diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 2bf566c0..3052cd3b 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -2484,7 +2484,7 @@ getLinkSoundRelated = .text:0x8005BDA0; // type:function size:0xC fn_8005BDB0 = .text:0x8005BDB0; // type:function size:0xE8 unsetRegionBasedFlagsMaybe = .text:0x8005BEA0; // type:function size:0x100 getEarringsColor__17daPlayerActBase_cFv = .text:0x8005BFA0; // type:function size:0xB0 -getLinkTunicSubtype = .text:0x8005C050; // type:function size:0xC +getCurrentTunicType__17daPlayerActBase_cFv = .text:0x8005C050; // type:function size:0xC getCurrentSwordType = .text:0x8005C060; // type:function size:0xAC updateCurrentSword__17daPlayerActBase_cFv = .text:0x8005C110; // type:function size:0x24 doesPlayerHaveSword = .text:0x8005C140; // type:function size:0x1C @@ -7759,21 +7759,21 @@ __dt__94sStateMgr_c<25dLytMapPinIconAggregate_c,20sStateMethodUsr_FI_c,12sFState __dt__64sFStateMgr_c<25dLytMapPinIconAggregate_c,20sStateMethodUsr_FI_c>Fv = .text:0x801346D0; // type:function size:0xA4 __ct__16dLytMapPinIcon_cFv = .text:0x80134780; // type:function size:0x134 __dt__25dLytMapPinIconAggregate_cFv = .text:0x801348C0; // type:function size:0xCC -fn_80134990 = .text:0x80134990; // type:function size:0x464 -fn_80134E00 = .text:0x80134E00; // type:function size:0x74 -fn_80134E80 = .text:0x80134E80; // type:function size:0x10 -fn_80134E90 = .text:0x80134E90; // type:function size:0x40 -fn_80134ED0 = .text:0x80134ED0; // type:function size:0x4 -fn_80134EE0 = .text:0x80134EE0; // type:function size:0x40 -fn_80134F20 = .text:0x80134F20; // type:function size:0x10 -fn_80134F30 = .text:0x80134F30; // type:function size:0x40 -fn_80134F70 = .text:0x80134F70; // type:function size:0xBC -fn_80135030 = .text:0x80135030; // type:function size:0x4 -fn_80135040 = .text:0x80135040; // type:function size:0x40 -fn_80135080 = .text:0x80135080; // type:function size:0x74 -fn_80135100 = .text:0x80135100; // type:function size:0x108 -fn_80135210 = .text:0x80135210; // type:function size:0x234 -fn_80135450 = .text:0x80135450; // type:function size:0x78 +__ct__16dLytMapMarkers_cFv = .text:0x80134990; // type:function size:0x464 +__dt__14dLytMapPopup_cFv = .text:0x80134E00; // type:function size:0x74 +__ct__13MapUnkStruct1Fv = .text:0x80134E80; // type:function size:0x10 +__dt__13MapUnkStruct1Fv = .text:0x80134E90; // type:function size:0x40 +__ct__13MapUnkStruct2Fv = .text:0x80134ED0; // type:function size:0x4 +__dt__13MapUnkStruct2Fv = .text:0x80134EE0; // type:function size:0x40 +__ct__13MapUnkStruct3Fv = .text:0x80134F20; // type:function size:0x10 +__dt__13MapUnkStruct3Fv = .text:0x80134F30; // type:function size:0x40 +__dt__15dLytMapIcon01_cFv = .text:0x80134F70; // type:function size:0xBC +__ct__13MapUnkStruct4Fv = .text:0x80135030; // type:function size:0x4 +__dt__13MapUnkStruct4Fv = .text:0x80135040; // type:function size:0x40 +__dt__14dLytMapPlace_cFv = .text:0x80135080; // type:function size:0x74 +__dt__15dLytMapIcon00_cFv = .text:0x80135100; // type:function size:0x108 +__dt__16dLytMapMarkers_cFv = .text:0x80135210; // type:function size:0x234 +__dt__19dLytMapFootPrints_cFv = .text:0x80135450; // type:function size:0x78 __ct__16dLytMapPutIcon_cFv = .text:0x801354D0; // type:function size:0x54 __dt__16dLytMapPutIcon_cFv = .text:0x80135530; // type:function size:0x5C __ct__16dLytMapSaveObj_cFv = .text:0x80135590; // type:function size:0xC8 @@ -9907,31 +9907,31 @@ setInout__14dLytMapPopup_cFf = .text:0x801798A0; // type:function size:0x94 setInitialState__14dLytMapPopup_cFv = .text:0x80179940; // type:function size:0xD4 updateScale__14dLytMapPopup_cFv = .text:0x80179A20; // type:function size:0xF4 checkMapMode__14dLytMapPopup_cFv = .text:0x80179B20; // type:function size:0xAC -fn_80179BD0 = .text:0x80179BD0; // type:function size:0x234 -fn_80179E10 = .text:0x80179E10; // type:function size:0x58 -fn_80179E70 = .text:0x80179E70; // type:function size:0xBC -fn_80179F30 = .text:0x80179F30; // type:function size:0xA8 -fn_80179FE0 = .text:0x80179FE0; // type:function size:0xB4 -fn_8017A0A0 = .text:0x8017A0A0; // type:function size:0x3C +build__14dLytMapPlace_cFPQ23d2d10ResAccIf_c = .text:0x80179BD0; // type:function size:0x234 +remove__14dLytMapPlace_cFv = .text:0x80179E10; // type:function size:0x58 +execute__14dLytMapPlace_cFv = .text:0x80179E70; // type:function size:0xBC +draw__14dLytMapPlace_cFv = .text:0x80179F30; // type:function size:0xA8 +setLabel__14dLytMapPlace_cFPCc = .text:0x80179FE0; // type:function size:0xB4 +realize__14dLytMapPlace_cFv = .text:0x8017A0A0; // type:function size:0x3C fn_8017A0E0 = .text:0x8017A0E0; // type:function size:0x2A8 -fn_8017A390 = .text:0x8017A390; // type:function size:0x84 +setInout__14dLytMapPlace_cFf = .text:0x8017A390; // type:function size:0x84 fn_8017A420 = .text:0x8017A420; // type:function size:0x78 -fn_8017A4A0 = .text:0x8017A4A0; // type:function size:0x94 -fn_8017A540 = .text:0x8017A540; // type:function size:0x11C -fn_8017A660 = .text:0x8017A660; // type:function size:0xF4 -fn_8017A760 = .text:0x8017A760; // type:function size:0x78 -fn_8017A7E0 = .text:0x8017A7E0; // type:function size:0x78 -fn_8017A860 = .text:0x8017A860; // type:function size:0x138 -fn_8017A9A0 = .text:0x8017A9A0; // type:function size:0x688 -fn_8017B030 = .text:0x8017B030; // type:function size:0x70 -fn_8017B0A0 = .text:0x8017B0A0; // type:function size:0x2B8 -fn_8017B360 = .text:0x8017B360; // type:function size:0x704 -fn_8017BA70 = .text:0x8017BA70; // type:function size:0x4FC +setColor__14dLytMapPlace_cFUl = .text:0x8017A4A0; // type:function size:0x94 +setInitialState__14dLytMapPlace_cFv = .text:0x8017A540; // type:function size:0x11C +updateScale__14dLytMapPlace_cFv = .text:0x8017A660; // type:function size:0xF4 +realizeText__14dLytMapPlace_cFv = .text:0x8017A760; // type:function size:0x78 +realizeTextSize__14dLytMapPlace_cFv = .text:0x8017A7E0; // type:function size:0x78 +realizeBgSize__14dLytMapPlace_cFv = .text:0x8017A860; // type:function size:0x138 +build__15dLytMapIcon01_cFPQ23d2d10ResAccIf_c = .text:0x8017A9A0; // type:function size:0x688 +remove__15dLytMapIcon01_cFv = .text:0x8017B030; // type:function size:0x70 +execute__15dLytMapIcon01_cFv = .text:0x8017B0A0; // type:function size:0x2B8 +draw__15dLytMapIcon01_cFv = .text:0x8017B360; // type:function size:0x704 +resetDrawCommands__15dLytMapIcon01_cFv = .text:0x8017BA70; // type:function size:0x4FC setMapIcons = .text:0x8017BF70; // type:function size:0x2C8 -fn_8017C240 = .text:0x8017C240; // type:function size:0x98 +setLinkTunic__15dLytMapIcon01_cFl = .text:0x8017C240; // type:function size:0x98 fn_8017C2E0 = .text:0x8017C2E0; // type:function size:0xA0 fn_8017C380 = .text:0x8017C380; // type:function size:0xA0 -forGoddessStatueOnSkyFieldMap = .text:0x8017C420; // type:function size:0x74 +setGoddessStatue__15dLytMapIcon01_cFb = .text:0x8017C420; // type:function size:0x74 fn_8017C4A0 = .text:0x8017C4A0; // type:function size:0xA0 fn_8017C540 = .text:0x8017C540; // type:function size:0x1C fn_8017C560 = .text:0x8017C560; // type:function size:0x80 @@ -9949,16 +9949,16 @@ fn_8017CAF0 = .text:0x8017CAF0; // type:function size:0xC fn_8017CB00 = .text:0x8017CB00; // type:function size:0xC fn_8017CB10 = .text:0x8017CB10; // type:function size:0xC fn_8017CB20 = .text:0x8017CB20; // type:function size:0xC -fn_8017CB30 = .text:0x8017CB30; // type:function size:0xB8 -fn_8017CBF0 = .text:0x8017CBF0; // type:function size:0xB8 -fn_8017CCB0 = .text:0x8017CCB0; // type:function size:0xAC -fn_8017CD60 = .text:0x8017CD60; // type:function size:0xAC -fn_8017CE10 = .text:0x8017CE10; // type:function size:0x150 +drawWithAnimIn = .text:0x8017CB30; // type:function size:0xB8 +drawWithAnimOut = .text:0x8017CBF0; // type:function size:0xB8 +drawFullyIn = .text:0x8017CCB0; // type:function size:0xAC +checkMapMode__15dLytMapIcon01_cFv = .text:0x8017CD60; // type:function size:0xAC +setupActorDrawCommands__15dLytMapIcon01_cFv = .text:0x8017CE10; // type:function size:0x150 fn_8017CF60 = .text:0x8017CF60; // type:function size:0xFC -fn_8017D060 = .text:0x8017D060; // type:function size:0xF4 -fn_8017D160 = .text:0x8017D160; // type:function size:0x17C -fn_8017D2E0 = .text:0x8017D2E0; // type:function size:0xB4 -fn_8017D3A0 = .text:0x8017D3A0; // type:function size:0xB4 +setupTboxDrawCommand__15dLytMapIcon01_cFP9dAcBase_c = .text:0x8017D060; // type:function size:0xF4 +setupTboxDrawCommandClosed__15dLytMapIcon01_cFP9dAcTbox_c = .text:0x8017D160; // type:function size:0x17C +setupTboxDrawCommandOpen__15dLytMapIcon01_cFP9dAcTbox_c = .text:0x8017D2E0; // type:function size:0xB4 +setupTboxDrawCommandGoddessClosed__15dLytMapIcon01_cFP9dAcTbox_c = .text:0x8017D3A0; // type:function size:0xB4 fn_8017D460 = .text:0x8017D460; // type:function size:0x3E4 fn_8017D850 = .text:0x8017D850; // type:function size:0x3F4 fn_8017DC50 = .text:0x8017DC50; // type:function size:0x398 @@ -9970,18 +9970,18 @@ fn_8017E9B0 = .text:0x8017E9B0; // type:function size:0xA20 fn_8017F3D0 = .text:0x8017F3D0; // type:function size:0x110 fn_8017F4E0 = .text:0x8017F4E0; // type:function size:0x1C0 fn_8017F6A0 = .text:0x8017F6A0; // type:function size:0x1D8 -fn_8017F880 = .text:0x8017F880; // type:function size:0xA8 +setupStageDrawCommands__15dLytMapIcon01_cFv = .text:0x8017F880; // type:function size:0xA8 fn_8017F930 = .text:0x8017F930; // type:function size:0x268 fn_8017FBA0 = .text:0x8017FBA0; // type:function size:0x954 fn_80180500 = .text:0x80180500; // type:function size:0x750 fn_80180C50 = .text:0x80180C50; // type:function size:0x1C8 fn_80180E20 = .text:0x80180E20; // type:function size:0x134 fn_80180F60 = .text:0x80180F60; // type:function size:0x240 -fn_801811A0 = .text:0x801811A0; // type:function size:0x50 +setupLinkDrawCommand__15dLytMapIcon01_cFv = .text:0x801811A0; // type:function size:0x50 fn_801811F0 = .text:0x801811F0; // type:function size:0x14C fn_80181340 = .text:0x80181340; // type:function size:0x1B8 fn_80181500 = .text:0x80181500; // type:function size:0xC8 -fn_801815D0 = .text:0x801815D0; // type:function size:0x130 +setupTriforceDrawCommands__15dLytMapIcon01_cFv = .text:0x801815D0; // type:function size:0x130 fn_80181700 = .text:0x80181700; // type:function size:0x178 fn_80181880 = .text:0x80181880; // type:function size:0xC4 fn_80181950 = .text:0x80181950; // type:function size:0x30 @@ -9989,7 +9989,7 @@ fn_80181980 = .text:0x80181980; // type:function size:0x64 fn_801819F0 = .text:0x801819F0; // type:function size:0xB0 fn_80181AA0 = .text:0x80181AA0; // type:function size:0x11C fn_80181BC0 = .text:0x80181BC0; // type:function size:0x78 -fn_80181C40 = .text:0x80181C40; // type:function size:0x94 +fn_80181C40__15dLytMapIcon01_cFv = .text:0x80181C40; // type:function size:0x94 fn_80181CE0 = .text:0x80181CE0; // type:function size:0x68C fn_80182370 = .text:0x80182370; // type:function size:0x78 fn_801823F0 = .text:0x801823F0; // type:function size:0x28C @@ -10066,7 +10066,7 @@ fn_801897D0 = .text:0x801897D0; // type:function size:0x168 fn_80189940 = .text:0x80189940; // type:function size:0x8C fn_801899D0 = .text:0x801899D0; // type:function size:0xEC fn_80189AC0 = .text:0x80189AC0; // type:function size:0x68 -setIslandNamesOn__19dLytMapDecoration_cFb = .text:0x80189B30; // type:function size:0x50 +setIslandNamesOn__16dLytMapMarkers_cFb = .text:0x80189B30; // type:function size:0x50 fn_80189B80 = .text:0x80189B80; // type:function size:0x4 fn_80189B90 = .text:0x80189B90; // type:function size:0x27C fn_80189E10 = .text:0x80189E10; // type:function size:0xF4 @@ -11009,7 +11009,7 @@ fn_801B4C90 = .text:0x801B4C90; // type:function size:0x1C fn_801B4CB0 = .text:0x801B4CB0; // type:function size:0x1C fn_801B4CD0 = .text:0x801B4CD0; // type:function size:0x78 fn_801B4D50 = .text:0x801B4D50; // type:function size:0x1BC -fn_801B4F10 = .text:0x801B4F10; // type:function size:0x1AC +fn_801B4F10__10MapRelatedCFlRC7mVec3_c = .text:0x801B4F10; // type:function size:0x1AC fn_801B50C0 = .text:0x801B50C0; // type:function size:0xB8 fn_801B5180 = .text:0x801B5180; // type:function size:0x7F0 fn_801B5970 = .text:0x801B5970; // type:function size:0x38 @@ -33866,7 +33866,7 @@ lbl_80520B50 = .data:0x80520B50; // type:object size:0xC lbl_80520B5C = .data:0x80520B5C; // type:object size:0xC lbl_80520B68 = .data:0x80520B68; // type:object size:0xC lbl_80520B74 = .data:0x80520B74; // type:object size:0xC -lbl_80520B80 = .data:0x80520B80; // type:object size:0xC +__vt__14dLytMapPopup_c = .data:0x80520B80; // type:object size:0xC __vt__16dLytMapCapture_c = .data:0x80520B8C; // type:object size:0xC __vt__55sFStateMgr_c<16dLytMapCapture_c,20sStateMethodUsr_FI_c> = .data:0x80520B98; // type:object size:0x30 __vt__85sStateMgr_c<16dLytMapCapture_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x80520BC8; // type:object size:0x30 @@ -35353,8 +35353,8 @@ jumptable_8052A758 = .data:0x8052A758; // type:object size:0xA4 scope:local lbl_8052A7FC = .data:0x8052A7FC; // type:object size:0xC lbl_8052A808 = .data:0x8052A808; // type:object size:0x18 lbl_8052A820 = .data:0x8052A820; // type:object size:0x20 -LytDungeonBokoBaseIcons__vtable = .data:0x8052A840; // type:object size:0x20 -lbl_8052A860 = .data:0x8052A860; // type:object size:0x20 +__vt__15dLytMapIcon00_c = .data:0x8052A840; // type:object size:0x20 +__vt__15dLytMapIcon01_c = .data:0x8052A860; // type:object size:0x20 lbl_8052A880 = .data:0x8052A880; // type:object size:0x10 lbl_8052A890 = .data:0x8052A890; // type:object size:0xC8 lbl_8052A958 = .data:0x8052A958; // type:object size:0x68 diff --git a/include/d/a/obj/d_a_obj_tbox.h b/include/d/a/obj/d_a_obj_tbox.h index b3c95053..93f8a7f9 100644 --- a/include/d/a/obj/d_a_obj_tbox.h +++ b/include/d/a/obj/d_a_obj_tbox.h @@ -64,6 +64,14 @@ public: STATE_FUNC_DECLARE(dAcTbox_c, Wait); STATE_FUNC_DECLARE(dAcTbox_c, GoddessWait); + u8 getVariant() const { + return mVariant; + } + + bool hasBeenOpened() const { + return mHasBeenOpened; + } + private: static f32 getSomeRate(); bool initBgW(dBgW &bg, const char *arcName, const char *fileName); diff --git a/include/d/d_player_act.h b/include/d/d_player_act.h index b06ba8fa..29eb2763 100644 --- a/include/d/d_player_act.h +++ b/include/d/d_player_act.h @@ -636,10 +636,12 @@ public: static bool isOutOfStamina(); static f32 getStamina(); + static s32 getCurrentTunicType(); static s32 getCurrentSwordType(); static const char *getSwordName(s32); static s32 getCurrentlyEquippedShieldType(); + static const mColor &getEarringsColor(); static mVec3_c sPos1; diff --git a/include/d/d_stage.h b/include/d/d_stage.h index d714f3dd..5d48f917 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -84,6 +84,7 @@ public: void fn_801B4C70(const mVec3_c &); void fn_801B50C0(s32); const mVec3_c &fn_801B4CB0() const; + s32 fn_801B4F10(s32 roomid, const mVec3_c &position) const; }; // OBJ NAME: STAGE diff --git a/include/d/lyt/d_lyt_map.h b/include/d/lyt/d_lyt_map.h index 63222b91..33bb92c1 100644 --- a/include/d/lyt/d_lyt_map.h +++ b/include/d/lyt/d_lyt_map.h @@ -9,6 +9,7 @@ #include "d/lyt/d_lyt_map_global.h" #include "d/lyt/d_textbox.h" #include "d/lyt/d_window.h" +#include "d/lyt/d_lyt_map_markers.h" #include "egg/core/eggColorFader.h" #include "m/m2d.h" #include "m/m_angle.h" @@ -467,17 +468,6 @@ private: /* 0x18E */ bool mDecideFinished; }; -// TODO, name made up -class dLytMapDecoration_c : public m2d::Base_c { -public: - dLytMapDecoration_c() {} - virtual ~dLytMapDecoration_c() {} - virtual void draw() override; - virtual void build(d2d::ResAccIf_c *resAcc); - - void setIslandNamesOn(bool on); - void fn_80189B90(); -}; /** 2D UI - Map - beacon preview icon following the cursor */ class dLytMapPutIcon_c { @@ -605,10 +595,9 @@ private: /* 0x0F24 */ dLytMapCapture_c mMapCapture; /* 0x0FA0 */ dLytMapFloorBtnMgr_c mFloorBtnMgr; /* 0x16B4 */ dLytMapPinIconAggregate_c mPinIconAggregate; + /* 0x2060 */ dLytMapMarkers_c mMarkers; - /* 0x2060 */ dLytMapDecoration_c field_0x2060; - - /* 0x2070 */ u8 _0x2070[0x64C0 - 0x2070]; + /* 0x5F54 */ u8 _0x5F54[0x64C0 - 0x5F54]; /* 0x64C0 */ dLytMapFootPrints_c mFootPrints; diff --git a/include/d/lyt/d_lyt_map_global.h b/include/d/lyt/d_lyt_map_global.h index 64c29f52..d5e14f60 100644 --- a/include/d/lyt/d_lyt_map_global.h +++ b/include/d/lyt/d_lyt_map_global.h @@ -68,6 +68,10 @@ public: return mPlayerPosition; } + u8 getField_0x55() const { + return field_0x55; + } + const mAng &getField_0x56() const { return field_0x56; } @@ -145,7 +149,8 @@ private: /* 0x4E */ u8 mAlpha; /* 0x4F */ u8 field_0x4F; /* 0x50 */ UNKWORD field_0x50; - /* 0x54 */ u8 _0x54[0x56 - 0x54]; + /* 0x54 */ u8 field_0x54; + /* 0x55 */ u8 field_0x55; /* 0x56 */ mAng field_0x56; /* 0x58 */ f32 field_0x58; /* 0x5C */ s32 mCurrentMapMode; diff --git a/include/d/lyt/d_lyt_map_markers.h b/include/d/lyt/d_lyt_map_markers.h index dd73bc00..1a995f65 100644 --- a/include/d/lyt/d_lyt_map_markers.h +++ b/include/d/lyt/d_lyt_map_markers.h @@ -1,16 +1,100 @@ #ifndef D_LYT_MAP_MARKERS_H #define D_LYT_MAP_MARKERS_H +#include "d/d_cursor_hit_check.h" #include "d/lyt/d2d.h" #include "d/lyt/d_textbox.h" +#include "d/lyt/d_window.h" +#include "m/m_angle.h" #include "m/m_vec.h" +#include "nw4r/lyt/lyt_bounding.h" #include "nw4r/lyt/lyt_pane.h" #include "sized_string.h" +class dAcBase_c; +class dAcTbox_c; + +// Size: 0x1C +struct MapUnkStruct1 { +public: + MapUnkStruct1() {} + ~MapUnkStruct1() {} + + /* 0x00 */ u8 _0x00[0x1C]; +}; + +/** + * Since a map has a dynamic number of actors, the layout + * doesn't actually contain multiple panes for each icon - + * instead it contains one copy per icon, and then the custom + * draw function simply reads a bunch of draw commands to position + * and draw the panes, potentially using a pane multiple times. + * + * Size: 0xC + */ +struct dLytMapIcon01DrawCommand { +public: + dLytMapIcon01DrawCommand() {} + ~dLytMapIcon01DrawCommand() {} + + /* 0x00 */ mVec2_c position; + /* 0x08 */ mAng rotation; + /* 0x0A */ u8 paneIdx; + /* 0x0B */ u8 passIdx; +}; + +// Size: 0x20 +struct MapUnkStruct3 { +public: + MapUnkStruct3() {} + ~MapUnkStruct3() {} + + /* 0x00 */ UNKWORD field_0x00; + /* 0x04 */ nw4r::lyt::Bounding *bounding; + /* 0x08 */ f32 field_0x08; + /* 0x0C */ f32 field_0x0C; + /* 0x10 */ mVec2_c field_0x10; + /* 0x18 */ u8 field_0x18; + /* 0x19 */ u8 field_0x19; + /* 0x1C */ const char *field_0x1C; +}; + +// Size: 0xC +struct MapUnkStruct4 { +public: + MapUnkStruct4() {} + ~MapUnkStruct4() {} + + /* 0x00 */ f32 field_0x00; + /* 0x04 */ f32 field_0x04; + /* 0x08 */ u16 field_0x08; + /* 0x0A */ u8 field_0x0A; + /* 0x0B */ u8 field_0x0B; +}; + +/** + * Since map icons are completely virtual, we need to separately + * track animation state if there are special in/out animations. + * + * Size: 0x10 + */ +struct dLytMapIconAnimState { +public: + // no ctor/dtor + + /* 0x00 */ UNKWORD cmdIndex; + /* 0x04 */ f32 frame; + /* 0x08 */ u8 animIn; + /* 0x09 */ u8 animOut; + /* 0x0A */ u8 idleVisible; + /* 0x0B */ u8 field_0x0B; + /* 0x0C */ bool visible; +}; + /** 2D UI - Map - Popup text that appears when pointing at certain points of interest */ class dLytMapPopup_c { public: - dLytMapPopup_c() {} + dLytMapPopup_c() : mLabel("MAP_00") {} virtual ~dLytMapPopup_c() {} bool build(d2d::ResAccIf_c *resAcc); @@ -50,4 +134,216 @@ private: /* 0x180 */ UNKWORD field_0x180; }; +/** 2D UI - Map - Text holding area names (on the world/province view, or exits on the stage view) */ +class dLytMapPlace_c { +public: + dLytMapPlace_c() {} + virtual ~dLytMapPlace_c() {} + + bool build(d2d::ResAccIf_c *resAcc); + bool remove(); + bool execute(); + void draw(); + + void setLabel(const char *label); + void setInout(f32 value); + void setColor(u32 value); + + void realize(); + +private: + enum ModeCheck_e { + MODE_TRANSITION_TO_ZOOM = 2, + MODE_TRANSITION_TO_STAGE = 3, + MODE_STABLE_STAGE = 4, + MODE_STABLE_ZOOM = 5, + }; + + void realizeText(); + void setInitialState(); + void updateScale(); + void realizeTextSize(); + void realizeBgSize(); + + /* 0x004 */ d2d::LytBase_c mLyt; + /* 0x094 */ d2d::AnmGroup_c mAnm[3]; + /* 0x154 */ SizedString<0x40> mLabel; + /* 0x194 */ nw4r::lyt::Pane *mpPanes[2]; + /* 0x19C */ nw4r::lyt::Pane *mpBgPanes[3]; + /* 0x1A8 */ dTextBox_c *mpTextboxes[3]; + /* 0x1B4 */ dWindow_c *mpWindow[1]; + /* 0x1B8 */ dTextBox_c *mpSizeBox[1]; + /* 0x1BC */ s32 mModeCheckResult; + /* 0x1C0 */ f32 field_0x1C0; + /* 0x1C4 */ f32 field_0x1C4; + /* 0x1C8 */ mVec2_c field_0x1C8; + /* 0x1D0 */ u8 _0x1D0[0x1D8 - 0x1D0]; + /* 0x1D8 */ f32 mMaxScale; +}; + +class dLytMapIcon00_c : public m2d::Base_c { +public: + dLytMapIcon00_c() {} + +private: + /* 0x0104 */ d2d::LytBase_c mLyt; + /* 0x0194 */ d2d::AnmGroup_c mAnm[29]; + /* 0x0970 */ dCursorHitCheckLyt_c mCsHitCheck; + /* 0x0998 */ MapUnkStruct4 mUnk4[100]; + /* 0x0E5B */ u8 field_0x0E5B[100]; + /* 0x0F20 */ u8 field_0x0F20[100]; + /* 0x0F84 */ mVec3_c field_0x0F84[77]; + /* 0x1342 */ u8 field_0x1342[100]; + /* 0x13A8 */ u8 field_0x13A8[100]; + /* 0x1410 */ MapUnkStruct3 mUnk3[30]; + /* 0x1D70 */ dLytMapPlace_c mPlace; +}; + +class dLytMapIcon01_c : public m2d::Base_c { +public: + dLytMapIcon01_c() {} + virtual void draw() override; + virtual bool build(d2d::ResAccIf_c *resAcc); + virtual bool remove(); + virtual bool execute(); + virtual void resetDrawCommands(); + +private: + enum ModeCheck_e { + MODE_TRANSITION_TO_ZOOM = 2, + MODE_TRANSITION_TO_STAGE = 3, + MODE_STABLE_STAGE = 4, + MODE_STABLE_ZOOM = 5, + }; + + void setupActorDrawCommands(); + void setupStageDrawCommands(); + void setupLinkDrawCommand(); + void setupTriforceDrawCommands(); + void setupUnkDrawCommand(); + + void sortDrawCommands(); + + void setupTboxDrawCommand(dAcBase_c *actor); + void setupTboxDrawCommandGoddessClosed(dAcTbox_c *box); + void setupTboxDrawCommandOpen(dAcTbox_c *box); + void setupTboxDrawCommandClosed(dAcTbox_c *box); + + void setLinkTunic(s32 type); + void setGoddessStatue(bool present); + void setTerry(bool present); + void drawAreaLight(s32 color, nw4r::lyt::Pane *pane); + void drawSaveObj(s32 color, nw4r::lyt::Pane *pane); + void drawCloud(s32 alpha, nw4r::lyt::Pane *pane); + + void drawWithAnimIn(u32 paneIdx, nw4r::lyt::Pane *pane, f32 frame); + void drawWithAnimOut(u32 paneIdx, nw4r::lyt::Pane *pane, f32 frame); + void drawFullyIn(u32 paneIdx, nw4r::lyt::Pane *pane); + void fn_80181C40(); + + void checkMapMode(); + void loadFlags(); + + /* 0x0010 */ nw4r::lyt::Bounding *mpBoundings[59]; + /* 0x00FC */ nw4r::lyt::Pane *mpSpecialPanes[27]; + /* 0x0168 */ nw4r::lyt::Pane *mpSpecialPictures[27]; + /* 0x01D4 */ nw4r::lyt::Pane *mpTerryOnOffPane; + /* 0x01D8 */ d2d::ResAccIf_c *mpResAcc; + /* 0x01DC */ d2d::LytBase_c mLyt; + /* 0x026C */ d2d::AnmGroup_c mAnm[18]; + /* 0x06EC */ nw4r::lyt::Pane *mpPanes[42]; + /* 0x0794 */ dCursorHitCheckLyt_c mCsHitCheck; + /* 0x07BC */ dLytMapIcon01DrawCommand mCommands[100]; + /* 0x0C6C */ s32 mModeCheckResult; + /* 0x0C70 */ s32 field_0x0C70; + + /* 0x0C74 */ u8 field_0x0C74; + /* 0x0C75 */ u8 field_0x0C75; + /* 0x0C76 */ u8 field_0x0C76; + /* 0x0C77 */ u8 field_0x0C77; + /* 0x0C78 */ u8 field_0x0C78; + /* 0x0C79 */ u8 field_0x0C79; + /* 0x0C7A */ u8 field_0x0C7A; + /* 0x0C7B */ u8 field_0x0C7B; + /* 0x0C7C */ u8 field_0x0C7C; + /* 0x0C7D */ u8 field_0x0C7D; + /* 0x0C7E */ u8 field_0x0C7E; + /* 0x0C7F */ u8 field_0x0C7F; + /* 0x0C80 */ u8 field_0x0C80; + /* 0x0C81 */ u8 field_0x0C81; + /* 0x0C82 */ u8 field_0x0C82; + /* 0x0C83 */ u8 field_0x0C83; + /* 0x0C84 */ u8 field_0x0C84; + /* 0x0C85 */ u8 field_0x0C85[100]; + /* 0x0CE9 */ u8 mPassIdxes[35]; + /* 0x0D0C */ s32 field_0xD0C; + /* 0x0D10 */ s32 field_0xD10; + /* 0x0D14 */ u8 mNumCommandsPerPass[35]; + /* 0x0D37 */ u8 mNumCommands; + + /* 0x0D38 */ u8 _0x0D38[0x0D3A - 0x0D38]; + + /* 0x0D3A */ mAng field_0x0D3A; + + /* 0x0D3C */ u8 _0x0D3C[0x0D40 - 0x0D3C]; + + /* 0x0D40 */ mVec2_c field_0x0D40; + /* 0x0D48 */ u8 field_0x0D48; + /* 0x0D49 */ u8 field_0x0D49; + /* 0x0D4A */ u8 field_0x0D4A; + /* 0x0D4B */ u8 field_0x0D4B[100]; // ??? + + /* 0x0DAF */ u8 _0x0DAF[0x0E13 - 0x0DAF]; + + /* 0x0E13 */ u8 field_0x0E13; + /* 0x0E14 */ MapUnkStruct3 mUnk3[56]; + /* 0x1514 */ dLytMapIconAnimState mIconAnims[50]; + /* 0x1834 */ s32 mNumAnims; + /* 0x1838 */ f32 field_0x1838; + /* 0x183C */ f32 field_0x183C; + + /* 0x1840 */ u8 _0x183C[0x1845 - 0x1840]; + + /* 0x1845 */ u8 field_0x1845; + + /* 0x1846 */ u8 _0x1846[0x184C - 0x1846]; + + /* 0x184C */ bool field_0x184C; +}; + +// TODO, name made up +class dLytMapMarkers_c : public m2d::Base_c { +public: + dLytMapMarkers_c() : field_0x6F0(0), field_0x0702(0), field_0x0703(0), field_0x0704(0.0f) {} + virtual ~dLytMapMarkers_c() {} + virtual void draw() override; + virtual void build(d2d::ResAccIf_c *resAcc); + + void setIslandNamesOn(bool on); + void fn_80189B90(); + + void setField_0x6F4(const mVec2_c &v) { + field_0x06F4 = v; + } + +private: + /* 0x0010 */ d2d::ResAccIf_c mResAcc1; + /* 0x0380 */ d2d::ResAccIf_c mResAcc2; + + /* 0x06F0 */ u8 field_0x6F0; + /* 0x06F4 */ mVec2_c field_0x06F4; + + /* 0x06FC */ u8 _0x6FC[0x0702 - 0x06FC]; + + /* 0x0702 */ u8 field_0x0702; + /* 0x0702 */ u8 field_0x0703; + /* 0x0704 */ f32 field_0x0704; + /* 0x0708 */ dLytMapPopup_c mMapPopup; + /* 0x088C */ u8 _0x088C[0x0894 - 0x088C]; + /* 0x0894 */ MapUnkStruct1 mUnk1[60]; + + /* 0x0F30 */ dLytMapIcon01_c mIcon01; + /* 0x2780 */ dLytMapIcon00_c mIcon00; +}; + #endif diff --git a/include/m/m_angle.h b/include/m/m_angle.h index 1ef491a7..96a93851 100644 --- a/include/m/m_angle.h +++ b/include/m/m_angle.h @@ -17,6 +17,10 @@ struct mAng { return *this; } + void setF(const f32 &f) { + mVal = f; + } + static mAng atan2s(f32 a, f32 b) { return mAng(cM::atan2s(a, b)); } diff --git a/src/d/lyt/d_lyt_map.cpp b/src/d/lyt/d_lyt_map.cpp index 5054382d..97380752 100644 --- a/src/d/lyt/d_lyt_map.cpp +++ b/src/d/lyt/d_lyt_map.cpp @@ -2207,7 +2207,7 @@ void dLytMapMain_c::build() { d2d::dSubPane::linkMeters(mLyt.getLayout()->GetGroupContainer()->FindGroupByName(sGroupName), &mSubpaneList); mFootPrints.build(resAcc); - field_0x2060.build(resAcc); + mMarkers.build(resAcc); mPinIconAggregate.build(resAcc); mPutIcon.build(resAcc); @@ -2295,8 +2295,7 @@ void dLytMapMain_c::build() { mpPriorityGroups[i] = mLyt.findGroupByName(sPriorityGroupNames[i]); } - // TODO - ((mVec2_c*)(_0x2070 + 0x6E4))->set(boundingPos2.x, boundingPos2.y); + mMarkers.setField_0x6F4(boundingPos2); mPinIconAggregate.setUnk(&field_0xF1C); @@ -2346,7 +2345,7 @@ void dLytMapMain_c::draw() { } if (mCurrentMapMode == dLytMapGlobal_c::MAPMODE_STAGE || mCurrentMapMode == dLytMapGlobal_c::MAPMODE_ZOOM || mNextMapMode == dLytMapGlobal_c::MAPMODE_STAGE || mNextMapMode == dLytMapGlobal_c::MAPMODE_ZOOM) { - field_0x2060.draw(); + mMarkers.draw(); } if (field_0x8C68 != 3 && field_0x8C68 != 5 && field_0x8C94 != 2) { @@ -2367,7 +2366,7 @@ void dLytMapMain_c::draw() { fn_80138D80(); } fn_80143120(-2); - field_0x2060.fn_80189B90(); + mMarkers.fn_80189B90(); mPutIcon.draw(); if (field_0x8C94 == 10) { mPopupInfo.draw(); @@ -2448,7 +2447,7 @@ void dLytMapMain_c::executeState_Active() { dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_MAP_ISLAND_NAME_ON); } mIslandNamesOn = !mIslandNamesOn; - field_0x2060.setIslandNamesOn(mIslandNamesOn); + mMarkers.setIslandNamesOn(mIslandNamesOn); } checkScroll(); @@ -2713,10 +2712,10 @@ void dLytMapMain_c::initializeState_ChgDispAreaMode_MapRot() { mAnmGroups[MAP_MAIN_ANIM_ROTATE].setToEnd(); } if (mNextMapMode == dLytMapGlobal_c::MAPMODE_ZOOM) { - field_0x2060.setIslandNamesOn(false); + mMarkers.setIslandNamesOn(false); } if (mNextMapMode == dLytMapGlobal_c::MAPMODE_STAGE) { - field_0x2060.setIslandNamesOn(mIslandNamesOn); + mMarkers.setIslandNamesOn(mIslandNamesOn); } if (mCurrentMapMode == dLytMapGlobal_c::MAPMODE_ZOOM && mNextMapMode == dLytMapGlobal_c::MAPMODE_STAGE) { diff --git a/src/d/lyt/d_lyt_map_markers.cpp b/src/d/lyt/d_lyt_map_markers.cpp index 56ae532e..72e11718 100644 --- a/src/d/lyt/d_lyt_map_markers.cpp +++ b/src/d/lyt/d_lyt_map_markers.cpp @@ -1,10 +1,38 @@ #include "d/lyt/d_lyt_map_markers.h" #include "common.h" +#include "d/a/d_a_base.h" +#include "d/a/d_a_player.h" +#include "d/a/obj/d_a_obj_tbox.h" +#include "d/d_cursor_hit_check.h" #include "d/d_message.h" +#include "d/d_player.h" +#include "d/d_player_act.h" +#include "d/d_sc_game.h" +#include "d/d_stage.h" +#include "d/flag/dungeonflag_manager.h" +#include "d/flag/storyflag_manager.h" +#include "d/lyt/d2d.h" #include "d/lyt/d_lyt_map_global.h" #include "d/lyt/d_window.h" +#include "d/snd/d_snd_small_effect_mgr.h" #include "m/m_vec.h" +#include "nw4r/lyt/lyt_bounding.h" +#include "nw4r/lyt/lyt_pane.h" +#include "nw4r/lyt/lyt_types.h" + +inline mVec3_c vec2ToVec3XY(const mVec2_c &v) { + return mVec3_c(v.x, v.y, 0.0f); +} + +static bool checkHasMap() { + return DungeonflagManager::sInstance->getCounterOrFlag(2, 8); +} + +static bool projectOntoMap(const mVec3_c &position, mVec2_c &result) { + dLytMapGlobal_c::GetInstance()->projectOntoMap(result, position); + return true; +} static const d2d::LytBrlanMapping brlanMapMapPopup[] = { {"mapPopup_00_scale.brlan", "G_scale_00"}, @@ -215,3 +243,992 @@ void dLytMapPopup_c::checkMapMode() { return; } } + +static const d2d::LytBrlanMapping brlanMapMapPlace[] = { + { "mapPlace_00_in.brlan", "G_inOut_00"}, + {"mapPlace_00_scale.brlan", "G_scale_00"}, + {"mapPlace_00_color.brlan", "G_color_00"}, +}; + +#define MAP_PLACE_ANIM_IN 0 +#define MAP_PLACE_ANIM_SCALE 1 +#define MAP_PLACE_ANIM_COLOR 2 + +#define MAP_PLACE_NUM_ANIMS 3 + +static const char *sMapPlacePaneNames[] = { + "N_all_00", + "N_all_01", +}; + +#define MAP_PLACE_PANE_ALL_00 0 +#define MAP_PLACE_PANE_ALL_01 1 +#define MAP_PLACE_NUM_PANES 2 + +static const char *sMapPlaceBgPaneNames[] = { + "P_bg_00", + "P_bg_01", + "P_bg_02", +}; + +#define MAP_PLACE_PANE_BG_00 0 +#define MAP_PLACE_PANE_BG_01 1 +#define MAP_PLACE_PANE_BG_02 2 +#define MAP_PLACE_NUM_BG_PANES 3 + +static const char *sMapPlaceTextboxNames[] = { + "T_area_00", + "T_areaS_00", + "T_areaS_01", +}; + +#define MAP_PLACE_NUM_TEXTBOXES 3 + +static const char *sMapPlaceSizeBoxNames[] = {"W_bgP_00"}; + +bool dLytMapPlace_c::build(d2d::ResAccIf_c *resAcc) { + mLyt.setResAcc(resAcc); + mLyt.build("mapPlace_00.brlyt", nullptr); + + for (int i = 0; i < MAP_PLACE_NUM_ANIMS; i++) { + mAnm[i].init(brlanMapMapPlace[i].mFile, resAcc, mLyt.getLayout(), brlanMapMapPlace[i].mName); + mAnm[i].bind(false); + mAnm[i].setRate(1.0f); + mAnm[i].setAnimEnable(false); + } + + for (int i = 0; i < MAP_PLACE_NUM_PANES; i++) { + mpPanes[i] = mLyt.findPane(sMapPlacePaneNames[i]); + } + + for (int i = 0; i < MAP_PLACE_NUM_BG_PANES; i++) { + mpBgPanes[i] = mLyt.findPane(sMapPlaceBgPaneNames[i]); + } + + for (int i = 0; i < MAP_PLACE_NUM_TEXTBOXES; i++) { + mpTextboxes[i] = mLyt.getTextBox(sMapPlaceTextboxNames[i]); + } + + for (int i = 0; i < 1; i++) { + mpWindow[i] = mLyt.getWindow(sMapPlaceSizeBoxNames[i]); + mpSizeBox[i] = mLyt.getSizeBoxInWindow(sMapPlaceSizeBoxNames[i]); + } + + realizeText(); + + f32 windowWidth = mpWindow[0]->GetSize().width; + f32 w1 = mpBgPanes[0]->GetSize().width; + f32 w2 = mpBgPanes[1]->GetSize().width; + f32 w3 = mpBgPanes[2]->GetSize().width; + + f32 lineWidth = mpTextboxes[0]->GetLineWidth(nullptr); + + f32 bgWidth = (w1 + w2 + w3); + field_0x1C4 = windowWidth - lineWidth; + field_0x1C0 = windowWidth - bgWidth; + + realizeTextSize(); + realizeBgSize(); + setInitialState(); + + mMaxScale = mAnm[MAP_PLACE_ANIM_SCALE].getLastFrame(); + + return true; +} + +bool dLytMapPlace_c::remove() { + for (int i = 0; i < MAP_PLACE_NUM_ANIMS; i++) { + mAnm[i].unbind(); + mAnm[i].remove(); + } + return true; +} + +bool dLytMapPlace_c::execute() { + if (mAnm[MAP_PLACE_ANIM_IN].isEnabled() && mAnm[MAP_PLACE_ANIM_IN].isStop2()) { + mAnm[MAP_PLACE_ANIM_IN].setAnimEnable(false); + } + for (int i = 0; i < MAP_PLACE_NUM_ANIMS; i++) { + if (mAnm[i].isEnabled()) { + mAnm[i].play(); + } + } + mLyt.calc(); + return true; +} + +void dLytMapPlace_c::draw() { + mpPanes[MAP_PLACE_PANE_ALL_00]->SetAlpha(dLytMapGlobal_c::GetInstance()->getAlpha()); + mpPanes[MAP_PLACE_PANE_ALL_00]->SetTranslate(vec2ToVec3XY(field_0x1C8)); + mpPanes[MAP_PLACE_PANE_ALL_00]->Animate(0); + mpPanes[MAP_PLACE_PANE_ALL_00]->CalculateMtx(mLyt.getDrawInfo()); + mpPanes[MAP_PLACE_PANE_ALL_00]->Draw(mLyt.getDrawInfo()); +} + +void dLytMapPlace_c::setLabel(const char *label) { + mLabel = label; +} + +void dLytMapPlace_c::realize() { + realizeText(); + realizeTextSize(); + realizeBgSize(); +} + +void dLytMapPlace_c::setInout(f32 value) { + if (/* 0.0f <= value && */ value <= mAnm[MAP_PLACE_ANIM_IN].getLastFrame()) { + mAnm[MAP_PLACE_ANIM_IN].setFrame(value); + mAnm[MAP_PLACE_ANIM_IN].setAnimEnable(true); + mpPanes[MAP_POPUP_PANE_ALL]->Animate(0); + mAnm[MAP_PLACE_ANIM_IN].setAnimEnable(false); + } +} + +void dLytMapPlace_c::setColor(u32 value) { + f32 frame = value; + mAnm[MAP_PLACE_ANIM_COLOR].setAnimEnable(true); + mAnm[MAP_PLACE_ANIM_COLOR].setFrame(frame); + mpPanes[MAP_PLACE_PANE_ALL_00]->Animate(0); + mAnm[MAP_PLACE_ANIM_COLOR].setAnimEnable(false); +} + +void dLytMapPlace_c::setInitialState() { + mAnm[MAP_PLACE_ANIM_COLOR].setRate(1.0f); + mAnm[MAP_PLACE_ANIM_COLOR].setForwardOnce(); + mAnm[MAP_PLACE_ANIM_COLOR].setToStart(); + mAnm[MAP_PLACE_ANIM_COLOR].setAnimEnable(true); + + mAnm[MAP_PLACE_ANIM_SCALE].setRate(1.0f); + mAnm[MAP_PLACE_ANIM_SCALE].setForwardOnce(); + mAnm[MAP_PLACE_ANIM_SCALE].setToStart(); + mAnm[MAP_PLACE_ANIM_SCALE].setAnimEnable(true); + + mAnm[MAP_PLACE_ANIM_IN].setRate(1.0f); + mAnm[MAP_PLACE_ANIM_IN].setForwardOnce(); + mAnm[MAP_PLACE_ANIM_IN].setToEnd2(); + mAnm[MAP_PLACE_ANIM_IN].setAnimEnable(true); + + mLyt.calc(); + + mAnm[MAP_PLACE_ANIM_IN].setAnimEnable(false); + mAnm[MAP_PLACE_ANIM_SCALE].setAnimEnable(false); + mAnm[MAP_PLACE_ANIM_COLOR].setAnimEnable(false); +} + +void dLytMapPlace_c::updateScale() { + // @bug mModeCheckResult is never set + f32 frame = 0.0f; + f32 zoomFrame = dLytMapGlobal_c::GetInstance()->getZoomFrame(); + + switch (mModeCheckResult) { + case MODE_TRANSITION_TO_ZOOM: frame = mMaxScale * zoomFrame; break; + case MODE_TRANSITION_TO_STAGE: frame = mMaxScale * zoomFrame; break; + case MODE_STABLE_STAGE: frame = 0.0f; break; + case MODE_STABLE_ZOOM: frame = mMaxScale; break; + } + + if (mMaxScale < frame) { + frame = mMaxScale; + } else if (frame < 0.0f) { + frame = 0.0f; + } + + mAnm[MAP_PLACE_ANIM_SCALE].setAnimEnable(true); + mAnm[MAP_PLACE_ANIM_SCALE].setFrame(frame); + mpPanes[MAP_PLACE_PANE_ALL_01]->Animate(0); + mAnm[MAP_PLACE_ANIM_SCALE].setAnimEnable(false); +} + +void dLytMapPlace_c::realizeText() { + const wchar_t *text = dMessage_c::getTextMessageByLabel(mLabel, true, nullptr, 0); + if (text != nullptr) { + for (int i = 0; i < MAP_PLACE_NUM_TEXTBOXES; i++) { + mpTextboxes[i]->setTextWithGlobalTextProcessor(text); + } + } +} + +void dLytMapPlace_c::realizeTextSize() { + const wchar_t *text = dMessage_c::getTextMessageByLabel(mLabel, true, nullptr, 0); + if (text != nullptr) { + mpWindow[0]->UpdateSize(mpSizeBox[0], 0.0f); + nw4r::lyt::Size size(mpWindow[0]->GetSize()); + size.width += field_0x1C4; + mpWindow[0]->SetSize(size); + } +} + +static const d2d::LytBrlanMapping brlanMapMapIcon01[] = { + { "mapIcon_01_player2pattern.brlan", "G_2pattern_00"}, + { "mapIcon_01_playerLoop.brlan", "G_playerLoop_00"}, + { "mapIcon_01_scale.brlan", "G_scale_00"}, + { "mapIcon_01_nusiAnim.brlan", "G_nusiLoop_00"}, + { "mapIcon_01_areaLoop.brlan", "G_areaLoop_00"}, + { "mapIcon_01_areaColor.brlan", "G_areaColor_00"}, + { "mapIcon_01_cloudLoop.brlan", "G_cloudBLoop_00"}, + { "mapIcon_01_cloudAlpha.brlan", "G_cloudBAlpha_00"}, + { "mapIcon_01_loop.brlan", "G_loop_00"}, + { "mapIcon_01_goddessOnOff.brlan", "G_goddess_00"}, + {"mapIcon_01_saveObjectColor.brlan", "G_saveColor_00"}, + { "mapIcon_01_iconOut.brlan", "G_tresInOut_00"}, + { "mapIcon_01_iconOut.brlan", "G_markInOut_00"}, + { "mapIcon_01_iconIn.brlan", "G_tresInOut_00"}, + { "mapIcon_01_iconIn.brlan", "G_markInOut_00"}, + { "mapIcon_01_iconIn.brlan", "G_doorInOut_00"}, + { "mapIcon_01_iconIn.brlan", "G_saveInOut_00"}, + { "mapIcon_01_iconIn.brlan", "G_forceInOut_00"}, +}; + +#define MAP_ICON_01_ANIM_PLAYER_2_PATTERN 0 +#define MAP_ICON_01_ANIM_PLAYER_LOOP 1 +#define MAP_ICON_01_ANIM_SCALE 2 +#define MAP_ICON_01_ANIM_NUSI_ANIM 3 +#define MAP_ICON_01_ANIM_AREA_LOOP 4 +#define MAP_ICON_01_ANIM_AREA_COLOR 5 +#define MAP_ICON_01_ANIM_CLOUD_LOOP 6 +#define MAP_ICON_01_ANIM_CLOUD_ALPHA 7 +#define MAP_ICON_01_ANIM_LOOP 8 +#define MAP_ICON_01_ANIM_GODDESS_ON_OFF 9 +#define MAP_ICON_01_ANIM_SAVE_OBJECT_COLOR 10 +#define MAP_ICON_01_ANIM_TRES_OUT 11 +#define MAP_ICON_01_ANIM_MARK_OUT 12 +#define MAP_ICON_01_ANIM_TRES_IN 13 +#define MAP_ICON_01_ANIM_MARK_IN 14 +#define MAP_ICON_01_ANIM_DOOR_IN 15 +#define MAP_ICON_01_ANIM_SAVE_IN 16 +#define MAP_ICON_01_ANIM_FORCE_IN 17 +#define MAP_ICON_01_NUM_ANIMS 18 + +static const char *sPaneNamesIcon01[] = { + "N_treasure_00", "N_mark_000", "N_door_000", "N_saveIcon_00", "N_triforce_00", "N_player_000", + "N_player_01", "N_start_000", "N_sword_00", "N_shizuku_00", "N_shizuku_01", "N_goddessC_00", + "N_terryShop_00", "N_cloudBig_000", "N_treasure_01", "N_areaLight_00", "N_nusi_00", "N_doorKey_00", + "N_target_00", "N_mushi_00", "N_seekerIcon_00", "N_doddess_00", "N_domitory_00", "N_shop_00", + "N_mHusband_00", "N_mWife_00", "N_tool_00", "N_keep_00", "N_junk_00", "N_fortune_00", + "N_ruletou_000", "N_pampkin_000", "N_tery_000", "N_tikurin_000", "N_uta_000", "N_musi_000", + "N_skyloft_000", "N_roulette_00", "N_takegiri_00", "N_kobunB_00", "N_sebasun_00", "N_commonIcon_00", +}; + +#define MAP_ICON_01_PANE_TREASURE_00 0 +#define MAP_ICON_01_PANE_MARK_000 1 +#define MAP_ICON_01_PANE_DOOR_000 2 +#define MAP_ICON_01_PANE_SAVEICON_00 3 +#define MAP_ICON_01_PANE_TRIFORCE_00 4 +#define MAP_ICON_01_PANE_PLAYER_000 5 +#define MAP_ICON_01_PANE_PLAYER_01 6 +#define MAP_ICON_01_PANE_START_000 7 +#define MAP_ICON_01_PANE_SWORD_00 8 +#define MAP_ICON_01_PANE_SHIZUKU_00 9 +#define MAP_ICON_01_PANE_SHIZUKU_01 10 +#define MAP_ICON_01_PANE_GODDESSC_00 11 +#define MAP_ICON_01_PANE_TERRYSHOP_00 12 +#define MAP_ICON_01_PANE_CLOUDBIG_000 13 +#define MAP_ICON_01_PANE_TREASURE_01 14 +#define MAP_ICON_01_PANE_AREALIGHT_00 15 +#define MAP_ICON_01_PANE_NUSI_00 16 +#define MAP_ICON_01_PANE_DOORKEY_00 17 +#define MAP_ICON_01_PANE_TARGET_00 18 +#define MAP_ICON_01_PANE_MUSHI_00 19 +#define MAP_ICON_01_PANE_SEEKERICON_00 20 +#define MAP_ICON_01_PANE_DODDESS_00 21 +#define MAP_ICON_01_PANE_DOMITORY_00 22 +#define MAP_ICON_01_PANE_SHOP_00 23 +#define MAP_ICON_01_PANE_MHUSBAND_00 24 +#define MAP_ICON_01_PANE_MWIFE_00 25 +#define MAP_ICON_01_PANE_TOOL_00 26 +#define MAP_ICON_01_PANE_KEEP_00 27 +#define MAP_ICON_01_PANE_JUNK_00 28 +#define MAP_ICON_01_PANE_FORTUNE_00 29 +#define MAP_ICON_01_PANE_RULETOU_000 30 +#define MAP_ICON_01_PANE_PAMPKIN_000 31 +#define MAP_ICON_01_PANE_TERY_000 32 +#define MAP_ICON_01_PANE_TIKURIN_000 33 +#define MAP_ICON_01_PANE_UTA_000 34 +#define MAP_ICON_01_PANE_MUSI_000 35 +#define MAP_ICON_01_PANE_SKYLOFT_000 36 +#define MAP_ICON_01_PANE_ROULETTE_00 37 +#define MAP_ICON_01_PANE_TAKEGIRI_00 38 +#define MAP_ICON_01_PANE_KOBUNB_00 39 +#define MAP_ICON_01_PANE_SEBASUN_00 40 +#define MAP_ICON_01_PANE_COMMONICON_00 41 + +#define MAP_ICON_01_NUM_PANES 42 + +static const char *sMapIcon01BoundingNames[] = { + "B_doddess_00", "B_domitory_00", "B_shop_00", "B_mHusband_00", "B_mWife_00", "B_tool_00", + "B_keep_00", "B_junk_00", "B_fortune_00", "B_ruletou_00", "B_pampkin_00", "B_tery_00", + "B_tikurin_00", "B_uta_01", "B_musi_01", "B_skyloft_01", "B_roulette_00", "B_takegiri_00", + "B_kobunB_00", "B_sebasun_00", "B_uta_00", "B_musi_00", "B_skyloft_00", "B_nusi_00", + "B_terryShop_00", "B_seekerStone_00", "B_commonIcon_00", "B_commonIcon_01", "B_commonIcon_02", "B_commonIcon_03", + "B_commonIcon_04", "B_commonIcon_05", "B_commonIcon_06", "B_commonIcon_07", "B_commonIcon_08", "B_commonIcon_09", + "B_commonIcon_10", "B_commonIcon_11", "B_commonIcon_12", "B_commonIcon_13", "B_commonIcon_14", "B_commonIcon_15", + "B_commonIcon_16", "B_commonIcon_17", "B_commonIcon_18", "B_commonIcon_19", "B_commonIcon_20", "B_commonIcon_21", + "B_commonIcon_22", "B_commonIcon_23", "B_commonIcon_24", "B_commonIcon_25", "B_commonIcon_26", "B_commonIcon_27", + "B_commonIcon_28", "B_commonIcon_29", "B_saveIcon_00", "B_mushi_00", "B_areaLight_00", +}; + +#define MAP_ICON_01_BOUNDING_DODDESS_00 0 +#define MAP_ICON_01_BOUNDING_DOMITORY_00 1 +#define MAP_ICON_01_BOUNDING_SHOP_00 2 +#define MAP_ICON_01_BOUNDING_MHUSBAND_00 3 +#define MAP_ICON_01_BOUNDING_MWIFE_00 4 +#define MAP_ICON_01_BOUNDING_TOOL_00 5 +#define MAP_ICON_01_BOUNDING_KEEP_00 6 +#define MAP_ICON_01_BOUNDING_JUNK_00 7 +#define MAP_ICON_01_BOUNDING_FORTUNE_00 8 +#define MAP_ICON_01_BOUNDING_RULETOU_00 9 +#define MAP_ICON_01_BOUNDING_PAMPKIN_00 10 +#define MAP_ICON_01_BOUNDING_TERY_00 11 +#define MAP_ICON_01_BOUNDING_TIKURIN_00 12 +#define MAP_ICON_01_BOUNDING_UTA_01 13 +#define MAP_ICON_01_BOUNDING_MUSI_01 14 +#define MAP_ICON_01_BOUNDING_SKYLOFT_01 15 +#define MAP_ICON_01_BOUNDING_ROULETTE_00 16 +#define MAP_ICON_01_BOUNDING_TAKEGIRI_00 17 +#define MAP_ICON_01_BOUNDING_KOBUNB_00 18 +#define MAP_ICON_01_BOUNDING_SEBASUN_00 19 +#define MAP_ICON_01_BOUNDING_UTA_00 20 +#define MAP_ICON_01_BOUNDING_MUSI_00 21 +#define MAP_ICON_01_BOUNDING_SKYLOFT_00 22 +#define MAP_ICON_01_BOUNDING_NUSI_00 23 +#define MAP_ICON_01_BOUNDING_TERRYSHOP_00 24 +#define MAP_ICON_01_BOUNDING_SEEKERSTONE_00 25 +#define MAP_ICON_01_BOUNDING_COMMONICON_00 26 +#define MAP_ICON_01_BOUNDING_COMMONICON_01 27 +#define MAP_ICON_01_BOUNDING_COMMONICON_02 28 +#define MAP_ICON_01_BOUNDING_COMMONICON_03 29 +#define MAP_ICON_01_BOUNDING_COMMONICON_04 30 +#define MAP_ICON_01_BOUNDING_COMMONICON_05 31 +#define MAP_ICON_01_BOUNDING_COMMONICON_06 32 +#define MAP_ICON_01_BOUNDING_COMMONICON_07 33 +#define MAP_ICON_01_BOUNDING_COMMONICON_08 34 +#define MAP_ICON_01_BOUNDING_COMMONICON_09 35 +#define MAP_ICON_01_BOUNDING_COMMONICON_10 36 +#define MAP_ICON_01_BOUNDING_COMMONICON_11 37 +#define MAP_ICON_01_BOUNDING_COMMONICON_12 38 +#define MAP_ICON_01_BOUNDING_COMMONICON_13 39 +#define MAP_ICON_01_BOUNDING_COMMONICON_14 40 +#define MAP_ICON_01_BOUNDING_COMMONICON_15 41 +#define MAP_ICON_01_BOUNDING_COMMONICON_16 42 +#define MAP_ICON_01_BOUNDING_COMMONICON_17 43 +#define MAP_ICON_01_BOUNDING_COMMONICON_18 44 +#define MAP_ICON_01_BOUNDING_COMMONICON_19 45 +#define MAP_ICON_01_BOUNDING_COMMONICON_20 46 +#define MAP_ICON_01_BOUNDING_COMMONICON_21 47 +#define MAP_ICON_01_BOUNDING_COMMONICON_22 48 +#define MAP_ICON_01_BOUNDING_COMMONICON_23 49 +#define MAP_ICON_01_BOUNDING_COMMONICON_24 50 +#define MAP_ICON_01_BOUNDING_COMMONICON_25 51 +#define MAP_ICON_01_BOUNDING_COMMONICON_26 52 +#define MAP_ICON_01_BOUNDING_COMMONICON_27 53 +#define MAP_ICON_01_BOUNDING_COMMONICON_28 54 +#define MAP_ICON_01_BOUNDING_COMMONICON_29 55 +#define MAP_ICON_01_BOUNDING_SAVEICON_00 56 +#define MAP_ICON_01_BOUNDING_MUSHI_00 57 +#define MAP_ICON_01_BOUNDING_AREALIGHT_00 58 + +#define MAP_ICON_01_NUM_BOUNDINGS 59 + +static const char *sMapIcon01SpecialPaneNames[] = { + "N_doddess_000", "N_domitory_000", "N_shop_000", "N_mHusband_000", "N_mWife_000", "N_tool_000", + "N_keep_000", "N_junk_000", "N_fortune_000", "N_ruletou_000", "N_pampkin_000", "N_tery_000", + "N_tikurin_000", "N_uta_000", "N_musi_000", "N_skyloft_02", "N_roulette_01", "N_takegiri_01", + "N_kobunB_01", "N_sebasun_01", "N_commonIcon_000", "N_saveIcon_000", "N_areaLight_01", "N_nusi_000", + "N_terryShop_01", "N_seekerIcon_01", "N_mushi_01", +}; + +#define MAP_ICON_01_SPECIAL_PANE_DODDESS_000 0 +#define MAP_ICON_01_SPECIAL_PANE_DOMITORY_000 1 +#define MAP_ICON_01_SPECIAL_PANE_SHOP_000 2 +#define MAP_ICON_01_SPECIAL_PANE_MHUSBAND_000 3 +#define MAP_ICON_01_SPECIAL_PANE_MWIFE_000 4 +#define MAP_ICON_01_SPECIAL_PANE_TOOL_000 5 +#define MAP_ICON_01_SPECIAL_PANE_KEEP_000 6 +#define MAP_ICON_01_SPECIAL_PANE_JUNK_000 7 +#define MAP_ICON_01_SPECIAL_PANE_FORTUNE_000 8 +#define MAP_ICON_01_SPECIAL_PANE_RULETOU_000 9 +#define MAP_ICON_01_SPECIAL_PANE_PAMPKIN_000 10 +#define MAP_ICON_01_SPECIAL_PANE_TERY_000 11 +#define MAP_ICON_01_SPECIAL_PANE_TIKURIN_000 12 +#define MAP_ICON_01_SPECIAL_PANE_UTA_000 13 +#define MAP_ICON_01_SPECIAL_PANE_MUSI_000 14 +#define MAP_ICON_01_SPECIAL_PANE_SKYLOFT_02 15 +#define MAP_ICON_01_SPECIAL_PANE_ROULETTE_01 16 +#define MAP_ICON_01_SPECIAL_PANE_TAKEGIRI_01 17 +#define MAP_ICON_01_SPECIAL_PANE_KOBUNB_01 18 +#define MAP_ICON_01_SPECIAL_PANE_SEBASUN_01 19 +#define MAP_ICON_01_SPECIAL_PANE_COMMONICON_000 20 +#define MAP_ICON_01_SPECIAL_PANE_SAVEICON_000 21 +#define MAP_ICON_01_SPECIAL_PANE_AREALIGHT_01 22 +#define MAP_ICON_01_SPECIAL_PANE_NUSI_000 23 +#define MAP_ICON_01_SPECIAL_PANE_TERRYSHOP_01 24 +#define MAP_ICON_01_SPECIAL_PANE_SEEKERICON_01 25 +#define MAP_ICON_01_SPECIAL_PANE_MUSHI_01 26 + +#define MAP_ICON_01_NUM_SPECIAL_PANES 27 + +static const char *sMapIcon01SpecialPictureNames[] = { + "P_doddess_00", "P_domitory_00", "P_shop_00", "P_mHusband_00", "P_mWife_00", "P_tool_00", "P_keep_00", + "P_junk_00", "P_fortune_00", "P_ruletou_00", "P_pampkin_00", "P_tery_00", "P_tikurin_00", "P_uta_00", + "P_musi_00", "P_skyloft_00", "P_icon_01", "P_icon_02", "P_icon_00", "P_icon_04", "P_commonIcon_00", + "P_saveIcon_01", "P_light_00_00", "P_nusi_00", "P_terry_01", "P_seeker_00", "P_mushi_00", + +}; + +#define MAP_ICON_01_SPECIAL_PICTURE_DODDESS_00 0 +#define MAP_ICON_01_SPECIAL_PICTURE_DOMITORY_00 1 +#define MAP_ICON_01_SPECIAL_PICTURE_SHOP_00 2 +#define MAP_ICON_01_SPECIAL_PICTURE_MHUSBAND_00 3 +#define MAP_ICON_01_SPECIAL_PICTURE_MWIFE_00 4 +#define MAP_ICON_01_SPECIAL_PICTURE_TOOL_00 5 +#define MAP_ICON_01_SPECIAL_PICTURE_KEEP_00 6 +#define MAP_ICON_01_SPECIAL_PICTURE_JUNK_00 7 +#define MAP_ICON_01_SPECIAL_PICTURE_FORTUNE_00 8 +#define MAP_ICON_01_SPECIAL_PICTURE_RULETOU_00 9 +#define MAP_ICON_01_SPECIAL_PICTURE_PAMPKIN_00 10 +#define MAP_ICON_01_SPECIAL_PICTURE_TERY_00 11 +#define MAP_ICON_01_SPECIAL_PICTURE_TIKURIN_00 12 +#define MAP_ICON_01_SPECIAL_PICTURE_UTA_00 13 +#define MAP_ICON_01_SPECIAL_PICTURE_MUSI_00 14 +#define MAP_ICON_01_SPECIAL_PICTURE_SKYLOFT_00 15 +#define MAP_ICON_01_SPECIAL_PICTURE_ICON_01 16 +#define MAP_ICON_01_SPECIAL_PICTURE_ICON_02 17 +#define MAP_ICON_01_SPECIAL_PICTURE_ICON_00 18 +#define MAP_ICON_01_SPECIAL_PICTURE_ICON_04 19 +#define MAP_ICON_01_SPECIAL_PICTURE_COMMONICON_00 20 +#define MAP_ICON_01_SPECIAL_PICTURE_SAVEICON_01 21 +#define MAP_ICON_01_SPECIAL_PICTURE_LIGHT_00_00 22 +#define MAP_ICON_01_SPECIAL_PICTURE_NUSI_00 23 +#define MAP_ICON_01_SPECIAL_PICTURE_TERRY_01 24 +#define MAP_ICON_01_SPECIAL_PICTURE_SEEKER_00 25 +#define MAP_ICON_01_SPECIAL_PICTURE_MUSHI_00 26 + +#define MAP_ICON_01_NUM_SPECIAL_PICTURES 27 + +static const char *sTerryOnOff = "N_terryOnOff_00"; + +bool dLytMapIcon01_c::build(d2d::ResAccIf_c *resAcc) { + // TODO - ... + mpResAcc = resAcc; + mLyt.setResAcc(resAcc); + mLyt.build("mapIcon_01.brlyt", nullptr); + for (int i = 0; i < MAP_ICON_01_NUM_ANIMS; i++) { + mAnm[i].init(brlanMapMapIcon01[i].mFile, mpResAcc, mLyt.getLayout(), brlanMapMapIcon01[i].mName); + mAnm[i].bind(false); + } + + if (daPlayerActBase_c::getCurrentTunicType() == 1) { + setLinkTunic(1); + } else { + setLinkTunic(0); + } + + // TODO bunch of setters + + if (StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_TRIFORCE_COMPLETE)) { + setGoddessStatue(false); + } else { + setGoddessStatue(true); + } + + for (int i = 0; i < MAP_ICON_01_NUM_PANES; i++) { + mpPanes[i] = mLyt.findPane(sPaneNamesIcon01[i]); + } + + for (int i = 0; i < MAP_ICON_01_NUM_BOUNDINGS; i++) { + mpBoundings[i] = mLyt.findBounding(sMapIcon01BoundingNames[i]); + } + + // TODO - why 56 and not 59 + for (int i = 0; i < 56; i++) { + mUnk3[i].bounding = mpBoundings[i]; + } + + for (int i = 0; i < MAP_ICON_01_NUM_BOUNDINGS; i++) { + mpBoundings[i]->SetVisible(false); + } + + mLyt.calc(); + + for (int i = 0; i < MAP_ICON_01_NUM_SPECIAL_PANES; i++) { + mpSpecialPanes[i] = mLyt.findPane(sMapIcon01SpecialPaneNames[i]); + } + + for (int i = 0; i < MAP_ICON_01_NUM_SPECIAL_PICTURES; i++) { + mpSpecialPictures[i] = mLyt.findPane(sMapIcon01SpecialPictureNames[i]); + } + + mpTerryOnOffPane = mLyt.findPane(sTerryOnOff); + setTerry(false); + + for (int i = 0; i < 35; i++) { + mPassIdxes[i] = i; + } + + checkMapMode(); + + for (int i = 0; i < (int)ARRAY_LENGTH(mIconAnims); i++) { + mIconAnims[i].cmdIndex = 100; + mIconAnims[i].frame = 0.0f; + mIconAnims[i].animIn = false; + mIconAnims[i].animOut = false; + mIconAnims[i].idleVisible = false; + mIconAnims[i].field_0x0B = 0; + mIconAnims[i].visible = false; + } + + setupActorDrawCommands(); + setupStageDrawCommands(); + setupLinkDrawCommand(); + + if (field_0x0C70 == 1) { + setupTriforceDrawCommands(); + } + + if (field_0x0C70 == 4) { + setupUnkDrawCommand(); + } + + // TODO - ... + + sortDrawCommands(); + + mCsHitCheck.init(mLyt.getLayout()->GetRootPane(), 0x1, 0, 0); + dCsMgr_c::GetInstance()->registCursorTarget(&mCsHitCheck); + resetDrawCommands(); + return true; +} + +bool dLytMapIcon01_c::remove() { + for (int i = 0; i < MAP_ICON_01_NUM_ANIMS; i++) { + mAnm[i].unbind(); + mAnm[i].remove(); + } + dCsMgr_c::GetInstance()->unregistCursorTarget(&mCsHitCheck); + return true; +} + +bool dLytMapIcon01_c::execute() { + for (int i = 0; i < MAP_ICON_01_ANIM_FORCE_IN + 1 - MAP_ICON_01_ANIM_TRES_OUT; i++) { + if (mAnm[MAP_ICON_01_ANIM_TRES_OUT + i].isEnabled() && mAnm[MAP_ICON_01_ANIM_TRES_OUT + i].isStop2()) { + mAnm[MAP_ICON_01_ANIM_TRES_OUT + i].setAnimEnable(false); + } + } + mLyt.calc(); + checkMapMode(); + loadFlags(); + + return true; +} + +void dLytMapIcon01_c::draw() { + // TODO - tons of GPR regswaps, mAng nonsense, otherwise OK + mAng mapRot = dLytMapGlobal_c::GetInstance()->getMapRotation(); + // Maybe compiler-generated + u8 *idxes = mPassIdxes; + for (int pass = 0; pass < 35; pass++, idxes++) { + u8 idx = *idxes; + if (mNumCommandsPerPass[idx]) { + for (int cmd = 0; cmd < mNumCommands; cmd++) { + // Maybe compiler-generated + const mAng &commandRot = mCommands[cmd].rotation; + // Suspicious cast + if (idx == (int)mCommands[cmd].passIdx) { + s32 paneIdx = mCommands[cmd].paneIdx; + nw4r::lyt::Pane *pane = mpPanes[paneIdx]; + switch (paneIdx) { + case MAP_ICON_01_PANE_PLAYER_000: { + mVec3_c rotate(0.0f, 0.0f, 0.0f); + if (dLytMapGlobal_c::GetInstance()->getField_0x55() != 0) { + dAcPy_c *link = getLinkPtr(); + rotate.z = (link->vt_0x19C() + link->mRotation.y + (-mapRot)).degree2(); + } else { + rotate.z = (field_0x0D3A + (-mapRot)).degree2(); + } + pane->SetRotate(rotate); + pane = pane->GetParent(); + break; + } + case MAP_ICON_01_PANE_DOOR_000: + case MAP_ICON_01_PANE_START_000: { + mVec3_c rotate(0.0f, 0.0f, ((-mapRot) + commandRot).degree2()); + pane->SetRotate(rotate); + pane = mpPanes[paneIdx]->GetParent(); + break; + } + case MAP_ICON_01_PANE_MARK_000: + case MAP_ICON_01_PANE_RULETOU_000: + case MAP_ICON_01_PANE_PAMPKIN_000: + case MAP_ICON_01_PANE_TERY_000: + case MAP_ICON_01_PANE_TIKURIN_000: + case MAP_ICON_01_PANE_UTA_000: + case MAP_ICON_01_PANE_MUSI_000: + case MAP_ICON_01_PANE_SKYLOFT_000: { + mVec3_c rotate(0.0f, 0.0f, (-mapRot).degree2()); + pane->SetRotate(rotate); + pane = mpPanes[paneIdx]->GetParent(); + break; + } + case MAP_ICON_01_PANE_AREALIGHT_00: { + if (field_0x0D48 != 100 && field_0x0D48 == cmd) { + drawAreaLight(0, pane); + } else if (field_0x0D49 != 100 && field_0x0D49 == cmd) { + drawAreaLight(1, pane); + } else if (field_0x0D4A != 100 && field_0x0D4A == cmd) { + drawAreaLight(2, pane); + } + break; + } + case MAP_ICON_01_PANE_SAVEICON_00: { + if (field_0x0D4B[cmd] != 100) { + drawSaveObj(field_0x0D4B[cmd], pane); + } + break; + } + } + + if (paneIdx == MAP_ICON_01_PANE_CLOUDBIG_000) { + if (dScGame_c::isCurrentStage("F020")) { + if (field_0x0C81) { + drawCloud(1, pane); + } else { + drawCloud(0, pane); + } + } else if (dScGame_c::isCurrentStage("F023")) { + drawCloud(2, pane); + } + mVec3_c rotate(0.0f, 0.0f, (-mapRot).degree2()); + pane->SetRotate(rotate); + pane = mpPanes[paneIdx]->GetParent(); + } + + u8 alpha = dLytMapGlobal_c::GetInstance()->getAlpha(); + bool found = false; + int i = 0; + for (; i < mNumAnims; i++) { + if (cmd == mIconAnims[i].cmdIndex) { + found = true; + break; + } + } + + if (found == true) { + if (field_0x0C84 && mIconAnims[i].animIn == true) { + if (field_0x1845 == 1) { + mIconAnims[i].idleVisible = true; + mIconAnims[i].animIn = true; + } else { + mIconAnims[i].idleVisible = false; + mIconAnims[i].animIn = false; + } + } + + if (field_0xD0C != field_0xD10) { + mIconAnims[i].animIn = false; + mIconAnims[i].animOut = false; + } + + if (mIconAnims[i].animIn) { + f32 f = mIconAnims[i].frame; + if (f <= field_0x1838) { + drawWithAnimIn(paneIdx, pane, f); + mIconAnims[i].frame += 1.0f; + mIconAnims[i].visible = true; + if (!field_0x184C) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_MAP_ICON_APPEAR); + field_0x184C = true; + } + } else { + mIconAnims[i].animIn = false; + mIconAnims[i].visible = true; + field_0x184C = false; + } + } else if (mIconAnims[i].animOut) { + f32 f = mIconAnims[i].frame; + if (f <= field_0x183C) { + drawWithAnimOut(paneIdx, pane, f); + mIconAnims[i].frame += 1.0f; + mIconAnims[i].visible = true; + } else { + mIconAnims[i].animOut = false; + mIconAnims[i].visible = true; + } + } else if (mIconAnims[i].idleVisible) { + drawFullyIn(paneIdx, pane); + mIconAnims[i].visible = true; + } + + if (mIconAnims[i].visible == true) { + pane->SetAlpha(alpha); + pane->SetTranslate(vec2ToVec3XY(mCommands[cmd].position + field_0x0D40)); + pane->Animate(0); + pane->CalculateMtx(mLyt.getDrawInfo()); + pane->Draw(mLyt.getDrawInfo()); + } + } else { + // No animation data - simply draw + pane->SetAlpha(alpha); + pane->SetTranslate(vec2ToVec3XY(mCommands[cmd].position + field_0x0D40)); + pane->Animate(0); + pane->CalculateMtx(mLyt.getDrawInfo()); + pane->Draw(mLyt.getDrawInfo()); + } + } + } + } + } + + mVec2_c v2(0.0f, 0.0f); + for (int i = 0; i < field_0x0E13; i++) { + if (mUnk3[i + MAP_ICON_01_BOUNDING_COMMONICON_00].bounding->IsVisible()) { + v2 = mUnk3[i + MAP_ICON_01_BOUNDING_COMMONICON_00].field_0x10; + mUnk3[i + MAP_ICON_01_BOUNDING_COMMONICON_00].bounding->SetTranslate(vec2ToVec3XY(v2 + field_0x0D40)); + mUnk3[i + MAP_ICON_01_BOUNDING_COMMONICON_00].bounding->CalculateMtx(mLyt.getDrawInfo()); + mUnk3[i + MAP_ICON_01_BOUNDING_COMMONICON_00].bounding->Draw(mLyt.getDrawInfo()); + } + } + + field_0xD10 = field_0xD0C; +} + +static const char *sMapPrefix = "MAP_"; + +void dLytMapIcon01_c::resetDrawCommands() { + for (int i = 0; i < (int)ARRAY_LENGTH(mCommands); i++) { + mCommands[i].position.set(0.0f, 0.0f); + mCommands[i].rotation.setF(0.0f); + mCommands[i].paneIdx = MAP_ICON_01_NUM_PANES; + mCommands[i].passIdx = 35; + field_0x0D4B[i] = 100; + field_0x0C85[i] = 0; + } + + field_0xD0C = 0; + + for (int i = 0; i < (int)ARRAY_LENGTH(mNumCommandsPerPass); i++) { + mNumCommandsPerPass[i] = 0; + } + + mNumCommands = 0; + + for (int i = 0; i < (int)ARRAY_LENGTH(mUnk3); i++) { + mUnk3[i].field_0x00 = 100; + mUnk3[i].field_0x10.set(0.0f, 0.0f); + mUnk3[i].field_0x08 = 0.0f; + mUnk3[i].field_0x0C = 0.0f; + mUnk3[i].field_0x18 = 0; + mUnk3[i].field_0x19 = 0; + mUnk3[i].field_0x1C = sMapPrefix; + } + + field_0x0E13 = 0; + field_0x0C83 = 0; + field_0x0C84 = 0; + + fn_80181C40(); + + field_0x0D48 = 100; + field_0x0D49 = 100; + field_0x0D4A = 100; + + field_0x0C74 = 0; + field_0x0C75 = 0; + field_0x0C76 = 0; + field_0x0C77 = 0; + field_0x0C78 = 0; + field_0x0C79 = 0; + field_0x0C7A = 0; + field_0x0C7B = 0; + field_0x0C7C = 0; + field_0x0C7D = 0; + field_0x0C7E = 0; + field_0x0C7F = 0; + field_0x0C80 = 0; + field_0x0C81 = 0; + field_0x0C82 = 0; + + for (int i = 0; i < (int)ARRAY_LENGTH(mIconAnims); i++) { + mIconAnims[i].visible = 0; + } + + mNumAnims = 0; +} + +void dLytMapIcon01_c::setLinkTunic(s32 type) { + f32 frame = 0.0f; + switch (type) { + case 1: frame = 0.0f; break; + case 0: frame = 1.0f; break; + } + + mAnm[MAP_ICON_01_ANIM_PLAYER_2_PATTERN].setAnimEnable(true); + mAnm[MAP_ICON_01_ANIM_PLAYER_2_PATTERN].setFrame(frame); + mLyt.calc(); + mAnm[MAP_ICON_01_ANIM_PLAYER_2_PATTERN].setAnimEnable(false); +} + +void dLytMapIcon01_c::drawWithAnimIn(u32 paneIdx, nw4r::lyt::Pane *pane, f32 frame) { + if (paneIdx == MAP_ICON_01_PANE_DOORKEY_00) { + paneIdx = MAP_ICON_01_PANE_DOOR_000; + } + + // NOTE: Treasure/Mark/Door/Save/Triforce order is the same between anims and panes + u8 anmIdx = paneIdx - MAP_ICON_01_PANE_TREASURE_00 + MAP_ICON_01_ANIM_TRES_IN; + + if (frame <= mAnm[anmIdx].getLastFrame()) { + mAnm[anmIdx].setFrame(frame); + // Maybe inlines/macros + d2d::AnmGroup_c &anm = mAnm[anmIdx]; + anm.setAnimEnable(true); + pane->Animate(0); + anm.setAnimEnable(false); + } +} + +void dLytMapIcon01_c::drawWithAnimOut(u32 paneIdx, nw4r::lyt::Pane *pane, f32 frame) { + if (paneIdx == MAP_ICON_01_PANE_DOORKEY_00) { + paneIdx = MAP_ICON_01_PANE_DOOR_000; + } + + // NOTE: Treasure/Mark/Door/Save/Triforce order is the same between anims and panes + u8 anmIdx = paneIdx - MAP_ICON_01_PANE_TREASURE_00 + MAP_ICON_01_ANIM_TRES_OUT; + + if (frame <= mAnm[anmIdx].getLastFrame()) { + mAnm[anmIdx].setFrame(frame); + // Maybe inlines/macros + d2d::AnmGroup_c &anm = mAnm[anmIdx]; + anm.setAnimEnable(true); + pane->Animate(0); + anm.setAnimEnable(false); + } +} + +void dLytMapIcon01_c::drawFullyIn(u32 paneIdx, nw4r::lyt::Pane *pane) { + if (paneIdx == MAP_ICON_01_PANE_DOORKEY_00) { + paneIdx = MAP_ICON_01_PANE_DOOR_000; + } + + // NOTE: Treasure/Mark/Door/Save/Triforce order is the same between anims and panes + u8 anmIdx = paneIdx - MAP_ICON_01_PANE_TREASURE_00 + MAP_ICON_01_ANIM_TRES_IN; + + mAnm[anmIdx].setToEnd2(); + // Maybe inlines/macros + d2d::AnmGroup_c &anm = mAnm[anmIdx]; + anm.setAnimEnable(true); + pane->Animate(0); + anm.setAnimEnable(false); +} + +void dLytMapIcon01_c::checkMapMode() { + s32 current = dLytMapGlobal_c::GetInstance()->getCurrentMapMode(); + s32 next = dLytMapGlobal_c::GetInstance()->getNextMapMode(); + + if (current == dLytMapGlobal_c::MAPMODE_PROVINCE && next == dLytMapGlobal_c::MAPMODE_ZOOM) { + return; + } + + if (current == dLytMapGlobal_c::MAPMODE_ZOOM && next == dLytMapGlobal_c::MAPMODE_PROVINCE) { + return; + } + + if (current == dLytMapGlobal_c::MAPMODE_STAGE && next == dLytMapGlobal_c::MAPMODE_ZOOM) { + mModeCheckResult = MODE_TRANSITION_TO_ZOOM; + return; + } + + if (current == dLytMapGlobal_c::MAPMODE_ZOOM && next == dLytMapGlobal_c::MAPMODE_STAGE) { + mModeCheckResult = MODE_TRANSITION_TO_STAGE; + return; + } + + if (current == next && current == dLytMapGlobal_c::MAPMODE_PROVINCE) { + return; + } + + if (current == next && current == dLytMapGlobal_c::MAPMODE_STAGE) { + mModeCheckResult = MODE_STABLE_STAGE; + return; + } + + if (current == next && current == dLytMapGlobal_c::MAPMODE_ZOOM) { + mModeCheckResult = MODE_STABLE_ZOOM; + return; + } +} + +void dLytMapIcon01_c::setupTboxDrawCommand(dAcBase_c *actor) { + if (actor->mProfileName == fProfile::TBOX && !actor->checkActorProperty(dAcBase_c::AC_PROP_0x100) && + field_0xD0C == dStage_c::GetInstance()->getMapRelated()->fn_801B4F10(actor->mRoomID, actor->mPosition)) { + dAcTbox_c *box = static_cast(actor); + if (box->getVariant() == dAcTbox_c::GODDESS) { + u16 flag = box->getParams2Lower(); + if (StoryflagManager::sInstance->getCounterOrFlag(flag) != 0 && box->hasBeenOpened() != true) { + setupTboxDrawCommandGoddessClosed(box); + } + } else if (box->hasBeenOpened() != true) { + if (field_0x0C70 == 1) { + setupTboxDrawCommandClosed(box); + } + } else { + setupTboxDrawCommandOpen(box); + } + } +} + +void dLytMapIcon01_c::setupTboxDrawCommandClosed(dAcTbox_c *box) { + if (mNumCommands < 100) { + mVec2_c pos(0.0f, 0.0f); + projectOntoMap(box->mPosition, pos); + mCommands[mNumCommands].passIdx = 17; + mCommands[mNumCommands].paneIdx = MAP_ICON_01_PANE_TREASURE_00; + mCommands[mNumCommands].position.x = pos.x; + mCommands[mNumCommands].position.y = pos.y; + + if (checkHasMap()) { + if (field_0x0C84) { + mIconAnims[mNumAnims].cmdIndex = mNumCommands; + mIconAnims[mNumAnims].idleVisible = true; + mIconAnims[mNumAnims].animIn = true; + } else { + mIconAnims[mNumAnims].cmdIndex = mNumCommands; + mIconAnims[mNumAnims].idleVisible = true; + mIconAnims[mNumAnims].animIn = false; + } + } else { + mIconAnims[mNumAnims].cmdIndex = mNumCommands; + mIconAnims[mNumAnims].idleVisible = false; + } + + mNumAnims++; + mNumCommandsPerPass[17]++; + mNumCommands++; + } +} + +void dLytMapIcon01_c::setupTboxDrawCommandOpen(dAcTbox_c *box) { + if (mNumCommands < 100) { + mVec2_c pos(0.0f, 0.0f); + projectOntoMap(box->mPosition, pos); + mCommands[mNumCommands].passIdx = 17; + mCommands[mNumCommands].paneIdx = MAP_ICON_01_PANE_TREASURE_01; + mCommands[mNumCommands].position.x = pos.x; + mCommands[mNumCommands].position.y = pos.y; + + mNumCommandsPerPass[17]++; + mNumCommands++; + } +} + +void dLytMapIcon01_c::setupTboxDrawCommandGoddessClosed(dAcTbox_c *box) { + if (mNumCommands < 100) { + mVec2_c pos(0.0f, 0.0f); + projectOntoMap(box->mPosition, pos); + mCommands[mNumCommands].passIdx = 28; + mCommands[mNumCommands].paneIdx = MAP_ICON_01_PANE_GODDESSC_00; + mCommands[mNumCommands].position.x = pos.x; + mCommands[mNumCommands].position.y = pos.y; + + mNumCommandsPerPass[28]++; + mNumCommands++; + } +}