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