Make response to EVENT_WINDOW_CLOSE conform to 'handling' system - returning 1 means abort closing

This commit is contained in:
kreatordxx 2010-01-28 03:27:49 +00:00
parent 04316ff79b
commit 9d4e69c7a9
10 changed files with 12 additions and 2 deletions

View file

@ -4,6 +4,7 @@ D1X-Rebirth Changelog
--------
main/playsave.c, main/playsave.h, main/object.c, main/render.c, main/hud.c, main/hostage.c, main/newdemo.c, main/gamerend.c, main/endlevel.c, main/game.c, main/gauges.c: Made PlayerCfg.CockpitMode an array to hold two values: 0 to store the actual "cockpit", 1 to also store Letterbox, Rear, etc. Greatly helps to switch and restore views - especially in Demo playback which now properly selects modes
main/newdemo.c: Added a new code to properly re-record view/cockpit-events at beginning and end of Demo recording so views will be fine if switched before recording started; Also added lost sequence to record Rear-view reset between levels; Last but not least, record wall tmaps so opened/blasted doors will be shown correctly if opened/blasted before recording; Everything done without breaking the Demo format!
arch/sdl/window.c, main/automap.c, main/game.c, main/gamecntl.c, main/kconfig.c, main/menu.c, main/net_ipx.c, main/net_udp.c, main/newmenu.c: Make response to EVENT_WINDOW_CLOSE conform to 'handling' system - returning 1 means abort closing
20100127
--------

View file

@ -60,8 +60,8 @@ int window_close(window *wind)
event.type = EVENT_WINDOW_CLOSE;
if (!window_send_event(wind, &event))
return 0; // user cancelled close (e.g. clicked 'No' to abort box)
if (window_send_event(wind, &event))
return 0; // user 'handled' the event, cancelling close
if (wind == FrontWindow)
{

View file

@ -543,6 +543,7 @@ int automap_handler(window *wind, d_event *event, automap *am)
game_flush_inputs();
d_free(am);
window_set_visible(Game_wind, 1);
return 0; // continue closing
break;
default:

View file

@ -1058,6 +1058,7 @@ int game_handler(window *wind, d_event *event, void *data)
clear_warn_func(game_show_warning); //don't use this func anymore
game_disable_cheats();
Game_wind = NULL;
return 0; // continue closing
break;
default:

View file

@ -271,6 +271,7 @@ int pause_handler(window *wind, d_event *event, char *msg)
ext_music_resume();
digi_resume_all();
d_free(msg);
return 0; // continue closing
break;
default:

View file

@ -949,6 +949,7 @@ int kconfig_handler(window *wind, d_event *event, kc_menu *menu)
for (i=0; i<NUM_D1X_CONTROLS; i++)
PlayerCfg.KeySettingsD1X[i] = kc_d1x[i].value;
return 0; // continue closing
break;
default:

View file

@ -713,6 +713,7 @@ int options_menuset(newmenu *menu, d_event *event, void *userdata)
case EVENT_WINDOW_CLOSE:
write_player_file();
return 0; // continue closing
break;
default:

View file

@ -4027,6 +4027,7 @@ static int show_game_rules_handler(window *wind, d_event *event, netgame_info *n
case EVENT_WINDOW_CLOSE:
game_flush_inputs();
return 0; // continue closing
break;
default:

View file

@ -4324,6 +4324,7 @@ static int show_game_rules_handler(window *wind, d_event *event, netgame_info *n
case EVENT_WINDOW_CLOSE:
game_flush_inputs();
return 0; // continue closing
break;
default:

View file

@ -1251,6 +1251,7 @@ int newmenu_handler(window *wind, d_event *event, newmenu *menu)
digi_resume_digi_sounds();
// d_free(menu); // have to wait until newmenus use a separate event loop
return 0; // continue closing
break; // always close
default:
@ -1938,6 +1939,7 @@ int listbox_handler(window *wind, d_event *event, listbox *lb)
(*lb->listbox_callback)(lb, event, lb->userdata);
newmenu_hide_cursor();
return 0; // continue closing
break;
default: