Initial CJointCollisionDescription imps, minor CScriptTrigger cleanup

This commit is contained in:
Phillip Stephens 2017-04-22 04:04:07 -07:00
parent 337ffd1c16
commit 1845a1465b
5 changed files with 69 additions and 24 deletions

View File

@ -34,6 +34,9 @@ public:
{ {
}; };
private: private:
float x34_steeringSpeedMin;
float x38_steeringSpeedMax;
rstl::reserved_vector<CBodyStateCmd, 28> x44_;
public: public:
CBodyStateCmdMgr() = default; CBodyStateCmdMgr() = default;
void DeliverCmd(EBodyStateCmd); void DeliverCmd(EBodyStateCmd);

View File

@ -3,11 +3,49 @@
namespace urde namespace urde
{ {
CJointCollisionDescription::CJointCollisionDescription(ECollisionType, CSegId, CSegId, const zeus::CVector3f&, CJointCollisionDescription::CJointCollisionDescription(ECollisionType colType, CSegId seg1, CSegId seg2,
const zeus::CVector3f&, float, float, EOrientationType, const zeus::CVector3f& v1, const zeus::CVector3f& v2, float f1,
const std::string&, float) float f2, EOrientationType orientType, const std::string& name,
float f3)
: x0_colType(colType)
, x4_orientType(orientType)
, x8_(seg1)
, x9_(seg2)
, xc_(v1)
, x18_(v2)
, x24_(f1)
, x28_(f2)
, x2c_name(name)
, x40_(f3)
{ {
} }
CJointCollisionDescription CJointCollisionDescription::SphereSubdivideCollision(CSegId seg1, CSegId seg2, float f1,
float f2, EOrientationType orientType,
const std::string& name, float f3)
{
return CJointCollisionDescription(ECollisionType::SphereSubdivide, seg1, seg2, zeus::CVector3f::skZero,
zeus::CVector3f::skZero, f1, f2, orientType, name, f3);
}
CJointCollisionDescription CJointCollisionDescription::SphereCollision(CSegId, float f1, const std::string&, float f2)
{
return CJointCollisionDescription(ECollisionType::Sphere, segId, -1, zeus::CVector3f::skZero,
zeus::CVector3f::skZero, f1, 0.f, EOrientationType::Zero, name, f2);
}
CJointCollisionDescription CJointCollisionDescription::AABoxCollision(CSegId segId, const zeus::CVector3f& v1,
const std::string& name, float f1)
{
return CJointCollisionDescription(ECollisionType::AABox, segId, -1, v1, zeus::CVector3f::skZero, 0.f, 0.f,
EOrientationType::Zero, name, f1);
}
CJointCollisionDescription CJointCollisionDescription::OBBCollision(CSegId segId, const zeus::CVector3f& v1,
const zeus::CVector3f& v2, const std::string& name,
float f1)
{
return CJointCollisionDescription(ECollisionType::OBB, segId, -1, v1, v2, 0.f, 0.f, EOrientationType::Zero, name,
f1);
}
} }

View File

