1 /* NetHack 3.6 rip.c $NHDT-Date: 1436753522 2015/07/13 02:12:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 /* JNetHack Copyright */
6 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
7 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016 */
8 /* JNetHack may be freely redistributed. See license for details. */
12 STATIC_DCL void FDECL(center, (int, char *));
14 #if defined(TTY_GRAPHICS) || defined(X11_GRAPHICS) || defined(GEM_GRAPHICS) \
15 || defined(MSWIN_GRAPHICS)
16 #define TEXT_TOMBSTONE
18 #if defined(mac) || defined(__BEOS__) || defined(WIN32_GRAPHICS)
19 #ifndef TEXT_TOMBSTONE
20 #define TEXT_TOMBSTONE
26 #ifndef NH320_DEDICATION
27 /* A normal tombstone for end of game display. */
28 static const char *rip_txt[] = {
35 " | |", /* Name of player */
36 " | |", /* Amount of $ */
37 " | |", /* Type of death */
41 " | 1001 |", /* Real year of death */
43 " _________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______", 0
45 #define STONE_LINE_CENT 28 /* char[] element of center of stone face */
46 #else /* NH320_DEDICATION */
47 /* NetHack 3.2.x displayed a dual tombstone as a tribute to Izchak. */
48 static const char *rip_txt[] = {
49 " ---------- ----------",
51 " / REST \\ / This \\",
52 " / IN \\ / release of \\",
53 " / PEACE \\ / NetHack is \\",
54 " / \\ / dedicated to \\",
55 " | | | the memory of |",
57 " | | | Izchak Miller |",
58 " | | | 1935 - 1994 |",
62 " * | * * * | * * | * * * | *",
63 " _____)/\\|\\__//(\\/(/\\)/\\//\\/|_)________)/|\\\\_/_/(\\/(/\\)/\\/\\/|_)____",
66 #define STONE_LINE_CENT 19 /* char[] element of center of stone face */
67 #endif /* NH320_DEDICATION */
68 #define STONE_LINE_LEN \
69 16 /* # chars that fit on one line \
70 * (note 1 ' ' border) \
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 #define YEAR_LINE 12 /* *char[] line # for year */
84 register char *ip, *op;
86 op = &rip[line][STONE_LINE_CENT - ((strlen(text) + 1) >> 1)];
92 genl_outrip(tmpwin, how, when)
104 rip = dp = (char **) alloc(sizeof(rip_txt));
105 for (x = 0; rip_txt[x]; ++x)
106 dp[x] = dupstr(rip_txt[x]);
109 /* Put name on stone */
110 Sprintf(buf, "%s", plname);
111 buf[STONE_LINE_LEN] = 0;
112 center(NAME_LINE, buf);
115 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 formatkiller(buf, sizeof buf, how);
122 /* Put death type on stone */
123 for (line = DEATH_LINE, dpx = buf; line < YEAR_LINE; line++) {
130 if ((i0 = strlen(dpx)) <= STONE_LINE_LEN)
131 jstone_line = STONE_LINE_LEN;
132 else if (i0 / 2 <= STONE_LINE_LEN )
133 jstone_line = ((i0 + 3) / 4) * 2;
134 else if (i0 / 3 <= STONE_LINE_LEN )
135 jstone_line = ((i0 + 5) / 6) * 2;
137 jstone_line = ((i0 + 7) / 8) * 2;
140 if ((i0 = strlen(dpx)) > STONE_LINE_LEN) {
141 for (i = STONE_LINE_LEN; ((i0 > STONE_LINE_LEN) && i); i--)
150 while(i0 < jstone_line){
151 uc = (unsigned char *)(dpx + i0);
163 if (tmpchar != ' ') {
170 /* Put year on stone */
171 year = yyyymmdd(when) / 10000L;
172 Sprintf(buf, "%4ld", year);
173 center(YEAR_LINE, buf);
175 putstr(tmpwin, 0, "");
177 putstr(tmpwin, 0, *dp);
179 putstr(tmpwin, 0, "");
180 putstr(tmpwin, 0, "");
182 for (x = 0; rip_txt[x]; x++) {
183 free((genericptr_t) rip[x]);
185 free((genericptr_t) rip);
189 #endif /* TEXT_TOMBSTONE */