1 /* SCCS Id: @(#)rip.c 3.4 2003/01/08 */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
7 STATIC_DCL void FDECL(center, (int, char *));
9 extern const char * const killed_by_prefix[]; /* from topten.c */
11 #if defined(TTY_GRAPHICS) || defined(X11_GRAPHICS) || defined(GEM_GRAPHICS) || defined(MSWIN_GRAPHICS)
12 # define TEXT_TOMBSTONE
14 #if defined(mac) || defined(__BEOS__) || defined(WIN32_GRAPHICS)
15 # ifndef TEXT_TOMBSTONE
16 # define TEXT_TOMBSTONE
22 #ifndef NH320_DEDICATION
23 /* A normal tombstone for end of game display. */
24 static const char *rip_txt[] = {
31 " | |", /* Name of player */
32 " | |", /* Amount of $ */
33 " | |", /* Type of death */
37 " | 1001 |", /* Real year of death */
39 " _________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______",
42 #define STONE_LINE_CENT 28 /* char[] element of center of stone face */
43 #else /* NH320_DEDICATION */
44 /* NetHack 3.2.x displayed a dual tombstone as a tribute to Izchak. */
45 static const char *rip_txt[] = {
46 " ---------- ----------",
48 " / REST \\ / This \\",
49 " / IN \\ / release of \\",
50 " / PEACE \\ / NetHack is \\",
51 " / \\ / dedicated to \\",
52 " | | | the memory of |",
54 " | | | Izchak Miller |",
55 " | | | 1935 - 1994 |",
59 " * | * * * | * * | * * * | *",
60 " _____)/\\|\\__//(\\/(/\\)/\\//\\/|_)________)/|\\\\_/_/(\\/(/\\)/\\/\\/|_)____",
63 #define STONE_LINE_CENT 19 /* char[] element of center of stone face */
64 #endif /* NH320_DEDICATION */
65 #define STONE_LINE_LEN 16 /* # chars that fit on one line
68 #define NAME_LINE 6 /* *char[] line # for player name */
69 #define GOLD_LINE 7 /* *char[] line # for amount of gold */
70 #define DEATH_LINE 8 /* *char[] line # for death description */
71 #define YEAR_LINE 12 /* *char[] line # for year */
80 register char *ip,*op;
82 op = &rip[line][STONE_LINE_CENT - ((strlen(text)+1)>>1)];
83 while(*ip) *op++ = *ip++;
88 genl_outrip(tmpwin, how)
98 rip = dp = (char **) alloc(sizeof(rip_txt));
99 for (x = 0; rip_txt[x]; x++) {
100 dp[x] = (char *) alloc((unsigned int)(strlen(rip_txt[x]) + 1));
101 Strcpy(dp[x], rip_txt[x]);
105 /* Put name on stone */
106 Sprintf(buf, "%s", plname);
107 buf[STONE_LINE_LEN] = 0;
108 center(NAME_LINE, buf);
112 Sprintf(buf, "%ld Au", u.ugold);
114 Sprintf(buf, "%ld Au", done_money);
116 buf[STONE_LINE_LEN] = 0; /* It could be a *lot* of gold :-) */
117 center(GOLD_LINE, buf);
119 /* Put together death description */
120 switch (killer_format) {
121 default: impossible("bad killer format?");
123 Strcpy(buf, killed_by_prefix[how]);
124 Strcat(buf, an(killer));
127 Strcpy(buf, killed_by_prefix[how]);
130 case NO_KILLER_PREFIX:
135 /* Put death type on stone */
136 for (line=DEATH_LINE, dpx = buf; line<YEAR_LINE; line++) {
140 if ( (i0=strlen(dpx)) > STONE_LINE_LEN) {
141 for(i = STONE_LINE_LEN;
142 ((i0 > STONE_LINE_LEN) && i); i--)
143 if(dpx[i] == ' ') i0 = i;
144 if(!i) i0 = STONE_LINE_LEN;
149 if (tmpchar != ' ') {
152 } else dpx= &dpx[i0+1];
155 /* Put year on stone */
156 Sprintf(buf, "%4d", getyear());
157 center(YEAR_LINE, buf);
159 putstr(tmpwin, 0, "");
161 putstr(tmpwin, 0, *dp);
163 putstr(tmpwin, 0, "");
164 putstr(tmpwin, 0, "");
166 for (x = 0; rip_txt[x]; x++) {
167 free((genericptr_t)rip[x]);
169 free((genericptr_t)rip);
173 #endif /* TEXT_TOMBSTONE */