mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-26 10:08:51 -05:00
Move obtainability check up higher
This commit is contained in:
parent
8c6774fa35
commit
c7207d2e0a
@ -1194,8 +1194,8 @@ s16 Randomizer::GetItemFromActor(s16 actorId, s16 actorParams, s16 sceneNum, Get
|
|||||||
return GetItemIDFromRandomizerGet(this->itemLocations[GetCheckFromActor(sceneNum, actorId, actorParams)], ogItemId);
|
return GetItemIDFromRandomizerGet(this->itemLocations[GetCheckFromActor(sceneNum, actorId, actorParams)], ogItemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
CanObtainResult Randomizer::CanObtainRandomizerGet(RandomizerGet randoGet) {
|
CanObtainResult Randomizer::GetCanObtainFromRandomizerCheck(RandomizerCheck randomizerCheck) {
|
||||||
switch (randoGet) {
|
switch (this->itemLocations[randomizerCheck]) {
|
||||||
case RG_NONE:
|
case RG_NONE:
|
||||||
case RG_TRIFORCE:
|
case RG_TRIFORCE:
|
||||||
case RG_HINT:
|
case RG_HINT:
|
||||||
@ -1532,12 +1532,6 @@ CanObtainResult Randomizer::CanObtainRandomizerGet(RandomizerGet randoGet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GetItemID Randomizer::GetItemIDFromRandomizerGet(RandomizerGet randoGet, GetItemID ogItemId) {
|
GetItemID Randomizer::GetItemIDFromRandomizerGet(RandomizerGet randoGet, GetItemID ogItemId) {
|
||||||
CanObtainResult canObtain = Randomizer::CanObtainRandomizerGet(randoGet);
|
|
||||||
|
|
||||||
if (canObtain != CAN_OBTAIN) {
|
|
||||||
return GI_RUPEE_BLUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (randoGet) {
|
switch (randoGet) {
|
||||||
case RG_NONE:
|
case RG_NONE:
|
||||||
return ogItemId;
|
return ogItemId;
|
||||||
|
@ -21,7 +21,6 @@ class Randomizer {
|
|||||||
std::string ganonText;
|
std::string ganonText;
|
||||||
std::unordered_map<RandomizerSettingKey, u8> randoSettings;
|
std::unordered_map<RandomizerSettingKey, u8> randoSettings;
|
||||||
std::unordered_map<RandomizerCheck, u16> randomizerMerchantPrices;
|
std::unordered_map<RandomizerCheck, u16> randomizerMerchantPrices;
|
||||||
CanObtainResult CanObtainRandomizerGet(RandomizerGet randoGet);
|
|
||||||
GetItemID GetItemIDFromRandomizerGet(RandomizerGet randoGet, GetItemID ogItemId);
|
GetItemID GetItemIDFromRandomizerGet(RandomizerGet randoGet, GetItemID ogItemId);
|
||||||
s16 GetItemFromActor(s16 actorId, s16 actorParams, s16 sceneNum, GetItemID ogItemId);
|
s16 GetItemFromActor(s16 actorId, s16 actorParams, s16 sceneNum, GetItemID ogItemId);
|
||||||
void ParseRandomizerSettingsFile(const char* spoilerFileName);
|
void ParseRandomizerSettingsFile(const char* spoilerFileName);
|
||||||
@ -59,6 +58,7 @@ class Randomizer {
|
|||||||
ScrubIdentity IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respawnData);
|
ScrubIdentity IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respawnData);
|
||||||
s16 GetRandomizedItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId);
|
s16 GetRandomizedItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId);
|
||||||
s16 GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum);
|
s16 GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum);
|
||||||
|
CanObtainResult GetCanObtainFromRandomizerCheck(RandomizerCheck randomizerCheck);
|
||||||
static void CreateCustomMessages();
|
static void CreateCustomMessages();
|
||||||
static std::string RandomizeRupeeName(std::string message, int language);
|
static std::string RandomizeRupeeName(std::string message, int language);
|
||||||
static CustomMessageEntry GetRupeeMessage(u16 rupeeTextId);
|
static CustomMessageEntry GetRupeeMessage(u16 rupeeTextId);
|
||||||
|
@ -1631,13 +1631,19 @@ extern "C" GetItemEntry ItemTable_RetrieveEntry(s16 tableID, s16 getItemID) {
|
|||||||
|
|
||||||
extern "C" GetItemEntry Randomizer_GetRandomizedItem(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum) {
|
extern "C" GetItemEntry Randomizer_GetRandomizedItem(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum) {
|
||||||
s16 getItemModIndex;
|
s16 getItemModIndex;
|
||||||
if (OTRGlobals::Instance->gRandomizer->CheckContainsVanillaItem(
|
RandomizerCheck randomizerCheck = OTRGlobals::Instance->gRandomizer->GetCheckFromActor(sceneNum, actorId, actorParams);
|
||||||
OTRGlobals::Instance->gRandomizer->GetCheckFromActor(sceneNum, actorId, actorParams))) {
|
if (OTRGlobals::Instance->gRandomizer->CheckContainsVanillaItem(randomizerCheck)) {
|
||||||
getItemModIndex = MOD_NONE;
|
getItemModIndex = MOD_NONE;
|
||||||
} else {
|
} else {
|
||||||
getItemModIndex = MOD_RANDOMIZER;
|
getItemModIndex = MOD_RANDOMIZER;
|
||||||
}
|
}
|
||||||
s16 itemID = OTRGlobals::Instance->gRandomizer->GetRandomizedItemId(ogId, actorId, actorParams, sceneNum);
|
s16 itemID = OTRGlobals::Instance->gRandomizer->GetRandomizedItemId(ogId, actorId, actorParams, sceneNum);
|
||||||
|
|
||||||
|
// This feels awkward, maybe in the future each mod will have it's own obtainability check
|
||||||
|
if (OTRGlobals::Instance->gRandomizer->GetCanObtainFromRandomizerCheck(randomizerCheck) != CAN_OBTAIN) {
|
||||||
|
return ItemTable_RetrieveEntry(MOD_NONE, GI_RUPEE_BLUE);
|
||||||
|
}
|
||||||
|
|
||||||
return ItemTable_RetrieveEntry(getItemModIndex, itemID);
|
return ItemTable_RetrieveEntry(getItemModIndex, itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1649,6 +1655,12 @@ extern "C" GetItemEntry Randomizer_GetItemFromKnownCheck(RandomizerCheck randomi
|
|||||||
getItemModIndex = MOD_RANDOMIZER;
|
getItemModIndex = MOD_RANDOMIZER;
|
||||||
}
|
}
|
||||||
s16 itemID = OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId);
|
s16 itemID = OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId);
|
||||||
|
|
||||||
|
// This feels awkward, maybe in the future each mod will have it's own obtainability check
|
||||||
|
if (OTRGlobals::Instance->gRandomizer->GetCanObtainFromRandomizerCheck(randomizerCheck) != CAN_OBTAIN) {
|
||||||
|
return ItemTable_RetrieveEntry(MOD_NONE, GI_RUPEE_BLUE);
|
||||||
|
}
|
||||||
|
|
||||||
return ItemTable_RetrieveEntry(getItemModIndex, itemID);
|
return ItemTable_RetrieveEntry(getItemModIndex, itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user