Finish CPlayerGun

This commit is contained in:
Jack Andersen 2017-09-01 18:06:05 -10:00
parent ddb1d584b7
commit 35ab6e4803
21 changed files with 996 additions and 350 deletions

View File

@ -15,8 +15,9 @@ class CPlayerState
{
friend class CWorldTransManager;
public:
enum class EItemType : u32
enum class EItemType : s32
{
Invalid = -1,
PowerBeam = 0,
IceBeam = 1,
WaveBeam = 2,
@ -127,7 +128,7 @@ public:
float sub_80091204() const;
u32 GetMissileCostForAltAttack() const;
static float GetMissileComboChargeFactor() { return 1.8f; }
static constexpr float GetMissileComboChargeFactor() { return 1.8f; }
u32 CalculateItemCollectionRate() const;
CHealthInfo& HealthInfo();

View File

@ -85,6 +85,7 @@ class CAnimData
{
friend class CModelData;
friend class CActor;
friend class CPlayerGun;
public:
enum class EAnimDir
{

View File

@ -17,7 +17,7 @@ public:
void Update(float);
void StopRumble(s16) {}
void Rumble(CStateManager&, ERumbleFxId, ERumblePriority priority) {}
void Rumble(CStateManager&, ERumbleFxId, float, ERumblePriority priority) {}
s16 Rumble(CStateManager&, ERumbleFxId, float, ERumblePriority priority) {return 0;}
};
}

View File

@ -9,13 +9,15 @@ enum class ERumbleFxId
{
Seven = 7,
Eleven = 11,
Twelve = 12,
Fifteen = 15
};
enum class ERumblePriority
{
None = 0,
One = 1,
Two = 2
Two = 2,
Three = 3
};
struct SAdsrData;

View File

@ -28,6 +28,18 @@ void CAuxWeapon::StopComboFx(CStateManager& mgr, bool b1)
}
bool CAuxWeapon::UpdateComboFx(float dt, const zeus::CVector3f& scale, const zeus::CVector3f& pos,
const zeus::CTransform& xf, CStateManager& mgr)
{
return false;
}
void CAuxWeapon::Fire(bool underwater, CPlayerState::EBeamId currentBeam, EChargeState chargeState,
const zeus::CTransform& xf, CStateManager& mgr, EWeaponType type, TUniqueId homingId)
{
}
void CAuxWeapon::LoadIdle()
{
@ -38,4 +50,14 @@ void CAuxWeapon::RenderMuzzleFx() const
}
TUniqueId CAuxWeapon::HasTarget(const CStateManager& mgr) const
{
return {};
}
void CAuxWeapon::SetNewTarget(TUniqueId targetId, CStateManager& mgr)
{
}
}

View File

@ -4,6 +4,7 @@
#include "CPlayerState.hpp"
#include "RetroTypes.hpp"
#include "CStateManager.hpp"
#include "CGunWeapon.hpp"
namespace urde
{
@ -17,9 +18,15 @@ public:
bool IsComboFxActive(const CStateManager& mgr) const;
void Load(CPlayerState::EBeamId curBeam, CStateManager& mgr);
void StopComboFx(CStateManager& mgr, bool b1);
bool UpdateComboFx(float dt, const zeus::CVector3f& scale, const zeus::CVector3f& pos,
const zeus::CTransform& xf, CStateManager& mgr);
void Fire(bool underwater, CPlayerState::EBeamId currentBeam, EChargeState chargeState,
const zeus::CTransform& xf, CStateManager& mgr, EWeaponType type, TUniqueId homingId);
void LoadIdle();
bool IsLoaded() const { return x80_24_isLoaded; }
void RenderMuzzleFx() const;
TUniqueId HasTarget(const CStateManager& mgr) const;
void SetNewTarget(TUniqueId targetId, CStateManager& mgr);
};
}

View File

