From 07ea1b3d0a920f78b5288fa580cb8745bf65b9ac Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Fri, 25 Nov 2022 22:52:18 +0200 Subject: [PATCH] Fix build --- asm/MetroidPrime/Weapons/CGunWeapon.s | 8 ++-- .../Kyoto/Animation/CVertexMorphEffect.hpp | 26 +++++++++++++ include/Kyoto/CDependencyGroup.hpp | 21 +++++++++++ include/MetroidPrime/Weapons/WeaponCommon.hpp | 2 +- src/MetroidPrime/Weapons/CGunWeapon.cpp | 37 +++++++++---------- 5 files changed, 70 insertions(+), 24 deletions(-) create mode 100644 include/Kyoto/Animation/CVertexMorphEffect.hpp create mode 100644 include/Kyoto/CDependencyGroup.hpp diff --git a/asm/MetroidPrime/Weapons/CGunWeapon.s b/asm/MetroidPrime/Weapons/CGunWeapon.s index ec390ecd..7e2649a5 100644 --- a/asm/MetroidPrime/Weapons/CGunWeapon.s +++ b/asm/MetroidPrime/Weapons/CGunWeapon.s @@ -3898,11 +3898,11 @@ __ct__10CGunWeaponFUi11EWeaponType9TUniqueId14EMaterialTypesRC9CVector3f: /* 801BD2BC 001BA21C 90 1E 01 44 */ stw r0, 0x144(r30) /* 801BD2C0 001BA220 48 00 01 29 */ bl GetWeaponIndex__F11EWeaponType /* 801BD2C4 001BA224 80 8D A0 64 */ lwz r4, gpSimplePool@sda21(r13) -/* 801BD2C8 001BA228 3C A0 80 3D */ lis r5, lbl_803D17A0@ha +/* 801BD2C8 001BA228 3C A0 80 3D */ lis r5, skBeamXferNames@ha /* 801BD2CC 001BA22C 54 60 10 3A */ slwi r0, r3, 2 /* 801BD2D0 001BA230 38 61 00 08 */ addi r3, r1, 8 /* 801BD2D4 001BA234 81 84 00 00 */ lwz r12, 0(r4) -/* 801BD2D8 001BA238 38 A5 17 A0 */ addi r5, r5, lbl_803D17A0@l +/* 801BD2D8 001BA238 38 A5 17 A0 */ addi r5, r5, skBeamXferNames@l /* 801BD2DC 001BA23C 7C A5 00 2E */ lwzx r5, r5, r0 /* 801BD2E0 001BA240 81 8C 00 10 */ lwz r12, 0x10(r12) /* 801BD2E4 001BA244 7D 89 03 A6 */ mtctr r12 @@ -4085,8 +4085,8 @@ skFrozenNames: .4byte lbl_803D18A7 .4byte lbl_803D189E -.global lbl_803D17A0 -lbl_803D17A0: +.global skBeamXferNames +skBeamXferNames: # ROM: 0x3CE7A0 .4byte lbl_803D18C9 .4byte lbl_803D18D3 diff --git a/include/Kyoto/Animation/CVertexMorphEffect.hpp b/include/Kyoto/Animation/CVertexMorphEffect.hpp new file mode 100644 index 00000000..ce0cd01d --- /dev/null +++ b/include/Kyoto/Animation/CVertexMorphEffect.hpp @@ -0,0 +1,26 @@ +#ifndef _CVERTEXMORPHEFFECT +#define _CVERTEXMORPHEFFECT + +#include "Kyoto/Math/CUnitVector3f.hpp" +#include "Kyoto/Math/CVector3f.hpp" + +#include "rstl/vector.hpp" + +class CRandom16; + +class CVertexMorphEffect { +public: + ~CVertexMorphEffect() {} + +private: + CUnitVector3f x0_dir; + CVector3f xc_pos; + float x18_duration; + float x1c_elapsed; + float x20_diagExtent; + CRandom16& x24_random; + rstl::vector< uint > x28_indices; + rstl::vector< float > x38_floats; +}; + +#endif // _CVERTEXMORPHEFFECT diff --git a/include/Kyoto/CDependencyGroup.hpp b/include/Kyoto/CDependencyGroup.hpp new file mode 100644 index 00000000..c391a7c6 --- /dev/null +++ b/include/Kyoto/CDependencyGroup.hpp @@ -0,0 +1,21 @@ +#ifndef _CDEPENDENCYGROUP +#define _CDEPENDENCYGROUP + +#include "Kyoto/SObjectTag.hpp" + +#include "rstl/vector.hpp" + +class CInputStream; + +class CDependencyGroup { +public: + explicit CDependencyGroup(CInputStream& in); + void ReadFromStream(CInputStream& in); + + const rstl::vector< SObjectTag >& GetObjectTagVector() const { return x0_objectTags; } + +private: + rstl::vector< SObjectTag > x0_objectTags; +}; + +#endif // _CDEPENDENCYGROUP diff --git a/include/MetroidPrime/Weapons/WeaponCommon.hpp b/include/MetroidPrime/Weapons/WeaponCommon.hpp index badba387..a7dc06f3 100644 --- a/include/MetroidPrime/Weapons/WeaponCommon.hpp +++ b/include/MetroidPrime/Weapons/WeaponCommon.hpp @@ -32,7 +32,7 @@ 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); +int get_current_suit(const CStateManager& mgr); } // namespace NWeaponTypes diff --git a/src/MetroidPrime/Weapons/CGunWeapon.cpp b/src/MetroidPrime/Weapons/CGunWeapon.cpp index e8174ad7..b19a47ea 100644 --- a/src/MetroidPrime/Weapons/CGunWeapon.cpp +++ b/src/MetroidPrime/Weapons/CGunWeapon.cpp @@ -52,7 +52,7 @@ const char* skSuitArmNames[] = { "FusionArm", "FusionArmG", "FusionArmV", "FusionArmP", }; -const int skAnimTypeList[] = { +int skAnimTypeList[] = { 0, 4, 1, 2, 3, 5, 6, 7, 8, 9, 10, }; @@ -75,11 +75,10 @@ CPlayerState::EBeamId GetWeaponIndex(EWeaponType type) { 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))])) +, x160_xferEffect(gpSimplePool->GetObj(skBeamXferNames[GetWeaponIndex(type)])) , x1bc_rainSplashGenerator(nullptr) , x1c0_weaponType(type) , x1c4_playerId(playerId) @@ -587,6 +586,20 @@ void CGunWeapon::LoadFxIdle(float dt, CStateManager& mgr) { } } +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::LockTokens(CStateManager& mgr) { AsyncLoadSuitArm(mgr); NWeaponTypes::lock_tokens(x12c_deps); @@ -628,22 +641,8 @@ 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); + int suit = NWeaponTypes::get_current_suit(mgr); xb0_suitArmModelData = rstl::optional_object_null(); x13c_armCharacter = gpSimplePool->GetObj(skSuitArmNames[suit]); x13c_armCharacter.Lock(); @@ -654,7 +653,7 @@ void CGunWeapon::LoadSuitArm(CStateManager& mgr) { if (!x13c_armCharacter.IsLoaded()) { return; } - CPlayerState::EPlayerSuit suit = NWeaponTypes::get_current_suit(mgr); + int 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);