diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 6ceb1bd8..ed3a8426 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -7481,13 +7481,13 @@ unprojectFromMap__15dLytMapGlobal_cCFR7mVec3_cRC7mVec2_c = .text:0x8012D330; // unprojectFromMap__15dLytMapGlobal_cCFR7mVec3_cRC7mVec2_cRC4mAng = .text:0x8012D350; // type:function size:0x1C unprojectFromMap__15dLytMapGlobal_cCFR7mVec3_cRC7mVec2_cRC7mVec3_cRC4mAng = .text:0x8012D370; // type:function size:0x1C unprojectFromMap__15dLytMapGlobal_cCFR7mVec3_cRC7mVec2_cRC7mVec2_cRC7mVec3_cRC7mVec3_cRC4mAngff = .text:0x8012D390; // type:function size:0x118 -LytMapCapture__stateRenderingWaitEnter = .text:0x8012D4B0; // type:function size:0x4 -LytMapCapture__stateRenderingWaitUpdate = .text:0x8012D4C0; // type:function size:0x70 +initializeState_RenderingWait__16dLytMapCapture_cFv = .text:0x8012D4B0; // type:function size:0x4 +executeState_RenderingWait__16dLytMapCapture_cFv = .text:0x8012D4C0; // type:function size:0x70 changeState__85sStateMgr_c<16dLytMapCapture_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x8012D530; // type:function size:0x10 -LytMapCapture__stateRenderingWaitLeave = .text:0x8012D540; // type:function size:0x4 -LytMapCapture__stateRenderingWaitStep2Enter = .text:0x8012D550; // type:function size:0x4 -LytMapCapture__stateRenderingWaitStep2Update = .text:0x8012D560; // type:function size:0x94 -LytMapCapture__stateRenderingWaitStep2Leave = .text:0x8012D600; // type:function size:0x4 +finalizeState_RenderingWait__16dLytMapCapture_cFv = .text:0x8012D540; // type:function size:0x4 +initializeState_RenderingWaitStep2__16dLytMapCapture_cFv = .text:0x8012D550; // type:function size:0x4 +executeState_RenderingWaitStep2__16dLytMapCapture_cFv = .text:0x8012D560; // type:function size:0x94 +finalizeState_RenderingWaitStep2__16dLytMapCapture_cFv = .text:0x8012D600; // type:function size:0x4 fn_8012D610 = .text:0x8012D610; // type:function size:0x5C fn_8012D670 = .text:0x8012D670; // type:function size:0x5C fn_8012D6D0 = .text:0x8012D6D0; // type:function size:0x20 @@ -7495,12 +7495,12 @@ fn_8012D6F0 = .text:0x8012D6F0; // type:function size:0xE4 fn_8012D7E0 = .text:0x8012D7E0; // type:function size:0x10 fn_8012D7F0 = .text:0x8012D7F0; // type:function size:0x8 fn_8012D800 = .text:0x8012D800; // type:function size:0xEC -fn_8012D8F0 = .text:0x8012D8F0; // type:function size:0x30 -fn_8012D920 = .text:0x8012D920; // type:function size:0x30 -fn_8012D950 = .text:0x8012D950; // type:function size:0x30 -LytMapCapture__initStates = .text:0x8012D980; // type:function size:0x1C0 -LytMapCapture__dtor = .text:0x8012DB40; // type:function size:0x58 -fn_8012DBA0 = .text:0x8012DBA0; // type:function size:0x88 +finalizeState__31sFStateID_c<16dLytMapCapture_c>CFR16dLytMapCapture_c = .text:0x8012D8F0; // type:function size:0x30 +executeState__31sFStateID_c<16dLytMapCapture_c>CFR16dLytMapCapture_c = .text:0x8012D920; // type:function size:0x30 +initializeState__31sFStateID_c<16dLytMapCapture_c>CFR16dLytMapCapture_c = .text:0x8012D950; // type:function size:0x30 +__sinit_\d_lyt_map_capture_cpp = .text:0x8012D980; // type:function size:0x1C0 +__dt__31sFStateID_c<16dLytMapCapture_c>Fv = .text:0x8012DB40; // type:function size:0x58 +isSameName__31sFStateID_c<16dLytMapCapture_c>CFPCc = .text:0x8012DBA0; // type:function size:0x88 __ct__13dLytMap_HIO_cFv = .text:0x8012DC30; // type:function size:0xEC __dt__13dLytMap_HIO_cFv = .text:0x8012DD20; // type:function size:0x40 init__21dMapFootPrintsQueue_cFv = .text:0x8012DD60; // type:function size:0x17C @@ -7629,7 +7629,7 @@ getStateID__89sStateMgr_c<20dLytMapFloorBtnMgr_c,20sStateMethodUsr_FI_c,12sFStat executeState__89sStateMgr_c<20dLytMapFloorBtnMgr_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x801312F0; // type:function size:0x10 checkPointedAtBtn__20dLytMapFloorBtnMgr_cFv = .text:0x80131300; // type:function size:0xF0 getPointedAtBtnIdx__20dLytMapFloorBtnMgr_cCFv = .text:0x801313F0; // type:function size:0x58 -fn_80131450 = .text:0x80131450; // type:function size:0x8 +isUsingPointerNav__20dLytMapFloorBtnMgr_cCFv = .text:0x80131450; // type:function size:0x8 resetFloor__20dLytMapFloorBtnMgr_cFl = .text:0x80131460; // type:function size:0xC4 decideSelectedFloor__20dLytMapFloorBtnMgr_cFv = .text:0x80131530; // type:function size:0x5C canDecideFloor__20dLytMapFloorBtnMgr_cCFv = .text:0x80131590; // type:function size:0x1D8 @@ -7664,11 +7664,11 @@ finalizeState_WaitInvalid__18dLytMapPopupInfo_cFv = .text:0x80131ED0; // type:fu initializeState_Out__18dLytMapPopupInfo_cFv = .text:0x80131EE0; // type:function size:0xC executeState_Out__18dLytMapPopupInfo_cFv = .text:0x80131EF0; // type:function size:0x6C finalizeState_Out__18dLytMapPopupInfo_cFv = .text:0x80131F60; // type:function size:0x4 -fn_80131F70 = .text:0x80131F70; // type:function size:0xB0 -fn_80132020 = .text:0x80132020; // type:function size:0x4C -fn_80132070 = .text:0x80132070; // type:function size:0x94 +build__18dLytMapPopupInfo_cFPQ23d2d10ResAccIf_c = .text:0x80131F70; // type:function size:0xB0 +remove__18dLytMapPopupInfo_cFv = .text:0x80132020; // type:function size:0x4C +execute__18dLytMapPopupInfo_cFv = .text:0x80132070; // type:function size:0x94 executeState__87sStateMgr_c<18dLytMapPopupInfo_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x80132110; // type:function size:0x10 -fn_80132120 = .text:0x80132120; // type:function size:0x14 +draw__18dLytMapPopupInfo_cFv = .text:0x80132120; // type:function size:0x14 initializeState_Invisible__24dLytMapSavePopupAction_cFv = .text:0x80132140; // type:function size:0x4 executeState_Invisible__24dLytMapSavePopupAction_cFv = .text:0x80132150; // type:function size:0x28 changeState__93sStateMgr_c<24dLytMapSavePopupAction_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x80132180; // type:function size:0x10 @@ -7682,18 +7682,18 @@ finalizeState_Wait__24dLytMapSavePopupAction_cFv = .text:0x80132340; // type:fun initializeState_Out__24dLytMapSavePopupAction_cFv = .text:0x80132350; // type:function size:0x7C executeState_Out__24dLytMapSavePopupAction_cFv = .text:0x801323D0; // type:function size:0xB4 finalizeState_Out__24dLytMapSavePopupAction_cFv = .text:0x80132490; // type:function size:0x4 -fn_801324A0 = .text:0x801324A0; // type:function size:0x10 +execute__24dLytMapSavePopupAction_cFv = .text:0x801324A0; // type:function size:0x10 executeState__93sStateMgr_c<24dLytMapSavePopupAction_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x801324B0; // type:function size:0x10 -fn_801324C0 = .text:0x801324C0; // type:function size:0x10 -fn_801324D0 = .text:0x801324D0; // type:function size:0x78 -fn_80132550 = .text:0x80132550; // type:function size:0xD0 -fn_80132620 = .text:0x80132620; // type:function size:0x4C -fn_80132670 = .text:0x80132670; // type:function size:0x94 -fn_80132710 = .text:0x80132710; // type:function size:0x318 +init__24dLytMapSavePopupAction_cFPQ23d2d10AnmGroup_c = .text:0x801324C0; // type:function size:0x10 +hide__24dLytMapSavePopupAction_cFv = .text:0x801324D0; // type:function size:0x78 +build__18dLytMapSavePopup_cFPQ23d2d10ResAccIf_c = .text:0x80132550; // type:function size:0xD0 +remove__18dLytMapSavePopup_cFv = .text:0x80132620; // type:function size:0x4C +execute__18dLytMapSavePopup_cFv = .text:0x80132670; // type:function size:0x94 +draw__18dLytMapSavePopup_cFv = .text:0x80132710; // type:function size:0x318 getStateID__93sStateMgr_c<24dLytMapSavePopupAction_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x80132A30; // type:function size:0x10 -fn_80132A40 = .text:0x80132A40; // type:function size:0xC -fn_80132A50 = .text:0x80132A50; // type:function size:0xA4 -fn_80132B00 = .text:0x80132B00; // type:function size:0x10 +set__18dLytMapSavePopup_cFPPQ34nw4r3lyt8Boundingl = .text:0x80132A40; // type:function size:0xC +setStatueLabel__18dLytMapSavePopup_cFPCc = .text:0x80132A50; // type:function size:0xA4 +hide__18dLytMapSavePopup_cFl = .text:0x80132B00; // type:function size:0x10 initializeState_Invisible__20dLytMapSaveCaption_cFv = .text:0x80132B10; // type:function size:0x4 executeState_Invisible__20dLytMapSaveCaption_cFv = .text:0x80132B20; // type:function size:0x4 finalizeState_Invisible__20dLytMapSaveCaption_cFv = .text:0x80132B30; // type:function size:0x4 @@ -33515,10 +33515,10 @@ lbl_8051EE7C = .data:0x8051EE7C; // type:object size:0xC lbl_8051EE88 = .data:0x8051EE88; // type:object size:0x1C lbl_8051EEA4 = .data:0x8051EEA4; // type:object size:0x1C data:string lbl_8051EEC0 = .data:0x8051EEC0; // type:object size:0xC -lbl_8051EECC = .data:0x8051EECC; // type:object size:0x1C +lbl_8051EECC = .data:0x8051EECC; // type:object size:0x16 data:string lbl_8051EEE8 = .data:0x8051EEE8; // type:object size:0x18 data:string lbl_8051EF00 = .data:0x8051EF00; // type:object size:0x18 data:string -lbl_8051EF18 = .data:0x8051EF18; // type:object size:0x14 +lbl_8051EF18 = .data:0x8051EF18; // type:object size:0x12 data:string lbl_8051EF2C = .data:0x8051EF2C; // type:object size:0xC data:string lbl_8051EF38 = .data:0x8051EF38; // type:object size:0xC lbl_8051EF44 = .data:0x8051EF44; // type:object size:0xC diff --git a/include/d/d_stage.h b/include/d/d_stage.h index d68d64b8..07c25499 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -74,11 +74,16 @@ public: /* 0x1F0 */ u8 field_0x1F0; public: + u8 getField_0x1EE() const { + return field_0x1EE; + } + void init(MapRelated *); void fn_801b4900(); void fn_801B4B80(u32 mapParams, const mVec3_c ¢er, const mVec3_c &size); void fn_801B4C70(const mVec3_c &); void fn_801B50C0(s32); + const mVec3_c &fn_801B4CB0() const; }; // OBJ NAME: STAGE @@ -128,6 +133,10 @@ public: return sInstance; } + MapRelated *getMapRelated() { + return &mMapRelated; + } + bool isFadedOut() const { return mFader.isStatus(mFaderBase_c::FADED_OUT); } @@ -154,7 +163,7 @@ private: /* 0x0068 */ sFPhase mPhase; /* 0x007C */ dRoomTable_c rooms; /* 0x017C */ dFader_c mFader; - /* 0x01A0 */ MapRelated mapRelated; + /* 0x01A0 */ MapRelated mMapRelated; /* 0x0394 */ u8 _0x394[0x39C - 0x394]; /* 0x039C */ u32 loaded_entities[2047]; /* 0x2398 */ s8 curr_room_id; diff --git a/include/d/lyt/d_lyt_map.h b/include/d/lyt/d_lyt_map.h index 6ca15fb8..cee9f4ce 100644 --- a/include/d/lyt/d_lyt_map.h +++ b/include/d/lyt/d_lyt_map.h @@ -16,6 +16,16 @@ #include "s/s_State.hpp" #include "toBeSorted/d_flow_mgr.h" +/** Bird Statue Definition (StatueSelectDestination) */ +struct dMapSaveDefinition { + /* 0x00 */ const char *stageName; + /* 0x04 */ u8 room; + /* 0x05 */ u8 layer; + /* 0x06 */ u8 enrance; + /* 0x08 */ UNKWORD field_0x08; + /* 0x0C */ const char *statueLabel; +}; + struct dMapFootPrintEntry { /* 0x00 */ dMapFootPrintEntry *pPrev; /* 0x04 */ dMapFootPrintEntry *pNext; @@ -261,8 +271,8 @@ public: mBaseFloorOffset = 0; mSelectedBtnIdx = 0; field_0x70C = 4; - field_0x710 = false; - field_0x711 = false; + mPointerVisible = false; + mPrevPointerVisible = false; field_0x712 = false; } virtual ~dLytMapFloorBtnMgr_c(); @@ -294,7 +304,8 @@ public: return getPointedAtBtnIdx() >= 0; } - void resetFloor(s32 newFloor); + void resetFloor(s32 newFloorBtn); + bool isUsingPointerNav() const; private: void checkPointedAtBtn(); @@ -311,8 +322,8 @@ private: /* 0x704 */ s32 mBaseFloorOffset; /* 0x708 */ s32 mSelectedBtnIdx; /* 0x70C */ UNKWORD field_0x70C; - /* 0x710 */ bool field_0x710; - /* 0x711 */ bool field_0x711; + /* 0x710 */ bool mPointerVisible; + /* 0x711 */ bool mPrevPointerVisible; /* 0x712 */ bool field_0x712; }; @@ -327,6 +338,11 @@ public: STATE_FUNC_DECLARE(dLytMapPopupInfo_c, WaitInvalid); STATE_FUNC_DECLARE(dLytMapPopupInfo_c, Out); + void build(d2d::ResAccIf_c *resAcc); + void remove(); + void execute(); + void draw(); + private: /* 0x000 */ UI_STATE_MGR_DECLARE(dLytMapPopupInfo_c); /* 0x03C */ d2d::LytBase_c mLyt; @@ -335,33 +351,50 @@ private: // Size 0x4C class dLytMapSavePopupAction_c { + friend class dLytMapSavePopup_c; + public: - dLytMapSavePopupAction_c() : mStateMgr(*this, sStateID::null), field_0x44(0.0f), field_0x48(0) {} + dLytMapSavePopupAction_c() : mStateMgr(*this, sStateID::null), mInOutFrame(0.0f), mInRequest(false) {} STATE_FUNC_DECLARE(dLytMapSavePopupAction_c, Invisible); STATE_FUNC_DECLARE(dLytMapSavePopupAction_c, In); STATE_FUNC_DECLARE(dLytMapSavePopupAction_c, Wait); STATE_FUNC_DECLARE(dLytMapSavePopupAction_c, Out); + void execute(); + void init(d2d::AnmGroup_c *pGroups); + void hide(); + private: /* 0x00 */ UI_STATE_MGR_DECLARE(dLytMapSavePopupAction_c); - /* 0x3C */ u8 _0x3C[0x44 - 0x3C]; - /* 0x44 */ f32 field_0x44; - /* 0x48 */ u8 field_0x48; + /* 0x3C */ d2d::AnmGroup_c *mpAnmGroupInOut; + /* 0x40 */ d2d::AnmGroup_c *mpAnmGroupInput; + /* 0x44 */ f32 mInOutFrame; + /* 0x48 */ bool mInRequest; }; // Assumed name class dLytMapSavePopup_c { public: - dLytMapSavePopup_c() : field_0x4A0(0), field_0x4A4(0), field_0x4A8(-1) {} + dLytMapSavePopup_c() : mStatueNum(0), mpStatueBoundings(nullptr), mCurrentlyInStatue(-1) {} + + void build(d2d::ResAccIf_c *resAcc); + void remove(); + void execute(); + void draw(); + + void set(nw4r::lyt::Bounding **pStatueBoundings, s32 count); + void hide(s32 statueIdx); private: + f32 setStatueLabel(const char *label); + /* 0x000 */ d2d::LytBase_c mLyt; /* 0x090 */ d2d::AnmGroup_c mAnmGroups[2]; /* 0x110 */ dLytMapSavePopupAction_c mActions[12]; - /* 0x4A0 */ UNKWORD field_0x4A0; - /* 0x4A4 */ UNKWORD field_0x4A4; - /* 0x4A8 */ UNKWORD field_0x4A8; + /* 0x4A0 */ s32 mStatueNum; + /* 0x4A4 */ nw4r::lyt::Bounding **mpStatueBoundings; + /* 0x4A8 */ s32 mCurrentlyInStatue; }; class dLytMapSaveCaption_c { @@ -444,6 +477,8 @@ public: bool fn_80139EA0() const; void lightPillarRelated(s32, s32, s32); + const dMapSaveDefinition *getSaveDefinition(s32 province, s32 statueIdx) const; + STATE_FUNC_DECLARE(dLytMapMain_c, Invisible); STATE_FUNC_DECLARE(dLytMapMain_c, RenderingWait); STATE_FUNC_DECLARE(dLytMapMain_c, In); @@ -496,7 +531,7 @@ private: f32 fn_80142D90(s32); void fn_80142F00(mVec3_c &, s32 mapMode, u8, const mVec3_c &, const mAng &); - void fn_8013FB70(const mVec3_c&, f32); + void fn_8013FB70(const mVec3_c &, f32); void zoomOut(); void zoomIn(); @@ -527,8 +562,11 @@ private: /* 0x7BD0 */ dLytMapSavePopup_c mSavePopup; /* 0x807C */ dLytMapPopupInfo_c mPopupInfo; - /* 0x8208 */ u8 _0x8208[0x828C - 0x8208]; + /* 0x8208 */ u8 _0x8208[0x821C - 0x8208]; + /* 0x821C */ nw4r::lyt::Bounding **field_0x821C[10]; + /* 0x8244 */ nw4r::lyt::Bounding **field_0x8244[6]; + /* 0x825C */ nw4r::lyt::Bounding **field_0x825C[12]; /* 0x828C */ mVec3_c field_0x828C[12]; /* 0x831C */ u8 _0x831C[0x832C - 0x831C]; @@ -558,7 +596,11 @@ private: /* 0x8C90 */ u8 field_0x8C90; /* 0x8C94 */ s32 field_0x8C94; - /* 0x8C98 */ u8 _0x8C98[0x8CA4 - 0x8C98]; + /* 0x8C98 */ u8 _0x8C98[0x8C9C - 0x8C98]; + + /* 0x8C9C */ UNKWORD field_0x8C9C; + + /* 0x8CA0 */ u8 _0x8CA0[0x8CA4 - 0x8CA0]; /* 0x8CA4 */ s32 field_0x8CA4; /* 0x8CA8 */ s32 field_0x8CA8; @@ -665,6 +707,10 @@ public: mMapMain.lightPillarRelated(p1, p2, p3); } + const dMapSaveDefinition *getSaveDefinition(s32 statueIdx) const { + return mMapMain.getSaveDefinition(mMapMain.field_0x8C9C, statueIdx); + } + private: /* 0x0004 */ d2d::ResAccIf_c mResAcc; /* 0x0374 */ dLytMapMain_c mMapMain; diff --git a/include/d/lyt/d_lyt_map_capture.h b/include/d/lyt/d_lyt_map_capture.h index 974c095b..723d8c16 100644 --- a/include/d/lyt/d_lyt_map_capture.h +++ b/include/d/lyt/d_lyt_map_capture.h @@ -11,8 +11,8 @@ public: field_0x040 = 0; field_0x070 = 0.0f; field_0x074 = 0.0f; - field_0x078 = 0; - field_0x079 = 0; + mRenderRequest = false; + mIsBusyRendering = false; field_0x06C = 0.0f; field_0x068 = 0.0f; field_0x064 = 0.0f; @@ -24,6 +24,8 @@ public: STATE_FUNC_DECLARE(dLytMapCapture_c, RenderingWaitStep2); private: + void fn_8012D6F0(); + /* 0x004 */ UI_STATE_MGR_DECLARE(dLytMapCapture_c); /* 0x040 */ UNKWORD field_0x040; /* 0x044 */ u8 _0x040[0x064 - 0x044]; @@ -32,8 +34,8 @@ private: /* 0x06C */ f32 field_0x06C; /* 0x070 */ f32 field_0x070; /* 0x074 */ f32 field_0x074; - /* 0x078 */ u8 field_0x078; - /* 0x079 */ u8 field_0x079; + /* 0x078 */ bool mRenderRequest; + /* 0x079 */ bool mIsBusyRendering; }; #endif diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index b86ba605..9e8fde25 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -70,7 +70,7 @@ int dStage_c::create() { pcam++; } - if (mapRelated.field_0x1EB == 0) { + if (mMapRelated.field_0x1EB == 0) { mVec3_c min, max; for (s32 i = 0; i < MAX_ROOM_NUMBER - 1; i++) { dRoom_c *room = getRoom(i); @@ -89,11 +89,11 @@ int dStage_c::create() { max.y += 6000.0f; mVec3_c size = max - min; mVec3_c center = mVec3_c(min.x + size.x * 0.5f, min.y, min.z + size.z * 0.5f); - mapRelated.fn_801B4B80(0, center, size); + mMapRelated.fn_801B4B80(0, center, size); mVec3_c v = mVec3_c(10000.0f, 10000.0f, 100000.0f); - mapRelated.fn_801B4C70(v); + mMapRelated.fn_801B4C70(v); } - mapRelated.fn_801B50C0(0); + mMapRelated.fn_801B50C0(0); fn_80028A80(); return SUCCEEDED; diff --git a/src/d/lyt/d_lyt_map.cpp b/src/d/lyt/d_lyt_map.cpp index cd1f6491..f9690327 100644 --- a/src/d/lyt/d_lyt_map.cpp +++ b/src/d/lyt/d_lyt_map.cpp @@ -15,6 +15,8 @@ #include "d/lyt/d_lyt_control_game.h" #include "d/lyt/d_lyt_map_global.h" #include "d/lyt/d_textbox.h" +#include "d/lyt/d_window.h" +#include "d/lyt/msg_window/d_lyt_msg_window.h" #include "d/snd/d_snd_small_effect_mgr.h" #include "egg/core/eggColorFader.h" #include "m/m_vec.h" @@ -22,6 +24,8 @@ #include "nw4r/g3d/g3d_obj.h" #include "nw4r/lyt/lyt_bounding.h" #include "nw4r/lyt/lyt_pane.h" +#include "nw4r/lyt/lyt_window.h" +#include "s/s_StateInterfaces.hpp" #include "sized_string.h" #include "toBeSorted/arc_managers/layout_arc_manager.h" #include "toBeSorted/d_beacon.h" @@ -56,6 +60,10 @@ struct dLytMap_HIO_c { /* 0x2A */ u8 mFootstepsAlpha; /* 0x2B */ u8 field_0x2B; /* 0x2C */ f32 field_0x2C; + + f32 getField_0x04() const { + return field_0x04; + } }; dLytMap_HIO_c sHio; @@ -1030,8 +1038,8 @@ bool dLytMapFloorBtnMgr_c::build(d2d::ResAccIf_c *resAcc) { mCsHitChecks[i].execute(); } - field_0x710 = false; - field_0x711 = false; + mPointerVisible = false; + mPrevPointerVisible = false; for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { mFloorBtns[i].mSelected = false; @@ -1063,7 +1071,7 @@ bool dLytMapFloorBtnMgr_c::remove() { bool dLytMapFloorBtnMgr_c::execute() { field_0x70C = 4; if (*mStateMgr.getStateID() != StateID_Invisible) { - if (field_0x710) { + if (mPointerVisible) { for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { mFloorBtns[i].execute(); } @@ -1072,13 +1080,15 @@ bool dLytMapFloorBtnMgr_c::execute() { // Determine the currently active floor s32 activeBtn = 0; s32 direction = dPadNav::getFSStickNavDirection(); - if (field_0x710 != field_0x711) { + if (mPointerVisible != mPrevPointerVisible) { + // We just turned off pointing, so make the decided button the selected one too for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { if (mFloorBtns[i].mDecided) { activeBtn = i; } } } else { + // Normal handling - pointing off, selected button stays selected for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { if (mFloorBtns[i].mSelected) { activeBtn = i; @@ -1136,14 +1146,14 @@ bool dLytMapFloorBtnMgr_c::execute() { } void dLytMapFloorBtnMgr_c::checkPointedAtBtn() { - field_0x711 = field_0x710; - field_0x710 = dPadNav::isPointerVisible(); + mPrevPointerVisible = mPointerVisible; + mPointerVisible = dPadNav::isPointerVisible(); if (field_0x712) { dPadNav::stopFSStickNav(); - field_0x710 = true; + mPointerVisible = true; } - if (field_0x710) { + if (mPointerVisible) { for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { mFloorBtns[i].mSelected = false; } @@ -1170,6 +1180,82 @@ s32 dLytMapFloorBtnMgr_c::getPointedAtBtnIdx() const { return idx; } +bool dLytMapFloorBtnMgr_c::isUsingPointerNav() const { + return mPointerVisible; +} + +void dLytMapFloorBtnMgr_c::resetFloor(s32 newFloorBtn) { + mFloorBtns[mSelectedBtnIdx].mDecided = false; + mFloorBtns[mSelectedBtnIdx].directlyUndecide(); + mFloorBtns[mSelectedBtnIdx].mStateMgr.changeState(dLytMapFloorBtn_c::StateID_Wait); + + mFloorBtns[newFloorBtn].mDecided = true; + mFloorBtns[newFloorBtn].directlyDecide(); + mFloorBtns[newFloorBtn].mStateMgr.changeState(dLytMapFloorBtn_c::StateID_Decide); + + mSelectedBtnIdx = newFloorBtn; +} + +void dLytMapFloorBtnMgr_c::decideSelectedFloor() { + for (int i = 0; i < mNumFloors; i++) { + if (mFloorBtns[i].mSelected) { + if (i != mSelectedBtnIdx) { + mFloorBtns[mSelectedBtnIdx].mDecided = false; + mFloorBtns[i].mDecided = true; + } + mSelectedBtnIdx = i; + } + } +} + +bool dLytMapFloorBtnMgr_c::canDecideFloor() const { + bool ret = false; + + s32 idx = getPointedAtBtnIdx(); + if (idx >= 0) { + // When pointing at a button that is thus selected but not yet decided, + // we can decide on that button if it's not busy animating... + if (!mFloorBtns[idx].mDecided) { + if (mFloorBtns[idx].mStateMgr.isState(dLytMapFloorBtn_c::StateID_Select)) { + bool busy = mFloorBtns[idx].mpAnmGroups->mOnOff.isBound() || + mFloorBtns[idx].mpAnmGroups->mDecide.isBound() || + mFloorBtns[idx].mpAnmGroups->mOnOffLight.isBound(); + if (!busy) { + ret = true; + } + } + } + } + + for (int i = 0; i < mNumFloors; i++) { + // But if any other button is animating and in a changing state, also forbid + if (i != idx) { + bool busy = mFloorBtns[i].mpAnmGroups->mOnOff.isBound() || mFloorBtns[i].mpAnmGroups->mDecide.isBound() || + mFloorBtns[i].mpAnmGroups->mOnOffLight.isBound(); + + if (busy) { + if (!mFloorBtns[i].mStateMgr.isState(dLytMapFloorBtn_c::StateID_Wait) && + !mFloorBtns[i].mStateMgr.isState(dLytMapFloorBtn_c::StateID_Decide)) { + ret = false; + break; + } + } + } + } + + return ret; +} + +s32 dLytMapFloorBtnMgr_c::getCurrentFloor() const { + s32 ret = -1; + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + if (mFloorBtns[i].mDecided) { + ret = i; + } + } + return mBaseFloorOffset - ret; +} + // What it says on the tin static const char *sFloorBtnLabels[] = { "FLOOR_F3", "FLOOR_F2", "FLOOR_F1", "FLOOR_B1", "FLOOR_B2", "FLOOR_B3", @@ -1239,42 +1325,291 @@ dLytMapFloorBtnMgr_c::~dLytMapFloorBtnMgr_c() { dPadNav::setNavEnabled(false, false); } +#define MAP_POPUP_INFO_ANIM_IN 0 +#define MAP_POPUP_INFO_ANIM_OUT 1 +#define MAP_POPUP_INFO_ANIM_INPUT 2 + +#define MAP_POPUP_INFO_NUM_ANIMS 3 + void dLytMapPopupInfo_c::initializeState_Invisible() {} void dLytMapPopupInfo_c::executeState_Invisible() {} void dLytMapPopupInfo_c::finalizeState_Invisible() {} -void dLytMapPopupInfo_c::initializeState_In() {} -void dLytMapPopupInfo_c::executeState_In() {} +void dLytMapPopupInfo_c::initializeState_In() { + mAnmGroups[MAP_POPUP_INFO_ANIM_IN].bind(false); +} +void dLytMapPopupInfo_c::executeState_In() { + if (mAnmGroups[MAP_POPUP_INFO_ANIM_IN].isEndReached()) { + mLyt.calc(); + mAnmGroups[MAP_POPUP_INFO_ANIM_IN].unbind(); + mStateMgr.changeState(StateID_Wait); + } +} void dLytMapPopupInfo_c::finalizeState_In() {} void dLytMapPopupInfo_c::initializeState_Wait() {} -void dLytMapPopupInfo_c::executeState_Wait() {} +void dLytMapPopupInfo_c::executeState_Wait() { + if (dLytMsgWindow_c::getInstance()->isVisible()) { + mAnmGroups[MAP_POPUP_INFO_ANIM_INPUT].bind(false); + mAnmGroups[MAP_POPUP_INFO_ANIM_INPUT].setForward(); + mAnmGroups[MAP_POPUP_INFO_ANIM_INPUT].setToStart(); + mStateMgr.changeState(StateID_WaitInvalid); + } else if (mAnmGroups[MAP_POPUP_INFO_ANIM_INPUT].isStop2()) { + mLyt.calc(); + mAnmGroups[MAP_POPUP_INFO_ANIM_INPUT].unbind(); + } +} void dLytMapPopupInfo_c::finalizeState_Wait() {} void dLytMapPopupInfo_c::initializeState_WaitInvalid() {} -void dLytMapPopupInfo_c::executeState_WaitInvalid() {} +void dLytMapPopupInfo_c::executeState_WaitInvalid() { + if (!dLytMsgWindow_c::getInstance()->isVisible()) { + mAnmGroups[MAP_POPUP_INFO_ANIM_INPUT].bind(false); + mAnmGroups[MAP_POPUP_INFO_ANIM_INPUT].setBackward(); + mAnmGroups[MAP_POPUP_INFO_ANIM_INPUT].setToStart(); + mStateMgr.changeState(StateID_Wait); + } else if (mAnmGroups[MAP_POPUP_INFO_ANIM_INPUT].isStop2()) { + mLyt.calc(); + mAnmGroups[MAP_POPUP_INFO_ANIM_INPUT].unbind(); + } +} void dLytMapPopupInfo_c::finalizeState_WaitInvalid() {} -void dLytMapPopupInfo_c::initializeState_Out() {} -void dLytMapPopupInfo_c::executeState_Out() {} +void dLytMapPopupInfo_c::initializeState_Out() { + mAnmGroups[MAP_POPUP_INFO_ANIM_OUT].bind(false); +} +void dLytMapPopupInfo_c::executeState_Out() { + if (mAnmGroups[MAP_POPUP_INFO_ANIM_OUT].isEndReached()) { + mLyt.calc(); + mAnmGroups[MAP_POPUP_INFO_ANIM_OUT].unbind(); + } +} void dLytMapPopupInfo_c::finalizeState_Out() {} +static const d2d::LytBrlanMapping sMapPopupInfoBrlanMap[] = { + { "mapPopupInfo_00_in.brlan", "G_inOut_00"}, + { "mapPopupInfo_00_out.brlan", "G_inOut_00"}, + {"mapPopupInfo_00_inPut.brlan", "G_input_00"}, +}; + +void dLytMapPopupInfo_c::build(d2d::ResAccIf_c *resAcc) { + mLyt.setResAcc(resAcc); + mLyt.build("mapPopupInfo_00.brlyt", nullptr); + for (int i = 0; i < MAP_POPUP_INFO_NUM_ANIMS; i++) { + mAnmGroups[i].init(sMapPopupInfoBrlanMap[i].mFile, resAcc, mLyt.getLayout(), sMapPopupInfoBrlanMap[i].mName); + } + mStateMgr.changeState(StateID_Invisible); +} + +void dLytMapPopupInfo_c::remove() { + for (int i = 0; i < MAP_POPUP_INFO_NUM_ANIMS; i++) { + mAnmGroups[i].remove(); + } +} + +void dLytMapPopupInfo_c::execute() { + mStateMgr.executeState(); + mLyt.calc(); + for (int i = 0; i < MAP_POPUP_INFO_NUM_ANIMS; i++) { + if (mAnmGroups[i].isBound()) { + mAnmGroups[i].play(); + } + } +} + +void dLytMapPopupInfo_c::draw() { + mLyt.draw(); +} + +#define MAP_SAVE_POPUP_ACTION_ANIM_IN_OUT 0 +#define MAP_SAVE_POPUP_ACTION_ANIM_INPUT 1 + +#define MAP_SAVE_POPUP_ACTION_NUM_ANIMS 2 + void dLytMapSavePopupAction_c::initializeState_Invisible() {} -void dLytMapSavePopupAction_c::executeState_Invisible() {} +void dLytMapSavePopupAction_c::executeState_Invisible() { + if (mInRequest) { + mStateMgr.changeState(StateID_In); + } +} void dLytMapSavePopupAction_c::finalizeState_Invisible() {} -void dLytMapSavePopupAction_c::initializeState_In() {} -void dLytMapSavePopupAction_c::executeState_In() {} +void dLytMapSavePopupAction_c::initializeState_In() { + // TODO - explain why this seems unnecessarily complicated + mpAnmGroupInOut->bind(false); + mpAnmGroupInOut->setForward(); + mpAnmGroupInOut->setToStart(); + mInOutFrame = mpAnmGroupInOut->getFrame(); + mpAnmGroupInOut->unbind(); +} +void dLytMapSavePopupAction_c::executeState_In() { + // TODO - explain why this seems unnecessarily complicated + mpAnmGroupInOut->bind(false); + mpAnmGroupInOut->setFrame(mInOutFrame); + mpAnmGroupInOut->play(); + if (mpAnmGroupInOut->isEndReached()) { + mStateMgr.changeState(StateID_Wait); + } + mInOutFrame = mpAnmGroupInOut->getFrame(); + mpAnmGroupInOut->unbind(); +} void dLytMapSavePopupAction_c::finalizeState_In() {} void dLytMapSavePopupAction_c::initializeState_Wait() {} -void dLytMapSavePopupAction_c::executeState_Wait() {} +void dLytMapSavePopupAction_c::executeState_Wait() { + if (!mInRequest) { + mStateMgr.changeState(StateID_Out); + } +} void dLytMapSavePopupAction_c::finalizeState_Wait() {} -void dLytMapSavePopupAction_c::initializeState_Out() {} -void dLytMapSavePopupAction_c::executeState_Out() {} +void dLytMapSavePopupAction_c::initializeState_Out() { + // TODO - explain why this seems unnecessarily complicated + mpAnmGroupInOut->bind(false); + mpAnmGroupInOut->setBackward(); + mpAnmGroupInOut->setToStart(); + mInOutFrame = mpAnmGroupInOut->getFrame(); + mpAnmGroupInOut->unbind(); +} +void dLytMapSavePopupAction_c::executeState_Out() { + // TODO - explain why this seems unnecessarily complicated + mpAnmGroupInOut->bind(false); + mpAnmGroupInOut->setBackward(); + mpAnmGroupInOut->setFrame(mInOutFrame); + mpAnmGroupInOut->play(); + if (mpAnmGroupInOut->isStop2()) { + mStateMgr.changeState(StateID_Wait); + } + mInOutFrame = mpAnmGroupInOut->getFrame(); + mpAnmGroupInOut->unbind(); +} void dLytMapSavePopupAction_c::finalizeState_Out() {} +void dLytMapSavePopupAction_c::execute() { + mStateMgr.executeState(); +} + +void dLytMapSavePopupAction_c::init(d2d::AnmGroup_c *pGroups) { + mpAnmGroupInOut = &pGroups[MAP_SAVE_POPUP_ACTION_ANIM_IN_OUT]; + mpAnmGroupInput = &pGroups[MAP_SAVE_POPUP_ACTION_ANIM_INPUT]; +} + +void dLytMapSavePopupAction_c::hide() { + mpAnmGroupInOut->bind(false); + mpAnmGroupInOut->setFrame(0.0f); + mpAnmGroupInOut->unbind(); + mStateMgr.changeState(StateID_Invisible); +} + +static const d2d::LytBrlanMapping sMapSavePopupActionBrlanMap[] = { + {"mapPopup_00_inOut.brlan", "G_inOut_00"}, + {"mapPopup_00_scale.brlan", "G_scale_00"}, +}; + +void dLytMapSavePopup_c::build(d2d::ResAccIf_c *resAcc) { + mLyt.setResAcc(resAcc); + mLyt.build("mapPopup_00.brlyt", nullptr); + for (int i = 0; i < MAP_SAVE_POPUP_ACTION_NUM_ANIMS; i++) { + mAnmGroups[i].init( + sMapSavePopupActionBrlanMap[i].mFile, resAcc, mLyt.getLayout(), sMapSavePopupActionBrlanMap[i].mName + ); + } + + for (int i = 0; i < (int)ARRAY_LENGTH(mActions); i++) { + mActions[i].init(mAnmGroups); + mActions[i].mStateMgr.changeState(dLytMapSavePopupAction_c::StateID_Invisible); + } +} + +void dLytMapSavePopup_c::remove() { + for (int i = 0; i < MAP_SAVE_POPUP_ACTION_NUM_ANIMS; i++) { + mAnmGroups[i].remove(); + } +} + +void dLytMapSavePopup_c::execute() { + for (int i = 0; i < mStatueNum; i++) { + mActions[i].mInRequest = mCurrentlyInStatue == i; + } + + for (int i = 0; i < mStatueNum; i++) { + mActions[i].execute(); + } +} + +void dLytMapSavePopup_c::draw() { + nw4r::lyt::Bounding *pBounding; + + f32 scaleX = mLyt.getDrawInfo().GetLocationAdjustScale().x; + nw4r::lyt::Pane *rootPane = mLyt.getLayout()->GetRootPane(); + for (int i = 0; i < mStatueNum; i++) { + const sStateIDIf_c *stateID = mActions[i].mStateMgr.getStateID(); + if (*stateID != dLytMapSavePopupAction_c::StateID_Invisible) { + pBounding = mpStatueBoundings[i]; + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_INPUT].bind(false); + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_INPUT].setFrame(30.0f); + const dMapSaveDefinition *def = dLytMap_c::GetInstance()->getSaveDefinition(i); + f32 width = setStatueLabel(def->statueLabel); + + f32 allScaleX = mLyt.findPane("N_all_00")->GetScale().x; + // TODO fadds regswap + f32 x = pBounding->GetGlobalMtx()._03 + (0.5f * width * allScaleX * scaleX) + sHio.field_0x04; + f32 y = pBounding->GetGlobalMtx()._13; + mVec2_c translate2d(x, y); + mVec3_c translate = vec2ToVec3XY(translate2d); + rootPane->SetTranslate(translate); + + if (*stateID == dLytMapSavePopupAction_c::StateID_In) { + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_IN_OUT].bind(false); + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_IN_OUT].setFrame(mActions[i].mInOutFrame); + mLyt.calc(); + mLyt.draw(); + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_IN_OUT].unbind(); + } else if (*stateID == dLytMapSavePopupAction_c::StateID_Wait) { + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_IN_OUT].bind(false); + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_IN_OUT].setToEnd(); + mLyt.calc(); + mLyt.draw(); + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_IN_OUT].unbind(); + } else if (*stateID == dLytMapSavePopupAction_c::StateID_Out) { + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_IN_OUT].bind(false); + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_IN_OUT].setBackward(); + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_IN_OUT].setFrame(mActions[i].mInOutFrame); + mLyt.calc(); + mLyt.draw(); + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_IN_OUT].unbind(); + } + mAnmGroups[MAP_SAVE_POPUP_ACTION_ANIM_INPUT].unbind(); + } + } +} + +void dLytMapSavePopup_c::set(nw4r::lyt::Bounding **pStatueBoundings, s32 count) { + mpStatueBoundings = pStatueBoundings; + mStatueNum = count; +} + +f32 dLytMapSavePopup_c::setStatueLabel(const char *label) { + static const char *sTPopupS = "T_popupS_00"; + static const char *sTPopup = "T_popup_00"; + static const char *sBg = "W_bgP_00"; + dTextBox_c *textBox; + + textBox = mLyt.getTextBox(sTPopupS); + textBox->setMessageWithGlobalTextProcessor2(label, nullptr); + textBox->GetLineWidth(nullptr); + textBox = mLyt.getTextBox(sTPopup); + textBox->setMessageWithGlobalTextProcessor2(label, nullptr); + + dWindow_c *w = mLyt.getWindow(sBg); + w->UpdateSize(textBox, 60.0f); + return w->GetSize().width; +} + +void dLytMapSavePopup_c::hide(s32 statueIdx) { + mActions[statueIdx].hide(); +} + void dLytMapSaveCaption_c::initializeState_Invisible() {} void dLytMapSaveCaption_c::executeState_Invisible() {} void dLytMapSaveCaption_c::finalizeState_Invisible() {} diff --git a/src/d/lyt/d_lyt_map_capture.cpp b/src/d/lyt/d_lyt_map_capture.cpp new file mode 100644 index 00000000..46686efc --- /dev/null +++ b/src/d/lyt/d_lyt_map_capture.cpp @@ -0,0 +1,32 @@ +#include "d/lyt/d_lyt_map_capture.h" +#include "common.h" +#include "d/d_stage.h" + +STATE_DEFINE(dLytMapCapture_c, RenderingWait); +STATE_DEFINE(dLytMapCapture_c, RenderingWaitStep2); + +void dLytMapCapture_c::initializeState_RenderingWait() {} +void dLytMapCapture_c::executeState_RenderingWait() { + if (mRenderRequest && !mIsBusyRendering) { + fn_8012D6F0(); + mRenderRequest = false; + mIsBusyRendering = true; + mStateMgr.changeState(StateID_RenderingWaitStep2); + } +} +void dLytMapCapture_c::finalizeState_RenderingWait() {} + +void dLytMapCapture_c::initializeState_RenderingWaitStep2() {} +void dLytMapCapture_c::executeState_RenderingWaitStep2() { + if (mIsBusyRendering && dStage_c::GetInstance() != nullptr && !dStage_c::GetInstance()->getMapRelated()->getField_0x1EE()) { + mIsBusyRendering = false; + if (mRenderRequest) { + fn_8012D6F0(); + mRenderRequest = false; + mIsBusyRendering = true; + } else { + mStateMgr.changeState(StateID_RenderingWait); + } + } +} +void dLytMapCapture_c::finalizeState_RenderingWaitStep2() {}