metaforce/Runtime/Collision/CCollisionActor.hpp

74 lines
3.6 KiB
C++
Raw Permalink Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
#include <memory>
#include <string_view>
2020-09-23 19:41:51 +00:00
#include "Runtime/Graphics/Shaders/CAABoxShader.hpp"
#include "Runtime/World/CDamageVulnerability.hpp"
#include "Runtime/World/CHealthInfo.hpp"
#include "Runtime/World/CPhysicsActor.hpp"
#include <zeus/CVector3f.hpp>
2021-04-10 08:42:06 +00:00
namespace metaforce {
2017-03-03 22:13:23 +00:00
class CCollidableSphere;
class CCollidableOBBTreeGroup;
class CCollidableOBBTreeGroupContainer;
2018-12-08 05:30:43 +00:00
class CCollisionActor : public CPhysicsActor {
enum class EPrimitiveType { OBBTreeGroup, AABox, Sphere };
EPrimitiveType x258_primitiveType;
TUniqueId x25c_owner;
zeus::CVector3f x260_boxSize;
2019-01-05 03:28:02 +00:00
zeus::CVector3f x26c_center;
2018-12-08 05:30:43 +00:00
std::unique_ptr<CCollidableOBBTreeGroupContainer> x278_obbContainer;
std::unique_ptr<CCollidableOBBTreeGroup> x27c_obbTreeGroupPrimitive;
std::unique_ptr<CCollidableAABox> x280_aaboxPrimitive;
std::unique_ptr<CCollidableSphere> x284_spherePrimitive;
float x288_sphereRadius;
CHealthInfo x28c_healthInfo = CHealthInfo(0.f);
CDamageVulnerability x294_damageVuln = CDamageVulnerability::NormalVulnerabilty();
TUniqueId x2fc_lastTouched = kInvalidUniqueId;
EWeaponCollisionResponseTypes x300_responseType = EWeaponCollisionResponseTypes::EnemyNormal;
zeus::CVector3f x304_extendedTouchBounds = zeus::skZero3f;
2017-03-03 22:13:23 +00:00
2020-09-23 19:41:51 +00:00
CAABoxShader m_aabox;
public:
2021-05-26 14:00:57 +00:00
DEFINE_ENTITY
CCollisionActor(TUniqueId uid, TAreaId areaId, TUniqueId owner, const zeus::CVector3f& extent,
const zeus::CVector3f& center, bool active, float mass, std::string_view name);
CCollisionActor(TUniqueId uid, TAreaId areaId, TUniqueId owner, const zeus::CVector3f& boxSize, bool active,
float mass, std::string_view name);
CCollisionActor(TUniqueId uid, TAreaId areaId, TUniqueId owner, bool active, float radius, float mass,
2019-01-05 03:28:02 +00:00
std::string_view name);
2017-03-01 03:42:06 +00:00
void Accept(IVisitor& visitor) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) override;
2020-09-23 19:41:51 +00:00
void DebugDraw();
CHealthInfo* HealthInfo(CStateManager& mgr) override;
const CDamageVulnerability* GetDamageVulnerability() const override;
const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f& vec1, const zeus::CVector3f& vec2,
const CDamageInfo& dInfo) const override;
void OnScanStateChanged(EScanState state, CStateManager& mgr) override;
2017-03-03 22:13:23 +00:00
void Touch(CActor& actor, CStateManager& mgr) override;
zeus::CVector3f GetOrbitPosition(const CStateManager& mgr) const override;
const CCollisionPrimitive* GetCollisionPrimitive() const override;
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f& vec1, const zeus::CVector3f& vec2,
const CWeaponMode& mode,
EProjectileAttrib attribute) const override;
void SetWeaponCollisionResponseType(EWeaponCollisionResponseTypes type) { x300_responseType = type; }
zeus::CTransform GetPrimitiveTransform() const override;
std::optional<zeus::CAABox> GetTouchBounds() const override;
2018-12-08 05:30:43 +00:00
void SetDamageVulnerability(const CDamageVulnerability& vuln);
const zeus::CVector3f& GetBoxSize() const { return x260_boxSize; }
TUniqueId GetOwnerId() const { return x25c_owner; }
TUniqueId GetLastTouchedObject() const { return x2fc_lastTouched; }
zeus::CVector3f GetScanObjectIndicatorPosition(const CStateManager& mgr) const override;
2018-12-08 05:30:43 +00:00
void SetExtendedTouchBounds(const zeus::CVector3f& boundExt) { x304_extendedTouchBounds = boundExt; }
2019-11-12 20:25:21 +00:00
void SetSphereRadius(float radius);
2018-12-08 05:30:43 +00:00
float GetSphereRadius() const { return x288_sphereRadius; }
};
2021-04-10 08:42:06 +00:00
} // namespace metaforce