From 2bd75275fe4bc59e3d7106d5d6f4055ae2b59018 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Fri, 7 Oct 2022 02:44:37 +0300 Subject: [PATCH] Match CGunMotion::LoadAnimations Former-commit-id: 8f1d21ac8329c07b0a847d91e986df9facd64091 --- asm/MetroidPrime/Player/CGrappleArm.s | 2 +- asm/MetroidPrime/Weapons/CGunWeapon.s | 2 +- asm/MetroidPrime/Weapons/GunController/CGunMotion.s | 3 +-- asm/MetroidPrime/Weapons/WeaponTypes.s | 4 ++-- include/MetroidPrime/Weapons/WeaponCommon.hpp | 6 ++++++ src/MetroidPrime/Weapons/GunController/CGunMotion.cpp | 5 ++++- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/asm/MetroidPrime/Player/CGrappleArm.s b/asm/MetroidPrime/Player/CGrappleArm.s index adf31ce4..9622feb8 100644 --- a/asm/MetroidPrime/Player/CGrappleArm.s +++ b/asm/MetroidPrime/Player/CGrappleArm.s @@ -1043,7 +1043,7 @@ LoadAnimations__11CGrappleArmFv: /* 8011E080 0011AFE0 7C 7F 1B 78 */ mr r31, r3 /* 8011E084 0011AFE4 38 DF 01 8C */ addi r6, r31, 0x18c /* 8011E088 0011AFE8 80 63 00 10 */ lwz r3, 0x10(r3) -/* 8011E08C 0011AFEC 48 16 D1 E1 */ bl "get_token_vector__12NWeaponTypesFR9CAnimDataiiRQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b" +/* 8011E08C 0011AFEC 48 16 D1 E1 */ bl "get_token_vector__12NWeaponTypesFRC9CAnimDataiiRQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b" /* 8011E090 0011AFF0 38 00 00 00 */ li r0, 0 /* 8011E094 0011AFF4 7F E3 FB 78 */ mr r3, r31 /* 8011E098 0011AFF8 98 01 00 54 */ stb r0, 0x54(r1) diff --git a/asm/MetroidPrime/Weapons/CGunWeapon.s b/asm/MetroidPrime/Weapons/CGunWeapon.s index b4da393d..9e3a288c 100644 --- a/asm/MetroidPrime/Weapons/CGunWeapon.s +++ b/asm/MetroidPrime/Weapons/CGunWeapon.s @@ -959,7 +959,7 @@ LoadAnimations__10CGunWeaponFv: /* 801BA9D8 001B7938 38 A0 00 0F */ li r5, 0xf /* 801BA9DC 001B793C 38 E0 00 01 */ li r7, 1 /* 801BA9E0 001B7940 80 63 00 20 */ lwz r3, 0x20(r3) -/* 801BA9E4 001B7944 48 0D 08 89 */ bl "get_token_vector__12NWeaponTypesFR9CAnimDataiiRQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b" +/* 801BA9E4 001B7944 48 0D 08 89 */ bl "get_token_vector__12NWeaponTypesFRC9CAnimDataiiRQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b" /* 801BA9E8 001B7948 80 01 00 14 */ lwz r0, 0x14(r1) /* 801BA9EC 001B794C 7C 08 03 A6 */ mtlr r0 /* 801BA9F0 001B7950 38 21 00 10 */ addi r1, r1, 0x10 diff --git a/asm/MetroidPrime/Weapons/GunController/CGunMotion.s b/asm/MetroidPrime/Weapons/GunController/CGunMotion.s index 7dc02c61..75d02802 100644 --- a/asm/MetroidPrime/Weapons/GunController/CGunMotion.s +++ b/asm/MetroidPrime/Weapons/GunController/CGunMotion.s @@ -13,7 +13,7 @@ LoadAnimations__10CGunMotionFv: /* 801D8F8C 001D5EEC 38 A0 00 0E */ li r5, 0xe /* 801D8F90 001D5EF0 38 E0 00 01 */ li r7, 1 /* 801D8F94 001D5EF4 80 63 00 10 */ lwz r3, 0x10(r3) -/* 801D8F98 001D5EF8 48 0B 22 D5 */ bl "get_token_vector__12NWeaponTypesFR9CAnimDataiiRQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b" +/* 801D8F98 001D5EF8 48 0B 22 D5 */ bl "get_token_vector__12NWeaponTypesFRC9CAnimDataiiRQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b" /* 801D8F9C 001D5EFC 80 01 00 14 */ lwz r0, 0x14(r1) /* 801D8FA0 001D5F00 7C 08 03 A6 */ mtlr r0 /* 801D8FA4 001D5F04 38 21 00 10 */ addi r1, r1, 0x10 @@ -568,4 +568,3 @@ lbl_805AC9B8: lbl_805AC9BC: # ROM: 0x3F925C .4byte 0 - diff --git a/asm/MetroidPrime/Weapons/WeaponTypes.s b/asm/MetroidPrime/Weapons/WeaponTypes.s index 12dd2f52..2317b4e1 100644 --- a/asm/MetroidPrime/Weapons/WeaponTypes.s +++ b/asm/MetroidPrime/Weapons/WeaponTypes.s @@ -620,8 +620,8 @@ lbl_8028B25C: /* 8028B264 002881C4 38 60 00 01 */ li r3, 1 /* 8028B268 002881C8 4E 80 00 20 */ blr -.global "get_token_vector__12NWeaponTypesFR9CAnimDataiiRQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b" -"get_token_vector__12NWeaponTypesFR9CAnimDataiiRQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b": +.global "get_token_vector__12NWeaponTypesFRC9CAnimDataiiRQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b" +"get_token_vector__12NWeaponTypesFRC9CAnimDataiiRQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b": /* 8028B26C 002881CC 94 21 FF 80 */ stwu r1, -0x80(r1) /* 8028B270 002881D0 7C 08 02 A6 */ mflr r0 /* 8028B274 002881D4 90 01 00 84 */ stw r0, 0x84(r1) diff --git a/include/MetroidPrime/Weapons/WeaponCommon.hpp b/include/MetroidPrime/Weapons/WeaponCommon.hpp index 8a7ddb06..7acff768 100644 --- a/include/MetroidPrime/Weapons/WeaponCommon.hpp +++ b/include/MetroidPrime/Weapons/WeaponCommon.hpp @@ -1,6 +1,11 @@ #ifndef _WEAPONCOMMON_HPP #define _WEAPONCOMMON_HPP +#include "rstl/vector.hpp" + +class CToken; +class CSfxHandle; + namespace NWeaponTypes { enum EGunAnimType { @@ -18,6 +23,7 @@ enum EGunAnimType { }; CSfxHandle play_sfx(u16 sfx, bool underwater, bool looped, short pan); +void get_token_vector(const CAnimData& animData, int begin, int end, rstl::vector& tokensOut, bool preLock); } diff --git a/src/MetroidPrime/Weapons/GunController/CGunMotion.cpp b/src/MetroidPrime/Weapons/GunController/CGunMotion.cpp index 26a725a2..f270661b 100644 --- a/src/MetroidPrime/Weapons/GunController/CGunMotion.cpp +++ b/src/MetroidPrime/Weapons/GunController/CGunMotion.cpp @@ -3,6 +3,7 @@ #include "MetroidPrime/CAnimData.hpp" #include "MetroidPrime/CAnimRes.hpp" #include "MetroidPrime/CStateManager.hpp" +#include "MetroidPrime/Weapons/WeaponCommon.hpp" #include "Kyoto/Animation/CPASAnimParmData.hpp" #include "Kyoto/Animation/CPASDatabase.hpp" @@ -98,4 +99,6 @@ void CGunMotion::EnterFidget(CStateManager& mgr, SamusGun::EFidgetType type, int x4c_gunController.EnterFidget(mgr, int(type), 0, parm2); } -void CGunMotion::LoadAnimations() {} +void CGunMotion::LoadAnimations() { + NWeaponTypes::get_token_vector(*x0_modelData.GetAnimationData(), 0, 14, xa8_anims, true); +}