]> icculus.org git repositories - taylor/freespace2.git/blob - src/popup/popupdead.cpp
The Great Newline Fix
[taylor/freespace2.git] / src / popup / popupdead.cpp
1 /*
2  * $Logfile: /Freespace2/code/Popup/PopupDead.cpp $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * C module for the death popup
8  *
9  * $Log$
10  * Revision 1.2  2002/05/07 03:16:51  theoddone33
11  * The Great Newline Fix
12  *
13  * Revision 1.1.1.1  2002/05/03 03:28:10  root
14  * Initial import.
15  *
16  * 
17  * 14    9/14/99 4:35a Dave
18  * Argh. Added all kinds of code to handle potential crashes in debriefing
19  * code.
20  * 
21  * 13    9/14/99 12:51a Jefff
22  * sm3-09 no skip hack.
23  * 
24  * 12    9/11/99 1:09a Mikek
25  * Removed semi-bogus Int3() in popupdead code which seemed to get tripped
26  * by the supernova.
27  * 
28  * 11    9/10/99 6:49p Jefff
29  * changed skip popup to normal type popup
30  * 
31  * 10    9/09/99 7:17p Jefff
32  * 
33  * 9     9/07/99 4:44p Jefff
34  * fixed double counting of mission failures
35  * 
36  * 8     9/07/99 1:54p Jefff
37  * skip mission cleanup
38  * 
39  * 7     9/06/99 9:46p Jefff
40  * skip mission support
41  * 
42  * 6     8/11/99 5:47p Jefff
43  * fixed button bitmap loading
44  * 
45  * 5     7/24/99 1:54p Dave
46  * Hud text flash gauge. Reworked dead popup to use 4 buttons in red-alert
47  * missions.
48  * 
49  * 4     6/01/99 3:52p Dave
50  * View footage screen. Fixed xstrings to not display the & symbol. Popup,
51  * dead popup, pxo find player popup, pxo private room popup.
52  * 
53  * 3     10/13/98 9:29a Dave
54  * Started neatening up freespace.h. Many variables renamed and
55  * reorganized. Added AlphaColors.[h,cpp]
56  * 
57  * 2     10/07/98 10:53a Dave
58  * Initial checkin.
59  * 
60  * 1     10/07/98 10:51a Dave
61  * 
62  * 11    6/09/98 10:31a Hoffoss
63  * Created index numbers for all xstr() references.  Any new xstr() stuff
64  * added from here on out should be added to the end if the list.  The
65  * current list count can be found in FreeSpace.cpp (search for
66  * XSTR_SIZE).
67  * 
68  * 10    5/17/98 1:43a Dave
69  * Eradicated chatbox problems. Remove speed match for observers. Put in
70  * help screens for PXO. Fix messaging and end mission privelges. Fixed
71  * team select screen bugs. Misc UI fixes.
72  * 
73  * 9     5/01/98 4:24p Lawrance
74  * Change "Main Hall" to "Flight Deck"
75  * 
76  * 8     4/22/98 4:59p Allender
77  * new multiplayer dead popup.  big changes to the comm menu system for
78  * team vs. team.  Start of debriefing stuff for team vs. team  Make form
79  * on my wing work with individual ships who have high priority orders
80  * 
81  * 7     3/12/98 4:02p Lawrance
82  * Cleanup how pause works, fix couple pause-related bugs.
83  * 
84  * 6     3/05/98 12:35p Lawrance
85  * Fix bug where two options could be highlighted at once.
86  * 
87  * 5     2/22/98 4:30p John
88  * More string externalization classification
89  * 
90  * 4     2/22/98 2:48p John
91  * More String Externalization Classification
92  * 
93  * 3     2/22/98 12:19p John
94  * Externalized some strings
95  * 
96  * 2     2/10/98 11:20p Lawrance
97  * Implement separate dead popup system
98  * 
99  * 1     2/10/98 6:02p Lawrance
100  *
101  * $NoKeywords: $
102  */
103
104
105 #define POPUPDEAD_NUM_CHOICES                           3               // normal
106 #define POPUPDEAD_NUM_CHOICES_RA                        4               // red alert
107 #define POPUPDEAD_NUM_CHOICES_SKIP              3               // skip mission menu
108
109 #define POPUPDEAD_NUM_CHOICES_MAX               4
110
111 #include "ui.h"
112 #include "key.h"
113 #include "mouse.h"
114 #include "freespace.h"
115 #include "gamesnd.h"
116 #include "keycontrol.h"
117 #include "player.h"
118 #include "multi.h"
119 #include "multiutil.h"
120 #include "popupdead.h"
121 #include "alphacolors.h"
122 #include "gamesequence.h"
123 #include "popup.h"
124
125 UI_WINDOW       Popupdead_window;
126 UI_BUTTON       Popupdead_buttons[POPUPDEAD_NUM_CHOICES_MAX];                           // actual lit buttons
127 UI_BUTTON       Popupdead_button_regions[POPUPDEAD_NUM_CHOICES_MAX];    // fake buttons used for mouse detection over text
128
129 int Popupdead_region_coords[GR_NUM_RESOLUTIONS][POPUPDEAD_NUM_CHOICES_MAX][4] =
130 {       
131         {       // GR_640
132                 {464, 389, 497, 403},           // upper right pixel of text, lower right pixel of button (for tiny popup)
133                 {464, 413, 497, 427},
134                 {464, 435, 497, 446},           
135                 {464, 457, 497, 466},
136         }, 
137         {       // GR_1024
138                 {745, 627, 809, 664},
139                 {745, 663, 809, 700},           // upper right pixel of text, lower right pixel of button (for tiny popup)
140                 {745, 699, 809, 736},           
141                 {745, 735, 809, 772},
142         }, 
143 };
144
145 int Popupdead_button_coords[GR_NUM_RESOLUTIONS][POPUPDEAD_NUM_CHOICES_MAX][2] =
146 {
147         {       // GR_640
148                 {478, 387},                                             // upper left pixel (tiny popup)
149                 {478, 410},
150                 {478, 432},
151                 {478, 455},
152         },
153         {       // GR_1024
154                 {760, 620},                                             // upper left pixel (tiny popup)
155                 {760, 656},
156                 {760, 692},
157                 {760, 728},
158         }
159 };
160
161 char *Popupdead_background_filename[GR_NUM_RESOLUTIONS] = {
162         "PopDeath",             // GR_640
163         "2_PopDeath"    // GR-1024
164 };
165
166 int Popupdead_background_coords[GR_NUM_RESOLUTIONS][2] = 
167 {
168         { // GR_640
169                 131, 363
170         },
171         { // GR_1024
172                 205, 581
173         }
174 };
175
176 char *Popupdead_button_filenames[GR_NUM_RESOLUTIONS][POPUPDEAD_NUM_CHOICES_MAX] = 
177 {
178         {       // GR_640
179                 "PopD_00",                              // first choice
180                 "PopD_01",                              // second choice
181                 "PopD_02",                              // third choice
182                 "PopD_03",                              // fourth choice
183         },
184         {       // GR_1024
185                 "2_PopD_00",                    // first choice
186                 "2_PopD_01",                    // second choice
187                 "2_PopD_02",                    // third choice
188                 "2_PopD_03",                    // fourth choice
189         }
190 };
191
192 int Popupdead_skip_message_y[GR_NUM_RESOLUTIONS] = { 
193                 96,     // GR_640
194                 160
195 };
196
197
198 static char *Popupdead_button_text[POPUPDEAD_NUM_CHOICES_MAX];
199
200 // multiplayer specifics to help with return values since they can vary
201 #define POPUPDEAD_OBS_ONLY                      1
202 #define POPUPDEAD_OBS_QUIT                      2
203 #define POPUPDEAD_RESPAWN_ONLY  3
204 #define POPUPDEAD_RESPAWN_QUIT  4
205
206 int Popupdead_default_choice;           // What the default choice is (ie activated when Enter pressed)
207 int Popupdead_active    =       0;                      // A dead popup is active
208 int Popupdead_choice;                           // Index for choice picked (-1 if none picked)
209 int Popupdead_num_choices;                      // number of buttons
210 int Popupdead_multi_type;                       // what kind of popup is active for muliplayer
211 int Popupdead_skip_active = 0;  // The skip-misison popup is active
212 int Popupdead_skip_already_shown = 0;
213
214 // Initialize the dead popup data
215 void popupdead_start()
216 {
217         int                     i;
218         UI_BUTTON       *b;
219
220         if ( Popupdead_active ) {
221                 // Int3();
222                 return;
223         }
224
225         // increment number of deaths
226         Player->failures_this_session++;
227
228
229         // create base window
230         Popupdead_window.create(Popupdead_background_coords[gr_screen.res][0], Popupdead_background_coords[gr_screen.res][1], 1, 1, 0);
231         Popupdead_window.set_foreground_bmap(Popupdead_background_filename[gr_screen.res]);
232
233         Popupdead_num_choices = 0;
234         Popupdead_multi_type = -1;
235
236         if ( Game_mode & GM_NORMAL ) {
237                 // also do a campaign check here?
238                 if (0) { //((Player->show_skip_popup) && (!Popupdead_skip_already_shown) && (Game_mode & GM_CAMPAIGN_MODE) && (Game_mode & GM_NORMAL) && (Player->failures_this_session >= PLAYER_MISSION_FAILURE_LIMIT)) {
239                         // init the special preliminary death popup that gives the skip option
240                         Popupdead_button_text[0] = XSTR( "Do Not Skip This Mission", 1473);
241                         Popupdead_button_text[1] = XSTR( "Advance To The Next Mission", 1474);
242                         Popupdead_button_text[2] = XSTR( "Don't Show Me This Again", 1475);
243                         Popupdead_num_choices = POPUPDEAD_NUM_CHOICES_SKIP;
244                         Popupdead_skip_active = 1;
245                 } else if(The_mission.red_alert) {
246                         // We can't staticly declare these because they are externalized
247                         Popupdead_button_text[0] = XSTR( "Quick Start Mission", 105);
248                         Popupdead_button_text[1] = XSTR( "Return To Flight Deck", 106);
249                         Popupdead_button_text[2] = XSTR( "Return To Briefing", 107);
250                         Popupdead_button_text[3] = XSTR( "Replay previous mission", 1432);
251                         Popupdead_num_choices = POPUPDEAD_NUM_CHOICES_RA;
252                 } else {
253                         Popupdead_button_text[0] = XSTR( "Quick Start Mission", 105);
254                         Popupdead_button_text[1] = XSTR( "Return To Flight Deck", 106);
255                         Popupdead_button_text[2] = XSTR( "Return To Briefing", 107);
256                         Popupdead_num_choices = POPUPDEAD_NUM_CHOICES;
257                 }
258         } else {
259                 // in multiplayer, we have different choices depending on respawn mode, etc.
260
261                 // if the player has run out of respawns and must either quit and become an observer
262                 if(Net_player->flags & NETINFO_FLAG_LIMBO){
263
264                         // the master should not be able to quit the game
265                         if( ((Net_player->flags & NETINFO_FLAG_AM_MASTER) && (multi_num_players() > 1)) || (Net_player->flags & NETINFO_FLAG_TEAM_CAPTAIN) ) {
266                                 Popupdead_button_text[0] = XSTR( "Observer Mode", 108);
267                                 Popupdead_num_choices = 1;
268                                 Popupdead_multi_type = POPUPDEAD_OBS_ONLY;
269                         } else {
270                                 Popupdead_button_text[0] = XSTR( "Observer Mode", 108);
271                                 Popupdead_button_text[1] = XSTR( "Return To Flight Deck", 106);
272                                 Popupdead_num_choices = 2;
273                                 Popupdead_multi_type = POPUPDEAD_OBS_QUIT;
274                         }
275                 } else {
276                         // the master of the game should not be allowed to quit
277                         if ( ((Net_player->flags & NETINFO_FLAG_AM_MASTER) && (multi_num_players() > 1)) || (Net_player->flags & NETINFO_FLAG_TEAM_CAPTAIN) ) {
278                                 Popupdead_button_text[0] = XSTR( "Respawn", 109);
279                                 Popupdead_num_choices = 1;
280                                 Popupdead_multi_type = POPUPDEAD_RESPAWN_ONLY;
281                         } else {
282                                 Popupdead_button_text[0] = XSTR( "Respawn", 109);
283                                 Popupdead_button_text[1] = XSTR( "Return To Flight Deck", 106);
284                                 Popupdead_num_choices = 2;
285                                 Popupdead_multi_type = POPUPDEAD_RESPAWN_QUIT;
286                         }
287                 }
288         }
289
290         // create buttons
291         for (i=0; i < Popupdead_num_choices; i++) {
292                 b = &Popupdead_buttons[i];
293                 b->create(&Popupdead_window, "", Popupdead_button_coords[gr_screen.res][i][0], Popupdead_button_coords[gr_screen.res][i][1], 30, 20, 0, 1);
294                 b->set_bmaps(Popupdead_button_filenames[gr_screen.res][i], 3, 0);
295                 b->set_highlight_action(common_play_highlight_sound);
296
297                 // create invisible buttons to detect mouse presses... can't use mask since button region is dynamically sized
298                 int lx, w, h;
299                 gr_get_string_size(&w, &h, Popupdead_button_text[i]);
300                 lx = Popupdead_region_coords[gr_screen.res][i][0] - w;
301                 b = &Popupdead_button_regions[i];       
302                 b->create(&Popupdead_window, "", lx, Popupdead_region_coords[gr_screen.res][i][1], Popupdead_region_coords[gr_screen.res][i][2]-lx, Popupdead_region_coords[gr_screen.res][i][3]-Popupdead_region_coords[gr_screen.res][i][1], 0, 1);
303                 b->hide();
304         }
305         
306         Popupdead_default_choice = 0;
307         Popupdead_choice = -1;
308         Popupdead_active = 1;
309 }
310
311 // maybe play a sound when key up/down is pressed to switch default choice
312 void popupdead_play_default_change_sound()
313 {
314         int i, mouse_over=0;
315         UI_BUTTON *br, *b;
316
317         // only play if mouse not currently highlighting a choice
318         for ( i = 0; i < Popupdead_num_choices; i++ ) {
319                 br = &Popupdead_button_regions[i];
320                 b = &Popupdead_buttons[i];
321                 if ( br->button_down() ) {
322                         mouse_over=1;
323                         break;
324                 }
325
326                 if ( br->button_hilighted() && !b->button_down() ) {
327                         mouse_over=1;
328                         break;
329                 }
330
331                 if ( b->button_hilighted() ) {
332                         mouse_over=1;
333                 }
334         }
335
336         if (!mouse_over) {
337                 gamesnd_play_iface(SND_USER_SELECT);
338         }
339 }
340
341 // do any key processing here
342 // exit:        -1              =>      nothing was done
343 //                      >=0     => a choice was selected
344 int popupdead_process_keys(int k)
345 {
346         int masked_k;
347
348         if ( k <= 0 ) {
349                 return -1;
350         }
351         
352         switch(k) {
353
354         case KEY_ENTER:
355                 return Popupdead_default_choice;        // select the current default choice
356                 break;
357
358         case KEY_ESC:
359                 if (Popupdead_skip_active) {
360                         return 0;                                                               // 0 mimics a "do not skip"
361                 } else {
362                         return 1;                                                               // do nothing here for now - 1 mimics a "return to flight deck"
363                 }
364                 break;
365
366         case KEY_DOWN:
367         case KEY_PAD2:
368         case KEY_TAB:
369                 popupdead_play_default_change_sound();
370                 Popupdead_default_choice++;
371                 if ( Popupdead_default_choice >= Popupdead_num_choices ) {
372                         Popupdead_default_choice=0;
373                 }
374                 break;
375
376         case KEY_UP:
377         case KEY_PAD8:
378         case KEY_SHIFTED+KEY_TAB:
379                 popupdead_play_default_change_sound();
380                 Popupdead_default_choice--;
381                 if ( Popupdead_default_choice < 0 ) {
382                         Popupdead_default_choice=Popupdead_num_choices-1;
383                 }
384                 break;
385
386         case KEY_PAUSE:
387                 game_process_pause_key();
388                 break;
389
390         default:
391                 break;
392         } // end switch
393
394         // read the dead key set
395         masked_k = k & ~KEY_CTRLED;     // take out CTRL modifier only
396         process_set_of_keys(masked_k, Dead_key_set_size, Dead_key_set);
397         button_info_do(&Player->bi);    // call functions based on status of button_info bit vectors
398
399         return -1;
400 }
401
402
403 // see if any popup buttons have been pressed
404 // exit: -1                                             => no buttons pressed
405 //                      >=0                                     =>      button index that was pressed
406 int popupdead_check_buttons()
407 {
408         int                     i;
409         UI_BUTTON       *b;
410
411         for ( i = 0; i < Popupdead_num_choices; i++ ) {
412                 b = &Popupdead_button_regions[i];
413                 if ( b->pressed() ) {
414                         return i;
415                 }
416
417                 b = &Popupdead_buttons[i];
418                 if ( b->pressed() ) {
419                         return i;
420                 }
421         }
422
423         return -1;
424 }
425
426 // See if any of the button should change appearance based on mouse position
427 void popupdead_force_draw_buttons()
428 {
429         int i,mouse_is_highlighting=0;
430         UI_BUTTON *br, *b;
431
432         for ( i = 0; i < Popupdead_num_choices; i++ ) {
433                 br = &Popupdead_button_regions[i];
434                 b = &Popupdead_buttons[i];
435                 if ( br->button_down() ) {
436                         b->draw_forced(2);
437                         mouse_is_highlighting=1;
438                         continue;
439                 }
440
441                 if ( (b->button_hilighted()) || (br->button_hilighted() && !b->button_down()) ) {
442                         Popupdead_default_choice=i;
443                         mouse_is_highlighting=1;
444                         b->draw_forced(1);
445                 }
446         }
447
448         // Only if mouse is not highlighting an option, let the default choice be drawn highlighted
449         if ( (!mouse_is_highlighting) && (Popupdead_num_choices>1) ) {
450                 for ( i = 0; i < Popupdead_num_choices; i++ ) {
451                         b = &Popupdead_buttons[i];
452                         // highlight the default choice
453                         if ( i == Popupdead_default_choice ) {
454                                 b->draw_forced(1);
455                         }
456                 }
457         }
458 }
459
460 // Draw the button text nicely formatted in the popup
461 void popupdead_draw_button_text()
462 {
463         int w,h,i,sx,sy;
464
465         gr_set_color_fast(&Color_bright_blue);
466
467         for ( i=0; i < Popupdead_num_choices; i++ ) {
468                 gr_get_string_size(&w, &h, Popupdead_button_text[i]);
469                 sx = Popupdead_region_coords[gr_screen.res][i][0]-w;
470                 sy = Popupdead_region_coords[gr_screen.res][i][1]+4;
471                 gr_string(sx, sy, Popupdead_button_text[i]);
472         }
473 }
474
475 // reinits the death popup
476 // used for skip popup to death popup transition
477 void popupdead_restart() {
478         Popupdead_skip_already_shown = 1;
479         Popupdead_skip_active = 0;
480         Popupdead_active = 0;
481         Player->failures_this_session--;                // hacky correction for a double count when calling popupdead_start() twice
482         popupdead_start();
483 }
484
485 // do the "skip mission" version of the death popup
486 int popupdead_skip_do_frame()
487 {
488         int k = Popupdead_window.process();
489
490         // check for input
491         int choice = popupdead_process_keys(k);
492         if (choice < 0) {
493                 choice = popupdead_check_buttons();
494         }
495
496         // take appropriate options
497         switch (choice) {
498         case 0:
499                 // try this mission again, so proceed to normal death popup
500                 gamesnd_play_iface(SND_USER_SELECT);
501                 popupdead_restart();
502                 break;
503         case 1:
504                 // skip this mission
505                 mission_campaign_skip_to_next();
506
507                 gamesnd_play_iface(SND_USER_SELECT);
508                 break;
509         case 2:
510                 // dont show this again
511                 Player->show_skip_popup = 0;
512                 
513                 gamesnd_play_iface(SND_USER_SELECT);
514                 popupdead_restart();
515                 break;
516         }
517
518         // render
519         Popupdead_window.draw();
520         popupdead_force_draw_buttons();
521         popupdead_draw_button_text();
522
523         // render skip mission message
524         gr_set_color_fast(&Color_bright_white);
525         gr_string(0x8000, Popupdead_skip_message_y[gr_screen.res], XSTR("You have failed this mission five times.", 1470));
526         gr_string(0x8000, Popupdead_skip_message_y[gr_screen.res] + gr_get_font_height(), XSTR("If you like, you may advance to the next mission.", 1471));
527
528         return choice;
529 }
530
531
532 // Called once per frame to run the dead popup
533 int popupdead_do_frame(float frametime)
534 {
535         int k, choice;
536
537 /*
538         if (Popupdead_skip_active) {
539                 // do the skip mission popup, and thats all
540                 if (popupdead_skip_do_frame() == 1) {
541                         return 2;       // fake the "go to briefing" choice
542                 } else {
543                         return -1;      // fake no choice
544                 }
545         }
546 */
547         if ( !Popupdead_active ) {
548                 return -1;
549         }
550
551         // dont let dude skip 3-09.  hack.
552         if(Game_mode & GM_CAMPAIGN_MODE){
553                 if((Campaign.current_mission >= 0) && (Campaign.current_mission < MAX_CAMPAIGN_MISSIONS)){
554                         if ((Campaign.missions[Campaign.current_mission].name != NULL) && !stricmp(Campaign.missions[Campaign.current_mission].name, "sm3-09.fs2")) {
555                                 Popupdead_skip_already_shown = 1;
556                         }
557                 }
558         }
559
560         // maybe show skip mission popup
561         if ((!Popupdead_skip_already_shown) && (Player->show_skip_popup) && (Game_mode & GM_NORMAL) && (Game_mode & GM_CAMPAIGN_MODE) && (Player->failures_this_session >= PLAYER_MISSION_FAILURE_LIMIT)) {
562                 int popup_choice = popup(0, 3, XSTR("Do Not Skip This Mission", 1473),
563                                                                                                  XSTR("Advance To The Next Mission", 1474),
564                                                                                                  XSTR("Don't Show Me This Again", 1475),
565                                                                                                  XSTR("You have failed this mission five times.  If you like, you may advance to the next mission.", 1472) );
566                 switch (popup_choice) {
567                 case 0:
568                         // stay on this mission, so proceed to normal death popup
569                         // in other words, do nothing.
570                         break;
571                 case 1:
572                         // skip this mission
573                         Popupdead_active = 0;
574                         mission_campaign_skip_to_next();
575                         gameseq_post_event(GS_EVENT_START_GAME);
576                         return -1;
577                 case 2:
578                         // dont show this again
579                         Player->show_skip_popup = 0;
580                         break;
581                 }
582
583                 Popupdead_skip_already_shown = 1;
584         }
585
586         
587         k = Popupdead_window.process();
588
589         choice = popupdead_process_keys(k);
590         if ( choice >= 0 ) {
591                 // do something different for single/multiplayer
592                 if ( Game_mode & GM_NORMAL ) {
593                         Popupdead_choice=choice;
594                 } else {
595                         Assert( Popupdead_multi_type != -1 );
596                         switch ( Popupdead_multi_type ) {
597                                 
598                         case POPUPDEAD_OBS_ONLY:
599                         case POPUPDEAD_OBS_QUIT:
600                                 Popupdead_choice = POPUPDEAD_DO_OBSERVER;
601                                 if ( (Popupdead_multi_type == POPUPDEAD_OBS_QUIT) && (choice == 1) )
602                                         Popupdead_choice = POPUPDEAD_DO_MAIN_HALL;
603                                 break;
604
605                         case POPUPDEAD_RESPAWN_ONLY:
606                         case POPUPDEAD_RESPAWN_QUIT:
607                                 Popupdead_choice = POPUPDEAD_DO_RESPAWN;
608                                 if ( (Popupdead_multi_type == POPUPDEAD_RESPAWN_QUIT) && (choice == 1) )
609                                         Popupdead_choice = POPUPDEAD_DO_MAIN_HALL;
610                                 break;
611
612                         default:
613                                 Int3();
614                                 break;
615                         }
616                 }
617         }
618
619         choice = popupdead_check_buttons();
620         if ( choice >= 0 ) {
621                 // do something different for single/multiplayer
622                 if ( Game_mode & GM_NORMAL ) {
623                         Popupdead_choice=choice;
624                 } else {
625                         Assert( Popupdead_multi_type != -1 );
626                         switch ( Popupdead_multi_type ) {
627                                 
628                         case POPUPDEAD_OBS_ONLY:
629                         case POPUPDEAD_OBS_QUIT:
630                                 Popupdead_choice = POPUPDEAD_DO_OBSERVER;
631                                 if ( (Popupdead_multi_type == POPUPDEAD_OBS_QUIT) && (choice == 1) )
632                                         Popupdead_choice = POPUPDEAD_DO_MAIN_HALL;
633                                 break;
634
635                         case POPUPDEAD_RESPAWN_ONLY:
636                         case POPUPDEAD_RESPAWN_QUIT:
637                                 Popupdead_choice = POPUPDEAD_DO_RESPAWN;
638                                 if ( (Popupdead_multi_type == POPUPDEAD_RESPAWN_QUIT) && (choice == 1) )
639                                         Popupdead_choice = POPUPDEAD_DO_MAIN_HALL;
640                                 break;
641
642                         default:
643                                 Int3();
644                                 break;
645                         }
646                 }
647         }
648
649         Popupdead_window.draw();
650         popupdead_force_draw_buttons();
651         popupdead_draw_button_text();
652
653         return Popupdead_choice;
654 }
655
656 // Close down the dead popup
657 void popupdead_close()
658 {
659         if ( !Popupdead_active ) {
660                 return;
661         }
662
663         gamesnd_play_iface(SND_POPUP_DISAPPEAR);
664         Popupdead_window.destroy();
665         game_flush();
666
667         Popupdead_active = 0;
668         Popupdead_skip_active = 0;
669         Popupdead_skip_already_shown = 0;
670 }
671
672 // Is there a dead popup active?
673 int popupdead_is_active()
674 {
675         return Popupdead_active;
676
677