diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index ad02c030..02984ca5 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -540,7 +540,11 @@ toBeSorted/bigboss_model_math_stuff.cpp: .sbss start:0x80575410 end:0x80575418 toBeSorted/actor_event_flow_manager_related.cpp: - .text start:0x800C3900 end:0x800C447C align:16 + .text start:0x800C3900 end:0x800C3AEC align:16 + +toBeSorted/d_flow_mgr.cpp: + .text start:0x800C3AF0 end:0x800C447C align:16 + .data start:0x80511B18 end:0x80511B30 d/d_lyt_base.cpp: .text start:0x800C4480 end:0x800C4690 align:16 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index e58d8816..3f699681 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -180,7 +180,7 @@ fn_80007E60 = .text:0x80007E60; // type:function size:0xF8 fn_80007F60 = .text:0x80007F60; // type:function size:0x68 fn_80007FD0 = .text:0x80007FD0; // type:function size:0x7C fn_80008050 = .text:0x80008050; // type:function size:0x350 -fn_800083A0 = .text:0x800083A0; // type:function size:0x40 +__dt__14dFlowMgrBase_cFv = .text:0x800083A0; // type:function size:0x40 fn_800083E0 = .text:0x800083E0; // type:function size:0x18 fn_80008400 = .text:0x80008400; // type:function size:0x118 fn_80008520 = .text:0x80008520; // type:function size:0x68 @@ -4270,7 +4270,7 @@ fn_800C3820 = .text:0x800C3820; // type:function size:0x80 fn_800C38A0 = .text:0x800C38A0; // type:function size:0x58 fn_800C3900 = .text:0x800C3900; // type:function size:0xD0 fn_800C39D0 = .text:0x800C39D0; // type:function size:0x11C -fn_800C3AF0 = .text:0x800C3AF0; // type:function size:0x1C +__ct__14dFlowMgrBase_cFP7dFlow_c = .text:0x800C3AF0; // type:function size:0x1C ActorEventFlowManagerRelated__triggerEventEntryPoint = .text:0x800C3B10; // type:function size:0xF8 fn_800C3C10 = .text:0x800C3C10; // type:function size:0xE8 fn_800C3D00 = .text:0x800C3D00; // type:function size:0x78 @@ -4286,8 +4286,8 @@ fn_800C40F0 = .text:0x800C40F0; // type:function size:0xB4 fn_800C41B0 = .text:0x800C41B0; // type:function size:0xBC fn_800C4270 = .text:0x800C4270; // type:function size:0x54 fn_800C42D0 = .text:0x800C42D0; // type:function size:0xF8 -fn_800C43D0 = .text:0x800C43D0; // type:function size:0x48 -fn_800C4420 = .text:0x800C4420; // type:function size:0x5C +__ct__10dFlowMgr_cFv = .text:0x800C43D0; // type:function size:0x48 +__dt__10dFlowMgr_cFv = .text:0x800C4420; // type:function size:0x5C __ct__10dLytBase_cFv = .text:0x800C4480; // type:function size:0x54 __dt__10dLytBase_cFv = .text:0x800C44E0; // type:function size:0x94 allocateLytWork1Heap__10dLytBase_cFPCcb = .text:0x800C4580; // type:function size:0xB4 @@ -7516,12 +7516,12 @@ remove__19dLytMapFootPrints_cFv = .text:0x8012E2E0; // type:function size:0x8 execute__19dLytMapFootPrints_cFv = .text:0x8012E2F0; // type:function size:0x204 __ct__7mVec2_cFff = .text:0x8012E500; // type:function size:0xC draw__19dLytMapFootPrints_cFv = .text:0x8012E510; // type:function size:0x1F0 -fn_8012E700 = .text:0x8012E700; // type:function size:0x68 -fn_8012E770 = .text:0x8012E770; // type:function size:0x4 -fn_8012E780 = .text:0x8012E780; // type:function size:0x14 -fn_8012E7A0 = .text:0x8012E7A0; // type:function size:0x24 -fn_8012E7D0 = .text:0x8012E7D0; // type:function size:0x3C -fn_8012E810 = .text:0x8012E810; // type:function size:0x24 +build__16dLytMapPutIcon_cFPQ23d2d10ResAccIf_c = .text:0x8012E700; // type:function size:0x68 +remove__16dLytMapPutIcon_cFv = .text:0x8012E770; // type:function size:0x4 +execute__16dLytMapPutIcon_cFv = .text:0x8012E780; // type:function size:0x14 +draw__16dLytMapPutIcon_cFv = .text:0x8012E7A0; // type:function size:0x24 +setPosition__16dLytMapPutIcon_cFRC7mVec2_c = .text:0x8012E7D0; // type:function size:0x3C +setScale__16dLytMapPutIcon_cFf = .text:0x8012E810; // type:function size:0x24 initializeState_Wait__16dLytMapPinIcon_cFv = .text:0x8012E840; // type:function size:0x14 executeState_Wait__16dLytMapPinIcon_cFv = .text:0x8012E860; // type:function size:0x58 changeState__85sStateMgr_c<16dLytMapPinIcon_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x8012E8C0; // type:function size:0x10 @@ -7538,18 +7538,18 @@ finalizeState_ToUnselect__16dLytMapPinIcon_cFv = .text:0x8012EAE0; // type:funct initializeState_Remove__16dLytMapPinIcon_cFv = .text:0x8012EAF0; // type:function size:0x4 executeState_Remove__16dLytMapPinIcon_cFv = .text:0x8012EB00; // type:function size:0x18 finalizeState_Remove__16dLytMapPinIcon_cFv = .text:0x8012EB20; // type:function size:0x4 -fn_8012EB30 = .text:0x8012EB30; // type:function size:0xF8 -fn_8012EC30 = .text:0x8012EC30; // type:function size:0x80 -fn_8012ECB0 = .text:0x8012ECB0; // type:function size:0x10C +updatePosition__16dLytMapPinIcon_cFv = .text:0x8012EB30; // type:function size:0xF8 +checkPointedAt__16dLytMapPinIcon_cFv = .text:0x8012EC30; // type:function size:0x80 +setPosition__16dLytMapPinIcon_cFRC7mVec3_c = .text:0x8012ECB0; // type:function size:0x10C removeBeacon__16dLytMapPinIcon_cFv = .text:0x8012EDC0; // type:function size:0x2C __dt__16dLytMapPinIcon_cFv = .text:0x8012EDF0; // type:function size:0x110 __dt__55sFStateMgr_c<16dLytMapPinIcon_c,20sStateMethodUsr_FI_c>Fv = .text:0x8012EF00; // type:function size:0xA4 __dt__85sStateMgr_c<16dLytMapPinIcon_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x8012EFB0; // type:function size:0xA0 __dt__32sFStateFct_c<16dLytMapPinIcon_c>Fv = .text:0x8012F050; // type:function size:0x6C __dt__29sFState_c<16dLytMapPinIcon_c>Fv = .text:0x8012F0C0; // type:function size:0x58 -fn_8012F120 = .text:0x8012F120; // type:function size:0x8 +getGlobal__16dLytMapPinIcon_cCFv = .text:0x8012F120; // type:function size:0x8 build__16dLytMapPinIcon_cFPQ23d2d10ResAccIf_c = .text:0x8012F130; // type:function size:0x17C -fn_8012F2B0 = .text:0x8012F2B0; // type:function size:0x6C +setScale__16dLytMapPinIcon_cFf = .text:0x8012F2B0; // type:function size:0x6C remove__16dLytMapPinIcon_cFv = .text:0x8012F320; // type:function size:0x60 execute__16dLytMapPinIcon_cFv = .text:0x8012F380; // type:function size:0xE4 executeState__85sStateMgr_c<16dLytMapPinIcon_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x8012F470; // type:function size:0x10 @@ -7565,21 +7565,21 @@ finalizeState_Select__25dLytMapPinIconAggregate_cFv = .text:0x8012F760; // type: initializeState_Remove__25dLytMapPinIconAggregate_cFv = .text:0x8012F770; // type:function size:0x4 executeState_Remove__25dLytMapPinIconAggregate_cFv = .text:0x8012F780; // type:function size:0x24 finalizeState_Remove__25dLytMapPinIconAggregate_cFv = .text:0x8012F7B0; // type:function size:0x4 -fn_8012F7C0 = .text:0x8012F7C0; // type:function size:0x94 -fn_8012F860 = .text:0x8012F860; // type:function size:0x5C -fn_8012F8C0 = .text:0x8012F8C0; // type:function size:0x4C -fn_8012F910 = .text:0x8012F910; // type:function size:0x1C -fn_8012F930 = .text:0x8012F930; // type:function size:0x68 -fn_8012F9A0 = .text:0x8012F9A0; // type:function size:0x1C -fn_8012F9C0 = .text:0x8012F9C0; // type:function size:0x5C -fn_8012FA20 = .text:0x8012FA20; // type:function size:0xA8 -fn_8012FAD0 = .text:0x8012FAD0; // type:function size:0x50 -fn_8012FB20 = .text:0x8012FB20; // type:function size:0xA8 +findNewBeaconId__25dLytMapPinIconAggregate_cFPl = .text:0x8012F7C0; // type:function size:0x94 +setScale__25dLytMapPinIconAggregate_cFf = .text:0x8012F860; // type:function size:0x5C +updatePosition__25dLytMapPinIconAggregate_cFv = .text:0x8012F8C0; // type:function size:0x4C +setUnk__25dLytMapPinIconAggregate_cFP16LytMap0x80520B5C = .text:0x8012F910; // type:function size:0x1C +setPosition__25dLytMapPinIconAggregate_cFlRC7mVec3_c = .text:0x8012F930; // type:function size:0x68 +unsetAll__25dLytMapPinIconAggregate_cFv = .text:0x8012F9A0; // type:function size:0x1C +getNumSetPins__25dLytMapPinIconAggregate_cCFv = .text:0x8012F9C0; // type:function size:0x5C +build__25dLytMapPinIconAggregate_cFPQ23d2d10ResAccIf_c = .text:0x8012FA20; // type:function size:0xA8 +remove__25dLytMapPinIconAggregate_cFv = .text:0x8012FAD0; // type:function size:0x50 +execute__25dLytMapPinIconAggregate_cFv = .text:0x8012FB20; // type:function size:0xA8 executeState__94sStateMgr_c<25dLytMapPinIconAggregate_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x8012FBD0; // type:function size:0x10 -fn_8012FBE0 = .text:0x8012FBE0; // type:function size:0x50 -fn_8012FC30 = .text:0x8012FC30; // type:function size:0x18 +draw__25dLytMapPinIconAggregate_cFv = .text:0x8012FBE0; // type:function size:0x50 +init__17dLytMapFloorBtn_cFv = .text:0x8012FC30; // type:function size:0x18 changeState__86sStateMgr_c<17dLytMapFloorBtn_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x8012FC50; // type:function size:0x10 -fn_8012FC60 = .text:0x8012FC60; // type:function size:0x10 +execute__17dLytMapFloorBtn_cFv = .text:0x8012FC60; // type:function size:0x10 executeState__86sStateMgr_c<17dLytMapFloorBtn_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x8012FC70; // type:function size:0x10 fn_8012FC80 = .text:0x8012FC80; // type:function size:0xB4 fn_8012FD40 = .text:0x8012FD40; // type:function size:0xAC @@ -7616,15 +7616,15 @@ __dt__56sFStateMgr_c<17dLytMapFloorBtn_c,20sStateMethodUsr_FI_c>Fv = .text:0x801 __dt__86sStateMgr_c<17dLytMapFloorBtn_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x80130800; // type:function size:0xA0 __dt__33sFStateFct_c<17dLytMapFloorBtn_c>Fv = .text:0x801308A0; // type:function size:0x6C __dt__30sFState_c<17dLytMapFloorBtn_c>Fv = .text:0x80130910; // type:function size:0x58 -__dt__20LytMapFourAnimGroupsFv = .text:0x80130970; // type:function size:0xA0 +__dt__24dLytMapFloorBtnAnmGroupsFv = .text:0x80130970; // type:function size:0xA0 __dt__59sFStateMgr_c<20dLytMapFloorBtnMgr_c,20sStateMethodUsr_FI_c>Fv = .text:0x80130A10; // type:function size:0xA4 __dt__89sStateMgr_c<20dLytMapFloorBtnMgr_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x80130AC0; // type:function size:0xA0 __dt__36sFStateFct_c<20dLytMapFloorBtnMgr_c>Fv = .text:0x80130B60; // type:function size:0x6C __dt__33sFState_c<20dLytMapFloorBtnMgr_c>Fv = .text:0x80130BD0; // type:function size:0x58 -fn_80130C30 = .text:0x80130C30; // type:function size:0x300 +build__20dLytMapFloorBtnMgr_cFPQ23d2d10ResAccIf_c = .text:0x80130C30; // type:function size:0x300 changeState__89sStateMgr_c<20dLytMapFloorBtnMgr_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x80130F30; // type:function size:0x10 -fn_80130F40 = .text:0x80130F40; // type:function size:0xB4 -fn_80131000 = .text:0x80131000; // type:function size:0x2D4 +remove__20dLytMapFloorBtnMgr_cFv = .text:0x80130F40; // type:function size:0xB4 +execute__20dLytMapFloorBtnMgr_cFv = .text:0x80131000; // type:function size:0x2D4 getStateID__89sStateMgr_c<20dLytMapFloorBtnMgr_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x801312E0; // type:function size:0x10 executeState__89sStateMgr_c<20dLytMapFloorBtnMgr_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x801312F0; // type:function size:0x10 fn_80131300 = .text:0x80131300; // type:function size:0xF0 @@ -7749,7 +7749,7 @@ __dt__85sStateMgr_c<16dLytMapCapture_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13s __dt__55sFStateMgr_c<16dLytMapCapture_c,20sStateMethodUsr_FI_c>Fv = .text:0x80133F40; // type:function size:0xA4 __dt__16dLytMapCapture_cFv = .text:0x80133FF0; // type:function size:0xB4 __ct__20dLytMapFloorBtnMgr_cFP15dLytMapGlobal_c = .text:0x801340B0; // type:function size:0x178 -__ct__20LytMapFourAnimGroupsFv = .text:0x80134230; // type:function size:0x140 +__ct__24dLytMapFloorBtnAnmGroupsFv = .text:0x80134230; // type:function size:0x140 __ct__20dCursorHitCheckLyt_cFv = .text:0x80134370; // type:function size:0x48 __ct__17dLytMapFloorBtn_cFv = .text:0x801343C0; // type:function size:0xAC __ct__25dLytMapPinIconAggregate_cFv = .text:0x80134470; // type:function size:0xF0 @@ -10108,10 +10108,10 @@ fn_8018B230 = .text:0x8018B230; // type:function size:0x74 ActorLink__handleHotPumpkinSoup = .text:0x8018B2B0; // type:function size:0xE4 fn_8018B3A0 = .text:0x8018B3A0; // type:function size:0x80 shouldDropItemForChance = .text:0x8018B420; // type:function size:0x84 -getBeaconCount = .text:0x8018B4B0; // type:function size:0x44 +getBeaconCount__Fv = .text:0x8018B4B0; // type:function size:0x44 fn_8018B500 = .text:0x8018B500; // type:function size:0x40 getBeaconPositionByIndex = .text:0x8018B540; // type:function size:0x60 -placeBeacon = .text:0x8018B5A0; // type:function size:0x7C +setBeaconPosition__FPC7mVec3_cUl = .text:0x8018B5A0; // type:function size:0x7C placeBeaconButCheckGround = .text:0x8018B620; // type:function size:0x194 fn_8018B7C0 = .text:0x8018B7C0; // type:function size:0x40 fn_8018B800 = .text:0x8018B800; // type:function size:0x24 @@ -31161,8 +31161,8 @@ lbl_80510D84 = .data:0x80510D84; // type:object size:0xC StoryflagManager__STORYFLAG_DEFINITIONS = .data:0x80510D90; // type:object size:0x964 ItemflagManager__ITEMFLAG_DEFINITIONS = .data:0x805116F4; // type:object size:0x3FC DungeonflagManager__FLAG_DEFINITIONS = .data:0x80511AF0; // type:object size:0x28 -lbl_80511B18 = .data:0x80511B18; // type:object size:0xC -lbl_80511B24 = .data:0x80511B24; // type:object size:0xC +__vt__10dFlowMgr_c = .data:0x80511B18; // type:object size:0xC +__vt__14dFlowMgrBase_c = .data:0x80511B24; // type:object size:0xC ActorLytBase__vtable = .data:0x80511B30; // type:object size:0x50 lbl_80511B80 = .data:0x80511B80; // type:object size:0x1C lbl_80511B9C = .data:0x80511B9C; // type:object size:0xC @@ -33474,7 +33474,7 @@ lbl_8051EB30 = .data:0x8051EB30; // type:object size:0xC lbl_8051EB3C = .data:0x8051EB3C; // type:object size:0x1C lbl_8051EB58 = .data:0x8051EB58; // type:object size:0x1C lbl_8051EB74 = .data:0x8051EB74; // type:object size:0xC -lbl_8051EB80 = .data:0x8051EB80; // type:object size:0xC +lbl_8051EB80 = .data:0x8051EB80; // type:object size:0xA data:string lbl_8051EB8C = .data:0x8051EB8C; // type:object size:0x10 lbl_8051EB9C = .data:0x8051EB9C; // type:object size:0x10 lbl_8051EBAC = .data:0x8051EBAC; // type:object size:0x10 diff --git a/configure.py b/configure.py index 920ba14f..8aca9664 100644 --- a/configure.py +++ b/configure.py @@ -488,6 +488,7 @@ config.libs = [ Object(Matching, "d/flag/flag_managers.cpp"), Object(NonMatching, "toBeSorted/bigboss_model_math_stuff.cpp"), Object(NonMatching, "toBeSorted/actor_event_flow_manager_related.cpp"), + Object(NonMatching, "toBeSorted/d_flow_mgr.cpp"), Object(NonMatching, "d/d_lyt_base.cpp"), Object(NonMatching, "toBeSorted/unk_npc_path_stuff_1.cpp"), Object(NonMatching, "toBeSorted/unk_npc_path_stuff_2.cpp"), diff --git a/include/d/d_cs_game.h b/include/d/d_cs_game.h index 0498a9a7..b8dd9831 100644 --- a/include/d/d_cs_game.h +++ b/include/d/d_cs_game.h @@ -431,6 +431,10 @@ public: mNextCursorActive = false; } + dCursorHitCheck_c *getCursorHit() const { + return mCursorIf.getHit(); + } + private: static dCsGame_c *sInstance; bool isForcedHidden() const; diff --git a/include/d/lyt/d_lyt_map.h b/include/d/lyt/d_lyt_map.h index 95865bcb..7b420a56 100644 --- a/include/d/lyt/d_lyt_map.h +++ b/include/d/lyt/d_lyt_map.h @@ -95,14 +95,20 @@ struct LytMap0x80520B5C { bool field_0x05; }; -struct LytMapFourAnimGroups { - /* 0x00 */ d2d::AnmGroup_c mGroup1; - /* 0x40 */ d2d::AnmGroup_c mGroup2; - /* 0x80 */ d2d::AnmGroup_c mGroup3; - /* 0xC0 */ d2d::AnmGroup_c mGroup4; +struct dLytMapFloorBtnAnmGroups { + /* 0x00 */ d2d::AnmGroup_c mLoop; + /* 0x40 */ d2d::AnmGroup_c mOnOff; + /* 0x80 */ d2d::AnmGroup_c mDecide; + /* 0xC0 */ d2d::AnmGroup_c mOnOffLight; }; -// Size 0x1E0 +// Ostensibly a bounding box for lyt elements +struct LytMapTwoVecs { + /* 0x00 */ mVec3_c field_0x00; + /* 0x0C */ mVec3_c field_0x0C; +}; + +/** 2D UI - Map - a placed down beacon */ class dLytMapPinIcon_c { public: friend class dLytMapPinIconAggregate_c; @@ -111,12 +117,12 @@ public: : mStateMgr(*this, sStateID::null), mpBounding(nullptr), field_0x1BC(0), - field_0x1C0(0.0f, 0.0f, 0.0f), - field_0x1CC(0), + mPosition(0.0f, 0.0f, 0.0f), + mIsSet(false), field_0x1D0(nullptr), field_0x1D4(0), mIndex(0), - field_0x1DC(0) {} + mLoopFrame(0) {} virtual ~dLytMapPinIcon_c(); bool build(d2d::ResAccIf_c *resAcc); @@ -124,7 +130,10 @@ public: bool draw(); bool execute(); - void fn_8012EC30(); + void updatePosition(); + void checkPointedAt(); + void setPosition(const mVec3_c &pos); + void setScale(f32 scale); bool isSelect() const { return *mStateMgr.getStateID() == dLytMapPinIcon_c::StateID_ToSelect || @@ -144,56 +153,71 @@ public: private: void removeBeacon(); + dLytMapGlobal_c *getGlobal() const; + /* 0x004 */ UI_STATE_MGR_DECLARE(dLytMapPinIcon_c); /* 0x040 */ d2d::LytBase_c mLyt; /* 0x0D0 */ d2d::AnmGroup_c mAnmGroups[3]; /* 0x190 */ dCursorHitCheckLyt_c mCsHitCheck; /* 0x1B8 */ nw4r::lyt::Bounding *mpBounding; /* 0x1BC */ UNKWORD field_0x1BC; - /* 0x1C0 */ mVec3_c field_0x1C0; - /* 0x1CC */ u8 field_0x1CC; + /* 0x1C0 */ mVec3_c mPosition; + /* 0x1CC */ bool mIsSet; /* 0x1D0 */ LytMap0x80520B5C *field_0x1D0; /* 0x1D4 */ UNKWORD field_0x1D4; /* 0x1D8 */ s32 mIndex; - /* 0x1DC */ UNKWORD field_0x1DC; + /* 0x1DC */ UNKWORD mLoopFrame; }; class dLytMapPinIconAggregate_c { public: dLytMapPinIconAggregate_c() : mStateMgr(*this, sStateID::null) { field_0x9A0 = nullptr; - field_0x9A4 = 0; - field_0x9A8 = 0; + mLoopFrame = 0; + mLoopFrameMax = 0; for (int i = 0; i < 5; i++) { mPins[i].mIndex = i; } } virtual ~dLytMapPinIconAggregate_c() {} + bool build(d2d::ResAccIf_c *resAcc); bool remove(); + bool execute(); + bool draw(); + + void setScale(f32 scale); + void updatePosition(); + void setUnk(LytMap0x80520B5C *unk); + bool setPosition(s32 index, const mVec3_c &position); + void unsetAll(); + s32 getNumSetPins() const; STATE_FUNC_DECLARE(dLytMapPinIconAggregate_c, Wait); STATE_FUNC_DECLARE(dLytMapPinIconAggregate_c, Select); STATE_FUNC_DECLARE(dLytMapPinIconAggregate_c, Remove); private: + bool findNewBeaconId(s32 *pOutId); + /* 0x004 */ UI_STATE_MGR_DECLARE(dLytMapPinIconAggregate_c); /* 0x040 */ dLytMapPinIcon_c mPins[5]; /* 0x9A0 */ LytMap0x80520B5C *field_0x9A0; - /* 0x9A4 */ UNKWORD field_0x9A4; - /* 0x9A8 */ UNKWORD field_0x9A8; + /* 0x9A4 */ s32 mLoopFrame; + /* 0x9A8 */ s32 mLoopFrameMax; }; // Size 0x50 class dLytMapFloorBtn_c { + friend class dLytMapFloorBtnMgr_c; public: dLytMapFloorBtn_c() : mStateMgr(*this, sStateID::null), - field_0x3C(0), - field_0x40(0), + mpOwnerLyt(nullptr), + mpAnmGroups(nullptr), field_0x44(0), - field_0x48(0), + mpBounding(nullptr), field_0x4C(0), field_0x4D(0) {} ~dLytMapFloorBtn_c() {} @@ -208,12 +232,17 @@ public: STATE_FUNC_DECLARE(dLytMapFloorBtn_c, SelectInDecide); STATE_FUNC_DECLARE(dLytMapFloorBtn_c, DecideToSelectInDecide); + void init(); + void execute(); + + bool build(d2d::ResAccIf_c *resAcc); + private: /* 0x00 */ UI_STATE_MGR_DECLARE(dLytMapFloorBtn_c); - /* 0x3C */ UNKWORD field_0x3C; - /* 0x40 */ UNKWORD field_0x40; + /* 0x3C */ d2d::LytBase_c *mpOwnerLyt; + /* 0x40 */ dLytMapFloorBtnAnmGroups *mpAnmGroups; /* 0x44 */ UNKWORD field_0x44; - /* 0x48 */ UNKWORD field_0x48; + /* 0x48 */ nw4r::lyt::Bounding *mpBounding; /* 0x4C */ u8 field_0x4C; /* 0x4D */ u8 field_0x4D; }; @@ -221,7 +250,7 @@ private: class dLytMapFloorBtnMgr_c : public d2d::dSubPane { public: dLytMapFloorBtnMgr_c(dLytMapGlobal_c *global) - : mpGlobal(global), field_0x51C(nullptr), mStateMgr(*this, sStateID::null) { + : mpGlobal(global), mpPane(nullptr), mStateMgr(*this, sStateID::null) { field_0x700 = 1; field_0x704 = 0; field_0x708 = 0; @@ -253,8 +282,8 @@ private: /* 0x00C */ UI_STATE_MGR_DECLARE(dLytMapFloorBtnMgr_c); /* 0x048 */ d2d::dLytSub mLyt; /* 0x0DC */ d2d::AnmGroup_c mAnmGroups[1]; - /* 0x11C */ LytMapFourAnimGroups mMoreGroups[4]; - /* 0x51C */ void *field_0x51C; + /* 0x11C */ dLytMapFloorBtnAnmGroups mBtnGroups[4]; + /* 0x51C */ nw4r::lyt::Pane *mpPane; /* 0x520 */ dCursorHitCheckLyt_c mCsHitChecks[4]; /* 0x5C0 */ dLytMapFloorBtn_c mFloorBtns[4]; /* 0x700 */ UNKWORD field_0x700; @@ -295,6 +324,7 @@ public: private: /* 0x00 */ UI_STATE_MGR_DECLARE(dLytMapSavePopupAction_c); + /* 0x3C */ u8 _0x3C[0x44 - 0x3C]; /* 0x44 */ f32 field_0x44; /* 0x48 */ u8 field_0x48; }; @@ -302,12 +332,15 @@ private: // Assumed name class dLytMapSavePopup_c { public: - dLytMapSavePopup_c() {} + dLytMapSavePopup_c() : field_0x4A0(0), field_0x4A4(0), field_0x4A8(-1) {} private: /* 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; }; class dLytMapSaveCaption_c { @@ -345,21 +378,31 @@ private: /* 0x18E */ u8 field_0x18E; }; +// TODO, name made up class dLytMapDecoration_c { public: dLytMapDecoration_c() {} virtual ~dLytMapDecoration_c() {} - // TODO, name made up }; -class dLytMapPutIcon { +/** 2D UI - Map - beacon preview icon following the cursor */ +class dLytMapPutIcon_c { public: - dLytMapPutIcon() {} - virtual ~dLytMapPutIcon() {} - // TODO, name made up + dLytMapPutIcon_c() {} + virtual ~dLytMapPutIcon_c() {} + void build(d2d::ResAccIf_c *resAcc); + void remove(); + void execute(); + void draw(); + + void setPosition(const mVec2_c &pos); + void setScale(f32 scale); + +private: /* 0x04 */ d2d::LytBase_c mLyt; - /* 0x98 */ mVec2_c field_0x98; + /* 0x94 */ bool mVisible; + /* 0x95 */ u8 _0x95[0x9C - 0x95]; }; class dLytMapMain_c : public m2d::Base_c { @@ -421,8 +464,7 @@ public: private: /* 0x0010 */ UI_STATE_MGR_DECLARE(dLytMapMain_c); - /* 0x004C */ dFlowMgr_c mFlowMgr; - /* 0x0058 */ u8 _0x0058[0x00A4 - 0x0058]; + /* 0x004C */ dFlowMgrBase_c mFlowMgr; /* 0x00A4 */ dFlow_c mFlow; /* 0x0108 */ u8 _0x0108[0x010C - 0x0108]; /* 0x010C */ d2d::LytBase_c mLyt; @@ -438,16 +480,13 @@ private: /* 0x64C0 */ dLytMapFootPrints_c mFootPrints; - /* 0x6664 */ dLytMapPutIcon mPutIcon; + /* 0x6664 */ dLytMapPutIcon_c mPutIcon; /* 0x6700 */ u8 _0x6700[0x6704 - 0x6700]; /* 0x6704 */ dLytMapSaveObj_c mSaveObjs[12]; /* 0x79C4 */ dLytMapSaveCaption_c mSaveCaption; /* 0x7BD0 */ dLytMapSavePopup_c mSavePopup; - - /* 0x8010 */ u8 _0x7F84[0x807C - 0x8010]; - /* 0x807C */ dLytMapPopupInfo_c mPopupInfo; /* 0x8208 */ u8 _0x8208[0x828C - 0x8208]; @@ -456,6 +495,9 @@ private: /* 0x831C */ u8 _0x831C[0x832C - 0x831C]; + // TODO - it appears the map abuses these hit check things + // to calculate Lyt bounding boxes, and it stores the + // results in 0x8948... /* 0x832C */ dCursorHitCheckLyt_c field_0x832C[33]; /* 0x8854 */ u8 _0x8854[0x8904 - 0x8854]; @@ -467,8 +509,10 @@ private: /* 0x8930 */ mVec3_c field_0x8930; /* 0x893C */ mVec3_c field_0x893C; - /* 0x8948 */ u8 _0x8948[0x8C94 - 0x8948]; - + /* 0x8948 */ LytMapTwoVecs field_0x8948[33]; + + /* 0x8C60 */ u8 _0x8C60[0x8C94 - 0x8C60]; + /* 0x8C94 */ s32 field_0x8C94; /* 0x8C98 */ u8 _0x8C98[0x8CC4 - 0x8C98]; diff --git a/include/d/lyt/d_lyt_map_global.h b/include/d/lyt/d_lyt_map_global.h index 7480478d..a9b742a5 100644 --- a/include/d/lyt/d_lyt_map_global.h +++ b/include/d/lyt/d_lyt_map_global.h @@ -1,12 +1,16 @@ #ifndef D_LYT_MAP_GLOBAL_H #define D_LYT_MAP_GLOBAL_H +#include "common.h" #include "m/m_angle.h" #include "m/m_vec.h" class dLytMapGlobal_c { public: dLytMapGlobal_c(); + ~dLytMapGlobal_c() { + sInstance = nullptr; + } enum MapMode_e { MAPMODE_WORLD = 0, @@ -21,11 +25,11 @@ public: return sInstance; } - const mVec2_c& getField_0x20() const { + const mVec2_c &getField_0x20() const { return field_0x20; } - const mVec3_c& getPlayerPos() const { + const mVec3_c &getPlayerPos() const { return mPlayerPosition; } diff --git a/include/toBeSorted/d_beacon.h b/include/toBeSorted/d_beacon.h new file mode 100644 index 00000000..71631457 --- /dev/null +++ b/include/toBeSorted/d_beacon.h @@ -0,0 +1,14 @@ +#ifndef D_BEACON_H +#define D_BEACON_H + +#include "m/m_vec.h" + +u32 getBeaconCount(); + +/** + * When passed a position, sets the beacon with the given index to the position. + * When position is nullptr, removes the beacon. + */ +void setBeaconPosition(const mVec3_c *position, u32 beaconIndex); + +#endif diff --git a/include/toBeSorted/d_flow_mgr.h b/include/toBeSorted/d_flow_mgr.h index 2c7e1c9f..e1834154 100644 --- a/include/toBeSorted/d_flow_mgr.h +++ b/include/toBeSorted/d_flow_mgr.h @@ -2,17 +2,27 @@ #define D_FLOW_MGR_H #include "common.h" +#include "d/d_message.h" +#include "sized_string.h" -class dFlow_c; - -class dFlowMgr_c { +class dFlowMgrBase_c { public: - dFlowMgr_c(dFlow_c *flow); - virtual ~dFlowMgr_c() {} + dFlowMgrBase_c(dFlow_c *flow); + virtual ~dFlowMgrBase_c() {} private: /* 0x04 */ dFlow_c *mpFlow; - /* 0x08 */ u8 field_0x05; + /* 0x08 */ u8 _0x08[0x14 - 0x08]; + /* 0x14 */ SizedString<0x40> field_0x14; + /* 0x54 */ u8 field_0x54; +}; + +class dFlowMgr_c : public dFlowMgrBase_c { +public: + dFlowMgr_c(); + +private: + /* 0x58 */ dFlow_c mFlow; }; #endif diff --git a/src/d/lyt/d_lyt_map.cpp b/src/d/lyt/d_lyt_map.cpp index 5cd9fcbb..cf2c122a 100644 --- a/src/d/lyt/d_lyt_map.cpp +++ b/src/d/lyt/d_lyt_map.cpp @@ -2,6 +2,8 @@ #include "common.h" #include "d/a/d_a_player.h" +#include "d/d_cs_base.h" +#include "d/d_cs_game.h" #include "d/d_cursor_hit_check.h" #include "d/d_d2d.h" #include "d/d_pad.h" @@ -14,9 +16,11 @@ #include "egg/core/eggColorFader.h" #include "m/m_vec.h" #include "m/m_video.h" +#include "nw4r/lyt/lyt_bounding.h" #include "nw4r/lyt/lyt_pane.h" #include "sized_string.h" #include "toBeSorted/arc_managers/layout_arc_manager.h" +#include "toBeSorted/d_beacon.h" struct dLytMap_HIO_c { dLytMap_HIO_c(); @@ -83,6 +87,10 @@ dLytMap_HIO_c::dLytMap_HIO_c() { dLytMap_HIO_c::~dLytMap_HIO_c() {} +inline mVec3_c vec2ToVec3XY(const mVec2_c &v) { + return mVec3_c(v.x, v.y, 0.0f); +} + void dMapFootPrintsQueue_c::init() { int j = ARRAY_LENGTH(mEntries) - 1; for (int i = 0; i < (int)ARRAY_LENGTH(mEntries); i++) { @@ -140,8 +148,6 @@ void dMapFootPrintsMgr_c::execute() { } } -// here seems to be mAng::mAng(s16) { ... } - dLytMapFootPrints_c::dLytMapFootPrints_c(dLytMapGlobal_c *global) : mpGlobal(global), mpPane(nullptr), @@ -224,8 +230,6 @@ bool dLytMapFootPrints_c::execute() { return true; } -// here seems to be mVec2_c::mVec2_c(f32, f32) { ... } - void dLytMapFootPrints_c::draw() { if (!field_0x1A0) { return; @@ -244,11 +248,13 @@ void dLytMapFootPrints_c::draw() { mVec2_c scaleV = mVec2_c(scale, scale); mpPane->SetScale(scaleV); + // rgb(104, 222, 222) + // rgb(0, 255, 255) f32 globalAlphaF = globalAlpha; for (int i = 0; i < mCurrentNumSteps; i++) { mVec2_c pos = mVec2_c(global->getField_0x20() + mFootprintPositions[i]); - pane->SetTranslate(mVec3_c(pos.x, pos.y, 0.0f)); + pane->SetTranslate(vec2ToVec3XY(pos)); // TODO - FPR regswaps, maybe fewer temps would work f32 constantAlpha = sHio.mFootstepsAlpha / 255.0f; @@ -262,6 +268,36 @@ void dLytMapFootPrints_c::draw() { } } +void dLytMapPutIcon_c::build(d2d::ResAccIf_c *resAcc) { + mLyt.setResAcc(resAcc); + mLyt.build("mapPutIcon_00.brlyt", nullptr); + mVisible = true; + mLyt.calc(); +} + +void dLytMapPutIcon_c::remove() { + // no-op +} + +void dLytMapPutIcon_c::execute() { + mLyt.calc(); +} + +void dLytMapPutIcon_c::draw() { + if (mVisible) { + mLyt.draw(); + } +} + +void dLytMapPutIcon_c::setPosition(const mVec2_c &pos) { + mVec3_c pos3 = vec2ToVec3XY(mVec2_c(pos)); + mLyt.getLayout()->GetRootPane()->SetTranslate(pos3); +} + +void dLytMapPutIcon_c::setScale(f32 scale) { + mLyt.getLayout()->GetRootPane()->SetScale(mVec2_c(scale, scale)); +} + STATE_DEFINE(dLytMapPinIcon_c, Wait); STATE_DEFINE(dLytMapPinIcon_c, ToSelect); STATE_DEFINE(dLytMapPinIcon_c, Select); @@ -383,7 +419,7 @@ void dLytMapPinIcon_c::executeState_Wait() { return; } - if (field_0x1CC == 0) { + if (!mIsSet) { return; } @@ -451,12 +487,76 @@ void dLytMapPinIcon_c::executeState_Remove() { } void dLytMapPinIcon_c::finalizeState_Remove() {} +void dLytMapPinIcon_c::updatePosition() { + dLytMapGlobal_c *global = getGlobal(); + if (mIsSet) { + mVec2_c pos2d; + global->projectOntoMap(pos2d, mPosition); + pos2d += global->getField_0x20(); + mVec3_c translate3d = vec2ToVec3XY(pos2d); + mLyt.getLayout()->GetRootPane()->SetTranslate(translate3d); + } + + bool vis = mIsSet; + mLyt.getLayout()->GetRootPane()->SetVisible(mIsSet); + if (mpBounding != nullptr) { + mpBounding->SetVisible(vis); + } + + mLyt.getLayout()->GetRootPane()->SetAlpha(global->getAlpha()); + mLyt.getLayout()->GetRootPane()->SetInfluencedAlpha(true); + mLyt.calc(); +} + +void dLytMapPinIcon_c::checkPointedAt() { + field_0x1BC = 0; + dCursorHitCheck_c *chk = dCsGame_c::GetInstance()->getCursorHit(); + if (chk != nullptr && chk->getType() == 'lyt ' && + static_cast(chk)->getHitPane() == mpBounding) { + field_0x1BC = 1; + } +} + +void dLytMapPinIcon_c::setPosition(const mVec3_c &pos) { + d2d::AnmGroup_c *anm; + + mPosition = pos; + dLytMapGlobal_c *global = getGlobal(); + mVec2_c pos2d; + global->projectOntoMap(pos2d, pos); + pos2d += global->getField_0x20(); + mVec3_c translate3d = vec2ToVec3XY(mVec2_c(pos2d)); + + mLyt.getLayout()->GetRootPane()->SetTranslate(translate3d); + mLyt.getLayout()->GetRootPane()->SetVisible(true); + + anm = &mAnmGroups[LYT_MAP_PIN_ICON_ANIM_ERASE]; + + anm->bind(false); + anm->setFrame(0.0f); + mLyt.calc(); + anm->unbind(); + mIsSet = true; +} + +void dLytMapPinIcon_c::removeBeacon() { + mIsSet = false; + if (mpBounding != nullptr) { + mpBounding->SetVisible(false); + } + setBeaconPosition(nullptr, mIndex); +} + dLytMapPinIcon_c::~dLytMapPinIcon_c() { if (dCsMgr_c::GetInstance()->isRegist(&mCsHitCheck)) { dCsMgr_c::GetInstance()->unregistCursorTarget(&mCsHitCheck); } } +dLytMapGlobal_c *dLytMapPinIcon_c::getGlobal() const { + return dLytMapGlobal_c::GetInstance(); +} + static const d2d::LytBrlanMapping sMapPinIconBrlanMap[] = { {"mapPutIcon_00_scale.brlan", "G_scale_00"}, {"mapPutIcon_00_erase.brlan", "G_scale_00"}, @@ -492,8 +592,8 @@ bool dLytMapPinIcon_c::build(d2d::ResAccIf_c *resAcc) { mStateMgr.changeState(StateID_Wait); field_0x1BC = 0; - field_0x1CC = 0; - field_0x1DC = 0; + mIsSet = false; + mLoopFrame = 0; return true; } @@ -505,12 +605,28 @@ bool dLytMapPinIcon_c::remove() { return true; } +void dLytMapPinIcon_c::setScale(f32 scale) { + // TODO - probably inlines + f32 frame = mAnmGroups[LYT_MAP_PIN_ICON_ANIM_SCALE].getLastFrame(); + d2d::AnmGroup_c *grp = &mAnmGroups[LYT_MAP_PIN_ICON_ANIM_SCALE]; + grp->setFrame(scale * frame); + mLyt.calc(); +} + bool dLytMapPinIcon_c::execute() { - fn_8012EC30(); + checkPointedAt(); mStateMgr.executeState(); field_0x1BC = 0; - mAnmGroups[LYT_MAP_PIN_ICON_ANIM_LOOP].setFrame(field_0x1DC); - // TODO something MapCapture + d2d::AnmGroup_c *grp = &mAnmGroups[LYT_MAP_PIN_ICON_ANIM_LOOP]; + grp->setFrame(mLoopFrame); + + // TODO - probably inlines + dLytMapGlobal_c *global = getGlobal(); + f32 frame = mAnmGroups[LYT_MAP_PIN_ICON_ANIM_SCALE].getLastFrame(); + grp = &mAnmGroups[LYT_MAP_PIN_ICON_ANIM_SCALE]; + f32 tmp = global->getZoomFrame(); + grp->setFrame(tmp * frame); + mLyt.calc(); mCsHitCheck.resetCachedHitboxes(); mCsHitCheck.execute(); @@ -567,6 +683,118 @@ void dLytMapPinIconAggregate_c::executeState_Remove() { } void dLytMapPinIconAggregate_c::finalizeState_Remove() {} +bool dLytMapPinIconAggregate_c::findNewBeaconId(s32 *pOutId) { + bool ret = false; + for (s32 idx = 0; idx < getBeaconCount(); idx++) { + s32 existingIndex = mPins[idx].mIndex; + if (!mPins[idx].mIsSet) { + // If we have an unused id, use that + *pOutId = idx; + ret = true; + break; + } + + // Otherwise use the lowest id ("oldest beacon"?) + if (existingIndex < *pOutId) { + *pOutId = existingIndex; + } + } + + return ret; +} + +void dLytMapPinIconAggregate_c::setScale(f32 scale) { + for (int idx = 0; idx < (int)ARRAY_LENGTH(mPins); idx++) { + mPins[idx].setScale(scale); + } +} + +void dLytMapPinIconAggregate_c::updatePosition() { + for (int idx = 0; idx < (int)ARRAY_LENGTH(mPins); idx++) { + mPins[idx].updatePosition(); + } +} + +void dLytMapPinIconAggregate_c::setUnk(LytMap0x80520B5C *unk) { + field_0x9A0 = unk; + for (int idx = 0; idx < (int)ARRAY_LENGTH(mPins); idx++) { + mPins[idx].field_0x1D0 = unk; + } +} + +bool dLytMapPinIconAggregate_c::setPosition(s32 index, const mVec3_c &position) { + bool ret = false; + for (int idx = 0; idx < (int)ARRAY_LENGTH(mPins); idx++) { + if (mPins[idx].mIndex == index) { + mPins[idx].setPosition(position); + ret = true; + break; + } + } + return ret; +} + +void dLytMapPinIconAggregate_c::unsetAll() { + for (int idx = 0; idx < (int)ARRAY_LENGTH(mPins); idx++) { + mPins[idx].mIsSet = false; + } +} + +s32 dLytMapPinIconAggregate_c::getNumSetPins() const { + s32 num = 0; + for (int idx = 0; idx < (int)ARRAY_LENGTH(mPins); idx++) { + if (mPins[idx].mIsSet) { + num++; + } + } + return num; +} + +bool dLytMapPinIconAggregate_c::build(d2d::ResAccIf_c *resAcc) { + for (int idx = 0; idx < (int)ARRAY_LENGTH(mPins); idx++) { + mPins[idx].build(resAcc); + } + mLoopFrame = 0; + mLoopFrameMax = mPins[0].mAnmGroups[LYT_MAP_PIN_ICON_ANIM_LOOP].getAnimDuration(); + mStateMgr.changeState(StateID_Wait); + return true; +} + +bool dLytMapPinIconAggregate_c::remove() { + for (int idx = 0; idx < (int)ARRAY_LENGTH(mPins); idx++) { + mPins[idx].remove(); + } + return true; +} + +bool dLytMapPinIconAggregate_c::execute() { + mLoopFrame++; + if (mLoopFrame > mLoopFrameMax) { + mLoopFrame = 0; + } + for (int idx = 0; idx < (int)ARRAY_LENGTH(mPins); idx++) { + mPins[idx].mLoopFrame = mLoopFrame; + mPins[idx].execute(); + } + mStateMgr.executeState(); + return true; +} + +bool dLytMapPinIconAggregate_c::draw() { + for (int idx = 0; idx < (int)ARRAY_LENGTH(mPins); idx++) { + mPins[idx].draw(); + } + return true; +} + +void dLytMapFloorBtn_c::init() { + mStateMgr.changeState(StateID_Wait); +} + +void dLytMapFloorBtn_c::execute() { + mStateMgr.executeState(); +} + void dLytMapFloorBtn_c::initializeState_Wait() {} void dLytMapFloorBtn_c::executeState_Wait() {} void dLytMapFloorBtn_c::finalizeState_Wait() {} @@ -603,6 +831,196 @@ void dLytMapFloorBtn_c::initializeState_DecideToSelectInDecide() {} void dLytMapFloorBtn_c::executeState_DecideToSelectInDecide() {} void dLytMapFloorBtn_c::finalizeState_DecideToSelectInDecide() {} +static const d2d::LytBrlanMapping brlanMapFloorBtnMgr[] = { + {"mapFloorBtn_00_btnV.brlan", "G_btnV_00"}, +}; + +#define MAP_FLOOR_BTN_MGR_ANIM_BTNV 0 +#define MAP_FLOOR_BTN_MGR_NUM_ANIMS 1 + +static const char *brlanListFloorBtn[] = { + "mapFloorBtn_00_btnLoop.brlan", + "mapFloorBtn_00_btnOnOffNormal.brlan", + "mapFloorBtn_00_btnDecideNormal.brlan", + "mapFloorBtn_00_btnOnOffLight.brlan", +}; + +static const char *groupListFloorBtn[][4] = { + {"G_btnLoop_00", "G_btn_00", "G_btn_00", "G_btn_00"}, + {"G_btnLoop_01", "G_btn_01", "G_btn_01", "G_btn_01"}, + {"G_btnLoop_02", "G_btn_02", "G_btn_02", "G_btn_02"}, + {"G_btnLoop_03", "G_btn_03", "G_btn_03", "G_btn_03"}, +}; + +static const char *sFloorBtnBoundings[] = { + "B_choices_00", + "B_choices_01", + "B_choices_02", + "B_choices_03", +}; + +#define MAP_FLOOR_BTN_MGR_NUM_BTNS 4 + +bool dLytMapFloorBtnMgr_c::build(d2d::ResAccIf_c *resAcc) { + mLyt.setResAcc(resAcc); + mLyt.build("mapFloorBtn_00.brlyt", nullptr); + + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_ANIMS; i++) { + mAnmGroups[i].init(brlanMapFloorBtnMgr[i].mFile, resAcc, mLyt.getLayout(), brlanMapFloorBtnMgr[i].mName); + } + + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + mBtnGroups[i].mLoop.init(brlanListFloorBtn[0], resAcc, mLyt.getLayout(), groupListFloorBtn[i][0]); + mBtnGroups[i].mOnOff.init(brlanListFloorBtn[1], resAcc, mLyt.getLayout(), groupListFloorBtn[i][1]); + mBtnGroups[i].mDecide.init(brlanListFloorBtn[2], resAcc, mLyt.getLayout(), groupListFloorBtn[i][2]); + mBtnGroups[i].mOnOffLight.init(brlanListFloorBtn[3], resAcc, mLyt.getLayout(), groupListFloorBtn[i][3]); + } + + nw4r::lyt::Bounding *bounding; + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + bounding = mLyt.findBounding(sFloorBtnBoundings[i]); + mFloorBtns[i].init(); + mFloorBtns[i].mpBounding = bounding; + bounding->SetVisible(false); + mCsHitChecks[i].init(bounding, 0x2, 0, 0); + dCsMgr_c::GetInstance()->registCursorTarget(&mCsHitChecks[i]); + } + + mpPane = mLyt.findPane("N_all_00"); + mpPane->SetInfluencedAlpha(true); + + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + mFloorBtns[i].mpOwnerLyt = &mLyt; + mFloorBtns[i].mpAnmGroups = &mBtnGroups[i]; + } + + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + mBtnGroups[i].mOnOff.bind(false); + mBtnGroups[i].mOnOff.setFrame(0.0f); + } + + mLyt.getLayout()->Animate(0); + + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + mBtnGroups[i].mOnOff.unbind(); + } + + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + mBtnGroups[i].mLoop.bind(false); + } + + mLyt.calc(); + + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + mCsHitChecks[i].resetCachedHitboxes(); + mCsHitChecks[i].execute(); + } + + field_0x710 = 0; + field_0x711 = 0; + + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + mFloorBtns[i].field_0x4C = 0; + } + + mStateMgr.changeState(StateID_Invisible); + + return true; +} + +bool dLytMapFloorBtnMgr_c::remove() { + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + dCsMgr_c::GetInstance()->unregistCursorTarget(&mCsHitChecks[i]); + } + + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + mBtnGroups[i].mOnOff.remove(); + mBtnGroups[i].mLoop.remove(); + mBtnGroups[i].mDecide.remove(); + mBtnGroups[i].mOnOffLight.remove(); + } + // not removing our own anm group... + + dPadNav::setNavEnabled(false, false); + + return true; +} + +bool dLytMapFloorBtnMgr_c::execute() { + field_0x70C = 4; + if (*mStateMgr.getStateID() != StateID_Invisible) { + if (field_0x710) { + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + mFloorBtns[i].execute(); + } + mStateMgr.executeState(); + } else { + // Determine the currently active floor + s32 activeBtn = 0; + s32 direction = dPadNav::getFSStickNavDirection(); + if (field_0x710 != field_0x711) { + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + if (mFloorBtns[i].field_0x4D) { + activeBtn = i; + } + } + } else { + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + if (mFloorBtns[i].field_0x4C) { + activeBtn = i; + } + } + } + + // Handle navigation + if (activeBtn > 0 && (direction == dPadNav::FS_STICK_UP || direction == dPadNav::FS_STICK_UP_RIGHT || + direction == dPadNav::FS_STICK_UP_LEFT)) { + activeBtn--; + } + + if (activeBtn < field_0x700 - 1 && + (direction == dPadNav::FS_STICK_DOWN || direction == dPadNav::FS_STICK_DOWN_RIGHT || + direction == dPadNav::FS_STICK_DOWN_LEFT)) { + activeBtn++; + } + + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + if (i == activeBtn) { + mFloorBtns[i].field_0x4C = 1; + if (dCsBase_c::GetInstance() != nullptr) { + dCsBase_c::GetInstance()->setCursorStickTargetPane(mFloorBtns[i].mpBounding); + } + } else { + mFloorBtns[i].field_0x4C = 0; + } + } + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + mFloorBtns[i].execute(); + } + } + + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + mBtnGroups[i].mLoop.play(); + if (mBtnGroups[i].mOnOff.isBound()) { + mBtnGroups[i].mOnOff.play(); + } + if (mBtnGroups[i].mDecide.isBound()) { + mBtnGroups[i].mDecide.play(); + } + if (mBtnGroups[i].mOnOffLight.isBound()) { + mBtnGroups[i].mOnOffLight.play(); + } + } + } + mLyt.calc(); + for (int i = 0; i < MAP_FLOOR_BTN_MGR_NUM_BTNS; i++) { + mCsHitChecks[i].resetCachedHitboxes(); + mCsHitChecks[i].execute(); + } + + return true; +} + void dLytMapFloorBtnMgr_c::initializeState_Invisible() {} void dLytMapFloorBtnMgr_c::executeState_Invisible() {} void dLytMapFloorBtnMgr_c::finalizeState_Invisible() {} @@ -708,7 +1126,13 @@ dLytMapMain_c::dLytMapMain_c() field_0x8D68(0) {} #pragma dont_inline reset -dLytMapMain_c::~dLytMapMain_c() {} +dLytMapMain_c::~dLytMapMain_c() { + for (int i = 0; i < (int)ARRAY_LENGTH(field_0x832C); i++) { + if (dCsMgr_c::GetInstance()->isRegist(&field_0x832C[i])) { + dCsMgr_c::GetInstance()->unregistCursorTarget(&field_0x832C[i]); + } + } +} void dLytMapMain_c::draw() {} diff --git a/src/toBeSorted/d_flow_mgr.cpp b/src/toBeSorted/d_flow_mgr.cpp new file mode 100644 index 00000000..b7b073ab --- /dev/null +++ b/src/toBeSorted/d_flow_mgr.cpp @@ -0,0 +1,5 @@ +#include "toBeSorted/d_flow_mgr.h" + +dFlowMgrBase_c::dFlowMgrBase_c(dFlow_c *flow): mpFlow(flow) {} + +dFlowMgr_c::dFlowMgr_c() : dFlowMgrBase_c(&mFlow) {}