mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 14:23:44 -07:00
Merge branch 'Blair' into BossEntryways
This commit is contained in:
commit
daeee0b893
8 changed files with 19 additions and 18 deletions
|
@ -15,7 +15,7 @@ extern "C"
|
||||||
#include <soh/Enhancements/randomizer/randomizer_inf.h>
|
#include <soh/Enhancements/randomizer/randomizer_inf.h>
|
||||||
|
|
||||||
#if defined(INCLUDE_GAME_PRINTF) && defined(_DEBUG)
|
#if defined(INCLUDE_GAME_PRINTF) && defined(_DEBUG)
|
||||||
#define osSyncPrintf(fmt, ...) lusprintf(__FILE__, __LINE__, 0, fmt, __VA_ARGS__)
|
#define osSyncPrintf(fmt, ...) lusprintf(__FILE__, __LINE__, 0, fmt, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define osSyncPrintf(fmt, ...) osSyncPrintfUnused(fmt, ##__VA_ARGS__)
|
#define osSyncPrintf(fmt, ...) osSyncPrintfUnused(fmt, ##__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -421,7 +421,7 @@ bool AddCheckToLogic(LocationAccess& locPair, GetAccessibleLocationsStruct& gals
|
||||||
Rando::ItemLocation* location = ctx->GetItemLocation(loc);
|
Rando::ItemLocation* location = ctx->GetItemLocation(loc);
|
||||||
RandomizerGet locItem = location->GetPlacedRandomizerGet();
|
RandomizerGet locItem = location->GetPlacedRandomizerGet();
|
||||||
|
|
||||||
if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion)) {
|
if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion, gals.calculatingAvailableChecks)) {
|
||||||
if (gals.calculatingAvailableChecks) {
|
if (gals.calculatingAvailableChecks) {
|
||||||
gals.accessibleLocations.push_back(loc);
|
gals.accessibleLocations.push_back(loc);
|
||||||
StopPerformanceTimer(PT_LOCATION_LOGIC);
|
StopPerformanceTimer(PT_LOCATION_LOGIC);
|
||||||
|
|
|
@ -33,7 +33,7 @@ bool LocationAccess::CheckConditionAtAgeTime(bool& age, bool& time) const {
|
||||||
return GetConditionsMet();
|
return GetConditionsMet();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocationAccess::ConditionsMet(Region* parentRegion) const {
|
bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const {
|
||||||
// WARNING enterance validation can run this after resetting the access for sphere 0 validation
|
// WARNING enterance validation can run this after resetting the access for sphere 0 validation
|
||||||
// When refactoring ToD access, either fix the above or do not assume that we
|
// When refactoring ToD access, either fix the above or do not assume that we
|
||||||
// have any access at all just because this is being run
|
// have any access at all just because this is being run
|
||||||
|
@ -46,7 +46,7 @@ bool LocationAccess::ConditionsMet(Region* parentRegion) const {
|
||||||
conditionsMet = true;
|
conditionsMet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return conditionsMet && CanBuy();
|
return conditionsMet && CanBuy(calculatingAvailableChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t GetMinimumPrice(const Rando::Location* loc) {
|
static uint16_t GetMinimumPrice(const Rando::Location* loc) {
|
||||||
|
@ -90,13 +90,13 @@ static uint16_t GetMinimumPrice(const Rando::Location* loc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocationAccess::CanBuy() const {
|
bool LocationAccess::CanBuy(bool calculatingAvailableChecks) const {
|
||||||
const auto& loc = Rando::StaticData::GetLocation(location);
|
const auto& loc = Rando::StaticData::GetLocation(location);
|
||||||
const auto& itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(location);
|
const auto& itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(location);
|
||||||
|
|
||||||
if (loc->GetRCType() == RCTYPE_SHOP || loc->GetRCType() == RCTYPE_SCRUB || loc->GetRCType() == RCTYPE_MERCHANT) {
|
if (loc->GetRCType() == RCTYPE_SHOP || loc->GetRCType() == RCTYPE_SCRUB || loc->GetRCType() == RCTYPE_MERCHANT) {
|
||||||
// Checks should only be identified while playing
|
// Checks should only be identified while playing
|
||||||
if (itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) {
|
if (calculatingAvailableChecks && itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) {
|
||||||
return CanBuyAnother(GetMinimumPrice(loc));
|
return CanBuyAnother(GetMinimumPrice(loc));
|
||||||
} else {
|
} else {
|
||||||
return CanBuyAnother(itemLoc->GetPrice());
|
return CanBuyAnother(itemLoc->GetPrice());
|
||||||
|
|
|
@ -84,7 +84,7 @@ class LocationAccess {
|
||||||
|
|
||||||
bool CheckConditionAtAgeTime(bool& age, bool& time) const;
|
bool CheckConditionAtAgeTime(bool& age, bool& time) const;
|
||||||
|
|
||||||
bool ConditionsMet(Region* parentRegion) const;
|
bool ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const;
|
||||||
|
|
||||||
RandomizerCheck GetLocation() const {
|
RandomizerCheck GetLocation() const {
|
||||||
return location;
|
return location;
|
||||||
|
@ -100,7 +100,7 @@ class LocationAccess {
|
||||||
std::string condition_str;
|
std::string condition_str;
|
||||||
|
|
||||||
// Makes sure shop locations are buyable
|
// Makes sure shop locations are buyable
|
||||||
bool CanBuy() const;
|
bool CanBuy(bool calculatingAvailableChecks) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool CanBuyAnother(uint16_t price);
|
bool CanBuyAnother(uint16_t price);
|
||||||
|
|
|
@ -20,7 +20,7 @@ void RegionTable_Init_FireTemple() {
|
||||||
//Exits
|
//Exits
|
||||||
Entrance(RR_FIRE_TEMPLE_ENTRYWAY, []{return true;}),
|
Entrance(RR_FIRE_TEMPLE_ENTRYWAY, []{return true;}),
|
||||||
Entrance(RR_FIRE_TEMPLE_NEAR_BOSS_ROOM, []{return logic->FireTimer() >= 24;}),
|
Entrance(RR_FIRE_TEMPLE_NEAR_BOSS_ROOM, []{return logic->FireTimer() >= 24;}),
|
||||||
Entrance(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return Here(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->CanUse(RG_MEGATON_HAMMER);}) && (logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsKeysanity);}),
|
Entrance(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return Here(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->CanUse(RG_MEGATON_HAMMER);}) && (logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsFireLoopLocked);}),
|
||||||
Entrance(RR_FIRE_TEMPLE_LOOP_EXIT, []{return true;}),
|
Entrance(RR_FIRE_TEMPLE_LOOP_EXIT, []{return true;}),
|
||||||
Entrance(RR_FIRE_TEMPLE_BIG_LAVA_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 2) && logic->FireTimer() >= 24;}),
|
Entrance(RR_FIRE_TEMPLE_BIG_LAVA_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 2) && logic->FireTimer() >= 24;}),
|
||||||
});
|
});
|
||||||
|
@ -43,7 +43,7 @@ void RegionTable_Init_FireTemple() {
|
||||||
|
|
||||||
areaTable[RR_FIRE_TEMPLE_LOOP_ENEMIES] = Region("Fire Temple Loop Enemies", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, {}, {}, {
|
areaTable[RR_FIRE_TEMPLE_LOOP_ENEMIES] = Region("Fire Temple Loop Enemies", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, {}, {}, {
|
||||||
//Exits
|
//Exits
|
||||||
Entrance(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsKeysanity;}),
|
Entrance(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsFireLoopLocked;}),
|
||||||
Entrance(RR_FIRE_TEMPLE_LOOP_TILES, []{return Here(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return logic->CanKillEnemy(RE_TORCH_SLUG) && logic->CanKillEnemy(RE_FIRE_KEESE);});}),
|
Entrance(RR_FIRE_TEMPLE_LOOP_TILES, []{return Here(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return logic->CanKillEnemy(RE_TORCH_SLUG) && logic->CanKillEnemy(RE_FIRE_KEESE);});}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1389,6 +1389,7 @@ bool Logic::SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmountGlitchless
|
||||||
static_cast<uint8_t>(GlitchDifficulty::INTERMEDIATE) || GetDifficultyValueFromString(GlitchHover) >=
|
static_cast<uint8_t>(GlitchDifficulty::INTERMEDIATE) || GetDifficultyValueFromString(GlitchHover) >=
|
||||||
static_cast<uint8_t>(GlitchDifficulty::INTERMEDIATE))) { return FireTempleKeys >= requiredAmountGlitched;
|
static_cast<uint8_t>(GlitchDifficulty::INTERMEDIATE))) { return FireTempleKeys >= requiredAmountGlitched;
|
||||||
}*/
|
}*/
|
||||||
|
// If the Fire Temple loop lock is removed, Small key Count is set to 1 before starting
|
||||||
return GetSmallKeyCount(SCENE_FIRE_TEMPLE) >= requiredAmountGlitchless;
|
return GetSmallKeyCount(SCENE_FIRE_TEMPLE) >= requiredAmountGlitchless;
|
||||||
|
|
||||||
case RR_WATER_TEMPLE:
|
case RR_WATER_TEMPLE:
|
||||||
|
@ -2336,9 +2337,9 @@ void Logic::Reset() {
|
||||||
StartPerformanceTimer(PT_LOGIC_RESET);
|
StartPerformanceTimer(PT_LOGIC_RESET);
|
||||||
memset(inLogic, false, sizeof(inLogic));
|
memset(inLogic, false, sizeof(inLogic));
|
||||||
// Settings-dependent variables
|
// Settings-dependent variables
|
||||||
IsKeysanity = ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE) ||
|
IsFireLoopLocked = ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE) ||
|
||||||
ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE) ||
|
ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_OVERWORLD) ||
|
||||||
ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE);
|
ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANY_DUNGEON);
|
||||||
|
|
||||||
// AmmoCanDrop = /*AmmoDrops.IsNot(AMMODROPS_NONE)*/ false; TODO: AmmoDrop setting
|
// AmmoCanDrop = /*AmmoDrops.IsNot(AMMODROPS_NONE)*/ false; TODO: AmmoDrop setting
|
||||||
|
|
||||||
|
@ -2400,7 +2401,7 @@ void Logic::Reset() {
|
||||||
|
|
||||||
// If not keysanity, start with 1 logical key to account for automatically unlocking the basement door in vanilla
|
// If not keysanity, start with 1 logical key to account for automatically unlocking the basement door in vanilla
|
||||||
// FiT
|
// FiT
|
||||||
if (!IsKeysanity && ctx->GetDungeon(Rando::FIRE_TEMPLE)->IsVanilla()) {
|
if (!IsFireLoopLocked && ctx->GetDungeon(Rando::FIRE_TEMPLE)->IsVanilla()) {
|
||||||
SetSmallKeyCount(SCENE_FIRE_TEMPLE, 1);
|
SetSmallKeyCount(SCENE_FIRE_TEMPLE, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Logic {
|
||||||
bool LightTrialClear = false;
|
bool LightTrialClear = false;
|
||||||
|
|
||||||
// Logical keysanity
|
// Logical keysanity
|
||||||
bool IsKeysanity = false;
|
bool IsFireLoopLocked = false;
|
||||||
|
|
||||||
// Bottle Count
|
// Bottle Count
|
||||||
uint8_t Bottles = 0;
|
uint8_t Bottles = 0;
|
||||||
|
|
|
@ -2437,15 +2437,15 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
|
||||||
// animation until the text box auto-dismisses.
|
// animation until the text box auto-dismisses.
|
||||||
// RANDOTODO: Implement a way to determine if an item came from a skulltula and
|
// RANDOTODO: Implement a way to determine if an item came from a skulltula and
|
||||||
// inject the auto-dismiss control code if it did.
|
// inject the auto-dismiss control code if it did.
|
||||||
if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 &&
|
bool gsTokensShuffled = Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF;
|
||||||
!(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF)) {
|
if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 && !(IS_RANDO && gsTokensShuffled)) {
|
||||||
textId = TEXT_GS_NO_FREEZE;
|
textId = TEXT_GS_NO_FREEZE;
|
||||||
} else {
|
} else {
|
||||||
textId = TEXT_GS_FREEZE;
|
textId = TEXT_GS_FREEZE;
|
||||||
}
|
}
|
||||||
// In vanilla, GS token count is incremented prior to the text box displaying
|
// In vanilla, GS token count is incremented prior to the text box displaying
|
||||||
// In rando we need to bump the token count by one to show the correct count
|
// In rando we need to bump the token count by one to show the correct count
|
||||||
s16 gsCount = gSaveContext.inventory.gsTokens + (IS_RANDO ? 1 : 0);
|
s16 gsCount = gSaveContext.inventory.gsTokens + ((IS_RANDO && gsTokensShuffled) ? 1 : 0);
|
||||||
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, textId, MF_FORMATTED);
|
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, textId, MF_FORMATTED);
|
||||||
messageEntry.Replace("[[gsCount]]", std::to_string(gsCount));
|
messageEntry.Replace("[[gsCount]]", std::to_string(gsCount));
|
||||||
} else if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 &&
|
} else if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 &&
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue