diff --git a/soh/soh/Enhancements/randomizer.cpp b/soh/soh/Enhancements/randomizer.cpp index 37972e356..ac64610bf 100644 --- a/soh/soh/Enhancements/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer.cpp @@ -553,6 +553,10 @@ GetItemID Randomizer::GetItemFromSceneAndParams(s16 sceneNum, s16 actorParams, G return GetItemFromGet(this->itemLocations[GetCheckFromSceneAndParams(sceneNum, actorParams)], ogItemId); } +GetItemID Randomizer::GetItemFromSceneParamsAndHomePos(s16 sceneNum, s16 actorParams, s32 homePosX, s32 homePosY, s32 homePosZ, GetItemID ogItemId) { + return GetItemFromGet(this->itemLocations[GetCheckFromSceneAndParams(sceneNum, actorParams, homePosX, homePosY, homePosZ)], ogItemId); +} + GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId) { switch(randoGet) { case UNKNOWN_GET: @@ -769,7 +773,7 @@ RandomizerCheck Randomizer::GetCheckFromActor(s16 actorId, GetItemID ogItemId) { return UNKNOWN_CHECK; } -RandomizerCheck Randomizer::GetCheckFromSceneAndParams(s16 sceneNum, s16 actorParams) { +RandomizerCheck Randomizer::GetCheckFromSceneAndParams(s16 sceneNum, s16 actorParams, s32 homePosX, s32 homePosY, s32 homePosZ) { if (!gSaveContext.n64ddFlag) { return UNKNOWN_CHECK; } diff --git a/soh/soh/Enhancements/randomizer.h b/soh/soh/Enhancements/randomizer.h index 07bc65e54..b7c365c34 100644 --- a/soh/soh/Enhancements/randomizer.h +++ b/soh/soh/Enhancements/randomizer.h @@ -12,7 +12,7 @@ class Randomizer { std::unordered_map itemLocations; GetItemID GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId); RandomizerCheck GetCheckFromActor(s16 actorId, GetItemID ogItemId); - RandomizerCheck GetCheckFromSceneAndParams(s16 sceneNum, s16 actorParams); + RandomizerCheck GetCheckFromSceneAndParams(s16 sceneNum, s16 actorParams, s32 homePosX = 0, s32 homePosY = 0, s32 homePosZ = 0); public: Randomizer(); @@ -22,6 +22,7 @@ class Randomizer { void ParseItemLocations(std::string spoilerfilename); GetItemID GetItemFromActor(s16 actorId, GetItemID ogItemId); GetItemID GetItemFromSceneAndParams(s16 sceneNum, s16 actorParams, GetItemID ogItemId); + GetItemID GetItemFromSceneParamsAndHomePos(s16 sceneNum, s16 actorParams, s32 homePosX, s32 homePosY, s32 homePosZ, GetItemID ogItemId); }; #endif diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index b69985ddb..8e9b8631c 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -997,11 +997,11 @@ extern "C" int Controller_ShouldRumble(size_t i) { } extern "C" void LoadItemLocations() { - return OTRGlobals::Instance->gRandomizer->LoadItemLocations(); + OTRGlobals::Instance->gRandomizer->LoadItemLocations(); } extern "C" void ParseItemLocations(const char* spoilerfilename) { - return OTRGlobals::Instance->gRandomizer->ParseItemLocations(spoilerfilename); + OTRGlobals::Instance->gRandomizer->ParseItemLocations(spoilerfilename); } extern "C" GetItemID GetItemFromActor(s16 actorId, GetItemID ogItemId) { @@ -1010,4 +1010,9 @@ extern "C" GetItemID GetItemFromActor(s16 actorId, GetItemID ogItemId) { extern "C" GetItemID GetItemFromSceneAndParams(s16 sceneNum, s16 actorParams, GetItemID ogItemId) { return OTRGlobals::Instance->gRandomizer->GetItemFromSceneAndParams(sceneNum, actorParams, ogItemId); -} \ No newline at end of file +} + +// use an explicit (s32) cast on the position values from the Vec3f when calling +extern "C" GetItemID GetItemFromSceneParamsAndHomePos(s16 sceneNum, s16 actorParams, s32 homePosX, s32 homePosY, s32 homePosZ, GetItemID ogItemId) { + return OTRGlobals::Instance->gRandomizer->GetItemFromSceneParamsAndHomePos(sceneNum, actorParams, homePosX, homePosY, homePosZ, ogItemId); +}