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