From f2bcb0da52cd6c3e0ed18315c155d57ec71d805f Mon Sep 17 00:00:00 2001 From: robojumper Date: Sat, 5 Apr 2025 00:11:00 +0200 Subject: [PATCH] More demo --- config/SOUE01/symbols.txt | 156 +++++++-------- include/d/d_textwindow_unk.h | 36 +++- include/d/lyt/msg_window/d_lyt_msg_window.h | 13 +- .../lyt/msg_window/d_lyt_msg_window_common.h | 26 ++- .../d/lyt/msg_window/d_lyt_msg_window_demo.h | 33 ++-- .../d/lyt/msg_window/d_lyt_msg_window_sword.h | 16 +- include/m/m2d.h | 2 +- include/toBeSorted/lyt_vec2f.h | 14 ++ src/d/lyt/msg_window/d_lyt_msg_window.cpp | 11 +- .../lyt/msg_window/d_lyt_msg_window_demo.cpp | 184 ++++++++++++++++++ 10 files changed, 380 insertions(+), 111 deletions(-) create mode 100644 include/toBeSorted/lyt_vec2f.h create mode 100644 src/d/lyt/msg_window/d_lyt_msg_window_demo.cpp diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 6a0a648b..bc9f48a8 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -688,7 +688,7 @@ GetTexSize = .text:0x8001D820; // type:function size:0x8 fn_8001D830 = .text:0x8001D830; // type:function size:0x8 fn_8001D840 = .text:0x8001D840; // type:function size:0x38 fn_8001D880 = .text:0x8001D880; // type:function size:0x8C -fn_8001D910 = .text:0x8001D910; // type:function size:0x40 +__dt__8LytVec2fFv = .text:0x8001D910; // type:function size:0x40 fn_8001D950 = .text:0x8001D950; // type:function size:0x22C fn_8001DB80 = .text:0x8001DB80; // type:function size:0x74 fn_8001DC00 = .text:0x8001DC00; // type:function size:0x764 @@ -2902,7 +2902,7 @@ lzSafeDecompress = .text:0x80066FB0; // type:function size:0x64 matrixCreateFromPosRotYScale__FR6mMtx_cRC7mVec3_c4mAngRC7mVec3_cP6mMtx_cf = .text:0x80067020; // type:function size:0x138 checkIfVec3fInMatrix__FRC6mMtx_cRC7mVec3_c = .text:0x80067160; // type:function size:0x88 fn_800671F0 = .text:0x800671F0; // type:function size:0x84 -fn_80067280 = .text:0x80067280; // type:function size:0x4 +__ct__8LytVec2fFv = .text:0x80067280; // type:function size:0x4 fn_80067290 = .text:0x80067290; // type:function size:0xA8 fn_80067340 = .text:0x80067340; // type:function size:0xC0 fn_80067400 = .text:0x80067400; // type:function size:0x80 @@ -3896,8 +3896,8 @@ checkEndReached__13TextWindowUnkCFv = .text:0x800B2B70; // type:function size:0x checkLastLineReachedMaybe__13TextWindowUnkCFv = .text:0x800B2B90; // type:function size:0xD8 fn_800B2C70 = .text:0x800B2C70; // type:function size:0x340 fn_800B2FB0 = .text:0x800B2FB0; // type:function size:0x324 -fn_800B32E0 = .text:0x800B32E0; // type:function size:0x84 -drawTextBlur = .text:0x800B3370; // type:function size:0x138 +build__20MsgWindowBlurRelatedFv = .text:0x800B32E0; // type:function size:0x84 +drawTextBlur__20MsgWindowBlurRelatedFP13dLytTextLightQ34nw4r4math4VEC2Uc = .text:0x800B3370; // type:function size:0x138 fn_800B34B0 = .text:0x800B34B0; // type:function size:0x40 fn_800B34F0 = .text:0x800B34F0; // type:function size:0xD0 __ct__15dTagProcessor_cFv = .text:0x800B35C0; // type:function size:0x260 @@ -6856,18 +6856,18 @@ fn_801185E0 = .text:0x801185E0; // type:function size:0x58 fn_80118640 = .text:0x80118640; // type:function size:0x6C fn_801186B0 = .text:0x801186B0; // type:function size:0xA0 fn_80118750 = .text:0x80118750; // type:function size:0xA4 -fn_80118800 = .text:0x80118800; // type:function size:0x70 -fn_80118870 = .text:0x80118870; // type:function size:0x40 +__dt__13dLytTextLightFv = .text:0x80118800; // type:function size:0x70 +__dt__20MsgWindowBlurRelatedFv = .text:0x80118870; // type:function size:0x40 __ct__18dLytMsgWindowGet_cFv = .text:0x801188B0; // type:function size:0x1FC fn_80118AB0 = .text:0x80118AB0; // type:function size:0x58 fn_80118B10 = .text:0x80118B10; // type:function size:0x6C fn_80118B80 = .text:0x80118B80; // type:function size:0xA0 fn_80118C20 = .text:0x80118C20; // type:function size:0xA4 __ct__19dLytMsgWindowDemo_cFv = .text:0x80118CD0; // type:function size:0x1B0 -fn_80118E80 = .text:0x80118E80; // type:function size:0x58 -fn_80118EE0 = .text:0x80118EE0; // type:function size:0x6C -fn_80118F50 = .text:0x80118F50; // type:function size:0xA0 -fn_80118FF0 = .text:0x80118FF0; // type:function size:0xA4 +__dt__32sFState_c<19dLytMsgWindowDemo_c>Fv = .text:0x80118E80; // type:function size:0x58 +__dt__35sFStateFct_c<19dLytMsgWindowDemo_c>Fv = .text:0x80118EE0; // type:function size:0x6C +__dt__88sStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x80118F50; // type:function size:0xA0 +__dt__58sFStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c>Fv = .text:0x80118FF0; // type:function size:0xA4 __ct__19dLytMsgWindowTalk_cFv = .text:0x801190A0; // type:function size:0x1FC fn_801192A0 = .text:0x801192A0; // type:function size:0x58 fn_80119300 = .text:0x80119300; // type:function size:0x6C @@ -6886,7 +6886,7 @@ __dt__17dLytAutoCaption_cFv = .text:0x8011A4B0; // type:function size:0x118 fn_8011A5D0__15dLytMsgWindow_cCFv = .text:0x8011A5D0; // type:function size:0x1AC changeState__86sStateMgr_c<17dLytAutoCaption_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x8011A780; // type:function size:0x10 changeState__86sStateMgr_c<17dLytAutoExplain_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x8011A790; // type:function size:0x10 -fn_8011A7A0 = .text:0x8011A7A0; // type:function size:0x10 +changeState__88sStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x8011A7A0; // type:function size:0x10 fn_8011A7B0 = .text:0x8011A7B0; // type:function size:0x10 changeState__89sStateMgr_c<20dLytMsgWindowStone_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x8011A7C0; // type:function size:0x10 changeState__88sStateMgr_c<19dLytMsgWindowWood_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x8011A7D0; // type:function size:0x10 @@ -6897,8 +6897,8 @@ build__33sFStateFct_c<17dLytAutoCaption_c>FRC12sStateIDIf_c = .text:0x8011A810; dispose__33sFStateFct_c<17dLytAutoCaption_c>FRP10sStateIf_c = .text:0x8011A870; // type:function size:0xC build__33sFStateFct_c<17dLytAutoExplain_c>FRC12sStateIDIf_c = .text:0x8011A880; // type:function size:0x60 dispose__33sFStateFct_c<17dLytAutoExplain_c>FRP10sStateIf_c = .text:0x8011A8E0; // type:function size:0xC -fn_8011A8F0 = .text:0x8011A8F0; // type:function size:0x60 -fn_8011A950 = .text:0x8011A950; // type:function size:0xC +build__35sFStateFct_c<19dLytMsgWindowDemo_c>FRC12sStateIDIf_c = .text:0x8011A8F0; // type:function size:0x60 +dispose__35sFStateFct_c<19dLytMsgWindowDemo_c>FRP10sStateIf_c = .text:0x8011A950; // type:function size:0xC fn_8011A960 = .text:0x8011A960; // type:function size:0x60 fn_8011A9C0 = .text:0x8011A9C0; // type:function size:0xC build__36sFStateFct_c<20dLytMsgWindowStone_c>FRC12sStateIDIf_c = .text:0x8011A9D0; // type:function size:0x60 @@ -6917,9 +6917,9 @@ finalize__30sFState_c<17dLytAutoCaption_c>Fv = .text:0x8011AC40; // type:functio initialize__30sFState_c<17dLytAutoExplain_c>Fv = .text:0x8011AC60; // type:function size:0x1C execute__30sFState_c<17dLytAutoExplain_c>Fv = .text:0x8011AC80; // type:function size:0x1C finalize__30sFState_c<17dLytAutoExplain_c>Fv = .text:0x8011ACA0; // type:function size:0x1C -fn_8011ACC0 = .text:0x8011ACC0; // type:function size:0x1C -fn_8011ACE0 = .text:0x8011ACE0; // type:function size:0x1C -fn_8011AD00 = .text:0x8011AD00; // type:function size:0x1C +initialize__32sFState_c<19dLytMsgWindowDemo_c>Fv = .text:0x8011ACC0; // type:function size:0x1C +execute__32sFState_c<19dLytMsgWindowDemo_c>Fv = .text:0x8011ACE0; // type:function size:0x1C +finalize__32sFState_c<19dLytMsgWindowDemo_c>Fv = .text:0x8011AD00; // type:function size:0x1C fn_8011AD20 = .text:0x8011AD20; // type:function size:0x1C fn_8011AD40 = .text:0x8011AD40; // type:function size:0x1C fn_8011AD60 = .text:0x8011AD60; // type:function size:0x1C @@ -6954,14 +6954,14 @@ getState__86sStateMgr_c<17dLytAutoExplain_c,20sStateMethodUsr_FI_c,12sFStateFct_ getNewStateID__86sStateMgr_c<17dLytAutoExplain_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x8011B030; // type:function size:0x10 getStateID__86sStateMgr_c<17dLytAutoExplain_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x8011B040; // type:function size:0x10 getOldStateID__86sStateMgr_c<17dLytAutoExplain_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x8011B050; // type:function size:0x10 -fn_8011B060 = .text:0x8011B060; // type:function size:0x10 -fn_8011B070 = .text:0x8011B070; // type:function size:0x10 -fn_8011B080 = .text:0x8011B080; // type:function size:0x10 -fn_8011B090 = .text:0x8011B090; // type:function size:0x10 -fn_8011B0A0 = .text:0x8011B0A0; // type:function size:0x10 -fn_8011B0B0 = .text:0x8011B0B0; // type:function size:0x10 -fn_8011B0C0 = .text:0x8011B0C0; // type:function size:0x10 -fn_8011B0D0 = .text:0x8011B0D0; // type:function size:0x10 +initializeState__88sStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x8011B060; // type:function size:0x10 +executeState__88sStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x8011B070; // type:function size:0x10 +finalizeState__88sStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x8011B080; // type:function size:0x10 +refreshState__88sStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x8011B090; // type:function size:0x10 +getState__88sStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x8011B0A0; // type:function size:0x10 +getNewStateID__88sStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x8011B0B0; // type:function size:0x10 +getStateID__88sStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x8011B0C0; // type:function size:0x10 +getOldStateID__88sStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x8011B0D0; // type:function size:0x10 fn_8011B0E0 = .text:0x8011B0E0; // type:function size:0x10 fn_8011B0F0 = .text:0x8011B0F0; // type:function size:0x10 fn_8011B100 = .text:0x8011B100; // type:function size:0x10 @@ -7031,16 +7031,16 @@ initializeState__35sFStateID_c<20dLytMsgWindowStone_c>CFR20dLytMsgWindowStone_c fn_8011B740 = .text:0x8011B740; // type:function size:0x30 fn_8011B770 = .text:0x8011B770; // type:function size:0x30 fn_8011B7A0 = .text:0x8011B7A0; // type:function size:0x30 -fn_8011B7D0 = .text:0x8011B7D0; // type:function size:0x30 -fn_8011B800 = .text:0x8011B800; // type:function size:0x30 -fn_8011B830 = .text:0x8011B830; // type:function size:0x30 +finalizeState__34sFStateID_c<19dLytMsgWindowDemo_c>CFR19dLytMsgWindowDemo_c = .text:0x8011B7D0; // type:function size:0x30 +executeState__34sFStateID_c<19dLytMsgWindowDemo_c>CFR19dLytMsgWindowDemo_c = .text:0x8011B800; // type:function size:0x30 +initializeState__34sFStateID_c<19dLytMsgWindowDemo_c>CFR19dLytMsgWindowDemo_c = .text:0x8011B830; // type:function size:0x30 finalizeState__32sFStateID_c<17dLytAutoExplain_c>CFR17dLytAutoExplain_c = .text:0x8011B860; // type:function size:0x30 executeState__32sFStateID_c<17dLytAutoExplain_c>CFR17dLytAutoExplain_c = .text:0x8011B890; // type:function size:0x30 initializeState__32sFStateID_c<17dLytAutoExplain_c>CFR17dLytAutoExplain_c = .text:0x8011B8C0; // type:function size:0x30 finalizeState__32sFStateID_c<17dLytAutoCaption_c>CFR17dLytAutoCaption_c = .text:0x8011B8F0; // type:function size:0x30 executeState__32sFStateID_c<17dLytAutoCaption_c>CFR17dLytAutoCaption_c = .text:0x8011B920; // type:function size:0x30 initializeState__32sFStateID_c<17dLytAutoCaption_c>CFR17dLytAutoCaption_c = .text:0x8011B950; // type:function size:0x30 -__sinit_\d_lyt_msg_window_cpp = .text:0x8011B980; // type:function size:0xE58 +__sinit_\d_lyt_msg_window_cpp = .text:0x8011B980; // type:function size:0xE58 scope:local __dt__30sFStateID_c<15dLytMsgWindow_c>Fv = .text:0x8011C7E0; // type:function size:0x58 isSameName__30sFStateID_c<15dLytMsgWindow_c>CFPCc = .text:0x8011C840; // type:function size:0x88 __ct__15SelectBtnHelperFv = .text:0x8011C8D0; // type:function size:0x60 @@ -7127,8 +7127,8 @@ build__13dLytTextSwordFPQ23d2d10ResAccIf_cQ213dLytTextSword10ESwordType = .text: remove__13dLytTextSwordFv = .text:0x80120C30; // type:function size:0x28 draw__13dLytTextSwordFPCwScRC7mVec3_cf = .text:0x80120C60; // type:function size:0x14C fn_80120DB0__13dLytTextSwordCFv = .text:0x80120DB0; // type:function size:0xC -fn_80120DC0 = .text:0x80120DC0; // type:function size:0x104 -fn_80120ED0 = .text:0x80120ED0; // type:function size:0x28 +build__13dLytTextLightFPQ23d2d10ResAccIf_cQ213dLytTextLight9ETextType = .text:0x80120DC0; // type:function size:0x104 +remove__13dLytTextLightFv = .text:0x80120ED0; // type:function size:0x28 fn_80120F00 = .text:0x80120F00; // type:function size:0x14C fn_80121050 = .text:0x80121050; // type:function size:0xC vt_0x40__20dLytMsgWindowSubtypeCFv = .text:0x80121060; // type:function size:0x8 @@ -7309,32 +7309,32 @@ getTextBox__20dLytMsgWindowStone_cFv = .text:0x80127040; // type:function size:0 __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 -fn_80127810 = .text:0x80127810; // type:function size:0x8 -fn_80127820 = .text:0x80127820; // type:function size:0x28 -fn_80127850 = .text:0x80127850; // type:function size:0x4 -fn_80127860 = .text:0x80127860; // type:function size:0x60 -fn_801278C0 = .text:0x801278C0; // type:function size:0x60 -fn_80127920 = .text:0x80127920; // type:function size:0x4 -fn_80127930 = .text:0x80127930; // type:function size:0x4 -fn_80127940 = .text:0x80127940; // type:function size:0x28 -fn_80127970 = .text:0x80127970; // type:function size:0x4 -fn_80127980 = .text:0x80127980; // type:function size:0x60 -fn_801279E0 = .text:0x801279E0; // type:function size:0x60 -fn_80127A40 = .text:0x80127A40; // type:function size:0x4 -fn_80127A50 = .text:0x80127A50; // type:function size:0xA8 -fn_80127B00 = .text:0x80127B00; // type:function size:0x100 -fn_80127C00 = .text:0x80127C00; // type:function size:0x88 -fn_80127C90 = .text:0x80127C90; // type:function size:0xC -fn_80127CA0 = .text:0x80127CA0; // type:function size:0x4C -fn_80127CF0 = .text:0x80127CF0; // type:function size:0xC -fn_80127D00 = .text:0x80127D00; // type:function size:0x4C -fn_80127D50 = .text:0x80127D50; // type:function size:0x7C -LytMsgWindowDemo__initStates = .text:0x80127DD0; // type:function size:0x338 -LytMsgWindowDemo__dtor = .text:0x80128110; // type:function size:0x58 -fn_80128170 = .text:0x80128170; // type:function size:0x88 +build__19dLytMsgWindowDemo_cFPQ23d2d10ResAccIf_cPQ23d2d10ResAccIf_cP15dTagProcessor_c = .text:0x80127480; // type:function size:0x1BC +remove__19dLytMsgWindowDemo_cFv = .text:0x80127640; // type:function size:0x6C +initializeState_Invisible__19dLytMsgWindowDemo_cFv = .text:0x801276B0; // type:function size:0x160 +getTextBox__19dLytMsgWindowDemo_cFv = .text:0x80127810; // type:function size:0x8 +executeState_Invisible__19dLytMsgWindowDemo_cFv = .text:0x80127820; // type:function size:0x28 +finalizeState_Invisible__19dLytMsgWindowDemo_cFv = .text:0x80127850; // type:function size:0x4 +initializeState_In__19dLytMsgWindowDemo_cFv = .text:0x80127860; // type:function size:0x60 +executeState_In__19dLytMsgWindowDemo_cFv = .text:0x801278C0; // type:function size:0x60 +finalizeState_In__19dLytMsgWindowDemo_cFv = .text:0x80127920; // type:function size:0x4 +initializeState_Visible__19dLytMsgWindowDemo_cFv = .text:0x80127930; // type:function size:0x4 +executeState_Visible__19dLytMsgWindowDemo_cFv = .text:0x80127940; // type:function size:0x28 +finalizeState_Visible__19dLytMsgWindowDemo_cFv = .text:0x80127970; // type:function size:0x4 +initializeState_Out__19dLytMsgWindowDemo_cFv = .text:0x80127980; // type:function size:0x60 +executeState_Out__19dLytMsgWindowDemo_cFv = .text:0x801279E0; // type:function size:0x60 +finalizeState_Out__19dLytMsgWindowDemo_cFv = .text:0x80127A40; // type:function size:0x4 +execute__19dLytMsgWindowDemo_cFv = .text:0x80127A50; // type:function size:0xA8 +draw__19dLytMsgWindowDemo_cFv = .text:0x80127B00; // type:function size:0x100 +getTextLabel__19dLytMsgWindowDemo_cFv = .text:0x80127C00; // type:function size:0x88 +open__19dLytMsgWindowDemo_cFP12dAcObjBase_cUl = .text:0x80127C90; // type:function size:0xC +isDoneOpening__19dLytMsgWindowDemo_cCFv = .text:0x80127CA0; // type:function size:0x4C +close__19dLytMsgWindowDemo_cFv = .text:0x80127CF0; // type:function size:0xC +isDoneClosing__19dLytMsgWindowDemo_cCFv = .text:0x80127D00; // type:function size:0x4C +setText__19dLytMsgWindowDemo_cFPCw = .text:0x80127D50; // type:function size:0x7C +__sinit_\d_lyt_msg_window_demo_cpp = .text:0x80127DD0; // type:function size:0x338 +__dt__34sFStateID_c<19dLytMsgWindowDemo_c>Fv = .text:0x80128110; // type:function size:0x58 +isSameName__34sFStateID_c<19dLytMsgWindowDemo_c>CFPCc = .text:0x80128170; // type:function size:0x88 fn_80128200 = .text:0x80128200; // type:function size:0x8 fn_80128210 = .text:0x80128210; // type:function size:0x4 fn_80128220 = .text:0x80128220; // type:function size:0x8 @@ -32057,45 +32057,45 @@ lbl_8051B6E8 = .data:0x8051B6E8; // type:object size:0xC lbl_8051B6F4 = .data:0x8051B6F4; // type:object size:0xC lbl_8051B700 = .data:0x8051B700; // type:object size:0xC data:string jumptable_8051B70C = .data:0x8051B70C; // type:object size:0x7C scope:local -__vt__22MsgWindowUnkLocalClass = .data:0x8051B788; // type:object size:0x10 +__vt__22MsgWindowUnkLocalClass = .data:0x8051B788; // type:object size:0xC __vt__56sFStateMgr_c<17dLytAutoCaption_c,20sStateMethodUsr_FI_c> = .data:0x8051B798; // type:object size:0x30 __vt__86sStateMgr_c<17dLytAutoCaption_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x8051B7C8; // type:object size:0x30 -__vt__33sFStateFct_c<17dLytAutoCaption_c> = .data:0x8051B7F8; // type:object size:0x18 +__vt__33sFStateFct_c<17dLytAutoCaption_c> = .data:0x8051B7F8; // type:object size:0x14 __vt__30sFState_c<17dLytAutoCaption_c> = .data:0x8051B810; // type:object size:0x18 __vt__56sFStateMgr_c<17dLytAutoExplain_c,20sStateMethodUsr_FI_c> = .data:0x8051B828; // type:object size:0x30 __vt__86sStateMgr_c<17dLytAutoExplain_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x8051B858; // type:object size:0x30 -__vt__33sFStateFct_c<17dLytAutoExplain_c> = .data:0x8051B888; // type:object size:0x18 +__vt__33sFStateFct_c<17dLytAutoExplain_c> = .data:0x8051B888; // type:object size:0x14 __vt__30sFState_c<17dLytAutoExplain_c> = .data:0x8051B8A0; // type:object size:0x18 -lbl_8051B8B8 = .data:0x8051B8B8; // type:object size:0x30 -lbl_8051B8E8 = .data:0x8051B8E8; // type:object size:0x30 -lbl_8051B918 = .data:0x8051B918; // type:object size:0x18 -lbl_8051B930 = .data:0x8051B930; // type:object size:0x18 +__vt__58sFStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c> = .data:0x8051B8B8; // type:object size:0x30 +__vt__88sStateMgr_c<19dLytMsgWindowDemo_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x8051B8E8; // type:object size:0x30 +__vt__35sFStateFct_c<19dLytMsgWindowDemo_c> = .data:0x8051B918; // type:object size:0x14 +__vt__32sFState_c<19dLytMsgWindowDemo_c> = .data:0x8051B930; // type:object size:0x18 lbl_8051B948 = .data:0x8051B948; // type:object size:0x30 lbl_8051B978 = .data:0x8051B978; // type:object size:0x30 -lbl_8051B9A8 = .data:0x8051B9A8; // type:object size:0x18 +lbl_8051B9A8 = .data:0x8051B9A8; // type:object size:0x14 lbl_8051B9C0 = .data:0x8051B9C0; // type:object size:0x18 __vt__59sFStateMgr_c<20dLytMsgWindowStone_c,20sStateMethodUsr_FI_c> = .data:0x8051B9D8; // type:object size:0x30 __vt__89sStateMgr_c<20dLytMsgWindowStone_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x8051BA08; // type:object size:0x30 -__vt__36sFStateFct_c<20dLytMsgWindowStone_c> = .data:0x8051BA38; // type:object size:0x18 +__vt__36sFStateFct_c<20dLytMsgWindowStone_c> = .data:0x8051BA38; // type:object size:0x14 __vt__33sFState_c<20dLytMsgWindowStone_c> = .data:0x8051BA50; // type:object size:0x18 __vt__58sFStateMgr_c<19dLytMsgWindowWood_c,20sStateMethodUsr_FI_c> = .data:0x8051BA68; // type:object size:0x30 __vt__88sStateMgr_c<19dLytMsgWindowWood_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x8051BA98; // type:object size:0x30 -__vt__35sFStateFct_c<19dLytMsgWindowWood_c> = .data:0x8051BAC8; // type:object size:0x18 +__vt__35sFStateFct_c<19dLytMsgWindowWood_c> = .data:0x8051BAC8; // type:object size:0x14 __vt__32sFState_c<19dLytMsgWindowWood_c> = .data:0x8051BAE0; // type:object size:0x18 __vt__59sFStateMgr_c<20dLytMsgWindowSword_c,20sStateMethodUsr_FI_c> = .data:0x8051BAF8; // type:object size:0x30 __vt__89sStateMgr_c<20dLytMsgWindowSword_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x8051BB28; // type:object size:0x30 -__vt__36sFStateFct_c<20dLytMsgWindowSword_c> = .data:0x8051BB58; // type:object size:0x18 +__vt__36sFStateFct_c<20dLytMsgWindowSword_c> = .data:0x8051BB58; // type:object size:0x14 __vt__33sFState_c<20dLytMsgWindowSword_c> = .data:0x8051BB70; // type:object size:0x18 lbl_8051BB88 = .data:0x8051BB88; // type:object size:0x30 lbl_8051BBB8 = .data:0x8051BBB8; // type:object size:0x30 -lbl_8051BBE8 = .data:0x8051BBE8; // type:object size:0x18 +lbl_8051BBE8 = .data:0x8051BBE8; // type:object size:0x14 lbl_8051BC00 = .data:0x8051BC00; // type:object size:0x18 lbl_8051BC18 = .data:0x8051BC18; // type:object size:0x30 lbl_8051BC48 = .data:0x8051BC48; // type:object size:0x30 -lbl_8051BC78 = .data:0x8051BC78; // type:object size:0x18 +lbl_8051BC78 = .data:0x8051BC78; // type:object size:0x14 lbl_8051BC90 = .data:0x8051BC90; // type:object size:0x18 -lbl_8051BCA8 = .data:0x8051BCA8; // type:object size:0xC -lbl_8051BCB4 = .data:0x8051BCB4; // type:object size:0xC +__vt__20MsgWindowBlurRelated = .data:0x8051BCA8; // type:object size:0xC +__vt__13dLytTextLight = .data:0x8051BCB4; // type:object size:0xC __vt__13dLytTextSword = .data:0x8051BCC0; // type:object size:0xC __vt__30sFStateID_c<15dLytMsgWindow_c> = .data:0x8051C2CC; // type:object size:0x34 lbl_8051C300 = .data:0x8051C300; // type:object size:0xC @@ -32267,8 +32267,8 @@ lbl_8051DDA8 = .data:0x8051DDA8; // type:object size:0xC lbl_8051DDB4 = .data:0x8051DDB4; // type:object size:0x18 lbl_8051DDCC = .data:0x8051DDCC; // type:object size:0x10 lbl_8051DDDC = .data:0x8051DDDC; // type:object size:0x8C -lbl_8051DE68 = .data:0x8051DE68; // type:object size:0x16C -lbl_8051DFD4 = .data:0x8051DFD4; // type:object size:0x34 +__vt__19dLytMsgWindowDemo_c = .data:0x8051DE68; // type:object size:0x44 +__vt__34sFStateID_c<19dLytMsgWindowDemo_c> = .data:0x8051DFD4; // type:object size:0x34 lbl_8051E008 = .data:0x8051E008; // type:object size:0x1C lbl_8051E024 = .data:0x8051E024; // type:object size:0xC lbl_8051E030 = .data:0x8051E030; // type:object size:0x20 @@ -40104,7 +40104,7 @@ sInstance__14dLytDobutton_c = .sbss:0x80575468; // type:object size:0x8 data:4by lbl_80575470 = .sbss:0x80575470; // type:object size:0x8 lbl_80575478 = .sbss:0x80575478; // type:object size:0x8 data:4byte sInstance__20LytBirdButtonRelated = .sbss:0x80575480; // type:object size:0x8 data:4byte -LYT_MSG_WINDOW = .sbss:0x80575488; // type:object size:0x4 data:4byte +sInstance__15dLytMsgWindow_c = .sbss:0x80575488; // type:object size:0x4 data:4byte lbl_8057548C = .sbss:0x8057548C; // type:object size:0x4 data:4byte CURRENT_ACTOR_EVENT_FLOW_MANAGER = .sbss:0x80575490; // type:object size:0x8 data:4byte LYT_SIMPLE_WINDOW = .sbss:0x80575498; // type:object size:0x8 data:4byte @@ -48864,10 +48864,10 @@ StateID_In__19dLytMsgWindowWood_c = .bss:0x805AEE40; // type:object size:0x30 da 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: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 +StateID_Invisible__20dLytMsgWindowStone_c = .bss:0x805AEF00; // type:object size:0x30 data:4byte +StateID_In__20dLytMsgWindowStone_c = .bss:0x805AEF40; // type:object size:0x30 data:4byte +StateID_Visible__20dLytMsgWindowStone_c = .bss:0x805AEF80; // type:object size:0x30 data:4byte +StateID_Out__20dLytMsgWindowStone_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/include/d/d_textwindow_unk.h b/include/d/d_textwindow_unk.h index 1ab9c6f4..0eb68014 100644 --- a/include/d/d_textwindow_unk.h +++ b/include/d/d_textwindow_unk.h @@ -3,14 +3,18 @@ #include "d/d_tag_processor.h" #include "d/lyt/d_textbox.h" +#include "d/lyt/msg_window/d_lyt_msg_window_common.h" +#include "toBeSorted/lyt_vec2f.h" // Size 0x1554 +// Probably responsible for emitting characters +// one by one in the text boxes class TextWindowUnk { public: TextWindowUnk(dTagProcessor_c *tagProcessor); virtual ~TextWindowUnk() {} - void fn_800B2130(const char *, dTextBox_c *, void*, bool); + void fn_800B2130(const char *, dTextBox_c *, void *, bool); void fn_800B2AA0(); void textAdvancingRelated(bool, bool); @@ -28,7 +32,7 @@ public: bool checkEndReached() const; bool checkLastLineReachedMaybe() const; - + private: /* 0x0004 */ dTagProcessor_c *mpTagProcessor; /* 0x0008 */ wchar_t mRawTextBuffer[1023]; @@ -37,7 +41,33 @@ private: /* 0x147A */ u16 field_0x147A; /* 0x147C */ u16 field_0x147C; /* 0x147E */ u8 _0x147E[0x1550 - 0x147E]; - /* 0x1550 */ void* field_0x1550; + /* 0x1550 */ void *field_0x1550; +}; + +struct dLytMsgWindowCharData { + /* 0x00 */ f32 posX; + /* 0x04 */ f32 posY; + /* 0x08 */ f32 field_0x08; + /* 0x0C */ s16 field_0x0C; + /* 0x0E */ wchar_t character; + /* 0x10 */ s8 displayTimerMaybe; +}; + +class MsgWindowBlurRelated { +public: + MsgWindowBlurRelated() {} + virtual ~MsgWindowBlurRelated() {} + + void build(); + void remove(); + void drawTextBlur(dLytTextLight *thing, LytVec2f size, u8 alpha); + + dLytMsgWindowCharData *getCharData() { + return mData; + } + +private: + dLytMsgWindowCharData mData[1023]; }; #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 index 2ee9b484..b3130433 100644 --- a/include/d/lyt/msg_window/d_lyt_msg_window.h +++ b/include/d/lyt/msg_window/d_lyt_msg_window.h @@ -20,6 +20,8 @@ class dLytMsgWindowDemo_c; class dLytAutoExplain_c; class dLytAutoCaption_c; +struct dLytMsgWindowCharData; + class dLytMsgWindow_c { public: dLytMsgWindow_c() : mStateMgr(*this) {} @@ -37,13 +39,20 @@ public: void setCurrentEntrypointName(const char *name); void setCurrentFlowFilename(const char *name); + static dLytMsgWindow_c *getInstance() { + return sInstance; + } + + SizedString<64> getLabel() const { + return mNameCopy; + } + 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); @@ -121,7 +130,7 @@ private: /* 0x820 */ u16 field_0x820; /* 0x824 */ s32 field_0x824; - /* 0x828 */ void *field_0x828; + /* 0x828 */ dLytMsgWindowCharData *field_0x828; /* 0x82C */ u32 mTextOptionSelection; /* 0x830 */ u32 mSpecialFiMenuValue; 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 index d3ea5db9..7c04d57b 100644 --- a/include/d/lyt/msg_window/d_lyt_msg_window_common.h +++ b/include/d/lyt/msg_window/d_lyt_msg_window_common.h @@ -50,7 +50,7 @@ public: bool build(d2d::ResAccIf_c *pResAcc, ESwordType type); bool remove(); - void draw(const wchar_t *str, s8, const mVec3_c&, f32); + void draw(const wchar_t *str, s8, const mVec3_c &, f32); f32 fn_80120DB0() const; private: @@ -61,4 +61,28 @@ private: /* 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(const wchar_t *str, s8, const mVec3_c &, f32); + f32 fn_80120DB0() 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 index 2c3beb6d..952912f4 100644 --- a/include/d/lyt/msg_window/d_lyt_msg_window_demo.h +++ b/include/d/lyt/msg_window/d_lyt_msg_window_demo.h @@ -2,12 +2,14 @@ #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_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 "nw4r/lyt/lyt_pane.h" #include "s/s_State.hpp" +#include "sized_string.h" +#include "toBeSorted/lyt_vec2f.h" class dLytMsgWindowDemo_c : public dLytMsgWindowSubtype { public: @@ -24,16 +26,11 @@ public: /* 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; + return mpTextboxes[0]; } - /* 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; + + dLytMsgWindowCharData *getCharData() { + return mBlurRelated.getCharData(); } STATE_FUNC_DECLARE(dLytMsgWindowDemo_c, Invisible); @@ -42,7 +39,21 @@ public: STATE_FUNC_DECLARE(dLytMsgWindowDemo_c, Out); private: + static SizedString<64> getTextLabel(); + /* 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 */ LytVec2f mOffsets[2]; + /* 0x4EC */ dLytTextLight mText; + /* 0x5C8 */ MsgWindowBlurRelated mBlurRelated; + + /* 0x55B8 */ 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 index 81518c9c..772dd631 100644 --- a/include/d/lyt/msg_window/d_lyt_msg_window_sword.h +++ b/include/d/lyt/msg_window/d_lyt_msg_window_sword.h @@ -3,6 +3,7 @@ #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" @@ -10,15 +11,6 @@ #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) {} @@ -56,6 +48,10 @@ public: mSwordType = type; } + dLytMsgWindowCharData *getCharData() { + return mCharacterData; + } + private: /* 0x0010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowSword_c); /* 0x004C */ d2d::SubPaneList mSubpaneList; @@ -80,7 +76,7 @@ private: /* 0x05F8 */ dLytCommonABtn_c mBtn; - /* 0x07A8 */ dLytMsgWindowSwordLetterDataMaybe mCharacterData[1023]; + /* 0x07A8 */ dLytMsgWindowCharData mCharacterData[1023]; /* 0x5794 */ wchar_t mTextBuf[1023]; /* 0x5F94 */ dLytTextSword mSwordText; diff --git a/include/m/m2d.h b/include/m/m2d.h index 639df15f..7247ba0a 100644 --- a/include/m/m2d.h +++ b/include/m/m2d.h @@ -167,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/toBeSorted/lyt_vec2f.h b/include/toBeSorted/lyt_vec2f.h new file mode 100644 index 00000000..54bc65c4 --- /dev/null +++ b/include/toBeSorted/lyt_vec2f.h @@ -0,0 +1,14 @@ +#ifndef D_LYT_VEC2F_H +#define D_LYT_VEC2F_H + +#include "common.h" + +// This better not be mVec2_c or something stupid +struct LytVec2f { + LytVec2f() {} + ~LytVec2f() {} + f32 x; + f32 y; +}; + +#endif diff --git a/src/d/lyt/msg_window/d_lyt_msg_window.cpp b/src/d/lyt/msg_window/d_lyt_msg_window.cpp index 0f15501f..51e11365 100644 --- a/src/d/lyt/msg_window/d_lyt_msg_window.cpp +++ b/src/d/lyt/msg_window/d_lyt_msg_window.cpp @@ -14,14 +14,13 @@ // clang-format off // vtable order #include "d/lyt/msg_window/d_lyt_msg_window_common.h" -#include "d/lyt/msg_window/d_lyt_msg_window_demo.h" -#include "d/lyt/msg_window/d_lyt_msg_window_get.h" #include "d/lyt/msg_window/d_lyt_msg_window_link.h" -#include "d/lyt/msg_window/d_lyt_msg_window_sword.h" #include "d/lyt/msg_window/d_lyt_msg_window_talk.h" - +#include "d/lyt/msg_window/d_lyt_msg_window_sword.h" #include "d/lyt/msg_window/d_lyt_msg_window_wood.h" #include "d/lyt/msg_window/d_lyt_msg_window_stone.h" +#include "d/lyt/msg_window/d_lyt_msg_window_get.h" +#include "d/lyt/msg_window/d_lyt_msg_window_demo.h" #include "d/lyt/d_lyt_auto_explain.h" #include "d/lyt/d_lyt_auto_caption.h" // clang-format on @@ -217,7 +216,7 @@ void dLytMsgWindow_c::executeState_Invisible() { } else if (mpTagProcessor->getMsgWindowSubtype() >= 2 && mpTagProcessor->getMsgWindowSubtype() < 5) { mpCurrentSubtype = mpWindowSword; - // TODO + field_0x828 = mpWindowSword->getCharData(); } else if (mpTagProcessor->getMsgWindowSubtype() == 9) { mpCurrentSubtype = mpWindowLink; // TODO @@ -226,10 +225,12 @@ void dLytMsgWindow_c::executeState_Invisible() { // TODO } else if (mpTagProcessor->getMsgWindowSubtype() == 30) { mpCurrentSubtype = mpWindowDemo; + field_0x828 = mpWindowDemo->getCharData(); dTextBox_c *box = mpCurrentSubtype->getTextBox(); mpMsgWindowUnk->fn_800B2130(mNameCopy, box, field_0x828, true); mpMsgWindowUnk->textAdvancingRelated(true, true); setTextToDisplay(mpMsgWindowUnk->getProcessedText()); + mpCurrentSubtype->setPriority(0x8A); mStateMgr.changeState(StateID_DemoIn); return; } else { diff --git a/src/d/lyt/msg_window/d_lyt_msg_window_demo.cpp b/src/d/lyt/msg_window/d_lyt_msg_window_demo.cpp new file mode 100644 index 00000000..2e15b7ce --- /dev/null +++ b/src/d/lyt/msg_window/d_lyt_msg_window_demo.cpp @@ -0,0 +1,184 @@ +#include "d/lyt/msg_window/d_lyt_msg_window_demo.h" + +#include "common.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.h" +#include "d/lyt/msg_window/d_lyt_msg_window_common.h" +#include "nw4r/lyt/lyt_pane.h" +#include "nw4r/lyt/lyt_types.h" +#include "s/s_State.hpp" +#include "toBeSorted/arc_managers/layout_arc_manager.h" + +STATE_DEFINE(dLytMsgWindowDemo_c, Invisible); +STATE_DEFINE(dLytMsgWindowDemo_c, In); +STATE_DEFINE(dLytMsgWindowDemo_c, Visible); +STATE_DEFINE(dLytMsgWindowDemo_c, Out); + +static const d2d::LytBrlanMapping brlanMap[] = { + { "demoWait_00_in.brlan", "G_inOut_00"}, + {"demoWait_00_out.brlan", "G_inOut_00"}, +}; + +#define DEMO_ANIM_IN 0 +#define DEMO_ANIM_OUT 1 + +#define DEMO_NUM_ANIMS 2 + +static const char *sTextBoxes[] = { + "T_message_00", + "T_messageS_00", +}; + +bool dLytMsgWindowDemo_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) { + mResAcc.attach(LayoutArcManager::GetInstance()->getLoadedData("DemoWait"), ""); + mLyt.setResAcc(&mResAcc); + mLyt.build("demoWait_00.brlyt", nullptr); + mLyt.setPriority(0x8A); + + for (int i = 0; i < DEMO_NUM_ANIMS; i++) { + mAnm[i].init(brlanMap[i].mFile, &mResAcc, mLyt.getLayout(), brlanMap[i].mName); + mAnm[i].bind(false); + mAnm[i].setAnimEnable(false); + } + + mAnm[DEMO_ANIM_OUT].setAnimEnable(true); + mAnm[DEMO_ANIM_OUT].setToEnd(); + mLyt.calc(); + mAnm[DEMO_ANIM_OUT].setAnimEnable(false); + + mpPane = mLyt.findPane("N_inOut_00"); + + for (int i = 0; i < 2; i++) { + mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]); + } + + mpTextboxes[1]->set0x1F6(1); + + mpTagProcessor = tagProcessor; + + mOffsets[0].x = mOffsets[0].y = 0.0f; + mOffsets[1].x = mOffsets[1].y = 0.0f; + + mText.build(&mResAcc, dLytTextLight::DEMO); + mBlurRelated.build(); + + mStateMgr.changeState(StateID_Invisible); + return true; +} + +bool dLytMsgWindowDemo_c::remove() { + mText.remove(); + for (int i = 0; i < DEMO_NUM_ANIMS; i++) { + mAnm[i].remove(); + } + mResAcc.detach(); + return true; +} + +void dLytMsgWindowDemo_c::initializeState_Invisible() { + nw4r::lyt::Size size = getTextBox()->GetSize(); + nw4r::lyt::Size fontSize = getTextBox()->GetFontSize(); + nw4r::math::MTX34 transform = getTextBox()->GetGlobalMtx(); + + mOffsets[0].x = transform._03 - size.width / 2.0f; + mOffsets[0].y = (transform._13 - size.height / 2.0f) + fontSize.height + fontSize.height * 0.5f; + mOffsets[1].x = mOffsets[0].x; + mOffsets[1].y = + (transform._13 - size.height / 2.0f) + fontSize.height + getTextBox()->GetLineSpace() + fontSize.height; +} +void dLytMsgWindowDemo_c::executeState_Invisible() { + if (mShouldBeOpen) { + mStateMgr.changeState(StateID_In); + } +} +void dLytMsgWindowDemo_c::finalizeState_Invisible() {} + +void dLytMsgWindowDemo_c::initializeState_In() { + mAnm[DEMO_ANIM_IN].setForwardOnce(); + mAnm[DEMO_ANIM_IN].setAnimEnable(true); + mAnm[DEMO_ANIM_IN].setToStart(); +} +void dLytMsgWindowDemo_c::executeState_In() { + if (mAnm[DEMO_ANIM_IN].isStop2()) { + mAnm[DEMO_ANIM_IN].setAnimEnable(false); + mStateMgr.changeState(StateID_Visible); + } +} +void dLytMsgWindowDemo_c::finalizeState_In() {} + +void dLytMsgWindowDemo_c::initializeState_Visible() {} +void dLytMsgWindowDemo_c::executeState_Visible() { + if (!mShouldBeOpen) { + mStateMgr.changeState(StateID_Out); + } +} +void dLytMsgWindowDemo_c::finalizeState_Visible() {} + +void dLytMsgWindowDemo_c::initializeState_Out() { + mAnm[DEMO_ANIM_OUT].setForwardOnce(); + mAnm[DEMO_ANIM_OUT].setAnimEnable(true); + mAnm[DEMO_ANIM_OUT].setToStart(); +} +void dLytMsgWindowDemo_c::executeState_Out() { + if (mAnm[DEMO_ANIM_OUT].isStop2()) { + mAnm[DEMO_ANIM_OUT].setAnimEnable(false); + mStateMgr.changeState(StateID_Invisible); + } +} +void dLytMsgWindowDemo_c::finalizeState_Out() {} + +bool dLytMsgWindowDemo_c::execute() { + mStateMgr.executeState(); + for (int i = 0; i < DEMO_NUM_ANIMS; i++) { + if (mAnm[i].isEnabled()) { + mAnm[i].play(); + } + } + mLyt.calc(); + return true; +} + +void dLytMsgWindowDemo_c::draw() { + SizedString<64> label = getTextLabel(); + // TODO figure out what these correspond to + if (!(label == "Demo01_01:07") && !(label == "Demo01_01:15") && !(label == "Demo01_01:16") && + !(label == "Demo01_01:17") && !(label == "Demo01_01:18")) { + // TODO order of evaluation + s32 i = 0; + if (mpTagProcessor->getNumLinesMaybe() > 1) { + i = 1; + } + mBlurRelated.drawTextBlur(&mText, mOffsets[i], mpPane->GetAlpha()); + } + mLyt.draw(); +} + +SizedString<64> dLytMsgWindowDemo_c::getTextLabel() { + return dLytMsgWindow_c::getInstance()->getLabel(); +} + +void dLytMsgWindowDemo_c::open(dAcObjBase_c *obj, u32 param) { + mShouldBeOpen = true; +} + +bool dLytMsgWindowDemo_c::isDoneOpening() const { + return !(*mStateMgr.getStateID() == StateID_In); +} + +void dLytMsgWindowDemo_c::close() { + mShouldBeOpen = false; +} + +bool dLytMsgWindowDemo_c::isDoneClosing() const { + return !(*mStateMgr.getStateID() == StateID_Out); +} + +bool dLytMsgWindowDemo_c::setText(const wchar_t *text) { + mpTextboxes[0]->SetTagProcessor(mpTagProcessor); + mpTextboxes[1]->SetTagProcessor(mpTagProcessor); + mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0); + mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0); + return true; +}