1
|
1 /* $Id: death.c,v 1.1.1.1 1997/12/06 05:41:28 darius Exp $ */
|
|
2
|
|
3 /*
|
|
4 * death.c
|
|
5 */
|
|
6 #include "copyright.h"
|
|
7
|
|
8 #include <stdio.h>
|
|
9 #include <signal.h>
|
|
10 #include <setjmp.h>
|
|
11 #include <sys/types.h>
|
|
12 #ifdef hpux
|
|
13 #include <time.h>
|
|
14 #else /* hpux */
|
|
15 #include <sys/time.h>
|
|
16 #endif /* hpux */
|
|
17 #include <string.h>
|
|
18 #include "Wlib.h"
|
|
19 #include "defs.h"
|
|
20 #include "struct.h"
|
|
21 #include "data.h"
|
|
22 #include "proto.h"
|
|
23 #include "gameconf.h"
|
|
24
|
|
25 extern jmp_buf env;
|
|
26
|
|
27 static char *teamstring[4] = { /* "", */ "and the Federation",
|
|
28 "and the Romulan Empire", /* "", */
|
|
29 "and the Klingon Empire", /* "", "", "", */
|
|
30 "and the Orions"};
|
|
31
|
|
32 void
|
|
33 redraw_death_messages()
|
|
34 {
|
|
35 char buf[256];
|
|
36 int len;
|
|
37
|
|
38 switch (me->p_whydead) {
|
|
39 case KNOREASON:
|
|
40 strcpy(buf, "You were not killed");
|
|
41 break;
|
|
42 case KQUIT:
|
|
43 strcpy(buf, "You have self-destructed.");
|
|
44 break;
|
|
45 case KTORP:
|
|
46 sprintf(buf, "You were killed by a photon torpedo from %s (%c%c).",
|
|
47 players[me->p_whodead].p_name,
|
|
48 teaminfo[players[me->p_whodead].p_teami].letter,
|
|
49 shipnos[me->p_whodead]);
|
|
50 break;
|
|
51 case KPLASMA:
|
|
52 sprintf(buf, "You were killed by a plasma torpedo from %s (%c%c)",
|
|
53 players[me->p_whodead].p_name,
|
|
54 teaminfo[players[me->p_whodead].p_teami].letter,
|
|
55 shipnos[me->p_whodead]);
|
|
56 break;
|
|
57 case KPHASER:
|
|
58 sprintf(buf, "You were killed by a phaser shot from %s (%c%c)",
|
|
59 players[me->p_whodead].p_name,
|
|
60 teaminfo[players[me->p_whodead].p_teami].letter,
|
|
61 shipnos[me->p_whodead]);
|
|
62 break;
|
|
63 case KPLANET:
|
|
64 sprintf(buf, "You were killed by planetary fire from %s (%c)",
|
|
65 planets[me->p_whodead].pl_name,
|
|
66 teaminfo[mask_to_idx(planets[me->p_whodead].pl_owner)].letter);
|
|
67 break;
|
|
68 case KSHIP:
|
|
69 sprintf(buf, "You were killed by an exploding ship formerly owned by %s (%c%c)",
|
|
70 players[me->p_whodead].p_name,
|
|
71 teaminfo[players[me->p_whodead].p_teami].letter,
|
|
72 shipnos[me->p_whodead]);
|
|
73 break;
|
|
74 case KDAEMON:
|
|
75 strcpy(buf, "You were killed by a dying daemon.");
|
|
76 break;
|
|
77 case KWINNER:
|
|
78 if (me->p_whodead >= 0)
|
|
79 sprintf(buf, "Galaxy has been conquered by %s (%c%c) %s",
|
|
80 players[me->p_whodead].p_name,
|
|
81 teaminfo[players[me->p_whodead].p_teami].letter,
|
|
82 shipnos[players[me->p_whodead].p_no],
|
|
83 teamstring[players[me->p_whodead].p_teami]);
|
|
84 else
|
|
85 sprintf(buf, "Galaxy has been conquered by %s",
|
|
86 teamstring[-1 - me->p_whodead]);
|
|
87 break;
|
|
88 case KGHOST:
|
|
89 sprintf(buf, "You were ghostbusted.");
|
|
90 break;
|
|
91 case KGENOCIDE:
|
|
92 sprintf(buf, "Your team was genocided by %s (%c%c) %s.",
|
|
93 players[me->p_whodead].p_name,
|
|
94 teaminfo[players[me->p_whodead].p_teami].letter,
|
|
95 shipnos[me->p_whodead],
|
|
96 teamstring[players[me->p_whodead].p_teami]);
|
|
97 break;
|
|
98 case KPROVIDENCE:
|
|
99 sprintf(buf, "You were removed from existence by divine mercy.");
|
|
100 break;
|
|
101 case KTOURNEND:
|
|
102 strcpy(buf, "The tournament has ended.");
|
|
103 break;
|
|
104 case KOVER:
|
|
105 strcpy(buf, "The game has gone into overtime!");
|
|
106 break;
|
|
107 case KTOURNSTART:
|
|
108 strcpy(buf, "The tournament has begun.");
|
|
109 break;
|
|
110 case KBADBIN:
|
|
111 sprintf(buf, "Your netrek executable didn't verify correctly.");
|
|
112 W_WriteText(mapw, 50, 70, textColor, buf, strlen(buf), W_RegularFont);
|
|
113 sprintf(buf, "(could be an old copy or illegal cyborg)");
|
|
114 W_WriteText(mapw, 50, 110, W_Yellow, buf, strlen(buf), W_RegularFont);
|
|
115 *buf = 0;
|
|
116 break;
|
|
117 case KMISSILE:
|
|
118 sprintf(buf, "You were killed by a missile from %s (%c%c).",
|
|
119 players[me->p_whodead].p_name,
|
|
120 teaminfo[players[me->p_whodead].p_teami].letter,
|
|
121 shipnos[me->p_whodead]);
|
|
122 break;
|
|
123
|
|
124 case KASTEROID:
|
|
125 strcpy(buf, "You were smashed to bits by an asteroid.");
|
|
126 W_WriteText(mapw, 50, 70, textColor, buf, strlen(buf), W_RegularFont );
|
|
127 break;
|
|
128
|
|
129 default:
|
|
130 sprintf(buf, "You were killed by something unknown to this game (%d).",
|
|
131 me->p_whydead);
|
|
132 break;
|
|
133 }
|
|
134 len = strlen(buf);
|
|
135 W_WriteText(mapw, 250 - len * W_Textwidth / 2, 11 * W_Textheight, W_Yellow, buf,
|
|
136 len, W_RegularFont);
|
|
137 /* First we check for promotions: */
|
|
138 if (promoted) {
|
|
139 if (!paradise) {
|
|
140 sprintf(buf, "Congratulations! You have been promoted to %s",
|
|
141 ranks[mystats->st_rank].name);
|
|
142 W_WriteText(mapw, 150, 23 * W_Textheight, W_Yellow, buf, strlen(buf), W_BoldFont);
|
|
143 } else {
|
|
144 sprintf(buf, "Congratulations! You have been promoted to %s",
|
|
145 ranks2[mystats->st_rank].name);
|
|
146 W_WriteText(mapw, 150, 23 * W_Textheight, W_Yellow, buf, strlen(buf), W_BoldFont);
|
|
147 }
|
|
148 promoted = 0;
|
|
149 }
|
|
150 }
|
|
151
|
|
152 void
|
|
153 death()
|
|
154 {
|
|
155 W_Event event;
|
|
156
|
|
157 #ifdef AUTOKEY
|
|
158 if (autoKey)
|
|
159 autoKeyAllOff();
|
|
160 #endif /* AUTOKEY */
|
|
161
|
|
162
|
|
163 W_ClearWindow(mapw);
|
|
164 W_ClearWindow(iconWin);
|
|
165 if (oldalert != PFGREEN) {
|
|
166 if (extraBorder)
|
|
167 W_ChangeBorder(w, gColor);
|
|
168 W_ChangeBorder(baseWin, gColor);
|
|
169 oldalert = PFGREEN;
|
|
170 if(autoUnZoom>0)
|
|
171 blk_zoom = 0;
|
|
172 }
|
|
173 if (W_IsMapped(statwin)) {
|
|
174 W_UnmapWindow(statwin);
|
|
175 showStats = 1;
|
|
176 } else {
|
|
177 showStats = 0;
|
|
178 }
|
|
179 if (infomapped)
|
|
180 destroyInfo();
|
|
181 W_UnmapWindow(planetw);
|
|
182 W_UnmapWindow(planetw2);
|
|
183 W_UnmapWindow(rankw);
|
|
184 W_UnmapWindow(war);
|
|
185 if (optionWin)
|
|
186 optiondone();
|
|
187
|
|
188 redraw_death_messages();
|
|
189
|
|
190 while (W_EventsPending()) {
|
|
191 W_NextEvent(&event);
|
|
192 }
|
|
193 longjmp(env, 0);
|
|
194 }
|