Mod so that when loading save, player goes to last entrance

If the player saves in a grotto, he will go back to link's house or
temple of time.
This commit is contained in:
William Kirk 2022-04-27 14:53:21 -05:00
parent eea5135d62
commit b57a6ecdec
5 changed files with 36 additions and 2 deletions

View File

@ -83,6 +83,9 @@ namespace Game {
Settings.enhancements.newdrops = stob(Conf[EnhancementSection]["newdrops"]);
CVar_SetS32("gNewDrops", Settings.enhancements.newdrops);
Settings.enhancements.save_entrance = stob(Conf[EnhancementSection]["save_entrance"]);
CVar_SetS32("gSaveEntrance", Settings.enhancements.save_entrance);
// Audio
Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]);

View File

@ -0,0 +1,9 @@
diff a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp (rejected hunks)
@@ -184,6 +187,7 @@ namespace Game {
Conf[EnhancementSection]["newdrops"] = std::to_string(Settings.enhancements.newdrops);
Conf[EnhancementSection]["visualagony"] = std::to_string(Settings.enhancements.visualagony);
Conf[EnhancementSection]["mm_bunny_hood"] = std::to_string(Settings.enhancements.mm_bunny_hood);
+ Conf[EnhancementSection]["save_entrance"] = std::to_string(Settings.enhancements.save_entrance);
// Controllers

View File

@ -0,0 +1,9 @@
diff a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h (rejected hunks)
@@ -29,6 +29,7 @@ struct SoHConfigType {
bool newdrops = false;
bool visualagony = false;
bool mm_bunny_hood = false;
+ bool save_entrance = true;
} enhancements;

View File

@ -508,6 +508,11 @@ namespace SohImGui {
needs_save = true;
}
if (ImGui::Checkbox("Save Last Entrance", &Game::Settings.enhancements.save_entrance)) {
CVar_SetS32("gSaveEntrance", Game::Settings.enhancements.save_entrance);
needs_save = true;
}
ImGui::Text("Graphics");
ImGui::Separator();

View File

@ -362,14 +362,22 @@ void Sram_OpenSave(SramContext* sramCtx) {
case SCENE_GANON_DEMO:
gSaveContext.entranceIndex = 0x41B;
break;
default:
case SCENE_KAKUSIANA:
if (gSaveContext.savedSceneNum != SCENE_LINK_HOME) {
gSaveContext.entranceIndex = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? 0xBB : 0x5F4;
} else {
gSaveContext.entranceIndex = 0xBB;
}
break;
default:
if (!CVar_GetS32("gSaveEntrance", 0)) {
if (gSaveContext.savedSceneNum != SCENE_LINK_HOME) {
gSaveContext.entranceIndex = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? 0xBB : 0x5F4;
} else {
gSaveContext.entranceIndex = 0xBB;
}
break;
}
}
osSyncPrintf("scene_no = %d\n", gSaveContext.entranceIndex);