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.3 2005/05/22 03:37:05 y0netan1 Exp $ */ 5 6 #include <stdio.h> 7 #include "hack.h" 8 9 static void center(int , const char *); 10 extern char plname[]; 11 12 static char rip[][60] = { 13 " ----------", 14 " / \\", 15 " / REST \\", 16 " / IN \\", 17 " / PEACE \\", 18 " / \\", 19 " | |", 20 " | |", 21 " | |", 22 " | |", 23 " | |", 24 " | 1001 |", 25 " *| * * * | *", 26 " _________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______\n", 27 }; 28 static const int n_rips = sizeof(rip) / sizeof(rip[0]); 29 30 outrip(){ 31 char *dpx; 32 char buf[BUFSZ]; 33 int i, 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, i = 0; i < n_rips; y++, i++){ 61 x = 0; 62 dpx = rip[i]; 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 static void 79 center(int line, const char *text) 80 { 81 const char *ip = text; 82 char *op; 83 84 op = &rip[line][28 - ((strlen(text)+1)/2)]; 85 while(*ip) *op++ = *ip++; 86 } 87