From 6ea05616bc9aa55a8f1c1ae0e4a1c2c67b8183bc Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Thu, 3 Nov 2022 20:14:41 +0200 Subject: [PATCH] Add CMetroidPrimeProjectile --- asm/MetroidPrime/Enemies/CFlaahgra.s | 2 +- asm/MetroidPrime/Enemies/CFlyingPirate.s | 2 +- asm/MetroidPrime/Enemies/CMetroidPrimeExo.s | 4 +- .../Enemies/CMetroidPrimeProjectile.s | 18 +++--- asm/MetroidPrime/Enemies/CPatterned.s | 2 +- asm/MetroidPrime/Enemies/CPuddleSpore.s | 2 +- asm/MetroidPrime/Enemies/CRidley.s | 4 +- .../ScriptObjects/CScriptGunTurret.s | 2 +- asm/MetroidPrime/Weapons/CAuxWeapon.s | 2 +- asm/MetroidPrime/Weapons/CEnergyProjectile.s | 4 +- asm/MetroidPrime/Weapons/CGunWeapon.s | 2 +- .../Weapons/CTargetableProjectile.s | 4 +- asm/MetroidPrime/Weapons/CWaveBeam.s | 2 +- configure.py | 2 +- .../Enemies/CMetroidPrimeProjectile.hpp | 53 ++++++++++++++++ .../Weapons/CEnergyProjectile.hpp | 7 ++- .../MetroidPrime/Weapons/CGameProjectile.hpp | 2 +- .../Enemies/CMetroidPrimeProjectile.cpp | 63 +++++++++++++++++++ 18 files changed, 149 insertions(+), 28 deletions(-) create mode 100644 include/MetroidPrime/Enemies/CMetroidPrimeProjectile.hpp create mode 100644 src/MetroidPrime/Enemies/CMetroidPrimeProjectile.cpp diff --git a/asm/MetroidPrime/Enemies/CFlaahgra.s b/asm/MetroidPrime/Enemies/CFlaahgra.s index 7aa6670d..f4f3aeda 100644 --- a/asm/MetroidPrime/Enemies/CFlaahgra.s +++ b/asm/MetroidPrime/Enemies/CFlaahgra.s @@ -8209,7 +8209,7 @@ lbl_801B43A8: /* 801B4464 001B13C4 91 61 00 20 */ stw r11, 0x20(r1) /* 801B4468 001B13C8 90 01 00 24 */ stw r0, 0x24(r1) /* 801B446C 001B13CC 92 C1 00 28 */ stw r22, 0x28(r1) -/* 801B4470 001B13D0 48 06 12 29 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 801B4470 001B13D0 48 06 12 29 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 801B4474 001B13D4 88 01 00 4C */ lbz r0, 0x4c(r1) /* 801B4478 001B13D8 28 00 00 00 */ cmplwi r0, 0 /* 801B447C 001B13DC 41 82 00 1C */ beq lbl_801B4498 diff --git a/asm/MetroidPrime/Enemies/CFlyingPirate.s b/asm/MetroidPrime/Enemies/CFlyingPirate.s index e8c6a402..8f69eb3a 100644 --- a/asm/MetroidPrime/Enemies/CFlyingPirate.s +++ b/asm/MetroidPrime/Enemies/CFlyingPirate.s @@ -5540,7 +5540,7 @@ lbl_801F88DC: /* 801F895C 001F58BC 93 A1 00 20 */ stw r29, 0x20(r1) /* 801F8960 001F58C0 90 01 00 24 */ stw r0, 0x24(r1) /* 801F8964 001F58C4 91 61 00 28 */ stw r11, 0x28(r1) -/* 801F8968 001F58C8 48 01 CD 31 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 801F8968 001F58C8 48 01 CD 31 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 801F896C 001F58CC 7C 7E 1B 78 */ mr r30, r3 lbl_801F8970: /* 801F8970 001F58D0 7E E0 07 75 */ extsb. r0, r23 diff --git a/asm/MetroidPrime/Enemies/CMetroidPrimeExo.s b/asm/MetroidPrime/Enemies/CMetroidPrimeExo.s index 239b509d..9d2988b5 100644 --- a/asm/MetroidPrime/Enemies/CMetroidPrimeExo.s +++ b/asm/MetroidPrime/Enemies/CMetroidPrimeExo.s @@ -10636,7 +10636,7 @@ lbl_80279CF4: /* 80279F20 00276E80 91 81 00 20 */ stw r12, 0x20(r1) /* 80279F24 00276E84 91 61 00 24 */ stw r11, 0x24(r1) /* 80279F28 00276E88 90 01 00 28 */ stw r0, 0x28(r1) -/* 80279F2C 00276E8C 48 02 67 99 */ bl "__ct__23CMetroidPrimeProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueIdUi9TUniqueIdUiRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 80279F2C 00276E8C 48 02 67 99 */ bl "__ct__23CMetroidPrimeProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueIdRC20SPrimeProjectileInfo9TUniqueIdUiRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 80279F30 00276E90 7C 7A 1B 78 */ mr r26, r3 lbl_80279F34: /* 80279F34 00276E94 7E A0 07 75 */ extsb. r0, r21 @@ -10821,7 +10821,7 @@ lbl_80279FE0: /* 8027A1F4 00277154 91 61 00 20 */ stw r11, 0x20(r1) /* 8027A1F8 00277158 90 01 00 24 */ stw r0, 0x24(r1) /* 8027A1FC 0027715C 91 81 00 28 */ stw r12, 0x28(r1) -/* 8027A200 00277160 4B F9 B4 99 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 8027A200 00277160 4B F9 B4 99 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 8027A204 00277164 7C 7A 1B 78 */ mr r26, r3 lbl_8027A208: /* 8027A208 00277168 7E A0 07 75 */ extsb. r0, r21 diff --git a/asm/MetroidPrime/Enemies/CMetroidPrimeProjectile.s b/asm/MetroidPrime/Enemies/CMetroidPrimeProjectile.s index d9f2f420..5ddfb30d 100644 --- a/asm/MetroidPrime/Enemies/CMetroidPrimeProjectile.s +++ b/asm/MetroidPrime/Enemies/CMetroidPrimeProjectile.s @@ -3,8 +3,8 @@ .section .data .balign 8 -.global lbl_803EC390 -lbl_803EC390: +.global __vt__23CMetroidPrimeProjectile +__vt__23CMetroidPrimeProjectile: # ROM: 0x3E9390 .4byte 0 .4byte 0 @@ -49,9 +49,9 @@ __dt__23CMetroidPrimeProjectileFv: /* 802A034C 0029D2AC 93 C1 00 08 */ stw r30, 8(r1) /* 802A0350 0029D2B0 7C 7E 1B 79 */ or. r30, r3, r3 /* 802A0354 0029D2B4 41 82 00 44 */ beq lbl_802A0398 -/* 802A0358 0029D2B8 3C 60 80 3F */ lis r3, lbl_803EC390@ha +/* 802A0358 0029D2B8 3C 60 80 3F */ lis r3, __vt__23CMetroidPrimeProjectile@ha /* 802A035C 0029D2BC 34 1E 03 D8 */ addic. r0, r30, 0x3d8 -/* 802A0360 0029D2C0 38 03 C3 90 */ addi r0, r3, lbl_803EC390@l +/* 802A0360 0029D2C0 38 03 C3 90 */ addi r0, r3, __vt__23CMetroidPrimeProjectile@l /* 802A0364 0029D2C4 90 1E 00 00 */ stw r0, 0(r30) /* 802A0368 0029D2C8 41 82 00 14 */ beq lbl_802A037C /* 802A036C 0029D2CC 34 7E 03 DC */ addic. r3, r30, 0x3dc @@ -282,8 +282,8 @@ Accept__23CMetroidPrimeProjectileFR8IVisitor: /* 802A06BC 0029D61C 38 21 00 10 */ addi r1, r1, 0x10 /* 802A06C0 0029D620 4E 80 00 20 */ blr -.global "__ct__23CMetroidPrimeProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueIdUi9TUniqueIdUiRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" -"__ct__23CMetroidPrimeProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueIdUi9TUniqueIdUiRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb": +.global "__ct__23CMetroidPrimeProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueIdRC20SPrimeProjectileInfo9TUniqueIdUiRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" +"__ct__23CMetroidPrimeProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueIdRC20SPrimeProjectileInfo9TUniqueIdUiRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb": /* 802A06C4 0029D624 94 21 FF A0 */ stwu r1, -0x60(r1) /* 802A06C8 0029D628 7C 08 02 A6 */ mflr r0 /* 802A06CC 0029D62C 90 01 00 64 */ stw r0, 0x64(r1) @@ -320,10 +320,10 @@ Accept__23CMetroidPrimeProjectileFR8IVisitor: /* 802A0748 0029D6A8 93 41 00 20 */ stw r26, 0x20(r1) /* 802A074C 0029D6AC 93 61 00 24 */ stw r27, 0x24(r1) /* 802A0750 0029D6B0 93 81 00 28 */ stw r28, 0x28(r1) -/* 802A0754 0029D6B4 4B F7 4F 45 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" -/* 802A0758 0029D6B8 3C 80 80 3F */ lis r4, lbl_803EC390@ha +/* 802A0754 0029D6B4 4B F7 4F 45 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" +/* 802A0758 0029D6B8 3C 80 80 3F */ lis r4, __vt__23CMetroidPrimeProjectile@ha /* 802A075C 0029D6BC 38 7F 03 DC */ addi r3, r31, 0x3dc -/* 802A0760 0029D6C0 38 04 C3 90 */ addi r0, r4, lbl_803EC390@l +/* 802A0760 0029D6C0 38 04 C3 90 */ addi r0, r4, __vt__23CMetroidPrimeProjectile@l /* 802A0764 0029D6C4 38 9D 00 04 */ addi r4, r29, 4 /* 802A0768 0029D6C8 90 1F 00 00 */ stw r0, 0(r31) /* 802A076C 0029D6CC 80 1D 00 00 */ lwz r0, 0(r29) diff --git a/asm/MetroidPrime/Enemies/CPatterned.s b/asm/MetroidPrime/Enemies/CPatterned.s index 1f54e47a..4e7c0d09 100644 --- a/asm/MetroidPrime/Enemies/CPatterned.s +++ b/asm/MetroidPrime/Enemies/CPatterned.s @@ -1156,7 +1156,7 @@ lbl_80077AFC: /* 80077BA4 00074B04 93 61 00 20 */ stw r27, 0x20(r1) /* 80077BA8 00074B08 93 81 00 24 */ stw r28, 0x24(r1) /* 80077BAC 00074B0C 93 A1 00 28 */ stw r29, 0x28(r1) -/* 80077BB0 00074B10 48 19 DA E9 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 80077BB0 00074B10 48 19 DA E9 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 80077BB4 00074B14 7C 7F 1B 78 */ mr r31, r3 lbl_80077BB8: /* 80077BB8 00074B18 28 1F 00 00 */ cmplwi r31, 0 diff --git a/asm/MetroidPrime/Enemies/CPuddleSpore.s b/asm/MetroidPrime/Enemies/CPuddleSpore.s index 7c83d2a7..159299f7 100644 --- a/asm/MetroidPrime/Enemies/CPuddleSpore.s +++ b/asm/MetroidPrime/Enemies/CPuddleSpore.s @@ -1453,7 +1453,7 @@ lbl_80147AB0: /* 80147C18 00144B78 91 61 00 20 */ stw r11, 0x20(r1) /* 80147C1C 00144B7C 90 01 00 24 */ stw r0, 0x24(r1) /* 80147C20 00144B80 93 21 00 28 */ stw r25, 0x28(r1) -/* 80147C24 00144B84 48 0C DA 75 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 80147C24 00144B84 48 0C DA 75 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 80147C28 00144B88 7C 7F 1B 78 */ mr r31, r3 lbl_80147C2C: /* 80147C2C 00144B8C 7F 40 07 75 */ extsb. r0, r26 diff --git a/asm/MetroidPrime/Enemies/CRidley.s b/asm/MetroidPrime/Enemies/CRidley.s index 67b5b48c..044db843 100644 --- a/asm/MetroidPrime/Enemies/CRidley.s +++ b/asm/MetroidPrime/Enemies/CRidley.s @@ -7386,7 +7386,7 @@ lbl_80258578: /* 80258754 002556B4 91 61 00 20 */ stw r11, 0x20(r1) /* 80258758 002556B8 90 01 00 24 */ stw r0, 0x24(r1) /* 8025875C 002556BC 93 01 00 28 */ stw r24, 0x28(r1) -/* 80258760 002556C0 4B FB CF 39 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 80258760 002556C0 4B FB CF 39 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 80258764 002556C4 7C 7B 1B 78 */ mr r27, r3 lbl_80258768: /* 80258768 002556C8 7F 40 07 75 */ extsb. r0, r26 @@ -7570,7 +7570,7 @@ lbl_80258828: /* 80258A10 00255970 91 61 00 20 */ stw r11, 0x20(r1) /* 80258A14 00255974 90 01 00 24 */ stw r0, 0x24(r1) /* 80258A18 00255978 93 01 00 28 */ stw r24, 0x28(r1) -/* 80258A1C 0025597C 4B FB CC 7D */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 80258A1C 0025597C 4B FB CC 7D */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 80258A20 00255980 7C 7B 1B 78 */ mr r27, r3 lbl_80258A24: /* 80258A24 00255984 7F 20 07 75 */ extsb. r0, r25 diff --git a/asm/MetroidPrime/ScriptObjects/CScriptGunTurret.s b/asm/MetroidPrime/ScriptObjects/CScriptGunTurret.s index 10719063..5dcf5a2f 100644 --- a/asm/MetroidPrime/ScriptObjects/CScriptGunTurret.s +++ b/asm/MetroidPrime/ScriptObjects/CScriptGunTurret.s @@ -2305,7 +2305,7 @@ lbl_802176A0: /* 8021777C 002146DC 90 01 00 20 */ stw r0, 0x20(r1) /* 80217780 002146E0 93 81 00 24 */ stw r28, 0x24(r1) /* 80217784 002146E4 91 81 00 28 */ stw r12, 0x28(r1) -/* 80217788 002146E8 4B FF DF 11 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 80217788 002146E8 4B FF DF 11 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 8021778C 002146EC 7C 7D 1B 78 */ mr r29, r3 lbl_80217790: /* 80217790 002146F0 28 1D 00 00 */ cmplwi r29, 0 diff --git a/asm/MetroidPrime/Weapons/CAuxWeapon.s b/asm/MetroidPrime/Weapons/CAuxWeapon.s index 9bdff9cf..c0f6e634 100644 --- a/asm/MetroidPrime/Weapons/CAuxWeapon.s +++ b/asm/MetroidPrime/Weapons/CAuxWeapon.s @@ -654,7 +654,7 @@ lbl_801B919C: /* 801B91F0 001B6150 91 C1 00 20 */ stw r14, 0x20(r1) /* 801B91F4 001B6154 91 61 00 24 */ stw r11, 0x24(r1) /* 801B91F8 001B6158 90 01 00 28 */ stw r0, 0x28(r1) -/* 801B91FC 001B615C 48 05 C4 9D */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 801B91FC 001B615C 48 05 C4 9D */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 801B9200 001B6160 7C 75 1B 78 */ mr r21, r3 lbl_801B9204: /* 801B9204 001B6164 7F 00 07 75 */ extsb. r0, r24 diff --git a/asm/MetroidPrime/Weapons/CEnergyProjectile.s b/asm/MetroidPrime/Weapons/CEnergyProjectile.s index b0212cfa..2625fa29 100644 --- a/asm/MetroidPrime/Weapons/CEnergyProjectile.s +++ b/asm/MetroidPrime/Weapons/CEnergyProjectile.s @@ -1949,8 +1949,8 @@ lbl_80215680: /* 80215690 002125F0 38 21 00 20 */ addi r1, r1, 0x20 /* 80215694 002125F4 4E 80 00 20 */ blr -.global "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" -"__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb": +.global "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" +"__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb": /* 80215698 002125F8 94 21 FE 90 */ stwu r1, -0x170(r1) /* 8021569C 002125FC 7C 08 02 A6 */ mflr r0 /* 802156A0 00212600 3D 60 80 3D */ lis r11, lbl_803D2890@ha diff --git a/asm/MetroidPrime/Weapons/CGunWeapon.s b/asm/MetroidPrime/Weapons/CGunWeapon.s index 80a51cf3..b4970685 100644 --- a/asm/MetroidPrime/Weapons/CGunWeapon.s +++ b/asm/MetroidPrime/Weapons/CGunWeapon.s @@ -2181,7 +2181,7 @@ lbl_801BB9CC: /* 801BBA90 001B89F0 90 01 00 28 */ stw r0, 0x28(r1) /* 801BBA94 001B89F4 80 D7 01 C0 */ lwz r6, 0x1c0(r23) /* 801BBA98 001B89F8 81 17 01 C8 */ lwz r8, 0x1c8(r23) -/* 801BBA9C 001B89FC 48 05 9B FD */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 801BBA9C 001B89FC 48 05 9B FD */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 801BBAA0 001B8A00 7C 7E 1B 78 */ mr r30, r3 lbl_801BBAA4: /* 801BBAA4 001B8A04 7E C0 07 75 */ extsb. r0, r22 diff --git a/asm/MetroidPrime/Weapons/CTargetableProjectile.s b/asm/MetroidPrime/Weapons/CTargetableProjectile.s index f772ca90..dabf67f8 100644 --- a/asm/MetroidPrime/Weapons/CTargetableProjectile.s +++ b/asm/MetroidPrime/Weapons/CTargetableProjectile.s @@ -430,7 +430,7 @@ Think__21CTargetableProjectileFfR13CStateManager: /* 8013BE08 00138D68 91 61 00 20 */ stw r11, 0x20(r1) /* 8013BE0C 00138D6C 90 01 00 24 */ stw r0, 0x24(r1) /* 8013BE10 00138D70 93 41 00 28 */ stw r26, 0x28(r1) -/* 8013BE14 00138D74 48 0D 98 85 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 8013BE14 00138D74 48 0D 98 85 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 8013BE18 00138D78 7C 7F 1B 78 */ mr r31, r3 lbl_8013BE1C: /* 8013BE1C 00138D7C 7F 60 07 75 */ extsb. r0, r27 @@ -548,7 +548,7 @@ Accept__21CTargetableProjectileFR8IVisitor: /* 8013BFB8 00138F18 91 61 00 20 */ stw r11, 0x20(r1) /* 8013BFBC 00138F1C 90 01 00 24 */ stw r0, 0x24(r1) /* 8013BFC0 00138F20 93 A1 00 28 */ stw r29, 0x28(r1) -/* 8013BFC4 00138F24 48 0D 96 D5 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 8013BFC4 00138F24 48 0D 96 D5 */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 8013BFC8 00138F28 3C 60 80 3E */ lis r3, lbl_803E1800@ha /* 8013BFCC 00138F2C 7F C4 F3 78 */ mr r4, r30 /* 8013BFD0 00138F30 38 03 18 00 */ addi r0, r3, lbl_803E1800@l diff --git a/asm/MetroidPrime/Weapons/CWaveBeam.s b/asm/MetroidPrime/Weapons/CWaveBeam.s index 1837d755..0c5e203d 100644 --- a/asm/MetroidPrime/Weapons/CWaveBeam.s +++ b/asm/MetroidPrime/Weapons/CWaveBeam.s @@ -466,7 +466,7 @@ lbl_800E04E4: /* 800E0610 000DD570 91 81 00 20 */ stw r12, 0x20(r1) /* 800E0614 000DD574 91 61 00 24 */ stw r11, 0x24(r1) /* 800E0618 000DD578 90 01 00 28 */ stw r0, 0x28(r1) -/* 800E061C 000DD57C 48 13 50 7D */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" +/* 800E061C 000DD57C 48 13 50 7D */ bl "__ct__17CEnergyProjectileFbRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb" /* 800E0620 000DD580 7C 7D 1B 78 */ mr r29, r3 lbl_800E0624: /* 800E0624 000DD584 7E 40 07 75 */ extsb. r0, r18 diff --git a/configure.py b/configure.py index 9c5d7b01..36c5b033 100755 --- a/configure.py +++ b/configure.py @@ -389,7 +389,7 @@ LIBS = [ "MetroidPrime/CGameCubeDoll", "MetroidPrime/ScriptObjects/CScriptProjectedShadow", "MetroidPrime/ScriptObjects/CEnergyBall", - "MetroidPrime/Enemies/CMetroidPrimeProjectile", + ["MetroidPrime/Enemies/CMetroidPrimeProjectile", False], ["MetroidPrime/Enemies/SPositionHistory", True], ], }, diff --git a/include/MetroidPrime/Enemies/CMetroidPrimeProjectile.hpp b/include/MetroidPrime/Enemies/CMetroidPrimeProjectile.hpp new file mode 100644 index 00000000..487d9571 --- /dev/null +++ b/include/MetroidPrime/Enemies/CMetroidPrimeProjectile.hpp @@ -0,0 +1,53 @@ +#ifndef _CMETROIDPRIMEPROJECTILE +#define _CMETROIDPRIMEPROJECTILE + +#include "MetroidPrime/Weapons/CEnergyProjectile.hpp" + +struct SPrimeProjectileInfo { + uint x0_propertyCount; + TToken< CGenDescription > x4_particle; + CDamageInfo xc_dInfo; + float x28_; + float x2c_; + float x30_; + CAssetId x34_texture; + bool x38_24_ : 1; + bool x38_25_ : 1; + bool x38_26_ : 1; + bool x38_27_ : 1; + explicit SPrimeProjectileInfo(CInputStream& in); + + const CDamageInfo& GetDamageInfo() const { return xc_dInfo; } + float Get_0x28() const { return x28_; } + float Get_0x2c() const { return x2c_; } + float Get_0x30() const { return x30_; } + CAssetId GetTexture() const { return x34_texture; } + bool GetFlag_24() const { return x38_24_; } + bool GetFlag_25() const { return x38_25_; } + bool GetFlag_26() const { return x38_26_; } + bool GetFlag_27() const { return x38_27_; } +}; +CHECK_SIZEOF(SPrimeProjectileInfo, 60); + +class CMetroidPrimeProjectile : public CEnergyProjectile { + SPrimeProjectileInfo x3d8_auxData; + +public: + CMetroidPrimeProjectile( + bool active, const TToken< CWeaponDescription >& desc, EWeaponType type, + const CTransform4f& xf, EMaterialTypes materials, const CDamageInfo& damage, TUniqueId uid, + TAreaId aid, TUniqueId owner, const SPrimeProjectileInfo& auxData, TUniqueId homingTarget, + uint attribs, const CVector3f& scale, + const rstl::optional_object< TLockedToken< CGenDescription > >& visorParticle, ushort visorSfx, + bool sendCollideMsg); + + // CEntity + ~CMetroidPrimeProjectile() override; + void Accept(IVisitor& visitor) override; + + // CEnergyProjectile + bool Explode(const CVector3f& pos, const CVector3f& normal, EWeaponCollisionResponseTypes type, + CStateManager& mgr, const CDamageVulnerability& dVuln, TUniqueId hitActor) override; +}; + +#endif // _CMETROIDPRIMEPROJECTILE diff --git a/include/MetroidPrime/Weapons/CEnergyProjectile.hpp b/include/MetroidPrime/Weapons/CEnergyProjectile.hpp index e9b4dc58..aa77efed 100644 --- a/include/MetroidPrime/Weapons/CEnergyProjectile.hpp +++ b/include/MetroidPrime/Weapons/CEnergyProjectile.hpp @@ -11,7 +11,12 @@ class CEnergyProjectile : public CGameProjectile { public: - // TODO ctor + CEnergyProjectile(bool active, const TToken< CWeaponDescription >& desc, EWeaponType type, + const CTransform4f& xf, EMaterialTypes excludeMat, const CDamageInfo& damage, + TUniqueId uid, TAreaId aid, TUniqueId owner, TUniqueId homingTarget, + uint attribs, bool underwater, const CVector3f& scale, + const rstl::optional_object< TLockedToken< CGenDescription > >& visorParticle, + ushort visorSfx, bool sendCollideMsg); // CEntity ~CEnergyProjectile() override; diff --git a/include/MetroidPrime/Weapons/CGameProjectile.hpp b/include/MetroidPrime/Weapons/CGameProjectile.hpp index e8f60d5f..13a3a1f0 100644 --- a/include/MetroidPrime/Weapons/CGameProjectile.hpp +++ b/include/MetroidPrime/Weapons/CGameProjectile.hpp @@ -35,7 +35,7 @@ public: const CVector3f& GetPreviousPos() const { return x298_previousPos; } TUniqueId GetHomingTargetId() const { return x2c0_homingTargetId; } -private: +protected: rstl::optional_object< TLockedToken< CGenDescription > > x158_visorParticle; ushort x168_visorSfx; CProjectileWeapon x170_projectile; diff --git a/src/MetroidPrime/Enemies/CMetroidPrimeProjectile.cpp b/src/MetroidPrime/Enemies/CMetroidPrimeProjectile.cpp new file mode 100644 index 00000000..288ee301 --- /dev/null +++ b/src/MetroidPrime/Enemies/CMetroidPrimeProjectile.cpp @@ -0,0 +1,63 @@ +#include "MetroidPrime/Enemies/CMetroidPrimeProjectile.hpp" + +#include "MetroidPrime/ScriptObjects/CFire.hpp" + +#include "Kyoto/Math/CAABox.hpp" +#include "Kyoto/Streams/CInputStream.hpp" + +CMetroidPrimeProjectile::CMetroidPrimeProjectile( + bool active, const TToken< CWeaponDescription >& desc, EWeaponType type, const CTransform4f& xf, + EMaterialTypes materials, const CDamageInfo& damage, TUniqueId uid, TAreaId aid, + TUniqueId owner, const SPrimeProjectileInfo& auxData, TUniqueId homingTarget, uint attribs, + const CVector3f& scale, + const rstl::optional_object< TLockedToken< CGenDescription > >& visorParticle, ushort visorSfx, + bool sendCollideMsg) +: CEnergyProjectile(active, desc, type, xf, materials, damage, uid, aid, owner, homingTarget, + attribs, false, scale, visorParticle, visorSfx, sendCollideMsg) +, x3d8_auxData(auxData) {} + +void CMetroidPrimeProjectile::Accept(IVisitor& visitor) override { visitor.Visit(*this); } + +// CEnergyProjectile +bool CMetroidPrimeProjectile::Explode(const CVector3f& pos, const CVector3f& normal, + EWeaponCollisionResponseTypes type, CStateManager& mgr, + const CDamageVulnerability& dVuln, + TUniqueId hitActor) override { + + bool result = CEnergyProjectile::Explode(pos, normal, type, mgr, dVuln, hitActor); + if (!x2e4_24_active) { + TUniqueId newId(mgr.AllocateUniqueId()); + + CAABox box( + CAABox(CVector3f(-1.f, -1.f, -1.f), CVector3f(1.f, 1.f, 1.f)) + .GetTransformedAABox(GetTransform() * + CTransform4f::Scale(x3d8_auxData.GetDamageInfo().GetRadius()))); + + CFire* fire = + new CFire(x3d8_auxData.x4_particle, newId, GetCurrentAreaId(), true, GetUniqueId(), + GetTransform(), x3d8_auxData.GetDamageInfo(), box, CVector3f(1.f, 1.f, 1.f), + x3d8_auxData.GetFlag_27(), x3d8_auxData.GetTexture(), x3d8_auxData.GetFlag_24(), + x3d8_auxData.GetFlag_25(), x3d8_auxData.GetFlag_26(), 1.0, + x3d8_auxData.Get_0x28(), x3d8_auxData.Get_0x2c(), x3d8_auxData.Get_0x30()); + if (fire) { + mgr.AddObject(fire); + } + } + return result; +} + +SPrimeProjectileInfo::SPrimeProjectileInfo(CInputStream& in) +: x0_propertyCount(in.ReadLong()) +, x4_particle(gpSimplePool->GetObj(SObjectTag('PART', in.ReadLong()))) +, xc_dInfo(in) +, x28_(in.ReadFloat()) +, x2c_(in.ReadFloat()) +, x30_(in.ReadFloat()) +, x34_texture(in.ReadLong()) { + x38_24_ = in.ReadBool(); + x38_25_ = in.ReadBool(); + x38_26_ = in.ReadBool(); + x38_27_ = in.ReadBool(); +} + +CMetroidPrimeProjectile::~CMetroidPrimeProjectile() override {}