Merge branch 'pr-276'

This commit is contained in:
Luke Street 2020-03-25 02:09:05 -04:00
commit f91536ebee
2 changed files with 29 additions and 26 deletions

View File

@ -13,13 +13,13 @@ constexpr CMaterialList skDefaultCollisionActorMaterials =
CMaterialList(EMaterialTypes::Solid, EMaterialTypes::CollisionActor, EMaterialTypes::ScanPassthrough,
EMaterialTypes::CameraPassthrough);
CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, const zeus::CVector3f& extent,
CCollisionActor::CCollisionActor(TUniqueId uid, TAreaId areaId, TUniqueId owner, const zeus::CVector3f& extent,
const zeus::CVector3f& center, bool active, float mass, std::string_view name)
: CPhysicsActor(uid1, active, "CollisionActor", CEntityInfo(aId, CEntity::NullConnectionList),
: CPhysicsActor(uid, active, "CollisionActor", CEntityInfo(areaId, CEntity::NullConnectionList),
zeus::CTransform(), CModelData::CModelDataNull(), skDefaultCollisionActorMaterials,
zeus::skNullBox, SMoverData(mass), CActorParameters::None(), 0.3f, 0.1f)
, x258_primitiveType(EPrimitiveType::OBBTreeGroup)
, x25c_owner(uid2)
, x25c_owner(owner)
, x260_boxSize(extent)
, x26c_center(center)
, x278_obbContainer(std::make_unique<CCollidableOBBTreeGroupContainer>(extent, center))
@ -32,13 +32,13 @@ CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, co
{EMaterialTypes::Solid}, {EMaterialTypes::CollisionActor, EMaterialTypes::NoStaticCollision}));
}
CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, const zeus::CVector3f& boxSize,
CCollisionActor::CCollisionActor(TUniqueId uid, TAreaId areaId, TUniqueId owner, const zeus::CVector3f& boxSize,
bool active, float mass, std::string_view name)
: CPhysicsActor(uid1, active, "CollisionActor", CEntityInfo(aId, CEntity::NullConnectionList),
: CPhysicsActor(uid, active, "CollisionActor", CEntityInfo(areaId, CEntity::NullConnectionList),
zeus::CTransform(), CModelData::CModelDataNull(), skDefaultCollisionActorMaterials,
zeus::skNullBox, SMoverData(mass), CActorParameters::None(), 0.3f, 0.1f)
, x258_primitiveType(EPrimitiveType::AABox)
, x25c_owner(uid2)
, x25c_owner(owner)
, x260_boxSize(boxSize)
, x280_aaboxPrimitive(
std::make_unique<CCollidableAABox>(zeus::CAABox(-0.5f * boxSize, 0.5f * boxSize),
@ -51,13 +51,13 @@ CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, co
{EMaterialTypes::Solid}, {EMaterialTypes::CollisionActor, EMaterialTypes::NoStaticCollision}));
}
CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, bool active, float radius, float mass,
CCollisionActor::CCollisionActor(TUniqueId uid, TAreaId areaId, TUniqueId owner, bool active, float radius, float mass,
std::string_view name)
: CPhysicsActor(uid1, active, "CollisionActor", CEntityInfo(aId, CEntity::NullConnectionList),
: CPhysicsActor(uid, active, "CollisionActor", CEntityInfo(areaId, CEntity::NullConnectionList),
zeus::CTransform(), CModelData::CModelDataNull(), skDefaultCollisionActorMaterials,
zeus::skNullBox, SMoverData(mass), CActorParameters::None(), 0.3f, 0.1f)
, x258_primitiveType(EPrimitiveType::Sphere)
, x25c_owner(uid2)
, x25c_owner(owner)
, x284_spherePrimitive(std::make_unique<CCollidableSphere>(
zeus::CSphere(zeus::skZero3f, radius), CMaterialList(EMaterialTypes::NoStaticCollision, EMaterialTypes::Solid)))
, x288_sphereRadius(radius) {
@ -71,7 +71,7 @@ CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, bo
void CCollisionActor::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CCollisionActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
void CCollisionActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) {
switch (msg) {
case EScriptObjectMessage::Falling:
case EScriptObjectMessage::Registered:
@ -82,7 +82,7 @@ void CCollisionActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C
case EScriptObjectMessage::Damage:
case EScriptObjectMessage::InvulnDamage: {
if (CEntity* ent = mgr.ObjectById(x25c_owner)) {
x2fc_lastTouched = uid;
x2fc_lastTouched = sender;
mgr.SendScriptMsg(ent, GetUniqueId(), msg);
}
} break;
@ -91,7 +91,7 @@ void CCollisionActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C
break;
}
CActor::AcceptScriptMsg(msg, uid, mgr);
CActor::AcceptScriptMsg(msg, sender, mgr);
}
CHealthInfo* CCollisionActor::HealthInfo(CStateManager&) { return &x28c_healthInfo; }
@ -157,7 +157,7 @@ std::optional<zeus::CAABox> CCollisionActor::GetTouchBounds() const {
return aabox;
}
void CCollisionActor::OnScanStateChanged(CActor::EScanState state, CStateManager& mgr) {
void CCollisionActor::OnScanStateChanged(EScanState state, CStateManager& mgr) {
TCastToPtr<CActor> actor = mgr.ObjectById(x25c_owner);
if (actor)
actor->OnScanStateChanged(state, mgr);

View File

@ -33,24 +33,27 @@ class CCollisionActor : public CPhysicsActor {
zeus::CVector3f x304_extendedTouchBounds = zeus::skZero3f;
public:
CCollisionActor(TUniqueId, TAreaId, TUniqueId, const zeus::CVector3f&, const zeus::CVector3f&, bool, float,
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,
std::string_view name);
CCollisionActor(TUniqueId, TAreaId, TUniqueId, const zeus::CVector3f&, bool, float, std::string_view name);
CCollisionActor(TUniqueId, TAreaId, TUniqueId, bool, float, float, std::string_view name);
void Accept(IVisitor& visitor) override;
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) override;
CHealthInfo* HealthInfo(CStateManager&) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) override;
CHealthInfo* HealthInfo(CStateManager& mgr) override;
const CDamageVulnerability* GetDamageVulnerability() const override;
const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f&, const zeus::CVector3f&,
const CDamageInfo&) const override;
void OnScanStateChanged(EScanState, CStateManager&) override;
const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f& vec1, const zeus::CVector3f& vec2,
const CDamageInfo& dInfo) const override;
void OnScanStateChanged(EScanState state, CStateManager& mgr) override;
void Touch(CActor&, CStateManager&) override;
zeus::CVector3f GetOrbitPosition(const CStateManager&) const override;
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&, const zeus::CVector3f&,
const CWeaponMode&, EProjectileAttrib) 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;
@ -58,7 +61,7 @@ public:
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&) const override;
zeus::CVector3f GetScanObjectIndicatorPosition(const CStateManager& mgr) const override;
void SetExtendedTouchBounds(const zeus::CVector3f& boundExt) { x304_extendedTouchBounds = boundExt; }
void SetSphereRadius(float radius);
float GetSphereRadius() const { return x288_sphereRadius; }