2016-04-19 21:25:26 +00:00
|
|
|
#ifndef __URDE_CSCRIPTTRIGGER_HPP__
|
|
|
|
#define __URDE_CSCRIPTTRIGGER_HPP__
|
|
|
|
|
|
|
|
#include "CActor.hpp"
|
2016-04-29 10:08:46 +00:00
|
|
|
#include "CDamageInfo.hpp"
|
2016-04-19 21:25:26 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
2016-11-20 21:53:15 +00:00
|
|
|
|
|
|
|
// TODO - Phil: Figure out what each of the DetectProjectiles actually mean
|
|
|
|
enum class ETriggerFlags : u32
|
|
|
|
{
|
2017-01-15 03:59:37 +00:00
|
|
|
None = 0,
|
2016-11-20 21:53:15 +00:00
|
|
|
DetectPlayer = (1 << 0),
|
|
|
|
DetectAI = (1 << 1),
|
|
|
|
DetectProjectiles1 = (1 << 2),
|
|
|
|
DetectProjectiles2 = (1 << 3),
|
|
|
|
DetectProjectiles3 = (1 << 4),
|
|
|
|
DetectProjectiles4 = (1 << 5),
|
|
|
|
DetectBombs = (1 << 6),
|
2017-01-15 03:59:37 +00:00
|
|
|
DetectPowerBombs = (1 << 7),
|
2016-11-20 21:53:15 +00:00
|
|
|
DetectProjectiles5 = (1 << 8),
|
|
|
|
DetectProjectiles6 = (1 << 9),
|
|
|
|
DetectProjectiles7 = (1 << 10),
|
|
|
|
KillOnEnter = (1 << 11),
|
|
|
|
DetectMorphedPlayer = (1 << 12),
|
2017-01-15 03:59:37 +00:00
|
|
|
UseCollisionImpulses = (1 << 13),
|
2017-11-28 10:06:40 +00:00
|
|
|
DetectCamera = (1 << 14),
|
2017-01-15 03:59:37 +00:00
|
|
|
UseBooleanIntersection = (1 << 15),
|
2016-11-20 21:53:15 +00:00
|
|
|
DetectUnmorphedPlayer = (1 << 16),
|
|
|
|
BlockEnvironmentalEffects = (1 << 17)
|
|
|
|
};
|
2017-04-09 06:14:22 +00:00
|
|
|
ENABLE_BITWISE_ENUM(ETriggerFlags)
|
2016-11-20 21:53:15 +00:00
|
|
|
|
2016-04-19 21:25:26 +00:00
|
|
|
class CScriptTrigger : public CActor
|
|
|
|
{
|
2016-04-29 10:08:46 +00:00
|
|
|
public:
|
|
|
|
class CObjectTracker
|
|
|
|
{
|
|
|
|
TUniqueId x0_id;
|
2016-11-20 21:53:15 +00:00
|
|
|
|
2016-04-29 10:08:46 +00:00
|
|
|
public:
|
2016-11-20 21:53:15 +00:00
|
|
|
CObjectTracker(TUniqueId id) : x0_id(id) {}
|
2016-04-29 10:08:46 +00:00
|
|
|
|
|
|
|
TUniqueId GetObjectId() const { return x0_id; }
|
2017-01-15 03:59:37 +00:00
|
|
|
bool operator==(const CObjectTracker& other) const { return x0_id == other.x0_id; }
|
2016-04-29 10:08:46 +00:00
|
|
|
};
|
|
|
|
|
2016-11-20 21:53:15 +00:00
|
|
|
protected:
|
|
|
|
std::list<CObjectTracker> xe8_inhabitants;
|
2016-04-29 10:08:46 +00:00
|
|
|
CDamageInfo x100_damageInfo;
|
|
|
|
zeus::CVector3f x11c_forceField;
|
|
|
|
float x128_forceMagnitude;
|
2016-11-20 21:53:15 +00:00
|
|
|
ETriggerFlags x12c_flags;
|
2016-04-29 10:08:46 +00:00
|
|
|
zeus::CAABox x130_bounds;
|
|
|
|
|
2016-11-20 21:53:15 +00:00
|
|
|
union {
|
2016-04-29 10:08:46 +00:00
|
|
|
struct
|
|
|
|
{
|
2017-11-28 10:06:40 +00:00
|
|
|
bool x148_24_detectCamera : 1;
|
2017-08-13 07:56:35 +00:00
|
|
|
bool x148_25_camSubmerged : 1;
|
2017-01-15 03:59:37 +00:00
|
|
|
bool x148_26_deactivateOnEntered : 1;
|
|
|
|
bool x148_27_deactivateOnExited : 1;
|
2017-11-26 03:04:25 +00:00
|
|
|
bool x148_28_playerTriggerProc : 1;
|
2017-01-15 03:59:37 +00:00
|
|
|
bool x148_29_didPhazonDamage : 1;
|
2016-04-29 10:08:46 +00:00
|
|
|
};
|
|
|
|
u8 dummy = 0;
|
|
|
|
};
|
2016-11-20 21:53:15 +00:00
|
|
|
|
2016-04-19 21:25:26 +00:00
|
|
|
public:
|
2017-11-13 06:19:18 +00:00
|
|
|
CScriptTrigger(TUniqueId, std::string_view name, const CEntityInfo& info, const zeus::CVector3f& pos,
|
2016-11-20 21:53:15 +00:00
|
|
|
const zeus::CAABox&, const CDamageInfo& dInfo, const zeus::CVector3f& orientedForce,
|
|
|
|
ETriggerFlags triggerFlags, bool, bool, bool);
|
2016-04-29 10:08:46 +00:00
|
|
|
|
2017-01-15 03:07:01 +00:00
|
|
|
void Accept(IVisitor& visitor);
|
2017-01-15 03:59:37 +00:00
|
|
|
void Think(float, CStateManager &);
|
|
|
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager &);
|
2016-04-29 10:08:46 +00:00
|
|
|
virtual void InhabitantRejected(CActor&, CStateManager&) {}
|
|
|
|
virtual void InhabitantExited(CActor&, CStateManager&) {}
|
|
|
|
virtual void InhabitantIdle(CActor&, CStateManager&) {}
|
|
|
|
virtual void InhabitantAdded(CActor&, CStateManager&) {}
|
2017-01-15 03:59:37 +00:00
|
|
|
CObjectTracker* FindObject(TUniqueId);
|
|
|
|
void UpdateInhabitants(float, CStateManager&);
|
|
|
|
std::list<CObjectTracker>& GetInhabitants();
|
2018-04-30 03:12:41 +00:00
|
|
|
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
2017-01-15 03:59:37 +00:00
|
|
|
void Touch(CActor &, CStateManager &);
|
2017-08-13 07:56:35 +00:00
|
|
|
const zeus::CAABox& GetTriggerBoundsOR() const { return x130_bounds; }
|
2016-04-29 10:08:46 +00:00
|
|
|
zeus::CAABox GetTriggerBoundsWR() const;
|
2017-04-09 06:14:22 +00:00
|
|
|
const CDamageInfo& GetDamageInfo() const { return x100_damageInfo; }
|
|
|
|
ETriggerFlags GetTriggerFlags() const { return x12c_flags; }
|
2016-04-19 21:25:26 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CSCRIPTTRIGGER_HPP__
|