diff options
| author | Pepe20129 <72659707+Pepe20129@users.noreply.github.com> | 2023-09-26 16:20:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-26 09:20:33 -0500 |
| commit | d63c9d1774c13d192ba9a2ccf76d95fb016bc352 (patch) | |
| tree | b62e8b4cf4bf9666b769ed3fe922cb361d3acf54 /soh/src/code | |
| parent | 6dd3437ad43026eb018ca419ff9bb3988e6da666 (diff) | |
Quest Cleanup (#3178)
* Change most n64ddFlag checks to IS_RANDO checks
* Change most isMasterQuest checks to IS_MASTER_QUEST checks
* Change most isBossRush checks to IS_BOSS_RUSH checks
* Replace isMasterQuest & isBossRush with questId
* Replace n64ddFlag with questId
Also restore authentic n64ddFlag behavior except savefile saving/loading
* Move quest enum from file_choose.h to z64save.h
* Update macros to not take gSaveContext
Diffstat (limited to 'soh/src/code')
| -rw-r--r-- | soh/src/code/z_actor.c | 8 | ||||
| -rw-r--r-- | soh/src/code/z_demo.c | 18 | ||||
| -rw-r--r-- | soh/src/code/z_en_item00.c | 22 | ||||
| -rw-r--r-- | soh/src/code/z_game_over.c | 2 | ||||
| -rw-r--r-- | soh/src/code/z_horse.c | 4 | ||||
| -rw-r--r-- | soh/src/code/z_kaleido_scope_call.c | 2 | ||||
| -rw-r--r-- | soh/src/code/z_map_exp.c | 8 | ||||
| -rw-r--r-- | soh/src/code/z_message_PAL.c | 8 | ||||
| -rw-r--r-- | soh/src/code/z_onepointdemo.c | 2 | ||||
| -rw-r--r-- | soh/src/code/z_parameter.c | 44 | ||||
| -rw-r--r-- | soh/src/code/z_play.c | 12 | ||||
| -rw-r--r-- | soh/src/code/z_room.c | 2 | ||||
| -rw-r--r-- | soh/src/code/z_scene_table.c | 2 | ||||
| -rw-r--r-- | soh/src/code/z_sram.c | 11 |
14 files changed, 72 insertions, 73 deletions
diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 85b9748df..1a122cc9b 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -1988,7 +1988,7 @@ s32 GiveItemEntryWithoutActor(PlayState* play, GetItemEntry getItemEntry) { if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { if (((player->heldActor != NULL) && ((getItemEntry.getItemId > GI_NONE) && (getItemEntry.getItemId < GI_MAX)) || - (gSaveContext.n64ddFlag && (getItemEntry.getItemId > RG_NONE) && (getItemEntry.getItemId < RG_MAX))) || + (IS_RANDO && (getItemEntry.getItemId > RG_NONE) && (getItemEntry.getItemId < RG_MAX))) || (!(player->stateFlags1 & 0x20000800))) { if ((getItemEntry.getItemId != GI_NONE)) { player->getItemEntry = getItemEntry; @@ -2024,8 +2024,8 @@ s32 GiveItemEntryFromActor(Actor* actor, PlayState* play, GetItemEntry getItemEn if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { if ((((player->heldActor != NULL) || (actor == player->targetActor)) && - ((!gSaveContext.n64ddFlag && ((getItemEntry.getItemId > GI_NONE) && (getItemEntry.getItemId < GI_MAX))) || - (gSaveContext.n64ddFlag && ((getItemEntry.getItemId > RG_NONE) && (getItemEntry.getItemId < RG_MAX))))) || + ((!IS_RANDO && ((getItemEntry.getItemId > GI_NONE) && (getItemEntry.getItemId < GI_MAX))) || + (IS_RANDO && ((getItemEntry.getItemId > RG_NONE) && (getItemEntry.getItemId < RG_MAX))))) || (!(player->stateFlags1 & 0x20000800))) { if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) { s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y; @@ -2066,7 +2066,7 @@ s32 func_8002F434(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { if ((((player->heldActor != NULL) || (actor == player->targetActor)) && - ((!gSaveContext.n64ddFlag && ((getItemId > GI_NONE) && (getItemId < GI_MAX))) || (gSaveContext.n64ddFlag && ((getItemId > RG_NONE) && (getItemId < RG_MAX))))) || + ((!IS_RANDO && ((getItemId > GI_NONE) && (getItemId < GI_MAX))) || (IS_RANDO && ((getItemId > RG_NONE) && (getItemId < RG_MAX))))) || (!(player->stateFlags1 & 0x20000800))) { if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) { s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y; diff --git a/soh/src/code/z_demo.c b/soh/src/code/z_demo.c index bba12161f..e0b17fe72 100644 --- a/soh/src/code/z_demo.c +++ b/soh/src/code/z_demo.c @@ -246,7 +246,7 @@ void func_80064824(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { case 3: if (sp3F != 0) { Flags_SetEnv(play, 0); - if (gSaveContext.entranceIndex == 0x0053 || (gSaveContext.n64ddFlag && gSaveContext.entranceIndex == 0x05F4)) { + if (gSaveContext.entranceIndex == 0x0053 || (IS_RANDO && gSaveContext.entranceIndex == 0x05F4)) { Flags_SetEnv(play, 2); } } @@ -497,7 +497,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB // cmd->base == 8: Traveling back/forward in time cutscene // cmd->base == 24: Dropping a fish for Jabu Jabu // cmd->base == 33: Zelda escaping with impa cutscene - bool randoCsSkip = (gSaveContext.n64ddFlag && (cmd->base == 8 || cmd->base == 24 || cmd->base == 33)); + bool randoCsSkip = (IS_RANDO && (cmd->base == 8 || cmd->base == 24 || cmd->base == 33)); bool debugCsSkip = (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) && (gSaveContext.fileNum != 0xFEDC) && CVarGetInteger("gDebugEnabled", 0)); @@ -2113,7 +2113,7 @@ void Cutscene_HandleEntranceTriggers(PlayState* play) { u8 requiredAge; s16 i; - if (gSaveContext.n64ddFlag && + if (IS_RANDO && // don't skip epona escape cutscenes gSaveContext.entranceIndex != 650 && gSaveContext.entranceIndex != 654 && @@ -2151,9 +2151,9 @@ void Cutscene_HandleConditionalTriggers(PlayState* play) { if ((gSaveContext.gameMode == 0) && (gSaveContext.respawnFlag <= 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) { const bool bShouldTowerRandoSkip = - (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SKIP_TOWER_ESCAPE)); + (IS_RANDO && Randomizer_GetSettingValue(RSK_SKIP_TOWER_ESCAPE)); if ((gSaveContext.entranceIndex == 0x01E1) && !Flags_GetEventChkInf(EVENTCHKINF_LEARNED_REQUIEM_OF_SPIRIT)) { - if (!gSaveContext.n64ddFlag) { + if (!IS_RANDO) { Flags_SetEventChkInf(EVENTCHKINF_LEARNED_REQUIEM_OF_SPIRIT); gSaveContext.entranceIndex = 0x0123; gSaveContext.cutsceneIndex = 0xFFF0; @@ -2161,12 +2161,12 @@ void Cutscene_HandleConditionalTriggers(PlayState* play) { } else if ((gSaveContext.entranceIndex == 0x00DB) && LINK_IS_ADULT && (Flags_GetEventChkInf(EVENTCHKINF_USED_FOREST_TEMPLE_BLUE_WARP)) && (Flags_GetEventChkInf(EVENTCHKINF_USED_FIRE_TEMPLE_BLUE_WARP)) && (Flags_GetEventChkInf(EVENTCHKINF_USED_WATER_TEMPLE_BLUE_WARP)) && !Flags_GetEventChkInf(EVENTCHKINF_BONGO_BONGO_ESCAPED_FROM_WELL)) { - if (!gSaveContext.n64ddFlag) { + if (!IS_RANDO) { Flags_SetEventChkInf(EVENTCHKINF_BONGO_BONGO_ESCAPED_FROM_WELL); gSaveContext.cutsceneIndex = 0xFFF0; } } else if ((gSaveContext.entranceIndex == 0x05E0) && !Flags_GetEventChkInf(EVENTCHKINF_SPOKE_TO_SARIA_ON_BRIDGE)) { - if (!gSaveContext.n64ddFlag) { + if (!IS_RANDO) { Flags_SetEventChkInf(EVENTCHKINF_SPOKE_TO_SARIA_ON_BRIDGE); Item_Give(play, ITEM_OCARINA_FAIRY); gSaveContext.entranceIndex = 0x011E; @@ -2175,7 +2175,7 @@ void Cutscene_HandleConditionalTriggers(PlayState* play) { } else if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && LINK_IS_ADULT && !Flags_GetEventChkInf(EVENTCHKINF_RETURNED_TO_TEMPLE_OF_TIME_WITH_ALL_MEDALLIONS) && (gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_TEMPLE_OF_TIME)) { - if (!gSaveContext.n64ddFlag) { + if (!IS_RANDO) { Flags_SetEventChkInf(EVENTCHKINF_RETURNED_TO_TEMPLE_OF_TIME_WITH_ALL_MEDALLIONS); gSaveContext.entranceIndex = 0x0053; gSaveContext.cutsceneIndex = 0xFFF8; @@ -2187,7 +2187,7 @@ void Cutscene_HandleConditionalTriggers(PlayState* play) { Flags_SetEventChkInf(EVENTCHKINF_WATCHED_GANONS_CASTLE_COLLAPSE_CAUGHT_BY_GERUDO); gSaveContext.entranceIndex = 0x0517; // In rando, skip the cutscene for the tower falling down after the escape. - if (gSaveContext.n64ddFlag) { + if (IS_RANDO) { return; } gSaveContext.cutsceneIndex = 0xFFF0; diff --git a/soh/src/code/z_en_item00.c b/soh/src/code/z_en_item00.c index fc8bbd669..42ea78f90 100644 --- a/soh/src/code/z_en_item00.c +++ b/soh/src/code/z_en_item00.c @@ -381,7 +381,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.03f); this->scale = 0.03f; // Offset keys in randomizer slightly higher for their GID replacement - if (!gSaveContext.n64ddFlag) { + if (!IS_RANDO) { yOffset = 350.0f; } else { yOffset = 430.0f; @@ -488,7 +488,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { RandomizerCheck randoCheck = Randomizer_GetCheckFromActor(this->actor.id, play->sceneNum, this->ogParams); - if (gSaveContext.n64ddFlag && randoCheck != RC_UNKNOWN_CHECK) { + if (IS_RANDO && randoCheck != RC_UNKNOWN_CHECK) { this->randoGiEntry = Randomizer_GetItemFromKnownCheck(randoCheck, getItemId); this->randoGiEntry.getItemFrom = ITEM_FROM_FREESTANDING; @@ -578,7 +578,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { if (!Actor_HasParent(&this->actor, play)) { if (getItemId != GI_NONE) { - if (!gSaveContext.n64ddFlag || this->randoGiEntry.getItemId == GI_NONE) { + if (!IS_RANDO || this->randoGiEntry.getItemId == GI_NONE) { func_8002F554(&this->actor, play, getItemId); } else { GiveItemEntryFromActorWithFixedRange(&this->actor, play, this->randoGiEntry); @@ -731,7 +731,7 @@ void func_8001E5C8(EnItem00* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->getItemId != GI_NONE) { if (!Actor_HasParent(&this->actor, play)) { - if (!gSaveContext.n64ddFlag) { + if (!IS_RANDO) { func_8002F434(&this->actor, play, this->getItemId, 50.0f, 80.0f); } else { GiveItemEntryFromActor(&this->actor, play, this->randoGiEntry, 50.0f, 80.0f); @@ -783,7 +783,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) { this->actor.params == ITEM00_BOMBS_SPECIAL || this->actor.params == ITEM00_BOMBCHU) { if (CVarGetInteger("gNewDrops", 0) || // Keys in randomizer need to always rotate for their GID replacement - (gSaveContext.n64ddFlag && this->actor.params == ITEM00_SMALL_KEY)) { + (IS_RANDO && this->actor.params == ITEM00_SMALL_KEY)) { this->actor.shape.rot.y += 960; } else { this->actor.shape.rot.y = 0; @@ -951,7 +951,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) { params = &this->actor.params; if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, play)) { - if (!gSaveContext.n64ddFlag || this->randoGiEntry.getItemId == GI_NONE) { + if (!IS_RANDO || this->randoGiEntry.getItemId == GI_NONE) { func_8002F554(&this->actor, play, getItemId); } else { getItemId = this->randoGiEntry.getItemId; @@ -1046,7 +1046,7 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) { } break; case ITEM00_HEART_PIECE: - if (CVarGetInteger("gNewDrops", 0) && !gSaveContext.n64ddFlag) { + if (CVarGetInteger("gNewDrops", 0) && !IS_RANDO) { mtxScale = 21.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_HEART_PIECE); @@ -1156,7 +1156,7 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) { break; } case ITEM00_SMALL_KEY: - if (CVarGetInteger("gNewDrops", 0) && !gSaveContext.n64ddFlag) { + if (CVarGetInteger("gNewDrops", 0) && !IS_RANDO) { mtxScale = 8.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_KEY_SMALL); @@ -1362,7 +1362,7 @@ static const Vtx customDropVtx[] = { * Draw Function used for most collectible types of En_Item00 (ammo, bombs, sticks, nuts, magic...). */ void EnItem00_DrawCollectible(EnItem00* this, PlayState* play) { - if (gSaveContext.n64ddFlag && (this->getItemId != GI_NONE || this->actor.params == ITEM00_SMALL_KEY)) { + if (IS_RANDO && (this->getItemId != GI_NONE || this->actor.params == ITEM00_SMALL_KEY)) { RandomizerCheck randoCheck = Randomizer_GetCheckFromActor(this->actor.id, play->sceneNum, this->ogParams); @@ -1456,7 +1456,7 @@ void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play) { * Draw Function used for the Piece of Heart type of En_Item00. */ void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play) { - if (gSaveContext.n64ddFlag) { + if (IS_RANDO) { RandomizerCheck randoCheck = Randomizer_GetCheckFromActor(this->actor.id, play->sceneNum, this->ogParams); @@ -1533,7 +1533,7 @@ s16 func_8001F404(s16 dropId) { } if ((CVarGetInteger("gBombchuDrops", 0) || - (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_ENABLE_BOMBCHU_DROPS) == 1)) && + (IS_RANDO && Randomizer_GetSettingValue(RSK_ENABLE_BOMBCHU_DROPS) == 1)) && (dropId == ITEM00_BOMBS_A || dropId == ITEM00_BOMBS_B || dropId == ITEM00_BOMBS_SPECIAL)) { dropId = EnItem00_ConvertBombDropToBombchu(dropId); } diff --git a/soh/src/code/z_game_over.c b/soh/src/code/z_game_over.c index 315199000..4b10cb5e2 100644 --- a/soh/src/code/z_game_over.c +++ b/soh/src/code/z_game_over.c @@ -33,7 +33,7 @@ void GameOver_Update(PlayState* play) { gSaveContext.eventInf[1] &= ~1; // search inventory for spoiling items and revert if necessary - if (!(gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE))) { + if (!(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE))) { for (i = 0; i < ARRAY_COUNT(gSpoilingItems); i++) { if (INV_CONTENT(ITEM_POCKET_EGG) == gSpoilingItems[i]) { INV_CONTENT(gSpoilingItemReverts[i]) = gSpoilingItemReverts[i]; diff --git a/soh/src/code/z_horse.c b/soh/src/code/z_horse.c index 3d63a467a..c36e6095e 100644 --- a/soh/src/code/z_horse.c +++ b/soh/src/code/z_horse.c @@ -73,8 +73,8 @@ void func_8006D0EC(PlayState* play, Player* player) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1, true); assert(horseActor != NULL); } else if ((play->sceneNum == gSaveContext.horseData.scene) && - (((Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) != 0) && (!gSaveContext.n64ddFlag || - (gSaveContext.n64ddFlag && CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && + (((Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) != 0) && (!IS_RANDO || + (IS_RANDO && CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && (INV_CONTENT(ITEM_OCARINA_FAIRY) != ITEM_NONE)))) || DREG(1) != 0)) { // "Set by existence of horse %d %d %d" osSyncPrintf("馬存在によるセット %d %d %d\n", gSaveContext.horseData.scene, Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED), diff --git a/soh/src/code/z_kaleido_scope_call.c b/soh/src/code/z_kaleido_scope_call.c index 6f0648e08..dd7e3fdd9 100644 --- a/soh/src/code/z_kaleido_scope_call.c +++ b/soh/src/code/z_kaleido_scope_call.c @@ -57,7 +57,7 @@ void KaleidoScopeCall_Update(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; if (!gSaveContext.sohStats.gameComplete && - (!gSaveContext.isBossRush || !gSaveContext.isBossRushPaused)) { + (!IS_BOSS_RUSH || !gSaveContext.isBossRushPaused)) { gSaveContext.sohStats.pauseTimer++; } diff --git a/soh/src/code/z_map_exp.c b/soh/src/code/z_map_exp.c index caeef6887..c4db0098b 100644 --- a/soh/src/code/z_map_exp.c +++ b/soh/src/code/z_map_exp.c @@ -394,8 +394,8 @@ void Map_InitData(PlayState* play, s16 room) { } } else if (play->sceneNum == SCENE_LAKE_HYLIA) { if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && - ((!gSaveContext.n64ddFlag && !CHECK_QUEST_ITEM(QUEST_MEDALLION_WATER)) || - (gSaveContext.n64ddFlag && !Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_WATER_TEMPLE)))) { + ((!IS_RANDO && !CHECK_QUEST_ITEM(QUEST_MEDALLION_WATER)) || + (IS_RANDO && !Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_WATER_TEMPLE)))) { extendedMapIndex = 0x15; } } else if (play->sceneNum == SCENE_GERUDO_VALLEY) { @@ -403,8 +403,8 @@ void Map_InitData(PlayState* play, s16 room) { extendedMapIndex = 0x16; } } else if (play->sceneNum == SCENE_GERUDOS_FORTRESS) { - if ((!gSaveContext.n64ddFlag && GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) || - (gSaveContext.n64ddFlag && CHECK_QUEST_ITEM(QUEST_GERUDO_CARD))) { + if ((!IS_RANDO && GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) || + (IS_RANDO && CHECK_QUEST_ITEM(QUEST_GERUDO_CARD))) { extendedMapIndex = 0x17; } } diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 91f9003a2..c88c698c7 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -1617,9 +1617,9 @@ void Message_OpenText(PlayState* play, u16 textId) { // Increments text id based on piece of heart count, assumes the piece of heart text is all // in order and that you don't have more than the intended amount of heart pieces. textId += (gSaveContext.inventory.questItems & 0xF0000000 & 0xF0000000) >> 0x1C; - } else if (!gSaveContext.n64ddFlag && (msgCtx->textId == 0xC && CHECK_OWNED_EQUIP(EQUIP_SWORD, 2))) { + } else if (!IS_RANDO && (msgCtx->textId == 0xC && CHECK_OWNED_EQUIP(EQUIP_SWORD, 2))) { textId = 0xB; // Traded Giant's Knife for Biggoron Sword - } else if (!gSaveContext.n64ddFlag && (msgCtx->textId == 0xB4 && (Flags_GetEventChkInf(EVENTCHKINF_SPOKE_TO_CURSED_MAN_IN_SKULL_HOUSE)))) { + } else if (!IS_RANDO && (msgCtx->textId == 0xB4 && (Flags_GetEventChkInf(EVENTCHKINF_SPOKE_TO_CURSED_MAN_IN_SKULL_HOUSE)))) { textId = 0xB5; // Destroyed Gold Skulltula } // Ocarina Staff + Dialog @@ -2517,7 +2517,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { if (msgCtx->lastPlayedSong < OCARINA_SONG_SARIAS && (msgCtx->ocarinaAction < OCARINA_ACTION_PLAYBACK_MINUET || msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_SARIA)) { - if (msgCtx->disableWarpSongs || (interfaceCtx->restrictions.warpSongs == 3 && !gSaveContext.n64ddFlag)) { + if (msgCtx->disableWarpSongs || (interfaceCtx->restrictions.warpSongs == 3 && !IS_RANDO)) { Message_StartTextbox(play, 0x88C, NULL); // "You can't warp here!" play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else if ((gSaveContext.eventInf[0] & 0xF) != 1) { @@ -2603,7 +2603,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { msgCtx->lastPlayedSong = msgCtx->ocarinaStaff->state; msgCtx->msgMode = MSGMODE_SONG_PLAYBACK_SUCCESS; - if (!gSaveContext.n64ddFlag) { + if (!IS_RANDO) { Item_Give(play, ITEM_SONG_MINUET + gOcarinaSongItemMap[msgCtx->ocarinaStaff->state]); } diff --git a/soh/src/code/z_onepointdemo.c b/soh/src/code/z_onepointdemo.c index 704c28585..ab62692cc 100644 --- a/soh/src/code/z_onepointdemo.c +++ b/soh/src/code/z_onepointdemo.c @@ -792,7 +792,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor case 4100: csInfo->keyFrames = D_801225D4; // RANDO: Waterfall opening cutscene skips to the end of the cutscene data earlier by doing this - if (!(gSaveContext.n64ddFlag)) { + if (!(IS_RANDO)) { csInfo->keyFrameCnt = 5; } else { csInfo->keyFrameCnt = 2; diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 93bf8fbfd..75c85e3e4 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -884,7 +884,7 @@ void func_80083108(PlayState* play) { } } // Don't hide the HUD in the Chamber of Sages when in Boss Rush. - } else if (play->sceneNum == SCENE_CHAMBER_OF_THE_SAGES && !gSaveContext.isBossRush) { + } else if (play->sceneNum == SCENE_CHAMBER_OF_THE_SAGES && !IS_BOSS_RUSH) { Interface_ChangeAlpha(1); } else if (play->sceneNum == SCENE_FISHING_POND) { gSaveContext.unk_13E7 = 2; @@ -1413,7 +1413,7 @@ void Inventory_SwapAgeEquipment(void) { // When becoming adult, remove swordless flag since we'll get master sword // Only in rando to keep swordless link bugs in vanilla - if (gSaveContext.n64ddFlag) { + if (IS_RANDO) { Flags_UnsetInfTable(INFTABLE_SWORDLESS); } @@ -1467,7 +1467,7 @@ void Inventory_SwapAgeEquipment(void) { } else { // When becoming child, set swordless flag if player doesn't have kokiri sword // Only in rando to keep swordless link bugs in vanilla - if (gSaveContext.n64ddFlag && (1 << 0 & gSaveContext.inventory.equipment) == 0) { + if (IS_RANDO && (1 << 0 & gSaveContext.inventory.equipment) == 0) { Flags_SetInfTable(INFTABLE_SWORDLESS); } @@ -1533,7 +1533,7 @@ void Inventory_SwapAgeEquipment(void) { gSaveContext.equips.equipment = gSaveContext.childEquips.equipment; gSaveContext.equips.equipment &= 0xFFF0; gSaveContext.equips.equipment |= 0x0001; - } else if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_STARTING_AGE) == RO_AGE_ADULT) { + } else if (IS_RANDO && Randomizer_GetSettingValue(RSK_STARTING_AGE) == RO_AGE_ADULT) { /*If in rando and starting age is adult, childEquips is not initialized and buttonItems[0] will be ITEM_NONE. When changing age from adult -> child, reset equips to "default" (only kokiri tunic/boots equipped, no sword, no C-button items, no D-Pad items). @@ -1837,7 +1837,7 @@ u8 Item_Give(PlayState* play, u8 item) { // In rando, when buying Giant's Knife, also check // for 0xE in case we don't have Kokiri Sword - if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF || (gSaveContext.n64ddFlag && ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xE)) { + if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF || (IS_RANDO && ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xE)) { gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; @@ -1944,13 +1944,13 @@ u8 Item_Give(PlayState* play, u8 item) { return Return_Item(item, MOD_NONE, ITEM_NONE); } else if (item == ITEM_WALLET_ADULT) { Inventory_ChangeUpgrade(UPG_WALLET, 1); - if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_FULL_WALLETS)) { + if (IS_RANDO && Randomizer_GetSettingValue(RSK_FULL_WALLETS)) { Rupees_ChangeBy(200); } return Return_Item(item, MOD_NONE, ITEM_NONE); } else if (item == ITEM_WALLET_GIANT) { Inventory_ChangeUpgrade(UPG_WALLET, 2); - if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_FULL_WALLETS)) { + if (IS_RANDO && Randomizer_GetSettingValue(RSK_FULL_WALLETS)) { Rupees_ChangeBy(500); } return Return_Item(item, MOD_NONE, ITEM_NONE); @@ -1994,7 +1994,7 @@ u8 Item_Give(PlayState* play, u8 item) { } } // update the adult/child equips when rando'd (accounting for equp swapped hookshot as child) - if (gSaveContext.n64ddFlag && LINK_IS_CHILD) { + if (IS_RANDO && LINK_IS_CHILD) { for (i = 1; i < ARRAY_COUNT(gSaveContext.adultEquips.buttonItems); i++) { if (gSaveContext.adultEquips.buttonItems[i] == ITEM_HOOKSHOT) { gSaveContext.adultEquips.buttonItems[i] = ITEM_LONGSHOT; @@ -2004,7 +2004,7 @@ u8 Item_Give(PlayState* play, u8 item) { } } } - if (gSaveContext.n64ddFlag && LINK_IS_ADULT) { + if (IS_RANDO && LINK_IS_ADULT) { for (i = 1; i < ARRAY_COUNT(gSaveContext.childEquips.buttonItems); i++) { if (gSaveContext.childEquips.buttonItems[i] == ITEM_HOOKSHOT) { gSaveContext.childEquips.buttonItems[i] = ITEM_LONGSHOT; @@ -2149,7 +2149,7 @@ u8 Item_Give(PlayState* play, u8 item) { } // update the adult/child equips when rando'd - if (gSaveContext.n64ddFlag && LINK_IS_CHILD) { + if (IS_RANDO && LINK_IS_CHILD) { for (i = 1; i < ARRAY_COUNT(gSaveContext.adultEquips.buttonItems); i++) { if (gSaveContext.adultEquips.buttonItems[i] == ITEM_OCARINA_FAIRY) { gSaveContext.adultEquips.buttonItems[i] = ITEM_OCARINA_TIME; @@ -2159,7 +2159,7 @@ u8 Item_Give(PlayState* play, u8 item) { } } } - if (gSaveContext.n64ddFlag && LINK_IS_ADULT) { + if (IS_RANDO && LINK_IS_ADULT) { for (i = 1; i < ARRAY_COUNT(gSaveContext.childEquips.buttonItems); i++) { if (gSaveContext.childEquips.buttonItems[i] == ITEM_OCARINA_FAIRY) { gSaveContext.childEquips.buttonItems[i] = ITEM_OCARINA_TIME; @@ -2515,7 +2515,7 @@ u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) { if (item == RG_TYCOON_WALLET) { Inventory_ChangeUpgrade(UPG_WALLET, 3); - if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_FULL_WALLETS)) { + if (IS_RANDO && Randomizer_GetSettingValue(RSK_FULL_WALLETS)) { Rupees_ChangeBy(999); } return Return_Item_Entry(giEntry, RG_NONE); @@ -2576,7 +2576,7 @@ u8 Item_CheckObtainability(u8 item) { osSyncPrintf("item_get_non_setting=%d pt=%d z=%x\n", item, slot, gSaveContext.inventory.items[slot]); osSyncPrintf(VT_RST); - if (gSaveContext.n64ddFlag) { + if (IS_RANDO) { if (item == ITEM_SINGLE_MAGIC || item == ITEM_DOUBLE_MAGIC || item == ITEM_DOUBLE_DEFENSE) { return ITEM_NONE; } @@ -2593,25 +2593,25 @@ u8 Item_CheckObtainability(u8 item) { return ITEM_NONE; } else if ((gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD]) & gSaveContext.inventory.equipment) { - return gSaveContext.n64ddFlag ? ITEM_NONE : item; + return IS_RANDO ? ITEM_NONE : item; } else { return ITEM_NONE; } } else if ((item >= ITEM_SHIELD_DEKU) && (item <= ITEM_SHIELD_MIRROR)) { if ((gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]) & gSaveContext.inventory.equipment) { - return gSaveContext.n64ddFlag ? ITEM_NONE : item; + return IS_RANDO ? ITEM_NONE : item; } else { return ITEM_NONE; } } else if ((item >= ITEM_TUNIC_KOKIRI) && (item <= ITEM_TUNIC_ZORA)) { if ((gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]) & gSaveContext.inventory.equipment) { - return gSaveContext.n64ddFlag ? ITEM_NONE : item; + return IS_RANDO ? ITEM_NONE : item; } else { return ITEM_NONE; } } else if ((item >= ITEM_BOOTS_KOKIRI) && (item <= ITEM_BOOTS_HOVER)) { if ((gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]) & gSaveContext.inventory.equipment) { - return gSaveContext.n64ddFlag ? ITEM_NONE : item; + return IS_RANDO ? ITEM_NONE : item; } else { return ITEM_NONE; } @@ -2828,7 +2828,7 @@ s32 Inventory_ConsumeFairy(PlayState* play) { } bool Inventory_HatchPocketCucco(PlayState* play) { - if (!gSaveContext.n64ddFlag) { + if (!IS_RANDO) { return Inventory_ReplaceItem(play, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO); } @@ -5096,7 +5096,7 @@ void Interface_Draw(PlayState* play) { } gDPSetPrimColor(OVERLAY_DISP++, 0, 0, rColor.r, rColor.g, rColor.b, interfaceCtx->magicAlpha); // Draw Rupee icon. Hide in Boss Rush. - if (!gSaveContext.isBossRush) { + if (!IS_BOSS_RUSH) { OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, PosX_RC, PosY_RC, 16, 16, 1 << 10, 1 << 10); } @@ -5214,7 +5214,7 @@ void Interface_Draw(PlayState* play) { svar5 = rupeeDigitsCount[CUR_UPG_VALUE(UPG_WALLET)]; // Draw Rupee Counter. Hide in Boss Rush. - if (!gSaveContext.isBossRush) { + if (!IS_BOSS_RUSH) { for (svar1 = 0, svar3 = 16; svar1 < svar5; svar1++, svar2++, svar3 += 8) { OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, ((u8*)digitTextures[interfaceCtx->counterDigits[svar2]]), 8, 16, PosX_RC + svar3, PosY_RC, 8, 16, 1 << 10, 1 << 10); @@ -6152,7 +6152,7 @@ void Interface_Draw(PlayState* play) { void Interface_DrawTotalGameplayTimer(PlayState* play) { // Draw timer based on the Gameplay Stats total time. - if ((gSaveContext.isBossRush && gSaveContext.bossRushOptions[BR_OPTIONS_TIMER] == BR_CHOICE_TIMER_YES) || + if ((IS_BOSS_RUSH && gSaveContext.bossRushOptions[BR_OPTIONS_TIMER] == BR_CHOICE_TIMER_YES) || (CVarGetInteger("gGameplayStats.ShowIngameTimer", 0) && gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2)) { s32 X_Margins_Timer = 0; @@ -6639,7 +6639,7 @@ void Interface_Update(PlayState* play) { play->nextEntranceIndex = gSaveContext.entranceIndex; // In ER, handle sun song respawn from last entrance from grottos - if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { + if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { Grotto_ForceGrottoReturn(); } diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index 7e480ad27..45977b6e7 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -179,7 +179,7 @@ void Play_Destroy(GameState* thisx) { } // In ER, remove link from epona when entering somewhere that doesn't support epona - if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_OVERWORLD_ENTRANCES)) { + if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_OVERWORLD_ENTRANCES)) { Entrance_HandleEponaState(); } @@ -469,7 +469,7 @@ void Play_Init(GameState* thisx) { // eventChkInf[5] & 0x200 = Got Impa's reward // entranceIndex 0x7A, Castle Courtyard - Day from crawlspace // entranceIndex 0x400, Zelda's Courtyard - if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SKIP_CHILD_STEALTH) && + if (IS_RANDO && Randomizer_GetSettingValue(RSK_SKIP_CHILD_STEALTH) && !Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER) && !Flags_GetEventChkInf(EVENTCHKINF_LEARNED_ZELDAS_LULLABY)) { if (gSaveContext.entranceIndex == 0x7A) { gSaveContext.entranceIndex = 0x400; @@ -1181,7 +1181,7 @@ void Play_Update(PlayState* play) { play->gameplayFrames++; // Gameplay stat tracking if (!gSaveContext.sohStats.gameComplete && - (!gSaveContext.isBossRush || (gSaveContext.isBossRush && !gSaveContext.isBossRushPaused))) { + (!IS_BOSS_RUSH || (IS_BOSS_RUSH && !gSaveContext.isBossRushPaused))) { gSaveContext.sohStats.playTimer++; gSaveContext.sohStats.sceneTimer++; gSaveContext.sohStats.roomTimer++; @@ -1419,7 +1419,7 @@ skip: Environment_Update(play, &play->envCtx, &play->lightCtx, &play->pauseCtx, &play->msgCtx, &play->gameOverCtx, play->state.gfxCtx); - if (gSaveContext.n64ddFlag) { + if (IS_RANDO) { GivePlayerRandoRewardSariaGift(play, RC_LW_GIFT_FROM_SARIA); GivePlayerRandoRewardSongOfTime(play, RC_SONG_FROM_OCARINA_OF_TIME); GivePlayerRandoRewardZeldaLightArrowsGift(play, RC_TOT_LIGHT_ARROWS_CUTSCENE); @@ -1918,7 +1918,7 @@ void* Play_LoadFile(PlayState* play, RomFile* file) { void Play_InitEnvironment(PlayState* play, s16 skyboxId) { // For entrance rando, ensure the correct weather state and sky mode is applied - if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { + if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { Entrance_OverrideWeatherState(); } Skybox_Init(&play->state, &play->skyboxCtx, skyboxId); @@ -1955,7 +1955,7 @@ void Play_SpawnScene(PlayState* play, s32 sceneNum, s32 spawn) { OTRPlay_SpawnScene(play, sceneNum, spawn); - if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { + if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { Entrance_OverrideSpawnScene(sceneNum, spawn); } } diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index 81fe2714b..ccbc93d0d 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -579,7 +579,7 @@ s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) { size_t size; // In ER, override roomNum to load based on scene and spawn - if (gSaveContext.n64ddFlag && gSaveContext.respawnFlag <= 0 && + if (IS_RANDO && gSaveContext.respawnFlag <= 0 && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { roomNum = Entrance_OverrideSpawnSceneRoom(play->sceneNum, play->curSpawn, roomNum); } diff --git a/soh/src/code/z_scene_table.c b/soh/src/code/z_scene_table.c index 00593d0dd..d1065533c 100644 --- a/soh/src/code/z_scene_table.c +++ b/soh/src/code/z_scene_table.c @@ -2091,7 +2091,7 @@ void func_8009EE44(PlayState* play) { gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); bool playerHasCojiro = INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO; - if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE)) { + if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE)) { playerHasCojiro = PLAYER_HAS_SHUFFLED_ADULT_TRADE_ITEM(ITEM_COJIRO); } if ((play->roomCtx.unk_74[0] == 0) && playerHasCojiro) { diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index 8dbb96087..fd2b5ebd9 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -155,7 +155,7 @@ void Sram_OpenSave() { } // if zelda cutscene has been watched but lullaby was not obtained, restore cutscene and take away letter - if ((Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER)) && !CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) && !gSaveContext.n64ddFlag) { + if ((Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER)) && !CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) && !IS_RANDO) { i = gSaveContext.eventChkInf[4] & ~1; gSaveContext.eventChkInf[4] = i; @@ -176,7 +176,7 @@ void Sram_OpenSave() { gSaveContext.equips.equipment |= 2; } - if (!(gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE))) { + if (!(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE))) { for (i = 0; i < ARRAY_COUNT(gSpoilingItems); i++) { if (INV_CONTENT(ITEM_TRADE_ADULT) == gSpoilingItems[i]) { INV_CONTENT(gSpoilingItemReverts[i]) = gSpoilingItemReverts[i]; @@ -218,11 +218,10 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) { gSaveContext.playerName[offset] = Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->playerName[offset]; } + gSaveContext.n64ddFlag = fileChooseCtx->n64ddFlag; + if (fileChooseCtx->questType[fileChooseCtx->buttonIndex] == 2 && strnlen(CVarGetString("gSpoilerLog", ""), 1) != 0) { - // Set N64DD Flags for save file - fileChooseCtx->n64ddFlags[fileChooseCtx->buttonIndex] = 1; - fileChooseCtx->n64ddFlag = 1; - gSaveContext.n64ddFlag = 1; + gSaveContext.questId = 2; Randomizer_InitSaveFile(); } |
