Fix: Clean up flags when using debug warp (#728)

* Fix: Clean up flags when using debug warp

* comments
This commit is contained in:
Archez 2024-06-28 17:48:24 -04:00 committed by GitHub
parent 6af9227293
commit f201a494d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,13 +20,33 @@ void MapSelect_LoadConsoleLogo(MapSelectState* this) {
void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) {
if (gSaveContext.fileNum == 0xFF) {
Sram_InitDebugSave();
// #region 2S2H [Debug] Clear all flags when using debug file slot.
// This is mostly copied from Sram_OpenSave.
for (size_t i = 0; i < ARRAY_COUNT(gSaveContext.eventInf); i++) {
gSaveContext.eventInf[i] = 0;
}
for (size_t i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) {
gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.saveInfo.permanentSceneFlags[i].chest;
gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0;
gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1;
gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom;
gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible;
}
// #endregion
}
// #region 2S2H [Debug] Clear some potential lingering flags
CLEAR_EVENTINF(EVENTINF_17);
CLEAR_EVENTINF(EVENTINF_TRIGGER_DAYTELOP);
// #endregion
gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED;
gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_ENABLED;
gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED;
gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED;
// #region 2S2H
// #region 2S2H [Dpad]
gSaveContext.shipSaveContext.dpad.status[EQUIP_SLOT_D_RIGHT] = BTN_ENABLED;
gSaveContext.shipSaveContext.dpad.status[EQUIP_SLOT_D_LEFT] = BTN_ENABLED;
gSaveContext.shipSaveContext.dpad.status[EQUIP_SLOT_D_DOWN] = BTN_ENABLED;