Sword somewhat ok, though not well understood

This commit is contained in:
robojumper
2025-04-04 21:14:40 +02:00
parent 4612c35f45
commit af4a1cfdb0
20 changed files with 858 additions and 144 deletions
+4
View File
@@ -125,6 +125,10 @@ public:
field_0x104 = str;
}
s16 getField_0x7AE() const {
return field_0x7AE;
}
bool getField_0x7B4() const {
return field_0x7B4;
}
+4
View File
@@ -270,6 +270,10 @@ struct AnmGroupBase_c {
syncAnmFrame();
}
inline f32 getRatio() const {
return mpFrameCtrl->getRatio();
}
inline void setBackwardsRatio(f32 ratio) {
mpFrameCtrl->setBackwardsRatio(ratio);
syncAnmFrame();
+1 -1
View File
@@ -22,7 +22,7 @@ public:
/* 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 *vt_0x30() override {
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
return mpTextboxes[0];
}
+1 -1
View File
@@ -22,7 +22,7 @@ public:
/* 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 *vt_0x30() override {
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
return mpTextboxes[0];
}
+3 -3
View File
@@ -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);
+10 -5
View File
@@ -10,8 +10,13 @@
#include "s/s_State.hpp"
#include "sized_string.h"
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;
@@ -69,13 +74,13 @@ private:
/* 0x724 */ dTagProcessor_c *mpTagProcessor;
/* 0x728 */ dLytMsgWindowSubtype *mpCurrentSubtype;
/* 0x72C */ dLytMsgWindowSubtype *mpWindowTalk;
/* 0x730 */ dLytMsgWindowSubtype *mpWindowLink;
/* 0x734 */ dLytMsgWindowSubtype *mpWindowSword;
/* 0x72C */ dLytMsgWindowTalk_c *mpWindowTalk;
/* 0x730 */ dLytMsgWindowLink_c *mpWindowLink;
/* 0x734 */ dLytMsgWindowSword_c *mpWindowSword;
/* 0x738 */ dLytMsgWindowWood_c *mpWindowWood;
/* 0x73C */ dLytMsgWindowStone_c *mpWindowStone;
/* 0x740 */ dLytMsgWindowSubtype *mpWindowGet;
/* 0x744 */ dLytMsgWindowSubtype *mpWindowDemo;
/* 0x740 */ dLytMsgWindowGet_c *mpWindowGet;
/* 0x744 */ dLytMsgWindowDemo_c *mpWindowDemo;
/* 0x748 */ dLytAutoExplain_c *mpAutoExplain;
/* 0x74C */ dLytAutoCaption_c *mpAutoCaption;
@@ -6,6 +6,8 @@
#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"
class dLytMsgWindowSubtype : public m2d::Base_c {
public:
@@ -19,19 +21,44 @@ public:
/* 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 *vt_0x30() {
/* vt 0x30 */ virtual dTextBox_c *getTextBox() {
return nullptr;
}
/* vt 0x34 */ virtual bool vt_0x34() {
/* vt 0x34 */ virtual bool startConfirm() {
return true;
}
/* vt 0x38 */ virtual bool vt_0x38(bool b) {
/* vt 0x38 */ virtual bool startDecide(bool b) {
return true;
}
/* vt 0x3C */ virtual bool vt_0x3C() const {
/* vt 0x3C */ virtual bool isDoneDecide() const {
return true;
}
/* vt 0x40 */ virtual bool vt_0x40() const;
};
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, const mVec3_c&, f32);
f32 fn_80120DB0() const;
private:
/* 0x04 */ d2d::LytBase_c mLyt;
/* 0x90 */ d2d::AnmGroup_c mAnm;
/* 0xD4 */ dTextBox_c *mpTexts[3];
/* 0xE0 */ nw4r::lyt::Pane *mpPane;
/* 0xE4 */ ESwordType mType;
};
#endif
@@ -0,0 +1,48 @@
#ifndef D_LYT_MSG_WINDOW_DEMO_H
#define D_LYT_MSG_WINDOW_DEMO_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_types.h"
#include "s/s_State.hpp"
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 nullptr;
}
/* vt 0x34 */ virtual bool startConfirm() override {
return true;
}
/* vt 0x38 */ virtual bool startDecide(bool b) override {
return true;
}
/* vt 0x3C */ virtual bool isDoneDecide() const override {
return true;
}
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:
/* 0x010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowDemo_c);
};
#endif
@@ -0,0 +1,46 @@
#ifndef D_LYT_MSG_WINDOW_GET_H
#define D_LYT_MSG_WINDOW_GET_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 "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 nullptr;
}
/* vt 0x34 */ virtual bool startConfirm() override {
return true;
}
/* vt 0x38 */ virtual bool startDecide(bool b) override {
return true;
}
/* vt 0x3C */ virtual bool isDoneDecide() const override {
return true;
}
STATE_FUNC_DECLARE(dLytMsgWindowGet_c, Invisible);
STATE_FUNC_DECLARE(dLytMsgWindowGet_c, In);
STATE_FUNC_DECLARE(dLytMsgWindowGet_c, Visible);
STATE_FUNC_DECLARE(dLytMsgWindowGet_c, Out);
private:
/* 0x010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowGet_c);
};
#endif
@@ -0,0 +1,46 @@
#ifndef D_LYT_MSG_WINDOW_LINK_H
#define D_LYT_MSG_WINDOW_LINK_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 "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 nullptr;
}
/* vt 0x34 */ virtual bool startConfirm() override {
return true;
}
/* vt 0x38 */ virtual bool startDecide(bool b) override {
return true;
}
/* vt 0x3C */ virtual bool isDoneDecide() const override {
return true;
}
STATE_FUNC_DECLARE(dLytMsgWindowLink_c, Invisible);
STATE_FUNC_DECLARE(dLytMsgWindowLink_c, In);
STATE_FUNC_DECLARE(dLytMsgWindowLink_c, Visible);
STATE_FUNC_DECLARE(dLytMsgWindowLink_c, Out);
private:
/* 0x010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowLink_c);
};
#endif
@@ -23,16 +23,16 @@ public:
/* 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 *vt_0x30() override {
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
return mpTextboxes[0];
}
/* vt 0x34 */ virtual bool vt_0x34() override {
/* vt 0x34 */ virtual bool startConfirm() override {
return mBtn.requestIn();
}
/* vt 0x38 */ virtual bool vt_0x38(bool b) override {
/* vt 0x38 */ virtual bool startDecide(bool b) override {
return mBtn.requestOut(b);
}
/* vt 0x3C */ virtual bool vt_0x3C() const override {
/* vt 0x3C */ virtual bool isDoneDecide() const override {
return mBtn.isDoneOut();
}
@@ -0,0 +1,92 @@
#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/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"
struct dLytMsgWindowSwordLetterDataMaybe {
/* 0x00 */ f32 posX;
/* 0x04 */ f32 posY;
/* 0x08 */ f32 field_0x08;
/* 0x0C */ s16 field_0x0C;
/* 0x0E */ wchar_t character;
/* 0x10 */ s8 displayTimerMaybe;
};
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;
}
private:
/* 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 */ f32 field_0x05E4;
/* 0x05E8 */ f32 field_0x05E8;
/* 0x05EC */ dAcObjBase_c *mpActor;
/* 0x05F0 */ s32 mParam;
/* 0x05F4 */ s32 field_0x5F4;
/* 0x05F8 */ dLytCommonABtn_c mBtn;
/* 0x07A8 */ dLytMsgWindowSwordLetterDataMaybe mCharacterData[1023];
/* 0x5794 */ wchar_t mTextBuf[1023];
/* 0x5F94 */ dLytTextSword mSwordText;
/* 0x607C */ dLytTextSword::ESwordType mSwordType;
/* 0x6080 */ bool mShouldBeOpen;
/* 0x6081 */ bool mHasDrawnThisTick;
};
#endif
@@ -0,0 +1,46 @@
#ifndef D_LYT_MSG_WINDOW_TALK_H
#define D_LYT_MSG_WINDOW_TALK_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 "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 nullptr;
}
/* vt 0x34 */ virtual bool startConfirm() override {
return true;
}
/* vt 0x38 */ virtual bool startDecide(bool b) override {
return true;
}
/* vt 0x3C */ virtual bool isDoneDecide() const override {
return true;
}
STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, Invisible);
STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, In);
STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, Visible);
STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, Out);
private:
/* 0x010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowTalk_c);
};
#endif
@@ -24,16 +24,16 @@ public:
/* 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 *vt_0x30() override {
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
return mpTextboxes[0];
}
/* vt 0x34 */ virtual bool vt_0x34() override {
/* vt 0x34 */ virtual bool startConfirm() override {
return mBtn.requestIn();
}
/* vt 0x38 */ virtual bool vt_0x38(bool b) override {
/* vt 0x38 */ virtual bool startDecide(bool b) override {
return mBtn.requestOut(b);
}
/* vt 0x3C */ virtual bool vt_0x3C() const override {
/* vt 0x3C */ virtual bool isDoneDecide() const override {
return mBtn.isDoneOut();
}
+5
View File
@@ -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));