public static void start_unit_editor(string chapterId, string mapDataKey, string unitDataKey) { UnitEditorActive = true; Global.game_temp = new Game_Temp(); Global.game_battalions = new Game_Battalions(); Global.game_actors = new Game_Actors(); Global.change_to_new_scene("Scene_Map_Unit_Editor"); Global.game_system.reset(); Global.game_system.new_chapter(new List <string>(), Global.game_system.chapter_id, new Dictionary <string, string>()); Global.reset_game_state(); var old_map = Global.game_map; Global.game_map = new Game_Map(); Global.player = new Player(); // Trying to start this after everything else, instead of in the middle //move_range_update_thread(); //Debug Global.clear_events(); //Global.Audio.clear_map_theme(); //@Debug Global.set_unit_editor_data(chapterId, mapDataKey, unitDataKey); Global.change_game_state_turn(); if (old_map != null) { Global.game_map.set_scroll_loc(old_map.display_loc, true, true); Global.player.center_cursor(true); } }
internal static void suspend_finish_load(bool resume) { Global.change_to_new_scene("Scene_Map"); Global.suspend_fade_in(); Global.game_map.load_suspend(); // Resume Preparations if (Game_System.home_base) { if (resume) { (Scene as Scene_Map).resume_home_base(); } else { (Scene as Scene_Map).activate_home_base(); } } else if (Game_System.preparations) { if (resume) { (Scene as Scene_Map).resume_preparations(); } else { (Scene as Scene_Map).activate_preparations(); } } else { Game_State.resume_turn_theme(); if (!Global.game_state.is_map_ready(true)) { Game_State.any_trigger_start_events(); } else { Game_State.any_trigger_events(); } #if DEBUG Game_State.activate_autorun_events(); #endif } }
public static void start_chapter() { Global.change_to_new_scene("Scene_Map"); Global.reset_game_state(); Global.game_map = new Game_Map(); Global.player = new Player(); // Trying to start this after everything else, instead of in the middle //move_range_update_thread(); //Debug Global.clear_events(); //Global.Audio.clear_map_theme(); //@Debug Global.set_map_data(); Global.game_state.reset_support_data(); Global.change_game_state_turn(); }
private void ChangeScene(string newScene) { Global.return_to_title = false; if (Global.map_exists && MoveRangeUpdateThread == null) { StartMoveRangeThread(); } bool sceneChanged = true; string text = Global.game_temp.message_text; Global.game_temp.message_text = null; switch (newScene) { case "Scene_Splash": Global.scene = new Scene_Splash(); break; case "Scene_Soft_Reset": EndMoveRangeThread(); MoveRangeUpdateThread = null; Global.scene = new Scene_Soft_Reset(); break; #if DEBUG case "Debug_Start": #endif case "Start_Game": case "Scene_Worldmap": IOHandler.RefreshSaveId(); #if DEBUG IOHandler.RefreshDebugFileId(newScene == "Debug_Start"); if (newScene == "Start_Game" || newScene == "Debug_Start") { newScene = "Start_Game"; #else if (newScene == "Start_Game") { #endif IOHandler.LoadFile(true); Global.game_options.post_read(); Global.game_temp = new Game_Temp(); } Global.change_to_new_scene(newScene); break; case "Scene_Save": Global.change_to_new_scene("Scene_Save"); break; case "Start_Chapter": EndMoveRangeThread(); Global.start_chapter(); StartMoveRangeThread(); break; #if !MONOGAME && DEBUG case "Scene_Map_Unit_Editor": EndMoveRangeThread(); Global.start_unit_editor( MapEditorUnits, MapEditorMap, MapEditorUnitsSource); StartMoveRangeThread(); break; case "Scene_Map_Playtest": if (!Global.scene.is_unit_editor) { Print.message("Failed to start playtest, not currently in unit editor"); sceneChanged = false; } else { IOHandler.RefreshFileId(); IOHandler.LoadFile(true); Global.game_options.post_read(); Global.game_temp = new Game_Temp(); EndMoveRangeThread(); Global.start_unit_editor_playtest(); StartMoveRangeThread(); } break; #endif case "Load_Suspend": IOHandler.RefreshSaveId(); // Resume Arena if (Global.in_arena()) { ChangeScene("Scene_Arena"); StartMoveRangeThread(); return; } else { Global.suspend_finish_load(true); StartMoveRangeThread(); } break; case "Scene_Map": Global.change_to_new_scene("Scene_Map"); Global.init_map(); break; case "Scene_Dance": case "Scene_Staff": case "Scene_Arena": case "Scene_Battle": case "Scene_Promotion": #if DEBUG case "Scene_Test_Battle": if (newScene == "Scene_Test_Battle") { Global.change_to_new_scene("Scene_Test_Battle"); } else { #endif Global.change_to_new_scene(newScene); Global.initialize_action_scene(newScene == "Scene_Arena", newScene == "Scene_Promotion"); #if DEBUG } #endif break; case "Scene_Title_Load": Global.reset_system(); Global.change_to_new_scene("Scene_Title_Load"); break; case "Scene_Title": Global.reset_system(); Global.clear_events(); Global.change_to_new_scene("Scene_Title"); break; case "Scene_Class_Reel": Global.game_temp = new Game_Temp(); Global.new_game_actors(); Global.change_to_new_scene("Scene_Class_Reel"); break; default: sceneChanged = false; #if DEBUG Print.message("Non-existant scene type called: " + Global.new_scene); #endif break; } if (sceneChanged) { Global.dispose_battle_textures(); Global.dispose_face_textures(); Global.Audio.stop_bgs(); //@Debug Global.Audio.stop_me(); //@Debug } else { Global.game_temp.message_text = text; } Global.scene_change(""); }
public static void start_unit_editor_playtest() { var old_scene = Global.scene; if (!(old_scene is Scene_Map_Unit_Editor)) { return; } Difficulty_Modes difficulty = Global.game_system.Difficulty_Mode; var chapter = Global.data_chapters[Global.game_system.New_Chapter_Id]; var previous_chapters = Global.save_file.valid_previous_chapters(chapter.Id); var previous_chapter_ids = previous_chapters .ToDictionary(p => p.Key, p => p.Value.Count == 0 ? "" : p.Value.Last()); if (previous_chapters.Count == 0 || previous_chapters.Any(x => x.Value.Count == 0)) { if (previous_chapters.Count > 0) { Print.message(string.Format( "Could not load any save data\nfor \"{0}\", tried to use save file {1}", Global.game_system.New_Chapter_Id, Global.current_save_id)); } previous_chapter_ids = previous_chapter_ids .ToDictionary(p => p.Key, p => ""); Global.game_system.reset(); Global.game_system.reset_event_variables(); int battalion_index = chapter.Battalion; Global.game_battalions.add_battalion(battalion_index); Global.game_battalions.current_battalion = battalion_index; } else { Global.save_file.load_data(chapter.Id, previous_chapter_ids, ""); Global.game_actors.heal_battalion(); Global.battalion.refresh_deployed(); } Global.game_system.Difficulty_Mode = difficulty; if (Global.game_system.Style != Mode_Styles.Classic) { Global.save_file.Difficulty = Global.game_system.Difficulty_Mode; } Global.game_system.new_chapter(chapter.Prior_Chapters, chapter.Id, previous_chapter_ids); // these weren't copied in like the rest of the Scene_Worldmap.start_chapter() stuff? //Debug Global.game_temp = new Game_Temp(); Global.save_file = null; Global.change_to_new_scene("Scene_Map"); Global.reset_game_state(); var old_map = Global.game_map; Global.game_map = new Game_Map(); Global.player = new Player(); // Trying to start this after everything else, instead of in the middle //move_range_update_thread(); //Debug Global.clear_events(); //Global.Audio.clear_map_theme(); //@Debug (Scene as Scene_Map).set_map(old_scene as Scene_Map_Unit_Editor); Global.game_state.reset_support_data(); Global.change_game_state_turn(); if (old_map != null) { Global.game_map.set_scroll_loc(old_map.display_loc, true, true); Global.player.center_cursor(true); } }