diff --git a/osx/boe.actions.cpp b/osx/boe.actions.cpp index e2e41c26..e60c8e29 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -97,7 +97,7 @@ short store_selling_values[8] = {0,0,0,0,0,0,0,0}; extern short cen_x, cen_y, stat_window,give_delays;//,pc_moves[6]; extern eGameMode overall_mode; extern location to_create; -extern bool in_startup_mode,All_Done,play_sounds,frills_on,spell_forced,save_maps,monsters_going; +extern bool All_Done,play_sounds,frills_on,spell_forced,save_maps,monsters_going; extern bool party_in_memory,in_scen_debug; // game info globals @@ -1393,7 +1393,7 @@ bool handle_action(sf::Event event) if (end_scenario) { reload_startup(); - in_startup_mode = true; + overall_mode = MODE_STARTUP; draw_startup(0); menu_activate(); univ.party.scen_name = ".exs"; // should be harmless... @@ -1609,7 +1609,7 @@ bool handle_keystroke(sf::Event& event){ return false; } - if (in_startup_mode == true) + if(overall_mode == MODE_STARTUP) return false; // Only hide the cursor if it's in the window. @@ -2146,7 +2146,7 @@ void do_load() { fs::path file_to_load = nav_get_party(); if(!file_to_load.empty()) load_party(file_to_load); - if (in_startup_mode == false) + if(overall_mode != MODE_STARTUP) post_load(); menu_activate(); } @@ -2529,32 +2529,28 @@ void handle_death() { std::string choice; - in_startup_mode = true; + overall_mode = MODE_STARTUP; - while (in_startup_mode == true) { + while(true) { // Use death (or leave Exile) dialog - in_startup_mode = false; - choice = cChoiceDlog("party-death.xml",{"load","new","quit"}).show(); //// FCD hates it when it gets called in startup mode - // and startup graphiocs aren't loaded. - in_startup_mode = true; + choice = cChoiceDlog("party-death.xml",{"load","new","quit"}).show(); if(choice == "quit") { - in_startup_mode = false; All_Done = true; + return; } else if(choice == "load") { - in_startup_mode = false; fs::path file_to_load = nav_get_party(); if(!file_to_load.empty()) load_party(file_to_load); if (party_toast() == false) { - if (in_startup_mode == false) + if(overall_mode != MODE_STARTUP) post_load(); - else return; + return; } - else in_startup_mode = true; } else if(choice == "new") { start_new_game(); + return; } } diff --git a/osx/boe.appleevents.mm b/osx/boe.appleevents.mm index 7fa2f81e..c5f142da 100644 --- a/osx/boe.appleevents.mm +++ b/osx/boe.appleevents.mm @@ -18,7 +18,7 @@ extern void finish_load_party(); extern void end_startup(); extern void post_load(); -extern bool app_started_normally, ae_loading, in_startup_mode, startup_loaded, All_Done; +extern bool app_started_normally, ae_loading, startup_loaded, All_Done; extern eGameMode overall_mode; extern cUniverse univ; @@ -75,15 +75,15 @@ void set_up_apple_events() { finish_load_party(); ae_loading = false; - if(!in_startup_mode && startup_loaded) + if(overall_mode != MODE_STARTUP && startup_loaded) end_startup(); - if(!in_startup_mode) { + if(overall_mode != MODE_STARTUP) { post_load(); } } -(void)handleQuit:(AEDescr*)theAppleEvent withReply: (AEDescr*)reply { - if((overall_mode == MODE_STARTUP/*40*/) || (in_startup_mode)) { + if(overall_mode == MODE_STARTUP) { All_Done = true; return; } diff --git a/osx/boe.dlgutil.cpp b/osx/boe.dlgutil.cpp index 58b18422..2a84a22c 100644 --- a/osx/boe.dlgutil.cpp +++ b/osx/boe.dlgutil.cpp @@ -41,7 +41,7 @@ extern short stat_window; extern eGameMode overall_mode; //extern current_town_type univ.town; //extern party_record_type party; -extern bool in_startup_mode,play_sounds,give_intro_hint,show_startup_splash; +extern bool play_sounds,give_intro_hint,show_startup_splash; extern sf::RenderWindow mainPtr; extern RECT d_rects[80]; extern short d_rect_index[80]; diff --git a/osx/boe.fileio.cpp b/osx/boe.fileio.cpp index dba43e89..a3cef92f 100644 --- a/osx/boe.fileio.cpp +++ b/osx/boe.fileio.cpp @@ -36,7 +36,7 @@ //extern unsigned char out[96][96],out_e[96][96]; extern short give_delays,stat_screen_mode; extern eGameMode overall_mode; -extern bool in_startup_mode,play_sounds,sys_7_avail,save_maps,party_in_memory,in_scen_debug; +extern bool play_sounds,sys_7_avail,save_maps,party_in_memory,in_scen_debug; //extern current_town_type c_town; //extern town_item_list t_i; extern location center; @@ -147,9 +147,9 @@ void finish_load_party(){ // now if not in scen, this is it. if (!in_scen) { - if (!in_startup_mode) { + if(overall_mode != MODE_STARTUP) { reload_startup(); - in_startup_mode = true; + overall_mode = MODE_STARTUP; draw_startup(0); } return; @@ -234,7 +234,6 @@ void finish_load_party(){ save_maps = true; else save_maps = false; - in_startup_mode = false; in_scen_debug = false; } @@ -738,7 +737,8 @@ void build_outdoors() fix_boats(); add_outdoor_maps(); // make_out_trim(); - if (in_startup_mode == false) + // TODO: This might be another relic of the "demo" mode + if(overall_mode != MODE_STARTUP) erase_out_specials(); for (i = 0; i < 10; i++) diff --git a/osx/boe.graphics.cpp b/osx/boe.graphics.cpp index 8f5b0dfa..28339e85 100644 --- a/osx/boe.graphics.cpp +++ b/osx/boe.graphics.cpp @@ -34,7 +34,7 @@ extern RECT windRect; extern short stat_window,give_delays; extern eGameMode overall_mode; extern short current_spell_range,town_type; -extern bool in_startup_mode,anim_onscreen,play_sounds,frills_on,startup_loaded,party_in_memory; +extern bool anim_onscreen,play_sounds,frills_on,startup_loaded,party_in_memory; extern bool flushingInput; extern short anim_step; extern ter_num_t combat_terrain[64][64]; @@ -193,13 +193,7 @@ void adjust_window_mode() } } - if (overall_mode != MODE_STARTUP) { // TODO: This is odd - fix it - if (in_startup_mode == true) - draw_startup(0); - if (in_startup_mode == false) - //refresh_screen(0); redraw_screen(); - } if (text_sbar != NULL) { text_sbar->relocate({ul.x + 546,ul.y + 283}); item_sbar->relocate({ul.x + 546,ul.y + 146}); @@ -679,7 +673,7 @@ void draw_main_screen() // redraw_screen does the very first redraw, and any full redraw void redraw_screen(){ put_background(); - if(in_startup_mode) + if(overall_mode == MODE_STARTUP) draw_startup(0); else{ switch (overall_mode) { diff --git a/osx/boe.graphutil.cpp b/osx/boe.graphutil.cpp index 59c4663b..6e3c37c5 100644 --- a/osx/boe.graphutil.cpp +++ b/osx/boe.graphutil.cpp @@ -26,7 +26,7 @@ extern RECT windRect; extern short stat_window,give_delays; extern eGameMode overall_mode; extern short current_spell_range,town_type; -extern bool in_startup_mode,anim_onscreen,play_sounds,frills_on,startup_loaded; +extern bool anim_onscreen,play_sounds,frills_on,startup_loaded; //extern short town_size[3]; //extern cParty party; //extern pc_record_type adven[6]; diff --git a/osx/boe.infodlg.cpp b/osx/boe.infodlg.cpp index 23109bda..2040c821 100644 --- a/osx/boe.infodlg.cpp +++ b/osx/boe.infodlg.cpp @@ -44,7 +44,7 @@ extern short which_pc_displayed; extern short mage_range[66],priest_range[66]; extern short spell_cost[2][62],cur_town_talk_loaded; //extern current_town_type univ.town; -extern bool in_startup_mode,give_intro_hint; +extern bool give_intro_hint; extern sf::RenderWindow mainPtr; extern short on_monst_menu[256]; //extern big_tr_type t_d; diff --git a/osx/boe.items.cpp b/osx/boe.items.cpp index 77cd8dea..9c7b51a6 100644 --- a/osx/boe.items.cpp +++ b/osx/boe.items.cpp @@ -36,7 +36,7 @@ extern eGameMode overall_mode; //extern current_town_type univ.town; //extern town_item_list univ.town.items; extern sf::RenderWindow mainPtr; -extern bool in_startup_mode,boom_anim_active; +extern bool boom_anim_active; extern RECT d_rects[80]; extern short d_rect_index[80]; //extern big_tr_type t_d; @@ -144,7 +144,7 @@ bool give_to_pc(short pc_num,cItemRec item,short print_result) if (stat_window == pc_num) put_item_screen(stat_window,0); } - if (in_startup_mode == false) { + if(overall_mode != MODE_STARTUP) { if (!item.ident) sprintf((char *) announce_string," %s gets %s.",univ.party[pc_num].name.c_str(),item.name.c_str()); else sprintf((char *) announce_string," %s gets %s.",univ.party[pc_num].name.c_str(),item.full_name.c_str()); @@ -1191,7 +1191,7 @@ short char_select_pc(short active_only,short free_inv_only,const char *title) selectPc.run(); item_hit = selectPc.getResult(); - if (in_startup_mode == false) + if(overall_mode != MODE_STARTUP) //refresh_screen(0); redraw_screen(); else draw_startup(0); diff --git a/osx/boe.main.cpp b/osx/boe.main.cpp index cad11cb1..28b9d20f 100644 --- a/osx/boe.main.cpp +++ b/osx/boe.main.cpp @@ -39,7 +39,7 @@ bool All_Done = false; sf::Event event; sf::RenderWindow mainPtr; short had_text_freeze = 0,num_fonts; -bool in_startup_mode = true,app_started_normally = false, skip_boom_delay = false; +bool app_started_normally = false, skip_boom_delay = false; bool first_startup_update = true; bool diff_depth_ok = false,first_sound_played = false,spell_forced = false,startup_loaded = false; bool save_maps = true,party_in_memory = false; @@ -314,12 +314,12 @@ void Handle_One_Event() Handle_Update(); //(cur_time - last_anim_time > 42) - if((animTimer.getElapsedTime().asMilliseconds() >= fortyTicks) && (in_startup_mode == false) && (anim_onscreen == true) && (PSD[SDF_NO_TER_ANIM] == 0) + if((animTimer.getElapsedTime().asMilliseconds() >= fortyTicks) && (overall_mode != MODE_STARTUP) && (anim_onscreen == true) && (PSD[SDF_NO_TER_ANIM] == 0) && (isFrontWindow(mainPtr) || isFrontWindow(mini_map)) && (!gInBackground)) { animTimer.restart(); draw_terrain(); } - if((animTimer.getElapsedTime().asMilliseconds() > twentyTicks) && (in_startup_mode == true) + if((animTimer.getElapsedTime().asMilliseconds() > twentyTicks) && (overall_mode == MODE_STARTUP) && app_started_normally && isFrontWindow(mainPtr)) { animTimer.restart(); draw_startup_anim(true); @@ -383,7 +383,7 @@ void Handle_One_Event() break; case sf::Event::Closed: - if (in_startup_mode == true) { + if(overall_mode == MODE_STARTUP) { All_Done = true; break; } @@ -456,7 +456,7 @@ bool handle_dialog_event() void Handle_Update() { - if (in_startup_mode == true) { + if(overall_mode == MODE_STARTUP) { /*if (first_startup_update == true) first_startup_update = false; else*/ draw_startup(0); @@ -613,7 +613,7 @@ void Mouse_Pressed() } // a control hit // else { // ordinary click #endif // end commented-out code section - if (in_startup_mode == false) + if(overall_mode != MODE_STARTUP) All_Done = handle_action(event); else All_Done = handle_startup_press({event.mouseButton.x, event.mouseButton.y}); @@ -652,7 +652,7 @@ void handle_file_menu(int item_hit) switch (item_hit) { case 1: - if (in_startup_mode == true) + if(overall_mode == MODE_STARTUP) startup_load(); else do_load(); break; @@ -663,7 +663,7 @@ void handle_file_menu(int item_hit) do_save(1); break; case 4: - if (in_startup_mode == false) { + if(overall_mode != MODE_STARTUP) { choice = cChoiceDlog("restart-game.xml",{"okay","cancel"}).show(); if (choice == "cancel") return; @@ -671,7 +671,7 @@ void handle_file_menu(int item_hit) univ.party[i].main_status = MAIN_STATUS_ABSENT; party_in_memory = false; reload_startup(); - in_startup_mode = true; + overall_mode = MODE_STARTUP; draw_startup(0); } start_new_game(); @@ -683,7 +683,7 @@ void handle_file_menu(int item_hit) break; case 8: - if (in_startup_mode == true) { + if(overall_mode == MODE_STARTUP) { All_Done = true; break; } @@ -784,7 +784,7 @@ void handle_options_menu(int item_hit) adventure_notes(); break; case 8: - if (in_startup_mode == false) + if(overall_mode != MODE_STARTUP) print_party_stats(); break; } diff --git a/osx/boe.menus.mac.mm b/osx/boe.menus.mac.mm index 70f666d1..b4ccfdf2 100644 --- a/osx/boe.menus.mac.mm +++ b/osx/boe.menus.mac.mm @@ -13,6 +13,7 @@ #include "scenario.h" #include "boe.party.h" #include "boe.infodlg.h" +#include "boe.consts.h" extern short on_spell_menu[2][62]; extern short spell_level[62]; @@ -20,10 +21,11 @@ extern short spell_cost[2][62]; extern short on_monst_menu[256]; extern const char* mage_s_name[62]; extern const char* priest_s_name[62]; -extern bool in_startup_mode, party_in_memory; +extern bool party_in_memory; extern short current_pc; extern cUniverse univ; extern cScenario scenario; +extern eGameMode overall_mode; #ifndef __APPLE__ #error boe.menus.mm is Mac-specific code; try compiling boe.menus.win.cpp instead @@ -71,7 +73,7 @@ void adjust_monst_menu() { NSMenu* monst_menu; char monst_name[256]; - if(in_startup_mode == true) return; + if(overall_mode == MODE_STARTUP) return; monst_menu = [[menu_bar_handle itemWithTitle: @"Monsters"] submenu]; id targ = [[monst_menu itemAtIndex: 0] target]; @@ -171,7 +173,7 @@ void adjust_spell_menus() short old_on_spell_menu[2][62]; bool need_menu_change = false; - if (in_startup_mode || current_pc == 6) + if(overall_mode == MODE_STARTUP || current_pc == 6) return; for (i = 0; i < 2; i++) @@ -255,7 +257,7 @@ void adjust_spell_menus() void menu_activate() { - if(in_startup_mode) { + if(overall_mode == MODE_STARTUP) { [[menu_bar_handle itemWithTitle: @"Options"] setEnabled: NO]; [[menu_bar_handle itemWithTitle: @"Monsters"] setEnabled: NO]; [[menu_bar_handle itemWithTitle: @"Actions"] setEnabled: NO]; diff --git a/osx/boe.newgraph.cpp b/osx/boe.newgraph.cpp index 5ab71782..5e1cdbfa 100644 --- a/osx/boe.newgraph.cpp +++ b/osx/boe.newgraph.cpp @@ -49,7 +49,7 @@ extern RECT bg[]; extern sf::RenderWindow mainPtr; extern short town_type,which_combat_type; extern eGameMode overall_mode; -extern bool play_sounds,boom_anim_active,in_startup_mode; +extern bool play_sounds,boom_anim_active; extern sf::Texture fields_gworld,boom_gworld,missiles_gworld,invenbtn_gworld; extern sf::Texture tiny_obj_gworld, items_gworld, talkfaces_gworld; extern sf::RenderTexture terrain_screen_gworld; @@ -416,7 +416,8 @@ void do_missile_anim(short num_steps,location missile_origin,short sound_num) return; // initialize general data - if (in_startup_mode) { + // TODO: This is probably yet another relic of the Exile III demo + if(overall_mode == MODE_STARTUP) { current_terrain_ul.x = 306; current_terrain_ul.y = 5; } else current_terrain_ul.x = current_terrain_ul.y = 5; @@ -588,7 +589,7 @@ void do_explosion_anim(short sound_num,short special_draw) return; // initialize general data - if (in_startup_mode) { + if(overall_mode == MODE_STARTUP) { // TODO: I think this is a relic of the "demo" on the main screen of Exile III current_terrain_ul.x = 306; current_terrain_ul.y = 5; diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index 69527e81..d37285c6 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -128,7 +128,7 @@ extern eGameMode overall_mode; extern fs::path progDir; extern location pc_pos[6],center; extern sf::RenderWindow mainPtr; -extern bool in_startup_mode,spell_forced,save_maps,suppress_stat_screen,boom_anim_active; +extern bool spell_forced,save_maps,suppress_stat_screen,boom_anim_active; //extern stored_items_list_type stored_items[3]; //extern CursHandle sword_curs; //extern setup_save_type setup_save; @@ -507,7 +507,6 @@ void put_party_in_scen(std::string scen_name) // if at this point, startup must be over, so make this call to make sure we're ready, // graphics wise end_startup(); - in_startup_mode = false; load_outdoors(loc(univ.party.outdoor_corner.x + 1,univ.party.outdoor_corner.y + 1),univ.out.outdoors[1][1]); load_outdoors(loc(univ.party.outdoor_corner.x,univ.party.outdoor_corner.y + 1),univ.out.outdoors[0][1]); @@ -590,7 +589,7 @@ bool create_pc(short spot,cDialog* parent) univ.party[spot].main_status = MAIN_STATUS_ALIVE; - if (in_startup_mode == false) { + if(overall_mode != MODE_STARTUP) { univ.party[spot].items[0] = start_items[univ.party[spot].race * 2]; univ.party[spot].equip[0] = true; univ.party[spot].items[1] = start_items[univ.party[spot].race * 2 + 1]; diff --git a/osx/boe.startup.cpp b/osx/boe.startup.cpp index 1f783595..88a29546 100644 --- a/osx/boe.startup.cpp +++ b/osx/boe.startup.cpp @@ -27,7 +27,7 @@ using std::vector; //extern party_record_type party; //extern pc_record_type adven[6]; -extern bool in_startup_mode,play_sounds,party_in_memory; +extern bool play_sounds,party_in_memory; extern long register_flag; extern sf::RenderWindow mainPtr; extern location ul; @@ -119,6 +119,7 @@ bool handle_startup_press(location the_point) void startup_load()//// { + bool in_startup_mode = true; fs::path file_to_load = nav_get_party(); if(!file_to_load.empty() && load_party(file_to_load)){ party_in_memory = true; diff --git a/osx/boe.text.cpp b/osx/boe.text.cpp index ac1daec1..8c98c2d2 100644 --- a/osx/boe.text.cpp +++ b/osx/boe.text.cpp @@ -86,7 +86,7 @@ extern short terrain_there[9][9]; //extern unsigned char out[96][96]; //extern big_tr_type t_d; extern location ul; -extern bool play_sounds,suppress_stat_screen,in_startup_mode; +extern bool play_sounds,suppress_stat_screen; extern RECT item_buttons[8][6]; // name, use, give, drip, info, sell/id extern RECT pc_buttons[6][5]; @@ -1263,7 +1263,7 @@ short print_terrain(location space) void add_string_to_buf(std::string str) { - if (in_startup_mode == true) + if(overall_mode == MODE_STARTUP) return; if(str == "") return;