2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CGUNWEAPON
|
|
|
|
#define _CGUNWEAPON
|
2022-10-05 22:55:57 +00:00
|
|
|
|
2022-10-05 23:06:15 +00:00
|
|
|
#include "types.h"
|
2022-10-05 22:55:57 +00:00
|
|
|
|
2022-11-15 20:06:18 +00:00
|
|
|
#include "MetroidPrime/CModelData.hpp"
|
2022-10-05 23:06:15 +00:00
|
|
|
#include "MetroidPrime/Player/CPlayerState.hpp"
|
2022-10-06 11:37:57 +00:00
|
|
|
#include "MetroidPrime/Weapons/WeaponCommon.hpp"
|
2022-10-05 23:06:15 +00:00
|
|
|
#include "MetroidPrime/Weapons/WeaponTypes.hpp"
|
|
|
|
|
2022-11-15 20:06:18 +00:00
|
|
|
#include "Kyoto/Math/CAABox.hpp"
|
2022-10-05 23:06:15 +00:00
|
|
|
#include "Kyoto/Math/CVector3f.hpp"
|
|
|
|
#include "Kyoto/TToken.hpp"
|
|
|
|
|
|
|
|
#include "Collision/CMaterialList.hpp"
|
|
|
|
|
|
|
|
#include "rstl/optional_object.hpp"
|
|
|
|
#include "rstl/reserved_vector.hpp"
|
|
|
|
#include "rstl/single_ptr.hpp"
|
|
|
|
|
|
|
|
class CGenDescription;
|
|
|
|
class CGunController;
|
|
|
|
class CAnimCharacterSet;
|
|
|
|
class CWeaponDescription;
|
|
|
|
class CElementGen;
|
|
|
|
class CRainSplashGenerator;
|
2022-11-15 20:06:18 +00:00
|
|
|
class CTransform4f;
|
|
|
|
class CModelFlags;
|
|
|
|
class CActorLights;
|
|
|
|
class SWeaponInfo;
|
2022-10-05 23:06:15 +00:00
|
|
|
|
|
|
|
class CVelocityInfo {
|
|
|
|
public:
|
|
|
|
const CVector3f& GetVelocity(int i) const { return x0_vel[i]; }
|
|
|
|
bool GetTargetHoming(int i) const { return x1c_targetHoming[i]; }
|
|
|
|
void Clear() {
|
|
|
|
x0_vel.clear();
|
|
|
|
x1c_targetHoming.clear();
|
|
|
|
x24_trat.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
rstl::reserved_vector< CVector3f, 2 > x0_vel;
|
|
|
|
rstl::reserved_vector< bool, 2 > x1c_targetHoming;
|
|
|
|
rstl::reserved_vector< float, 2 > x24_trat;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CGunWeapon {
|
|
|
|
public:
|
2022-11-15 20:06:18 +00:00
|
|
|
CGunWeapon(CAssetId ancsId, EWeaponType type, TUniqueId playerId, EMaterialTypes playerMaterial,
|
|
|
|
const CVector3f& scale);
|
2022-10-05 23:06:15 +00:00
|
|
|
virtual ~CGunWeapon();
|
|
|
|
|
|
|
|
enum ESecondaryFxType {
|
|
|
|
kSFT_None,
|
|
|
|
kSFT_Charge,
|
|
|
|
kSFT_ToCombo,
|
|
|
|
kSFT_CancelCharge,
|
|
|
|
};
|
|
|
|
enum EFrozenFxType {
|
|
|
|
kFFT_None,
|
|
|
|
kFFT_Frozen,
|
|
|
|
kFFT_Thawed,
|
|
|
|
};
|
|
|
|
|
2022-10-06 11:37:57 +00:00
|
|
|
// Virtual Methods
|
|
|
|
virtual void Reset(CStateManager& mgr);
|
|
|
|
virtual void PlayAnim(NWeaponTypes::EGunAnimType type, bool loop);
|
|
|
|
virtual void PreRenderGunFx(const CStateManager& mgr, const CTransform4f& xf);
|
|
|
|
virtual void PostRenderGunFx(const CStateManager& mgr, const CTransform4f& xf);
|
2022-10-09 05:13:17 +00:00
|
|
|
virtual void UpdateGunFx(bool shotSmoke, float dt, const CStateManager& mgr,
|
|
|
|
const CTransform4f& xf);
|
|
|
|
virtual void Fire(bool underwater, float dt, CPlayerState::EChargeStage chargeState,
|
|
|
|
const CTransform4f& xf, CStateManager& mgr, TUniqueId homingTarget,
|
|
|
|
float chargeFactor1, float chargeFactor2);
|
2022-10-06 11:37:57 +00:00
|
|
|
virtual void EnableFx(bool enable);
|
|
|
|
virtual void EnableSecondaryFx(ESecondaryFxType type);
|
2022-10-09 05:13:17 +00:00
|
|
|
virtual void Draw(bool drawSuitArm, const CStateManager& mgr, const CTransform4f& xf,
|
2022-11-25 00:01:26 +00:00
|
|
|
const CModelFlags& flags, const CActorLights* lights) const;
|
2022-10-06 11:37:57 +00:00
|
|
|
virtual void DrawMuzzleFx(const CStateManager& mgr) const;
|
|
|
|
virtual void Update(float dt, CStateManager& mgr);
|
|
|
|
virtual void Load(CStateManager& mgr, bool subtypeBasePose);
|
|
|
|
virtual void Unload(CStateManager& mgr);
|
|
|
|
virtual bool IsLoaded() const;
|
|
|
|
|
2022-10-06 16:45:09 +00:00
|
|
|
const CVelocityInfo& GetVelocityInfo() const { return x1d0_velInfo; }
|
2022-10-06 11:37:57 +00:00
|
|
|
rstl::optional_object< CModelData >& SolidModelData() { return x10_solidModelData; }
|
2022-10-06 20:34:27 +00:00
|
|
|
const CModelData& GetSolidModelData() const { return x10_solidModelData.data(); }
|
2022-10-06 11:37:57 +00:00
|
|
|
|
|
|
|
CAABox GetBounds() const;
|
|
|
|
CAABox GetBounds(const CTransform4f& xf) const;
|
2022-10-06 19:38:21 +00:00
|
|
|
const SWeaponInfo& GetWeaponInfo() const;
|
2022-11-25 00:01:26 +00:00
|
|
|
void ActivateCharge(bool enable, bool resetEffect);
|
2022-10-06 11:37:57 +00:00
|
|
|
|
2022-11-15 20:06:18 +00:00
|
|
|
protected:
|
2022-10-06 10:38:13 +00:00
|
|
|
// x0 is vtable
|
2022-10-05 23:06:15 +00:00
|
|
|
CVector3f x4_scale;
|
|
|
|
rstl::optional_object< CModelData > x10_solidModelData;
|
|
|
|
rstl::optional_object< CModelData > x60_holoModelData;
|
|
|
|
rstl::optional_object< CModelData > xb0_suitArmModelData;
|
|
|
|
rstl::single_ptr< CGunController > x100_gunController;
|
|
|
|
TToken< CAnimCharacterSet > x104_gunCharacter;
|
|
|
|
rstl::vector< CToken > x10c_anims;
|
2022-10-06 10:38:13 +00:00
|
|
|
rstl::vector< int > x11c_unk;
|
2022-10-05 23:06:15 +00:00
|
|
|
rstl::vector< CToken > x12c_deps;
|
|
|
|
TToken< CAnimCharacterSet > x13c_armCharacter;
|
|
|
|
rstl::reserved_vector< TCachedToken< CWeaponDescription >, 2 > x144_weapons;
|
|
|
|
TCachedToken< CGenDescription > x160_xferEffect;
|
|
|
|
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;
|
2022-10-09 05:37:23 +00:00
|
|
|
uchar x1b0_pad[8];
|
2022-10-05 23:06:15 +00:00
|
|
|
rstl::single_ptr< CElementGen > x1b8_frozenGenerator;
|
|
|
|
CRainSplashGenerator* x1bc_rainSplashGenerator;
|
|
|
|
EWeaponType x1c0_weaponType;
|
|
|
|
TUniqueId x1c4_playerId;
|
|
|
|
EMaterialTypes x1c8_playerMaterial;
|
|
|
|
ESecondaryFxType x1cc_enabledSecondaryEffect;
|
|
|
|
CVelocityInfo x1d0_velInfo;
|
|
|
|
CPlayerState::EBeamId x200_beamId;
|
|
|
|
EFrozenFxType x204_frozenEffect;
|
|
|
|
uint x208_muzzleEffectIdx;
|
|
|
|
uint x20c_shaderIdx;
|
|
|
|
// 0x1: load request, 0x2: muzzle fx, 0x4: projectile data, 0x8: anims, 0x10: everything else
|
|
|
|
uint x210_loadFlags;
|
|
|
|
CAssetId x214_ancsId;
|
|
|
|
bool x218_24 : 1;
|
|
|
|
bool x218_25_enableCharge : 1;
|
|
|
|
bool x218_26_loaded : 1;
|
|
|
|
// Initialize in selected beam's pose, rather than power beam's pose
|
|
|
|
bool x218_27_subtypeBasePose : 1;
|
|
|
|
bool x218_28_suitArmLocked : 1;
|
|
|
|
bool x218_29_drawHologram : 1;
|
|
|
|
|
|
|
|
static const int skShootAnim[32];
|
|
|
|
};
|
2022-10-06 10:38:13 +00:00
|
|
|
CHECK_SIZEOF(CGunWeapon, 0x21c)
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CGUNWEAPON
|