implemented return value for kmatrix_view() so we can properly bail out of the game loop in AdvanceLevel()
This commit is contained in:
parent
8292efe622
commit
8d686ab23b
|
@ -31,7 +31,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
|
||||
#ifdef __cplusplus
|
||||
|
||||
void kmatrix_view(int network);
|
||||
int kmatrix_view(int network); // shows matrix screen. Retruns 0 if aborted (quitting game) and 1 if proceeding to next level if applicable.
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -278,7 +278,7 @@ void multi_send_effect_blowup(segnum_t segnum, int side, const vms_vector &pnt);
|
|||
void multi_add_lifetime_kills(void);
|
||||
void multi_send_bounty( void );
|
||||
|
||||
void multi_endlevel_score(void);
|
||||
int multi_endlevel_score(void);
|
||||
void multi_consistency_error(int reset);
|
||||
void multi_prep_level(void);
|
||||
int multi_level_sync(void);
|
||||
|
|
|
@ -1286,7 +1286,15 @@ static void AdvanceLevel(int secret_flag)
|
|||
#endif
|
||||
if (Current_level_num != Last_level) {
|
||||
if (Game_mode & GM_MULTI)
|
||||
multi_endlevel_score();
|
||||
{
|
||||
int result = multi_endlevel_score();
|
||||
if (!result)
|
||||
{
|
||||
if (Game_wind)
|
||||
window_close(Game_wind); // Exit out of game loop
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
// NOTE LINK TO ABOVE!!!
|
||||
DoEndLevelScoreGlitz(0); //give bonuses
|
||||
|
|
|
@ -182,6 +182,7 @@ struct kmatrix_screen : ignore_window_pointer_t
|
|||
int network;
|
||||
fix64 end_time;
|
||||
int playing;
|
||||
int aborted;
|
||||
};
|
||||
|
||||
static void kmatrix_redraw(kmatrix_screen *km)
|
||||
|
@ -284,8 +285,8 @@ static window_event_result kmatrix_handler(window *wind,const d_event &event, km
|
|||
multi_send_endlevel_packet();
|
||||
|
||||
multi_leave_game();
|
||||
if (Game_wind)
|
||||
window_close(Game_wind);
|
||||
km->aborted = 1;
|
||||
|
||||
return window_event_result::close;
|
||||
}
|
||||
return window_event_result::handled;
|
||||
|
@ -337,8 +338,8 @@ static window_event_result kmatrix_handler(window *wind,const d_event &event, km
|
|||
multi_send_endlevel_packet();
|
||||
|
||||
multi_leave_game();
|
||||
if (Game_wind)
|
||||
window_close(Game_wind);
|
||||
km->aborted = 1;
|
||||
|
||||
return window_event_result::close;
|
||||
}
|
||||
}
|
||||
|
@ -365,20 +366,21 @@ static window_event_result kmatrix_handler(window *wind,const d_event &event, km
|
|||
return window_event_result::ignored;
|
||||
}
|
||||
|
||||
void kmatrix_view(int network)
|
||||
int kmatrix_view(int network)
|
||||
{
|
||||
window *wind;
|
||||
kmatrix_screen km;
|
||||
gr_init_bitmap_data(km.background);
|
||||
if (pcx_read_bitmap(STARS_BACKGROUND, km.background, BM_LINEAR, gr_palette) != PCX_ERROR_NONE)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
gr_palette_load(gr_palette);
|
||||
|
||||
km.network = network;
|
||||
km.end_time = -1;
|
||||
km.playing = 0;
|
||||
km.aborted = 0;
|
||||
|
||||
set_screen_mode( SCREEN_MENU );
|
||||
game_flush_inputs();
|
||||
|
@ -390,10 +392,11 @@ void kmatrix_view(int network)
|
|||
wind = window_create(&grd_curscreen->sc_canvas, 0, 0, SWIDTH, SHEIGHT, kmatrix_handler, &km);
|
||||
if (!wind)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (window_exists(wind))
|
||||
event_process();
|
||||
gr_free_bitmap_data(km.background);
|
||||
return (km.aborted?0:1);
|
||||
}
|
||||
|
|
|
@ -364,11 +364,11 @@ int multi_objnum_is_past(objnum_t objnum)
|
|||
//
|
||||
|
||||
// Show a score list to end of net players
|
||||
void multi_endlevel_score(void)
|
||||
int multi_endlevel_score(void)
|
||||
{
|
||||
int old_connect=0, game_wind_visible = 0;
|
||||
int old_connect=0, game_wind_visible = 0, rval = 0;
|
||||
|
||||
// If there still is a Game_wind and it's suspended (usually both shoudl be the case), bring it up again so host can still take actions of the game
|
||||
// If there still is a Game_wind and it's suspended (usually both should be the case), bring it up again so host can still take actions of the game
|
||||
if (Game_wind)
|
||||
{
|
||||
if (!window_is_visible(Game_wind))
|
||||
|
@ -387,7 +387,7 @@ void multi_endlevel_score(void)
|
|||
}
|
||||
|
||||
// Do the actual screen we wish to show
|
||||
kmatrix_view(Game_mode & GM_NETWORK);
|
||||
rval = kmatrix_view(Game_mode & GM_NETWORK);
|
||||
|
||||
// Restore connect state
|
||||
|
||||
|
@ -417,6 +417,8 @@ void multi_endlevel_score(void)
|
|||
// hide Game_wind again if we brought it up
|
||||
if (Game_wind && game_wind_visible)
|
||||
window_set_visible(Game_wind, 0);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
int get_team(const playernum_t pnum)
|
||||
|
|
Loading…
Reference in a new issue