Fix some situations where trade items spoiled (#4569)

* Fix some situations where trade items reverted

* Update z_game_over.c

* Hopefully fix mac
This commit is contained in:
Pepe20129 2024-11-27 18:33:50 +01:00 committed by GitHub
parent 5b7b38f198
commit a92c08dea1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 11 deletions

View File

@ -1,5 +1,7 @@
#include "global.h"
#include "soh/OTRGlobals.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
void GameOver_Init(PlayState* play) {
play->gameOverCtx.state = GAMEOVER_INACTIVE;
@ -34,7 +36,7 @@ void GameOver_Update(PlayState* play) {
gSaveContext.eventInf[1] &= ~1;
// search inventory for spoiling items and revert if necessary
if (!(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE))) {
if (GameInteractor_Should(VB_REVERT_SPOILING_ITEMS, true)) {
for (i = 0; i < ARRAY_COUNT(gSpoilingItems); i++) {
if (INV_CONTENT(ITEM_POCKET_EGG) == gSpoilingItems[i]) {
INV_CONTENT(gSpoilingItemReverts[i]) = gSpoilingItemReverts[i];

View File

@ -5685,6 +5685,7 @@ void Interface_Draw(PlayState* play) {
}
// Revert any spoiling trade quest items
if (GameInteractor_Should(VB_REVERT_SPOILING_ITEMS, true)) {
for (svar1 = 0; svar1 < ARRAY_COUNT(gSpoilingItems); svar1++) {
if (INV_CONTENT(ITEM_TRADE_ADULT) == gSpoilingItems[svar1]) {
gSaveContext.eventInf[0] &= 0x7F80;
@ -5701,6 +5702,7 @@ void Interface_Draw(PlayState* play) {
}
}
}
}
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) &&
(play->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == MSGMODE_NONE) &&