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 center(int, char *);
9 extern const char * const killed_by_prefix
[]; /* from topten.c */
11 #if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS) || defined(X11_GRAPHICS) || defined(GEM_GRAPHICS) || defined(MSWIN_GRAPHICS) || defined(GTK_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 */
39 " | 1001 |", /* Real year of death */
41 " _________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______",
44 #define STONE_LINE_CENT 28 /* char[] element of center of stone face */
45 #else /* NH320_DEDICATION */
46 /* NetHack 3.2.x displayed a dual tombstone as a tribute to Izchak. */
47 static const char *rip_txt
[] = {
48 " ---------- ----------",
50 " / REST \\ / This \\",
51 " / IN \\ / release of \\",
52 " / PEACE \\ / NetHack is \\",
53 " / \\ / dedicated to \\",
54 " | | | the memory of |",
56 " | | | Izchak Miller |",
57 " | | | 1935 - 1994 |",
63 " * | * * * | * * | * * * | *",
64 " _____)/\\|\\__//(\\/(/\\)/\\//\\/|_)________)/|\\\\_/_/(\\/(/\\)/\\/\\/|_)____",
67 #define STONE_LINE_CENT 19 /* char[] element of center of stone face */
68 #endif /* NH320_DEDICATION */
69 #define STONE_LINE_LEN 18 /* # chars that fit on one line
72 #define NAME_LINE 6 /* *char[] line # for player name */
73 #define GOLD_LINE 7 /* *char[] line # for amount of gold */
74 #define DEATH_LINE 8 /* *char[] line # for death description */
75 /* "killed by a hallucinogen-distorted ravenous bugblatter beast of traal, while helpless" --Amy */
76 #define YEAR_LINE 14 /* *char[] line # for year */
85 register char *ip
,*op
;
87 op
= &rip
[line
][STONE_LINE_CENT
- ((strlen(text
)+1)>>1)];
88 while(*ip
) *op
++ = *ip
++;
93 genl_outrip(tmpwin
, how
)
103 rip
= dp
= (char **) alloc(sizeof(rip_txt
));
104 for (x
= 0; rip_txt
[x
]; x
++) {
105 dp
[x
] = (char *) alloc((unsigned int)(strlen(rip_txt
[x
]) + 1));
106 strcpy(dp
[x
], rip_txt
[x
]);
110 /* Put name on stone */
111 sprintf(buf
, "%s", playeraliasname
);
112 buf
[STONE_LINE_LEN
] = 0;
113 center(NAME_LINE
, buf
);
117 sprintf(buf
, "%ld Au", u
.ugold
);
119 sprintf(buf
, "%ld Au", done_money
);
121 buf
[STONE_LINE_LEN
] = 0; /* It could be a *lot* of gold :-) */
122 center(GOLD_LINE
, buf
);
124 /* Put together death description */
125 switch (killer_format
) {
126 default: impossible("bad killer format?");
129 strcpy(buf
, "instantly ");
130 strcat(buf
, killed_by_prefix
[how
]);
132 else if (Quick_Death
) {
133 strcpy(buf
, "quickly ");
134 strcat(buf
, killed_by_prefix
[how
]);
135 } else strcpy(buf
, killed_by_prefix
[how
]);
136 strcat(buf
, an(killer
));
140 strcpy(buf
, "instantly ");
141 strcat(buf
, killed_by_prefix
[how
]);
143 else if (Quick_Death
) {
144 strcpy(buf
, "quickly ");
145 strcat(buf
, killed_by_prefix
[how
]);
146 } else strcpy(buf
, killed_by_prefix
[how
]);
149 case NO_KILLER_PREFIX
:
154 /* Put death type on stone */
155 for (line
=DEATH_LINE
, dpx
= buf
; line
<YEAR_LINE
; line
++) {
159 if ( (i0
=strlen(dpx
)) > STONE_LINE_LEN
) {
160 for(i
= STONE_LINE_LEN
;
161 ((i0
> STONE_LINE_LEN
) && i
); i
--)
162 if(dpx
[i
] == ' ') i0
= i
;
163 if(!i
) i0
= STONE_LINE_LEN
;
168 if (tmpchar
!= ' ') {
171 } else dpx
= &dpx
[i0
+1];
174 /* Put year on stone */
175 sprintf(buf
, "%4d", getyear());
176 center(YEAR_LINE
, buf
);
178 putstr(tmpwin
, 0, "");
180 putstr(tmpwin
, 0, *dp
);
182 putstr(tmpwin
, 0, "");
183 putstr(tmpwin
, 0, "");
185 for (x
= 0; rip_txt
[x
]; x
++) {
186 free((void *)rip
[x
]);
192 #endif /* TEXT_TOMBSTONE */