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:
float x34_steeringSpeedMin;
float x38_steeringSpeedMax;
rstl::reserved_vector<CBodyStateCmd, 28> x44_;
public:
CBodyStateCmdMgr() = default;
void DeliverCmd(EBodyStateCmd);

View File

@ -3,11 +3,49 @@
namespace urde
{
CJointCollisionDescription::CJointCollisionDescription(ECollisionType, CSegId, CSegId, const zeus::CVector3f&,
const zeus::CVector3f&, float, float, EOrientationType,
const std::string&, float)
CJointCollisionDescription::CJointCollisionDescription(ECollisionType colType, CSegId seg1, CSegId seg2,
const zeus::CVector3f& v1, const zeus::CVector3f& v2, float f1,
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:
enum class ECollisionType
{
Sphere,
SphereSubdivide,
AABox,
OBBAutoSize,
OBB,
};
enum class EOrientationType
{
Zero,
};
private:
u32 x0_;
u32 x4_;
ECollisionType x0_colType;
EOrientationType x4_orientType;
CSegId x8_;
CSegId x9_;
zeus::CVector3f xc_;
@ -28,7 +33,7 @@ private:
float x24_;
float x28_;
std::string x2c_name;
TUniqueId x3c_actorId;
TUniqueId x3c_actorId = kInvalidUniqueId;
float x40_;
public:
@ -36,12 +41,14 @@ public:
float, EOrientationType, const std::string&, float);
const std::string& GetName() const { return x2c_name; }
TUniqueId GetCollisionActorId() const { return x3c_actorId; }
void SphereSubdivideCollision(ECollisionType, CSegId, CSegId, float, float, EOrientationType, const std::string&,
float);
void SphereCollision(CSegId, float, const std::string&, float);
void AABoxCollision(CSegId, zeus::CVector3f const&, const std::string&, float);
void OBBAutoSizeCollision(CSegId, CSegId, const zeus::CVector3f&, EOrientationType, const std::string&, float);
void OBBCollision(CSegId, const zeus::CVector3f&, const zeus::CVector3f&, const std::string&, float);
static CJointCollisionDescription SphereSubdivideCollision(CSegId, CSegId, float, float,
EOrientationType, const std::string&, float);
static CJointCollisionDescription SphereCollision(CSegId, float, const std::string&, float);
static CJointCollisionDescription AABoxCollision(CSegId, zeus::CVector3f const&, const std::string&, float);
static CJointCollisionDescription OBBAutoSizeCollision(CSegId, CSegId, const zeus::CVector3f&, EOrientationType,
const std::string&, float);
static CJointCollisionDescription OBBCollision(CSegId, const zeus::CVector3f&, const zeus::CVector3f&,
const std::string&, float);
zeus::CVector3f GetPivotPoint() const;
float GetRadius() const;
void SetCollisionActorId(TUniqueId);

View File

@ -15,8 +15,8 @@ namespace urde
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& forceField, ETriggerFlags triggerFlags, bool active, bool b2,
bool b3)
const zeus::CVector3f& forceField, ETriggerFlags triggerFlags, bool active, bool deactivateOnEntered,
bool deactivateOnExited)
: CActor(uid, active, name, info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(),
CMaterialList(EMaterialTypes::Trigger), CActorParameters::None(), kInvalidUniqueId)
, x100_damageInfo(dInfo)
@ -25,8 +25,8 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, const std::string& name, const CEn
, x12c_flags(triggerFlags)
, x130_bounds(bounds)
{
x148_26_deactivateOnEntered = b2;
x148_27_deactivateOnExited = b3;
x148_26_deactivateOnEntered = deactivateOnEntered;
x148_27_deactivateOnExited = deactivateOnExited;
}
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);
zeus::CVector3f position;
position.readBig(in);
zeus::CVector3f position = zeus::CVector3f::ReadBig(in);
zeus::CVector3f extent;
extent.readBig(in);
zeus::CVector3f extent = zeus::CVector3f::ReadBig(in);
CDamageInfo dInfo(in);
zeus::CVector3f forceVec;
forceVec.readBig(in);
zeus::CVector3f forceVec = zeus::CVector3f::ReadBig(in);
ETriggerFlags flags = ETriggerFlags(in.readUint32Big());
bool active = in.readBool();