@ -11,16 +11,21 @@ class CJointCollisionDescription
public: public:
enum class ECollisionType enum class ECollisionType
{ {
Sphere,
SphereSubdivide,
AABox,
OBBAutoSize,
OBB,
}; };
enum class EOrientationType enum class EOrientationType
{ {
Zero,
}; };
private: private:
u32 x0_; ECollisionType x0_colType;
u32 x4_; EOrientationType x4_orientType;
CSegId x8_; CSegId x8_;
CSegId x9_; CSegId x9_;
zeus::CVector3f xc_; zeus::CVector3f xc_;
@ -28,7 +33,7 @@ private:
float x24_; float x24_;
float x28_; float x28_;
std::string x2c_name; std::string x2c_name;
TUniqueId x3c_actorId; TUniqueId x3c_actorId = kInvalidUniqueId;
float x40_; float x40_;
public: public:
@ -36,12 +41,14 @@ public:
float, EOrientationType, const std::string&, float); float, EOrientationType, const std::string&, float);
const std::string& GetName() const { return x2c_name; } const std::string& GetName() const { return x2c_name; }
TUniqueId GetCollisionActorId() const { return x3c_actorId; } TUniqueId GetCollisionActorId() const { return x3c_actorId; }
void SphereSubdivideCollision(ECollisionType, CSegId, CSegId, float, float, EOrientationType, const std::string&, static CJointCollisionDescription SphereSubdivideCollision(CSegId, CSegId, float, float,
float); EOrientationType, const std::string&, float);
void SphereCollision(CSegId, float, const std::string&, float); static CJointCollisionDescription SphereCollision(CSegId, float, const std::string&, float);
void AABoxCollision(CSegId, zeus::CVector3f const&, const std::string&, float); static CJointCollisionDescription AABoxCollision(CSegId, zeus::CVector3f const&, const std::string&, float);
void OBBAutoSizeCollision(CSegId, CSegId, const zeus::CVector3f&, EOrientationType, const std::string&, float); static CJointCollisionDescription OBBAutoSizeCollision(CSegId, CSegId, const zeus::CVector3f&, EOrientationType,
void OBBCollision(CSegId, const zeus::CVector3f&, const zeus::CVector3f&, const std::string&, float); const std::string&, float);
static CJointCollisionDescription OBBCollision(CSegId, const zeus::CVector3f&, const zeus::CVector3f&,
const std::string&, float);
zeus::CVector3f GetPivotPoint() const; zeus::CVector3f GetPivotPoint() const;
float GetRadius() const; float GetRadius() const;
void SetCollisionActorId(TUniqueId); void SetCollisionActorId(TUniqueId);

View File

@ -15,8 +15,8 @@ namespace urde
CScriptTrigger::CScriptTrigger(TUniqueId uid, const std::string& name, const CEntityInfo& info, CScriptTrigger::CScriptTrigger(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CVector3f& pos, const zeus::CAABox& bounds, const CDamageInfo& dInfo, const zeus::CVector3f& pos, const zeus::CAABox& bounds, const CDamageInfo& dInfo,
const zeus::CVector3f& forceField, ETriggerFlags triggerFlags, bool active, bool b2, const zeus::CVector3f& forceField, ETriggerFlags triggerFlags, bool active, bool deactivateOnEntered,
bool b3) bool deactivateOnExited)
: CActor(uid, active, name, info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(), : CActor(uid, active, name, info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(),
CMaterialList(EMaterialTypes::Trigger), CActorParameters::None(), kInvalidUniqueId) CMaterialList(EMaterialTypes::Trigger), CActorParameters::None(), kInvalidUniqueId)
, x100_damageInfo(dInfo) , x100_damageInfo(dInfo)
@ -25,8 +25,8 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, const std::string& name, const CEn
, x12c_flags(triggerFlags) , x12c_flags(triggerFlags)
, x130_bounds(bounds) , x130_bounds(bounds)
{ {
x148_26_deactivateOnEntered = b2; x148_26_deactivateOnEntered = deactivateOnEntered;
x148_27_deactivateOnExited = b3; x148_27_deactivateOnExited = deactivateOnExited;
} }
void CScriptTrigger::Accept(IVisitor& visitor) { visitor.Visit(this); } void CScriptTrigger::Accept(IVisitor& visitor) { visitor.Visit(this); }

View File

@ -511,16 +511,13 @@ CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, int pro
std::string name = mgr.HashInstanceName(in); std::string name = mgr.HashInstanceName(in);
zeus::CVector3f position; zeus::CVector3f position = zeus::CVector3f::ReadBig(in);
position.readBig(in);
zeus::CVector3f extent; zeus::CVector3f extent = zeus::CVector3f::ReadBig(in);
extent.readBig(in);
CDamageInfo dInfo(in); CDamageInfo dInfo(in);
zeus::CVector3f forceVec; zeus::CVector3f forceVec = zeus::CVector3f::ReadBig(in);
forceVec.readBig(in);
ETriggerFlags flags = ETriggerFlags(in.readUint32Big()); ETriggerFlags flags = ETriggerFlags(in.readUint32Big());
bool active = in.readBool(); bool active = in.readBool();