diff --git a/include/Kyoto/Particles/CElementGen.hpp b/include/Kyoto/Particles/CElementGen.hpp index a1852b5b..1d959519 100644 --- a/include/Kyoto/Particles/CElementGen.hpp +++ b/include/Kyoto/Particles/CElementGen.hpp @@ -13,6 +13,10 @@ public: static void Initialize(); static void ShutDown(); + +private: + u8 x0_pad[0x340]; }; +CHECK_SIZEOF(CElementGen, 0x340) #endif diff --git a/include/MetroidPrime/CRainSplashGenerator.hpp b/include/MetroidPrime/CRainSplashGenerator.hpp new file mode 100644 index 00000000..81354130 --- /dev/null +++ b/include/MetroidPrime/CRainSplashGenerator.hpp @@ -0,0 +1,18 @@ +#ifndef _CRAINSPLASHGENERATOR_HPP +#define _CRAINSPLASHGENERATOR_HPP + +#include "types.h" + +class CVector3f; + +class CRainSplashGenerator { +public: + CRainSplashGenerator(const CVector3f& scale, int maxSplashes, int genRate, float minZ, + float alpha); + +private: + u8 x0_pad[0x4c]; +}; +CHECK_SIZEOF(CRainSplashGenerator, 0x4c) + +#endif // _CRAINSPLASHGENERATOR_HPP diff --git a/include/MetroidPrime/CWorldShadow.hpp b/include/MetroidPrime/CWorldShadow.hpp new file mode 100644 index 00000000..1b32295e --- /dev/null +++ b/include/MetroidPrime/CWorldShadow.hpp @@ -0,0 +1,30 @@ +#ifndef _CWORLDSHADOW_HPP +#define _CWORLDSHADOW_HPP + +#include "MetroidPrime/TGameTypes.hpp" + +#include "Kyoto/Math/CVector3f.hpp" +#include "Kyoto/Math/CTransform4f.hpp" + +#include "rstl/single_ptr.hpp" + +class CTexture; + +class CWorldShadow { + rstl::single_ptr x0_texture; + CTransform4f x4_view; + CTransform4f x34_model; + float x64_objHalfExtent; + CVector3f x68_objPos; + CVector3f x74_lightPos; + TAreaId x80_aid; + s32 x84_lightIdx; + bool x88_blurReset; + +public: + CWorldShadow(uint w, uint h, bool rgba8); +}; +CHECK_SIZEOF(CWorldShadow, 0x8c) + + +#endif // _CWORLDSHADOW_HPP diff --git a/include/MetroidPrime/Player/CFidget.hpp b/include/MetroidPrime/Player/CFidget.hpp index f8607b31..f589b537 100644 --- a/include/MetroidPrime/Player/CFidget.hpp +++ b/include/MetroidPrime/Player/CFidget.hpp @@ -53,6 +53,8 @@ private: bool x34_24_loading : 1; public: + CFidget(); + EState GetState() const { return x0_state; } SamusGun::EFidgetType GetType() const { return x4_type; } int GetAnimSet() const { return xc_animSet; } diff --git a/include/MetroidPrime/Player/CGrappleArm.hpp b/include/MetroidPrime/Player/CGrappleArm.hpp new file mode 100644 index 00000000..7ec7bae1 --- /dev/null +++ b/include/MetroidPrime/Player/CGrappleArm.hpp @@ -0,0 +1,17 @@ +#ifndef _CGRAPPLEARM_HPP_ +#define _CGRAPPLEARM_HPP_ + +#include "types.h" + +class CVector3f; + +class CGrappleArm { +public: + CGrappleArm(const CVector3f& scale); + +private: + u8 x0_pad[0x3b4]; +}; +CHECK_SIZEOF(CGrappleArm, 0x3b4) + +#endif // _CGRAPPLEARM_HPP_ diff --git a/include/MetroidPrime/Player/CPlayerGun.hpp b/include/MetroidPrime/Player/CPlayerGun.hpp index 3c899afc..325a5349 100644 --- a/include/MetroidPrime/Player/CPlayerGun.hpp +++ b/include/MetroidPrime/Player/CPlayerGun.hpp @@ -123,8 +123,9 @@ private: kD_Done, }; - CGunMorph(float gunTransformTime, float holoHoldTime) - : x4_gunTransformTime(gunTransformTime), x10_holoHoldTime(fabs(holoHoldTime)) {} + CGunMorph(float gunTransformTime, float holoHoldTime); + // CGunMorph(float gunTransformTime, float holoHoldTime) + // : x4_gunTransformTime(gunTransformTime), x10_holoHoldTime(fabs(holoHoldTime)) {} EMorphEvent Update(float inY, float outY, float dt); void StartWipe(EDir dir); @@ -162,6 +163,18 @@ private: kFS_Firing, }; + CMotionState() + : x0_24_extendParabola(true) + , x4_extendParabolaDelayTimer(0.f) + , x8_fireTime(0.f) + , xc_curExtendDist(0.f) + , x10_curRotation(0.f) + , x14_rotationT(0.f) + , x18_startRotation(0.f) + , x1c_endRotation(0.f) + , x20_state(kMS_Zero) + , x24_fireState(kFS_NotFiring) {} + static void SetExtendDistance(float d) { kGunExtendDistance = d; } void SetState(EMotionState state) { x20_state = state; } @@ -315,6 +328,9 @@ private: bool x835_27_intoPhazonBeam : 1; bool x835_28_bombReady : 1; bool x835_29_powerBombReady : 1; + bool x835_30_inPhazonPool : 1; + bool x835_31_actorAttached : 1; + // bool x835_32_unk : 1; }; CHECK_SIZEOF(CPlayerGun, 0x838) diff --git a/include/MetroidPrime/Weapons/CAuxWeapon.hpp b/include/MetroidPrime/Weapons/CAuxWeapon.hpp new file mode 100644 index 00000000..69d5f177 --- /dev/null +++ b/include/MetroidPrime/Weapons/CAuxWeapon.hpp @@ -0,0 +1,15 @@ +#ifndef _CAUXWEAPON_HPP +#define _CAUXWEAPON_HPP + +#include "MetroidPrime/TGameTypes.hpp" + +class CAuxWeapon { +public: + explicit CAuxWeapon(TUniqueId playerId); + +private: + u8 x0_pad[0x84]; +}; +CHECK_SIZEOF(CAuxWeapon, 0x84) + +#endif // _CAUXWEAPON_HPP diff --git a/include/MetroidPrime/Weapons/CGunWeapon.hpp b/include/MetroidPrime/Weapons/CGunWeapon.hpp index 7d69b430..897f97cc 100644 --- a/include/MetroidPrime/Weapons/CGunWeapon.hpp +++ b/include/MetroidPrime/Weapons/CGunWeapon.hpp @@ -1,4 +1,6 @@ -#pragma once +// #pragma once +#ifndef _CGUNWEAPON_HPP_ +#define _CGUNWEAPON_HPP_ #include "types.h" @@ -41,6 +43,7 @@ private: class CGunWeapon { public: // TODO ctor + CGunWeapon(); virtual ~CGunWeapon(); // TODO other virtual methods @@ -57,6 +60,7 @@ public: }; private: + // x0 is vtable CVector3f x4_scale; rstl::optional_object< CModelData > x10_solidModelData; rstl::optional_object< CModelData > x60_holoModelData; @@ -64,6 +68,7 @@ private: rstl::single_ptr< CGunController > x100_gunController; TToken< CAnimCharacterSet > x104_gunCharacter; rstl::vector< CToken > x10c_anims; + rstl::vector< int > x11c_unk; rstl::vector< CToken > x12c_deps; TToken< CAnimCharacterSet > x13c_armCharacter; rstl::reserved_vector< TCachedToken< CWeaponDescription >, 2 > x144_weapons; @@ -71,6 +76,7 @@ private: 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; + u8 x1b0_pad[8]; rstl::single_ptr< CElementGen > x1b8_frozenGenerator; CRainSplashGenerator* x1bc_rainSplashGenerator; EWeaponType x1c0_weaponType; @@ -95,4 +101,6 @@ private: static const int skShootAnim[32]; }; -CHECK_SIZEOF(CGunWeapon, 0x218) +CHECK_SIZEOF(CGunWeapon, 0x21c) + +#endif diff --git a/include/MetroidPrime/Weapons/CIceBeam.hpp b/include/MetroidPrime/Weapons/CIceBeam.hpp new file mode 100644 index 00000000..ec6b6c49 --- /dev/null +++ b/include/MetroidPrime/Weapons/CIceBeam.hpp @@ -0,0 +1,16 @@ +#ifndef _CICEBEAM_HPP +#define _CICEBEAM_HPP + +#include "MetroidPrime/Weapons/CGunWeapon.hpp" + +class CIceBeam : public CGunWeapon { +public: + CIceBeam(CAssetId characterId, EWeaponType type, TUniqueId playerId, + EMaterialTypes playerMaterial, const CVector3f& scale); + +private: + u8 x21c_pad[0x30]; +}; +CHECK_SIZEOF(CIceBeam, 0x24c) + +#endif // _CICEBEAM_HPP diff --git a/include/MetroidPrime/Weapons/CPhazonBeam.hpp b/include/MetroidPrime/Weapons/CPhazonBeam.hpp new file mode 100644 index 00000000..e0386f04 --- /dev/null +++ b/include/MetroidPrime/Weapons/CPhazonBeam.hpp @@ -0,0 +1,16 @@ +#ifndef _CPHAZONBEAM_HPP +#define _CPHAZONBEAM_HPP + +#include "MetroidPrime/Weapons/CGunWeapon.hpp" + +class CPhazonBeam : public CGunWeapon { +public: + CPhazonBeam(CAssetId characterId, EWeaponType type, TUniqueId playerId, + EMaterialTypes playerMaterial, const CVector3f& scale); + +private: + u8 x21c_pad[0x60]; +}; +CHECK_SIZEOF(CPhazonBeam, 0x27c) + +#endif // _CPHAZONBEAM_HPP diff --git a/include/MetroidPrime/Weapons/CPlasmaBeam.hpp b/include/MetroidPrime/Weapons/CPlasmaBeam.hpp new file mode 100644 index 00000000..b57a7c3a --- /dev/null +++ b/include/MetroidPrime/Weapons/CPlasmaBeam.hpp @@ -0,0 +1,16 @@ +#ifndef _CPLASMABEAM_HPP +#define _CPLASMABEAM_HPP + +#include "MetroidPrime/Weapons/CGunWeapon.hpp" + +class CPlasmaBeam : public CGunWeapon { +public: + CPlasmaBeam(CAssetId characterId, EWeaponType type, TUniqueId playerId, + EMaterialTypes playerMaterial, const CVector3f& scale); + +private: + u8 x21c_pad[0x24]; +}; +CHECK_SIZEOF(CPlasmaBeam, 0x240) + +#endif // _CPLASMABEAM_HPP diff --git a/include/MetroidPrime/Weapons/CPowerBeam.hpp b/include/MetroidPrime/Weapons/CPowerBeam.hpp new file mode 100644 index 00000000..4029c960 --- /dev/null +++ b/include/MetroidPrime/Weapons/CPowerBeam.hpp @@ -0,0 +1,16 @@ +#ifndef _CPOWERBEAM_HPP +#define _CPOWERBEAM_HPP + +#include "MetroidPrime/Weapons/CGunWeapon.hpp" + +class CPowerBeam : public CGunWeapon { +public: + CPowerBeam(CAssetId characterId, EWeaponType type, TUniqueId playerId, + EMaterialTypes playerMaterial, const CVector3f& scale); + +private: + u8 x21c_pad[0x2C]; +}; +CHECK_SIZEOF(CPowerBeam, 0x248) + +#endif // _CPOWERBEAM_HPP diff --git a/include/MetroidPrime/Weapons/CWaveBeam.hpp b/include/MetroidPrime/Weapons/CWaveBeam.hpp new file mode 100644 index 00000000..63e5367b --- /dev/null +++ b/include/MetroidPrime/Weapons/CWaveBeam.hpp @@ -0,0 +1,16 @@ +#ifndef _CWAVEBEAM_HPP +#define _CWAVEBEAM_HPP + +#include "MetroidPrime/Weapons/CGunWeapon.hpp" + +class CWaveBeam : public CGunWeapon { +public: + CWaveBeam(CAssetId characterId, EWeaponType type, TUniqueId playerId, + EMaterialTypes playerMaterial, const CVector3f& scale); + +private: + u8 x21c_pad[0x40]; +}; +CHECK_SIZEOF(CWaveBeam, 0x25c) + +#endif // _CWAVEBEAM_HPP diff --git a/include/MetroidPrime/Weapons/GunController/CGunMotion.hpp b/include/MetroidPrime/Weapons/GunController/CGunMotion.hpp new file mode 100644 index 00000000..9a0da414 --- /dev/null +++ b/include/MetroidPrime/Weapons/GunController/CGunMotion.hpp @@ -0,0 +1,17 @@ +#ifndef _CGUNMOTION_HPP +#define _CGUNMOTION_HPP + +#include "Kyoto/CObjectReference.hpp" + +class CVector3f; + +class CGunMotion { +public: + CGunMotion(CAssetId ancsId, const CVector3f& scale); + +private: + u8 x0_pad[0xbc]; +}; +CHECK_SIZEOF(CGunMotion, 0xbc) + +#endif // _CGUNMOTION_HPP diff --git a/src/MetroidPrime/Player/CPlayerGun.cpp b/src/MetroidPrime/Player/CPlayerGun.cpp index 8fe67720..02b40833 100644 --- a/src/MetroidPrime/Player/CPlayerGun.cpp +++ b/src/MetroidPrime/Player/CPlayerGun.cpp @@ -1,8 +1,18 @@ #include "MetroidPrime/Player/CPlayerGun.hpp" #include "MetroidPrime/CAnimRes.hpp" +#include "MetroidPrime/CRainSplashGenerator.hpp" +#include "MetroidPrime/CWorldShadow.hpp" +#include "MetroidPrime/Player/CGrappleArm.hpp" #include "MetroidPrime/Tweaks/CTweakGunRes.hpp" #include "MetroidPrime/Tweaks/CTweakPlayerGun.hpp" +#include "MetroidPrime/Weapons/CAuxWeapon.hpp" +#include "MetroidPrime/Weapons/CIceBeam.hpp" +#include "MetroidPrime/Weapons/CPhazonBeam.hpp" +#include "MetroidPrime/Weapons/CPlasmaBeam.hpp" +#include "MetroidPrime/Weapons/CPowerBeam.hpp" +#include "MetroidPrime/Weapons/CWaveBeam.hpp" +#include "MetroidPrime/Weapons/GunController/CGunMotion.hpp" #include "MetroidPrime/Weapons/WeaponTypes.hpp" #include "Kyoto/Graphics/CModelFlags.hpp" @@ -164,7 +174,7 @@ CPlayerGun::CPlayerGun(TUniqueId playerId) , x398_damageAmt(0.f) , x39c_phazonMorphT(0.f) , x3a0_missileExitTimer(0.f) -, x3dc_damageLocation(0.f, 0.f, 0.f) +, x3dc_damageLocation(CVector3f::Zero()) , x3e8_xf(CTransform4f::Identity()) , x418_beamLocalXf(CTransform4f::Identity()) , x448_elbowWorldXf(CTransform4f::Identity()) @@ -184,6 +194,7 @@ CPlayerGun::CPlayerGun(TUniqueId playerId) , x668_aimVerticalSpeed(gpTweakPlayerGun->GetAimVerticalSpeed()) , x66c_aimHorizontalSpeed(gpTweakPlayerGun->GetAimHorizontalSpeed()) , x678_morph(gpTweakPlayerGun->GetGunTransformTime(), gpTweakPlayerGun->GetHoloHoldTime()) +, x6a0_motionState() , x6c8_hologramClipCube(CVector3f(-0.29329199f, 0.f, -0.2481945f), CVector3f(0.29329199f, 1.292392f, 0.2481945f)) , x6e0_rightHandModel(CAnimRes(gpTweakGunRes->xc_rightHand, 0, CVector3f(3.f, 3.f, 3.f), 0, true)) @@ -191,20 +202,23 @@ CPlayerGun::CPlayerGun(TUniqueId playerId) , x730_outgoingBeam(nullptr) , x734_loadingBeam(nullptr) , x738_nextBeam(nullptr) -// , x73c_gunMotion(new CGunMotion(gpTweakGunRes->x4_gunMotion, sGunScale)) -// , x740_grappleArm(new CGrappleArm(sGunScale)) -// , x744_auxWeapon(new CAuxWeapon(playerId)) -// , x748_rainSplashGenerator(new CRainSplashGenerator(sGunScale, 20, 2, 0.f, 0.125f)) -// , x74c_powerBeam(new CPowerBeam(gpTweakGunRes->x10_powerBeam, kWT_Power, playerId, kMT_Player, -// sGunScale)) , x750_iceBeam(new CIceBeam(gpTweakGunRes->x14_iceBeam, kWT_Ice, playerId, -// kMT_Player, sGunScale)) , x754_waveBeam(new CWaveBeam(gpTweakGunRes->x18_waveBeam, kWT_Wave, -// playerId, kMT_Player, sGunScale)) , x758_plasmaBeam(new -// CPlasmaBeam(gpTweakGunRes->x1c_plasmaBeam, kWT_Plasma, playerId, kMT_Player, sGunScale)) , -// x75c_phazonBeam(new CPhazonBeam(gpTweakGunRes->x20_phazonBeam, kWT_Phazon, playerId, kMT_Player, -// sGunScale)) +, x73c_gunMotion(new CGunMotion(gpTweakGunRes->x4_gunMotion, sGunScale)) +, x740_grappleArm(new CGrappleArm(sGunScale)) +, x744_auxWeapon(new CAuxWeapon(playerId)) +, x748_rainSplashGenerator(new CRainSplashGenerator(sGunScale, 20, 2, 0.f, 0.125f)) +, x74c_powerBeam( + new CPowerBeam(gpTweakGunRes->x10_powerBeam, kWT_Power, playerId, kMT_Player, sGunScale)) +, x750_iceBeam(new CIceBeam(gpTweakGunRes->x14_iceBeam, kWT_Ice, playerId, kMT_Player, sGunScale)) +, x754_waveBeam( + new CWaveBeam(gpTweakGunRes->x18_waveBeam, kWT_Wave, playerId, kMT_Player, sGunScale)) +, x758_plasmaBeam( + new CPlasmaBeam(gpTweakGunRes->x1c_plasmaBeam, kWT_Plasma, playerId, kMT_Player, sGunScale)) +, x75c_phazonBeam( + new CPhazonBeam(gpTweakGunRes->x20_phazonBeam, kWT_Phazon, playerId, kMT_Player, sGunScale)) +, x760_selectableBeams(nullptr) , x774_holoTransitionGen( new CElementGen(gpSimplePool->GetObj(SObjectTag('PART', gpTweakGunRes->x24_holoTransition)))) -// , x82c_shadow(new CWorldShadow(256, 256, true)) +, x82c_shadow(new CWorldShadow(32, 32, true)) , x830_chargeRumbleHandle(-1) , x832_24_coolingCharge(false) , x832_25_chargeEffectVisible(false) @@ -236,10 +250,10 @@ CPlayerGun::CPlayerGun(TUniqueId playerId) , x835_27_intoPhazonBeam(false) , x835_28_bombReady(false) , x835_29_powerBombReady(false) -// , x835_30_inPhazonPool(false) -// , x835_31_actorAttached(false) -{ +, x835_30_inPhazonPool(false) +, x835_31_actorAttached(false) { + x6e0_rightHandModel.SetSortThermal(true); kVerticalAngleTable[2] = gpTweakPlayerGun->GetUpLookAngle(); kVerticalAngleTable[0] = gpTweakPlayerGun->GetDownLookAngle(); kHorizontalAngleTable[1] = gpTweakPlayerGun->GetHorizontalSpread();