xref: /netbsd-src/games/hack/hack.rip.c (revision 811e6386f8c5e4a3521c7003da29ec8673e344fa)
1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.rip.c - version 1.0.2 */
3 
4 #include <stdio.h>
5 #include "hack.h"
6 
7 extern char plname[];
8 
9 static char *riptop= "\
10                        ----------\n\
11                       /          \\\n\
12                      /    REST    \\\n\
13                     /      IN      \\\n\
14                    /     PEACE      \\\n\
15                   /                  \\";
16 
17 static char *ripmid = "                  | %*s%*s |\n";
18 
19 static char *ripbot = "\
20                  *|     *  *  *      | *\n\
21         _________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______";
22 
23 outrip(){
24 	char buf[BUFSZ];
25 
26 	cls();
27 	curs(1, 8);
28 	puts(riptop);
29 	(void) strcpy(buf, plname);
30 	buf[16] = 0;
31 	center(6, buf);
32 	(void) sprintf(buf, "%ld AU", u.ugold);
33 	center(7, buf);
34 	(void) sprintf(buf, "killed by%s",
35 		!strncmp(killer, "the ", 4) ? "" :
36 		!strcmp(killer, "starvation") ? "" :
37 		index(vowels, *killer) ? " an" : " a");
38 	center(8, buf);
39 	(void) strcpy(buf, killer);
40  	{
41 		register int i1;
42 		if((i1 = strlen(buf)) > 16) {
43 			register int i,i0;
44 			i0 = i1 = 0;
45 			for(i = 0; i <= 16; i++)
46 				if(buf[i] == ' ') i0 = i, i1 = i+1;
47 			if(!i0) i0 = i1 = 16;
48 			buf[i1 + 16] = 0;
49 			buf[i0] = 0;
50 		}
51 		center(9, buf);
52 		center(10, buf+i1);
53 	}
54 	(void) sprintf(buf, "%4d", getyear());
55 	center(11, buf);
56 	puts(ripbot);
57 	getret();
58 }
59 
60 center(line, text) int line; char *text; {
61 	register int n = strlen(text)/2;
62 	printf(ripmid, 8+n, text, 8-n, "");
63 }
64 
65