From 79b6719db3cc90edd1fa6f112fbf229a6a20a71a Mon Sep 17 00:00:00 2001 From: Malkierian Date: Wed, 21 May 2025 11:30:16 -0700 Subject: [PATCH 01/13] Change soh.otr loading to use `LocateFileAcrossAppDirs()` instead of just the app bundle path. (#5525) --- soh/soh/OTRGlobals.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index e5906778f..88109e923 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -272,7 +272,7 @@ OTRGlobals::OTRGlobals() { if (std::filesystem::exists(ootPath)) { OTRFiles.push_back(ootPath); } - std::string sohOtrPath = Ship::Context::GetPathRelativeToAppBundle("soh.otr"); + std::string sohOtrPath = Ship::Context::LocateFileAcrossAppDirs("soh.otr"); if (std::filesystem::exists(sohOtrPath)) { OTRFiles.push_back(sohOtrPath); } @@ -1153,7 +1153,7 @@ extern "C" void InitOTR() { CheckAndCreateModFolder(); #endif - CheckSoHOTRVersion(Ship::Context::GetPathRelativeToAppBundle("soh.otr")); + CheckSoHOTRVersion(Ship::Context::LocateFileAcrossAppDirs("soh.otr")); if (!std::filesystem::exists(Ship::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName)) && !std::filesystem::exists(Ship::Context::LocateFileAcrossAppDirs("oot.otr", appShortName))) { From 1d716a59752947173bf49710f614fb0d7fc7b060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Thu, 22 May 2025 22:18:03 +0000 Subject: [PATCH 02/13] ShuffleBeehives.cpp (#5511) --- .../randomizer/ShuffleBeehives.cpp | 137 ++++++++++++++++++ .../Enhancements/randomizer/ShuffleCows.cpp | 1 - soh/soh/Enhancements/randomizer/context.cpp | 1 - .../Enhancements/randomizer/hook_handlers.cpp | 75 ---------- .../Enhancements/randomizer/location_list.cpp | 34 ----- soh/soh/Enhancements/randomizer/static_data.h | 1 + 6 files changed, 138 insertions(+), 111 deletions(-) create mode 100644 soh/soh/Enhancements/randomizer/ShuffleBeehives.cpp diff --git a/soh/soh/Enhancements/randomizer/ShuffleBeehives.cpp b/soh/soh/Enhancements/randomizer/ShuffleBeehives.cpp new file mode 100644 index 000000000..60969a0c0 --- /dev/null +++ b/soh/soh/Enhancements/randomizer/ShuffleBeehives.cpp @@ -0,0 +1,137 @@ +#include +#include "static_data.h" + +extern "C" { +#include "src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h" +extern PlayState* gPlayState; +} + +extern void EnItem00_DrawRandomizedItem(EnItem00* enItem00, PlayState* play); + +void ObjComb_RandomizerChooseItemDrop(ObjComb* objComb, PlayState* play) { + s16 params = objComb->actor.params & 0x1F; + + if (Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_BEEHIVES).Get() && + !Flags_GetRandomizerInf(objComb->beehiveIdentity.randomizerInf)) { + EnItem00* item00 = (EnItem00*)Item_DropCollectible2(play, &objComb->actor.world.pos, ITEM00_SOH_DUMMY); + item00->randoInf = objComb->beehiveIdentity.randomizerInf; + item00->itemEntry = + OTRGlobals::Instance->gRandomizer->GetItemFromKnownCheck(objComb->beehiveIdentity.randomizerCheck, GI_NONE); + item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem; + return; + } + + if ((params > 0) || (params < 0x1A)) { + if (params == 6) { + if (Flags_GetCollectible(play, (objComb->actor.params >> 8) & 0x3F)) { + params = -1; + } else { + params = (params | (((objComb->actor.params >> 8) & 0x3F) << 8)); + } + } else if (Rand_ZeroOne() < 0.5f) { + params = -1; + } + if (params >= 0 && !CVarGetInteger(CVAR_ENHANCEMENT("NoRandomDrops"), 0)) { + Item_DropCollectible(play, &objComb->actor.world.pos, params); + } + } +} + +void ObjComb_RandomizerWait(ObjComb* objComb, PlayState* play) { + s32 dmgFlags; + + objComb->unk_1B0 -= 50; + if (Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_BEEHIVES).Get() && + !Flags_GetRandomizerInf(objComb->beehiveIdentity.randomizerInf)) { + if (objComb->unk_1B0 <= -5000) { + objComb->unk_1B0 = 1500; + } + } else if (objComb->unk_1B0 < 0) { + objComb->unk_1B0 = 0; + } + + if ((objComb->collider.base.acFlags & AC_HIT) != 0) { + objComb->collider.base.acFlags &= ~AC_HIT; + dmgFlags = objComb->collider.elements[0].info.acHitInfo->toucher.dmgFlags; + if (dmgFlags & 0x4001F866) { + objComb->unk_1B0 = 1500; + } else { + ObjComb_Break(objComb, play); + ObjComb_RandomizerChooseItemDrop(objComb, play); + Actor_Kill(&objComb->actor); + } + } else { + CollisionCheck_SetAC(play, &play->colChkCtx, &objComb->collider.base); + } + + if (objComb->actor.update != NULL) { + CollisionCheck_SetOC(play, &play->colChkCtx, &objComb->collider.base); + } +} + +void ObjComb_RandomizerInit(void* actor) { + ObjComb* objComb = static_cast(actor); + s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1); + objComb->beehiveIdentity = OTRGlobals::Instance->gRandomizer->IdentifyBeehive( + gPlayState->sceneNum, (s16)objComb->actor.world.pos.x, respawnData); + objComb->actionFunc = (ObjCombActionFunc)ObjComb_RandomizerWait; +} + +void ObjComb_RandomizerUpdate(void* actor) { + ObjComb* combActor = reinterpret_cast(actor); + combActor->actor.shape.rot.x = + static_cast(Math_SinS(combActor->unk_1B2)) * CLAMP_MIN(combActor->unk_1B0, 0) + + combActor->actor.home.rot.x; +} + +void RegisterShuffleBeehives() { + bool shouldRegister = IS_RANDO && Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_BEEHIVES).Get(); + + COND_ID_HOOK(OnActorInit, ACTOR_OBJ_COMB, shouldRegister, ObjComb_RandomizerInit); + COND_ID_HOOK(OnActorUpdate, ACTOR_OBJ_COMB, shouldRegister, ObjComb_RandomizerUpdate); +} + +static RegisterShipInitFunc initFunc(RegisterShuffleBeehives, { "IS_RANDO" }); + +void Rando::StaticData::RegisterBeehiveLocations() { + static bool registered = false; + if (registered) + return; + registered = true; + // clang-format off + locationTable[RC_KF_STORMS_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_KF_STORMS_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KOKIRI_FOREST, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x2C), "Storms Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KF_STORMS_GROTTO_LEFT)); + locationTable[RC_KF_STORMS_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_KF_STORMS_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KOKIRI_FOREST, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x2C), "Storms Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KF_STORMS_GROTTO_RIGHT)); + locationTable[RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LOST_WOODS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x14), "Tunnel Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LW_NEAR_SHORTCUTS_GROTTO_LEFT)); + locationTable[RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LOST_WOODS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x14), "Tunnel Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LW_NEAR_SHORTCUTS_GROTTO_RIGHT)); + locationTable[RC_LW_DEKU_SCRUB_GROTTO_BEEHIVE] = Location::Base(RC_LW_DEKU_SCRUB_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LOST_WOODS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(747, 0xF5), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LW_DEKU_SCRUB_GROTTO)); + locationTable[RC_SFM_STORMS_GROTTO_BEEHIVE] = Location::Base(RC_SFM_STORMS_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_SACRED_FOREST_MEADOW, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xEE), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_SFM_STORMS_GROTTO)); + locationTable[RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x00), "Near Market Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_NEAR_MARKET_GROTTO_LEFT)); + locationTable[RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x00), "Near Market Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_NEAR_MARKET_GROTTO_RIGHT)); + locationTable[RC_HF_OPEN_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_HF_OPEN_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x03), "Open Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_OPEN_GROTTO_LEFT)); + locationTable[RC_HF_OPEN_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_HF_OPEN_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x03), "Open Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_OPEN_GROTTO_RIGHT)); + locationTable[RC_HF_SOUTHEAST_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_HF_SOUTHEAST_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x22), "Southeast Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_SOUTHEAST_GROTTO_LEFT)); + locationTable[RC_HF_SOUTHEAST_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_HF_SOUTHEAST_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x22), "Southeast Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_SOUTHEAST_GROTTO_RIGHT)); + locationTable[RC_HF_INSIDE_FENCE_GROTTO_BEEHIVE] = Location::Base(RC_HF_INSIDE_FENCE_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(1410, 0xE6), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_LONELY_SCRUB_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_INSIDE_FENCE_GROTTO)); + locationTable[RC_LLR_GROTTO_BEEHIVE] = Location::Base(RC_LLR_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LON_LON_RANCH, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xFC), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LLR_GROTTO)); + locationTable[RC_KAK_OPEN_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_KAK_OPEN_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KAKARIKO_VILLAGE, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x28), "Open Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KAK_OPEN_GROTTO_LEFT)); + locationTable[RC_KAK_OPEN_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_KAK_OPEN_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KAKARIKO_VILLAGE, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x28), "Open Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KAK_OPEN_GROTTO_RIGHT)); + locationTable[RC_DMT_COW_GROTTO_BEEHIVE] = Location::Base(RC_DMT_COW_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2617, 0xF8), "Cow Grotto Beehive", RHT_BEEHIVE_COW_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMT_COW_GROTTO)); + locationTable[RC_DMT_STORMS_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_DMT_STORMS_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x57), "Storms Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMT_STORMS_GROTTO_LEFT)); + locationTable[RC_DMT_STORMS_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_DMT_STORMS_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x57), "Storms Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMT_STORMS_GROTTO_RIGHT)); + locationTable[RC_GC_GROTTO_BEEHIVE] = Location::Base(RC_GC_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_GORON_CITY, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xFB), "Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_GC_GROTTO)); + locationTable[RC_DMC_UPPER_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_DMC_UPPER_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_CRATER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x7A), "Upper Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMC_UPPER_GROTTO_LEFT)); + locationTable[RC_DMC_UPPER_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_DMC_UPPER_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_CRATER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x7A), "Upper Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMC_UPPER_GROTTO_RIGHT)); + locationTable[RC_DMC_HAMMER_GROTTO_BEEHIVE] = Location::Base(RC_DMC_HAMMER_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_CRATER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xF9), "Hammer Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMC_HAMMER_GROTTO)); + locationTable[RC_ZR_OPEN_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_ZR_OPEN_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_ZORAS_RIVER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x29), "Open Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZR_OPEN_GROTTO_LEFT)); + locationTable[RC_ZR_OPEN_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_ZR_OPEN_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_ZORAS_RIVER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x29), "Open Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZR_OPEN_GROTTO_RIGHT)); + locationTable[RC_ZR_STORMS_GROTTO_BEEHIVE] = Location::Base(RC_ZR_STORMS_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_ZORAS_RIVER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xEB), "Storms Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZR_STORMS_GROTTO)); + locationTable[RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_LEFT] = Location::Base(RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, ACTOR_OBJ_COMB, SCENE_ZORAS_DOMAIN, TWO_ACTOR_PARAMS(382, 0x00), "In Front of King Zora Beehive Left", RHT_BEEHIVE_IN_FRONT_OF_KING_ZORA, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZD_IN_FRONT_OF_KING_ZORA_LEFT)); + locationTable[RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_RIGHT] = Location::Base(RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, ACTOR_OBJ_COMB, SCENE_ZORAS_DOMAIN, TWO_ACTOR_PARAMS(948, 0x00), "In Front of King Zora Beehive Right", RHT_BEEHIVE_IN_FRONT_OF_KING_ZORA, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZD_IN_FRONT_OF_KING_ZORA_RIGHT)); + locationTable[RC_ZD_BEHIND_KING_ZORA_BEEHIVE] = Location::Base(RC_ZD_BEHIND_KING_ZORA_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, ACTOR_OBJ_COMB, SCENE_ZORAS_DOMAIN, TWO_ACTOR_PARAMS(701, 0x00), "Behind King Zora Beehive", RHT_BEEHIVE_BEHIND_KING_ZORA, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZD_BEHIND_KING_ZORA)); + locationTable[RC_LH_GROTTO_BEEHIVE] = Location::Base(RC_LH_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LAKE_HYLIA, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xEF), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LH_GROTTO)); + locationTable[RC_GV_DEKU_SCRUB_GROTTO_BEEHIVE] = Location::Base(RC_GV_DEKU_SCRUB_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_GERUDO_VALLEY, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xF0), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_GV_DEKU_SCRUB_GROTTO)); + locationTable[RC_COLOSSUS_GROTTO_BEEHIVE] = Location::Base(RC_COLOSSUS_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DESERT_COLOSSUS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xFD), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_COLOSSUS_GROTTO)); + // clang-format-on +} + +static RegisterShipInitFunc registerFunc(Rando::StaticData::RegisterBeehiveLocations); diff --git a/soh/soh/Enhancements/randomizer/ShuffleCows.cpp b/soh/soh/Enhancements/randomizer/ShuffleCows.cpp index 5dfe02b26..ac2e9529e 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleCows.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleCows.cpp @@ -76,7 +76,6 @@ void Rando::StaticData::RegisterCowLocations() { locationTable[RC_DMT_COW_GROTTO_COW] = Location::Base(RC_DMT_COW_GROTTO_COW, RCQUEST_BOTH, RCTYPE_COW, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_EN_COW, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2444, -471), "Cow Grotto Cow", RHT_DMT_COW_GROTTO_COW, RG_MILK, SpoilerCollectionCheck::RandomizerInf(RAND_INF_COWS_MILKED_DMT_COW_GROTTO_COW)); locationTable[RC_GV_COW] = Location::Base(RC_GV_COW, RCQUEST_BOTH, RCTYPE_COW, ACTOR_EN_COW, SCENE_GERUDO_VALLEY, 0x00, "Cow", RHT_GV_COW, RG_MILK, SpoilerCollectionCheck::RandomizerInf(RAND_INF_COWS_MILKED_GV_COW)); locationTable[RC_JABU_JABUS_BELLY_MQ_COW] = Location::Base(RC_JABU_JABUS_BELLY_MQ_COW, RCQUEST_MQ, RCTYPE_COW, ACTOR_EN_COW, SCENE_JABU_JABU, 0x00, "MQ Cow", RHT_JABU_JABUS_BELLY_MQ_COW, RG_MILK, SpoilerCollectionCheck::RandomizerInf(RAND_INF_COWS_MILKED_JABU_JABUS_BELLY_MQ_COW)); - // clang-format-on } diff --git a/soh/soh/Enhancements/randomizer/context.cpp b/soh/soh/Enhancements/randomizer/context.cpp index fa755325e..e3a914e87 100644 --- a/soh/soh/Enhancements/randomizer/context.cpp +++ b/soh/soh/Enhancements/randomizer/context.cpp @@ -202,7 +202,6 @@ void Context::GenerateLocationPool() { mOptions[RSK_SHUFFLE_FREESTANDING].Is(RO_SHUFFLE_FREESTANDING_DUNGEONS)) || (location.GetRCType() == RCTYPE_POT && mOptions[RSK_SHUFFLE_POTS].Is(RO_SHUFFLE_POTS_DUNGEONS)) || (location.GetRCType() == RCTYPE_GRASS && mOptions[RSK_SHUFFLE_GRASS].Is(RO_SHUFFLE_GRASS_DUNGEONS)) || - (location.GetRCType() == RCTYPE_POT && mOptions[RSK_SHUFFLE_POTS].Is(RO_SHUFFLE_POTS_DUNGEONS)) || (location.GetRCType() == RCTYPE_CRATE && mOptions[RSK_SHUFFLE_CRATES].Is(RO_SHUFFLE_CRATES_DUNGEONS)) || (location.GetRCType() == RCTYPE_NLCRATE && mOptions[RSK_SHUFFLE_CRATES].Is(RO_SHUFFLE_CRATES_DUNGEONS) && diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 5fe050170..a7b56a6be 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -43,7 +43,6 @@ extern "C" { #include "src/overlays/actors/ovl_En_Box/z_en_box.h" #include "src/overlays/actors/ovl_En_Skj/z_en_skj.h" #include "src/overlays/actors/ovl_En_Hy/z_en_hy.h" -#include "src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h" #include "src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h" #include "src/overlays/actors/ovl_En_Ge1/z_en_ge1.h" #include "src/overlays/actors/ovl_En_Ds/z_en_ds.h" @@ -1832,65 +1831,6 @@ void EnDns_RandomizerPurchase(EnDns* enDns) { Flags_SetRandomizerInf(enDns->sohScrubIdentity.randomizerInf); } -void ObjComb_RandomizerChooseItemDrop(ObjComb* objComb, PlayState* play) { - s16 params = objComb->actor.params & 0x1F; - - if (RAND_GET_OPTION(RSK_SHUFFLE_BEEHIVES) && !Flags_GetRandomizerInf(objComb->beehiveIdentity.randomizerInf)) { - EnItem00* item00 = (EnItem00*)Item_DropCollectible2(play, &objComb->actor.world.pos, ITEM00_SOH_DUMMY); - item00->randoInf = objComb->beehiveIdentity.randomizerInf; - item00->itemEntry = - OTRGlobals::Instance->gRandomizer->GetItemFromKnownCheck(objComb->beehiveIdentity.randomizerCheck, GI_NONE); - item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem; - return; - } - - if ((params > 0) || (params < 0x1A)) { - if (params == 6) { - if (Flags_GetCollectible(play, (objComb->actor.params >> 8) & 0x3F)) { - params = -1; - } else { - params = (params | (((objComb->actor.params >> 8) & 0x3F) << 8)); - } - } else if (Rand_ZeroOne() < 0.5f) { - params = -1; - } - if (params >= 0 && !CVarGetInteger(CVAR_ENHANCEMENT("NoRandomDrops"), 0)) { - Item_DropCollectible(play, &objComb->actor.world.pos, params); - } - } -} - -void ObjComb_RandomizerWait(ObjComb* objComb, PlayState* play) { - s32 dmgFlags; - - objComb->unk_1B0 -= 50; - if (RAND_GET_OPTION(RSK_SHUFFLE_BEEHIVES) && !Flags_GetRandomizerInf(objComb->beehiveIdentity.randomizerInf)) { - if (objComb->unk_1B0 <= -5000) { - objComb->unk_1B0 = 1500; - } - } else if (objComb->unk_1B0 < 0) { - objComb->unk_1B0 = 0; - } - - if ((objComb->collider.base.acFlags & AC_HIT) != 0) { - objComb->collider.base.acFlags &= ~AC_HIT; - dmgFlags = objComb->collider.elements[0].info.acHitInfo->toucher.dmgFlags; - if (dmgFlags & 0x4001F866) { - objComb->unk_1B0 = 1500; - } else { - ObjComb_Break(objComb, play); - ObjComb_RandomizerChooseItemDrop(objComb, play); - Actor_Kill(&objComb->actor); - } - } else { - CollisionCheck_SetAC(play, &play->colChkCtx, &objComb->collider.base); - } - - if (objComb->actor.update != NULL) { - CollisionCheck_SetOC(play, &play->colChkCtx, &objComb->collider.base); - } -} - void RandomizerOnActorInitHandler(void* actorRef) { Actor* actor = static_cast(actorRef); @@ -1983,14 +1923,6 @@ void RandomizerOnActorInitHandler(void* actorRef) { } } - if (actor->id == ACTOR_OBJ_COMB) { - ObjComb* objComb = static_cast(actorRef); - s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1); - objComb->beehiveIdentity = OTRGlobals::Instance->gRandomizer->IdentifyBeehive( - gPlayState->sceneNum, (s16)actor->world.pos.x, respawnData); - objComb->actionFunc = (ObjCombActionFunc)ObjComb_RandomizerWait; - } - if (actor->id == ACTOR_EN_EX_ITEM) { EnExItem* enExItem = static_cast(actorRef); @@ -2199,13 +2131,6 @@ void RandomizerOnActorUpdateHandler(void* refActor) { actor->params == 0x000F) { // Warp Song particles Entrance_SetWarpSongEntrance(); } - - if (actor->id == ACTOR_OBJ_COMB) { - ObjComb* combActor = reinterpret_cast(actor); - combActor->actor.shape.rot.x = - static_cast(Math_SinS(combActor->unk_1B2)) * CLAMP_MIN(combActor->unk_1B0, 0) + - combActor->actor.home.rot.x; - } } // from z_player.c diff --git a/soh/soh/Enhancements/randomizer/location_list.cpp b/soh/soh/Enhancements/randomizer/location_list.cpp index d1785ba07..2812b0135 100644 --- a/soh/soh/Enhancements/randomizer/location_list.cpp +++ b/soh/soh/Enhancements/randomizer/location_list.cpp @@ -842,40 +842,6 @@ void Rando::StaticData::InitLocationTable() { locationTable[RC_SONG_FROM_OCARINA_OF_TIME] = Location::Base(RC_SONG_FROM_OCARINA_OF_TIME, RCQUEST_BOTH, RCTYPE_SONG_LOCATION, ACTOR_ID_MAX, SCENE_HYRULE_FIELD, 0x00, "Song from Ocarina of Time", "Song from Ocarina of Time", RHT_SONG_FROM_OCARINA_OF_TIME, RG_SONG_OF_TIME, SpoilerCollectionCheck::EventChkInf(EVENTCHKINF_LEARNED_SONG_OF_TIME), true); locationTable[RC_SONG_FROM_WINDMILL] = Location::Base(RC_SONG_FROM_WINDMILL, RCQUEST_BOTH, RCTYPE_SONG_LOCATION, RCAREA_KAKARIKO_VILLAGE, ACTOR_ID_MAX, SCENE_WINDMILL_AND_DAMPES_GRAVE, 0x00, "Song from Windmill", "Song from Windmill", RHT_SONG_FROM_WINDMILL, RG_SONG_OF_STORMS, SpoilerCollectionCheck::EventChkInf(EVENTCHKINF_LEARNED_SONG_OF_STORMS), true); - //Beehives - locationTable[RC_KF_STORMS_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_KF_STORMS_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KOKIRI_FOREST, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x2C), "Storms Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KF_STORMS_GROTTO_LEFT)); - locationTable[RC_KF_STORMS_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_KF_STORMS_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KOKIRI_FOREST, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x2C), "Storms Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KF_STORMS_GROTTO_RIGHT)); - locationTable[RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LOST_WOODS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x14), "Tunnel Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LW_NEAR_SHORTCUTS_GROTTO_LEFT)); - locationTable[RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LOST_WOODS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x14), "Tunnel Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LW_NEAR_SHORTCUTS_GROTTO_RIGHT)); - locationTable[RC_LW_DEKU_SCRUB_GROTTO_BEEHIVE] = Location::Base(RC_LW_DEKU_SCRUB_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LOST_WOODS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(747, 0xF5), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LW_DEKU_SCRUB_GROTTO)); - locationTable[RC_SFM_STORMS_GROTTO_BEEHIVE] = Location::Base(RC_SFM_STORMS_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_SACRED_FOREST_MEADOW, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xEE), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_SFM_STORMS_GROTTO)); - locationTable[RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x00), "Near Market Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_NEAR_MARKET_GROTTO_LEFT)); - locationTable[RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x00), "Near Market Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_NEAR_MARKET_GROTTO_RIGHT)); - locationTable[RC_HF_OPEN_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_HF_OPEN_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x03), "Open Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_OPEN_GROTTO_LEFT)); - locationTable[RC_HF_OPEN_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_HF_OPEN_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x03), "Open Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_OPEN_GROTTO_RIGHT)); - locationTable[RC_HF_SOUTHEAST_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_HF_SOUTHEAST_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x22), "Southeast Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_SOUTHEAST_GROTTO_LEFT)); - locationTable[RC_HF_SOUTHEAST_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_HF_SOUTHEAST_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x22), "Southeast Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_SOUTHEAST_GROTTO_RIGHT)); - locationTable[RC_HF_INSIDE_FENCE_GROTTO_BEEHIVE] = Location::Base(RC_HF_INSIDE_FENCE_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(1410, 0xE6), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_LONELY_SCRUB_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_INSIDE_FENCE_GROTTO)); - locationTable[RC_LLR_GROTTO_BEEHIVE] = Location::Base(RC_LLR_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LON_LON_RANCH, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xFC), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LLR_GROTTO)); - locationTable[RC_KAK_OPEN_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_KAK_OPEN_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KAKARIKO_VILLAGE, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x28), "Open Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KAK_OPEN_GROTTO_LEFT)); - locationTable[RC_KAK_OPEN_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_KAK_OPEN_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KAKARIKO_VILLAGE, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x28), "Open Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KAK_OPEN_GROTTO_RIGHT)); - locationTable[RC_DMT_COW_GROTTO_BEEHIVE] = Location::Base(RC_DMT_COW_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2617, 0xF8), "Cow Grotto Beehive", RHT_BEEHIVE_COW_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMT_COW_GROTTO)); - locationTable[RC_DMT_STORMS_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_DMT_STORMS_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x57), "Storms Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMT_STORMS_GROTTO_LEFT)); - locationTable[RC_DMT_STORMS_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_DMT_STORMS_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x57), "Storms Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMT_STORMS_GROTTO_RIGHT)); - locationTable[RC_GC_GROTTO_BEEHIVE] = Location::Base(RC_GC_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_GORON_CITY, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xFB), "Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_GC_GROTTO)); - locationTable[RC_DMC_UPPER_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_DMC_UPPER_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_CRATER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x7A), "Upper Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMC_UPPER_GROTTO_LEFT)); - locationTable[RC_DMC_UPPER_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_DMC_UPPER_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_CRATER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x7A), "Upper Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMC_UPPER_GROTTO_RIGHT)); - locationTable[RC_DMC_HAMMER_GROTTO_BEEHIVE] = Location::Base(RC_DMC_HAMMER_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_CRATER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xF9), "Hammer Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMC_HAMMER_GROTTO)); - locationTable[RC_ZR_OPEN_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_ZR_OPEN_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_ZORAS_RIVER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x29), "Open Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZR_OPEN_GROTTO_LEFT)); - locationTable[RC_ZR_OPEN_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_ZR_OPEN_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_ZORAS_RIVER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x29), "Open Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZR_OPEN_GROTTO_RIGHT)); - locationTable[RC_ZR_STORMS_GROTTO_BEEHIVE] = Location::Base(RC_ZR_STORMS_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_ZORAS_RIVER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xEB), "Storms Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZR_STORMS_GROTTO)); - locationTable[RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_LEFT] = Location::Base(RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, ACTOR_OBJ_COMB, SCENE_ZORAS_DOMAIN, TWO_ACTOR_PARAMS(382, 0x00), "In Front of King Zora Beehive Left", RHT_BEEHIVE_IN_FRONT_OF_KING_ZORA, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZD_IN_FRONT_OF_KING_ZORA_LEFT)); - locationTable[RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_RIGHT] = Location::Base(RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, ACTOR_OBJ_COMB, SCENE_ZORAS_DOMAIN, TWO_ACTOR_PARAMS(948, 0x00), "In Front of King Zora Beehive Right", RHT_BEEHIVE_IN_FRONT_OF_KING_ZORA, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZD_IN_FRONT_OF_KING_ZORA_RIGHT)); - locationTable[RC_ZD_BEHIND_KING_ZORA_BEEHIVE] = Location::Base(RC_ZD_BEHIND_KING_ZORA_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, ACTOR_OBJ_COMB, SCENE_ZORAS_DOMAIN, TWO_ACTOR_PARAMS(701, 0x00), "Behind King Zora Beehive", RHT_BEEHIVE_BEHIND_KING_ZORA, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZD_BEHIND_KING_ZORA)); - locationTable[RC_LH_GROTTO_BEEHIVE] = Location::Base(RC_LH_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LAKE_HYLIA, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xEF), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LH_GROTTO)); - locationTable[RC_GV_DEKU_SCRUB_GROTTO_BEEHIVE] = Location::Base(RC_GV_DEKU_SCRUB_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_GERUDO_VALLEY, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xF0), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_GV_DEKU_SCRUB_GROTTO)); - locationTable[RC_COLOSSUS_GROTTO_BEEHIVE] = Location::Base(RC_COLOSSUS_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DESERT_COLOSSUS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xFD), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_COLOSSUS_GROTTO)); - /*------------------------------- --- SHOPS --- 8 6 2 4 diff --git a/soh/soh/Enhancements/randomizer/static_data.h b/soh/soh/Enhancements/randomizer/static_data.h index 797fcab46..1be34e772 100644 --- a/soh/soh/Enhancements/randomizer/static_data.h +++ b/soh/soh/Enhancements/randomizer/static_data.h @@ -49,6 +49,7 @@ class StaticData { static std::vector GetPondFishLocations(); static std::vector GetOverworldFishLocations(); static std::vector GetOverworldFairyLocations(); + static void RegisterBeehiveLocations(); static void RegisterCowLocations(); static void RegisterFishLocations(); static void RegisterFairyLocations(); From 24013e2e5c2c8db47e46180818e1a11b0c7266f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Fri, 23 May 2025 21:00:35 +0000 Subject: [PATCH 03/13] skip bottling big poes (#5247) * setting to skip bottling big poes empty bottle still required to collect avoids logic needing to work around player soft locking by filling bottles without poe collector access * No option, zero option * TEXT_BIG_POE_COLLECTED_RANDO * update preset * fix talking to poe collector after receiving item --- .../Enhancements/Presets/PresetEntries.cpp | 8 ++-- .../custom-message/CustomMessageTypes.h | 1 + .../vanilla-behavior/GIVanillaBehavior.h | 16 ++++++++ .../Enhancements/randomizer/3drando/fill.cpp | 24 ++---------- .../Enhancements/randomizer/3drando/fill.hpp | 2 +- .../Enhancements/randomizer/3drando/hints.cpp | 4 +- soh/soh/Enhancements/randomizer/entrance.cpp | 17 +-------- .../Enhancements/randomizer/hook_handlers.cpp | 26 ++++++++++++- .../randomizer/location_access.cpp | 3 -- .../location_access/overworld/market.cpp | 2 +- soh/soh/Enhancements/randomizer/logic.cpp | 37 +++++++++---------- soh/soh/Enhancements/randomizer/logic.h | 6 --- soh/soh/Enhancements/randomizer/savefile.cpp | 2 +- soh/soh/Enhancements/randomizer/settings.cpp | 2 +- soh/soh/OTRGlobals.cpp | 3 ++ soh/soh/z_message_OTR.cpp | 3 ++ soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c | 28 +++++++------- soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h | 3 +- .../actors/ovl_En_Po_Field/z_en_po_field.c | 2 +- 19 files changed, 97 insertions(+), 92 deletions(-) diff --git a/soh/soh/Enhancements/Presets/PresetEntries.cpp b/soh/soh/Enhancements/Presets/PresetEntries.cpp index c9ca5c24f..d94323d08 100644 --- a/soh/soh/Enhancements/Presets/PresetEntries.cpp +++ b/soh/soh/Enhancements/Presets/PresetEntries.cpp @@ -316,7 +316,7 @@ const std::vector randomizerBeginnerPresetEntries = { // Gamplay tab PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 0), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), 1), @@ -387,7 +387,7 @@ const std::vector randomizerStandardPresetEntries = { // Gamplay tab PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 0), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), 1), @@ -469,7 +469,7 @@ const std::vector randomizerAdvancedPresetEntries = { // Gamplay tab PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 0), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), 1), @@ -568,7 +568,7 @@ const std::vector hellModePresetEntries = { // Gamplay tab PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 0), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BombchuBag"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), 1), diff --git a/soh/soh/Enhancements/custom-message/CustomMessageTypes.h b/soh/soh/Enhancements/custom-message/CustomMessageTypes.h index e7c559857..3bcbaf7b0 100644 --- a/soh/soh/Enhancements/custom-message/CustomMessageTypes.h +++ b/soh/soh/Enhancements/custom-message/CustomMessageTypes.h @@ -162,6 +162,7 @@ typedef enum { TEXT_ANJU_THANKS_FOR_FINDING_MY_CUCCOS = 0x503B, TEXT_ANJU_ROUND_THEM_UP_OR_YOULL_PAY = 0x503C, TEXT_ANJU_DONT_TEASE_MY_CUCCOS = 0x503D, + TEXT_BIG_POE_COLLECTED_RANDO = 0x5090, TEXT_HBA_NOT_ON_HORSE = 0x603F, TEXT_HBA_INITIAL_EXPLAINATION = 0x6040, TEXT_HBA_WANT_TO_TRY_AGAIN_YES_NO = 0x6041, diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index 12b0e7fb2..4e607a29c 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -228,6 +228,14 @@ typedef enum { // - `*Actor` (interactRangeActor) VB_BOTTLE_ACTOR, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - `*EnPoField` + VB_BOTTLE_BIG_POE, + // #### `result` // ```c // ((this->actor.params == DNS_TYPE_HEART_PIECE) && (Flags_GetItemGetInf(ITEMGETINF_DEKU_SCRUB_HEART_PIECE))) || @@ -1733,6 +1741,14 @@ typedef enum { // - `*EnRu1` VB_RUTO_WANT_TO_BE_TOSSED_TO_SAPPHIRE, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - `*EnGb` + VB_SELL_POES_TO_POE_COLLECTOR, + // #### `result` // ```c // true diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index f0954231b..0fe779cf1 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -159,11 +159,6 @@ static void ValidateOtherEntrance(GetAccessibleLocationsStruct& gals) { ApplyStartingInventory(); // RANDOTODO when proper ammo logic is done, this could be moved to the start } } - // If we are not shuffling the guard house, add the key so we can properly check for poe merchant access - if (gals.validatedStartingRegion && gals.foundTempleOfTime && - ctx->GetOption(RSK_SHUFFLE_INTERIOR_ENTRANCES).Is(RO_INTERIOR_ENTRANCE_SHUFFLE_OFF)) { - Rando::StaticData::RetrieveItem(RG_GUARD_HOUSE_KEY).ApplyEffect(); - } } // Apply all items that are necessary for checking all location access @@ -180,10 +175,7 @@ static void ApplyAllAdvancmentItems() { static void ValidateSphereZero(GetAccessibleLocationsStruct& gals) { auto ctx = Rando::Context::GetInstance(); // Condition for verifying everything required for sphere 0, expanding search to all locations - if ((!logic->AreCheckingBigPoes || logic->CanEmptyBigPoes) && gals.validatedStartingRegion && - gals.foundTempleOfTime && gals.haveTimeAccess) { - // stop checking for big poes - logic->AreCheckingBigPoes = false; + if (gals.validatedStartingRegion && gals.foundTempleOfTime && gals.haveTimeAccess) { // Apply all items that are necessary for checking all location access ApplyAllAdvancmentItems(); // Reset access as the non-starting age @@ -213,7 +205,7 @@ void ProcessExits(Region* region, GetAccessibleLocationsStruct& gals, Randomizer // Update Time of Day Access for the exit if (UpdateToDAccess(&exit, exitRegion)) { gals.logicUpdated = true; - if (!gals.sphereZeroComplete || logic->AreCheckingBigPoes) { + if (!gals.sphereZeroComplete) { if (!gals.foundTempleOfTime || !gals.validatedStartingRegion) { ValidateOtherEntrance(gals); } @@ -596,15 +588,12 @@ bool CheckBeatable(RandomizerGet ignore /* = RG_NONE*/) { } // Check if the currently randomised set of entrances is a valid game map. -void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAccess) { +void ValidateEntrances(bool checkOtherEntranceAccess) { auto ctx = Rando::Context::GetInstance(); GetAccessibleLocationsStruct gals(0); ResetLogic(ctx, gals, !checkOtherEntranceAccess); ctx->allLocationsReachable = false; - if (checkPoeCollectorAccess) { - logic->AreCheckingBigPoes = true; - } if (checkOtherEntranceAccess) { gals.foundTempleOfTime = false; @@ -620,13 +609,6 @@ void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAcce RegionTable(RR_ROOT)->adultNight = true; RegionTable(RR_ROOT)->childDay = true; RegionTable(RR_ROOT)->adultDay = true; - } else if (checkPoeCollectorAccess) { - // If we are not shuffling the guard house, add the key so we can properly check for poe merchant access - if (ctx->GetOption(RSK_SHUFFLE_INTERIOR_ENTRANCES).Is(RO_INTERIOR_ENTRANCE_SHUFFLE_OFF)) { - Rando::StaticData::RetrieveItem(RG_GUARD_HOUSE_KEY).ApplyEffect(); - } - RegionTable(RR_ROOT)->adultNight = true; - RegionTable(RR_ROOT)->adultDay = true; } else { ApplyAllAdvancmentItems(); } diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.hpp b/soh/soh/Enhancements/randomizer/3drando/fill.hpp index 7e2e99e12..484331104 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.hpp @@ -72,4 +72,4 @@ void GeneratePlaythrough(); bool CheckBeatable(RandomizerGet ignore = RG_NONE); -void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAccess); +void ValidateEntrances(bool checkOtherEntranceAccess); diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.cpp b/soh/soh/Enhancements/randomizer/3drando/hints.cpp index 6a83c498e..394f6636d 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.cpp @@ -273,8 +273,8 @@ std::vector>> conditionalAlways std::make_pair(RC_MARKET_10_BIG_POES, []() { auto ctx = Rando::Context::GetInstance(); - return ctx->GetOption(RSK_BIG_POE_COUNT).Get() >= 3 && !ctx->GetOption(RSK_BIG_POES_HINT); - }), // Remember, the option's value being 3 means 4 are required + return ctx->GetOption(RSK_BIG_POE_COUNT).Get() > 3 && !ctx->GetOption(RSK_BIG_POES_HINT); + }), std::make_pair(RC_DEKU_THEATER_MASK_OF_TRUTH, []() { auto ctx = Rando::Context::GetInstance(); diff --git a/soh/soh/Enhancements/randomizer/entrance.cpp b/soh/soh/Enhancements/randomizer/entrance.cpp index f58dad3bc..5a19339ce 100644 --- a/soh/soh/Enhancements/randomizer/entrance.cpp +++ b/soh/soh/Enhancements/randomizer/entrance.cpp @@ -441,12 +441,6 @@ static bool ValidateWorld(Entrance* entrancePlaced) { type = entrancePlaced->GetType(); } - bool checkPoeCollectorAccess = - (ctx->GetOption(RSK_SHUFFLE_OVERWORLD_ENTRANCES) || - ctx->GetOption(RSK_SHUFFLE_INTERIOR_ENTRANCES).Is(RO_INTERIOR_ENTRANCE_SHUFFLE_ALL)) && - (entrancePlaced == nullptr || ctx->GetOption(RSK_MIXED_ENTRANCE_POOLS) || type == EntranceType::Interior || - type == EntranceType::SpecialInterior || type == EntranceType::Overworld || type == EntranceType::Spawn || - type == EntranceType::WarpSong || type == EntranceType::OwlDrop); bool checkOtherEntranceAccess = (ctx->GetOption(RSK_SHUFFLE_OVERWORLD_ENTRANCES) || ctx->GetOption(RSK_SHUFFLE_INTERIOR_ENTRANCES).Is(RO_INTERIOR_ENTRANCE_SHUFFLE_ALL) || @@ -459,7 +453,7 @@ static bool ValidateWorld(Entrance* entrancePlaced) { // Conditions will be checked during the search and any that fail will be figured out // afterwards ctx->GetLogic()->Reset(); - ValidateEntrances(checkPoeCollectorAccess, checkOtherEntranceAccess); + ValidateEntrances(checkOtherEntranceAccess); if (!ctx->GetOption(RSK_DECOUPLED_ENTRANCES)) { // Unless entrances are decoupled, we don't want the player to end up through certain entrances as the wrong age @@ -544,15 +538,6 @@ static bool ValidateWorld(Entrance* entrancePlaced) { } } - // The Big Poe shop should always be accessible as adult without the need to use any bottles - // This is important to ensure that players can never lock their only bottles by filling them with Big Poes they - // can't sell - if (checkPoeCollectorAccess) { - if (!RegionTable(RR_MARKET_GUARD_HOUSE)->Adult()) { - SPDLOG_DEBUG("Big Poe Shop access is not guarenteed as adult\n"); - return false; - } - } SPDLOG_DEBUG("All Locations NOT REACHABLE\n"); return false; } diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index a7b56a6be..5da887494 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -29,6 +29,7 @@ extern "C" { #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" @@ -1079,12 +1080,35 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l *should = false; break; } + case VB_BOTTLE_BIG_POE: { + EnPoField* enPoe = va_arg(args, EnPoField*); + enPoe->actor.textId = 0x5090; + Flags_SetSwitch(gPlayState, enPoe->actor.params & 0xFF); + HIGH_SCORE(HS_POE_POINTS) += 100; + if (HIGH_SCORE(HS_POE_POINTS) > 1100) { + HIGH_SCORE(HS_POE_POINTS) = 1100; + } + *should = false; + break; + } + case VB_SELL_POES_TO_POE_COLLECTOR: { + if (!Flags_GetRandomizerInf(RAND_INF_10_BIG_POES) && HIGH_SCORE(HS_POE_POINTS) >= 1000) { + EnGb* enGb = va_arg(args, EnGb*); + enGb->textId = 0x70F8; + Message_ContinueTextbox(gPlayState, enGb->textId); + enGb->actionFunc = func_80A2FB40; + *should = false; + } + break; + } case VB_GIVE_ITEM_FROM_POE_COLLECTOR: { EnGb* enGb = va_arg(args, EnGb*); if (!Flags_GetRandomizerInf(RAND_INF_10_BIG_POES)) { + Flags_SetInfTable(INFTABLE_SPOKE_TO_POE_COLLECTOR_IN_RUINED_MARKET); Flags_SetRandomizerInf(RAND_INF_10_BIG_POES); + enGb->textId = 0x70F5; enGb->dyna.actor.parent = NULL; - enGb->actionFunc = func_80A2FC0C; + enGb->actionFunc = func_80A2F83C; *should = false; } break; diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index d6efe7b9a..c7e98dca2 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -379,9 +379,6 @@ void RegionTable_Init() { areaTable[RR_ROOT] = Region("Root", "", {RA_LINKS_POCKET}, NO_DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->KakarikoVillageGateOpen, []{return ctx->GetOption(RSK_KAK_GATE).Is(RO_KAK_GATE_OPEN);}), - //The big poes bottle softlock safety check does not account for the guard house lock if the guard house is not shuffled, so the key is needed before we can safely allow bottle use in logic - //RANDOTODO a setting that lets you drink/dump big poes so we don't need this logic - EventAccess(&logic->CouldEmptyBigPoes, []{return !ctx->GetOption(RSK_SHUFFLE_INTERIOR_ENTRANCES).Is(RO_INTERIOR_ENTRANCE_SHUFFLE_OFF) || logic->CanOpenOverworldDoor(RG_GUARD_HOUSE_KEY);}), }, { //Locations LOCATION(RC_LINKS_POCKET, true), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/market.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/market.cpp index a96f5b37a..dc6058832 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/market.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/market.cpp @@ -54,7 +54,7 @@ void RegionTable_Init_Market() { EventAccess(&logic->CanEmptyBigPoes, []{return logic->IsAdult;}), }, { //Locations - LOCATION(RC_MARKET_10_BIG_POES, logic->IsAdult && (logic->BigPoeKill || logic->BigPoes > ctx->GetOption(RSK_BIG_POE_COUNT).Get())), + LOCATION(RC_MARKET_10_BIG_POES, logic->IsAdult && (logic->BigPoeKill || logic->BigPoes >= ctx->GetOption(RSK_BIG_POE_COUNT).Get())), LOCATION(RC_MARKET_GS_GUARD_HOUSE, logic->IsChild), LOCATION(RC_MK_GUARD_HOUSE_CHILD_POT_1, logic->IsChild && logic->CanBreakPots()), LOCATION(RC_MK_GUARD_HOUSE_CHILD_POT_2, logic->IsChild && logic->CanBreakPots()), diff --git a/soh/soh/Enhancements/randomizer/logic.cpp b/soh/soh/Enhancements/randomizer/logic.cpp index 85987f0b6..ca52009ac 100644 --- a/soh/soh/Enhancements/randomizer/logic.cpp +++ b/soh/soh/Enhancements/randomizer/logic.cpp @@ -1011,26 +1011,24 @@ Logic::Logic() { uint8_t Logic::BottleCount() { uint8_t count = 0; - if (CouldEmptyBigPoes && !AreCheckingBigPoes) { - for (int i = SLOT_BOTTLE_1; i <= SLOT_BOTTLE_4; i++) { - uint8_t item = GetSaveContext()->inventory.items[i]; - switch (item) { - case ITEM_LETTER_RUTO: - if (DeliverLetter) { - count++; - } - break; - case ITEM_BIG_POE: - if (CanEmptyBigPoes) { - count++; - } - break; - case ITEM_NONE: - break; - default: + for (int i = SLOT_BOTTLE_1; i <= SLOT_BOTTLE_4; i++) { + uint8_t item = GetSaveContext()->inventory.items[i]; + switch (item) { + case ITEM_LETTER_RUTO: + if (DeliverLetter) { count++; - break; - } + } + break; + case ITEM_BIG_POE: + if (CanEmptyBigPoes) { + count++; + } + break; + case ITEM_NONE: + break; + default: + count++; + break; } } return count; @@ -2407,7 +2405,6 @@ void Logic::Reset() { Bottles = 0; NumBottles = 0; CanEmptyBigPoes = false; - CouldEmptyBigPoes = false; // Drops and Bottle Contents Access NutPot = false; diff --git a/soh/soh/Enhancements/randomizer/logic.h b/soh/soh/Enhancements/randomizer/logic.h index 77c49d25f..19d7e173e 100644 --- a/soh/soh/Enhancements/randomizer/logic.h +++ b/soh/soh/Enhancements/randomizer/logic.h @@ -66,12 +66,6 @@ class Logic { uint8_t NumBottles = 0; // this event covers if the player can currently empty big poes in logic bool CanEmptyBigPoes = false; - // this event covers if the player could, if they filled their bottle with big poes in field, empty them at the poe - // merchant. Works in tandem with the big poes safety check during entrance validation - bool CouldEmptyBigPoes = false; - // this check is used to tell logic that we are checking big poes accessibility in logic, to ensure it's not - // bottle-locked. - bool AreCheckingBigPoes = false; // Drops and Bottle Contents Access bool NutPot = false; diff --git a/soh/soh/Enhancements/randomizer/savefile.cpp b/soh/soh/Enhancements/randomizer/savefile.cpp index aede3484b..884ade150 100644 --- a/soh/soh/Enhancements/randomizer/savefile.cpp +++ b/soh/soh/Enhancements/randomizer/savefile.cpp @@ -334,7 +334,7 @@ extern "C" void Randomizer_InitSaveFile() { Flags_SetRandomizerInf(RAND_INF_TOT_MASTER_SWORD); } - HIGH_SCORE(HS_POE_POINTS) = 1000 - (100 * (Randomizer_GetSettingValue(RSK_BIG_POE_COUNT) + 1)); + HIGH_SCORE(HS_POE_POINTS) = 1000 - (100 * Randomizer_GetSettingValue(RSK_BIG_POE_COUNT)); if (Randomizer_GetSettingValue(RSK_SKIP_EPONA_RACE)) { Flags_SetEventChkInf(EVENTCHKINF_EPONA_OBTAINED); diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp index 8f56c9cb5..7ca0aa82e 100644 --- a/soh/soh/Enhancements/randomizer/settings.cpp +++ b/soh/soh/Enhancements/randomizer/settings.cpp @@ -268,7 +268,7 @@ void Settings::CreateOptions() { OPT_BOOL(RSK_SKIP_CHILD_ZELDA, "Skip Child Zelda", {"Don't Skip", "Skip"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("SkipChildZelda"), mOptionDescriptions[RSK_SKIP_CHILD_ZELDA], WidgetType::Checkbox, RO_GENERIC_DONT_SKIP); OPT_BOOL(RSK_SKIP_EPONA_RACE, "Skip Epona Race", {"Don't Skip", "Skip"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("SkipEponaRace"), mOptionDescriptions[RSK_SKIP_EPONA_RACE], WidgetType::Checkbox, RO_GENERIC_DONT_SKIP); OPT_BOOL(RSK_SKIP_SCARECROWS_SONG, "Skip Scarecrow's Song", CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), mOptionDescriptions[RSK_SKIP_SCARECROWS_SONG]); - OPT_U8(RSK_BIG_POE_COUNT, "Big Poe Target Count", {NumOpts(1, 10)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), mOptionDescriptions[RSK_BIG_POE_COUNT], WidgetType::Slider, 9); + OPT_U8(RSK_BIG_POE_COUNT, "Big Poe Target Count", {NumOpts(0, 10)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), mOptionDescriptions[RSK_BIG_POE_COUNT], WidgetType::Slider, 10); OPT_U8(RSK_CUCCO_COUNT, "Cuccos to return", {NumOpts(0, 7)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("CuccosToReturn"), mOptionDescriptions[RSK_CUCCO_COUNT], WidgetType::Slider, 7); OPT_BOOL(RSK_COMPLETE_MASK_QUEST, "Complete Mask Quest", CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), mOptionDescriptions[RSK_COMPLETE_MASK_QUEST]); OPT_U8(RSK_GOSSIP_STONE_HINTS, "Gossip Stone Hints", {"No Hints", "Need Nothing", "Mask of Truth", "Stone of Agony"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("GossipStoneHints"), mOptionDescriptions[RSK_GOSSIP_STONE_HINTS], WidgetType::Combobox, RO_GOSSIP_STONES_NEED_NOTHING, false, IMFLAG_NONE); diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 88109e923..1d64c31d1 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -2436,6 +2436,9 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, textId, MF_AUTO_FORMAT); } else if (textId == TEXT_MASK_SHOP_SIGN && ctx->GetOption(RSK_MASK_SHOP_HINT)) { messageEntry = ctx->GetHint(RH_MASK_SHOP_HINT)->GetHintMessage(MF_AUTO_FORMAT); + } else if (textId == TEXT_BIG_POE_COLLECTED_RANDO) { + messageEntry = + CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, textId, MF_AUTO_FORMAT); } } if (textId == TEXT_GS_NO_FREEZE || textId == TEXT_GS_FREEZE) { diff --git a/soh/soh/z_message_OTR.cpp b/soh/soh/z_message_OTR.cpp index bcd301627..ea849af05 100644 --- a/soh/soh/z_message_OTR.cpp +++ b/soh/soh/z_message_OTR.cpp @@ -172,4 +172,7 @@ extern "C" void OTRMessage_Init() { CustomMessage("I'm sorry I can't sell you these fine specimens, they need an #experienced owner#.^" "Come back when you have had #Bombchus# of your own.", { QM_RED, QM_GREEN })); + CustomMessageManager::Instance->CreateMessage( + customMessageTableID, TEXT_BIG_POE_COLLECTED_RANDO, + CustomMessage("You have #" + CustomMessage::POINTS("\x01") + "# points.", { QM_RED })); } diff --git a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c index 40239a1e3..372962042 100644 --- a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -288,19 +288,21 @@ void func_80A2F83C(EnGb* this, PlayState* play) { } } if (Actor_ProcessTalkRequest(&this->dyna.actor, play)) { - switch (func_8002F368(play)) { - case EXCH_ITEM_NONE: - func_80A2F180(this); - this->actionFunc = func_80A2F94C; - break; - case EXCH_ITEM_POE: - player->actor.textId = 0x70F6; - this->actionFunc = func_80A2F9C0; - break; - case EXCH_ITEM_BIG_POE: - player->actor.textId = 0x70F7; - this->actionFunc = func_80A2FA50; - break; + if (GameInteractor_Should(VB_SELL_POES_TO_POE_COLLECTOR, true, this)) { + switch (func_8002F368(play)) { + case EXCH_ITEM_NONE: + func_80A2F180(this); + this->actionFunc = func_80A2F94C; + break; + case EXCH_ITEM_POE: + player->actor.textId = 0x70F6; + this->actionFunc = func_80A2F9C0; + break; + case EXCH_ITEM_BIG_POE: + player->actor.textId = 0x70F7; + this->actionFunc = func_80A2FA50; + break; + } } return; } diff --git a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h index 6df73808e..2ff4f64ff 100644 --- a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h +++ b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h @@ -47,6 +47,7 @@ typedef struct EnGb { /* 0x0388 */ EnGbCagedSoul cagedSouls[4]; } EnGb; // size = 0x0438 -void func_80A2FC0C(EnGb* actor, PlayState* play); +void func_80A2FB40(EnGb* actor, PlayState* play); +void func_80A2F83C(EnGb* actor, PlayState* play); #endif diff --git a/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index 4d42cd39a..ac13107cf 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -712,7 +712,7 @@ void EnPoField_SoulInteract(EnPoField* this, PlayState* play) { if (this->actor.params == 0) { Item_Give(play, ITEM_POE); this->actor.textId = 0x5008; - } else { + } else if (GameInteractor_Should(VB_BOTTLE_BIG_POE, true, this)) { this->actor.textId = 0x508F; Item_Give(play, ITEM_BIG_POE); Flags_SetSwitch(play, sEnPoFieldSpawnSwitchFlags[this->spawnFlagIndex]); From ca32dfd2468d4d84bbfd2d88b9cb65c494c8fb41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Fri, 23 May 2025 21:03:20 +0000 Subject: [PATCH 04/13] Dampe Fire (#5521) * No Dampe Fire * spicy * bikeshed --- soh/soh/Enhancements/DampeFire.cpp | 48 +++++++++++++++++++ soh/soh/Enhancements/enhancementTypes.h | 10 ++++ .../vanilla-behavior/GIVanillaBehavior.h | 8 ++++ soh/soh/SohGui/SohMenu.h | 10 ++++ soh/soh/SohGui/SohMenuEnhancements.cpp | 9 ++++ .../actors/ovl_En_Po_Relay/z_en_po_relay.c | 4 +- 6 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 soh/soh/Enhancements/DampeFire.cpp diff --git a/soh/soh/Enhancements/DampeFire.cpp b/soh/soh/Enhancements/DampeFire.cpp new file mode 100644 index 000000000..1378ecb04 --- /dev/null +++ b/soh/soh/Enhancements/DampeFire.cpp @@ -0,0 +1,48 @@ +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ShipInit.hpp" +#include "soh/Enhancements/enhancementTypes.h" + +extern "C" { +extern PlayState* gPlayState; +#include "src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h" +} + +void RegisterDampeFire() { + COND_VB_SHOULD(VB_DAMPE_DROP_FLAME, CVarGetInteger(CVAR_ENHANCEMENT("DampeDropRate"), DAMPE_NORMAL) != DAMPE_NORMAL, + { + double chance; + int cooldown = 9; + switch (CVarGetInteger(CVAR_ENHANCEMENT("DampeDropRate"), DAMPE_NORMAL)) { + case DAMPE_NONE: + *should = false; + return; + default: + case DAMPE_NORMAL: + return; + case DAMPE_JALAPENO: + chance = 0.03; + break; + case DAMPE_CHIPOTLE: + chance = 0.1; + break; + case DAMPE_SCOTCH_BONNET: + chance = 0.2; + break; + case DAMPE_GHOST_PEPPER: + chance = 0.5; + cooldown = 4; + break; + case DAMPE_INFERNO: + *should = true; + return; + } + + EnPoRelay* actor = va_arg(args, EnPoRelay*); + if (actor->actionTimer > cooldown) { + actor->actionTimer = cooldown; + } + *should = actor->actionTimer == 0 && Rand_ZeroOne() < chance; + }); +} + +static RegisterShipInitFunc initFunc(RegisterDampeFire, { CVAR_ENHANCEMENT("DampeDropRate") }); diff --git a/soh/soh/Enhancements/enhancementTypes.h b/soh/soh/Enhancements/enhancementTypes.h index ee3b26d2e..c1b91cffa 100644 --- a/soh/soh/Enhancements/enhancementTypes.h +++ b/soh/soh/Enhancements/enhancementTypes.h @@ -87,6 +87,16 @@ typedef enum { DAMAGE_OHKO } DamageMultType; +typedef enum { + DAMPE_NONE, + DAMPE_NORMAL, + DAMPE_JALAPENO, + DAMPE_CHIPOTLE, + DAMPE_SCOTCH_BONNET, + DAMPE_GHOST_PEPPER, + DAMPE_INFERNO, +} DampeDropRate; + typedef enum { DEKU_STICK_NORMAL, DEKU_STICK_UNBREAKABLE, diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index 4e607a29c..c2b8c1756 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -339,6 +339,14 @@ typedef enum { // - None VB_CRAWL_SPEED_INCREASE, + // #### `result` + // ```c + // this->actionTimer == 0 && Rand_ZeroOne() < 0.03f + // ``` + // #### `args` + // - `*EnPoRelay` + VB_DAMPE_DROP_FLAME, + // #### `result` // ```c // !Flags_GetItemGetInf(ITEMGETINF_1C) diff --git a/soh/soh/SohGui/SohMenu.h b/soh/soh/SohGui/SohMenu.h index 362cc4721..1de142299 100644 --- a/soh/soh/SohGui/SohMenu.h +++ b/soh/soh/SohGui/SohMenu.h @@ -135,6 +135,16 @@ static const std::unordered_map bonkDamageValues = { { BONK_DAMAGE_8_HEARTS, "8 Hearts" }, { BONK_DAMAGE_OHKO, "OHKO" }, }; +static const std::unordered_map dampeDropRates = { + { DAMPE_NONE, "None" }, + { DAMPE_NORMAL, "Vanilla" }, + { DAMPE_JALAPENO, "Jalapeño" }, + { DAMPE_CHIPOTLE, "Serrano" }, + { DAMPE_SCOTCH_BONNET, "Habanero" }, + { DAMPE_GHOST_PEPPER, "Ghost Pepper" }, + { DAMPE_INFERNO, "Dampe's Inferno" }, +}; + static const std::unordered_map cursorAnywhereValues = { { PAUSE_ANY_CURSOR_RANDO_ONLY, "Only in Rando" }, { PAUSE_ANY_CURSOR_ALWAYS_ON, "Always" }, diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index edfb1052f..4785da238 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -1150,6 +1150,12 @@ void SohMenu::AddMenuEnhancements() { .CVar(CVAR_ENHANCEMENT("TreesDropSticks")) .Options(CheckboxOptions().Tooltip( "Bonking into Trees will have a chance to drop up to 3 Sticks. Must have obtained sticks previously.")); + AddWidget(path, "Dampe Drop Rate", WIDGET_CVAR_COMBOBOX) + .CVar(CVAR_ENHANCEMENT("DampeDropRate")) + .Options(ComboboxOptions() + .ComboMap(dampeDropRates) + .DefaultIndex(DAMPE_NORMAL) + .Tooltip("Adjusts rate Dampe drops flames during race.")); AddWidget(path, "Miscellaneous", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Delete File on Death", WIDGET_CVAR_CHECKBOX) @@ -1615,6 +1621,9 @@ void SohMenu::AddMenuEnhancements() { .Options(CheckboxOptions().Tooltip( "Keese and Guay no longer target you and simply ignore you as if you were wearing the " "Skull Mask.")); + AddWidget(path, "No Dampe Fire", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_CHEAT("NoDampeFire")) + .Options(CheckboxOptions().Tooltip("Dampe won't drop fireballs during race.")); AddWidget(path, "Glitch Aids", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Easy Frame Advancing with Pause", WIDGET_CVAR_CHECKBOX) diff --git a/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c index 41ee2d5c6..d850021a4 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c +++ b/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c @@ -8,6 +8,8 @@ #include "overlays/actors/ovl_En_Honotrap/z_en_honotrap.h" #include "objects/object_tk/object_tk.h" #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -197,7 +199,7 @@ void EnPoRelay_Race(EnPoRelay* this, PlayState* play) { if (this->actionTimer != 0) { this->actionTimer--; } - if (this->actionTimer == 0 && Rand_ZeroOne() < 0.03f) { + if (GameInteractor_Should(VB_DAMPE_DROP_FLAME, this->actionTimer == 0 && Rand_ZeroOne() < 0.03f, this)) { this->actionTimer = 32; if (this->pathIndex < 23) { speed = Rand_ZeroOne() * 3.0f; From ae480e107ef09aa316678c4f323fcd6306feb84a Mon Sep 17 00:00:00 2001 From: Malkierian Date: Fri, 23 May 2025 14:03:30 -0700 Subject: [PATCH 05/13] Implement Log Level selector setting (#5263) * Implement Log Level selector setting. * run clang * Enum for default value. * PR feedback: use CVAR_DEVELOPER_TOOLS in CVar builder. * Slight change to try to force a PR update. * screw you clang --- soh/soh/OTRGlobals.cpp | 4 ++++ soh/soh/SohGui/SohMenuDevTools.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 1d64c31d1..a2135006a 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -332,6 +332,10 @@ OTRGlobals::OTRGlobals() { context->InitCrashHandler(); context->InitConsole(); + Ship::Context::GetInstance()->GetLogger()->set_level( + (spdlog::level::level_enum)CVarGetInteger(CVAR_DEVELOPER_TOOLS("LogLevel"), 1)); + Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v"); + auto sohInputEditorWindow = std::make_shared(CVAR_WINDOW("ControllerConfiguration"), "Configure Controller"); auto sohFast3dWindow = diff --git a/soh/soh/SohGui/SohMenuDevTools.cpp b/soh/soh/SohGui/SohMenuDevTools.cpp index 91d456c95..6a5c292eb 100644 --- a/soh/soh/SohGui/SohMenuDevTools.cpp +++ b/soh/soh/SohGui/SohMenuDevTools.cpp @@ -87,6 +87,17 @@ void SohMenu::AddMenuDevTools() { } }) .SameLine(true); + AddWidget(path, "Log Level", WIDGET_CVAR_COMBOBOX) + .CVar(CVAR_DEVELOPER_TOOLS("LogLevel")) + .Options(ComboboxOptions() + .Tooltip("The log level determines which messages are printed to the console." + " This does not affect the log file output") + .ComboMap(logLevels)) + .Callback([](WidgetInfo& info) { + Ship::Context::GetInstance()->GetLogger()->set_level( + (spdlog::level::level_enum)CVarGetInteger(CVAR_DEVELOPER_TOOLS("LogLevel"), DEBUG_LOG_DEBUG)); + }) + .PreFunc([](WidgetInfo& info) { info.isHidden = mSohMenu->disabledMap.at(DISABLE_FOR_DEBUG_MODE_OFF).active; }); // Stats path.sidebarName = "Stats"; From d8acc32876dee20908854532332884a13ffc191d Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Fri, 23 May 2025 17:04:20 -0400 Subject: [PATCH 06/13] Move Daytime Gold Skulltulas mod hook to its own file (#5174) * Move Daytime Gold Skulltulas mod hook to its own file * Fix externs? * Rename initFunc --- soh/soh/Enhancements/QoL/DaytimeGS.cpp | 70 ++++++++++++++++++++++++++ soh/soh/Enhancements/mods.cpp | 60 ---------------------- 2 files changed, 70 insertions(+), 60 deletions(-) create mode 100644 soh/soh/Enhancements/QoL/DaytimeGS.cpp diff --git a/soh/soh/Enhancements/QoL/DaytimeGS.cpp b/soh/soh/Enhancements/QoL/DaytimeGS.cpp new file mode 100644 index 000000000..869945cb5 --- /dev/null +++ b/soh/soh/Enhancements/QoL/DaytimeGS.cpp @@ -0,0 +1,70 @@ +#include +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ShipInit.hpp" +#include "functions.h" +#include "macros.h" + +extern "C" { +extern PlayState* gPlayState; +extern SaveContext gSaveContext; +} + +static constexpr int32_t CVAR_DAYTIME_GS_DEFAULT = 0; +#define CVAR_DAYTIME_GS_NAME CVAR_ENHANCEMENT("NightGSAlwaysSpawn") +#define CVAR_DAYTIME_GS_VALUE CVarGetInteger(CVAR_DAYTIME_GS_NAME, CVAR_DAYTIME_GS_DEFAULT) + +struct DayTimeGoldSkulltulas { + uint16_t scene; + uint16_t room; + bool forChild; + std::vector actorEntries; +}; + +using DayTimeGoldSkulltulasList = std::vector; + +void OnSpawnNighttimeGoldSkulltula() { + // Gold Skulltulas that are not part of the scene actor list during the day + // Actor values copied from the night time scene actor list + static const DayTimeGoldSkulltulasList dayTimeGoldSkulltulas = { + // Graveyard + { SCENE_GRAVEYARD, 1, true, { { ACTOR_EN_SW, { 156, 315, 795 }, { 16384, -32768, 0 }, -20096 } } }, + // ZF + { SCENE_ZORAS_FOUNTAIN, 0, true, { { ACTOR_EN_SW, { -1891, 187, 1911 }, { 16384, 18022, 0 }, -19964 } } }, + // GF + { SCENE_GERUDOS_FORTRESS, 0, false, { { ACTOR_EN_SW, { 1598, 999, -2008 }, { 16384, -16384, 0 }, -19198 } } }, + { SCENE_GERUDOS_FORTRESS, 1, false, { { ACTOR_EN_SW, { 3377, 1734, -4935 }, { 16384, 0, 0 }, -19199 } } }, + // Kak + { SCENE_KAKARIKO_VILLAGE, 0, false, { { ACTOR_EN_SW, { -18, 540, 1800 }, { 0, -32768, 0 }, -20160 } } }, + { SCENE_KAKARIKO_VILLAGE, + 0, + true, + { { ACTOR_EN_SW, { -465, 377, -888 }, { 0, 28217, 0 }, -20222 }, + { ACTOR_EN_SW, { 5, 686, -171 }, { 0, -32768, 0 }, -20220 }, + { ACTOR_EN_SW, { 324, 270, 905 }, { 16384, 0, 0 }, -20216 }, + { ACTOR_EN_SW, { -602, 120, 1120 }, { 16384, 0, 0 }, -20208 } } }, + // LLR + { SCENE_LON_LON_RANCH, + 0, + true, + { { ACTOR_EN_SW, { -2344, 180, 672 }, { 16384, 22938, 0 }, -29695 }, + { ACTOR_EN_SW, { 808, 48, 326 }, { 16384, 0, 0 }, -29694 }, + { ACTOR_EN_SW, { 997, 286, -2698 }, { 16384, -16384, 0 }, -29692 } } }, + }; + + for (const auto& dayTimeGS : dayTimeGoldSkulltulas) { + if (IS_DAY && dayTimeGS.forChild == LINK_IS_CHILD && dayTimeGS.scene == gPlayState->sceneNum && + dayTimeGS.room == gPlayState->roomCtx.curRoom.num) { + for (const auto& actorEntry : dayTimeGS.actorEntries) { + Actor_Spawn(&gPlayState->actorCtx, gPlayState, actorEntry.id, actorEntry.pos.x, actorEntry.pos.y, + actorEntry.pos.z, actorEntry.rot.x, actorEntry.rot.y, actorEntry.rot.z, actorEntry.params, + false); + } + } + } +} + +void RegisterDaytimeGoldSkultullas() { + COND_HOOK(OnSceneSpawnActors, CVAR_DAYTIME_GS_VALUE, OnSpawnNighttimeGoldSkulltula); +} + +static RegisterShipInitFunc initFunc_DaytimeGoldSkulltulas(RegisterDaytimeGoldSkultullas, { CVAR_DAYTIME_GS_NAME }); diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index a183680a8..f57e13c01 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -243,65 +243,6 @@ void RegisterDeleteFileOnDeath() { }); } -struct DayTimeGoldSkulltulas { - uint16_t scene; - uint16_t room; - bool forChild; - std::vector actorEntries; -}; - -using DayTimeGoldSkulltulasList = std::vector; - -void RegisterDaytimeGoldSkultullas() { - GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger(CVAR_ENHANCEMENT("NightGSAlwaysSpawn"), 0)) { - return; - } - - // Gold Skulltulas that are not part of the scene actor list during the day - // Actor values copied from the night time scene actor list - static const DayTimeGoldSkulltulasList dayTimeGoldSkulltulas = { - // Graveyard - { SCENE_GRAVEYARD, 1, true, { { ACTOR_EN_SW, { 156, 315, 795 }, { 16384, -32768, 0 }, -20096 } } }, - // ZF - { SCENE_ZORAS_FOUNTAIN, 0, true, { { ACTOR_EN_SW, { -1891, 187, 1911 }, { 16384, 18022, 0 }, -19964 } } }, - // GF - { SCENE_GERUDOS_FORTRESS, - 0, - false, - { { ACTOR_EN_SW, { 1598, 999, -2008 }, { 16384, -16384, 0 }, -19198 } } }, - { SCENE_GERUDOS_FORTRESS, 1, false, { { ACTOR_EN_SW, { 3377, 1734, -4935 }, { 16384, 0, 0 }, -19199 } } }, - // Kak - { SCENE_KAKARIKO_VILLAGE, 0, false, { { ACTOR_EN_SW, { -18, 540, 1800 }, { 0, -32768, 0 }, -20160 } } }, - { SCENE_KAKARIKO_VILLAGE, - 0, - true, - { { ACTOR_EN_SW, { -465, 377, -888 }, { 0, 28217, 0 }, -20222 }, - { ACTOR_EN_SW, { 5, 686, -171 }, { 0, -32768, 0 }, -20220 }, - { ACTOR_EN_SW, { 324, 270, 905 }, { 16384, 0, 0 }, -20216 }, - { ACTOR_EN_SW, { -602, 120, 1120 }, { 16384, 0, 0 }, -20208 } } }, - // LLR - { SCENE_LON_LON_RANCH, - 0, - true, - { { ACTOR_EN_SW, { -2344, 180, 672 }, { 16384, 22938, 0 }, -29695 }, - { ACTOR_EN_SW, { 808, 48, 326 }, { 16384, 0, 0 }, -29694 }, - { ACTOR_EN_SW, { 997, 286, -2698 }, { 16384, -16384, 0 }, -29692 } } }, - }; - - for (const auto& dayTimeGS : dayTimeGoldSkulltulas) { - if (IS_DAY && dayTimeGS.forChild == LINK_IS_CHILD && dayTimeGS.scene == gPlayState->sceneNum && - dayTimeGS.room == gPlayState->roomCtx.curRoom.num) { - for (const auto& actorEntry : dayTimeGS.actorEntries) { - Actor_Spawn(&gPlayState->actorCtx, gPlayState, actorEntry.id, actorEntry.pos.x, actorEntry.pos.y, - actorEntry.pos.z, actorEntry.rot.x, actorEntry.rot.y, actorEntry.rot.z, - actorEntry.params, false); - } - } - } - }); -} - bool IsHyperBossesActive() { return CVarGetInteger(CVAR_ENHANCEMENT("HyperBosses"), 0) || (IS_BOSS_RUSH && @@ -1073,7 +1014,6 @@ void InitMods() { TimeSavers_Register(); RegisterTTS(); RegisterOcarinaTimeTravel(); - RegisterDaytimeGoldSkultullas(); RegisterRupeeDash(); RegisterShadowTag(); RegisterPermanentHeartLoss(); From db8440e744d043533c13fc8d6e83cddcd6a0deae Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Fri, 23 May 2025 17:04:43 -0400 Subject: [PATCH 07/13] Move Shadow Tag Mode hook to its own file (#5179) * Move Shadow Tag Mode hook to its own file * Rename initFunc --- soh/soh/Enhancements/ExtraModes/ShadowTag.cpp | 50 +++++++++++++++++++ soh/soh/Enhancements/mods.cpp | 33 ------------ 2 files changed, 50 insertions(+), 33 deletions(-) create mode 100644 soh/soh/Enhancements/ExtraModes/ShadowTag.cpp diff --git a/soh/soh/Enhancements/ExtraModes/ShadowTag.cpp b/soh/soh/Enhancements/ExtraModes/ShadowTag.cpp new file mode 100644 index 000000000..dc85534c8 --- /dev/null +++ b/soh/soh/Enhancements/ExtraModes/ShadowTag.cpp @@ -0,0 +1,50 @@ +#include +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ShipInit.hpp" +#include "functions.h" + +extern "C" PlayState* gPlayState; + +static constexpr int32_t CVAR_SHADOW_TAG_DEFAULT = 0; +#define CVAR_SHADOW_TAG_NAME CVAR_ENHANCEMENT("ShadowTag") +#define CVAR_SHADOW_TAG_VALUE CVarGetInteger(CVAR_SHADOW_TAG_NAME, CVAR_SHADOW_TAG_DEFAULT) + +static bool shouldSpawn = false; +static uint16_t delayTimer = 60; + +static constexpr s8 ROOM_GREEN_POE = 16; +static constexpr s8 ROOM_BLUE_POE = 13; +static constexpr s8 ROOM_RED_POE = 12; + +void OnPlayerUpdateShadowTag() { + if (gPlayState->sceneNum == SCENE_FOREST_TEMPLE) { + switch (gPlayState->roomCtx.curRoom.num) { + case ROOM_GREEN_POE: + case ROOM_BLUE_POE: + case ROOM_RED_POE: + return; + default: + break; + } + } + + if (shouldSpawn && (delayTimer <= 0)) { + Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_WALLMAS, 0, 0, 0, 0, 0, 0, 3, false); + shouldSpawn = false; + } else { + delayTimer--; + } +} + +void ResetShadowTagSpawnTimer() { + shouldSpawn = true; + delayTimer = 60; +} + +void RegisterShadowTag() { + COND_HOOK(OnPlayerUpdate, CVAR_SHADOW_TAG_VALUE, OnPlayerUpdateShadowTag); + COND_HOOK(OnSceneSpawnActors, true, []() { ResetShadowTagSpawnTimer(); }); + COND_HOOK(OnSceneInit, true, [](int16_t) { ResetShadowTagSpawnTimer(); }); +} + +static RegisterShipInitFunc initFunc_ShadowTag(RegisterShadowTag, { CVAR_SHADOW_TAG_NAME }); diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index f57e13c01..2e302ea1d 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -159,38 +159,6 @@ void RegisterRupeeDash() { }); } -void RegisterShadowTag() { - static bool shouldSpawn = false; - static uint16_t delayTimer = 60; - - GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger(CVAR_ENHANCEMENT("ShadowTag"), 0)) { - return; - } - if (gPlayState->sceneNum == SCENE_FOREST_TEMPLE && // Forest Temple Scene - gPlayState->roomCtx.curRoom.num == 16 || // Green Poe Room - gPlayState->roomCtx.curRoom.num == 13 || // Blue Poe Room - gPlayState->roomCtx.curRoom.num == 12) { // Red Poe Room - return; - } else { - if (shouldSpawn && (delayTimer <= 0)) { - Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_WALLMAS, 0, 0, 0, 0, 0, 0, 3, false); - shouldSpawn = false; - } else { - delayTimer--; - } - } - }); - GameInteractor::Instance->RegisterGameHook([]() { - shouldSpawn = true; - delayTimer = 60; - }); - GameInteractor::Instance->RegisterGameHook([](int16_t sceneNum) { - shouldSpawn = true; - delayTimer = 60; - }); -} - static bool hasAffectedHealth = false; void UpdatePermanentHeartLossState() { if (!GameInteractor::IsSaveLoaded()) @@ -1015,7 +983,6 @@ void InitMods() { RegisterTTS(); RegisterOcarinaTimeTravel(); RegisterRupeeDash(); - RegisterShadowTag(); RegisterPermanentHeartLoss(); RegisterDeleteFileOnDeath(); RegisterHyperBosses(); From e4448f491eaaf62ecc0aeb49611312e25dded1e2 Mon Sep 17 00:00:00 2001 From: Rozelette Date: Fri, 23 May 2025 16:05:33 -0500 Subject: [PATCH 08/13] Add ObjectExtension system (#5429) --- soh/soh/Enhancements/debugger/actorViewer.cpp | 2 + soh/soh/ObjectExtension/ActorListIndex.cpp | 16 +++ soh/soh/ObjectExtension/ActorListIndex.h | 16 +++ soh/soh/ObjectExtension/ObjectExtension.cpp | 25 ++++ soh/soh/ObjectExtension/ObjectExtension.h | 116 ++++++++++++++++++ soh/src/code/z_actor.c | 16 ++- 6 files changed, 190 insertions(+), 1 deletion(-) create mode 100644 soh/soh/ObjectExtension/ActorListIndex.cpp create mode 100644 soh/soh/ObjectExtension/ActorListIndex.h create mode 100644 soh/soh/ObjectExtension/ObjectExtension.cpp create mode 100644 soh/soh/ObjectExtension/ObjectExtension.h diff --git a/soh/soh/Enhancements/debugger/actorViewer.cpp b/soh/soh/Enhancements/debugger/actorViewer.cpp index 2e94e1391..ae4e498b5 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.cpp +++ b/soh/soh/Enhancements/debugger/actorViewer.cpp @@ -17,6 +17,7 @@ #include #include "soh/OTRGlobals.h" #include "soh/cvar_prefixes.h" +#include "soh/ObjectExtension/ActorListIndex.h" extern "C" { #include @@ -998,6 +999,7 @@ void ActorViewerWindow::DrawElement() { ImGui::Text("Category: %s", acMapping[display->category]); ImGui::Text("ID: %d", display->id); ImGui::Text("Parameters: %d", display->params); + ImGui::Text("Actor List Index: %d", GetActorListIndex(display)); }, "Selected Actor"); ImGui::SameLine(); diff --git a/soh/soh/ObjectExtension/ActorListIndex.cpp b/soh/soh/ObjectExtension/ActorListIndex.cpp new file mode 100644 index 000000000..5c9367703 --- /dev/null +++ b/soh/soh/ObjectExtension/ActorListIndex.cpp @@ -0,0 +1,16 @@ +#include "ActorListIndex.h" +#include "soh/ObjectExtension/ObjectExtension.h" + +struct ActorListIndex { + s16 index = -1; +}; +static ObjectExtension::Register ActorListIndexRegister; + +int16_t GetActorListIndex(const Actor* actor) { + const ActorListIndex* index = ObjectExtension::GetInstance().Get(actor); + return index != nullptr ? index->index : ActorListIndex{}.index; +} + +void SetActorListIndex(const Actor* actor, int16_t index) { + ObjectExtension::GetInstance().Set(actor, ActorListIndex{ index }); +} \ No newline at end of file diff --git a/soh/soh/ObjectExtension/ActorListIndex.h b/soh/soh/ObjectExtension/ActorListIndex.h new file mode 100644 index 000000000..84f00449d --- /dev/null +++ b/soh/soh/ObjectExtension/ActorListIndex.h @@ -0,0 +1,16 @@ +#ifndef ACTOR_LIST_INDEX_H +#define ACTOR_LIST_INDEX_H + +#ifdef __cplusplus +extern "C" { +#include "z64actor.h" +#endif + +int16_t GetActorListIndex(const Actor* actor); +void SetActorListIndex(const Actor* actor, int16_t index); + +#ifdef __cplusplus +} +#endif + +#endif // ACTOR_LIST_INDEX_H \ No newline at end of file diff --git a/soh/soh/ObjectExtension/ObjectExtension.cpp b/soh/soh/ObjectExtension/ObjectExtension.cpp new file mode 100644 index 000000000..3b8f6f8bf --- /dev/null +++ b/soh/soh/ObjectExtension/ObjectExtension.cpp @@ -0,0 +1,25 @@ +#include "ObjectExtension.h" + +ObjectExtension& ObjectExtension::GetInstance() { + static ObjectExtension instance; + return instance; +} + +ObjectExtension::Id ObjectExtension::RegisterId() { + return NextId++; +} + +void ObjectExtension::Free(const void* object) { + if (object == nullptr) { + return; + } + + std::erase_if(Data, [&object](const auto& iter) { + auto const& [key, value] = iter; + return key.first == object; + }); +} + +extern "C" void ObjectExtension_Free(const void* object) { + ObjectExtension::GetInstance().Free(object); +} diff --git a/soh/soh/ObjectExtension/ObjectExtension.h b/soh/soh/ObjectExtension/ObjectExtension.h new file mode 100644 index 000000000..d59edffd0 --- /dev/null +++ b/soh/soh/ObjectExtension/ObjectExtension.h @@ -0,0 +1,116 @@ +#pragma once + +#ifdef __cplusplus + +#include + +#include +#include +#include +#include +#include + +/* + * This class can attach additional data to pointers. It can only attach a single instance of each type of data. + * Use the ObjectExtension::Register class to register a type to be used as an object extension. + * An example usage is: + * + * struct MyData { + * s32 data = -1; + * }; + * static ObjectExtension::Register MyDataRegister; + * + * Then you can get with + * ObjectExtension::GetInstance().Get(ptr); + * and set with + * ObjectExtension::GetInstance().Set(ptr, MyData{}); + * (or with the returned pointer from Get()). + */ +class ObjectExtension { + public: + using Id = uint32_t; + + static constexpr Id InvalidId = std::numeric_limits::max(); + + // Registers type T to be used as an object extension + template class Register { + public: + Register() { + Id = ObjectExtension::GetInstance().RegisterId(); + } + + static ObjectExtension::Id Id; + }; + + // Gets the singleton ObjectExtension instance + static ObjectExtension& GetInstance(); + + // Gets the data of type T associated with an object, or nullptr if no such data has been attached + template T* Get(const void* object) { + assert(ObjectExtension::Register::Id != InvalidId); + if (object == nullptr) { + return nullptr; + } + + auto it = Data.find(std::make_pair(object, ObjectExtension::Register::Id)); + if (it == Data.end()) { + return nullptr; + } + + return std::any_cast(&(it->second)); + } + + // Sets the data of type T for an object. Data will be copied. + template void Set(const void* object, const T&& data) { + assert(ObjectExtension::Register::Id != InvalidId); + if (object != nullptr) { + Data[std::make_pair(object, ObjectExtension::Register::Id)] = data; + } + } + + // Returns true if an object has data of type T associated with it + template bool Has(const void* object) { + assert(ObjectExtension::Register::Id != InvalidId); + if (object == nullptr) { + return false; + } + + return Data.contains(std::make_pair(object, ObjectExtension::Register::Id)); + } + + // Removes data of type T from an object + template void Remove(const void* object) { + assert(ObjectExtension::Register::Id != InvalidId); + + Data.erase(std::make_pair(object, ObjectExtension::Register::Id)); + } + + // Removes all data from an object + void Free(const void* object); + + private: + ObjectExtension() = default; + + // Returns the next free object extension Id + Id RegisterId(); + + ObjectExtension::Id NextId = 0; + + struct KeyHash { + std::size_t operator()(const std::pair& key) const { + return std::hash{}(key.first) ^ (std::hash{}(key.second) << 1); + } + }; + + // Collection of all object extension data. + std::unordered_map, std::any, KeyHash> Data; +}; + +// Static template globals +template ObjectExtension::Id ObjectExtension::Register::Id = ObjectExtension::InvalidId; + +#else // __cplusplus + +void ObjectExtension_Free(const void* object); + +#endif // __cplusplus diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index ac9e4f3f6..b70408d8f 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -7,6 +7,8 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "objects/object_bdoor/object_bdoor.h" +#include "soh/ObjectExtension/ObjectExtension.h" +#include "soh/ObjectExtension/ActorListIndex.h" #include "soh/frame_interpolation.h" #include "soh/Enhancements/cosmetics/cosmeticsTypes.h" #include "soh/Enhancements/enemyrandomizer.h" @@ -2574,7 +2576,11 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { if (play->numSetupActors != 0) { actorEntry = &play->setupActorList[0]; for (i = 0; i < play->numSetupActors; i++) { - Actor_SpawnEntry(&play->actorCtx, actorEntry++, play); + Actor* spawnedActor = Actor_SpawnEntry(&play->actorCtx, actorEntry++, play); + + // #region SOH [ObjectExtension] ActorListIndex tracking + SetActorListIndex(spawnedActor, (s16)i); + // #endregion } play->numSetupActors = 0; GameInteractor_ExecuteOnSceneSpawnActors(); @@ -3352,6 +3358,10 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos return NULL; } + // #region SOH [ObjectExtension] + SetActorListIndex(actor, -1); + // #endregion + assert(dbEntry->numLoaded < 255); dbEntry->numLoaded++; @@ -3497,6 +3507,10 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { newHead = Actor_RemoveFromCategory(play, actorCtx, actor); + // #region SOH [ObjectExtension] + ObjectExtension_Free(actor); + // #endregion + ZELDA_ARENA_FREE_DEBUG(actor); dbEntry->numLoaded--; From 150029fa49de2aa6d891b93917e9e635543c03ca Mon Sep 17 00:00:00 2001 From: nclok1405 <155463060+nclok1405@users.noreply.github.com> Date: Sat, 24 May 2025 06:05:59 +0900 Subject: [PATCH 09/13] =?UTF-8?q?Set=20default=20player=20name=20to=20"?= =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=82=AF"=20("Link"=20in=20Katakana)=20when?= =?UTF-8?q?=20playing=20in=20Japanese=20(#5487)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soh/soh/SaveManager.cpp | 12 ++++++++++ .../ovl_file_choose/z_file_choose.c | 22 +++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 97ab6a52a..0b0421fbe 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -922,6 +922,12 @@ void SaveManager::InitFileDebug() { gSaveContext.playerName[i] = sPlayerName[i]; } gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_PAL; + } else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese + const static std::array sPlayerName = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; + for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) { + gSaveContext.playerName[i] = sPlayerName[i]; + } + gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_NTSC_JPN; } else { // GAME_REGION_NTSC const static std::array sPlayerName = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) { @@ -1037,6 +1043,12 @@ void SaveManager::InitFileMaxed() { gSaveContext.playerName[i] = sPlayerName[i]; } gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_PAL; + } else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese + const static std::array sPlayerName = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; + for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) { + gSaveContext.playerName[i] = sPlayerName[i]; + } + gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_NTSC_JPN; } else { // GAME_REGION_NTSC const static std::array sPlayerName = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) { 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 6dae312ac..78b167442 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 @@ -1086,10 +1086,6 @@ static s16 sLastFileChooseButtonIndex; * Update function for `CM_MAIN_MENU` */ void FileChoose_UpdateMainMenu(GameState* thisx) { - static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E }; - static u8 emptyNameNES[] = { 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; - static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E }; - static u8 linkNameNES[] = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); @@ -1300,6 +1296,7 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) { static u8 emptyNameNES[] = { 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E }; static u8 linkNameNES[] = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; + static u8 linkNameJP[] = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; FileChoose_UpdateStickDirectionPromptAnim(thisx); FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; @@ -1369,6 +1366,14 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) { this->nameEntryBoxAlpha = 0; if (ResourceMgr_GetGameRegion(0) == GAME_REGION_PAL && gSaveContext.language != LANGUAGE_JPN) { defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkName : &emptyName; + } else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese + if (CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) != 0) { + // Set player name to "リンク" ("Link" in Katakana, 3 characters long) when playing in Japanese. + defaultName = &linkNameJP; + this->newFileNameCharCount = 3; + } else { + defaultName = &emptyNameNES; + } } else { // GAME_REGION_NTSC defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkNameNES : &emptyNameNES; } @@ -1544,6 +1549,7 @@ void FileChoose_UpdateRandomizerMenu(GameState* thisx) { static u8 emptyNameNES[] = { 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E }; static u8 linkNameNES[] = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; + static u8 linkNameJP[] = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; u8* defaultName; this->prevConfigMode = this->configMode; @@ -1561,6 +1567,14 @@ void FileChoose_UpdateRandomizerMenu(GameState* thisx) { this->nameEntryBoxAlpha = 0; if (ResourceMgr_GetGameRegion(0) == GAME_REGION_PAL && gSaveContext.language != LANGUAGE_JPN) { defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkName : &emptyName; + } else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese + if (CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) != 0) { + // Set player name to "リンク" ("Link" in Katakana, 3 characters long) when playing in Japanese. + defaultName = &linkNameJP; + this->newFileNameCharCount = 3; + } else { + defaultName = &emptyNameNES; + } } else { // GAME_REGION_NTSC defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkNameNES : &emptyNameNES; } From a2541fded8638494177661835e615d76391cfbd5 Mon Sep 17 00:00:00 2001 From: Rozelette Date: Fri, 23 May 2025 16:06:19 -0500 Subject: [PATCH 10/13] Exclude build dependencies from clang format (#5490) --- run-clang-format.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-clang-format.ps1 b/run-clang-format.ps1 index 39905f9ed..063cec7af 100644 --- a/run-clang-format.ps1 +++ b/run-clang-format.ps1 @@ -39,7 +39,7 @@ $files = Get-ChildItem -Path $basePath\soh -Recurse -File ` | Where-Object { ($_.Extension -eq '.c' -or $_.Extension -eq '.cpp' -or ` (($_.Extension -eq '.h' -or $_.Extension -eq '.hpp') -and ` (-not ($_.FullName -like "*\soh\src\*" -or $_.FullName -like "*\soh\include\*")))) -and ` - (-not ($_.FullName -like "*\soh\assets\*")) } + (-not ($_.FullName -like "*\soh\assets\*" -or $_.FullName -like "*\soh\build\*")) } for ($i = 0; $i -lt $files.Length; $i++) { $file = $files[$i] From 3a069e621eed36a3c9fd801e87567f4fb13b1c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Fri, 23 May 2025 21:21:25 +0000 Subject: [PATCH 11/13] Fix warnings (#5516) * use size_t instead of uint8_t for hint ids * va_arg int instead of s16 warning: second argument to 'va_arg' is of promotable type 's16' (aka 'short'); this va_arg has undefined behavior because arguments will be promoted to 'int' [-Wvarargs] * more issues like #5443 --- .../Enhancements/TimeSavers/CrawlSpeed.cpp | 6 +++--- .../Enhancements/randomizer/3drando/hints.cpp | 14 ++++++------- .../Enhancements/randomizer/3drando/hints.hpp | 10 ++++----- soh/soh/Enhancements/randomizer/hint.cpp | 21 +++++++++---------- soh/soh/Enhancements/randomizer/hint.h | 6 +++--- soh/soh/config/ConfigUpdaters.h | 6 +++--- soh/soh/resource/importer/AnimationFactory.h | 2 +- soh/soh/resource/importer/ArrayFactory.h | 2 +- .../resource/importer/AudioSampleFactory.h | 2 +- .../importer/AudioSequenceFactory.cpp | 6 +++--- .../resource/importer/AudioSequenceFactory.h | 2 +- .../resource/importer/AudioSoundFontFactory.h | 2 +- soh/soh/resource/importer/BackgroundFactory.h | 2 +- .../importer/CollisionHeaderFactory.h | 4 ++-- soh/soh/resource/importer/CutsceneFactory.h | 2 +- soh/soh/resource/importer/PathFactory.h | 4 ++-- .../importer/PlayerAnimationFactory.h | 2 +- soh/soh/resource/importer/SceneFactory.h | 4 ++-- soh/soh/resource/importer/SkeletonFactory.cpp | 2 +- soh/soh/resource/importer/SkeletonFactory.h | 4 ++-- .../resource/importer/SkeletonLimbFactory.h | 4 ++-- soh/soh/resource/importer/TextFactory.h | 4 ++-- .../importer/scenecommand/EndMarkerFactory.h | 4 ++-- .../scenecommand/SetActorListFactory.h | 4 ++-- .../scenecommand/SetAlternateHeadersFactory.h | 4 ++-- .../scenecommand/SetCameraSettingsFactory.h | 4 ++-- .../scenecommand/SetCollisionHeaderFactory.h | 4 ++-- .../scenecommand/SetCsCameraFactory.h | 4 ++-- .../scenecommand/SetCutscenesFactory.h | 4 ++-- .../scenecommand/SetEchoSettingsFactory.h | 4 ++-- .../scenecommand/SetEntranceListFactory.h | 4 ++-- .../scenecommand/SetExitListFactory.h | 4 ++-- .../scenecommand/SetLightListFactory.h | 4 ++-- .../scenecommand/SetLightingSettingsFactory.h | 4 ++-- .../importer/scenecommand/SetMeshFactory.h | 4 ++-- .../scenecommand/SetObjectListFactory.h | 4 ++-- .../scenecommand/SetPathwaysFactory.h | 4 ++-- .../scenecommand/SetRoomBehaviorFactory.h | 4 ++-- .../scenecommand/SetRoomListFactory.h | 4 ++-- .../scenecommand/SetSkyboxModifierFactory.h | 4 ++-- .../scenecommand/SetSkyboxSettingsFactory.h | 4 ++-- .../scenecommand/SetSoundSettingsFactory.h | 4 ++-- .../scenecommand/SetSpecialObjectsFactory.h | 4 ++-- .../SetStartPositionListFactory.h | 4 ++-- .../scenecommand/SetTimeSettingsFactory.h | 4 ++-- .../SetTransitionActorListFactory.h | 4 ++-- .../scenecommand/SetWindSettingsFactory.h | 4 ++-- .../resource/type/scenecommand/SetLightList.h | 2 +- .../type/scenecommand/SetLightingSettings.h | 2 +- 49 files changed, 107 insertions(+), 108 deletions(-) diff --git a/soh/soh/Enhancements/TimeSavers/CrawlSpeed.cpp b/soh/soh/Enhancements/TimeSavers/CrawlSpeed.cpp index b9f65df04..896f07973 100644 --- a/soh/soh/Enhancements/TimeSavers/CrawlSpeed.cpp +++ b/soh/soh/Enhancements/TimeSavers/CrawlSpeed.cpp @@ -77,9 +77,9 @@ void CrawlSpeed_Register() { COND_VB_SHOULD(VB_CRAWL_SPEED_EXIT_CS, shouldRegister, { Player* player = GET_PLAYER(gPlayState); Camera* csCam = va_arg(args, Camera*); - s16 csId = va_arg(args, s16); - s16 actionParameters = va_arg(args, s16); - s16 initTimer = va_arg(args, s16); + s16 csId = static_cast(va_arg(args, int)); + s16 actionParameters = static_cast(va_arg(args, int)); + s16 initTimer = static_cast(va_arg(args, int)); CutsceneCameraPoint* atPoints = va_arg(args, CutsceneCameraPoint*); CutsceneCameraPoint* eyePoints = va_arg(args, CutsceneCameraPoint*); bool excludeWellBackroom = (player->actor.world.pos.x > 950.0f) && (player->actor.world.pos.x < 1025.0f) && diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.cpp b/soh/soh/Enhancements/randomizer/3drando/hints.cpp index 394f6636d..65cc6eb8c 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.cpp @@ -40,7 +40,7 @@ const CustomMessage& HintText::GetObscure() const { return obscureText.size() > 0 ? RandomElement(obscureText) : clearText; } -const CustomMessage& HintText::GetObscure(uint8_t selection) const { +const CustomMessage& HintText::GetObscure(size_t selection) const { if (obscureText.size() > selection) { return obscureText[selection]; } else if (obscureText.size() > 0) { @@ -53,7 +53,7 @@ const CustomMessage& HintText::GetAmbiguous() const { return ambiguousText.size() > 0 ? RandomElement(ambiguousText) : clearText; } -const CustomMessage& HintText::GetAmbiguous(uint8_t selection) const { +const CustomMessage& HintText::GetAmbiguous(size_t selection) const { if (ambiguousText.size() > selection) { return ambiguousText[selection]; } else if (ambiguousText.size() > 0) { @@ -62,15 +62,15 @@ const CustomMessage& HintText::GetAmbiguous(uint8_t selection) const { return clearText; } -uint8_t HintText::GetAmbiguousSize() const { - return static_cast(ambiguousText.size()); +size_t HintText::GetAmbiguousSize() const { + return ambiguousText.size(); } -uint8_t HintText::GetObscureSize() const { - return static_cast(obscureText.size()); +size_t HintText::GetObscureSize() const { + return obscureText.size(); } -const CustomMessage& HintText::GetHintMessage(uint8_t selection) const { +const CustomMessage& HintText::GetHintMessage(size_t selection) const { auto ctx = Rando::Context::GetInstance(); if (ctx->GetOption(RSK_HINT_CLARITY).Is(RO_HINT_CLARITY_OBSCURE)) { return GetObscure(selection); diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.hpp b/soh/soh/Enhancements/randomizer/3drando/hints.hpp index 48566f47e..365904274 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.hpp @@ -37,12 +37,12 @@ class HintText { std::vector obscureText_ = {}); const CustomMessage& GetClear() const; const CustomMessage& GetObscure() const; - const CustomMessage& GetObscure(uint8_t selection) const; + const CustomMessage& GetObscure(size_t selection) const; const CustomMessage& GetAmbiguous() const; - const CustomMessage& GetAmbiguous(uint8_t selection) const; - uint8_t GetAmbiguousSize() const; - uint8_t GetObscureSize() const; - const CustomMessage& GetHintMessage(uint8_t selection = 0) const; + const CustomMessage& GetAmbiguous(size_t selection) const; + size_t GetAmbiguousSize() const; + size_t GetObscureSize() const; + const CustomMessage& GetHintMessage(size_t selection = 0) const; const CustomMessage GetMessageCopy() const; bool operator==(const HintText& right) const; bool operator!=(const HintText& right) const; diff --git a/soh/soh/Enhancements/randomizer/hint.cpp b/soh/soh/Enhancements/randomizer/hint.cpp index 3b1cb23f4..4c3de9770 100644 --- a/soh/soh/Enhancements/randomizer/hint.cpp +++ b/soh/soh/Enhancements/randomizer/hint.cpp @@ -174,8 +174,8 @@ void Hint::NamesChosen() { auto ctx = Rando::Context::GetInstance(); std::vector namesTemp = {}; bool saveNames = false; - uint8_t numMessages = GetNumberOfMessages(); - for (uint8_t c = 0; c < numMessages; c++) { + size_t numMessages = GetNumberOfMessages(); + for (size_t c = 0; c < numMessages; c++) { uint8_t selection = GetRandomHintTextEntry(GetHintText(c)); if (selection > 0) { saveNames = true; @@ -187,7 +187,7 @@ void Hint::NamesChosen() { } if (hintType == HINT_TYPE_ITEM || hintType == HINT_TYPE_ITEM_AREA) { - for (uint8_t c = 0; c < locations.size(); c++) { + for (size_t c = 0; c < locations.size(); c++) { namesTemp = {}; saveNames = false; uint8_t selection = GetRandomHintTextEntry(GetItemHintText(c)); @@ -218,7 +218,7 @@ void Hint::NamesChosen() { } } -uint8_t Hint::GetNumberOfMessages() const { +size_t Hint::GetNumberOfMessages() const { size_t numMessages = std::max(messages.size(), hintKeys.size()); if (StaticData::staticHintInfoMap.contains(ownKey)) { numMessages = std::max(StaticData::staticHintInfoMap[ownKey].hintKeys.size(), numMessages); @@ -226,20 +226,19 @@ uint8_t Hint::GetNumberOfMessages() const { if (numMessages == 0) { numMessages = 1; // RANDOTODO make std::max actually fucking work for 3 arguments } - // RANDOTODO will number of messages always be u8? - return static_cast(numMessages); + return numMessages; } const std::vector Hint::GetAllMessageStrings(MessageFormat format) const { std::vector hintMessages = {}; - uint8_t numMessages = GetNumberOfMessages(); - for (int c = 0; c < numMessages; c++) { + size_t numMessages = GetNumberOfMessages(); + for (size_t c = 0; c < numMessages; c++) { hintMessages.push_back(GetHintMessage(format, c).GetForCurrentLanguage(format)); } return hintMessages; } -const HintText Hint::GetHintText(uint8_t id) const { +const HintText Hint::GetHintText(size_t id) const { auto ctx = Rando::Context::GetInstance(); if (hintKeys.size() > id) { return StaticData::hintTextTable[hintKeys[id]]; @@ -284,11 +283,11 @@ const HintText Hint::GetHintText(uint8_t id) const { } } -const CustomMessage Hint::GetHintMessage(MessageFormat format, uint8_t id) const { +const CustomMessage Hint::GetHintMessage(MessageFormat format, size_t id) const { auto ctx = Rando::Context::GetInstance(); CustomMessage hintText = CustomMessage(""); - uint8_t chosenMessage = 0; + size_t chosenMessage = 0; if (hintTextsChosen.size() > id) { chosenMessage = id; } diff --git a/soh/soh/Enhancements/randomizer/hint.h b/soh/soh/Enhancements/randomizer/hint.h index e0e595395..7ff46a104 100644 --- a/soh/soh/Enhancements/randomizer/hint.h +++ b/soh/soh/Enhancements/randomizer/hint.h @@ -23,10 +23,10 @@ class Hint { void FillGapsInData(); void SetLocationsAsHinted() const; void NamesChosen(); - uint8_t GetNumberOfMessages() const; + size_t GetNumberOfMessages() const; const std::vector GetAllMessageStrings(MessageFormat format = MF_AUTO_FORMAT) const; - const CustomMessage GetHintMessage(MessageFormat format = MF_AUTO_FORMAT, uint8_t id = 0) const; - const HintText GetHintText(uint8_t id = 0) const; + const CustomMessage GetHintMessage(MessageFormat format = MF_AUTO_FORMAT, size_t id = 0) const; + const HintText GetHintText(size_t id = 0) const; oJson toJSON(); void logHint(oJson& jsonData); const HintText GetItemHintText(uint8_t slot, bool mysterious = false) const; diff --git a/soh/soh/config/ConfigUpdaters.h b/soh/soh/config/ConfigUpdaters.h index 6ba0bb98e..7912be7de 100644 --- a/soh/soh/config/ConfigUpdaters.h +++ b/soh/soh/config/ConfigUpdaters.h @@ -1,19 +1,19 @@ #include "libultraship/libultraship.h" namespace SOH { -class ConfigVersion1Updater : public Ship::ConfigVersionUpdater { +class ConfigVersion1Updater final : public Ship::ConfigVersionUpdater { public: ConfigVersion1Updater(); void Update(Ship::Config* conf); }; -class ConfigVersion2Updater : public Ship::ConfigVersionUpdater { +class ConfigVersion2Updater final : public Ship::ConfigVersionUpdater { public: ConfigVersion2Updater(); void Update(Ship::Config* conf); }; -class ConfigVersion3Updater : public Ship::ConfigVersionUpdater { +class ConfigVersion3Updater final : public Ship::ConfigVersionUpdater { public: ConfigVersion3Updater(); void Update(Ship::Config* conf); diff --git a/soh/soh/resource/importer/AnimationFactory.h b/soh/soh/resource/importer/AnimationFactory.h index edeaf9749..2312d7ad3 100644 --- a/soh/soh/resource/importer/AnimationFactory.h +++ b/soh/soh/resource/importer/AnimationFactory.h @@ -4,7 +4,7 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryAnimationV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryAnimationV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/ArrayFactory.h b/soh/soh/resource/importer/ArrayFactory.h index 49978ff69..a64b7a821 100644 --- a/soh/soh/resource/importer/ArrayFactory.h +++ b/soh/soh/resource/importer/ArrayFactory.h @@ -4,7 +4,7 @@ #include "resource/ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryArrayV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryArrayV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/AudioSampleFactory.h b/soh/soh/resource/importer/AudioSampleFactory.h index 028c8fe3d..43b028fd2 100644 --- a/soh/soh/resource/importer/AudioSampleFactory.h +++ b/soh/soh/resource/importer/AudioSampleFactory.h @@ -4,7 +4,7 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryAudioSampleV2 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryAudioSampleV2 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/AudioSequenceFactory.cpp b/soh/soh/resource/importer/AudioSequenceFactory.cpp index 1423c5c3b..4a4a06265 100644 --- a/soh/soh/resource/importer/AudioSequenceFactory.cpp +++ b/soh/soh/resource/importer/AudioSequenceFactory.cpp @@ -15,7 +15,7 @@ ResourceFactoryBinaryAudioSequenceV2::ReadResource(std::shared_ptr f audioSequence->sequence.seqDataSize = reader->ReadInt32(); audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize); - for (uint32_t i = 0; i < audioSequence->sequence.seqDataSize; i++) { + for (int32_t i = 0; i < audioSequence->sequence.seqDataSize; i++) { audioSequence->sequenceData.push_back(reader->ReadChar()); } audioSequence->sequence.seqData = audioSequence->sequenceData.data(); @@ -25,10 +25,10 @@ ResourceFactoryBinaryAudioSequenceV2::ReadResource(std::shared_ptr f audioSequence->sequence.cachePolicy = reader->ReadUByte(); audioSequence->sequence.numFonts = reader->ReadUInt32(); - for (uint32_t i = 0; i < 16; i++) { + for (int32_t i = 0; i < 16; i++) { audioSequence->sequence.fonts[i] = 0; } - for (uint32_t i = 0; i < audioSequence->sequence.numFonts; i++) { + for (int32_t i = 0; i < audioSequence->sequence.numFonts; i++) { audioSequence->sequence.fonts[i] = reader->ReadUByte(); } diff --git a/soh/soh/resource/importer/AudioSequenceFactory.h b/soh/soh/resource/importer/AudioSequenceFactory.h index 138f22099..5ae4ed946 100644 --- a/soh/soh/resource/importer/AudioSequenceFactory.h +++ b/soh/soh/resource/importer/AudioSequenceFactory.h @@ -4,7 +4,7 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryAudioSequenceV2 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryAudioSequenceV2 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/AudioSoundFontFactory.h b/soh/soh/resource/importer/AudioSoundFontFactory.h index 6ea5b2a78..b978a14bf 100644 --- a/soh/soh/resource/importer/AudioSoundFontFactory.h +++ b/soh/soh/resource/importer/AudioSoundFontFactory.h @@ -4,7 +4,7 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryAudioSoundFontV2 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryAudioSoundFontV2 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/BackgroundFactory.h b/soh/soh/resource/importer/BackgroundFactory.h index 0e6c3fcdf..e9a47a952 100644 --- a/soh/soh/resource/importer/BackgroundFactory.h +++ b/soh/soh/resource/importer/BackgroundFactory.h @@ -4,7 +4,7 @@ #include "resource/ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryBackgroundV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryBackgroundV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/CollisionHeaderFactory.h b/soh/soh/resource/importer/CollisionHeaderFactory.h index f72a0a89b..4db21d351 100644 --- a/soh/soh/resource/importer/CollisionHeaderFactory.h +++ b/soh/soh/resource/importer/CollisionHeaderFactory.h @@ -5,13 +5,13 @@ #include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinaryCollisionHeaderV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryCollisionHeaderV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; }; -class ResourceFactoryXMLCollisionHeaderV0 : public Ship::ResourceFactoryXML { +class ResourceFactoryXMLCollisionHeaderV0 final : public Ship::ResourceFactoryXML { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/CutsceneFactory.h b/soh/soh/resource/importer/CutsceneFactory.h index 0be1e6721..95a6f379e 100644 --- a/soh/soh/resource/importer/CutsceneFactory.h +++ b/soh/soh/resource/importer/CutsceneFactory.h @@ -4,7 +4,7 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryCutsceneV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryCutsceneV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/PathFactory.h b/soh/soh/resource/importer/PathFactory.h index 4fe530e10..f94a201c5 100644 --- a/soh/soh/resource/importer/PathFactory.h +++ b/soh/soh/resource/importer/PathFactory.h @@ -5,13 +5,13 @@ #include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinaryPathV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryPathV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; }; -class ResourceFactoryXMLPathV0 : public Ship::ResourceFactoryXML { +class ResourceFactoryXMLPathV0 final : public Ship::ResourceFactoryXML { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/PlayerAnimationFactory.h b/soh/soh/resource/importer/PlayerAnimationFactory.h index 0487e608f..7761c63b6 100644 --- a/soh/soh/resource/importer/PlayerAnimationFactory.h +++ b/soh/soh/resource/importer/PlayerAnimationFactory.h @@ -4,7 +4,7 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryPlayerAnimationV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryPlayerAnimationV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/SceneFactory.h b/soh/soh/resource/importer/SceneFactory.h index 53e676093..a22291d51 100644 --- a/soh/soh/resource/importer/SceneFactory.h +++ b/soh/soh/resource/importer/SceneFactory.h @@ -8,7 +8,7 @@ #include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinarySceneV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinarySceneV0 final : public Ship::ResourceFactoryBinary { public: ResourceFactoryBinarySceneV0(); @@ -28,7 +28,7 @@ class ResourceFactoryBinarySceneV0 : public Ship::ResourceFactoryBinary { std::shared_ptr reader, uint32_t index); }; -class ResourceFactoryXMLSceneV0 : public Ship::ResourceFactoryXML { +class ResourceFactoryXMLSceneV0 final : public Ship::ResourceFactoryXML { public: ResourceFactoryXMLSceneV0(); diff --git a/soh/soh/resource/importer/SkeletonFactory.cpp b/soh/soh/resource/importer/SkeletonFactory.cpp index 56338cd03..f81476523 100644 --- a/soh/soh/resource/importer/SkeletonFactory.cpp +++ b/soh/soh/resource/importer/SkeletonFactory.cpp @@ -23,7 +23,7 @@ ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr file, skeleton->limbTableCount = reader->ReadUInt32(); skeleton->limbTable.reserve(skeleton->limbTableCount); - for (uint32_t i = 0; i < skeleton->limbTableCount; i++) { + for (int32_t i = 0; i < skeleton->limbTableCount; i++) { std::string limbPath = reader->ReadString(); skeleton->limbTable.push_back(limbPath); diff --git a/soh/soh/resource/importer/SkeletonFactory.h b/soh/soh/resource/importer/SkeletonFactory.h index 610681529..b7c90443f 100644 --- a/soh/soh/resource/importer/SkeletonFactory.h +++ b/soh/soh/resource/importer/SkeletonFactory.h @@ -5,13 +5,13 @@ #include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinarySkeletonV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinarySkeletonV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; }; -class ResourceFactoryXMLSkeletonV0 : public Ship::ResourceFactoryXML { +class ResourceFactoryXMLSkeletonV0 final : public Ship::ResourceFactoryXML { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/SkeletonLimbFactory.h b/soh/soh/resource/importer/SkeletonLimbFactory.h index 5c3430fb3..bcf1fd4d5 100644 --- a/soh/soh/resource/importer/SkeletonLimbFactory.h +++ b/soh/soh/resource/importer/SkeletonLimbFactory.h @@ -5,13 +5,13 @@ #include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinarySkeletonLimbV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinarySkeletonLimbV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; }; -class ResourceFactoryXMLSkeletonLimbV0 : public Ship::ResourceFactoryXML { +class ResourceFactoryXMLSkeletonLimbV0 final : public Ship::ResourceFactoryXML { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/TextFactory.h b/soh/soh/resource/importer/TextFactory.h index a00757285..b67f07cbb 100644 --- a/soh/soh/resource/importer/TextFactory.h +++ b/soh/soh/resource/importer/TextFactory.h @@ -5,13 +5,13 @@ #include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinaryTextV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryTextV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; }; -class ResourceFactoryXMLTextV0 : public Ship::ResourceFactoryXML { +class ResourceFactoryXMLTextV0 final : public Ship::ResourceFactoryXML { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h index a8f336896..3ffc956a6 100644 --- a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h +++ b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class EndMarkerFactory : public SceneCommandFactoryBinaryV0 { +class EndMarkerFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class EndMarkerFactoryXML : public SceneCommandFactoryXMLV0 { +class EndMarkerFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetActorListFactory.h b/soh/soh/resource/importer/scenecommand/SetActorListFactory.h index 8d22cb146..febc5d2b8 100644 --- a/soh/soh/resource/importer/scenecommand/SetActorListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetActorListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetActorListFactory : public SceneCommandFactoryBinaryV0 { +class SetActorListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetActorListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetActorListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h index e299ceca3..477843603 100644 --- a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetAlternateHeadersFactory : public SceneCommandFactoryBinaryV0 { +class SetAlternateHeadersFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetAlternateHeadersFactoryXML : public SceneCommandFactoryXMLV0 { +class SetAlternateHeadersFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h index 19d6a9e00..d25e8b447 100644 --- a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetCameraSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetCameraSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetCameraSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetCameraSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h index 74628cfb7..da7626701 100644 --- a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetCollisionHeaderFactory : public SceneCommandFactoryBinaryV0 { +class SetCollisionHeaderFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetCollisionHeaderFactoryXML : public SceneCommandFactoryXMLV0 { +class SetCollisionHeaderFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h index aef0564fb..239713d44 100644 --- a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetCsCameraFactory : public SceneCommandFactoryBinaryV0 { +class SetCsCameraFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetCsCameraFactoryXML : public SceneCommandFactoryXMLV0 { +class SetCsCameraFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h index 72d430e06..5db5824fc 100644 --- a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetCutscenesFactory : public SceneCommandFactoryBinaryV0 { +class SetCutscenesFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetCutscenesFactoryXML : public SceneCommandFactoryXMLV0 { +class SetCutscenesFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h index 583bb2ce0..1ce2ff52d 100644 --- a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetEchoSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetEchoSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetEchoSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetEchoSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h index 86187ca5e..e6949f924 100644 --- a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetEntranceListFactory : public SceneCommandFactoryBinaryV0 { +class SetEntranceListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetEntranceListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetEntranceListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetExitListFactory.h b/soh/soh/resource/importer/scenecommand/SetExitListFactory.h index 4e8fb1fbd..3e5da585a 100644 --- a/soh/soh/resource/importer/scenecommand/SetExitListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetExitListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetExitListFactory : public SceneCommandFactoryBinaryV0 { +class SetExitListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetExitListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetExitListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetLightListFactory.h b/soh/soh/resource/importer/scenecommand/SetLightListFactory.h index 38eed91be..1cc5c5758 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetLightListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetLightListFactory : public SceneCommandFactoryBinaryV0 { +class SetLightListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetLightListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetLightListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h index 153f7743d..eeb3024b9 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetLightingSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetLightingSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetLightingSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetLightingSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetMeshFactory.h b/soh/soh/resource/importer/scenecommand/SetMeshFactory.h index b26b07775..82430d5b5 100644 --- a/soh/soh/resource/importer/scenecommand/SetMeshFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetMeshFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetMeshFactory : public SceneCommandFactoryBinaryV0 { +class SetMeshFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetMeshFactoryXML : public SceneCommandFactoryXMLV0 { +class SetMeshFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h index d89eee6aa..3b060dd61 100644 --- a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetObjectListFactory : public SceneCommandFactoryBinaryV0 { +class SetObjectListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetObjectListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetObjectListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h index ec2e20f9b..7c49e34a9 100644 --- a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetPathwaysFactory : public SceneCommandFactoryBinaryV0 { +class SetPathwaysFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetPathwaysFactoryXML : public SceneCommandFactoryXMLV0 { +class SetPathwaysFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h index 7cfe6845a..080adb2b5 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetRoomBehaviorFactory : public SceneCommandFactoryBinaryV0 { +class SetRoomBehaviorFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetRoomBehaviorFactoryXML : public SceneCommandFactoryXMLV0 { +class SetRoomBehaviorFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h index 54fd88cc9..310a42a3b 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetRoomListFactory : public SceneCommandFactoryBinaryV0 { +class SetRoomListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetRoomListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetRoomListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h index e05a016fc..def84cf59 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetSkyboxModifierFactory : public SceneCommandFactoryBinaryV0 { +class SetSkyboxModifierFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetSkyboxModifierFactoryXML : public SceneCommandFactoryXMLV0 { +class SetSkyboxModifierFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h index ec0e7aca5..74e48da15 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetSkyboxSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetSkyboxSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetSkyboxSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetSkyboxSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h index 8cac78994..f6e04a3af 100644 --- a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetSoundSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetSoundSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetSoundSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetSoundSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h index 648a76ab0..b3be7e3a5 100644 --- a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetSpecialObjectsFactory : public SceneCommandFactoryBinaryV0 { +class SetSpecialObjectsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetSpecialObjectsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetSpecialObjectsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h index 228a24f05..2e71e43e2 100644 --- a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetStartPositionListFactory : public SceneCommandFactoryBinaryV0 { +class SetStartPositionListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetStartPositionListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetStartPositionListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h index 1818c345f..cb886776c 100644 --- a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetTimeSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetTimeSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetTimeSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetTimeSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h index 344e60990..f4763b021 100644 --- a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetTransitionActorListFactory : public SceneCommandFactoryBinaryV0 { +class SetTransitionActorListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetTransitionActorListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetTransitionActorListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h index c9ad2d3d6..bc60ca2d8 100644 --- a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetWindSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetWindSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetWindSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetWindSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/type/scenecommand/SetLightList.h b/soh/soh/resource/type/scenecommand/SetLightList.h index f9ec925ef..d79a73aec 100644 --- a/soh/soh/resource/type/scenecommand/SetLightList.h +++ b/soh/soh/resource/type/scenecommand/SetLightList.h @@ -35,7 +35,7 @@ typedef struct { /* 0x2 */ LightParams params; } LightInfo; // size = 0xE -class SetLightList : public SceneCommand { +class SetLightList final : public SceneCommand { public: using SceneCommand::SceneCommand; diff --git a/soh/soh/resource/type/scenecommand/SetLightingSettings.h b/soh/soh/resource/type/scenecommand/SetLightingSettings.h index c4059d259..cb2089517 100644 --- a/soh/soh/resource/type/scenecommand/SetLightingSettings.h +++ b/soh/soh/resource/type/scenecommand/SetLightingSettings.h @@ -19,7 +19,7 @@ typedef struct { /* 0x14 */ s16 fogFar; } EnvLightSettings; // size = 0x16 -class SetLightingSettings : public SceneCommand { +class SetLightingSettings final : public SceneCommand { public: using SceneCommand::SceneCommand; From 99c3fa600672c656dc39d2eb5efaff1b7ff8041c Mon Sep 17 00:00:00 2001 From: Malkierian Date: Fri, 23 May 2025 14:57:49 -0700 Subject: [PATCH 12/13] Preset Manager (#5459) * Add presets sidebar, proof of concept row-based listing. * Complete and unify section check/x drawing. * Add error state to InputString, and corresponding members and builders to InputOptions. Implement saving and loading of preset files. * Implement `Config::SetBlock()`. Implement Apply. Implement Delete. Some json structure changes. * Apply `CVarClear()` calls in CVar-prefixed widget functions. * Comment out satellite preset pickers for now. * clang * Fix ButtonOptions initializer list. * I hate clang... * Loop new preset checkbox creation. Restore auto-resizing to new preset popup. Remove errant BeginDisabled in randomizer (merge artifact?). * Add BlockInfo struct to make array with all info for each block. Setup loops for all other same-ish situations (applying presets, setting up columns, etc) based on blockInfo. * Save tracker windows info for later restoration. Lay the groundwork for said restoration. * Complete tracker window restoration on preset application. * Fix RadioButtonsOptions builder parameter type. Add race lockout to new and apply buttons. * Revert application of CVarClear on UIWidgets widgets (need to preserve manually-set default states). * Remove enhancements satellite picker. Swap randomizer satellite picker to use the manager presets, only displays presets with randomizer section included. Move built-in presets to the asset archive, and remove delete button on them. Remove PresetEntries.cpp. * Fix locations and tricks tabs not updating live when applying preset with new system. * Apply RandoGenerating lockout to rando preset Apply button. * Fix new presets not being properly filtered in satellite selectors. * Fix currently selected presets getting deleted still being selected in satellite selectors. * Change BigPoeTargetCount in preset files to 1. --- soh/assets/custom/presets/Main Default.json | 11 + soh/assets/custom/presets/Main Enhanced.json | 56 ++ .../custom/presets/Main Randomizer.json | 135 ++++ soh/assets/custom/presets/Main Vanilla+.json | 56 ++ soh/assets/custom/presets/Rando Advanced.json | 69 ++ soh/assets/custom/presets/Rando Beginner.json | 51 ++ soh/assets/custom/presets/Rando Default.json | 9 + .../custom/presets/Rando Hell Mode.json | 80 +++ soh/assets/custom/presets/Rando Standard.json | 63 ++ .../Enhancements/Presets/PresetEntries.cpp | 650 ------------------ soh/soh/Enhancements/Presets/Presets.cpp | 470 +++++++++++-- soh/soh/Enhancements/Presets/Presets.h | 62 +- .../Enhancements/randomizer/randomizer.cpp | 72 +- .../randomizer/randomizer_check_tracker.cpp | 18 +- .../randomizer/randomizer_check_tracker.h | 1 + .../randomizer_entrance_tracker.cpp | 18 +- .../randomizer/randomizer_entrance_tracker.h | 1 + .../randomizer/randomizer_item_tracker.cpp | 26 +- .../randomizer/randomizer_item_tracker.h | 17 + .../randomizer/randomizer_settings_window.h | 1 + soh/soh/SohGui/SohMenu.h | 7 - soh/soh/SohGui/SohMenuEnhancements.cpp | 67 +- soh/soh/SohGui/SohMenuNetwork.cpp | 1 + soh/soh/SohGui/SohMenuRandomizer.cpp | 2 +- soh/soh/SohGui/SohMenuSettings.cpp | 1 + soh/soh/SohGui/UIWidgets.cpp | 28 +- soh/soh/SohGui/UIWidgets.hpp | 31 +- 27 files changed, 1114 insertions(+), 889 deletions(-) create mode 100644 soh/assets/custom/presets/Main Default.json create mode 100644 soh/assets/custom/presets/Main Enhanced.json create mode 100644 soh/assets/custom/presets/Main Randomizer.json create mode 100644 soh/assets/custom/presets/Main Vanilla+.json create mode 100644 soh/assets/custom/presets/Rando Advanced.json create mode 100644 soh/assets/custom/presets/Rando Beginner.json create mode 100644 soh/assets/custom/presets/Rando Default.json create mode 100644 soh/assets/custom/presets/Rando Hell Mode.json create mode 100644 soh/assets/custom/presets/Rando Standard.json delete mode 100644 soh/soh/Enhancements/Presets/PresetEntries.cpp diff --git a/soh/assets/custom/presets/Main Default.json b/soh/assets/custom/presets/Main Default.json new file mode 100644 index 000000000..7d87c3d95 --- /dev/null +++ b/soh/assets/custom/presets/Main Default.json @@ -0,0 +1,11 @@ +{ + "blocks": { + "enhancements": { + "gCheats": null, + "gEnhancements": null, + "gRandoEnhancements": null + } + }, + "presetName": "Main Default", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Main Enhanced.json b/soh/assets/custom/presets/Main Enhanced.json new file mode 100644 index 000000000..026a78de7 --- /dev/null +++ b/soh/assets/custom/presets/Main Enhanced.json @@ -0,0 +1,56 @@ +{ + "blocks": { + "enhancements": { + "gCheats": null, + "gEnhancements": { + "AssignableTunicsAndBoots": 1, + "Autosave": 1, + "BetterOwl": 1, + "CreditsFix": 1, + "CustomizeFrogsOcarinaGame": 1, + "DekuNutUpgradeFix": 1, + "DisableLOD": 1, + "DpadEquips": 1, + "DpadNoDropOcarinaInput": 1, + "DynamicWalletIcon": 1, + "EnemySpawnsOverWaterboxes": 1, + "FasterRupeeAccumulator": 1, + "FixBrokenGiantsKnife": 1, + "FixDaruniaDanceSpeed": 1, + "FixDungeonMinimapIcon": 1, + "FixEyesOpenWhileSleeping": 1, + "FixFloorSwitches": 1, + "FixHammerHand": 1, + "FixMenuLR": 1, + "FixSawSoftlock": 1, + "FixTexturesOOB": 1, + "FixVineFall": 1, + "FixZoraHintDialogue": 1, + "FrogsModifyFailTime": 2, + "GerudoWarriorClothingFix": 1, + "GravediggingTourFix": 1, + "InjectItemCounts": { + "GoldSkulltula": 1, + "HeartContainer": 1, + "HeartPiece": 1 + }, + "NaviTextFix": 1, + "PulsateBossIcon": 1, + "RedGanonBlood": 1, + "RememberMapToggleState": 1, + "SceneSpecificDirtPathFix": 1, + "SilverRupeeJingleExtend": 1, + "SkipSaveConfirmation": 1, + "SkipText": 1, + "TextSpeed": 5, + "TimeFlowFileSelect": 1, + "TwoHandedIdle": 1, + "VisualAgony": 1, + "WidescreenActorCulling": 1 + }, + "gRandoEnhancements": null + } + }, + "presetName": "Main Enhanced", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Main Randomizer.json b/soh/assets/custom/presets/Main Randomizer.json new file mode 100644 index 000000000..59c24e982 --- /dev/null +++ b/soh/assets/custom/presets/Main Randomizer.json @@ -0,0 +1,135 @@ +{ + "blocks": { + "enhancements": { + "gCheats": { + "EasyFrameAdvance": 1 + }, + "gEnhancements": { + "AdultMasks": 1, + "AssignableTunicsAndBoots": 1, + "Autosave": 1, + "BetterAmmoRendering": 1, + "BetterBombchuShopping": 1, + "BetterFarore": 1, + "BetterOwl": 1, + "BombchusOOB": 1, + "ClimbSpeed": 3, + "CrawlSpeed": 2, + "CreditsFix": 1, + "CustomizeFishing": 1, + "CustomizeFrogsOcarinaGame": 1, + "CustomizeOcarinaGame": 1, + "DampeAllNight": 1, + "DampeWin": 1, + "DayGravePull": 1, + "DekuNutUpgradeFix": 1, + "DisableCritWiggle": 1, + "DisableFirstPersonChus": 1, + "DisableLOD": 1, + "DpadEquips": 1, + "DpadNoDropOcarinaInput": 1, + "DynamicWalletIcon": 1, + "EarlyEyeballFrog": 1, + "EnemySpawnsOverWaterboxes": 1, + "EquipmentCanBeRemoved": 1, + "ExtendedCullingExcludeGlitchActors": 1, + "FastBoomerang": 1, + "FastChests": 1, + "FastDrops": 1, + "FastFarores": 1, + "FastOcarinaPlayback": 1, + "FasterBlockPush": 5, + "FasterHeavyBlockLift": 1, + "FasterRupeeAccumulator": 1, + "FileSelectMoreInfo": 1, + "FishNeverEscape": 1, + "FixBrokenGiantsKnife": 1, + "FixDaruniaDanceSpeed": 1, + "FixDungeonMinimapIcon": 1, + "FixFloorSwitches": 1, + "FixHammerHand": 1, + "FixMenuLR": 1, + "FixSawSoftlock": 1, + "FixTexturesOOB": 1, + "FixVineFall": 1, + "FixZoraHintDialogue": 1, + "ForgeTime": 0, + "FrogsModifyFailTime": 2, + "GerudoWarriorClothingFix": 1, + "GoronPot": 1, + "GravediggingTourFix": 1, + "GuaranteeFishingBite": 1, + "HoverFishing": 1, + "IncludeHeldInputsBufferWindow": 1, + "InjectItemCounts": { + "GoldSkulltula": 1, + "HeartContainer": 1, + "HeartPiece": 1 + }, + "InstantPutaway": 1, + "InstantScarecrow": 1, + "MMBunnyHood": 1, + "MarketSneak": 1, + "MaskSelect": 1, + "MinimumFishWeightAdult": 6, + "MinimumFishWeightChild": 3, + "MweepSpeed": 5.0, + "N64WeirdFrames": 1, + "NaviTextFix": 1, + "NewDrops": 1, + "NoInputForCredits": 1, + "NutsExplodeBombs": 1, + "OcarinaGame": { + "StartingNotes": 5 + }, + "PauseMenuAnimatedLink": 1, + "PauseWarp": 1, + "PersistentMasks": 1, + "PulsateBossIcon": 1, + "QuickBongoKill": 1, + "QuickPutaway": 1, + "QuitFishingAtDoor": 1, + "RedGanonBlood": 1, + "RememberMapToggleState": 1, + "SceneSpecificDirtPathFix": 1, + "SeparateArrows": 1, + "ShowDoorLocksOnBothSides": 1, + "SilverRupeeJingleExtend": 1, + "SkipArrowAnimation": 1, + "SkipSaveConfirmation": 1, + "SkipSwimDeepEndAnim": 1, + "SkipText": 1, + "SlowTextSpeed": 5, + "SwordToggle": 1, + "TextSpeed": 5, + "TimeFlowFileSelect": 1, + "TimeSavers": { + "DisableTitleCard": 1, + "SkipChildStealth": 1, + "SkipCutscene": { + "BossIntro": 1, + "Entrances": 1, + "Intro": 1, + "LearnSong": 1, + "OnePoint": 1, + "QuickBossDeaths": 1, + "Story": 1 + }, + "SkipForcedDialog": 3, + "SkipMiscInteractions": 1, + "SkipOwlInteractions": 1, + "SkipTowerEscape": 1, + "SleepingWaterfall": 1 + }, + "ToTMedallionsColors": 1, + "ToggleStrength": 1, + "TwoHandedIdle": 1, + "VisualAgony": 1, + "WidescreenActorCulling": 1 + }, + "gRandoEnhancements": null + } + }, + "presetName": "Main Randomizer", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Main Vanilla+.json b/soh/assets/custom/presets/Main Vanilla+.json new file mode 100644 index 000000000..0f6c1741a --- /dev/null +++ b/soh/assets/custom/presets/Main Vanilla+.json @@ -0,0 +1,56 @@ +{ + "blocks": { + "enhancements": { + "gCheats": null, + "gEnhancements": { + "AssignableTunicsAndBoots": 1, + "Autosave": 1, + "BetterOwl": 1, + "CreditsFix": 1, + "CustomizeFrogsOcarinaGame": 1, + "DekuNutUpgradeFix": 1, + "DisableLOD": 1, + "DpadEquips": 1, + "DpadNoDropOcarinaInput": 1, + "DynamicWalletIcon": 1, + "EnemySpawnsOverWaterboxes": 1, + "FasterRupeeAccumulator": 1, + "FixBrokenGiantsKnife": 1, + "FixDaruniaDanceSpeed": 1, + "FixDungeonMinimapIcon": 1, + "FixEyesOpenWhileSleeping": 1, + "FixFloorSwitches": 1, + "FixHammerHand": 1, + "FixMenuLR": 1, + "FixSawSoftlock": 1, + "FixTexturesOOB": 1, + "FixVineFall": 1, + "FixZoraHintDialogue": 1, + "FrogsModifyFailTime": 2, + "GerudoWarriorClothingFix": 1, + "GravediggingTourFix": 1, + "InjectItemCounts": { + "GoldSkulltula": 1, + "HeartContainer": 1, + "HeartPiece": 1 + }, + "NaviTextFix": 1, + "PulsateBossIcon": 1, + "RedGanonBlood": 1, + "RememberMapToggleState": 1, + "SceneSpecificDirtPathFix": 1, + "SilverRupeeJingleExtend": 1, + "SkipSaveConfirmation": 1, + "SkipText": 1, + "TextSpeed": 5, + "TimeFlowFileSelect": 1, + "TwoHandedIdle": 1, + "VisualAgony": 1, + "WidescreenActorCulling": 1 + }, + "gRandoEnhancements": null + } + }, + "presetName": "Main Vanilla+", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Advanced.json b/soh/assets/custom/presets/Rando Advanced.json new file mode 100644 index 000000000..4042c0688 --- /dev/null +++ b/soh/assets/custom/presets/Rando Advanced.json @@ -0,0 +1,69 @@ +{ + "blocks": { + "rando": { + "gRandoSettings": { + "40GSHint": 1, + "50GSHint": 1, + "BigPoeTargetCount": 1, + "BlueFireArrows": 1, + "BombchuBag": 1, + "BossKeysanity": 5, + "ClosedForest": 2, + "CompleteMaskQuest": 1, + "CuccosToReturn": 1, + "DampeHint": 1, + "DoorOfTime": 2, + "EnableBombchuDrops": 1, + "FortressCarpenters": 1, + "FrogsHint": 1, + "FullWallets": 1, + "GanonTrial": 0, + "GerudoKeys": 3, + "GregHint": 1, + "HBAHint": 1, + "IncludeTycoonWallet": 1, + "KakarikoGate": 1, + "Keysanity": 5, + "LacsRewardCount": 8, + "MalonHint": 1, + "MerchantText": 1, + "RainbowBridge": 7, + "SariaHint": 1, + "ScrubsFixedPrice": 2, + "ScrubsPrices": 3, + "SheikLAHint": 0, + "Shopsanity": 1, + "ShopsanityCount": 7, + "ShopsanityPrices": 2, + "ShuffleAdultTrade": 1, + "ShuffleBossEntrances": 2, + "ShuffleCows": 1, + "ShuffleDekuNutBag": 1, + "ShuffleDekuStickBag": 1, + "ShuffleDungeonsEntrances": 2, + "ShuffleFrogSongRupees": 1, + "ShuffleGanonBossKey": 9, + "ShuffleGerudoToken": 1, + "ShuffleKeyRings": 2, + "ShuffleKeyRingsRandomCount": 4, + "ShuffleKokiriSword": 1, + "ShuffleMasterSword": 1, + "ShuffleMerchants": 3, + "ShuffleOcarinas": 1, + "ShuffleOverworldSpawns": 1, + "ShuffleScrubs": 2, + "ShuffleSongs": 2, + "ShuffleSwim": 1, + "ShuffleTokens": 3, + "SkipChildZelda": 1, + "SkipEponaRace": 1, + "SkipScarecrowsSong": 1, + "StartingAge": 2, + "StartingMapsCompasses": 0, + "SunlightArrows": 1 + } + } + }, + "presetName": "Rando Advanced", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Beginner.json b/soh/assets/custom/presets/Rando Beginner.json new file mode 100644 index 000000000..595734fe0 --- /dev/null +++ b/soh/assets/custom/presets/Rando Beginner.json @@ -0,0 +1,51 @@ +{ + "blocks": { + "rando": { + "gRandoSettings": { + "10GSHint": 1, + "20GSHint": 1, + "30GSHint": 1, + "40GSHint": 1, + "50GSHint": 1, + "BigPoeTargetCount": 1, + "BiggoronHint": 1, + "BlueFireArrows": 1, + "BossKeysanity": 2, + "ClosedForest": 2, + "CompleteMaskQuest": 1, + "CuccosToReturn": 1, + "DampeHint": 1, + "DoorOfTime": 2, + "EnableBombchuDrops": 1, + "ExcludedLocations": "147,148,233,323,", + "FortressCarpenters": 1, + "FrogsHint": 1, + "FullWallets": 1, + "GanonTrial": 0, + "GregHint": 1, + "HBAHint": 1, + "IncludeTycoonWallet": 1, + "KakarikoGate": 1, + "Keysanity": 2, + "LacsRewardCount": 6, + "MalonHint": 1, + "MerchantText": 1, + "RainbowBridge": 7, + "SariaHint": 1, + "SheikLAHint": 0, + "ShuffleGanonBossKey": 9, + "ShuffleOcarinas": 1, + "SkipChildZelda": 1, + "SkipEponaRace": 1, + "SkipScarecrowsSong": 1, + "StartingKokiriSword": 1, + "StartingMapsCompasses": 0, + "StartingOcarina": 1, + "SunlightArrows": 1, + "ZorasFountain": 1 + } + } + }, + "presetName": "Rando Beginner", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Default.json b/soh/assets/custom/presets/Rando Default.json new file mode 100644 index 000000000..f5c5818e9 --- /dev/null +++ b/soh/assets/custom/presets/Rando Default.json @@ -0,0 +1,9 @@ +{ + "blocks": { + "rando": { + "gRandoSettings": null + } + }, + "presetName": "Rando Default", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Hell Mode.json b/soh/assets/custom/presets/Rando Hell Mode.json new file mode 100644 index 000000000..d42727127 --- /dev/null +++ b/soh/assets/custom/presets/Rando Hell Mode.json @@ -0,0 +1,80 @@ +{ + "blocks": { + "rando": { + "gRandoSettings": { + "BigPoeTargetCount": 1, + "BlueFireArrows": 1, + "BombchuBag": 1, + "BossKeysanity": 5, + "ClosedForest": 2, + "CuccosToReturn": 1, + "DecoupleEntrances": 1, + "DoorOfTime": 2, + "EnableBombchuDrops": 1, + "Fishsanity": 4, + "FishsanityAgeSplit": 1, + "FishsanityPondCount": 17, + "GerudoKeys": 3, + "IncludeTycoonWallet": 1, + "KakarikoGate": 1, + "Keysanity": 5, + "LacsRewardCount": 10, + "LacsRewardOptions": 1, + "LockOverworldDoors": 1, + "MixBosses": 1, + "MixDungeons": 1, + "MixGrottos": 1, + "MixInteriors": 1, + "MixOverworld": 1, + "MixedEntrances": 1, + "RainbowBridge": 7, + "ScrubsPrices": 2, + "Shopsanity": 1, + "ShopsanityCount": 7, + "ShopsanityPrices": 2, + "Shuffle100GSReward": 1, + "ShuffleAdultTrade": 1, + "ShuffleBeehives": 1, + "ShuffleBossEntrances": 2, + "ShuffleBossSouls": 2, + "ShuffleChildWallet": 1, + "ShuffleCows": 1, + "ShuffleCrates": 3, + "ShuffleDekuNutBag": 1, + "ShuffleDekuStickBag": 1, + "ShuffleDungeonsEntrances": 2, + "ShuffleFairies": 1, + "ShuffleFishingPole": 1, + "ShuffleFreestanding": 3, + "ShuffleFrogSongRupees": 1, + "ShuffleGanonBossKey": 9, + "ShuffleGerudoToken": 1, + "ShuffleGrass": 3, + "ShuffleGrottosEntrances": 1, + "ShuffleInteriorsEntrances": 2, + "ShuffleKokiriSword": 1, + "ShuffleMasterSword": 1, + "ShuffleMerchants": 3, + "ShuffleOcarinaButtons": 1, + "ShuffleOcarinas": 1, + "ShuffleOverworldEntrances": 1, + "ShuffleOverworldSpawns": 1, + "ShuffleOwlDrops": 1, + "ShufflePots": 3, + "ShuffleScrubs": 2, + "ShuffleSongs": 2, + "ShuffleSwim": 1, + "ShuffleTokens": 3, + "ShuffleWarpSongs": 1, + "ShuffleWeirdEgg": 1, + "SkipEponaRace": 1, + "StartingAge": 2, + "StartingHearts": 0, + "StartingMapsCompasses": 5, + "SunlightArrows": 1 + } + } + }, + "presetName": "Rando Hell Mode", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Standard.json b/soh/assets/custom/presets/Rando Standard.json new file mode 100644 index 000000000..ad91912de --- /dev/null +++ b/soh/assets/custom/presets/Rando Standard.json @@ -0,0 +1,63 @@ +{ + "blocks": { + "rando": { + "gRandoSettings": { + "10GSHint": 1, + "20GSHint": 1, + "30GSHint": 1, + "40GSHint": 1, + "50GSHint": 1, + "BigPoeTargetCount": 1, + "BiggoronHint": 1, + "BlueFireArrows": 1, + "BombchuBag": 1, + "BossKeysanity": 2, + "ClosedForest": 2, + "CompleteMaskQuest": 1, + "CuccosToReturn": 1, + "DampeHint": 1, + "DoorOfTime": 2, + "EnableBombchuDrops": 1, + "FortressCarpenters": 1, + "FrogsHint": 1, + "FullWallets": 1, + "GanonTrial": 0, + "GregHint": 1, + "HBAHint": 1, + "IncludeTycoonWallet": 1, + "KakarikoGate": 1, + "Keysanity": 5, + "LacsRewardCount": 7, + "MalonHint": 1, + "MerchantText": 1, + "RainbowBridge": 7, + "SariaHint": 1, + "ScrubsFixedPrice": 2, + "ScrubsPrices": 3, + "SheikLAHint": 0, + "Shopsanity": 1, + "ShopsanityCount": 4, + "ShopsanityPrices": 2, + "ShuffleGanonBossKey": 9, + "ShuffleGerudoToken": 1, + "ShuffleKeyRings": 2, + "ShuffleKeyRingsRandomCount": 8, + "ShuffleKokiriSword": 1, + "ShuffleMerchants": 1, + "ShuffleOcarinas": 1, + "ShuffleScrubs": 2, + "ShuffleSongs": 2, + "ShuffleTokens": 3, + "SkipChildZelda": 1, + "SkipEponaRace": 1, + "SkipScarecrowsSong": 1, + "StartingMapsCompasses": 0, + "StartingOcarina": 1, + "SunlightArrows": 1, + "ZorasFountain": 1 + } + } + }, + "presetName": "Rando Standard", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/soh/Enhancements/Presets/PresetEntries.cpp b/soh/soh/Enhancements/Presets/PresetEntries.cpp deleted file mode 100644 index d94323d08..000000000 --- a/soh/soh/Enhancements/Presets/PresetEntries.cpp +++ /dev/null @@ -1,650 +0,0 @@ -#include "Presets.h" -#include -#include "soh/cvar_prefixes.h" -#include "soh/Enhancements/enhancementTypes.h" - -#define PRESET_ENTRY_S32(cvar, value) \ - { cvar, PRESET_ENTRY_TYPE_S32, value } -#define PRESET_ENTRY_FLOAT(cvar, value) \ - { cvar, PRESET_ENTRY_TYPE_FLOAT, value } -#define PRESET_ENTRY_STRING(cvar, value) \ - { cvar, PRESET_ENTRY_TYPE_STRING, value } -#define PRESET_ENTRY_CPP_STRING(cvar, value) \ - { cvar, PRESET_ENTRY_TYPE_CPP_STRING, value } - -// TODO: Ideally everything in this file will come from one/many JSON files - -// Enhancement presets -const std::vector vanillaPlusPresetEntries = { - // Quality of Life - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("Autosave"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.GoldSkulltula"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.HeartPiece"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.HeartContainer"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterOwl"), 1), - - // Skips & Speed-ups - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipText"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TextSpeed"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterRupeeAccumulator"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSaveConfirmation"), 1), - - // Graphics - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableLOD"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RememberMapToggleState"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("VisualAgony"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DynamicWalletIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeFlowFileSelect"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("WidescreenActorCulling"), 1), - - // Items - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadEquips"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), - - // Fixes - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GravediggingTourFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixFloorSwitches"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixZoraHintDialogue"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixVineFall"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EnemySpawnsOverWaterboxes"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixSawSoftlock"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DekuNutUpgradeFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixBrokenGiantsKnife"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixMenuLR"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDungeonMinimapIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TwoHandedIdle"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NaviTextFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GerudoWarriorClothingFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixTexturesOOB"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixEyesOpenWhileSleeping"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixHammerHand"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SceneSpecificDirtPathFix"), ZFIGHT_FIX_CONSISTENT_VANISH), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDaruniaDanceSpeed"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CreditsFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RedGanonBlood"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PulsateBossIcon"), 1), - - // Difficulty - // NONE - - // Minigames - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FrogsModifyFailTime"), 2), - - // Extra Modes - // NONE - - // Cheats - // NONE -}; - -const std::vector enhancedPresetEntries = { - // Quality of Life - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("Autosave"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseWarp"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoInputForCredits"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.GoldSkulltula"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.HeartPiece"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.HeartContainer"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableCritWiggle"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterOwl"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuitFishingAtDoor"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantPutaway"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), 1), - - // Skips & Speed-ups - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipText"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TextSpeed"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SlowTextSpeed"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSwimDeepEndAnim"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ClimbSpeed"), 3), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterBlockPush"), 5), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CrawlSpeed"), 2), - PRESET_ENTRY_FLOAT(CVAR_ENHANCEMENT("MweepSpeed"), 5.0f), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantScarecrow"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterRupeeAccumulator"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkulltulaFreeze"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSaveConfirmation"), 1), - - // Graphics - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableLOD"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NewDrops"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseMenuAnimatedLink"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ShowDoorLocksOnBothSides"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ToTMedallionsColors"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RememberMapToggleState"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("VisualAgony"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DynamicWalletIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterAmmoRendering"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeFlowFileSelect"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("WidescreenActorCulling"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ExtendedCullingExcludeGlitchActors"), 1), - - // Items - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadEquips"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_FAST), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PersistentMasks"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NutsExplodeBombs"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableFirstPersonChus"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterBombchuShopping"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SeparateArrows"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipArrowAnimation"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastBoomerang"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterFarore"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastFarores"), 1), - - // Fixes - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GravediggingTourFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixFloorSwitches"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixZoraHintDialogue"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixVineFall"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EnemySpawnsOverWaterboxes"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixSawSoftlock"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DekuNutUpgradeFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixBrokenGiantsKnife"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixMenuLR"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDungeonMinimapIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TwoHandedIdle"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NaviTextFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GerudoWarriorClothingFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixTexturesOOB"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixEyesOpenWhileSleeping"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixHammerHand"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SceneSpecificDirtPathFix"), ZFIGHT_FIX_CONSISTENT_VANISH), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDaruniaDanceSpeed"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CreditsFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RedGanonBlood"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PulsateBossIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("HoverFishing"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("N64WeirdFrames"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BombchusOOB"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuickPutaway"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuickBongoKill"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 1), - - // Difficulty - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EnableBombchuDrops"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DampeWin"), 1), - - // Minigames - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FrogsModifyFailTime"), 2), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeOcarinaGame"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("OcarinaGame.StartingNotes"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFishing"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GuaranteeFishingBite"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FishNeverEscape"), 1), - - // Extra Modes - // NONE - - // Cheats - // NONE -}; - -const std::vector randomizerPresetEntries = { - // Quality of Life - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("Autosave"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DayGravePull"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DampeAllNight"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MarketSneak"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseWarp"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoInputForCredits"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("IncludeHeldInputsBufferWindow"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.GoldSkulltula"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.HeartPiece"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.HeartContainer"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableCritWiggle"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterOwl"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuitFishingAtDoor"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantPutaway"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), 1), - - // Skips & Speed-ups - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastDrops"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipForcedDialog"), FORCED_DIALOG_SKIP_ALL), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipText"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TextSpeed"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SlowTextSpeed"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastChests"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSwimDeepEndAnim"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ClimbSpeed"), 3), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterBlockPush"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CrawlSpeed"), 2), - PRESET_ENTRY_FLOAT(CVAR_ENHANCEMENT("MweepSpeed"), 5.0f), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipChildStealth"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipTowerEscape"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantScarecrow"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterRupeeAccumulator"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSaveConfirmation"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ForgeTime"), 0), - - // Graphics - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableLOD"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NewDrops"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseMenuAnimatedLink"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ShowDoorLocksOnBothSides"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ToTMedallionsColors"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RememberMapToggleState"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("VisualAgony"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DynamicWalletIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FileSelectMoreInfo"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterAmmoRendering"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeFlowFileSelect"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("WidescreenActorCulling"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ExtendedCullingExcludeGlitchActors"), 1), - - // Items - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadEquips"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EquipmentCanBeRemoved"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ToggleStrength"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SwordToggle"), SWORD_TOGGLE_CHILD), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_FAST), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AdultMasks"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PersistentMasks"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MaskSelect"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NutsExplodeBombs"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableFirstPersonChus"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterBombchuShopping"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SeparateArrows"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipArrowAnimation"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastBoomerang"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterFarore"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastFarores"), 1), - - // Fixes - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GravediggingTourFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixFloorSwitches"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixZoraHintDialogue"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixVineFall"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EnemySpawnsOverWaterboxes"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixSawSoftlock"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DekuNutUpgradeFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixBrokenGiantsKnife"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixMenuLR"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDungeonMinimapIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TwoHandedIdle"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NaviTextFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GerudoWarriorClothingFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixTexturesOOB"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixHammerHand"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SceneSpecificDirtPathFix"), ZFIGHT_FIX_CONSISTENT_VANISH), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDaruniaDanceSpeed"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CreditsFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RedGanonBlood"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PulsateBossIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("HoverFishing"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("N64WeirdFrames"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BombchusOOB"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuickPutaway"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuickBongoKill"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 1), - - // Difficulty - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GoronPot"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DampeWin"), 1), - - // Minigames - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FrogsModifyFailTime"), 2), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeOcarinaGame"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("OcarinaGame.StartingNotes"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFishing"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GuaranteeFishingBite"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FishNeverEscape"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MinimumFishWeightChild"), 3), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MinimumFishWeightAdult"), 6), - - // Extra Modes - // NONE - - // Cheats - PRESET_ENTRY_S32(CVAR_CHEAT("EasyFrameAdvance"), 1), -}; - -// Randomizer presets -const std::vector randomizerBeginnerPresetEntries = { - // World tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ClosedForest"), RO_CLOSED_FOREST_OFF), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ZorasFountain"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_GREG), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrial"), RO_GANONS_TRIALS_SKIP), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FortressCarpenters"), 1), - - // Items tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("IncludeTycoonWallet"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_STARTWITH), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Keysanity"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_LACS_REWARDS), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsRewardCount"), 6), - - // Gamplay tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), 1), - - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SheikLAHint"), 0), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DampeHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GregHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SariaHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FrogsHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BiggoronHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MalonHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("HBAHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MerchantText"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("10GSHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("20GSHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("30GSHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("40GSHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("50GSHint"), 1), - - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FullWallets"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BlueFireArrows"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SunlightArrows"), 1), - - // Locations tab - PRESET_ENTRY_STRING(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), "147,148,233,323,"), - - // Tricks/Glitches tab - // NONE - - // Starting inventory tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingKokiriSword"), RO_STARTING_OCARINA_FAIRY), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingOcarina"), RO_STARTING_OCARINA_FAIRY), -}; - -const std::vector randomizerStandardPresetEntries = { - // World tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ClosedForest"), RO_CLOSED_FOREST_OFF), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ZorasFountain"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_GREG), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrial"), RO_GANONS_TRIALS_SKIP), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FortressCarpenters"), 1), - - // Items tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleSongs"), RO_SONG_SHUFFLE_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleTokens"), RO_TOKENSANITY_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("IncludeTycoonWallet"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_SPECIFIC_COUNT), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityCount"), 4), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityPrices"), RO_PRICE_BALANCED), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), RO_SCRUBS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubsPrices"), RO_PRICE_FIXED), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubsFixedPrice"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleMerchants"), RO_SHUFFLE_MERCHANTS_BEANS_ONLY), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_STARTWITH), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Keysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_LACS_REWARDS), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsRewardCount"), 7), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), RO_KEYRINGS_COUNT), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsRandomCount"), 8), - - // Gamplay tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), 1), - - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SheikLAHint"), 0), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DampeHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GregHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SariaHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FrogsHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BiggoronHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MalonHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("HBAHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MerchantText"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("10GSHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("20GSHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("30GSHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("40GSHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("50GSHint"), 1), - - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FullWallets"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BombchuBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BlueFireArrows"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SunlightArrows"), 1), - - // Locations tab - // NONE - - // Tricks/Glitches tab - // NONE - - // Starting inventory tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingOcarina"), RO_STARTING_OCARINA_FAIRY), -}; - -const std::vector randomizerAdvancedPresetEntries = { - // World tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ClosedForest"), RO_CLOSED_FOREST_OFF), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_GREG), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingAge"), RO_AGE_RANDOM), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrial"), RO_GANONS_TRIALS_SKIP), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FortressCarpenters"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDungeonsEntrances"), RO_DUNGEON_ENTRANCE_SHUFFLE_ON_PLUS_GANON), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBossEntrances"), RO_BOSS_ROOM_ENTRANCE_SHUFFLE_FULL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOverworldSpawns"), 1), - - // Items tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleSongs"), RO_SONG_SHUFFLE_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleTokens"), RO_TOKENSANITY_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleMasterSword"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("IncludeTycoonWallet"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleSwim"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDekuNutBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDekuStickBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_SPECIFIC_COUNT), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityCount"), 7), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityPrices"), RO_PRICE_BALANCED), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), RO_SCRUBS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubsPrices"), RO_PRICE_FIXED), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubsFixedPrice"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleCows"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleMerchants"), RO_SHUFFLE_MERCHANTS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleFrogSongRupees"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_STARTWITH), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Keysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_LACS_REWARDS), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsRewardCount"), 8), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), RO_KEYRINGS_COUNT), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsRandomCount"), 4), - - // Gamplay tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), 1), - - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SheikLAHint"), 0), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DampeHint"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GregHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SariaHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FrogsHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MalonHint"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("HBAHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MerchantText"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("40GSHint"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("50GSHint"), 1), - - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FullWallets"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BombchuBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BlueFireArrows"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SunlightArrows"), 1), - - // Locations tab - // NONE - - // Tricks/Glitches tab - // NONE - - // Starting inventory tab - // NONE -}; - -const std::vector hellModePresetEntries = { - // World tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ClosedForest"), RO_CLOSED_FOREST_OFF), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LockOverworldDoors"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_GREG), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingAge"), RO_AGE_RANDOM), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDungeonsEntrances"), RO_DUNGEON_ENTRANCE_SHUFFLE_ON_PLUS_GANON), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBossEntrances"), RO_BOSS_ROOM_ENTRANCE_SHUFFLE_FULL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOverworldEntrances"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleInteriorsEntrances"), RO_INTERIOR_ENTRANCE_SHUFFLE_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGrottosEntrances"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOwlDrops"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleWarpSongs"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOverworldSpawns"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixedEntrances"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixDungeons"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixBosses"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixOverworld"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixInteriors"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixGrottos"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DecoupleEntrances"), 1), - - // Items tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleSongs"), RO_SONG_SHUFFLE_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleTokens"), RO_TOKENSANITY_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleMasterSword"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleChildWallet"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("IncludeTycoonWallet"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinaButtons"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleSwim"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleWeirdEgg"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleFishingPole"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDekuNutBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDekuStickBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleFreestanding"), RO_SHUFFLE_FREESTANDING_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_SPECIFIC_COUNT), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityCount"), 7), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityPrices"), RO_PRICE_BALANCED), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Fishsanity"), RO_FISHSANITY_BOTH), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FishsanityPondCount"), 17), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FishsanityAgeSplit"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), RO_SCRUBS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubsPrices"), RO_PRICE_BALANCED), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBeehives"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleCows"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShufflePots"), RO_SHUFFLE_POTS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleCrates"), RO_SHUFFLE_CRATES_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleMerchants"), RO_SHUFFLE_MERCHANTS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleFrogSongRupees"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shuffle100GSReward"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBossSouls"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleFairies"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGrass"), RO_SHUFFLE_GRASS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Keysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_LACS_REWARDS), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsRewardCount"), 10), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsRewardOptions"), RO_LACS_GREG_REWARD), - - // Gamplay tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BombchuBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BlueFireArrows"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SunlightArrows"), 1), - - // Locations tab - // NONE - - // Tricks/Glitches tab - // NONE - - // Starting inventory tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingHearts"), 0), -}; - -const std::map presetTypes = { - { PRESET_TYPE_ENHANCEMENTS, - { { CVAR_PREFIX_ENHANCEMENT, CVAR_PREFIX_CHEAT }, - { - { ENHANCEMENT_PRESET_DEFAULT, - { - "Default", - "Reset all options to their default values.", - {}, - } }, - { ENHANCEMENT_PRESET_VANILLA_PLUS, - { - "Vanilla Plus", - "Adds some quality of life features, but don't alter gameplay and aims to " - "preserve the authentic experience. Recommended for a first playthrough of OoT.", - vanillaPlusPresetEntries, - } }, - { ENHANCEMENT_PRESET_ENHANCED, - { "Enhanced", - "The \"Vanilla Plus\" preset, but with more quality of life enhancements that might alter gameplay " - "slightly. Recommended for returning players going through the vanilla game again.", - enhancedPresetEntries } }, - { ENHANCEMENT_PRESET_RANDOMIZER, - { "Randomizer", - "A baseline set of enhancements for playing randomizer. Includes many quality of life options and " - "options to speed up gameplay.", - randomizerPresetEntries } }, - } } }, - { PRESET_TYPE_RANDOMIZER, - { { CVAR_PREFIX_RANDOMIZER_SETTING, CVAR_PREFIX_RANDOMIZER_ENHANCEMENT }, - { - { RANDOMIZER_PRESET_DEFAULT, - { - "Default", - "Reset all options to their default values.", - {}, - } }, - { RANDOMIZER_PRESET_BEGINNER, - { - "Beginner", - "A simpler set of options and shuffled items meant for players new to the randomizer. ", - randomizerBeginnerPresetEntries, - } }, - { RANDOMIZER_PRESET_STANDARD, - { - "Standard", - "A set of options meant as a baseline for both newer and experienced randomizer players.", - randomizerStandardPresetEntries, - } }, - { RANDOMIZER_PRESET_ADVANCED, - { - "Advanced", - "Includes many more shuffled items and introduces some entrance shuffle options. Meant for advanced " - "randomizer players.", - randomizerAdvancedPresetEntries, - } }, - { RANDOMIZER_PRESET_HELL_MODE, - { "Hell Mode", - "Every location randomized, all entrance settings enabled, but still using glitchless logic. Expect " - "pain.", - hellModePresetEntries } }, - } } } -}; diff --git a/soh/soh/Enhancements/Presets/Presets.cpp b/soh/soh/Enhancements/Presets/Presets.cpp index cef3f8362..b5c364251 100644 --- a/soh/soh/Enhancements/Presets/Presets.cpp +++ b/soh/soh/Enhancements/Presets/Presets.cpp @@ -1,63 +1,145 @@ #include "Presets.h" #include #include -#include -#include +#include +#include +#include +#include #include +#include +#include "soh/OTRGlobals.h" #include "soh/SohGui/MenuTypes.h" #include "soh/SohGui/SohMenu.h" #include "soh/SohGui/SohGui.hpp" +#include "soh/Enhancements/randomizer/randomizer_settings_window.h" +#include "soh/Enhancements/randomizer/randomizer_check_tracker.h" +#include "soh/Enhancements/randomizer/randomizer_entrance_tracker.h" +#include "soh/Enhancements/randomizer/randomizer_item_tracker.h" -std::string FormatLocations(std::vector locs) { - std::string locString = ""; - for (auto loc : locs) { - locString += std::to_string(loc) + ","; - } - return locString; +namespace fs = std::filesystem; + +namespace SohGui { +extern std::shared_ptr mSohMenu; +extern std::shared_ptr mRandomizerSettingsWindow; +} // namespace SohGui + +struct PresetInfo { + nlohmann::json presetValues; + std::string fileName; + bool apply[PRESET_SECTION_MAX]; + bool isBuiltIn = false; +}; + +struct BlockInfo { + std::vector sections; + const char* icon; + std::string names[2]; +}; + +static std::map presets; +static std::string presetFolder; + +void BlankButton() { + ImGui::PushStyleColor(ImGuiCol_Button, { 0, 0, 0, 0 }); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0, 0, 0, 0 }); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0, 0, 0, 0 }); + ImGui::PushStyleColor(ImGuiCol_Border, { 0, 0, 0, 0 }); + ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(8.0f, 8.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 5.0f); } -void applyPreset(std::vector entries) { - for (auto& [cvar, type, value] : entries) { - switch (type) { - case PRESET_ENTRY_TYPE_S32: - CVarSetInteger(cvar, std::get(value)); - break; - case PRESET_ENTRY_TYPE_FLOAT: - CVarSetFloat(cvar, std::get(value)); - break; - case PRESET_ENTRY_TYPE_STRING: - CVarSetString(cvar, std::get(value)); - break; - case PRESET_ENTRY_TYPE_CPP_STRING: - CVarSetString(cvar, std::get(value).c_str()); - break; +void PresetCheckboxStyle(const ImVec4& color) { + ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(color.x, color.y, color.z, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(color.x, color.y, color.z, 0.8f)); + ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(color.x, color.y, color.z, 0.6f)); + ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.0f, 0.0f, 0.0f, 0.3f)); + ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.0f, 1.0f, 1.0f, 0.7f)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(6.0f, 6.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 5.0f); +} + +static BlockInfo blockInfo[PRESET_SECTION_MAX] = { + { { CVAR_PREFIX_SETTING, CVAR_PREFIX_WINDOW }, ICON_FA_COG, { "Settings", "settings" } }, + { { CVAR_PREFIX_ENHANCEMENT, CVAR_PREFIX_RANDOMIZER_ENHANCEMENT, CVAR_PREFIX_CHEAT }, + ICON_FA_PLUS_CIRCLE, + { "Enhancements", "enhancements" } }, + { { CVAR_PREFIX_AUDIO }, ICON_FA_MUSIC, { "Audio", "audio" } }, + { { CVAR_PREFIX_COSMETIC }, ICON_FA_PAINT_BRUSH, { "Cosmetics", "cosmetics" } }, + { { CVAR_PREFIX_RANDOMIZER_SETTING }, ICON_FA_RANDOM, { "Rando Settings", "rando" } }, + { { CVAR_PREFIX_TRACKER }, ICON_FA_MAP, { "Trackers", "trackers" } }, + { { CVAR_PREFIX_REMOTE }, ICON_FA_WIFI, { "Network", "network" } }, +}; + +std::string FormatPresetPath(std::string name) { + return fmt::format("{}/{}.json", presetFolder, name); +} + +void applyPreset(std::string presetName, std::vector includeSections) { + auto& info = presets[presetName]; + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + if (info.apply[i] && info.presetValues["blocks"].contains(blockInfo[i].names[1])) { + if (!includeSections.empty() && + std::find(includeSections.begin(), includeSections.end(), i) == includeSections.end()) { + continue; + } + if (i == PRESET_SECTION_TRACKERS) { + ItemTracker_LoadFromPreset(info.presetValues["blocks"][blockInfo[i].names[1]]["windows"]); + if (info.presetValues["blocks"][blockInfo[i].names[1]]["windows"].contains("Check Tracker")) { + CheckTracker::CheckTracker_LoadFromPreset( + info.presetValues["blocks"][blockInfo[i].names[1]]["windows"]["Check Tracker"]); + } + if (info.presetValues["blocks"][blockInfo[i].names[1]]["windows"].contains("Entrance Tracker")) { + EntranceTracker_LoadFromPreset( + info.presetValues["blocks"][blockInfo[i].names[1]]["windows"]["Entrance Tracker"]); + } + } + auto section = info.presetValues["blocks"][blockInfo[i].names[1]]; + for (auto& item : section.items()) { + if (section[item.key()].is_null()) { + CVarClearBlock(item.key().c_str()); + } else { + Ship::Context::GetInstance()->GetConfig()->SetBlock(fmt::format("{}.{}", "CVars", item.key()), + item.value()); + Ship::Context::GetInstance()->GetConsoleVariables()->Load(); + } + } + if (i == PRESET_SECTION_RANDOMIZER) { + SohGui::mRandomizerSettingsWindow->SetNeedsUpdate(); + } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } - ShipInit::Init("*"); } -void DrawPresetSelector(PresetType presetTypeId) { - const std::string presetTypeCvar = CVAR_GENERAL("SelectedPresets.") + std::to_string(presetTypeId); - const PresetTypeDefinition presetTypeDef = presetTypes.at(presetTypeId); - uint16_t selectedPresetId = CVarGetInteger(presetTypeCvar.c_str(), 0); - if (selectedPresetId >= presetTypeDef.presets.size()) { - selectedPresetId = 0; +void DrawPresetSelector(std::vector includeSections, std::string presetLoc, bool disabled) { + std::vector includedPresets; + for (auto& [name, info] : presets) { + for (auto& section : includeSections) { + if (info.apply[section]) { + includedPresets.push_back(name); + } + } } - const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(selectedPresetId); - std::string comboboxTooltip = ""; - for (auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter) { - if (iter->first != 0) - comboboxTooltip += "\n\n"; - comboboxTooltip += std::string(iter->second.label) + " - " + std::string(iter->second.description); - } - ImGui::Text("Presets"); + if (includedPresets.empty()) { + ImGui::PushStyleColor(ImGuiCol_Text, UIWidgets::ColorValues.at(UIWidgets::Colors::Orange)); + ImGui::Text("No presets with rando options. Make some in Settings -> Presets"); + ImGui::PopStyleColor(); + return; + } + std::string selectorCvar = fmt::format(CVAR_GENERAL("{}SelectedPreset"), presetLoc); + std::string currentIndex = CVarGetString(selectorCvar.c_str(), includedPresets[0].c_str()); + if (!presets.contains(currentIndex)) { + currentIndex = *includedPresets.begin(); + CVarSetString(selectorCvar.c_str(), currentIndex.c_str()); + } UIWidgets::PushStyleCombobox(THEME_COLOR); - if (ImGui::BeginCombo("##PresetsComboBox", selectedPresetDef.label)) { - for (auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter) { - if (ImGui::Selectable(iter->second.label, iter->first == selectedPresetId)) { - CVarSetInteger(presetTypeCvar.c_str(), iter->first); + if (ImGui::BeginCombo("##PresetsComboBox", currentIndex.c_str())) { + for (auto iter = includedPresets.begin(); iter != includedPresets.end(); ++iter) { + if (ImGui::Selectable(iter->c_str(), *iter == currentIndex)) { + CVarSetString(selectorCvar.c_str(), iter->c_str()); + currentIndex = *iter; Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } @@ -65,18 +147,300 @@ void DrawPresetSelector(PresetType presetTypeId) { ImGui::EndCombo(); } UIWidgets::PopStyleCombobox(); - UIWidgets::Tooltip(comboboxTooltip.c_str()); + // UIWidgets::Tooltip(comboboxTooltip.c_str()); UIWidgets::PushStyleButton(THEME_COLOR); - if (ImGui::Button(("Apply Preset##" + presetTypeCvar).c_str())) { - for (const char* block : presetTypeDef.blocksToClear) { - CVarClearBlock(block); - } - if (selectedPresetId != 0) { - applyPreset(selectedPresetDef.entries); - } - CVarSetInteger(presetTypeCvar.c_str(), selectedPresetId); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + if (UIWidgets::Button( + ("Apply Preset##" + selectorCvar).c_str(), + UIWidgets::ButtonOptions({ { .disabled = disabled } }).Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline))) { + applyPreset(currentIndex, includeSections); } UIWidgets::PopStyleButton(); } + +void DrawSectionCheck(const std::string& name, bool empty, bool* pointer, std::string section) { + ImGui::AlignTextToFramePadding(); + if (empty) { + ImGui::PushStyleColor(ImGuiCol_Text, { 1.0f, 0.0f, 0.0f, 0.7f }); + BlankButton(); + ImGui::BeginDisabled(); + ImGui::Button((ICON_FA_TIMES + std::string("##") + name + section).c_str()); + ImGui::EndDisabled(); + UIWidgets::PopStyleButton(); + ImGui::PopStyleColor(); + } else { + ImGui::PushFont(OTRGlobals::Instance->fontMono); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (ImGui::GetStyle().FramePadding.y)); + UIWidgets::Checkbox(("##" + name + section).c_str(), pointer, + { .defaultValue = true, .padding = { 6.0f, 6.0f }, .color = THEME_COLOR }); + ImGui::PopFont(); + } +} + +void ParsePreset(nlohmann::json& json, std::string name) { + try { + presets[json["presetName"]].presetValues = json; + presets[json["presetName"]].fileName = name; + if (json.contains("isBuiltIn")) { + presets[json["presetName"]].isBuiltIn = json["isBuiltIn"]; + } + for (int i = 0; i < PRESET_SECTION_MAX; i++) { + if (presets[json["presetName"]].presetValues["blocks"].contains(blockInfo[i].names[1])) { + presets[json["presetName"]].apply[i] = true; + } + } + } catch (...) {} +} + +void LoadPresets() { + if (!fs::exists(presetFolder)) { + return; + } + if (!presets.empty()) { + presets.clear(); + } + for (auto const& preset : fs::directory_iterator(presetFolder)) { + std::ifstream ifs(preset.path()); + + auto json = nlohmann::json::parse(ifs); + if (!json.contains("presetName")) { + spdlog::error(fmt::format("Attempted to load file {} as a preset, but was not a preset file.", + preset.path().filename().string())); + } else { + ParsePreset(json, preset.path().filename().stem().string()); + } + ifs.close(); + } + auto initData = std::make_shared(); + initData->Format = RESOURCE_FORMAT_BINARY; + initData->Type = static_cast(Ship::ResourceType::Json); + initData->ResourceVersion = 0; + std::string folder = "presets/*"; + auto builtIns = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(folder); + size_t start = std::string(folder).size() - 1; + for (size_t i = 0; i < builtIns->size(); i++) { + std::string filePath = builtIns->at(i); + auto json = std::static_pointer_cast( + Ship::Context::GetInstance()->GetResourceManager()->LoadResource(filePath, true, initData)); + + std::string fileName = filePath.substr(start, filePath.size() - start - 5); // 5 for length of ".json" + ParsePreset(json->Data, fileName); + } +} + +void SavePreset(std::string& presetName) { + if (!fs::exists(presetFolder)) { + fs::create_directory(presetFolder); + } + presets[presetName].presetValues["presetName"] = presetName; + std::ofstream file( + fmt::format("{}/{}.json", Ship::Context::GetInstance()->LocateFileAcrossAppDirs("presets"), presetName)); + file << presets[presetName].presetValues.dump(4); + file.close(); + LoadPresets(); +} + +static std::string newPresetName; +static bool saveSection[PRESET_SECTION_MAX]; + +void DrawNewPresetPopup() { + bool nameExists = presets.contains(newPresetName); + UIWidgets::InputString("Preset Name", &newPresetName, + UIWidgets::InputOptions() + .Color(THEME_COLOR) + .Size({ 200, 40 }) + .ComponentAlignment(UIWidgets::ComponentAlignments::Right) + .LabelPosition(UIWidgets::LabelPositions::Near) + .ErrorText("Preset name already exists") + .HasError(nameExists)); + nameExists = presets.contains(newPresetName); + bool noneSelected = true; + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + if (saveSection[i]) { + noneSelected = false; + break; + } + } + const char* disabledTooltip = + (newPresetName.empty() ? "Preset name is empty" + : (noneSelected ? "No sections selected" : "Preset name already exists")); + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + UIWidgets::Checkbox(fmt::format("Save {}", blockInfo[i].names[0]).c_str(), &saveSection[i], + UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({ 6.0f, 6.0f })); + } + if (UIWidgets::Button( + "Save", UIWidgets::ButtonOptions({ { .disabled = (nameExists || noneSelected || newPresetName.empty()), + .disabledTooltip = disabledTooltip } }) + .Padding({ 6.0f, 6.0f }) + .Color(THEME_COLOR))) { + presets[newPresetName] = {}; + auto config = Ship::Context::GetInstance()->GetConfig()->GetNestedJson(); + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + if (saveSection[i]) { + for (int j = 0; j < blockInfo[i].sections.size(); j++) { + presets[newPresetName].presetValues["blocks"][blockInfo[i].names[1]][blockInfo[i].sections[j]] = + config["CVars"][blockInfo[i].sections[j]]; + } + } + } + if (saveSection[PRESET_SECTION_TRACKERS]) { + for (auto id : itemTrackerWindowIDs) { + auto window = ImGui::FindWindowByName(id); + if (window != nullptr) { + auto size = window->Size; + auto pos = window->Pos; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]] + ["windows"][id]["size"]["width"] = size.x; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]] + ["windows"][id]["size"]["height"] = size.y; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]] + ["windows"][id]["pos"]["x"] = pos.x; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]] + ["windows"][id]["pos"]["y"] = pos.y; + } + } + + auto window = ImGui::FindWindowByName("Entrance Tracker"); + if (window != nullptr) { + auto size = window->Size; + auto pos = window->Pos; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Entrance Tracker"]["size"]["width"] = size.x; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Entrance Tracker"]["size"]["height"] = size.y; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Entrance Tracker"]["pos"]["x"] = pos.x; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Entrance Tracker"]["pos"]["y"] = pos.y; + } + + window = ImGui::FindWindowByName("Check Tracker"); + if (window != nullptr) { + auto size = window->Size; + auto pos = window->Pos; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Check Tracker"]["size"]["width"] = size.x; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Check Tracker"]["size"]["height"] = size.y; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Check Tracker"]["pos"]["x"] = pos.x; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Check Tracker"]["pos"]["y"] = pos.y; + } + } + presets[newPresetName].fileName = newPresetName; + std::fill_n(presets[newPresetName].apply, PRESET_SECTION_MAX, true); + SavePreset(newPresetName); + newPresetName = ""; + ImGui::CloseCurrentPopup(); + } + if (UIWidgets::Button("Cancel", UIWidgets::ButtonOptions().Padding({ 6.0f, 6.0f }).Color(THEME_COLOR))) { + ImGui::CloseCurrentPopup(); + } + ImGui::EndPopup(); +} + +void PresetsCustomWidget(WidgetInfo& info) { + ImGui::PushFont(OTRGlobals::Instance->fontMonoLargest); + if (UIWidgets::Button("New Preset", UIWidgets::ButtonOptions( + { { .disabled = (CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) != 0), + .disabledTooltip = "Disabled because of race lockout" } }) + .Size(UIWidgets::Sizes::Inline) + .Color(THEME_COLOR))) { + ImGui::OpenPopup("newPreset"); + } + if (ImGui::BeginPopup("newPreset", ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | + ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | + ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoTitleBar)) { + DrawNewPresetPopup(); + } + ImGui::SameLine(); + UIWidgets::CVarCheckbox("Hide built-in presets", CVAR_GENERAL("HideBuiltInPresets"), + UIWidgets::CheckboxOptions().Color(THEME_COLOR)); + bool hideBuiltIn = CVarGetInteger(CVAR_GENERAL("HideBuiltInPresets"), 0); + UIWidgets::PushStyleTabs(THEME_COLOR); + if (ImGui::BeginTable("PresetWidgetTable", PRESET_SECTION_MAX + 3)) { + ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, 250); + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + ImGui::TableSetupColumn(blockInfo[i].names[0].c_str()); + } + ImGui::TableSetupColumn("Apply", ImGuiTableColumnFlags_WidthFixed, + ImGui::CalcTextSize("Apply").x + ImGui::GetStyle().FramePadding.x * 2); + ImGui::TableSetupColumn("Delete", ImGuiTableColumnFlags_WidthFixed, + ImGui::CalcTextSize("Delete").x + ImGui::GetStyle().FramePadding.x * 2); + BlankButton(); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + ImGui::TableNextColumn(); + ImGui::Button(fmt::format("{}##header{}", blockInfo[i].icon, blockInfo[i].names[1]).c_str()); + UIWidgets::Tooltip(blockInfo[i].names[0].c_str()); + } + UIWidgets::PopStyleButton(); + + if (presets.empty()) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::AlignTextToFramePadding(); + ImGui::Text("No presets found."); + ImGui::EndTable(); + UIWidgets::PopStyleTabs(); + ImGui::PopFont(); + return; + } + for (auto& [name, info] : presets) { + if (hideBuiltIn && info.isBuiltIn) { + continue; + } + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::AlignTextToFramePadding(); + ImGui::Text(name.c_str()); + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + ImGui::TableNextColumn(); + DrawSectionCheck(name, !info.presetValues["blocks"].contains(blockInfo[i].names[1]), &info.apply[i], + blockInfo[i].names[1]); + } + ImGui::TableNextColumn(); + UIWidgets::PushStyleButton(THEME_COLOR); + if (UIWidgets::Button( + ("Apply##" + name).c_str(), + UIWidgets::ButtonOptions({ { .disabled = (CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) != 0), + .disabledTooltip = "Disabled because of race lockout" } }) + .Padding({ 6.0f, 6.0f }))) { + applyPreset(name); + } + UIWidgets::PopStyleButton(); + ImGui::TableNextColumn(); + UIWidgets::PushStyleButton(THEME_COLOR); + if (!info.isBuiltIn) { + if (UIWidgets::Button(("Delete##" + name).c_str(), + UIWidgets::ButtonOptions().Padding({ 6.0f, 6.0f }))) { + auto path = FormatPresetPath(info.fileName); + if (fs::exists(path)) { + fs::remove(path); + } + presets.erase(name); + UIWidgets::PopStyleButton(); + break; + } + } + UIWidgets::PopStyleButton(); + } + + ImGui::EndTable(); + } + ImGui::PopFont(); + UIWidgets::PopStyleTabs(); +} + +void RegisterPresetsWidgets() { + SohGui::mSohMenu->AddSidebarEntry("Settings", "Presets", 1); + WidgetPath path = { "Settings", "Presets", SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddWidget(path, "PresetsWidget", WIDGET_CUSTOM).CustomFunction(PresetsCustomWidget); + presetFolder = Ship::Context::GetInstance()->GetPathRelativeToAppDirectory("presets"); + std::fill_n(saveSection, PRESET_SECTION_MAX, true); + LoadPresets(); +} + +static RegisterMenuInitFunc initFunc(RegisterPresetsWidgets); diff --git a/soh/soh/Enhancements/Presets/Presets.h b/soh/soh/Enhancements/Presets/Presets.h index 898bc9cc9..5edb265a3 100644 --- a/soh/soh/Enhancements/Presets/Presets.h +++ b/soh/soh/Enhancements/Presets/Presets.h @@ -2,57 +2,17 @@ #include #include -#include -#include "soh/OTRGlobals.h" -enum PresetEntryType { - PRESET_ENTRY_TYPE_S32, - PRESET_ENTRY_TYPE_FLOAT, - PRESET_ENTRY_TYPE_STRING, - PRESET_ENTRY_TYPE_CPP_STRING, +enum PresetSection { + PRESET_SECTION_SETTINGS, + PRESET_SECTION_ENHANCEMENTS, + PRESET_SECTION_AUDIO, + PRESET_SECTION_COSMETICS, + PRESET_SECTION_RANDOMIZER, + PRESET_SECTION_TRACKERS, + PRESET_SECTION_NETWORK, + PRESET_SECTION_MAX, }; -enum PresetType { - PRESET_TYPE_ENHANCEMENTS, - PRESET_TYPE_RANDOMIZER, -}; - -enum EnhancementPreset { - ENHANCEMENT_PRESET_DEFAULT, - ENHANCEMENT_PRESET_VANILLA_PLUS, - ENHANCEMENT_PRESET_ENHANCED, - ENHANCEMENT_PRESET_RANDOMIZER, -}; - -enum RandomizerPreset { - RANDOMIZER_PRESET_DEFAULT, - RANDOMIZER_PRESET_BEGINNER, - RANDOMIZER_PRESET_STANDARD, - RANDOMIZER_PRESET_ADVANCED, - RANDOMIZER_PRESET_HELL_MODE, -}; - -typedef struct PresetEntry { - const char* cvar; - PresetEntryType type; - std::variant value; -} PresetEntry; - -std::string FormatLocations(std::vector locs); - -void DrawPresetSelector(PresetType presetType); -void clearCvars(std::vector cvarsToClear); -void applyPreset(std::vector entries); - -typedef struct PresetDefinition { - const char* label; - const char* description; - std::vector entries; -} PresetDefinition; - -typedef struct PresetTypeDefinition { - std::vector blocksToClear; - std::map presets; -} PresetTypeDefinition; - -extern const std::map presetTypes; +void DrawPresetSelector(std::vector includeSections, std::string currentIndex, bool disabled); +void applyPreset(std::string presetName, std::vector includeSections = {}); diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 104dfd435..f7279ff80 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -26,6 +26,7 @@ #include #include #include "draw.h" +#include "soh/OTRGlobals.h" #include "soh/SohGui/UIWidgets.hpp" #include "static_data.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" @@ -3643,14 +3644,8 @@ bool GenerateRandomizer(std::string seed /*= ""*/) { return false; } -static const std::unordered_map randomizerPresetList = { - { RANDOMIZER_PRESET_DEFAULT, "Default" }, - { RANDOMIZER_PRESET_BEGINNER, "Beginner" }, - { RANDOMIZER_PRESET_STANDARD, "Standard" }, - { RANDOMIZER_PRESET_ADVANCED, "Advanced" }, - { RANDOMIZER_PRESET_HELL_MODE, "Hell Mode" } -}; -static int32_t randomizerPresetSelected = RANDOMIZER_PRESET_DEFAULT; +static bool locationsTabOpen = false; +static bool tricksTabOpen = false; void RandomizerSettingsWindow::DrawElement() { auto ctx = Rando::Context::GetInstance(); @@ -3658,53 +3653,12 @@ void RandomizerSettingsWindow::DrawElement() { generated = 0; randoThread.join(); } - static bool locationsTabOpen = false; - static bool tricksTabOpen = false; - bool disableEditingRandoSettings = - CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0); - ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) || disableEditingRandoSettings); - const PresetTypeDefinition presetTypeDef = presetTypes.at(PRESET_TYPE_RANDOMIZER); - std::string comboboxTooltip = ""; - for (auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter) { - if (iter->first != 0) - comboboxTooltip += "\n\n"; - comboboxTooltip += std::string(iter->second.label) + " - " + std::string(iter->second.description); - } - const std::string presetTypeCvar = CVAR_GENERAL("SelectedPresets.") + std::to_string(PRESET_TYPE_RANDOMIZER); - randomizerPresetSelected = CVarGetInteger(presetTypeCvar.c_str(), RANDOMIZER_PRESET_DEFAULT); + bool generating = CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0); + bool disableEditingRandoSettings = generating || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0); - if (UIWidgets::Combobox("Randomizer Presets", &randomizerPresetSelected, randomizerPresetList, - UIWidgets::ComboboxOptions() - .DefaultIndex(RANDOMIZER_PRESET_DEFAULT) - .Tooltip(comboboxTooltip.c_str()) - .Color(THEME_COLOR))) { - CVarSetInteger(presetTypeCvar.c_str(), randomizerPresetSelected); - } - ImGui::SameLine(); - ImGui::SetCursorPosY(ImGui::GetCursorPos().y + 35.f); - if (UIWidgets::Button( - "Apply Preset##Randomizer", - UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline).Padding(ImVec2(10.f, 6.f)))) { - if (randomizerPresetSelected >= presetTypeDef.presets.size()) { - randomizerPresetSelected = 0; - } - const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(randomizerPresetSelected); - for (const char* block : presetTypeDef.blocksToClear) { - CVarClearBlock(block); - } - if (randomizerPresetSelected != 0) { - applyPreset(selectedPresetDef.entries); - } - CVarSetInteger(presetTypeCvar.c_str(), randomizerPresetSelected); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); - mSettings->UpdateOptionProperties(); - // force excluded location list and trick list update if tab is open. - locationsTabOpen = false; - tricksTabOpen = false; - } - ImGui::EndDisabled(); + DrawPresetSelector({ PRESET_SECTION_RANDOMIZER }, "Randomizer", generating); - UIWidgets::Spacer(0); + // UIWidgets::Spacer(0); UIWidgets::CVarCheckbox("Manual seed entry", CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), UIWidgets::CheckboxOptions().Color(THEME_COLOR)); if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), 0)) { @@ -3754,10 +3708,6 @@ void RandomizerSettingsWindow::DrawElement() { ImGui::Text("Spoiler File: %s", spoilerfilepath.c_str()); } - // RANDOTODO settings presets - // std::string presetfilepath = CVarGetString(CVAR_RANDOMIZER_SETTING("LoadedPreset"), ""); - // ImGui::Text("Settings File: %s", presetfilepath.c_str()); - UIWidgets::Separator(true, true, 0.f, 0.f); ImGuiWindow* window = ImGui::GetCurrentWindow(); @@ -4367,9 +4317,17 @@ void RandomizerSettingsWindow::DrawElement() { UIWidgets::PopStyleTabs(); } +void RandomizerSettingsWindow::SetNeedsUpdate() { + mNeedsUpdate = true; +} + void RandomizerSettingsWindow::UpdateElement() { if (mNeedsUpdate) { + RandomizerCheckObjects::UpdateImGuiVisibility(); mSettings->UpdateOptionProperties(); + locationsTabOpen = false; + tricksTabOpen = false; + mNeedsUpdate = false; } } diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index c919e4c6c..52b977032 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -91,6 +91,10 @@ bool previousShowHidden = false; bool hideShopUnshuffledChecks = false; bool alwaysShowGS = false; +static bool presetLoaded = false; +static ImVec2 presetPos; +static ImVec2 presetSize; + std::map startingShopItem = { { SCENE_KOKIRI_SHOP, RC_KF_SHOP_ITEM_1 }, { SCENE_BAZAAR, RC_MARKET_BAZAAR_ITEM_1 }, @@ -979,7 +983,13 @@ void CheckTrackerWindow::DrawElement() { } } - ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver); + if (presetLoaded) { + ImGui::SetNextWindowSize(presetSize); + ImGui::SetNextWindowPos(presetPos); + presetLoaded = false; + } else { + ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver); + } BeginFloatWindows("Check Tracker", mIsVisible, ImGuiWindowFlags_NoScrollbar); if (!GameInteractor::IsSaveLoaded() || !initialized) { @@ -2000,6 +2010,12 @@ void RecalculateAvailableChecks() { GetPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS).count()); } +void CheckTracker_LoadFromPreset(nlohmann::json info) { + presetLoaded = true; + presetPos = { info["pos"]["x"], info["pos"]["y"] }; + presetSize = { info["size"]["width"], info["size"]["height"] }; +} + void CheckTrackerWindow::Draw() { if (!IsVisible()) { return; diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h index 7636ab063..695899bab 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h @@ -62,4 +62,5 @@ void UpdateAllAreas(); void RecalculateAllAreaTotals(); void SpoilAreaFromCheck(RandomizerCheck rc); void RecalculateAvailableChecks(); +void CheckTracker_LoadFromPreset(nlohmann::json info); } // namespace CheckTracker diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp index eaa928705..1a635f58e 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp @@ -39,6 +39,10 @@ static s16 lastEntranceIndex = -1; static s16 currentGrottoId = -1; static s16 lastSceneOrEntranceDetected = -1; +static bool presetLoaded = false; +static ImVec2 presetPos; +static ImVec2 presetSize; + static std::string spoilerEntranceGroupNames[] = { "Spawns/Warp Songs/Owls", "Kokiri Forest", @@ -445,6 +449,12 @@ const EntranceData* GetEntranceData(s16 index) { return nullptr; } +void EntranceTracker_LoadFromPreset(nlohmann::json info) { + presetLoaded = true; + presetPos = { info["pos"]["x"], info["pos"]["y"] }; + presetSize = { info["size"]["width"], info["size"]["height"] }; +} + // Used for verifying the names on both sides of entrance pairs match. Keeping for ease of use for further name changes // later // TODO: Figure out how to remove the need for duplicate entrance names so this is no longer necessary @@ -757,7 +767,13 @@ void EntranceTrackerWindow::Draw() { } void EntranceTrackerWindow::DrawElement() { - ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver); + if (presetLoaded) { + ImGui::SetNextWindowSize(presetSize); + ImGui::SetNextWindowPos(presetPos); + presetLoaded = false; + } else { + ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver); + } if (!ImGui::Begin("Entrance Tracker", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h index 4ee33ef62..2d2f7143c 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h @@ -90,6 +90,7 @@ void InitEntranceTrackingData(); s16 GetLastEntranceOverride(); s16 GetCurrentGrottoId(); const EntranceData* GetEntranceData(s16); +void EntranceTracker_LoadFromPreset(nlohmann::json info); class EntranceTrackerSettingsWindow final : public Ship::GuiWindow { public: diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index bd26b1d44..6284d7121 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -375,6 +375,10 @@ uint32_t notesIdleFrames = 0; bool notesNeedSave = false; const uint32_t notesMaxIdleFrames = 40; // two seconds of game time, since OnGameFrameUpdate is used to tick +static bool presetLoaded = false; +static std::unordered_map presetPos; +static std::unordered_map presetSize; + void ItemTrackerOnFrame() { if (notesNeedSave && notesIdleFrames <= notesMaxIdleFrames) { notesIdleFrames++; @@ -398,6 +402,16 @@ bool HasEquipment(ItemTrackerItem item) { return GameInteractor::IsSaveLoaded() ? (item.data & gSaveContext.inventory.equipment) : false; } +void ItemTracker_LoadFromPreset(nlohmann::json trackerInfo) { + presetLoaded = true; + for (auto window : itemTrackerWindowIDs) { + if (trackerInfo.contains(window)) { + presetPos[window] = { trackerInfo[window]["pos"]["x"], trackerInfo[window]["pos"]["y"] }; + presetSize[window] = { trackerInfo[window]["size"]["width"], trackerInfo[window]["size"]["height"] }; + } + } +} + ItemTrackerNumbers GetItemCurrentAndMax(ItemTrackerItem item) { ItemTrackerNumbers result; result.currentCapacity = 0; @@ -1171,6 +1185,12 @@ void BeginFloatingWindows(std::string UniqueName, ImGuiWindowFlags flags = 0) { ImGui::PushStyleColor(ImGuiCol_WindowBg, color); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f); + if (presetLoaded && presetPos.contains(UniqueName)) { + ImGui::SetNextWindowSize(presetSize[UniqueName]); + ImGui::SetNextWindowPos(presetPos[UniqueName]); + presetSize.erase(UniqueName); + presetPos.erase(UniqueName); + } ImGui::Begin(UniqueName.c_str(), nullptr, windowFlags); } void EndFloatingWindows() { @@ -1525,7 +1545,7 @@ void ItemTrackerWindow::DrawElement() { SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) || (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Notes"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW)) { - BeginFloatingWindows("Item Tracker##main window"); + BeginFloatingWindows("Item Tracker"); DrawItemsInRows(mainWindowItems, 6); if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Notes"), SECTION_DISPLAY_HIDDEN) == @@ -1659,6 +1679,10 @@ void ItemTrackerWindow::DrawElement() { EndFloatingWindows(); } } + if (presetLoaded) { + shouldUpdateVectors = true; + presetLoaded = false; + } } static std::unordered_map itemTrackerCapacityTrackOptions = { diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h index 7175baeab..85a2b63a0 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h @@ -25,6 +25,23 @@ bool HasEquipment(ItemTrackerItem); #define ITEM_TRACKER_ITEM_CUSTOM(id, name, nameFaded, data, drawFunc) \ { id, #name, #nameFaded "_Faded", data, drawFunc } +static std::vector itemTrackerWindowIDs = { "Item Tracker", + "Inventory Items Tracker", + "Equipment Items Tracker", + "Misc Items Tracker", + "Dungeon Rewards Tracker", + "Songs Tracker", + "Dungeon Items Tracker", + "Greg Tracker", + "Triforce Piece Tracker", + "Boss Soul Tracker", + "Ocarina Button Tracker", + "Overworld Key Tracker", + "Fishing Pole Tracker", + "Personal Notes", + "Total Checks" }; +void ItemTracker_LoadFromPreset(nlohmann::json trackerInfo); + typedef struct ItemTrackerDungeon { uint32_t id; std::vector items; diff --git a/soh/soh/Enhancements/randomizer/randomizer_settings_window.h b/soh/soh/Enhancements/randomizer/randomizer_settings_window.h index bf1a2a740..87d830e38 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_settings_window.h +++ b/soh/soh/Enhancements/randomizer/randomizer_settings_window.h @@ -13,6 +13,7 @@ class RandomizerSettingsWindow final : public Ship::GuiWindow { void InitElement() override; void DrawElement() override; void UpdateElement() override; + void SetNeedsUpdate(); private: bool mNeedsUpdate = false; diff --git a/soh/soh/SohGui/SohMenu.h b/soh/soh/SohGui/SohMenu.h index 1de142299..c3c3f4fd1 100644 --- a/soh/soh/SohGui/SohMenu.h +++ b/soh/soh/SohGui/SohMenu.h @@ -193,13 +193,6 @@ static const std::unordered_map bootSequenceLabels = { { BOOTSEQUENCE_FILESELECT, "File Select" }, }; -static const std::unordered_map enhancementPresetList = { - { ENHANCEMENT_PRESET_DEFAULT, "Default" }, - { ENHANCEMENT_PRESET_VANILLA_PLUS, "Vanilla Plus" }, - { ENHANCEMENT_PRESET_ENHANCED, "Enhanced" }, - { ENHANCEMENT_PRESET_RANDOMIZER, "Randomizer" }, -}; - class SohMenu : public Ship::Menu { public: SohMenu(const std::string& consoleVariable, const std::string& name); diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 4785da238..4aaf1fb67 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -4,11 +4,9 @@ #include #include #include -#include #include static std::string comboboxTooltip = ""; -static int32_t enhancementPresetSelected = ENHANCEMENT_PRESET_DEFAULT; bool isBetaQuestEnabled = false; static std::unordered_map bunnyHoodEffectMap = { { BUNNY_HOOD_VANILLA, "Vanilla" }, @@ -34,51 +32,8 @@ void SohMenu::AddMenuEnhancements() { // Add Enhancements Menu AddMenuEntry("Enhancements", CVAR_SETTING("Menu.EnhancementsSidebarSection")); - // Enhancements - WidgetPath path = { "Enhancements", "Presets", SECTION_COLUMN_1 }; - AddSidebarEntry("Enhancements", path.sidebarName, 3); - - const PresetTypeDefinition presetTypeDef = presetTypes.at(PRESET_TYPE_ENHANCEMENTS); - for (auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter) { - if (iter->first != 0) - comboboxTooltip += "\n\n"; - comboboxTooltip += std::string(iter->second.label) + " - " + std::string(iter->second.description); - } - AddWidget(path, "Enhancement Presets", WIDGET_SEPARATOR_TEXT); - AddWidget(path, "Select Preset", WIDGET_COMBOBOX) - .ValuePointer(&enhancementPresetSelected) - .Callback([](WidgetInfo& info) { - const std::string presetTypeCvar = - CVAR_GENERAL("SelectedPresets.") + std::to_string(PRESET_TYPE_ENHANCEMENTS); - CVarSetInteger(presetTypeCvar.c_str(), *std::get(info.valuePointer)); - }) - .Options(ComboboxOptions() - .ComboMap(enhancementPresetList) - .DefaultIndex(ENHANCEMENT_PRESET_DEFAULT) - .Tooltip(comboboxTooltip.c_str())); - AddWidget(path, "Apply Preset##Enhancemnts", WIDGET_BUTTON) - .Options(ButtonOptions().Size(UIWidgets::Sizes::Inline)) - .Callback([](WidgetInfo& info) { - const std::string presetTypeCvar = - CVAR_GENERAL("SelectedPresets.") + std::to_string(PRESET_TYPE_ENHANCEMENTS); - const PresetTypeDefinition presetTypeDef = presetTypes.at(PRESET_TYPE_ENHANCEMENTS); - uint16_t selectedPresetId = CVarGetInteger(presetTypeCvar.c_str(), 0); - if (selectedPresetId >= presetTypeDef.presets.size()) { - selectedPresetId = 0; - } - const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(selectedPresetId); - for (const char* block : presetTypeDef.blocksToClear) { - CVarClearBlock(block); - } - if (selectedPresetId != 0) { - applyPreset(selectedPresetDef.entries); - } - CVarSetInteger(presetTypeCvar.c_str(), selectedPresetId); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); - }); - // Quality of Life - path.sidebarName = "Quality of Life"; + WidgetPath path = { "Enhancements", "Quality of Life", SECTION_COLUMN_1 }; AddSidebarEntry("Enhancements", path.sidebarName, 3); path.column = SECTION_COLUMN_1; @@ -289,16 +244,16 @@ void SohMenu::AddMenuEnhancements() { .SameLine(true) .Options(ButtonOptions().Size(Sizes::Inline)) .Callback([](WidgetInfo& info) { - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), false); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard")); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); }); diff --git a/soh/soh/SohGui/SohMenuNetwork.cpp b/soh/soh/SohGui/SohMenuNetwork.cpp index 637c78285..bb6004288 100644 --- a/soh/soh/SohGui/SohMenuNetwork.cpp +++ b/soh/soh/SohGui/SohMenuNetwork.cpp @@ -3,6 +3,7 @@ #include #include #include "SohGui.hpp" +#include "soh/OTRGlobals.h" #include #include diff --git a/soh/soh/SohGui/SohMenuRandomizer.cpp b/soh/soh/SohGui/SohMenuRandomizer.cpp index 8f4e6e43b..b95a8049c 100644 --- a/soh/soh/SohGui/SohMenuRandomizer.cpp +++ b/soh/soh/SohGui/SohMenuRandomizer.cpp @@ -1,5 +1,5 @@ #include "SohMenu.h" -#include +#include "soh/OTRGlobals.h" namespace SohGui { diff --git a/soh/soh/SohGui/SohMenuSettings.cpp b/soh/soh/SohGui/SohMenuSettings.cpp index 909c647bd..23bee56dc 100644 --- a/soh/soh/SohGui/SohMenuSettings.cpp +++ b/soh/soh/SohGui/SohMenuSettings.cpp @@ -1,5 +1,6 @@ #include "SohMenu.h" #include "soh/Notification/Notification.h" +#include "soh/OTRGlobals.h" #include #include "soh/ResourceManagerHelpers.h" #include "UIWidgets.hpp" diff --git a/soh/soh/SohGui/UIWidgets.cpp b/soh/soh/SohGui/UIWidgets.cpp index 3c4e91147..774407583 100644 --- a/soh/soh/SohGui/UIWidgets.cpp +++ b/soh/soh/SohGui/UIWidgets.cpp @@ -204,19 +204,19 @@ bool WindowButton(const char* label, const char* cvarName, std::shared_ptrGetID(label); @@ -317,6 +318,7 @@ bool Checkbox(const char* _label, bool* value, const CheckboxOptions& options) { ImGui::ItemSize(total_bb, style.FramePadding.y); if (!ImGui::ItemAdd(total_bb, id)) { + PopStyleCheckbox(); ImGui::EndDisabled(); return false; } @@ -326,14 +328,13 @@ bool Checkbox(const char* _label, bool* value, const CheckboxOptions& options) { *value = !(*value); ImGui::MarkItemEdited(id); } - PushStyleCheckbox(options.color); ImVec2 checkPos = pos; ImVec2 labelPos = pos; if (options.labelPosition == LabelPositions::Above) { checkPos.y += label_size.y + (style.ItemInnerSpacing.y * 2.0f); } else { // Center with checkbox automatically - labelPos.y += ImGui::CalcTextSize("g").y / 8; + labelPos.y += ImGui::GetStyle().FramePadding.y; } if (options.alignment == ComponentAlignments::Right) { checkPos.x = total_bb.Max.x - square_sz; @@ -762,6 +763,9 @@ bool InputString(const char* label, std::string* value, const InputOptions& opti ImGui::BeginGroup(); ImGui::BeginDisabled(options.disabled); PushStyleInput(options.color); + if (options.hasError) { + ImGui::PushStyleColor(ImGuiCol_Border, ColorValues.at(Colors::Red)); + } float width = (options.size == ImVec2(0, 0)) ? ImGui::GetContentRegionAvail().x : options.size.x; if (options.alignment == ComponentAlignments::Left) { if (options.labelPosition == LabelPositions::Above) { @@ -787,11 +791,17 @@ bool InputString(const char* label, std::string* value, const InputOptions& opti ImGui::SameLine(17.0f); ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 0.4f), "%s", options.placeholder.c_str()); } + if (options.hasError) { + ImGui::PopStyleColor(); + } PopStyleInput(); ImGui::EndDisabled(); ImGui::EndGroup(); - if (options.disabled && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && - !Ship_IsCStringEmpty(options.disabledTooltip)) { + if (options.hasError && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && + !Ship_IsCStringEmpty(options.errorText)) { + ImGui::SetTooltip("%s", WrappedText(options.errorText).c_str()); + } else if (options.disabled && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && + !Ship_IsCStringEmpty(options.disabledTooltip)) { ImGui::SetTooltip("%s", WrappedText(options.disabledTooltip).c_str()); } else if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && !Ship_IsCStringEmpty(options.tooltip)) { ImGui::SetTooltip("%s", WrappedText(options.tooltip).c_str()); @@ -1018,7 +1028,7 @@ bool CVarRadioButton(const char* text, const char* cvarName, int32_t id, const R std::string make_invisible = "##" + std::string(text) + std::string(cvarName); bool ret = false; - int val = CVarGetInteger(cvarName, 0); + int val = CVarGetInteger(cvarName, options.defaultIndex); PushStyleCheckbox(options.color); if (ImGui::RadioButton(make_invisible.c_str(), id == val)) { CVarSetInteger(cvarName, id); diff --git a/soh/soh/SohGui/UIWidgets.hpp b/soh/soh/SohGui/UIWidgets.hpp index 0008b4cfa..caf2e912b 100644 --- a/soh/soh/SohGui/UIWidgets.hpp +++ b/soh/soh/SohGui/UIWidgets.hpp @@ -194,6 +194,7 @@ struct CheckboxOptions : WidgetOptions { bool defaultValue = false; // Only applicable to CVarCheckbox ComponentAlignments alignment = ComponentAlignments::Left; LabelPositions labelPosition = LabelPositions::Near; + ImVec2 padding = ImVec2(10.0f, 8.0f); Colors color = Colors::LightBlue; CheckboxOptions& DefaultValue(bool defaultValue_) { @@ -220,6 +221,10 @@ struct CheckboxOptions : WidgetOptions { WidgetOptions::disabledTooltip = disabledTooltip_; return *this; } + CheckboxOptions& Padding(ImVec2 padding_) { + padding = padding_; + return *this; + } }; struct ComboboxOptions : WidgetOptions { @@ -394,6 +399,7 @@ struct FloatSliderOptions : WidgetOptions { struct RadioButtonsOptions : WidgetOptions { std::unordered_map buttonMap; + int32_t defaultIndex = 0; Colors color = Colors::LightBlue; RadioButtonsOptions& ButtonMap(std::unordered_map buttonMap_) { @@ -408,6 +414,10 @@ struct RadioButtonsOptions : WidgetOptions { color = color_; return *this; } + RadioButtonsOptions& DefaultIndex(int32_t defaultIndex_) { + defaultIndex = defaultIndex_; + return *this; + } }; struct InputOptions : WidgetOptions { @@ -420,6 +430,8 @@ struct InputOptions : WidgetOptions { std::string defaultValue = ""; bool secret = false; ImGuiInputFlags addedFlags = 0; + bool hasError = false; + const char* errorText = ""; InputOptions& Tooltip(const char* tooltip_) { WidgetOptions::tooltip = tooltip_; @@ -454,6 +466,11 @@ struct InputOptions : WidgetOptions { return *this; } + InputOptions& ComponentAlignment(ComponentAlignments alignment_) { + alignment = alignment_; + return *this; + } + InputOptions& DefaultValue(std::string defaultValue_) { defaultValue = defaultValue_; return *this; @@ -463,6 +480,16 @@ struct InputOptions : WidgetOptions { secret = secret_; return *this; } + + InputOptions& HasError(bool error_ = false) { + hasError = error_; + return *this; + } + + InputOptions& ErrorText(const char* errorText_) { + errorText = errorText_; + return *this; + } }; void PushStyleMenu(const ImVec4& color); @@ -482,8 +509,8 @@ bool Button(const char* label, const ButtonOptions& options = {}); bool WindowButton(const char* label, const char* cvarName, std::shared_ptr windowPtr, const WindowButtonOptions& options = {}); -void PushStyleCheckbox(const ImVec4& color); -void PushStyleCheckbox(Colors color = Colors::LightBlue); +void PushStyleCheckbox(const ImVec4& color, ImVec2 padding = ImVec2(10.0f, 6.0f)); +void PushStyleCheckbox(Colors color = Colors::LightBlue, ImVec2 padding = ImVec2(10.0f, 6.0f)); void PopStyleCheckbox(); void RenderText(ImVec2 pos, const char* text, const char* text_end, bool hide_text_after_hash); bool Checkbox(const char* label, bool* v, const CheckboxOptions& options = {}); From f2298c6a8edd99d6a9b9a027f83a487c66dc11bc Mon Sep 17 00:00:00 2001 From: TheLynk <44308308+TheLynk@users.noreply.github.com> Date: Sat, 24 May 2025 00:37:30 +0200 Subject: [PATCH 13/13] Add Two New Tricks "Navi dive" (#5477) * add navi dive bottom of the well * add kokiri sword logic for botw * Optimisation Logic * Add Navi Dive Lost Wood * Update Logic * Move IsChild in logic trick * Add brackets * Clang-Format * Tweak Text Tweak Text * Final Push ? * It's really the last push --- .../randomizer/location_access/overworld/kakariko.cpp | 2 +- .../randomizer/location_access/overworld/lost_woods.cpp | 2 +- soh/soh/Enhancements/randomizer/randomizerTypes.h | 2 ++ soh/soh/Enhancements/randomizer/settings.cpp | 5 +++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/kakariko.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/kakariko.cpp index 056767cee..eec9d9248 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/kakariko.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/kakariko.cpp @@ -66,7 +66,7 @@ void RegionTable_Init_Kakariko() { Entrance(RR_KAK_WINDMILL, []{return logic->CanOpenOverworldDoor(RG_WINDMILL_KEY);}), Entrance(RR_KAK_BAZAAR, []{return logic->IsAdult && logic->AtDay && logic->CanOpenOverworldDoor(RG_KAK_BAZAAR_KEY);}), Entrance(RR_KAK_SHOOTING_GALLERY, []{return logic->IsAdult && logic->AtDay && logic->CanOpenOverworldDoor(RG_KAK_SHOOTING_GALLERY_KEY);}), - Entrance(RR_KAK_WELL, []{return logic->IsAdult || logic->DrainWell || logic->CanUse(RG_IRON_BOOTS);}), + Entrance(RR_KAK_WELL, []{return logic->IsAdult || logic->DrainWell || logic->CanUse(RG_IRON_BOOTS) || (ctx->GetTrickOption(RT_BOTTOM_OF_THE_WELL_NAVI_DIVE) && logic->IsChild && logic->HasItem(RG_BRONZE_SCALE) && logic->CanJumpslash());}), Entrance(RR_KAK_POTION_SHOP_FRONT, []{return (logic->AtDay || logic->IsChild) && logic->CanOpenOverworldDoor(RG_KAK_POTION_SHOP_KEY);}), Entrance(RR_KAK_REDEAD_GROTTO, []{return logic->CanOpenBombGrotto();}), Entrance(RR_KAK_IMPAS_LEDGE, []{return (logic->IsChild && logic->AtDay) || (logic->IsAdult && ctx->GetTrickOption(RT_VISIBLE_COLLISION));}), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/lost_woods.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/lost_woods.cpp index 569cbf3e6..56ad88df4 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/lost_woods.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/lost_woods.cpp @@ -57,7 +57,7 @@ void RegionTable_Init_LostWoods() { Entrance(RR_LW_FOREST_EXIT, []{return true;}), Entrance(RR_GC_WOODS_WARP, []{return true;}), Entrance(RR_LW_BRIDGE, []{return logic->CanLeaveForest() && ((logic->IsAdult && (CanPlantBean(RR_THE_LOST_WOODS) || ctx->GetTrickOption(RT_LW_BRIDGE))) || logic->CanUse(RG_HOVER_BOOTS) || logic->CanUse(RG_LONGSHOT));}), - Entrance(RR_ZORAS_RIVER, []{return logic->CanLeaveForest() && (logic->HasItem(RG_SILVER_SCALE) || logic->CanUse(RG_IRON_BOOTS));}), + Entrance(RR_ZORAS_RIVER, []{return logic->CanLeaveForest() && (logic->HasItem(RG_SILVER_SCALE) || logic->CanUse(RG_IRON_BOOTS) || (ctx->GetTrickOption(RT_BOTTOM_OF_THE_WELL_NAVI_DIVE) && logic->IsChild && logic->HasItem(RG_BRONZE_SCALE) && logic->CanJumpslash()));}), Entrance(RR_LW_BEYOND_MIDO, []{return logic->IsChild || logic->CanUse(RG_SARIAS_SONG) || ctx->GetTrickOption(RT_LW_MIDO_BACKFLIP);}), Entrance(RR_LW_NEAR_SHORTCUTS_GROTTO, []{return Here(RR_THE_LOST_WOODS, []{return logic->BlastOrSmash();});}), }); diff --git a/soh/soh/Enhancements/randomizer/randomizerTypes.h b/soh/soh/Enhancements/randomizer/randomizerTypes.h index 31002d16f..941402dbb 100644 --- a/soh/soh/Enhancements/randomizer/randomizerTypes.h +++ b/soh/soh/Enhancements/randomizer/randomizerTypes.h @@ -3697,6 +3697,8 @@ typedef enum { RT_MEGASIDEHOP_BOMB, RT_MEGASIDEHOP_BOMBCHU, RT_NAVI_DIVE, + RT_BOTTOM_OF_THE_WELL_NAVI_DIVE, + RT_LOST_WOOD_NAVI_DIVE, RT_OCARINA_ITEMS, RT_OCARINA_ITEMS_BOMB, RT_OCARINA_ITEMS_ESS, diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp index 7ca0aa82e..d94df9ae5 100644 --- a/soh/soh/Enhancements/randomizer/settings.cpp +++ b/soh/soh/Enhancements/randomizer/settings.cpp @@ -410,6 +410,8 @@ void Settings::CreateOptions() { "Hover Boots, or Bean."); OPT_TRICK(RT_LW_MIDO_BACKFLIP, RCQUEST_BOTH, RA_THE_LOST_WOODS, { Tricks::Tag::NOVICE }, "Backflip over Mido as Adult", "With a specific position and angle, you can backflip over Mido."); + OPT_TRICK(RT_LOST_WOOD_NAVI_DIVE, RCQUEST_BOTH, RA_THE_LOST_WOODS, { Tricks::Tag::NOVICE }, "Lost Woods Navi dive", + "You need Deku Sticks or Kokiri Sword to dive with Navi for entering Zora's River."); OPT_TRICK(RT_LW_GS_BEAN, RCQUEST_BOTH, RA_THE_LOST_WOODS, { Tricks::Tag::INTERMEDIATE }, "Lost Woods Adult GS without Bean", "You can collect the token with a precise Hookshot use, as long as you can kill the Skulltula somehow " @@ -705,6 +707,9 @@ void Settings::CreateOptions() { OPT_TRICK(RT_LENS_BOTW, RCQUEST_VANILLA, RA_BOTTOM_OF_THE_WELL, { Tricks::Tag::NOVICE }, "Bottom of the Well without Lens of Truth", "Removes the requirements for the Lens of Truth in Bottom of the Well."); + OPT_TRICK(RT_BOTTOM_OF_THE_WELL_NAVI_DIVE, RCQUEST_BOTH, RA_BOTTOM_OF_THE_WELL, { Tricks::Tag::NOVICE }, + "Bottom of the Well Navi dive", + "You need Deku Sticks or Kokiri Sword to dive with Navi for entering Bottom of the Well."); OPT_TRICK(RT_BOTW_CHILD_DEADHAND, RCQUEST_BOTH, RA_BOTTOM_OF_THE_WELL, { Tricks::Tag::NOVICE }, "Child Dead Hand without Kokiri Sword", "Requires 9 sticks or 5 jump slashes."); OPT_TRICK(RT_BOTW_BASEMENT, RCQUEST_VANILLA, RA_BOTTOM_OF_THE_WELL, { Tricks::Tag::NOVICE },