Source:NetHack 1.4f/rip.c

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