Merge from vendor branch OPENSSL:
[games.git] / games / hack / hack.rip.c
CommitLineData
984263bc
MD
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 $ */
c7106d58 4/* $DragonFly: src/games/hack/hack.rip.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */
984263bc 5
984263bc
MD
6#include "hack.h"
7
c7106d58 8static void center(int, const char *);
984263bc 9
fd2d026f 10static char rip[][60] = {
984263bc
MD
11" ----------",
12" / \\",
13" / REST \\",
14" / IN \\",
15" / PEACE \\",
16" / \\",
17" | |",
18" | |",
19" | |",
20" | |",
21" | |",
22" | 1001 |",
23" *| * * * | *",
24" _________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______\n",
984263bc 25};
fd2d026f 26static const int n_rips = sizeof(rip) / sizeof(rip[0]);
984263bc 27
c7106d58
PA
28void
29outrip(void)
30{
984263bc
MD
31 char *dpx;
32 char buf[BUFSZ];
c7106d58 33 int j, x, y;
984263bc
MD
34
35 cls();
c7106d58 36 strcpy(buf, plname);
984263bc
MD
37 buf[16] = 0;
38 center(6, buf);
c7106d58 39 sprintf(buf, "%ld AU", u.ugold);
984263bc 40 center(7, buf);
c7106d58 41 sprintf(buf, "killed by%s",
984263bc
MD
42 !strncmp(killer, "the ", 4) ? "" :
43 !strcmp(killer, "starvation") ? "" :
44 index(vowels, *killer) ? " an" : " a");
45 center(8, buf);
c7106d58 46 strcpy(buf, killer);
984263bc
MD
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);
c7106d58 58 sprintf(buf, "%4d", getyear());
984263bc 59 center(11, buf);
c7106d58 60 for(y = 8, j = 0; j < n_rips; y++, j++){
984263bc 61 x = 0;
c7106d58 62 dpx = rip[j];
984263bc
MD
63 while(dpx[x]) {
64 while(dpx[x] == ' ') x++;
65 curs(x,y);
66 while(dpx[x] && dpx[x] != ' '){
984263bc
MD
67 if(done_stopprint)
68 return;
69 curx++;
c7106d58 70 putchar(dpx[x++]);
984263bc
MD
71 }
72 }
73 }
74 getret();
75}
76
fd2d026f
YT
77static void
78center(int line, const char *text)
79{
80 const char *ip = text;
81 char *op;
82
984263bc
MD
83 op = &rip[line][28 - ((strlen(text)+1)/2)];
84 while(*ip) *op++ = *ip++;
85}