@ -3,7 +3,7 @@
namespace urde
{
CFidget::EState CFidget::Update(int fire, bool bobbing, bool b1, float dt, CStateManager& mgr)
CFidget::EState CFidget::Update(int fire, bool bobbing, bool inStrikeCooldown, float dt, CStateManager& mgr)
{
return EState::Zero;
}

View File

@ -41,7 +41,7 @@ public:
EState GetState() const { return x0_state; }
SamusGun::EFidgetType GetType() const { return x4_type; }
s32 GetParm2() const { return xc_parm2; }
EState Update(int fire, bool bobbing, bool b1, float dt, CStateManager& mgr);
EState Update(int fire, bool bobbing, bool inStrikeCooldown, float dt, CStateManager& mgr);
void ResetMinor();
void ResetAll();
void DoneLoading() { x34_24_loading = false; }

View File

@ -82,6 +82,11 @@ void CGrappleArm::EnterFreeLook(s32 gunId, s32 setId, CStateManager& mgr)
}
void CGrappleArm::EnterComboFire(s32 gunId, CStateManager& mgr)
{
}
void CGrappleArm::ReturnToDefault(CStateManager& mgr, float f1, bool b1)
{

View File

@ -77,6 +77,7 @@ public:
void EnterIdle(CStateManager& mgr);
void EnterFidget(CStateManager& mgr, SamusGun::EFidgetType type, s32 gunId, s32 parm2);
void EnterFreeLook(s32 gunId, s32 setId, CStateManager& mgr);
void EnterComboFire(s32 gunId, CStateManager& mgr);
void ReturnToDefault(CStateManager& mgr, float f1, bool b1);
CGunController* GunController() { return x328_gunController.get(); }
};

View File

@ -1,6 +1,7 @@
#include "CGunWeapon.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
#include "Character/CModelData.hpp"
namespace urde
{
@ -55,6 +56,24 @@ void CGunWeapon::AsyncLoadSuitArm(CStateManager& mgr)
{
}
void CGunWeapon::AllocResPools(CPlayerState::EBeamId)
{
}
static const s32 skAnimTypeList[] = { 0, 4, 1, 2, 3, 5, 6, 7, 8, 9, 10 };
void CGunWeapon::PlayAnim(NWeaponTypes::EGunAnimType type, bool loop)
{
if (x218_26 && type >= NWeaponTypes::EGunAnimType::BasePosition &&
type <= NWeaponTypes::EGunAnimType::ToBeam)
{
x10_solidModelData->AnimationData()->EnableLooping(loop);
CAnimPlaybackParms parms(skAnimTypeList[int(type)], -1, 1.f, true);
x10_solidModelData->AnimationData()->SetAnimation(parms, false);
}
}
void CGunWeapon::BuildSecondaryEffect(ESecondaryFxType type)
{
switch (type)
@ -124,4 +143,9 @@ zeus::CAABox CGunWeapon::GetBounds(const zeus::CTransform& xf) const
return zeus::CAABox::skNullBox;
}
bool CGunWeapon::IsChargeAnimOver() const
{
return false;
}
}

View File

