From 6576bd49df6b6507a1a9579c4741bc45a122a13b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Andr=C3=A9asson?= Date: Sat, 18 Jan 2025 17:55:54 +0100 Subject: [PATCH] Seperated the 2 KF bushes into 4 checks --- soh/soh/Enhancements/randomizer/grassanity.cpp | 2 +- .../location_access/overworld/kokiri_forest.cpp | 2 ++ soh/soh/Enhancements/randomizer/location_list.cpp | 8 ++++---- soh/soh/Enhancements/randomizer/randomizer.cpp | 15 ++++++++++----- soh/soh/Enhancements/randomizer/randomizer.h | 2 +- soh/soh/Enhancements/randomizer/randomizerTypes.h | 4 ++-- soh/soh/Enhancements/randomizer/randomizer_inf.h | 4 ++-- 7 files changed, 22 insertions(+), 15 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/grassanity.cpp b/soh/soh/Enhancements/randomizer/grassanity.cpp index f04d7f425..47508dd4f 100644 --- a/soh/soh/Enhancements/randomizer/grassanity.cpp +++ b/soh/soh/Enhancements/randomizer/grassanity.cpp @@ -70,7 +70,7 @@ void EnKusa_RandomizerInit(void* actorRef) { EnKusa* grassActor = static_cast(actorRef); s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1); - grassActor->grassIdentity = OTRGlobals::Instance->gRandomizer->IdentifyGrass(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, respawnData); + grassActor->grassIdentity = OTRGlobals::Instance->gRandomizer->IdentifyGrass(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, respawnData, gPlayState->linkAgeOnLoad); } void ShuffleGrass_OnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_list originalArgs) { diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/kokiri_forest.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/kokiri_forest.cpp index 81c2fac1d..812e1888d 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/kokiri_forest.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/kokiri_forest.cpp @@ -72,6 +72,8 @@ void RegionTable_Init_KokiriForest() { LOCATION(RC_KF_ADULT_GRASS_16, logic->IsAdult && logic->CanCutShrubs()), LOCATION(RC_KF_ADULT_GRASS_17, logic->IsAdult && logic->CanCutShrubs()), LOCATION(RC_KF_ADULT_GRASS_18, logic->IsAdult && logic->CanCutShrubs()), + LOCATION(RC_KF_ADULT_GRASS_19, logic->IsAdult && logic->CanCutShrubs()), + LOCATION(RC_KF_ADULT_GRASS_20, logic->IsAdult && logic->CanCutShrubs()), }, { //Exits Entrance(RR_KF_LINKS_HOUSE, []{return true;}), diff --git a/soh/soh/Enhancements/randomizer/location_list.cpp b/soh/soh/Enhancements/randomizer/location_list.cpp index 600e515fc..01871cc8b 100644 --- a/soh/soh/Enhancements/randomizer/location_list.cpp +++ b/soh/soh/Enhancements/randomizer/location_list.cpp @@ -1074,8 +1074,8 @@ void Rando::StaticData::InitLocationTable() { // locationTable[RC_KF_CHILD_GRASS_2] = Location::Grass(RC_KF_CHILD_GRASS_2, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(594, 542), "KF Child Grass 2", "KF Child Grass 2", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_CHILD_GRASS_2)); locationTable[RC_KF_CHILD_GRASS_3] = Location::Grass(RC_KF_CHILD_GRASS_3, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(572, 603), "KF Child Grass 3", "KF Child Grass 3", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_CHILD_GRASS_3)); locationTable[RC_KF_CHILD_GRASS_4] = Location::Grass(RC_KF_CHILD_GRASS_4, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(385, 643), "KF Child Grass 4", "KF Child Grass 4", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_CHILD_GRASS_4)); - locationTable[RC_KF_CHILD_GRASS_5] = Location::Grass(RC_KF_CHILD_GRASS_5, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-498, 696), "KF Child/Adult Grass 5", "KF Child/Adult Grass 5", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_CHILD_GRASS_5)); - locationTable[RC_KF_CHILD_GRASS_6] = Location::Grass(RC_KF_CHILD_GRASS_6, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-523, 771), "KF Child/Adult Grass 6", "KF Child/Adult Grass 6", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_CHILD_GRASS_6)); + locationTable[RC_KF_CHILD_GRASS_5] = Location::Grass(RC_KF_CHILD_GRASS_5, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-498, 696), "KF Child Grass 5", "KF Child Grass 5", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_CHILD_GRASS_5)); + locationTable[RC_KF_CHILD_GRASS_6] = Location::Grass(RC_KF_CHILD_GRASS_6, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-523, 771), "KF Child Grass 6", "KF Child Grass 6", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_CHILD_GRASS_6)); locationTable[RC_KF_CHILD_GRASS_7] = Location::Grass(RC_KF_CHILD_GRASS_7, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-612, 737), "KF Child Grass 7", "KF Child Grass 7", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_CHILD_GRASS_7)); locationTable[RC_KF_CHILD_GRASS_8] = Location::Grass(RC_KF_CHILD_GRASS_8, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-671, 671), "KF Child Grass 8", "KF Child Grass 8", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_CHILD_GRASS_8)); locationTable[RC_KF_CHILD_GRASS_9] = Location::Grass(RC_KF_CHILD_GRASS_9, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-748, 632), "KF Child Grass 9", "KF Child Grass 9", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_CHILD_GRASS_9)); @@ -1103,8 +1103,8 @@ void Rando::StaticData::InitLocationTable() { // locationTable[RC_KF_ADULT_GRASS_16] = Location::Grass(RC_KF_ADULT_GRASS_16, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-822, 644), "KF Adult Grass 16", "KF Adult Grass 16", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_ADULT_GRASS_16)); locationTable[RC_KF_ADULT_GRASS_17] = Location::Grass(RC_KF_ADULT_GRASS_17, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-842, 601), "KF Adult Grass 17", "KF Adult Grass 17", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_ADULT_GRASS_17)); locationTable[RC_KF_ADULT_GRASS_18] = Location::Grass(RC_KF_ADULT_GRASS_18, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-867, 674), "KF Adult Grass 18", "KF Adult Grass 18", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_ADULT_GRASS_18)); - //locationTable[RC_KF_ADULT_GRASS_19] = Location::Grass(RC_KF_ADULT_GRASS_19, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-498, 696), "KF Adult Grass 19", "KF Adult Grass 19", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_ADULT_GRASS_19)); - //locationTable[RC_KF_ADULT_GRASS_20] = Location::Grass(RC_KF_ADULT_GRASS_20, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-523, 771), "KF Adult Grass 20", "KF Adult Grass 29", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_ADULT_GRASS_20)); + locationTable[RC_KF_ADULT_GRASS_19] = Location::Grass(RC_KF_ADULT_GRASS_19, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-498, 0xFF), "KF Adult Grass 19", "KF Adult Grass 19", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_ADULT_GRASS_19)); + locationTable[RC_KF_ADULT_GRASS_20] = Location::Grass(RC_KF_ADULT_GRASS_20, RCQUEST_BOTH, RCAREA_KOKIRI_FOREST, SCENE_KOKIRI_FOREST, TWO_ACTOR_PARAMS(-523, 0xFF), "KF Adult Grass 20", "KF Adult Grass 29", RHT_KF_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_KF_ADULT_GRASS_20)); locationTable[RC_LW_GRASS_1] = Location::Grass(RC_LW_GRASS_1, RCQUEST_BOTH, RCAREA_LOST_WOODS, SCENE_LOST_WOODS, TWO_ACTOR_PARAMS(676, -651), "LW Grass 1", "LW Grass 1", RHT_LW_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_LW_GRASS_1)); locationTable[RC_LW_GRASS_2] = Location::Grass(RC_LW_GRASS_2, RCQUEST_BOTH, RCAREA_LOST_WOODS, SCENE_LOST_WOODS, TWO_ACTOR_PARAMS(633, -676), "LW Grass 2", "LW Grass 2", RHT_LW_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_LW_GRASS_2)); locationTable[RC_LW_GRASS_3] = Location::Grass(RC_LW_GRASS_3, RCQUEST_BOTH, RCAREA_LOST_WOODS, SCENE_LOST_WOODS, TWO_ACTOR_PARAMS(645, -638), "LW Grass 3", "LW Grass 3", RHT_LW_GRASS, RG_GREEN_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_LW_GRASS_3)); diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index ed5820443..6577a1a0a 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1040,8 +1040,8 @@ std::map rcToRandomizerInf = { { RC_KF_ADULT_GRASS_16, RAND_INF_KF_ADULT_GRASS_16 }, { RC_KF_ADULT_GRASS_17, RAND_INF_KF_ADULT_GRASS_17 }, { RC_KF_ADULT_GRASS_18, RAND_INF_KF_ADULT_GRASS_18 }, - //{ RC_KF_ADULT_GRASS_19, RAND_INF_KF_ADULT_GRASS_19 }, - //{ RC_KF_ADULT_GRASS_20, RAND_INF_KF_ADULT_GRASS_20 }, + { RC_KF_ADULT_GRASS_19, RAND_INF_KF_ADULT_GRASS_19 }, + { RC_KF_ADULT_GRASS_20, RAND_INF_KF_ADULT_GRASS_20 }, { RC_LW_GRASS_1, RAND_INF_LW_GRASS_1 }, { RC_LW_GRASS_2, RAND_INF_LW_GRASS_2 }, { RC_LW_GRASS_3, RAND_INF_LW_GRASS_3 }, @@ -2190,21 +2190,26 @@ FishIdentity Randomizer::IdentifyFish(s32 sceneNum, s32 actorParams) { return fishIdentity; } -GrassIdentity Randomizer::IdentifyGrass(s32 sceneNum, s32 posX, s32 posZ, s32 respawnData) { +GrassIdentity Randomizer::IdentifyGrass(s32 sceneNum, s32 posX, s32 posZ, s32 respawnData, s32 linkAge) { struct GrassIdentity grassIdentity; grassIdentity.randomizerInf = RAND_INF_MAX; grassIdentity.randomizerCheck = RC_UNKNOWN_CHECK; - //s32 actorParams = TWO_ACTOR_PARAMS(posX, posZ); - if (sceneNum == SCENE_GROTTOS) { respawnData = TWO_ACTOR_PARAMS(posX, respawnData); } else { + // We'll just pretend it's always daytime for our market bushes. if (sceneNum == SCENE_MARKET_NIGHT) { sceneNum = SCENE_MARKET_DAY; } + if (sceneNum == SCENE_KOKIRI_FOREST && linkAge == 0) { + if (posX == -498 || posX == -523) { + posZ = 0xFF; + } + } + respawnData = TWO_ACTOR_PARAMS(posX, posZ); } diff --git a/soh/soh/Enhancements/randomizer/randomizer.h b/soh/soh/Enhancements/randomizer/randomizer.h index b9c76c1da..13718dac4 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.h +++ b/soh/soh/Enhancements/randomizer/randomizer.h @@ -54,7 +54,7 @@ class Randomizer { CowIdentity IdentifyCow(s32 sceneNum, s32 posX, s32 posZ); PotIdentity IdentifyPot(s32 sceneNum, s32 posX, s32 posZ); FishIdentity IdentifyFish(s32 sceneNum, s32 actorParams); - GrassIdentity IdentifyGrass(s32 sceneNum, s32 posX, s32 posZ, s32 respawnData); + GrassIdentity IdentifyGrass(s32 sceneNum, s32 posX, s32 posZ, s32 respawnData, s32 linkAge); GetItemEntry GetItemFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogItemId, bool checkObtainability = true); GetItemEntry GetItemFromActor(s16 actorId, s16 sceneNum, s16 actorParams, GetItemID ogItemId, bool checkObtainability = true); ItemObtainability GetItemObtainabilityFromRandomizerCheck(RandomizerCheck randomizerCheck); diff --git a/soh/soh/Enhancements/randomizer/randomizerTypes.h b/soh/soh/Enhancements/randomizer/randomizerTypes.h index e061d1a2f..5c221aa96 100644 --- a/soh/soh/Enhancements/randomizer/randomizerTypes.h +++ b/soh/soh/Enhancements/randomizer/randomizerTypes.h @@ -2857,8 +2857,8 @@ typedef enum { RC_KF_ADULT_GRASS_16, RC_KF_ADULT_GRASS_17, RC_KF_ADULT_GRASS_18, - //RC_KF_ADULT_GRASS_19, - //RC_KF_ADULT_GRASS_20, + RC_KF_ADULT_GRASS_19, + RC_KF_ADULT_GRASS_20, RC_LW_GRASS_1, RC_LW_GRASS_2, RC_LW_GRASS_3, diff --git a/soh/soh/Enhancements/randomizer/randomizer_inf.h b/soh/soh/Enhancements/randomizer/randomizer_inf.h index 95a566c81..ad40304fc 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_inf.h +++ b/soh/soh/Enhancements/randomizer/randomizer_inf.h @@ -1307,8 +1307,8 @@ typedef enum { RAND_INF_KF_ADULT_GRASS_16, RAND_INF_KF_ADULT_GRASS_17, RAND_INF_KF_ADULT_GRASS_18, - //RAND_INF_KF_ADULT_GRASS_19, - //RAND_INF_KF_ADULT_GRASS_20, + RAND_INF_KF_ADULT_GRASS_19, + RAND_INF_KF_ADULT_GRASS_20, RAND_INF_LW_GRASS_1, RAND_INF_LW_GRASS_2, RAND_INF_LW_GRASS_3,