Storyflag Enum

This commit is contained in:
elijah-thomas774
2025-09-14 18:29:28 -04:00
parent 67c9e3346c
commit ca9c3fd7f3
38 changed files with 6212 additions and 151 deletions
+26 -19
View File
@@ -12,8 +12,9 @@ typedef TList<DowsingTarget, offsetof(DowsingTarget, mLink)> DowsingList;
DowsingList DOWSING_LISTS[8];
static const int DOWSING_TARGET_STORY_FLAGS[8] = {
100, 105, 100, 104, 108, 110, 109, 102,
}; // TODO (Story Flag ID)
STORYFLAG_ZELDA_DOWSING, STORYFLAG_RUPEE_DOWSING, STORYFLAG_ZELDA_DOWSING, STORYFLAG_CRYSTAL_DOWSING,
STORYFLAG_HEART_DOWSING, STORYFLAG_GODDESS_CUBE_DOWSING, STORYFLAG_109, STORYFLAG_TREASURE_DOWSING,
};
DowsingTarget::~DowsingTarget() {
doUnregister();
@@ -56,22 +57,23 @@ void DowsingTarget::getPosition(mVec3_c &position) {
PSMTXMultVec(mtx.m, mOffset, position);
}
// TODO (Story Flag IDs)
bool DowsingTarget::hasZeldaDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(100);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_ZELDA_DOWSING);
}
bool DowsingTarget::hasKikwiDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(56) && !StoryflagManager::sInstance->getCounterOrFlag(57);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_KIKWI_DOWSING) &&
!StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_KIKWI_FIND_FINISHED);
}
bool DowsingTarget::hasKeyPieceDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(106) && !StoryflagManager::sInstance->getCounterOrFlag(120);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_KEYPIECE_DOWSING) &&
!StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_KEYPIECE_COMPLETE);
}
bool DowsingTarget::hasDesertNodeDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(107) && !StoryflagManager::sInstance->getCounterOrFlag(8);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_GENERATOR_DOWSING) &&
!StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_LMF_RAISED);
}
inline bool checkTrial(u16 itemflag, u16 storyflag) {
@@ -81,45 +83,50 @@ inline bool checkTrial(u16 itemflag, u16 storyflag) {
false;
}
// TODO (Story Flag IDs) (you get the point lmao)
bool DowsingTarget::hasAnyTrialDowsing() {
return checkTrial(187, 93) || checkTrial(188, 97) || checkTrial(189, 98) || checkTrial(193, 99);
return checkTrial(ITEM_FARORES_COURAGE, STORYFLAG_FARON_TRIAL_UNLOCKED) ||
checkTrial(ITEM_NAYRUS_WISDOM, STORYFLAG_LANAYRU_TRIAL_UNLOCKED) ||
checkTrial(ITEM_DINS_POWER, STORYFLAG_ELDIN_TRIAL_UNLOCKED) ||
checkTrial(ITEM_SOTH, STORYFLAG_HYLIA_TRIAL_UNLOCKED);
}
bool DowsingTarget::hasSacredWaterDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(64) && !StoryflagManager::sInstance->getCounterOrFlag(65);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_SACRED_WATER_DOWSING) &&
!StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_WATER_DRAGON_HEALED);
}
bool DowsingTarget::hasSandshipDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(271) && !StoryflagManager::sInstance->getCounterOrFlag(14);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_SANDSHIP_DOWSING) &&
!StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_SANDSHIP_ENTERED);
}
bool DowsingTarget::hasTadtoneDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(81) && !StoryflagManager::sInstance->getCounterOrFlag(18);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_TADTONE_DOWSING) &&
!StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_ALL_TADTONES_GATHERED);
}
bool DowsingTarget::hasPropellerDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(668);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_PROPELLER_DOWSING);
}
bool DowsingTarget::hasWaterBasinDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(669);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_WATER_BASIN_DOWSING);
}
bool DowsingTarget::hasCrystalBallDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(670);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_CRYSTAL_BALL_DOWSING);
}
bool DowsingTarget::hasPumpkinDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(680);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_PUMPKIN_DOWSING);
}
bool DowsingTarget::hasNewPlantSpeciesDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(681);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_KIKWI_SPECIES_DOWSING);
}
bool DowsingTarget::hasPartyWheelDowsing() {
return StoryflagManager::sInstance->getCounterOrFlag(682);
return StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_PARTY_WHEEL_DOWSING);
}
bool DowsingTarget::hasDowsingInSlot(int slot) {
+16 -14
View File
@@ -14,7 +14,6 @@
#include "toBeSorted/file_manager.h"
#include "toBeSorted/unk_save_time.h"
// https://github.com/lepelog/skywardsword-tools/wiki/Navi-Table-(Fi-Advice)
// Portability hazard, only works for 32 bit architectures
@@ -88,7 +87,7 @@ s16 FiAnalysisHandle::getEquipmentFocus() const {
if (!isValid()) {
return -1;
} else {
if (StoryflagManager::sInstance->getCounterOrFlag(530)) {
if (StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_BOSS_RUSH_ACTIVE)) {
// "I cannot offer my usual analysis because you are currently engaged in a challenge created by the Thunder
// Dragon Lanayru."
return 180;
@@ -153,7 +152,7 @@ void FiContext::initialize(void *data) {
}
s16 FiContext::getNaviTableProgressSummary() {
if (StoryflagManager::sInstance->getFlag(530)) {
if (StoryflagManager::sInstance->getFlag(STORYFLAG_BOSS_RUSH_ACTIVE)) {
// When in boss rush, no progress is available since story flags
// are unreliable here.
// "You are currently reliving some of your previous battles within the Thunder Dragon's Lightning Round..."
@@ -172,7 +171,7 @@ s16 FiContext::getNaviTableProgressSummary() {
}
s16 FiContext::getFiAdviceHintEntry() {
if (StoryflagManager::sInstance->getFlag(530)) {
if (StoryflagManager::sInstance->getFlag(STORYFLAG_BOSS_RUSH_ACTIVE)) {
// When in boss rush, no hint since location doesn't make sense
// "Master, this is a world built from your memories by Lanayru, the Thunder Dragon"
return 37;
@@ -192,20 +191,22 @@ s16 FiContext::getFiAdviceHintEntry() {
}
s16 FiContext::getObjective() {
if (StoryflagManager::sInstance->getFlag(530)) {
if (StoryflagManager::sInstance->getFlag(STORYFLAG_BOSS_RUSH_ACTIVE)) {
// When in boss rush, objective is to beat the mode
// "Master, your primary objective is to defeat the enemy here and overcome the grueling task the Thunder
// Dragon, Lanayru, has set before you..."
return 92;
} else {
if (StoryflagManager::sInstance->getFlag(136) && StoryflagManager::sInstance->getFlag(143) &&
StoryflagManager::sInstance->getFlag(144) && StoryflagManager::sInstance->getFlag(145) &&
!StoryflagManager::sInstance->getFlag(133)) {
if (StoryflagManager::sInstance->getFlag(STORYFLAG_IMPRISONED_FIGHT) &&
StoryflagManager::sInstance->getFlag(STORYFLAG_IMPRISONED_1_FIGHT) &&
StoryflagManager::sInstance->getFlag(STORYFLAG_IMPRISONED_2_FIGHT) &&
StoryflagManager::sInstance->getFlag(STORYFLAG_IMPRISONED_3_FIGHT) &&
!StoryflagManager::sInstance->getFlag(STORYFLAG_IMPRISONED_3_DEFEATED)) {
// "Demise has once again broken the seal that binds him..."
return 70;
}
if (!StoryflagManager::sInstance->getCounterOrFlag(21)) {
if (!StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_THUNDER_DRAGON_SOTH_COMPLETED)) {
if (ItemflagManager::sInstance->getFlagDirect(ITEM_LIFE_TREE_SEED) &&
!ItemflagManager::sInstance->getFlagDirect(ITEM_LIFE_TREE_FRUIT)) {
// "I project that the soil in Lanayru Province will not provide enough nourishment for the Life Tree
@@ -310,7 +311,8 @@ u16 FiContext::prepareFiHelpIndex() {
}
}
if (FileManager::GetInstance()->getCurrentHealth() <= 12 && !StoryflagManager::sInstance->getCounterOrFlag(808)) {
if (FileManager::GetInstance()->getCurrentHealth() <= 12 &&
!StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_LOW_HEART_NOTICE)) {
ret = 6401;
// "Your hearts have decreased quite dramatically..."
setHelpIndex(0);
@@ -336,8 +338,8 @@ u16 FiContext::prepareFiHelpIndex() {
u32 numRupees = dAcItem_c::getRupeeCounter();
u32 walletCapacity = dAcItem_c::getCurrentWalletCapacity();
if (!StoryflagManager::sInstance->getFlag(727) && walletCapacity != 0 && numRupees == walletCapacity &&
!getField_0x47()) {
if (!StoryflagManager::sInstance->getFlag(STORYFLAG_WALLET_FULL_ACK) && walletCapacity != 0 &&
numRupees == walletCapacity && !getField_0x47()) {
ret = 6400;
// "Master, your wallet is full..."
setHelpIndex(5);
@@ -431,8 +433,8 @@ void FiContext::fn_8016CB40() {
}
bool FiContext::isInLeviasFightMaybe() {
if (dScGame_c::isCurrentStage("F023") && StoryflagManager::sInstance->getFlag(368) &&
!StoryflagManager::sInstance->getFlag(200)) {
if (dScGame_c::isCurrentStage("F023") && StoryflagManager::sInstance->getFlag(STORYFLAG_LEVIAS_FIGHT_STARTED) &&
!StoryflagManager::sInstance->getFlag(STORYFLAG_LEVIAS_FIGHT_DEFEATED)) {
return true;
}
return false;