diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 53bf26f3..f9eb3290 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -798,8 +798,8 @@ fn_800220D0 = .text:0x800220D0; // type:function size:0xD0 fn_800221A0 = .text:0x800221A0; // type:function size:0xC4 fn_80022270 = .text:0x80022270; // type:function size:0x5C fn_800222D0 = .text:0x800222D0; // type:function size:0xC8 -fn_800223A0 = .text:0x800223A0; // type:function size:0x94 -fn_80022440 = .text:0x80022440; // type:function size:0x34 +fn_800223A0__21BlurAndPaletteManagerFPv = .text:0x800223A0; // type:function size:0x94 +fn_80022440__21BlurAndPaletteManagerFPv = .text:0x80022440; // type:function size:0x34 fn_80022480 = .text:0x80022480; // type:function size:0xCC fn_80022550 = .text:0x80022550; // type:function size:0x74 Vec3f__copy = .text:0x800225D0; // type:function size:0x1C @@ -810,7 +810,7 @@ fn_800227F0 = .text:0x800227F0; // type:function size:0xF0 fn_800228E0 = .text:0x800228E0; // type:function size:0xEC fn_800229D0 = .text:0x800229D0; // type:function size:0x34 fn_80022A10 = .text:0x80022A10; // type:function size:0xD8 -fn_80022AF0 = .text:0x80022AF0; // type:function size:0x3C +fn_80022AF0__21BlurAndPaletteManagerFf = .text:0x80022AF0; // type:function size:0x3C fn_80022B30 = .text:0x80022B30; // type:function size:0x8 fn_80022B40 = .text:0x80022B40; // type:function size:0x58 fn_80022BA0 = .text:0x80022BA0; // type:function size:0xC @@ -854,7 +854,7 @@ fn_800246D0 = .text:0x800246D0; // type:function size:0x64 fn_80024740 = .text:0x80024740; // type:function size:0x24 fn_80024770 = .text:0x80024770; // type:function size:0x24 fn_800247A0 = .text:0x800247A0; // type:function size:0x30 -fn_800247D0 = .text:0x800247D0; // type:function size:0x20 +fn_800247D0__21BlurAndPaletteManagerF7mVec3_cf = .text:0x800247D0; // type:function size:0x20 createBlurAndPaletteMgr = .text:0x800247F0; // type:function size:0xBB0 Vec3f__ctor = .text:0x800253A0; // type:function size:0x10 fn_800253B0 = .text:0x800253B0; // type:function size:0xC @@ -1102,12 +1102,12 @@ FUN_8002dd10__9dAcBase_cFv = .text:0x8002DD10; // type:function size:0x3C FUN_8002dd50__9dAcBase_cFv = .text:0x8002DD50; // type:function size:0x34 FUN_8002dd90__9dAcBase_cFv = .text:0x8002DD90; // type:function size:0x3C FUN_8002ddd0__9dAcBase_cFv = .text:0x8002DDD0; // type:function size:0x54 -FUN_8002de30__9dAcBase_cFv = .text:0x8002DE30; // type:function size:0x4 +FUN_8002de30__9dAcBase_cFR13cBgS_PolyInfo = .text:0x8002DE30; // type:function size:0x4 getOarcFile__12dAcObjBase_cFPCcPCc = .text:0x8002DE40; // type:function size:0x14 ActorObjectBase__getOarcSubentry = .text:0x8002DE60; // type:function size:0x14 getOarcResFile__12dAcObjBase_cFPCc = .text:0x8002DE80; // type:function size:0xC ActorObjectBase__getOarcModelFile = .text:0x8002DE90; // type:function size:0xC -ActorObjectBase__getOarcZev = .text:0x8002DEA0; // type:function size:0xC +getOarcZev__12dAcObjBase_cFPCc = .text:0x8002DEA0; // type:function size:0xC getOarcDZB__12dAcObjBase_cFPCcPCc = .text:0x8002DEB0; // type:function size:0x14 getOarcPLC__12dAcObjBase_cFPCcPCc = .text:0x8002DED0; // type:function size:0x14 __ct__12dAcObjBase_cFv = .text:0x8002DEF0; // type:function size:0x158 @@ -2119,13 +2119,13 @@ fn_80051C00 = .text:0x80051C00; // type:function size:0x4C InitColliderAndAddToFront = .text:0x80051C50; // type:function size:0x5C fn_80051CB0 = .text:0x80051CB0; // type:function size:0x5C InitCollider2AndAddToFront = .text:0x80051D10; // type:function size:0x5C -addCc__16TboxAndMoreUnkCCFR10dAcTboxCcDRC11dCcD_SrcUnk = .text:0x80051D70; // type:function size:0x5C +addCc__18ColliderLinkedListFR14LinkedColliderRC11dCcD_SrcUnk = .text:0x80051D70; // type:function size:0x5C fn_80051DD0 = .text:0x80051DD0; // type:function size:0x64 fn_80051E40 = .text:0x80051E40; // type:function size:0x64 ColliderManager__staticAddCollider = .text:0x80051EB0; // type:function size:0x34 -ColliderLinkedList__registerColliders = .text:0x80051EF0; // type:function size:0x10 +registerColliders__18ColliderLinkedListFv = .text:0x80051EF0; // type:function size:0x10 fn_80051F00 = .text:0x80051F00; // type:function size:0x8 -SetStts__16TboxAndMoreUnkCCFR9cCcD_Stts = .text:0x80051F10; // type:function size:0x10 +SetStts__18ColliderLinkedListFR9cCcD_Stts = .text:0x80051F10; // type:function size:0x10 ColliderLinkedList__search = .text:0x80051F20; // type:function size:0x74 fn_80051FA0 = .text:0x80051FA0; // type:function size:0x1C fn_80051FC0 = .text:0x80051FC0; // type:function size:0x10 @@ -2139,7 +2139,7 @@ fn_80052040 = .text:0x80052040; // type:function size:0x1C fn_80052060 = .text:0x80052060; // type:function size:0x10 fn_80052070 = .text:0x80052070; // type:function size:0x10 fn_80052080 = .text:0x80052080; // type:function size:0x10 -fn_80052090 = .text:0x80052090; // type:function size:0x60 +__dt__18ColliderLinkedListFv = .text:0x80052090; // type:function size:0x60 create__4dDvdFlPQ23EGG4HeapPQ23EGG4HeapPQ23EGG4Heap = .text:0x800520F0; // type:function size:0x4 __ct__Q24dDvd8loader_cFv = .text:0x80052100; // type:function size:0x28 __dt__Q24dDvd8loader_cFv = .text:0x80052130; // type:function size:0x40 @@ -3569,7 +3569,7 @@ fn_8009F990 = .text:0x8009F990; // type:function size:0x80 fn_8009FA10 = .text:0x8009FA10; // type:function size:0x8 attachSkipEvent = .text:0x8009FA20; // type:function size:0x1A0 setAsEvent = .text:0x8009FBC0; // type:function size:0x120 -dBase_c__changeOwnEvent = .text:0x8009FCE0; // type:function size:0x11C +changeOwnEvent__12EventManagerFP9dAcBase_cP9dAcBase_cP5Eventi = .text:0x8009FCE0; // type:function size:0x11C fn_8009FE00 = .text:0x8009FE00; // type:function size:0x124 isInEvent__12EventManagerFP9dAcBase_cPCc = .text:0x8009FF30; // type:function size:0x10C fn_800A0040 = .text:0x800A0040; // type:function size:0x114 @@ -3597,8 +3597,8 @@ fn_800A09B0 = .text:0x800A09B0; // type:function size:0x1D0 fn_800A0B80 = .text:0x800A0B80; // type:function size:0x10 eventRelatedStateFlags_shift0x11_1 = .text:0x800A0B90; // type:function size:0x10 fn_800A0BA0 = .text:0x800A0BA0; // type:function size:0x94 -__ct__5EventFPcUlUlPvPv = .text:0x800A0C40; // type:function size:0xEC -Event__createSimple = .text:0x800A0D30; // type:function size:0xEC +__ct__5EventFPCcUlUlPvPv = .text:0x800A0C40; // type:function size:0xEC +__ct__5EventFPCcPvUlUlPvPv = .text:0x800A0D30; // type:function size:0xEC __ct__5EventFUllUlPvPv = .text:0x800A0E20; // type:function size:0x208 Event__Event4 = .text:0x800A1030; // type:function size:0x208 __dt__5EventFv = .text:0x800A1240; // type:function size:0x40 @@ -13513,7 +13513,7 @@ fn_80251180 = .text:0x80251180; // type:function size:0x44 AcItem__getEventName = .text:0x802511D0; // type:function size:0x6C fn_80251240 = .text:0x80251240; // type:function size:0x6C AcItem__getEventNamePtrForItemId = .text:0x802512B0; // type:function size:0x4C -TBox__getItemEventNamePtr = .text:0x80251300; // type:function size:0x4C +getItemGetEventName__9dAcItem_cFUsPPCc = .text:0x80251300; // type:function size:0x4C fn_80251350 = .text:0x80251350; // type:function size:0x54 AcItem__getPosition = .text:0x802513B0; // type:function size:0x24 fn_802513E0 = .text:0x802513E0; // type:function size:0xC @@ -13676,8 +13676,8 @@ fn_80252A80 = .text:0x80252A80; // type:function size:0xC fn_80252A90 = .text:0x80252A90; // type:function size:0xC fn_80252AA0 = .text:0x80252AA0; // type:function size:0xC itemGetBirdMaybe = .text:0x80252AB0; // type:function size:0x40 -itemGetEventStart = .text:0x80252AF0; // type:function size:0xD8 -AcItem__itemRecieved = .text:0x80252BD0; // type:function size:0x90 +itemGetEventStart__9dAcItem_cFP9dAcBase_c = .text:0x80252AF0; // type:function size:0xD8 +itemGetEventEnd__9dAcItem_cFP9dAcBase_c = .text:0x80252BD0; // type:function size:0x90 AcItem__getItemId2 = .text:0x80252C60; // type:function size:0x8 AcItem__setFinalDeterminedItemId = .text:0x80252C70; // type:function size:0x8 getItemInitStructForItem = .text:0x80252C80; // type:function size:0x5C @@ -14237,15 +14237,15 @@ __sinit_\d_a_obj_fairy_cpp = .text:0x80267F40; // type:function size:0x56C scope __dt__28sFStateID_c<13dAcObjFairy_c>Fv = .text:0x802684B0; // type:function size:0x58 isSameName__28sFStateID_c<13dAcObjFairy_c>CFPCc = .text:0x80268510; // type:function size:0x88 dAcTbox_c_classInit__Fv = .text:0x802685A0; // type:function size:0x30 -fn_802685D0 = .text:0x802685D0; // type:function size:0x68 -fn_80268640 = .text:0x80268640; // type:function size:0x4 -fn_80268650 = .text:0x80268650; // type:function size:0x8 -fn_80268660__9dAcTbox_cFi = .text:0x80268660; // type:function size:0x20 +tryGetDowsingTargetOffset__9dAcTbox_cFiR7mVec3_c = .text:0x802685D0; // type:function size:0x68 +getDowsingTargetOffset__9dAcTbox_cFiR7mVec3_c = .text:0x80268640; // type:function size:0x4 +getSomeRate__9dAcTbox_cFv = .text:0x80268650; // type:function size:0x8 +isValidGroupIndex__9dAcTbox_cFi = .text:0x80268660; // type:function size:0x20 hasCollectedAllTears__9dAcTbox_cFv = .text:0x80268680; // type:function size:0x1C -fn_802686A0 = .text:0x802686A0; // type:function size:0x50 -fn_802686F0__9dAcTbox_cFRC7mVec3_cf = .text:0x802686F0; // type:function size:0x5C +getGroundHeight__9dAcTbox_cFPfRC7mVec3_c = .text:0x802686A0; // type:function size:0x50 +isBelowGroundAtPos__9dAcTbox_cFfRC7mVec3_c = .text:0x802686F0; // type:function size:0x5C __ct__9dAcTbox_cFv = .text:0x80268750; // type:function size:0x2EC -__dt__10dAcTboxCcDFv = .text:0x80268A40; // type:function size:0x98 +__dt__14LinkedColliderFv = .text:0x80268A40; // type:function size:0x98 __dt__21sFState_c<9dAcTbox_c>Fv = .text:0x80268AE0; // type:function size:0x58 __dt__24sFStateFct_c<9dAcTbox_c>Fv = .text:0x80268B40; // type:function size:0x6C __dt__77sStateMgr_c<9dAcTbox_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x80268BB0; // type:function size:0xA0 @@ -14311,19 +14311,19 @@ initializeState_GoddessWait__9dAcTbox_cFv = .text:0x8026D010; // type:function s executeState_GoddessWait__9dAcTbox_cFv = .text:0x8026D080; // type:function size:0x74 finalizeState_GoddessWait__9dAcTbox_cFv = .text:0x8026D100; // type:function size:0x4 getDowsingTargetOffset__9dAcTbox_cCFP7mVec3_c = .text:0x8026D110; // type:function size:0x8 -fn_8026D120 = .text:0x8026D120; // type:function size:0x8 -fn_8026D130 = .text:0x8026D130; // type:function size:0x10 +fn_8026D120__9dAcTbox_cCFv = .text:0x8026D120; // type:function size:0x8 +fn_8026D130__9dAcTbox_cFv = .text:0x8026D130; // type:function size:0x10 fn_8026D140__9dAcTbox_cFv = .text:0x8026D140; // type:function size:0x10 -AcTbox__doInteraction = .text:0x8026D150; // type:function size:0x98 +doInteraction__9dAcTbox_cFl = .text:0x8026D150; // type:function size:0x98 registerInEvent__9dAcTbox_cFv = .text:0x8026D1F0; // type:function size:0xDC unkVirtFunc_0x6C__9dAcTbox_cFv = .text:0x8026D2D0; // type:function size:0x68 -AcTbox__checkShouldClose = .text:0x8026D340; // type:function size:0xC -AcTbox__setShouldCloseFlag = .text:0x8026D350; // type:function size:0xC -AcTbox__unsetShouldCloseFlag = .text:0x8026D360; // type:function size:0xC -fn_8026D370 = .text:0x8026D370; // type:function size:0x4C +checkShouldClose__9dAcTbox_cFv = .text:0x8026D340; // type:function size:0xC +setShouldCloseFlag__9dAcTbox_cFv = .text:0x8026D350; // type:function size:0xC +unsetShouldCloseFlag__9dAcTbox_cFv = .text:0x8026D360; // type:function size:0xC +fn_8026D370__9dAcTbox_cFv = .text:0x8026D370; // type:function size:0x4C fn_8026D3C0__9dAcTbox_cFv = .text:0x8026D3C0; // type:function size:0xD4 setChestFlag__9dAcTbox_cFv = .text:0x8026D4A0; // type:function size:0x10 -AcTbox__setTboxFlag = .text:0x8026D4B0; // type:function size:0x18 +setTboxFlag__9dAcTbox_cFv = .text:0x8026D4B0; // type:function size:0x18 checkTboxFlag__9dAcTbox_cCFv = .text:0x8026D4D0; // type:function size:0x4C isNotSmall__9dAcTbox_cCFv = .text:0x8026D520; // type:function size:0x18 fn_8026D540__9dAcTbox_cFv = .text:0x8026D540; // type:function size:0x14 @@ -14341,14 +14341,14 @@ registerKeyPieceDowsing__9dAcTbox_cFv = .text:0x8026D830; // type:function size: registerRupeeOrTreasureDowsing__9dAcTbox_cFv = .text:0x8026D8A0; // type:function size:0x48 noUnregisterDowsing__9dAcTbox_cFv = .text:0x8026D8F0; // type:function size:0x4 unregisterDowsing__9dAcTbox_cFv = .text:0x8026D900; // type:function size:0x48 -fn_8026D950 = .text:0x8026D950; // type:function size:0x28 +fn_8026D950__9dAcTbox_cFv = .text:0x8026D950; // type:function size:0x28 checkIsClear__9dAcTbox_cCFv = .text:0x8026D980; // type:function size:0x140 fn_8026DAC0__9dAcTbox_cFR4mAng = .text:0x8026DAC0; // type:function size:0x10 -fn_8026DAD0__9dAcTbox_cCFP7mVec3_cP7mVec3_c = .text:0x8026DAD0; // type:function size:0x8 +fn_8026DAD0__9dAcTbox_cCFPC7mVec3_cP7mVec3_c = .text:0x8026DAD0; // type:function size:0x8 getCylParams__9dAcTbox_cCFP7mVec3_cPfPf = .text:0x8026DAE0; // type:function size:0x28C getCCBounds__9dAcTbox_cCFP7mVec3_cP7mVec3_c = .text:0x8026DD70; // type:function size:0x2DC getInteractionTargetDef__9dAcTbox_cCFv = .text:0x8026E050; // type:function size:0x40 -fn_8026E090__9dAcTbox_cFv = .text:0x8026E090; // type:function size:0x594 +checkForLinkBonk__9dAcTbox_cFv = .text:0x8026E090; // type:function size:0x594 fn_8026E630__9dAcTbox_cFv = .text:0x8026E630; // type:function size:0x10C build__24sFStateFct_c<9dAcTbox_c>FRC12sStateIDIf_c = .text:0x8026E740; // type:function size:0x60 dispose__24sFStateFct_c<9dAcTbox_c>FRP10sStateIf_c = .text:0x8026E7A0; // type:function size:0xC @@ -14367,8 +14367,8 @@ initializeState__23sFStateID_c<9dAcTbox_c>CFR9dAcTbox_c = .text:0x8026E8D0; // t __sinit_\d_a_obj_tbox_cpp = .text:0x8026E900; // type:function size:0xA7C scope:local __dt__23sFStateID_c<9dAcTbox_c>Fv = .text:0x8026F380; // type:function size:0x58 isSameName__23sFStateID_c<9dAcTbox_c>CFPCc = .text:0x8026F3E0; // type:function size:0x88 -@316@__dt__10dAcTboxCcDFv = .text:0x8026F470; // type:function size:0x8 -@272@__dt__10dAcTboxCcDFv = .text:0x8026F480; // type:function size:0x8 +@316@__dt__14LinkedColliderFv = .text:0x8026F470; // type:function size:0x8 +@272@__dt__14LinkedColliderFv = .text:0x8026F480; // type:function size:0x8 AcTimeArea__ctor = .text:0x8026F490; // type:function size:0x1A8 fn_8026F640 = .text:0x8026F640; // type:function size:0x58 fn_8026F6A0 = .text:0x8026F6A0; // type:function size:0x6C @@ -30060,7 +30060,7 @@ lbl_80503278 = .data:0x80503278; // type:object size:0x9C lbl_80503314 = .data:0x80503314; // type:object size:0x6C __vt__7dBase_c = .data:0x80503380; // type:object size:0x4C lbl_805033D0 = .data:0x805033D0; // type:object size:0x10 -lbl_805033E0 = .data:0x805033E0; // type:object size:0x10 +__vt__18ColliderLinkedList = .data:0x805033E0; // type:object size:0x10 __vt__Q24dDvd8loader_c = .data:0x805033F0; // type:object size:0x10 lbl_80503400 = .data:0x80503400; // type:object size:0x40 lbl_80503440 = .data:0x80503440; // type:object size:0x6DF8 @@ -34484,7 +34484,7 @@ __vt__47sFStateMgr_c<9dAcTbox_c,20sStateMethodUsr_FI_c> = .data:0x80535540; // t __vt__77sStateMgr_c<9dAcTbox_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x80535570; // type:object size:0x30 __vt__24sFStateFct_c<9dAcTbox_c> = .data:0x805355A0; // type:object size:0x14 __vt__21sFState_c<9dAcTbox_c> = .data:0x805355B8; // type:object size:0x18 -__vt__10dAcTboxCcD = .data:0x805355D0; // type:object size:0x7C +__vt__14LinkedCollider = .data:0x805355D0; // type:object size:0x7C __vt__23sFStateID_c<9dAcTbox_c> = .data:0x805359E0; // type:object size:0x34 g_profile_TIME_AREA = .data:0x80535A18; // type:object size:0x10 lbl_80535A28 = .data:0x80535A28; // type:object size:0x68 @@ -40047,7 +40047,7 @@ lbl_80575698 = .sbss:0x80575698; // type:object size:0x4 data:4byte lbl_8057569C = .sbss:0x8057569C; // type:object size:0x4 data:4byte lbl_805756A0 = .sbss:0x805756A0; // type:object size:0x4 data:4byte lbl_805756A4 = .sbss:0x805756A4; // type:object size:0x4 data:4byte -GODDESS_CHESTS_OPENED_COUNTER = .sbss:0x805756A8; // type:object size:0x8 data:4byte +sInstance__19GoddessChestCounter = .sbss:0x805756A8; // type:object size:0x8 data:4byte BOOT_PTR = .sbss:0x805756B0; // type:object size:0x4 data:4byte lbl_805756B4 = .sbss:0x805756B4; // type:object size:0x4 data:4byte TITLE_SCREEN_CHANGE = .sbss:0x805756B8; // type:object size:0x4 data:4byte @@ -48264,7 +48264,7 @@ lbl_8058F1B8 = .bss:0x8058F1B8; // type:object size:0x10 data:float lbl_8058F1C8 = .bss:0x8058F1C8; // type:object size:0x28 data:float lbl_8058F1F0 = .bss:0x8058F1F0; // type:object size:0x20 data:byte lbl_8058F210 = .bss:0x8058F210; // type:object size:0x10 -BLUR_AND_PALETTE_MGR = .bss:0x8058F220; // type:object size:0x5D70 +sInstance__21BlurAndPaletteManager = .bss:0x8058F220; // type:object size:0x5D70 lbl_80594F90 = .bss:0x80594F90; // type:object size:0x10 data:4byte lbl_80594FA0 = .bss:0x80594FA0; // type:object size:0x18 data:4byte lbl_80594FB8 = .bss:0x80594FB8; // type:object size:0x1C diff --git a/include/d/a/d_a_item.h b/include/d/a/d_a_item.h index 674bb119..1f0b7691 100644 --- a/include/d/a/d_a_item.h +++ b/include/d/a/d_a_item.h @@ -59,6 +59,10 @@ public: static bool isKeyPiece(ITEM_ID item); static bool isTreasure(ITEM_ID item); + static bool getItemGetEventName(u16 item, const char **outName); + static void itemGetEventStart(dAcBase_c *); + static void itemGetEventEnd(dAcBase_c *); + private: /* 0x334 */ UNKTYPE *mpMdl; // Model has its own handling system /* 0x338 */ dShadowCircle_c mShdw; diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index 8c3ea526..8e9c0e79 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -112,7 +112,7 @@ public: /* vt 0x15C */ virtual void vt_0x15C(); /* vt 0x160 */ virtual void vt_0x160(); /* vt 0x164 */ virtual void vt_0x164(); - /* vt 0x168 */ virtual void getCurrentAnimFrame(); + /* vt 0x168 */ virtual f32 getCurrentAnimFrame() const; /* vt 0x16C */ virtual void getFloatIfStruggling(); /* vt 0x170 */ virtual void isSwimming(); /* vt 0x174 */ virtual void isGustBellowsBeingBlown(); diff --git a/include/d/a/obj/d_a_obj_tbox.h b/include/d/a/obj/d_a_obj_tbox.h index f621a13a..255d868b 100644 --- a/include/d/a/obj/d_a_obj_tbox.h +++ b/include/d/a/obj/d_a_obj_tbox.h @@ -7,6 +7,7 @@ #include "d/a/obj/d_a_obj_base.h" #include "d/col/bg/d_bg_w.h" #include "d/col/cc/d_cc_d.h" +#include "d/d_cc.h" #include "d/d_shadow.h" #include "m/m3d/m_anmchr.h" #include "m/m3d/m_anmmatclr.h" @@ -23,30 +24,6 @@ #include "toBeSorted/dowsing_target.h" #include "toBeSorted/stage_render_stuff.h" -// Somewhere in d_cc -class dAcTboxCcD : public dCcD_Unk { -public: - dAcTboxCcD() : mpList(nullptr), field_0x210(this) {} - virtual ~dAcTboxCcD() { - if (mpList != nullptr) { - mpList->remove(&mNode); - mpList = nullptr; - } - } - /* 0x00 */ cListNd_c mNode; - /* 0x08 */ dCcD_Unk *field_0x210; - /* 0x0C */ cListMg_c *mpList; -}; - -struct TboxAndMoreUnkCC { - cListMg_c mList; - virtual ~TboxAndMoreUnkCC(); - - void addCc(dAcTboxCcD &ccD, const dCcD_SrcUnk &src); - void SetStts(cCcD_Stts &stts); - void registerColliders(); -}; - class dAcTbox_c : public dAcObjBase_c { public: enum TboxVariant_e { @@ -68,6 +45,7 @@ public: virtual void registerInEvent() override; virtual void unkVirtFunc_0x6C() override; + virtual void doInteraction(s32) override; virtual void *getObjectListEntry() override; @@ -115,19 +93,23 @@ private: void noRegisterDowsing(); void noUnregisterDowsing(); - static bool fn_80268660(int arg); bool checkForLinkBonk(); void fn_8026E630(); bool fn_8026D540(); - bool fn_8026D3C0(); + void fn_8026D3C0(); void syncScaleToMdl(m3d::scnLeaf_c *lf); void getCCBounds(mVec3_c *out1, mVec3_c *out2) const; void getCylParams(mVec3_c *out1, f32 *out2, f32 *out3) const; - void fn_8026DAD0(mVec3_c *src, mVec3_c *dest) const; - void fn_8026DAC0(mAng& ang); + void fn_8026DAD0(const mVec3_c *src, mVec3_c *dest) const; + void fn_8026DAC0(mAng &ang); static bool hasCollectedAllTears(); static bool isValidVariant(int variant); + static bool tryGetDowsingTargetOffset(int variant, mVec3_c &out); + static void getDowsingTargetOffset(int variant, mVec3_c &out); + static bool isValidGroupIndex(int idx); + static bool getGroundHeight(f32 *height, const mVec3_c &pos); + static bool isBelowGroundAtPos(f32 height, const mVec3_c &pos); void setActionState(); @@ -137,9 +119,14 @@ private: void fn_8026D130(); void fn_8026D140(); void fn_8026D950(); + void fn_8026D370(); + + bool checkShouldClose(); + void setShouldCloseFlag(); + void unsetShouldCloseFlag(); + void setTboxFlag(); bool checkIsClear() const; - static bool fn_802686F0(const mVec3_c &vec, f32 y); const InteractionTargetDef &getInteractionTargetDef() const; /* 0x0330 */ m3d::mdlAnmChr mMdl1; @@ -161,9 +148,9 @@ private: s32 field_0x4F4; /* 0x04F8 */ dBgW mBgWs[2]; - /* 0x0918 */ dAcTboxCcD mCcD1; - /* 0x0B30 */ dAcTboxCcD mCcD2; - /* 0x0D48 */ TboxAndMoreUnkCC field_0x0D48; + /* 0x0918 */ LinkedCollider mCcD1; + /* 0x0B30 */ LinkedCollider mCcD2; + /* 0x0D48 */ ColliderLinkedList field_0x0D48; /* 0x0D54 */ dCcD_Unk mCcD3; /* 0x0F5C */ dCcD_Cyl mCcD4; /* 0x10AC */ STATE_MGR_DECLARE(dAcTbox_c); @@ -184,19 +171,19 @@ private: /* 0x11E4 */ u8 field_0x11E4[0x11E8 - 0x11E4]; /* 0x11E8 */ f32 field_0x11E8; - + /* 0x11EC */ f32 field_0x11EC; /* 0x11F0 */ UNKWORD field_0x11F0; /* 0x11F4 */ UNKWORD field_0x11F4; - + /* 0x11F8 */ UNKWORD field_0x11F8; - + /* 0x11FC */ UNKWORD field_0x11FC; /* 0x1200 */ u16 mItemId; /* 0x1202 */ u16 mItemModelIdx; - + /* 0x1204 */ bool mHasBeenOpened; /* 0x1205 */ u8 mSpawnSceneFlag; /* 0x1206 */ u8 mSetSceneFlag; // set when? diff --git a/include/d/d_cc.h b/include/d/d_cc.h new file mode 100644 index 00000000..42792ea9 --- /dev/null +++ b/include/d/d_cc.h @@ -0,0 +1,32 @@ +#ifndef D_CC_H +#define D_CC_H + +#include "c/c_list.h" +#include "d/col/c/c_cc_d.h" +#include "d/col/cc/d_cc_d.h" + +// Somewhere in d_cc +class LinkedCollider : public dCcD_Unk { +public: + LinkedCollider() : mpList(nullptr), field_0x210(this) {} + virtual ~LinkedCollider() { + if (mpList != nullptr) { + mpList->remove(&mNode); + mpList = nullptr; + } + } + /* 0x00 */ cListNd_c mNode; + /* 0x08 */ dCcD_Unk *field_0x210; + /* 0x0C */ cListMg_c *mpList; +}; + +struct ColliderLinkedList { + cListMg_c mList; + virtual ~ColliderLinkedList(); + + void addCc(LinkedCollider &ccD, const dCcD_SrcUnk &src); + void SetStts(cCcD_Stts &stts); + void registerColliders(); +}; + +#endif diff --git a/include/d/flag/tboxflag_manager.h b/include/d/flag/tboxflag_manager.h index a675b789..dd64a252 100644 --- a/include/d/flag/tboxflag_manager.h +++ b/include/d/flag/tboxflag_manager.h @@ -21,7 +21,7 @@ public: virtual ~TBoxflagManager() {} void init(); void copyFromSave(u32 sceneIndex); - bool checkFlag(u16 sceneIndex, u16 flag); + u16 checkFlag(u16 sceneIndex, u16 flag); virtual u16 getFlagCount() const; void setFlag(u16 flag); bool checkUncommittedFlag(u16 sceneIndex, u16 flag); diff --git a/include/toBeSorted/blur_and_palette_manager.h b/include/toBeSorted/blur_and_palette_manager.h new file mode 100644 index 00000000..cedc1ee4 --- /dev/null +++ b/include/toBeSorted/blur_and_palette_manager.h @@ -0,0 +1,27 @@ +#ifndef BLUR_AND_PALETTE_MANAGER_H +#define BLUR_AND_PALETTE_MANAGER_H + +#include "common.h" +#include "m/m_vec.h" + +class BlurAndPaletteManager { +public: + static BlurAndPaletteManager &GetInstance() { + return sInstance; + } + + void fn_800247D0(mVec3_c, f32); + void fn_80022AF0(f32); + void setField_0x2F20(f32 arg) { + field_0x2F20 = arg; + } + void fn_800223A0(void *); + void fn_80022440(void *); + +private: + u8 field_0x0000[0x2F20 - 0x0000]; + f32 field_0x2F20; + static BlurAndPaletteManager sInstance; +}; + +#endif diff --git a/include/toBeSorted/counters/counter.h b/include/toBeSorted/counters/counter.h index 5d0cc029..07f5b334 100644 --- a/include/toBeSorted/counters/counter.h +++ b/include/toBeSorted/counters/counter.h @@ -16,4 +16,4 @@ public: u16 counterId; }; -#endif COUNTER_H +#endif diff --git a/include/toBeSorted/counters/goddess_chest_counter.h b/include/toBeSorted/counters/goddess_chest_counter.h new file mode 100644 index 00000000..e1c62403 --- /dev/null +++ b/include/toBeSorted/counters/goddess_chest_counter.h @@ -0,0 +1,19 @@ +#ifndef GODDESS_CHEST_COUNTER_H +#define GODDESS_CHEST_COUNTER_H + +#include "toBeSorted/counters/counter.h" + +class GoddessChestCounter : public Counter { +public: + GoddessChestCounter() : Counter(0x43F) {} + virtual ~GoddessChestCounter() {}; + + virtual u16 getCommittedValue() override; + virtual u16 getMax() override; + virtual u16 getUncommittedValue() override; + virtual void setValue(u16 num) override; + + static GoddessChestCounter sInstance; +}; + +#endif diff --git a/include/toBeSorted/event.h b/include/toBeSorted/event.h index 01a6af2e..f07f8aa6 100644 --- a/include/toBeSorted/event.h +++ b/include/toBeSorted/event.h @@ -16,8 +16,9 @@ public: public: /** 0x800A0C40 */ - Event(char *eventName, u32 unk, u32 eventFlags, void *callback1, void *callback2); + Event(const char *eventName, u32 unk, u32 eventFlags, void *callback1, void *callback2); Event(u32 eventId, s32 roomId, u32 eventFlags, void *callback1, void *callback2); + Event(const char *eventName, void *zevDat, u32 unk, u32 eventFlags, void *callback1, void *callback2); /** 0x800A1240 */ virtual ~Event(); }; diff --git a/include/toBeSorted/event_manager.h b/include/toBeSorted/event_manager.h index 98997300..bd98a1c9 100644 --- a/include/toBeSorted/event_manager.h +++ b/include/toBeSorted/event_manager.h @@ -12,6 +12,7 @@ class EventManager { public: static bool isInEvent(dAcBase_c *actor, const char *eventName); static bool finishEvent(dAcBase_c *actor, const char *eventName); + static void changeOwnEvent(dAcBase_c *actor1, dAcBase_c *actor2, Event *event, UNKWORD); static bool alsoSetAsCurrentEvent(dAcBase_c *actor, Event *event, void *unknown); static EventManager *sInstance; diff --git a/src/REL/d/a/obj/d_a_obj_tumble_weed.cpp b/src/REL/d/a/obj/d_a_obj_tumble_weed.cpp index 212db3fb..45129dd7 100644 --- a/src/REL/d/a/obj/d_a_obj_tumble_weed.cpp +++ b/src/REL/d/a/obj/d_a_obj_tumble_weed.cpp @@ -18,6 +18,7 @@ #include "m/m_vec.h" #include "rvl/MTX/vec.h" #include "s/s_Math.h" +#include "toBeSorted/blur_and_palette_manager.h" #include "toBeSorted/dowsing_target.h" void float_ordering() { @@ -91,8 +92,6 @@ int dAcOTumbleWeed_c::doDelete() { return SUCCEEDED; } -extern "C" void fn_800247D0(void *, mVec3_c, f32); -extern "C" UNKWORD BLUR_AND_PALETTE_MGR; int dAcOTumbleWeed_c::actorExecute() { if (!mField_0x98C && !isStopped()) { @@ -106,7 +105,7 @@ int dAcOTumbleWeed_c::actorExecute() { calcWind(); sLib::chase(&mField_0x980, 1.f, 0.1f); - fn_800247D0(&BLUR_AND_PALETTE_MGR, mField_0x968, mField_0x980); + BlurAndPaletteManager::GetInstance().fn_800247D0(mField_0x968, mField_0x980); calcVelocity(); position += velocity; diff --git a/src/d/a/obj/d_a_obj_tbox.cpp b/src/d/a/obj/d_a_obj_tbox.cpp index c7190f00..c7999e84 100644 --- a/src/d/a/obj/d_a_obj_tbox.cpp +++ b/src/d/a/obj/d_a_obj_tbox.cpp @@ -1,6 +1,7 @@ #include "d/a/obj/d_a_obj_tbox.h" #include "c/c_lib.h" +#include "c/c_math.h" #include "common.h" #include "d/a/d_a_item.h" #include "d/a/d_a_itembase.h" @@ -12,6 +13,7 @@ #include "d/col/cc/d_cc_s.h" #include "d/flag/sceneflag_manager.h" #include "d/flag/storyflag_manager.h" +#include "d/flag/tboxflag_manager.h" #include "m/m3d/m_fanm.h" #include "m/m3d/m_scnleaf.h" #include "m/m_mtx.h" @@ -25,13 +27,15 @@ #include "s/s_Math.h" #include "toBeSorted/arc_managers/oarc_manager.h" #include "toBeSorted/attention.h" +#include "toBeSorted/blur_and_palette_manager.h" +#include "toBeSorted/counters/goddess_chest_counter.h" #include "toBeSorted/dowsing_target.h" #include "toBeSorted/event_manager.h" #include "toBeSorted/room_manager.h" SPECIAL_ACTOR_PROFILE(TBOX, dAcTbox_c, fProfile::TBOX, 0x018D, 0, 6); -extern "C" mVec3_c vecs[] = { +static mVec3_c sDowsingTargetOffsets[] = { mVec3_c(0.0f, 54.0f, 0.0f), mVec3_c(0.0f, 34.0f, 0.0f), mVec3_c(0.0f, 66.5f, 0.0f), mVec3_c(0.0f, 49.0f, 0.0f) }; @@ -729,13 +733,6 @@ static const u8 sItemToTBoxVariant[MAX_ITEM_ID + 1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static char *const sMdlNames[] = { - "TBoxNormalT", - "TBoxSmallT", - "TBoxBossT", - "GoddessTBox", -}; - static char *const sAnmNames[] = { "TBoxNormalT", "TBoxSmallT", @@ -743,6 +740,13 @@ static char *const sAnmNames[] = { "TBoxNormalT", }; +static char *const sMdlNames[] = { + "TBoxNormalT", + "TBoxSmallT", + "TBoxBossT", + "GoddessTBox", +}; + static char *const sCloseCcNames[] = { "TBoxNormalTClose", "TBoxSmallTClose", @@ -757,10 +761,55 @@ static char *const sOpenCcNames[] = { "GoddessTBoxOpen", }; +bool dAcTbox_c::tryGetDowsingTargetOffset(int variant, mVec3_c &out) { + bool ok = dAcTbox_c::isValidVariant(variant); + if (ok) { + out.x = sDowsingTargetOffsets[variant].x; + out.y = sDowsingTargetOffsets[variant].y; + out.z = sDowsingTargetOffsets[variant].z; + } + return ok; +} + +void dAcTbox_c::getDowsingTargetOffset(int variant, mVec3_c &out) { + tryGetDowsingTargetOffset(variant, out); +} + f32 dAcTbox_c::getSomeRate() { return 1.0f / 8.333333f; } +bool dAcTbox_c::isValidGroupIndex(int idx) { + return 0 <= idx && idx < 15; +} +extern "C" void *SIREN_TAG; +extern "C" bool hasCollectedAllTears(void *SIREN_TAG); +bool dAcTbox_c::hasCollectedAllTears() { + if (SIREN_TAG == nullptr) { + return false; + } + return ::hasCollectedAllTears(SIREN_TAG); +} + +bool dAcTbox_c::getGroundHeight(f32 *height, const mVec3_c &pos) { + if (height == nullptr) { + return false; + } + bool ok = dBgS_ObjGndChk::CheckPos(pos); + if (ok) { + *height = dBgS_ObjGndChk::GetGroundHeight(); + } + return ok; +} + +bool dAcTbox_c::isBelowGroundAtPos(f32 height, const mVec3_c &pos) { + f32 gndHeight; + if (!getGroundHeight(&gndHeight, pos)) { + return false; + } + return height < gndHeight; +} + dAcTbox_c::dAcTbox_c() : mStateMgr(*this, sStateID::null), mScnCallback(this), mEvent(*this, nullptr), mTboxListNode(this), mDowsingTarget(this, DowsingTarget::SLOT_NONE), mGoddessDowsingTarget(this, DowsingTarget::SLOT_NONE) { @@ -899,7 +948,7 @@ bool dAcTbox_c::createHeap() { return true; } -static u32 sSomeCounters[16] = {0}; +static u32 sSomeCounters[15] = {0}; int dAcTbox_c::create() { if (!isActualVisibleBox()) { @@ -937,7 +986,7 @@ int dAcTbox_c::create() { // This part of the code checks if there's another chest with similar properties // and only keeps one of them. - if (fn_80268660(field_0x1208) && !field_0x1210) { + if (isValidGroupIndex(field_0x1208) && !field_0x1210) { sSomeCounters[field_0x1208]++; field_0x1210 = true; } @@ -946,12 +995,12 @@ int dAcTbox_c::create() { u32 counterValue = 0; getSomeCounter(&counterValue); if (counterValue > 1) { - bool keepGoing = true; dAcTbox_c *other; + bool keepGoing = true; dAcObjBase_c *cursor = nullptr; do { - cursor = getNextObject(&sTboxActorList, cursor); - other = static_cast(cursor); + other = static_cast(getNextObject(&sTboxActorList, cursor)); + cursor = other; if (other != nullptr && this != other && !other->field_0x120D && field_0x1208 == other->field_0x1208) { keepGoing = false; } @@ -1047,8 +1096,8 @@ int dAcTbox_c::create() { } field_0x0D48.SetStts(mStts); // TODO figure out the right fields - mCcD1.SetTgType(-1); - mCcD2.SetTgType(-1); + mCcD1.SetTg_0x4C(-1); + mCcD2.SetTg_0x4C(-1); mMdl1.setAnm(sAnmNames[mVariant], m3d::PLAY_MODE_4); if (mHasBeenOpened == true) { mMdl1.setFrame(mMdl1.getAnm().getEndFrame()); @@ -1193,7 +1242,7 @@ int dAcTbox_c::actorExecute() { switch (field_0x120C) { case 0: v1.set(-38.0f, 0.0f, -35.0f); - v2.set(38.0f, 45.0f, 35.0f); + v2.set(38.0f, 45.0f, 31.0f); break; case 1: v1.set(-38.0f, 0.0f, -35.0f); @@ -1379,7 +1428,7 @@ int dAcTbox_c::actorExecuteInEvent() { switch (field_0x120C) { case 0: v1.set(-38.0f, 0.0f, -35.0f); - v2.set(38.0f, 45.0f, 35.0f); + v2.set(38.0f, 45.0f, 31.0f); break; case 1: v1.set(-38.0f, 0.0f, -35.0f); @@ -1574,7 +1623,7 @@ void dAcTbox_c::initializeState_DugOut() { } setActorProperty(0x100); if (mVariant == NORMAL) { - mMdl1.setAnm(sMdlNames[0], m3d::PLAY_MODE_4); + mMdl1.setAnm(sAnmNames[0], m3d::PLAY_MODE_4); } if (mVariant == NORMAL) { if (checkTboxFlag()) { @@ -1761,7 +1810,7 @@ void dAcTbox_c::initializeState_WaitOpen() { field_0x120C = 0; clearActorProperty(0x100); if (mVariant == NORMAL) { - mMdl1.setAnm(sMdlNames[0], m3d::PLAY_MODE_4); + mMdl1.setAnm(sAnmNames[0], m3d::PLAY_MODE_4); } if (mVariant == NORMAL) { mMdl1.setFrame(mMdl1.getAnm().getStartFrame()); @@ -1817,7 +1866,7 @@ void dAcTbox_c::initializeState_DeleteArchive() { mScale.set(1.0f, 1.0f, 1.0f); clearActorProperty(0x100); if (mVariant == NORMAL) { - mMdl1.setAnm(sMdlNames[0], m3d::PLAY_MODE_4); + mMdl1.setAnm(sAnmNames[0], m3d::PLAY_MODE_4); } if (mVariant == NORMAL) { mMdl1.setFrame(mMdl1.getAnm().getStartFrame()); @@ -1855,7 +1904,7 @@ void dAcTbox_c::initializeState_LoadArchive() { mScale.set(1.0f, 1.0f, 1.0f); clearActorProperty(0x100); if (mVariant == NORMAL) { - mMdl1.setAnm(sMdlNames[0], m3d::PLAY_MODE_4); + mMdl1.setAnm(sAnmNames[0], m3d::PLAY_MODE_4); } if (mVariant == NORMAL) { mMdl1.setFrame(mMdl1.getAnm().getStartFrame()); @@ -1879,28 +1928,282 @@ void dAcTbox_c::executeState_LoadArchive() { } void dAcTbox_c::finalizeState_LoadArchive() {} -void dAcTbox_c::initializeState_Open() {} -void dAcTbox_c::executeState_Open() {} +extern "C" void fn_800298B0(u16 effectIndex, mVec3_c *, mAng3_c *, mVec3_c *, void *, void *, void *, void *); +extern "C" u16 PARTICLE_RESOURCE_ID_MAPPING_209_; +extern "C" bool isPouchItem(u16); +extern "C" u8 adventurePouchFindItemSlot(ITEM_ID item); +extern "C" u16 findItemInItemCheck(ITEM_ID item); +extern "C" dAcItem_c *giveItem3(u16 item, s32); + +void dAcTbox_c::initializeState_Open() { + mScale.set(1.0f, 1.0f, 1.0f); + playSound(0xA36); + clearActorProperty(0x100); + if (mVariant == NORMAL) { + mAnmMatClr1.setFrame(mAnmMatClr1.getFrameMax(0), 0); + } + fn_8026D370(); + + if (isNotSmall()) { + mAnmMatClr2.setFrame(mAnmMatClr2.getFrameStart(0), 0); + mAnmChr.setFrameOnly(mAnmChr.getStartFrame()); + mAnmTexSrt1.setFrame(mAnmTexSrt1.getFrameStart(0), 0); + } + + if (isNotSmall()) { + mVec3_c pos; + fn_8026B380(pos); + mVec3_c p2 = fn_8026B3C0(); + fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_209_, &pos, &rotation, &p2, nullptr, nullptr, nullptr, nullptr); + } + fn_8026D140(); + ITEM_ID itemId = mItemId != 0 ? (ITEM_ID)mItemId : ITEM_GODDESS_HARP; + if (isPouchItem(itemId) && adventurePouchFindItemSlot(ITEM_NONE) == 8 && findItemInItemCheck(ITEM_NONE) == 0x3C) { + setShouldCloseFlag(); + } + dAcItem_c *item = giveItem3(itemId, -1); + if (item != nullptr) { + mItemRef.link(item); + const char *evName; + if (dAcItem_c::getItemGetEventName(itemId, &evName)) { + Event ev(evName, 300, 4, (void *)dAcItem_c::itemGetEventStart, (void *)dAcItem_c::itemGetEventEnd); + EventManager::changeOwnEvent(this, item, &ev, 0); + } + } + field_0x11C0.set(-61.0f, 0.0f, -90.0f); + field_0x11CC.set(61.0f, 142.0f, 42.0f); + field_0x11E8 = 1.0f; + field_0x11F4 |= 2; + field_0x120C = 1; +} +void dAcTbox_c::executeState_Open() { + mMdl1.setFrame(dAcPy_c::LINK->getCurrentAnimFrame()); + if (mVariant == GODDESS) { + if (0.4f < field_0x11EC) { + sLib::chase(&field_0x11EC, 0.4f, getSomeRate()); + BlurAndPaletteManager::GetInstance().fn_80022AF0(field_0x11EC); + BlurAndPaletteManager::GetInstance().setField_0x2F20(field_0x11EC); + } + } else if (mVariant != SMALL) { + // exact same code as in the other branch + if (0.4f < field_0x11EC) { + sLib::chase(&field_0x11EC, 0.4f, getSomeRate()); + BlurAndPaletteManager::GetInstance().fn_80022AF0(field_0x11EC); + BlurAndPaletteManager::GetInstance().setField_0x2F20(field_0x11EC); + } + } + if (mMdl1.getAnm().isStop()) { + mStateMgr.changeState(StateID_PresentItem); + } +} void dAcTbox_c::finalizeState_Open() {} -void dAcTbox_c::initializeState_PresentItem() {} -void dAcTbox_c::executeState_PresentItem() {} +void dAcTbox_c::initializeState_PresentItem() { + if (mVariant == NORMAL) { + mAnmMatClr1.setFrame(mAnmMatClr1.getFrameMax(0), 0); + } + field_0x11C0.set(-61.0f, 0.0f, -90.0f); + field_0x11CC.set(61.0f, 142.0f, 42.0f); + field_0x11E8 = 1.0f; + field_0x11F4 |= 2; + field_0x120C = 1; +} + +void dAcTbox_c::executeState_PresentItem() { + // Copied from executeState_Open + if (mVariant == GODDESS) { + if (0.4f < field_0x11EC) { + sLib::chase(&field_0x11EC, 0.4f, getSomeRate()); + BlurAndPaletteManager::GetInstance().fn_80022AF0(field_0x11EC); + BlurAndPaletteManager::GetInstance().setField_0x2F20(field_0x11EC); + } + } else if (mVariant != SMALL) { + if (0.4f < field_0x11EC) { + sLib::chase(&field_0x11EC, 0.4f, getSomeRate()); + BlurAndPaletteManager::GetInstance().fn_80022AF0(field_0x11EC); + BlurAndPaletteManager::GetInstance().setField_0x2F20(field_0x11EC); + } + } + mEvent.advanceNext(); + if (checkShouldClose()) { + unsetShouldCloseFlag(); + mStateMgr.changeState(StateID_Close); + } else { + mHasBeenOpened = true; + if (mSetSceneFlag < 0xFF) { + SceneflagManager::sInstance->setFlag(roomid, mSetSceneFlag); + } + setTboxFlag(); + if (mVariant == GODDESS) { + mStateMgr.changeState(StateID_GoddessWait); + GoddessChestCounter::sInstance.checkedAdd(1); + } else { + mStateMgr.changeState(StateID_Wait); + } + } +} void dAcTbox_c::finalizeState_PresentItem() {} -void dAcTbox_c::initializeState_Close() {} -void dAcTbox_c::executeState_Close() {} +void dAcTbox_c::initializeState_Close() { + mMdl1.getAnm().setPlayState(m3d::PLAY_MODE_3); + if (mVariant == NORMAL) { + mAnmMatClr1.setFrame(mAnmMatClr1.getFrameMax(0), 0); + } + field_0x11FC = 0x2D; + field_0x11C0.set(-61.0f, 0.0f, -90.0f); + field_0x11CC.set(61.0f, 142.0f, 42.0f); + field_0x11E8 = 1.0f; + field_0x11F4 |= 2; + field_0x120C = 1; +} +void dAcTbox_c::executeState_Close() { + switch ((u32)mVariant) { + case NORMAL: + case BOSS: + if (field_0x11FC <= 0) { + if (field_0x11EC < 1.0f) { + sLib::chase(&field_0x11EC, 1.0f, getSomeRate()); + BlurAndPaletteManager::GetInstance().fn_80022AF0(field_0x11EC); + BlurAndPaletteManager::GetInstance().setField_0x2F20(field_0x11EC); + } + } else { + field_0x11FC--; + } + if (!EventManager::isInEvent()) { + if (mMdl1.getAnm().isStop()) { + mMdl1.getAnm().setPlayState(m3d::PLAY_MODE_1); + mStateMgr.changeState(StateID_WaitOpen); + } else { + mMdl1.play(); + } + } + break; + case SMALL: + if (!EventManager::isInEvent()) { + if (mMdl1.getAnm().isStop()) { + mMdl1.getAnm().setPlayState(m3d::PLAY_MODE_1); + mStateMgr.changeState(StateID_WaitOpen); + } else { + mMdl1.play(); + } + } + break; + case GODDESS: + if (field_0x11FC <= 0) { + if (field_0x11EC < 1.0f) { + sLib::chase(&field_0x11EC, 1.0f, getSomeRate()); + BlurAndPaletteManager::GetInstance().fn_80022AF0(field_0x11EC); + BlurAndPaletteManager::GetInstance().setField_0x2F20(field_0x11EC); + } + } else { + field_0x11FC--; + } + if (!EventManager::isInEvent()) { + if (mMdl1.getAnm().isStop()) { + mMdl1.getAnm().setPlayState(m3d::PLAY_MODE_1); + mStateMgr.changeState(StateID_GoddessWaitOn); + } else { + mMdl1.play(); + } + } + break; + } +} void dAcTbox_c::finalizeState_Close() {} -void dAcTbox_c::initializeState_Wait() {} -void dAcTbox_c::executeState_Wait() {} +void dAcTbox_c::initializeState_Wait() { + mScale.set(1.0f, 1.0f, 1.0f); + field_0x11E8 = 1.0f; + field_0x11F4 |= 2; + switch ((u32)mVariant) { + case NORMAL: + field_0x11C0.set(-61.0f, 0.0f, -90.0f); + field_0x11CC.set(61.0f, 142.0f, 42.0f); + break; + case SMALL: + field_0x11C0.set(-38.0f, 0.0f, -68.0f); + field_0x11CC.set(38.0f, 101.0f, 31.0f); + break; + case BOSS: + field_0x11C0.set(-90.0f, 0.0f, -135.0f); + field_0x11CC.set(90.0f, 163.0f, 56.0f); + break; + } + field_0x120C = 1; + clearActorProperty(0x100); + if (mVariant == 0) { + mMdl1.setAnm(sAnmNames[0], m3d::PLAY_MODE_4); + mAnmMatClr1.setFrame(mAnmMatClr1.getFrameMax(0), 0); + } + mMdl1.setFrame(mMdl1.getAnm().getEndFrame()); + field_0x11FC = 0x2D; + fn_8026D130(); +} +void dAcTbox_c::executeState_Wait() { + if (mVariant == NORMAL || mVariant == BOSS) { + if (field_0x11FC <= 0) { + if (field_0x11EC < 1.0f) { + sLib::chase(&field_0x11EC, 1.0f, getSomeRate()); + BlurAndPaletteManager::GetInstance().fn_80022AF0(field_0x11EC); + BlurAndPaletteManager::GetInstance().setField_0x2F20(field_0x11EC); + } + } else { + field_0x11FC--; + } + } +} void dAcTbox_c::finalizeState_Wait() {} -void dAcTbox_c::initializeState_GoddessWait() {} -void dAcTbox_c::executeState_GoddessWait() {} +void dAcTbox_c::initializeState_GoddessWait() { + mScale.set(1.0f, 1.0f, 1.0f); + field_0x11C0.set(-62.0f, 0.0f, -95.0f); + field_0x11CC.set(62.0f, 140.0f, 47.0f); + field_0x11E8 = 1.0f; + field_0x11F4 |= 2; + field_0x120C = 1; + clearActorProperty(0x100); + field_0x11FC = 0x2D; + fn_8026D130(); +} +void dAcTbox_c::executeState_GoddessWait() { + if (field_0x11FC <= 0) { + if (field_0x11EC < 1.0f) { + sLib::chase(&field_0x11EC, 1.0f, getSomeRate()); + BlurAndPaletteManager::GetInstance().fn_80022AF0(field_0x11EC); + // this is apparently not needed here + // BlurAndPaletteManager::GetInstance().setField_0x2F20(field_0x11EC); + } + } else { + field_0x11FC--; + } +} void dAcTbox_c::finalizeState_GoddessWait() {} -extern "C" dAcBase_c *getCurrentEventActor(); +void dAcTbox_c::getDowsingTargetOffset(mVec3_c *out) const { + return getDowsingTargetOffset(mVariant, *out); +} +bool dAcTbox_c::fn_8026D120() const { + return true; +} + +void dAcTbox_c::fn_8026D130() { + setActorProperty(0x1); +} + +void dAcTbox_c::fn_8026D140() { + clearActorProperty(0x1); +} + +void dAcTbox_c::doInteraction(s32 _unused) { + void *zevDat = getOarcZev(sArcNames[mVariant]); + if (zevDat != nullptr) { + Event ev(sOpenEventNames[mVariant], zevDat, 100, 0x100001, 0, 0); + mEvent.scheduleEvent(ev, 0); + } +} + +extern "C" dAcBase_c *getCurrentEventActor(); void dAcTbox_c::registerInEvent() { if (getCurrentEventActor() == mItemRef.get()) { if (EventManager::isCurrentEvent("ItemGetDefaultTBox") || EventManager::isCurrentEvent("ItemGetGorgeousTBox")) { @@ -1918,10 +2221,88 @@ void dAcTbox_c::unkVirtFunc_0x6C() { } } +bool dAcTbox_c::checkShouldClose() { + return field_0x11F4 & 0x1; +} + +void dAcTbox_c::setShouldCloseFlag() { + setFlags(field_0x11F4 | 0x1); +} + +void dAcTbox_c::unsetShouldCloseFlag() { + setFlags(field_0x11F4 & ~0x1); +} + +void dAcTbox_c::fn_8026D370() { + if (isNotSmall()) { + field_0x11F0 = 1; + BlurAndPaletteManager::GetInstance().fn_800223A0(&field_0x4DC); + } +} + +void dAcTbox_c::fn_8026D3C0() { + if (mAnmChr.isStop() && mAnmTexSrt1.isStop(0) && mAnmMatClr2.isStop(0)) { + field_0x11F0 = 0; + BlurAndPaletteManager::GetInstance().fn_80022440(&field_0x4DC); + } else { + mAnmChr.play(); + mAnmTexSrt1.play(); + mAnmMatClr2.play(); + field_0x4E8.r = 0xAA; + field_0x4E8.g = 0x96; + field_0x4E8.b = 0x96; + field_0x4EC = 125.0f; + } +} + +void dAcTbox_c::setChestFlag() { + field_0x1207 = (rotation.z >> 9) & 0x3F; +} + +void dAcTbox_c::setTboxFlag() { + if (field_0x1207 <= 0x1F) { + TBoxflagManager::sInstance->setFlag(field_0x1207); + } +} + +bool dAcTbox_c::checkTboxFlag() const { + if (field_0x1207 <= 0x1F) { + return TBoxflagManager::sInstance->checkFlag(TBoxflagManager::sInstance->mSceneIndex, field_0x1207); + } + return false; +} + bool dAcTbox_c::isNotSmall() const { return mVariant != SMALL; } +bool dAcTbox_c::fn_8026D540() { + return field_0x11F0 == 1; +} + +bool dAcTbox_c::fn_8026D560() const { + if (isValidGroupIndex(field_0x1208)) { + u32 counterVal; + getSomeCounter(&counterVal); + f32 cmp = 1.0f / counterVal; + return cM::rndF(1.0f) <= cmp; + } + return true; +} + +bool dAcTbox_c::getSomeCounter(u32 *outValue) const { + bool ok = isValidGroupIndex(field_0x1208); + if (ok) { + *outValue = sSomeCounters[field_0x1208]; + ok = *outValue; + } + return ok; +} + +bool dAcTbox_c::fn_8026D670() const { + return isValidGroupIndex(field_0x1208); +} + void dAcTbox_c::syncScaleToMdl(m3d::scnLeaf_c *lf) { lf->setScale(mScale); } @@ -1989,6 +2370,12 @@ void dAcTbox_c::unregisterDowsing() { } } +extern "C" u16 PARTICLE_RESOURCE_ID_MAPPING_208_; + +void dAcTbox_c::fn_8026D950() { + fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_208_, &position, &rotation, nullptr, nullptr, nullptr, nullptr, nullptr); +} + bool dAcTbox_c::checkIsClear() const { f32 fs[] = { position.y, @@ -2010,7 +2397,7 @@ bool dAcTbox_c::checkIsClear() const { bool isClear = true; for (u32 i = 0; isClear && i <= 3;) { // @bug should this be points[i] instead? - if (fn_802686F0(points[0], fs[fsIdxes[i]])) { + if (isBelowGroundAtPos(fs[fsIdxes[i]], points[0])) { isClear = false; } else { i++; @@ -2020,6 +2407,14 @@ bool dAcTbox_c::checkIsClear() const { return isClear; } +void dAcTbox_c::fn_8026DAC0(mAng &ang) { + ang = rotation.y - 0x8000; +} + +void dAcTbox_c::fn_8026DAD0(const mVec3_c *a, mVec3_c *b) const { + PSMTXMultVec(mWorldMtx, *a, *b); +} + void dAcTbox_c::getCylParams(mVec3_c *c, f32 *r, f32 *h) const { switch ((u32)mVariant) { case NORMAL: @@ -2240,10 +2635,10 @@ bool dAcTbox_c::checkForLinkBonk() { } bool bonk = false; - bonk = bonk || (ccLo.x <= linkPos.x && linkPos.x <= ccHi.x) && - (ccLo.z - 80.0f <= linkPos.z && linkPos.z <= ccHi.z + 80.0f); - bonk = bonk || (ccLo.z <= linkPos.z && linkPos.z <= ccHi.z) && - (ccLo.x - 80.0f <= linkPos.x && linkPos.x <= ccHi.x + 80.0f); + bonk = bonk || + (ccLo.x <= linkPos.x && linkPos.x <= ccHi.x) && (ccLo.z - 80.0f <= linkPos.z && linkPos.z <= ccHi.z + 80.0f); + bonk = bonk || + (ccLo.z <= linkPos.z && linkPos.z <= ccHi.z) && (ccLo.x - 80.0f <= linkPos.x && linkPos.x <= ccHi.x + 80.0f); bonk = bonk || (linkPos.x < ccLo.x && linkPos.z < ccLo.z) && (linkPos.inprodXZ(ccLo) <= 6400.0f); bonk = bonk || (ccHi.x < linkPos.x && ccHi.z < linkPos.z) && (linkPos.inprodXZ(ccLo) <= 6400.0f); bonk = bonk || (linkPos.x < ccLo.x && ccLo.z < linkPos.z) && (linkPos.inprodXZ(ccLo) <= 6400.0f); @@ -2260,7 +2655,7 @@ bool dAcTbox_c::checkForLinkBonk() { } // TODO - + link->bonk(); return false; diff --git a/src/d/flag/tboxflag_manager.inc b/src/d/flag/tboxflag_manager.inc index a00ac045..a2eb7e07 100644 --- a/src/d/flag/tboxflag_manager.inc +++ b/src/d/flag/tboxflag_manager.inc @@ -33,7 +33,7 @@ void TBoxflagManager::copyFromSave(u32 sceneIndex) { } /* 0x800BE990 */ -bool TBoxflagManager::checkFlag(u16 sceneIndex, u16 flag) { +u16 TBoxflagManager::checkFlag(u16 sceneIndex, u16 flag) { s32 actualFlag = (flag + sceneIndex * 0x20); return mFlagHelper.checkFlag( actualFlag / 16, flag % 16, FileManager::getInstance()->getTBoxFlagsConst(), getFlagCount()