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