From 5e2343afb79863394f5f1487d70cd3492305963e Mon Sep 17 00:00:00 2001 From: robojumper Date: Wed, 2 Apr 2025 00:57:49 +0200 Subject: [PATCH] d_lyt_msg_window_stone OK --- config/SOUE01/splits.txt | 5 + config/SOUE01/symbols.txt | 114 +++++----- configure.py | 2 +- .../d/lyt/msg_window/d_lyt_msg_window_stone.h | 56 +++++ src/d/lyt/d_lyt_common_a_btn.cpp | 36 ++-- .../lyt/msg_window/d_lyt_msg_window_stone.cpp | 195 ++++++++++++++++++ 6 files changed, 332 insertions(+), 76 deletions(-) create mode 100644 include/d/lyt/msg_window/d_lyt_msg_window_stone.h create mode 100644 src/d/lyt/msg_window/d_lyt_msg_window_stone.cpp diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index c9b1a5b8..5af1cf27 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -470,6 +470,11 @@ d/lyt/msg_window/d_lyt_msg_window_wood.cpp: d/lyt/msg_window/d_lyt_msg_window_stone.cpp: .text start:0x80126800 end:0x80127478 .ctors start:0x804DB754 end:0x804DB758 + .rodata start:0x804E75D8 end:0x804E75F0 + .data start:0x8051DB08 end:0x8051DD90 + .sdata start:0x805725F8 end:0x80572608 + .sdata2 start:0x80579EC8 end:0x80579ED0 + .bss start:0x805AEEF0 end:0x805AEFF0 d/lyt/msg_window/d_lyt_msg_window_demo.cpp: .text start:0x80127480 end:0x801281F8 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index df9063e6..9592a204 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -6878,7 +6878,7 @@ LytMsgWindowTalk__dtor = .text:0x801198D0; // type:function size:0x198 fn_80119A70 = .text:0x80119A70; // type:function size:0x198 LytMsgWindowSword__dtor = .text:0x80119C10; // type:function size:0x198 __dt__19dLytMsgWindowWood_cFv = .text:0x80119DB0; // type:function size:0x170 -fn_80119F20 = .text:0x80119F20; // type:function size:0x170 +__dt__20dLytMsgWindowStone_cFv = .text:0x80119F20; // type:function size:0x170 fn_8011A090 = .text:0x8011A090; // type:function size:0x198 fn_8011A230 = .text:0x8011A230; // type:function size:0x158 fn_8011A390 = .text:0x8011A390; // type:function size:0x118 @@ -7025,9 +7025,9 @@ fn_8011B5F0 = .text:0x8011B5F0; // type:function size:0x30 finalizeState__34sFStateID_c<19dLytMsgWindowWood_c>CFR19dLytMsgWindowWood_c = .text:0x8011B620; // type:function size:0x30 executeState__34sFStateID_c<19dLytMsgWindowWood_c>CFR19dLytMsgWindowWood_c = .text:0x8011B650; // type:function size:0x30 initializeState__34sFStateID_c<19dLytMsgWindowWood_c>CFR19dLytMsgWindowWood_c = .text:0x8011B680; // type:function size:0x30 -fn_8011B6B0 = .text:0x8011B6B0; // type:function size:0x30 -fn_8011B6E0 = .text:0x8011B6E0; // type:function size:0x30 -fn_8011B710 = .text:0x8011B710; // type:function size:0x30 +finalizeState__35sFStateID_c<20dLytMsgWindowStone_c>CFR20dLytMsgWindowStone_c = .text:0x8011B6B0; // type:function size:0x30 +executeState__35sFStateID_c<20dLytMsgWindowStone_c>CFR20dLytMsgWindowStone_c = .text:0x8011B6E0; // type:function size:0x30 +initializeState__35sFStateID_c<20dLytMsgWindowStone_c>CFR20dLytMsgWindowStone_c = .text:0x8011B710; // type:function size:0x30 fn_8011B740 = .text:0x8011B740; // type:function size:0x30 fn_8011B770 = .text:0x8011B770; // type:function size:0x30 fn_8011B7A0 = .text:0x8011B7A0; // type:function size:0x30 @@ -7269,46 +7269,46 @@ executeState_Out__19dLytMsgWindowWood_cFv = .text:0x801260E0; // type:function s finalizeState_Out__19dLytMsgWindowWood_cFv = .text:0x80126160; // type:function size:0x4 execute__19dLytMsgWindowWood_cFv = .text:0x80126170; // type:function size:0xBC draw__19dLytMsgWindowWood_cFv = .text:0x80126230; // type:function size:0x14 -vt_0x1C__19dLytMsgWindowWood_cFv = .text:0x80126250; // type:function size:0xC -vt_0x20__19dLytMsgWindowWood_cCFv = .text:0x80126260; // type:function size:0x4C -vt_0x24__19dLytMsgWindowWood_cFv = .text:0x801262B0; // type:function size:0xC -vt_0x28__19dLytMsgWindowWood_cCFv = .text:0x801262C0; // type:function size:0x4C +open__19dLytMsgWindowWood_cFv = .text:0x80126250; // type:function size:0xC +isOpening__19dLytMsgWindowWood_cCFv = .text:0x80126260; // type:function size:0x4C +close__19dLytMsgWindowWood_cFv = .text:0x801262B0; // type:function size:0xC +isClosing__19dLytMsgWindowWood_cCFv = .text:0x801262C0; // type:function size:0x4C setText__19dLytMsgWindowWood_cFPCw = .text:0x80126310; // type:function size:0x7C vt_0x3C__19dLytMsgWindowWood_cCFv = .text:0x80126390; // type:function size:0x8 -vt_0x38__19dLytMsgWindowWood_cFv = .text:0x801263A0; // type:function size:0x8 +vt_0x38__19dLytMsgWindowWood_cFb = .text:0x801263A0; // type:function size:0x8 vt_0x34__19dLytMsgWindowWood_cFv = .text:0x801263B0; // type:function size:0x8 vt_0x30__19dLytMsgWindowWood_cFv = .text:0x801263C0; // type:function size:0x8 __sinit_\d_lyt_msg_window_wood_cpp = .text:0x801263D0; // type:function size:0x338 scope:local __dt__34sFStateID_c<19dLytMsgWindowWood_c>Fv = .text:0x80126710; // type:function size:0x58 isSameName__34sFStateID_c<19dLytMsgWindowWood_c>CFPCc = .text:0x80126770; // type:function size:0x88 -fn_80126800 = .text:0x80126800; // type:function size:0x284 -fn_80126A90 = .text:0x80126A90; // type:function size:0xD8 -fn_80126B70 = .text:0x80126B70; // type:function size:0x8 -fn_80126B80 = .text:0x80126B80; // type:function size:0x28 -fn_80126BB0 = .text:0x80126BB0; // type:function size:0x4 -fn_80126BC0 = .text:0x80126BC0; // type:function size:0x48 -fn_80126C10 = .text:0x80126C10; // type:function size:0x78 -fn_80126C90 = .text:0x80126C90; // type:function size:0x4 -fn_80126CA0 = .text:0x80126CA0; // type:function size:0x4 -fn_80126CB0 = .text:0x80126CB0; // type:function size:0x28 -fn_80126CE0 = .text:0x80126CE0; // type:function size:0x4 -fn_80126CF0 = .text:0x80126CF0; // type:function size:0x48 -fn_80126D40 = .text:0x80126D40; // type:function size:0x78 -fn_80126DC0 = .text:0x80126DC0; // type:function size:0x4 -fn_80126DD0 = .text:0x80126DD0; // type:function size:0xBC -fn_80126E90 = .text:0x80126E90; // type:function size:0x14 -fn_80126EB0 = .text:0x80126EB0; // type:function size:0xC -fn_80126EC0 = .text:0x80126EC0; // type:function size:0x4C -fn_80126F10 = .text:0x80126F10; // type:function size:0xC -fn_80126F20 = .text:0x80126F20; // type:function size:0x4C -fn_80126F70 = .text:0x80126F70; // type:function size:0xA0 -fn_80127010 = .text:0x80127010; // type:function size:0x8 -fn_80127020 = .text:0x80127020; // type:function size:0x8 -fn_80127030 = .text:0x80127030; // type:function size:0x8 -fn_80127040 = .text:0x80127040; // type:function size:0x8 -LytMsgWindowStone__initStates = .text:0x80127050; // type:function size:0x338 -LytMsgWindowStone__dtor = .text:0x80127390; // type:function size:0x58 -fn_801273F0 = .text:0x801273F0; // type:function size:0x88 +build__20dLytMsgWindowStone_cFPvPQ23d2d10ResAccIf_cP15dTagProcessor_c = .text:0x80126800; // type:function size:0x284 +remove__20dLytMsgWindowStone_cFv = .text:0x80126A90; // type:function size:0xD8 +initializeState_Invisible__20dLytMsgWindowStone_cFv = .text:0x80126B70; // type:function size:0x8 +executeState_Invisible__20dLytMsgWindowStone_cFv = .text:0x80126B80; // type:function size:0x28 +finalizeState_Invisible__20dLytMsgWindowStone_cFv = .text:0x80126BB0; // type:function size:0x4 +initializeState_In__20dLytMsgWindowStone_cFv = .text:0x80126BC0; // type:function size:0x48 +executeState_In__20dLytMsgWindowStone_cFv = .text:0x80126C10; // type:function size:0x78 +finalizeState_In__20dLytMsgWindowStone_cFv = .text:0x80126C90; // type:function size:0x4 +initializeState_Visible__20dLytMsgWindowStone_cFv = .text:0x80126CA0; // type:function size:0x4 +executeState_Visible__20dLytMsgWindowStone_cFv = .text:0x80126CB0; // type:function size:0x28 +finalizeState_Visible__20dLytMsgWindowStone_cFv = .text:0x80126CE0; // type:function size:0x4 +initializeState_Out__20dLytMsgWindowStone_cFv = .text:0x80126CF0; // type:function size:0x48 +executeState_Out__20dLytMsgWindowStone_cFv = .text:0x80126D40; // type:function size:0x78 +finalizeState_Out__20dLytMsgWindowStone_cFv = .text:0x80126DC0; // type:function size:0x4 +execute__20dLytMsgWindowStone_cFv = .text:0x80126DD0; // type:function size:0xBC +draw__20dLytMsgWindowStone_cFv = .text:0x80126E90; // type:function size:0x14 +open__20dLytMsgWindowStone_cFv = .text:0x80126EB0; // type:function size:0xC +isOpening__20dLytMsgWindowStone_cCFv = .text:0x80126EC0; // type:function size:0x4C +close__20dLytMsgWindowStone_cFv = .text:0x80126F10; // type:function size:0xC +isClosing__20dLytMsgWindowStone_cCFv = .text:0x80126F20; // type:function size:0x4C +setText__20dLytMsgWindowStone_cFPCw = .text:0x80126F70; // type:function size:0xA0 +vt_0x3C__20dLytMsgWindowStone_cCFv = .text:0x80127010; // type:function size:0x8 +vt_0x38__20dLytMsgWindowStone_cFb = .text:0x80127020; // type:function size:0x8 +vt_0x34__20dLytMsgWindowStone_cFv = .text:0x80127030; // type:function size:0x8 +vt_0x30__20dLytMsgWindowStone_cFv = .text:0x80127040; // type:function size:0x8 +__sinit_\d_lyt_msg_window_stone_cpp = .text:0x80127050; // type:function size:0x338 scope:local +__dt__35sFStateID_c<20dLytMsgWindowStone_c>Fv = .text:0x80127390; // type:function size:0x58 +isSameName__35sFStateID_c<20dLytMsgWindowStone_c>CFPCc = .text:0x801273F0; // type:function size:0x88 fn_80127480 = .text:0x80127480; // type:function size:0x1BC fn_80127640 = .text:0x80127640; // type:function size:0x6C fn_801276B0 = .text:0x801276B0; // type:function size:0x160 @@ -32246,22 +32246,22 @@ lbl_8051D934 = .data:0x8051D934; // type:object size:0xE data:string lbl_8051D944 = .data:0x8051D944; // type:object size:0x9 data:string lbl_8051D950 = .data:0x8051D950; // type:object size:0x16 data:string __vt__19dLytMsgWindowWood_c = .data:0x8051D968; // type:object size:0x44 -lbl_8051DAD4 = .data:0x8051DAD4; // type:object size:0x34 -lbl_8051DB08 = .data:0x8051DB08; // type:object size:0x1C -lbl_8051DB24 = .data:0x8051DB24; // type:object size:0xC +__vt__34sFStateID_c<19dLytMsgWindowWood_c> = .data:0x8051DAD4; // type:object size:0x34 +lbl_8051DB08 = .data:0x8051DB08; // type:object size:0x1A data:string +lbl_8051DB24 = .data:0x8051DB24; // type:object size:0xB data:string lbl_8051DB30 = .data:0x8051DB30; // type:object size:0x1C data:string -lbl_8051DB4C = .data:0x8051DB4C; // type:object size:0xC -lbl_8051DB58 = .data:0x8051DB58; // type:object size:0x1C -lbl_8051DB74 = .data:0x8051DB74; // type:object size:0xC -lbl_8051DB80 = .data:0x8051DB80; // type:object size:0xC -lbl_8051DB8C = .data:0x8051DB8C; // type:object size:0x10 -lbl_8051DB9C = .data:0x8051DB9C; // type:object size:0x10 -lbl_8051DBAC = .data:0x8051DBAC; // type:object size:0x10 +lbl_8051DB4C = .data:0x8051DB4C; // type:object size:0xA data:string +lbl_8051DB58 = .data:0x8051DB58; // type:object size:0x1B data:string +lbl_8051DB74 = .data:0x8051DB74; // type:object size:0xA data:string +lbl_8051DB80 = .data:0x8051DB80; // type:object size:0xB data:string +lbl_8051DB8C = .data:0x8051DB8C; // type:object size:0xD data:string +lbl_8051DB9C = .data:0x8051DB9C; // type:object size:0xE data:string +lbl_8051DBAC = .data:0x8051DBAC; // type:object size:0xE data:string lbl_8051DBBC = .data:0x8051DBBC; // type:object size:0xC data:4byte -lbl_8051DBC8 = .data:0x8051DBC8; // type:object size:0xC -lbl_8051DBD4 = .data:0x8051DBD4; // type:object size:0x18 -lbl_8051DBEC = .data:0x8051DBEC; // type:object size:0x16C -lbl_8051DD58 = .data:0x8051DD58; // type:object size:0x38 +lbl_8051DBC8 = .data:0x8051DBC8; // type:object size:0x9 data:string +lbl_8051DBD4 = .data:0x8051DBD4; // type:object size:0x17 data:string +__vt__20dLytMsgWindowStone_c = .data:0x8051DBEC; // type:object size:0x44 +__vt__35sFStateID_c<20dLytMsgWindowStone_c> = .data:0x8051DD58; // type:object size:0x34 lbl_8051DD90 = .data:0x8051DD90; // type:object size:0x18 lbl_8051DDA8 = .data:0x8051DDA8; // type:object size:0xC lbl_8051DDB4 = .data:0x8051DDB4; // type:object size:0x18 @@ -38210,7 +38210,7 @@ lbl_805725E0 = .sdata:0x805725E0; // type:object size:0x8 data:4byte lbl_805725E8 = .sdata:0x805725E8; // type:object size:0x8 data:4byte lbl_805725F0 = .sdata:0x805725F0; // type:object size:0x4 data:4byte lbl_805725F8 = .sdata:0x805725F8; // type:object size:0x8 data:4byte -lbl_80572600 = .sdata:0x80572600; // type:object size:0x8 data:4byte +lbl_80572600 = .sdata:0x80572600; // type:object size:0x4 data:4byte lbl_80572608 = .sdata:0x80572608; // type:object size:0x8 data:4byte lbl_80572610 = .sdata:0x80572610; // type:object size:0x8 lbl_80572618 = .sdata:0x80572618; // type:object size:0x8 data:4byte @@ -48863,11 +48863,11 @@ StateID_Invisible__19dLytMsgWindowWood_c = .bss:0x805AEE00; // type:object size: StateID_In__19dLytMsgWindowWood_c = .bss:0x805AEE40; // type:object size:0x30 data:4byte StateID_Visible__19dLytMsgWindowWood_c = .bss:0x805AEE80; // type:object size:0x30 data:4byte StateID_Out__19dLytMsgWindowWood_c = .bss:0x805AEEC0; // type:object size:0x30 data:4byte -lbl_805AEEF0 = .bss:0x805AEEF0; // type:object size:0x10 -LytMsgWindowStone__STATE_INVISIBLE = .bss:0x805AEF00; // type:object size:0x40 data:4byte -LytMsgWindowStone__STATE_IN = .bss:0x805AEF40; // type:object size:0x40 data:4byte -LytMsgWindowStone__STATE_VISIBLE = .bss:0x805AEF80; // type:object size:0x40 data:4byte -LytMsgWindowStone__STATE_OUT = .bss:0x805AEFC0; // type:object size:0x30 data:4byte +lbl_805AEEF0 = .bss:0x805AEEF0; // type:object size:0xC +StateID_Invisible__19dLytMsgWindowWood_c = .bss:0x805AEF00; // type:object size:0x30 data:4byte +StateID_In__19dLytMsgWindowWood_c = .bss:0x805AEF40; // type:object size:0x30 data:4byte +StateID_Visible__19dLytMsgWindowWood_c = .bss:0x805AEF80; // type:object size:0x30 data:4byte +StateID_Out__19dLytMsgWindowWood_c = .bss:0x805AEFC0; // type:object size:0x30 data:4byte lbl_805AEFF0 = .bss:0x805AEFF0; // type:object size:0x10 LytMsgWindowDemo__STATE_INVISIBLE = .bss:0x805AF000; // type:object size:0x40 data:4byte LytMsgWindowDemo__STATE_IN = .bss:0x805AF040; // type:object size:0x40 data:4byte diff --git a/configure.py b/configure.py index c5fbf426..716a2b79 100644 --- a/configure.py +++ b/configure.py @@ -414,7 +414,7 @@ config.libs = [ Object(NonMatching, "d/lyt/msg_window/d_lyt_msg_window_get.cpp"), Object(NonMatching, "d/lyt/msg_window/d_lyt_msg_window_sword.cpp"), Object(Matching, "d/lyt/msg_window/d_lyt_msg_window_wood.cpp"), - Object(NonMatching, "d/lyt/msg_window/d_lyt_msg_window_stone.cpp"), + Object(Matching, "d/lyt/msg_window/d_lyt_msg_window_stone.cpp"), Object(NonMatching, "d/lyt/msg_window/d_lyt_msg_window_demo.cpp"), Object(NonMatching, "d/lyt/d_lyt_simple_window.cpp"), Object(NonMatching, "d/lyt/d_lyt_auto_caption.cpp"), 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..e7b16086 --- /dev/null +++ b/include/d/lyt/msg_window/d_lyt_msg_window_stone.h @@ -0,0 +1,56 @@ +#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: + /* vt 0x08 */ virtual ~dLytMsgWindowStone_c() {} + /* vt 0x0C */ virtual void draw() override; + /* vt 0x10 */ virtual bool build(void *unk, 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() override; + /* vt 0x20 */ virtual bool isOpening() const override; + /* vt 0x24 */ virtual void close() override; + /* vt 0x28 */ virtual bool isClosing() const override; + /* vt 0x2C */ virtual bool setText(const wchar_t *text) override; + /* vt 0x30 */ virtual dTextBox_c *vt_0x30() override { + return mpTextboxes[0]; + } + /* vt 0x34 */ virtual void vt_0x34() override { + mCommon.requestIn(); + } + /* vt 0x38 */ virtual void vt_0x38(bool b) override { + mCommon.requestOut(b); + } + /* vt 0x3C */ virtual u8 vt_0x3C() const override { + return mCommon.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: + /* 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 mCommon; + /* 0x6EC */ bool mShouldBeOpen; +}; + +#endif diff --git a/src/d/lyt/d_lyt_common_a_btn.cpp b/src/d/lyt/d_lyt_common_a_btn.cpp index 056e6397..f484e1e5 100644 --- a/src/d/lyt/d_lyt_common_a_btn.cpp +++ b/src/d/lyt/d_lyt_common_a_btn.cpp @@ -14,12 +14,12 @@ static const d2d::LytBrlanMapping brlanMap[] = { { "aBtn_00_out.brlan", "G_inOut_00"}, }; -#define MSG_ABTN_ANIM_IN 0 -#define MSG_ABTN_ANIM_LOOP 1 -#define MSG_ABTN_ANIM_DECIDE 2 -#define MSG_ABTN_ANIM_OUT 3 +#define A_BTN_ANIM_IN 0 +#define A_BTN_ANIM_LOOP 1 +#define A_BTN_ANIM_DECIDE 2 +#define A_BTN_ANIM_OUT 3 -#define MSG_ABTN_NUM_ANIMS 4 +#define A_BTN_NUM_ANIMS 4 const dLytCommonABtn_c::executeFunc dLytCommonABtn_c::sExecuteFuncs[4] = { &dLytCommonABtn_c::executeStateInvisible, @@ -32,7 +32,7 @@ bool dLytCommonABtn_c::build(d2d::ResAccIf_c *resAcc) { mLyt.setResAcc(resAcc); mLyt.build("aBtn_00.brlyt", nullptr); - for (int i = 0; i < MSG_ABTN_NUM_ANIMS; i++) { + for (int i = 0; i < A_BTN_NUM_ANIMS; i++) { mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName); } @@ -42,7 +42,7 @@ bool dLytCommonABtn_c::build(d2d::ResAccIf_c *resAcc) { } bool dLytCommonABtn_c::remove() { - for (int i = 0; i < MSG_ABTN_NUM_ANIMS; i++) { + for (int i = 0; i < A_BTN_NUM_ANIMS; i++) { mAnm[i].remove(); } return true; @@ -93,7 +93,7 @@ void dLytCommonABtn_c::gotoStateInvisible() { setState(STATE_INVISIBLE); mLyt.unbindAnims(); - d2d::AnmGroup_c &inAnim = mAnm[MSG_ABTN_ANIM_IN]; + d2d::AnmGroup_c &inAnim = mAnm[A_BTN_ANIM_IN]; field_0x1A8 = 0; mInRequested = false; mOutRequested = false; @@ -130,7 +130,7 @@ void dLytCommonABtn_c::gotoStateIn() { } void dLytCommonABtn_c::executeStateIn() { - d2d::AnmGroup_c &anm = mAnm[MSG_ABTN_ANIM_IN]; + d2d::AnmGroup_c &anm = mAnm[A_BTN_ANIM_IN]; if (anm.isEndReached() == true) { goToStateVisible(); } else { @@ -140,8 +140,8 @@ void dLytCommonABtn_c::executeStateIn() { void dLytCommonABtn_c::goToStateVisible() { setState(STATE_VISIBLE); - mAnm[MSG_ABTN_ANIM_IN].unbind(); - d2d::AnmGroup_c &anm = mAnm[MSG_ABTN_ANIM_LOOP]; + mAnm[A_BTN_ANIM_IN].unbind(); + d2d::AnmGroup_c &anm = mAnm[A_BTN_ANIM_LOOP]; anm.bind(false); anm.setFrame(0.0f); if (dSys::getFrameRate() == 1) { @@ -156,17 +156,17 @@ void dLytCommonABtn_c::executeStateVisible() { goToStateDecideOut(); mOutRequested = false; } else { - d2d::AnmGroup_c &anm = mAnm[MSG_ABTN_ANIM_LOOP]; + d2d::AnmGroup_c &anm = mAnm[A_BTN_ANIM_LOOP]; anm.play(); } } void dLytCommonABtn_c::goToStateDecideOut() { setState(STATE_OUT); - mAnm[MSG_ABTN_ANIM_LOOP].unbind(); + mAnm[A_BTN_ANIM_LOOP].unbind(); if (mNoDecide == true) { mNoDecide = false; - d2d::AnmGroup_c &anm = mAnm[MSG_ABTN_ANIM_OUT]; + d2d::AnmGroup_c &anm = mAnm[A_BTN_ANIM_OUT]; anm.bind(false); anm.setFrame(0.0f); if (dSys::getFrameRate() == 1) { @@ -176,7 +176,7 @@ void dLytCommonABtn_c::goToStateDecideOut() { } mOutState = OUT_STATE_OUT; } else { - d2d::AnmGroup_c &anm = mAnm[MSG_ABTN_ANIM_DECIDE]; + d2d::AnmGroup_c &anm = mAnm[A_BTN_ANIM_DECIDE]; anm.bind(false); anm.setAnimEnable(true); anm.setFrame(0.0f); @@ -194,7 +194,7 @@ void dLytCommonABtn_c::goToStateDecideOut() { } void dLytCommonABtn_c::executeStateDecideOut() { - d2d::AnmGroup_c &decideAnm = mAnm[MSG_ABTN_ANIM_DECIDE]; + d2d::AnmGroup_c &decideAnm = mAnm[A_BTN_ANIM_DECIDE]; switch (mOutState) { case OUT_STATE_DECIDING: { if (decideAnm.isEndReached() == true) { @@ -210,7 +210,7 @@ void dLytCommonABtn_c::executeStateDecideOut() { } case OUT_STATE_GOTO_OUT: { decideAnm.unbind(); - d2d::AnmGroup_c &anmOut = mAnm[MSG_ABTN_ANIM_OUT]; + d2d::AnmGroup_c &anmOut = mAnm[A_BTN_ANIM_OUT]; anmOut.bind(false); anmOut.setAnimEnable(true); anmOut.setFrame(0.0f); @@ -223,7 +223,7 @@ void dLytCommonABtn_c::executeStateDecideOut() { break; } case OUT_STATE_OUT: { - d2d::AnmGroup_c &anmOut = mAnm[MSG_ABTN_ANIM_OUT]; + d2d::AnmGroup_c &anmOut = mAnm[A_BTN_ANIM_OUT]; if (anmOut.isEndReached() == true) { mOutState = OUT_STATE_GOTO_INVISIBLE; mIsDoneOut = true; diff --git a/src/d/lyt/msg_window/d_lyt_msg_window_stone.cpp b/src/d/lyt/msg_window/d_lyt_msg_window_stone.cpp new file mode 100644 index 00000000..b21936ff --- /dev/null +++ b/src/d/lyt/msg_window/d_lyt_msg_window_stone.cpp @@ -0,0 +1,195 @@ +#include "d/lyt/msg_window/d_lyt_msg_window_stone.h" + +#include "common.h" +#include "d/d_tag_processor.h" +#include "d/lyt/d2d.h" +#include "d/lyt/d_textbox.h" +#include "nw4r/lyt/lyt_group.h" +#include "nw4r/lyt/lyt_pane.h" +#include "s/s_State.hpp" + +STATE_DEFINE(dLytMsgWindowStone_c, Invisible); +STATE_DEFINE(dLytMsgWindowStone_c, In); +STATE_DEFINE(dLytMsgWindowStone_c, Visible); +STATE_DEFINE(dLytMsgWindowStone_c, Out); + +static const d2d::LytBrlanMapping brlanMap[] = { + { "sekibanWindow_00_in.brlan", "G_inOut_00"}, + {"sekibanWindow_00_loop.brlan", "G_loop_00"}, + { "sekibanWindow_00_out.brlan", "G_inOut_00"}, +}; + +#define SEKIBAN_ANIM_IN 0 +#define SEKIBAN_ANIM_LOOP 1 +#define SEKIBAN_ANIM_OUT 2 + +#define SEKIBAN_NUM_ANIMS 3 + +static const char *sPanes[] = { + "N_aBtn_00", + "N_inOut_00", +}; + +static const char *sTextBoxes[] = { + "T_message_00", + "T_messageS_00", + "T_messageS_01", +}; + +static const char *sGroupName = "G_ref_00"; + +bool dLytMsgWindowStone_c::build(void *unk, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) { + mLyt.setResAcc(resAcc); + mLyt.build("sekibanWindow_00.brlyt", nullptr); + mLyt.setPriority(0x8A); + + for (int i = 0; i < SEKIBAN_NUM_ANIMS; i++) { + mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName); + mAnm[i].bind(false); + mAnm[i].setAnimEnable(false); + } + + mAnm[SEKIBAN_ANIM_LOOP].setAnimEnable(true); + mAnm[SEKIBAN_ANIM_OUT].setAnimEnable(true); + mAnm[SEKIBAN_ANIM_OUT].setToEnd(); + mLyt.calc(); + mAnm[SEKIBAN_ANIM_OUT].setAnimEnable(false); + + for (int i = 0; i < 2; i++) { + mpPanes[i] = mLyt.findPane(sPanes[i]); + } + + for (int i = 0; i < 3; i++) { + mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]); + mpTextboxes[i]->SetTextPositionH(0); + mpTextboxes[i]->SetTextPositionV(0); + } + + mpTextboxes[1]->set0x1F6(1); + mpTextboxes[2]->set0x1F6(1); + + for (int i = 0; i < 1; i++) { + mNodes[i].mpLytPane = &mCommon; + mCommon.build(resAcc); + mSubpaneList.PushBack(&mNodes[i]); + } + + if (mLyt.getLayout()->GetGroupContainer() != nullptr) { + nw4r::lyt::Group *g = mLyt.getLayout()->GetGroupContainer()->FindGroupByName(sGroupName); + if (g != nullptr) { + d2d::dSubPane::linkMeters(g, &mSubpaneList); + } + } + + mpPanes[1]->SetVisible(true); + mLyt.calc(); + mpPanes[1]->SetVisible(false); + mpTagProcessor = tagProcessor; + mStateMgr.changeState(StateID_Invisible); + return true; +} + +bool dLytMsgWindowStone_c::remove() { + for (d2d::SubPaneList::Iterator it = mSubpaneList.GetBeginIter(); it != mSubpaneList.GetEndIter(); ++it) { + d2d::dSubPane *subPane = it->mpLytPane; + if (subPane != nullptr) { + nw4r::lyt::Pane *parent = subPane->getPane()->GetParent(); + parent->RemoveChild(subPane->getPane()); + } + } + + for (int i = 0; i < 1; i++) { + mNodes[i].mpLytPane->remove(); + } + mCommon.remove(); + for (int i = 0; i < SEKIBAN_NUM_ANIMS; i++) { + mAnm[i].remove(); + } + return true; +} + +void dLytMsgWindowStone_c::initializeState_Invisible() { + mCommon.resetToInvisble(); +} +void dLytMsgWindowStone_c::executeState_Invisible() { + if (mShouldBeOpen) { + mStateMgr.changeState(StateID_In); + } +} +void dLytMsgWindowStone_c::finalizeState_Invisible() {} + +void dLytMsgWindowStone_c::initializeState_In() { + mAnm[SEKIBAN_ANIM_IN].setAnimEnable(true); + mAnm[SEKIBAN_ANIM_IN].setFrame(0.0f); +} +void dLytMsgWindowStone_c::executeState_In() { + if (mAnm[SEKIBAN_ANIM_IN].isEndReached()) { + mAnm[SEKIBAN_ANIM_IN].setAnimEnable(false); + mStateMgr.changeState(StateID_Visible); + } +} +void dLytMsgWindowStone_c::finalizeState_In() {} + +void dLytMsgWindowStone_c::initializeState_Visible() {} +void dLytMsgWindowStone_c::executeState_Visible() { + if (!mShouldBeOpen) { + mStateMgr.changeState(StateID_Out); + } +} +void dLytMsgWindowStone_c::finalizeState_Visible() {} + +void dLytMsgWindowStone_c::initializeState_Out() { + mAnm[SEKIBAN_ANIM_OUT].setAnimEnable(true); + mAnm[SEKIBAN_ANIM_OUT].setFrame(0.0f); +} +void dLytMsgWindowStone_c::executeState_Out() { + if (mAnm[SEKIBAN_ANIM_OUT].isEndReached()) { + mAnm[SEKIBAN_ANIM_OUT].setAnimEnable(false); + mStateMgr.changeState(StateID_Invisible); + } +} +void dLytMsgWindowStone_c::finalizeState_Out() {} + +bool dLytMsgWindowStone_c::execute() { + mStateMgr.executeState(); + for (int i = 0; i < SEKIBAN_NUM_ANIMS; i++) { + if (mAnm[i].isEnabled()) { + mAnm[i].play(); + } + } + mLyt.calc(); + for (int i = 0; i < 1; i++) { + mNodes[i].mpLytPane->execute(); + } + return true; +} + +void dLytMsgWindowStone_c::draw() { + mLyt.draw(); +} + +void dLytMsgWindowStone_c::open() { + mShouldBeOpen = true; +} + +bool dLytMsgWindowStone_c::isOpening() const { + return !(*mStateMgr.getStateID() == StateID_In); +} + +void dLytMsgWindowStone_c::close() { + mShouldBeOpen = false; +} + +bool dLytMsgWindowStone_c::isClosing() const { + return !(*mStateMgr.getStateID() == StateID_Out); +} + +bool dLytMsgWindowStone_c::setText(const wchar_t *text) { + mpTextboxes[0]->SetTagProcessor(mpTagProcessor); + mpTextboxes[1]->SetTagProcessor(mpTagProcessor); + mpTextboxes[2]->SetTagProcessor(mpTagProcessor); + mpTextboxes[0]->fn_800AF540(text, mpTagProcessor, 0); + mpTextboxes[1]->fn_800AF540(text, mpTagProcessor, 0); + mpTextboxes[2]->fn_800AF540(text, mpTagProcessor, 0); + return true; +}