Reasonably match CPlayerGun constructor

Former-commit-id: 72d07311fd
This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-06 13:38:13 +03:00
parent 3caccf5974
commit ba9faeb44c
15 changed files with 241 additions and 20 deletions

View File

@ -13,6 +13,10 @@ public:
static void Initialize(); static void Initialize();
static void ShutDown(); static void ShutDown();
private:
u8 x0_pad[0x340];
}; };
CHECK_SIZEOF(CElementGen, 0x340)
#endif #endif

View File

@ -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

View File

@ -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<CTexture> 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

View File

@ -53,6 +53,8 @@ private:
bool x34_24_loading : 1; bool x34_24_loading : 1;
public: public:
CFidget();
EState GetState() const { return x0_state; } EState GetState() const { return x0_state; }
SamusGun::EFidgetType GetType() const { return x4_type; } SamusGun::EFidgetType GetType() const { return x4_type; }
int GetAnimSet() const { return xc_animSet; } int GetAnimSet() const { return xc_animSet; }

View File

@ -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_

View File

@ -123,8 +123,9 @@ private:
kD_Done, kD_Done,
}; };
CGunMorph(float gunTransformTime, float holoHoldTime) CGunMorph(float gunTransformTime, float holoHoldTime);
: x4_gunTransformTime(gunTransformTime), x10_holoHoldTime(fabs(holoHoldTime)) {} // CGunMorph(float gunTransformTime, float holoHoldTime)
// : x4_gunTransformTime(gunTransformTime), x10_holoHoldTime(fabs(holoHoldTime)) {}
EMorphEvent Update(float inY, float outY, float dt); EMorphEvent Update(float inY, float outY, float dt);
void StartWipe(EDir dir); void StartWipe(EDir dir);
@ -162,6 +163,18 @@ private:
kFS_Firing, 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; } static void SetExtendDistance(float d) { kGunExtendDistance = d; }
void SetState(EMotionState state) { x20_state = state; } void SetState(EMotionState state) { x20_state = state; }
@ -315,6 +328,9 @@ private:
bool x835_27_intoPhazonBeam : 1; bool x835_27_intoPhazonBeam : 1;
bool x835_28_bombReady : 1; bool x835_28_bombReady : 1;
bool x835_29_powerBombReady : 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) CHECK_SIZEOF(CPlayerGun, 0x838)

View File

@ -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

View File

