2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-08-14 21:11:44 +00:00
|
|
|
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "zeus/CVector3f.hpp"
|
|
|
|
#include "Character/CModelData.hpp"
|
2017-09-04 02:22:46 +00:00
|
|
|
#include "Character/CAnimCharacterSet.hpp"
|
2017-08-25 06:18:09 +00:00
|
|
|
#include "CStateManager.hpp"
|
2017-08-26 04:36:25 +00:00
|
|
|
#include "CGunController.hpp"
|
2017-08-27 03:02:18 +00:00
|
|
|
#include "CGunMotion.hpp"
|
2016-08-14 21:11:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2017-08-31 02:42:37 +00:00
|
|
|
class CStateManager;
|
2017-09-04 02:22:46 +00:00
|
|
|
struct CModelFlags;
|
2017-08-31 02:42:37 +00:00
|
|
|
class CActorLights;
|
2016-08-14 21:11:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CGrappleArm {
|
2017-07-17 03:04:14 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
enum class EArmState {
|
|
|
|
IntoGrapple,
|
|
|
|
IntoGrappleIdle,
|
|
|
|
FireGrapple,
|
|
|
|
Three,
|
|
|
|
ConnectGrapple,
|
|
|
|
Five,
|
|
|
|
Connected,
|
|
|
|
Seven,
|
|
|
|
OutOfGrapple,
|
|
|
|
GunControllerAnimation,
|
|
|
|
Done
|
|
|
|
};
|
|
|
|
|
2017-07-17 03:04:14 +00:00
|
|
|
private:
|
2019-06-12 02:05:17 +00:00
|
|
|
std::optional<CModelData> x0_grappleArmModel;
|
|
|
|
std::optional<CModelData> x50_grappleArmSkeletonModel;
|
2018-12-08 05:30:43 +00:00
|
|
|
CModelData xa0_grappleGearModel;
|
|
|
|
CModelData xec_grapNoz1Model;
|
|
|
|
CModelData x138_grapNoz2Model;
|
|
|
|
TCachedToken<CAnimCharacterSet> x184_grappleArm;
|
|
|
|
std::vector<CToken> x18c_anims;
|
|
|
|
rstl::reserved_vector<std::vector<CToken>, 8> x19c_suitDeps;
|
|
|
|
zeus::CTransform x220_xf;
|
|
|
|
zeus::CTransform x250_grapLocatorXf;
|
|
|
|
zeus::CTransform x280_grapNozLoc1Xf;
|
|
|
|
zeus::CTransform x2b0_grapNozLoc2Xf;
|
|
|
|
zeus::CTransform x2e0_auxXf;
|
|
|
|
zeus::CVector3f x310_grapplePointPos;
|
|
|
|
zeus::CVector3f x31c_scale;
|
|
|
|
std::unique_ptr<CGunController> x328_gunController;
|
|
|
|
CSfxHandle x32c_grappleLoopSfx;
|
|
|
|
CSfxHandle x330_swooshSfx;
|
|
|
|
EArmState x334_animState = EArmState::Done;
|
|
|
|
float x338_beamT = 0.f;
|
|
|
|
float x33c_beamDist = 0.f;
|
|
|
|
float x340_anglePhase = 0.f;
|
|
|
|
float x344_xAmplitude = 0.f;
|
|
|
|
float x348_zAmplitude = 0.f;
|
|
|
|
std::pair<u16, CSfxHandle> x34c_animSfx = {0xffff, {}};
|
|
|
|
TCachedToken<CGenDescription> x354_grappleSegmentDesc;
|
|
|
|
TCachedToken<CGenDescription> x360_grappleClawDesc;
|
|
|
|
TCachedToken<CGenDescription> x36c_grappleHitDesc;
|
|
|
|
TCachedToken<CGenDescription> x378_grappleMuzzleDesc;
|
|
|
|
TCachedToken<CSwooshDescription> x384_grappleSwooshDesc;
|
|
|
|
std::unique_ptr<CElementGen> x390_grappleSegmentGen;
|
|
|
|
std::unique_ptr<CElementGen> x394_grappleClawGen;
|
|
|
|
std::unique_ptr<CElementGen> x398_grappleHitGen;
|
|
|
|
std::unique_ptr<CElementGen> x39c_grappleMuzzleGen;
|
|
|
|
std::unique_ptr<CParticleSwoosh> x3a0_grappleSwooshGen;
|
|
|
|
std::unique_ptr<CRainSplashGenerator> x3a4_rainSplashGenerator;
|
|
|
|
CPlayerState::EPlayerSuit x3a8_loadedSuit = CPlayerState::EPlayerSuit::Invalid;
|
|
|
|
float x3ac_pitchBend = 0.f;
|
|
|
|
s16 x3b0_rumbleHandle = -1;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
bool x3b2_24_active : 1;
|
|
|
|
bool x3b2_25_beamActive : 1;
|
|
|
|
bool x3b2_26_grappleHit : 1;
|
|
|
|
bool x3b2_27_armMoving : 1;
|
|
|
|
bool x3b2_28_isGrappling : 1;
|
|
|
|
bool x3b2_29_suitLoading : 1;
|
2017-07-18 06:11:37 +00:00
|
|
|
};
|
2018-12-08 05:30:43 +00:00
|
|
|
u32 _dummy = 0;
|
|
|
|
};
|
2017-07-18 06:11:37 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
static float g_GrappleBeamAnglePhaseDelta;
|
|
|
|
static float g_GrappleBeamXWaveAmplitude;
|
|
|
|
static float g_GrappleBeamZWaveAmplitude;
|
|
|
|
static float g_GrappleBeamSpeed;
|
2017-09-04 02:22:46 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void FillTokenVector(const std::vector<SObjectTag>& tags, std::vector<CToken>& objects);
|
|
|
|
void BuildSuitDependencyList();
|
|
|
|
void LoadAnimations();
|
|
|
|
void ResetAuxParams(bool resetGunController);
|
|
|
|
void DisconnectGrappleBeam();
|
|
|
|
void LoadSuitPoll();
|
|
|
|
void BuildXRayModel();
|
|
|
|
void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type);
|
|
|
|
void DoUserAnimEvents(CStateManager& mgr);
|
|
|
|
void UpdateArmMovement(float dt, CStateManager& mgr);
|
|
|
|
void UpdateGrappleBeamFx(const zeus::CVector3f& beamGunPos, const zeus::CVector3f& beamAirPos, CStateManager& mgr);
|
|
|
|
bool UpdateGrappleBeam(float dt, const zeus::CTransform& beamLoc, CStateManager& mgr);
|
|
|
|
void UpdateSwingAction(float grappleSwingT, float dt, CStateManager& mgr);
|
|
|
|
void RenderXRayModel(const CStateManager& mgr, const zeus::CTransform& modelXf, const CModelFlags& flags) const;
|
2017-09-04 02:22:46 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
static void PointGenerator(void* ctx, const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn);
|
2017-09-04 02:22:46 +00:00
|
|
|
|
2016-08-14 21:11:44 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
explicit CGrappleArm(const zeus::CVector3f& scale);
|
|
|
|
void AsyncLoadSuit(CStateManager& mgr);
|
|
|
|
void SetTransform(const zeus::CTransform& xf) { x220_xf = xf; }
|
|
|
|
const zeus::CTransform& GetTransform() const { return x220_xf; }
|
|
|
|
zeus::CTransform& AuxTransform() { return x2e0_auxXf; }
|
|
|
|
void SetAnimState(EArmState state);
|
|
|
|
EArmState GetAnimState() const { return x334_animState; }
|
|
|
|
bool GetActive() const { return x3b2_24_active; }
|
|
|
|
bool BeamActive() const { return x3b2_25_beamActive; }
|
|
|
|
bool IsArmMoving() const { return x3b2_27_armMoving; }
|
|
|
|
bool IsGrappling() const { return x3b2_28_isGrappling; }
|
|
|
|
bool IsSuitLoading() const { return x3b2_29_suitLoading; }
|
|
|
|
void Activate(bool);
|
|
|
|
void GrappleBeamDisconnected();
|
|
|
|
void GrappleBeamConnected();
|
|
|
|
void RenderGrappleBeam(const CStateManager& mgr, const zeus::CVector3f& pos);
|
|
|
|
void TouchModel(const CStateManager& mgr) const;
|
|
|
|
void Update(float grappleSwingT, float dt, CStateManager& mgr);
|
|
|
|
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 CActorLights* lights) const;
|
|
|
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
|
|
|
void EnterStruck(CStateManager& mgr, float angle, bool bigStrike, bool notInFreeLook);
|
|
|
|
void EnterIdle(CStateManager& mgr);
|
|
|
|
void EnterFidget(CStateManager& mgr, SamusGun::EFidgetType type, s32 gunId, s32 animSet);
|
|
|
|
void EnterFreeLook(s32 gunId, s32 setId, CStateManager& mgr);
|
|
|
|
void EnterComboFire(s32 gunId, CStateManager& mgr);
|
|
|
|
void ReturnToDefault(CStateManager& mgr, float dt, bool setState);
|
|
|
|
CGunController* GunController() { return x328_gunController.get(); }
|
2016-08-14 21:11:44 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|