From f474a86928d9dd32ac2a2931096251b527d4be62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Sat, 17 Jan 2026 20:34:24 +0000 Subject: [PATCH] Cleanup various things noticed while fixing rando generation / debug warp (#6152) Adjust RAND_GET_OPTION to return option instead of option value --- soh/soh/Enhancements/InjectItemCounts.cpp | 4 +- soh/soh/Enhancements/NoSkulltulaFreeze.cpp | 4 +- .../SkipCutscene/Story/SkipBlueWarp.cpp | 4 +- soh/soh/Enhancements/Warping.cpp | 3 +- .../Enhancements/randomizer/3drando/fill.cpp | 2 +- soh/soh/Enhancements/randomizer/Bombchus.cpp | 7 +- .../randomizer/Messages/GossipStoneHints.cpp | 2 - .../randomizer/Messages/MerchantMessages.cpp | 16 ++-- .../randomizer/Messages/StaticHints.cpp | 15 ++-- soh/soh/Enhancements/randomizer/SeedContext.h | 2 +- .../Enhancements/randomizer/ShuffleCrates.cpp | 39 +++++---- .../randomizer/ShuffleFreestanding.cpp | 7 +- .../Enhancements/randomizer/ShuffleGrass.cpp | 8 +- .../Enhancements/randomizer/ShufflePots.cpp | 11 ++- .../Enhancements/randomizer/fishsanity.cpp | 4 +- .../Enhancements/randomizer/hook_handlers.cpp | 79 +++++++++---------- .../Enhancements/randomizer/location_list.cpp | 2 +- .../Enhancements/timesaver_hook_handlers.cpp | 3 +- soh/soh/OTRGlobals.cpp | 17 +--- .../ovl_file_choose/z_file_choose.c | 3 - 20 files changed, 99 insertions(+), 133 deletions(-) diff --git a/soh/soh/Enhancements/InjectItemCounts.cpp b/soh/soh/Enhancements/InjectItemCounts.cpp index 0f43c3852..ac00ad394 100644 --- a/soh/soh/Enhancements/InjectItemCounts.cpp +++ b/soh/soh/Enhancements/InjectItemCounts.cpp @@ -4,8 +4,6 @@ extern "C" { #include "variables.h" } -#define RAND_GET_OPTION(rsk) OTRGlobals::Instance->gRandoContext->GetOption(rsk) - void BuildSkulltulaMessage(uint16_t* textId, bool* loadFromMessageTable) { CustomMessage msg = CustomMessage("You got a %rGold Skulltula Token%w!&You've collected %r[[gsCount]]%w tokens&in total!", @@ -22,7 +20,7 @@ void BuildSkulltulaMessage(uint16_t* textId, bool* loadFromMessageTable) { // RANDOTODO: Implement a way to determine if an item came from a skulltula and // inject the auto-dismiss control code if it did. if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 && - !(IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_TOKENS).IsNot(RO_TOKENSANITY_OFF))) { + !(IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_TOKENS))) { // Auto dismiss textbox after 0x3C (60) frames (about 3 seconds for OoT) msg = msg + "\x0E\x3C"; } diff --git a/soh/soh/Enhancements/NoSkulltulaFreeze.cpp b/soh/soh/Enhancements/NoSkulltulaFreeze.cpp index 3b3051417..abefde2b5 100644 --- a/soh/soh/Enhancements/NoSkulltulaFreeze.cpp +++ b/soh/soh/Enhancements/NoSkulltulaFreeze.cpp @@ -4,10 +4,8 @@ extern "C" { #include "variables.h" } -#define RAND_GET_OPTION(rsk) OTRGlobals::Instance->gRandoContext->GetOption(rsk) - void AutoDismissSkulltulaMessage(uint16_t* textId, bool* loadFromMessageTable) { - if (IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_TOKENS).IsNot(RO_TOKENSANITY_OFF)) { + if (IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_TOKENS)) { *loadFromMessageTable = true; return; } diff --git a/soh/soh/Enhancements/TimeSavers/SkipCutscene/Story/SkipBlueWarp.cpp b/soh/soh/Enhancements/TimeSavers/SkipCutscene/Story/SkipBlueWarp.cpp index 49fb61329..da4d439d6 100644 --- a/soh/soh/Enhancements/TimeSavers/SkipCutscene/Story/SkipBlueWarp.cpp +++ b/soh/soh/Enhancements/TimeSavers/SkipCutscene/Story/SkipBlueWarp.cpp @@ -10,7 +10,6 @@ extern "C" { #include "functions.h" #include "variables.h" } -#define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).Get() extern "C" PlayState* gPlayState; static bool sEnteredBlueWarp = false; @@ -93,8 +92,7 @@ void RegisterShouldPlayBlueWarp() { } bool overrideBlueWarpDestinations = - IS_RANDO && (RAND_GET_OPTION(RSK_SHUFFLE_DUNGEON_ENTRANCES) != RO_DUNGEON_ENTRANCE_SHUFFLE_OFF || - RAND_GET_OPTION(RSK_SHUFFLE_BOSS_ENTRANCES) != RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF); + IS_RANDO && (RAND_GET_OPTION(RSK_SHUFFLE_DUNGEON_ENTRANCES) || RAND_GET_OPTION(RSK_SHUFFLE_BOSS_ENTRANCES)); // Force blue warp skip on when ER needs to place Link somewhere else. // This is preferred over having story cutscenes play in the overworld and then reloading Link somewhere else diff --git a/soh/soh/Enhancements/Warping.cpp b/soh/soh/Enhancements/Warping.cpp index 22bab3916..0a21a21fc 100644 --- a/soh/soh/Enhancements/Warping.cpp +++ b/soh/soh/Enhancements/Warping.cpp @@ -8,7 +8,7 @@ extern "C" { #include "z64.h" -#include "overlays/gamestates/ovl_file_choose/file_choose.h" +#include "global.h" #include "soh/Enhancements/enhancementTypes.h" void Sram_InitDebugSave(void); void Select_LoadGame(SelectContext* selectContext, s32 entranceIndex); @@ -76,7 +76,6 @@ void Warp(WarpPoint& warpPoint) { gWeatherMode = 0; gGameState->running = false; SET_NEXT_GAMESTATE(gGameState, Play_Init, PlayState); - GameInteractor_ExecuteOnLoadGame(gSaveContext.fileNum); } else { gPlayState->nextEntranceIndex = warpPoint.entranceId; diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index 340237ffd..e5dcf86ea 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -397,7 +397,7 @@ bool AddCheckToLogic(LocationAccess& locPair, GetAccessibleLocationsStruct& gals Rando::ItemLocation* location = ctx->GetItemLocation(loc); RandomizerGet locItem = location->GetPlacedRandomizerGet(); RandomizerCheckQuest quest = Rando::StaticData::GetLocation(loc)->GetQuest(); - assert(RAND_GET_OPTION(RSK_LOGIC_RULES) == RO_LOGIC_NO_LOGIC || quest == RCQUEST_BOTH || + assert(ctx->GetOption(RSK_LOGIC_RULES).Is(RO_LOGIC_NO_LOGIC) || quest == RCQUEST_BOTH || (quest == RCQUEST_VANILLA && ctx->GetDungeons()->GetDungeonFromScene(parentRegion->scene)->IsVanilla()) || (quest == RCQUEST_MQ && ctx->GetDungeons()->GetDungeonFromScene(parentRegion->scene)->IsMQ())); diff --git a/soh/soh/Enhancements/randomizer/Bombchus.cpp b/soh/soh/Enhancements/randomizer/Bombchus.cpp index 22a2aee84..8690a8329 100644 --- a/soh/soh/Enhancements/randomizer/Bombchus.cpp +++ b/soh/soh/Enhancements/randomizer/Bombchus.cpp @@ -1,5 +1,4 @@ #include -#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ShipInit.hpp" #include "src/overlays/actors/ovl_En_GirlA/z_en_girla.h" @@ -8,10 +7,10 @@ extern "C" { } void RegisterVBOverrides() { - bool shouldRegister = IS_RANDO && RAND_GET_OPTION(RSK_BOMBCHU_BAG) == RO_BOMBCHU_BAG_PROGRESSIVE; + bool shouldRegister = IS_RANDO && RAND_GET_OPTION(RSK_BOMBCHU_BAG).Is(RO_BOMBCHU_BAG_PROGRESSIVE); COND_VB_SHOULD(VB_CAN_BUY_BOMBCHUS, IS_RANDO, { EnGirlACanBuyResult* canBuy = va_arg(args, EnGirlACanBuyResult*); - u8 bombchuBag = RAND_GET_OPTION(RSK_BOMBCHU_BAG); + auto bombchuBag = RAND_GET_OPTION(RSK_BOMBCHU_BAG); // When in rando, don't allow buying bombchus when the player doesn't have required explosives // If bombchus are in logic, the player needs to have bombchus; otherwise they need a bomb bag if ((!bombchuBag && CUR_CAPACITY(UPG_BOMB_BAG) == 0) || @@ -20,7 +19,7 @@ void RegisterVBOverrides() { *should = true; } int8_t capacity = 50; - if (bombchuBag == RO_BOMBCHU_BAG_PROGRESSIVE) { + if (bombchuBag.Is(RO_BOMBCHU_BAG_PROGRESSIVE)) { capacity = OTRGlobals::Instance->gRandoContext->GetBombchuCapacity(); } if (AMMO(ITEM_BOMBCHU) >= capacity) { diff --git a/soh/soh/Enhancements/randomizer/Messages/GossipStoneHints.cpp b/soh/soh/Enhancements/randomizer/Messages/GossipStoneHints.cpp index 3ae4ab763..09c7a8680 100644 --- a/soh/soh/Enhancements/randomizer/Messages/GossipStoneHints.cpp +++ b/soh/soh/Enhancements/randomizer/Messages/GossipStoneHints.cpp @@ -11,8 +11,6 @@ extern PlayState* gPlayState; #include } -#define RAND_GET_OPTION(rsk) OTRGlobals::Instance->gRandoContext->GetOption(rsk) - void BuildHintStoneMessage(uint16_t* textId, bool* loadFromMessageTable) { if ((RAND_GET_OPTION(RSK_GOSSIP_STONE_HINTS).Is(RO_GOSSIP_STONES_NEED_TRUTH) && Player_GetMask(gPlayState) == PLAYER_MASK_TRUTH) || diff --git a/soh/soh/Enhancements/randomizer/Messages/MerchantMessages.cpp b/soh/soh/Enhancements/randomizer/Messages/MerchantMessages.cpp index 5afefc529..807392fd8 100644 --- a/soh/soh/Enhancements/randomizer/Messages/MerchantMessages.cpp +++ b/soh/soh/Enhancements/randomizer/Messages/MerchantMessages.cpp @@ -17,7 +17,6 @@ extern PlayState* gPlayState; #include } -#define RAND_GET_OPTION(rsk) OTRGlobals::Instance->gRandoContext->GetOption(rsk) #define RAND_GET_ITEM(rc) OTRGlobals::Instance->gRandoContext->GetItemLocation(rc) #define RAND_GET_OVERRIDE(rc) OTRGlobals::Instance->gRandoContext->overrides[rc] #define NON_BEAN_MERCHANTS \ @@ -58,7 +57,7 @@ void BuildBeanGuyMessage(uint16_t* textId, bool* loadFromMessageTable) { "Möchten Sie [[color]][[1]]%w für %y[[2]] Rubin%w kaufen?\x1B%gJa&Nein%w", "Voulez-vous acheter [[color]][[1]]%w pour %y[[2]] Rubis%w?\x1B%gOui&Non%w"); BuildMerchantMessage(msg, RC_ZR_MAGIC_BEAN_SALESMAN, - RAND_GET_OPTION(RSK_MERCHANT_TEXT_HINT).Is(RO_GENERIC_OFF) || + !RAND_GET_OPTION(RSK_MERCHANT_TEXT_HINT) || CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MysteriousShuffle"), 0)); msg.AutoFormat(); } @@ -71,7 +70,7 @@ void BuildMedigoronMessage(uint16_t* textId, bool* loadFromMessageTable) { "Möchten Sie [[color]][[1]]%w für %y[[2]] Rubin%w kaufen?\x1B%gJa&Nein%w", "Voulez-vous acheter [[color]][[1]]%w pour %y[[2]] Rubis%w?\x1B%gOui&Non%w"); BuildMerchantMessage(msg, RC_GC_MEDIGORON, - RAND_GET_OPTION(RSK_MERCHANT_TEXT_HINT).Is(RO_GENERIC_OFF) || + !RAND_GET_OPTION(RSK_MERCHANT_TEXT_HINT) || CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MysteriousShuffle"), 0)); msg.AutoFormat(); msg.LoadIntoFont(); @@ -80,13 +79,12 @@ void BuildMedigoronMessage(uint16_t* textId, bool* loadFromMessageTable) { void BuildGrannyMessage(uint16_t* textId, bool* loadFromMessageTable) { if (!Flags_GetRandomizerInf(RAND_INF_MERCHANTS_GRANNYS_SHOP) && - (RAND_GET_OPTION(RSK_SHUFFLE_ADULT_TRADE).Is(RO_GENERIC_ON) || - INV_CONTENT(ITEM_CLAIM_CHECK) == ITEM_CLAIM_CHECK)) { + (RAND_GET_OPTION(RSK_SHUFFLE_ADULT_TRADE) || INV_CONTENT(ITEM_CLAIM_CHECK) == ITEM_CLAIM_CHECK)) { CustomMessage msg = CustomMessage("Want to buy [[color]][[1]]%w for %y[[2]] Rupees%w?\x1B%gYes&No%w", "Möchten Sie [[color]][[1]]%w für %y[[2]] Rubin%w kaufen?\x1B%gJa&Nein%w", "Voulez-vous acheter [[color]][[1]]%w pour %y[[2]] Rubis%w?\x1B%gOui&Non%w"); BuildMerchantMessage(msg, RC_KAK_GRANNYS_SHOP, - RAND_GET_OPTION(RSK_MERCHANT_TEXT_HINT).Is(RO_GENERIC_OFF) || + !RAND_GET_OPTION(RSK_MERCHANT_TEXT_HINT) || CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MysteriousShuffle"), 0)); msg.AutoFormat(); msg.LoadIntoFont(); @@ -105,7 +103,7 @@ void BuildCarpetGuyMessage(uint16_t* textId, bool* loadFromMessageTable) { "Möchten Sie [[color]][[1]]%w für %y[[2]] Rubin%w kaufen?\x1B%gJa&Nein%w", "Voulez-vous acheter [[color]][[1]]%w pour %y[[2]] Rubis%w?\x1B%gOui&Non%w"); BuildMerchantMessage(msg, RC_WASTELAND_BOMBCHU_SALESMAN, - RAND_GET_OPTION(RSK_MERCHANT_TEXT_HINT).Is(RO_GENERIC_OFF) || + !RAND_GET_OPTION(RSK_MERCHANT_TEXT_HINT) || CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MysteriousShuffle"), 0)); } msg.AutoFormat(); @@ -148,7 +146,7 @@ void BuildScrubMessage(uint16_t* textId, bool* loadFromMessageTable) { "J'abandonne! Tu veux bien m'acheter un [[color]][[1]]%w? Ça fera %y[[2]] Rubis%w!\x07\x10\xA3"); } BuildMerchantMessage(msg, rc, - RAND_GET_OPTION(RSK_MERCHANT_TEXT_HINT).Is(RO_GENERIC_OFF) || + !RAND_GET_OPTION(RSK_MERCHANT_TEXT_HINT) || CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MysteriousShuffle"), 0)); msg.AutoFormat(); msg.LoadIntoFont(); @@ -194,7 +192,7 @@ void RegisterMerchantMessages() { COND_ID_HOOK(OnOpenText, TEXT_CARPET_SALESMAN_1, NON_BEAN_MERCHANTS, BuildCarpetGuyMessage); COND_ID_HOOK(OnOpenText, TEXT_CARPET_SALESMAN_ARMS_DEALER, NON_BEAN_MERCHANTS, BuildCarpetGuyMessage); COND_ID_HOOK(OnOpenText, TEXT_SCRUB_RANDOM, IS_RANDO, BuildScrubMessage); - COND_HOOK(OnOpenText, RAND_GET_OPTION(RSK_SHOPSANITY).IsNot(RO_SHOPSANITY_OFF), BuildShopMessage); + COND_HOOK(OnOpenText, RAND_GET_OPTION(RSK_SHOPSANITY), BuildShopMessage); COND_ID_HOOK(OnOpenText, TEXT_CARPET_SALESMAN_CUSTOM_FAIL_TO_BUY, IS_RANDO, BuildCarpetGuyFailToBuyMessage); } diff --git a/soh/soh/Enhancements/randomizer/Messages/StaticHints.cpp b/soh/soh/Enhancements/randomizer/Messages/StaticHints.cpp index 70dc08ad1..a947bd0ae 100644 --- a/soh/soh/Enhancements/randomizer/Messages/StaticHints.cpp +++ b/soh/soh/Enhancements/randomizer/Messages/StaticHints.cpp @@ -14,7 +14,6 @@ extern PlayState* gPlayState; #include } -#define RAND_GET_OPTION(rsk) OTRGlobals::Instance->gRandoContext->GetOption(rsk) #define RAND_GET_HINT(rh) OTRGlobals::Instance->gRandoContext->GetHint(rh) #define RAND_GET_ITEM_LOC(rc) OTRGlobals::Instance->gRandoContext->GetItemLocation(rc) #define ANY_SKULLTULA_HINTS \ @@ -75,7 +74,7 @@ void BuildSheikMessage(uint16_t* textId, bool* loadFromMessageTable) { "Cherche l'%cÉpée de Légende%w, %rquelque chose pour ranger tes flèches%w et de la %gmagie%w pour " "invoquer la %ylumière%w."); } else if (!Flags_GetEventChkInf(EVENTCHKINF_DISPELLED_GANONS_TOWER_BARRIER) && - !RAND_GET_OPTION(RSK_TRIAL_COUNT).Is(0)) { + RAND_GET_OPTION(RSK_TRIAL_COUNT)) { msg = CustomMessage( "You may have what you need to defeat %rthe Evil King%w, but the %cbarrier%w still " "stands.^Complete the remaining %gtrials%w to destroy it.", @@ -191,7 +190,7 @@ void BuildMysteriousWarpMessage() { } void BuildMinuetWarpMessage(uint16_t* textId, bool* loadFromMessageTable) { - if (RAND_GET_OPTION(RSK_WARP_SONG_HINTS).Is(RO_GENERIC_OFF)) { + if (!RAND_GET_OPTION(RSK_WARP_SONG_HINTS)) { BuildMysteriousWarpMessage(); *loadFromMessageTable = false; return; @@ -202,7 +201,7 @@ void BuildMinuetWarpMessage(uint16_t* textId, bool* loadFromMessageTable) { } void BuildBoleroWarpMessage(uint16_t* textId, bool* loadFromMessageTable) { - if (RAND_GET_OPTION(RSK_WARP_SONG_HINTS).Is(RO_GENERIC_OFF)) { + if (!RAND_GET_OPTION(RSK_WARP_SONG_HINTS)) { BuildMysteriousWarpMessage(); *loadFromMessageTable = false; return; @@ -213,7 +212,7 @@ void BuildBoleroWarpMessage(uint16_t* textId, bool* loadFromMessageTable) { } void BuildSerenadeWarpMessage(uint16_t* textId, bool* loadFromMessageTable) { - if (RAND_GET_OPTION(RSK_WARP_SONG_HINTS).Is(RO_GENERIC_OFF)) { + if (!RAND_GET_OPTION(RSK_WARP_SONG_HINTS)) { BuildMysteriousWarpMessage(); *loadFromMessageTable = false; return; @@ -224,7 +223,7 @@ void BuildSerenadeWarpMessage(uint16_t* textId, bool* loadFromMessageTable) { } void BuildRequiemWarpMessage(uint16_t* textId, bool* loadFromMessageTable) { - if (RAND_GET_OPTION(RSK_WARP_SONG_HINTS).Is(RO_GENERIC_OFF)) { + if (!RAND_GET_OPTION(RSK_WARP_SONG_HINTS)) { BuildMysteriousWarpMessage(); *loadFromMessageTable = false; return; @@ -235,7 +234,7 @@ void BuildRequiemWarpMessage(uint16_t* textId, bool* loadFromMessageTable) { } void BuildNocturneWarpMessage(uint16_t* textId, bool* loadFromMessageTable) { - if (RAND_GET_OPTION(RSK_WARP_SONG_HINTS).Is(RO_GENERIC_OFF)) { + if (!RAND_GET_OPTION(RSK_WARP_SONG_HINTS)) { BuildMysteriousWarpMessage(); *loadFromMessageTable = false; return; @@ -246,7 +245,7 @@ void BuildNocturneWarpMessage(uint16_t* textId, bool* loadFromMessageTable) { } void BuildPreludeWarpMessage(uint16_t* textId, bool* loadFromMessageTable) { - if (RAND_GET_OPTION(RSK_WARP_SONG_HINTS).Is(RO_GENERIC_OFF)) { + if (!RAND_GET_OPTION(RSK_WARP_SONG_HINTS)) { BuildMysteriousWarpMessage(); *loadFromMessageTable = false; return; diff --git a/soh/soh/Enhancements/randomizer/SeedContext.h b/soh/soh/Enhancements/randomizer/SeedContext.h index 659531da1..9ca42751a 100644 --- a/soh/soh/Enhancements/randomizer/SeedContext.h +++ b/soh/soh/Enhancements/randomizer/SeedContext.h @@ -15,7 +15,7 @@ #include #include -#define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).Get() +#define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option) /** * @brief Singleton for storing and accessing dynamic Randomizer-related data diff --git a/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp b/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp index 987881a42..aed35dfa7 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp @@ -3,16 +3,12 @@ #include "static_data.h" #include #include "global.h" -#include "soh/ResourceManagerHelpers.h" #include "soh/ObjectExtension/ObjectExtension.h" extern "C" { #include "variables.h" #include "overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h" -#include "objects/object_kibako2/object_kibako2.h" #include "overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h" -#include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" -#include "soh/Enhancements/enhancementTypes.h" extern PlayState* gPlayState; } @@ -160,11 +156,11 @@ uint8_t ObjKibako2_RandomizerHoldsItem(ObjKibako2* crateActor, PlayState* play) RandomizerCheck rc = crateIdentity->randomizerCheck; uint8_t isDungeon = Rando::StaticData::GetLocation(rc)->IsDungeon(); - uint8_t crateSetting = RAND_GET_OPTION(RSK_SHUFFLE_CRATES); + auto crateSetting = RAND_GET_OPTION(RSK_SHUFFLE_CRATES); // Don't pull randomized item if crate isn't randomized or is already checked - if (!IS_RANDO || (crateSetting == RO_SHUFFLE_CRATES_OVERWORLD && isDungeon) || - (crateSetting == RO_SHUFFLE_CRATES_DUNGEONS && !isDungeon) || + if (!IS_RANDO || (crateSetting.Is(RO_SHUFFLE_CRATES_OVERWORLD) && isDungeon) || + (crateSetting.Is(RO_SHUFFLE_CRATES_DUNGEONS) && !isDungeon) || Flags_GetRandomizerInf(crateIdentity->randomizerInf) || crateIdentity->randomizerCheck == RC_UNKNOWN_CHECK) { return false; } else { @@ -180,11 +176,11 @@ uint8_t ObjKibako_RandomizerHoldsItem(ObjKibako* smallCrateActor, PlayState* pla RandomizerCheck rc = crateIdentity->randomizerCheck; uint8_t isDungeon = Rando::StaticData::GetLocation(rc)->IsDungeon(); - uint8_t crateSetting = RAND_GET_OPTION(RSK_SHUFFLE_CRATES); + auto crateSetting = RAND_GET_OPTION(RSK_SHUFFLE_CRATES); // Don't pull randomized item if crate isn't randomized or is already checked - if (!IS_RANDO || (crateSetting == RO_SHUFFLE_CRATES_OVERWORLD && isDungeon) || - (crateSetting == RO_SHUFFLE_CRATES_DUNGEONS && !isDungeon) || + if (!IS_RANDO || (crateSetting.Is(RO_SHUFFLE_CRATES_OVERWORLD) && isDungeon) || + (crateSetting.Is(RO_SHUFFLE_CRATES_DUNGEONS) && !isDungeon) || Flags_GetRandomizerInf(crateIdentity->randomizerInf) || crateIdentity->randomizerCheck == RC_UNKNOWN_CHECK) { return false; } else { @@ -224,7 +220,7 @@ void ObjKibako_RandomizerSpawnCollectible(ObjKibako* smallCrateActor, PlayState* void ObjKibako2_RandomizerInit(void* actorRef) { Actor* actor = static_cast(actorRef); - uint8_t logicSetting = RAND_GET_OPTION(RSK_LOGIC_RULES); + auto logicSetting = RAND_GET_OPTION(RSK_LOGIC_RULES); // don't shuffle two OOB crates in GF and don't shuffle child GV/GF crates when not in no logic if (actor->id != ACTOR_OBJ_KIBAKO2 || @@ -232,16 +228,17 @@ void ObjKibako2_RandomizerInit(void* actorRef) { (s16)actor->world.pos.z == -3429) || (gPlayState->sceneNum == SCENE_GERUDOS_FORTRESS && (s16)actor->world.pos.x == -4571 && (s16)actor->world.pos.z == -3429) || - (logicSetting != RO_LOGIC_NO_LOGIC && ((gPlayState->sceneNum == SCENE_GERUDOS_FORTRESS && - (s16)actor->world.pos.x == 3443 && (s16)actor->world.pos.z == -4876) || - (gPlayState->sceneNum == SCENE_GERUDO_VALLEY && - (s16)actor->world.pos.x == -764 && (s16)actor->world.pos.z == 148) || - (gPlayState->sceneNum == SCENE_GERUDO_VALLEY && - (s16)actor->world.pos.x == -860 && (s16)actor->world.pos.z == -125) || - (gPlayState->sceneNum == SCENE_GERUDO_VALLEY && - (s16)actor->world.pos.x == -860 && (s16)actor->world.pos.z == -150) || - (gPlayState->sceneNum == SCENE_GERUDO_VALLEY && - (s16)actor->world.pos.x == -860 && (s16)actor->world.pos.z == -90)))) + (logicSetting.IsNot(RO_LOGIC_NO_LOGIC) && + ((gPlayState->sceneNum == SCENE_GERUDOS_FORTRESS && (s16)actor->world.pos.x == 3443 && + (s16)actor->world.pos.z == -4876) || + (gPlayState->sceneNum == SCENE_GERUDO_VALLEY && (s16)actor->world.pos.x == -764 && + (s16)actor->world.pos.z == 148) || + (gPlayState->sceneNum == SCENE_GERUDO_VALLEY && (s16)actor->world.pos.x == -860 && + (s16)actor->world.pos.z == -125) || + (gPlayState->sceneNum == SCENE_GERUDO_VALLEY && (s16)actor->world.pos.x == -860 && + (s16)actor->world.pos.z == -150) || + (gPlayState->sceneNum == SCENE_GERUDO_VALLEY && (s16)actor->world.pos.x == -860 && + (s16)actor->world.pos.z == -90)))) return; ObjKibako2* crateActor = static_cast(actorRef); diff --git a/soh/soh/Enhancements/randomizer/ShuffleFreestanding.cpp b/soh/soh/Enhancements/randomizer/ShuffleFreestanding.cpp index dac291196..cd43ee750 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleFreestanding.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleFreestanding.cpp @@ -2,7 +2,6 @@ extern "C" { #include "variables.h" -#include "functions.h" extern PlayState* gPlayState; } @@ -27,11 +26,11 @@ void RegisterShuffleFreestanding() { return; } uint8_t isDungeon = loc->IsDungeon(); - uint8_t freestandingSetting = RAND_GET_OPTION(RSK_SHUFFLE_FREESTANDING); + auto freestandingSetting = RAND_GET_OPTION(RSK_SHUFFLE_FREESTANDING); // Don't change to randomized item if current freestanding item isn't shuffled or already obtained. - if ((freestandingSetting == RO_SHUFFLE_FREESTANDING_OVERWORLD && isDungeon) || - (freestandingSetting == RO_SHUFFLE_FREESTANDING_DUNGEONS && !isDungeon) || + if ((freestandingSetting.Is(RO_SHUFFLE_FREESTANDING_OVERWORLD) && isDungeon) || + (freestandingSetting.Is(RO_SHUFFLE_FREESTANDING_DUNGEONS) && !isDungeon) || randomizerCheck == RC_UNKNOWN_CHECK) { return; } diff --git a/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp b/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp index 76cacad33..8d612b3a7 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp @@ -2,12 +2,10 @@ #include "soh_assets.h" #include "static_data.h" #include "soh/ObjectExtension/ObjectExtension.h" -#include "soh/Enhancements/enhancementTypes.h" extern "C" { #include "variables.h" #include "overlays/actors/ovl_En_Kusa/z_en_kusa.h" -#include "objects/gameplay_field_keep/gameplay_field_keep.h" #include "objects/object_kusa/object_kusa.h" extern PlayState* gPlayState; } @@ -88,11 +86,11 @@ uint8_t EnKusa_RandomizerHoldsItem(EnKusa* grassActor, PlayState* play) { RandomizerCheck rc = grassIdentity->randomizerCheck; uint8_t isDungeon = Rando::StaticData::GetLocation(rc)->IsDungeon(); - uint8_t grassSetting = RAND_GET_OPTION(RSK_SHUFFLE_GRASS); + auto grassSetting = RAND_GET_OPTION(RSK_SHUFFLE_GRASS); // Don't pull randomized item if grass isn't randomized or is already checked - if (!IS_RANDO || (grassSetting == RO_SHUFFLE_GRASS_OVERWORLD && isDungeon) || - (grassSetting == RO_SHUFFLE_GRASS_DUNGEONS && !isDungeon) || + if (!IS_RANDO || (grassSetting.Is(RO_SHUFFLE_GRASS_OVERWORLD) && isDungeon) || + (grassSetting.Is(RO_SHUFFLE_GRASS_DUNGEONS) && !isDungeon) || Flags_GetRandomizerInf(grassIdentity->randomizerInf) || rc == RC_UNKNOWN_CHECK) { return false; } else { diff --git a/soh/soh/Enhancements/randomizer/ShufflePots.cpp b/soh/soh/Enhancements/randomizer/ShufflePots.cpp index dcdbae913..b1ae4dd4d 100644 --- a/soh/soh/Enhancements/randomizer/ShufflePots.cpp +++ b/soh/soh/Enhancements/randomizer/ShufflePots.cpp @@ -4,7 +4,6 @@ #include "soh/ObjectExtension/ObjectExtension.h" extern "C" { -#include "variables.h" #include "overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h" #include "overlays/actors/ovl_Door_Shutter/z_door_shutter.h" extern PlayState* gPlayState; @@ -33,11 +32,11 @@ uint8_t ObjTsubo_RandomizerHoldsItem(ObjTsubo* potActor, PlayState* play) { RandomizerCheck rc = potIdentity->randomizerCheck; uint8_t isDungeon = Rando::StaticData::GetLocation(rc)->IsDungeon(); - uint8_t potSetting = RAND_GET_OPTION(RSK_SHUFFLE_POTS); + auto potSetting = RAND_GET_OPTION(RSK_SHUFFLE_POTS); // Don't pull randomized item if pot isn't randomized or is already checked - if (!IS_RANDO || (potSetting == RO_SHUFFLE_POTS_OVERWORLD && isDungeon) || - (potSetting == RO_SHUFFLE_POTS_DUNGEONS && !isDungeon) || Flags_GetRandomizerInf(potIdentity->randomizerInf) || + if (!IS_RANDO || (potSetting.Is(RO_SHUFFLE_POTS_OVERWORLD) && isDungeon) || + (potSetting.Is(RO_SHUFFLE_POTS_DUNGEONS) && !isDungeon) || Flags_GetRandomizerInf(potIdentity->randomizerInf) || potIdentity->randomizerCheck == RC_UNKNOWN_CHECK) { return false; } else { @@ -93,9 +92,9 @@ void RegisterShufflePots() { // Unlock early Ganon's Boss Key doors to allow access to the pots there when pots are shuffled in dungeon COND_VB_SHOULD(VB_LOCK_BOSS_DOOR, shouldRegister, { DoorShutter* doorActor = va_arg(args, DoorShutter*); - uint8_t shufflePotSetting = RAND_GET_OPTION(RSK_SHUFFLE_POTS); + auto shufflePotSetting = RAND_GET_OPTION(RSK_SHUFFLE_POTS); if (gPlayState->sceneNum == SCENE_GANONS_TOWER && doorActor->dyna.actor.world.pos.y == 800 && - (shufflePotSetting == RO_SHUFFLE_POTS_DUNGEONS || shufflePotSetting == RO_SHUFFLE_POTS_ALL)) { + (shufflePotSetting.Is(RO_SHUFFLE_POTS_DUNGEONS) || shufflePotSetting.Is(RO_SHUFFLE_POTS_ALL))) { *should = false; } }); diff --git a/soh/soh/Enhancements/randomizer/fishsanity.cpp b/soh/soh/Enhancements/randomizer/fishsanity.cpp index eaa4ac911..fd7dffc19 100644 --- a/soh/soh/Enhancements/randomizer/fishsanity.cpp +++ b/soh/soh/Enhancements/randomizer/fishsanity.cpp @@ -385,7 +385,7 @@ void Fishsanity::OnActorInitHandler(void* refActor) { fish = OTRGlobals::Instance->gRandomizer->IdentifyFish(gPlayState->sceneNum, actor->params); // With every pond fish shuffled, caught fish will not spawn unless all fish have been caught. - if (RAND_GET_OPTION(RSK_FISHSANITY_POND_COUNT) > 16 && !fs->GetPondCleared()) { + if (RAND_GET_OPTION(RSK_FISHSANITY_POND_COUNT).Get() > 16 && !fs->GetPondCleared()) { // Create effect for uncaught fish if (!Flags_GetRandomizerInf(fish.randomizerInf)) { actor->shape.shadowDraw = Fishsanity_DrawEffShadow; @@ -545,7 +545,7 @@ void Fishsanity_CloseGreyscaleColor(PlayState* play) { } void RegisterShuffleFish() { - bool shouldRegister = IS_RANDO && RAND_GET_OPTION(RSK_FISHSANITY) != RO_FISHSANITY_OFF; + bool shouldRegister = IS_RANDO && RAND_GET_OPTION(RSK_FISHSANITY).IsNot(RO_FISHSANITY_OFF); COND_HOOK(OnSceneInit, shouldRegister, [](int16_t sceneNum) { if (sceneNum == SCENE_ZORAS_DOMAIN) { fishGroupCounter = 0; diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 6be1b8cf4..a0b3f9d6b 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -3,7 +3,6 @@ #include "soh/ResourceManagerHelpers.h" #include "soh/Enhancements/enhancementTypes.h" #include "soh/Enhancements/custom-message/CustomMessageTypes.h" -#include "soh/Enhancements/item-tables/ItemTableManager.h" #include "soh/Enhancements/randomizer/randomizerTypes.h" #include "soh/Enhancements/randomizer/dungeon.h" #include "soh/Enhancements/randomizer/static_data.h" @@ -28,14 +27,11 @@ extern "C" { #include "src/overlays/actors/ovl_En_Ossan/z_en_ossan.h" #include "src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h" #include "src/overlays/actors/ovl_En_Dns/z_en_dns.h" -#include "src/overlays/actors/ovl_En_Gb/z_en_gb.h" -#include "src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h" #include "src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h" #include "src/overlays/actors/ovl_En_Ko/z_en_ko.h" #include "src/overlays/actors/ovl_En_Mk/z_en_mk.h" #include "src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h" #include "src/overlays/actors/ovl_En_Kz/z_en_kz.h" -#include "src/overlays/actors/ovl_En_Go2/z_en_go2.h" #include "src/overlays/actors/ovl_En_Ms/z_en_ms.h" #include "src/overlays/actors/ovl_En_Fr/z_en_fr.h" #include "src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h" @@ -122,30 +118,30 @@ RandomizerCheck GetRandomizerCheckFromSceneFlag(int16_t sceneNum, int16_t flagTy } bool MeetsLACSRequirements() { - switch (RAND_GET_OPTION(RSK_GANONS_BOSS_KEY)) { + switch (RAND_GET_OPTION(RSK_GANONS_BOSS_KEY).Get()) { case RO_GANON_BOSS_KEY_LACS_STONES: - if ((CheckStoneCount() + CheckLACSRewardCount()) >= RAND_GET_OPTION(RSK_LACS_STONE_COUNT)) { + if ((CheckStoneCount() + CheckLACSRewardCount()) >= RAND_GET_OPTION(RSK_LACS_STONE_COUNT).Get()) { return true; } break; case RO_GANON_BOSS_KEY_LACS_MEDALLIONS: - if ((CheckMedallionCount() + CheckLACSRewardCount()) >= RAND_GET_OPTION(RSK_LACS_MEDALLION_COUNT)) { + if ((CheckMedallionCount() + CheckLACSRewardCount()) >= RAND_GET_OPTION(RSK_LACS_MEDALLION_COUNT).Get()) { return true; } break; case RO_GANON_BOSS_KEY_LACS_REWARDS: if ((CheckMedallionCount() + CheckStoneCount() + CheckLACSRewardCount()) >= - RAND_GET_OPTION(RSK_LACS_REWARD_COUNT)) { + RAND_GET_OPTION(RSK_LACS_REWARD_COUNT).Get()) { return true; } break; case RO_GANON_BOSS_KEY_LACS_DUNGEONS: - if ((CheckDungeonCount() + CheckLACSRewardCount()) >= RAND_GET_OPTION(RSK_LACS_DUNGEON_COUNT)) { + if ((CheckDungeonCount() + CheckLACSRewardCount()) >= RAND_GET_OPTION(RSK_LACS_DUNGEON_COUNT).Get()) { return true; } break; case RO_GANON_BOSS_KEY_LACS_TOKENS: - if (gSaveContext.inventory.gsTokens >= RAND_GET_OPTION(RSK_LACS_TOKEN_COUNT)) { + if (gSaveContext.inventory.gsTokens >= RAND_GET_OPTION(RSK_LACS_TOKEN_COUNT).Get()) { return true; } break; @@ -169,7 +165,7 @@ bool CompletedAllTrials() { } bool MeetsRainbowBridgeRequirements() { - switch (RAND_GET_OPTION(RSK_RAINBOW_BRIDGE)) { + switch (RAND_GET_OPTION(RSK_RAINBOW_BRIDGE).Get()) { case RO_BRIDGE_VANILLA: { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && (INV_CONTENT(ITEM_ARROW_LIGHT) == ITEM_ARROW_LIGHT)) { @@ -178,33 +174,35 @@ bool MeetsRainbowBridgeRequirements() { break; } case RO_BRIDGE_STONES: { - if ((CheckStoneCount() + CheckBridgeRewardCount()) >= RAND_GET_OPTION(RSK_RAINBOW_BRIDGE_STONE_COUNT)) { + if ((CheckStoneCount() + CheckBridgeRewardCount()) >= + RAND_GET_OPTION(RSK_RAINBOW_BRIDGE_STONE_COUNT).Get()) { return true; } break; } case RO_BRIDGE_MEDALLIONS: { if ((CheckMedallionCount() + CheckBridgeRewardCount()) >= - RAND_GET_OPTION(RSK_RAINBOW_BRIDGE_MEDALLION_COUNT)) { + RAND_GET_OPTION(RSK_RAINBOW_BRIDGE_MEDALLION_COUNT).Get()) { return true; } break; } case RO_BRIDGE_DUNGEON_REWARDS: { if ((CheckMedallionCount() + CheckStoneCount() + CheckBridgeRewardCount()) >= - RAND_GET_OPTION(RSK_RAINBOW_BRIDGE_REWARD_COUNT)) { + RAND_GET_OPTION(RSK_RAINBOW_BRIDGE_REWARD_COUNT).Get()) { return true; } break; } case RO_BRIDGE_DUNGEONS: { - if ((CheckDungeonCount() + CheckBridgeRewardCount()) >= RAND_GET_OPTION(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT)) { + if ((CheckDungeonCount() + CheckBridgeRewardCount()) >= + RAND_GET_OPTION(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).Get()) { return true; } break; } case RO_BRIDGE_TOKENS: { - if (gSaveContext.inventory.gsTokens >= RAND_GET_OPTION(RSK_RAINBOW_BRIDGE_TOKEN_COUNT)) { + if (gSaveContext.inventory.gsTokens >= RAND_GET_OPTION(RSK_RAINBOW_BRIDGE_TOKEN_COUNT).Get()) { return true; } break; @@ -278,7 +276,8 @@ void RandomizerOnSceneFlagSetHandler(int16_t sceneNum, int16_t flagType, int16_t switch (sceneNum) { case SCENE_GERUDOS_FORTRESS: - if (RAND_GET_OPTION(RSK_SHUFFLE_DUNGEON_ENTRANCES) != RO_DUNGEON_ENTRANCE_SHUFFLE_OFF && flag == 0x3A) { + if (RAND_GET_OPTION(RSK_SHUFFLE_DUNGEON_ENTRANCES).IsNot(RO_DUNGEON_ENTRANCE_SHUFFLE_OFF) && + flag == 0x3A) { Flags_SetRandomizerInf(RAND_INF_GF_GTG_GATE_PERMANENTLY_OPEN); } break; @@ -607,8 +606,8 @@ void ItemEtcetera_UpdateRandomizedFireArrow(ItemEtcetera* itemEtcetera, PlayStat } u8 EnDs_RandoCanGetGrannyItem() { - return (RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS) == RO_SHUFFLE_MERCHANTS_ALL_BUT_BEANS || - RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS) == RO_SHUFFLE_MERCHANTS_ALL) && + return (RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS).Is(RO_SHUFFLE_MERCHANTS_ALL_BUT_BEANS) || + RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS).Is(RO_SHUFFLE_MERCHANTS_ALL)) && !Flags_GetRandomizerInf(RAND_INF_MERCHANTS_GRANNYS_SHOP) && // Traded odd mushroom when adult trade is on ((RAND_GET_OPTION(RSK_SHUFFLE_ADULT_TRADE) && Flags_GetItemGetInf(ITEMGETINF_30)) || @@ -617,15 +616,15 @@ u8 EnDs_RandoCanGetGrannyItem() { } u8 EnJs_RandoCanGetCarpetMerchantItem() { - return (RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS) == RO_SHUFFLE_MERCHANTS_ALL || - RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS) == RO_SHUFFLE_MERCHANTS_ALL_BUT_BEANS) && + return (RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS).Is(RO_SHUFFLE_MERCHANTS_ALL) || + RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS).Is(RO_SHUFFLE_MERCHANTS_ALL_BUT_BEANS)) && // If the rando check has already been awarded, use vanilla behavior. !Flags_GetRandomizerInf(RAND_INF_MERCHANTS_CARPET_SALESMAN); } u8 EnGm_RandoCanGetMedigoronItem() { - return (RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS) == RO_SHUFFLE_MERCHANTS_ALL || - RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS) == RO_SHUFFLE_MERCHANTS_ALL_BUT_BEANS) && + return (RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS).Is(RO_SHUFFLE_MERCHANTS_ALL) || + RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS).Is(RO_SHUFFLE_MERCHANTS_ALL_BUT_BEANS)) && // If the rando check has already been awarded, use vanilla behavior. !Flags_GetRandomizerInf(RAND_INF_MERCHANTS_MEDIGORON); } @@ -909,13 +908,13 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l !Flags_GetEventChkInf(EVENTCHKINF_LEARNED_PRELUDE_OF_LIGHT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_FOREST); break; case VB_MIDO_SPAWN: - if (RAND_GET_OPTION(RSK_FOREST) != RO_CLOSED_FOREST_OFF && + if (RAND_GET_OPTION(RSK_FOREST).IsNot(RO_CLOSED_FOREST_OFF) && !Flags_GetEventChkInf(EVENTCHKINF_SHOWED_MIDO_SWORD_SHIELD)) { *should = true; } break; case VB_MOVE_MIDO_IN_KOKIRI_FOREST: - if (RAND_GET_OPTION(RSK_FOREST) == RO_CLOSED_FOREST_OFF && gSaveContext.cutsceneIndex == 0) { + if (RAND_GET_OPTION(RSK_FOREST).Is(RO_CLOSED_FOREST_OFF) && gSaveContext.cutsceneIndex == 0) { *should = true; } break; @@ -927,7 +926,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l break; case VB_OPEN_KOKIRI_FOREST: *should = Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_KOKIRI_EMERALD_DEKU_TREE_DEAD) || - RAND_GET_OPTION(RSK_FOREST) != RO_CLOSED_FOREST_ON; + RAND_GET_OPTION(RSK_FOREST).IsNot(RO_CLOSED_FOREST_ON); break; case VB_BE_ELIGIBLE_FOR_DARUNIAS_JOY_REWARD: *should = !Flags_GetRandomizerInf(RAND_INF_DARUNIAS_JOY); @@ -949,8 +948,8 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l break; } case VB_BE_ELIGIBLE_FOR_MAGIC_BEANS_PURCHASE: { - if (RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS) == RO_SHUFFLE_MERCHANTS_BEANS_ONLY || - RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS) == RO_SHUFFLE_MERCHANTS_ALL) { + if (RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS).Is(RO_SHUFFLE_MERCHANTS_BEANS_ONLY) || + RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS).Is(RO_SHUFFLE_MERCHANTS_ALL)) { *should = gSaveContext.rupees >= OTRGlobals::Instance->gRandoContext->GetItemLocation(RC_ZR_MAGIC_BEAN_SALESMAN)->GetPrice(); } else if (RAND_GET_OPTION(RSK_SKIP_PLANTING_BEANS)) { @@ -1028,7 +1027,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l } case VB_KING_ZORA_BE_MOVED: { *should = false; - switch (RAND_GET_OPTION(RSK_ZORAS_FOUNTAIN)) { + switch (RAND_GET_OPTION(RSK_ZORAS_FOUNTAIN).Get()) { case RO_ZF_CLOSED: if (Flags_GetEventChkInf(EVENTCHKINF_KING_ZORA_MOVED)) { *should = true; @@ -1223,7 +1222,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l } case VB_GIVE_BOMBCHUS_FROM_CARPET_SALESMAN: { *should = - RAND_GET_OPTION(RSK_BOMBCHU_BAG) == RO_BOMBCHU_BAG_NONE || INV_CONTENT(ITEM_BOMBCHU) == ITEM_BOMBCHU; + RAND_GET_OPTION(RSK_BOMBCHU_BAG).Is(RO_BOMBCHU_BAG_NONE) || INV_CONTENT(ITEM_BOMBCHU) == ITEM_BOMBCHU; break; } case VB_CHECK_RANDO_PRICE_OF_MEDIGORON: { @@ -1256,8 +1255,8 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l } case VB_GIVE_ITEM_FROM_MAGIC_BEAN_SALESMAN: { EnMs* enMs = va_arg(args, EnMs*); - if (RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS) == RO_SHUFFLE_MERCHANTS_BEANS_ONLY || - RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS) == RO_SHUFFLE_MERCHANTS_ALL) { + if (RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS).Is(RO_SHUFFLE_MERCHANTS_BEANS_ONLY) || + RAND_GET_OPTION(RSK_SHUFFLE_MERCHANTS).Is(RO_SHUFFLE_MERCHANTS_ALL)) { Rupees_ChangeBy( OTRGlobals::Instance->gRandoContext->GetItemLocation(RC_ZR_MAGIC_BEAN_SALESMAN)->GetPrice() * -1); BEANS_BOUGHT = 10; @@ -1433,7 +1432,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l } case VB_OFFER_BLUE_POTION: { // Always offer blue potion when adult trade is off - *should |= RAND_GET_OPTION(RSK_SHUFFLE_ADULT_TRADE) == RO_GENERIC_OFF; + *should |= RAND_GET_OPTION(RSK_SHUFFLE_ADULT_TRADE).Is(RO_GENERIC_OFF); break; } case VB_OKARINA_TAG_COMPLETE: { @@ -1502,7 +1501,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l } case VB_BE_ELIGIBLE_TO_OPEN_DOT: { bool eligible = - RAND_GET_OPTION(RSK_DOOR_OF_TIME) != RO_DOOROFTIME_CLOSED || + RAND_GET_OPTION(RSK_DOOR_OF_TIME).IsNot(RO_DOOROFTIME_CLOSED) || (INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_TIME && CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) && CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)); *should = eligible; @@ -2197,13 +2196,13 @@ void RandomizerOnActorInitHandler(void* actorRef) { } if (actor->id == ACTOR_EN_OSSAN && actor->params == OSSAN_TYPE_MASK && - RAND_GET_OPTION(RSK_MASK_QUEST) == RO_MASK_QUEST_SHUFFLE) { + RAND_GET_OPTION(RSK_MASK_QUEST).Is(RO_MASK_QUEST_SHUFFLE)) { Actor_Kill(actor); } if (actor->id == ACTOR_BG_TREEMOUTH && LINK_IS_ADULT && - RAND_GET_OPTION(RSK_SHUFFLE_DUNGEON_ENTRANCES) != RO_DUNGEON_ENTRANCE_SHUFFLE_OFF && - (RAND_GET_OPTION(RSK_FOREST) == RO_CLOSED_FOREST_OFF || + RAND_GET_OPTION(RSK_SHUFFLE_DUNGEON_ENTRANCES).IsNot(RO_DUNGEON_ENTRANCE_SHUFFLE_OFF) && + (RAND_GET_OPTION(RSK_FOREST).Is(RO_CLOSED_FOREST_OFF) || Flags_GetEventChkInf(EVENTCHKINF_SHOWED_MIDO_SWORD_SHIELD))) { BgTreemouth* bgTreemouth = static_cast(actorRef); bgTreemouth->unk_168 = 1.0f; @@ -2247,7 +2246,7 @@ void RandomizerOnActorInitHandler(void* actorRef) { break; case SCENE_GANONDORF_BOSS: case SCENE_GANON_BOSS: - if (RAND_GET_OPTION(RSK_SHUFFLE_BOSS_SOULS) == RO_BOSS_SOULS_ON_PLUS_GANON) { + if (RAND_GET_OPTION(RSK_SHUFFLE_BOSS_SOULS).Is(RO_BOSS_SOULS_ON_PLUS_GANON)) { currentBossSoulRandInf = RAND_INF_GANON_SOUL; } break; @@ -2534,7 +2533,7 @@ void RandomizerOnPlayerUpdateHandler() { *Rando::StaticData::GetItemTable().at(RG_GANONS_CASTLE_BOSS_KEY).GetGIEntry()); } - if (!GameInteractor::IsGameplayPaused() && RAND_GET_OPTION(RSK_TRIFORCE_HUNT) != RO_TRIFORCE_HUNT_OFF) { + if (!GameInteractor::IsGameplayPaused() && RAND_GET_OPTION(RSK_TRIFORCE_HUNT).IsNot(RO_TRIFORCE_HUNT_OFF)) { // Warp to credits if (GameInteractor::State::TriforceHuntCreditsWarpActive) { gPlayState->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; @@ -2729,7 +2728,7 @@ static void RandomizerRegisterHooks() { onCuccoOrChickenHatchHook = GameInteractor::Instance->RegisterGameHook( RandomizerOnCuccoOrChickenHatch); - if (RAND_GET_OPTION(RSK_FISHSANITY) != RO_FISHSANITY_OFF) { + if (RAND_GET_OPTION(RSK_FISHSANITY).IsNot(RO_FISHSANITY_OFF)) { OTRGlobals::Instance->gRandoContext->GetFishsanity()->InitializeFromSave(); } }); diff --git a/soh/soh/Enhancements/randomizer/location_list.cpp b/soh/soh/Enhancements/randomizer/location_list.cpp index 73fb7fa6f..25f6cbc97 100644 --- a/soh/soh/Enhancements/randomizer/location_list.cpp +++ b/soh/soh/Enhancements/randomizer/location_list.cpp @@ -1011,7 +1011,7 @@ void Rando::StaticData::InitHashMaps() { } Location* Rando::StaticData::GetLocation(RandomizerCheck locKey) { - return &(locationTable[locKey]); + return &locationTable[locKey]; } std::array& Rando::StaticData::GetLocationTable() { diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 56d6e652d..d6444c210 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -9,7 +9,6 @@ extern "C" { #include "src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h" #include "src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h" #include "src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h" -#include "src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h" #include "src/overlays/actors/ovl_En_Owl/z_en_owl.h" #include "src/overlays/actors/ovl_En_Go2/z_en_go2.h" #include "src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h" @@ -949,7 +948,7 @@ void TimeSaverOnActorInitHandler(void* actorRef) { return; } - bool shouldOpen = IS_RANDO ? RAND_GET_OPTION(RSK_JABU_OPEN) + bool shouldOpen = IS_RANDO ? RAND_GET_OPTION(RSK_JABU_OPEN).Get() : CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipJabuJabuFish"), 0); if (!shouldOpen) { return; diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 0c87bce52..6131c1079 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -71,7 +71,6 @@ #include // OSFatal #endif -#include "Enhancements/custom-message/CustomMessageTypes.h" #include #include "Enhancements/item-tables/ItemTableManager.h" #include "soh/SohGui/SohGui.hpp" @@ -131,10 +130,6 @@ #include "soh/config/ConfigUpdaters.h" #include "soh/ShipInit.hpp" -extern "C" { -#include "src/overlays/actors/ovl_En_Dns/z_en_dns.h" -} - bool SoH_HandleConfigDrop(char* filePath); OTRGlobals* OTRGlobals::Instance; @@ -909,10 +904,9 @@ void OTRGlobals::Initialize() { // startup. We should probably find some code in db_camera that does initialization and only run once, and then // dealloc on deinitialization. cameraStrings = (char**)malloc(sizeof(constCameraStrings)); - for (int32_t i = 0; i < sizeof(constCameraStrings) / sizeof(char*); i++) { + for (size_t i = 0; i < sizeof(constCameraStrings) / sizeof(char*); i++) { // OTRTODO: never deallocated... - auto dup = strdup(constCameraStrings[i]); - cameraStrings[i] = dup; + cameraStrings[i] = strdup(constCameraStrings[i]); } auto versions = context->GetResourceManager()->GetArchiveManager()->GetGameVersions(); @@ -1462,10 +1456,7 @@ extern "C" void Messagebox_ShowErrorBox(char* title, char* body) { } bool VerifyArchiveVersion(OTRVersion version) { - if (version.major != INT16_MAX && version.major != gBuildVersionMajor) { - return true; - } - return false; + return version.major != INT16_MAX && version.major != gBuildVersionMajor; } extern "C" void InitOTR(int argc, char* argv[]) { @@ -1953,7 +1944,7 @@ void OTRGlobals::CheckSaveFile(size_t sramSize) const { std::fstream saveFile(savePath, std::fstream::in | std::fstream::out | std::fstream::binary); if (saveFile.fail()) { saveFile.open(savePath, std::fstream::in | std::fstream::out | std::fstream::binary | std::fstream::app); - for (int i = 0; i < sramSize; ++i) { + for (size_t i = 0; i < sramSize; i++) { saveFile.write("\0", 1); } } diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index af30cf9f6..048d9a707 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -15,11 +15,8 @@ #include "objects/object_mag/object_mag.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "soh_assets.h" -#include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/boss-rush/BossRush.h" #include "soh/Enhancements/FileSelectEnhancements.h" -#include "soh/Enhancements/custom-message/CustomMessageTypes.h" -#include "soh/Enhancements/enhancementTypes.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include #include "z64save.h"