Fix missing entries in RC to randinf and new identity pattern to make future misses more obvious (#7141)

This commit is contained in:
Pepper0ni
2026-09-05 22:05:13 +01:00
committed by GitHub
parent 495a2b17db
commit 6d65db6174
17 changed files with 54 additions and 83 deletions
@@ -1,4 +1,23 @@
#include "./RCToRandInf.h"
#include <spdlog/spdlog.h>
#include "randomizerEnumStrings.h"
bool IdentifyCheck(CheckIdentity* id, Rando::Location* loc, bool allowUnknown) {
if (loc == nullptr || loc->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
if (rcToRandomizerInf.contains(loc->GetRandomizerCheck())) {
id->randomizerInf = rcToRandomizerInf[loc->GetRandomizerCheck()];
} else {
SPDLOG_ERROR("{} not found in rcToRandomizerInf.", loc->GetRandomizerCheck());
assert(false);
}
id->randomizerCheck = loc->GetRandomizerCheck();
return true;
} else if (!allowUnknown) {
SPDLOG_WARN("IdentifyCheck did not receive a valid RC value ({}).", loc->GetRandomizerCheck());
assert(false);
}
return false;
}
std::map<RandomizerCheck, RandomizerInf> rcToRandomizerInf = {
{ RC_KF_LINKS_HOUSE_COW, RAND_INF_COWS_MILKED_KF_LINKS_HOUSE_COW },
@@ -2413,6 +2432,10 @@ std::map<RandomizerCheck, RandomizerInf> rcToRandomizerInf = {
{ RC_SPIRIT_TEMPLE_MQ_ENTRANCE_EYE_BOULDER, RAND_INF_SPIRIT_TEMPLE_MQ_ENTRANCE_EYE_BOULDER },
{ RC_SPIRIT_TEMPLE_MQ_ENTRANCE_CEILING_BOULDER, RAND_INF_SPIRIT_TEMPLE_MQ_ENTRANCE_CEILING_BOULDER },
{ RC_SPIRIT_TEMPLE_MQ_EARLY_ADULT_BOULDER, RAND_INF_SPIRIT_TEMPLE_MQ_EARLY_ADULT_BOULDER },
{ RC_SPIRIT_TEMPLE_MQ_CRAWLSPACE_BOULDER, RAND_INF_SPIRIT_TEMPLE_MQ_CRAWLSPACE_BOULDER },
{ RC_SPIRIT_TEMPLE_MQ_GIBDO_BOULDER, RAND_INF_SPIRIT_TEMPLE_MQ_GIBDO_BOULDER },
{ RC_SPIRIT_TEMPLE_MQ_GIBDO_BOULDER_LOW, RAND_INF_SPIRIT_TEMPLE_MQ_GIBDO_BOULDER_LOW },
{ RC_SPIRIT_TEMPLE_MQ_GIBDO_BOULDER_HIGH, RAND_INF_SPIRIT_TEMPLE_MQ_GIBDO_BOULDER_HIGH },
{ RC_BOTW_MQ_BOULDER_1, RAND_INF_BOTW_MQ_BOULDER_1 },
{ RC_BOTW_MQ_BOULDER_2, RAND_INF_BOTW_MQ_BOULDER_2 },
{ RC_BOTW_MQ_BOULDER_3, RAND_INF_BOTW_MQ_BOULDER_3 },
@@ -1,8 +1,12 @@
#pragma once
#include <map>
#include "soh/Enhancements/randomizer/location.h"
#include "soh/Enhancements/randomizer/randomizerEnums.h"
#include "soh/Enhancements/randomizer/randomizerTypes.h"
// There has been some talk about potentially just using the RC identifier to store flags rather than randomizer inf, so
// for now we're not going to store randomzierInf in the randomizer check objects, we're just going to map them 1:1 here
extern std::map<RandomizerCheck, RandomizerInf> rcToRandomizerInf;
extern std::map<RandomizerCheck, RandomizerInf> rcToRandomizerInf;
bool IdentifyCheck(CheckIdentity* id, Rando::Location* loc, bool allowUnknown = true);
@@ -94,10 +94,7 @@ static CheckIdentity IdentifyBeehive(s32 sceneNum, s16 xPosition, s32 respawnDat
Rando::Location* location =
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_OBJ_COMB, sceneNum, respawnData);
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
beehiveIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
beehiveIdentity.randomizerCheck = location->GetRandomizerCheck();
}
IdentifyCheck(&beehiveIdentity, location);
return beehiveIdentity;
}
@@ -15,12 +15,8 @@ static CheckIdentity IdentifyBeggar(s32 sceneNum, s32 textId) {
Rando::Location* location =
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_HY, sceneNum, textId);
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
LUSLOG_WARN("IdentifyBeggar did not receive a valid RC value (%d).", location->GetRandomizerCheck());
} else {
beggarIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
beggarIdentity.randomizerCheck = location->GetRandomizerCheck();
}
IdentifyCheck(&beggarIdentity, location);
return beggarIdentity;
}
@@ -51,10 +51,7 @@ static CheckIdentity IdentifyCow(s32 sceneNum, s32 posX, s32 posZ) {
Rando::Location* location =
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_COW, sceneNum, actorParams);
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
cowIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
cowIdentity.randomizerCheck = location->GetRandomizerCheck();
}
IdentifyCheck(&cowIdentity, location);
return cowIdentity;
}
@@ -208,13 +208,7 @@ static CheckIdentity IdentifyCrate(s32 sceneNum, s32 posX, s32 posZ) {
Rando::Location* location =
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_OBJ_KIBAKO2, crateSceneNum, actorParams);
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
LUSLOG_WARN("IdentifyCrate did not receive a valid RC value (%d).", location->GetRandomizerCheck());
assert(false);
} else {
crateIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
crateIdentity.randomizerCheck = location->GetRandomizerCheck();
}
IdentifyCheck(&crateIdentity, location);
return crateIdentity;
}
@@ -231,13 +225,7 @@ static CheckIdentity IdentifySmallCrate(s32 sceneNum, s32 posX, s32 posZ) {
Rando::Location* location =
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_OBJ_KIBAKO, smallCrateSceneNum, actorParams);
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
LUSLOG_WARN("IdentifyCrate did not receive a valid RC value (%d).", location->GetRandomizerCheck());
assert(false);
} else {
smallCrateIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
smallCrateIdentity.randomizerCheck = location->GetRandomizerCheck();
}
IdentifyCheck(&smallCrateIdentity, location);
return smallCrateIdentity;
}
@@ -172,10 +172,7 @@ static CheckIdentity IdentifyGrass(s32 sceneNum, s32 posX, s32 posZ, s32 respawn
Rando::Location* location =
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_KUSA, sceneNum, respawnData);
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
grassIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
grassIdentity.randomizerCheck = location->GetRandomizerCheck();
}
IdentifyCheck(&grassIdentity, location);
return grassIdentity;
}
@@ -104,13 +104,7 @@ static CheckIdentity IdentifyIcicle(s32 sceneNum, s32 posX, s32 posZ) {
Rando::Location* location =
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_BG_ICE_TURARA, icicleSceneNum, actorParams);
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
LUSLOG_WARN("IdentifyIcicle did not receive a valid RC value (%d).", location->GetRandomizerCheck());
assert(false);
} else {
icicleIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
icicleIdentity.randomizerCheck = location->GetRandomizerCheck();
}
IdentifyCheck(&icicleIdentity, location);
return icicleIdentity;
}
@@ -118,12 +118,7 @@ static CheckIdentity IdentifyPot(s32 sceneNum, s32 posX, s32 posZ) {
Rando::Location* location =
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_OBJ_TSUBO, potSceneNum, actorParams);
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
LUSLOG_WARN("IdentifyPot did not receive a valid RC value (%d).", location->GetRandomizerCheck());
} else {
potIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
potIdentity.randomizerCheck = location->GetRandomizerCheck();
}
IdentifyCheck(&potIdentity, location);
return potIdentity;
}
@@ -142,13 +142,7 @@ static CheckIdentity IdentifyRedIce(s32 sceneNum, s32 posX, s32 posZ) {
Rando::Location* location =
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_BG_ICE_SHELTER, redIceSceneNum, actorParams);
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
LUSLOG_WARN("IdentifyRedIce did not receive a valid RC value (%d).", location->GetRandomizerCheck());
assert(false);
} else {
redIceIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
redIceIdentity.randomizerCheck = location->GetRandomizerCheck();
}
IdentifyCheck(&redIceIdentity, location);
return redIceIdentity;
}
@@ -8,6 +8,7 @@
#include "soh/OTRGlobals.h"
#include "soh/Enhancements/randomizer/randomizer.h"
#include "soh/Enhancements/randomizer/RCToRandInf.h"
#include <spdlog/spdlog.h>
extern "C" {
#include "macros.h"
@@ -216,11 +217,8 @@ static CheckIdentity IdentifyRock(s32 sceneNum, s32 posX, s32 posZ) {
Rando::Location* location = OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(
ACTOR_EN_ISHI, sceneNum, TWO_ACTOR_PARAMS(posX, posZ));
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
rockIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
rockIdentity.randomizerCheck = location->GetRandomizerCheck();
} else {
LUSLOG_WARN("IdentifyRock did not receive a valid RC value %d,%d.", posX, posZ);
if (!IdentifyCheck(&rockIdentity, location)) {
SPDLOG_WARN("IdentifyRock did not receive a valid RC value %d,%d.", posX, posZ);
}
return rockIdentity;
@@ -1,4 +1,5 @@
#include <soh/OTRGlobals.h>
#include <spdlog/spdlog.h>
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/ObjectExtension/ObjectExtension.h"
#include "item_category_adj.h"
@@ -157,12 +158,7 @@ static CheckIdentity IdentifySign(s32 sceneNum, s32 posX, s32 posZ, s32 id) {
return signIdentity;
}
if (location == nullptr || location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
LUSLOG_WARN("IdentifySign did not receive a valid RC value (%d).", location->GetRandomizerCheck());
} else {
signIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
signIdentity.randomizerCheck = location->GetRandomizerCheck();
}
IdentifyCheck(&signIdentity, location);
return signIdentity;
}
@@ -135,11 +135,12 @@ static CheckIdentity IdentifyTree(s32 sceneNum, s32 posX, s32 posZ) {
s32 actorParams = TWO_ACTOR_PARAMS(posX, posZ);
Rando::Location* location =
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_WOOD02, sceneNum, actorParams);
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK &&
(location->GetRCType() != RCTYPE_NLTREE ||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_LOGIC_RULES) == RO_LOGIC_NO_LOGIC)) {
treeIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
treeIdentity.randomizerCheck = location->GetRandomizerCheck();
IdentifyCheck(&treeIdentity, location);
if ((location->GetRCType() != RCTYPE_NLTREE ||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_LOGIC_RULES) == RO_LOGIC_NO_LOGIC) &&
IdentifyCheck(&treeIdentity, location)) {
return treeIdentity;
}
@@ -120,12 +120,7 @@ static CheckIdentity IdentifyWonderItem(s32 sceneNum, s32 par1, s32 par2) {
Rando::Location* location =
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_WONDER_ITEM, wonderSceneNum, actorParams);
if (location->GetRandomizerCheck() == RC_UNKNOWN_CHECK) {
LUSLOG_WARN("IdentifyWonderItem did not receive a valid RC value (%d).", location->GetRandomizerCheck());
} else {
wonderIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
wonderIdentity.randomizerCheck = location->GetRandomizerCheck();
}
IdentifyCheck(&wonderIdentity, location);
return wonderIdentity;
}
@@ -269,10 +269,7 @@ static CheckIdentity IdentifyFish(s32 sceneNum, s32 actorParams) {
Rando::Location* location =
OTRGlobals::Instance->gRandomizer->GetCheckObjectFromActor(ACTOR_EN_FISH, sceneNum, actorParams);
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
fishIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
fishIdentity.randomizerCheck = location->GetRandomizerCheck();
}
IdentifyCheck(&fishIdentity, location);
return fishIdentity;
}
@@ -970,8 +970,8 @@ static ScrubIdentity IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respawnDat
return scrubIdentity;
}
scrubIdentity.identity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
scrubIdentity.identity.randomizerCheck = location->GetRandomizerCheck();
IdentifyCheck(&scrubIdentity.identity, location);
scrubIdentity.getItemId = (GetItemID)Rando::StaticData::RetrieveItem(location->GetVanillaItem()).GetItemID();
scrubIdentity.itemPrice =
OTRGlobals::Instance->gRandoContext->GetItemLocation(scrubIdentity.identity.randomizerCheck)->GetPrice();
@@ -838,8 +838,7 @@ ShopItemIdentity Randomizer::IdentifyShopItem(s32 sceneNum, u8 slotIndex) {
slotIndex - 1);
if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
shopItemIdentity.identity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
shopItemIdentity.identity.randomizerCheck = location->GetRandomizerCheck();
IdentifyCheck(&shopItemIdentity.identity, location);
shopItemIdentity.ogItemId = (GetItemID)Rando::StaticData::RetrieveItem(location->GetVanillaItem()).GetItemID();
RandomizerGet randoGet = Rando::Context::GetInstance()