From c7250e132fd5896c79819045553a94e37ec4c810 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Fri, 25 Nov 2022 14:41:28 +0200 Subject: [PATCH] Add CGunWeapon Former-commit-id: edbfd0d3052eca9fc71e42e7cb1f073064fde365 --- asm/Kyoto/Animation/DolphinCSkinnedModel.s | 4 +- asm/MetroidPrime/CActorParticles.s | 2 +- asm/MetroidPrime/CModelData.s | 16 +- asm/MetroidPrime/CProjectedShadow.s | 2 +- asm/MetroidPrime/CSamusDoll.s | 10 +- asm/MetroidPrime/Cameras/CCameraShakeData.s | 6 +- asm/MetroidPrime/Enemies/COmegaPirate.s | 4 +- asm/MetroidPrime/Enemies/CPatterned.s | 6 +- asm/MetroidPrime/Enemies/CSnakeWeedSwarm.s | 2 +- asm/MetroidPrime/Enemies/CWallCrawlerSwarm.s | 4 +- asm/MetroidPrime/Player/CGrappleArm.s | 20 +- asm/MetroidPrime/Player/CMorphBall.s | 4 +- asm/MetroidPrime/ScriptObjects/CFishCloud.s | 2 +- .../ScriptObjects/CScriptGunTurret.s | 2 +- asm/MetroidPrime/Weapons/CAuxWeapon.s | 4 +- asm/MetroidPrime/Weapons/CGunWeapon.s | 108 +-- .../Weapons/GunController/CGunController.s | 4 +- .../Weapons/GunController/CGunMotion.s | 2 +- include/Kyoto/Animation/CSkinnedModel.hpp | 23 +- include/Kyoto/CObjectReference.hpp | 1 + include/Kyoto/CToken.hpp | 4 +- include/Kyoto/Graphics/CModel.hpp | 1 + include/Kyoto/Particles/CVectorElement.hpp | 6 +- include/MetaRender/CCubeRenderer.hpp | 71 +- include/MetaRender/IRenderer.hpp | 37 + include/MetroidPrime/CAnimData.hpp | 7 + include/MetroidPrime/CModelData.hpp | 22 +- include/MetroidPrime/CRainSplashGenerator.hpp | 22 +- include/MetroidPrime/CStateManager.hpp | 1 + .../MetroidPrime/Cameras/CCameraShakeData.hpp | 2 + include/MetroidPrime/Tweaks/CTweakGunRes.hpp | 15 + .../MetroidPrime/Tweaks/CTweakPlayerGun.hpp | 13 + include/MetroidPrime/Weapons/CGunWeapon.hpp | 75 +- .../Weapons/GunController/CGunController.hpp | 15 +- include/MetroidPrime/Weapons/WeaponCommon.hpp | 4 + src/MetroidPrime/CActor.cpp | 6 +- src/MetroidPrime/Weapons/CGunWeapon.cpp | 745 +++++++++++++++++- .../Weapons/GunController/CGunController.cpp | 2 +- 38 files changed, 1099 insertions(+), 175 deletions(-) diff --git a/asm/Kyoto/Animation/DolphinCSkinnedModel.s b/asm/Kyoto/Animation/DolphinCSkinnedModel.s index 1e0f8024..72e989da 100644 --- a/asm/Kyoto/Animation/DolphinCSkinnedModel.s +++ b/asm/Kyoto/Animation/DolphinCSkinnedModel.s @@ -97,8 +97,8 @@ ClearPointGeneratorFunc__13CSkinnedModelFv: /* 8035270C 0034F66C 90 0D AA 30 */ stw r0, lbl_805A95F0@sda21(r13) /* 80352710 0034F670 4E 80 00 20 */ blr -.global SetPointGeneratorFunc__13CSkinnedModelFUiPFUiPC9CVector3fPC9CVector3fi_v -SetPointGeneratorFunc__13CSkinnedModelFUiPFUiPC9CVector3fPC9CVector3fi_v: +.global SetPointGeneratorFunc__13CSkinnedModelFPvPFPvPC9CVector3fPC9CVector3fi_v +SetPointGeneratorFunc__13CSkinnedModelFPvPFPvPC9CVector3fPC9CVector3fi_v: /* 80352714 0034F674 90 8D AA 30 */ stw r4, lbl_805A95F0@sda21(r13) /* 80352718 0034F678 90 6D AA 34 */ stw r3, lbl_805A95F4@sda21(r13) /* 8035271C 0034F67C 4E 80 00 20 */ blr diff --git a/asm/MetroidPrime/CActorParticles.s b/asm/MetroidPrime/CActorParticles.s index f768b5fc..3da897f7 100644 --- a/asm/MetroidPrime/CActorParticles.s +++ b/asm/MetroidPrime/CActorParticles.s @@ -1123,7 +1123,7 @@ SetupHook__20CActorModelParticlesCF9TUniqueId: /* 801E47AC 001E170C 3C 80 80 1E */ lis r4, PointGenerator__20CActorModelParticlesFUiPC9CVector3fPC9CVector3fi@ha /* 801E47B0 001E1710 38 63 00 08 */ addi r3, r3, 8 /* 801E47B4 001E1714 38 84 4E 20 */ addi r4, r4, PointGenerator__20CActorModelParticlesFUiPC9CVector3fPC9CVector3fi@l -/* 801E47B8 001E1718 48 16 DF 5D */ bl SetPointGeneratorFunc__13CSkinnedModelFUiPFUiPC9CVector3fPC9CVector3fi_v +/* 801E47B8 001E1718 48 16 DF 5D */ bl SetPointGeneratorFunc__13CSkinnedModelFPvPFPvPC9CVector3fPC9CVector3fi_v lbl_801E47BC: /* 801E47BC 001E171C 80 01 00 24 */ lwz r0, 0x24(r1) /* 801E47C0 001E1720 83 E1 00 1C */ lwz r31, 0x1c(r1) diff --git a/asm/MetroidPrime/CModelData.s b/asm/MetroidPrime/CModelData.s index a058a7ca..297ff4bf 100644 --- a/asm/MetroidPrime/CModelData.s +++ b/asm/MetroidPrime/CModelData.s @@ -1334,7 +1334,7 @@ lbl_80115DF4: /* 80115E28 00112D88 4B F1 6B 51 */ bl "SetupRender__9CAnimDataCFRC13CSkinnedModelRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 80115E2C 00112D8C 38 61 00 A4 */ addi r3, r1, 0xa4 /* 80115E30 00112D90 38 80 FF FF */ li r4, -1 -/* 80115E34 00112D94 4B F6 1E 59 */ bl sub_80077c8c +/* 80115E34 00112D94 4B F6 1E 59 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" /* 80115E38 00112D98 3C 60 80 11 */ lis r3, MultipassDrawCallback__10CModelDataFPCfPCfPC21SMultipassDrawContext@ha /* 80115E3C 00112D9C 93 C1 00 08 */ stw r30, 8(r1) /* 80115E40 00112DA0 38 83 64 48 */ addi r4, r3, MultipassDrawCallback__10CModelDataFPCfPCfPC21SMultipassDrawContext@l @@ -1412,7 +1412,7 @@ MultiLightingDraw__10CModelDataF11EWhichModelRC12CTransform4fPC12CActorLightsRC6 /* 80115F44 00112EA4 4B F1 6A 35 */ bl "SetupRender__9CAnimDataCFRC13CSkinnedModelRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 80115F48 00112EA8 38 61 00 B8 */ addi r3, r1, 0xb8 /* 80115F4C 00112EAC 38 80 FF FF */ li r4, -1 -/* 80115F50 00112EB0 4B F6 1D 3D */ bl sub_80077c8c +/* 80115F50 00112EB0 4B F6 1D 3D */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" /* 80115F54 00112EB4 80 1F 00 0C */ lwz r0, 0xc(r31) /* 80115F58 00112EB8 3C 60 80 11 */ lis r3, MultiLightingDrawCallback__10CModelDataFPCfPCfPC25SMultiLightingDrawContext@ha /* 80115F5C 00112EBC 38 83 64 B8 */ addi r4, r3, MultiLightingDrawCallback__10CModelDataFPCfPCfPC25SMultiLightingDrawContext@l @@ -1444,8 +1444,8 @@ lbl_80115FB0: /* 80115FBC 00112F1C 38 21 01 20 */ addi r1, r1, 0x120 /* 80115FC0 00112F20 4E 80 00 20 */ blr -.global FlatDraw__10CModelDataF11EWhichModelRC12CTransform4fbRC11CModelFlags -FlatDraw__10CModelDataF11EWhichModelRC12CTransform4fbRC11CModelFlags: +.global FlatDraw__10CModelDataCF11EWhichModelRC12CTransform4fbRC11CModelFlags +FlatDraw__10CModelDataCF11EWhichModelRC12CTransform4fbRC11CModelFlags: /* 80115FC4 00112F24 94 21 FE F0 */ stwu r1, -0x110(r1) /* 80115FC8 00112F28 7C 08 02 A6 */ mflr r0 /* 80115FCC 00112F2C 90 01 01 14 */ stw r0, 0x114(r1) @@ -1488,7 +1488,7 @@ FlatDraw__10CModelDataF11EWhichModelRC12CTransform4fbRC11CModelFlags: /* 80116060 00112FC0 4B F1 69 19 */ bl "SetupRender__9CAnimDataCFRC13CSkinnedModelRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 80116064 00112FC4 38 61 00 A4 */ addi r3, r1, 0xa4 /* 80116068 00112FC8 38 80 FF FF */ li r4, -1 -/* 8011606C 00112FCC 4B F6 1C 21 */ bl sub_80077c8c +/* 8011606C 00112FCC 4B F6 1C 21 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" /* 80116070 00112FD0 3C 60 80 11 */ lis r3, FlatDrawCallback__10CModelDataFPCfPCfPC16SFlatDrawContext@ha /* 80116074 00112FD4 93 E1 00 08 */ stw r31, 8(r1) /* 80116078 00112FD8 38 83 66 40 */ addi r4, r3, FlatDrawCallback__10CModelDataFPCfPCfPC16SFlatDrawContext@l @@ -1604,7 +1604,7 @@ DisintegrateDraw__10CModelDataF11EWhichModelRC12CTransform4fRC8CTextureRC6CColor /* 80116210 00113170 4B F1 67 69 */ bl "SetupRender__9CAnimDataCFRC13CSkinnedModelRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 80116214 00113174 38 61 00 C0 */ addi r3, r1, 0xc0 /* 80116218 00113178 38 80 FF FF */ li r4, -1 -/* 8011621C 0011317C 4B F6 1A 71 */ bl sub_80077c8c +/* 8011621C 0011317C 4B F6 1A 71 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" /* 80116220 00113180 80 1E 00 00 */ lwz r0, 0(r30) /* 80116224 00113184 3C 60 80 11 */ lis r3, DisintegrateDrawCallback__10CModelDataFPCfPCfPC22SOneTextureDrawContext@ha /* 80116228 00113188 38 83 66 8C */ addi r4, r3, DisintegrateDrawCallback__10CModelDataFPCfPCfPC22SOneTextureDrawContext@l @@ -1684,7 +1684,7 @@ RenderThermal__10CModelDataCFRC12CTransform4fRC6CColorRC6CColorRC11CModelFlags: /* 8011633C 0011329C 4B F1 66 3D */ bl "SetupRender__9CAnimDataCFRC13CSkinnedModelRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 80116340 001132A0 38 61 00 98 */ addi r3, r1, 0x98 /* 80116344 001132A4 38 80 FF FF */ li r4, -1 -/* 80116348 001132A8 4B F6 19 45 */ bl sub_80077c8c +/* 80116348 001132A8 4B F6 19 45 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" /* 8011634C 001132AC 7F E3 FB 78 */ mr r3, r31 /* 80116350 001132B0 7F 84 E3 78 */ mr r4, r28 /* 80116354 001132B4 7F A5 EB 78 */ mr r5, r29 @@ -2143,7 +2143,7 @@ lbl_80116984: /* 801169B8 00113918 4B F1 5F 65 */ bl "Render__9CAnimDataCFRC13CSkinnedModelRC11CModelFlagsRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 801169BC 0011391C 38 61 00 A0 */ addi r3, r1, 0xa0 /* 801169C0 00113920 38 80 FF FF */ li r4, -1 -/* 801169C4 00113924 4B F6 12 C9 */ bl sub_80077c8c +/* 801169C4 00113924 4B F6 12 C9 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" /* 801169C8 00113928 48 00 00 40 */ b lbl_80116A08 lbl_801169CC: /* 801169CC 0011392C 88 1F 00 28 */ lbz r0, 0x28(r31) diff --git a/asm/MetroidPrime/CProjectedShadow.s b/asm/MetroidPrime/CProjectedShadow.s index 2e9306c4..a62080dc 100644 --- a/asm/MetroidPrime/CProjectedShadow.s +++ b/asm/MetroidPrime/CProjectedShadow.s @@ -684,7 +684,7 @@ RenderShadowBuffer__16CProjectedShadowFR13CStateManagerRC10CModelDataRC12CTransf /* 8029E0BC 0029B01C 4B D8 E8 BD */ bl "SetupRender__9CAnimDataCFRC13CSkinnedModelRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 8029E0C0 0029B020 38 61 01 64 */ addi r3, r1, 0x164 /* 8029E0C4 0029B024 38 80 FF FF */ li r4, -1 -/* 8029E0C8 0029B028 4B DD 9B C5 */ bl sub_80077c8c +/* 8029E0C8 0029B028 4B DD 9B C5 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" /* 8029E0CC 0029B02C 7F 60 00 34 */ cntlzw r0, r27 /* 8029E0D0 0029B030 C0 59 00 00 */ lfs f2, 0(r25) /* 8029E0D4 0029B034 C0 39 00 04 */ lfs f1, 4(r25) diff --git a/asm/MetroidPrime/CSamusDoll.s b/asm/MetroidPrime/CSamusDoll.s index 35d92ddd..57d8948f 100644 --- a/asm/MetroidPrime/CSamusDoll.s +++ b/asm/MetroidPrime/CSamusDoll.s @@ -3822,7 +3822,7 @@ lbl_800DDC60: /* 800DDC70 000DABD0 4B FF F9 85 */ bl BuildSuitModelData1__10CSamusDollFQ212CPlayerState11EPlayerSuit /* 800DDC74 000DABD4 38 7A 00 C8 */ addi r3, r26, 0xc8 /* 800DDC78 000DABD8 38 81 00 D8 */ addi r4, r1, 0xd8 -/* 800DDC7C 000DABDC 48 00 01 FD */ bl sub_800dde78 +/* 800DDC7C 000DABDC 48 00 01 FD */ bl "__as__Q24rstl29optional_object<10CModelData>FRC10CModelData" /* 800DDC80 000DABE0 38 61 00 D8 */ addi r3, r1, 0xd8 /* 800DDC84 000DABE4 38 80 FF FF */ li r4, -1 /* 800DDC88 000DABE8 48 03 8D C5 */ bl __dt__10CModelDataFv @@ -3895,7 +3895,7 @@ lbl_800DDD70: /* 800DDD88 000DACE8 4B FF F7 65 */ bl BuildSuitModelDataBoots__10CSamusDollFQ212CPlayerState11EPlayerSuit /* 800DDD8C 000DACEC 38 7A 01 34 */ addi r3, r26, 0x134 /* 800DDD90 000DACF0 38 81 00 8C */ addi r4, r1, 0x8c -/* 800DDD94 000DACF4 48 00 00 E5 */ bl sub_800dde78 +/* 800DDD94 000DACF4 48 00 00 E5 */ bl "__as__Q24rstl29optional_object<10CModelData>FRC10CModelData" /* 800DDD98 000DACF8 38 61 00 8C */ addi r3, r1, 0x8c /* 800DDD9C 000DACFC 38 80 FF FF */ li r4, -1 /* 800DDDA0 000DAD00 48 03 8C AD */ bl __dt__10CModelDataFv @@ -3934,7 +3934,7 @@ lbl_800DDDC0: /* 800DDE20 000DAD80 48 03 8D 35 */ bl __ct__10CModelDataFRC8CAnimRes /* 800DDE24 000DAD84 38 7A 01 84 */ addi r3, r26, 0x184 /* 800DDE28 000DAD88 38 81 00 40 */ addi r4, r1, 0x40 -/* 800DDE2C 000DAD8C 48 00 00 4D */ bl sub_800dde78 +/* 800DDE2C 000DAD8C 48 00 00 4D */ bl "__as__Q24rstl29optional_object<10CModelData>FRC10CModelData" /* 800DDE30 000DAD90 38 61 00 40 */ addi r3, r1, 0x40 /* 800DDE34 000DAD94 38 80 FF FF */ li r4, -1 /* 800DDE38 000DAD98 48 03 8C 15 */ bl __dt__10CModelDataFv @@ -3955,8 +3955,8 @@ lbl_800DDE64: /* 800DDE70 000DADD0 38 21 01 90 */ addi r1, r1, 0x190 /* 800DDE74 000DADD4 4E 80 00 20 */ blr -.global sub_800dde78 -sub_800dde78: +.global "__as__Q24rstl29optional_object<10CModelData>FRC10CModelData" +"__as__Q24rstl29optional_object<10CModelData>FRC10CModelData": /* 800DDE78 000DADD8 94 21 FF F0 */ stwu r1, -0x10(r1) /* 800DDE7C 000DADDC 7C 08 02 A6 */ mflr r0 /* 800DDE80 000DADE0 90 01 00 14 */ stw r0, 0x14(r1) diff --git a/asm/MetroidPrime/Cameras/CCameraShakeData.s b/asm/MetroidPrime/Cameras/CCameraShakeData.s index e7e21882..f1e87632 100644 --- a/asm/MetroidPrime/Cameras/CCameraShakeData.s +++ b/asm/MetroidPrime/Cameras/CCameraShakeData.s @@ -40,7 +40,7 @@ lbl_805A789C: .section .bss .balign 8 .lcomm lbl_8046C7D0, 0x78, 4 -.comm lbl_805719E8, 0xD4, 4 +.comm skChargedShotCameraShakeData__16CCameraShakeData, 0xD4, 4 .comm lbl_80571ABC, 0xD4, 4 # MWCC .comm bug .comm lbl_80571B90, 0xD4, 4 @@ -1476,12 +1476,12 @@ __sinit_CCameraShakeData_cpp: /* 8015DD54 0015ACB4 4B FF F4 FD */ bl __ct__22CCameraShakerComponentFiRC17SCameraShakePointRC17SCameraShakePoint /* 8015DD58 0015ACB8 38 61 00 BC */ addi r3, r1, 0xbc /* 8015DD5C 0015ACBC 4B FF F3 D5 */ bl __ct__22CCameraShakerComponentFv -/* 8015DD60 0015ACC0 3C 60 80 57 */ lis r3, lbl_805719E8@ha +/* 8015DD60 0015ACC0 3C 60 80 57 */ lis r3, skChargedShotCameraShakeData__16CCameraShakeData@ha /* 8015DD64 0015ACC4 3C 80 80 5A */ lis r4, sZeroVector__9CVector3f@ha /* 8015DD68 0015ACC8 38 A4 66 A0 */ addi r5, r4, sZeroVector__9CVector3f@l /* 8015DD6C 0015ACCC C0 22 9F 18 */ lfs f1, lbl_805ABC38@sda21(r2) /* 8015DD70 0015ACD0 C0 42 9E F4 */ lfs f2, lbl_805ABC14@sda21(r2) -/* 8015DD74 0015ACD4 38 63 19 E8 */ addi r3, r3, lbl_805719E8@l +/* 8015DD74 0015ACD4 38 63 19 E8 */ addi r3, r3, skChargedShotCameraShakeData__16CCameraShakeData@l /* 8015DD78 0015ACD8 38 C1 01 34 */ addi r6, r1, 0x134 /* 8015DD7C 0015ACDC 38 E1 00 F8 */ addi r7, r1, 0xf8 /* 8015DD80 0015ACE0 39 01 00 BC */ addi r8, r1, 0xbc diff --git a/asm/MetroidPrime/Enemies/COmegaPirate.s b/asm/MetroidPrime/Enemies/COmegaPirate.s index 7cafcfec..52b2e150 100644 --- a/asm/MetroidPrime/Enemies/COmegaPirate.s +++ b/asm/MetroidPrime/Enemies/COmegaPirate.s @@ -5023,7 +5023,7 @@ Render__12COmegaPirateCFRC13CStateManager: /* 8028F518 0028C478 4B D9 D4 05 */ bl "Render__9CAnimDataCFRC13CSkinnedModelRC11CModelFlagsRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 8028F51C 0028C47C 38 61 01 20 */ addi r3, r1, 0x120 /* 8028F520 0028C480 38 80 FF FF */ li r4, -1 -/* 8028F524 0028C484 4B DE 87 69 */ bl sub_80077c8c +/* 8028F524 0028C484 4B DE 87 69 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" lbl_8028F528: /* 8028F528 0028C488 88 1E 09 A0 */ lbz r0, 0x9a0(r30) /* 8028F52C 0028C48C 28 00 00 00 */ cmplwi r0, 0 @@ -5081,7 +5081,7 @@ lbl_8028F580: /* 8028F5F8 0028C558 4B D9 D3 25 */ bl "Render__9CAnimDataCFRC13CSkinnedModelRC11CModelFlagsRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 8028F5FC 0028C55C 38 61 00 D4 */ addi r3, r1, 0xd4 /* 8028F600 0028C560 38 80 FF FF */ li r4, -1 -/* 8028F604 0028C564 4B DE 86 89 */ bl sub_80077c8c +/* 8028F604 0028C564 4B DE 86 89 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" lbl_8028F608: /* 8028F608 0028C568 7F C3 F3 78 */ mr r3, r30 /* 8028F60C 0028C56C 7F E4 FB 78 */ mr r4, r31 diff --git a/asm/MetroidPrime/Enemies/CPatterned.s b/asm/MetroidPrime/Enemies/CPatterned.s index e6c8ddb6..bc517693 100644 --- a/asm/MetroidPrime/Enemies/CPatterned.s +++ b/asm/MetroidPrime/Enemies/CPatterned.s @@ -1208,7 +1208,7 @@ RenderIceModelWithFlags__10CPatternedCFRC11CModelFlags: /* 80077C60 00074BC0 4B FB 4C BD */ bl "Render__9CAnimDataCFRC13CSkinnedModelRC11CModelFlagsRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 80077C64 00074BC4 38 61 00 10 */ addi r3, r1, 0x10 /* 80077C68 00074BC8 38 80 FF FF */ li r4, -1 -/* 80077C6C 00074BCC 48 00 00 21 */ bl sub_80077c8c +/* 80077C6C 00074BCC 48 00 00 21 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" lbl_80077C70: /* 80077C70 00074BD0 80 01 00 74 */ lwz r0, 0x74(r1) /* 80077C74 00074BD4 83 E1 00 6C */ lwz r31, 0x6c(r1) @@ -1218,8 +1218,8 @@ lbl_80077C70: /* 80077C84 00074BE4 38 21 00 70 */ addi r1, r1, 0x70 /* 80077C88 00074BE8 4E 80 00 20 */ blr -.global sub_80077c8c -sub_80077c8c: +.global "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" +"__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv": /* 80077C8C 00074BEC 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80077C90 00074BF0 7C 08 02 A6 */ mflr r0 /* 80077C94 00074BF4 90 01 00 14 */ stw r0, 0x14(r1) diff --git a/asm/MetroidPrime/Enemies/CSnakeWeedSwarm.s b/asm/MetroidPrime/Enemies/CSnakeWeedSwarm.s index b92f3ea6..6f1f9b16 100644 --- a/asm/MetroidPrime/Enemies/CSnakeWeedSwarm.s +++ b/asm/MetroidPrime/Enemies/CSnakeWeedSwarm.s @@ -1377,7 +1377,7 @@ sub_8023c688: /* 8023C714 00239674 48 11 65 E5 */ bl "Calculate__13CSkinnedModelFRC17CPoseAsTransformsRCQ24rstl37optional_object<18CVertexMorphEffect>PCfPf" /* 8023C718 00239678 38 61 00 AC */ addi r3, r1, 0xac /* 8023C71C 0023967C 38 80 FF FF */ li r4, -1 -/* 8023C720 00239680 4B E3 B5 6D */ bl sub_80077c8c +/* 8023C720 00239680 4B E3 B5 6D */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" lbl_8023C724: /* 8023C724 00239684 7F 03 C3 78 */ mr r3, r24 /* 8023C728 00239688 48 00 1C 5D */ bl sub_8023e384 diff --git a/asm/MetroidPrime/Enemies/CWallCrawlerSwarm.s b/asm/MetroidPrime/Enemies/CWallCrawlerSwarm.s index ce5c7293..29c5f308 100644 --- a/asm/MetroidPrime/Enemies/CWallCrawlerSwarm.s +++ b/asm/MetroidPrime/Enemies/CWallCrawlerSwarm.s @@ -2633,7 +2633,7 @@ lbl_801E98C4: /* 801E9924 001E6884 48 16 93 D5 */ bl "Calculate__13CSkinnedModelFRC17CPoseAsTransformsRCQ24rstl37optional_object<18CVertexMorphEffect>PCfPf" /* 801E9928 001E6888 38 61 00 88 */ addi r3, r1, 0x88 /* 801E992C 001E688C 38 80 FF FF */ li r4, -1 -/* 801E9930 001E6890 4B E8 E3 5D */ bl sub_80077c8c +/* 801E9930 001E6890 4B E8 E3 5D */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" lbl_801E9934: /* 801E9934 001E6894 80 6D A0 68 */ lwz r3, gpRender@sda21(r13) /* 801E9938 001E6898 38 97 00 40 */ addi r4, r23, 0x40 @@ -2716,7 +2716,7 @@ lbl_801E9934: /* 801E9A6C 001E69CC 4B E4 2E B1 */ bl "Render__9CAnimDataCFRC13CSkinnedModelRC11CModelFlagsRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 801E9A70 001E69D0 38 61 00 3C */ addi r3, r1, 0x3c /* 801E9A74 001E69D4 38 80 FF FF */ li r4, -1 -/* 801E9A78 001E69D8 4B E8 E2 15 */ bl sub_80077c8c +/* 801E9A78 001E69D8 4B E8 E2 15 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" /* 801E9A7C 001E69DC 48 00 00 B4 */ b lbl_801E9B30 lbl_801E9A80: /* 801E9A80 001E69E0 57 20 06 3F */ clrlwi. r0, r25, 0x18 diff --git a/asm/MetroidPrime/Player/CGrappleArm.s b/asm/MetroidPrime/Player/CGrappleArm.s index 151ecd6e..fd63a8f7 100644 --- a/asm/MetroidPrime/Player/CGrappleArm.s +++ b/asm/MetroidPrime/Player/CGrappleArm.s @@ -271,7 +271,7 @@ RenderXRayModel__11CGrappleArmFRC13CStateManagerRC12CTransform4fRC11CModelFlags: /* 8011D5FC 0011A55C 4B F0 F3 21 */ bl "Render__9CAnimDataCFRC13CSkinnedModelRC11CModelFlagsRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 8011D600 0011A560 38 61 00 A4 */ addi r3, r1, 0xa4 /* 8011D604 0011A564 38 80 FF FF */ li r4, -1 -/* 8011D608 0011A568 4B F5 A6 85 */ bl sub_80077c8c +/* 8011D608 0011A568 4B F5 A6 85 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" /* 8011D60C 0011A56C 48 22 C9 A1 */ bl White__6CColorFv /* 8011D610 0011A570 7C 64 1B 78 */ mr r4, r3 /* 8011D614 0011A574 80 6D A0 68 */ lwz r3, gpRender@sda21(r13) @@ -535,7 +535,7 @@ lbl_8011D95C: /* 8011D99C 0011A8FC 4B FF 91 B9 */ bl __ct__10CModelDataFRC8CAnimRes /* 8011D9A0 0011A900 38 7F 00 50 */ addi r3, r31, 0x50 /* 8011D9A4 0011A904 38 81 00 24 */ addi r4, r1, 0x24 -/* 8011D9A8 0011A908 4B FC 04 D1 */ bl sub_800dde78 +/* 8011D9A8 0011A908 4B FC 04 D1 */ bl "__as__Q24rstl29optional_object<10CModelData>FRC10CModelData" /* 8011D9AC 0011A90C 38 61 00 24 */ addi r3, r1, 0x24 /* 8011D9B0 0011A910 38 80 FF FF */ li r4, -1 /* 8011D9B4 0011A914 4B FF 90 99 */ bl __dt__10CModelDataFv @@ -583,7 +583,7 @@ LoadSuitPoll__11CGrappleArmFv: /* 8011DA50 0011A9B0 4B FF 91 05 */ bl __ct__10CModelDataFRC8CAnimRes /* 8011DA54 0011A9B4 7F E3 FB 78 */ mr r3, r31 /* 8011DA58 0011A9B8 38 81 00 24 */ addi r4, r1, 0x24 -/* 8011DA5C 0011A9BC 4B FC 04 1D */ bl sub_800dde78 +/* 8011DA5C 0011A9BC 4B FC 04 1D */ bl "__as__Q24rstl29optional_object<10CModelData>FRC10CModelData" /* 8011DA60 0011A9C0 38 61 00 24 */ addi r3, r1, 0x24 /* 8011DA64 0011A9C4 38 80 FF FF */ li r4, -1 /* 8011DA68 0011A9C8 4B FF 8F E5 */ bl __dt__10CModelDataFv @@ -710,7 +710,7 @@ AsyncLoadSuit__11CGrappleArmFR13CStateManager: /* 8011DC10 0011AB70 7F C3 F3 78 */ mr r3, r30 /* 8011DC14 0011AB74 98 01 00 74 */ stb r0, 0x74(r1) /* 8011DC18 0011AB78 38 81 00 28 */ addi r4, r1, 0x28 -/* 8011DC1C 0011AB7C 48 00 01 31 */ bl sub_8011dd4c +/* 8011DC1C 0011AB7C 48 00 01 31 */ bl "__as__Q24rstl29optional_object<10CModelData>FRCQ24rstl29optional_object<10CModelData>" /* 8011DC20 0011AB80 88 01 00 74 */ lbz r0, 0x74(r1) /* 8011DC24 0011AB84 28 00 00 00 */ cmplwi r0, 0 /* 8011DC28 0011AB88 41 82 00 10 */ beq lbl_8011DC38 @@ -795,8 +795,8 @@ lbl_8011DD2C: /* 8011DD44 0011ACA4 38 21 00 90 */ addi r1, r1, 0x90 /* 8011DD48 0011ACA8 4E 80 00 20 */ blr -.global sub_8011dd4c -sub_8011dd4c: +.global "__as__Q24rstl29optional_object<10CModelData>FRCQ24rstl29optional_object<10CModelData>" +"__as__Q24rstl29optional_object<10CModelData>FRCQ24rstl29optional_object<10CModelData>": /* 8011DD4C 0011ACAC 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8011DD50 0011ACB0 7C 08 02 A6 */ mflr r0 /* 8011DD54 0011ACB4 90 01 00 14 */ stw r0, 0x14(r1) @@ -944,7 +944,7 @@ ReturnToDefault__11CGrappleArmFR13CStateManagerf: /* 8011DF34 0011AE94 54 00 F7 FF */ rlwinm. r0, r0, 0x1e, 0x1f, 0x1f /* 8011DF38 0011AE98 40 82 00 0C */ bne lbl_8011DF44 /* 8011DF3C 0011AE9C 80 63 03 28 */ lwz r3, 0x328(r3) -/* 8011DF40 0011AEA0 48 0A E3 B9 */ bl ReturnToDefault__14CGunControllerFR13CStateManagerf +/* 8011DF40 0011AEA0 48 0A E3 B9 */ bl ReturnToDefault__14CGunControllerFR13CStateManagerfb lbl_8011DF44: /* 8011DF44 0011AEA4 80 01 00 14 */ lwz r0, 0x14(r1) /* 8011DF48 0011AEA8 7C 08 03 A6 */ mtlr r0 @@ -1048,7 +1048,7 @@ LoadAnimations__11CGrappleArmFv: /* 8011E094 0011AFF4 7F E3 FB 78 */ mr r3, r31 /* 8011E098 0011AFF8 98 01 00 54 */ stb r0, 0x54(r1) /* 8011E09C 0011AFFC 38 81 00 08 */ addi r4, r1, 8 -/* 8011E0A0 0011B000 4B FF FC AD */ bl sub_8011dd4c +/* 8011E0A0 0011B000 4B FF FC AD */ bl "__as__Q24rstl29optional_object<10CModelData>FRCQ24rstl29optional_object<10CModelData>" /* 8011E0A4 0011B004 88 01 00 54 */ lbz r0, 0x54(r1) /* 8011E0A8 0011B008 28 00 00 00 */ cmplwi r0, 0 /* 8011E0AC 0011B00C 41 82 00 10 */ beq lbl_8011E0BC @@ -2083,7 +2083,7 @@ lbl_8011EF44: /* 8011EF54 0011BEB4 38 7E 00 50 */ addi r3, r30, 0x50 /* 8011EF58 0011BEB8 98 01 01 34 */ stb r0, 0x134(r1) /* 8011EF5C 0011BEBC 38 81 00 E8 */ addi r4, r1, 0xe8 -/* 8011EF60 0011BEC0 4B FF ED ED */ bl sub_8011dd4c +/* 8011EF60 0011BEC0 4B FF ED ED */ bl "__as__Q24rstl29optional_object<10CModelData>FRCQ24rstl29optional_object<10CModelData>" /* 8011EF64 0011BEC4 88 01 01 34 */ lbz r0, 0x134(r1) /* 8011EF68 0011BEC8 28 00 00 00 */ cmplwi r0, 0 /* 8011EF6C 0011BECC 41 82 00 10 */ beq lbl_8011EF7C @@ -2638,7 +2638,7 @@ lbl_8011F728: /* 8011F73C 0011C69C 41 82 00 10 */ beq lbl_8011F74C /* 8011F740 0011C6A0 3C 80 80 12 */ lis r4, PointGenerator__11CGrappleArmFPvPC9CVector3fPC9CVector3fi@ha /* 8011F744 0011C6A4 38 84 D5 0C */ addi r4, r4, PointGenerator__11CGrappleArmFPvPC9CVector3fPC9CVector3fi@l -/* 8011F748 0011C6A8 48 23 2F CD */ bl SetPointGeneratorFunc__13CSkinnedModelFUiPFUiPC9CVector3fPC9CVector3fi_v +/* 8011F748 0011C6A8 48 23 2F CD */ bl SetPointGeneratorFunc__13CSkinnedModelFPvPFPvPC9CVector3fPC9CVector3fi_v lbl_8011F74C: /* 8011F74C 0011C6AC 7F 83 E3 78 */ mr r3, r28 /* 8011F750 0011C6B0 7F A4 EB 78 */ mr r4, r29 diff --git a/asm/MetroidPrime/Player/CMorphBall.s b/asm/MetroidPrime/Player/CMorphBall.s index b0116710..3de3c9ba 100644 --- a/asm/MetroidPrime/Player/CMorphBall.s +++ b/asm/MetroidPrime/Player/CMorphBall.s @@ -5681,7 +5681,7 @@ lbl_800F1C54: /* 800F1CE4 000EEC44 38 E1 00 18 */ addi r7, r1, 0x18 /* 800F1CE8 000EEC48 38 80 00 00 */ li r4, 0 /* 800F1CEC 000EEC4C 38 C0 00 00 */ li r6, 0 -/* 800F1CF0 000EEC50 48 02 42 D5 */ bl FlatDraw__10CModelDataF11EWhichModelRC12CTransform4fbRC11CModelFlags +/* 800F1CF0 000EEC50 48 02 42 D5 */ bl FlatDraw__10CModelDataCF11EWhichModelRC12CTransform4fbRC11CModelFlags /* 800F1CF4 000EEC54 3B FF 00 01 */ addi r31, r31, 1 /* 800F1CF8 000EEC58 2C 1F 00 05 */ cmpwi r31, 5 /* 800F1CFC 000EEC5C 41 80 FF 58 */ blt lbl_800F1C54 @@ -6250,7 +6250,7 @@ lbl_800F2500: /* 800F2514 000EF474 41 82 00 10 */ beq lbl_800F2524 /* 800F2518 000EF478 3C 80 80 0F */ lis r4, PointGenerator__10CMorphBallFPvPC9CVector3fPC9CVector3fi@ha /* 800F251C 000EF47C 38 84 E7 88 */ addi r4, r4, PointGenerator__10CMorphBallFPvPC9CVector3fPC9CVector3fi@l -/* 800F2520 000EF480 48 26 01 F5 */ bl SetPointGeneratorFunc__13CSkinnedModelFUiPFUiPC9CVector3fPC9CVector3fi_v +/* 800F2520 000EF480 48 26 01 F5 */ bl SetPointGeneratorFunc__13CSkinnedModelFPvPFPvPC9CVector3fPC9CVector3fi_v lbl_800F2524: /* 800F2524 000EF484 C0 22 91 5C */ lfs f1, lbl_805AAE7C@sda21(r2) /* 800F2528 000EF488 C0 1D 1C 34 */ lfs f0, 0x1c34(r29) diff --git a/asm/MetroidPrime/ScriptObjects/CFishCloud.s b/asm/MetroidPrime/ScriptObjects/CFishCloud.s index 7951d7f1..f2ad4387 100644 --- a/asm/MetroidPrime/ScriptObjects/CFishCloud.s +++ b/asm/MetroidPrime/ScriptObjects/CFishCloud.s @@ -2216,7 +2216,7 @@ sub_801cff50: /* 801CFFDC 001CCF3C 48 18 2D 1D */ bl "Calculate__13CSkinnedModelFRC17CPoseAsTransformsRCQ24rstl37optional_object<18CVertexMorphEffect>PCfPf" /* 801CFFE0 001CCF40 38 61 00 5C */ addi r3, r1, 0x5c /* 801CFFE4 001CCF44 38 80 FF FF */ li r4, -1 -/* 801CFFE8 001CCF48 4B EA 7C A5 */ bl sub_80077c8c +/* 801CFFE8 001CCF48 4B EA 7C A5 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" lbl_801CFFEC: /* 801CFFEC 001CCF4C C0 38 00 04 */ lfs f1, 4(r24) /* 801CFFF0 001CCF50 3C 60 80 5A */ lis r3, sUpVector__9CVector3f@ha diff --git a/asm/MetroidPrime/ScriptObjects/CScriptGunTurret.s b/asm/MetroidPrime/ScriptObjects/CScriptGunTurret.s index 5dcf5a2f..49584922 100644 --- a/asm/MetroidPrime/ScriptObjects/CScriptGunTurret.s +++ b/asm/MetroidPrime/ScriptObjects/CScriptGunTurret.s @@ -5429,7 +5429,7 @@ lbl_8021A3FC: /* 8021A458 002173B8 4B EC DE 41 */ bl sub_800e8298 /* 8021A45C 002173BC 38 7E 04 A4 */ addi r3, r30, 0x4a4 /* 8021A460 002173C0 38 81 00 B4 */ addi r4, r1, 0xb4 -/* 8021A464 002173C4 4B F0 38 E9 */ bl sub_8011dd4c +/* 8021A464 002173C4 4B F0 38 E9 */ bl "__as__Q24rstl29optional_object<10CModelData>FRCQ24rstl29optional_object<10CModelData>" /* 8021A468 002173C8 88 01 01 00 */ lbz r0, 0x100(r1) /* 8021A46C 002173CC 28 00 00 00 */ cmplwi r0, 0 /* 8021A470 002173D0 41 82 00 10 */ beq lbl_8021A480 diff --git a/asm/MetroidPrime/Weapons/CAuxWeapon.s b/asm/MetroidPrime/Weapons/CAuxWeapon.s index c0f6e634..9180b623 100644 --- a/asm/MetroidPrime/Weapons/CAuxWeapon.s +++ b/asm/MetroidPrime/Weapons/CAuxWeapon.s @@ -327,8 +327,8 @@ lbl_801B8D14: /* 801B8D24 001B5C84 38 E0 00 4A */ li r7, 0x4a /* 801B8D28 001B5C88 48 0D 1D D1 */ bl play_sfx__12NWeaponTypesFUsbbs /* 801B8D2C 001B5C8C 80 01 00 28 */ lwz r0, 0x28(r1) -/* 801B8D30 001B5C90 3C 60 80 57 */ lis r3, lbl_805719E8@ha -/* 801B8D34 001B5C94 38 83 19 E8 */ addi r4, r3, lbl_805719E8@l +/* 801B8D30 001B5C90 3C 60 80 57 */ lis r3, skChargedShotCameraShakeData__16CCameraShakeData@ha +/* 801B8D34 001B5C94 38 83 19 E8 */ addi r4, r3, skChargedShotCameraShakeData__16CCameraShakeData@l /* 801B8D38 001B5C98 38 A0 00 00 */ li r5, 0 /* 801B8D3C 001B5C9C 90 1C 00 7C */ stw r0, 0x7c(r28) /* 801B8D40 001B5CA0 80 7F 08 70 */ lwz r3, 0x870(r31) diff --git a/asm/MetroidPrime/Weapons/CGunWeapon.s b/asm/MetroidPrime/Weapons/CGunWeapon.s index f30f90c2..ec390ecd 100644 --- a/asm/MetroidPrime/Weapons/CGunWeapon.s +++ b/asm/MetroidPrime/Weapons/CGunWeapon.s @@ -3,8 +3,8 @@ .section .data .balign 8 -.global lbl_803E52B0 -lbl_803E52B0: +.global __vt__10CGunWeapon +__vt__10CGunWeapon: # ROM: 0x3E22B0 .4byte 0 .4byte 0 @@ -590,9 +590,9 @@ LoadSuitArm__10CGunWeaponFR13CStateManager: /* 801BA4BC 001B741C 41 82 00 88 */ beq lbl_801BA544 /* 801BA4C0 001B7420 7C 83 23 78 */ mr r3, r4 /* 801BA4C4 001B7424 48 0D 05 09 */ bl get_current_suit__12NWeaponTypesFRC13CStateManager -/* 801BA4C8 001B7428 3C 80 80 3D */ lis r4, lbl_803D17DC@ha +/* 801BA4C8 001B7428 3C 80 80 3D */ lis r4, skSuitArmNames@ha /* 801BA4CC 001B742C 54 60 10 3A */ slwi r0, r3, 2 -/* 801BA4D0 001B7430 38 64 17 DC */ addi r3, r4, lbl_803D17DC@l +/* 801BA4D0 001B7430 38 64 17 DC */ addi r3, r4, skSuitArmNames@l /* 801BA4D4 001B7434 7C 63 00 2E */ lwzx r3, r3, r0 /* 801BA4D8 001B7438 48 0D 0F 71 */ bl get_asset_id_from_name__12NWeaponTypesFPCc /* 801BA4DC 001B743C 90 61 00 08 */ stw r3, 8(r1) @@ -607,7 +607,7 @@ LoadSuitArm__10CGunWeaponFR13CStateManager: /* 801BA500 001B7460 4B F5 C8 5D */ bl __ct__10CModelDataFRC10CStaticRes /* 801BA504 001B7464 38 7F 00 B0 */ addi r3, r31, 0xb0 /* 801BA508 001B7468 38 81 00 18 */ addi r4, r1, 0x18 -/* 801BA50C 001B746C 4B F2 39 6D */ bl sub_800dde78 +/* 801BA50C 001B746C 4B F2 39 6D */ bl "__as__Q24rstl29optional_object<10CModelData>FRC10CModelData" /* 801BA510 001B7470 38 61 00 18 */ addi r3, r1, 0x18 /* 801BA514 001B7474 38 80 FF FF */ li r4, -1 /* 801BA518 001B7478 4B F5 C5 35 */ bl __dt__10CModelDataFv @@ -643,7 +643,7 @@ AsyncLoadSuitArm__10CGunWeaponFR13CStateManager: /* 801BA580 001B74E0 98 01 00 64 */ stb r0, 0x64(r1) /* 801BA584 001B74E4 38 7E 00 B0 */ addi r3, r30, 0xb0 /* 801BA588 001B74E8 38 81 00 18 */ addi r4, r1, 0x18 -/* 801BA58C 001B74EC 4B F6 37 C1 */ bl sub_8011dd4c +/* 801BA58C 001B74EC 4B F6 37 C1 */ bl "__as__Q24rstl29optional_object<10CModelData>FRCQ24rstl29optional_object<10CModelData>" /* 801BA590 001B74F0 88 01 00 64 */ lbz r0, 0x64(r1) /* 801BA594 001B74F4 28 00 00 00 */ cmplwi r0, 0 /* 801BA598 001B74F8 41 82 00 10 */ beq lbl_801BA5A8 @@ -652,11 +652,11 @@ AsyncLoadSuitArm__10CGunWeaponFR13CStateManager: /* 801BA5A4 001B7504 4B F5 C4 A9 */ bl __dt__10CModelDataFv lbl_801BA5A8: /* 801BA5A8 001B7508 38 00 00 00 */ li r0, 0 -/* 801BA5AC 001B750C 3C 60 80 3D */ lis r3, lbl_803D17DC@ha +/* 801BA5AC 001B750C 3C 60 80 3D */ lis r3, skSuitArmNames@ha /* 801BA5B0 001B7510 98 01 00 64 */ stb r0, 0x64(r1) /* 801BA5B4 001B7514 57 E0 10 3A */ slwi r0, r31, 2 /* 801BA5B8 001B7518 80 8D A0 64 */ lwz r4, gpSimplePool@sda21(r13) -/* 801BA5BC 001B751C 38 A3 17 DC */ addi r5, r3, lbl_803D17DC@l +/* 801BA5BC 001B751C 38 A3 17 DC */ addi r5, r3, skSuitArmNames@l /* 801BA5C0 001B7520 38 61 00 10 */ addi r3, r1, 0x10 /* 801BA5C4 001B7524 7C A5 00 2E */ lwzx r5, r5, r0 /* 801BA5C8 001B7528 81 84 00 00 */ lwz r12, 0(r4) @@ -733,10 +733,10 @@ AsyncLoadFidget__10CGunWeaponFR13CStateManagerQ28SamusGun11EFidgetTypei: BuildDependencyList__10CGunWeaponFQ212CPlayerState7EBeamId: /* 801BA6B8 001B7618 94 21 FF C0 */ stwu r1, -0x40(r1) /* 801BA6BC 001B761C 7C 08 02 A6 */ mflr r0 -/* 801BA6C0 001B7620 3C A0 80 3D */ lis r5, lbl_803D17C8@ha +/* 801BA6C0 001B7620 3C A0 80 3D */ lis r5, skDependencyNames@ha /* 801BA6C4 001B7624 90 01 00 44 */ stw r0, 0x44(r1) /* 801BA6C8 001B7628 7C 80 23 78 */ mr r0, r4 -/* 801BA6CC 001B762C 38 A5 17 C8 */ addi r5, r5, lbl_803D17C8@l +/* 801BA6CC 001B762C 38 A5 17 C8 */ addi r5, r5, skDependencyNames@l /* 801BA6D0 001B7630 93 E1 00 3C */ stw r31, 0x3c(r1) /* 801BA6D4 001B7634 93 C1 00 38 */ stw r30, 0x38(r1) /* 801BA6D8 001B7638 54 1E 10 3A */ slwi r30, r0, 2 @@ -761,8 +761,8 @@ BuildDependencyList__10CGunWeaponFQ212CPlayerState7EBeamId: /* 801BA724 001B7684 90 01 00 2C */ stw r0, 0x2c(r1) /* 801BA728 001B7688 48 18 67 19 */ bl __dt__6CTokenFv /* 801BA72C 001B768C 80 8D A0 64 */ lwz r4, gpSimplePool@sda21(r13) -/* 801BA730 001B7690 3C 60 80 3D */ lis r3, lbl_803D17B4@ha -/* 801BA734 001B7694 38 A3 17 B4 */ addi r5, r3, lbl_803D17B4@l +/* 801BA730 001B7690 3C 60 80 3D */ lis r3, skAnimDependencyNames@ha +/* 801BA734 001B7694 38 A3 17 B4 */ addi r5, r3, skAnimDependencyNames@l /* 801BA738 001B7698 38 61 00 08 */ addi r3, r1, 8 /* 801BA73C 001B769C 81 84 00 00 */ lwz r12, 0(r4) /* 801BA740 001B76A0 7C A5 F0 2E */ lwzx r5, r5, r30 @@ -790,11 +790,11 @@ BuildDependencyList__10CGunWeaponFQ212CPlayerState7EBeamId: /* 801BA798 001B76F8 7F E3 FB 78 */ mr r3, r31 /* 801BA79C 001B76FC 38 9D 01 2C */ addi r4, r29, 0x12c /* 801BA7A0 001B7700 38 A0 00 01 */ li r5, 1 -/* 801BA7A4 001B7704 48 00 00 49 */ bl "FillTokenVector__10CGunWeaponFRCQ24rstl47vector<10SObjectTag,Q24rstl17rmemory_allocator>RQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>" +/* 801BA7A4 001B7704 48 00 00 49 */ bl "FillTokenVector__10CGunWeaponFRCQ24rstl47vector<10SObjectTag,Q24rstl17rmemory_allocator>RQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b" /* 801BA7A8 001B7708 7F C3 F3 78 */ mr r3, r30 /* 801BA7AC 001B770C 38 9D 01 2C */ addi r4, r29, 0x12c /* 801BA7B0 001B7710 38 A0 00 00 */ li r5, 0 -/* 801BA7B4 001B7714 48 00 00 39 */ bl "FillTokenVector__10CGunWeaponFRCQ24rstl47vector<10SObjectTag,Q24rstl17rmemory_allocator>RQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>" +/* 801BA7B4 001B7714 48 00 00 39 */ bl "FillTokenVector__10CGunWeaponFRCQ24rstl47vector<10SObjectTag,Q24rstl17rmemory_allocator>RQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b" /* 801BA7B8 001B7718 38 61 00 18 */ addi r3, r1, 0x18 /* 801BA7BC 001B771C 38 80 00 00 */ li r4, 0 /* 801BA7C0 001B7720 48 18 66 81 */ bl __dt__6CTokenFv @@ -809,8 +809,8 @@ BuildDependencyList__10CGunWeaponFQ212CPlayerState7EBeamId: /* 801BA7E4 001B7744 38 21 00 40 */ addi r1, r1, 0x40 /* 801BA7E8 001B7748 4E 80 00 20 */ blr -.global "FillTokenVector__10CGunWeaponFRCQ24rstl47vector<10SObjectTag,Q24rstl17rmemory_allocator>RQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>" -"FillTokenVector__10CGunWeaponFRCQ24rstl47vector<10SObjectTag,Q24rstl17rmemory_allocator>RQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>": +.global "FillTokenVector__10CGunWeaponFRCQ24rstl47vector<10SObjectTag,Q24rstl17rmemory_allocator>RQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b" +"FillTokenVector__10CGunWeaponFRCQ24rstl47vector<10SObjectTag,Q24rstl17rmemory_allocator>RQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b": /* 801BA7EC 001B774C 94 21 FF D0 */ stwu r1, -0x30(r1) /* 801BA7F0 001B7750 7C 08 02 A6 */ mflr r0 /* 801BA7F4 001B7754 90 01 00 34 */ stw r0, 0x34(r1) @@ -1545,11 +1545,11 @@ AllocResPools__10CGunWeaponFQ212CPlayerState7EBeamId: /* 801BB1A8 001B8108 7C 96 23 78 */ mr r22, r4 /* 801BB1AC 001B810C 80 6D A1 48 */ lwz r3, gpTweakGunRes@sda21(r13) /* 801BB1B0 001B8110 4B F0 07 A9 */ bl GetWeaponResourcePair__12CTweakGunResCFi -/* 801BB1B4 001B8114 3C A0 80 3D */ lis r5, lbl_803D1750@ha +/* 801BB1B4 001B8114 3C A0 80 3D */ lis r5, skMuzzleNames@ha /* 801BB1B8 001B8118 3C 80 57 50 */ lis r4, 0x57505343@ha /* 801BB1BC 001B811C 56 DA 18 38 */ slwi r26, r22, 3 /* 801BB1C0 001B8120 7C 7F 1B 78 */ mr r31, r3 -/* 801BB1C4 001B8124 38 05 17 50 */ addi r0, r5, lbl_803D1750@l +/* 801BB1C4 001B8124 38 05 17 50 */ addi r0, r5, skMuzzleNames@l /* 801BB1C8 001B8128 3B 98 01 70 */ addi r28, r24, 0x170 /* 801BB1CC 001B812C 7F C0 D2 14 */ add r30, r0, r26 /* 801BB1D0 001B8130 3B 78 01 48 */ addi r27, r24, 0x148 @@ -1628,9 +1628,9 @@ lbl_801BB2BC: /* 801BB2E8 001B8248 2C 19 00 02 */ cmpwi r25, 2 /* 801BB2EC 001B824C 3B DE 00 04 */ addi r30, r30, 4 /* 801BB2F0 001B8250 41 80 FE F0 */ blt lbl_801BB1E0 -/* 801BB2F4 001B8254 3C 60 80 3D */ lis r3, lbl_803D1778@ha +/* 801BB2F4 001B8254 3C 60 80 3D */ lis r3, skFrozenNames@ha /* 801BB2F8 001B8258 3B 38 01 8C */ addi r25, r24, 0x18c -/* 801BB2FC 001B825C 38 03 17 78 */ addi r0, r3, lbl_803D1778@l +/* 801BB2FC 001B825C 38 03 17 78 */ addi r0, r3, skFrozenNames@l /* 801BB300 001B8260 3B 60 00 00 */ li r27, 0 /* 801BB304 001B8264 7E E0 D2 14 */ add r23, r0, r26 lbl_801BB308: @@ -1695,7 +1695,7 @@ Unload__10CGunWeaponFR13CStateManager: /* 801BB3D4 001B8334 38 81 00 A8 */ addi r4, r1, 0xa8 /* 801BB3D8 001B8338 90 1F 02 04 */ stw r0, 0x204(r31) /* 801BB3DC 001B833C 98 01 00 F4 */ stb r0, 0xf4(r1) -/* 801BB3E0 001B8340 4B F6 29 6D */ bl sub_8011dd4c +/* 801BB3E0 001B8340 4B F6 29 6D */ bl "__as__Q24rstl29optional_object<10CModelData>FRCQ24rstl29optional_object<10CModelData>" /* 801BB3E4 001B8344 88 01 00 F4 */ lbz r0, 0xf4(r1) /* 801BB3E8 001B8348 28 00 00 00 */ cmplwi r0, 0 /* 801BB3EC 001B834C 41 82 00 10 */ beq lbl_801BB3FC @@ -1708,7 +1708,7 @@ lbl_801BB3FC: /* 801BB404 001B8364 98 01 00 F4 */ stb r0, 0xf4(r1) /* 801BB408 001B8368 38 81 00 58 */ addi r4, r1, 0x58 /* 801BB40C 001B836C 98 01 00 A4 */ stb r0, 0xa4(r1) -/* 801BB410 001B8370 4B F6 29 3D */ bl sub_8011dd4c +/* 801BB410 001B8370 4B F6 29 3D */ bl "__as__Q24rstl29optional_object<10CModelData>FRCQ24rstl29optional_object<10CModelData>" /* 801BB414 001B8374 88 01 00 A4 */ lbz r0, 0xa4(r1) /* 801BB418 001B8378 28 00 00 00 */ cmplwi r0, 0 /* 801BB41C 001B837C 41 82 00 10 */ beq lbl_801BB42C @@ -1721,7 +1721,7 @@ lbl_801BB42C: /* 801BB434 001B8394 98 01 00 A4 */ stb r0, 0xa4(r1) /* 801BB438 001B8398 38 81 00 08 */ addi r4, r1, 8 /* 801BB43C 001B839C 98 01 00 54 */ stb r0, 0x54(r1) -/* 801BB440 001B83A0 4B F6 29 0D */ bl sub_8011dd4c +/* 801BB440 001B83A0 4B F6 29 0D */ bl "__as__Q24rstl29optional_object<10CModelData>FRCQ24rstl29optional_object<10CModelData>" /* 801BB444 001B83A4 88 01 00 54 */ lbz r0, 0x54(r1) /* 801BB448 001B83A8 28 00 00 00 */ cmplwi r0, 0 /* 801BB44C 001B83AC 41 82 00 10 */ beq lbl_801BB45C @@ -2030,7 +2030,7 @@ ReturnToDefault__10CGunWeaponFR13CStateManager: /* 801BB868 001B87C8 38 A0 00 00 */ li r5, 0 /* 801BB86C 001B87CC 90 01 00 14 */ stw r0, 0x14(r1) /* 801BB870 001B87D0 80 63 01 00 */ lwz r3, 0x100(r3) -/* 801BB874 001B87D4 48 01 0A 85 */ bl ReturnToDefault__14CGunControllerFR13CStateManagerf +/* 801BB874 001B87D4 48 01 0A 85 */ bl ReturnToDefault__14CGunControllerFR13CStateManagerfb /* 801BB878 001B87D8 80 01 00 14 */ lwz r0, 0x14(r1) /* 801BB87C 001B87DC 7C 08 03 A6 */ mtlr r0 /* 801BB880 001B87E0 38 21 00 10 */ addi r1, r1, 0x10 @@ -2219,8 +2219,8 @@ lbl_801BBB08: /* 801BBB18 001B8A78 50 60 36 72 */ rlwimi r0, r3, 6, 0x19, 0x19 /* 801BBB1C 001B8A7C 38 A0 00 00 */ li r5, 0 /* 801BBB20 001B8A80 98 17 02 18 */ stb r0, 0x218(r23) -/* 801BBB24 001B8A84 3C 60 80 57 */ lis r3, lbl_805719E8@ha -/* 801BBB28 001B8A88 38 83 19 E8 */ addi r4, r3, lbl_805719E8@l +/* 801BBB24 001B8A84 3C 60 80 57 */ lis r3, skChargedShotCameraShakeData__16CCameraShakeData@ha +/* 801BBB28 001B8A88 38 83 19 E8 */ addi r4, r3, skChargedShotCameraShakeData__16CCameraShakeData@l /* 801BBB2C 001B8A8C 80 7B 08 70 */ lwz r3, 0x870(r27) /* 801BBB30 001B8A90 4B E4 EE F1 */ bl AddCameraShaker__14CCameraManagerFRC16CCameraShakeDatab lbl_801BBB34: @@ -2281,7 +2281,7 @@ DrawHologram__10CGunWeaponCFRC13CStateManagerRC12CTransform4fRC11CModelFlags: /* 801BBC00 001B8B60 38 7E 00 60 */ addi r3, r30, 0x60 /* 801BBC04 001B8B64 38 80 00 00 */ li r4, 0 /* 801BBC08 001B8B68 38 C0 00 00 */ li r6, 0 -/* 801BBC0C 001B8B6C 4B F5 A3 B9 */ bl FlatDraw__10CModelDataF11EWhichModelRC12CTransform4fbRC11CModelFlags +/* 801BBC0C 001B8B6C 4B F5 A3 B9 */ bl FlatDraw__10CModelDataCF11EWhichModelRC12CTransform4fbRC11CModelFlags /* 801BBC10 001B8B70 48 00 00 E0 */ b lbl_801BBCF0 lbl_801BBC14: /* 801BBC14 001B8B74 C0 5E 00 10 */ lfs f2, 0x10(r30) @@ -2330,7 +2330,7 @@ lbl_801BBC14: /* 801BBCC0 001B8C20 4B E7 0C 5D */ bl "Render__9CAnimDataCFRC13CSkinnedModelRC11CModelFlagsRCQ24rstl37optional_object<18CVertexMorphEffect>PCf" /* 801BBCC4 001B8C24 38 61 00 A4 */ addi r3, r1, 0xa4 /* 801BBCC8 001B8C28 38 80 FF FF */ li r4, -1 -/* 801BBCCC 001B8C2C 4B EB BF C1 */ bl sub_80077c8c +/* 801BBCCC 001B8C2C 4B EB BF C1 */ bl "__dt__Q24rstl37optional_object<18CVertexMorphEffect>Fv" /* 801BBCD0 001B8C30 48 18 E2 DD */ bl White__6CColorFv /* 801BBCD4 001B8C34 7C 64 1B 78 */ mr r4, r3 /* 801BBCD8 001B8C38 80 6D A0 68 */ lwz r3, gpRender@sda21(r13) @@ -2386,7 +2386,7 @@ Draw__10CGunWeaponCFbRC13CStateManagerRC12CTransform4fRC11CModelFlagsPC12CActorL /* 801BBD90 001B8CF0 41 82 00 10 */ beq lbl_801BBDA0 /* 801BBD94 001B8CF4 3C 80 80 1C */ lis r4, PointGenerator__10CGunWeaponFPvPC9CVector3fPC9CVector3fi@ha /* 801BBD98 001B8CF8 38 84 A4 7C */ addi r4, r4, PointGenerator__10CGunWeaponFPvPC9CVector3fPC9CVector3fi@l -/* 801BBD9C 001B8CFC 48 19 69 79 */ bl SetPointGeneratorFunc__13CSkinnedModelFUiPFUiPC9CVector3fPC9CVector3fi_v +/* 801BBD9C 001B8CFC 48 19 69 79 */ bl SetPointGeneratorFunc__13CSkinnedModelFPvPFPvPC9CVector3fPC9CVector3fi_v lbl_801BBDA0: /* 801BBDA0 001B8D00 80 1C 0F 34 */ lwz r0, 0xf34(r28) /* 801BBDA4 001B8D04 2C 00 00 00 */ cmpwi r0, 0 @@ -3014,11 +3014,11 @@ PlayAnim__10CGunWeaponFQ212NWeaponTypes12EGunAnimTypeb: lbl_801BC684: /* 801BC684 001B95E4 80 63 00 20 */ lwz r3, 0x20(r3) /* 801BC688 001B95E8 54 A7 06 3E */ clrlwi r7, r5, 0x18 -/* 801BC68C 001B95EC 3C A0 80 3D */ lis r5, lbl_803D17FC@ha +/* 801BC68C 001B95EC 3C A0 80 3D */ lis r5, skAnimTypeList@ha /* 801BC690 001B95F0 54 80 10 3A */ slwi r0, r4, 2 /* 801BC694 001B95F4 88 C3 02 20 */ lbz r6, 0x220(r3) /* 801BC698 001B95F8 50 E6 36 72 */ rlwimi r6, r7, 6, 0x19, 0x19 -/* 801BC69C 001B95FC 38 85 17 FC */ addi r4, r5, lbl_803D17FC@l +/* 801BC69C 001B95FC 38 85 17 FC */ addi r4, r5, skAnimTypeList@l /* 801BC6A0 001B9600 39 00 00 01 */ li r8, 1 /* 801BC6A4 001B9604 98 C3 02 20 */ stb r6, 0x220(r3) /* 801BC6A8 001B9608 38 C0 FF FF */ li r6, -1 @@ -3271,7 +3271,7 @@ lbl_801BC9DC: /* 801BCA14 001B9974 4B F5 A1 41 */ bl __ct__10CModelDataFRC8CAnimRes /* 801BCA18 001B9978 38 7F 00 10 */ addi r3, r31, 0x10 /* 801BCA1C 001B997C 38 81 00 B4 */ addi r4, r1, 0xb4 -/* 801BCA20 001B9980 4B F2 14 59 */ bl sub_800dde78 +/* 801BCA20 001B9980 4B F2 14 59 */ bl "__as__Q24rstl29optional_object<10CModelData>FRC10CModelData" /* 801BCA24 001B9984 38 61 00 B4 */ addi r3, r1, 0xb4 /* 801BCA28 001B9988 38 80 FF FF */ li r4, -1 /* 801BCA2C 001B998C 4B F5 A0 21 */ bl __dt__10CModelDataFv @@ -3293,7 +3293,7 @@ lbl_801BC9DC: /* 801BCA6C 001B99CC 4B F5 A0 E9 */ bl __ct__10CModelDataFRC8CAnimRes /* 801BCA70 001B99D0 38 7F 00 60 */ addi r3, r31, 0x60 /* 801BCA74 001B99D4 38 81 00 68 */ addi r4, r1, 0x68 -/* 801BCA78 001B99D8 4B F2 14 01 */ bl sub_800dde78 +/* 801BCA78 001B99D8 4B F2 14 01 */ bl "__as__Q24rstl29optional_object<10CModelData>FRC10CModelData" /* 801BCA7C 001B99DC 38 61 00 68 */ addi r3, r1, 0x68 /* 801BCA80 001B99E0 38 80 FF FF */ li r4, -1 /* 801BCA84 001B99E4 4B F5 9F C9 */ bl __dt__10CModelDataFv @@ -3464,12 +3464,12 @@ __dt__10CGunWeaponFv: /* 801BCCDC 001B9C3C 93 A1 00 44 */ stw r29, 0x44(r1) /* 801BCCE0 001B9C40 93 81 00 40 */ stw r28, 0x40(r1) /* 801BCCE4 001B9C44 41 82 03 54 */ beq lbl_801BD038 -/* 801BCCE8 001B9C48 3C 80 80 3E */ lis r4, lbl_803E52B0@ha +/* 801BCCE8 001B9C48 3C 80 80 3E */ lis r4, __vt__10CGunWeapon@ha /* 801BCCEC 001B9C4C 38 7E 01 D0 */ addi r3, r30, 0x1d0 -/* 801BCCF0 001B9C50 38 04 52 B0 */ addi r0, r4, lbl_803E52B0@l +/* 801BCCF0 001B9C50 38 04 52 B0 */ addi r0, r4, __vt__10CGunWeapon@l /* 801BCCF4 001B9C54 38 80 FF FF */ li r4, -1 /* 801BCCF8 001B9C58 90 1E 00 00 */ stw r0, 0(r30) -/* 801BCCFC 001B9C5C 48 00 03 61 */ bl sub_801bd05c +/* 801BCCFC 001B9C5C 48 00 03 61 */ bl __dt__13CVelocityInfoFv /* 801BCD00 001B9C60 34 1E 01 B8 */ addic. r0, r30, 0x1b8 /* 801BCD04 001B9C64 41 82 00 24 */ beq lbl_801BCD28 /* 801BCD08 001B9C68 80 7E 01 B8 */ lwz r3, 0x1b8(r30) @@ -3722,8 +3722,8 @@ lbl_801BD038: /* 801BD054 001B9FB4 38 21 00 50 */ addi r1, r1, 0x50 /* 801BD058 001B9FB8 4E 80 00 20 */ blr -.global sub_801bd05c -sub_801bd05c: +.global __dt__13CVelocityInfoFv +__dt__13CVelocityInfoFv: /* 801BD05C 001B9FBC 94 21 FF F0 */ stwu r1, -0x10(r1) /* 801BD060 001B9FC0 7C 08 02 A6 */ mflr r0 /* 801BD064 001B9FC4 90 01 00 14 */ stw r0, 0x14(r1) @@ -3830,9 +3830,9 @@ lbl_801BD198: __ct__10CGunWeaponFUi11EWeaponType9TUniqueId14EMaterialTypesRC9CVector3f: /* 801BD1B0 001BA110 94 21 FF C0 */ stwu r1, -0x40(r1) /* 801BD1B4 001BA114 7C 08 02 A6 */ mflr r0 -/* 801BD1B8 001BA118 3D 20 80 3E */ lis r9, lbl_803E52B0@ha +/* 801BD1B8 001BA118 3D 20 80 3E */ lis r9, __vt__10CGunWeapon@ha /* 801BD1BC 001BA11C 90 01 00 44 */ stw r0, 0x44(r1) -/* 801BD1C0 001BA120 38 09 52 B0 */ addi r0, r9, lbl_803E52B0@l +/* 801BD1C0 001BA120 38 09 52 B0 */ addi r0, r9, __vt__10CGunWeapon@l /* 801BD1C4 001BA124 39 20 00 00 */ li r9, 0 /* 801BD1C8 001BA128 BF 41 00 28 */ stmw r26, 0x28(r1) /* 801BD1CC 001BA12C 7C 7E 1B 78 */ mr r30, r3 @@ -3869,9 +3869,9 @@ __ct__10CGunWeaponFUi11EWeaponType9TUniqueId14EMaterialTypesRC9CVector3f: /* 801BD248 001BA1A8 38 80 FF FF */ li r4, -1 /* 801BD24C 001BA1AC 48 18 3B F5 */ bl __dt__6CTokenFv /* 801BD250 001BA1B0 38 00 00 00 */ li r0, 0 -/* 801BD254 001BA1B4 3C 60 80 3D */ lis r3, lbl_803D17DC@ha +/* 801BD254 001BA1B4 3C 60 80 3D */ lis r3, skSuitArmNames@ha /* 801BD258 001BA1B8 90 1E 01 10 */ stw r0, 0x110(r30) -/* 801BD25C 001BA1BC 38 83 17 DC */ addi r4, r3, lbl_803D17DC@l +/* 801BD25C 001BA1BC 38 83 17 DC */ addi r4, r3, skSuitArmNames@l /* 801BD260 001BA1C0 38 61 00 10 */ addi r3, r1, 0x10 /* 801BD264 001BA1C4 80 A4 00 00 */ lwz r5, 0(r4) /* 801BD268 001BA1C8 90 1E 01 14 */ stw r0, 0x114(r30) @@ -4057,8 +4057,8 @@ lbl_805AC710: .section .rodata .balign 8 -.global lbl_803D1750 -lbl_803D1750: +.global skMuzzleNames +skMuzzleNames: # ROM: 0x3CE750 .4byte lbl_803D1828 .4byte lbl_803D1834 @@ -4071,8 +4071,8 @@ lbl_803D1750: .4byte lbl_803D1879 .4byte lbl_803D1886 -.global lbl_803D1778 -lbl_803D1778: +.global skFrozenNames +skFrozenNames: # ROM: 0x3CE778 .4byte lbl_803D1892 .4byte lbl_803D189E @@ -4094,8 +4094,8 @@ lbl_803D17A0: .4byte lbl_803D18E4 .4byte lbl_803D18EF -.global lbl_803D17B4 -lbl_803D17B4: +.global skAnimDependencyNames +skAnimDependencyNames: # ROM: 0x3CE7B4 .4byte lbl_803D18FA .4byte lbl_803D190A @@ -4103,8 +4103,8 @@ lbl_803D17B4: .4byte lbl_803D1927 .4byte lbl_803D1938 -.global lbl_803D17C8 -lbl_803D17C8: +.global skDependencyNames +skDependencyNames: # ROM: 0x3CE7C8 .4byte lbl_803D1949 .4byte lbl_803D1954 @@ -4112,8 +4112,8 @@ lbl_803D17C8: .4byte lbl_803D1967 .4byte lbl_803D1973 -.global lbl_803D17DC -lbl_803D17DC: +.global skSuitArmNames +skSuitArmNames: # ROM: 0x3CE7DC .4byte lbl_803D197F .4byte lbl_803D1988 @@ -4124,8 +4124,8 @@ lbl_803D17DC: .4byte lbl_803D19BB .4byte lbl_803D19C6 -.global lbl_803D17FC -lbl_803D17FC: +.global skAnimTypeList +skAnimTypeList: # ROM: 0x3CE7FC .4byte 0 .4byte 0x00000004 diff --git a/asm/MetroidPrime/Weapons/GunController/CGunController.s b/asm/MetroidPrime/Weapons/GunController/CGunController.s index fb7eb52d..b0921d58 100644 --- a/asm/MetroidPrime/Weapons/GunController/CGunController.s +++ b/asm/MetroidPrime/Weapons/GunController/CGunController.s @@ -143,8 +143,8 @@ Reset__14CGunControllerFv: /* 801CC2F0 001C9250 90 83 00 50 */ stw r4, 0x50(r3) /* 801CC2F4 001C9254 4E 80 00 20 */ blr -.global ReturnToDefault__14CGunControllerFR13CStateManagerf -ReturnToDefault__14CGunControllerFR13CStateManagerf: +.global ReturnToDefault__14CGunControllerFR13CStateManagerfb +ReturnToDefault__14CGunControllerFR13CStateManagerfb: /* 801CC2F8 001C9258 94 21 FF F0 */ stwu r1, -0x10(r1) /* 801CC2FC 001C925C 7C 08 02 A6 */ mflr r0 /* 801CC300 001C9260 7C 88 23 78 */ mr r8, r4 diff --git a/asm/MetroidPrime/Weapons/GunController/CGunMotion.s b/asm/MetroidPrime/Weapons/GunController/CGunMotion.s index 3aa37adc..016394dd 100644 --- a/asm/MetroidPrime/Weapons/GunController/CGunMotion.s +++ b/asm/MetroidPrime/Weapons/GunController/CGunMotion.s @@ -89,7 +89,7 @@ ReturnToDefault__10CGunMotionFR13CStateManager: /* 801D9088 001D5FE8 C0 22 AC 9C */ lfs f1, lbl_805AC9BC@sda21(r2) /* 801D908C 001D5FEC 38 63 00 4C */ addi r3, r3, 0x4c /* 801D9090 001D5FF0 90 01 00 14 */ stw r0, 0x14(r1) -/* 801D9094 001D5FF4 4B FF 32 65 */ bl ReturnToDefault__14CGunControllerFR13CStateManagerf +/* 801D9094 001D5FF4 4B FF 32 65 */ bl ReturnToDefault__14CGunControllerFR13CStateManagerfb /* 801D9098 001D5FF8 80 01 00 14 */ lwz r0, 0x14(r1) /* 801D909C 001D5FFC 7C 08 03 A6 */ mtlr r0 /* 801D90A0 001D6000 38 21 00 10 */ addi r1, r1, 0x10 diff --git a/include/Kyoto/Animation/CSkinnedModel.hpp b/include/Kyoto/Animation/CSkinnedModel.hpp index a6aa7786..0eaac826 100644 --- a/include/Kyoto/Animation/CSkinnedModel.hpp +++ b/include/Kyoto/Animation/CSkinnedModel.hpp @@ -3,12 +3,33 @@ #include "types.h" +#include "Kyoto/TToken.hpp" + +#include "rstl/auto_ptr.hpp" + +class CModel; +class CSkinRules; +class CCharLayoutInfo; + class CSkinnedModel { public: + virtual ~CSkinnedModel(); + static void ClearPointGeneratorFunc(); + TLockedToken< CModel >& Model() { return x4_model; } + const TLockedToken< CModel >& GetModel() const { return x4_model; } + + static void SetPointGeneratorFunc(void*, void (*)(void*, const CVector3f*, const CVector3f*, int)); + private: - // TODO + TLockedToken< CModel > x4_model; + TLockedToken< CSkinRules > x10_skinRules; + TLockedToken< CCharLayoutInfo > x1c_layoutInfo; + rstl::auto_ptr< float[] > x24_vertWorkspace; + rstl::auto_ptr< float[] > x2c_normalWorkspace; + bool x34_owned; + bool x35_disableWorkspaces; }; #endif // _CSKINNEDMODEL diff --git a/include/Kyoto/CObjectReference.hpp b/include/Kyoto/CObjectReference.hpp index 5190d8d3..16365077 100644 --- a/include/Kyoto/CObjectReference.hpp +++ b/include/Kyoto/CObjectReference.hpp @@ -27,6 +27,7 @@ public: void Lock(); void Unlock(); IObj* GetObject(); + const SObjectTag& GetTag() const { return x4_objTag; } private: short x0_refCount; diff --git a/include/Kyoto/CToken.hpp b/include/Kyoto/CToken.hpp index 6ac6699a..3784c3d5 100644 --- a/include/Kyoto/CToken.hpp +++ b/include/Kyoto/CToken.hpp @@ -16,15 +16,15 @@ public: CToken(const CToken& other); ~CToken(); - CObjOwnerDerivedFromIObjUntyped* GetObj(); void Lock(); void Unlock(); bool IsLoaded() const { return x0_objRef->IsLoaded(); } void RemoveRef(); CToken& operator=(const CToken&); + bool HasReference() const { return x0_objRef != nullptr; } + FourCC GetReferenceType() { return x0_objRef->GetTag().type; } -protected: bool HasLock() { return x4_lockHeld; } private: diff --git a/include/Kyoto/Graphics/CModel.hpp b/include/Kyoto/Graphics/CModel.hpp index bf9d4a7b..b2a09173 100644 --- a/include/Kyoto/Graphics/CModel.hpp +++ b/include/Kyoto/Graphics/CModel.hpp @@ -7,6 +7,7 @@ class CModel { public: void Touch(int) const; void Draw(const CModelFlags&) const; + bool IsLoaded(int matIdx) const; }; #endif // _CMODEL diff --git a/include/Kyoto/Particles/CVectorElement.hpp b/include/Kyoto/Particles/CVectorElement.hpp index 77b4f92e..0145bd99 100644 --- a/include/Kyoto/Particles/CVectorElement.hpp +++ b/include/Kyoto/Particles/CVectorElement.hpp @@ -22,19 +22,19 @@ private: class CVEParticleLocation : public CVectorElement { public: ~CVEParticleLocation() override {} - bool GetValue(int frame, CVector3f& valOut) const; + bool GetValue(int frame, CVector3f& valOut) const override; }; class CVEParticleColor : public CVectorElement { public: ~CVEParticleColor() override {} - bool GetValue(int frame, CVector3f& valOut) const; + bool GetValue(int frame, CVector3f& valOut) const override; }; class CVEParticleVelocity : public CVectorElement { public: ~CVEParticleVelocity() override {} - bool GetValue(int frame, CVector3f& valOut) const; + bool GetValue(int frame, CVector3f& valOut) const override; }; class CVEParticleSystemOrientationFront : public CVectorElement { diff --git a/include/MetaRender/CCubeRenderer.hpp b/include/MetaRender/CCubeRenderer.hpp index a1455845..373dbe5f 100644 --- a/include/MetaRender/CCubeRenderer.hpp +++ b/include/MetaRender/CCubeRenderer.hpp @@ -54,42 +54,43 @@ public: void SetBlendMode_ColorMultiply() override; void SetBlendMode_InvertDst() override; void SetBlendMode_InvertSrc() override; + void SetBlendMode_Replace() override; void SetBlendMode_AdditiveDestColor() override; - virtual void SetDebugOption(); - virtual void BeginScene(); - virtual void EndScene(); - virtual void BeginPrimitive(GXPrimitive prim, int count); - virtual void BeginLines(int nverts); - virtual void BeginLineStrip(int nverts); - virtual void BeginTriangles(int nverts); - virtual void BeginTriangleStrip(int nverts); - virtual void BeginTriangleFan(int nverts); - virtual void PrimVertex(const CVector3f& vtx); - virtual void PrimNormal(const CVector3f& nrm); - virtual void PrimColor(float r, float g, float b, float a); - virtual void PrimColor(const CColor& color); - virtual void EndPrimitive(); - virtual void SetAmbientColor(const CColor& color); - virtual void DrawString(); - virtual void GetFPS(); - virtual void CacheReflection(); - virtual void DrawSpaceWarp(); - virtual void DrawThermalModel(); - virtual void DrawModelDisintegrate(); - virtual void DrawModelFlat(); - virtual void SetWireframeFlags(); - virtual void SetWorldFog(); - virtual void RenderFogVolume(const CColor&, const CAABox&, const TLockedToken< CModel >*, - const CSkinnedModel*); - virtual void SetThermal(); - virtual void SetThermalColdScale(); - virtual void DoThermalBlendCold(); - virtual void DoThermalBlendHot(); - virtual void GetStaticWorldDataSize(); - virtual void SetGXRegister1Color(); - virtual void SetWorldLightFadeLevel(); - virtual void Something(); - virtual void PrepareDynamicLights(); + void SetDebugOption() override; + void BeginScene() override; + void EndScene() override; + void BeginPrimitive(GXPrimitive prim, int count) override; + void BeginLines(int nverts) override; + void BeginLineStrip(int nverts) override; + void BeginTriangles(int nverts) override; + void BeginTriangleStrip(int nverts) override; + void BeginTriangleFan(int nverts) override; + void PrimVertex(const CVector3f& vtx) override; + void PrimNormal(const CVector3f& nrm) override; + void PrimColor(float r, float g, float b, float a) override; + void PrimColor(const CColor& color) override; + void EndPrimitive() override; + void SetAmbientColor(const CColor& color) override; + void DrawString() override; + void GetFPS() override; + void CacheReflection() override; + void DrawSpaceWarp() override; + void DrawThermalModel() override; + void DrawModelDisintegrate() override; + void DrawModelFlat() override; + void SetWireframeFlags() override; + void SetWorldFog() override; + void RenderFogVolume(const CColor&, const CAABox&, const TLockedToken< CModel >*, + const CSkinnedModel*) override; + void SetThermal() override; + void SetThermalColdScale() override; + void DoThermalBlendCold() override; + void DoThermalBlendHot() override; + void GetStaticWorldDataSize() override; + void SetGXRegister1Color() override; + void SetWorldLightFadeLevel() override; + void Something() override; + void PrepareDynamicLights() override; void AllocatePhazonSuitMaskTexture(); diff --git a/include/MetaRender/IRenderer.hpp b/include/MetaRender/IRenderer.hpp index 16a69d2d..04b3689e 100644 --- a/include/MetaRender/IRenderer.hpp +++ b/include/MetaRender/IRenderer.hpp @@ -56,7 +56,44 @@ public: virtual void SetBlendMode_ColorMultiply(); virtual void SetBlendMode_InvertDst(); virtual void SetBlendMode_InvertSrc(); + virtual void SetBlendMode_Replace(); virtual void SetBlendMode_AdditiveDestColor(); + + virtual void SetDebugOption(); + virtual void BeginScene(); + virtual void EndScene(); + virtual void BeginPrimitive(GXPrimitive prim, int count); + virtual void BeginLines(int nverts); + virtual void BeginLineStrip(int nverts); + virtual void BeginTriangles(int nverts); + virtual void BeginTriangleStrip(int nverts); + virtual void BeginTriangleFan(int nverts); + virtual void PrimVertex(const CVector3f& vtx); + virtual void PrimNormal(const CVector3f& nrm); + virtual void PrimColor(float r, float g, float b, float a); + virtual void PrimColor(const CColor& color); + virtual void EndPrimitive(); + virtual void SetAmbientColor(const CColor& color); + virtual void DrawString(); + virtual void GetFPS(); + virtual void CacheReflection(); + virtual void DrawSpaceWarp(); + virtual void DrawThermalModel(); + virtual void DrawModelDisintegrate(); + virtual void DrawModelFlat(); + virtual void SetWireframeFlags(); + virtual void SetWorldFog(); + virtual void RenderFogVolume(const CColor&, const CAABox&, const TLockedToken< CModel >*, + const CSkinnedModel*); + virtual void SetThermal(); + virtual void SetThermalColdScale(); + virtual void DoThermalBlendCold(); + virtual void DoThermalBlendHot(); + virtual void GetStaticWorldDataSize(); + virtual void SetGXRegister1Color(); + virtual void SetWorldLightFadeLevel(); + virtual void Something(); + virtual void PrepareDynamicLights(); }; namespace Renderer { diff --git a/include/MetroidPrime/CAnimData.hpp b/include/MetroidPrime/CAnimData.hpp index c1d50ee9..850b911f 100644 --- a/include/MetroidPrime/CAnimData.hpp +++ b/include/MetroidPrime/CAnimData.hpp @@ -26,9 +26,13 @@ class CCharLayoutInfo; class CSkinnedModel; class CSkinnedModelWithAvgNormals; class CTransitionManager; +class CVertexMorphEffect; +class CModelFlags; class CAnimData { public: + ~CAnimData(); + enum EAnimDir { kAD_Forward, kAD_Backward, @@ -40,6 +44,8 @@ public: x220_24_animating = true; } + const TLockedToken< CSkinnedModel >& GetModelData() const { return xd8_modelData; } + void SetIsAnimating(bool v) { x220_24_animating = v; } void SetParticleEffectState(const rstl::string& name, bool active, CStateManager& mgr); @@ -89,6 +95,7 @@ public: // PreRender__9CAnimDataFv // SetupRender__9CAnimDataCFRC13CSkinnedModelRCQ24rstl37optional_object<18CVertexMorphEffect>PCf // Render__9CAnimDataCFRC13CSkinnedModelRC11CModelFlagsRCQ24rstl37optional_object<18CVertexMorphEffect>PCf + void Render(const CSkinnedModel&, const CModelFlags&, const rstl::optional_object&, const float*) const; // RenderAuxiliary__9CAnimDataCFRC14CFrustumPlanes // RecalcPoseBuilder__9CAnimDataCFPC13CCharAnimTime float GetAnimationDuration(int animIn) const; diff --git a/include/MetroidPrime/CModelData.hpp b/include/MetroidPrime/CModelData.hpp index a7edfaf4..7c29781d 100644 --- a/include/MetroidPrime/CModelData.hpp +++ b/include/MetroidPrime/CModelData.hpp @@ -23,6 +23,7 @@ class CFrustumPlanes; class CModel; class CModelFlags; class CStateManager; +class CSkinnedModel; // TODO move #include "Kyoto/Math/CQuaternion.hpp" @@ -48,15 +49,15 @@ public: CStaticRes(CAssetId id, const CVector3f& scale) : x0_cmdlId(id), x4_scale(scale) {} }; +enum EWhichModel { + kWM_Normal, + kWM_XRay, + kWM_Thermal, + kWM_ThermalHot, +}; + class CModelData { public: - enum EWhichModel { - kWM_Normal, - kWM_XRay, - kWM_Thermal, - kWM_ThermalHot, - }; - // TODO these probably aren't real bool HasNormalModel() const { return x1c_normalModel; } @@ -75,13 +76,18 @@ public: const CModelFlags& flags) const; void Render(const CStateManager&, const CTransform4f&, const CActorLights*, const CModelFlags&) const; - void Render(CModelData::EWhichModel, const CTransform4f&, const CActorLights*, + void Render(EWhichModel, const CTransform4f&, const CActorLights*, const CModelFlags&) const; + void FlatDraw(EWhichModel which, const CTransform4f& xf, bool unsortedOnly, + const CModelFlags& flags) const; + CSkinnedModel& PickAnimatedModel(EWhichModel which) const; + void Touch(const CStateManager& mgr, int) const; const CAnimData* GetAnimationData() const { return xc_animData.get(); } CAnimData* AnimationData() { return xc_animData.get(); } CAABox GetBounds(const CTransform4f& xf) const; CAABox GetBounds() const; + bool IsLoaded(int shaderIdx) const; CTransform4f GetScaledLocatorTransform(const rstl::string& name) const; diff --git a/include/MetroidPrime/CRainSplashGenerator.hpp b/include/MetroidPrime/CRainSplashGenerator.hpp index 31540af1..7aa121cf 100644 --- a/include/MetroidPrime/CRainSplashGenerator.hpp +++ b/include/MetroidPrime/CRainSplashGenerator.hpp @@ -5,7 +5,11 @@ #include "rstl/vector.hpp" #include "types.h" +#include "Kyoto/CRandom16.hpp" +#include "Kyoto/Math/CVector3f.hpp" + class CVector3f; +class CStateManager; class CRainSplashGenerator { struct SSplashLine { @@ -39,11 +43,27 @@ public: float alpha); ~CRainSplashGenerator() {} + + bool IsRaining() const { return x48_25_raining; } + void Draw(const CTransform4f& xf) const; + void GeneratePoints(const CVector3f* vertices, const CVector3f* normals, int count); + private: rstl::vector< SRainSplash > x0_rainSplashes; CRandom16 x10_random; CVector3f x14_scale; - uchar x0_pad[0x2c]; + float x20_generateTimer; + float x24_generateInterval; + float x28_dt; + float x2c_minZ; + float x30_alpha; + uint x34_curPoint; + uint x38_queueTail; + uint x3c_queueHead; + uint x40_queueSize; + uint x44_genRate; + bool x48_24 : 1; + bool x48_25_raining : 1; }; CHECK_SIZEOF(CRainSplashGenerator, 0x4c) diff --git a/include/MetroidPrime/CStateManager.hpp b/include/MetroidPrime/CStateManager.hpp index 18f87537..29307da3 100644 --- a/include/MetroidPrime/CStateManager.hpp +++ b/include/MetroidPrime/CStateManager.hpp @@ -187,6 +187,7 @@ public: const CWorldTransManager* GetWorldTransManager() const { return x8c4_worldTransManager.GetPtr(); } CRandom16* Random() const { return x900_random; } + uint GetUpdateFrameIndex() const { return x8d8_updateFrameIdx; } CObjectList& ObjectListById(EGameObjectList id) { return *x808_objectLists[id]; } const CObjectList& GetObjectListById(EGameObjectList id) const { return *x808_objectLists[id]; } diff --git a/include/MetroidPrime/Cameras/CCameraShakeData.hpp b/include/MetroidPrime/Cameras/CCameraShakeData.hpp index 916a1ecb..58550e48 100644 --- a/include/MetroidPrime/Cameras/CCameraShakeData.hpp +++ b/include/MetroidPrime/Cameras/CCameraShakeData.hpp @@ -70,6 +70,8 @@ public: float GetCurTime() const { return x4_curTime; } const CVector3f& GetPoint() const; // { return xc4_sfxPos; } + static CCameraShakeData skChargedShotCameraShakeData; + private: float x0_duration; float x4_curTime; diff --git a/include/MetroidPrime/Tweaks/CTweakGunRes.hpp b/include/MetroidPrime/Tweaks/CTweakGunRes.hpp index 185da4fe..45ba6eee 100644 --- a/include/MetroidPrime/Tweaks/CTweakGunRes.hpp +++ b/include/MetroidPrime/Tweaks/CTweakGunRes.hpp @@ -14,6 +14,13 @@ public: typedef CAssetId ResId; typedef CPlayerState::EBeamId EBeamId; + struct WeaponResourcePair { + ResId a; + ResId b; + ResId c; + ResId* d; + }; + ~CTweakGunRes() override; ResId x4_gunMotion; @@ -43,6 +50,14 @@ public: ResId xbc_grappleHit; ResId xc0_grappleMuzzle; ResId xc4_grappleSwoosh; + + const WeaponResourcePair* GetWeaponResourcePair(int beam) const; /* { + const int b = int(beam); + if (b < 0 || b > 4) { + return x34_weapons[0]; + } + return x34_weapons[b]; + }*/ }; extern CTweakGunRes* gpTweakGunRes; diff --git a/include/MetroidPrime/Tweaks/CTweakPlayerGun.hpp b/include/MetroidPrime/Tweaks/CTweakPlayerGun.hpp index 91285da6..203d1043 100644 --- a/include/MetroidPrime/Tweaks/CTweakPlayerGun.hpp +++ b/include/MetroidPrime/Tweaks/CTweakPlayerGun.hpp @@ -30,6 +30,17 @@ struct SShotParam { , x10_radius(0.f) , x14_knockback(0.f) , x18_24_noImmunity(false) {} + + SShotParam(float chargeFactor, const SShotParam& other) { + x14_knockback = chargeFactor * other.x14_knockback; + x0_weaponType = other.x0_weaponType; + x10_radius = chargeFactor * other.x10_radius; + x8_damage = chargeFactor * other.x8_damage; + x18_24_noImmunity = false; + *(reinterpret_cast(this) + 1) = *(reinterpret_cast(&other) + 1); + xc_radiusDamage = chargeFactor * other.xc_radiusDamage; + } + explicit SShotParam(CInputStream& in); }; @@ -77,6 +88,8 @@ public: const CVector3f& GetGunPosition() const { return x4c_gunPosition; } const CVector3f& GetGrapplingArmPosition() const { return x64_grapplingArmPosition; } + const SWeaponInfo& GetBeamInfo(int beam) const; + private: float x4_upLookAngle; float x8_downLookAngle; diff --git a/include/MetroidPrime/Weapons/CGunWeapon.hpp b/include/MetroidPrime/Weapons/CGunWeapon.hpp index 35aa1eb9..99e33419 100644 --- a/include/MetroidPrime/Weapons/CGunWeapon.hpp +++ b/include/MetroidPrime/Weapons/CGunWeapon.hpp @@ -3,11 +3,14 @@ #include "types.h" +#include "MetroidPrime/CDamageInfo.hpp" #include "MetroidPrime/CModelData.hpp" #include "MetroidPrime/Player/CPlayerState.hpp" +#include "MetroidPrime/Weapons/GunController/CGunMotion.hpp" #include "MetroidPrime/Weapons/WeaponCommon.hpp" #include "MetroidPrime/Weapons/WeaponTypes.hpp" + #include "Kyoto/Math/CAABox.hpp" #include "Kyoto/Math/CVector3f.hpp" #include "Kyoto/TToken.hpp" @@ -28,16 +31,27 @@ class CTransform4f; class CModelFlags; class CActorLights; class SWeaponInfo; +class SShotParam; + +enum EFrozenFxType { + kFFT_None, + kFFT_Frozen, + kFFT_Thawed, +}; class CVelocityInfo { public: + ~CVelocityInfo(); + + CVector3f& Velocity(int i) { return x0_vel[i]; } const CVector3f& GetVelocity(int i) const { return x0_vel[i]; } bool GetTargetHoming(int i) const { return x1c_targetHoming[i]; } - void Clear() { - x0_vel.clear(); - x1c_targetHoming.clear(); - x24_trat.clear(); - } + + void Clear(); + + void AddVelocity(const CVector3f& vel) { x0_vel.push_back(vel); } + void AddTargetHoming(const bool& homing) { x1c_targetHoming.push_back(homing); } + void AddTrat(const float& trat) { x24_trat.push_back(trat); } private: rstl::reserved_vector< CVector3f, 2 > x0_vel; @@ -57,11 +71,6 @@ public: kSFT_ToCombo, kSFT_CancelCharge, }; - enum EFrozenFxType { - kFFT_None, - kFFT_Frozen, - kFFT_Thawed, - }; // Virtual Methods virtual void Reset(CStateManager& mgr); @@ -87,10 +96,32 @@ public: rstl::optional_object< CModelData >& SolidModelData() { return x10_solidModelData; } const CModelData& GetSolidModelData() const { return x10_solidModelData.data(); } + TUniqueId GetPlayerId() const { return x1c4_playerId; } + CAABox GetBounds() const; CAABox GetBounds(const CTransform4f& xf) const; const SWeaponInfo& GetWeaponInfo() const; void ActivateCharge(bool enable, bool resetEffect); + bool PlayPasAnim(SamusGun::EAnimationState state, CStateManager& mgr, float angle); + bool IsChargeAnimOver() const; + void UpdateMuzzleFx(float dt, const CVector3f& scale, const CVector3f& pos, bool emitting); + CElementGen* GetChargeMuzzleFx() const; + void DrawHologram(const CStateManager& mgr, const CTransform4f& xf, + const CModelFlags& flags) const; + void ReturnToDefault(CStateManager& mgr); + bool ComboFireOver() const; + void EnterFidget(CStateManager& mgr, SamusGun::EFidgetType type, int parm2); + void Touch(const CStateManager& mgr); + void TouchHolo(const CStateManager& mgr); + void AsyncLoadSuitArm(CStateManager& mgr); + void AsyncLoadFidget(CStateManager& mgr, SamusGun::EFidgetType type, int animSet); + void UnLoadFidget(); + bool IsFidgetLoaded(); + void EnableFrozenEffect(EFrozenFxType type); + + CDamageInfo GetDamageInfo(CStateManager& mgr, CPlayerState::EChargeStage chargeState, + float chargeFactor); + CDamageInfo GetShotDamageInfo(const SShotParam& shotParam, CStateManager& mgr) const; protected: // x0 is vtable @@ -108,8 +139,7 @@ protected: TCachedToken< CGenDescription > x160_xferEffect; rstl::reserved_vector< TCachedToken< CGenDescription >, 2 > x16c_muzzleEffects; rstl::reserved_vector< TCachedToken< CGenDescription >, 2 > x188_frozenEffects; - rstl::reserved_vector< rstl::single_ptr< CElementGen >, 2 > x1a4_muzzleGenerators; - uchar x1b0_pad[8]; + rstl::reserved_vector< rstl::auto_ptr< CElementGen >, 2 > x1a4_muzzleGenerators; rstl::single_ptr< CElementGen > x1b8_frozenGenerator; CRainSplashGenerator* x1bc_rainSplashGenerator; EWeaponType x1c0_weaponType; @@ -122,7 +152,7 @@ protected: uint x208_muzzleEffectIdx; uint x20c_shaderIdx; // 0x1: load request, 0x2: muzzle fx, 0x4: projectile data, 0x8: anims, 0x10: everything else - uint x210_loadFlags; + int x210_loadFlags; CAssetId x214_ancsId; bool x218_24 : 1; bool x218_25_enableCharge : 1; @@ -132,7 +162,24 @@ protected: bool x218_28_suitArmLocked : 1; bool x218_29_drawHologram : 1; - static const int skShootAnim[32]; + static int skShootAnim[2]; + + void AllocResPools(CPlayerState::EBeamId beam); + void FreeResPools(); + static void FillTokenVector(const rstl::vector< SObjectTag >& tags, + rstl::vector< CToken >& objects, bool includeTxtr); + void BuildDependencyList(CPlayerState::EBeamId beam); + void LoadSuitArm(CStateManager& mgr); + void LoadGunModels(CStateManager& mgr); + void LoadAnimations(); + bool IsAnimsLoaded() const; + void LoadMuzzleFx(float dt); + void LoadProjectileData(CStateManager& mgr); + void LoadFxIdle(float dt, CStateManager& mgr); + void LockTokens(CStateManager& mgr); + void UnlockTokens(); + + static void PointGenerator(void*, const CVector3f*, const CVector3f*, int); }; CHECK_SIZEOF(CGunWeapon, 0x21c) diff --git a/include/MetroidPrime/Weapons/GunController/CGunController.hpp b/include/MetroidPrime/Weapons/GunController/CGunController.hpp index 960a75cf..52ba16bd 100644 --- a/include/MetroidPrime/Weapons/GunController/CGunController.hpp +++ b/include/MetroidPrime/Weapons/GunController/CGunController.hpp @@ -4,6 +4,8 @@ #include "types.h" #include "MetroidPrime/Weapons/GunController/CGSFreeLook.hpp" +#include "MetroidPrime/Weapons/GunController/CGSComboFire.hpp" +#include "MetroidPrime/Weapons/GunController/CGSFidget.hpp" class CModelData; @@ -23,9 +25,9 @@ class CStateManager; class CGunController { CModelData& x0_modelData; CGSFreeLook x4_freeLook; - // CGSComboFire x1c_comboFire; - // CGSFidget x30_fidget; - uchar x1c_pad[0x34]; + CGSComboFire x1c_comboFire; + CGSFidget x30_fidget; + char x48_pad[0x4]; EGunState x50_gunState; int x54_curAnimId; bool x58_24_animDone : 1; @@ -33,7 +35,7 @@ class CGunController { public: explicit CGunController(CModelData& modelData); - ~CGunController(); + ~CGunController(); void EnterFreeLook(CStateManager&, int, int); void EnterComboFire(CStateManager&, int); @@ -42,9 +44,12 @@ public: void LoadFidgetAnimAsync(CStateManager&, int, int, int); int Update(float, CStateManager&); void EnterIdle(CStateManager&); - void ReturnToDefault(CStateManager&, float); + void ReturnToDefault(CStateManager&, float, bool); void Reset(); void ReturnToBasePosition(CStateManager&); + bool IsComboOver() const { return x1c_comboFire.IsComboOver(); } + void UnLoadFidget() { x30_fidget.UnLoadAnim(); } + bool IsFidgetLoaded() const { return x30_fidget.IsAnimLoaded(); } int GetFreeLookSetId() const { return x4_freeLook.GetSetId(); } }; diff --git a/include/MetroidPrime/Weapons/WeaponCommon.hpp b/include/MetroidPrime/Weapons/WeaponCommon.hpp index cc12af67..badba387 100644 --- a/include/MetroidPrime/Weapons/WeaponCommon.hpp +++ b/include/MetroidPrime/Weapons/WeaponCommon.hpp @@ -29,6 +29,10 @@ void get_token_vector(CAnimData& animData, int, rstl::vector< CToken >& tokensOu void get_token_vector(const CAnimData& animData, int begin, int end, rstl::vector< CToken >& tokensOut, bool preLock); bool are_tokens_ready(const rstl::vector< CToken >&); +CAssetId get_asset_id_from_name(const char* name); +void lock_tokens(rstl::vector< CToken >&); +void unlock_tokens(rstl::vector< CToken >&); +CPlayerState::EPlayerSuit get_current_suit(const CStateManager& mgr); } // namespace NWeaponTypes diff --git a/src/MetroidPrime/CActor.cpp b/src/MetroidPrime/CActor.cpp index d7b7704d..b9ea1f67 100644 --- a/src/MetroidPrime/CActor.cpp +++ b/src/MetroidPrime/CActor.cpp @@ -296,7 +296,7 @@ void CActor::AddToRenderer(const CFrustumPlanes& planes, const CStateManager& mg void CActor::EnsureRendered(const CStateManager& mgr, const CVector3f& pos, const CAABox& bounds) const { if (GetModelData()) { - const CModelData::EWhichModel which = CModelData::GetRenderingModel(mgr); + const EWhichModel which = CModelData::GetRenderingModel(mgr); GetModelData()->RenderUnsortedParts(which, GetTransform(), GetActorLights(), GetModelFlags()); } mgr.AddDrawableActor(*this, pos, bounds); @@ -354,8 +354,8 @@ void CActor::Render(const CStateManager& mgr) const { } void CActor::RenderInternal(const CStateManager& mgr) const { - CModelData::EWhichModel which = CModelData::GetRenderingModel(mgr); - if (which == CModelData::kWM_ThermalHot) { + EWhichModel which = CModelData::GetRenderingModel(mgr); + if (which == kWM_ThermalHot) { if (GetModelData()->GetSortThermal()) { uchar addMag; uchar mulMag = 255; diff --git a/src/MetroidPrime/Weapons/CGunWeapon.cpp b/src/MetroidPrime/Weapons/CGunWeapon.cpp index 27b0fe61..e8174ad7 100644 --- a/src/MetroidPrime/Weapons/CGunWeapon.cpp +++ b/src/MetroidPrime/Weapons/CGunWeapon.cpp @@ -1,4 +1,747 @@ #include "MetroidPrime/Weapons/CGunWeapon.hpp" +#include "MetroidPrime/CAnimData.hpp" +#include "MetroidPrime/CAnimPlaybackParms.hpp" +#include "MetroidPrime/CAnimRes.hpp" +#include "MetroidPrime/CRainSplashGenerator.hpp" +#include "MetroidPrime/CStateManager.hpp" +#include "MetroidPrime/Cameras/CCameraManager.hpp" +#include "MetroidPrime/Cameras/CCameraShakeData.hpp" +#include "MetroidPrime/Tweaks/CTweakGunRes.hpp" +#include "MetroidPrime/Tweaks/CTweakPlayerGun.hpp" +#include "MetroidPrime/Weapons/CEnergyProjectile.hpp" +#include "MetroidPrime/Weapons/GunController/CGunController.hpp" + +#include "Weapons/CWeaponDescription.hpp" + +#include "Kyoto/Animation/CSkinnedModel.hpp" +#include "Kyoto/Animation/CVertexMorphEffect.hpp" +#include "Kyoto/Audio/CSfxManager.hpp" +#include "Kyoto/CDependencyGroup.hpp" +#include "Kyoto/Graphics/CGraphics.hpp" +#include "Kyoto/Graphics/CModel.hpp" +#include "Kyoto/Graphics/CModelFlags.hpp" +#include "Kyoto/Math/CloseEnough.hpp" +#include "Kyoto/Particles/CElementGen.hpp" +#include "MetaRender/CCubeRenderer.hpp" + +const char* skMuzzleNames[] = { + "PowerMuzzle", "PowerCharge", "IceMuzzle", "IceCharge", "PowerMuzzle", + "WaveCharge", "PlasmaMuzzle", "PlasmaCharge", "PhazonMuzzle", "EmptyMuzzle", +}; + +const char* skFrozenNames[] = { + "powerFrozen", "Ice2nd_2", "iceFrozen", "Ice2nd_2", "waveFrozen", + "Ice2nd_2", "plasmaFrozen", "Ice2nd_2", "iceFrozen", "Ice2nd_2", +}; + +const char* skBeamXferNames[] = { + "PowerXfer", "IceXfer", "WaveXfer", "PlasmaXfer", "PhazonXfer", +}; + +const char* skAnimDependencyNames[] = { + "Power_Anim_DGRP", "Ice_Anim_DGRP", "Wave_Anim_DGRP", "Plasma_Anim_DGRP", "Phazon_Anim_DGRP", +}; + +const char* skDependencyNames[] = { + "Power_DGRP", "Ice_DGRP", "Wave_DGRP", "Plasma_DGRP", "Phazon_DGRP", +}; + +const char* skSuitArmNames[] = { + "PowerArm", "GravityArm", "VariaArm", "PhazonArm", + "FusionArm", "FusionArmG", "FusionArmV", "FusionArmP", +}; + +const int skAnimTypeList[] = { + 0, 4, 1, 2, 3, 5, 6, 7, 8, 9, 10, +}; + +CPlayerState::EBeamId GetWeaponIndex(EWeaponType type) { + switch (type) { + case kWT_Power: + return CPlayerState::kBI_Power; + case kWT_Ice: + return CPlayerState::kBI_Ice; + case kWT_Wave: + return CPlayerState::kBI_Wave; + case kWT_Plasma: + return CPlayerState::kBI_Plasma; + case kWT_Phazon: + return CPlayerState::kBI_Phazon; + default: + return CPlayerState::kBI_Power; + } +} + +CGunWeapon::CGunWeapon(CAssetId ancsId, EWeaponType type, TUniqueId playerId, + EMaterialTypes playerMaterial, const CVector3f& scale) + +: x4_scale(scale) +, x104_gunCharacter(gpSimplePool->GetObj(SObjectTag('ANCS', ancsId))) +, x13c_armCharacter(gpSimplePool->GetObj(skSuitArmNames[0])) +, x160_xferEffect(gpSimplePool->GetObj(skBeamXferNames[size_t(GetWeaponIndex(type))])) +, x1bc_rainSplashGenerator(nullptr) +, x1c0_weaponType(type) +, x1c4_playerId(playerId) +, x1c8_playerMaterial(playerMaterial) +, x1cc_enabledSecondaryEffect(kSFT_None) +, x200_beamId(GetWeaponIndex(type)) +, x204_frozenEffect(kFFT_None) +, x208_muzzleEffectIdx(0) +, x20c_shaderIdx(u32(x200_beamId)) +, x210_loadFlags(0) +, x214_ancsId(ancsId) +, x218_24(false) +, x218_25_enableCharge(false) +, x218_26_loaded(false) +, x218_27_subtypeBasePose(false) +, x218_28_suitArmLocked(false) +, x218_29_drawHologram(false) { + AllocResPools(x200_beamId); + BuildDependencyList(x200_beamId); +} + +CVelocityInfo::~CVelocityInfo() {} + +CGunWeapon::~CGunWeapon() {} + +const SWeaponInfo& CGunWeapon::GetWeaponInfo() const { + return gpTweakPlayerGun->GetBeamInfo(x200_beamId); +} + +void CGunWeapon::LoadMuzzleFx(float dt) { + + for (int i = 0; i < x16c_muzzleEffects.capacity(); ++i) { + CElementGen* newElement = new CElementGen(x16c_muzzleEffects[i]); + newElement->SetParticleEmission(false); + newElement->Update(dt); + x1a4_muzzleGenerators.push_back(newElement); + } +} + +void CGunWeapon::LoadGunModels(CStateManager& mgr) { + int defaultAnim = 9; + if (x218_27_subtypeBasePose) { + defaultAnim = 0; + } + x10_solidModelData = CAnimRes(x214_ancsId, 0, x4_scale, defaultAnim, false); + x60_holoModelData = CAnimRes(x214_ancsId, 1, x4_scale, defaultAnim, false); + CAnimPlaybackParms parms(defaultAnim, -1, 1.f, true); + x10_solidModelData->AnimationData()->SetAnimation(parms, true); + LoadSuitArm(mgr); + x10_solidModelData->SetSortThermal(true); + x60_holoModelData->SetSortThermal(true); + x100_gunController = new CGunController(*x10_solidModelData); +} + +void CGunWeapon::LoadProjectileData(CStateManager& mgr) { + CRandom16 random(mgr.GetUpdateFrameIndex()); + CGlobalRandom grand(random); + + for (int i = 0; i < x144_weapons.capacity(); ++i) { + CWeaponDescription& weapon = **x144_weapons[i]; + + CVector3f weaponVel = CVector3f::Zero(); + if (const CVectorElement* ivec = weapon.x4_IVEC) { + ivec->GetValue(0, weaponVel); + } + x1d0_velInfo.AddVelocity(weaponVel); + + float tratVal = 0.f; + if (const CRealElement* trat = weapon.x30_TRAT) { + trat->GetValue(0, tratVal); + } + x1d0_velInfo.AddTrat(tratVal); + + x1d0_velInfo.AddTargetHoming(weapon.x29_HOMG); + + if (weaponVel.GetY() > 0.f) { + x1d0_velInfo.Velocity(i) *= 60.f; + } else { + x1d0_velInfo.Velocity(i) = CVector3f::Forward(); + } + } +} + +bool CGunWeapon::PlayPasAnim(SamusGun::EAnimationState state, CStateManager& mgr, float angle) { + switch (state) { + case SamusGun::kAS_ComboFire: + x100_gunController->EnterComboFire(mgr, x200_beamId); + break; + default: + return false; + case SamusGun::kAS_Wander: + break; + } + return true; +} + +bool CGunWeapon::IsChargeAnimOver() const { + if (x218_25_enableCharge) { + if (x10_solidModelData->GetAnimationData()->IsAnimTimeRemaining(0.001f, + rstl::string_l("Whole Body"))) { + return false; + } + } + return true; +} + +void CGunWeapon::PlayAnim(NWeaponTypes::EGunAnimType type, bool loop) { + if (!x218_26_loaded || type < NWeaponTypes::kGAT_BasePosition || + type > NWeaponTypes::kGAT_ToBeam) { + return; + } + x10_solidModelData->AnimationData()->EnableLooping(loop); + + const CAnimPlaybackParms parms(skAnimTypeList[type], -1, 1.f, true); + x10_solidModelData->AnimationData()->SetAnimation(parms, false); +} + +void CGunWeapon::Reset(CStateManager& mgr) { + if (!x218_26_loaded) + return; + + x10_solidModelData->AnimationData()->EnableLooping(false); + if (x218_25_enableCharge) + x218_25_enableCharge = false; + else + x100_gunController->Reset(); +} + +void CGunWeapon::Update(float dt, CStateManager& mgr) { + if (x218_26_loaded) { + x10_solidModelData->AdvanceAnimation(dt, mgr, kInvalidAreaId, true); + x100_gunController->Update(dt, mgr); + if (x218_28_suitArmLocked) { + LoadSuitArm(mgr); + } + } else { + if (x104_gunCharacter.HasLock()) { + if (x104_gunCharacter.IsLoaded()) { + if ((x210_loadFlags & 0x1) != 0x1) { + LoadGunModels(mgr); + LoadAnimations(); + x210_loadFlags |= 0x1; + } + if ((x210_loadFlags & 0x8) != 0x8) { + if (IsAnimsLoaded()) + x210_loadFlags |= 0x8; + } + } + + LoadFxIdle(dt, mgr); + if ((x210_loadFlags & 0x1f) == 0x1f) { + CSkinnedModel& model = x10_solidModelData->PickAnimatedModel(kWM_Normal); + bool flag1 = model.GetModel()->IsLoaded(x20c_shaderIdx); + bool flag2 = xb0_suitArmModelData->IsLoaded(0); + if (flag1 && flag2) { + x218_26_loaded = true; + } + } + } + } +} + +void CGunWeapon::PostRenderGunFx(const CStateManager& mgr, const CTransform4f& xf) { + if (x218_26_loaded && x1b8_frozenGenerator.get() && x204_frozenEffect != kFFT_None) + x1b8_frozenGenerator->Render(); +} + +void CGunWeapon::UpdateGunFx(bool shotSmoke, float dt, const CStateManager& mgr, + const CTransform4f& xf) { + if (x218_26_loaded && x204_frozenEffect != kFFT_None) { + if (x204_frozenEffect == kFFT_Thawed) { + if (x1b8_frozenGenerator->IsSystemDeletable()) { + x204_frozenEffect = kFFT_None; + x1b8_frozenGenerator = nullptr; + } else { + x1b8_frozenGenerator->SetTranslation(xf.GetTranslation()); + x1b8_frozenGenerator->SetOrientation(xf.GetRotation()); + } + } else { + x1b8_frozenGenerator->SetGlobalOrientAndTrans(xf); + } + if (x1b8_frozenGenerator.get()) + x1b8_frozenGenerator->Update(dt); + } +} + +void CGunWeapon::UpdateMuzzleFx(float dt, const CVector3f& scale, const CVector3f& pos, + bool emitting) { + x1a4_muzzleGenerators[x208_muzzleEffectIdx]->SetGlobalTranslation(pos); + x1a4_muzzleGenerators[x208_muzzleEffectIdx]->SetGlobalScale(scale); + x1a4_muzzleGenerators[x208_muzzleEffectIdx]->SetParticleEmission(emitting); + x1a4_muzzleGenerators[x208_muzzleEffectIdx]->Update(dt); +} + +CElementGen* CGunWeapon::GetChargeMuzzleFx() const { + CElementGen* result = x1a4_muzzleGenerators[1].get(); + if (result) { + return result; + } + return nullptr; +} + +void CGunWeapon::DrawMuzzleFx(const CStateManager& mgr) const { + if (!x1a4_muzzleGenerators[x208_muzzleEffectIdx].null()) { + if (x200_beamId != CPlayerState::kBI_Ice && + mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::kPV_XRay) { + CElementGen::SetSubtractBlend(true); + x1a4_muzzleGenerators[x208_muzzleEffectIdx]->Render(); + CElementGen::SetSubtractBlend(false); + } else { + x1a4_muzzleGenerators[x208_muzzleEffectIdx]->Render(); + } + } +} + +void CGunWeapon::ActivateCharge(bool enable, bool resetEffect) { + x1a4_muzzleGenerators[x208_muzzleEffectIdx]->SetParticleEmission(false); + x208_muzzleEffectIdx = !!enable; + if (enable || resetEffect) { + x1a4_muzzleGenerators[x208_muzzleEffectIdx] = + new CElementGen(x16c_muzzleEffects[x208_muzzleEffectIdx]); + } +} + void CGunWeapon::Draw(bool drawSuitArm, const CStateManager& mgr, const CTransform4f& xf, - const CModelFlags& flags, const CActorLights* lights) const {} + const CModelFlags& flags, const CActorLights* lights) const { + if (!x218_26_loaded) + return; + + CTransform4f armXf = xf * x10_solidModelData->GetScaledLocatorTransform(rstl::string_l("elbow")); + + if (x1bc_rainSplashGenerator && x1bc_rainSplashGenerator->IsRaining()) { + CSkinnedModel::SetPointGeneratorFunc((void*)x1bc_rainSplashGenerator, + &CGunWeapon::PointGenerator); + } + + if (mgr.GetThermalDrawFlag() == kTD_Hot && x200_beamId != CPlayerState::kBI_Ice) { + /* Hot Draw */ + float a = flags.GetColor().GetAlpha(); + const CColor mulColor(a, a, a, a); + CColor addColor((uchar)0x40, 0x40, 0x40, 0x40); + if (x218_29_drawHologram) { + DrawHologram(mgr, xf, flags); + } else { + CModelFlags useFlags(CModelFlags::kT_Opaque, 1.0f); + x10_solidModelData->RenderThermal(xf, mulColor, addColor, useFlags); + } + + if (drawSuitArm && xb0_suitArmModelData) { + CModelFlags useFlags(CModelFlags::kT_Opaque, 1.0f); + xb0_suitArmModelData->RenderThermal(xf, mulColor, addColor, useFlags); + } + } else { + /* Cold Draw */ + if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::kPV_XRay && + !x218_29_drawHologram) { + x10_solidModelData->Render(mgr, xf, lights, flags.UseShaderSet(x20c_shaderIdx)); + } else { + DrawHologram(mgr, xf, flags); + } + + if (drawSuitArm && xb0_suitArmModelData) { + xb0_suitArmModelData->Render(mgr, armXf, lights, flags); + } + } + + if (x1bc_rainSplashGenerator && x1bc_rainSplashGenerator->IsRaining()) { + CSkinnedModel::ClearPointGeneratorFunc(); + x1bc_rainSplashGenerator->Draw(xf); + } +} + +void CGunWeapon::DrawHologram(const CStateManager& mgr, const CTransform4f& xf, + const CModelFlags& flags) const { + if (!x218_26_loaded) + return; + + // TODO + if (x218_29_drawHologram) { + x60_holoModelData->FlatDraw(kWM_Normal, xf, false, flags); + } else { + const CVector3f& scale = x10_solidModelData->GetScale(); + CTransform4f modelMatrix(xf); + modelMatrix = modelMatrix * CTransform4f::Scale(scale.GetX(), scale.GetY(), scale.GetZ()); + gpRender->SetModelMatrix(modelMatrix); + + CGraphics::DisableAllLights(); + gpRender->SetAmbientColor(CColor::White()); + x10_solidModelData->GetAnimationData()->Render( + **x60_holoModelData->GetAnimationData()->GetModelData(), flags, + rstl::optional_object_null(), nullptr); + gpRender->SetAmbientColor(CColor::White()); + CGraphics::DisableAllLights(); + } +} + +int CGunWeapon::skShootAnim[2] = {4, 3}; + +static float kChargeScaleFactor = 1.0f; + +inline float GetChargeFactor(CPlayerState::EChargeStage chargeState, float chargeFactor2) { + float k = chargeFactor2; + if (chargeState == CPlayerState::kCS_Normal) { + k = 1.0f; + } + return k * kChargeScaleFactor; +} + +void CGunWeapon::Fire(bool underwater, float dt, CPlayerState::EChargeStage chargeState, + const CTransform4f& xf, CStateManager& mgr, TUniqueId homingTarget, + float chargeFactor1, float chargeFactor2) { + CDamageInfo dInfo(GetDamageInfo(mgr, chargeState, chargeFactor1)); + + CVector3f scale(GetChargeFactor(chargeState, chargeFactor2), + GetChargeFactor(chargeState, chargeFactor2), + GetChargeFactor(chargeState, chargeFactor2)); + bool partialCharge = + chargeState == CPlayerState::kCS_Normal ? false : !close_enough(chargeFactor1, 1.f); + + uint particleChargeAttribs = 0; + if (partialCharge) + particleChargeAttribs = kPA_PartialCharge; + + uint attribs = kPA_ArmCannon; + if (chargeState != CPlayerState::kCS_Normal) + attribs = kPA_ArmCannon | kPA_Charged; + + CEnergyProjectile* proj = new CEnergyProjectile( + true, x144_weapons[chargeState], x1c0_weaponType, xf, x1c8_playerMaterial, dInfo, + mgr.AllocateUniqueId(), kInvalidAreaId, GetPlayerId(), homingTarget, + particleChargeAttribs | attribs, underwater, scale, rstl::optional_object_null(), + CSfxManager::kInternalInvalidSfxId, false); + if (proj) { + mgr.AddObject(proj); + proj->Think(dt, mgr); + } + + if (chargeState != CPlayerState::kCS_Normal) { + x218_25_enableCharge = true; + mgr.CameraManager()->AddCameraShaker(CCameraShakeData::skChargedShotCameraShakeData, false); + } + + x10_solidModelData->AnimationData()->EnableLooping(false); + CAnimPlaybackParms parms(skShootAnim[chargeState], -1, 1.f, true); + x10_solidModelData->AnimationData()->SetAnimation(parms, false); +} + +void CGunWeapon::ReturnToDefault(CStateManager& mgr) { + x100_gunController->ReturnToDefault(mgr, 0.f, false); +} + +bool CGunWeapon::ComboFireOver() const { return x100_gunController->IsComboOver(); } + +void CGunWeapon::EnterFidget(CStateManager& mgr, SamusGun::EFidgetType type, int parm2) { + x100_gunController->EnterFidget(mgr, s32(type), s32(x200_beamId), parm2); +} + +CDamageInfo CGunWeapon::GetDamageInfo(CStateManager& mgr, CPlayerState::EChargeStage chargeState, + float chargeFactor) { + const SWeaponInfo& wInfo = GetWeaponInfo(); + if (chargeState == CPlayerState::kCS_Normal) { + return GetShotDamageInfo(wInfo.x4_normal, mgr); + } else { + SShotParam param(chargeFactor, wInfo.x20_charged); + return GetShotDamageInfo(param, mgr); + } +} + +CAABox CGunWeapon::GetBounds() const { + if (x10_solidModelData) + return x10_solidModelData->GetBounds(); + return CAABox::Identity(); +} + +CAABox CGunWeapon::GetBounds(const CTransform4f& xf) const { + if (x10_solidModelData) + return x10_solidModelData->GetBounds(xf); + return CAABox::Identity(); +} + +void CGunWeapon::Touch(const CStateManager& mgr) { + if (x10_solidModelData) { + x10_solidModelData->Touch(mgr, x20c_shaderIdx); + if (xb0_suitArmModelData) + xb0_suitArmModelData->Touch(mgr, 0); + } +} + +void CGunWeapon::TouchHolo(const CStateManager& mgr) { + if (x60_holoModelData) + x60_holoModelData->Touch(mgr, 0); +} + +void CGunWeapon::Load(CStateManager& mgr, bool subtypeBasePose) { + LockTokens(mgr); + x218_27_subtypeBasePose = subtypeBasePose; + x204_frozenEffect = kFFT_None; + x1b8_frozenGenerator = nullptr; + x104_gunCharacter.Lock(); + x160_xferEffect.Lock(); + + for (int i = 0; i < x16c_muzzleEffects.capacity(); ++i) { + x16c_muzzleEffects[i].Lock(); + x144_weapons[i].Lock(); + } + + for (int i = 0; i < x188_frozenEffects.capacity(); ++i) { + x188_frozenEffects[i].Lock(); + } +} + +void CGunWeapon::Unload(CStateManager& mgr) { + UnlockTokens(); + x210_loadFlags = 0; + x204_frozenEffect = kFFT_None; + x10_solidModelData = rstl::optional_object_null(); + x60_holoModelData = rstl::optional_object_null(); + xb0_suitArmModelData = rstl::optional_object_null(); + x100_gunController = nullptr; + x1bc_rainSplashGenerator = nullptr; + x1b8_frozenGenerator = nullptr; + FreeResPools(); + x104_gunCharacter.Unlock(); + x218_26_loaded = false; +} + +bool CGunWeapon::IsLoaded() const { return x218_26_loaded; } + +void CGunWeapon::AllocResPools(CPlayerState::EBeamId beam) { + const CTweakGunRes::WeaponResourcePair* wPair = gpTweakGunRes->GetWeaponResourcePair(beam); + const char* const* muzzleNames = &skMuzzleNames[size_t(beam) * 2]; + + for (int i = 0; i < x16c_muzzleEffects.capacity(); ++i) { + x16c_muzzleEffects.push_back(gpSimplePool->GetObj(muzzleNames[i])); + x144_weapons.push_back(gpSimplePool->GetObj(SObjectTag('WPSC', wPair->d[i]))); + } + + const char* const* frozenNames = &skFrozenNames[size_t(beam) * 2]; + for (int i = 0; i < x16c_muzzleEffects.capacity(); ++i) { + x188_frozenEffects.push_back(gpSimplePool->GetObj(frozenNames[i])); + } +} + +void CVelocityInfo::Clear() { + x0_vel = rstl::reserved_vector< CVector3f, 2 >(); + x1c_targetHoming = rstl::reserved_vector< bool, 2 >(); + x24_trat = rstl::reserved_vector< float, 2 >(); +} + +void CGunWeapon::FreeResPools() { + x160_xferEffect.Unlock(); + + for (int i = 0; i < x16c_muzzleEffects.capacity(); ++i) { + x16c_muzzleEffects[i].Unlock(); + x144_weapons[i].Unlock(); + } + for (int i = 0; i < x188_frozenEffects.capacity(); ++i) { + x188_frozenEffects[i].Unlock(); + } + + x10c_anims = rstl::vector< CToken >(); + x1a4_muzzleGenerators = rstl::reserved_vector< rstl::auto_ptr< CElementGen >, 2 >(); + x1d0_velInfo.Clear(); +} + +void CGunWeapon::LoadFxIdle(float dt, CStateManager& mgr) { + if (!NWeaponTypes::are_tokens_ready(x12c_deps)) { + return; + } + + if ((x210_loadFlags & 0x2) != 0 && (x210_loadFlags & 0x4) != 0 && (x210_loadFlags & 0x10) != 0) { + return; + } + + bool loaded = true; + for (int i = 0; i < x16c_muzzleEffects.capacity(); ++i) { + if (!x16c_muzzleEffects[i].IsLoaded()) { + loaded = false; + break; + } + if (!x144_weapons[i].IsLoaded()) { + loaded = false; + break; + } + } + for (int i = 0; i < x188_frozenEffects.capacity(); ++i) { + if (!x188_frozenEffects[i].IsLoaded()) { + loaded = false; + break; + } + } + if (!x160_xferEffect.IsLoaded()) { + loaded = false; + } + if (loaded) { + if ((x210_loadFlags & 0x2) != 0x2) { + LoadMuzzleFx(dt); + x210_loadFlags |= 0x2; + } + x210_loadFlags |= 0x10; + if ((x210_loadFlags & 0x4) != 0x4) { + LoadProjectileData(mgr); + x210_loadFlags |= 0x4; + } + } +} + +void CGunWeapon::LockTokens(CStateManager& mgr) { + AsyncLoadSuitArm(mgr); + NWeaponTypes::lock_tokens(x12c_deps); +} + +void CGunWeapon::UnlockTokens() { + x13c_armCharacter.Unlock(); + NWeaponTypes::unlock_tokens(x12c_deps); +} + +void CGunWeapon::FillTokenVector(const rstl::vector< SObjectTag >& tags, + rstl::vector< CToken >& out, bool includeTxtr) { + rstl::vector< SObjectTag >::const_iterator it; + for (it = tags.begin(); it != tags.end(); ++it) { + CToken token = gpSimplePool->GetObj(*it); + if (!includeTxtr && token.GetReferenceType() == 'TXTR') { + continue; + } + out.push_back(token); + } +} + +void CGunWeapon::BuildDependencyList(CPlayerState::EBeamId beam) { + TLockedToken< CDependencyGroup > deps = gpSimplePool->GetObj(skDependencyNames[beam]); + TLockedToken< CDependencyGroup > animDeps = gpSimplePool->GetObj(skAnimDependencyNames[beam]); + CDependencyGroup* depsObj = *deps; + CDependencyGroup* animDepsObj = *animDeps; + x12c_deps.reserve(depsObj->GetObjectTagVector().size() + + animDepsObj->GetObjectTagVector().size()); + FillTokenVector(depsObj->GetObjectTagVector(), x12c_deps, true); + FillTokenVector(animDepsObj->GetObjectTagVector(), x12c_deps, false); +} + +void CGunWeapon::AsyncLoadFidget(CStateManager& mgr, SamusGun::EFidgetType type, int animSet) { + x100_gunController->LoadFidgetAnimAsync(mgr, type, x200_beamId, animSet); +} + +void CGunWeapon::UnLoadFidget() { x100_gunController->UnLoadFidget(); } + +bool CGunWeapon::IsFidgetLoaded() { return x100_gunController->IsFidgetLoaded(); } + +void CGunWeapon::LoadAnimations() { + NWeaponTypes::get_token_vector(*x10_solidModelData->GetAnimationData(), 0, 15, x10c_anims, true); +} + +bool CGunWeapon::IsAnimsLoaded() const { + for (rstl::vector< CToken >::const_iterator it = x10c_anims.begin(); it != x10c_anims.end(); + ++it) { + if (!it->IsLoaded()) { + return false; + } + } + return true; +} + +void CGunWeapon::AsyncLoadSuitArm(CStateManager& mgr) { + CPlayerState::EPlayerSuit suit = NWeaponTypes::get_current_suit(mgr); + xb0_suitArmModelData = rstl::optional_object_null(); + x13c_armCharacter = gpSimplePool->GetObj(skSuitArmNames[suit]); + x13c_armCharacter.Lock(); + x218_28_suitArmLocked = true; +} + +void CGunWeapon::LoadSuitArm(CStateManager& mgr) { + if (!x13c_armCharacter.IsLoaded()) { + return; + } + CPlayerState::EPlayerSuit suit = NWeaponTypes::get_current_suit(mgr); + const CAssetId armId = NWeaponTypes::get_asset_id_from_name(skSuitArmNames[suit]); + xb0_suitArmModelData = CStaticRes(armId, x4_scale); + xb0_suitArmModelData->SetSortThermal(true); + x218_28_suitArmLocked = false; + x13c_armCharacter.Unlock(); +} + +void CGunWeapon::PointGenerator(void* ptr, const CVector3f* vertices, const CVector3f* normals, + int count) { + + ((CRainSplashGenerator*)ptr)->GeneratePoints(vertices, normals, count); +} + +void CGunWeapon::EnableFrozenEffect(EFrozenFxType type) { + switch (type) { + case kFFT_Thawed: + if (x204_frozenEffect == kFFT_Thawed) + break; + x1b8_frozenGenerator = new CElementGen(x188_frozenEffects[1]); + x1b8_frozenGenerator->SetGlobalScale(x4_scale); + break; + case kFFT_Frozen: + if (x204_frozenEffect == kFFT_Frozen) + break; + x1b8_frozenGenerator = new CElementGen(x188_frozenEffects[0]); + x1b8_frozenGenerator->SetGlobalScale(x4_scale); + break; + default: + break; + } + x204_frozenEffect = type; +} + + +void DrawClipCube(const CAABox& aabb) { + // Render AABB as completely transparent object, only modifying Z-buffer + const CColor color(1.f, 1.f, 1.f, 0.f); + gpRender->SetBlendMode_AlphaBlended(); + CGraphics::SetCullMode(kCM_None); + + gpRender->BeginTriangleStrip(4); + gpRender->PrimColor(color); + gpRender->PrimVertex(CVector3f(aabb.GetMaxPoint().GetX(), aabb.GetMaxPoint().GetY(), aabb.GetMinPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMaxPoint().GetX(), aabb.GetMinPoint().GetY(), aabb.GetMinPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMaxPoint().GetX(), aabb.GetMaxPoint().GetY(), aabb.GetMaxPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMaxPoint().GetX(), aabb.GetMinPoint().GetY(), aabb.GetMaxPoint().GetZ())); + gpRender->EndPrimitive(); + + gpRender->BeginTriangleStrip(4); + gpRender->PrimColor(color); + gpRender->PrimVertex(CVector3f(aabb.GetMinPoint().GetX(), aabb.GetMaxPoint().GetY(), aabb.GetMinPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMaxPoint().GetX(), aabb.GetMaxPoint().GetY(), aabb.GetMinPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMinPoint().GetX(), aabb.GetMaxPoint().GetY(), aabb.GetMaxPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMaxPoint().GetX(), aabb.GetMaxPoint().GetY(), aabb.GetMaxPoint().GetZ())); + gpRender->EndPrimitive(); + + gpRender->BeginTriangleStrip(4); + gpRender->PrimColor(color); + gpRender->PrimVertex(CVector3f(aabb.GetMinPoint().GetX(), aabb.GetMaxPoint().GetY(), aabb.GetMinPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMinPoint().GetX(), aabb.GetMinPoint().GetY(), aabb.GetMinPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMinPoint().GetX(), aabb.GetMaxPoint().GetY(), aabb.GetMaxPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMinPoint().GetX(), aabb.GetMinPoint().GetY(), aabb.GetMaxPoint().GetZ())); + gpRender->EndPrimitive(); + + gpRender->BeginTriangleStrip(4); + gpRender->PrimColor(color); + gpRender->PrimVertex(CVector3f(aabb.GetMinPoint().GetX(), aabb.GetMinPoint().GetY(), aabb.GetMinPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMaxPoint().GetX(), aabb.GetMinPoint().GetY(), aabb.GetMinPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMinPoint().GetX(), aabb.GetMinPoint().GetY(), aabb.GetMaxPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMaxPoint().GetX(), aabb.GetMinPoint().GetY(), aabb.GetMaxPoint().GetZ())); + gpRender->EndPrimitive(); + + gpRender->BeginTriangleStrip(4); + gpRender->PrimColor(color); + gpRender->PrimVertex(CVector3f(aabb.GetMinPoint().GetX(), aabb.GetMinPoint().GetY(), aabb.GetMaxPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMaxPoint().GetX(), aabb.GetMinPoint().GetY(), aabb.GetMaxPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMinPoint().GetX(), aabb.GetMaxPoint().GetY(), aabb.GetMaxPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMaxPoint().GetX(), aabb.GetMaxPoint().GetY(), aabb.GetMaxPoint().GetZ())); + gpRender->EndPrimitive(); + + gpRender->BeginTriangleStrip(4); + gpRender->PrimColor(color); + gpRender->PrimVertex(CVector3f(aabb.GetMinPoint().GetX(), aabb.GetMinPoint().GetY(), aabb.GetMinPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMaxPoint().GetX(), aabb.GetMinPoint().GetY(), aabb.GetMinPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMinPoint().GetX(), aabb.GetMaxPoint().GetY(), aabb.GetMinPoint().GetZ())); + gpRender->PrimVertex(CVector3f(aabb.GetMaxPoint().GetX(), aabb.GetMaxPoint().GetY(), aabb.GetMinPoint().GetZ())); + gpRender->EndPrimitive(); + + CGraphics::SetCullMode(kCM_Front); +} diff --git a/src/MetroidPrime/Weapons/GunController/CGunController.cpp b/src/MetroidPrime/Weapons/GunController/CGunController.cpp index aed50bd3..7e967571 100644 --- a/src/MetroidPrime/Weapons/GunController/CGunController.cpp +++ b/src/MetroidPrime/Weapons/GunController/CGunController.cpp @@ -21,7 +21,7 @@ int CGunController::Update(float, CStateManager&) { return 0; } void CGunController::EnterIdle(CStateManager&) {} -void CGunController::ReturnToDefault(CStateManager&, float) {} +void CGunController::ReturnToDefault(CStateManager&, float, bool) {} void CGunController::Reset() {}