@ -63,7 +63,7 @@ protected:
TToken<CAnimCharacterSet> x104_gunCharacter;
TToken<CAnimCharacterSet> x13c_armCharacter;
rstl::reserved_vector<TCachedToken<CWeaponDescription>, 2> x144_weapons;
TToken<CGenDescription> x160_xferEffect;
TCachedToken<CGenDescription> x160_xferEffect;
rstl::reserved_vector<TCachedToken<CGenDescription>, 2> x16c_muzzleEffects;
rstl::reserved_vector<TCachedToken<CGenDescription>, 2> x188_secondaryEffects;
rstl::reserved_vector<std::unique_ptr<CElementGen>, 2> x1a4_muzzleGenerators;
@ -84,7 +84,7 @@ protected:
struct
{
bool x218_24 : 1;
bool x218_25 : 1;
bool x218_25_enableCharge : 1;
bool x218_26 : 1;
bool x218_27 : 1;
bool x218_28 : 1;
@ -97,12 +97,11 @@ public:
CGunWeapon(CAssetId ancsId, EWeaponType type, TUniqueId playerId, EMaterialTypes, const zeus::CVector3f& scale);
void AsyncLoadSuitArm(CStateManager& mgr);
void AllocResPools(CPlayerState::EBeamId);
virtual void Reset(CStateManager&) {}
virtual void PlayAnim(NWeaponTypes::EGunAnimType type, bool loop) {}
virtual void PlayAnim(NWeaponTypes::EGunAnimType type, bool loop);
virtual void PreRenderGunFx(const CStateManager&, const zeus::CTransform&) {}
virtual void PostRenderGunFx(const CStateManager&, const zeus::CTransform&) {}
virtual void UpdateGunFx(bool, float, const CStateManager&, const zeus::CTransform&) {}
virtual void UpdateGunFx(bool shotSmoke, float, const CStateManager&, const zeus::CTransform&) {}
virtual void Fire(bool underwater, float dt, EChargeState chargeState, const zeus::CTransform& xf,
CStateManager& mgr, TUniqueId homingTarget) {}
virtual void EnableFx(bool) {}
@ -123,7 +122,9 @@ public:
const CVelocityInfo& GetVelocityInfo() const { return x1d0_velInfo; }
void SetRainSplashGenerator(CRainSplashGenerator* g) { x1bc_rainSplashGenerator = g; }
CElementGen* GetChargeMuzzleFx() const { return x1a4_muzzleGenerators[1].get(); }
const TToken<CGenDescription>& GetComboXferDescr() const { return x160_xferEffect; }
void ReturnToDefault(CStateManager& mgr) {}
bool PlayPasAnim(SamusGun::EAnimationState state, CStateManager& mgr, float angle) { return false; }
void UnLoadFidget() {}
bool IsFidgetLoaded() const { return x100_gunController->IsFidgetLoaded(); }
void AsyncLoadFidget(CStateManager& mgr, SamusGun::EFidgetType type, s32 parm2)
@ -133,9 +134,13 @@ public:
bool HasSolidModelData() const { return x10_solidModelData.operator bool(); }
CModelData& GetSolidModelData() { return *x10_solidModelData; }
const SWeaponInfo& GetWeaponInfo() const;
EWeaponType GetWeaponType() const { return x1c0_weaponType; }
zeus::CAABox GetBounds() const;
zeus::CAABox GetBounds(const zeus::CTransform& xf) const;
bool ComboFireOver() const { return x100_gunController->IsComboOver(); }
bool IsChargeAnimOver() const;
void SetLeavingBeam(bool leaving) { x218_29_leavingBeam = leaving; }
void EnableCharge(bool c) { x218_25_enableCharge = c; }
};
}

View File

@ -31,4 +31,10 @@ void CPhazonBeam::StopBeam(CStateManager& mgr, bool b1)
}
void CPhazonBeam::UpdateBeam(float dt, const zeus::CTransform& targetXf,
const zeus::CVector3f& localBeamPos, CStateManager& mgr)
{
}
}

View File

@ -29,6 +29,8 @@ public:
void SetX274_25(bool b) { x274_25 = b; }
void SetX274_26(bool b) { x274_26 = b; }
void StopBeam(CStateManager& mgr, bool b1);
void UpdateBeam(float dt, const zeus::CTransform& targetXf,
const zeus::CVector3f& localBeamPos, CStateManager& mgr);
};
}

View File

@ -22,6 +22,8 @@ public:
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
bool IsFiring() const { return x234_ > 0.f; }
void StopBeam(CStateManager& mgr, bool b1) {}
void UpdateBeam(float dt, const zeus::CTransform& targetXf,
const zeus::CVector3f& localBeamPos, CStateManager& mgr) {}
};
}

File diff suppressed because it is too large Load Diff

View File

