2016-12-22 19:57:21 +00:00
|
|
|
#ifndef __URDE_CGAMEPROJECTILE_HPP__
|
|
|
|
#define __URDE_CGAMEPROJECTILE_HPP__
|
|
|
|
|
|
|
|
#include "Collision/CMaterialList.hpp"
|
|
|
|
#include "Weapon/CWeaponMode.hpp"
|
|
|
|
#include "Weapon/CWeapon.hpp"
|
|
|
|
#include "World/CDamageInfo.hpp"
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "CToken.hpp"
|
2017-05-18 10:58:15 +00:00
|
|
|
#include "Weapon/CProjectileWeapon.hpp"
|
2018-02-09 07:12:26 +00:00
|
|
|
#include "Collision/CRayCastResult.hpp"
|
2016-12-22 19:57:21 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
class CGenDescription;
|
|
|
|
class CWeaponDescription;
|
2018-02-09 07:12:26 +00:00
|
|
|
|
|
|
|
class CProjectileTouchResult
|
|
|
|
{
|
|
|
|
TUniqueId x0_id;
|
|
|
|
rstl::optional_object<CRayCastResult> x4_result;
|
|
|
|
public:
|
|
|
|
CProjectileTouchResult(TUniqueId id, const rstl::optional_object<CRayCastResult>& result)
|
|
|
|
: x0_id(id), x4_result(result) {}
|
|
|
|
TUniqueId GetActorId() const { return x0_id; }
|
|
|
|
bool HasRayCastResult() const { return x4_result.operator bool(); }
|
|
|
|
const CRayCastResult& GetRayCastResult() const { return *x4_result; }
|
|
|
|
};
|
|
|
|
|
2016-12-22 19:57:21 +00:00
|
|
|
class CGameProjectile : public CWeapon
|
|
|
|
{
|
2018-02-11 05:27:00 +00:00
|
|
|
protected:
|
2018-02-09 07:12:26 +00:00
|
|
|
rstl::optional_object<TLockedToken<CGenDescription>> x158_visorParticle;
|
|
|
|
u16 x168_visorSfx;
|
|
|
|
CProjectileWeapon x170_projectile;
|
2018-02-11 05:27:00 +00:00
|
|
|
zeus::CVector3f x298_lastOrigin;
|
|
|
|
float x2a4_projExtent;
|
2018-02-09 07:12:26 +00:00
|
|
|
float x2a8_homingDt = 0.03f;
|
|
|
|
double x2b0_targetHomingTime = 0.0;
|
|
|
|
double x2b8_curHomingTime = x2a8_homingDt;
|
2017-09-10 00:36:21 +00:00
|
|
|
TUniqueId x2c0_homingTargetId;
|
2018-02-09 07:12:26 +00:00
|
|
|
TUniqueId x2c2_ = kInvalidUniqueId;
|
|
|
|
TUniqueId x2c4_ = kInvalidUniqueId;
|
|
|
|
TUniqueId x2c6_ = kInvalidUniqueId;
|
|
|
|
TUniqueId x2c8_projectileLight = kInvalidUniqueId;
|
|
|
|
CAssetId x2cc_wpscId;
|
|
|
|
std::vector<CProjectileTouchResult> x2d0_touchResults;
|
|
|
|
float x2e0_minHomingDist = 0.f;
|
2017-05-18 10:58:15 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2018-02-12 05:30:21 +00:00
|
|
|
bool x2e4_24_active : 1;
|
2018-02-11 05:27:00 +00:00
|
|
|
bool x2e4_25_startedUnderwater : 1;
|
2017-09-05 03:00:19 +00:00
|
|
|
bool x2e4_26_waterUpdate : 1;
|
|
|
|
bool x2e4_27_inWater : 1;
|
2018-02-09 07:12:26 +00:00
|
|
|
bool x2e4_28_sendProjectileCollideMsg : 1;
|
2017-05-18 10:58:15 +00:00
|
|
|
};
|
|
|
|
};
|
2016-12-22 19:57:21 +00:00
|
|
|
public:
|
2017-11-13 06:19:18 +00:00
|
|
|
CGameProjectile(bool active, const TToken<CWeaponDescription>&, std::string_view name,
|
2018-03-15 00:27:45 +00:00
|
|
|
EWeaponType wType, const zeus::CTransform& xf, EMaterialTypes excludeMat,
|
2017-09-05 03:00:19 +00:00
|
|
|
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner,
|
|
|
|
TUniqueId homingTarget, EProjectileAttrib attribs, bool underwater, const zeus::CVector3f& scale,
|
2018-02-09 07:12:26 +00:00
|
|
|
const rstl::optional_object<TLockedToken<CGenDescription>>& visorParticle,
|
|
|
|
u16 visorSfx, bool sendCollideMsg);
|
2016-12-22 19:57:21 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
virtual void Accept(IVisitor &visitor);
|
2018-02-09 07:12:26 +00:00
|
|
|
virtual void ResolveCollisionWithActor(const CRayCastResult& res, CActor& act, CStateManager& mgr);
|
2017-05-18 10:58:15 +00:00
|
|
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager &);
|
2016-12-22 19:57:21 +00:00
|
|
|
static EProjectileAttrib GetBeamAttribType(EWeaponType wType);
|
2017-05-18 10:58:15 +00:00
|
|
|
void DeleteProjectileLight(CStateManager&);
|
2017-11-13 06:19:18 +00:00
|
|
|
void CreateProjectileLight(std::string_view, const CLight&, CStateManager&);
|
2018-02-09 07:12:26 +00:00
|
|
|
void Chase(float dt, CStateManager& mgr);
|
|
|
|
void UpdateHoming(float dt, CStateManager& mgr);
|
|
|
|
void UpdateProjectileMovement(float dt, CStateManager& mgr);
|
|
|
|
CRayCastResult DoCollisionCheck(TUniqueId& idOut, CStateManager& mgr);
|
|
|
|
void ApplyDamageToActors(CStateManager& mgr, const CDamageInfo& dInfo);
|
|
|
|
void FluidFxThink(EFluidState state, CScriptWater& water, CStateManager& mgr);
|
|
|
|
CRayCastResult RayCollisionCheckWithWorld(TUniqueId& idOut, const zeus::CVector3f& start,
|
|
|
|
const zeus::CVector3f& end, float mag,
|
|
|
|
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
|
|
|
|
CStateManager& mgr);
|
|
|
|
CProjectileTouchResult CanCollideWith(CActor& act, CStateManager& mgr);
|
2018-02-11 05:27:00 +00:00
|
|
|
CProjectileTouchResult CanCollideWithComplexCollision(CActor& act, CStateManager& mgr);
|
|
|
|
CProjectileTouchResult CanCollideWithGameObject(CActor& act, CStateManager& mgr);
|
|
|
|
CProjectileTouchResult CanCollideWithTrigger(CActor& act, CStateManager& mgr);
|
2018-02-09 07:12:26 +00:00
|
|
|
zeus::CAABox GetProjectileBounds() const;
|
2017-09-10 00:36:21 +00:00
|
|
|
TUniqueId GetHomingTargetId() const { return x2c0_homingTargetId; }
|
2016-12-22 19:57:21 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CGAMEPROJECTILE_HPP__
|