From 9ef6ce3af8757314a10a8818d836b42e95bfa0b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Andr=C3=A9asson?= Date: Thu, 16 Jan 2025 03:48:21 +0100 Subject: [PATCH] * renamed option and types to 'GRASSANITY' * changed grassnity to be a combobox option * added first 5 deku tree locations --- .../randomizer/3drando/item_pool.cpp | 10 +++++----- soh/soh/Enhancements/randomizer/ShuffleGrass.cpp | 11 +++++------ soh/soh/Enhancements/randomizer/context.cpp | 4 ++-- soh/soh/Enhancements/randomizer/dungeon.cpp | 6 ++++++ .../Enhancements/randomizer/hook_handlers.cpp | 2 +- .../location_access/dungeons/deku_tree.cpp | 5 +++++ .../randomizer/option_descriptions.cpp | 12 +++++++++++- .../Enhancements/randomizer/randomizerTypes.h | 2 +- .../randomizer/randomizer_check_tracker.cpp | 16 ++++++++++++++-- soh/soh/Enhancements/randomizer/settings.cpp | 4 ++-- 10 files changed, 52 insertions(+), 20 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp b/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp index fb1f010c8..61662658d 100644 --- a/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp @@ -931,11 +931,11 @@ void GenerateItemPool() { PlaceItemsForType(RCTYPE_POT, overworldPotsActive, dungeonPotsActive, false); } - // Shuffle Grass - bool overworldGrassActive = ctx->GetOption(RSK_SHUFFLE_GRASS).Is(RO_SHUFFLE_GRASS_OVERWORLD) || - ctx->GetOption(RSK_SHUFFLE_GRASS).Is(RO_SHUFFLE_GRASS_ALL); - bool dungeonGrassActive = ctx->GetOption(RSK_SHUFFLE_GRASS).Is(RO_SHUFFLE_GRASS_DUNGEONS) || - ctx->GetOption(RSK_SHUFFLE_GRASS).Is(RO_SHUFFLE_GRASS_ALL); + // Grassanity + bool overworldGrassActive = ctx->GetOption(RSK_GRASSANITY).Is(RO_SHUFFLE_GRASS_OVERWORLD) || + ctx->GetOption(RSK_GRASSANITY).Is(RO_SHUFFLE_GRASS_ALL); + bool dungeonGrassActive = ctx->GetOption(RSK_GRASSANITY).Is(RO_SHUFFLE_GRASS_DUNGEONS) || + ctx->GetOption(RSK_GRASSANITY).Is(RO_SHUFFLE_GRASS_ALL); if (overworldGrassActive || dungeonGrassActive) { PlaceItemsForType(RCTYPE_GRASS, overworldGrassActive, dungeonGrassActive, false); } diff --git a/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp b/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp index d0f4cd596..382501921 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp @@ -19,8 +19,7 @@ extern "C" void EnKusa_RandomizerDraw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL_25Opa(play->state.gfxCtx); Matrix_Scale(grassSize, grassSize, grassSize, MTXMODE_APPLY); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 255, 0, 255); - gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 255, 0, 255); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); @@ -35,12 +34,12 @@ extern "C" void EnKusa_RandomizerDraw(Actor* thisx, PlayState* play) { uint8_t EnKusa_RandomizerHoldsItem(EnKusa* grassActor, PlayState* play) { RandomizerCheck rc = grassActor->grassIdentity.randomizerCheck; - //uint8_t isDungeon = Rando::StaticData::GetLocation(rc)->IsDungeon(); - //uint8_t potSetting = Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_POTS).GetContextOptionIndex(); + uint8_t isDungeon = Rando::StaticData::GetLocation(rc)->IsDungeon(); + uint8_t grassSetting = Rando::Context::GetInstance()->GetOption(RSK_GRASSANITY).GetContextOptionIndex(); // Don't pull randomized item if pot isn't randomized or is already checked - if (!IS_RANDO || /*(potSetting == RO_SHUFFLE_POTS_OVERWORLD && isDungeon) ||*/ - /*(potSetting == RO_SHUFFLE_POTS_DUNGEONS && !isDungeon) ||*/ + if (!IS_RANDO || (grassSetting == RO_SHUFFLE_GRASS_OVERWORLD && isDungeon) || + (grassSetting == RO_SHUFFLE_GRASS_DUNGEONS && !isDungeon) || Flags_GetRandomizerInf(grassActor->grassIdentity.randomizerInf) || grassActor->grassIdentity.randomizerCheck == RC_UNKNOWN_CHECK) { return false; diff --git a/soh/soh/Enhancements/randomizer/context.cpp b/soh/soh/Enhancements/randomizer/context.cpp index 60645220c..ca83e92e4 100644 --- a/soh/soh/Enhancements/randomizer/context.cpp +++ b/soh/soh/Enhancements/randomizer/context.cpp @@ -144,8 +144,8 @@ void Context::GenerateLocationPool() { AddLocations(StaticData::GetOverworldPotLocations()); } - if (mSettings->GetOption(RSK_SHUFFLE_GRASS).Is(RO_SHUFFLE_GRASS_OVERWORLD) || - mSettings->GetOption(RSK_SHUFFLE_GRASS).Is(RO_SHUFFLE_GRASS_ALL)) { + if (mSettings->GetOption(RSK_GRASSANITY).Is(RO_SHUFFLE_GRASS_OVERWORLD) || + mSettings->GetOption(RSK_GRASSANITY).Is(RO_SHUFFLE_GRASS_ALL)) { AddLocations(StaticData::GetOverworldGrassLocations()); } diff --git a/soh/soh/Enhancements/randomizer/dungeon.cpp b/soh/soh/Enhancements/randomizer/dungeon.cpp index 90a220915..347e0a3e9 100644 --- a/soh/soh/Enhancements/randomizer/dungeon.cpp +++ b/soh/soh/Enhancements/randomizer/dungeon.cpp @@ -155,6 +155,11 @@ std::vector DungeonInfo::GetDungeonLocations() const { auto potLocations = masterQuest ? mqPots : vanillaPots; AddElementsToPool(locations, potLocations); } + if (Context::GetInstance()->GetSettings()->GetOption(RSK_GRASSANITY).Is(RO_SHUFFLE_GRASS_DUNGEONS) || + Context::GetInstance()->GetSettings()->GetOption(RSK_GRASSANITY).Is(RO_SHUFFLE_GRASS_ALL)) { + auto grassLocations = masterQuest ? mqGrass : vanillaGrass; + AddElementsToPool(locations, grassLocations); + } AddElementsToPool(locations, sharedLocations); AddElementsToPool(locations, bossRoomLocations); return locations; @@ -221,6 +226,7 @@ Dungeons::Dungeons() { RC_DEKU_TREE_LOBBY_GRASS_2, RC_DEKU_TREE_LOBBY_GRASS_3, RC_DEKU_TREE_LOBBY_GRASS_4, + RC_DEKU_TREE_LOBBY_GRASS_5, }, { // MQ Grass diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 77e50effe..01dffdf2b 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -2492,7 +2492,7 @@ void RandomizerRegisterHooks() { ShuffleFairies_RegisterHooks(); } - if (RAND_GET_OPTION(RSK_SHUFFLE_GRASS)) { + if (RAND_GET_OPTION(RSK_GRASSANITY)) { shuffleGrassOnActorInitHook = GameInteractor::Instance->RegisterGameHook(EnKusa_RandomizerInit); shuffleGrassOnVanillaBehaviorHook = GameInteractor::Instance->RegisterGameHook(ShuffleGrass_OnVanillaBehaviorHandler); } diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/deku_tree.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/deku_tree.cpp index 9d3febe36..d62e68a98 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/deku_tree.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/deku_tree.cpp @@ -24,6 +24,11 @@ void RegionTable_Init_DekuTree() { LOCATION(RC_DEKU_TREE_MAP_CHEST, true), LOCATION(RC_DEKU_TREE_LOBBY_LOWER_HEART, true), LOCATION(RC_DEKU_TREE_LOBBY_UPPER_HEART, logic->CanPassEnemy(RE_BIG_SKULLTULA)), + LOCATION(RC_DEKU_TREE_LOBBY_GRASS_1, logic->CanCutShrubs()), + LOCATION(RC_DEKU_TREE_LOBBY_GRASS_2, logic->CanCutShrubs()), + LOCATION(RC_DEKU_TREE_LOBBY_GRASS_3, logic->CanCutShrubs()), + LOCATION(RC_DEKU_TREE_LOBBY_GRASS_4, logic->CanCutShrubs()), + LOCATION(RC_DEKU_TREE_LOBBY_GRASS_5, logic->CanCutShrubs()), }, { //Exits Entrance(RR_DEKU_TREE_ENTRYWAY, []{return true;}), diff --git a/soh/soh/Enhancements/randomizer/option_descriptions.cpp b/soh/soh/Enhancements/randomizer/option_descriptions.cpp index a8ad6c499..56e648a25 100644 --- a/soh/soh/Enhancements/randomizer/option_descriptions.cpp +++ b/soh/soh/Enhancements/randomizer/option_descriptions.cpp @@ -448,7 +448,17 @@ void Settings::CreateOptionDescriptions() { "All Items - Shuffle all freestanding rupees & hearts."; mOptionDescriptions[RSK_SHUFFLE_FAIRIES] = "Shuffle fairy locations."; - mOptionDescriptions[RSK_SHUFFLE_GRASS] = "Shuffle grass patches."; + mOptionDescriptions[RSK_GRASSANITY] = + "Grass/Bushes will drop a randomized item the first time they're cut and collected. " + "Grass/Bushes will have a different appearance when they hold a randomized item.\n" + "\n" + "Off - Grass/Bushes will not be shuffled.\n" + "\n" + "Dungeons - Only shuffle grass/bushes that are within dungeons.\n" + "\n" + "Overworld - Only shuffle grass/bushes that are outside of dungeons.\n" + "\n" + "All Grass/Bushes - Shuffle all grass/bushes."; mOptionDescriptions[RSK_SHUFFLE_DUNGEON_REWARDS] = "Shuffles the location of Spiritual Stones and medallions.\n" "\n" diff --git a/soh/soh/Enhancements/randomizer/randomizerTypes.h b/soh/soh/Enhancements/randomizer/randomizerTypes.h index f7534a382..4d64a3ad0 100644 --- a/soh/soh/Enhancements/randomizer/randomizerTypes.h +++ b/soh/soh/Enhancements/randomizer/randomizerTypes.h @@ -5504,7 +5504,7 @@ typedef enum { RSK_SHUFFLE_DEKU_NUT_BAG, RSK_SHUFFLE_FREESTANDING, RSK_SHUFFLE_FAIRIES, - RSK_SHUFFLE_GRASS, + RSK_GRASSANITY, RSK_MAX } RandomizerSettingKey; diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index ce228fecf..6e7a3a003 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -1236,11 +1236,23 @@ void LoadSettings() { break; } - switch (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_GRASS)) { - default: + switch (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GRASSANITY)) { + case RO_SHUFFLE_GRASS_ALL: showOverworldGrass = true; showDungeonGrass = true; break; + case RO_SHUFFLE_GRASS_OVERWORLD: + showOverworldGrass = true; + showDungeonGrass = false; + break; + case RO_SHUFFLE_GRASS_DUNGEONS: + showOverworldGrass = false; + showDungeonGrass = true; + break; + default: + showOverworldGrass = false; + showDungeonGrass = false; + break; } } else { // Vanilla showOverworldTokens = true; diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp index abdaa879c..72750bd19 100644 --- a/soh/soh/Enhancements/randomizer/settings.cpp +++ b/soh/soh/Enhancements/randomizer/settings.cpp @@ -227,7 +227,7 @@ void Settings::CreateOptions() { mOptions[RSK_FISHSANITY_POND_COUNT] = Option::U8("Pond Fish Count", {NumOpts(0,17,1)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("FishsanityPondCount"), mOptionDescriptions[RSK_FISHSANITY_POND_COUNT], WidgetType::Slider, 0, true, IMFLAG_NONE); mOptions[RSK_FISHSANITY_AGE_SPLIT] = Option::Bool("Pond Age Split", CVAR_RANDOMIZER_SETTING("FishsanityAgeSplit"), mOptionDescriptions[RSK_FISHSANITY_AGE_SPLIT]); mOptions[RSK_SHUFFLE_FAIRIES] = Option::Bool("Shuffle Fairies", CVAR_RANDOMIZER_SETTING("ShuffleFairies"), mOptionDescriptions[RSK_SHUFFLE_FAIRIES]); - mOptions[RSK_SHUFFLE_GRASS] = Option::Bool("Shuffle Grass", CVAR_RANDOMIZER_SETTING("ShuffleGrass"), mOptionDescriptions[RSK_SHUFFLE_GRASS]); + mOptions[RSK_GRASSANITY] = Option::U8("Grassanity", {"Off", "Dungeons", "Overworld", "All Grass/Bushes"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("Grassanity"), mOptionDescriptions[RSK_GRASSANITY], WidgetType::Combobox, RO_SHUFFLE_GRASS_OFF); mOptions[RSK_SHUFFLE_MAPANDCOMPASS] = Option::U8("Maps/Compasses", {"Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), mOptionDescriptions[RSK_SHUFFLE_MAPANDCOMPASS], WidgetType::Combobox, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON); mOptions[RSK_KEYSANITY] = Option::U8("Small Key Shuffle", {"Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("Keysanity"), mOptionDescriptions[RSK_KEYSANITY], WidgetType::Combobox, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON); mOptions[RSK_GERUDO_KEYS] = Option::U8("Gerudo Fortress Keys", {"Vanilla", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("GerudoKeys"), mOptionDescriptions[RSK_GERUDO_KEYS], WidgetType::Combobox, RO_GERUDO_KEYS_VANILLA); @@ -795,7 +795,6 @@ void Settings::CreateOptions() { &mOptions[RSK_SHUFFLE_DEKU_STICK_BAG], &mOptions[RSK_SHUFFLE_DEKU_NUT_BAG], &mOptions[RSK_SHUFFLE_FREESTANDING], - &mOptions[RSK_SHUFFLE_GRASS], }, WidgetContainerType::COLUMN); mOptionGroups[RSG_SHUFFLE_NPCS_IMGUI] = OptionGroup::SubGroup("Shuffle NPCs & Merchants", { &mOptions[RSK_SHOPSANITY], @@ -843,6 +842,7 @@ void Settings::CreateOptions() { &mOptions[RSK_SHUFFLE_100_GS_REWARD], &mOptions[RSK_SHUFFLE_BOSS_SOULS], &mOptions[RSK_SHUFFLE_FAIRIES], + &mOptions[RSK_GRASSANITY], }, WidgetContainerType::COLUMN); mOptionGroups[RSG_SHUFFLE_DUNGEON_ITEMS_IMGUI] = OptionGroup::SubGroup("Shuffle Dungeon Items", { &mOptions[RSK_SHUFFLE_DUNGEON_REWARDS],