void DoGameOver() { time_out_value = timer_get_approx_seconds() + i2f(60*5); nm_messagebox1( TXT_GAME_OVER, DoEndLevelScoreGlitzPoll, 1, TXT_OK, "" ); if (Current_mission_num == 0) scores_maybe_add_player(0); Function_mode = FMODE_MENU; Game_mode = GM_GAME_OVER; longjmp( LeaveGame, 0 ); // Exit out of game loop }
void do_screen_message(char *fmt, ...) { va_list arglist; grs_bitmap background; char msg[1024]; if (Game_mode & GM_MULTI) return; gr_init_bitmap_data(&background); if (pcx_read_bitmap(Menu_pcx_name, &background, BM_LINEAR, gr_palette) != PCX_ERROR_NONE) return; gr_palette_load(gr_palette); va_start(arglist, fmt); vsprintf(msg, fmt, arglist); va_end(arglist); nm_messagebox1(NULL, (int (*)(newmenu *, d_event *, void *))draw_rock, &background, 1, TXT_OK, msg); gr_free_bitmap_data(&background); }
int kmatrix_handler(window *wind, d_event *event, kmatrix_screen *km) { int i = 0, k = 0, choice = 0; switch (event->type) { case EVENT_KEY_COMMAND: k = event_key_get(event); switch( k ) { case KEY_ESC: if (km->network) { StartAbortMenuTime=timer_query(); choice=nm_messagebox1( NULL,multi_endlevel_poll2, NULL, 2, TXT_YES, TXT_NO, TXT_ABORT_GAME ); } else choice=nm_messagebox( NULL, 2, TXT_YES, TXT_NO, TXT_ABORT_GAME ); if (choice==0) { Players[Player_num].connected=CONNECT_DISCONNECTED; if (km->network) multi_send_endlevel_packet(); multi_leave_game(); window_close(wind); if (Game_wind) window_close(Game_wind); return 1; } return 1; default: break; } break; case EVENT_WINDOW_DRAW: timer_delay2(50); if (km->network) multi_do_protocol_frame(0, 1); km->playing = 0; // Check if all connected players are also looking at this screen ... for (i = 0; i < MAX_PLAYERS; i++) if (Players[i].connected) if (Players[i].connected != CONNECT_END_MENU && Players[i].connected != CONNECT_DIED_IN_MINE) km->playing = 1; // ... and let the reactor blow sky high! if (!km->playing) Countdown_seconds_left = -1; // If Reactor is finished and end_time not inited, set the time when we will exit this loop if (km->end_time == -1 && Countdown_seconds_left < 0 && !km->playing) km->end_time = timer_query() + (KMATRIX_VIEW_SEC * F1_0); // Check if end_time has been reached and exit loop if (timer_query() >= km->end_time && km->end_time != -1) { if (km->network) multi_send_endlevel_packet(); // make sure if (is_D2_OEM) { if (Current_level_num==8) { Players[Player_num].connected=CONNECT_DISCONNECTED; if (km->network) multi_send_endlevel_packet(); multi_leave_game(); window_close(wind); if (Game_wind) window_close(Game_wind); return 0; } } window_close(wind); break; } kmatrix_redraw(km); if (km->playing) kmatrix_status_msg(Countdown_seconds_left, 1); else kmatrix_status_msg(f2i(timer_query()-km->end_time), 0); break; case EVENT_WINDOW_CLOSE: game_flush_inputs(); newmenu_free_background(); break; default: break; } return 0; }