diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 81c903eca6..8cb71654d7 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -2077,9 +2077,7 @@ inline void dComIfGs_setKeyNum(u8 i_keyNum) { } #if TARGET_PC -inline u8 dComIfGs_getKeyNum(int i_stageNo) { - return g_dComIfG_gameInfo.info.getSavedata().getSave(i_stageNo).getBit().getKeyNum(); -} +u8 dComIfGs_getKeyNum(int i_stageNo); #endif inline void dComIfGs_onDungeonItemMap() { diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index aa226bf1de..8c7bcf8b88 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -3316,6 +3316,20 @@ void dComIfGs_setSelectEquipShield(u8 i_itemNo) { g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().setSelectEquip(COLLECT_SHIELD, i_itemNo); } +#if TARGET_PC +u8 dComIfGs_getKeyNum(int i_stageNo) { + // If we're on the current stage for this key, take the current stage info + if (dComIfGp_getStageStagInfo()) { + if (i_stageNo == dStage_stagInfo_GetSaveTbl(dComIfGp_getStageStagInfo())) { + return dComIfGs_getKeyNum(); + } + } + + // Otherwise take info from the save + return g_dComIfG_gameInfo.info.getSavedata().getSave(i_stageNo).getBit().getKeyNum(); +} +#endif + void dComIfGs_setKeyNum(int i_stageNo, u8 i_keyNum) { if (dComIfGp_getStageStagInfo()) { if (i_stageNo == dStage_stagInfo_GetSaveTbl(dComIfGp_getStageStagInfo())) {