mirror of https://github.com/AxioDL/metaforce.git
More gun implementations, and script objects
This commit is contained in:
parent
be40ebc8db
commit
5793c8df87
|
@ -95,6 +95,10 @@ public:
|
|||
Phazon
|
||||
};
|
||||
|
||||
enum class EChargeState : u32
|
||||
{
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
static const u32 PowerUpMaxValues[41];
|
||||
|
@ -107,7 +111,7 @@ private:
|
|||
};
|
||||
union
|
||||
{
|
||||
struct { bool x0_24_ : 1; bool x0_25_ : 1; bool x0_26_fusion; };
|
||||
struct { bool x0_24_ : 1; bool x0_25_ : 1; bool x0_26_fusion : 1; };
|
||||
u32 dummy = 0;
|
||||
};
|
||||
|
||||
|
@ -137,6 +141,7 @@ public:
|
|||
EPlayerSuit GetCurrentSuit() const;
|
||||
EBeamId GetCurrentBeam() const { return x8_currentBeam; }
|
||||
bool CanVisorSeeFog(const CStateManager& stateMgr) const;
|
||||
EPlayerVisor GetCurrentVisor() const { return x14_currentVisor; }
|
||||
EPlayerVisor GetActiveVisor(const CStateManager& stateMgr) const;
|
||||
void UpdateStaticInterference(CStateManager& stateMgr, const float& dt);
|
||||
void IncreaseScanTime(u32 time, float val);
|
||||
|
|
|
@ -161,6 +161,7 @@ public:
|
|||
void DelAdditiveAnimation(u32);
|
||||
void AddAdditiveAnimation(u32, float, bool, bool);
|
||||
std::shared_ptr<CAnimationManager> GetAnimationManager();
|
||||
const CCharacterInfo& GetCharacterInfo() const { return xc_charInfo; }
|
||||
const CCharLayoutInfo& GetCharLayoutInfo() const { return *xcc_layoutData.GetObj(); }
|
||||
void SetPhase(float);
|
||||
void Touch(const CSkinnedModel& model, int shaderIdx) const;
|
||||
|
|
|
@ -8,17 +8,24 @@ namespace urde
|
|||
class CPASAnimParmData
|
||||
{
|
||||
s32 x0_stateId;
|
||||
rstl::reserved_vector<CPASAnimParm,8> x4_parms;
|
||||
rstl::reserved_vector<CPASAnimParm, 8> x4_parms;
|
||||
|
||||
public:
|
||||
CPASAnimParmData()
|
||||
{};
|
||||
CPASAnimParmData() {}
|
||||
|
||||
CPASAnimParmData(s32 stateId, const CPASAnimParm& parm1, const CPASAnimParm& parm2, const CPASAnimParm& parm3,
|
||||
const CPASAnimParm& parm4, const CPASAnimParm& parm5, const CPASAnimParm& parm6,
|
||||
const CPASAnimParm& parm7, const CPASAnimParm& parm8);
|
||||
|
||||
s32 GetStateId();
|
||||
const rstl::reserved_vector<CPASAnimParm,8>& GetAnimParmData() const;
|
||||
const rstl::reserved_vector<CPASAnimParm, 8>& GetAnimParmData() const;
|
||||
|
||||
static inline CPASAnimParmData NoParameters(s32 stateId)
|
||||
{
|
||||
return {stateId, CPASAnimParm::NoParameter(), CPASAnimParm::NoParameter(), CPASAnimParm::NoParameter(),
|
||||
CPASAnimParm::NoParameter(), CPASAnimParm::NoParameter(), CPASAnimParm::NoParameter(),
|
||||
CPASAnimParm::NoParameter(), CPASAnimParm::NoParameter()};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#include "CGSComboFire.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
bool CGSComboFire::Update(CAnimData&, float, CStateManager&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CGSComboFire::SetAnim(CAnimData&, s32, s32, s32, CStateManager&, float)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -6,6 +6,8 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
class CAnimData;
|
||||
class CStateManager;
|
||||
class CGSComboFire
|
||||
{
|
||||
float x0_ = 0.f;
|
||||
|
@ -22,6 +24,14 @@ class CGSComboFire
|
|||
};
|
||||
u8 _dummy = 0;
|
||||
};
|
||||
public:
|
||||
bool IsComboOver() const;
|
||||
s32 GetLoopState() const;
|
||||
void SetLoopState(s32);
|
||||
void SetIdle(bool);
|
||||
void GetGunId() const;
|
||||
bool Update(CAnimData&, float, CStateManager&);
|
||||
void SetAnim(CAnimData&, s32, s32, s32, CStateManager&, float);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#include "CGSFidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
bool CGSFidget::Update(CAnimData&, float, CStateManager&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CAnimData;
|
||||
class CStateManager;
|
||||
class CGSFidget
|
||||
{
|
||||
u32 x4_ = 0;
|
||||
|
@ -14,6 +15,12 @@ class CGSFidget
|
|||
u32 x10_ = -1;
|
||||
u32 x14_ = -1;
|
||||
u32 x18_ = -1;
|
||||
public:
|
||||
bool Update(CAnimData&, float, CStateManager&);
|
||||
void SetAnim(CAnimData&, s32, s32, s32, CStateManager&);
|
||||
void LoadAnimAsync(CAnimData, s32, s32, s32, CStateManager&);
|
||||
void UnLoadAnim();
|
||||
bool IsAnimLoaded() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#include "CGSFreeLook.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "Character/CAnimData.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
s32 CGSFreeLook::GetSetId() const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool CGSFreeLook::Update(CAnimData& animData, float dt, CStateManager& mgr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 CGSFreeLook::SetAnim(CAnimData&, s32, s32, s32, CStateManager&, float)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -6,14 +6,25 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
class CAnimData;
|
||||
class CStateManager;
|
||||
class CGSFreeLook
|
||||
{
|
||||
friend class CGunController;
|
||||
float x0_ = 0.f;
|
||||
u32 x4_ = -1;
|
||||
s32 x4_ = -1;
|
||||
u32 x8_ = -1;
|
||||
u32 xc_ = 0;
|
||||
u32 x10_ = -1;
|
||||
bool x14_ = false;
|
||||
public:
|
||||
s32 GetSetId() const;
|
||||
void SetLoopState(s32);
|
||||
s32 GetLoopState() const;
|
||||
s32 GetGunId() const;
|
||||
bool Update(CAnimData&, float, CStateManager&);
|
||||
u32 SetAnim(CAnimData&, s32, s32, s32, CStateManager&, float);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,67 @@
|
|||
#include "CGunController.hpp"
|
||||
#include "Character/CCharLayoutInfo.hpp"
|
||||
#include "Character/CPASAnimParmData.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CGunController::CGunController(CModelData& modelData)
|
||||
: x0_modelData(modelData)
|
||||
bool CGunController::Update(float dt, CStateManager& mgr)
|
||||
{
|
||||
x58_24_ = true;
|
||||
CAnimData& animData = *x0_modelData.AnimationData();
|
||||
switch (x50_gunState)
|
||||
{
|
||||
case EGunState::FreeLook:
|
||||
{
|
||||
x58_24_ = x4_freeLook.Update(animData, dt, mgr);
|
||||
if (!x58_24_ || !x58_25_)
|
||||
break;
|
||||
|
||||
EnterComboFire(mgr, x4_freeLook.xc_);
|
||||
x58_24_ = false;
|
||||
break;
|
||||
}
|
||||
case EGunState::ComboFire:
|
||||
x58_24_ = x1c_comboFire.Update(animData, dt, mgr);
|
||||
break;
|
||||
case EGunState::Fidget:
|
||||
x58_24_ = x30_fidget.Update(animData, dt, mgr);
|
||||
break;
|
||||
case EGunState::Six:
|
||||
{
|
||||
if (animData.IsAnimTimeRemaining(0.001f, "Whole Body"))
|
||||
break;
|
||||
x54_ = x4_freeLook.SetAnim(animData, x4_freeLook.xc_, x4_freeLook.x10_, 0, mgr, 0.f);
|
||||
x50_gunState = EGunState::FreeLook;
|
||||
break;
|
||||
}
|
||||
case EGunState::Seven:
|
||||
x58_24_ = !animData.IsAnimTimeRemaining(0.001f, "Whole Body");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!x58_24_)
|
||||
return false;
|
||||
|
||||
x50_gunState = EGunState::Zero;
|
||||
x58_25_ = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CGunController::ReturnToBasePosition(CStateManager& mgr, float)
|
||||
{
|
||||
const CPASDatabase& pasDatabase = x0_modelData.AnimationData()->GetCharacterInfo().GetPASDatabase();
|
||||
std::pair<float, s32> anim =
|
||||
pasDatabase.FindBestAnimation(CPASAnimParmData::NoParameters(6), *mgr.GetActiveRandom(), -1);
|
||||
}
|
||||
|
||||
void CGunController::Reset()
|
||||
{
|
||||
x58_24_ = true;
|
||||
x58_25_ = false;
|
||||
x50_gunState = EGunState::Zero;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,17 @@
|
|||
|
||||
namespace urde
|
||||
{
|
||||
enum class EGunState
|
||||
{
|
||||
Zero,
|
||||
One,
|
||||
FreeLook,
|
||||
ComboFire,
|
||||
Four,
|
||||
Fidget,
|
||||
Six,
|
||||
Seven
|
||||
};
|
||||
|
||||
class CGunController
|
||||
{
|
||||
|
@ -15,11 +26,10 @@ class CGunController
|
|||
CGSFreeLook x4_freeLook;
|
||||
CGSComboFire x1c_comboFire;
|
||||
CGSFidget x30_fidget;
|
||||
u32 x50_ = 0;
|
||||
EGunState x50_gunState = EGunState::Zero;
|
||||
u32 x54_ = -1;
|
||||
|
||||
union
|
||||
{
|
||||
union {
|
||||
struct
|
||||
{
|
||||
bool x58_24_ : 1;
|
||||
|
@ -27,10 +37,24 @@ class CGunController
|
|||
};
|
||||
u8 _dummy = 0;
|
||||
};
|
||||
public:
|
||||
CGunController(CModelData& modelData);
|
||||
};
|
||||
|
||||
public:
|
||||
CGunController(CModelData& modelData) : x0_modelData(modelData), x58_24_(true) {}
|
||||
void UnLoadFidget();
|
||||
void LoadFidgetAnimAsync(CStateManager&, s32, s32, s32);
|
||||
void GetFreeLookSetId() const;
|
||||
bool IsFidgetLoaded() const;
|
||||
bool IsComboOver() const;
|
||||
void EnterFreeLook(CStateManager&, s32, s32);
|
||||
void EnterComboFire(CStateManager&, s32);
|
||||
void EnterFidget(CStateManager&, s32, s32, s32);
|
||||
void EnterStruck(CStateManager&, float);
|
||||
void EnterIdle(CStateManager&);
|
||||
bool Update(float, CStateManager&);
|
||||
void ReturnToDefault(CStateManager&, float);
|
||||
void ReturnToBasePosition(CStateManager&, float);
|
||||
void Reset();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUNCONTROLLER_HPP__
|
||||
|
|
|
@ -1,9 +1,52 @@
|
|||
#include "CGunWeapon.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
const char* CGunWeapon::skBeamXferNames[5] =
|
||||
{
|
||||
"PowerXfer",
|
||||
"IceXfer",
|
||||
"WaveXfer",
|
||||
"PlasmaXfer",
|
||||
"PhazonXfer"
|
||||
};
|
||||
|
||||
CGunWeapon::CGunWeapon(u32, EWeaponType type, TUniqueId, EMaterialTypes, const zeus::CVector3f& vec)
|
||||
const char* CGunWeapon::skSuitArmNames[8] =
|
||||
{
|
||||
"PowerArm",
|
||||
"GravityArm",
|
||||
"VariaArm",
|
||||
"PhazonArm",
|
||||
"FusionArm",
|
||||
"FusionArmG",
|
||||
"FusionArmV",
|
||||
"FusionArmP",
|
||||
};
|
||||
|
||||
s32 GetWeaponIndex(EWeaponType type)
|
||||
{
|
||||
if (type == EWeaponType::Power)
|
||||
return 0;
|
||||
else if (type == EWeaponType::Ice)
|
||||
return 1;
|
||||
else if (type == EWeaponType::Wave)
|
||||
return 2;
|
||||
else if (type == EWeaponType::Plasma)
|
||||
return 3;
|
||||
else if (type == EWeaponType::Phazon)
|
||||
return 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGunWeapon::CGunWeapon(ResId ancsId, EWeaponType type, TUniqueId uid, EMaterialTypes mType, const zeus::CVector3f& vec)
|
||||
: x4_(vec),
|
||||
x104_gunCharacter(g_SimplePool->GetObj({ancsId, FOURCC('ANCS')})),
|
||||
x13c_armCharacter(g_SimplePool->GetObj(skSuitArmNames[0])),
|
||||
x1c0_weaponType(type),
|
||||
x1c4_uid(uid),
|
||||
x1c8_matType(mType)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -5,18 +5,63 @@
|
|||
#include "CWeaponMgr.hpp"
|
||||
#include "Collision/CMaterialList.hpp"
|
||||
#include "zeus/CVector3f.hpp"
|
||||
#include "CPlayerState.hpp"
|
||||
#include "Character/CAnimCharacterSet.hpp"
|
||||
#include "Particle/CElementGen.hpp"
|
||||
#include "CToken.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CStateManager;
|
||||
namespace NWeaponTypes
|
||||
{
|
||||
enum class EGunAnimType
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
class CActorLights;
|
||||
class CGunController;
|
||||
class CModelFlags;
|
||||
class CStateManager;
|
||||
class CGunWeapon
|
||||
{
|
||||
public:
|
||||
CGunWeapon(u32, EWeaponType type, TUniqueId, EMaterialTypes, const zeus::CVector3f& vec);
|
||||
enum class ESecondaryFxType : u32
|
||||
{
|
||||
};
|
||||
protected:
|
||||
static const char* skBeamXferNames[5];
|
||||
static const char* skAnimDependencyNames[5];
|
||||
static const char* skDependencyNames[5];
|
||||
static const char* skSuitArmNames[8];
|
||||
zeus::CVector3f x4_;
|
||||
TToken<CAnimCharacterSet> x104_gunCharacter;
|
||||
TToken<CAnimCharacterSet> x13c_armCharacter;
|
||||
EWeaponType x1c0_weaponType;
|
||||
TUniqueId x1c4_uid;
|
||||
EMaterialTypes x1c8_matType;
|
||||
CPlayerState::EBeamId x200_beamId;
|
||||
public:
|
||||
CGunWeapon(ResId ancsId, EWeaponType type, TUniqueId uid, EMaterialTypes, const zeus::CVector3f& vec);
|
||||
void AsyncLoadSuitArm(CStateManager& mgr);
|
||||
};
|
||||
void AllocResPools(CPlayerState::EBeamId);
|
||||
|
||||
virtual void Reset(CStateManager&) {}
|
||||
virtual void PlayAnim(NWeaponTypes::EGunAnimType, bool) {}
|
||||
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 Fire(bool, float, CPlayerState::EChargeState, const zeus::CTransform&, CStateManager&, TUniqueId) {}
|
||||
virtual void EnableFx(bool) {}
|
||||
virtual void EnableSecondaryFx(ESecondaryFxType) {}
|
||||
virtual void Draw(bool, const CStateManager&, const zeus::CTransform&, const CModelFlags&,
|
||||
const CActorLights*) const {}
|
||||
virtual void DrawMuzzleFx(const CStateManager&) const {}
|
||||
virtual void Update(float, CStateManager&) {}
|
||||
virtual void Load(bool) {}
|
||||
virtual void Unload(CStateManager&) {}
|
||||
virtual bool IsLoaded() const {return false;}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUNWEAPON_HPP__
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#include "CPowerBeam.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
CPowerBeam::CPowerBeam(u32 w1, EWeaponType wType, TUniqueId uid, EMaterialTypes mType, const zeus::CVector3f& vec)
|
||||
: CGunWeapon(w1, wType, uid, mType, vec)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -8,6 +8,8 @@ namespace urde
|
|||
|
||||
class CPowerBeam : public CGunWeapon
|
||||
{
|
||||
public:
|
||||
CPowerBeam(u32, EWeaponType, TUniqueId, EMaterialTypes, const zeus::CVector3f&);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#include "CWeaponMgr.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
}
|
|
@ -28,6 +28,14 @@ enum class EWeaponType
|
|||
|
||||
class CWeaponMgr
|
||||
{
|
||||
std::map<TUniqueId, rstl::reserved_vector<s32, 10>> x0_weapons;
|
||||
public:
|
||||
void Add(TUniqueId, EWeaponType);
|
||||
void Remove(TUniqueId);
|
||||
void IncrCount(TUniqueId, EWeaponType);
|
||||
void DecrCount(TUniqueId, EWeaponType);
|
||||
s32 GetNumActive(TUniqueId, EWeaponType) const;
|
||||
s32 GetIndex(TUniqueId) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@ protected:
|
|||
bool xe6_26_inFluid : 1;
|
||||
bool xe6_30_enablePitchBend : 1;
|
||||
bool xe7_29_ : 1;
|
||||
bool xe7_30_ : 1;
|
||||
bool xe7_31_ : 1;
|
||||
};
|
||||
u32 dummy = 0;
|
||||
};
|
||||
|
|
|
@ -32,6 +32,13 @@ public:
|
|||
: x4_lightParms(lightParms), x40_scanParms(scanParms),
|
||||
x44_xrayAssets(xrayAssets), x4c_thermalAssets(thermalAssets),
|
||||
x54_visorParms(visorParms), b1(a), b2(b), b3(c), b4(d) {}
|
||||
CActorParameters Scannable(const CScannableParameters& sParms) const
|
||||
{
|
||||
CActorParameters aParms = *this;
|
||||
aParms.x40_scanParms = sParms;
|
||||
return aParms;
|
||||
}
|
||||
|
||||
static CActorParameters None() {return CActorParameters();}
|
||||
|
||||
void SetVisorParameters(const CVisorParameters& vParams) { x54_visorParms = vParams; }
|
||||
|
|
|
@ -42,6 +42,8 @@ set(WORLD_SOURCES
|
|||
CScriptActorKeyframe.hpp CScriptActorKeyframe.cpp
|
||||
CScriptWater.hpp CScriptWater.cpp
|
||||
CScriptGrapplePoint.hpp CScriptGrapplePoint.cpp
|
||||
CScriptPickupGenerator.hpp CScriptPickupGenerator.cpp
|
||||
CScriptPointOfInterest.hpp CScriptPointOfInterest.cpp
|
||||
CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp
|
||||
CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp
|
||||
CScriptCoverPoint.hpp CScriptCoverPoint.cpp
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
#include "CScriptPickupGenerator.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
CScriptPickupGenerator::CScriptPickupGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CVector3f& pos, float frequency, bool active)
|
||||
: CEntity(uid, info, active, name), x34_position(pos), x40_frequency(frequency)
|
||||
{
|
||||
}
|
||||
|
||||
void CScriptPickupGenerator::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
|
||||
{
|
||||
if (msg == EScriptObjectMessage::SetToZero && x30_24_active && x44_ != 100.f)
|
||||
{
|
||||
x44_ -= 1.f;
|
||||
if (x44_ < 0.000009f)
|
||||
sub8015E220();
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
||||
}
|
||||
|
||||
void CScriptPickupGenerator::sub8015E220()
|
||||
{
|
||||
if (x40_frequency > 0.f)
|
||||
x44_ = (100.f / x40_frequency) + 100.f;
|
||||
else
|
||||
x44_ = std::numeric_limits<float>::max();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef __URDE_CSCRIPTPICKUPGENERATOR_HPP__
|
||||
#define __URDE_CSCRIPTPICKUPGENERATOR_HPP__
|
||||
|
||||
#include "CEntity.hpp"
|
||||
#include "zeus/CVector3f.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CScriptPickupGenerator : public CEntity
|
||||
{
|
||||
zeus::CVector3f x34_position;
|
||||
float x40_frequency;
|
||||
float x44_ = 0.f;
|
||||
void sub8015E220();
|
||||
public:
|
||||
CScriptPickupGenerator(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CVector3f&, float, bool);
|
||||
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
|
||||
};
|
||||
}
|
||||
#endif // __URDE_CSCRIPTPICKUPGENERATOR_HPP__
|
|
@ -0,0 +1,49 @@
|
|||
#include "CScriptPointOfInterest.hpp"
|
||||
#include "CActorParameters.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "CPlayerState.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CScriptPointOfInterest::CScriptPointOfInterest(TUniqueId uid, const std::string& name, const CEntityInfo info,
|
||||
const zeus::CTransform& xf, bool active,
|
||||
const CScannableParameters& parms, float f1)
|
||||
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(u64(EMaterialTypes::FourtyOne)),
|
||||
CActorParameters::None().Scannable(parms), kInvalidUniqueId)
|
||||
, xe8_pointSize(f1)
|
||||
{
|
||||
}
|
||||
|
||||
void CScriptPointOfInterest::Think(float dt, CStateManager& mgr)
|
||||
{
|
||||
xe7_31_ = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan;
|
||||
CEntity::Think(dt, mgr);
|
||||
}
|
||||
|
||||
void CScriptPointOfInterest::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||
{
|
||||
CActor::AcceptScriptMsg(msg, uid, mgr);
|
||||
}
|
||||
|
||||
void CScriptPointOfInterest::AddToRenderer(const zeus::CFrustum&, const CStateManager&) const
|
||||
{
|
||||
}
|
||||
|
||||
void CScriptPointOfInterest::Render(const CStateManager&) const
|
||||
{
|
||||
}
|
||||
|
||||
void CScriptPointOfInterest::CalculateRenderBounds()
|
||||
{
|
||||
if (xe8_pointSize == 0.f)
|
||||
CActor::CalculateRenderBounds();
|
||||
else
|
||||
x9c_aabox = zeus::CAABox(x34_transform.origin - xe8_pointSize, x34_transform.origin + xe8_pointSize);
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptPointOfInterest::GetTouchBounds() const
|
||||
{
|
||||
return {zeus::CAABox{x34_transform.origin, x34_transform.origin}};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef __URDE_CSCRIPTPOINTOFINTEREST_HPP__
|
||||
#define __URDE_CSCRIPTPOINTOFINTEREST_HPP__
|
||||
|
||||
#include "CActor.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CScannableParameters;
|
||||
class CScriptPointOfInterest : public CActor
|
||||
{
|
||||
private:
|
||||
float xe8_pointSize;
|
||||
public:
|
||||
CScriptPointOfInterest(TUniqueId, const std::string&, const CEntityInfo, const zeus::CTransform&, bool,
|
||||
const CScannableParameters&, float);
|
||||
|
||||
void Think(float, CStateManager &);
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager &);
|
||||
void AddToRenderer(const zeus::CFrustum &, const CStateManager &) const;
|
||||
void Render(const CStateManager &) const;
|
||||
void CalculateRenderBounds();
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
};
|
||||
}
|
||||
#endif // __URDE_CSCRIPTPOINTOFINTEREST_HPP__
|
|
@ -26,6 +26,8 @@
|
|||
#include "CScriptSound.hpp"
|
||||
#include "CScriptGenerator.hpp"
|
||||
#include "CScriptGrapplePoint.hpp"
|
||||
#include "CScriptPickupGenerator.hpp"
|
||||
#include "CScriptPointOfInterest.hpp"
|
||||
#include "CScriptAreaAttributes.hpp"
|
||||
#include "CScriptCameraWaypoint.hpp"
|
||||
#include "CScriptCoverPoint.hpp"
|
||||
|
@ -458,10 +460,10 @@ CEntity* ScriptLoader::LoadDoor(CStateManager& mgr, CInputStream& in, int propCo
|
|||
zeus::CVector3f offset;
|
||||
offset.readBig(in);
|
||||
|
||||
bool b1 = in.readBool();
|
||||
bool b2 = in.readBool();
|
||||
bool active = in.readBool();
|
||||
bool open = in.readBool();
|
||||
bool b3 = in.readBool();
|
||||
float f1 = in.readFloatBig();
|
||||
float animationLength = in.readFloatBig();
|
||||
|
||||
zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), collisionExtent, offset);
|
||||
|
||||
|
@ -483,7 +485,7 @@ CEntity* ScriptLoader::LoadDoor(CStateManager& mgr, CInputStream& in, int propCo
|
|||
isMorphballDoor = in.readBool();
|
||||
|
||||
return new CScriptDoor(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(mData), actParms,
|
||||
v1, aabb, b1, b2, b3, f1, isMorphballDoor);
|
||||
v1, aabb, active, open, b3, animationLength, isMorphballDoor);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
@ -1548,7 +1550,14 @@ CEntity* ScriptLoader::LoadRipper(CStateManager& mgr, CInputStream& in, int prop
|
|||
|
||||
CEntity* ScriptLoader::LoadPickupGenerator(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
{
|
||||
return nullptr;
|
||||
if (!EnsurePropertyCount(propCount, 4, "PickupGenerator"))
|
||||
return nullptr;
|
||||
|
||||
const std::string* name = mgr.HashInstanceName(in);
|
||||
zeus::CVector3f pos = zeus::CVector3f::ReadBig(in);
|
||||
bool active = in.readBool();
|
||||
float f1 = in.readFloatBig();
|
||||
return new CScriptPickupGenerator(mgr.AllocateUniqueId(), *name, info, pos, f1, active);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadAIKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
@ -1558,7 +1567,15 @@ CEntity* ScriptLoader::LoadAIKeyframe(CStateManager& mgr, CInputStream& in, int
|
|||
|
||||
CEntity* ScriptLoader::LoadPointOfInterest(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
{
|
||||
return nullptr;
|
||||
if (!EnsurePropertyCount(propCount, 6, "PointOfInterest"))
|
||||
return nullptr;
|
||||
|
||||
SActorHead aHead = LoadActorHead(in, mgr);
|
||||
bool active = in.readBool();
|
||||
CScannableParameters sParms = LoadScannableParameters(in);
|
||||
float f1 = in.readFloatBig();
|
||||
|
||||
return new CScriptPointOfInterest(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, sParms, f1);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadDrone(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
|
Loading…
Reference in New Issue