mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-12 11:26:09 +00:00
@@ -1,21 +1,25 @@
|
||||
#ifndef _CPLAYERGUN_HPP
|
||||
#define _CPLAYERGUN_HPP
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "MetroidPrime/CActorLights.hpp"
|
||||
#include "MetroidPrime/CModelData.hpp"
|
||||
#include "MetroidPrime/Player/CFidget.hpp"
|
||||
#include "MetroidPrime/Player/CPlayerCameraBob.hpp"
|
||||
#include "MetroidPrime/Player/CPlayerState.hpp"
|
||||
#include "MetroidPrime/Weapons/CGunWeapon.hpp"
|
||||
|
||||
#include "Kyoto/Audio/CSfxHandle.hpp"
|
||||
#include "Kyoto/Math/CAABox.hpp"
|
||||
#include "Kyoto/Math/CTransform4f.hpp"
|
||||
|
||||
#include "rstl/pair.hpp"
|
||||
#include "rstl/reserved_vector.hpp"
|
||||
#include "rstl/single_ptr.hpp"
|
||||
#include "rstl/vector.hpp"
|
||||
|
||||
#include "math.h"
|
||||
enum EChargeState {
|
||||
kCS_Normal,
|
||||
kCS_Charged,
|
||||
};
|
||||
|
||||
class CGunWeapon;
|
||||
class CGunMotion;
|
||||
@@ -29,27 +33,37 @@ class CPlasmaBeam;
|
||||
class CPhazonBeam;
|
||||
class CElementGen;
|
||||
class CWorldShadow;
|
||||
class CGenDescription;
|
||||
|
||||
class CPlayerGun {
|
||||
static float skTractorBeamFactor;
|
||||
|
||||
public:
|
||||
enum EMissileMode { kMM_Inactive, kMM_Active };
|
||||
enum EBWeapon { kBW_Bomb, kBW_PowerBomb };
|
||||
enum EPhazonBeamState { kPBS_Inactive, kPBS_Entering, kPBS_Exiting, kPBS_Active };
|
||||
enum EMissileMode {
|
||||
kMM_Inactive,
|
||||
kMM_Active,
|
||||
};
|
||||
enum EBWeapon {
|
||||
kBW_Bomb,
|
||||
kBW_PowerBomb,
|
||||
};
|
||||
enum EPhazonBeamState {
|
||||
kKBS_Inactive,
|
||||
kKBS_Entering,
|
||||
kKBS_Exiting,
|
||||
kKBS_Active,
|
||||
};
|
||||
enum EChargePhase {
|
||||
kGP_NotCharging,
|
||||
kGP_ChargeRequested,
|
||||
kGP_AnimAndSfx,
|
||||
kGP_FxGrowing,
|
||||
kGP_FxGrown,
|
||||
kGP_ComboXfer,
|
||||
kGP_ComboXferDone,
|
||||
kGP_ComboFire,
|
||||
kGP_ComboFireDone,
|
||||
kGP_ChargeCooldown,
|
||||
kGP_ChargeDone
|
||||
kCP_NotCharging,
|
||||
kCP_ChargeRequested,
|
||||
kCP_AnimAndSfx,
|
||||
kCP_FxGrowing,
|
||||
kCP_FxGrown,
|
||||
kCP_ComboXfer,
|
||||
kCP_ComboXferDone,
|
||||
kCP_ComboFire,
|
||||
kCP_ComboFireDone,
|
||||
kCP_ChargeCooldown,
|
||||
kCP_ChargeDone,
|
||||
};
|
||||
enum ENextState {
|
||||
kNS_StatusQuo,
|
||||
@@ -61,21 +75,51 @@ public:
|
||||
kNS_SetupBeam,
|
||||
kNS_Seven,
|
||||
kNS_EnterPhazonBeam,
|
||||
kNS_ExitPhazonBeam
|
||||
kNS_ExitPhazonBeam,
|
||||
};
|
||||
enum EIdleState {
|
||||
kIS_NotIdle,
|
||||
kIS_Wander,
|
||||
kIS_Idle,
|
||||
kIS_Three,
|
||||
kIS_Four,
|
||||
};
|
||||
enum EIdleState { kIS_NotIdle, kIS_Wander, kIS_Idle, kIS_Three, kIS_Four };
|
||||
|
||||
bool IsCharging() const;
|
||||
float GetChargeBeamFactor() const;
|
||||
bool IsCharging() const { return x834_24_charging; }
|
||||
float GetChargeBeamFactor() const { return x834_24_charging ? x340_chargeBeamFactor : 0.f; }
|
||||
|
||||
static float GetTractorBeamFactor() { return skTractorBeamFactor; }
|
||||
|
||||
private:
|
||||
class CGunMorph {
|
||||
public:
|
||||
enum EGunState { kGS_InWipeDone, kGS_OutWipeDone, kGS_InWipe, kGS_OutWipe };
|
||||
enum EMorphEvent { kME_None, kME_InWipeDone, kME_OutWipeDone };
|
||||
enum EDir { kD_In, kD_Out, kD_Done };
|
||||
enum EGunState {
|
||||
kGS_InWipeDone,
|
||||
kGS_OutWipeDone,
|
||||
kGS_InWipe,
|
||||
kGS_OutWipe,
|
||||
};
|
||||
enum EMorphEvent {
|
||||
kME_None,
|
||||
kME_InWipeDone,
|
||||
kME_OutWipeDone,
|
||||
};
|
||||
enum EDir {
|
||||
kD_In,
|
||||
kD_Out,
|
||||
kD_Done,
|
||||
};
|
||||
|
||||
CGunMorph(float gunTransformTime, float holoHoldTime)
|
||||
: x4_gunTransformTime(gunTransformTime), x10_holoHoldTime(fabs(holoHoldTime)) {}
|
||||
|
||||
EMorphEvent Update(float inY, float outY, float dt);
|
||||
void StartWipe(EDir dir);
|
||||
|
||||
float GetYLerp() const { return x0_yLerp; }
|
||||
float GetTransitionFactor() const { return x18_transitionFactor; }
|
||||
EGunState GetGunState() const { return x20_gunState; }
|
||||
void SetWeaponChanged() { x24_25_weaponChanged = true; }
|
||||
|
||||
private:
|
||||
float x0_yLerp;
|
||||
@@ -89,26 +133,29 @@ private:
|
||||
EGunState x20_gunState;
|
||||
bool x24_24_morphing : 1;
|
||||
bool x24_25_weaponChanged : 1;
|
||||
|
||||
public:
|
||||
CGunMorph(float gunTransformTime, float holoHoldTime)
|
||||
: x4_gunTransformTime(gunTransformTime), x10_holoHoldTime(fabs(holoHoldTime)) {}
|
||||
float GetYLerp() const { return x0_yLerp; }
|
||||
float GetTransitionFactor() const { return x18_transitionFactor; }
|
||||
EGunState GetGunState() const { return x20_gunState; }
|
||||
void SetWeaponChanged() { x24_25_weaponChanged = true; }
|
||||
EMorphEvent Update(float inY, float outY, float dt);
|
||||
void StartWipe(EDir dir);
|
||||
};
|
||||
|
||||
class CMotionState {
|
||||
public:
|
||||
enum EMotionState { kMS_Zero, kMS_One, kMS_LockOn, kMS_CancelLockOn };
|
||||
enum EFireState { kFS_NotFiring, kFS_StartFire, kFS_Firing };
|
||||
enum EMotionState {
|
||||
kMS_Zero,
|
||||
kMS_One,
|
||||
kMS_LockOn,
|
||||
kMS_CancelLockOn,
|
||||
};
|
||||
enum EFireState {
|
||||
kFS_NotFiring,
|
||||
kFS_StartFire,
|
||||
kFS_Firing,
|
||||
};
|
||||
|
||||
static void SetExtendDistance(float d) { kGunExtendDistance = d; }
|
||||
|
||||
void SetState(EMotionState state) { x20_state = state; }
|
||||
void Update(bool firing, float dt, CTransform4f& xf, CStateManager& mgr);
|
||||
|
||||
private:
|
||||
static float gGunExtendDistance;
|
||||
bool x0_24_extendParabola;
|
||||
bool x0_24_extendParabola : 1;
|
||||
float x4_extendParabolaDelayTimer;
|
||||
float x8_fireTime;
|
||||
float xc_curExtendDist;
|
||||
@@ -119,10 +166,7 @@ private:
|
||||
EMotionState x20_state;
|
||||
EFireState x24_fireState;
|
||||
|
||||
public:
|
||||
static void SetExtendDistance(float d) { gGunExtendDistance = d; }
|
||||
void SetState(EMotionState state) { x20_state = state; }
|
||||
void Update(bool firing, float dt, CTransform4f& xf, CStateManager& mgr);
|
||||
static float kGunExtendDistance;
|
||||
};
|
||||
|
||||
CActorLights x0_lights;
|
||||
@@ -130,26 +174,26 @@ private:
|
||||
CSfxHandle x2e4_invalidSfx;
|
||||
CSfxHandle x2e8_phazonBeamSfx;
|
||||
// 0x1: FireOrBomb, 0x2: MissileOrPowerBomb
|
||||
u32 x2ec_lastFireButtonStates;
|
||||
u32 x2f0_pressedFireButtonStates;
|
||||
u32 x2f4_fireButtonStates;
|
||||
uint x2ec_lastFireButtonStates;
|
||||
uint x2f0_pressedFireButtonStates;
|
||||
uint x2f4_fireButtonStates;
|
||||
// 0x1: beam mode, 0x2: missile mode, 0x4: missile ready, 0x8: morphing, 0x10: combo fire
|
||||
u32 x2f8_stateFlags;
|
||||
u32 x2fc_fidgetAnimBits;
|
||||
u32 x300_remainingMissiles;
|
||||
u32 x304_;
|
||||
u32 x308_bombCount;
|
||||
u32 x30c_rapidFireShots;
|
||||
uint x2f8_stateFlags;
|
||||
uint x2fc_fidgetAnimBits;
|
||||
uint x300_remainingMissiles;
|
||||
uint x304_;
|
||||
uint x308_bombCount;
|
||||
uint x30c_rapidFireShots;
|
||||
CPlayerState::EBeamId x310_currentBeam;
|
||||
CPlayerState::EBeamId x314_nextBeam;
|
||||
u32 x318_comboAmmoIdx;
|
||||
uint x318_comboAmmoIdx;
|
||||
EMissileMode x31c_missileMode;
|
||||
CPlayerState::EBeamId x320_currentAuxBeam;
|
||||
EIdleState x324_idleState;
|
||||
float x328_animSfxPitch;
|
||||
EChargePhase x32c_chargePhase;
|
||||
EChargeState x330_chargeState;
|
||||
u32 x334_;
|
||||
uint x334_;
|
||||
ENextState x338_nextState;
|
||||
EPhazonBeamState x33c_phazonBeamState;
|
||||
float x340_chargeBeamFactor;
|
||||
@@ -191,7 +235,7 @@ private:
|
||||
TUniqueId x53c_lightId;
|
||||
rstl::vector< CToken > x540_handAnimTokens;
|
||||
CPlayerCameraBob x550_camBob;
|
||||
u32 x658_;
|
||||
uint x658_;
|
||||
float x65c_;
|
||||
float x660_;
|
||||
float x664_;
|
||||
@@ -216,12 +260,12 @@ private:
|
||||
rstl::single_ptr< CPlasmaBeam > x758_plasmaBeam;
|
||||
rstl::single_ptr< CPhazonBeam > x75c_phazonBeam;
|
||||
rstl::reserved_vector< CGunWeapon*, 4 > x760_selectableBeams;
|
||||
rstl::single_ptr< CElementGen > x774_holoTransitionGen;
|
||||
rstl::single_ptr< CElementGen > x77c_comboXferGen;
|
||||
rstl::auto_ptr< CElementGen > x774_holoTransitionGen;
|
||||
rstl::auto_ptr< CElementGen > x77c_comboXferGen;
|
||||
rstl::reserved_vector< rstl::reserved_vector< TLockedToken< CGenDescription >, 2 >, 2 >
|
||||
x784_bombEffects;
|
||||
rstl::reserved_vector< TLockedToken< CGenDescription >, 5 > x7c0_auxMuzzleEffects;
|
||||
rstl::reserved_vector< rstl::single_ptr< CElementGen >, 5 > x800_auxMuzzleGenerators;
|
||||
rstl::reserved_vector< rstl::auto_ptr< CElementGen >, 5 > x800_auxMuzzleGenerators;
|
||||
rstl::single_ptr< CWorldShadow > x82c_shadow;
|
||||
s16 x830_chargeRumbleHandle;
|
||||
|
||||
@@ -258,8 +302,7 @@ 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;
|
||||
};
|
||||
CHECK_SIZEOF(CPlayerGun, 0x838)
|
||||
|
||||
#endif // _CPLAYERGUN_HPP
|
||||
|
||||
Reference in New Issue
Block a user