Source:NetHack 1.3d/rip.c

From NetHackWiki
Revision as of 00:20, 4 March 2008 by Kernigh bot (talk | contribs) (NetHack 1.3d/rip.c moved to Source:NetHack 1.3d/rip.c: Robot: moved page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Below is the full text to rip.c from the source code of NetHack 1.3d. To link to a particular line, write [[NetHack 1.3d/rip.c#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

Screenshots and source code from Hack are used under the CWI license.

1.    /*	SCCS Id: @(#)rip.c	1.3	87/07/14
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* hack.rip.c - version 1.0.2 */
4.    
5.    #include <stdio.h>
6.    #include "hack.h"
7.    
8.    extern char plname[];
9.    
10.   static char *rip[] = {
11.   "                       ----------",
12.   "                      /          \\",
13.   "                     /    REST    \\",
14.   "                    /      IN      \\",
15.   "                   /     PEACE      \\",
16.   "                  /                  \\",
17.   "                  |                  |",
18.   "                  |                  |",
19.   "                  |                  |",
20.   "                  |                  |",
21.   "                  |                  |",
22.   "                  |       1001       |",
23.   "                 *|     *  *  *      | *",
24.   "        _________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______\n",
25.   0
26.   };
27.   
28.   outrip(){
29.   	register char **dp = rip;
30.   	register char *dpx;
31.   	char buf[BUFSZ];
32.   	register x,y;
33.   
34.   	cls();
35.   	(void) strcpy(buf, plname);
36.   	buf[16] = 0;
37.   	center(6, buf);
38.   	(void) sprintf(buf, "%ld AU", u.ugold);
39.   	center(7, buf);
40.   	(void) sprintf(buf, "killed by%s",
41.   		!strncmp(killer, "the ", 4) ? "" :
42.   		!strcmp(killer, "starvation") ? "" :
43.   		index(vowels, *killer) ? " an" : " a");
44.   	center(8, buf);
45.   	(void) strcpy(buf, killer);
46.   	if(strlen(buf) > 16) {
47.   	    register int i,i0,i1;
48.   		i0 = i1 = 0;
49.   		for(i = 0; i <= 16; i++)
50.   			if(buf[i] == ' ') i0 = i, i1 = i+1;
51.   		if(!i0) i0 = i1 = 16;
52.   		buf[i1 + 16] = 0;
53.   		center(10, buf+i1);
54.   		buf[i0] = 0;
55.   	}
56.   	center(9, buf);
57.   	(void) sprintf(buf, "%4d", getyear());
58.   	center(11, buf);
59.   	for(y=8; *dp; y++,dp++){
60.   		x = 0;
61.   		dpx = *dp;
62.   		while(dpx[x]) {
63.   			while(dpx[x] == ' ') x++;
64.   			curs(x,y);
65.   			while(dpx[x] && dpx[x] != ' '){
66.   				extern int done_stopprint;
67.   				if(done_stopprint)
68.   					return;
69.   				curx++;
70.   				(void) putchar(dpx[x++]);
71.   			}
72.   		}
73.   	}
74.   	getret();
75.   }
76.   
77.   center(line, text) int line; char *text; {
78.   register char *ip,*op;
79.   	ip = text;
80.   	op = &rip[line][28 - ((strlen(text)+1)/2)];
81.   	while(*ip) *op++ = *ip++;
82.   }