1 /* NetHack 3.6 rip.c $NHDT-Date: 1488788514 2017/03/06 08:21:54 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.23 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Robert Patrick Rankin, 2017. */
4 /* NetHack may be freely redistributed. See license for details. */
6 /* JNetHack Copyright */
7 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
8 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2018 */
9 /* JNetHack may be freely redistributed. See license for details. */
13 STATIC_DCL void FDECL(center, (int, char *));
15 #if defined(TTY_GRAPHICS) || defined(X11_GRAPHICS) || defined(GEM_GRAPHICS) \
16 || defined(MSWIN_GRAPHICS) || defined(DUMPLOG)
17 #define TEXT_TOMBSTONE
19 #if defined(mac) || defined(__BEOS__) || defined(WIN32_GRAPHICS)
20 #ifndef TEXT_TOMBSTONE
21 #define TEXT_TOMBSTONE
27 #ifndef NH320_DEDICATION
28 /* A normal tombstone for end of game display. */
29 static const char *rip_txt[] = {
36 " | |", /* Name of player */
37 " | |", /* Amount of $ */
38 " | |", /* Type of death */
42 " | 1001 |", /* Real year of death */
44 " _________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______", 0
46 #define STONE_LINE_CENT 28 /* char[] element of center of stone face */
47 #else /* NH320_DEDICATION */
48 /* NetHack 3.2.x displayed a dual tombstone as a tribute to Izchak. */
49 static const char *rip_txt[] = {
50 " ---------- ----------",
52 " / REST \\ / This \\",
53 " / IN \\ / release of \\",
54 " / PEACE \\ / NetHack is \\",
55 " / \\ / dedicated to \\",
56 " | | | the memory of |",
58 " | | | Izchak Miller |",
59 " | | | 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 \
70 16 /* # chars that fit on one line \
71 * (note 1 ' ' border) \
73 #define NAME_LINE 6 /* *char[] line # for player name */
74 #define GOLD_LINE 7 /* *char[] line # for amount of gold */
75 #define DEATH_LINE 8 /* *char[] line # for death description */
76 #define YEAR_LINE 12 /* *char[] line # for year */
85 register char *ip, *op;
87 op = &rip[line][STONE_LINE_CENT - ((strlen(text) + 1) >> 1)];
93 genl_outrip(tmpwin, how, when)
105 rip = dp = (char **) alloc(sizeof(rip_txt));
106 for (x = 0; rip_txt[x]; ++x)
107 dp[x] = dupstr(rip_txt[x]);
110 /* Put name on stone */
111 Sprintf(buf, "%s", plname);
112 buf[STONE_LINE_LEN] = 0;
113 center(NAME_LINE, buf);
116 Sprintf(buf, "%ld Au", done_money);
117 buf[STONE_LINE_LEN] = 0; /* It could be a *lot* of gold :-) */
118 center(GOLD_LINE, buf);
120 /* Put together death description */
121 formatkiller(buf, sizeof buf, how, FALSE);
123 /* Put death type on stone */
124 for (line = DEATH_LINE, dpx = buf; line < YEAR_LINE; line++) {
131 if ((i0 = strlen(dpx)) <= STONE_LINE_LEN)
132 jstone_line = STONE_LINE_LEN;
133 else if (i0 / 2 <= STONE_LINE_LEN )
134 jstone_line = ((i0 + 3) / 4) * 2;
135 else if (i0 / 3 <= STONE_LINE_LEN )
136 jstone_line = ((i0 + 5) / 6) * 2;
138 jstone_line = ((i0 + 7) / 8) * 2;
141 if ((i0 = strlen(dpx)) > STONE_LINE_LEN) {
142 for (i = STONE_LINE_LEN; ((i0 > STONE_LINE_LEN) && i); i--)
151 while(i0 < jstone_line){
152 uc = (unsigned char *)(dpx + i0);
164 if (tmpchar != ' ') {
171 /* Put year on stone */
172 year = yyyymmdd(when) / 10000L;
173 Sprintf(buf, "%4ld", year);
174 center(YEAR_LINE, buf);
178 dump_forward_putstr(0, 0, "Game over:", TRUE);
181 putstr(tmpwin, 0, "");
184 putstr(tmpwin, 0, *dp);
186 putstr(tmpwin, 0, "");
190 putstr(tmpwin, 0, "");
192 for (x = 0; rip_txt[x]; x++) {
193 free((genericptr_t) rip[x]);
195 free((genericptr_t) rip);
199 #endif /* TEXT_TOMBSTONE */