@ -1,4 +1,6 @@
#pragma once // #pragma once
#ifndef _CGUNWEAPON_HPP_
#define _CGUNWEAPON_HPP_
#include "types.h" #include "types.h"
@ -41,6 +43,7 @@ private:
class CGunWeapon { class CGunWeapon {
public: public:
// TODO ctor // TODO ctor
CGunWeapon();
virtual ~CGunWeapon(); virtual ~CGunWeapon();
// TODO other virtual methods // TODO other virtual methods
@ -57,6 +60,7 @@ public:
}; };
private: private:
// x0 is vtable
CVector3f x4_scale; CVector3f x4_scale;
rstl::optional_object< CModelData > x10_solidModelData; rstl::optional_object< CModelData > x10_solidModelData;
rstl::optional_object< CModelData > x60_holoModelData; rstl::optional_object< CModelData > x60_holoModelData;
@ -64,6 +68,7 @@ private:
rstl::single_ptr< CGunController > x100_gunController; rstl::single_ptr< CGunController > x100_gunController;
TToken< CAnimCharacterSet > x104_gunCharacter; TToken< CAnimCharacterSet > x104_gunCharacter;
rstl::vector< CToken > x10c_anims; rstl::vector< CToken > x10c_anims;
rstl::vector< int > x11c_unk;
rstl::vector< CToken > x12c_deps; rstl::vector< CToken > x12c_deps;
TToken< CAnimCharacterSet > x13c_armCharacter; TToken< CAnimCharacterSet > x13c_armCharacter;
rstl::reserved_vector< TCachedToken< CWeaponDescription >, 2 > x144_weapons; 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 > x16c_muzzleEffects;
rstl::reserved_vector< TCachedToken< CGenDescription >, 2 > x188_frozenEffects; rstl::reserved_vector< TCachedToken< CGenDescription >, 2 > x188_frozenEffects;
rstl::reserved_vector< rstl::single_ptr< CElementGen >, 2 > x1a4_muzzleGenerators; rstl::reserved_vector< rstl::single_ptr< CElementGen >, 2 > x1a4_muzzleGenerators;
u8 x1b0_pad[8];
rstl::single_ptr< CElementGen > x1b8_frozenGenerator; rstl::single_ptr< CElementGen > x1b8_frozenGenerator;
CRainSplashGenerator* x1bc_rainSplashGenerator; CRainSplashGenerator* x1bc_rainSplashGenerator;
EWeaponType x1c0_weaponType; EWeaponType x1c0_weaponType;
@ -95,4 +101,6 @@ private:
static const int skShootAnim[32]; static const int skShootAnim[32];
}; };
CHECK_SIZEOF(CGunWeapon, 0x218) CHECK_SIZEOF(CGunWeapon, 0x21c)
#endif

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,8 +1,18 @@
#include "MetroidPrime/Player/CPlayerGun.hpp" #include "MetroidPrime/Player/CPlayerGun.hpp"
#include "MetroidPrime/CAnimRes.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/CTweakGunRes.hpp"
#include "MetroidPrime/Tweaks/CTweakPlayerGun.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 "MetroidPrime/Weapons/WeaponTypes.hpp"
#include "Kyoto/Graphics/CModelFlags.hpp" #include "Kyoto/Graphics/CModelFlags.hpp"
@ -164,7 +174,7 @@ CPlayerGun::CPlayerGun(TUniqueId playerId)
, x398_damageAmt(0.f) , x398_damageAmt(0.f)
, x39c_phazonMorphT(0.f) , x39c_phazonMorphT(0.f)
, x3a0_missileExitTimer(0.f) , x3a0_missileExitTimer(0.f)
, x3dc_damageLocation(0.f, 0.f, 0.f) , x3dc_damageLocation(CVector3f::Zero())
, x3e8_xf(CTransform4f::Identity()) , x3e8_xf(CTransform4f::Identity())
, x418_beamLocalXf(CTransform4f::Identity()) , x418_beamLocalXf(CTransform4f::Identity())
, x448_elbowWorldXf(CTransform4f::Identity()) , x448_elbowWorldXf(CTransform4f::Identity())
@ -184,6 +194,7 @@ CPlayerGun::CPlayerGun(TUniqueId playerId)
, x668_aimVerticalSpeed(gpTweakPlayerGun->GetAimVerticalSpeed()) , x668_aimVerticalSpeed(gpTweakPlayerGun->GetAimVerticalSpeed())
, x66c_aimHorizontalSpeed(gpTweakPlayerGun->GetAimHorizontalSpeed()) , x66c_aimHorizontalSpeed(gpTweakPlayerGun->GetAimHorizontalSpeed())
, x678_morph(gpTweakPlayerGun->GetGunTransformTime(), gpTweakPlayerGun->GetHoloHoldTime()) , x678_morph(gpTweakPlayerGun->GetGunTransformTime(), gpTweakPlayerGun->GetHoloHoldTime())
, x6a0_motionState()
, x6c8_hologramClipCube(CVector3f(-0.29329199f, 0.f, -0.2481945f), , x6c8_hologramClipCube(CVector3f(-0.29329199f, 0.f, -0.2481945f),
CVector3f(0.29329199f, 1.292392f, 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)) , 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) , x730_outgoingBeam(nullptr)
, x734_loadingBeam(nullptr) , x734_loadingBeam(nullptr)
, x738_nextBeam(nullptr) , x738_nextBeam(nullptr)
// , x73c_gunMotion(new CGunMotion(gpTweakGunRes->x4_gunMotion, sGunScale)) , x73c_gunMotion(new CGunMotion(gpTweakGunRes->x4_gunMotion, sGunScale))
// , x740_grappleArm(new CGrappleArm(sGunScale)) , x740_grappleArm(new CGrappleArm(sGunScale))
// , x744_auxWeapon(new CAuxWeapon(playerId)) , x744_auxWeapon(new CAuxWeapon(playerId))
// , x748_rainSplashGenerator(new CRainSplashGenerator(sGunScale, 20, 2, 0.f, 0.125f)) , x748_rainSplashGenerator(new CRainSplashGenerator(sGunScale, 20, 2, 0.f, 0.125f))
// , x74c_powerBeam(new CPowerBeam(gpTweakGunRes->x10_powerBeam, kWT_Power, playerId, kMT_Player, , x74c_powerBeam(
// sGunScale)) , x750_iceBeam(new CIceBeam(gpTweakGunRes->x14_iceBeam, kWT_Ice, playerId, new CPowerBeam(gpTweakGunRes->x10_powerBeam, kWT_Power, playerId, kMT_Player, sGunScale))
// kMT_Player, sGunScale)) , x754_waveBeam(new CWaveBeam(gpTweakGunRes->x18_waveBeam, kWT_Wave, , x750_iceBeam(new CIceBeam(gpTweakGunRes->x14_iceBeam, kWT_Ice, playerId, kMT_Player, sGunScale))
// playerId, kMT_Player, sGunScale)) , x758_plasmaBeam(new , x754_waveBeam(
// CPlasmaBeam(gpTweakGunRes->x1c_plasmaBeam, kWT_Plasma, playerId, kMT_Player, sGunScale)) , new CWaveBeam(gpTweakGunRes->x18_waveBeam, kWT_Wave, playerId, kMT_Player, sGunScale))
// x75c_phazonBeam(new CPhazonBeam(gpTweakGunRes->x20_phazonBeam, kWT_Phazon, playerId, kMT_Player, , x758_plasmaBeam(
// sGunScale)) 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( , x774_holoTransitionGen(
new CElementGen(gpSimplePool->GetObj(SObjectTag('PART', gpTweakGunRes->x24_holoTransition)))) 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) , x830_chargeRumbleHandle(-1)
, x832_24_coolingCharge(false) , x832_24_coolingCharge(false)
, x832_25_chargeEffectVisible(false) , x832_25_chargeEffectVisible(false)
@ -236,10 +250,10 @@ CPlayerGun::CPlayerGun(TUniqueId playerId)
, x835_27_intoPhazonBeam(false) , x835_27_intoPhazonBeam(false)
, x835_28_bombReady(false) , x835_28_bombReady(false)
, x835_29_powerBombReady(false) , x835_29_powerBombReady(false)
// , x835_30_inPhazonPool(false) , x835_30_inPhazonPool(false)
// , x835_31_actorAttached(false) , x835_31_actorAttached(false) {
{
x6e0_rightHandModel.SetSortThermal(true);
kVerticalAngleTable[2] = gpTweakPlayerGun->GetUpLookAngle(); kVerticalAngleTable[2] = gpTweakPlayerGun->GetUpLookAngle();
kVerticalAngleTable[0] = gpTweakPlayerGun->GetDownLookAngle(); kVerticalAngleTable[0] = gpTweakPlayerGun->GetDownLookAngle();
kHorizontalAngleTable[1] = gpTweakPlayerGun->GetHorizontalSpread(); kHorizontalAngleTable[1] = gpTweakPlayerGun->GetHorizontalSpread();