@ -38,12 +38,47 @@ public:
Bomb,
PowerBomb
};
enum class EGunOverrideMode
enum class EPhazonBeamState
{
Normal,
One,
Two,
Three
Inactive,
Entering,
Exiting,
Active
};
enum class EChargePhase
{
NotCharging,
ChargeRequested,
AnimAndSfx,
FxGrowing,
FxGrown,
ComboXfer,
ComboXferDone,
ComboFire,
ComboFireDone,
ChargeCancelled,
ChargeDone
};
enum class ENextState
{
StatusQuo,
EnterMissile,
ExitMissile,
MissileShotDone,
MissileReload,
ChangeWeapon,
SetupBeam,
Seven,
EnterPhazonBeam,
ExitPhazonBeam
};
enum class EIdleState
{
NotIdle,
Wander,
Idle,
Three,
Four
};
private:
class CGunMorph
@ -107,25 +142,31 @@ private:
{
Zero,
One,
Two
LockOn,
CancelLockOn
};
enum class EFireState
{
NotFiring,
StartFire,
Firing
};
private:
static float gGunExtendDistance;
bool x0_24_ = true;
float x4_ = 0.f;
float x8_ = 0.f;
float xc_ = 0.f;
float x10_ = 0.f;
float x14_ = 0.f;
float x18_ = 0.f;
float x1c_ = 0.f;
bool x0_24_extendParabola = true;
float x4_extendParabolaDelayTimer = 0.f;
float x8_fireTime = 0.f;
float xc_curExtendDist = 0.f;
float x10_curRotation = 0.f;
float x14_rotationT = 0.f;
float x18_startRotation = 0.f;
float x1c_endRotation = 0.f;
EMotionState x20_state = EMotionState::Zero;
u32 x24_ = 0;
EFireState x24_fireState = EFireState::NotFiring;
public:
static void SetExtendDistance(float d) { gGunExtendDistance = d; }
void SetState(EMotionState state) { x20_state = state; }
void Update(bool b1, float dt, zeus::CTransform& xf, CStateManager& mgr);
void Update(bool firing, float dt, zeus::CTransform& xf, CStateManager& mgr);
};
CActorLights x0_lights;
@ -136,49 +177,50 @@ private:
u32 x2ec_lastFireButtonStates = 0;
u32 x2f0_pressedFireButtonStates = 0;
u32 x2f4_fireButtonStates = 0;
u32 x2f8_ = 1;
// 0x1: beam mode, 0x2: missile mode, 0x4: missile ready, 0x8: morphing, 0x10: combo fire
u32 x2f8_stateFlags = 0x1;
u32 x2fc_fidgetAnimBits = 0;
u32 x300_ = 0;
u32 x300_remainingMissiles = 0;
u32 x304_ = 0;
u32 x308_bombCount = 3;
u32 x30c_ = 0;
u32 x30c_rapidFireShots = 0;
CPlayerState::EBeamId x310_currentBeam = CPlayerState::EBeamId::Power;
CPlayerState::EBeamId x314_nextBeam = CPlayerState::EBeamId::Power;
u32 x318_ = 0;
u32 x318_comboAmmoIdx = 0;
EMissleMode x31c_missileMode = EMissleMode::Inactive;
CPlayerState::EBeamId x320_currentAuxBeam = CPlayerState::EBeamId::Power;
u32 x324_ = 4;
u32 x328_ = 0x2000;
u32 x32c_ = 0;
EIdleState x324_idleState = EIdleState::Four;
float x328_animSfxPitch = 0.f;
EChargePhase x32c_chargePhase = EChargePhase::NotCharging;
EChargeState x330_chargeState = EChargeState::Normal;
u32 x334_ = 0;
u32 x338_ = 0;
EGunOverrideMode x33c_gunOverrideMode = EGunOverrideMode::Normal;
ENextState x338_nextState = ENextState::StatusQuo;
EPhazonBeamState x33c_phazonBeamState = EPhazonBeamState::Inactive;
float x340_chargeBeamFactor = 0.f;
float x344_ = 0.f;
float x348_ = 0.f;
float x344_comboXferTimer = 0.f;
float x348_chargeCancelTimer = 0.f;
float x34c_shakeX = 0.f;
float x350_shakeZ = 0.f;
float x354_bombFuseTime;
float x358_bombDropDelayTime;
float x35c_bombTime = 0.f;
float x360_ = 0.f;
float x364_ = 0.f;
float x368_ = 0.f;
float x364_gunStrikeCoolTimer = 0.f;
float x368_idleWanderDelayTimer = 0.f;
float x36c_ = 1.f;
float x370_gunMotionSpeedMult = 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 x378_shotSmokeStartTimer = 0.f;
float x37c_rapidFireShotsDecayTimer = 0.f;
float x380_shotSmokeTimer = 0.f;
float x384_gunStrikeDelayTimer = 0.f;
float x388_enterFreeLookDelayTimer = 0.f;
float x38c_muzzleEffectVisTimer = 0.f;
float x390_cooldown = 0.f;
float x394_damageTimer = 0.f;
float x398_damageAmt = 0.f;
float x39c_phazonMorphT = 0.f;
float x3a0_ = 0.f;
float x3a0_missileExitTimer = 0.f;
CFidget x3a4_fidget;
zeus::CVector3f x3dc_damageLocation;
zeus::CTransform x3e8_xf;
@ -199,8 +241,7 @@ private:
float x664_ = 0.f;
float x668_aimVerticalSpeed;
float x66c_aimHorizontalSpeed;
TUniqueId x670_ = kInvalidUniqueId;
u32 x674_ = 0;
std::pair<u16, CSfxHandle> x670_animSfx = {0xffff, {}};
CGunMorph x678_morph;
CMotionState x6a0_motionState;
zeus::CAABox x6c8_hologramClipCube;
@ -220,7 +261,7 @@ private:
std::unique_ptr<CPhazonBeam> x75c_phazonBeam;
CGunWeapon* x760_selectableBeams[4] = {}; // Used to be reserved_vector
std::unique_ptr<CElementGen> x774_holoTransitionGen;
std::unique_ptr<CElementGen> x77c_;
std::unique_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<std::unique_ptr<CElementGen>, 5> x800_auxMuzzleGenerators;
@ -231,14 +272,14 @@ private:
{
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;
bool x832_24_cancellingCharge : 1;
bool x832_25_chargeEffectVisible : 1;
bool x832_26_comboFiring : 1;
bool x832_27_chargeAnimStarted : 1;
bool x832_28_readyForShot : 1;
bool x832_29_lockedOn : 1;
bool x832_30_requestReturnToDefault : 1;
bool x832_31_inRestPose : 1;
bool x833_24_isFidgeting : 1;
bool x833_25_ : 1;
@ -246,17 +287,17 @@ private:
bool x833_27_ : 1;
bool x833_28_phazonBeamActive : 1;
bool x833_29_pointBlankWorldSurface : 1;
bool x833_30_ : 1;
bool x833_31_ : 1;
bool x833_30_canShowAuxMuzzleEffect : 1;
bool x833_31_inFreeLook : 1;
bool x834_24_charging : 1;
bool x834_25_ : 1;
bool x834_26_ : 1;
bool x834_25_gunMotionFidgeting : 1;
bool x834_26_animPlaying : 1;
bool x834_27_underwater : 1;
bool x834_28_ : 1;
bool x834_28_requestImmediateRecharge : 1;
bool x834_29_frozen : 1;
bool x834_30_inBigStrike : 1;
bool x834_31_ : 1;
bool x834_31_gunMotionInFidgetBasePosition : 1;
bool x835_24_canFirePhazon : 1;
bool x835_25_inPhazonBeam : 1;
@ -277,7 +318,7 @@ private:
void LoadHandAnimTokens();
void CreateGunLight(CStateManager& mgr);
void DeleteGunLight(CStateManager& mgr);
void UpdateGunLight(const zeus::CTransform& pos, CStateManager& mgr);
void UpdateGunLight(const zeus::CTransform& xf, CStateManager& mgr);
void SetGunLightActive(bool active, CStateManager& mgr);
void SetPhazonBeamMorph(bool intoPhazonBeam);
void Reset(CStateManager& mgr, bool b1);
@ -288,7 +329,7 @@ private:
bool ExitMissile();
void StopChargeSound(CStateManager& mgr);
void UnLoadFidget();
void ReturnArmAndGunToDefault(CStateManager& mgr, bool b1);
void ReturnArmAndGunToDefault(CStateManager& mgr, bool returnToDefault);
void ReturnToRestPose();
void ChangeWeapon(const CPlayerState& playerState, CStateManager& mgr);
void GetLctrWithShake(zeus::CTransform& xfOut, const CModelData& mData, const std::string& lctrName,
@ -298,8 +339,10 @@ private:
void SetPhazonBeamFeedback(bool active);
void StartPhazonBeamTransition(bool active, CStateManager& mgr, CPlayerState& playerState);
void ProcessPhazonGunMorph(float dt, CStateManager& mgr);
void EnableChargeFx(EChargeState state, CStateManager& mgr);
void UpdateChargeState(float dt, CStateManager& mgr);
void UpdateAuxWeapons(float dt, const zeus::CTransform& targetXf, CStateManager& mgr);
void DoUserAnimEvent(float dt, CStateManager& mgr, const CInt32POINode& node, EUserEventType type);
void DoUserAnimEvents(float dt, CStateManager& mgr);
TUniqueId GetTargetId(CStateManager& mgr) const;
void CancelLockOn();
@ -316,7 +359,7 @@ private:
void AsyncLoadFidget(CStateManager& mgr);
bool IsFidgetLoaded() const;
void EnterFidget(CStateManager& mgr);
void UpdateGunIdle(bool b1, float camBobT, float dt, CStateManager& mgr);
void UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, CStateManager& mgr);
void RenderEnergyDrainEffects(const CStateManager& mgr) const;
void DrawArm(const CStateManager& mgr, const zeus::CVector3f& pos, const CModelFlags& flags) const;
zeus::CVector3f ConvertToScreenSpace(const zeus::CVector3f& pos, const CGameCamera& cam) const;

View File

@ -10,7 +10,7 @@ class CPowerBeam : public CGunWeapon
{
TCachedToken<CGenDescription> x21c_shotSmoke;
TCachedToken<CGenDescription> x228_power2nd1;
u32 x234_ = 0;
std::unique_ptr<CElementGen> x234_shotSmokeGen;
float x23c_ = 0.f;
u32 x240_ = 0;
bool x244_24 : 1;

View File

@ -3,6 +3,8 @@
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
#include "Character/CPrimitive.hpp"
#include "Audio/CSfxManager.hpp"
#include "CStateManager.hpp"
namespace urde
{
@ -78,5 +80,83 @@ void get_token_vector(CAnimData& animData, int animIdx, std::vector<CToken>& tok
primitive_set_to_token_vector(animData, prims, tokensOut, preLock);
}
void do_sound_event(std::pair<u16, CSfxHandle>& sfxHandle, float& pitch, bool doPitchBend, u32 soundId,
float weight, u32 flags, float falloff, float maxDist, float minVol, float maxVol,
const zeus::CVector3f& posToCam, const zeus::CVector3f& pos, TAreaId aid,
CStateManager& mgr)
{
if (posToCam.magSquared() >= maxDist * maxDist)
return;
u16 useSfxId = CSfxManager::TranslateSFXID(u16(soundId));
u32 useFlags = 0x1; // Continuous parameter update
if ((flags & 0x8) != 0)
useFlags |= 0x8; // Doppler effect
bool useAcoustics = (flags & 0x80) == 0;
CAudioSys::C3DEmitterParmData parms;
parms.x0_pos = pos;
parms.xc_dir = zeus::CVector3f::skUp;
parms.x18_maxDist = maxDist;
parms.x1c_distComp = falloff;
parms.x20_flags = useFlags;
parms.x24_sfxId = useSfxId;
parms.x26_maxVol = maxVol;
parms.x27_minVol = minVol;
parms.x28_important = false;
parms.x29_prio = 0x7f;
if (mgr.GetActiveRandom()->Float() <= weight)
{
if ((soundId & 0x80000000) != 0)
{
if (!sfxHandle.second)
{
CSfxHandle hnd;
if ((soundId & 0x40000000) != 0)
hnd = CSfxManager::SfxStart(useSfxId, 1.f, 0.f, true, 0x7f, true, aid);
else
hnd = CSfxManager::AddEmitter(parms, useAcoustics, 0x7f, true, aid);
if (hnd)
{
sfxHandle.first = useSfxId;
sfxHandle.second = hnd;
if (doPitchBend)
CSfxManager::PitchBend(hnd, pitch);
}
}
else
{
if (sfxHandle.first == useSfxId)
{
CSfxManager::UpdateEmitter(sfxHandle.second, parms.x0_pos, parms.xc_dir, parms.x26_maxVol);
}
else if ((flags & 0x4) != 0) // Pausable
{
CSfxManager::RemoveEmitter(sfxHandle.second);
CSfxHandle hnd = CSfxManager::AddEmitter(parms, useAcoustics, 0x7f, true, aid);
if (hnd)
{
sfxHandle.first = useSfxId;
sfxHandle.second = hnd;
if (doPitchBend)
CSfxManager::PitchBend(hnd, pitch);
}
}
}
}
else
{
CSfxHandle hnd;
if ((soundId & 0x40000000) != 0)
hnd = CSfxManager::SfxStart(useSfxId, 1.f, 0.f, true, 0x7f, false, aid);
else
hnd = CSfxManager::AddEmitter(parms, useAcoustics, 0x7f, false, aid);
if (doPitchBend)
CSfxManager::PitchBend(hnd, pitch);
}
}
}
}
}

View File

@ -3,6 +3,7 @@
#include "RetroTypes.hpp"
#include "DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp"
#include "Audio/CSfxManager.hpp"
#include <set>
namespace urde
@ -10,6 +11,8 @@ namespace urde
class CAnimData;
class CToken;
class CPrimitive;
class CStateManager;
enum class EWeaponType
{
None = -1,
@ -35,17 +38,17 @@ namespace NWeaponTypes
enum class EGunAnimType
{
Zero,
One,
Two,
Three,
Four,
BasePosition,
Shoot,
ChargeUp,
ChargeLoop,
ChargeShoot,
FromMissile,
ToMissile,
Seven,
MissileShoot,
MissileReload,
FromBeam,
Ten
ToBeam
};
void primitive_set_to_token_vector(const CAnimData& animData, const std::set<CPrimitive>& primSet,
@ -55,6 +58,10 @@ void lock_tokens(std::vector<CToken>& anims);
bool are_tokens_ready(const std::vector<CToken>& anims);
void get_token_vector(CAnimData& animData, int begin, int end, std::vector<CToken>& tokensOut, bool preLock);
void get_token_vector(CAnimData& animData, int animIdx, std::vector<CToken>& tokensOut, bool preLock);
void do_sound_event(std::pair<u16, CSfxHandle>& sfxHandle, float& pitch, bool doPitchBend, u32 soundId,
float weight, u32 flags, float falloff, float maxDist, float minVol, float maxVol,
const zeus::CVector3f& posToCam, const zeus::CVector3f& pos, TAreaId aid,
CStateManager& mgr);
}

View File

@ -561,6 +561,7 @@ public:
bool ValidateAimTargetId(TUniqueId, CStateManager& mgr);
bool ValidateObjectForMode(TUniqueId, CStateManager& mgr) const;
TUniqueId FindAimTargetId(CStateManager& mgr);
TUniqueId GetAimTarget() const { return x3f4_aimTarget; }
TUniqueId CheckEnemiesAgainstOrbitZone(const std::vector<TUniqueId>&, EPlayerZoneInfo, EPlayerZoneType,
CStateManager& mgr) const;
TUniqueId FindOrbitTargetId(CStateManager& mgr);
@ -634,6 +635,7 @@ public:
EPlayerScanState GetScanningState() const { return x3a8_scanState; }
float GetScanningTime() const { return x3ac_scanningTime; }
TUniqueId GetOrbitTargetId() const { return x310_orbitTargetId; }
TUniqueId GetOrbitNextTargetId() const { return x33c_orbitNextTargetId; }
TUniqueId GetScanningObjectId() const { return x3b4_scanningObject; }
EGrappleState GetGrappleState() const { return x3b8_grappleState; }
bool IsNewScanScanning() const { return x9c6_30_newScanScanning; }