diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 0e95e2d9..480136ef 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -9210,11 +9210,11 @@ executeState__86sStateMgr_c<17dLytCommonArrow_c,20sStateMethodUsr_FI_c,12sFState getStateID__86sStateMgr_c<17dLytCommonArrow_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x801685C0; // type:function size:0x10 addToDrawList__17dLytCommonArrow_cFv = .text:0x801685D0; // type:function size:0x34 setState__17dLytCommonArrow_cFl = .text:0x80168610; // type:function size:0x24 -fn_80168640__17dLytCommonArrow_cFPf = .text:0x80168640; // type:function size:0x34 -fn_80168680__17dLytCommonArrow_cFv = .text:0x80168680; // type:function size:0x70 -fn_801686F0__17dLytCommonArrow_cFv = .text:0x801686F0; // type:function size:0x70 +setTranslate__17dLytCommonArrow_cFPC3Vec = .text:0x80168640; // type:function size:0x34 +requestIn__17dLytCommonArrow_cFv = .text:0x80168680; // type:function size:0x70 +requestOut__17dLytCommonArrow_cFv = .text:0x801686F0; // type:function size:0x70 fn_80168760__17dLytCommonArrow_cFv = .text:0x80168760; // type:function size:0x2C -fn_80168790__17dLytCommonArrow_cFlf = .text:0x80168790; // type:function size:0x68 +displayElement__17dLytCommonArrow_cFlf = .text:0x80168790; // type:function size:0x68 fn_80168800__17dLytCommonArrow_cFl = .text:0x80168800; // type:function size:0x10 fn_80168810__17dLytCommonArrow_cFPQ23d2d10AnmGroup_c = .text:0x80168810; // type:function size:0x64 fn_80168880__17dLytCommonArrow_cFv = .text:0x80168880; // type:function size:0xC4 @@ -33250,18 +33250,18 @@ lbl_80527260 = .data:0x80527260; // type:object size:0x14 lbl_80527274 = .data:0x80527274; // type:object size:0x14 lbl_80527288 = .data:0x80527288; // type:object size:0x10 lbl_80527298 = .data:0x80527298; // type:object size:0x18 data:string -lbl_805272B0 = .data:0x805272B0; // type:object size:0xC -lbl_805272BC = .data:0x805272BC; // type:object size:0x1C -lbl_805272D8 = .data:0x805272D8; // type:object size:0xC -lbl_805272E4 = .data:0x805272E4; // type:object size:0x1C -lbl_80527300 = .data:0x80527300; // type:object size:0xC -lbl_8052730C = .data:0x8052730C; // type:object size:0x1C +lbl_805272B0 = .data:0x805272B0; // type:object size:0xB data:string +lbl_805272BC = .data:0x805272BC; // type:object size:0x1A data:string +lbl_805272D8 = .data:0x805272D8; // type:object size:0xA data:string +lbl_805272E4 = .data:0x805272E4; // type:object size:0x1A data:string +lbl_80527300 = .data:0x80527300; // type:object size:0xA data:string +lbl_8052730C = .data:0x8052730C; // type:object size:0x1B data:string lbl_80527328 = .data:0x80527328; // type:object size:0xC data:string lbl_80527334 = .data:0x80527334; // type:object size:0xC data:string lbl_80527340 = .data:0x80527340; // type:object size:0x1C data:string -lbl_8052735C = .data:0x8052735C; // type:object size:0x1C -lbl_80527378 = .data:0x80527378; // type:object size:0xC -lbl_80527384 = .data:0x80527384; // type:object size:0x58 +lbl_8052735C = .data:0x8052735C; // type:object size:0x1B data:string +lbl_80527378 = .data:0x80527378; // type:object size:0xB data:string +lbl_80527384 = .data:0x80527384; // type:object size:0x19 data:string __vt__17dLytCommonArrow_c = .data:0x805273DC; // type:object size:0xC __vt__56sFStateMgr_c<17dLytCommonArrow_c,20sStateMethodUsr_FI_c> = .data:0x805273E8; // type:object size:0x30 __vt__86sStateMgr_c<17dLytCommonArrow_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x80527418; // type:object size:0x30 @@ -38204,7 +38204,7 @@ lbl_805729C0 = .sdata:0x805729C0; // type:object size:0x4 data:4byte lbl_805729C4 = .sdata:0x805729C4; // type:object size:0x4 lbl_805729C8 = .sdata:0x805729C8; // type:object size:0x4 data:4byte lbl_805729CC = .sdata:0x805729CC; // type:object size:0x4 -lbl_805729D0 = .sdata:0x805729D0; // type:object size:0x8 +lbl_805729D0 = .sdata:0x805729D0; // type:object size:0x1 lbl_805729D8 = .sdata:0x805729D8; // type:object size:0x4 lbl_805729DC = .sdata:0x805729DC; // type:object size:0x4 lbl_805729E0 = .sdata:0x805729E0; // type:object size:0x8 data:string @@ -48761,7 +48761,7 @@ LytSaveMsgWindow__STATE_INIT = .bss:0x805B1BC0; // type:object size:0x40 data:4b LytSaveMsgWindow__STATE_IN = .bss:0x805B1C00; // type:object size:0x40 data:4byte LytSaveMsgWindow__STATE_WAIT = .bss:0x805B1C40; // type:object size:0x40 data:4byte LytSaveMsgWindow__STATE_OUT = .bss:0x805B1C80; // type:object size:0x30 data:4byte -lbl_805B1CB0 = .bss:0x805B1CB0; // type:object size:0x10 +lbl_805B1CB0 = .bss:0x805B1CB0; // type:object size:0xC StateID_None__17dLytCommonArrow_c = .bss:0x805B1CC0; // type:object size:0x30 data:4byte StateID_In__17dLytCommonArrow_c = .bss:0x805B1D00; // type:object size:0x30 data:4byte StateID_Wait__17dLytCommonArrow_c = .bss:0x805B1D40; // type:object size:0x30 data:4byte diff --git a/configure.py b/configure.py index 8134e351..280808bb 100644 --- a/configure.py +++ b/configure.py @@ -421,7 +421,7 @@ config.libs = [ Object(Matching, "d/lyt/d_screen_fader.cpp"), Object(NonMatching, "d/d_cs_base.cpp"), Object(NonMatching, "d/d_cs_game.cpp"), - Object(NonMatching, "d/lyt/d_lyt_common_arrow.cpp"), + Object(Matching, "d/lyt/d_lyt_common_arrow.cpp"), Object(NonMatching, "toBeSorted/file_manager.cpp"), Object(NonMatching, "toBeSorted/save_manager.cpp"), Object(Matching, "DynamicLink.cpp"), diff --git a/include/d/d_cs_base.h b/include/d/d_cs_base.h index c3aa6346..2d75ce27 100644 --- a/include/d/d_cs_base.h +++ b/include/d/d_cs_base.h @@ -1,6 +1,7 @@ #ifndef D_C_BASE_H #define D_C_BASE_H +#include "common.h" #include "d/d_cs.h" #include "d/lyt/d2d.h" #include "d/lyt/d_lyt_cursor_stick.h" @@ -25,6 +26,10 @@ public: field_0x703 = val; } + d2d::dLytStructD *getUnk() { + return mStructC.field_0x14; + } + private: static int sfield0x700Init; void setCurrentLyt(int lyt); diff --git a/include/d/lyt/d_lyt_common_arrow.h b/include/d/lyt/d_lyt_common_arrow.h index 06ff8c07..16415e5a 100644 --- a/include/d/lyt/d_lyt_common_arrow.h +++ b/include/d/lyt/d_lyt_common_arrow.h @@ -3,6 +3,7 @@ #include "d/lyt/d2d.h" #include "d/lyt/d_structd.h" +#include "nw4r/lyt/lyt_bounding.h" #include "s/s_State.hpp" #include "s/s_StateMgr.hpp" @@ -23,11 +24,11 @@ public: bool fn_80168490(); bool fn_80168500(); - void fn_80168640(f32 *); - bool fn_80168680(); - bool fn_801686F0(); + void setTranslate(const Vec *); + bool requestIn(); + bool requestOut(); bool fn_80168760(); - void fn_80168790(s32, f32); + void displayElement(s32, f32); void fn_80168800(s32); void fn_80168810(d2d::AnmGroup_c *); void fn_80168880(); @@ -36,18 +37,18 @@ private: UI_STATE_MGR_DECLARE(dLytCommonArrow_c); /* 0x40 */ d2d::LytBase_c mLytBase; d2d::ResAccIf_c mResAcc; - d2d::AnmGroup_c field_0x440[0x9]; - d2d::dLytStructD field_0x680; - void *field_0x6A8; - void *field_0x6AC; - s32 field_0x6B0; + d2d::AnmGroup_c mAnmGroups[0x9]; + d2d::dLytStructD mStructD; + nw4r::lyt::Bounding *mBoundingL; + nw4r::lyt::Bounding *mBoundingR; + s32 mType; s32 field_0x6B4; s32 field_0x6B8; s32 field_0x6BC; s32 field_0x6C0; - s32 field_0x6C4; - u8 field_0x6C8; - u8 field_0x6C9; + s32 mTimer; + u8 mInRequested; + u8 mOutRequested; u8 field_0x6CA; u8 field_0x6CB; u8 field_0x6CC; diff --git a/include/d/lyt/d_structd.h b/include/d/lyt/d_structd.h index 51359aa6..346dda60 100644 --- a/include/d/lyt/d_structd.h +++ b/include/d/lyt/d_structd.h @@ -1,21 +1,23 @@ #ifndef D_LYT_STRUCTD_H #define D_LYT_STRUCTD_H +#include "common.h" #include "egg/core/eggHeap.h" -#include "nw4r/ut/ut_LinkList.h" #include "toBeSorted/tlist.h" namespace d2d { +class dLytStructD; + class dLytStructC { public: - dLytStructC() : field_0x10(0), field_0x14(0) {} + dLytStructC() : field_0x10(0), field_0x14(nullptr) {} virtual ~dLytStructC() {} virtual void *dLytStructC0x0C(); TListNode mLink; u16 field_0x10; - s32 field_0x14; + dLytStructD *field_0x14; }; class dLytStructCSub : public dLytStructC { @@ -30,7 +32,8 @@ public: struct dLytStructD_Base { dLytStructD_Base() : field_0x0C(0), field_0x10(0), field_0x14(0), field_0x015(0), field_0x016(0) {} - virtual ~dLytStructD_Base() {} + virtual u32 getType() = 0; + virtual void doSomething() = 0; TListNode mLink; u32 field_0x0C; u32 field_0x10; @@ -56,8 +59,10 @@ struct dLytStructDInArray { }; struct dLytStructD : dLytStructD_Base { - dLytStructD() : field_0x18(0), field_0x1C(nullptr), field_0x20(0), field_0x22(0), field_0x23(0), field_0x24(0) {} + dLytStructD() : field_0x18(0), field_0x1C(nullptr), field_0x20(0), field_0x22(0), field_0x23(0), field_0x24(nullptr) {} + virtual u32 getType() override; + virtual void doSomething() override; virtual ~dLytStructD(); void init(nw4r::lyt::Pane *, u16, u8, u8); @@ -69,7 +74,7 @@ struct dLytStructD : dLytStructD_Base { u16 field_0x20; u8 field_0x22; u8 field_0x23; - u32 field_0x24; + void *field_0x24; }; class dLytStructDList { diff --git a/src/d/lyt/d_lyt_common_arrow.cpp b/src/d/lyt/d_lyt_common_arrow.cpp index 438bbb94..ad0b028f 100644 --- a/src/d/lyt/d_lyt_common_arrow.cpp +++ b/src/d/lyt/d_lyt_common_arrow.cpp @@ -1,15 +1,15 @@ #include "d/lyt/d_lyt_common_arrow.h" +#include "d/d_cs_base.h" +#include "d/lyt/d_structd.h" +#include "rvl/MTX/mtx.h" #include "toBeSorted/arc_managers/layout_arc_manager.h" - STATE_DEFINE(dLytCommonArrow_c, None); STATE_DEFINE(dLytCommonArrow_c, In); STATE_DEFINE(dLytCommonArrow_c, Wait); STATE_DEFINE(dLytCommonArrow_c, Out); -f32 arrow_fs[0x20]; - static const d2d::LytBrlanMapping brlanMap[] = { { "commonArrow_00_in.brlan", "G_inOut_00"}, { "commonArrow_00_loop.brlan", "G_loop_00"}, @@ -22,6 +22,19 @@ static const d2d::LytBrlanMapping brlanMap[] = { { "commonArrow_00_out.brlan", "G_inOut_00"}, }; +#define ANIM_IN 0 +#define ANIM_LOOP 1 +#define ANIM_TYPE 2 +#define ANIM_ONOFF_L 3 +#define ANIM_ONOFF_R 4 + +#define ANIM_DECIDE_OFFSET 5 + +#define ANIM_DECIDE_L 5 +#define ANIM_DECIDE_R 6 +#define ANIM_INPUT 7 +#define ANIM_OUT 8 + dLytCommonArrow_c::dLytCommonArrow_c() : mStateMgr(*this, sStateID::null) {} bool dLytCommonArrow_c::init() { @@ -31,22 +44,22 @@ bool dLytCommonArrow_c::init() { mLytBase.mPriority = 0x86; for (int i = 0; i < 9; i++) { - field_0x440[i].init(brlanMap[i].mFile, &mResAcc, mLytBase.getLayout(), brlanMap[i].mName); + mAnmGroups[i].init(brlanMap[i].mFile, &mResAcc, mLytBase.getLayout(), brlanMap[i].mName); } - field_0x680.fn_80065E70(mLytBase.getLayout()->GetRootPane(), 1, 0, 0); - d2d::dLytStructDList::sInstance->appendToList2(&field_0x680); - field_0x6A8 = mLytBase.findBounding("B_arrowL_00"); - field_0x6AC = mLytBase.findBounding("B_arrowR_00"); + mStructD.fn_80065E70(mLytBase.getLayout()->GetRootPane(), 1, 0, 0); + d2d::dLytStructDList::sInstance->appendToList2(&mStructD); + mBoundingL = mLytBase.findBounding("B_arrowL_00"); + mBoundingR = mLytBase.findBounding("B_arrowR_00"); mStateMgr.changeState(StateID_None); setState(0); return true; } bool dLytCommonArrow_c::fn_80168490() { - d2d::dLytStructDList::sInstance->removeFromList2(&field_0x680); + d2d::dLytStructDList::sInstance->removeFromList2(&mStructD); mLytBase.unbindAnims(); for (int i = 0; i < 9; i++) { - field_0x440[i].afterUnbind(); + mAnmGroups[i].afterUnbind(); } return true; } @@ -54,11 +67,11 @@ bool dLytCommonArrow_c::fn_80168490() { bool dLytCommonArrow_c::fn_80168500() { mStateMgr.executeState(); if (!mStateMgr.getStateID()->isEqual(StateID_None)) { - field_0x440[1].play(); + mAnmGroups[ANIM_LOOP].play(); } mLytBase.calc(); - field_0x680.field_0x22 = 0; - field_0x680.fn_80065F70(); + mStructD.field_0x22 = 0; + mStructD.fn_80065F70(); field_0x6BC = field_0x6B8; return true; } @@ -71,7 +84,7 @@ bool dLytCommonArrow_c::addToDrawList() { } void dLytCommonArrow_c::setState(s32 state) { - field_0x6B0 = state; + mType = state; if (state == 0) { mLytBase.mPriority = 0x86; } else { @@ -79,24 +92,25 @@ void dLytCommonArrow_c::setState(s32 state) { } } -void dLytCommonArrow_c::fn_80168640(f32 *arg) { - // TODO - mLytBase.getLayout()->GetRootPane()->SetTranslate(nw4r::math::VEC3(arg[0], arg[1], 0.0f)); +void dLytCommonArrow_c::setTranslate(const Vec *arg) { + nw4r::math::VEC3 v(*arg); + v.z = 0.0f; + mLytBase.getLayout()->GetRootPane()->SetTranslate(v); } -bool dLytCommonArrow_c::fn_80168680() { +bool dLytCommonArrow_c::requestIn() { if (!mStateMgr.getStateID()->isEqual(StateID_None)) { return false; } - field_0x6C8 = 1; + mInRequested = 1; return true; } -bool dLytCommonArrow_c::fn_801686F0() { +bool dLytCommonArrow_c::requestOut() { if (!mStateMgr.getStateID()->isEqual(StateID_Wait)) { return false; } - field_0x6C9 = 1; + mOutRequested = 1; return true; } @@ -108,13 +122,13 @@ bool dLytCommonArrow_c::fn_80168760() { return false; } -void dLytCommonArrow_c::fn_80168790(s32 idx, f32 frame) { - d2d::AnmGroup_c *s = &field_0x440[idx]; +void dLytCommonArrow_c::displayElement(s32 idx, f32 frame) { + d2d::AnmGroup_c *s = &mAnmGroups[idx]; s->setFrameAndControlThings(frame); } void dLytCommonArrow_c::fn_80168800(s32 idx) { - field_0x440[idx].unbind(); + mAnmGroups[idx].unbind(); } void dLytCommonArrow_c::fn_80168810(d2d::AnmGroup_c *ctrl) { @@ -127,50 +141,73 @@ void dLytCommonArrow_c::fn_80168810(d2d::AnmGroup_c *ctrl) { } } -void dLytCommonArrow_c::fn_80168880() {} +extern "C" u8 lbl_80572D10; + +void dLytCommonArrow_c::fn_80168880() { + int i = -1; + if (lbl_80572D10 == 0) { + field_0x6B4 = 2; + return; + } + + d2d::dLytStructD *thing = dCsBase_c::sInstance->getUnk(); + if (thing != nullptr && thing->getType() == 'lyt ') { + if (thing->field_0x24 == mBoundingL) { + i = 0; + } else if (thing->field_0x24 == mBoundingR) { + i = 1; + } + } + + if (i >= 0) { + field_0x6B4 = i; + } else { + field_0x6B4 = 2; + } +} void dLytCommonArrow_c::initializeState_None() { mLytBase.unbindAnims(); - field_0x6C8 = 0; - field_0x6C9 = 0; + mInRequested = 0; + mOutRequested = 0; field_0x6CA = 0; field_0x6CB = 0; field_0x6B4 = 2; field_0x6B8 = 2; field_0x6BC = 2; field_0x6C0 = 2; - field_0x6C4 = 0; - fn_80168790(0, 0.0f); + mTimer = 0; + displayElement(ANIM_IN, 0.0f); field_0x6CC = 1; } void dLytCommonArrow_c::executeState_None() { - if (field_0x6C8 == 1) { + if (mInRequested == 1) { mStateMgr.changeState(StateID_In); } } void dLytCommonArrow_c::finalizeState_None() { - field_0x6C8 = 0; - fn_80168790(1, 0.0f); + mInRequested = 0; + displayElement(ANIM_LOOP, 0.0f); } void dLytCommonArrow_c::initializeState_In() { - field_0x6C4 = 0; + mTimer = 0; field_0x6CB = 1; - f32 tmp = 0.0f; - if (field_0x6B0 == 1) { - tmp = 1.0f; + f32 anmType = 0.0f; + if (mType == 1) { + anmType = 1.0f; } - fn_80168790(2, tmp); - fn_80168790(3, 0.0f); - fn_80168790(4, 0.0f); - fn_80168790(7, 0.0f); + displayElement(ANIM_TYPE, anmType); + displayElement(ANIM_ONOFF_L, 0.0f); + displayElement(ANIM_ONOFF_R, 0.0f); + displayElement(ANIM_INPUT, 0.0f); } void dLytCommonArrow_c::executeState_In() { - switch (field_0x6C4) { + switch (mTimer) { case 0: { - d2d::AnmGroup_c *s = &field_0x440[0]; + d2d::AnmGroup_c *s = &mAnmGroups[ANIM_IN]; if (s->isEndReached() == 1) { - field_0x6C4 += 1; + mTimer += 1; field_0x6CA = 1; } else { s->play(); @@ -183,43 +220,92 @@ void dLytCommonArrow_c::executeState_In() { } } void dLytCommonArrow_c::finalizeState_In() { - fn_80168800(0); + fn_80168800(ANIM_IN); } void dLytCommonArrow_c::initializeState_Wait() { - field_0x6C4 = 0; + mTimer = 0; } + +extern "C" void SmallSoundManager__playSound(void *, u32); +extern "C" void *SOUND_EFFECT_SOUND_MGR; + void dLytCommonArrow_c::executeState_Wait() { - if (field_0x6C9 == 1) { + if (mOutRequested == 1) { mStateMgr.changeState(StateID_Out); return; } fn_80168880(); if (field_0x6B8 == 0) { - field_0x440[3].play(); - fn_80168810(&field_0x440[4]); + d2d::AnmGroup_c &g = mAnmGroups[ANIM_ONOFF_L]; + g.play(); + fn_80168810(&mAnmGroups[ANIM_ONOFF_R]); } else if (field_0x6B8 == 1) { - field_0x440[4].play(); - fn_80168810(&field_0x440[3]); + d2d::AnmGroup_c &g = mAnmGroups[ANIM_ONOFF_R]; + g.play(); + fn_80168810(&mAnmGroups[ANIM_ONOFF_L]); } else { - fn_80168810(&field_0x440[3]); - fn_80168810(&field_0x440[4]); + fn_80168810(&mAnmGroups[ANIM_ONOFF_L]); + fn_80168810(&mAnmGroups[ANIM_ONOFF_R]); + } + + d2d::AnmGroup_c &g2 = mAnmGroups[ANIM_INPUT]; + if (field_0x6CC != 0) { + fn_80168810(&g2); + } else { + g2.play(); + } + + switch (mTimer) { + case 0: + if (field_0x6C0 != 2) { + displayElement(field_0x6C0 + ANIM_DECIDE_OFFSET, 0.0f); + if (field_0x6C0 == 0) { + SmallSoundManager__playSound(SOUND_EFFECT_SOUND_MGR, 0x142D); + } else { + SmallSoundManager__playSound(SOUND_EFFECT_SOUND_MGR, 0x142E); + } + mTimer++; + } + break; + case 1: { + d2d::AnmGroup_c &g = mAnmGroups[field_0x6C0 + ANIM_DECIDE_OFFSET]; + if (g.isEndReached() == true) { + mTimer++; + field_0x6CA = 1; + } + g.play(); + } break; + case 2: + fn_80168800(field_0x6C0 + ANIM_DECIDE_OFFSET); + mTimer = 0; + field_0x6CA = 0; + field_0x6C0 = 2; + break; + } + + if (field_0x6BC != field_0x6B8 && field_0x6B8 != 2) { + if (field_0x6B8 == 0) { + SmallSoundManager__playSound(SOUND_EFFECT_SOUND_MGR, 0x142B); + } else { + SmallSoundManager__playSound(SOUND_EFFECT_SOUND_MGR, 0x142C); + } } } void dLytCommonArrow_c::finalizeState_Wait() {} void dLytCommonArrow_c::initializeState_Out() { - field_0x6C4 = 0; - fn_80168790(8, 0.0f); - field_0x6C9 = 0; + mTimer = 0; + displayElement(ANIM_OUT, 0.0f); + mOutRequested = 0; } void dLytCommonArrow_c::executeState_Out() { - switch (field_0x6C4) { + switch (mTimer) { case 0: { - d2d::AnmGroup_c *s = &field_0x440[8]; + d2d::AnmGroup_c *s = &mAnmGroups[ANIM_OUT]; if (s->isEndReached() == 1) { - field_0x6C4 = 1; + mTimer = 1; field_0x6CA = 1; } s->play();