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