From 3e99420527d043df50fd009de9b8ae3d10876215 Mon Sep 17 00:00:00 2001 From: gymnast86 Date: Tue, 5 May 2026 05:13:26 -0700 Subject: [PATCH] allow keeping ooccoo jr through dungeon exits --- include/d/d_save.h | 4 ++++ src/d/actor/d_a_alink_demo.inc | 7 ++++++ src/d/d_gameover.cpp | 6 +++++ src/d/d_save.cpp | 43 ++++++++-------------------------- 4 files changed, 27 insertions(+), 33 deletions(-) diff --git a/include/d/d_save.h b/include/d/d_save.h index f437ba77a3..b7cfdd2e2d 100644 --- a/include/d/d_save.h +++ b/include/d/d_save.h @@ -680,10 +680,14 @@ public: void onDungeonItemBossKey() { onDungeonItem(BOSS_KEY); } void offDungeonItemBossKey() { offDungeonItem(BOSS_KEY); } s32 isDungeonItemBossKey() const { return isDungeonItem(BOSS_KEY); } +#if TARGET_PC + void onStageBossEnemy(); +#else void onStageBossEnemy() { onDungeonItem(STAGE_BOSS_ENEMY); onDungeonItem(OOCCOO_NOTE); } +#endif void offStageBossEnemy() { offDungeonItem(STAGE_BOSS_ENEMY); } s32 isStageBossEnemy() const { return isDungeonItem(STAGE_BOSS_ENEMY); } void onStageLife() { onDungeonItem(STAGE_LIFE); } diff --git a/src/d/actor/d_a_alink_demo.inc b/src/d/actor/d_a_alink_demo.inc index b6ea961a8f..17d506fb82 100644 --- a/src/d/actor/d_a_alink_demo.inc +++ b/src/d/actor/d_a_alink_demo.inc @@ -4842,6 +4842,13 @@ int daAlink_c::procCoWarpInit(int param_0, int param_1) { (checkItemGet(dItemNo_DUNGEON_BACK_e, 1) && strcmp(stageName, dComIfGs_getWarpStageName()) == 0)) { +#if TARGET_PC + // In rando, only clear the Ooccoo slot if Ooccoo is in it + u8 ooccooSlot = dComIfGs_getItem(SLOT_18, false); + if (!randomizer_IsActive() || ooccooSlot == dItemNo_Randomizer_DUNGEON_EXIT_e || + ooccooSlot == dItemNo_Randomizer_DUNGEON_EXIT_2_e || + ooccooSlot == dItemNo_Randomizer_LV7_DUNGEON_EXIT_e) +#endif dComIfGs_setItem(SLOT_18, dItemNo_NONE_e); dComIfGs_resetLastWarpAcceptStage(); } diff --git a/src/d/d_gameover.cpp b/src/d/d_gameover.cpp index 870fb00f14..bf3958be86 100644 --- a/src/d/d_gameover.cpp +++ b/src/d/d_gameover.cpp @@ -156,6 +156,12 @@ int dGameover_c::_create() { if (!strcmp(dComIfGp_getLastPlayStageName(), "D_MN10A")) { // Last stage was Stallord Arena // Remove Ooccoo from inventory +#if TARGET_PC + // In rando, only clear the Ooccoo slot if Ooccoo is in it + u8 ooccooSlot = dComIfGs_getItem(SLOT_18, false); + if (!randomizer_IsActive() || ooccooSlot == dItemNo_Randomizer_DUNGEON_EXIT_e || + ooccooSlot == dItemNo_Randomizer_DUNGEON_EXIT_2_e) +#endif dComIfGs_setItem(SLOT_18, dItemNo_NONE_e); dComIfGs_resetLastWarpAcceptStage(); } diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp index f946260cc1..0f72129c76 100644 --- a/src/d/d_save.cpp +++ b/src/d/d_save.cpp @@ -1243,39 +1243,6 @@ void dSv_memBit_c::onDungeonItem(int i_no) { if (i_no == STAGE_LIFE) { return; } - - switch(i_no) - { - case STAGE_BOSS_ENEMY: - { - // Start at 1 because we haven't set the current dungeon's flag yet. - int numCompletedDungeons = 1; - for (int i = 0x10; i < 0x18; i++) - { - if (dComIfGs_isStageBossEnemy(i)) - { - numCompletedDungeons++; - } - } - - /* - Pasting rando code for the time being until the framework is built: - // Check if we have completed enough dungeons to break the barrier. - randoPtr->checkSetHCBarrierFlag(rando::HC_Dungeons, numDungeons); - - // Check if we have completed enough dungeons to unlock the BK check. - randoPtr->checkSetHCBkFlag(rando::HC_BK_Dungeons, numDungeons); - */ - if (i_no == 0x13) // Stallord - { - /* - const uint32_t agDungeonReward = randoPtr->getEventItem(rando::customItems::Mirror_Piece_1); - randoPtr->addItemToEventQueue(agDungeonReward); - */ - } - break; - } - } } #endif mDungeonItem |= (u8)(1 << i_no); @@ -1355,6 +1322,16 @@ s32 dSv_memBit_c::isDungeonItem(int i_no) const { return mDungeonItem & (u8)(1 << i_no) ? TRUE : FALSE; } +#if TARGET_PC +void dSv_memBit_c::onStageBossEnemy() { + onDungeonItem(STAGE_BOSS_ENEMY); + // Don't turn Ooccoo into the note when defeating a boss + if (!randomizer_IsActive()) { + onDungeonItem(OOCCOO_NOTE); + } +} +#endif + void dSv_event_c::init() { int i; for (i = 0; i < MAX_EVENTS; i++) {