summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/d/d_message.h118
-rw-r--r--include/d/d_pad.h6
-rw-r--r--include/d/d_stage_mgr.h4
-rw-r--r--include/d/d_sys.h1
-rw-r--r--include/d/d_tag_processor.h105
-rw-r--r--include/d/d_textunk.h96
-rw-r--r--include/d/d_textwindow_unk.h96
-rw-r--r--include/d/lyt/d2d.h76
-rw-r--r--include/d/lyt/d_lyt_auto_caption.h48
-rw-r--r--include/d/lyt/d_lyt_auto_explain.h48
-rw-r--r--include/d/lyt/d_lyt_common_a_btn.h89
-rw-r--r--include/d/lyt/d_lyt_common_arrow.h18
-rw-r--r--include/d/lyt/d_lyt_common_icon_item.h6
-rw-r--r--include/d/lyt/d_lyt_control_game.h25
-rw-r--r--include/d/lyt/d_lyt_map.h10
-rw-r--r--include/d/lyt/d_textbox.h82
-rw-r--r--include/d/lyt/msg_window/d_lyt_msg_window.h147
-rw-r--r--include/d/lyt/msg_window/d_lyt_msg_window_common.h91
-rw-r--r--include/d/lyt/msg_window/d_lyt_msg_window_demo.h60
-rw-r--r--include/d/lyt/msg_window/d_lyt_msg_window_get.h68
-rw-r--r--include/d/lyt/msg_window/d_lyt_msg_window_link.h73
-rw-r--r--include/d/lyt/msg_window/d_lyt_msg_window_select_btn.h149
-rw-r--r--include/d/lyt/msg_window/d_lyt_msg_window_stone.h59
-rw-r--r--include/d/lyt/msg_window/d_lyt_msg_window_sword.h88
-rw-r--r--include/d/lyt/msg_window/d_lyt_msg_window_talk.h74
-rw-r--r--include/d/lyt/msg_window/d_lyt_msg_window_wood.h60
-rw-r--r--include/egg/math/eggVector.h5
-rw-r--r--include/libms/commonlib.h5
-rw-r--r--include/libms/flowfile.h2
-rw-r--r--include/libms/msgfile.h11
-rw-r--r--include/m/m2d.h9
-rw-r--r--include/m/m_fader_base.h16
-rw-r--r--include/m/m_vec.h10
-rw-r--r--include/nw4r/lyt/lyt_pane.h6
-rw-r--r--include/nw4r/lyt/lyt_textBox.h4
-rw-r--r--include/nw4r/lyt/lyt_types.h4
-rw-r--r--include/nw4r/ut/ut_Font.h7
-rw-r--r--include/s/s_State.hpp4
-rw-r--r--include/toBeSorted/d_d3d.h4
-rw-r--r--include/toBeSorted/event_manager.h5
-rw-r--r--include/toBeSorted/global_fi_context.h17
-rw-r--r--include/toBeSorted/lyt_related_floats.h21
-rw-r--r--include/toBeSorted/music_mgrs.h3
-rw-r--r--include/toBeSorted/other_sound_stuff.h10
-rw-r--r--include/toBeSorted/small_sound_mgr.h2
45 files changed, 1742 insertions, 100 deletions
diff --git a/include/d/d_message.h b/include/d/d_message.h
new file mode 100644
index 00000000..cd075bb0
--- /dev/null
+++ b/include/d/d_message.h
@@ -0,0 +1,118 @@
+#ifndef D_MESSAGE_H
+#define D_MESSAGE_H
+
+#include "common.h"
+#include "d/d_base.h"
+#include "d/d_tag_processor.h"
+#include "libms/flowfile.h"
+#include "libms/msgfile.h"
+#include "sized_string.h"
+
+class dMessage_c : public dBase_c {
+public:
+ dMessage_c();
+ virtual ~dMessage_c() {
+ sInstance = nullptr;
+ }
+
+ int create() override;
+ int doDelete() override;
+ int execute() override;
+ int draw() override;
+
+ static const char *getLanguageIdentifier();
+
+ static dMessage_c *getInstance() {
+ return sInstance;
+ }
+
+ static dTagProcessor_c *getGlobalTagProcessor() {
+ return sTagProcessor;
+ }
+
+ void reset();
+
+ bool getField_0x329() const {
+ return field_0x329;
+ }
+
+ void setField_0x329(bool v) {
+ field_0x329 = v;
+ }
+
+ bool getField_0x32A() const {
+ return field_0x32A;
+ }
+
+ static bool isValidTextLabel(const char *name);
+ static void loadTextByLabel(const char *label, dTagProcessor_c *tagProcessor, bool, u32, u32);
+
+ static s32 getMsbtIndexForLabel(const char *name);
+ static const char *getMsbtFileName(s32 index);
+
+ static const wchar_t *getTextMessageByLabel(const char *label, bool global, wchar_t *dstBuf, u32 maxLen);
+ static const wchar_t *
+ getTextMessageByLabel(const char *label, dTagProcessor_c *pTagProcessor, bool global, wchar_t *dstBuf, u32 maxLen);
+
+ static const wchar_t *formatText(const wchar_t *text);
+
+private:
+ static void *sZev0;
+ static void *sZevStage;
+
+ static void *getZev0Internal();
+ static void *getZevStageInternal();
+
+ void executeMinigame();
+
+ const wchar_t *formatTextInternal(const wchar_t *text);
+ const wchar_t *getTextMessageByLabelInternal(
+ const char *label, dTagProcessor_c *pTagProcessor, bool global, wchar_t *dstBuf, u32 maxLen
+ );
+
+ static s32 getArcIndexForFile(const char *fileName);
+ static const char *getArcNameByIndex(s32 idx, bool);
+
+ bool checkIsValidTextLabel(const char *name);
+
+ static void setZevFromMsbArc();
+ static void setStageZevFromMsbArc();
+ static s32 getMsbtNumberByIndex(s32 index);
+ static const char *getMsbfFileName(s32 index);
+ static s32 getMsbfNumberByIndex(s32 index);
+ static void *getDataFromMsbArc(s32 number, const char *fileName, bool);
+
+ s32 getTextIndexForLabel(const char *label);
+ s32 getMsbtIndexForLabelInternal(const char *label);
+ static MsbtInfo *getMsbtInfoForIndex(s32 index);
+ MsbtInfo *getMsbtInfoForIndexInternal(s32 index);
+
+ static MsbfInfo *getMsbfInfoForIndex(s32 index);
+ MsbfInfo *getMsbfInfoForIndexInternal(s32 index);
+
+ static const char *getArcNameByIndexInternal(s32 idx, bool global);
+
+ static dMessage_c *sInstance;
+ static dTagProcessor_c *sTagProcessor;
+
+ /* 0x068 */ MsbtInfo *mpMsgs[82];
+ /* 0x1B0 */ MsbfInfo *mpFlows[80];
+ /* 0x2F0 */ SizedString<8> mLanguage;
+ /* 0x2F8 */ u32 mCurrentTextFileNumber;
+
+ /* 0x2FC */ s32 field_0x2FC;
+
+ /* 0x300 */ u8 _0x300[0x329 - 0x300];
+
+ /* 0x329 */ bool field_0x329;
+ /* 0x32A */ bool field_0x32A;
+
+ /* 0x32B */ u8 _0x32B[0x334 - 0x32B];
+
+ /* 0x334 */ u32 mMinigameResultPoints;
+ /* 0x338 */ u32 mMinigameTime;
+ /* 0x33C */ u8 _0x33C[0x344 - 0x33C];
+ /* 0x344 */ s32 field_0x344;
+};
+
+#endif
diff --git a/include/d/d_pad.h b/include/d/d_pad.h
index e158fafb..5175dbca 100644
--- a/include/d/d_pad.h
+++ b/include/d/d_pad.h
@@ -3,8 +3,12 @@
class dPad {
public:
-
+ static bool checkButtonAPressed();
+ static bool checkButtonBPressed();
static bool checkButtonZPressed();
+ static bool checkButtonPlusPressed();
+
+ static bool checkButtonAHeld();
static bool checkButtonZHeld();
};
diff --git a/include/d/d_stage_mgr.h b/include/d/d_stage_mgr.h
index aa4b277f..9160b33d 100644
--- a/include/d/d_stage_mgr.h
+++ b/include/d/d_stage_mgr.h
@@ -114,6 +114,10 @@ public:
void addObjId(u16 id);
void addActorId(u16 actorId);
+ dFader_c *getFader() {
+ return &mFader;
+ }
+
private:
static void lastExecuteCallback();
diff --git a/include/d/d_sys.h b/include/d/d_sys.h
index 02a9c127..a9d6ff9c 100644
--- a/include/d/d_sys.h
+++ b/include/d/d_sys.h
@@ -7,6 +7,7 @@
namespace dSys {
void setFrameRate(u32);
+u8 getFrameRate();
void setClearColor(mColor clr);
} // namespace dSys_c
diff --git a/include/d/d_tag_processor.h b/include/d/d_tag_processor.h
index c68ad2f1..f4195865 100644
--- a/include/d/d_tag_processor.h
+++ b/include/d/d_tag_processor.h
@@ -5,6 +5,13 @@
#include "nw4r/ut/ut_TagProcessorBase.h"
#include "nw4r/ut/ut_TextWriterBase.h"
+struct dLytMsgWindowCharData;
+
+struct LineData {
+ f32 mLineWidths[0x32];
+ u32 mNumLines;
+};
+
// inofficial name
// size: 0xEF4
class dTagProcessor_c : public nw4r::ut::TagProcessorBase<wchar_t> {
@@ -12,8 +19,9 @@ public:
dTagProcessor_c();
virtual ~dTagProcessor_c();
+ void format(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen, void *unk, ...);
void
- eventFlowTextProcessingRelated(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen);
+ formatV(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen, void *unk, va_list list);
virtual nw4r::ut::Operation Process(u16 ch, nw4r::ut::PrintContext<wchar_t> *ctx) override;
virtual nw4r::ut::Operation CalcRect(nw4r::ut::Rect *rect, u16 ch, nw4r::ut::PrintContext<wchar_t> *ctx) override;
@@ -45,7 +53,7 @@ public:
u8 symbolToFontIdx(s32 s);
void setStringArg(const wchar_t *arg, s32 index);
- static s32 getNumLines(s32 arg);
+ static s32 getMaxNumLines(s32 arg);
static void getTextCommand(wchar_t _0xe, const wchar_t *src, u8 *outCmdLen, s32 *outCmd, wchar_t **outEndPtr);
static void process0xFCommand(wchar_t _0xf, const wchar_t *src, s32 *outCmd);
@@ -60,13 +68,97 @@ public:
char fn_800B7880(u32);
void fn_800B70D0(nw4r::ut::TextWriterBase<wchar_t> *, nw4r::ut::PrintContext<wchar_t> *ctx, u16 c, s32);
+ void
+ fn_800B4290(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, s32, u16 *, dLytMsgWindowCharData *charData);
+
void resetSomething();
- void resetSomeFloats();
+ void resetLineData();
void setNumericArg0(s32 arg);
void setNumericArgs(const s32 *args, s32 numArgs);
- f32 getFloat(s32 i);
+ f32 getLineWidth(s32 i);
s32 tickPauseFrame();
s32 tick0x830();
+ void execute();
+
+ void setTextbox(dTextBox_c *box) {
+ field_0x004 = box;
+ }
+
+ s32 getNumLinesMaybe() const {
+ return mLineData.mNumLines;
+ }
+
+ u8 getMsgWindowSubtype() const {
+ return mMsgWindowSubtype;
+ }
+
+ u8 getField_0x90D() const {
+ return field_0x90D;
+ }
+
+ u8 getField_0x90E() const {
+ return field_0x90E;
+ }
+
+ s32 getField_0x824() const {
+ return field_0x824;
+ }
+
+ s32 getField_0x828() const {
+ return field_0x828;
+ }
+
+ s32 getField_0x82C() const {
+ return field_0x82C;
+ }
+
+ s32 getField_0x830() const {
+ return field_0x830;
+ }
+
+ void setMsgWindowSubtype(u8 type) {
+ mMsgWindowSubtype = type;
+ }
+
+ void setField_0x828(s32 val) {
+ field_0x828 = val;
+ }
+
+ void setField_0x82C(s32 val) {
+ field_0x82C = val;
+ }
+
+ void setField_0x90D(u8 val) {
+ field_0x90D = val;
+ }
+
+ void setField_0x90E(u8 val) {
+ field_0x90E = val;
+ }
+
+ void setField_0xEE0(u8 val) {
+ field_0xEE0 = val;
+ }
+
+ void setField_0xEE1(u8 val) {
+ field_0xEE1 = val;
+ }
+
+ void setField_0xEE2(u8 val) {
+ field_0xEE2 = val;
+ }
+
+ void setField_0xEE3(u8 val) {
+ field_0xEE3 = val;
+ }
+
+ wchar_t *getBuf(s32 idx) {
+ return field_0x008[idx];
+ }
+
+ LineData getLineData() const {
+ return mLineData;
+ }
private:
/* 0x004 */ dTextBox_c *field_0x004;
@@ -117,12 +209,11 @@ private:
/* 0x900 */ s32 field_0x900;
/* 0x904 */ f32 field_0x904;
/* 0x908 */ f32 field_0x908;
- /* 0x90C */ u8 field_0x90C;
+ /* 0x90C */ u8 mMsgWindowSubtype;
/* 0x90D */ u8 field_0x90D;
/* 0x90E */ u8 field_0x90E;
/* 0x90F */ u8 field_0x90F[4];
- /* 0x914 */ f32 field_0x914[0x32];
- /* 0x9DC */ s32 mCommandInsert;
+ /* 0x914 */ LineData mLineData;
/* 0x9E0 */ wchar_t mStringArgs[8][64];
/* 0xDE0 */ u8 field_0xDE0[0xEE0 - 0xDE0];
/* 0xEE0 */ u8 field_0xEE0;
diff --git a/include/d/d_textunk.h b/include/d/d_textunk.h
index 5e43e709..a76d5c99 100644
--- a/include/d/d_textunk.h
+++ b/include/d/d_textunk.h
@@ -7,6 +7,13 @@
#include "nw4r/ut/ut_Color.h"
#include "sized_string.h"
+/**
+ * This class appears to be the remnant of a sort of "hot-reloading"
+ * mechanism for the game's user interface. Many of the functions
+ * affect text formatting, UI layouting, and it also has mechanisms
+ * for overriding the text and flow files being accessed. The actual
+ * implementation appears to have been stripped out though.
+ */
class UnkTextThing {
public:
UnkTextThing();
@@ -21,6 +28,20 @@ public:
return 0.0f;
}
+ inline static f32 getField0x75C() {
+ if (sInstance != nullptr) {
+ return sInstance->field_0x75C;
+ }
+ return 0.0f;
+ }
+
+ inline static f32 getField0x760() {
+ if (sInstance != nullptr) {
+ return sInstance->field_0x760;
+ }
+ return 0.0f;
+ }
+
inline static f32 getField0x768() {
if (sInstance != nullptr) {
return sInstance->field_0x768;
@@ -95,11 +116,68 @@ public:
return 0.0f;
}
-private:
- static UnkTextThing *sInstance;
+ static UnkTextThing *getInstance() {
+ return sInstance;
+ }
+
+ s16 getMsgWindowWaitDelay() const {
+ return mMsgWindowWaitDelay;
+ }
+
+ bool getShouldOverrideData() const {
+ return mShouldOverrideData;
+ }
+
+ void *getOverrideZev0() const {
+ return mOverrideZev0;
+ }
+
+ void *getOverrideStageZev() const {
+ return mOverrideStageZev;
+ }
+
+ bool getShouldHookAllocations() const {
+ return mShouldHookAllocations;
+ }
+
+ MsbtInfo *getOverrideMsbtInfo(s32 index) const {
+ return mMsbts[index];
+ }
+
+ MsbfInfo *getOverrideMsbfInfo(s32 index) const {
+ return mMsbfs[index];
+ }
+
+ const char *getStr1() const {
+ return field_0x004;
+ }
+
+ const char *getStr2() const {
+ return field_0x084;
+ }
+
+ const char *getStr3() const {
+ return field_0x104;
+ }
+
+ void setStr1(const char *s) {
+ field_0x004 = s;
+ }
+
+ void setStr2(const char *s) {
+ field_0x084 = s;
+ }
+
+ void setStr3(const char *s) {
+ field_0x104 = s;
+ }
void *allocUnk(size_t size, int align);
void destroyUnk(void *thing);
+
+private:
+ static UnkTextThing *sInstance;
+
void destroyFlow(MsbfInfo *flow);
void destroyMsg(MsbtInfo *msg);
@@ -121,11 +199,11 @@ private:
/* 0x184 */ void *field_buf0[82];
/* 0x2CC */ void *field_buf4[23];
/* 0x328 */ void *field_buf1[80];
- /* 0x468 */ MsbtInfo *field_buf2[82];
+ /* 0x468 */ MsbtInfo *mMsbts[82];
/* 0x5B0 */ MsbtInfo *field_buf5[23];
- /* 0x60C */ MsbfInfo *field_buf3[80];
- /* 0x74C */ void *field_0x74C;
- /* 0x750 */ void *field_0x750;
+ /* 0x60C */ MsbfInfo *mMsbfs[80];
+ /* 0x74C */ void *mOverrideZev0;
+ /* 0x750 */ void *mOverrideStageZev;
/* 0x754 */ f32 field_0x754;
/* 0x758 */ f32 field_0x758;
/* 0x75C */ f32 field_0x75C;
@@ -152,13 +230,13 @@ private:
/* 0x7A8 */ s16 field_0x7A8;
/* 0x7AA */ s16 field_0x7AA;
/* 0x7AC */ s16 field_0x7AC;
- /* 0x7AE */ s16 field_0x7AE;
+ /* 0x7AE */ s16 mMsgWindowWaitDelay;
/* 0x7B0 */ s16 field_0x7B0;
/* 0x7B2 */ bool field_0x7B2;
/* 0x7B3 */ bool field_0x7B3;
- /* 0x7B4 */ bool field_0x7B4;
+ /* 0x7B4 */ bool mShouldOverrideData;
/* 0x7B5 */ bool field_0x7B5;
- /* 0x7B6 */ bool field_0x7B6;
+ /* 0x7B6 */ bool mShouldHookAllocations;
/* 0x7B6 */ bool field_0x7B7;
/* 0x7B8 */ nw4r::ut::Color field_0x7B8;
/* 0x7BC */ nw4r::ut::Color field_0x7BC;
diff --git a/include/d/d_textwindow_unk.h b/include/d/d_textwindow_unk.h
new file mode 100644
index 00000000..a599b2d0
--- /dev/null
+++ b/include/d/d_textwindow_unk.h
@@ -0,0 +1,96 @@
+#ifndef D_TEXTWINDOW_UNK_H
+#define D_TEXTWINDOW_UNK_H
+
+#include "d/d_tag_processor.h"
+#include "d/lyt/d_textbox.h"
+#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
+#include "m/m_vec.h"
+#include "sized_string.h"
+
+struct dLytMsgWindowCharData {
+ /* 0x00 */ f32 posX;
+ /* 0x04 */ f32 posY;
+ /* 0x08 */ f32 field_0x08;
+ /* 0x0C */ s16 field_0x0C;
+ /* 0x0E */ wchar_t character;
+ /* 0x10 */ s8 displayTimerMaybe;
+
+ void reset() {
+ posX = 0.0f;
+ posY = 0.0f;
+ field_0x08 = dTagProcessor_c::fn_800B8040(0, 0);
+ character = L'\0';
+ field_0x0C = 1023;
+ displayTimerMaybe = -1;
+ }
+};
+
+// Size 0x1554
+// Probably responsible for emitting characters
+// one by one in the text boxes
+class TextWindowUnk {
+public:
+ TextWindowUnk(dTagProcessor_c *tagProcessor);
+ virtual ~TextWindowUnk() {}
+
+ bool fn_800B2130(const char *, dTextBox_c *, dLytMsgWindowCharData *data, bool);
+ void fn_800B2AA0();
+ void textAdvancingRelated(bool, bool);
+
+ const wchar_t *getProcessedText() const {
+ return mProcessedTextBuffer;
+ }
+
+ u16 getField_0x147A() const {
+ return field_0x147A;
+ }
+
+ u16 getField_0x147C() const {
+ return field_0x147C;
+ }
+
+ bool checkEndReached() const;
+ bool checkLastLineReached();
+ bool reset();
+
+private:
+ /* 0x0004 */ dTagProcessor_c *mpTagProcessor;
+ /* 0x0008 */ wchar_t mRawTextBuffer[1023];
+ /* 0x0806 */ wchar_t mProcessedTextBuffer[1023];
+ /* 0x1004 */ wchar_t mUnkBuffer[511]; // ???
+ /* 0x1402 */ SizedString<64> field_0x1402;
+ /* 0x1442 */ u8 _0x1442[0x144C - 0x1442];
+
+ /* 0x144C */ s32 mRawTextPos;
+ /* 0x1450 */ s32 mRawTextEndPos;
+ /* 0x1454 */ s32 mCurrentLine;
+ /* 0x1458 */ s32 field_0x1458;
+ /* 0x145C */ u8 _0x145C[0x1478 - 0x145C];
+ /* 0x1478 */ u16 field_0x1478;
+ /* 0x147A */ u16 field_0x147A;
+ /* 0x147C */ u16 field_0x147C;
+ /* 0x147E */ u8 _0x147E[0x1480 - 0x147E];
+ /* 0x1480 */ dTextBox_c *mpTextBox;
+ /* 0x1484 */ LineData mLineWidths;
+ /* 0x1550 */ dLytMsgWindowCharData *mpCharacterData;
+};
+
+class MsgWindowBlurRelated {
+public:
+ MsgWindowBlurRelated() {}
+ virtual ~MsgWindowBlurRelated() {}
+
+ void build();
+ void remove();
+ void drawTextBlur(dLytTextLight *thing, mVec2_c size, u8 alpha);
+ void reset();
+
+ dLytMsgWindowCharData *getCharData() {
+ return mData;
+ }
+
+private:
+ dLytMsgWindowCharData mData[1023];
+};
+
+#endif
diff --git a/include/d/lyt/d2d.h b/include/d/lyt/d2d.h
index a1015f1f..d7a7bc8d 100644
--- a/include/d/lyt/d2d.h
+++ b/include/d/lyt/d2d.h
@@ -44,10 +44,10 @@ class Multi_c : public m2d::Base_c {
public:
Multi_c();
virtual ~Multi_c() {}
- virtual void draw() override;
- virtual void animate();
- virtual void calc();
- virtual bool build(const char *name, m2d::ResAccIf_c *acc);
+ /* vt 0x0C */ virtual void draw() override;
+ /* vt 0x10 */ virtual void animate();
+ /* vt 0x18 */ virtual void calc();
+ /* vt 0x18 */ virtual bool build(const char *name, m2d::ResAccIf_c *acc);
void calcBefore();
void calcAfter();
@@ -68,6 +68,10 @@ public:
mpResAcc = resAcc;
}
+ const nw4r::lyt::DrawInfo &getDrawInfo() {
+ return mDrawInfo;
+ }
+
protected:
Layout_c mLayout;
nw4r::lyt::DrawInfo mDrawInfo;
@@ -79,11 +83,11 @@ class LytBase_c : public Multi_c {
public:
LytBase_c();
virtual ~LytBase_c();
- virtual void draw() override {
+ /* vt 0x0C */ virtual void draw() override {
mLayout.Draw(mDrawInfo);
};
- virtual bool build(const char *name, m2d::ResAccIf_c *acc) override;
+ /* vt 0x18 */ virtual bool build(const char *name, m2d::ResAccIf_c *acc) override;
dTextBox_c *getTextBox(const char *name);
dTextBox_c *getSizeBoxInWindow(const char *windowName);
dWindow_c *getWindow(const char *name);
@@ -92,7 +96,7 @@ public:
bool fn_800AB940(const char *name, int arg);
bool fn_800AB9A0(dTextBox_c *textbox, int arg);
- bool fn_800ABE50(dTextBox_c *textbox, int arg, void *unk);
+ bool fn_800ABE50(dTextBox_c *textbox, wchar_t *destBuf, u32 maxLen);
private:
void setPropertiesRecursive(nw4r::lyt::Pane *pane, f32, f32, f32, f32, f32);
@@ -101,9 +105,10 @@ private:
bool fn_800ABB80(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg);
bool fn_800ABCE0(const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, int arg);
- bool fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg, void *unk);
+ bool fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, wchar_t *destBuf, u32 maxLen);
bool fn_800AC1AC(
- const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, int arg, void *unk
+ const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, wchar_t *destBuf,
+ u32 maxLen
);
MsbtInfo *getMsbtInfo() const;
bool fn_800AB930(dTextBox_c *box);
@@ -131,9 +136,11 @@ private:
class dSubPane;
struct SubPaneListNode {
- nw4r::ut::LinkListNode mNode;
- dSubPane *mpLytPane;
- nw4r::lyt::Pane *mpPane;
+ /* 0x00 */ nw4r::ut::LinkListNode mNode;
+ /** The d lyt pane, set by the UI element */
+ /* 0x08 */ dSubPane *mpLytPane;
+ /** The nw4r lyt pane, set by linkMeters */
+ /* 0x0C */ nw4r::lyt::Pane *mpPane;
};
typedef nw4r::ut::LinkList<SubPaneListNode, offsetof(SubPaneListNode, mNode)> SubPaneList;
@@ -141,24 +148,24 @@ typedef nw4r::ut::LinkList<SubPaneListNode, offsetof(SubPaneListNode, mNode)> Su
class dSubPane {
public:
dSubPane() : field_0x04(false), field_0x05(0) {}
- virtual ~dSubPane() {}
- virtual bool build(ResAccIf_c *resAcc) = 0;
- virtual bool remove() = 0;
- virtual bool execute() = 0;
- virtual nw4r::lyt::Pane *getPane() = 0;
- virtual LytBase_c *getLyt() = 0;
- virtual const char *getName() const = 0;
- virtual bool LytMeter0x24() const {
+ /* vt 0x08 */ virtual ~dSubPane() {}
+ /* vt 0x0C */ virtual bool build(ResAccIf_c *resAcc) = 0;
+ /* vt 0x10 */ virtual bool remove() = 0;
+ /* vt 0x14 */ virtual bool execute() = 0;
+ /* vt 0x18 */ virtual nw4r::lyt::Pane *getPane() = 0;
+ /* vt 0x1C */ virtual LytBase_c *getLyt() = 0;
+ /* vt 0x20 */ virtual const char *getName() const = 0;
+ /* vt 0x24 */ virtual bool LytMeter0x24() const {
return field_0x04;
}
- virtual void LytMeter0x28(bool arg) {
+ /* vt 0x28 */ virtual void LytMeter0x28(bool arg) {
field_0x04 = arg;
}
- virtual u8 LytMeter0x2C() const {
+ /* vt 0x2C */ virtual u8 LytMeter0x2C() const {
return field_0x05;
}
- virtual void LytMeter0x30(u8 arg) {
+ /* vt 0x30 */ virtual void LytMeter0x30(u8 arg) {
field_0x05 = arg;
}
@@ -178,22 +185,15 @@ struct AnmGroupBase_c {
bool init(const char *fileName, m2d::ResAccIf_c *acc, d2d::Layout_c *layout, const char *animName);
bool init(nw4r::lyt::AnimTransform *transform, const char *fileName, m2d::ResAccIf_c *acc, nw4r::lyt::Group *group);
- bool setDirection(bool backwards);
+ bool bind(bool bDisable);
bool unbind();
- bool afterUnbind();
+ bool remove();
void setAnimEnable(bool);
void setAnmFrame(f32);
void syncAnmFrame();
void setForward();
void setBackward();
- inline void setFrameAndControlThings(f32 frame) {
- setDirection(false);
- setAnimEnable(true);
- mpFrameCtrl->setFrame(frame);
- syncAnmFrame();
- }
-
inline void play() {
mpFrameCtrl->play();
syncAnmFrame();
@@ -205,12 +205,12 @@ struct AnmGroupBase_c {
}
inline void setFrameRatio(f32 frame) {
- f32 end = getEndFrameRaw() - 1.0f;
+ f32 end = getAnimDuration() - 1.0f;
setFrame(end * frame);
}
- inline f32 getEndFrameRaw() const {
- return mpFrameCtrl->getEndFrameRaw();
+ inline f32 getAnimDuration() const {
+ return mpFrameCtrl->getAnimDuration();
}
inline f32 getFrame() const {
@@ -250,7 +250,7 @@ struct AnmGroupBase_c {
return mpFrameCtrl->getFlags() == (FLAG_NO_LOOP | FLAG_BACKWARDS);
}
- inline bool isPlayingForwardsOnce() const {
+ inline bool isPlayingForwardsOnce() const {
return mpFrameCtrl->getFlags() == FLAG_NO_LOOP;
}
@@ -275,6 +275,10 @@ struct AnmGroupBase_c {
syncAnmFrame();
}
+ inline f32 getRatio() const {
+ return mpFrameCtrl->getRatio();
+ }
+
inline void setBackwardsRatio(f32 ratio) {
mpFrameCtrl->setBackwardsRatio(ratio);
syncAnmFrame();
diff --git a/include/d/lyt/d_lyt_auto_caption.h b/include/d/lyt/d_lyt_auto_caption.h
new file mode 100644
index 00000000..7ad26cba
--- /dev/null
+++ b/include/d/lyt/d_lyt_auto_caption.h
@@ -0,0 +1,48 @@
+#ifndef D_LYT_AUTO_CAPTION_H
+#define D_LYT_AUTO_CAPTION_H
+
+#include "d/d_tag_processor.h"
+#include "d/lyt/d2d.h"
+#include "d/lyt/d_textbox.h"
+#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
+#include "nw4r/lyt/lyt_pane.h"
+#include "s/s_State.hpp"
+
+class dLytAutoCaption_c : public dLytMsgWindowSubtype {
+public:
+ dLytAutoCaption_c() : mStateMgr(*this) {}
+ /* vt 0x08 */ virtual ~dLytAutoCaption_c() {}
+ /* vt 0x0C */ virtual void draw() override;
+ /* vt 0x10 */ virtual bool
+ build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
+ /* vt 0x14 */ virtual bool remove() override;
+ /* vt 0x18 */ virtual bool execute() override;
+ /* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
+ /* vt 0x20 */ virtual bool isDoneOpening() const override;
+ /* vt 0x24 */ virtual void close() override;
+ /* vt 0x28 */ virtual bool isDoneClosing() const override;
+ /* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
+ /* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
+ return mpTextboxes[0];
+ }
+
+ STATE_FUNC_DECLARE(dLytAutoCaption_c, Invisible);
+ STATE_FUNC_DECLARE(dLytAutoCaption_c, In);
+ STATE_FUNC_DECLARE(dLytAutoCaption_c, OutputText);
+ STATE_FUNC_DECLARE(dLytAutoCaption_c, Out);
+
+ bool checkSomethingMeter();
+
+private:
+ MSG_WINDOW_STATE_MGR_INLINE(dLytAutoCaption_c)
+ /* 0x010 */ UI_STATE_MGR_DECLARE(dLytAutoCaption_c);
+ /* 0x068 */ d2d::ResAccIf_c mResAcc;
+ /* 0x3C4 */ d2d::LytBase_c mLyt;
+ /* 0x44C */ d2d::AnmGroup_c mAnm[4];
+ /* 0x54C */ dTextBox_c *mpTextboxes[2];
+ /* 0x554 */ nw4r::lyt::Pane *mpPane;
+ /* 0x558 */ dTagProcessor_c *mpTagProcessor;
+ /* 0x55C */ bool mShouldBeOpen;
+};
+
+#endif
diff --git a/include/d/lyt/d_lyt_auto_explain.h b/include/d/lyt/d_lyt_auto_explain.h
new file mode 100644
index 00000000..b3988de4
--- /dev/null
+++ b/include/d/lyt/d_lyt_auto_explain.h
@@ -0,0 +1,48 @@
+#ifndef D_LYT_AUTO_EXPLAIN_H
+#define D_LYT_AUTO_EXPLAIN_H
+
+#include "d/d_tag_processor.h"
+#include "d/lyt/d2d.h"
+#include "d/lyt/d_textbox.h"
+#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
+#include "nw4r/lyt/lyt_pane.h"
+#include "s/s_State.hpp"
+
+class dLytAutoExplain_c : public dLytMsgWindowSubtype {
+public:
+ dLytAutoExplain_c() : mStateMgr(*this) {}
+ /* vt 0x08 */ virtual ~dLytAutoExplain_c() {}
+ /* vt 0x0C */ virtual void draw() override;
+ /* vt 0x10 */ virtual bool
+ build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
+ /* vt 0x14 */ virtual bool remove() override;
+ /* vt 0x18 */ virtual bool execute() override;
+ /* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
+ /* vt 0x20 */ virtual bool isDoneOpening() const override;
+ /* vt 0x24 */ virtual void close() override;
+ /* vt 0x28 */ virtual bool isDoneClosing() const override;
+ /* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
+ /* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
+ return mpTextboxes[0];
+ }
+
+ STATE_FUNC_DECLARE(dLytAutoExplain_c, Invisible);
+ STATE_FUNC_DECLARE(dLytAutoExplain_c, In);
+ STATE_FUNC_DECLARE(dLytAutoExplain_c, OutputText);
+ STATE_FUNC_DECLARE(dLytAutoExplain_c, Out);
+
+ bool checkSomethingMeter();
+
+private:
+ MSG_WINDOW_STATE_MGR_INLINE(dLytAutoExplain_c)
+ /* 0x010 */ UI_STATE_MGR_DECLARE(dLytAutoExplain_c);
+ /* 0x068 */ d2d::ResAccIf_c mResAcc;
+ /* 0x3C4 */ d2d::LytBase_c mLyt;
+ /* 0x44C */ d2d::AnmGroup_c mAnm[3];
+ /* 0x50C */ dTextBox_c *mpTextboxes[2];
+ /* 0x514 */ nw4r::lyt::Pane *mpPane;
+ /* 0x518 */ dTagProcessor_c *mpTagProcessor;
+ /* 0x51C */ bool mShouldBeOpen;
+};
+
+#endif
diff --git a/include/d/lyt/d_lyt_common_a_btn.h b/include/d/lyt/d_lyt_common_a_btn.h
new file mode 100644
index 00000000..a2f9fe02
--- /dev/null
+++ b/include/d/lyt/d_lyt_common_a_btn.h
@@ -0,0 +1,89 @@
+#ifndef D_LYT_COMMON_A_BTN_H
+#define D_LYT_COMMON_A_BTN_H
+
+#include "d/lyt/d2d.h"
+
+/**
+ * Made up name.
+ *
+ * An A button used in various message windows, as well as
+ * the title menu. Can be hidden, visible, animating in, animating out.
+ */
+class dLytCommonABtn_c : public d2d::dSubPane {
+public:
+ virtual bool build(d2d::ResAccIf_c *resAcc) override;
+ virtual bool remove() override;
+ virtual bool execute() override;
+ virtual nw4r::lyt::Pane *getPane() override {
+ return mLyt.getLayout()->GetRootPane();
+ }
+ virtual d2d::LytBase_c *getLyt() override {
+ return &mLyt;
+ }
+ virtual const char *getName() const override {
+ return mLyt.getName();
+ }
+
+ bool isDoneOut() const {
+ return mIsDoneOut;
+ }
+
+ bool requestIn();
+ bool requestOut(bool b);
+
+ enum SoundVariant {
+ VARIANT_NORMAL,
+ VARIANT_TITLE,
+ };
+
+ void setSoundVariant(SoundVariant);
+ void resetToInvisble();
+
+ enum ABtnState {
+ STATE_INVISIBLE,
+ STATE_IN,
+ STATE_VISIBLE,
+ STATE_OUT,
+ };
+
+private:
+ enum OutState {
+ OUT_STATE_DECIDING,
+ OUT_STATE_GOTO_OUT,
+ OUT_STATE_OUT,
+ OUT_STATE_GOTO_INVISIBLE,
+ };
+
+ void setState(ABtnState state);
+
+ void runExecuteFunc();
+
+ void executeStateInvisible();
+ void executeStateIn();
+ void executeStateVisible();
+ void executeStateDecideOut();
+
+ void gotoStateInvisible();
+ void gotoStateIn();
+ void goToStateVisible();
+ void goToStateDecideOut();
+
+ typedef void (dLytCommonABtn_c::*executeFunc)(void);
+ static const executeFunc sExecuteFuncs[4];
+
+ /* 0x008 */ d2d::dLytSub mLyt;
+ /* 0x09C */ d2d::AnmGroup_c mAnm[4];
+ /* 0x19C */ ABtnState mState;
+ /* 0x1A0 */ OutState mOutState;
+ /* 0x1A4 */ SoundVariant mSoundVariant;
+ /* 0x1A8 */ u8 field_0x1A8;
+ /* 0x1A9 */ bool mInRequested;
+ /* 0x1AA */ bool mOutRequested;
+ /* 0x1AB */ bool mIsDoneOut;
+ /* 0x1AC */ u8 field_0x1AC;
+ /* 0x1AD */ bool mNoDecide;
+ /* 0x1AE */ u8 field_0x1AE;
+ /* 0x1AF */ u8 field_0x1AF;
+};
+
+#endif
diff --git a/include/d/lyt/d_lyt_common_arrow.h b/include/d/lyt/d_lyt_common_arrow.h
index 16415e5a..c6dd34ea 100644
--- a/include/d/lyt/d_lyt_common_arrow.h
+++ b/include/d/lyt/d_lyt_common_arrow.h
@@ -12,7 +12,7 @@ public:
dLytCommonArrow_c();
virtual ~dLytCommonArrow_c() {}
- bool init();
+ bool build();
STATE_FUNC_DECLARE(dLytCommonArrow_c, None);
STATE_FUNC_DECLARE(dLytCommonArrow_c, In);
@@ -20,20 +20,20 @@ public:
STATE_FUNC_DECLARE(dLytCommonArrow_c, Out);
void setState(s32 state);
- bool addToDrawList();
+ bool draw();
- bool fn_80168490();
- bool fn_80168500();
- void setTranslate(const Vec *);
+ bool remove();
+ bool execute();
bool requestIn();
bool requestOut();
+
+private:
+ void setTranslate(const Vec *);
bool fn_80168760();
void displayElement(s32, f32);
- void fn_80168800(s32);
- void fn_80168810(d2d::AnmGroup_c *);
+ void unbindAt(s32);
+ void tickDown(d2d::AnmGroup_c *);
void fn_80168880();
-
-private:
UI_STATE_MGR_DECLARE(dLytCommonArrow_c);
/* 0x40 */ d2d::LytBase_c mLytBase;
d2d::ResAccIf_c mResAcc;
diff --git a/include/d/lyt/d_lyt_common_icon_item.h b/include/d/lyt/d_lyt_common_icon_item.h
index 7e5712c7..66be9d60 100644
--- a/include/d/lyt/d_lyt_common_icon_item.h
+++ b/include/d/lyt/d_lyt_common_icon_item.h
@@ -56,7 +56,7 @@ public:
void setNumberColor(u8 color);
void setOn();
void setOff();
- void startDecide();
+ void startConfirm();
bool isDoneDeciding() const;
private:
@@ -129,7 +129,7 @@ public:
void setNumberColor(u8 color);
void setOn();
void setOff();
- void startDecide();
+ void startConfirm();
bool isDoneDeciding() const;
void setShieldOnOff(bool onOff);
@@ -264,7 +264,7 @@ public:
/** The "decide" animation in the scrap shop makes the selected item flash for a
short time before showing the upgrade screen */
- void startDecide();
+ void startConfirm();
bool isDoneDeciding() const;
void setShieldOnOff(bool onOff);
diff --git a/include/d/lyt/d_lyt_control_game.h b/include/d/lyt/d_lyt_control_game.h
new file mode 100644
index 00000000..5802522f
--- /dev/null
+++ b/include/d/lyt/d_lyt_control_game.h
@@ -0,0 +1,25 @@
+#ifndef D_LYT_CONTROL_GAME_H
+#define D_LYT_CONTROL_GAME_H
+
+#include "d/d_base.h"
+
+class dLytControlGame_c : public dBase_c {
+public:
+ dLytControlGame_c();
+ virtual ~dLytControlGame_c();
+
+ bool isInSomeMapState() const;
+ bool isNotInStateMap() const;
+
+ void fn_802CCD40(bool);
+
+ static dLytControlGame_c *getInstance() {
+ return sInstance;
+ }
+
+private:
+
+ static dLytControlGame_c *sInstance;
+};
+
+#endif
diff --git a/include/d/lyt/d_lyt_map.h b/include/d/lyt/d_lyt_map.h
index 81e3f3d2..fbe85483 100644
--- a/include/d/lyt/d_lyt_map.h
+++ b/include/d/lyt/d_lyt_map.h
@@ -263,6 +263,8 @@ public:
void build();
+ bool isOpenMaybe() const;
+
STATE_FUNC_DECLARE(dLytMapMain_c, Invisible);
STATE_FUNC_DECLARE(dLytMapMain_c, RenderingWait);
STATE_FUNC_DECLARE(dLytMapMain_c, In);
@@ -369,6 +371,14 @@ public:
return &sInstance->mResAcc;
}
+ static dLytMap_c *getInstance() {
+ return sInstance;
+ }
+
+ bool isOpenMaybe() const {
+ return mMapMain.isOpenMaybe();
+ }
+
void build();
private:
diff --git a/include/d/lyt/d_textbox.h b/include/d/lyt/d_textbox.h
index b3a69449..57b406fc 100644
--- a/include/d/lyt/d_textbox.h
+++ b/include/d/lyt/d_textbox.h
@@ -2,56 +2,116 @@
#define D_LYT_TEXTBOX_H
#include "d/lyt/d2d.h"
+#include "libms/msgfile.h"
+#include "nw4r/lyt/lyt_drawInfo.h"
#include "nw4r/lyt/lyt_textBox.h"
#include "nw4r/lyt/lyt_types.h"
+#include "nw4r/ut/ut_Rect.h"
+#include "nw4r/ut/ut_TextWriterBase.h"
+
+class dTagProcessor_c;
class dTextBox_c : public nw4r::lyt::TextBox {
friend class dWindow_c;
public:
- dTextBox_c(const nw4r::lyt::res::TextBox *pBlock, const nw4r::lyt::ResBlockSet &ResBlockSet);
+ dTextBox_c(const nw4r::lyt::res::TextBox *pBlock, const nw4r::lyt::ResBlockSet &resBlockSet);
+ virtual void DrawSelf(const nw4r::lyt::DrawInfo &drawInfo) override; // at 0x18
- f32 GetLineWidth(f32 *pOutSpacing);
+ f32 GetLineWidth(f32 *pOutSpacing) const;
+ f32 GetLinesHeight() const;
+ f32 GetUnkWidthRatio() const;
void setLytBase(d2d::LytBase_c *lytBase) {
mpLytBase = lytBase;
}
void SetScale(f32 scale) {
- nw4r::lyt::Size value(mTextScale);
+ nw4r::lyt::Size value(mMyTextScale);
value.width *= scale;
value.height *= scale;
- mScale = scale;
+ mMyScale = scale;
MySetScale(value);
nw4r::lyt::TextBox::SetFontSize(value);
}
+ void set0x1F6(u8 val) {
+ field_0x1F6 = val;
+ }
+
void set0x1F8(u8 val) {
field_0x1F8 = val;
}
f32 getMyScale() const {
- return mScale;
+ return mMyScale;
}
void fn_800E0A60(const char *area, ...) {
// TODO
}
- void fn_800AF930(const wchar_t *);
+ void setTextWithGlobalTextProcessor(const wchar_t *str);
+ void setTextWithGlobalTextProcessor(const wchar_t *str, void *, ...);
+ void setMessageWithGlobalTextProcessor(const char *labelId, void *unused, void *, ...);
+ void setMessageWithGlobalTextProcessorV(const char *labelId, void *unused, void *, va_list list);
+ void setTextWithTextProcessor(const wchar_t *str, dTagProcessor_c *tagProcessor, void *, ...);
+ s32 calcTextLines(const wchar_t *src, dTagProcessor_c *tagProcessor);
+
+ void setMessageWithGlobalTextProcessorAndMsbtInfo(const MsbtInfo *info, const char *labelId, wchar_t *destBuf, u32 maxLen);
+
+ void loadTextFormatVars();
+ void setupGX() const;
// @bug: This does not implement UT's RTTI, so casts to dTextBox_c will
// succeed even if all you have is a lyt::TextBox
private:
+ void init();
+ void MySetFontSize(const nw4r::lyt::Size &value);
void MySetScale(const nw4r::lyt::Size &value);
+ void setTextWithGlobalTextProcessorV(const wchar_t *str, void *, va_list list);
+ void setTextWithTextProcessorV(const wchar_t *str, dTagProcessor_c *tagProcessor, void *, va_list list);
+
+ nw4r::ut::Rect GetMyTextDrawRect(nw4r::ut::TextWriterBase<wchar_t> *pWriter, bool *pbWideScreenUnk) const;
+
+ f32 resizeTextToFit(f32 maxWidth);
+ bool hasDynamicText();
+ void someDebugCheckMaybe();
+
+ int GetStoredLineStrNum(int i, f32 *pLineWidth, bool *pbOver) const {
+ *pbOver = mbOvers[i];
+ *pLineWidth = mLineWidths[i];
+ return mLineStrNums[i];
+ }
+
+ void SetStoredLineStrNum(int i, f32 lineWidth, int lineStrNum, bool bOver) {
+ mLineWidths[i] = lineWidth;
+ mLineStrNums[i] = lineStrNum;
+ mbOvers[i] = bOver;
+ }
+
/* 0x104 */ d2d::LytBase_c *mpLytBase;
- /* 0x108 */ u8 field_0x108[0x118 - 0x108];
- /* 0x118 */ nw4r::lyt::Size mTextScale;
- /* 0x120 */ f32 mScale;
- /* 0x124 */ u8 field_0x124[0x1F8 - 0x124];
+ /* 0x108 */ f32 mFixedWidth;
+ /* 0x10C */ u8 mIsWidthFixed;
+ /* 0x114 */ nw4r::lyt::Size mMyFontSize;
+ /* 0x118 */ nw4r::lyt::Size mMyTextScale;
+ /* 0x120 */ f32 mMyScale;
+ /* 0x124 */ nw4r::ut::TextWriterBase<wchar_t> mTextWriter;
+ /* 0x188 */ nw4r::ut::Rect field_0x188;
+ /* 0x198 */ u32 mLineStrNums[10];
+ /* 0x1C0 */ u8 mFontIdx;
+ /* 0x1C1 */ u8 mWindowSubtype;
+ /* 0x1C4 */ f32 mLineWidths[10];
+ /* 0x1EC */ bool mbOvers[10];
+ /* 0x1F6 */ u8 field_0x1F6;
+ /* 0x1F7 */ u8 field_0x1F7;
/* 0x1F8 */ u8 field_0x1F8;
- /* 0x1F9 */ u8 field_0x1F9[0x204 - 0x1F9];
+ /* 0x1F9 */ bool field_0x1F9;
+ /* 0x1FA */ u8 field_0x1FA;
+ /* 0x1FC */ dTagProcessor_c *mpMyTagProcessor;
+ /* 0x200 */ bool mHasTextWriter;
+ /* 0x201 */ bool field_0x201;
};
#endif
diff --git a/include/d/lyt/msg_window/d_lyt_msg_window.h b/include/d/lyt/msg_window/d_lyt_msg_window.h
new file mode 100644
index 00000000..ad6be3c2
--- /dev/null
+++ b/include/d/lyt/msg_window/d_lyt_msg_window.h
@@ -0,0 +1,147 @@
+#ifndef D_LYT_MSG_WINDOW_H
+#define D_LYT_MSG_WINDOW_H
+
+#include "d/d_tag_processor.h"
+#include "d/d_textwindow_unk.h"
+#include "d/lyt/d2d.h"
+#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
+#include "d/lyt/msg_window/d_lyt_msg_window_select_btn.h"
+#include "m/m_vec.h"
+#include "s/s_State.hpp"
+#include "sized_string.h"
+
+// Forward declarations required for vtable order
+class dLytMsgWindowTalk_c;
+class dLytMsgWindowLink_c;
+class dLytMsgWindowGet_c;
+class dLytMsgWindowSword_c;
+class dLytMsgWindowWood_c;
+class dLytMsgWindowStone_c;
+class dLytMsgWindowDemo_c;
+class dLytAutoExplain_c;
+class dLytAutoCaption_c;
+
+struct dLytMsgWindowCharData;
+
+class dLytMsgWindow_c {
+public:
+ dLytMsgWindow_c() : mStateMgr(*this) {}
+ virtual ~dLytMsgWindow_c() {}
+
+ bool build();
+ bool remove();
+ bool execute();
+ bool draw();
+
+ bool isVisible() const;
+ bool isOutputtingText() const;
+
+ void setCurrentLabelName(const char *name, bool storeFile);
+ void setCurrentEntrypointName(const char *name);
+ void setCurrentFlowFilename(const char *name);
+
+ static dLytMsgWindow_c *getInstance() {
+ return sInstance;
+ }
+
+ SizedString<64> getLabel() const {
+ return mNameCopy;
+ }
+
+ const char *fn_80117390(bool) const;
+
+private:
+ bool setTextToDisplay(const wchar_t *text);
+ void createSubMsgManager(u8 type);
+ void removeSubMsgManagers();
+ bool fn_8011A5D0() const;
+
+ static dLytMsgWindow_c *sInstance;
+
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, Invisible);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, In);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, OutputText);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeyChangePage0);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeyChangePage1);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeyMsgEnd0);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeyMsgEnd1);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeyMsgEnd2);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeySelectQuestion);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, MapOpen);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeyMapClose);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, MapClose);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, Out);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, ExplainIn);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, ExplainVisible);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, ExplainOut);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, DemoIn);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, DemoVisible);
+ STATE_FUNC_DECLARE(dLytMsgWindow_c, DemoOut);
+
+ /* 0x004 */ UI_STATE_MGR_DECLARE(dLytMsgWindow_c);
+ /* 0x040 */ d2d::ResAccIf_c mResAcc1;
+ /* 0x3B0 */ d2d::ResAccIf_c mResAcc2;
+
+ /* 0x720 */ TextWindowUnk *mpMsgWindowUnk;
+ /* 0x724 */ dTagProcessor_c *mpTagProcessor;
+
+ /* 0x728 */ dLytMsgWindowSubtype *mpCurrentSubtype;
+ /* 0x72C */ dLytMsgWindowTalk_c *mpWindowTalk;
+ /* 0x730 */ dLytMsgWindowLink_c *mpWindowLink;
+ /* 0x734 */ dLytMsgWindowSword_c *mpWindowSword;
+ /* 0x738 */ dLytMsgWindowWood_c *mpWindowWood;
+ /* 0x73C */ dLytMsgWindowStone_c *mpWindowStone;
+ /* 0x740 */ dLytMsgWindowGet_c *mpWindowGet;
+ /* 0x744 */ dLytMsgWindowDemo_c *mpWindowDemo;
+ /* 0x748 */ dLytAutoExplain_c *mpAutoExplain;
+ /* 0x74C */ dLytAutoCaption_c *mpAutoCaption;
+
+ /* 0x750 */ u8 _0x750[0x75C - 0x750];
+ /* 0x75C */ mVec3_c field_0x75C;
+ /* 0x768 */ mVec3_c field_0x768;
+ /* 0x774 */ s32 field_0x774;
+ /* 0x778 */ s32 field_0x778;
+ /* 0x77C */ s32 field_0x77C;
+ /* 0x780 */ s32 field_0x780;
+ /* 0x784 */ s32 field_0x784;
+
+ /* 0x788 */ u16 mEntryPointToTrigger;
+ /* 0x78A */ u16 mAlsoEntryPointToTrigger;
+
+ /* 0x78C */ SizedString<0x40> mName;
+ /* 0x7CC */ SizedString<0x40> mNameCopy;
+
+ /* 0x80C */ u8 field_0x80C;
+ /* 0x80D */ u8 field_0x80D;
+ /* 0x80E */ u8 field_0x80E;
+ /* 0x80F */ u8 mShowAutoMessage;
+ /* 0x810 */ u8 field_0x810;
+ /* 0x811 */ u8 field_0x811;
+ /* 0x812 */ u8 field_0x812;
+ /* 0x813 */ u8 field_0x813;
+ /* 0x814 */ u8 field_0x814;
+ /* 0x815 */ u8 field_0x815;
+ /* 0x816 */ u8 field_0x816;
+ /* 0x817 */ u8 field_0x817;
+ /* 0x818 */ u8 field_0x818;
+ /* 0x819 */ u8 field_0x819;
+ /* 0x81A */ u8 field_0x81A;
+ /* 0x81B */ u8 field_0x81B;
+ /* 0x81C */ u8 field_0x81C;
+ /* 0x81D */ u8 field_0x81D;
+ /* 0x81E */ u8 field_0x81E;
+
+ /* 0x820 */ u16 field_0x820;
+ /* 0x824 */ s32 field_0x824;
+ /* 0x828 */ dLytMsgWindowCharData *field_0x828;
+
+ /* 0x82C */ u32 mTextOptionSelection;
+ /* 0x830 */ u32 mSpecialFiMenuValue;
+
+ /* 0x834 */ dLytMsgWindowSelectBtn_c mSelectBtn;
+ /* 0x1208 */ SizedString<8> mCurrentEntrypointName;
+ /* 0x1210 */ SizedString<16> mCurrentFlowFileName;
+ /* 0x1220 */ u8 field_0x1220;
+};
+
+#endif
diff --git a/include/d/lyt/msg_window/d_lyt_msg_window_common.h b/include/d/lyt/msg_window/d_lyt_msg_window_common.h
new file mode 100644
index 00000000..0180bdd3
--- /dev/null
+++ b/include/d/lyt/msg_window/d_lyt_msg_window_common.h
@@ -0,0 +1,91 @@
+#ifndef D_LYT_MGS_WINDOW_COMMON_H
+#define D_LYT_MGS_WINDOW_COMMON_H
+
+#include "common.h"
+#include "d/a/obj/d_a_obj_base.h"
+#include "d/d_tag_processor.h"
+#include "d/lyt/d2d.h"
+#include "m/m2d.h"
+#include "m/m_vec.h"
+#include "nw4r/lyt/lyt_pane.h"
+
+#define MSG_WINDOW_STATE_MGR_INLINE(className) void changeState(const sFStateID_c<className> &newState) { mStateMgr.changeState(newState); }
+
+class dLytMsgWindowSubtype : public m2d::Base_c {
+public:
+ /* vt 0x08 */ virtual ~dLytMsgWindowSubtype() {}
+ // vt 0x0C = m2d::Base_c::draw
+ /* vt 0x10 */ virtual bool build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor);
+ /* vt 0x14 */ virtual bool remove();
+ /* vt 0x18 */ virtual bool execute();
+ /* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param);
+ /* vt 0x20 */ virtual bool isDoneOpening() const;
+ /* vt 0x24 */ virtual void close();
+ /* vt 0x28 */ virtual bool isDoneClosing() const;
+ /* vt 0x2C */ virtual bool setText(const wchar_t *text);
+ /* vt 0x30 */ virtual dTextBox_c *getTextBox() {
+ return nullptr;
+ }
+ /* vt 0x34 */ virtual bool startConfirm() {
+ return true;
+ }
+ /* vt 0x38 */ virtual bool startDecide(bool b) {
+ return true;
+ }
+ /* vt 0x3C */ virtual bool isDoneDecide() const {
+ return true;
+ }
+ /* vt 0x40 */ virtual bool vt_0x40() const {
+ return true;
+ }
+};
+
+class dLytTextSword {
+public:
+ enum ESwordType {
+ FI,
+ GHIRAHIM,
+ LASTBOSS,
+ };
+
+ dLytTextSword() {}
+ /* vt at 0x00 */
+ virtual ~dLytTextSword() {}
+
+ bool build(d2d::ResAccIf_c *pResAcc, ESwordType type);
+ bool remove();
+ void draw(const wchar_t *str, s8 frame, mVec3_c pos, f32 scale);
+ f32 getAnimDuration() const;
+
+private:
+ /* 0x04 */ d2d::LytBase_c mLyt;
+ /* 0x94 */ d2d::AnmGroup_c mAnm;
+ /* 0xD4 */ dTextBox_c *mpTexts[3];
+ /* 0xE0 */ nw4r::lyt::Pane *mpPane;
+ /* 0xE4 */ ESwordType mType;
+};
+
+class dLytTextLight {
+public:
+ enum ETextType {
+ NORMAL,
+ DEMO,
+ };
+
+ dLytTextLight() {}
+ /* vt at 0x00 */
+ virtual ~dLytTextLight() {}
+
+ bool build(d2d::ResAccIf_c *pResAcc, ETextType type);
+ bool remove();
+ void draw(s8 frame, mVec3_c pos, u8 alpha, f32 scale);
+ f32 getAnimDuration() const;
+
+private:
+ /* 0x04 */ d2d::LytBase_c mLyt;
+ /* 0x94 */ d2d::AnmGroup_c mAnm;
+ /* 0xD4 */ nw4r::lyt::Pane *mpPane;
+ /* 0xD8 */ ETextType mType;
+};
+
+#endif
diff --git a/include/d/lyt/msg_window/d_lyt_msg_window_demo.h b/include/d/lyt/msg_window/d_lyt_msg_window_demo.h
new file mode 100644
index 00000000..dad4d332
--- /dev/null
+++ b/include/d/lyt/msg_window/d_lyt_msg_window_demo.h
@@ -0,0 +1,60 @@
+#ifndef D_LYT_MSG_WINDOW_DEMO_H
+#define D_LYT_MSG_WINDOW_DEMO_H
+
+#include "d/d_tag_processor.h"
+#include "d/d_textwindow_unk.h"
+#include "d/lyt/d2d.h"
+#include "d/lyt/d_textbox.h"
+#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
+#include "m/m_vec.h"
+#include "nw4r/lyt/lyt_pane.h"
+#include "s/s_State.hpp"
+#include "sized_string.h"
+
+class dLytMsgWindowDemo_c : public dLytMsgWindowSubtype {
+public:
+ dLytMsgWindowDemo_c() : mStateMgr(*this) {}
+ /* vt 0x08 */ virtual ~dLytMsgWindowDemo_c() {}
+ /* vt 0x0C */ virtual void draw() override;
+ /* vt 0x10 */ virtual bool
+ build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
+ /* vt 0x14 */ virtual bool remove() override;
+ /* vt 0x18 */ virtual bool execute() override;
+ /* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
+ /* vt 0x20 */ virtual bool isDoneOpening() const override;
+ /* vt 0x24 */ virtual void close() override;
+ /* vt 0x28 */ virtual bool isDoneClosing() const override;
+ /* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
+ /* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
+ return mpTextboxes[0];
+ }
+
+ dLytMsgWindowCharData *getCharData() {
+ return mBlurRelated.getCharData();
+ }
+
+ STATE_FUNC_DECLARE(dLytMsgWindowDemo_c, Invisible);
+ STATE_FUNC_DECLARE(dLytMsgWindowDemo_c, In);
+ STATE_FUNC_DECLARE(dLytMsgWindowDemo_c, Visible);
+ STATE_FUNC_DECLARE(dLytMsgWindowDemo_c, Out);
+
+private:
+ static SizedString<64> getTextLabel();
+
+ MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowDemo_c)
+ /* 0x010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowDemo_c);
+ /* 0x04C */ d2d::ResAccIf_c mResAcc;
+ /* 0x3BC */ d2d::LytBase_c mLyt;
+ /* 0x44C */ d2d::AnmGroup_c mAnm[2];
+
+ /* 0x4CC */ nw4r::lyt::Pane *mpPane;
+ /* 0x4D0 */ dTextBox_c *mpTextboxes[2];
+ /* 0x4D8 */ dTagProcessor_c *mpTagProcessor;
+ /* 0x4DC */ mVec2_c mOffsets[2];
+ /* 0x4EC */ dLytTextLight mText;
+ /* 0x5C8 */ MsgWindowBlurRelated mBlurRelated;
+
+ /* 0x55B8 */ bool mShouldBeOpen;
+};
+
+#endif
diff --git a/include/d/lyt/msg_window/d_lyt_msg_window_get.h b/include/d/lyt/msg_window/d_lyt_msg_window_get.h
new file mode 100644
index 00000000..7aabba08
--- /dev/null
+++ b/include/d/lyt/msg_window/d_lyt_msg_window_get.h
@@ -0,0 +1,68 @@
+#ifndef D_LYT_MSG_WINDOW_GET_H
+#define D_LYT_MSG_WINDOW_GET_H
+
+#include "d/d_tag_processor.h"
+#include "d/d_textwindow_unk.h"
+#include "d/lyt/d2d.h"
+#include "d/lyt/d_lyt_common_a_btn.h"
+#include "d/lyt/d_textbox.h"
+#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
+#include "m/m_vec.h"
+#include "s/s_State.hpp"
+
+class dLytMsgWindowGet_c : public dLytMsgWindowSubtype {
+public:
+ dLytMsgWindowGet_c() : mStateMgr(*this) {}
+ /* vt 0x08 */ virtual ~dLytMsgWindowGet_c() {}
+ /* vt 0x0C */ virtual void draw() override;
+ /* vt 0x10 */ virtual bool
+ build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
+ /* vt 0x14 */ virtual bool remove() override;
+ /* vt 0x18 */ virtual bool execute() override;
+ /* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
+ /* vt 0x20 */ virtual bool isDoneOpening() const override;
+ /* vt 0x24 */ virtual void close() override;
+ /* vt 0x28 */ virtual bool isDoneClosing() const override;
+ /* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
+ /* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
+ return mpTextboxes[0];
+ }
+ /* vt 0x34 */ virtual bool startConfirm() override {
+ return mBtn.requestIn();
+ }
+ /* vt 0x38 */ virtual bool startDecide(bool b) override {
+ return mBtn.requestOut(b);
+ }
+ /* vt 0x3C */ virtual bool isDoneDecide() const override {
+ return mBtn.isDoneOut();
+ }
+
+ STATE_FUNC_DECLARE(dLytMsgWindowGet_c, Invisible);
+ STATE_FUNC_DECLARE(dLytMsgWindowGet_c, In);
+ STATE_FUNC_DECLARE(dLytMsgWindowGet_c, Visible);
+ STATE_FUNC_DECLARE(dLytMsgWindowGet_c, Out);
+
+ dLytMsgWindowCharData *getCharData() {
+ return mBlurRelated.getCharData();
+ }
+
+private:
+ MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowGet_c)
+ /* 0x0010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowGet_c);
+ /* 0x004C */ d2d::SubPaneList mSubpaneList;
+ /* 0x005C */ d2d::SubPaneListNode mNodes[1];
+ /* 0x0068 */ d2d::ResAccIf_c mResAcc;
+ /* 0x03D8 */ d2d::LytBase_c mLyt;
+ /* 0x0468 */ d2d::AnmGroup_c mAnm[3];
+ /* 0x0528 */ dTextBox_c *mpTextboxes[2];
+ /* 0x0530 */ nw4r::lyt::Pane *mpPanes[6];
+ /* 0x0548 */ dTagProcessor_c *mpTagProcessor;
+ /* 0x054C */ mVec2_c mOffset;
+ /* 0x0554 */ dLytCommonABtn_c mBtn;
+ /* 0x06E0 */ dLytTextLight mText;
+ /* 0x07C4 */ MsgWindowBlurRelated mBlurRelated;
+
+ /* 0x55B8 */ bool mShouldBeOpen;
+};
+
+#endif
diff --git a/include/d/lyt/msg_window/d_lyt_msg_window_link.h b/include/d/lyt/msg_window/d_lyt_msg_window_link.h
new file mode 100644
index 00000000..f392c417
--- /dev/null
+++ b/include/d/lyt/msg_window/d_lyt_msg_window_link.h
@@ -0,0 +1,73 @@
+#ifndef D_LYT_MSG_WINDOW_LINK_H
+#define D_LYT_MSG_WINDOW_LINK_H
+
+#include "d/d_tag_processor.h"
+#include "d/d_textwindow_unk.h"
+#include "d/lyt/d2d.h"
+#include "d/lyt/d_lyt_common_a_btn.h"
+#include "d/lyt/d_textbox.h"
+#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
+#include "s/s_State.hpp"
+
+class dLytMsgWindowLink_c : public dLytMsgWindowSubtype {
+public:
+ dLytMsgWindowLink_c() : mStateMgr(*this) {}
+ /* vt 0x08 */ virtual ~dLytMsgWindowLink_c() {}
+ /* vt 0x0C */ virtual void draw() override;
+ /* vt 0x10 */ virtual bool
+ build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
+ /* vt 0x14 */ virtual bool remove() override;
+ /* vt 0x18 */ virtual bool execute() override;
+ /* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
+ /* vt 0x20 */ virtual bool isDoneOpening() const override;
+ /* vt 0x24 */ virtual void close() override;
+ /* vt 0x28 */ virtual bool isDoneClosing() const override;
+ /* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
+ /* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
+ return mpTextboxes[0];
+ }
+ /* vt 0x34 */ virtual bool startConfirm() override {
+ return mBtn.requestIn();
+ }
+ /* vt 0x38 */ virtual bool startDecide(bool b) override {
+ return mBtn.requestOut(b);
+ }
+ /* vt 0x3C */ virtual bool isDoneDecide() const override {
+ return mBtn.isDoneOut();
+ }
+
+ STATE_FUNC_DECLARE(dLytMsgWindowLink_c, Invisible);
+ STATE_FUNC_DECLARE(dLytMsgWindowLink_c, In);
+ STATE_FUNC_DECLARE(dLytMsgWindowLink_c, Wait);
+ STATE_FUNC_DECLARE(dLytMsgWindowLink_c, Visible);
+ STATE_FUNC_DECLARE(dLytMsgWindowLink_c, Out);
+
+ dLytMsgWindowCharData *getCharData() {
+ return mBlurRelated.getCharData();
+ }
+
+private:
+ MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowLink_c)
+ /* 0x0010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowLink_c);
+ /* 0x004C */ d2d::SubPaneList mSubpaneList;
+ /* 0x005C */ d2d::SubPaneListNode mNodes[1];
+ /* 0x0068 */ d2d::ResAccIf_c mResAcc;
+ /* 0x03D8 */ d2d::LytBase_c mLyt;
+ /* 0x0468 */ d2d::AnmGroup_c mAnm[4];
+ /* 0x0568 */ dTextBox_c *mpTextboxes[2];
+ /* 0x0570 */ nw4r::lyt::Pane *mpPanes[5];
+ /* 0x0584 */ dTagProcessor_c *mpTagProcessor;
+ /* 0x0588 */ mVec3_c mTranslationOrig;
+ /* 0x0594 */ mVec3_c mTranslationTo;
+ /* 0x05A0 */ mVec3_c mTranslationFrom;
+ /* 0x05AC */ mVec2_c mOffset;
+ /* 0x05B4 */ dAcObjBase_c *mpActor;
+ /* 0x05B8 */ s32 mParam;
+ /* 0x05BC */ s32 mWaitDelay;
+ /* 0x05C0 */ dLytCommonABtn_c mBtn;
+ /* 0x0770 */ dLytTextLight mText;
+ /* 0x084C */ MsgWindowBlurRelated mBlurRelated;
+ /* 0x583C */ bool mShouldBeOpen;
+};
+
+#endif
diff --git a/include/d/lyt/msg_window/d_lyt_msg_window_select_btn.h b/include/d/lyt/msg_window/d_lyt_msg_window_select_btn.h
new file mode 100644
index 00000000..3d69201e
--- /dev/null
+++ b/include/d/lyt/msg_window/d_lyt_msg_window_select_btn.h
@@ -0,0 +1,149 @@
+#ifndef D_LYT_MSG_WINDOW_SELECT_BTN_H
+#define D_LYT_MSG_WINDOW_SELECT_BTN_H
+
+#include "d/d_tag_processor.h"
+#include "d/lyt/d2d.h"
+#include "d/lyt/d_textbox.h"
+#include "d/lyt/d_window.h"
+#include "nw4r/lyt/lyt_pane.h"
+#include "s/s_State.hpp"
+
+// Size 0x54?
+struct SelectBtnHelper {
+ SelectBtnHelper();
+ ~SelectBtnHelper();
+
+ /* 0x00 */ nw4r::lyt::Pane *panes[9];
+ /* 0x24 */ u8 _0x24[0x34 - 0x24];
+ /* 0x34 */ f32 field_0x34;
+ /* 0x38 */ f32 field_0x38;
+ /* 0x3C */ f32 field_0x3C;
+ /* 0x40 */ f32 field_0x40;
+ /* 0x44 */ s32 field_0x44;
+ /* 0x48 */ s32 field_0x48;
+ /* 0x4C */ s32 field_0x4C;
+ /* 0x50 */ s8 field_0x50;
+ /* 0x51 */ s8 field_0x51;
+ /* 0x52 */ s8 field_0x52;
+
+ f32 fn_8011D690(s32);
+ void fn_8011C970();
+ u8 fn_8011CAC0();
+};
+
+class dLytMsgWindowSelectBtnParts_c {
+ friend class dLytMsgWindowSelectBtn_c;
+
+public:
+ dLytMsgWindowSelectBtnParts_c() : mStateMgr(*this) {}
+
+ void init();
+ void execute();
+
+private:
+ STATE_FUNC_DECLARE(dLytMsgWindowSelectBtnParts_c, Wait);
+ STATE_FUNC_DECLARE(dLytMsgWindowSelectBtnParts_c, On);
+ STATE_FUNC_DECLARE(dLytMsgWindowSelectBtnParts_c, Select);
+ STATE_FUNC_DECLARE(dLytMsgWindowSelectBtnParts_c, Off);
+
+ /* 0x00 */ UI_STATE_MGR_DECLARE(dLytMsgWindowSelectBtnParts_c);
+ /* 0x3C */ d2d::AnmGroup_c *mpAnms[3];
+ /* 0x48 */ u32 field_0x48;
+ /* 0x4C */ u32 field_0x4C;
+ /* 0x50 */ u8 field_0x50;
+};
+
+class dLytMsgWindowSelectBtn_c : public d2d::dSubPane {
+public:
+ dLytMsgWindowSelectBtn_c() : mStateMgr(*this) {}
+ virtual bool build(d2d::ResAccIf_c *resAcc) override;
+ virtual bool remove() override;
+ virtual bool execute() override;
+ virtual nw4r::lyt::Pane *getPane() override {
+ return mLyt.getLayout()->GetRootPane();
+ }
+ virtual d2d::LytBase_c *getLyt() override {
+ return &mLyt;
+ }
+ virtual const char *getName() const override {
+ return mLyt.getName();
+ }
+
+ virtual ~dLytMsgWindowSelectBtn_c() {}
+
+ bool draw();
+
+ s32 getField_0x9B4() const {
+ return field_0x9B4;
+ }
+
+ void setField_0x9B8(s32 value) {
+ field_0x9B8 = value;
+ }
+
+ void setField_0x9BC(s32 value) {
+ field_0x9BC = value;
+ }
+
+ void setField_0x990(s32 value) {
+ mBtnHelper.field_0x4C = value;
+ }
+
+ void setField_0x998(dTagProcessor_c *value) {
+ mpTagProcessor = value;
+ }
+
+ void fn_8011E5D0(u32, bool);
+
+ dTextBox_c *getSelectTextBox(s32 option, s32 idx) const {
+ return mpSelectTextBoxes[option][idx];
+ }
+
+ BOOL isStateWait() {
+ return *mStateMgr.getStateID() == StateID_Wait;
+ }
+
+private:
+ s32 fn_8011FE50();
+
+ STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, Wait);
+ STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, In);
+ STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, WaitSelect);
+ STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, CursorInOut);
+ STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, WaitDecide);
+ STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, WaitCancel);
+ STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, Out);
+
+ /* 0x008 */ UI_STATE_MGR_DECLARE(dLytMsgWindowSelectBtn_c);
+ /* 0x044 */ d2d::dLytSub mLyt;
+ /* 0x0D8 */ d2d::AnmGroup_c mAnm[27];
+ /* 0x798 */ nw4r::lyt::Pane *mpSelectPanes[7];
+ /* 0x7B4 */ dTextBox_c *mpSelectTextBoxes[4][2];
+ /* 0x7D4 */ dTextBox_c *mpDecideTextBoxes[2];
+ /* 0x7DC */ nw4r::lyt::Pane *mpBoundings[4];
+ /* 0x7EC */ dWindow_c *mpWindow;
+ /* 0x7F0 */ dTextBox_c *mpSizeBox;
+ /* 0x7F4 */ dLytMsgWindowSelectBtnParts_c mParts[4];
+ /* 0x944 */ SelectBtnHelper mBtnHelper;
+ /* 0x998 */ dTagProcessor_c *mpTagProcessor;
+ /* 0x99C */ s32 field_0x99C;
+ /* 0x9A0 */ s32 field_0x9A0;
+ /* 0x9A4 */ u8 field_0x9A4;
+ /* 0x9A8 */ s32 field_0x9A8;
+ /* 0x9AC */ void *field_0x9AC;
+ /* 0x9B0 */ s32 field_0x9B0;
+ /* 0x9B0 */ s32 field_0x9B4;
+ /* 0x9B8 */ s32 field_0x9B8;
+ /* 0x9BC */ s32 field_0x9BC;
+ /* 0x9C0 */ s32 field_0x9C0;
+ /* 0x9C4 */ void *field_0x9C4;
+ /* 0x9C8 */ s32 field_0x9C8;
+ /* 0x9CC */ s8 field_0x9CC;
+ /* 0x9CD */ u8 field_0x9CD;
+ /* 0x9CE */ u8 field_0x9CE;
+ /* 0x9CF */ u8 field_0x9CF;
+ /* 0x9D0 */ u8 field_0x9D0;
+ /* 0x9D1 */ u8 field_0x9D1;
+};
+
+#endif
diff --git a/include/d/lyt/msg_window/d_lyt_msg_window_stone.h b/include/d/lyt/msg_window/d_lyt_msg_window_stone.h
new file mode 100644
index 00000000..4e2b4e71
--- /dev/null
+++ b/include/d/lyt/msg_window/d_lyt_msg_window_stone.h
@@ -0,0 +1,59 @@
+#ifndef D_LYT_MSG_WINDOW_STONE_H
+#define D_LYT_MSG_WINDOW_STONE_H
+
+#include "d/d_tag_processor.h"
+#include "d/lyt/d2d.h"
+#include "d/lyt/d_lyt_common_a_btn.h"
+#include "d/lyt/d_textbox.h"
+#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
+#include "nw4r/lyt/lyt_pane.h"
+#include "s/s_State.hpp"
+
+class dLytMsgWindowStone_c : public dLytMsgWindowSubtype {
+public:
+ dLytMsgWindowStone_c() : mStateMgr(*this) {}
+ /* vt 0x08 */ virtual ~dLytMsgWindowStone_c() {}
+ /* vt 0x0C */ virtual void draw() override;
+ /* vt 0x10 */ virtual bool
+ build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
+ /* vt 0x14 */ virtual bool remove() override;
+ /* vt 0x18 */ virtual bool execute() override;
+ /* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
+ /* vt 0x20 */ virtual bool isDoneOpening() const override;
+ /* vt 0x24 */ virtual void close() override;
+ /* vt 0x28 */ virtual bool isDoneClosing() const override;
+ /* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
+ /* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
+ return mpTextboxes[0];
+ }
+ /* vt 0x34 */ virtual bool startConfirm() override {
+ return mBtn.requestIn();
+ }
+ /* vt 0x38 */ virtual bool startDecide(bool b) override {
+ return mBtn.requestOut(b);
+ }
+ /* vt 0x3C */ virtual bool isDoneDecide() const override {
+ return mBtn.isDoneOut();
+ }
+
+ STATE_FUNC_DECLARE(dLytMsgWindowStone_c, Invisible);
+ STATE_FUNC_DECLARE(dLytMsgWindowStone_c, In);
+ STATE_FUNC_DECLARE(dLytMsgWindowStone_c, Visible);
+ STATE_FUNC_DECLARE(dLytMsgWindowStone_c, Out);
+
+private:
+ MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowStone_c)
+ /* 0x010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowStone_c);
+ /* 0x04C */ d2d::SubPaneList mSubpaneList;
+ /* 0x05C */ d2d::SubPaneListNode mNodes[1];
+ /* 0x068 */ d2d::ResAccIf_c mResAcc;
+ /* 0x3D8 */ d2d::LytBase_c mLyt;
+ /* 0x468 */ d2d::AnmGroup_c mAnm[3];
+ /* 0x528 */ dTextBox_c *mpTextboxes[3];
+ /* 0x530 */ nw4r::lyt::Pane *mpPanes[2];
+ /* 0x538 */ dTagProcessor_c *mpTagProcessor;
+ /* 0x53C */ dLytCommonABtn_c mBtn;
+ /* 0x6EC */ bool mShouldBeOpen;
+};
+
+#endif
diff --git a/include/d/lyt/msg_window/d_lyt_msg_window_sword.h b/include/d/lyt/msg_window/d_lyt_msg_window_sword.h
new file mode 100644
index 00000000..ae9a40b8
--- /dev/null
+++ b/include/d/lyt/msg_window/d_lyt_msg_window_sword.h
@@ -0,0 +1,88 @@
+#ifndef D_LYT_MSG_WINDOW_SWORD_H
+#define D_LYT_MSG_WINDOW_SWORD_H
+
+#include "d/a/obj/d_a_obj_base.h"
+#include "d/d_tag_processor.h"
+#include "d/d_textwindow_unk.h"
+#include "d/lyt/d2d.h"
+#include "d/lyt/d_lyt_common_a_btn.h"
+#include "d/lyt/d_textbox.h"
+#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
+#include "m/m_vec.h"
+#include "s/s_State.hpp"
+
+class dLytMsgWindowSword_c : public dLytMsgWindowSubtype {
+public:
+ dLytMsgWindowSword_c() : mStateMgr(*this) {}
+ /* vt 0x08 */ virtual ~dLytMsgWindowSword_c() {}
+ /* vt 0x0C */ virtual void draw() override;
+ /* vt 0x10 */ virtual bool
+ build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
+ /* vt 0x14 */ virtual bool remove() override;
+ /* vt 0x18 */ virtual bool execute() override;
+ /* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
+ /* vt 0x20 */ virtual bool isDoneOpening() const override;
+ /* vt 0x24 */ virtual void close() override;
+ /* vt 0x28 */ virtual bool isDoneClosing() const override;
+ /* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
+ /* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
+ return mpTextboxes[0];
+ }
+ /* vt 0x34 */ virtual bool startConfirm() override {
+ return mBtn.requestIn();
+ }
+ /* vt 0x38 */ virtual bool startDecide(bool b) override {
+ return mBtn.requestOut(b);
+ }
+ /* vt 0x3C */ virtual bool isDoneDecide() const override {
+ return mBtn.isDoneOut();
+ }
+
+ STATE_FUNC_DECLARE(dLytMsgWindowSword_c, Invisible);
+ STATE_FUNC_DECLARE(dLytMsgWindowSword_c, In);
+ STATE_FUNC_DECLARE(dLytMsgWindowSword_c, Wait);
+ STATE_FUNC_DECLARE(dLytMsgWindowSword_c, Visible);
+ STATE_FUNC_DECLARE(dLytMsgWindowSword_c, Out);
+
+ void setSwordType(dLytTextSword::ESwordType type) {
+ mSwordType = type;
+ }
+
+ dLytMsgWindowCharData *getCharData() {
+ return mCharacterData;
+ }
+
+private:
+ MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowSword_c)
+ /* 0x0010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowSword_c);
+ /* 0x004C */ d2d::SubPaneList mSubpaneList;
+ /* 0x005C */ d2d::SubPaneListNode mNodes[1];
+ /* 0x0068 */ d2d::ResAccIf_c mResAcc;
+ /* 0x03D8 */ d2d::LytBase_c mLyt;
+ /* 0x0468 */ d2d::AnmGroup_c mAnm[5];
+ /* 0x05A8 */ dTextBox_c *mpTextboxes[2];
+ /* 0x05B0 */ nw4r::lyt::Pane *mpPanes[3];
+ /* 0x05BC */ dTagProcessor_c *mpTagProcessor;
+ /* 0x05C0 */ mVec3_c mTranslationOrig;
+ /* 0x05CC */ mVec3_c mTranslationTo;
+ /* 0x05D8 */ mVec3_c mTranslationFrom;
+
+ /* 0x05E4 */ mVec2_c mOffset;
+
+ /* 0x05EC */ dAcObjBase_c *mpActor;
+ /* 0x05F0 */ s32 mParam;
+
+ /* 0x05F4 */ s32 mWaitDelay;
+
+ /* 0x05F8 */ dLytCommonABtn_c mBtn;
+
+ /* 0x07A8 */ dLytMsgWindowCharData mCharacterData[1023];
+ /* 0x5794 */ wchar_t mTextBuf[1023];
+
+ /* 0x5F94 */ dLytTextSword mSwordText;
+ /* 0x607C */ dLytTextSword::ESwordType mSwordType;
+ /* 0x6080 */ bool mShouldBeOpen;
+ /* 0x6081 */ bool mHasDrawnThisTick;
+};
+
+#endif
diff --git a/include/d/lyt/msg_window/d_lyt_msg_window_talk.h b/include/d/lyt/msg_window/d_lyt_msg_window_talk.h
new file mode 100644
index 00000000..3cbed7e2
--- /dev/null
+++ b/include/d/lyt/msg_window/d_lyt_msg_window_talk.h
@@ -0,0 +1,74 @@
+#ifndef D_LYT_MSG_WINDOW_TALK_H
+#define D_LYT_MSG_WINDOW_TALK_H
+
+#include "d/d_tag_processor.h"
+#include "d/d_textwindow_unk.h"
+#include "d/lyt/d2d.h"
+#include "d/lyt/d_lyt_common_a_btn.h"
+#include "d/lyt/d_textbox.h"
+#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
+#include "m/m_vec.h"
+#include "s/s_State.hpp"
+
+class dLytMsgWindowTalk_c : public dLytMsgWindowSubtype {
+public:
+ dLytMsgWindowTalk_c() : mStateMgr(*this) {}
+ /* vt 0x08 */ virtual ~dLytMsgWindowTalk_c() {}
+ /* vt 0x0C */ virtual void draw() override;
+ /* vt 0x10 */ virtual bool
+ build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
+ /* vt 0x14 */ virtual bool remove() override;
+ /* vt 0x18 */ virtual bool execute() override;
+ /* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
+ /* vt 0x20 */ virtual bool isDoneOpening() const override;
+ /* vt 0x24 */ virtual void close() override;
+ /* vt 0x28 */ virtual bool isDoneClosing() const override;
+ /* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
+ /* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
+ return mpTextboxes[0];
+ }
+ /* vt 0x34 */ virtual bool startConfirm() override {
+ return mBtn.requestIn();
+ }
+ /* vt 0x38 */ virtual bool startDecide(bool b) override {
+ return mBtn.requestOut(b);
+ }
+ /* vt 0x3C */ virtual bool isDoneDecide() const override {
+ return mBtn.isDoneOut();
+ }
+
+ STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, Invisible);
+ STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, In);
+ STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, Wait);
+ STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, Visible);
+ STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, Out);
+
+ dLytMsgWindowCharData *getCharData() {
+ return mBlurRelated.getCharData();
+ }
+
+private:
+ MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowTalk_c)
+ /* 0x0010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowTalk_c);
+ /* 0x004C */ d2d::SubPaneList mSubpaneList;
+ /* 0x005C */ d2d::SubPaneListNode mNodes[1];
+ /* 0x0068 */ d2d::ResAccIf_c mResAcc;
+ /* 0x03D8 */ d2d::LytBase_c mLyt;
+ /* 0x0468 */ d2d::AnmGroup_c mAnm[4];
+ /* 0x0568 */ dTextBox_c *mpTextboxes[2];
+ /* 0x0570 */ nw4r::lyt::Pane *mpPanes[5];
+ /* 0x0584 */ dTagProcessor_c *mpTagProcessor;
+ /* 0x0588 */ mVec3_c mTranslationOrig;
+ /* 0x0594 */ mVec3_c mTranslationTo;
+ /* 0x05A0 */ mVec3_c mTranslationFrom;
+ /* 0x05AC */ mVec2_c mOffset;
+ /* 0x05B4 */ dAcObjBase_c *mpActor;
+ /* 0x05B8 */ s32 mParam;
+ /* 0x05BC */ s32 mWaitDelay;
+ /* 0x05C0 */ dLytCommonABtn_c mBtn;
+ /* 0x0770 */ dLytTextLight mText;
+ /* 0x084C */ MsgWindowBlurRelated mBlurRelated;
+ /* 0x583C */ bool mShouldBeOpen;
+};
+
+#endif
diff --git a/include/d/lyt/msg_window/d_lyt_msg_window_wood.h b/include/d/lyt/msg_window/d_lyt_msg_window_wood.h
new file mode 100644
index 00000000..d1a31ff6
--- /dev/null
+++ b/include/d/lyt/msg_window/d_lyt_msg_window_wood.h
@@ -0,0 +1,60 @@
+#ifndef D_LYT_MSG_WINDOW_WOOD_H
+#define D_LYT_MSG_WINDOW_WOOD_H
+
+#include "d/a/obj/d_a_obj_base.h"
+#include "d/d_tag_processor.h"
+#include "d/lyt/d2d.h"
+#include "d/lyt/d_lyt_common_a_btn.h"
+#include "d/lyt/d_textbox.h"
+#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
+#include "nw4r/lyt/lyt_pane.h"
+#include "s/s_State.hpp"
+
+class dLytMsgWindowWood_c : public dLytMsgWindowSubtype {
+public:
+ dLytMsgWindowWood_c() : mStateMgr(*this) {}
+ /* vt 0x08 */ virtual ~dLytMsgWindowWood_c() {}
+ /* vt 0x0C */ virtual void draw() override;
+ /* vt 0x10 */ virtual bool
+ build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
+ /* vt 0x14 */ virtual bool remove() override;
+ /* vt 0x18 */ virtual bool execute() override;
+ /* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
+ /* vt 0x20 */ virtual bool isDoneOpening() const override;
+ /* vt 0x24 */ virtual void close() override;
+ /* vt 0x28 */ virtual bool isDoneClosing() const override;
+ /* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
+ /* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
+ return mpTextboxes[0];
+ }
+ /* vt 0x34 */ virtual bool startConfirm() override {
+ return mBtn.requestIn();
+ }
+ /* vt 0x38 */ virtual bool startDecide(bool b) override {
+ return mBtn.requestOut(b);
+ }
+ /* vt 0x3C */ virtual bool isDoneDecide() const override {
+ return mBtn.isDoneOut();
+ }
+
+ STATE_FUNC_DECLARE(dLytMsgWindowWood_c, Invisible);
+ STATE_FUNC_DECLARE(dLytMsgWindowWood_c, In);
+ STATE_FUNC_DECLARE(dLytMsgWindowWood_c, Visible);
+ STATE_FUNC_DECLARE(dLytMsgWindowWood_c, Out);
+
+private:
+ MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowWood_c)
+ /* 0x010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowWood_c);
+ /* 0x04C */ d2d::SubPaneList mSubpaneList;
+ /* 0x05C */ d2d::SubPaneListNode mNodes[1];
+ /* 0x068 */ d2d::ResAccIf_c mResAcc;
+ /* 0x3D8 */ d2d::LytBase_c mLyt;
+ /* 0x468 */ d2d::AnmGroup_c mAnm[3];
+ /* 0x528 */ dTextBox_c *mpTextboxes[2];
+ /* 0x530 */ nw4r::lyt::Pane *mpPanes[2];
+ /* 0x538 */ dTagProcessor_c *mpTagProcessor;
+ /* 0x53C */ dLytCommonABtn_c mBtn;
+ /* 0x6EC */ bool mShouldBeOpen;
+};
+
+#endif
diff --git a/include/egg/math/eggVector.h b/include/egg/math/eggVector.h
index 2d030d45..f509ad85 100644
--- a/include/egg/math/eggVector.h
+++ b/include/egg/math/eggVector.h
@@ -136,6 +136,11 @@ public:
static const Vector2f ex;
static const Vector2f ey;
+ void set(f32 fx, f32 fy) {
+ x = fx;
+ y = fy;
+ }
+
Vector2f operator-(const Vector2f &v) {
return Vector2f(x - v.x, y - v.y);
}
diff --git a/include/libms/commonlib.h b/include/libms/commonlib.h
index 13e8bcc1..7a0680e4 100644
--- a/include/libms/commonlib.h
+++ b/include/libms/commonlib.h
@@ -22,8 +22,7 @@ struct MsbBlock {
/* 0x0C */ u16 field_0x0C;
};
-#pragma push
-#pragma pack(2)
+#pragma pack(push ,2)
struct MsbHeader {
/* 0x00 */ unsigned char field_0x00[0x0C - 0x00];
@@ -33,7 +32,7 @@ struct MsbHeader {
/* 0x12 */ int fileLength;
};
-#pragma pop
+#pragma pack(pop)
struct MsbInfo {
/* 0x00 */ struct MsbHeader *header;
diff --git a/include/libms/flowfile.h b/include/libms/flowfile.h
index 9bc47790..edd1710f 100644
--- a/include/libms/flowfile.h
+++ b/include/libms/flowfile.h
@@ -12,7 +12,7 @@ struct MsbfInfo;
struct MsbFlowInfo {
/* 0x00 */ char type;
/* 0x01 */ char subType;
- /* 0x04 */ short params1n2;
+ /* 0x04 */ int params1n2;
/* 0x08 */ short next;
/* 0x0A */ short param3;
/* 0x0C */ short param4;
diff --git a/include/libms/msgfile.h b/include/libms/msgfile.h
index 50121699..bc6f2aaa 100644
--- a/include/libms/msgfile.h
+++ b/include/libms/msgfile.h
@@ -2,6 +2,7 @@
#define LIBMS_MSGFILE_H
#include "common.h"
+#include <wchar.h>
#ifdef __cplusplus
extern "C" {
@@ -16,11 +17,11 @@ struct MsbtAttrInfo {
struct MsbtInfo *LMS_InitMessage(void *data);
void LMS_CloseMessage(struct MsbtInfo *info);
-int LMS_GetTextIndexByLabel(struct MsbtInfo *info, const char *label);
-const char *LMS_GetText(struct MsbtInfo *info, int index);
-const char *LMS_GetTextByLabel(struct MsbtInfo *info, const char *label);
-const char *LMS_GetLabelByTextIndex(struct MsbtInfo *info, int index);
-struct MsbtAttrInfo *LMS_GetAttribute(struct MsbtInfo *info, int index);
+int LMS_GetTextIndexByLabel(const struct MsbtInfo *info, const char *label);
+const wchar_t *LMS_GetText(const struct MsbtInfo *info, int index);
+const wchar_t *LMS_GetTextByLabel(const struct MsbtInfo *info, const char *label);
+const char *LMS_GetLabelByTextIndex(const struct MsbtInfo *info, int index);
+struct MsbtAttrInfo *LMS_GetAttribute(const struct MsbtInfo *info, int index);
#ifdef __cplusplus
}
diff --git a/include/m/m2d.h b/include/m/m2d.h
index cf0936e1..3f839d91 100644
--- a/include/m/m2d.h
+++ b/include/m/m2d.h
@@ -94,6 +94,11 @@ public:
setFrame(actualEnd * ratio);
}
+ inline f32 getRatio() const {
+ f32 actualEnd = mEndFrame - 1.0f;
+ return mCurrFrame / actualEnd;
+ }
+
inline void setBackwardsRatio(f32 ratio) {
f32 actualEnd = mEndFrame - 1.0f;
setFrame(actualEnd - (ratio * actualEnd));
@@ -105,7 +110,7 @@ public:
return f >= end ? 0.0f : f;
}
- inline f32 getEndFrameRaw() const {
+ inline f32 getAnimDuration() const {
return mEndFrame;
}
@@ -162,7 +167,7 @@ public:
Base_c(u8 priority) : mPriority(priority) {}
/* 0x00 */ nw4r::ut::Node mLink;
- /* vt offset 0x04 */
+ /* vt offset 0x08 */
/* vt 0x08 */ virtual ~Base_c();
/* vt 0x0C */ virtual void draw();
diff --git a/include/m/m_fader_base.h b/include/m/m_fader_base.h
index fcef4dfd..61869523 100644
--- a/include/m/m_fader_base.h
+++ b/include/m/m_fader_base.h
@@ -19,14 +19,14 @@ public:
};
mFaderBase_c(const mColor &color, EStatus status);
- virtual ~mFaderBase_c();
-
- virtual void setStatus(EStatus status) = 0;
- virtual EStatus getStatus() const;
- virtual bool fadeIn();
- virtual bool fadeOut();
- virtual bool calc();
- virtual void draw() = 0;
+ /* vt 0x08 */ virtual ~mFaderBase_c();
+
+ /* vt 0x0C */ virtual void setStatus(EStatus status) = 0;
+ /* vt 0x10 */ virtual EStatus getStatus() const;
+ /* vt 0x14 */ virtual bool fadeIn();
+ /* vt 0x18 */ virtual bool fadeOut();
+ /* vt 0x1C */ virtual bool calc();
+ /* vt 0x20 */ virtual void draw() = 0;
void setFrame(u16 frame);
void setColor(const mColor &color);
diff --git a/include/m/m_vec.h b/include/m/m_vec.h
index 011679b0..0ec12fd4 100644
--- a/include/m/m_vec.h
+++ b/include/m/m_vec.h
@@ -254,4 +254,14 @@ public:
static mVec3_c Ez;
};
+class mVec2_c : public EGG::Vector2f {
+public:
+ mVec2_c() {}
+ ~mVec2_c() {}
+
+ mVec2_c(const mVec2_c &other) {
+ set(other.x, other.y);
+ }
+};
+
#endif
diff --git a/include/nw4r/lyt/lyt_pane.h b/include/nw4r/lyt/lyt_pane.h
index a1fa6327..87c760be 100644
--- a/include/nw4r/lyt/lyt_pane.h
+++ b/include/nw4r/lyt/lyt_pane.h
@@ -41,9 +41,15 @@ public:
bool IsInfluencedAlpha() const {
return detail::TestBit<u8>(mFlag, INFLUENCED_ALPHA);
}
+ void SetInfluencedAlpha(bool bInfluenced) {
+ detail::SetBit(&mFlag, INFLUENCED_ALPHA, bInfluenced);
+ }
bool IsLocationAdjust() const {
return detail::TestBit<u8>(mFlag, LOCATION_ADJUST);
}
+ void SetLocationAdjust(bool bAdjust) {
+ detail::SetBit(&mFlag, LOCATION_ADJUST, bAdjust);
+ }
bool IsUserAllocated() const {
return mbUserAllocated;
}
diff --git a/include/nw4r/lyt/lyt_textBox.h b/include/nw4r/lyt/lyt_textBox.h
index 4dfd0549..f4d5bff9 100644
--- a/include/nw4r/lyt/lyt_textBox.h
+++ b/include/nw4r/lyt/lyt_textBox.h
@@ -77,6 +77,10 @@ public:
mpTagProcessor = pTagProcessor;
}
+ const wchar_t *GetString() const {
+ return mTextBuf;
+ }
+
virtual ~TextBox();
NW4R_UT_RTTI_DECL(TextBox);
virtual void DrawSelf(const DrawInfo &drawInfo); // at 0x18
diff --git a/include/nw4r/lyt/lyt_types.h b/include/nw4r/lyt/lyt_types.h
index 047638e2..36bf2c71 100644
--- a/include/nw4r/lyt/lyt_types.h
+++ b/include/nw4r/lyt/lyt_types.h
@@ -31,8 +31,8 @@ inline bool TestBit(T bits, int index) {
}
template <typename T>
inline void SetBit(T *bits, int pos, bool val) {
- T mask = T(1 << pos);
- *bits = T((*bits & ~mask)) | (val << pos);
+ T mask = ~T(1 << pos);
+ *bits = T((*bits & mask)) | (val << pos);
}
template <typename T>
diff --git a/include/nw4r/ut/ut_Font.h b/include/nw4r/ut/ut_Font.h
index 4df7724e..37b37741 100644
--- a/include/nw4r/ut/ut_Font.h
+++ b/include/nw4r/ut/ut_Font.h
@@ -1,5 +1,6 @@
#ifndef NW4R_UT_FONT_H
#define NW4R_UT_FONT_H
+#include "common.h"
#include "nw4r/types_nw4r.h"
#include "nw4r/ut/ut_CharStrmReader.h"
#include "rvl/GX.h" // IWYU pragma: export
@@ -67,7 +68,11 @@ public:
void InitReaderFunc(FontEncoding encode);
- CharStrmReader GetCharStrmReader() const;
+ // ???
+ DECOMP_DONT_INLINE CharStrmReader GetCharStrmReader() const {
+ CharStrmReader reader(mReadFunc);
+ return reader;
+ }
private:
CharStrmReader::ReadFunc mReadFunc; // at 0x4
diff --git a/include/s/s_State.hpp b/include/s/s_State.hpp
index 3a8c4ec5..23dbc2f8 100644
--- a/include/s/s_State.hpp
+++ b/include/s/s_State.hpp
@@ -8,6 +8,10 @@
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
+// Handy search and replace regex to generate functions based on define macros
+// STATE_DEFINE\(([A-Za-z_0-9]+), ([A-Za-z_0-9]+)\);
+// void $1::initializeState_$2() {}\nvoid $1::executeState_$2() {}\nvoid $1::finalizeState_$2() {}\n
+
#define STATE_FUNC_DECLARE(class, name) \
void initializeState_##name(); \
void executeState_##name(); \
diff --git a/include/toBeSorted/d_d3d.h b/include/toBeSorted/d_d3d.h
index f02b4480..f088d007 100644
--- a/include/toBeSorted/d_d3d.h
+++ b/include/toBeSorted/d_d3d.h
@@ -10,6 +10,7 @@
#include "m/m3d/m_proc.h"
#include "m/m_color.h"
#include "m/m_mtx.h"
+#include "m/m_vec.h"
#include "nw4r/g3d/res/g3d_resfile.h"
#include "toBeSorted/tlist.h"
@@ -17,6 +18,9 @@
namespace d3d {
+f32 fn_80016960(mVec3_c&, const mVec3_c& pos);
+bool fn_80016A90(const mVec3_c& pos);
+
class AnmMdlWrapper : protected m3d::mdlAnmChr {
public:
AnmMdlWrapper();
diff --git a/include/toBeSorted/event_manager.h b/include/toBeSorted/event_manager.h
index c3117290..9c524aec 100644
--- a/include/toBeSorted/event_manager.h
+++ b/include/toBeSorted/event_manager.h
@@ -3,11 +3,11 @@
#define EVENT_MANAGER_H
#include "common.h"
+#include "d/a/obj/d_a_obj_base.h"
+#include "f/f_base.h"
#include "sized_string.h"
#include "toBeSorted/event.h"
-#include <cstring>
-
class dAcBase_c;
class EventManager {
@@ -16,6 +16,7 @@ public:
static bool finishEvent(dAcBase_c *actor, const char *eventName);
static void changeOwnEvent(dAcBase_c *actor1, dAcBase_c *actor2, Event *event, UNKWORD);
static bool alsoSetAsCurrentEvent(dAcBase_c *actor, Event *event, void *unknown);
+ static dAcObjBase_c *fn_800A08F0(fBase_c::GROUP_TYPE_e);
static EventManager *sInstance;
diff --git a/include/toBeSorted/global_fi_context.h b/include/toBeSorted/global_fi_context.h
new file mode 100644
index 00000000..585f416d
--- /dev/null
+++ b/include/toBeSorted/global_fi_context.h
@@ -0,0 +1,17 @@
+#ifndef GLOBAL_FI_CONTEXT_H
+#define GLOBAL_FI_CONTEXT_H
+
+#include "common.h"
+
+struct FiContext {
+ /* 0x00 */ u8 _0x00[0x4B - 0x00];
+ /* 0x4B */ bool mDoSpecialFiMenuHandling;
+
+ static s32 getGlobalFiInfo0(s32);
+};
+
+extern "C" FiContext *GLOBAL_FI_CONTEXT;
+extern "C" void fn_8016C9F0(FiContext *);
+extern "C" void createGlobalFiContext();
+
+#endif
diff --git a/include/toBeSorted/lyt_related_floats.h b/include/toBeSorted/lyt_related_floats.h
new file mode 100644
index 00000000..5b12e937
--- /dev/null
+++ b/include/toBeSorted/lyt_related_floats.h
@@ -0,0 +1,21 @@
+#ifndef LYT_RELATED_FLOATS_H
+#define LYT_RELATED_FLOATS_H
+
+#include "common.h"
+
+extern "C" f32 lbl_805751A4;
+inline f32 get_805751A4() {
+ return lbl_805751A4;
+}
+
+extern "C" s32 lbl_80575134;
+inline s32 get_80575134() {
+ return lbl_80575134;
+}
+
+extern "C" s32 lbl_8057511C;
+inline s32 get_8057511C() {
+ return lbl_8057511C;
+}
+
+#endif
diff --git a/include/toBeSorted/music_mgrs.h b/include/toBeSorted/music_mgrs.h
index 0702156c..7beeb58e 100644
--- a/include/toBeSorted/music_mgrs.h
+++ b/include/toBeSorted/music_mgrs.h
@@ -5,7 +5,10 @@
extern "C" void *BGM_MGR;
extern "C" void fn_8035E000();
+extern "C" void fn_8035E860(void *);
extern "C" void fn_8035E310(void *);
+extern "C" void fn_8035E820(void *);
+extern "C" void fn_8035E880(void *);
extern "C" void *ENEMY_SOUND_MGR;
extern "C" void fn_80362150(void *, u16);
diff --git a/include/toBeSorted/other_sound_stuff.h b/include/toBeSorted/other_sound_stuff.h
new file mode 100644
index 00000000..9de21cee
--- /dev/null
+++ b/include/toBeSorted/other_sound_stuff.h
@@ -0,0 +1,10 @@
+#ifndef OTHER_SOUND_STUFF_H
+#define OTHER_SOUND_STUFF_H
+
+#include "common.h"
+
+extern "C" void *lbl_80575DE0;
+extern "C" void fn_803996B0(void *, const char *msgLabelName, u16, s32);
+extern "C" void fn_803998A0(void *, u16, u16);
+
+#endif
diff --git a/include/toBeSorted/small_sound_mgr.h b/include/toBeSorted/small_sound_mgr.h
index 444f1572..9c56dab9 100644
--- a/include/toBeSorted/small_sound_mgr.h
+++ b/include/toBeSorted/small_sound_mgr.h
@@ -3,6 +3,7 @@
// Thanks kiwi! https://gist.github.com/kiwi515/47bb17b07ed502bdfa7faa60bc48a3c7
+#include "common.h"
enum WZSound {
/* 0x0000 */ SE_L_FLIPED,
/* 0x0001 */ SE_L_FS_START,
@@ -6471,6 +6472,7 @@ enum WZSound {
class SmallSoundManager {
public:
void playSound(WZSound id);
+ void playButtonPressSoundWhenAdvancingTextBoxes(f32);
static SmallSoundManager *GetInstance() {
return sInstance;