Source:NetHack 3.0.0/rip.c

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

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

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