2016-08-14 21:11:44 +00:00
|
|
|
#ifndef __URDE_CPLAYERGUN_HPP__
|
|
|
|
#define __URDE_CPLAYERGUN_HPP__
|
|
|
|
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "Character/CActorLights.hpp"
|
|
|
|
#include "CFidget.hpp"
|
|
|
|
#include "zeus/CTransform.hpp"
|
|
|
|
#include "zeus/CAABox.hpp"
|
2016-11-22 20:43:16 +00:00
|
|
|
#include "World/CPlayerCameraBob.hpp"
|
2016-08-14 21:11:44 +00:00
|
|
|
#include "CGunMotion.hpp"
|
|
|
|
#include "CGrappleArm.hpp"
|
|
|
|
#include "CAuxWeapon.hpp"
|
|
|
|
#include "CPowerBeam.hpp"
|
|
|
|
#include "CIceBeam.hpp"
|
|
|
|
#include "CWaveBeam.hpp"
|
|
|
|
#include "CPlasmaBeam.hpp"
|
|
|
|
#include "CPhazonBeam.hpp"
|
|
|
|
#include "Particle/CElementGen.hpp"
|
|
|
|
#include "Character/CModelData.hpp"
|
2016-11-22 20:43:16 +00:00
|
|
|
#include "World/CWorldShadow.hpp"
|
2017-06-12 04:23:34 +00:00
|
|
|
#include "World/ScriptObjectSupport.hpp"
|
2017-08-22 03:20:22 +00:00
|
|
|
#include "Graphics/CRainSplashGenerator.hpp"
|
2016-08-14 21:11:44 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
2017-07-16 06:13:37 +00:00
|
|
|
class CFinalInput;
|
2016-08-14 21:11:44 +00:00
|
|
|
|
|
|
|
class CPlayerGun
|
|
|
|
{
|
2017-04-04 05:48:13 +00:00
|
|
|
public:
|
|
|
|
enum class EMissleMode
|
|
|
|
{
|
|
|
|
Inactive,
|
|
|
|
Active
|
|
|
|
};
|
2017-08-16 05:34:02 +00:00
|
|
|
enum class EBWeapon
|
|
|
|
{
|
|
|
|
|
|
|
|
};
|
2017-08-25 06:18:09 +00:00
|
|
|
enum class EGunOverrideMode
|
|
|
|
{
|
|
|
|
Normal,
|
|
|
|
One,
|
|
|
|
Two,
|
|
|
|
Three
|
|
|
|
};
|
2017-04-04 05:48:13 +00:00
|
|
|
private:
|
2017-08-16 05:34:02 +00:00
|
|
|
class CGunMorph
|
2016-08-14 21:11:44 +00:00
|
|
|
{
|
2017-08-25 06:18:09 +00:00
|
|
|
public:
|
|
|
|
enum class EGunState
|
|
|
|
{
|
|
|
|
Zero,
|
|
|
|
One
|
|
|
|
};
|
|
|
|
private:
|
2016-08-15 01:19:04 +00:00
|
|
|
float x0_ = 0.f;
|
2017-08-21 05:46:59 +00:00
|
|
|
float x4_gunTransformTime;
|
2016-08-15 01:19:04 +00:00
|
|
|
float x8_ = 0.f;
|
|
|
|
float xc_ = 0.1f;
|
2017-08-21 05:46:59 +00:00
|
|
|
float x10_holoHoldTime;
|
2016-08-15 01:19:04 +00:00
|
|
|
float x14_ = 2.f;
|
2017-08-16 05:34:02 +00:00
|
|
|
float x18_transitionFactor = 1.f;
|
2016-08-15 01:19:04 +00:00
|
|
|
u32 x1c_ = 2;
|
2017-08-25 06:18:09 +00:00
|
|
|
EGunState x20_gunState = EGunState::One;
|
2016-08-15 01:19:04 +00:00
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool x24_24_ : 1;
|
|
|
|
bool x24_25_ : 1;
|
|
|
|
};
|
2017-08-16 05:34:02 +00:00
|
|
|
u32 _dummy = 0;
|
2016-08-15 01:19:04 +00:00
|
|
|
};
|
|
|
|
|
2017-08-16 05:34:02 +00:00
|
|
|
public:
|
2017-08-21 05:46:59 +00:00
|
|
|
CGunMorph(float gunTransformTime, float holoHoldTime)
|
|
|
|
: x4_gunTransformTime(gunTransformTime), x10_holoHoldTime(std::fabs(holoHoldTime)) {}
|
2017-08-16 05:34:02 +00:00
|
|
|
float GetTransitionFactor() const { return x18_transitionFactor; }
|
2017-08-25 06:18:09 +00:00
|
|
|
EGunState GetGunState() const { return x20_gunState; }
|
2017-08-16 05:34:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CMotionState
|
|
|
|
{
|
2017-08-22 03:20:22 +00:00
|
|
|
static float gGunExtendDistance;
|
|
|
|
public:
|
|
|
|
static void SetExtendDistance(float d) { gGunExtendDistance = d; }
|
2016-08-14 21:11:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
CActorLights x0_lights;
|
|
|
|
u32 x2e0_ = 0;
|
|
|
|
u32 x2e4_ = 0;
|
|
|
|
u32 x2e8_ = 0;
|
2017-08-16 05:34:02 +00:00
|
|
|
u32 x2ec_firing = 0;
|
2016-08-14 21:11:44 +00:00
|
|
|
u32 x2f0_ = 0;
|
|
|
|
u32 x2f4_ = 0;
|
|
|
|
u32 x2f8_ = 1;
|
|
|
|
u32 x2fc_ = 0;
|
|
|
|
u32 x300_ = 0;
|
|
|
|
u32 x304_ = 0;
|
2017-02-18 02:19:50 +00:00
|
|
|
u32 x308_bombCount = 3;
|
2016-08-14 21:11:44 +00:00
|
|
|
u32 x30c_ = 0;
|
2017-04-09 06:14:22 +00:00
|
|
|
u32 x310_selectedBeam = 0;
|
|
|
|
u32 x314_pendingSelectedBeam = 0;
|
2016-08-14 21:11:44 +00:00
|
|
|
u32 x318_ = 0;
|
2017-04-04 05:48:13 +00:00
|
|
|
EMissleMode x31c_missileMode = EMissleMode::Inactive;
|
2016-08-14 21:11:44 +00:00
|
|
|
u32 x320_ = 0;
|
|
|
|
u32 x324_ = 4;
|
|
|
|
u32 x328_ = 0x2000;
|
|
|
|
u32 x32c_ = 0;
|
2017-07-23 23:45:04 +00:00
|
|
|
u32 x330_chargeWeaponIdx = 0;
|
2016-08-14 21:11:44 +00:00
|
|
|
u32 x334_ = 0;
|
|
|
|
u32 x338_ = 0;
|
2017-08-25 06:18:09 +00:00
|
|
|
EGunOverrideMode x33c_gunOverrideMode = EGunOverrideMode::Normal;
|
2017-04-04 05:48:13 +00:00
|
|
|
float x340_chargeBeamFactor = 0.f;
|
2016-08-14 21:11:44 +00:00
|
|
|
float x344_ = 0.f;
|
|
|
|
float x348_ = 0.f;
|
|
|
|
float x34c_ = 0.f;
|
|
|
|
float x350_ = 0.f;
|
2017-08-21 05:46:59 +00:00
|
|
|
float x354_bombFuseTime;
|
|
|
|
float x358_bombDropDelayTime;
|
2017-02-18 02:19:50 +00:00
|
|
|
float x35c_bombTime = 0.f;
|
2016-08-14 21:11:44 +00:00
|
|
|
float x360_ = 0.f;
|
|
|
|
float x364_ = 0.f;
|
|
|
|
float x368_ = 0.f;
|
|
|
|
float x36c_ = 1.f;
|
|
|
|
float x370_ = 1.f;
|
|
|
|
float x374_ = 0.f;
|
|
|
|
float x378_ = 0.f;
|
|
|
|
float x37c_ = 0.f;
|
|
|
|
float x380_ = 0.f;
|
|
|
|
float x384_ = 0.f;
|
|
|
|
float x388_ = 0.f;
|
|
|
|
float x38c_ = 0.f;
|
|
|
|
float x390_ = 0.f;
|
2017-08-25 06:18:09 +00:00
|
|
|
float x394_damageTimer = 0.f;
|
2017-07-05 18:34:12 +00:00
|
|
|
float x398_damageAmt = 0.f;
|
2016-08-14 21:11:44 +00:00
|
|
|
float x39c_ = 0.f;
|
|
|
|
float x3a0_ = 0.f;
|
|
|
|
CFidget x3a4_fidget;
|
2017-07-05 18:34:12 +00:00
|
|
|
zeus::CVector3f x3dc_damageLocation;
|
2017-07-19 17:47:57 +00:00
|
|
|
zeus::CTransform x3e8_xf;
|
2016-08-14 21:11:44 +00:00
|
|
|
zeus::CTransform x418_;
|
|
|
|
zeus::CTransform x448_;
|
2017-07-23 23:45:04 +00:00
|
|
|
zeus::CTransform x478_assistAimXf;
|
2016-08-14 21:11:44 +00:00
|
|
|
zeus::CTransform x4a8_;
|
|
|
|
zeus::CTransform x4d8_;
|
|
|
|
zeus::CTransform x508_;
|
2017-08-25 06:18:09 +00:00
|
|
|
TUniqueId x538_playerId;
|
2016-08-14 21:11:44 +00:00
|
|
|
TUniqueId x53a_ = kInvalidUniqueId;
|
2017-08-25 06:18:09 +00:00
|
|
|
TUniqueId x53c_lightId = kInvalidUniqueId;
|
2017-08-22 03:20:22 +00:00
|
|
|
std::vector<CToken> x540_handAnimTokens;
|
2016-08-14 21:11:44 +00:00
|
|
|
CPlayerCameraBob x550_camBob;
|
|
|
|
u32 x658_ = 1;
|
|
|
|
float x65c_ = 0.f;
|
|
|
|
float x660_ = 0.f;
|
|
|
|
float x664_ = 0.f;
|
2017-08-21 05:46:59 +00:00
|
|
|
float x668_aimVerticalSpeed;
|
|
|
|
float x66c_aimHorizontalSpeed;
|
2016-08-14 21:11:44 +00:00
|
|
|
TUniqueId x670_ = kInvalidUniqueId;
|
|
|
|
u32 x674_ = 0;
|
|
|
|
CGunMorph x678_morph;
|
|
|
|
bool x6a0_24_ = true;
|
|
|
|
float x6a4_ = 0.f;
|
|
|
|
float x6a8_ = 0.f;
|
|
|
|
float x6ac_ = 0.f;
|
|
|
|
float x6b0_ = 0.f;
|
|
|
|
float x6b4_ = 0.f;
|
|
|
|
float x6b8_ = 0.f;
|
|
|
|
float x6bc_ = 0.f;
|
|
|
|
u32 x6c0_ = 0;
|
|
|
|
u32 x6c4_ = 0;
|
|
|
|
zeus::CAABox x6c8_;
|
2017-08-21 05:46:59 +00:00
|
|
|
CModelData x6e0_rightHandModel;
|
2016-08-15 01:19:04 +00:00
|
|
|
CGunWeapon* x72c_currentBeam = nullptr;
|
2016-08-14 21:11:44 +00:00
|
|
|
u32 x730_ = 0;
|
2017-08-25 06:18:09 +00:00
|
|
|
CGunWeapon* x734_ = nullptr;
|
2017-08-22 03:20:22 +00:00
|
|
|
CGunWeapon* x738_nextBeam = nullptr;
|
2016-08-15 01:19:04 +00:00
|
|
|
std::unique_ptr<CGunMotion> x73c_gunMotion;
|
|
|
|
std::unique_ptr<CGrappleArm> x740_grappleArm;
|
|
|
|
std::unique_ptr<CAuxWeapon> x744_auxWeapon;
|
2017-08-22 03:20:22 +00:00
|
|
|
std::unique_ptr<CRainSplashGenerator> x748_rainSplashGenerator;
|
2016-08-15 01:19:04 +00:00
|
|
|
std::unique_ptr<CPowerBeam> x74c_powerBeam;
|
|
|
|
std::unique_ptr<CIceBeam> x750_iceBeam;
|
|
|
|
std::unique_ptr<CWaveBeam> x754_waveBeam;
|
|
|
|
std::unique_ptr<CPlasmaBeam> x758_plasmaBeam;
|
|
|
|
std::unique_ptr<CPhazonBeam> x75c_phazonBeam;
|
2017-08-22 03:20:22 +00:00
|
|
|
CGunWeapon* x760_selectableBeams[4] = {}; // Used to be reserved_vector
|
|
|
|
std::unique_ptr<CElementGen> x774_holoTransitionGen;
|
|
|
|
std::unique_ptr<u32> x77c_;
|
|
|
|
rstl::reserved_vector<rstl::reserved_vector<TLockedToken<CGenDescription>, 2>, 2> x784_bombEffects;
|
|
|
|
rstl::reserved_vector<TLockedToken<CGenDescription>, 5> x7c0_auxMuzzleEffects;
|
|
|
|
rstl::reserved_vector<std::unique_ptr<CElementGen>, 5> x800_auxMuzzleGenerators;
|
2016-08-15 01:19:04 +00:00
|
|
|
std::unique_ptr<CWorldShadow> x82c_shadow;
|
2017-08-22 03:20:22 +00:00
|
|
|
s16 x830 = -1;
|
2016-08-15 01:19:04 +00:00
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool x832_24_ : 1;
|
|
|
|
bool x832_25_ : 1;
|
|
|
|
bool x832_26_ : 1;
|
|
|
|
bool x832_27_ : 1;
|
|
|
|
bool x832_28_ : 1;
|
|
|
|
bool x832_29_ : 1;
|
|
|
|
bool x832_30_ : 1;
|
|
|
|
bool x832_31_ : 1;
|
|
|
|
|
2017-07-20 06:04:40 +00:00
|
|
|
bool x833_24_isFidgeting : 1;
|
2016-08-15 01:19:04 +00:00
|
|
|
bool x833_25_ : 1;
|
|
|
|
bool x833_26_ : 1;
|
|
|
|
bool x833_27_ : 1;
|
2017-08-25 06:18:09 +00:00
|
|
|
bool x833_28_phazonBeamActive : 1;
|
2016-08-15 01:19:04 +00:00
|
|
|
bool x833_29_ : 1;
|
|
|
|
bool x833_30_ : 1;
|
|
|
|
bool x833_31_ : 1;
|
|
|
|
|
2017-04-04 05:48:13 +00:00
|
|
|
bool x834_24_charging : 1;
|
2016-08-15 01:19:04 +00:00
|
|
|
bool x834_25_ : 1;
|
|
|
|
bool x834_26_ : 1;
|
2017-08-25 06:18:09 +00:00
|
|
|
bool x834_27_underwater : 1;
|
2016-08-15 01:19:04 +00:00
|
|
|
bool x834_28_ : 1;
|
|
|
|
bool x834_29_ : 1;
|
2017-08-25 06:18:09 +00:00
|
|
|
bool x834_30_damaged : 1;
|
2016-08-15 01:19:04 +00:00
|
|
|
bool x834_31_ : 1;
|
|
|
|
|
2017-08-25 06:18:09 +00:00
|
|
|
bool x835_24_canFirePhazon : 1;
|
|
|
|
bool x835_25_inPhazonBeam : 1;
|
|
|
|
bool x835_26_phazonBeamMorphing : 1;
|
|
|
|
bool x835_27_intoPhazonBeam : 1;
|
2017-04-08 20:40:36 +00:00
|
|
|
bool x835_28_bombReady : 1;
|
|
|
|
bool x835_29_powerBombReady : 1;
|
2017-08-25 06:18:09 +00:00
|
|
|
bool x835_30_inPhazonPool : 1;
|
2017-08-19 06:52:13 +00:00
|
|
|
bool x835_31_actorAttached : 1;
|
2016-08-15 01:19:04 +00:00
|
|
|
};
|
|
|
|
u32 _dummy = 0;
|
|
|
|
};
|
2016-08-14 21:11:44 +00:00
|
|
|
|
2017-08-22 03:20:22 +00:00
|
|
|
void InitBeamData();
|
|
|
|
void InitBombData();
|
|
|
|
void InitMuzzleData();
|
|
|
|
void InitCTData();
|
|
|
|
void LoadHandAnimTokens();
|
2017-08-25 06:18:09 +00:00
|
|
|
void CreateGunLight(CStateManager& mgr);
|
|
|
|
void DeleteGunLight(CStateManager& mgr);
|
|
|
|
void SetGunLightActive(bool active, CStateManager& mgr);
|
|
|
|
void SetPhazonBeamMorph(bool intoPhazonBeam);
|
|
|
|
void Reset(CStateManager& mgr, bool b1);
|
|
|
|
void ResetBeamParams(CStateManager& mgr, const CPlayerState& playerState, bool playSelectionSfx);
|
|
|
|
void PlaySfx(u16 sfx, bool underwater, bool looped, float pan);
|
|
|
|
void PlayAnim(NWeaponTypes::EGunAnimType type, bool b1);
|
|
|
|
void CancelCharge(CStateManager& mgr, bool withEffect);
|
2017-08-22 03:20:22 +00:00
|
|
|
|
2016-08-14 21:11:44 +00:00
|
|
|
public:
|
2017-08-22 03:20:22 +00:00
|
|
|
explicit CPlayerGun(TUniqueId playerId);
|
2017-08-25 06:18:09 +00:00
|
|
|
void TakeDamage(bool attack, bool notFromMetroid, CStateManager& mgr);
|
2017-08-13 05:26:14 +00:00
|
|
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
2016-08-15 01:19:04 +00:00
|
|
|
void AsyncLoadSuit(CStateManager& mgr);
|
2017-07-31 05:19:05 +00:00
|
|
|
void TouchModel(const CStateManager& stateMgr);
|
2017-04-04 05:48:13 +00:00
|
|
|
EMissleMode GetMissleMode() const { return x31c_missileMode; }
|
2017-07-20 06:04:40 +00:00
|
|
|
bool IsFidgeting() const { return x833_24_isFidgeting; }
|
2017-04-08 20:40:36 +00:00
|
|
|
bool IsCharging() const { return x834_24_charging; }
|
|
|
|
float GetChargeBeamFactor() const { return x340_chargeBeamFactor; }
|
|
|
|
bool IsBombReady() const { return x835_28_bombReady; }
|
|
|
|
u32 GetBombCount() const { return x308_bombCount; }
|
|
|
|
bool IsPowerBombReady() const { return x835_29_powerBombReady; }
|
2017-04-09 06:14:22 +00:00
|
|
|
u32 GetSelectedBeam() const { return x310_selectedBeam; }
|
|
|
|
u32 GetPendingSelectedBeam() const { return x314_pendingSelectedBeam; }
|
|
|
|
const CGunMorph& GetGunMorph() const { return x678_morph; }
|
2017-08-16 05:34:02 +00:00
|
|
|
float GetHoloTransitionFactor() const { return x678_morph.GetTransitionFactor(); }
|
2017-07-19 17:47:57 +00:00
|
|
|
void SetTransform(const zeus::CTransform& xf) { x3e8_xf = xf; }
|
2017-07-23 23:45:04 +00:00
|
|
|
void SetAssistAimTransform(const zeus::CTransform& xf) { x478_assistAimXf = xf; }
|
2017-06-18 01:58:13 +00:00
|
|
|
CGrappleArm& GetGrappleArm() { return *x740_grappleArm; }
|
2017-07-05 18:34:12 +00:00
|
|
|
void DamageRumble(const zeus::CVector3f& location, float damage, const CStateManager& mgr);
|
2017-08-25 06:18:09 +00:00
|
|
|
void ResetCharge(CStateManager& mgr, bool b1);
|
|
|
|
void HandleBeamChange(const CFinalInput& input, CStateManager& mgr);
|
|
|
|
void HandlePhazonBeamChange(CStateManager& mgr);
|
|
|
|
void HandleWeaponChange(const CFinalInput& input, CStateManager& mgr);
|
2017-07-16 06:13:37 +00:00
|
|
|
void ProcessInput(const CFinalInput& input, CStateManager& mgr);
|
2017-07-17 03:04:14 +00:00
|
|
|
void ResetIdle(CStateManager& mgr);
|
|
|
|
void CancelFiring(CStateManager& mgr);
|
2017-07-23 23:45:04 +00:00
|
|
|
float GetBeamVelocity() const;
|
2017-08-25 06:18:09 +00:00
|
|
|
void StopContinuousBeam(CStateManager& mgr, bool b1);
|
2017-08-16 05:34:02 +00:00
|
|
|
void Update(float grappleSwingT, float cameraBobT, float dt, CStateManager& mgr);
|
2017-07-31 05:19:05 +00:00
|
|
|
void PreRender(const CStateManager& mgr, const zeus::CFrustum& frustum, const zeus::CVector3f& camPos);
|
|
|
|
void Render(const CStateManager& mgr, const zeus::CVector3f& pos, const CModelFlags& flags) const;
|
|
|
|
void AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const;
|
2017-08-16 05:34:02 +00:00
|
|
|
bool GetFiring() const { return x2ec_firing != 0; }
|
|
|
|
TUniqueId DropPowerBomb(CStateManager& mgr);
|
2017-08-19 06:52:13 +00:00
|
|
|
void SetActorAttached(bool b) { x835_31_actorAttached = b; }
|
2016-08-14 21:11:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CPLAYERGUN_HPP__
|