diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 272d4257..9c33c219 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -1404,6 +1404,7 @@ d/d_cs_game.cpp: .ctors start:0x804DB820 end:0x804DB824 .rodata start:0x804EAC38 end:0x804EACF0 .data start:0x8052E968 end:0x80530170 + .sdata start:0x80573448 end:0x80573460 .sbss start:0x805757B0 end:0x805757B8 .sdata2 start:0x8057B5C0 end:0x8057B650 .bss start:0x805B38B8 end:0x805B4178 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index fe4451f5..63ffdb4a 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -3915,11 +3915,11 @@ setFramesLeftOnPause__15dTagProcessor_cFPQ34nw4r2ut4RectPQ34nw4r2ut15PrintContex fn_800B5500__15dTagProcessor_cFUcPw = .text:0x800B5500; // type:function size:0x18 fn_800B5520__15dTagProcessor_cFPw = .text:0x800B5520; // type:function size:0x14 fn_800B5540__15dTagProcessor_cFPw = .text:0x800B5540; // type:function size:0x28 -writeHeroname__15dTagProcessor_cFPwPll = .text:0x800B5570; // type:function size:0x110 -writeItem__15dTagProcessor_cFPwPwPll = .text:0x800B5680; // type:function size:0x1DC -writeStringArg__15dTagProcessor_cFPwPwPll = .text:0x800B5860; // type:function size:0x1C0 -writeNumericArg__15dTagProcessor_cFPwPwPll = .text:0x800B5A20; // type:function size:0x3AC -writeSingularOrPluralWord__15dTagProcessor_cFPwPwPll = .text:0x800B5DD0; // type:function size:0x1FC +writeHeroname__15dTagProcessor_cFPwPlb = .text:0x800B5570; // type:function size:0x110 +writeItem__15dTagProcessor_cFPwPwPlb = .text:0x800B5680; // type:function size:0x1DC +writeStringArg__15dTagProcessor_cFPwPwPlb = .text:0x800B5860; // type:function size:0x1C0 +writeNumericArg__15dTagProcessor_cFPwPwPlb = .text:0x800B5A20; // type:function size:0x3AC +writeSingularOrPluralWord__15dTagProcessor_cFPwPwPlb = .text:0x800B5DD0; // type:function size:0x1FC writeSingleCharacter__15dTagProcessor_cFwPwPl = .text:0x800B5FD0; // type:function size:0x10C fn_800B60E0__15dTagProcessor_cFUcPw = .text:0x800B60E0; // type:function size:0x24 fn_800B6110__15dTagProcessor_cFUcPw = .text:0x800B6110; // type:function size:0x24 @@ -3937,7 +3937,7 @@ calcRectIcon__15dTagProcessor_cFPQ34nw4r2ut4RectPQ34nw4r2ut15PrintContextPw = configureWriterForIcon__15dTagProcessor_cFPQ34nw4r2ut17TextWriterBasePQ34nw4r2ut15PrintContextUsl = .text:0x800B70D0; // type:function size:0x3A4 somethingWithScrapperAndMusic__15dTagProcessor_cFPw = .text:0x800B7480; // type:function size:0xB8 restoreColor__15dTagProcessor_cFPQ34nw4r2ut15PrintContextUc = .text:0x800B7540; // type:function size:0x250 -writeTextNormal__15dTagProcessor_cFPCwPwPlUcl = .text:0x800B7790; // type:function size:0xD8 +writeTextNormal__15dTagProcessor_cFPCwPwPlUcb = .text:0x800B7790; // type:function size:0xD8 symbolToFontIdx__15dTagProcessor_cFl = .text:0x800B7870; // type:function size:0x10 getAnimatedIconReplacement__15dTagProcessor_cFUc = .text:0x800B7880; // type:function size:0x210 getAnimatedWiggleIconReplacement__15dTagProcessor_cFUc = .text:0x800B7A90; // type:function size:0x9C @@ -11266,8 +11266,8 @@ dCsGame_c_classInit__Fv = .text:0x801BD250; // type:function size:0x30 __ct__13dCsGame_HIO_cFv = .text:0x801BD280; // type:function size:0x8C __dt__13dCsGame_HIO_cFv = .text:0x801BD310; // type:function size:0x40 __ct__9dCsGame_cFv = .text:0x801BD350; // type:function size:0x4CC -fn_801BD820 = .text:0x801BD820; // type:function size:0x40 -fn_801BD860 = .text:0x801BD860; // type:function size:0x40 +__dt__17dCsGameLytBase1_cFv = .text:0x801BD820; // type:function size:0x40 +__dt__17dCsGameLytBase2_cFv = .text:0x801BD860; // type:function size:0x40 __dt__13dCsGameLyt1_cFv = .text:0x801BD8A0; // type:function size:0x5C __dt__13dCsGameLyt2_cFv = .text:0x801BD900; // type:function size:0x5C __dt__40sFState_cFv = .text:0x801BD960; // type:function size:0x58 @@ -11302,15 +11302,15 @@ __dt__112sStateMgr_cFv = .text:0x801BE930; // type:function size:0xA4 __dt__Q39dCsGame_c15lytItemCursor_c14lytVacuumCsr_cFv = .text:0x801BE9E0; // type:function size:0xB4 __dt__Q29dCsGame_c15lytItemCursor_cFv = .text:0x801BEAA0; // type:function size:0x2E4 -fn_801BED90 = .text:0x801BED90; // type:function size:0x40 +__dt__22dCursorInterfaceGame_cFv = .text:0x801BED90; // type:function size:0x40 __dt__9dCsGame_cFv = .text:0x801BEDD0; // type:function size:0x33C create__9dCsGame_cFv = .text:0x801BF110; // type:function size:0xF4 doDelete__9dCsGame_cFv = .text:0x801BF210; // type:function size:0x84 -CsGame__baseUpdate = .text:0x801BF2A0; // type:function size:0x25C -fn_801BF500 = .text:0x801BF500; // type:function size:0x14 -CsGame__draw = .text:0x801BF520; // type:function size:0xBC +execute__9dCsGame_cFv = .text:0x801BF2A0; // type:function size:0x25C +setPosition__17dCsGameLytBase1_cFRC7mVec2_c = .text:0x801BF500; // type:function size:0x14 +draw__9dCsGame_cFv = .text:0x801BF520; // type:function size:0xBC fn_801BF5E0__9dCsGame_cCFv = .text:0x801BF5E0; // type:function size:0x44 -fn_801BF630 = .text:0x801BF630; // type:function size:0x288 +isForcedHidden__9dCsGame_cCFv = .text:0x801BF630; // type:function size:0x288 setNextCursorType__9dCsGame_cFQ39dCsGame_c15lytItemCursor_c12CursorType_e = .text:0x801BF8C0; // type:function size:0x10 setCursorTypeNoneMaybe__9dCsGame_cFv = .text:0x801BF8D0; // type:function size:0x8 setCursorTypePointer__9dCsGame_cFv = .text:0x801BF8E0; // type:function size:0x18 @@ -11324,19 +11324,19 @@ fn_801BFAC0 = .text:0x801BFAC0; // type:function size:0x8 fn_801BFAD0 = .text:0x801BFAD0; // type:function size:0x54 fn_801BFB30 = .text:0x801BFB30; // type:function size:0x3C fn_801BFB70 = .text:0x801BFB70; // type:function size:0x48 -fn_801BFBC0 = .text:0x801BFBC0; // type:function size:0x8 -fn_801BFBD0 = .text:0x801BFBD0; // type:function size:0x178 -fn_801BFD50 = .text:0x801BFD50; // type:function size:0x50 -fn_801BFDA0 = .text:0x801BFDA0; // type:function size:0x88 -fn_801BFE30 = .text:0x801BFE30; // type:function size:0x34 -fn_801BFE70 = .text:0x801BFE70; // type:function size:0xC -fn_801BFE80 = .text:0x801BFE80; // type:function size:0x20 -fn_801BFEA0 = .text:0x801BFEA0; // type:function size:0x4C -fn_801BFEF0 = .text:0x801BFEF0; // type:function size:0x8 -fn_801BFF00 = .text:0x801BFF00; // type:function size:0xC -fn_801BFF10 = .text:0x801BFF10; // type:function size:0x20 -fn_801BFF30 = .text:0x801BFF30; // type:function size:0x4C -fn_801BFF80 = .text:0x801BFF80; // type:function size:0x8 +setCursorTypePlayerCam__9dCsGame_cFv = .text:0x801BFBC0; // type:function size:0x8 +getCursorPos__22dCursorInterfaceGame_cFv = .text:0x801BFBD0; // type:function size:0x178 +init__17dCsGameLytBase2_cFv = .text:0x801BFD50; // type:function size:0x50 +execute__17dCsGameLytBase2_cFv = .text:0x801BFDA0; // type:function size:0x88 +draw__17dCsGameLytBase2_cFv = .text:0x801BFE30; // type:function size:0x34 +loadResAcc__13dCsGameLyt1_cFv = .text:0x801BFE70; // type:function size:0xC +build__13dCsGameLyt1_cFv = .text:0x801BFE80; // type:function size:0x20 +init__13dCsGameLyt1_cFv = .text:0x801BFEA0; // type:function size:0x4C +remove__13dCsGameLyt1_cFv = .text:0x801BFEF0; // type:function size:0x8 +loadResAcc__13dCsGameLyt2_cFv = .text:0x801BFF00; // type:function size:0xC +build__13dCsGameLyt2_cFv = .text:0x801BFF10; // type:function size:0x20 +init__13dCsGameLyt2_cFv = .text:0x801BFF30; // type:function size:0x4C +remove__13dCsGameLyt2_cFv = .text:0x801BFF80; // type:function size:0x8 initializeState_Invisible__Q29dCsGame_c15lytItemCursor_cFv = .text:0x801BFF90; // type:function size:0x4 executeState_Invisible__Q29dCsGame_c15lytItemCursor_cFv = .text:0x801BFFA0; // type:function size:0x4 finalizeState_Invisible__Q29dCsGame_c15lytItemCursor_cFv = .text:0x801BFFB0; // type:function size:0x4 @@ -11370,11 +11370,11 @@ fn_801C01D0 = .text:0x801C01D0; // type:function size:0x8 fn_801C01E0 = .text:0x801C01E0; // type:function size:0x8 fn_801C01F0 = .text:0x801C01F0; // type:function size:0x8 fn_801C0200 = .text:0x801C0200; // type:function size:0x8 -fn_801C0210 = .text:0x801C0210; // type:function size:0xC -fn_801C0220 = .text:0x801C0220; // type:function size:0x20 -doInit__Q29dCsGame_c15lytItemCursor_cFv = .text:0x801C0240; // type:function size:0x19C -fn_801C03E0 = .text:0x801C03E0; // type:function size:0x28 -fn_801C0410 = .text:0x801C0410; // type:function size:0x108 +loadResAcc__Q29dCsGame_c15lytItemCursor_cFv = .text:0x801C0210; // type:function size:0xC +build__Q29dCsGame_c15lytItemCursor_cFv = .text:0x801C0220; // type:function size:0x20 +init__Q29dCsGame_c15lytItemCursor_cFv = .text:0x801C0240; // type:function size:0x19C +remove__Q29dCsGame_c15lytItemCursor_cFv = .text:0x801C03E0; // type:function size:0x28 +execute__Q29dCsGame_c15lytItemCursor_cFv = .text:0x801C0410; // type:function size:0x108 executeState__96sStateMgr_cFv = .text:0x801C0520; // type:function size:0x10 initializeState_NotFind__Q39dCsGame_c15lytItemCursor_c15lytDowsingCsr_cFv = .text:0x801C0530; // type:function size:0x4 executeState_NotFind__Q39dCsGame_c15lytItemCursor_c15lytDowsingCsr_cFv = .text:0x801C0540; // type:function size:0x70 @@ -11395,9 +11395,9 @@ finalizeState_ToNotFind__Q39dCsGame_c15lytItemCursor_c15lytDowsingCsr_cFv = .tex enter__Q39dCsGame_c15lytItemCursor_c15lytDowsingCsr_cFv = .text:0x801C09E0; // type:function size:0x108 fn_801C0AF0 = .text:0x801C0AF0; // type:function size:0x74 fn_801C0B70 = .text:0x801C0B70; // type:function size:0x8 -fn_801C0B80 = .text:0x801C0B80; // type:function size:0x24 -fn_801C0BB0 = .text:0x801C0BB0; // type:function size:0x1C -fn_801C0BD0 = .text:0x801C0BD0; // type:function size:0x140 +moveEffectsIn__Q39dCsGame_c15lytItemCursor_c15lytDowsingCsr_cFv = .text:0x801C0B80; // type:function size:0x24 +moveEffectsOut__Q39dCsGame_c15lytItemCursor_c15lytDowsingCsr_cFv = .text:0x801C0BB0; // type:function size:0x1C +updateEffects__Q39dCsGame_c15lytItemCursor_c15lytDowsingCsr_cFv = .text:0x801C0BD0; // type:function size:0x140 init__Q39dCsGame_c15lytItemCursor_c15lytDowsingCsr_cFv = .text:0x801C0D10; // type:function size:0x8C execute__Q39dCsGame_c15lytItemCursor_c15lytDowsingCsr_cFv = .text:0x801C0DA0; // type:function size:0x2B0 executeState__113sStateMgr_cFv = .text:0x801C1050; // type:function size:0x10 @@ -11425,7 +11425,7 @@ executeState_Charge__Q39dCsGame_c15lytItemCursor_c11lytBowCsr_cFv = .text:0x801C finalizeState_Charge__Q39dCsGame_c15lytItemCursor_c11lytBowCsr_cFv = .text:0x801C1660; // type:function size:0x4 enter__Q39dCsGame_c15lytItemCursor_c11lytBowCsr_cFv = .text:0x801C1670; // type:function size:0x1F4 init__Q39dCsGame_c15lytItemCursor_c11lytBowCsr_cFv = .text:0x801C1870; // type:function size:0x170 -fn_801C19E0 = .text:0x801C19E0; // type:function size:0x170 +execute__Q39dCsGame_c15lytItemCursor_c11lytBowCsr_cFv = .text:0x801C19E0; // type:function size:0x170 executeState__109sStateMgr_cFv = .text:0x801C1B50; // type:function size:0x10 CsGame__lytItemCursor__lytBowCsr__startDrawOrCharge = .text:0x801C1B60; // type:function size:0xB0 getStateID__109sStateMgr_cCFv = .text:0x801C1C10; // type:function size:0x10 @@ -11456,12 +11456,12 @@ finalizeState_ChargeFull__Q39dCsGame_c15lytItemCursor_c16lytPachinkoCsr_cFv = .t init__Q39dCsGame_c15lytItemCursor_c16lytPachinkoCsr_cFv = .text:0x801C2420; // type:function size:0x150 execute__Q39dCsGame_c15lytItemCursor_c16lytPachinkoCsr_cFv = .text:0x801C2570; // type:function size:0xFC executeState__114sStateMgr_cFv = .text:0x801C2670; // type:function size:0x10 -fn_801C2680 = .text:0x801C2680; // type:function size:0xC +setCharging__Q39dCsGame_c15lytItemCursor_c16lytPachinkoCsr_cFbf = .text:0x801C2680; // type:function size:0xC initializeState_Normal__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFv = .text:0x801C2690; // type:function size:0x10 executeState_Normal__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFv = .text:0x801C26A0; // type:function size:0xC8 changeState__114sStateMgr_cFRC12sStateIDIf_c = .text:0x801C2770; // type:function size:0x10 finalizeState_Normal__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFv = .text:0x801C2780; // type:function size:0x4 -fn_801C2790 = .text:0x801C2790; // type:function size:0x60 +setRotate__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFf = .text:0x801C2790; // type:function size:0x60 initializeState_ToLock__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFv = .text:0x801C27F0; // type:function size:0x8 executeState_ToLock__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFv = .text:0x801C2800; // type:function size:0xDC finalizeState_ToLock__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFv = .text:0x801C28E0; // type:function size:0x4 @@ -11472,7 +11472,7 @@ initializeState_ToNormal__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFv = .t executeState_ToNormal__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFv = .text:0x801C2A00; // type:function size:0xFC finalizeState_ToNormal__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFv = .text:0x801C2B00; // type:function size:0x4 enter__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFv = .text:0x801C2B10; // type:function size:0xDC -fn_801C2BF0 = .text:0x801C2BF0; // type:function size:0x8 +setLocked__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFb = .text:0x801C2BF0; // type:function size:0x8 init__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFv = .text:0x801C2C00; // type:function size:0xA4 execute__Q39dCsGame_c15lytItemCursor_c16lytCrawShotCsr_cFv = .text:0x801C2CB0; // type:function size:0x10 executeState__114sStateMgr_cFv = .text:0x801C2CC0; // type:function size:0x10 @@ -11490,14 +11490,14 @@ initializeState_ToNormal__Q39dCsGame_c15lytItemCursor_c14lytVacuumCsr_cFv = .tex executeState_ToNormal__Q39dCsGame_c15lytItemCursor_c14lytVacuumCsr_cFv = .text:0x801C2FD0; // type:function size:0x98 finalizeState_ToNormal__Q39dCsGame_c15lytItemCursor_c14lytVacuumCsr_cFv = .text:0x801C3070; // type:function size:0x4 enter__Q39dCsGame_c15lytItemCursor_c14lytVacuumCsr_cFv = .text:0x801C3080; // type:function size:0xD8 -fn_801C3160 = .text:0x801C3160; // type:function size:0x2C -fn_801C3190 = .text:0x801C3190; // type:function size:0x8 +setUnkFloat__Q39dCsGame_c15lytItemCursor_c14lytVacuumCsr_cFf = .text:0x801C3160; // type:function size:0x2C +setLocked__Q39dCsGame_c15lytItemCursor_c14lytVacuumCsr_cFb = .text:0x801C3190; // type:function size:0x8 init__Q39dCsGame_c15lytItemCursor_c14lytVacuumCsr_cFv = .text:0x801C31A0; // type:function size:0x50 execute__Q39dCsGame_c15lytItemCursor_c14lytVacuumCsr_cFv = .text:0x801C31F0; // type:function size:0x10 executeState__112sStateMgr_cFv = .text:0x801C3200; // type:function size:0x10 -fn_801C3210 = .text:0x801C3210; // type:function size:0x8 -fn_801C3220 = .text:0x801C3220; // type:function size:0x8 -fn_801C3230 = .text:0x801C3230; // type:function size:0x8 +getLyt__Q29dCsGame_c15lytItemCursor_cFv = .text:0x801C3210; // type:function size:0x8 +getLyt__13dCsGameLyt2_cFv = .text:0x801C3220; // type:function size:0x8 +getLyt__13dCsGameLyt1_cFv = .text:0x801C3230; // type:function size:0x8 build__43sFStateFct_cFRC12sStateIDIf_c = .text:0x801C3240; // type:function size:0x60 dispose__43sFStateFct_cFRP10sStateIf_c = .text:0x801C32A0; // type:function size:0xC build__59sFStateFct_cFRC12sStateIDIf_c = .text:0x801C32B0; // type:function size:0x60 @@ -35798,8 +35798,8 @@ __vt__86sStateMgr_c<17dLytCursorStick_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13 __vt__33sFStateFct_c<17dLytCursorStick_c> = .data:0x8052E938; // type:object size:0x14 scope:weak __vt__30sFState_c<17dLytCursorStick_c> = .data:0x8052E950; // type:object size:0x18 scope:weak g_profile_C_GAME = .data:0x8052E968; // type:object size:0xC -lbl_8052E974 = .data:0x8052E974; // type:object size:0x10 -lbl_8052E984 = .data:0x8052E984; // type:object size:0x10 +lbl_8052E974 = .data:0x8052E974; // type:object size:0xD data:string +lbl_8052E984 = .data:0x8052E984; // type:object size:0xD data:string lbl_8052E994 = .data:0x8052E994; // type:object size:0x14 data:string lbl_8052E9A8 = .data:0x8052E9A8; // type:object size:0x1C lbl_8052E9C4 = .data:0x8052E9C4; // type:object size:0xC data:string @@ -35843,12 +35843,20 @@ lbl_8052ED54 = .data:0x8052ED54; // type:object size:0x1C data:string lbl_8052ED70 = .data:0x8052ED70; // type:object size:0x10 lbl_8052ED80 = .data:0x8052ED80; // type:object size:0x20 lbl_8052EDA0 = .data:0x8052EDA0; // type:object size:0x10 -lbl_8052EDB0 = .data:0x8052EDB0; // type:object size:0x10 -lbl_8052EDC0 = .data:0x8052EDC0; // type:object size:0x84 +lbl_8052EDB0 = .data:0x8052EDB0; // type:object size:0xD data:string +lbl_8052EDC0 = .data:0x8052EDC0; // type:object size:0xD data:string +lbl_8052EDD0 = .data:0x8052EDD0; // type:object size:0xF data:string +lbl_8052EDE0 = .data:0x8052EDE0; // type:object size:0x10 data:string +lbl_8052EDF0 = .data:0x8052EDF0; // type:object size:0xF data:string +lbl_8052EE00 = .data:0x8052EE00; // type:object size:0x10 data:string +lbl_8052EE10 = .data:0x8052EE10; // type:object size:0xD data:string +lbl_8052EE20 = .data:0x8052EE20; // type:object size:0xA data:string +lbl_8052EE2C = .data:0x8052EE2C; // type:object size:0xA data:string +lbl_8052EE38 = .data:0x8052EE38; // type:object size:0xA data:string lbl_8052EE44 = .data:0x8052EE44; // type:object size:0xC __vt__9dCsGame_c = .data:0x8052EE50; // type:object size:0x4C __vt__Q29dCsGame_c15lytItemCursor_c = .data:0x8052EE9C; // type:object size:0x2C -lbl_8052EEC8 = .data:0x8052EEC8; // type:object size:0x10 +__vt__18dCsGameAnmGroups_c = .data:0x8052EEC8; // type:object size:0x10 __vt__66sFStateMgr_c = .data:0x8052EED8; // type:object size:0x30 __vt__96sStateMgr_c = .data:0x8052EF08; // type:object size:0x30 __vt__43sFStateFct_c = .data:0x8052EF38; // type:object size:0x18 @@ -35878,10 +35886,13 @@ __vt__79sFStateMgr_c = .data:0x8052F228; // type:object size:0x30 __vt__56sFStateFct_c = .data:0x8052F258; // type:object size:0x18 __vt__53sFState_c = .data:0x8052F270; // type:object size:0x18 -lbl_8052F288 = .data:0x8052F288; // type:object size:0x2C -lbl_8052F2B4 = .data:0x8052F2B4; // type:object size:0x7C +__vt__13dCsGameLyt2_c = .data:0x8052F288; // type:object size:0x2C +__vt__13dCsGameLyt1_c = .data:0x8052F2B4; // type:object size:0x2C +__vt__17dCsGameLytBase2_c = .data:0x8052F2E0; // type:object size:0x2C +__vt__17dCsGameLytBase1_c = .data:0x8052F310; // type:object size:0x20 __vt__22dCursorInterfaceGame_c = .data:0x8052F330; // type:object size:0x10 -lbl_8052F340 = .data:0x8052F340; // type:object size:0xCF4 +__vt__Q23d2d9AnmGroups = .data:0x8052F340; // type:object size:0xC +lbl_8052F34C = .data:0x8052F34C; // type:object size:0xCE8 __vt__58sFStateID_c = .data:0x80530034; // type:object size:0x34 __vt__60sFStateID_c = .data:0x80530068; // type:object size:0x34 __vt__60sFStateID_c = .data:0x8053009C; // type:object size:0x34 @@ -40475,10 +40486,10 @@ sLytNames = .sdata:0x80573430; // type:object size:0x8 scope:local data:4byte @13276 = .sdata:0x80573438; // type:object size:0x4 scope:local data:4byte @13956 = .sdata:0x8057343C; // type:object size:0x7 scope:local data:string @13957 = .sdata:0x80573444; // type:object size:0x4 scope:local data:string -lbl_80573448 = .sdata:0x80573448; // type:object size:0x8 +lbl_80573448 = .sdata:0x80573448; // type:object size:0x7 data:string lbl_80573450 = .sdata:0x80573450; // type:object size:0x4 data:string -lbl_80573454 = .sdata:0x80573454; // type:object size:0x8 -lbl_8057345C = .sdata:0x8057345C; // type:object size:0x4 +lbl_80573454 = .sdata:0x80573454; // type:object size:0x7 data:string +lbl_8057345C = .sdata:0x8057345C; // type:object size:0x1 lbl_80573460 = .sdata:0x80573460; // type:object size:0x4 data:4byte lbl_80573464 = .sdata:0x80573464; // type:object size:0x4 align:4 data:float lbl_80573468 = .sdata:0x80573468; // type:object size:0x4 align:4 data:float @@ -51782,7 +51793,7 @@ StateID_Stanby__9dScGame_c = .bss:0x805B37EC; // type:object size:0x34 data:4byt StateID_Action__9dScGame_c = .bss:0x805B382C; // type:object size:0x34 data:4byte currentSpawnInfo__9dScGame_c = .bss:0x805B3860; // type:object size:0x2A nextSpawnInfo__9dScGame_c = .bss:0x805B388C; // type:object size:0x2A data:byte -lbl_805B38B8 = .bss:0x805B38B8; // type:object size:0x50 +sHio = .bss:0x805B38B8; // type:object size:0x50 scope:local CsGame__lytItemCursor__STATE_INVISIBLE = .bss:0x805B3908; // type:object size:0x40 data:4byte CsGame__lytItemCursor__STATE_BOW = .bss:0x805B3948; // type:object size:0x40 data:4byte CsGame__lytItemCursor__STATE_DOWSING = .bss:0x805B3988; // type:object size:0x40 data:4byte diff --git a/include/d/d_cs_game.h b/include/d/d_cs_game.h index 2b5980be..7bd17792 100644 --- a/include/d/d_cs_game.h +++ b/include/d/d_cs_game.h @@ -6,6 +6,8 @@ #include "d/d_cursor_hit_check.h" #include "d/lyt/d2d.h" #include "m/m2d.h" +#include "m/m_vec.h" +#include "nw4r/lyt/lyt_pane.h" #include "s/s_FStateID.hpp" #include "s/s_State.hpp" #include "s/s_StateID.hpp" @@ -42,32 +44,49 @@ public: virtual ~EffectRelated() {} }; -class dCsGameLytBase_c { +class dCsGameLytBase1_c { public: - dCsGameLytBase_c() {} - virtual ~dCsGameLytBase_c() {} - virtual void dCsGameLytBase_0x0C() {} // not overridden - virtual void dCsGameLytBase_0x10() {} // overridden by both - virtual void dCsGameLytBase_0x14() = 0; - virtual void dCsGameLytBase_0x18() {} // not overridden - virtual void dCsGameLytBase_0x1C() {} // not overridden - virtual void dCsGameLytBase_0x20() = 0; - virtual void dCsGameLytBase_0x24() = 0; - virtual void dCsGameLytBase_0x28() = 0; + virtual ~dCsGameLytBase1_c() {} + /* 0x0C */ virtual void setPosition(const mVec2_c &pos) { + mPosition = pos; + } + + /* 0x10 */ virtual bool init() = 0; + /* 0x14 */ virtual bool remove() = 0; + /* 0x18 */ virtual bool execute() = 0; + /* 0x1C */ virtual bool draw() = 0; protected: - /* 0x04 */ u8 field_0x04[0x0C - 0x04]; + /* 0x04 */ mVec2_c mPosition; }; -class dCsGameLyt1_c : public dCsGameLytBase_c { +class dCsGameLytBase2_c : public dCsGameLytBase1_c { +public: + virtual ~dCsGameLytBase2_c() {} + + /* 0x10 */ virtual bool init(); + /* 0x14 */ virtual bool remove() = 0; + /* 0x18 */ virtual bool execute(); + /* 0x1C */ virtual bool draw(); + + /* 0x20 */ virtual void loadResAcc() = 0; + /* 0x24 */ virtual void build() = 0; + /* 0x28 */ virtual d2d::LytBase_c *getLyt() = 0; + +protected: +}; + +class dCsGameLyt1_c : public dCsGameLytBase2_c { public: dCsGameLyt1_c() : mpResAcc(nullptr) {} virtual ~dCsGameLyt1_c() {} - virtual void dCsGameLytBase_0x10() override; - virtual void dCsGameLytBase_0x14() override; - virtual void dCsGameLytBase_0x20() override; - virtual void dCsGameLytBase_0x24() override; - virtual void dCsGameLytBase_0x28() override; + virtual bool init() override; + virtual bool remove() override; + virtual void loadResAcc() override; + virtual void build() override; + virtual d2d::LytBase_c *getLyt() override { + return &mLyt; + } void setResAcc(m2d::ResAccIf_c *resAcc) { mpResAcc = resAcc; @@ -78,15 +97,17 @@ private: /* 0x10 */ d2d::LytBase_c mLyt; }; -class dCsGameLyt2_c : public dCsGameLytBase_c { +class dCsGameLyt2_c : public dCsGameLytBase2_c { public: dCsGameLyt2_c() : mpResAcc(nullptr) {} virtual ~dCsGameLyt2_c() {} - virtual void dCsGameLytBase_0x10() override; - virtual void dCsGameLytBase_0x14() override; - virtual void dCsGameLytBase_0x20() override; - virtual void dCsGameLytBase_0x24() override; - virtual void dCsGameLytBase_0x28() override; + virtual bool init() override; + virtual bool remove() override; + virtual void loadResAcc() override; + virtual void build() override; + virtual d2d::LytBase_c *getLyt() override { + return &mLyt; + } void setResAcc(m2d::ResAccIf_c *resAcc) { mpResAcc = resAcc; @@ -97,9 +118,10 @@ private: /* 0x10 */ d2d::LytBase_c mLyt; }; +template class Tmp { public: - d2d::AnmGroup_c mAnmGroups[0x17]; + d2d::AnmGroup_c mAnmGroups[N]; }; class dCsGameAnmGroups_c { @@ -107,7 +129,11 @@ public: dCsGameAnmGroups_c() {} virtual ~dCsGameAnmGroups_c() {} - Tmp tmp; + d2d::AnmGroup_c &operator[](int idx) { + return tmp.mAnmGroups[idx]; + } + + Tmp<0x17> tmp; }; /// @brief Game cursor. @@ -118,22 +144,32 @@ public: virtual int create() override; virtual int doDelete() override; + virtual int execute() override; + virtual int draw() override; static dCsGame_c *GetInstance() { return sInstance; } bool fn_801BF5E0() const; - bool fn_801BF630() const; /// @brief Item cursor. - class lytItemCursor_c { + class lytItemCursor_c : public dCsGameLytBase2_c { friend class dCsGame_c; public: enum CursorType_e { - NONE = 0, - BOW = 6, + CS_NONE = 0, + /** Default pointer */ + CS_POINTER_DEF = 1, + /** Grab pointer */ + CS_POINTER_CAT = 2, + CS_BOW = 6, + CS_DOWSING = 7, + CS_VACUUM = 8, + CS_PACHINKO = 9, + CS_HOOKSHOT = 10, + CS_PLAYERCAM = 14, }; /// @brief Bow cursor. @@ -180,6 +216,10 @@ public: void enter(); void execute(); + void moveEffectsIn(); + void moveEffectsOut(); + void updateEffects(); + private: STATE_FUNC_DECLARE(lytDowsingCsr_c, NotFind); STATE_FUNC_DECLARE(lytDowsingCsr_c, ToFind); @@ -192,10 +232,14 @@ public: /* 0x4C */ d2d::LytBase_c *mpLyt; /* 0x50 */ EffectsStruct mEffects1; /* 0x84 */ EffectsStruct mEffects2; - /* 0xB8 */ f32 field_0xB8; - /* 0xBC */ f32 field_0xBC; + /* 0xB8 */ nw4r::lyt::Pane *mpRingAllPane; + /* 0xBC */ nw4r::lyt::Pane *mpDowsingPane; /* 0xC0 */ f32 field_0xC0; - /* 0xC4 */ u8 field_0xC4[0xD8 - 0xC4]; + /* 0xC4 */ u8 field_0xC4[0xC8 - 0xC4]; + /* 0xC8 */ mAng mRotZ; + /* 0xCC */ f32 field_0xCC; + /* 0xD0 */ f32 field_0xD0; + /* 0xD4 */ u32 mAlpha; }; /// @brief Slingshot cursor. @@ -205,16 +249,17 @@ public: : mAnm(g.tmp.mAnmGroups, 0x17), mpLyt(lyt), mStateMgr(*this, sStateID::null), - field_0x50(0), - field_0x54(0.0f), - field_0x58(0.0f) {} + mIsCharging(false), + mDrawProgress(0.0f), + mSavedOnProgress(0.0f) {} virtual ~lytPachinkoCsr_c() {} void init(); - // void enter(); void execute(); + void setCharging(bool charging, f32 progress); + private: STATE_FUNC_DECLARE(lytPachinkoCsr_c, Invisible); STATE_FUNC_DECLARE(lytPachinkoCsr_c, Select); @@ -227,9 +272,9 @@ public: /* 0x04 */ UI_STATE_MGR_DECLARE(lytPachinkoCsr_c); /* 0x40 */ d2d::AnmGroups mAnm; /* 0x4C */ d2d::LytBase_c *mpLyt; - /* 0x50 */ u8 field_0x50; - /* 0x54 */ f32 field_0x54; - /* 0x58 */ f32 field_0x58; + /* 0x50 */ bool mIsCharging; + /* 0x54 */ f32 mDrawProgress; + /* 0x58 */ f32 mSavedOnProgress; }; /// @brief Clawshots cursor. @@ -244,6 +289,9 @@ public: void enter(); void execute(); + void setLocked(bool locked); + void setRotate(f32 rot); + private: STATE_FUNC_DECLARE(lytCrawShotCsr_c, Normal); STATE_FUNC_DECLARE(lytCrawShotCsr_c, ToLock); @@ -253,14 +301,18 @@ public: /* 0x04 */ UI_STATE_MGR_DECLARE(lytCrawShotCsr_c); /* 0x40 */ d2d::AnmGroups mAnm; /* 0x4C */ d2d::LytBase_c *mpLyt; - /* 0x50 */ u8 field_0x50[0x6C - 0x50]; + /* 0x50 */ u8 field_0x50[0x54 - 0x50]; + /* 0x54 */ bool mLocked; + /* 0x58 */ nw4r::lyt::Pane *mpPaneCrawFix; + /* 0x5C */ nw4r::lyt::Pane *mpPaneCraws[3]; + /* 0x68 */ f32 field_0x68; }; /// @brief Gust Bellows cursor. class lytVacuumCsr_c { public: lytVacuumCsr_c(dCsGameAnmGroups_c &g, d2d::LytBase_c *lyt) - : mAnm(g.tmp.mAnmGroups, 0x17), mpLyt(lyt), mStateMgr(*this, sStateID::null) {} + : mAnm(g.tmp.mAnmGroups, 0x17), mpLyt(lyt), mStateMgr(*this, sStateID::null), mLocked(false) {} virtual ~lytVacuumCsr_c() {} void init(); @@ -268,6 +320,9 @@ public: void enter(); void execute(); + void setUnkFloat(f32 f); + void setLocked(bool locked); + private: STATE_FUNC_DECLARE(lytVacuumCsr_c, Normal); STATE_FUNC_DECLARE(lytVacuumCsr_c, ToLock); @@ -277,8 +332,10 @@ public: /* 0x04 */ UI_STATE_MGR_DECLARE(lytVacuumCsr_c); /* 0x40 */ d2d::AnmGroups mAnm; /* 0x4C */ d2d::LytBase_c *mpLyt; - /* 0x50 */ u8 field_0x50[0x5C - 0x50]; - /* 0x5C */ u8 field_0x5C; + /* 0x50 */ u8 field_0x50[0x54 - 0x50]; + /* 0x54 */ f32 field_0x54; + /* 0x58 */ u8 field_0x58[0x5C - 0x58]; + /* 0x5C */ bool mLocked; }; public: @@ -291,12 +348,14 @@ public: mCrawShot(mAnmGroups, &mLyt), mVacuum(mAnmGroups, &mLyt) {} virtual ~lytItemCursor_c() {} - virtual void lytItemCursor0x0C(); - virtual bool init(); - virtual bool remove(); - - bool preInit(); - bool doInit(); + virtual bool init() override; + virtual bool remove() override; + virtual bool execute() override; + virtual void loadResAcc() override; + virtual void build() override; + virtual d2d::LytBase_c *getLyt() override { + return &mLyt; + } void setResAcc(m2d::ResAccIf_c *resAcc) { mpResAcc = resAcc; @@ -329,13 +388,12 @@ public: STATE_FUNC_DECLARE(lytItemCursor_c, HookShot); STATE_FUNC_DECLARE(lytItemCursor_c, PlayerCam); - /* 0x004 */ f32 field_0x004; - /* 0x008 */ f32 field_0x008; /* 0x00C */ UI_STATE_MGR_DECLARE(lytItemCursor_c); /* 0x048 */ EffectsStruct mEffects; /* 0x07C */ dEmitterCallbackCursorTrail_c mTrailCb; - /* 0x0B0 */ u8 field_0xB0[0xC8 - 0xB0]; + /* 0x0B0 */ mVec3_c mPositionThisFrame; + /* 0x0BC */ mVec3_c mPositionLastFrame; /* 0x0C8 */ m2d::ResAccIf_c *mpResAcc; /* 0x0CC */ d2d::LytBase_c mLyt; /* 0x15C */ dCsGameAnmGroups_c mAnmGroups; @@ -346,7 +404,7 @@ public: /* 0x8C8 */ lytCrawShotCsr_c mCrawShot; /* 0x934 */ lytVacuumCsr_c mVacuum; /* 0x994 */ u8 field_0x994[0x99C - 0x994]; // seemingly not used - /* 0x99C */ bool mCursorTrail; + /* 0x99C */ bool mDrawCursorTrailThisFrame; /* 0x99D */ u8 field_0x99D[0x9A0 - 0x99D]; // Havent seen this range be set /* 0x9A0 */ bool mCursorActive; /* 0x9A1 */ bool field_0x9A1; // Compares to mCursorActive to change state @@ -359,17 +417,20 @@ public: void setNextCursorType(lytItemCursor_c::CursorType_e); void setCursorTypeNoneMaybe(); void setCursorTypePointer(); + void setCursorTypePlayerCam(); void offNextCursor() { mCursor.offNextCursor(); } +private: static dCsGame_c *sInstance; + bool isForcedHidden() const; /* 0x068 */ m2d::ResAccIf_c mCursorResAcc; /* 0x11C */ m2d::ResAccIf_c mMain2DResAcc; /* 0x1D0 */ dCursorInterfaceGame_c mCursorIf; - /* 0x1EC */ s32 mCursorType; + /* 0x1EC */ lytItemCursor_c::CursorType_e mCursorType; /* 0x1F0 */ dCsGameLyt1_c mLyt1; /* 0x290 */ dCsGameLyt2_c mLyt2; /* 0x330 */ lytItemCursor_c mCursor; diff --git a/include/d/d_cursor_hit_check.h b/include/d/d_cursor_hit_check.h index 8cb73b3e..ab4a7a7a 100644 --- a/include/d/d_cursor_hit_check.h +++ b/include/d/d_cursor_hit_check.h @@ -138,7 +138,7 @@ public: virtual mVec2_c &getCursorPos(); private: - /* 0x14 */ u8 _0x14[8]; + /* 0x14 */ mVec2_c field_0x14; }; /** diff --git a/include/d/lyt/d2d.h b/include/d/lyt/d2d.h index ed6994c7..14c92b78 100644 --- a/include/d/lyt/d2d.h +++ b/include/d/lyt/d2d.h @@ -227,6 +227,10 @@ struct AnmGroupBase_c { return mpFrameCtrl->getAnimDuration(); } + inline f32 getLastFrame() const { + return mpFrameCtrl->getAnimDuration() - 1.0f; + } + inline f32 getFrame() const { return mpFrameCtrl->getFrame(); } @@ -292,20 +296,10 @@ struct AnmGroupBase_c { syncAnmFrame(); } - inline void setRatio(f32 ratio) { - mpFrameCtrl->setRatio(ratio); - syncAnmFrame(); - } - inline f32 getRatio() const { return mpFrameCtrl->getRatio(); } - inline void setBackwardsRatio(f32 ratio) { - mpFrameCtrl->setBackwardsRatio(ratio); - syncAnmFrame(); - } - inline f32 getNextFrame() const { return mpFrameCtrl->getNextFrame(); } diff --git a/include/m/m2d.h b/include/m/m2d.h index 475fc6b0..8be7f6da 100644 --- a/include/m/m2d.h +++ b/include/m/m2d.h @@ -97,21 +97,11 @@ public: mFlags = mFlags | FLAG_BACKWARDS; } - inline void setRatio(f32 ratio) { - f32 actualEnd = mEndFrame - 1.0f; - setFrame(actualEnd * ratio); - } - inline f32 getRatio() const { f32 actualEnd = mEndFrame - 1.0f; return mCurrFrame / actualEnd; } - inline void setBackwardsRatio(f32 ratio) { - f32 actualEnd = mEndFrame - 1.0f; - setFrame(actualEnd - (ratio * actualEnd)); - } - inline f32 getNextFrame() const { f32 end = mEndFrame; f32 f = mCurrFrame + 1.0f; diff --git a/include/nw4r/lyt/lyt_pane.h b/include/nw4r/lyt/lyt_pane.h index cbd0d5b6..ab0c79b8 100644 --- a/include/nw4r/lyt/lyt_pane.h +++ b/include/nw4r/lyt/lyt_pane.h @@ -71,6 +71,10 @@ public: mTranslate = value; } + const math::VEC3 &GetRotate() const { + return mRotate; + } + void SetRotate(const nw4r::math::VEC3 &value) { mRotate = value; } diff --git a/src/d/d_cs_game.cpp b/src/d/d_cs_game.cpp index f9f7518c..fdeff1cd 100644 --- a/src/d/d_cs_game.cpp +++ b/src/d/d_cs_game.cpp @@ -1,15 +1,23 @@ #include "d/d_cs_game.h" +#include "common.h" +#include "d/a/d_a_player.h" #include "d/d_cs_base.h" #include "d/d_cursor_hit_check.h" +#include "d/d_gfx.h" +#include "d/d_pad.h" #include "d/lyt/d2d.h" +#include "d/lyt/d_lyt_map.h" #include "d/snd/d_snd_small_effect_mgr.h" #include "f/f_base.h" +#include "m/m_vec.h" +#include "nw4r/lyt/lyt_pane.h" #include "toBeSorted/arc_managers/layout_arc_manager.h" +#include "toBeSorted/d_emitter.h" SPECIAL_BASE_PROFILE(C_GAME, dCsGame_c, fProfile::C_GAME, 0x2BF, 0x06F9); -dCsGame_HIO_c sConfig; +static dCsGame_HIO_c sHio; dCsGame_HIO_c::dCsGame_HIO_c() { field_0x04 = 0.0f; @@ -72,6 +80,237 @@ STATE_DEFINE(dCsGame_c::lytItemCursor_c::lytVacuumCsr_c, ToLock); STATE_DEFINE(dCsGame_c::lytItemCursor_c::lytVacuumCsr_c, Lock); STATE_DEFINE(dCsGame_c::lytItemCursor_c::lytVacuumCsr_c, ToNormal); +dCsGame_c::dCsGame_c() : mCursorType(lytItemCursor_c::CS_NONE) { + sInstance = this; +} + +dCsGame_c::~dCsGame_c() { + sInstance = nullptr; +} + +int dCsGame_c::create() { + void *csData = LayoutArcManager::GetInstance()->getLoadedData("cursor"); + mCursorResAcc.attach(csData, "arc"); + void *mainData = LayoutArcManager::GetInstance()->getLoadedData("Main2D"); + mMain2DResAcc.attach(mainData, ""); + + mLyt1.setResAcc(&mCursorResAcc); + mLyt1.init(); + mLyt2.setResAcc(&mCursorResAcc); + mLyt2.init(); + mCursor.setResAcc(&mMain2DResAcc); + mCursor.init(); + + setNextCursorType(lytItemCursor_c::CS_NONE); + mCursorType = lytItemCursor_c::CS_NONE; + + mCursor.setField0x9A0(0); + mCursorIf.setCursorMask(2); + dCsMgr_c::GetInstance()->registCursor(&mCursorIf); + dCsBase_c::GetInstance()->setVisible(false); + return SUCCEEDED; +} + +int dCsGame_c::doDelete() { + mCursor.remove(); + mLyt2.remove(); + mLyt1.remove(); + dCsMgr_c::GetInstance()->unregistCursor(&mCursorIf); + mCursorResAcc.detach(); + mMain2DResAcc.detach(); + return SUCCEEDED; +} + +#pragma push +#pragma pool_data off +int dCsGame_c::execute() { + mCursorType = mCursor.mNextCursorType; + mCursor.mCursorActive = mCursor.mNextCursor; + if (mCursor.isCursorActive() && mCursorType == lytItemCursor_c::CS_DOWSING) { + mCursor.mDowsing.moveEffectsIn(); + } else { + mCursor.mDowsing.moveEffectsOut(); + } + + bool active = mCursor.isCursorActive(); + if (!active) { + if (!mCursor.field_0x9A2) { + mCursor.field_0x9A1 = active; + } + mCursor.field_0x9A2 = false; + return SUCCEEDED; + } + + if (active != mCursor.field_0x9A1 || mCursorType != mCursor.mActiveCursorType) { + switch (mCursorType) { + case lytItemCursor_c::CS_BOW: mCursor.changeState(lytItemCursor_c::StateID_Bow); break; + case lytItemCursor_c::CS_DOWSING: mCursor.changeState(lytItemCursor_c::StateID_Dowsing); break; + case lytItemCursor_c::CS_VACUUM: mCursor.changeState(lytItemCursor_c::StateID_Vacuum); break; + case lytItemCursor_c::CS_PACHINKO: mCursor.changeState(lytItemCursor_c::StateID_Pachinko); break; + case lytItemCursor_c::CS_HOOKSHOT: mCursor.changeState(lytItemCursor_c::StateID_HookShot); break; + case lytItemCursor_c::CS_PLAYERCAM: mCursor.changeState(lytItemCursor_c::StateID_PlayerCam); break; + default: break; + } + + if (!mCursor.field_0x9A2) { + mCursor.mActiveCursorType = mCursorType; + mCursor.field_0x9A1 = mCursor.mCursorActive; + } + } + + const mVec2_c &cursorPosition = mCursorIf.getCursorPos(); + + switch (mCursorType) { + case lytItemCursor_c::CS_POINTER_CAT: { + mLyt2.setPosition(mVec2_c(cursorPosition.x, cursorPosition.y + 10.0f)); + mLyt2.execute(); + break; + } + case lytItemCursor_c::CS_POINTER_DEF: { + mLyt1.setPosition(cursorPosition); + mLyt1.execute(); + break; + } + case lytItemCursor_c::CS_BOW: + case lytItemCursor_c::CS_DOWSING: + case lytItemCursor_c::CS_VACUUM: + case lytItemCursor_c::CS_PACHINKO: + case lytItemCursor_c::CS_PLAYERCAM: + case lytItemCursor_c::CS_HOOKSHOT: { + mCursor.setPosition(cursorPosition); + mCursor.execute(); + } break; + default: break; + } + + mCursor.mNextCursor = false; + mCursor.field_0x9A2 = false; + + return SUCCEEDED; +} +#pragma pop + +int dCsGame_c::draw() { + if (!mCursor.isCursorActive() || isForcedHidden()) { + return SUCCEEDED; + } + + switch (mCursorType) { + case lytItemCursor_c::CS_POINTER_CAT: mLyt2.draw(); break; + case lytItemCursor_c::CS_POINTER_DEF: mLyt1.draw(); break; + case lytItemCursor_c::CS_BOW: + case lytItemCursor_c::CS_DOWSING: + case lytItemCursor_c::CS_VACUUM: + case lytItemCursor_c::CS_PACHINKO: + case lytItemCursor_c::CS_PLAYERCAM: + case lytItemCursor_c::CS_HOOKSHOT: mCursor.draw(); break; + default: break; + } + + return SUCCEEDED; +} + +bool dCsGame_c::fn_801BF5E0() const { + return mCursor.isCursorActive() & !isForcedHidden(); +} + +void dCsGame_c::setNextCursorType(lytItemCursor_c::CursorType_e cs) { + mCursor.setNextCursorType(cs); +} + +void dCsGame_c::setCursorTypePlayerCam() { + setNextCursorType(lytItemCursor_c::CS_PLAYERCAM); +} + +mVec2_c &dCursorInterfaceGame_c::getCursorPos() { + // TODO explain this math + mVec2_c pos = dPad::getDpdPosScreen(); + f32 f0 = dGfx_c::getWidth4x3() / dGfx_c::getWidth16x9F() * 368.0f; + f32 f1 = sHio.field_0x04; + f32 f2 = sHio.field_0x08 + 6.0f; + f32 f3 = sHio.field_0x10 + 4.0f; + f32 f4 = sHio.field_0x0C + -15.0f; + + if (dLytMap_c::GetInstance() != nullptr && dLytMap_c::GetInstance()->isOpenMaybe()) { + if (pos.x < -f0 + f4) { + pos.x = -f0 + f4; + } + if (pos.x > f0 + f3) { + pos.x = f0 + f3; + } + if (pos.y < f1 + -209.0f) { + pos.y = f1 + -209.0f; + } + if (pos.y < f2 + -209.0f) { + pos.y = f2 + -209.0f; + } + } + + field_0x14 = pos; + + return field_0x14; +} + +bool dCsGameLytBase2_c::init() { + loadResAcc(); + build(); + return true; +} + +bool dCsGameLytBase2_c::execute() { + nw4r::lyt::Pane *p = getLyt()->getLayout()->GetRootPane(); + mVec3_c pos; + pos.x = mPosition.x; + pos.y = mPosition.y; + pos.z = 0.0f; + p->SetTranslate(pos); + getLyt()->calc(); + return true; +} + +bool dCsGameLytBase2_c::draw() { + getLyt()->addToDrawList(); + return true; +} + +void dCsGameLyt1_c::loadResAcc() { + mLyt.setResAcc(mpResAcc); +} + +void dCsGameLyt1_c::build() { + mLyt.build("P1_Def.brlyt", nullptr); +} + +bool dCsGameLyt1_c::init() { + dCsGameLytBase2_c::init(); + mLyt.setPriority(0x88); + mLyt.calc(); + return true; +} + +bool dCsGameLyt1_c::remove() { + return true; +} + +void dCsGameLyt2_c::loadResAcc() { + mLyt.setResAcc(mpResAcc); +} + +void dCsGameLyt2_c::build() { + mLyt.build("P1_Cat.brlyt", nullptr); +} + +bool dCsGameLyt2_c::init() { + dCsGameLytBase2_c::init(); + mLyt.setPriority(0x88); + mLyt.calc(); + return true; +} + +bool dCsGameLyt2_c::remove() { + return true; +} + #define MAIN_ANIM_CURSOR 0 #define MAIN_ANIM_DOWSE_IN_OUT 1 #define MAIN_ANIM_LOOP 2 @@ -96,6 +335,72 @@ STATE_DEFINE(dCsGame_c::lytItemCursor_c::lytVacuumCsr_c, ToNormal); #define MAIN_ANIM_LOOP_END 21 #define MAIN_ANIM_LOOP_END_2 22 +void dCsGame_c::lytItemCursor_c::initializeState_Invisible() {} +void dCsGame_c::lytItemCursor_c::executeState_Invisible() {} +void dCsGame_c::lytItemCursor_c::finalizeState_Invisible() {} + +void dCsGame_c::lytItemCursor_c::initializeState_Bow() { + mBow.enter(); + mBow.select(); +} +void dCsGame_c::lytItemCursor_c::executeState_Bow() { + mDrawCursorTrailThisFrame = true; + mBow.execute(); +} +void dCsGame_c::lytItemCursor_c::finalizeState_Bow() {} + +void dCsGame_c::lytItemCursor_c::initializeState_Dowsing() { + mDowsing.enter(); +} +void dCsGame_c::lytItemCursor_c::executeState_Dowsing() { + mDowsing.execute(); +} +void dCsGame_c::lytItemCursor_c::finalizeState_Dowsing() {} + +void dCsGame_c::lytItemCursor_c::initializeState_Vacuum() { + mVacuum.enter(); +} +void dCsGame_c::lytItemCursor_c::executeState_Vacuum() { + mDrawCursorTrailThisFrame = true; + mVacuum.execute(); +} +void dCsGame_c::lytItemCursor_c::finalizeState_Vacuum() {} + +void dCsGame_c::lytItemCursor_c::initializeState_Pachinko() {} +void dCsGame_c::lytItemCursor_c::executeState_Pachinko() { + mDrawCursorTrailThisFrame = true; + mPachinko.execute(); +} +void dCsGame_c::lytItemCursor_c::finalizeState_Pachinko() {} + +void dCsGame_c::lytItemCursor_c::initializeState_HookShot() { + mCrawShot.enter(); +} +void dCsGame_c::lytItemCursor_c::executeState_HookShot() { + mDrawCursorTrailThisFrame = true; + mCrawShot.execute(); +} +void dCsGame_c::lytItemCursor_c::finalizeState_HookShot() {} + +void dCsGame_c::lytItemCursor_c::initializeState_PlayerCam() {} +void dCsGame_c::lytItemCursor_c::executeState_PlayerCam() { + d2d::AnmGroup_c &g = mAnmGroups.tmp.mAnmGroups[MAIN_ANIM_CURSOR]; + g.setFrame(9.0f); +} +void dCsGame_c::lytItemCursor_c::finalizeState_PlayerCam() {} + +void dCsGame_c::lytItemCursor_c::changeState(const sFStateID_c &newState) { + mStateMgr.changeState(newState); +} + +void dCsGame_c::lytItemCursor_c::loadResAcc() { + mLyt.setResAcc(mpResAcc); +} + +void dCsGame_c::lytItemCursor_c::build() { + mLyt.build("itemCursor_00.brlyt", nullptr); +} + static const d2d::LytBrlanMapping lytItemCursorMap[] = { { "itemCursor_00_cursor.brlan", "G_cursor_00"}, { "itemCursor_00_dowseInOut.brlan", "G_dowseAll_00"}, @@ -122,131 +427,27 @@ static const d2d::LytBrlanMapping lytItemCursorMap[] = { { "itemCursor_00_loopEnd2.brlan", "G_loopEnd_01"}, }; -dCsGame_c::dCsGame_c() : mCursorType(0) { - sInstance = this; -} - -dCsGame_c::~dCsGame_c() { - sInstance = nullptr; -} - -int dCsGame_c::create() { - void *csData = LayoutArcManager::GetInstance()->getLoadedData("cursor"); - mCursorResAcc.attach(csData, "arc"); - void *mainData = LayoutArcManager::GetInstance()->getLoadedData("Main2D"); - mMain2DResAcc.attach(mainData, ""); - - mLyt1.setResAcc(&mCursorResAcc); - mLyt1.dCsGameLytBase_0x10(); - mLyt2.setResAcc(&mCursorResAcc); - mLyt2.dCsGameLytBase_0x10(); - mCursor.setResAcc(&mMain2DResAcc); - mCursor.init(); - - setNextCursorType(lytItemCursor_c::NONE); - mCursorType = 0; - - mCursor.setField0x9A0(0); - mCursorIf.setCursorMask(2); - dCsMgr_c::GetInstance()->registCursor(&mCursorIf); - dCsBase_c::GetInstance()->setVisible(false); - return SUCCEEDED; -} - -int dCsGame_c::doDelete() { - mCursor.remove(); - mLyt2.dCsGameLytBase_0x14(); - mLyt1.dCsGameLytBase_0x14(); - dCsMgr_c::GetInstance()->unregistCursor(&mCursorIf); - mCursorResAcc.detach(); - mMain2DResAcc.detach(); - return SUCCEEDED; -} - -bool dCsGame_c::fn_801BF5E0() const { - return mCursor.isCursorActive() & !fn_801BF630(); -} - -void dCsGame_c::setNextCursorType(lytItemCursor_c::CursorType_e cs) { - mCursor.setNextCursorType(cs); -} - -void dCsGame_c::lytItemCursor_c::initializeState_Invisible() {} -void dCsGame_c::lytItemCursor_c::executeState_Invisible() {} -void dCsGame_c::lytItemCursor_c::finalizeState_Invisible() {} - -void dCsGame_c::lytItemCursor_c::initializeState_Bow() { - mBow.enter(); - mBow.select(); -} -void dCsGame_c::lytItemCursor_c::executeState_Bow() { - mCursorTrail = 1; - mBow.execute(); -} -void dCsGame_c::lytItemCursor_c::finalizeState_Bow() {} - -void dCsGame_c::lytItemCursor_c::initializeState_Dowsing() { - mDowsing.enter(); -} -void dCsGame_c::lytItemCursor_c::executeState_Dowsing() { - mDowsing.execute(); -} -void dCsGame_c::lytItemCursor_c::finalizeState_Dowsing() {} - -void dCsGame_c::lytItemCursor_c::initializeState_Vacuum() { - mVacuum.enter(); -} -void dCsGame_c::lytItemCursor_c::executeState_Vacuum() { - mCursorTrail = 1; - mVacuum.execute(); -} -void dCsGame_c::lytItemCursor_c::finalizeState_Vacuum() {} - -void dCsGame_c::lytItemCursor_c::initializeState_Pachinko() {} -void dCsGame_c::lytItemCursor_c::executeState_Pachinko() { - mCursorTrail = 1; - mPachinko.execute(); -} -void dCsGame_c::lytItemCursor_c::finalizeState_Pachinko() {} - -void dCsGame_c::lytItemCursor_c::initializeState_HookShot() { - mCrawShot.enter(); -} -void dCsGame_c::lytItemCursor_c::executeState_HookShot() { - mCursorTrail = 1; - mCrawShot.execute(); -} -void dCsGame_c::lytItemCursor_c::finalizeState_HookShot() {} - -void dCsGame_c::lytItemCursor_c::initializeState_PlayerCam() {} -void dCsGame_c::lytItemCursor_c::executeState_PlayerCam() { - d2d::AnmGroup_c &g = mAnmGroups.tmp.mAnmGroups[MAIN_ANIM_CURSOR]; - g.setFrame(9.0f); -} -void dCsGame_c::lytItemCursor_c::finalizeState_PlayerCam() {} - -void dCsGame_c::lytItemCursor_c::changeState(const sFStateID_c &newState) { - mStateMgr.changeState(newState); -} - -bool dCsGame_c::lytItemCursor_c::doInit() { +bool dCsGame_c::lytItemCursor_c::init() { mEffects.init(dCsGame_c::sInstance); - preInit(); + dCsGameLytBase2_c::init(); mLyt.setPriority(0x88); mLyt.calc(); mAnm.init(mAnmGroups.tmp.mAnmGroups, lytItemCursorMap, 0x17, mpResAcc, mLyt.getLayout()); for (int i = 0; i < 0x17; i++) { - mAnmGroups.tmp.mAnmGroups[i].bind(false); - mAnmGroups.tmp.mAnmGroups[i].setAnimEnable(false); + d2d::AnmGroup_c &grp = mAnmGroups[i]; + grp.bind(false); + grp.setAnimEnable(false); } mAnmGroups.tmp.mAnmGroups[MAIN_ANIM_CURSOR].setAnimEnable(true); - mAnmGroups.tmp.mAnmGroups[MAIN_ANIM_LOOP].setFrame(0.0f); - mAnmGroups.tmp.mAnmGroups[MAIN_ANIM_LOOP].setAnimEnable(true); + d2d::AnmGroup_c &mainLoop = mAnmGroups.tmp.mAnmGroups[MAIN_ANIM_LOOP]; + mainLoop.setFrame(0.0f); + mainLoop.setAnimEnable(true); mAnmGroups.tmp.mAnmGroups[MAIN_ANIM_ARROW_LOOP].setAnimEnable(true); - mAnmGroups.tmp.mAnmGroups[MAIN_ANIM_ARROW_LOOP].setFrame(0.0f); + d2d::AnmGroup_c &arrowLoop = mAnmGroups.tmp.mAnmGroups[MAIN_ANIM_ARROW_LOOP]; + arrowLoop.setFrame(0.0f); mBow.init(); mDowsing.init(); @@ -256,18 +457,47 @@ bool dCsGame_c::lytItemCursor_c::doInit() { mAnmGroups.tmp.mAnmGroups[MAIN_ANIM_VACUUM_LOCK].setAnimEnable(false); mEffects.setEmitterCallback(&mTrailCb); - + mLyt.setPriority(0x88); mLyt.calc(); - mAnmGroups.tmp.mAnmGroups[0x14].setAnimEnable(false); + arrowLoop.setAnimEnable(false); mStateMgr.changeState(StateID_Invisible); return true; } +bool dCsGame_c::lytItemCursor_c::remove() { + mAnm.remove(); + return true; +} + +bool dCsGame_c::lytItemCursor_c::execute() { + mPositionThisFrame.x = mPosition.x; + mPositionThisFrame.y = mPosition.y; + mPositionThisFrame.z = 0.0f; + + mDrawCursorTrailThisFrame = false; + mAnmGroups[MAIN_ANIM_LOOP].setAnimEnable(true); + mStateMgr.executeState(); + + if (dCsGame_c::GetInstance()->fn_801BF5E0() && mDrawCursorTrailThisFrame) { + f32 sqDist = mPositionThisFrame.squareDistance(mPositionLastFrame); + if (sqDist > sHio.field_0x34 * sHio.field_0x34 || + (mEffects.hasEmitters() && sqDist > sHio.field_0x38 * sHio.field_0x38)) { + mEffects.createContinuousUIEffect( + PARTICLE_RESOURCE_ID_MAPPING_31_, mPositionThisFrame, nullptr, nullptr, nullptr, nullptr + ); + } + } + + dCsGameLytBase2_c::execute(); + mPositionLastFrame = mPositionThisFrame; + return true; +} + void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::initializeState_NotFind() {} void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::executeState_NotFind() { - if (field_0xC0 < 0.999f) { + if (field_0xC0 < 0.9999f) { mAnm[MAIN_ANIM_DOWSE_IN_OUT].setAnimEnable(true); mAnm[MAIN_ANIM_DOWSE_IN_OUT].setForward(); mStateMgr.changeState(StateID_Find); @@ -280,8 +510,7 @@ void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::executeState_ToFind() { if (mAnm[MAIN_ANIM_DOWSE_IN_OUT].isEndReached()) { mAnm[MAIN_ANIM_DOWSE_IN_OUT].setAnimEnable(false); mAnm[MAIN_ANIM_DOWSE_ZOOM].setAnimEnable(true); - // TODO - mAnm[MAIN_ANIM_DOWSE_ZOOM].setRatio(1.0f - field_0xC0); + mAnm[MAIN_ANIM_DOWSE_ZOOM].setFrame((1.0f - field_0xC0) * mAnm[MAIN_ANIM_DOWSE_ZOOM].getLastFrame()); mpLyt->calc(); mStateMgr.changeState(StateID_Find); } else { @@ -294,11 +523,11 @@ void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::initializeState_Find() {} void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::executeState_Find() { mAnm[MAIN_ANIM_DOWSE_LOOP_2].setAnimEnable(true); mAnm[MAIN_ANIM_DOWSE_ZOOM].setAnimEnable(true); - // TODO - mAnm[MAIN_ANIM_DOWSE_ZOOM].setRatio(1.0f - field_0xC0); + f32 f = mAnm[MAIN_ANIM_DOWSE_ZOOM].getLastFrame(); + mAnm[MAIN_ANIM_DOWSE_ZOOM].setFrame((1.0f - field_0xC0) * f); if (field_0xC0 > 0.9999f) { - mAnm[MAIN_ANIM_DOWSE_ZOOM].setToEnd(); + mAnm[MAIN_ANIM_DOWSE_ZOOM].setFrame(f); mpLyt->calc(); mAnm[MAIN_ANIM_DOWSE_IN_OUT].setAnimEnable(true); mAnm[MAIN_ANIM_DOWSE_ZOOM].setAnimEnable(false); @@ -335,6 +564,119 @@ void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::executeState_ToNotFind() { } void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::finalizeState_ToNotFind() {} +void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::enter() { + mAnm[MAIN_ANIM_CURSOR].setFrame(3.0f); + mAnm[MAIN_ANIM_DOWSE_IN_OUT].setFrame(0.0f); + mAnm[MAIN_ANIM_DOWSE_IN_OUT].setAnimEnable(true); + mAnm[MAIN_ANIM_DOWSE_ZOOM].setAnimEnable(false); + mAnm[MAIN_ANIM_LOOP].setAnimEnable(false); + mAnm[MAIN_ANIM_DOWSE_LOOP_1].setAnimEnable(false); + mAnm[MAIN_ANIM_DOWSE_LOOP_2].setAnimEnable(false); + mAnm[MAIN_ANIM_DOWSE_LOOP_3].setAnimEnable(false); + + mpLyt->calc(); + + mAnm[MAIN_ANIM_DOWSE_ZOOM].setAnimEnable(false); + mAnm[MAIN_ANIM_DOWSE_IN_OUT].setAnimEnable(false); + mAnm[MAIN_ANIM_DOWSE_LOOP_1].setAnimEnable(true); +} + +void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::moveEffectsIn() { + if (mAlpha < sHio.field_0x40) { + mAlpha++; + } + updateEffects(); +} + +void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::moveEffectsOut() { + if (mAlpha > 0) { + mAlpha--; + updateEffects(); + } +} + +void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::updateEffects() { + u8 alpha = (f32)mAlpha / (f32)sHio.field_0x40 * 255.0f; + if (alpha != 0) { + mVec2_c csPos = dPad::getDpdPosScreen(); + mVec3_c effectPos(csPos.x, csPos.y, 0.0f); + mVec3_c effectScale(sHio.field_0x3C, sHio.field_0x3C, 1.0f); + mEffects1.createContinuousUIEffect( + PARTICLE_RESOURCE_ID_MAPPING_725_, mVec3_c::Zero, nullptr, nullptr, nullptr, nullptr + ); + mEffects2.createContinuousUIEffect( + PARTICLE_RESOURCE_ID_MAPPING_726_, effectPos, &mAng3_c::Zero, &effectScale, nullptr, nullptr + ); + mEffects1.setGlobalAlpha(alpha); + mEffects2.setGlobalAlpha(alpha); + } else { + mEffects1.remove(true); + mEffects2.remove(true); + } +} + +void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::init() { + mpDowsingPane = mpLyt->findPane("N_dowsing_00"); + mpRingAllPane = mpLyt->findPane("N_ringAll_00"); + mEffects1.init(dCsGame_c::GetInstance()); + mEffects2.init(dCsGame_c::GetInstance()); + field_0xC0 = 0.0f; + enter(); + mStateMgr.changeState(StateID_NotFind); +} + +void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::execute() { + mAnm[MAIN_ANIM_LOOP].setAnimEnable(false); + f32 f2 = (sHio.field_0x18 - sHio.field_0x1C) * 0.95f; + if (field_0xD0 > 0.0f) { + field_0xD0 -= f2 / sHio.field_0x14; + if (field_0xD0 < 0.0f) { + field_0xD0 = 0.0f; + } + } else { + field_0xD0 += f2 / sHio.field_0x14; + if (field_0xD0 > 0.0f) { + field_0xD0 = 0.0f; + } + } + + f32 scale = sHio.field_0x1C + (sHio.field_0x18 - sHio.field_0x1C) * (field_0xCC + field_0xD0); + mpDowsingPane->SetScale(mVec2_c(scale, scale)); + + mVec3_c rot = mpRingAllPane->GetRotate(); + rot.z = -mRotZ.degree2(); + mpRingAllPane->SetRotate(rot); + + mStateMgr.executeState(); + + if (mAnm[MAIN_ANIM_DOWSE_LOOP_1].isEnabled()) { + mAnm[MAIN_ANIM_DOWSE_LOOP_1].play(); + } + + if (mAnm[MAIN_ANIM_DOWSE_LOOP_2].isEnabled()) { + if (mAnm[MAIN_ANIM_DOWSE_LOOP_2].getFrame() >= 60.0f) { + mAnm[MAIN_ANIM_DOWSE_LOOP_2].setFrame(60.0f); + } else { + mAnm[MAIN_ANIM_DOWSE_LOOP_2].play(); + } + } + + if (mAnm[MAIN_ANIM_DOWSE_LOOP_3].isEnabled()) { + mAnm[MAIN_ANIM_DOWSE_LOOP_3].play(); + if (mAnm[MAIN_ANIM_DOWSE_LOOP_3].isEndReached()) { + mAnm[MAIN_ANIM_DOWSE_LOOP_3].setAnimEnable(false); + } + } + + const sStateIDIf_c *state = mStateMgr.getStateID(); + + if (*state == StateID_NotFind || *state == StateID_ToNotFind) { + mAnm[MAIN_ANIM_DOWSE_LOOP_2].setFrame(0.0f); + mpLyt->calc(); + mAnm[MAIN_ANIM_DOWSE_LOOP_2].setAnimEnable(false); + } +} + void dCsGame_c::lytItemCursor_c::lytBowCsr_c::initializeState_Invisible() {} void dCsGame_c::lytItemCursor_c::lytBowCsr_c::executeState_Invisible() {} void dCsGame_c::lytItemCursor_c::lytBowCsr_c::finalizeState_Invisible() {} @@ -394,7 +736,8 @@ void dCsGame_c::lytItemCursor_c::lytBowCsr_c::executeState_Draw() { } else if (t > 0.9999f) { t = 1.0f; } - mAnm[MAIN_ANIM_ARROW_CURSOR].setBackwardsRatio(t); + f32 f = mAnm[MAIN_ANIM_ARROW_CURSOR].getLastFrame(); + mAnm[MAIN_ANIM_ARROW_CURSOR].setFrame(f - (t * f)); if (t <= 0.0f) { mAnm[MAIN_ANIM_ARROW_CURSOR].setAnimEnable(false); mStateMgr.changeState(StateID_Charge); @@ -434,26 +777,25 @@ void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::finalizeState_Invisible() {} void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::initializeState_Select() {} void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::executeState_Select() { - if (!field_0x50) { - return; + if (mIsCharging) { + mStateMgr.changeState(StateID_ToDraw); } - mStateMgr.changeState(StateID_ToDraw); } void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::finalizeState_Select() {} void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::initializeState_ToDraw() { mAnm[MAIN_ANIM_SLING_ON].setAnimEnable(true); mAnm[MAIN_ANIM_SLING_ON].setFrame(0.0f); - field_0x58 = 0.0f; + mSavedOnProgress = 0.0f; } -extern "C" int getCurrentSlingshotType(); + void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::executeState_ToDraw() { - if (field_0x50) { + if (mIsCharging) { if (mAnm[MAIN_ANIM_SLING_ON].isEndReached()) { mpLyt->calc(); mAnm[MAIN_ANIM_SLING_ON].setAnimEnable(false); - if (getCurrentSlingshotType() == 2) { - field_0x58 = field_0x54; + if (dAcPy_c::getCurrentSlingshotType() == 2) { + mSavedOnProgress = mDrawProgress; mStateMgr.changeState(StateID_Charge); } else { mStateMgr.changeState(StateID_Draw); @@ -470,10 +812,9 @@ void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::finalizeState_ToDraw() {} void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::initializeState_Draw() {} void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::executeState_Draw() { - if (field_0x50) { - return; + if (!mIsCharging) { + mStateMgr.changeState(StateID_Out); } - mStateMgr.changeState(StateID_Out); } void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::finalizeState_Draw() {} @@ -498,15 +839,16 @@ void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::initializeState_Charge() { mpLyt->calc(); } void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::executeState_Charge() { - if (field_0x50) { - if (field_0x54 >= 1.0f) { + if (mIsCharging) { + if (mDrawProgress >= 1.0f) { mAnm[MAIN_ANIM_SLING_KEEP].setToEnd(); mpLyt->calc(); mAnm[MAIN_ANIM_SLING_KEEP].setAnimEnable(false); mStateMgr.changeState(StateID_ChargeFull); } else { - // TODO we need a second load of anm control here - mAnm[MAIN_ANIM_SLING_KEEP].setRatio((field_0x54 - field_0x58) / (1.0f - field_0x58)); + f32 frame = ((mDrawProgress - mSavedOnProgress) / (1.0f - mSavedOnProgress)); + f32 len = mAnm[MAIN_ANIM_SLING_KEEP].getLastFrame(); + mAnm[MAIN_ANIM_SLING_KEEP].setFrame(len * frame); } } else { mAnm[MAIN_ANIM_SLING_KEEP].setAnimEnable(false); @@ -522,7 +864,7 @@ void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::initializeState_ChargeFull() mAnm[MAIN_ANIM_SLING_PEAK_RING].setFrame(0.0f); } void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::executeState_ChargeFull() { - if (field_0x50) { + if (mIsCharging) { if (mAnm[MAIN_ANIM_SLING_PEAK].isEndReached()) { mpLyt->calc(); } else if (mAnm[MAIN_ANIM_SLING_PEAK].isEnabled()) { @@ -536,24 +878,130 @@ void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::executeState_ChargeFull() { } void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::finalizeState_ChargeFull() {} -void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::initializeState_Normal() {} -void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::executeState_Normal() {} +void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::init() { + mAnm[MAIN_ANIM_SLING_ON].setFrame(0.0f); + mAnm[MAIN_ANIM_SLING_ON].setAnimEnable(true); + mAnm[MAIN_ANIM_SLING_KEEP].setFrame(0.0f); + mAnm[MAIN_ANIM_SLING_KEEP].setAnimEnable(true); + mAnm[MAIN_ANIM_SLING_PEAK].setFrame(0.0f); + mAnm[MAIN_ANIM_SLING_PEAK].setAnimEnable(true); + mAnm[MAIN_ANIM_SLING_OUT].setFrame(0.0f); + mAnm[MAIN_ANIM_SLING_OUT].setAnimEnable(true); + mpLyt->calc(); + + mAnm[MAIN_ANIM_SLING_KEEP].setAnimEnable(false); + mAnm[MAIN_ANIM_SLING_PEAK].setAnimEnable(false); + mAnm[MAIN_ANIM_SLING_OUT].setAnimEnable(false); + + mIsCharging = false; + mDrawProgress = false; + + mStateMgr.changeState(StateID_Select); +} + +void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::execute() { + mAnm[MAIN_ANIM_CURSOR].setFrame(5.0f); + mStateMgr.executeState(); + if (mAnm[MAIN_ANIM_LOOP].isEnabled()) { + // ??? order + mpLyt->calc(); + mAnm[MAIN_ANIM_LOOP].play(); + } + + if (mAnm[MAIN_ANIM_SLING_PEAK_RING].isEndReached()) { + mAnm[MAIN_ANIM_SLING_PEAK_RING].setAnimEnable(false); + mpLyt->calc(); + } else { + mAnm[MAIN_ANIM_SLING_PEAK_RING].play(); + } +} + +void dCsGame_c::lytItemCursor_c::lytPachinkoCsr_c::setCharging(bool charging, f32 progress) { + mIsCharging = charging; + mDrawProgress = progress; +} + +void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::initializeState_Normal() { + mAnm[MAIN_ANIM_LOOP].setAnimEnable(true); +} +void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::executeState_Normal() { + if (mLocked) { + mAnm[MAIN_ANIM_HOOK_FIX].setAnimEnable(true); + mAnm[MAIN_ANIM_HOOK_FIX].setForward(); + mAnm[MAIN_ANIM_HOOK_FIX].setToStart(); + mAnm[MAIN_ANIM_LOOP].setAnimEnable(false); + mStateMgr.changeState(StateID_ToLock); + } else { + mAnm[MAIN_ANIM_LOOP].play(); + } +} void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::finalizeState_Normal() {} -void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::initializeState_ToLock() {} -void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::executeState_ToLock() {} +void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::setRotate(f32 rot) { + mVec3_c v; + v.set(0.0f, 0.0f, rot); + mpPaneCraws[0]->SetRotate(v); + v.z -= 120.0f; + mpPaneCraws[1]->SetRotate(v); + v.z += 240.0f; + mpPaneCraws[2]->SetRotate(v); +} + +void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::initializeState_ToLock() { + setRotate(0.0f); +} +void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::executeState_ToLock() { + if (mAnm[MAIN_ANIM_HOOK_FIX].isEndReached()) { + mAnm[MAIN_ANIM_HOOK_FIX].setAnimEnable(false); + mpLyt->calc(); + mAnm[MAIN_ANIM_LOCK_LOOP].setAnimEnable(true); + mAnm[MAIN_ANIM_LOCK_LOOP].setFrame(0.0f); + mStateMgr.changeState(StateID_Lock); + } else { + mAnm[MAIN_ANIM_HOOK_FIX].play(); + } +} void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::finalizeState_ToLock() {} void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::initializeState_Lock() {} -void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::executeState_Lock() {} +void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::executeState_Lock() { + if (!mLocked) { + mAnm[MAIN_ANIM_HOOK_FIX].setAnimEnable(true); + mAnm[MAIN_ANIM_HOOK_FIX].setBackward(); + mAnm[MAIN_ANIM_HOOK_FIX].setToStart(); + mAnm[MAIN_ANIM_LOCK_LOOP].setAnimEnable(false); + field_0x68 = mpPaneCrawFix->GetRotate().z; + setRotate(field_0x68); + mStateMgr.changeState(StateID_ToNormal); + } else { + mAnm[MAIN_ANIM_LOCK_LOOP].play(); + } +} void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::finalizeState_Lock() {} void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::initializeState_ToNormal() {} -void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::executeState_ToNormal() {} +void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::executeState_ToNormal() { + if (mAnm[MAIN_ANIM_HOOK_FIX].isStop2()) { + setRotate(0.0f); + mpLyt->calc(); + mAnm[MAIN_ANIM_HOOK_FIX].setAnimEnable(false); + mStateMgr.changeState(StateID_Normal); + } else { + mAnm[MAIN_ANIM_HOOK_FIX].play(); + f32 frame = mAnm[MAIN_ANIM_HOOK_FIX].getFrame(); + f32 len = mAnm[MAIN_ANIM_HOOK_FIX].getLastFrame(); + f32 offset = (-120.0f - field_0x68); + offset /= len; + if (offset < -10.0f) { + offset = -10.0f; + } + setRotate(field_0x68 + offset * (len - frame)); + } +} void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::finalizeState_ToNormal() {} void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::enter() { - mAnm[MAIN_ANIM_CURSOR].setFrame(4.0f); + mAnm[MAIN_ANIM_CURSOR].setFrame(6.0f); mAnm[MAIN_ANIM_HOOK_FIX].setAnimEnable(true); mAnm[MAIN_ANIM_HOOK_FIX].setFrame(0.0f); mAnm[MAIN_ANIM_LOCK_LOOP].setAnimEnable(false); @@ -563,7 +1011,16 @@ void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::enter() { mStateMgr.changeState(StateID_Normal); } +void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::setLocked(bool locked) { + mLocked = locked; +} + void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::init() { + mpPaneCrawFix = mpLyt->findPane("N_crawFix_00"); + mpPaneCraws[0] = mpLyt->findPane("N_craw_03"); + mpPaneCraws[1] = mpLyt->findPane("N_craw_04"); + mpPaneCraws[2] = mpLyt->findPane("N_craw_05"); + mLocked = false; enter(); mStateMgr.changeState(StateID_Normal); } @@ -572,12 +1029,11 @@ void dCsGame_c::lytItemCursor_c::lytCrawShotCsr_c::execute() { mStateMgr.executeState(); } - void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::initializeState_Normal() { mAnm[MAIN_ANIM_LOOP].setAnimEnable(true); } void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::executeState_Normal() { - if (field_0x5C) { + if (mLocked) { mAnm[MAIN_ANIM_VACUUM_LOCK].setAnimEnable(true); mAnm[MAIN_ANIM_VACUUM_LOCK].setForward(); mAnm[MAIN_ANIM_VACUUM_LOCK].setToStart(); @@ -605,7 +1061,7 @@ void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::finalizeState_ToLock() {} void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::initializeState_Lock() {} void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::executeState_Lock() { - if (!field_0x5C) { + if (!mLocked) { mAnm[MAIN_ANIM_VACUUM_LOCK].setAnimEnable(true); mAnm[MAIN_ANIM_VACUUM_LOCK].setBackward(); mAnm[MAIN_ANIM_VACUUM_LOCK].setToStart(); @@ -629,6 +1085,19 @@ void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::executeState_ToNormal() { } void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::finalizeState_ToNormal() {} +void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::setUnkFloat(f32 f) { + if (f < 0.0f) { + f = 0.0f; + } else if (f > 100.0f) { + f = 100.0f; + } + field_0x54 = f; +} + +void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::setLocked(bool locked) { + mLocked = locked; +} + void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::enter() { mAnm[MAIN_ANIM_CURSOR].setFrame(4.0f); mAnm[MAIN_ANIM_LOCK_LOOP].setAnimEnable(false); @@ -641,7 +1110,7 @@ void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::enter() { } void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::init() { - field_0x5C = 0; + mLocked = false; enter(); mStateMgr.changeState(StateID_Normal); } diff --git a/src/d/d_cursor_hit_check.cpp b/src/d/d_cursor_hit_check.cpp index 61fe1108..013d14cb 100644 --- a/src/d/d_cursor_hit_check.cpp +++ b/src/d/d_cursor_hit_check.cpp @@ -39,7 +39,7 @@ void dCsMgr_c::execute() { u32 mask = it->mCursorMask; if (mask) { - for (HitCheckList::Iterator chkIt = mList2.GetBeginIter(); chkIt != mList2.GetEndIter(); ++it) { + for (HitCheckList::Iterator chkIt = mList2.GetBeginIter(); chkIt != mList2.GetEndIter(); ++chkIt) { if ((chkIt->mMask & mask) != 0) { bool hit = chkIt->checkHit(x, y); if (chkIt->checkOverrideCallback(hit)) {