mirror of
https://github.com/zeldaret/ss
synced 2026-06-20 07:53:16 -04:00
fi_context OK (also cleanup dFlow_c)
This commit is contained in:
@@ -1010,7 +1010,9 @@ d/lyt/d_lyt_cursor_stick.cpp:
|
||||
toBeSorted/fi_context.cpp:
|
||||
.text start:0x8016BCE0 end:0x8016CBD8 align:16
|
||||
.data start:0x80527BC0 end:0x80527BD0
|
||||
.sdata start:0x80572A08 end:0x80572A10
|
||||
.sbss start:0x80575500 end:0x80575508
|
||||
.sdata2 start:0x8057A1A8 end:0x8057A1D8
|
||||
|
||||
toBeSorted/item_mdl_name.cpp:
|
||||
.text start:0x8016CBE0 end:0x8016CC34 align:16
|
||||
|
||||
+17
-17
@@ -9329,30 +9329,30 @@ LytCursorStick__dtor = .text:0x8016BBF0; // type:function size:0x58
|
||||
fn_8016BC50 = .text:0x8016BC50; // type:function size:0x88
|
||||
isValid__16FiAnalysisHandleCFv = .text:0x8016BCE0; // type:function size:0x14
|
||||
getAreaIndexForFiAreaName__16FiAnalysisHandleCFv = .text:0x8016BD00; // type:function size:0x44
|
||||
fn_8016BD50 = .text:0x8016BD50; // type:function size:0x68
|
||||
getCurrentFocus__16FiAnalysisHandleFv = .text:0x8016BD50; // type:function size:0x68
|
||||
getEquipmentFocus__16FiAnalysisHandleCFv = .text:0x8016BDC0; // type:function size:0x68
|
||||
getSuitabilityArg__16FiAnalysisHandleCFv = .text:0x8016BE30; // type:function size:0x4C
|
||||
getSuitabilityLabel__16FiAnalysisHandleCFv = .text:0x8016BE80; // type:function size:0x50
|
||||
shieldRelated__16FiAnalysisHandleFv = .text:0x8016BED0; // type:function size:0x44
|
||||
getSuitabilityPercentageArg__16FiAnalysisHandleCFv = .text:0x8016BE30; // type:function size:0x4C
|
||||
getEquipmentRecommendation__16FiAnalysisHandleCFv = .text:0x8016BE80; // type:function size:0x50
|
||||
getThreatenedShield__16FiAnalysisHandleFv = .text:0x8016BED0; // type:function size:0x44
|
||||
getShieldMessage__16FiAnalysisHandleFv = .text:0x8016BF20; // type:function size:0x44
|
||||
initializeNaviTable = .text:0x8016BF70; // type:function size:0x88
|
||||
initialize__9FiContextFPv = .text:0x8016BF70; // type:function size:0x88
|
||||
getNaviTableProgressSummary__9FiContextFv = .text:0x8016C000; // type:function size:0xB8
|
||||
getFiAdviceHintEntry__9FiContextFv = .text:0x8016C0C0; // type:function size:0xC4
|
||||
getUnkObjectiveValue__9FiContextFv = .text:0x8016C190; // type:function size:0x1CC
|
||||
getObjective__9FiContextFv = .text:0x8016C190; // type:function size:0x1CC
|
||||
getNaviTableEquipmentCheckEntry__9FiContextFv = .text:0x8016C360; // type:function size:0x9C
|
||||
FiContext__setTargetedActorTextId = .text:0x8016C400; // type:function size:0x9C
|
||||
setTargetedActorTextId__9FiContextFl = .text:0x8016C400; // type:function size:0x9C
|
||||
rateBattlePerformance__9FiContextFUc = .text:0x8016C4A0; // type:function size:0x148
|
||||
prepareFiHelpIndex = .text:0x8016C5F0; // type:function size:0x288
|
||||
prepareFiHelpIndex__9FiContextFv = .text:0x8016C5F0; // type:function size:0x288
|
||||
getGlobalFiInfo0__9FiContextFl = .text:0x8016C880; // type:function size:0x20
|
||||
getTextMessage__9FiContextFl = .text:0x8016C8A0; // type:function size:0x54
|
||||
getButtonText__9FiContextFl = .text:0x8016C8A0; // type:function size:0x54
|
||||
create__9FiContextFv = .text:0x8016C900; // type:function size:0x2C
|
||||
FiContext__init = .text:0x8016C930; // type:function size:0xB4
|
||||
fn_8016C9F0 = .text:0x8016C9F0; // type:function size:0xC
|
||||
fn_8016CA00__9FiContextFv = .text:0x8016CA00; // type:function size:0xFC
|
||||
fn_8016CB00__9FiContextFl = .text:0x8016CB00; // type:function size:0x1C
|
||||
fn_8016CB20__9FiContextFv = .text:0x8016CB20; // type:function size:0x1C
|
||||
reset__9FiContextFv = .text:0x8016C930; // type:function size:0xB4
|
||||
resetSaveTimeRelated__9FiContextFv = .text:0x8016C9F0; // type:function size:0xC
|
||||
prepareFiCallOptions__9FiContextFv = .text:0x8016CA00; // type:function size:0xFC
|
||||
setAdviceOptions__9FiContextFl = .text:0x8016CB00; // type:function size:0x1C
|
||||
resetAdviceOptions__9FiContextFv = .text:0x8016CB20; // type:function size:0x1C
|
||||
fn_8016CB40__9FiContextFv = .text:0x8016CB40; // type:function size:0x1C
|
||||
fn_8016CB60 = .text:0x8016CB60; // type:function size:0x78
|
||||
isInLeviasFightMaybe__9FiContextFv = .text:0x8016CB60; // type:function size:0x78
|
||||
AcItem__isItemThatHasStruct = .text:0x8016CBE0; // type:function size:0x3C
|
||||
AcItem__getIndex = .text:0x8016CC20; // type:function size:0x14
|
||||
checkedAdd__7CounterFl = .text:0x8016CC40; // type:function size:0xF0
|
||||
@@ -10091,7 +10091,7 @@ adventurePouchFindItemSlot__F7ITEM_ID = .text:0x8018A650; // type:function size:
|
||||
adventurePouchCountItem__F7ITEM_ID = .text:0x8018A6E0; // type:function size:0x74
|
||||
convertLytPouchSlot__Fl = .text:0x8018A760; // type:function size:0x1C
|
||||
convertFilePouchSlot__Fl = .text:0x8018A780; // type:function size:0xAC
|
||||
fn_8018A830 = .text:0x8018A830; // type:function size:0x16C
|
||||
summarizePouchContents__FPlPlPl = .text:0x8018A830; // type:function size:0x16C
|
||||
hasAnyShields__Fv = .text:0x8018A9A0; // type:function size:0x7C
|
||||
changeItemPouchExtensionCounter = .text:0x8018AA20; // type:function size:0x10C
|
||||
getExtraAmmoInPouchByType = .text:0x8018AB30; // type:function size:0x98
|
||||
@@ -10903,7 +10903,7 @@ setField0x3C__7dFlow_cFv = .text:0x801B1C60; // type:function size:0xC
|
||||
checkField0x3C__7dFlow_cCFv = .text:0x801B1C70; // type:function size:0x14
|
||||
start__7dFlow_cFUs = .text:0x801B1C90; // type:function size:0xA4
|
||||
advanceUntil__7dFlow_cFllPl = .text:0x801B1D40; // type:function size:0x1C8
|
||||
shouldActorShowKillCount__7dFlow_cCFl = .text:0x801B1F10; // type:function size:0x38
|
||||
shouldHideKillCountForActor__7dFlow_cCFl = .text:0x801B1F10; // type:function size:0x38
|
||||
clear__7dFlow_cFv = .text:0x801B1F50; // type:function size:0x2C
|
||||
createLytMiniGame__7dFlow_cFv = .text:0x801B1F80; // type:function size:0xD8
|
||||
clearMinigame__7dFlow_cFv = .text:0x801B2060; // type:function size:0x98
|
||||
|
||||
+1
-1
@@ -532,7 +532,7 @@ config.libs = [
|
||||
Object(Matching, "d/lyt/d_lyt_common_arrow.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_common_title.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_cursor_stick.cpp"),
|
||||
Object(NonMatching, "toBeSorted/fi_context.cpp"),
|
||||
Object(Matching, "toBeSorted/fi_context.cpp"),
|
||||
Object(NonMatching, "toBeSorted/item_mdl_name.cpp"),
|
||||
Object(Matching, "toBeSorted/counters/counter.cpp"),
|
||||
Object(NonMatching, "toBeSorted/counters/counters.cpp"),
|
||||
|
||||
@@ -171,7 +171,7 @@ protected:
|
||||
void setNext(u16 next);
|
||||
void setField0x3C();
|
||||
bool checkField0x3C() const;
|
||||
bool shouldActorShowKillCount(s32 id) const;
|
||||
bool shouldHideKillCountForActor(s32 id) const;
|
||||
static void playSound(u32);
|
||||
void createLytMiniGame();
|
||||
void clearMinigame();
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "common.h"
|
||||
#include "d/a/d_a_itembase.h"
|
||||
|
||||
s32 summarizePouchContents(s32 *, s32 *, s32 *);
|
||||
|
||||
u32 convertFilePouchSlot(s32 fileSlot);
|
||||
s32 convertLytPouchSlot(s32 fileSlot);
|
||||
s32 getPouchSlotCount(bool unk);
|
||||
|
||||
@@ -421,6 +421,22 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static f32 getShieldLevel() {
|
||||
if (sInstance != nullptr) {
|
||||
return sInstance->mMain.mShield.getLevel();
|
||||
} else {
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static f32 getShieldGaugePercentMaybe() {
|
||||
if (sInstance != nullptr) {
|
||||
return sInstance->mMain.mShield.getGaugePercentMaybe();
|
||||
} else {
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x00004 */ d2d::ResAccIf_c mResAcc;
|
||||
/* 0x00374 */ dLytMeterEventSkip_c *mpEventSkip;
|
||||
|
||||
@@ -95,7 +95,7 @@ private:
|
||||
/* 0x420 */ dLytMeterCrossBtnParts_c mParts[4];
|
||||
/* 0x620 */ s32 field_0x620;
|
||||
/* 0x624 */ s32 field_0x624;
|
||||
/* 0x628 */ u16 field_0x628;
|
||||
/* 0x628 */ u16 mSavedFiFlow;
|
||||
/* 0x62C */ s32 mCallCount0;
|
||||
/* 0x630 */ s32 mCallCount1;
|
||||
/* 0x634 */ u8 field_0x634;
|
||||
|
||||
@@ -43,6 +43,10 @@ public:
|
||||
return field_0x31D;
|
||||
}
|
||||
|
||||
f32 getLevel() const {
|
||||
return field_0x2F0;
|
||||
}
|
||||
|
||||
private:
|
||||
s32 getLytFrameForShield(s32) const;
|
||||
void setLevel(f32 level);
|
||||
|
||||
@@ -3,40 +3,65 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct FiAnalysisEntry {
|
||||
/* 0x00 */ const char *mStageName;
|
||||
/* 0x04 */ u16 mStoryFlag;
|
||||
/* 0x06 */ s16 mKen3MonsterPresenceEntry;
|
||||
/* 0x08 */ u8 mSuitabilityPercent[4];
|
||||
/* 0x0C */ u16 mKen3SuitabilityAnalysis[4];
|
||||
/* 0x14 */ s16 mShieldType;
|
||||
/* 0x16 */ s16 mShieldMessage;
|
||||
};
|
||||
struct AnalysisEntry;
|
||||
|
||||
class FiAnalysisHandle {
|
||||
public:
|
||||
FiAnalysisHandle(AnalysisEntry *entry) : mpEntry(entry) {}
|
||||
s16 getEquipmentFocus() const;
|
||||
s16 getAreaIndexForFiAreaName() const;
|
||||
s32 getSuitabilityArg() const;
|
||||
s16 getSuitabilityLabel() const;
|
||||
s32 getSuitabilityPercentageArg() const;
|
||||
s16 getEquipmentRecommendation() const;
|
||||
s16 getShieldMessage();
|
||||
s16 shieldRelated();
|
||||
s16 getThreatenedShield();
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
private:
|
||||
FiAnalysisEntry *mpEntry;
|
||||
enum FiAnalysisEquipmentFocus_e {
|
||||
FOCUS_COMBAT,
|
||||
FOCUS_SURVIVAL,
|
||||
FOCUS_TREASURE,
|
||||
FOCUS_BALANCED,
|
||||
};
|
||||
|
||||
static FiAnalysisEquipmentFocus_e getCurrentFocus();
|
||||
|
||||
AnalysisEntry *mpEntry;
|
||||
};
|
||||
|
||||
class FiContext {
|
||||
public:
|
||||
enum KEN8_Button_e {
|
||||
KEN8_Summary = 0,
|
||||
KEN8_Hint = 1,
|
||||
KEN8_Objective = 2,
|
||||
KEN8_Analysis = 3,
|
||||
KEN8_PlayTime = 4,
|
||||
KEN8_Rumors = 5,
|
||||
KEN8_Other = 6,
|
||||
KEN8_Nevermind = 7,
|
||||
KEN8_Advice = 9,
|
||||
KEN8_None = 10,
|
||||
};
|
||||
|
||||
static void create();
|
||||
static void initialize(void *data);
|
||||
static s32 getGlobalFiInfo0(s32);
|
||||
static FiAnalysisHandle getNaviTableEquipmentCheckEntry();
|
||||
static u8 rateBattlePerformance(u8 enemyActorId);
|
||||
|
||||
/** KEN0 - player progress */
|
||||
static s16 getNaviTableProgressSummary();
|
||||
/** KEN1 - hint */
|
||||
static s16 getFiAdviceHintEntry();
|
||||
static s16 getUnkObjectiveValue();
|
||||
/** KEN2 - objective */
|
||||
static s16 getObjective();
|
||||
/* KEN3 - analysis*/
|
||||
static FiAnalysisHandle getNaviTableEquipmentCheckEntry();
|
||||
|
||||
static s32 setTargetedActorTextId(s32 id);
|
||||
|
||||
static u16 prepareFiHelpIndex();
|
||||
|
||||
bool getDoSpecialFiMenuHandling() const {
|
||||
return mDoSpecialFiMenuHandling;
|
||||
@@ -57,25 +82,49 @@ public:
|
||||
}
|
||||
|
||||
static const wchar_t *getMessageForFiInfo(s32 arg) {
|
||||
return getTextMessage(getGlobalFiInfo0(arg));
|
||||
return getButtonText(getGlobalFiInfo0(arg));
|
||||
}
|
||||
|
||||
static FiContext *GetInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
static bool getField_0x47() {
|
||||
if (sInstance != nullptr) {
|
||||
return sInstance->field_0x47;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void setField_0x48(bool val) {
|
||||
if (sInstance != nullptr) {
|
||||
sInstance->field_0x48 = val;
|
||||
}
|
||||
}
|
||||
|
||||
static bool getField_0x48() {
|
||||
if (sInstance != nullptr) {
|
||||
return sInstance->field_0x48;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void setField_0x4A(bool val) {
|
||||
if (sInstance != nullptr) {
|
||||
sInstance->field_0x4A = val;
|
||||
}
|
||||
}
|
||||
|
||||
static bool getField_0x4A() {
|
||||
if (sInstance != nullptr) {
|
||||
return sInstance->field_0x4A;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static s32 getHelpIndex() {
|
||||
if (sInstance != nullptr) {
|
||||
return sInstance->mFiHelpIndex;
|
||||
@@ -92,9 +141,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static void do_fn_8016CB00(s32 arg) {
|
||||
static void do_setAdviceOptions(s32 arg) {
|
||||
if (sInstance != nullptr) {
|
||||
sInstance->fn_8016CB00(arg);
|
||||
sInstance->setAdviceOptions(arg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,34 +153,53 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static void do_fn_8016CA00() {
|
||||
static void do_prepareFiCallOptions() {
|
||||
if (sInstance != nullptr) {
|
||||
sInstance->fn_8016CA00();
|
||||
sInstance->prepareFiCallOptions();
|
||||
}
|
||||
}
|
||||
|
||||
static void do_fn_8016CB20() {
|
||||
static void do_resetAdviceOptions() {
|
||||
if (sInstance != nullptr) {
|
||||
sInstance->fn_8016CB20();
|
||||
sInstance->resetAdviceOptions();
|
||||
}
|
||||
}
|
||||
|
||||
void resetField_0x3C();
|
||||
void reset();
|
||||
void resetSaveTimeRelated();
|
||||
void setAdviceOptions(s32 unused);
|
||||
void resetAdviceOptions();
|
||||
|
||||
static const wchar_t *getTextMessage(s32 idx);
|
||||
static const wchar_t *getButtonText(s32 idx);
|
||||
|
||||
private:
|
||||
static void setTargetActorId(s32 id) {
|
||||
if (sInstance != nullptr) {
|
||||
sInstance->mTargetActorId = id;
|
||||
}
|
||||
}
|
||||
|
||||
static void setHelpIndex(s32 idx) {
|
||||
if (sInstance != nullptr) {
|
||||
sInstance->mFiHelpIndex = idx;
|
||||
}
|
||||
}
|
||||
|
||||
static FiContext *sInstance;
|
||||
|
||||
void fn_8016CB00(s32);
|
||||
void fn_8016CB40();
|
||||
void fn_8016CA00();
|
||||
void fn_8016CB20();
|
||||
void prepareFiCallOptions();
|
||||
bool isInLeviasFightMaybe();
|
||||
|
||||
/* 0x00 */ u8 _0x00[0x34 - 0x00];
|
||||
/* 0x00 */ s32 mFiButtonOptions[10]; // correspond to KEN8 with an offset of +1
|
||||
/* 0x28 */ s32 field_0x28;
|
||||
/* 0x2C */ s32 field_0x2C;
|
||||
/* 0x30 */ s32 field_0x30;
|
||||
/* 0x34 */ s32 mTargetActorId;
|
||||
/* 0x38 */ s32 mFiHelpIndex;
|
||||
/* 0x3C */ u8 _0x3C[0x48 - 0x3C];
|
||||
/* 0x3C */ u8 mSaveTimeRelated;
|
||||
/* 0x3D */ u8 field_0x3D[10];
|
||||
/* 0x47 */ bool field_0x47;
|
||||
/* 0x48 */ bool field_0x48;
|
||||
/* 0x49 */ bool field_0x49;
|
||||
/* 0x4A */ bool field_0x4A;
|
||||
|
||||
@@ -108,9 +108,9 @@ public:
|
||||
/* 8000AAA0 */ void initFile(int fileNum);
|
||||
|
||||
/* 8000ABD0 */ void setCurrentHealthCapacity(s16 health);
|
||||
/* 8000AC00 */ s16 getCurrentHealthCapacity();
|
||||
/* 8000AC00 */ u16 getCurrentHealthCapacity();
|
||||
/* 8000AC50 */ void setCurrentHealth(s16 health);
|
||||
/* 8000AC80 */ s16 getCurrentHealth();
|
||||
/* 8000AC80 */ u16 getCurrentHealth();
|
||||
|
||||
/* 8000ACD0 */ u16 getLoadRoomT1();
|
||||
/* 8000AD20 */ u16 getLoadRoomT2();
|
||||
|
||||
@@ -13,6 +13,10 @@ public:
|
||||
return field_0x08;
|
||||
}
|
||||
|
||||
s64 getField_0x30() const {
|
||||
return field_0x30;
|
||||
}
|
||||
|
||||
s64 fn_801907D0();
|
||||
void fn_801907F0();
|
||||
void fn_801909A0();
|
||||
@@ -21,7 +25,9 @@ private:
|
||||
static SaveTimeRelated *sInstance;
|
||||
|
||||
/* 0x00 */ u8 _0x00[0x08 - 0x00];
|
||||
/* 0x08 */ u64 field_0x08;
|
||||
/* 0x08 */ s64 field_0x08;
|
||||
/* 0x10 */ u8 field_0x10[0x30 - 0x10];
|
||||
/* 0x30 */ s64 field_0x30;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+10
-4
@@ -28,6 +28,9 @@
|
||||
#include "toBeSorted/arc_managers/oarc_manager.h"
|
||||
#include "toBeSorted/d_d3d.h"
|
||||
#include "toBeSorted/d_hbm.h"
|
||||
#include "toBeSorted/d_emitter.h"
|
||||
#include "toBeSorted/d_particle.h"
|
||||
#include "toBeSorted/fi_context.h"
|
||||
#include "toBeSorted/reload_color_fader.h"
|
||||
#include "toBeSorted/save_manager.h"
|
||||
#include "toBeSorted/save_related.h"
|
||||
@@ -276,10 +279,13 @@ sFPhaseBase::sFPhaseState dScBoot_c::cb7() {
|
||||
return sFPhaseBase::PHASE_RETRY;
|
||||
}
|
||||
|
||||
// TODO JParticle monkaS
|
||||
OarcManager::GetInstance()->getData("System", "dat/navi_table.dat");
|
||||
OarcManager::GetInstance()->getData("JpaCommon", "dat/Common.jpc");
|
||||
OarcManager::GetInstance()->getData("JpaCommon", "dat/Common.jpn");
|
||||
void *naviDat = OarcManager::GetInstance()->getData("System", "dat/navi_table.dat");
|
||||
FiContext::initialize(naviDat);
|
||||
dParticle::mgr_c::create(dHeap::work1Heap.heap, 0xBB8, 0xFA, 0xF);
|
||||
dJEffManager_c::createEffManagers();
|
||||
void *jpc = OarcManager::GetInstance()->getData("JpaCommon", "dat/Common.jpc");
|
||||
void *jpn = OarcManager::GetInstance()->getData("JpaCommon", "dat/Common.jpn");
|
||||
dParticle::mgr_c::GetInstance()->createResource(dHeap::workExHeap.heap, 0, jpc, jpn);
|
||||
|
||||
return sFPhaseBase::PHASE_NEXT;
|
||||
}
|
||||
|
||||
+73
-20
@@ -285,7 +285,7 @@ bool dFlow_c::handleEventInternal(const MsbFlowInfo *element) {
|
||||
case 2: {
|
||||
hi = 6;
|
||||
lo = 200;
|
||||
field_0x5C = FiContext::getUnkObjectiveValue();
|
||||
field_0x5C = FiContext::getObjective();
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
@@ -319,7 +319,7 @@ bool dFlow_c::handleEventInternal(const MsbFlowInfo *element) {
|
||||
lo = 900;
|
||||
break;
|
||||
}
|
||||
FiContext::do_fn_8016CB00(FiContext::getGlobalFiInfo0(selectedOption));
|
||||
FiContext::do_setAdviceOptions(FiContext::getGlobalFiInfo0(selectedOption));
|
||||
field_0x46 = lo + hi * 1000;
|
||||
} else {
|
||||
triggerEntryPoint((params1n2 >> 16) & 0xFFFF, params1n2 & 0xFFFF);
|
||||
@@ -549,21 +549,29 @@ bool dFlow_c::handleMessage() {
|
||||
// Does this make sense? Result is unused...
|
||||
LMS_GetAttribute(dMessage_c::getMsbtInfoForIndex(dMessage_c::getInstance()->getCurrentTextFileNumber()), hasLabel);
|
||||
if (mCurrentTextLabelName == "KEN0_08") {
|
||||
// "After winning the race in the Wing Ceremony..."
|
||||
// Current objective - use value from FiContext::getObjective?
|
||||
if (field_0x5C < 0) {
|
||||
field_0x5C = 8;
|
||||
}
|
||||
mCurrentTextLabelName.sprintf("KEN0_%02d", field_0x5C);
|
||||
} else if (mCurrentTextLabelName == "KEN1_000") {
|
||||
// "This is Skyloft..."
|
||||
// Area analysis - use value from FiContext::???
|
||||
if (field_0x5C < 0) {
|
||||
field_0x5C = 0;
|
||||
}
|
||||
mCurrentTextLabelName.sprintf("KEN1_%03d", field_0x5C);
|
||||
} else if (mCurrentTextLabelName == "KEN2_000") {
|
||||
// "To search for Zelda..."
|
||||
// Hint - use value from FiContext::getFiAdviceHintEntry?
|
||||
if (field_0x5C < 0) {
|
||||
field_0x5C = 2;
|
||||
}
|
||||
mCurrentTextLabelName.sprintf("KEN2_%03d", field_0x5C);
|
||||
} else if (mCurrentTextLabelName == "KEN3_500") {
|
||||
// "Master, your current selection of pouch items is..."
|
||||
// Equipment focus
|
||||
FiAnalysisHandle analysis = FiContext::getNaviTableEquipmentCheckEntry();
|
||||
SizedString<16> label;
|
||||
label.sprintf("KEN3_%03d", analysis.getEquipmentFocus());
|
||||
@@ -571,6 +579,8 @@ bool dFlow_c::handleMessage() {
|
||||
dMessage_c::getTextMessageByLabel(label, true, nullptr, nullptr), 0
|
||||
);
|
||||
} else if (mCurrentTextLabelName == "KEN3_000") {
|
||||
// "You are located in the Sealed Grounds..."
|
||||
// Threat assessment
|
||||
FiAnalysisHandle analysis = FiContext::getNaviTableEquipmentCheckEntry();
|
||||
s16 value = analysis.getAreaIndexForFiAreaName();
|
||||
if (value < 0) {
|
||||
@@ -578,17 +588,23 @@ bool dFlow_c::handleMessage() {
|
||||
}
|
||||
mCurrentTextLabelName.sprintf("KEN3_%03d", value);
|
||||
} else if (mCurrentTextLabelName == "KEN3_501") {
|
||||
// "Suitability to current location is..."
|
||||
// Suitability analysis
|
||||
FiAnalysisHandle analysis = FiContext::getNaviTableEquipmentCheckEntry();
|
||||
s32 arg = analysis.getSuitabilityArg();
|
||||
s32 arg = analysis.getSuitabilityPercentageArg();
|
||||
dLytMsgWindow_c::getInstance()->setNumericArg0(arg);
|
||||
} else if (mCurrentTextLabelName == "KEN3_100") {
|
||||
// "My projections indicate that equipping..."
|
||||
// Equipment recommendation
|
||||
FiAnalysisHandle analysis = FiContext::getNaviTableEquipmentCheckEntry();
|
||||
s16 value = analysis.getSuitabilityLabel();
|
||||
s16 value = analysis.getEquipmentRecommendation();
|
||||
if (value < 0) {
|
||||
value = 0;
|
||||
}
|
||||
mCurrentTextLabelName.sprintf("KEN3_%03d", value);
|
||||
} else if (mCurrentTextLabelName == "KEN3_200") {
|
||||
// "To make matters worse, your Wooden Shield..."
|
||||
// Shield danger (wooden vs fire, iron vs electrical)
|
||||
FiAnalysisHandle analysis = FiContext::getNaviTableEquipmentCheckEntry();
|
||||
s16 value = analysis.getShieldMessage();
|
||||
if (value < 0) {
|
||||
@@ -596,6 +612,7 @@ bool dFlow_c::handleMessage() {
|
||||
}
|
||||
mCurrentTextLabelName.sprintf("KEN3_%03d", value);
|
||||
} else if (mCurrentTextLabelName == "KEN4_000") {
|
||||
// Your hearts have decreased quite dramatically...
|
||||
s32 fiHelpIndex = FiContext::getHelpIndex();
|
||||
if (fiHelpIndex < 0) {
|
||||
fiHelpIndex = 0;
|
||||
@@ -605,6 +622,7 @@ bool dFlow_c::handleMessage() {
|
||||
}
|
||||
mCurrentTextLabelName.sprintf("KEN4_%03d", fiHelpIndex);
|
||||
} else if (mCurrentTextLabelName == "KEN5_000") {
|
||||
// This is...
|
||||
s32 targetActorId = FiContext::getTargetActorId();
|
||||
if (targetActorId < 0) {
|
||||
targetActorId = 0;
|
||||
@@ -612,9 +630,12 @@ bool dFlow_c::handleMessage() {
|
||||
if (targetActorId <= 480) {
|
||||
mCurrentTextLabelName.sprintf("KEN5_%03d", targetActorId);
|
||||
} else {
|
||||
// "My apologies. I have no relevant information on the subject in my sizable memory."
|
||||
// FiHead
|
||||
mCurrentTextLabelName.sprintf("KEN7_000");
|
||||
}
|
||||
} else if (mCurrentTextLabelName == "KEN6_000") {
|
||||
// "Target lock: ..."
|
||||
s32 targetActorId = FiContext::getTargetActorId();
|
||||
if (targetActorId < 0) {
|
||||
targetActorId = 0;
|
||||
@@ -625,6 +646,7 @@ bool dFlow_c::handleMessage() {
|
||||
mCurrentTextLabelName.sprintf("KEN7_000");
|
||||
}
|
||||
} else if (mCurrentTextLabelName == "KEN6_107") {
|
||||
// "You have defeated <X> of this type of enemy. My analysis shows that your battle performance..."
|
||||
s32 targetActorId = FiContext::getTargetActorId();
|
||||
if (targetActorId < 0) {
|
||||
targetActorId = 0;
|
||||
@@ -633,26 +655,31 @@ bool dFlow_c::handleMessage() {
|
||||
u8 performance = FiContext::rateBattlePerformance(targetActorId);
|
||||
if (performance == 0xFF) {
|
||||
dLytMsgWindow_c::getInstance()->setNumericArg0(killCount);
|
||||
// "You have defeated <X> of this enemy type. I am unable to analyze your battle performance..."
|
||||
mCurrentTextLabelName.sprintf("KEN6_108");
|
||||
} else {
|
||||
dLytMsgWindow_c::getInstance()->setNumericArg0(killCount);
|
||||
SizedString<16> tmpLabel;
|
||||
// "very strong, ..., very weak"
|
||||
tmpLabel.sprintf("KEN6_1%02d", performance);
|
||||
dLytMsgWindow_c::getInstance()->getTagProcessor()->setStringArg(
|
||||
dMessage_c::getTextMessageByLabel(tmpLabel, true, nullptr, nullptr), 0
|
||||
);
|
||||
}
|
||||
} else if (mCurrentTextLabelName == "KEN7_000") {
|
||||
// "My apologies. I have no relevant information on the subject in my sizable memory."
|
||||
s32 targetActorId = FiContext::getTargetActorId();
|
||||
if (targetActorId < 0) {
|
||||
targetActorId = 0;
|
||||
}
|
||||
if (targetActorId <= 561) {
|
||||
// object info
|
||||
mCurrentTextLabelName.sprintf("KEN7_%03d", targetActorId);
|
||||
} else {
|
||||
mCurrentTextLabelName.sprintf("KEN7_000");
|
||||
}
|
||||
} else if (mCurrentTextLabelName == "KEN8_000" || mCurrentTextLabelName == "KEN2_096") {
|
||||
// "Current Session Play Time: ... Total Play Time: ..."
|
||||
s32 seconds = OS_TICKS_TO_SEC(SaveTimeRelated::GetInstance()->getField_0x08());
|
||||
s32 minutes_ = seconds / 60;
|
||||
s32 minutes = minutes_ % 60;
|
||||
@@ -672,12 +699,16 @@ bool dFlow_c::handleMessage() {
|
||||
s32 time[4] = {hours, minutes, hours1, minutes1};
|
||||
dLytMsgWindow_c::getInstance()->setNumericArgs(time, 4);
|
||||
} else if (mCurrentTextLabelName == "KEN9_000") {
|
||||
// Random hint
|
||||
s32 v;
|
||||
if (StoryflagManager::sInstance->getCounterOrFlag(530)) {
|
||||
// "When you require my analysis..."
|
||||
v = 200;
|
||||
} else if (dStageMgr_c::GetInstance()->getSTIFbyte4() == 0) {
|
||||
// Sky rumor
|
||||
v = cM::rndInt(30);
|
||||
} else {
|
||||
// Elsewhere rumor
|
||||
v = cM::rndInt(30) + 30;
|
||||
}
|
||||
mCurrentTextLabelName.sprintf("KEN9_%03d", v);
|
||||
@@ -705,14 +736,14 @@ u16 dFlow_c::getSwitchChoice(const MsbFlowInfo *element, u16 param) const {
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void setTagProcessorFiArgument(s32 a1, s32 a2) {
|
||||
inline void setTagProcessorFiArgument(s32 argIdx, s32 btnIdx) {
|
||||
dTagProcessor_c *p = dLytMsgWindow_c::getInstance()->getTagProcessor();
|
||||
p->setStringArg(FiContext::getMessageForFiInfo(a1), a2);
|
||||
p->setStringArg(FiContext::getMessageForFiInfo(argIdx), btnIdx);
|
||||
}
|
||||
|
||||
inline void setTagProcessorArgument(s32 a1, s32 a2) {
|
||||
inline void setTagProcessorArgument(s32 textLabel, s32 btnIdx) {
|
||||
dTagProcessor_c *p = dLytMsgWindow_c::getInstance()->getTagProcessor();
|
||||
p->setStringArg(FiContext::getTextMessage(a1), a2);
|
||||
p->setStringArg(FiContext::getButtonText(textLabel), btnIdx);
|
||||
}
|
||||
|
||||
u16 dFlow_c::branchHandler00(const MsbFlowInfo *element) const {
|
||||
@@ -726,7 +757,7 @@ u16 dFlow_c::branchHandler01(const MsbFlowInfo *element) const {
|
||||
u16 dFlow_c::branchHandler02(const MsbFlowInfo *element) const {
|
||||
if (FiContext::getDoSpecialFiMenuHandlingChecked()) {
|
||||
if (dLytMsgWindow_c::getInstance()->getTextOptionSelection() == 0 && FiContext::getGlobalFiInfo0(0) == 9) {
|
||||
FiContext::do_fn_8016CB20();
|
||||
FiContext::do_resetAdviceOptions();
|
||||
setTagProcessorFiArgument(0, 0);
|
||||
setTagProcessorFiArgument(1, 1);
|
||||
setTagProcessorFiArgument(2, 2);
|
||||
@@ -849,7 +880,7 @@ u16 dFlow_c::branchHandler19(const MsbFlowInfo *element) const {
|
||||
break;
|
||||
case 6: {
|
||||
FiAnalysisHandle handle = FiContext::getNaviTableEquipmentCheckEntry();
|
||||
switch (handle.shieldRelated()) {
|
||||
switch (handle.getThreatenedShield()) {
|
||||
case 0:
|
||||
if (dAcPy_c::getCurrentlyEquippedShieldType() == 0) {
|
||||
ret = 0;
|
||||
@@ -892,7 +923,7 @@ u16 dFlow_c::branchHandler20(const MsbFlowInfo *element) const {
|
||||
|
||||
u16 dFlow_c::branchHandler21(const MsbFlowInfo *element) const {
|
||||
u16 ret = 0;
|
||||
if (shouldActorShowKillCount(FiContext::getTargetActorId())) {
|
||||
if (shouldHideKillCountForActor(FiContext::getTargetActorId())) {
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
@@ -965,20 +996,20 @@ void dFlow_c::triggerEntryPoint(s32 labelPart1, s32 labelPart2) {
|
||||
|
||||
if (labelPart1 == 6 && labelPart2 == 801) {
|
||||
// "You called for me, Master?"
|
||||
FiContext::do_fn_8016CA00();
|
||||
FiContext::do_prepareFiCallOptions();
|
||||
FiContext::setDoSpecialFiMenuHandling(true);
|
||||
FiContext::do_fn_8016CB40();
|
||||
setTagProcessorFiArgument(0, 0);
|
||||
setTagProcessorFiArgument(1, 1);
|
||||
setTagProcessorFiArgument(2, 2);
|
||||
setTagProcessorArgument(7, 3);
|
||||
setTagProcessorArgument(FiContext::KEN8_Nevermind, 3);
|
||||
} else if (labelPart1 == 6 && labelPart2 == 802) {
|
||||
// Doesn't seem to exist in the files
|
||||
FiContext::setDoSpecialFiMenuHandling(true);
|
||||
setTagProcessorFiArgument(0, 0);
|
||||
setTagProcessorFiArgument(1, 1);
|
||||
setTagProcessorFiArgument(2, 2);
|
||||
setTagProcessorArgument(7, 3);
|
||||
setTagProcessorArgument(FiContext::KEN8_Nevermind, 3);
|
||||
}
|
||||
u16 entry = findEntryPoint(labelPart1, labelPart2);
|
||||
start(entry);
|
||||
@@ -1086,13 +1117,35 @@ bool dFlow_c::advanceUntil(s32 searchType, s32 searchParam3, s32 *pOutParams1n2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: Where are these IDs from?
|
||||
static const s32 sActorsWithKillCount[] = {0, 1, 10, 46, 47, 48, 49, 50, 51, 52, 53,
|
||||
54, 55, 65, 67, 77, 81, 87, 88, 89, 90, -1};
|
||||
// TODO: Used KEN6 as reference, will be set from dAcBase_c::targetFiTextId (0x114)
|
||||
static const s32 sActorsWithoutKillCount[] = {
|
||||
0, // Remlit (Day)
|
||||
1, // Remlit (Night)
|
||||
10, // Moldarach
|
||||
46, // Stalmaster
|
||||
47, // LD-002S Scervo
|
||||
48, // Koloktos
|
||||
49, // Ghirahim (G1)
|
||||
50, // Ghirahim (G2)
|
||||
51, // Ghirahim (G3.1)
|
||||
52, // The Imprisoned
|
||||
53, // The Imprisoned
|
||||
54, // The Imprisoned
|
||||
55, // Demise
|
||||
65, // Scaldera
|
||||
67, // <?>
|
||||
77, // Tentalus
|
||||
81, // Peahat
|
||||
87, // Sentrobe Bomb
|
||||
88, // LD-003D Dreadfuse
|
||||
89, // Ghirahim (G3.2)
|
||||
90, // Ghirahim (G3.3)
|
||||
-1 // <end of array>
|
||||
};
|
||||
|
||||
bool dFlow_c::shouldActorShowKillCount(s32 id) const {
|
||||
for (s32 i = 0; sActorsWithKillCount[i] >= 0; i++) {
|
||||
if (sActorsWithKillCount[i] == id) {
|
||||
bool dFlow_c::shouldHideKillCountForActor(s32 id) const {
|
||||
for (s32 i = 0; sActorsWithoutKillCount[i] >= 0; i++) {
|
||||
if (sActorsWithoutKillCount[i] == id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "d/lyt/d_lyt_unknowns.h"
|
||||
#include "d/lyt/meter/d_lyt_meter.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/fi_context.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
STATE_DEFINE(dLytMeterCrossBtnParts_c, Wait);
|
||||
@@ -406,7 +407,7 @@ bool dLytMeterCrossBtn_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
field_0x635 = 0;
|
||||
field_0x636 = 0;
|
||||
|
||||
field_0x628 = 0xFFFF;
|
||||
mSavedFiFlow = 0xFFFF;
|
||||
mCallCount0 = 0;
|
||||
mCallCount1 = 0;
|
||||
field_0x620 = 6;
|
||||
@@ -457,11 +458,10 @@ bool dLytMeterCrossBtn_c::remove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" u16 prepareFiHelpIndex();
|
||||
bool dLytMeterCrossBtn_c::execute() {
|
||||
u16 newFiValue = prepareFiHelpIndex();
|
||||
if (newFiValue != field_0x628) {
|
||||
field_0x628 = newFiValue;
|
||||
u16 newFiFlow = FiContext::prepareFiHelpIndex();
|
||||
if (newFiFlow != mSavedFiFlow) {
|
||||
mSavedFiFlow = newFiFlow;
|
||||
mCallCount0 = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ bool dLytMeterShieldGauge_c::execute() {
|
||||
}
|
||||
|
||||
if (mAnm[SHIELD_ANIM_BREAK].isEnabled()) {
|
||||
if (field_0x318 == 0 && field_0x2E0 > 0) {
|
||||
if (field_0x318 == 0 && field_0x2E0 > 0.0f) {
|
||||
mAnm[SHIELD_ANIM_BREAK].setFrame(0.0f);
|
||||
mAnm[SHIELD_ANIM_BREAK].setAnimEnable(true); // redundant?
|
||||
field_0x30C = 0;
|
||||
|
||||
@@ -90,7 +90,7 @@ bool dLytMsgWindow_c::build() {
|
||||
mpMsgWindowUnk = new TextWindowUnk(mpTagProcessor);
|
||||
|
||||
if (FiContext::GetInstance() != nullptr) {
|
||||
FiContext::GetInstance()->resetField_0x3C();
|
||||
FiContext::GetInstance()->resetSaveTimeRelated();
|
||||
}
|
||||
|
||||
mpWindowTalk = nullptr;
|
||||
@@ -105,7 +105,7 @@ bool dLytMsgWindow_c::build() {
|
||||
mpCurrentSubtype = nullptr;
|
||||
|
||||
mTextOptionSelection = 0;
|
||||
mSpecialFiMenuValue = 7;
|
||||
mSpecialFiMenuValue = FiContext::KEN8_Nevermind;
|
||||
|
||||
field_0x1220 = 0;
|
||||
|
||||
@@ -199,7 +199,7 @@ void dLytMsgWindow_c::executeState_Invisible() {
|
||||
} else {
|
||||
createSubMsgManager(mpTagProcessor->getMsgWindowSubtype());
|
||||
field_0x828 = nullptr;
|
||||
mSpecialFiMenuValue = 7;
|
||||
mSpecialFiMenuValue = FiContext::KEN8_Nevermind;
|
||||
if (mpTagProcessor->getMsgWindowSubtype() == 6) {
|
||||
mpCurrentSubtype = mpWindowWood;
|
||||
dTextBox_c *box = mpCurrentSubtype->getTextBox();
|
||||
@@ -523,7 +523,7 @@ void dLytMsgWindow_c::executeState_WaitKeySelectQuestion() {
|
||||
case 0: mSpecialFiMenuValue = FiContext::getGlobalFiInfo0(0); break;
|
||||
case 1: mSpecialFiMenuValue = FiContext::getGlobalFiInfo0(1); break;
|
||||
case 2: mSpecialFiMenuValue = FiContext::getGlobalFiInfo0(2); break;
|
||||
case 3: mSpecialFiMenuValue = 7; break;
|
||||
case 3: mSpecialFiMenuValue = FiContext::KEN8_Nevermind; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ dEmitterBase_c::~dEmitterBase_c() {
|
||||
}
|
||||
|
||||
JPABaseEmitter *dEmitterBase_c::GetNextEmitter(JPABaseEmitter *head) {
|
||||
// Portability hazard: u32->pointer cast
|
||||
return reinterpret_cast<JPABaseEmitter *>(head->getUserWork());
|
||||
}
|
||||
|
||||
@@ -132,6 +133,7 @@ bool dEmitterBase_c::createEmitters(
|
||||
);
|
||||
if (last != nullptr) {
|
||||
if (head != nullptr) {
|
||||
// Portability hazard: pointer->u32 cast
|
||||
head->setUserWork(reinterpret_cast<u32>(last));
|
||||
} else {
|
||||
mpEmitterHead = last;
|
||||
|
||||
@@ -0,0 +1,439 @@
|
||||
#include "toBeSorted/fi_context.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/d_a_item.h"
|
||||
#include "d/d_message.h"
|
||||
#include "d/d_pouch.h"
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/d_stage_mgr.h"
|
||||
#include "d/flag/itemflag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "d/lyt/meter/d_lyt_meter.h"
|
||||
#include "sized_string.h"
|
||||
#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
|
||||
|
||||
struct AdviceSummaryEntry {
|
||||
/* 0x00 */ u16 storyflag;
|
||||
/* 0x02 */ u16 KEN0_entry_num;
|
||||
};
|
||||
|
||||
struct AdviceHintEntry {
|
||||
/* 0x00 */ char *stage_name_ptr;
|
||||
/* 0x04 */ s16 storyflag;
|
||||
/* 0x06 */ u16 KEN1_entry_num;
|
||||
};
|
||||
|
||||
struct ObjectiveEntry {
|
||||
/* 0x00 */ u16 storyflag;
|
||||
/* 0x02 */ u16 KEN2_entry_num;
|
||||
};
|
||||
|
||||
struct AnalysisEntry {
|
||||
/* 0x00 */ char *stage_name_ptr;
|
||||
/* 0x04 */ s16 storyflag;
|
||||
/* 0x06 */ u16 KEN3_danger_entry_num;
|
||||
/* 0x08 */ u8 sutability_percent[4];
|
||||
/* 0x0C */ u16 KEN3_sutability_entry_num[4];
|
||||
/* 0x14 */ u16 area_shield_danger; // -1-no danger, 0-wooden burns, 1- iron electrifies
|
||||
/* 0x16 */ u16 KEN3_shield_entry_num;
|
||||
};
|
||||
|
||||
struct FileHeader {
|
||||
/* 0x00 */ u32 magic; // Is `V001`
|
||||
/* 0x04 */ u16 summary_count;
|
||||
/* 0x06 */ u16 hint_count;
|
||||
/* 0x08 */ u16 objective_count;
|
||||
/* 0x0A */ u16 analysis_count;
|
||||
/* 0x0C */ AdviceSummaryEntry *summary; // ptr to AdviceSummaryEntry[summary_count]
|
||||
/* 0x10 */ AdviceHintEntry *hint; // ptr to AdviceHintEntry[hint_count]
|
||||
/* 0x14 */ ObjectiveEntry *objective; // ptr to ObjectiveEntry[objective_count]
|
||||
/* 0x18 */ AnalysisEntry *analysis; // ptr to AnalysisEntry[analysis_count]
|
||||
};
|
||||
|
||||
bool FiAnalysisHandle::isValid() const {
|
||||
return mpEntry != nullptr;
|
||||
}
|
||||
|
||||
s16 FiAnalysisHandle::getAreaIndexForFiAreaName() const {
|
||||
if (isValid()) {
|
||||
return mpEntry->KEN3_danger_entry_num;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
FiAnalysisHandle::FiAnalysisEquipmentFocus_e FiAnalysisHandle::getCurrentFocus() {
|
||||
s32 pouchContents = summarizePouchContents(nullptr, nullptr, nullptr);
|
||||
if (pouchContents == 0) {
|
||||
return FOCUS_COMBAT;
|
||||
} else if (pouchContents == 1) {
|
||||
return FOCUS_BALANCED;
|
||||
} else if (pouchContents == 2) {
|
||||
return FOCUS_TREASURE;
|
||||
} else if (pouchContents == 3) {
|
||||
return FOCUS_SURVIVAL;
|
||||
}
|
||||
return FOCUS_COMBAT;
|
||||
}
|
||||
|
||||
s16 FiAnalysisHandle::getEquipmentFocus() const {
|
||||
static const s16 sEquipmentFocuses[] = {400, 403, 402, 401};
|
||||
if (!isValid()) {
|
||||
return -1;
|
||||
} else {
|
||||
if (StoryflagManager::sInstance->getCounterOrFlag(530)) {
|
||||
// "I cannot offer my usual analysis because you are currently engaged in a challenge created by the Thunder
|
||||
// Dragon Lanayru."
|
||||
return 180;
|
||||
}
|
||||
return sEquipmentFocuses[getCurrentFocus()];
|
||||
}
|
||||
}
|
||||
|
||||
s32 FiAnalysisHandle::getSuitabilityPercentageArg() const {
|
||||
if (!isValid()) {
|
||||
return -1;
|
||||
} else {
|
||||
return mpEntry->sutability_percent[getCurrentFocus()];
|
||||
}
|
||||
}
|
||||
|
||||
s16 FiAnalysisHandle::getEquipmentRecommendation() const {
|
||||
if (!isValid()) {
|
||||
return -1;
|
||||
} else {
|
||||
return mpEntry->KEN3_sutability_entry_num[getCurrentFocus()];
|
||||
}
|
||||
}
|
||||
|
||||
s16 FiAnalysisHandle::getThreatenedShield() {
|
||||
if (isValid()) {
|
||||
return mpEntry->area_shield_danger;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
s16 FiAnalysisHandle::getShieldMessage() {
|
||||
if (isValid()) {
|
||||
return mpEntry->KEN3_shield_entry_num;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
FiContext *FiContext::sInstance;
|
||||
static FileHeader *sNaviTable;
|
||||
|
||||
#define BIND_PTR(type, header, pointer) \
|
||||
pointer = reinterpret_cast<type *>(reinterpret_cast<char *>(header) + reinterpret_cast<u32>(pointer))
|
||||
|
||||
void FiContext::initialize(void *data) {
|
||||
FileHeader *header = reinterpret_cast<FileHeader *>(data);
|
||||
BIND_PTR(AdviceSummaryEntry, header, header->summary);
|
||||
BIND_PTR(AdviceHintEntry, header, header->hint);
|
||||
AdviceHintEntry *hint = header->hint;
|
||||
for (s32 i = 0; i < header->hint_count; i++) {
|
||||
BIND_PTR(char, header, hint[i].stage_name_ptr);
|
||||
}
|
||||
BIND_PTR(ObjectiveEntry, header, header->objective);
|
||||
BIND_PTR(AnalysisEntry, header, header->analysis);
|
||||
AnalysisEntry *analysis = header->analysis;
|
||||
for (s32 i = 0; i < header->analysis_count; i++) {
|
||||
BIND_PTR(char, header, analysis[i].stage_name_ptr);
|
||||
}
|
||||
sNaviTable = header;
|
||||
}
|
||||
|
||||
s16 FiContext::getNaviTableProgressSummary() {
|
||||
if (StoryflagManager::sInstance->getFlag(530)) {
|
||||
// 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..."
|
||||
return 40;
|
||||
} else {
|
||||
// Find the last entry with a set story flag
|
||||
AdviceSummaryEntry *last = sNaviTable->summary + (sNaviTable->summary_count - 1);
|
||||
for (s32 i = 0; i < sNaviTable->summary_count; i++) {
|
||||
if (StoryflagManager::sInstance->getFlag(last->storyflag)) {
|
||||
return last->KEN0_entry_num;
|
||||
}
|
||||
last--;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
s16 FiContext::getFiAdviceHintEntry() {
|
||||
if (StoryflagManager::sInstance->getFlag(530)) {
|
||||
// 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;
|
||||
} else {
|
||||
// Find the first entry that matches the current stage, if its story flag matches (if any)
|
||||
AdviceHintEntry *first = sNaviTable->hint;
|
||||
for (s32 i = 0; i < sNaviTable->hint_count; i++) {
|
||||
if (dScGame_c::isCurrentStage(first->stage_name_ptr) &&
|
||||
(first->storyflag < 0 || StoryflagManager::sInstance->getFlag(first->storyflag))) {
|
||||
return first->KEN1_entry_num;
|
||||
}
|
||||
first++;
|
||||
}
|
||||
// "This place has no name registered in my memory, and I have no useful data..."
|
||||
return 31;
|
||||
}
|
||||
}
|
||||
|
||||
s16 FiContext::getObjective() {
|
||||
if (StoryflagManager::sInstance->getFlag(530)) {
|
||||
// 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)) {
|
||||
// "Demise has once again broken the seal that binds him..."
|
||||
return 70;
|
||||
}
|
||||
|
||||
if (!StoryflagManager::sInstance->getCounterOrFlag(21)) {
|
||||
if (ItemflagManager::sInstance->getFlagDirect(0xC5) && !ItemflagManager::sInstance->getFlagDirect(0xC6)) {
|
||||
// "I project that the soil in Lanayru Province will not provide enough nourishment for the Life Tree
|
||||
// Seedling..."
|
||||
return 90;
|
||||
}
|
||||
|
||||
if (ItemflagManager::sInstance->getFlagDirect(0xC6)) {
|
||||
// "Master, I recommend you take the Life Tree Fruit to the Thunder Dragon..."
|
||||
return 91;
|
||||
}
|
||||
}
|
||||
|
||||
// Find the last entry with a set story flag
|
||||
ObjectiveEntry *last = sNaviTable->objective + (sNaviTable->objective_count - 1);
|
||||
for (s32 i = 0; i < sNaviTable->objective_count; i++) {
|
||||
if (StoryflagManager::sInstance->getFlag(last->storyflag)) {
|
||||
return last->KEN2_entry_num;
|
||||
}
|
||||
last--;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
FiAnalysisHandle FiContext::getNaviTableEquipmentCheckEntry() {
|
||||
AnalysisEntry *first = sNaviTable->analysis;
|
||||
for (s32 i = 0; i < sNaviTable->analysis_count; i++) {
|
||||
// Find the first entry that matches the current stage, if its story flag matches (if any)
|
||||
if (dScGame_c::isCurrentStage(first->stage_name_ptr) &&
|
||||
(first->storyflag < 0 || StoryflagManager::sInstance->getFlag(first->storyflag))) {
|
||||
return FiAnalysisHandle(first);
|
||||
}
|
||||
first++;
|
||||
}
|
||||
return FiAnalysisHandle(nullptr);
|
||||
}
|
||||
|
||||
s32 FiContext::setTargetedActorTextId(s32 id) {
|
||||
setTargetActorId(-1);
|
||||
s32 ret;
|
||||
if (id < 256) {
|
||||
ret = 6600; // Flow?
|
||||
setTargetActorId(id);
|
||||
} else if (id < 512) {
|
||||
ret = 6500; // Flow?
|
||||
setTargetActorId(id - 256);
|
||||
} else if (id < 768) {
|
||||
ret = 6700; // Flow?
|
||||
setTargetActorId(id - 512);
|
||||
} else {
|
||||
ret = 6500; // Flow?
|
||||
setTargetActorId(id - 668);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
u8 FiContext::rateBattlePerformance(u8 id) {
|
||||
u8 ret = 0xFF;
|
||||
u16 killCount = FileManager::GetInstance()->getEnemyKillCount(id);
|
||||
u16 enemyHitCount = FileManager::GetInstance()->getHitCountFromEnemy(id);
|
||||
if (killCount > 3 || enemyHitCount > 5) {
|
||||
if (killCount == 0) {
|
||||
ret = 6;
|
||||
} else {
|
||||
f32 ratio = (f32)enemyHitCount / (f32)killCount;
|
||||
if (ratio <= 0.2f) {
|
||||
ret = 0;
|
||||
} else if (ratio <= (1.0f / 3.0f)) {
|
||||
ret = 1;
|
||||
} else if (ratio <= 1.0f) {
|
||||
ret = 2;
|
||||
} else if (ratio <= 1.5f) {
|
||||
ret = 3;
|
||||
} else if (ratio <= 2.5f) {
|
||||
ret = 4;
|
||||
} else if (ratio <= 4.0f) {
|
||||
ret = 5;
|
||||
} else {
|
||||
ret = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern "C" bool isLowBattery1();
|
||||
extern "C" bool isLowBattery2();
|
||||
|
||||
u16 FiContext::prepareFiHelpIndex() {
|
||||
u16 ret = 0xFFFF;
|
||||
setHelpIndex(-1);
|
||||
|
||||
if (dLytMeter_c::getShieldLevel() > 0.0f && dLytMeter_c::getShieldGaugePercentMaybe() > 0.0f) {
|
||||
if (dLytMeter_c::getShieldGaugePercentMaybe() <= 6.0f) {
|
||||
if (!getField_0x4A()) {
|
||||
ret = 6402;
|
||||
// "The integrity of your shield has weakened..."
|
||||
setHelpIndex(1);
|
||||
}
|
||||
} else {
|
||||
if (getField_0x4A()) {
|
||||
setField_0x4A(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (FileManager::GetInstance()->getCurrentHealth() <= 12 && !StoryflagManager::sInstance->getCounterOrFlag(808)) {
|
||||
ret = 6401;
|
||||
// "Your hearts have decreased quite dramatically..."
|
||||
setHelpIndex(0);
|
||||
}
|
||||
|
||||
if (isLowBattery2() || isLowBattery1()) {
|
||||
if (!getField_0x48()) {
|
||||
ret = 6400;
|
||||
if (isLowBattery1()) {
|
||||
// "Master, the batteries in your Wii Remote will be depleted any moment."
|
||||
setHelpIndex(3);
|
||||
} else {
|
||||
// "Master, the batteries in your Wii Remote are nearly depleted."
|
||||
setHelpIndex(2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (getField_0x48()) {
|
||||
setField_0x48(false);
|
||||
}
|
||||
}
|
||||
|
||||
u32 numRupees = dAcItem_c::getRupeeCounter();
|
||||
u32 walletCapacity = dAcItem_c::getCurrentWalletCapacity();
|
||||
|
||||
if (!StoryflagManager::sInstance->getFlag(727) && walletCapacity != 0 && numRupees == walletCapacity &&
|
||||
!getField_0x47()) {
|
||||
ret = 6400;
|
||||
// "Master, your wallet is full..."
|
||||
setHelpIndex(5);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 FiContext::getGlobalFiInfo0(s32 idx) {
|
||||
if (sInstance != nullptr) {
|
||||
return sInstance->mFiButtonOptions[idx];
|
||||
}
|
||||
return KEN8_None;
|
||||
}
|
||||
|
||||
const wchar_t *FiContext::getButtonText(s32 idx) {
|
||||
SizedString<16> str;
|
||||
str.sprintf("KEN8_1%02d", idx + 1);
|
||||
return dMessage_c::getTextMessageByLabel(str, true, nullptr, 0);
|
||||
}
|
||||
|
||||
void FiContext::create() {
|
||||
sInstance = new FiContext();
|
||||
sInstance->reset();
|
||||
}
|
||||
|
||||
void FiContext::reset() {
|
||||
for (s32 i = 0; i < 10; i++) {
|
||||
mFiButtonOptions[i] = KEN8_None;
|
||||
field_0x3D[i] = 0xFF;
|
||||
}
|
||||
field_0x47 = false;
|
||||
field_0x48 = false;
|
||||
field_0x49 = false;
|
||||
field_0x4A = false;
|
||||
mSaveTimeRelated = 0xFF;
|
||||
|
||||
fn_8016CB40();
|
||||
|
||||
mTargetActorId = -1;
|
||||
mFiHelpIndex = -1;
|
||||
mDoSpecialFiMenuHandling = false;
|
||||
}
|
||||
|
||||
void FiContext::resetSaveTimeRelated() {
|
||||
mSaveTimeRelated = 0xFF;
|
||||
}
|
||||
|
||||
extern "C" bool isInAnySkyKeepRoom();
|
||||
|
||||
void FiContext::prepareFiCallOptions() {
|
||||
s32 seconds1 = OS_TICKS_TO_SEC(SaveTimeRelated::GetInstance()->getField_0x30());
|
||||
s32 seconds2 = OS_TICKS_TO_SEC(SaveTimeRelated::GetInstance()->getField_0x08());
|
||||
u8 val = 2;
|
||||
if (seconds2 < 300) {
|
||||
val = 0;
|
||||
} else if (seconds1 < 300) {
|
||||
val = 1;
|
||||
}
|
||||
if (mSaveTimeRelated != val) {
|
||||
mSaveTimeRelated = val;
|
||||
}
|
||||
|
||||
mFiButtonOptions[0] = KEN8_Advice;
|
||||
if (dStageMgr_c::GetInstance()->getSTIFbyte4() == 0 && !isInAnySkyKeepRoom() && !isInLeviasFightMaybe()) {
|
||||
// In the Sky, show play time
|
||||
mFiButtonOptions[1] = KEN8_PlayTime;
|
||||
} else {
|
||||
// Elswhere, and in Sky Keep and Levias fight, present analysis
|
||||
mFiButtonOptions[1] = KEN8_Analysis;
|
||||
}
|
||||
mFiButtonOptions[2] = KEN8_Objective;
|
||||
}
|
||||
|
||||
void FiContext::setAdviceOptions(s32 unused) {
|
||||
mFiButtonOptions[0] = KEN8_Hint;
|
||||
mFiButtonOptions[1] = KEN8_Rumors;
|
||||
mFiButtonOptions[2] = KEN8_Summary;
|
||||
}
|
||||
|
||||
void FiContext::resetAdviceOptions() {
|
||||
mFiButtonOptions[0] = KEN8_Hint;
|
||||
mFiButtonOptions[1] = KEN8_Rumors;
|
||||
mFiButtonOptions[2] = KEN8_Summary;
|
||||
}
|
||||
|
||||
void FiContext::fn_8016CB40() {
|
||||
field_0x28 = 0;
|
||||
field_0x2C = 1;
|
||||
field_0x30 = 2;
|
||||
}
|
||||
|
||||
bool FiContext::isInLeviasFightMaybe() {
|
||||
if (dScGame_c::isCurrentStage("F023") && StoryflagManager::sInstance->getFlag(368) &&
|
||||
!StoryflagManager::sInstance->getFlag(200)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -133,9 +133,9 @@ u16 *FileManager::getStoryFlagsMut() {
|
||||
}
|
||||
|
||||
/* 8000ABD0 */ void FileManager::setCurrentHealthCapacity(s16 health) {}
|
||||
/* 8000AC00 */ s16 FileManager::getCurrentHealthCapacity() {}
|
||||
/* 8000AC00 */ u16 FileManager::getCurrentHealthCapacity() {}
|
||||
/* 8000AC50 */ void FileManager::setCurrentHealth(s16 health) {}
|
||||
/* 8000AC80 */ s16 FileManager::getCurrentHealth() {}
|
||||
/* 8000AC80 */ u16 FileManager::getCurrentHealth() {}
|
||||
|
||||
/* 8000ACD0 */ u16 FileManager::getLoadRoomT1() {}
|
||||
/* 8000AD20 */ u16 FileManager::getLoadRoomT2() {}
|
||||
|
||||
Reference in New Issue
Block a user