Source:NetHack 2.3e/rip.c

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to rip.c from the source code of NetHack 2.3e.

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

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

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