mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of https://github.com/AxioDL/urde
This commit is contained in:
commit
6dff9b241a
|
@ -16,7 +16,6 @@ AlignTrailingComments: true
|
||||||
AlwaysBreakBeforeMultilineStrings: true
|
AlwaysBreakBeforeMultilineStrings: true
|
||||||
AlwaysBreakTemplateDeclarations: true
|
AlwaysBreakTemplateDeclarations: true
|
||||||
BreakConstructorInitializersBeforeComma: true
|
BreakConstructorInitializersBeforeComma: true
|
||||||
BreakStringLiterals: true
|
|
||||||
AlwaysBreakAfterReturnType: None
|
AlwaysBreakAfterReturnType: None
|
||||||
AlwaysBreakAfterDefinitionReturnType: None
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
AllowShortFunctionsOnASingleLine: All
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct Flaahgra : IScriptObject
|
||||||
UniqueID32 dependencyGroup;
|
UniqueID32 dependencyGroup;
|
||||||
|
|
||||||
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||||
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const
|
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const
|
||||||
{
|
{
|
||||||
actorParameters1.addCMDLRigPairs(addTo, patternedInfo.animationParameters.getCINF(pakRouter));
|
actorParameters1.addCMDLRigPairs(addTo, patternedInfo.animationParameters.getCINF(pakRouter));
|
||||||
actorParameters2.addCMDLRigPairs(addTo, animationParameters.getCINF(pakRouter));
|
actorParameters2.addCMDLRigPairs(addTo, animationParameters.getCINF(pakRouter));
|
||||||
|
|
|
@ -19,7 +19,6 @@ struct IScriptObject : BigYAML
|
||||||
Value<atUint32> state;
|
Value<atUint32> state;
|
||||||
Value<atUint32> msg;
|
Value<atUint32> msg;
|
||||||
Value<atUint32> target;
|
Value<atUint32> target;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Value<atUint32> connectionCount;
|
Value<atUint32> connectionCount;
|
||||||
|
@ -28,7 +27,9 @@ struct IScriptObject : BigYAML
|
||||||
virtual ~IScriptObject() = default;
|
virtual ~IScriptObject() = default;
|
||||||
|
|
||||||
virtual void addCMDLRigPairs(PAKRouter<PAKBridge>&,
|
virtual void addCMDLRigPairs(PAKRouter<PAKBridge>&,
|
||||||
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>&) const {}
|
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>&) const
|
||||||
|
{
|
||||||
|
}
|
||||||
virtual void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {}
|
virtual void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,17 +19,17 @@ void CSfxManager::UpdateListener(const zeus::CVector3f& pos, const zeus::CVector
|
||||||
|
|
||||||
u16 CSfxManager::TranslateSFXID(u16 id)
|
u16 CSfxManager::TranslateSFXID(u16 id)
|
||||||
{
|
{
|
||||||
if (mpSfxTranslationTable)
|
if (mpSfxTranslationTable == nullptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
u16 index = id & 0xFFFF;
|
u16 index = id;
|
||||||
if (index >= mpSfxTranslationTable->size())
|
if (index >= mpSfxTranslationTable->size())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
s16 ret = mpSfxTranslationTable->at(index);
|
s16 ret = mpSfxTranslationTable->at(index);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
return 0;
|
return 0;
|
||||||
return ret & 0xFFFF;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,9 @@ class CStateManager
|
||||||
};
|
};
|
||||||
u16 _dummy = 0;
|
u16 _dummy = 0;
|
||||||
};
|
};
|
||||||
|
s32 xef4_;
|
||||||
|
zeus::CVector2i xef8_;
|
||||||
|
zeus::CVector2i xf00_;
|
||||||
float xf24_thermColdScale1 = 0.f;
|
float xf24_thermColdScale1 = 0.f;
|
||||||
float xf28_thermColdScale2 = 0.f;
|
float xf28_thermColdScale2 = 0.f;
|
||||||
float xf2c_ = 1.f;
|
float xf2c_ = 1.f;
|
||||||
|
|
|
@ -371,7 +371,7 @@ SAdvancementDeltas CAnimData::Advance(float dt, const zeus::CVector3f& scale,
|
||||||
|
|
||||||
for (CParticlePOINode& node : g_ParticlePOINodes)
|
for (CParticlePOINode& node : g_ParticlePOINodes)
|
||||||
{
|
{
|
||||||
if (node.GetCharIdx() == -1 || node.GetCharIdx() == x204_charIdx)
|
if (node.GetCharacterIndex() == -1 || node.GetCharacterIndex() == x204_charIdx)
|
||||||
{
|
{
|
||||||
x120_particleDB.StartEffect(node.GetName(), node.GetFlags(), node.GetParticleData(),
|
x120_particleDB.StartEffect(node.GetName(), node.GetFlags(), node.GetParticleData(),
|
||||||
scale, stateMgr, aid, x21c_);
|
scale, stateMgr, aid, x21c_);
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
EPOIType GetPoiType() const { return x18_type; }
|
EPOIType GetPoiType() const { return x18_type; }
|
||||||
u32 GetIndex() const {return x24_index;}
|
u32 GetIndex() const {return x24_index;}
|
||||||
float GetWeight() const { return x2c_weight; }
|
float GetWeight() const { return x2c_weight; }
|
||||||
u32 GetCharIdx() const { return x30_charIdx; }
|
u32 GetCharacterIndex() const { return x30_charIdx; }
|
||||||
u32 GetFlags() const { return x34_flags; }
|
u32 GetFlags() const { return x34_flags; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,12 @@ CCollidableAABox::CCollidableAABox()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CCollidableAABox::CCollidableAABox(const zeus::CAABox& aabox, const CMaterialList& list)
|
||||||
|
: CCollisionPrimitive(list)
|
||||||
|
, x10_aabox(aabox)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
zeus::CAABox CCollidableAABox::Transform(const zeus::CTransform& xf) const
|
zeus::CAABox CCollidableAABox::Transform(const zeus::CTransform& xf) const
|
||||||
{
|
{
|
||||||
return {xf.origin + x10_aabox.min, xf.origin + x10_aabox.max};
|
return {xf.origin + x10_aabox.min, xf.origin + x10_aabox.max};
|
||||||
|
|
|
@ -19,6 +19,7 @@ class CCollidableAABox : public CCollisionPrimitive
|
||||||
zeus::CAABox x10_aabox;
|
zeus::CAABox x10_aabox;
|
||||||
public:
|
public:
|
||||||
CCollidableAABox();
|
CCollidableAABox();
|
||||||
|
CCollidableAABox(const zeus::CAABox&, const CMaterialList&);
|
||||||
|
|
||||||
zeus::CAABox Transform(const zeus::CTransform&) const;
|
zeus::CAABox Transform(const zeus::CTransform&) const;
|
||||||
virtual u32 GetTableIndex() const;
|
virtual u32 GetTableIndex() const;
|
||||||
|
|
|
@ -9,8 +9,8 @@ CWarWasp::CWarWasp(TUniqueId uid, const std::string& name, const CEntityInfo& in
|
||||||
CModelData&& mData, const CPatternedInfo& pInfo, CPatterned::EFlavorType flavor,
|
CModelData&& mData, const CPatternedInfo& pInfo, CPatterned::EFlavorType flavor,
|
||||||
CPatterned::EColliderType collider, const CDamageInfo& dInfo1, const CActorParameters& actorParms,
|
CPatterned::EColliderType collider, const CDamageInfo& dInfo1, const CActorParameters& actorParms,
|
||||||
ResId weapon, const CDamageInfo& dInfo2, ResId particle, u32 w3)
|
ResId weapon, const CDamageInfo& dInfo2, ResId particle, u32 w3)
|
||||||
: CPatterned(EUnknown::ThirtyNine, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer, collider, EBodyType::Three,
|
: CPatterned(EUnknown::ThirtyNine, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer,
|
||||||
actorParms, false)
|
collider, EBodyType::Three, actorParms, false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,4 +293,12 @@ void CActor::SetSfxPitchBend(s32 val)
|
||||||
CSfxManager::PitchBend(*x8c_sfxHandle.get(), val);
|
CSfxManager::PitchBend(*x8c_sfxHandle.get(), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CActor::SetTranslation(const zeus::CVector3f &tr)
|
||||||
|
{
|
||||||
|
x34_transform.origin = tr;
|
||||||
|
xe4_27_ = true;
|
||||||
|
xe4_28_ = true;
|
||||||
|
xe4_29_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,6 +138,7 @@ public:
|
||||||
bool HasModelData() const;
|
bool HasModelData() const;
|
||||||
const CSfxHandle* GetSfxHandle() const;
|
const CSfxHandle* GetSfxHandle() const;
|
||||||
void SetSfxPitchBend(s32);
|
void SetSfxPitchBend(s32);
|
||||||
|
void SetTranslation(const zeus::CVector3f& tr);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,11 @@ static CMaterialList MakeAiMaterialList(const CMaterialList& in)
|
||||||
}
|
}
|
||||||
|
|
||||||
CAi::CAi(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
CAi::CAi(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
CModelData&& mData, const zeus::CAABox& box, float mass, const CHealthInfo& hInfo, const CDamageVulnerability& dmgVuln,
|
CModelData&& mData, const zeus::CAABox& box, float mass, const CHealthInfo& hInfo,
|
||||||
const CMaterialList& list, ResId, const CActorParameters& actorParams, float f1, float f2)
|
const CDamageVulnerability& dmgVuln, const CMaterialList& list, ResId, const CActorParameters& actorParams,
|
||||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeAiMaterialList(list), box, SMoverData(mass), actorParams,
|
float stepUp, float stepDown)
|
||||||
f1, f2),
|
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeAiMaterialList(list), box, SMoverData(mass),
|
||||||
|
actorParams, stepUp, stepDown),
|
||||||
x258_healthInfo(hInfo),
|
x258_healthInfo(hInfo),
|
||||||
x260_damageVulnerability(dmgVuln)
|
x260_damageVulnerability(dmgVuln)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,10 +20,11 @@ CPatterned::CPatterned(EUnknown, TUniqueId uid, const std::string& name, CPatter
|
||||||
EBodyType, const CActorParameters& actorParms, bool)
|
EBodyType, const CActorParameters& actorParms, bool)
|
||||||
: CAi(uid, pInfo.xf8_active, name, info, xf, std::move(mData),
|
: CAi(uid, pInfo.xf8_active, name, info, xf, std::move(mData),
|
||||||
zeus::CAABox(pInfo.xcc_bodyOrigin - zeus::CVector3f{pInfo.xc4_halfExtent, pInfo.xc4_halfExtent, 0.f},
|
zeus::CAABox(pInfo.xcc_bodyOrigin - zeus::CVector3f{pInfo.xc4_halfExtent, pInfo.xc4_halfExtent, 0.f},
|
||||||
pInfo.xcc_bodyOrigin + zeus::CVector3f{pInfo.xc4_halfExtent, pInfo.xc4_halfExtent, pInfo.xc8_height}),
|
pInfo.xcc_bodyOrigin + zeus::CVector3f{pInfo.xc4_halfExtent, pInfo.xc4_halfExtent,
|
||||||
|
pInfo.xc8_height}),
|
||||||
pInfo.x0_mass, pInfo.x54_healthInfo, pInfo.x5c_damageVulnerability,
|
pInfo.x0_mass, pInfo.x54_healthInfo, pInfo.x5c_damageVulnerability,
|
||||||
moveType == EMovementType::Flyer ? gkPatternedFlyerMaterialList : gkPatternedGroundMaterialList,
|
moveType == EMovementType::Flyer ? gkPatternedFlyerMaterialList : gkPatternedGroundMaterialList,
|
||||||
pInfo.xfc_stateMachineId, actorParms, pInfo.xd8_, 0.8f)
|
pInfo.xfc_stateMachineId, actorParms, pInfo.xd8_stepUpHeight, 0.8f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,11 @@ CPatternedInfo::CPatternedInfo(CInputStream& in, u32 pcount)
|
||||||
xc4_halfExtent(in.readFloatBig()),
|
xc4_halfExtent(in.readFloatBig()),
|
||||||
xc8_height(in.readFloatBig()),
|
xc8_height(in.readFloatBig()),
|
||||||
xcc_bodyOrigin(zeus::CVector3f::ReadBig(in)),
|
xcc_bodyOrigin(zeus::CVector3f::ReadBig(in)),
|
||||||
xd8_(in.readFloatBig()),
|
xd8_stepUpHeight(in.readFloatBig()),
|
||||||
xdc_(in.readFloatBig()),
|
xdc_(in.readFloatBig()),
|
||||||
xe0_(in.readFloatBig()),
|
xe0_(in.readFloatBig()),
|
||||||
xe4_(in.readFloatBig()),
|
xe4_(in.readFloatBig()),
|
||||||
xe8_sfxId(CSfxManager::TranslateSFXID(in.readUint32Big())),
|
xe8_deathSfx(CSfxManager::TranslateSFXID(in.readUint32Big())),
|
||||||
xec_animParams(in),
|
xec_animParams(in),
|
||||||
xf8_active(in.readBool()),
|
xf8_active(in.readBool()),
|
||||||
xfc_stateMachineId(in.readUint32Big()),
|
xfc_stateMachineId(in.readUint32Big()),
|
||||||
|
@ -46,7 +46,7 @@ CPatternedInfo::CPatternedInfo(CInputStream& in, u32 pcount)
|
||||||
if (pcount >= 37)
|
if (pcount >= 37)
|
||||||
x130_particle2 = in.readUint32Big();
|
x130_particle2 = in.readUint32Big();
|
||||||
if (pcount >= 38)
|
if (pcount >= 38)
|
||||||
x134_sfxId2 = CSfxManager::TranslateSFXID(in.readUint32Big());
|
x134_iceShatterSfx = CSfxManager::TranslateSFXID(in.readUint32Big());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<bool, u32> CPatternedInfo::HasCorrectParameterCount(CInputStream& in)
|
std::pair<bool, u32> CPatternedInfo::HasCorrectParameterCount(CInputStream& in)
|
||||||
|
|
|
@ -34,11 +34,11 @@ class CPatternedInfo
|
||||||
float xc4_halfExtent;
|
float xc4_halfExtent;
|
||||||
float xc8_height;
|
float xc8_height;
|
||||||
zeus::CVector3f xcc_bodyOrigin;
|
zeus::CVector3f xcc_bodyOrigin;
|
||||||
float xd8_;
|
float xd8_stepUpHeight;
|
||||||
float xdc_;
|
float xdc_;
|
||||||
float xe0_;
|
float xe0_;
|
||||||
float xe4_;
|
float xe4_;
|
||||||
u16 xe8_sfxId;
|
u16 xe8_deathSfx;
|
||||||
CAnimationParameters xec_animParams;
|
CAnimationParameters xec_animParams;
|
||||||
bool xf8_active;
|
bool xf8_active;
|
||||||
ResId xfc_stateMachineId;
|
ResId xfc_stateMachineId;
|
||||||
|
@ -54,7 +54,7 @@ class CPatternedInfo
|
||||||
zeus::CVector3f x124_particle2Scale;
|
zeus::CVector3f x124_particle2Scale;
|
||||||
ResId x130_particle2 = -1;
|
ResId x130_particle2 = -1;
|
||||||
|
|
||||||
u16 x134_sfxId2 = -1;
|
u16 x134_iceShatterSfx = -1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPatternedInfo(CInputStream& in, u32 pcount);
|
CPatternedInfo(CInputStream& in, u32 pcount);
|
||||||
|
|
|
@ -6,27 +6,41 @@ namespace urde
|
||||||
CPhysicsActor::CPhysicsActor(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info,
|
CPhysicsActor::CPhysicsActor(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info,
|
||||||
const zeus::CTransform& xf, CModelData&& mData, const CMaterialList& matList,
|
const zeus::CTransform& xf, CModelData&& mData, const CMaterialList& matList,
|
||||||
const zeus::CAABox& box, const SMoverData& moverData, const CActorParameters& actorParms,
|
const zeus::CAABox& box, const SMoverData& moverData, const CActorParameters& actorParms,
|
||||||
float, float)
|
float stepUp, float stepDown)
|
||||||
: CActor(uid, active, name, info, xf, std::move(mData), matList, actorParms, kInvalidUniqueId)
|
: CActor(uid, active, name, info, xf, std::move(mData), matList, actorParms, kInvalidUniqueId)
|
||||||
|
, xe8_mass(moverData.x30_mass)
|
||||||
|
, xec_massRecip(moverData.x30_mass <= 0.f ? 1.f : 1.f / moverData.x30_mass)
|
||||||
|
, xf8_24_(true)
|
||||||
|
, x150_momentum(moverData.x18_)
|
||||||
|
, x1c0_collisionPrimitive(box, matList)
|
||||||
|
, x1f4_translation(xf.origin)
|
||||||
|
, x200_orientation(xf.buildMatrix3f())
|
||||||
|
, x23c_stepUpHeight(stepUp)
|
||||||
|
, x240_stepDownHeight(stepDown)
|
||||||
{
|
{
|
||||||
|
SetMass(moverData.x30_mass);
|
||||||
|
MoveCollisionPrimitive(zeus::CVector3f::skZero);
|
||||||
|
SetVelocityOR(moverData.x0_velocity);
|
||||||
|
SetAngularVelocityOR(moverData.xc_angularVelocity);
|
||||||
|
ComputeDerivedQuantities();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPhysicsActor::Render(const CStateManager &mgr)
|
void CPhysicsActor::Render(const CStateManager &mgr) const
|
||||||
{
|
{
|
||||||
CActor::Render(mgr);
|
CActor::Render(mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::CVector3f CPhysicsActor::GetOrbitPosition(const CStateManager &)
|
zeus::CVector3f CPhysicsActor::GetOrbitPosition(const CStateManager &) const
|
||||||
{
|
{
|
||||||
return GetBoundingBox().center();
|
return GetBoundingBox().center();
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::CVector3f CPhysicsActor::GetAimPosition(const CStateManager &, float val)
|
zeus::CVector3f CPhysicsActor::GetAimPosition(const CStateManager&, float dt) const
|
||||||
{
|
{
|
||||||
if (val <= 0.0)
|
if (dt <= 0.0)
|
||||||
return GetBoundingBox().center();
|
return GetBoundingBox().center();
|
||||||
//zeus::CVector3f delta = PredictMotion(val);
|
zeus::CVector3f trans = PredictMotion(dt).x0_translation;
|
||||||
return zeus::CVector3f();
|
return GetBoundingBox().center() + trans;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPhysicsActor::CollidedWith(const TUniqueId &, const CCollisionInfoList &, CStateManager &)
|
void CPhysicsActor::CollidedWith(const TUniqueId &, const CCollisionInfoList &, CStateManager &)
|
||||||
|
@ -38,26 +52,36 @@ const CCollisionPrimitive& CPhysicsActor::GetCollisionPrimitive() const
|
||||||
return x1c0_collisionPrimitive;
|
return x1c0_collisionPrimitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::CTransform CPhysicsActor::GetPrimitiveTransform()
|
zeus::CTransform CPhysicsActor::GetPrimitiveTransform() const
|
||||||
{
|
{
|
||||||
return zeus::CTransform();
|
return zeus::CTransform::Translate(x34_transform.origin + x1e8_primitiveOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
float CPhysicsActor::GetStepUpHeight()
|
float CPhysicsActor::GetStepUpHeight() const
|
||||||
{
|
{
|
||||||
return x23c_stepUpHeight;
|
return x23c_stepUpHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CPhysicsActor::GetStepDownHeight()
|
float CPhysicsActor::GetStepDownHeight() const
|
||||||
{
|
{
|
||||||
return x240_stepDownHeight;
|
return x240_stepDownHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CPhysicsActor::GetWeight()
|
float CPhysicsActor::GetWeight() const
|
||||||
{
|
{
|
||||||
return 24.525002f * xe8_mass;
|
return 24.525002f * xe8_mass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::sub_8011A4C(float f)
|
||||||
|
{
|
||||||
|
x238_ = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CPhysicsActor::sub_8011A4B8() const
|
||||||
|
{
|
||||||
|
return x238_;
|
||||||
|
}
|
||||||
|
|
||||||
void CPhysicsActor::SetPrimitiveOffset(const zeus::CVector2f &offset)
|
void CPhysicsActor::SetPrimitiveOffset(const zeus::CVector2f &offset)
|
||||||
{
|
{
|
||||||
x1e8_primitiveOffset = offset;
|
x1e8_primitiveOffset = offset;
|
||||||
|
@ -79,27 +103,83 @@ void CPhysicsActor::SetBoundingBox(const zeus::CAABox &box)
|
||||||
MoveCollisionPrimitive(zeus::CVector3f::skZero);
|
MoveCollisionPrimitive(zeus::CVector3f::skZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::CAABox CPhysicsActor::GetMotionVolume()
|
zeus::CAABox CPhysicsActor::GetMotionVolume(float dt) const
|
||||||
{
|
{
|
||||||
return {};
|
zeus::CAABox aabox = GetCollisionPrimitive().CalculateAABox(GetPrimitiveTransform());
|
||||||
|
zeus::CVector3f velocity = CalculateNewVelocityWR_UsingImpulses();
|
||||||
|
|
||||||
|
const zeus::CVector3f dv = (dt * velocity);
|
||||||
|
aabox.accumulateBounds(aabox.max + dv);
|
||||||
|
aabox.accumulateBounds(aabox.min + dv);
|
||||||
|
|
||||||
|
float up = GetStepUpHeight();
|
||||||
|
up = zeus::max(up, 0.f);
|
||||||
|
aabox.accumulateBounds(aabox.max + up);
|
||||||
|
|
||||||
|
float down = GetStepDownHeight();
|
||||||
|
down = zeus::max(down, 0.f);
|
||||||
|
aabox.accumulateBounds(aabox.min + down);
|
||||||
|
return aabox;
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::CAABox CPhysicsActor::GetBoundingBox()
|
zeus::CVector3f CPhysicsActor::CalculateNewVelocityWR_UsingImpulses() const
|
||||||
{
|
{
|
||||||
return {};
|
return x138_velocity + (xec_massRecip * (x168_impulse + x18c_));
|
||||||
}
|
}
|
||||||
|
|
||||||
const zeus::CAABox &CPhysicsActor::GetBaseBoundingBox() const
|
zeus::CAABox CPhysicsActor::GetBoundingBox() const
|
||||||
|
{
|
||||||
|
return { x1a4_baseBoundingBox.min + x1e8_primitiveOffset + x34_transform.origin,
|
||||||
|
x1a4_baseBoundingBox.max + x1e8_primitiveOffset + x34_transform.origin };
|
||||||
|
}
|
||||||
|
|
||||||
|
const zeus::CAABox& CPhysicsActor::GetBaseBoundingBox() const
|
||||||
{
|
{
|
||||||
return x1a4_baseBoundingBox;
|
return x1a4_baseBoundingBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::AddMotionState(const CMotionState& mst)
|
||||||
|
{
|
||||||
|
zeus::CNUQuaternion q{x34_transform.buildMatrix3f()};
|
||||||
|
// TODO: Jack please verify this assignment: 8011B514
|
||||||
|
x34_transform = zeus::CTransform::Translate(x34_transform.origin) * zeus::CMatrix3f(q);
|
||||||
|
|
||||||
|
xe4_27_ = true;
|
||||||
|
xe4_28_ = true;
|
||||||
|
xe4_29_ = true;
|
||||||
|
|
||||||
|
SetTranslation(x34_transform.origin + mst.x0_translation);
|
||||||
|
|
||||||
|
xfc_constantForce += mst.x1c_velocity;
|
||||||
|
|
||||||
|
ComputeDerivedQuantities();
|
||||||
|
}
|
||||||
|
|
||||||
|
CMotionState CPhysicsActor::GetMotionState() const
|
||||||
|
{
|
||||||
|
return {x34_transform.origin, {x34_transform.buildMatrix3f()}, xfc_constantForce, x108_angularMomentum};
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::SetMotionState(const CMotionState &mst)
|
||||||
|
{
|
||||||
|
x34_transform = zeus::CTransform::Translate(x34_transform.origin) * zeus::CMatrix3f(mst.xc_orientation);
|
||||||
|
|
||||||
|
xe4_27_ = true;
|
||||||
|
xe4_28_ = true;
|
||||||
|
xe4_29_ = true;
|
||||||
|
SetTranslation(mst.x0_translation);
|
||||||
|
|
||||||
|
xfc_constantForce = mst.x1c_velocity;
|
||||||
|
x108_angularMomentum = mst.x28_angularMomentum;
|
||||||
|
ComputeDerivedQuantities();
|
||||||
|
}
|
||||||
|
|
||||||
void CPhysicsActor::SetInertiaTensorScalar(float tensor)
|
void CPhysicsActor::SetInertiaTensorScalar(float tensor)
|
||||||
{
|
{
|
||||||
if (tensor <= 0.0f)
|
if (tensor <= 0.0f)
|
||||||
tensor = 1.0f;
|
tensor = 1.0f;
|
||||||
xf0_inertialTensor = tensor;
|
xf0_inertiaTensor = tensor;
|
||||||
xf4_inertialTensorRecip = 1.0f / tensor;
|
xf4_inertiaTensorRecip = 1.0f / tensor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPhysicsActor::SetMass(float mass)
|
void CPhysicsActor::SetMass(float mass)
|
||||||
|
@ -113,4 +193,294 @@ void CPhysicsActor::SetMass(float mass)
|
||||||
SetInertiaTensorScalar(mass * tensor);
|
SetInertiaTensorScalar(mass * tensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::SetAngularVelocityOR(const zeus::CAxisAngle& angVel)
|
||||||
|
{
|
||||||
|
x144_angularVelocity = x34_transform.rotate(angVel);
|
||||||
|
x108_angularMomentum = xf0_inertiaTensor * x144_angularVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CAxisAngle CPhysicsActor::GetAngularVelocityOR() const
|
||||||
|
{
|
||||||
|
return x34_transform.transposeRotate(x144_angularVelocity);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::SetAngularVelocityWR(const zeus::CAxisAngle& angVel)
|
||||||
|
{
|
||||||
|
x144_angularVelocity = angVel;
|
||||||
|
x108_angularMomentum = xf0_inertiaTensor * x144_angularVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::SetVelocityWR(const zeus::CVector3f &vel)
|
||||||
|
{
|
||||||
|
x138_velocity = vel;
|
||||||
|
xfc_constantForce = xe8_mass * x138_velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::SetVelocityOR(const zeus::CVector3f& vel)
|
||||||
|
{
|
||||||
|
SetVelocityWR(x34_transform.rotate(vel));
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CVector3f CPhysicsActor::GetTotalForcesWR() const
|
||||||
|
{
|
||||||
|
return x15c_force + x150_momentum;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::RotateInOneFrameOR(const zeus::CQuaternion &q, float d)
|
||||||
|
{
|
||||||
|
x198_ += GetRotateToORAngularMomentumWR(q, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::MoveInOneFrameOR(const zeus::CVector3f &trans, float d)
|
||||||
|
{
|
||||||
|
x18c_ += GetMoveToORImpulseWR(trans, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::RotateToOR(const zeus::CQuaternion& q, float d)
|
||||||
|
{
|
||||||
|
x108_angularMomentum = GetRotateToORAngularMomentumWR(q, d);
|
||||||
|
ComputeDerivedQuantities();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::MoveToOR(const zeus::CVector3f& trans, float d)
|
||||||
|
{
|
||||||
|
xfc_constantForce = GetMoveToORImpulseWR(trans, d);
|
||||||
|
ComputeDerivedQuantities();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::sub_8011B098(const zeus::CVector3f& trans, float d)
|
||||||
|
{
|
||||||
|
x18c_ += xe8_mass * (trans - x34_transform.origin) * (1.f / d);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::MoveToWR(const zeus::CVector3f& trans, float d)
|
||||||
|
{
|
||||||
|
xfc_constantForce = xe8_mass * (trans - x34_transform.origin) * (1.f / d);
|
||||||
|
ComputeDerivedQuantities();
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CAxisAngle CPhysicsActor::GetRotateToORAngularMomentumWR(const zeus::CQuaternion& q, float d) const
|
||||||
|
{
|
||||||
|
if (q.w > 0.99999976)
|
||||||
|
return zeus::CAxisAngle::skZero;
|
||||||
|
return (xf0_inertiaTensor * (((2.f * std::acos(q.w)) * (1.f / d)) *
|
||||||
|
x34_transform.rotate({q.x, q.y, q.z}).normalized()));
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CVector3f CPhysicsActor::GetMoveToORImpulseWR(const zeus::CVector3f &trans, float d) const
|
||||||
|
{
|
||||||
|
return (xe8_mass * x34_transform.rotate(trans)) * (1.f / d);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::ClearImpulses()
|
||||||
|
{
|
||||||
|
x18c_ = x168_impulse = zeus::CVector3f::skZero;
|
||||||
|
x198_ = x180_angularImpulse = zeus::CAxisAngle::skZero;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::ClearForcesAndTorques()
|
||||||
|
{
|
||||||
|
x18c_ = x168_impulse = x15c_force = zeus::CVector3f::skZero;
|
||||||
|
x198_ = x180_angularImpulse = x174_torque = zeus::CAxisAngle::skZero;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::Stop()
|
||||||
|
{
|
||||||
|
ClearForcesAndTorques();
|
||||||
|
xfc_constantForce = zeus::CVector3f::skZero;
|
||||||
|
x108_angularMomentum = zeus::CAxisAngle::skZero;
|
||||||
|
ComputeDerivedQuantities();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::ComputeDerivedQuantities()
|
||||||
|
{
|
||||||
|
x138_velocity = xec_massRecip * xfc_constantForce;
|
||||||
|
x114_ = x34_transform.buildMatrix3f();
|
||||||
|
x144_angularVelocity = xf0_inertiaTensor * x108_angularMomentum;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPhysicsActor::WillMove(const CStateManager&)
|
||||||
|
{
|
||||||
|
if (!zeus::close_enough(zeus::CVector3f::skZero, x138_velocity) ||
|
||||||
|
!zeus::close_enough(zeus::CVector3f::skZero, x168_impulse) ||
|
||||||
|
!zeus::close_enough(zeus::CVector3f::skZero, x174_torque) ||
|
||||||
|
!zeus::close_enough(zeus::CVector3f::skZero, x18c_) ||
|
||||||
|
!zeus::close_enough(zeus::CVector3f::skZero, x144_angularVelocity) ||
|
||||||
|
!zeus::close_enough(zeus::CVector3f::skZero, x180_angularImpulse) ||
|
||||||
|
!zeus::close_enough(zeus::CVector3f::skZero, x198_) ||
|
||||||
|
!zeus::close_enough(zeus::CVector3f::skZero, GetTotalForcesWR()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::SetPhysicsState(const CPhysicsState &state)
|
||||||
|
{
|
||||||
|
SetTranslation(state.GetTranslation());
|
||||||
|
x34_transform = zeus::CTransform::Translate(x34_transform.origin) * zeus::CMatrix3f(state.GetOrientation());
|
||||||
|
xe4_27_ = true;
|
||||||
|
xe4_28_ = true;
|
||||||
|
xe4_29_ = true;
|
||||||
|
|
||||||
|
xfc_constantForce = state.GetConstantForceWR();
|
||||||
|
x108_angularMomentum = state.GetAngularMomentumWR();;
|
||||||
|
x150_momentum = state.GetMomentumWR();
|
||||||
|
x15c_force = state.GetForceWR();
|
||||||
|
x168_impulse = state.GetImpulseWR();
|
||||||
|
x174_torque = state.GetTorque();
|
||||||
|
x180_angularImpulse = state.GetAngularImpulseWR();
|
||||||
|
ComputeDerivedQuantities();
|
||||||
|
}
|
||||||
|
|
||||||
|
CPhysicsState CPhysicsActor::GetPhysicsState() const
|
||||||
|
{
|
||||||
|
return {x34_transform.origin, {x34_transform.buildMatrix3f()}, xfc_constantForce, x108_angularMomentum,
|
||||||
|
x150_momentum, x15c_force, x168_impulse, x174_torque, x180_angularImpulse};
|
||||||
|
}
|
||||||
|
|
||||||
|
CMotionState CPhysicsActor::PredictMotion_Internal(float dt) const
|
||||||
|
{
|
||||||
|
if (xf8_25_)
|
||||||
|
return PredictMotion(dt);
|
||||||
|
|
||||||
|
CMotionState msl = PredictLinearMotion(dt);
|
||||||
|
CMotionState msa = PredictAngularMotion(dt);
|
||||||
|
return {msl.x0_translation, msa.xc_orientation, msl.x1c_velocity, msa.x28_angularMomentum};
|
||||||
|
}
|
||||||
|
|
||||||
|
CMotionState CPhysicsActor::PredictMotion(float dt) const
|
||||||
|
{
|
||||||
|
CMotionState msl = PredictLinearMotion(dt);
|
||||||
|
CMotionState msa = PredictAngularMotion(dt);
|
||||||
|
return {msl.x0_translation, msa.xc_orientation, msl.x1c_velocity, msa.x28_angularMomentum};
|
||||||
|
}
|
||||||
|
|
||||||
|
CMotionState CPhysicsActor::PredictLinearMotion(float dt) const
|
||||||
|
{
|
||||||
|
zeus::CVector3f velocity = CalculateNewVelocityWR_UsingImpulses();
|
||||||
|
return {velocity * dt, zeus::CNUQuaternion::skNoRotation,
|
||||||
|
((x15c_force + x150_momentum) * dt) + x168_impulse,
|
||||||
|
zeus::CAxisAngle::skZero};
|
||||||
|
}
|
||||||
|
|
||||||
|
CMotionState CPhysicsActor::PredictAngularMotion(float dt) const
|
||||||
|
{
|
||||||
|
const zeus::CVector3f v1 = xf4_inertiaTensorRecip * (x180_angularImpulse + x198_);
|
||||||
|
zeus::CNUQuaternion q = 0.5f * zeus::CNUQuaternion({0.f, x144_angularVelocity + v1});
|
||||||
|
return {zeus::CVector3f::skZero,
|
||||||
|
q * zeus::CNUQuaternion(x34_transform.buildMatrix3f()) * dt,
|
||||||
|
zeus::CVector3f::skZero,
|
||||||
|
(x174_torque * dt) + x180_angularImpulse};
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::ApplyForceOR(const zeus::CVector3f& force, const zeus::CAxisAngle& torque)
|
||||||
|
{
|
||||||
|
x15c_force += x34_transform.rotate(force);
|
||||||
|
x174_torque += x34_transform.rotate(torque);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::ApplyForceWR(const zeus::CVector3f &force, const zeus::CAxisAngle& torque)
|
||||||
|
{
|
||||||
|
x15c_force += force;
|
||||||
|
x174_torque += torque;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::ApplyImpulseOR(const zeus::CVector3f &impulse, const zeus::CAxisAngle &angle)
|
||||||
|
{
|
||||||
|
x168_impulse += x34_transform.rotate(impulse);
|
||||||
|
x180_angularImpulse += x34_transform.rotate(angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::ApplyImpulseWR(const zeus::CVector3f &impulse, const zeus::CAxisAngle& angleImp)
|
||||||
|
{
|
||||||
|
x168_impulse += impulse;
|
||||||
|
x180_angularImpulse += angleImp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::ApplyTorqueWR(const zeus::CVector3f& torque)
|
||||||
|
{
|
||||||
|
x174_torque += torque;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsActor::UseCollisionImpulses()
|
||||||
|
{
|
||||||
|
xfc_constantForce += x168_impulse;
|
||||||
|
x108_angularMomentum += x180_angularImpulse;
|
||||||
|
|
||||||
|
x168_impulse = zeus::CVector3f::skZero;
|
||||||
|
x180_angularImpulse = zeus::CAxisAngle::skZero;
|
||||||
|
ComputeDerivedQuantities();
|
||||||
|
}
|
||||||
|
|
||||||
|
CPhysicsState::CPhysicsState(const zeus::CVector3f& translation, const zeus::CQuaternion& orient,
|
||||||
|
const zeus::CVector3f& v2, const zeus::CAxisAngle& a1,
|
||||||
|
const zeus::CVector3f& v3, const zeus::CVector3f& v4,
|
||||||
|
const zeus::CVector3f& v5, const zeus::CAxisAngle& a2, const zeus::CAxisAngle& a3)
|
||||||
|
: x0_translation(translation)
|
||||||
|
, xc_orientation(orient)
|
||||||
|
, x1c_constantForce(v2)
|
||||||
|
, x28_angularMomentum(a1)
|
||||||
|
, x34_momentum(v3)
|
||||||
|
, x40_force(v4)
|
||||||
|
, x4c_impulse(v5)
|
||||||
|
, x58_torque(a2)
|
||||||
|
, x64_angularImpulse(a3)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsState::SetTranslation(const zeus::CVector3f& tr)
|
||||||
|
{
|
||||||
|
x0_translation = tr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsState::SetOrientation(const zeus::CQuaternion& orient)
|
||||||
|
{
|
||||||
|
xc_orientation = orient;
|
||||||
|
}
|
||||||
|
|
||||||
|
const zeus::CQuaternion& CPhysicsState::GetOrientation() const
|
||||||
|
{
|
||||||
|
return xc_orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
const zeus::CVector3f& CPhysicsState::GetTranslation() const
|
||||||
|
{
|
||||||
|
return x0_translation;
|
||||||
|
}
|
||||||
|
|
||||||
|
const zeus::CVector3f& CPhysicsState::GetConstantForceWR() const
|
||||||
|
{
|
||||||
|
return x1c_constantForce;
|
||||||
|
}
|
||||||
|
|
||||||
|
const zeus::CAxisAngle& CPhysicsState::GetAngularMomentumWR() const
|
||||||
|
{
|
||||||
|
return x28_angularMomentum;
|
||||||
|
}
|
||||||
|
|
||||||
|
const zeus::CVector3f& CPhysicsState::GetMomentumWR() const
|
||||||
|
{
|
||||||
|
return x34_momentum;
|
||||||
|
}
|
||||||
|
|
||||||
|
const zeus::CVector3f& CPhysicsState::GetForceWR() const
|
||||||
|
{
|
||||||
|
return x40_force;
|
||||||
|
}
|
||||||
|
|
||||||
|
const zeus::CVector3f& CPhysicsState::GetImpulseWR() const
|
||||||
|
{
|
||||||
|
return x4c_impulse;
|
||||||
|
}
|
||||||
|
|
||||||
|
const zeus::CAxisAngle& CPhysicsState::GetTorque() const
|
||||||
|
{
|
||||||
|
return x58_torque;
|
||||||
|
}
|
||||||
|
|
||||||
|
const zeus::CAxisAngle& CPhysicsState::GetAngularImpulseWR() const
|
||||||
|
{
|
||||||
|
return x64_angularImpulse;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,46 @@ struct SMoverData
|
||||||
|
|
||||||
struct CMotionState
|
struct CMotionState
|
||||||
{
|
{
|
||||||
CMotionState(const zeus::CVector3f&, const zeus::CNUQuaternion&, const zeus::CVector3f&, const zeus::CAxisAngle&);
|
zeus::CVector3f x0_translation;
|
||||||
|
zeus::CNUQuaternion xc_orientation;
|
||||||
|
zeus::CVector3f x1c_velocity;
|
||||||
|
zeus::CAxisAngle x28_angularMomentum;
|
||||||
|
CMotionState(const zeus::CVector3f& origin, const zeus::CNUQuaternion& orientation,
|
||||||
|
const zeus::CVector3f& velocity, const zeus::CAxisAngle& angle)
|
||||||
|
: x0_translation(origin)
|
||||||
|
, xc_orientation(orientation)
|
||||||
|
, x1c_velocity(velocity)
|
||||||
|
, x28_angularMomentum(angle)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
class CPhysicsState
|
||||||
|
{
|
||||||
|
zeus::CVector3f x0_translation;
|
||||||
|
zeus::CQuaternion xc_orientation;
|
||||||
|
zeus::CVector3f x1c_constantForce;
|
||||||
|
zeus::CAxisAngle x28_angularMomentum;
|
||||||
|
zeus::CVector3f x34_momentum;
|
||||||
|
zeus::CVector3f x40_force;
|
||||||
|
zeus::CVector3f x4c_impulse;
|
||||||
|
zeus::CAxisAngle x58_torque;
|
||||||
|
zeus::CAxisAngle x64_angularImpulse;
|
||||||
|
public:
|
||||||
|
CPhysicsState(const zeus::CVector3f&, const zeus::CQuaternion&, const zeus::CVector3f&,
|
||||||
|
const zeus::CAxisAngle&, const zeus::CVector3f&, const zeus::CVector3f&,
|
||||||
|
const zeus::CVector3f&, const zeus::CAxisAngle&, const zeus::CAxisAngle&);
|
||||||
|
|
||||||
|
void SetOrientation(const zeus::CQuaternion&);
|
||||||
|
const zeus::CQuaternion& GetOrientation() const;
|
||||||
|
void SetTranslation(const zeus::CVector3f&);
|
||||||
|
const zeus::CVector3f& GetTranslation() const;
|
||||||
|
const zeus::CVector3f& GetConstantForceWR() const;
|
||||||
|
const zeus::CAxisAngle& GetAngularMomentumWR() const;
|
||||||
|
const zeus::CVector3f& GetMomentumWR() const;
|
||||||
|
const zeus::CVector3f& GetForceWR() const;
|
||||||
|
const zeus::CVector3f& GetImpulseWR() const;
|
||||||
|
const zeus::CAxisAngle& GetTorque() const;
|
||||||
|
const zeus::CAxisAngle& GetAngularImpulseWR() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPhysicsActor : public CActor
|
class CPhysicsActor : public CActor
|
||||||
|
@ -30,34 +69,43 @@ class CPhysicsActor : public CActor
|
||||||
protected:
|
protected:
|
||||||
float xe8_mass;
|
float xe8_mass;
|
||||||
float xec_massRecip;
|
float xec_massRecip;
|
||||||
float xf0_inertialTensor;
|
float xf0_inertiaTensor;
|
||||||
float xf4_inertialTensorRecip;
|
float xf4_inertiaTensorRecip;
|
||||||
bool xf8_;
|
union
|
||||||
bool xf9_;
|
{
|
||||||
zeus::CVector3f xfc_;
|
struct
|
||||||
zeus::CAxisAngle x108_;
|
{
|
||||||
|
bool xf8_24_ : 1;
|
||||||
|
bool xf8_25_ : 1;
|
||||||
|
};
|
||||||
|
u8 _dummy = 0;
|
||||||
|
};
|
||||||
|
bool xf9_ = false;
|
||||||
|
zeus::CVector3f xfc_constantForce;
|
||||||
|
zeus::CAxisAngle x108_angularMomentum;
|
||||||
zeus::CMatrix3f x114_;
|
zeus::CMatrix3f x114_;
|
||||||
zeus::CVector3f x138_;
|
zeus::CVector3f x138_velocity;
|
||||||
zeus::CAxisAngle x144_;
|
zeus::CAxisAngle x144_angularVelocity;
|
||||||
zeus::CVector3f x150_;
|
zeus::CVector3f x150_momentum;
|
||||||
zeus::CVector3f x15c_;
|
zeus::CVector3f x15c_force;
|
||||||
zeus::CVector3f x168_;
|
zeus::CVector3f x168_impulse;
|
||||||
zeus::CAxisAngle x174_;
|
zeus::CAxisAngle x174_torque;
|
||||||
zeus::CAxisAngle x180_;
|
zeus::CAxisAngle x180_angularImpulse;
|
||||||
zeus::CVector3f x18c_;
|
zeus::CVector3f x18c_;
|
||||||
zeus::CAxisAngle x198_;
|
zeus::CAxisAngle x198_;
|
||||||
zeus::CAABox x1a4_baseBoundingBox;
|
zeus::CAABox x1a4_baseBoundingBox;
|
||||||
CCollidableAABox x1c0_collisionPrimitive;
|
CCollidableAABox x1c0_collisionPrimitive;
|
||||||
zeus::CVector3f x1e8_primitiveOffset;
|
zeus::CVector3f x1e8_primitiveOffset;
|
||||||
zeus::CQuaternion x200_;
|
zeus::CVector3f x1f4_translation;
|
||||||
zeus::CVector3f x210_;
|
zeus::CNUQuaternion x200_orientation;
|
||||||
zeus::CVector3f x21c_;
|
zeus::CAxisAngle x210_;
|
||||||
bool x234_;
|
zeus::CAxisAngle x21c_;
|
||||||
|
bool x234_ = false;
|
||||||
float x238_ = 1000000.0f;
|
float x238_ = 1000000.0f;
|
||||||
float x23c_stepUpHeight;
|
float x23c_stepUpHeight;
|
||||||
float x240_stepDownHeight;
|
float x240_stepDownHeight;
|
||||||
float x244_restitutionCoefModifier;
|
float x244_restitutionCoefModifier = 0.f;
|
||||||
float x248_collisionAccuracyModifier;
|
float x248_collisionAccuracyModifier = 1.f;
|
||||||
u32 x24c_;
|
u32 x24c_;
|
||||||
u32 x250_;
|
u32 x250_;
|
||||||
public:
|
public:
|
||||||
|
@ -66,25 +114,64 @@ public:
|
||||||
const zeus::CAABox&, const SMoverData&, const CActorParameters&,
|
const zeus::CAABox&, const SMoverData&, const CActorParameters&,
|
||||||
float, float);
|
float, float);
|
||||||
|
|
||||||
void Render(const CStateManager& mgr);
|
void Render(const CStateManager& mgr) const;
|
||||||
zeus::CVector3f GetOrbitPosition(const CStateManager&);
|
zeus::CVector3f GetOrbitPosition(const CStateManager&) const;
|
||||||
zeus::CVector3f GetAimPosition(const CStateManager&, float val);
|
zeus::CVector3f GetAimPosition(const CStateManager&, float val) const;
|
||||||
virtual const CCollisionPrimitive& GetCollisionPrimitive() const;
|
virtual const CCollisionPrimitive& GetCollisionPrimitive() const;
|
||||||
virtual zeus::CTransform GetPrimitiveTransform();
|
virtual zeus::CTransform GetPrimitiveTransform() const;
|
||||||
virtual void CollidedWith(const TUniqueId&, const CCollisionInfoList&, CStateManager&);
|
virtual void CollidedWith(const TUniqueId&, const CCollisionInfoList&, CStateManager&);
|
||||||
virtual float GetStepUpHeight();
|
virtual float GetStepUpHeight() const;
|
||||||
virtual float GetStepDownHeight();
|
virtual float GetStepDownHeight() const;
|
||||||
virtual float GetWeight();
|
virtual float GetWeight() const;
|
||||||
|
|
||||||
|
void sub_8011A4C(float f);
|
||||||
|
float sub_8011A4B8() const;
|
||||||
void SetPrimitiveOffset(const zeus::CVector2f& offset);
|
void SetPrimitiveOffset(const zeus::CVector2f& offset);
|
||||||
zeus::CVector3f GetPrimitiveOffset();
|
zeus::CVector3f GetPrimitiveOffset();
|
||||||
void MoveCollisionPrimitive(const zeus::CVector3f& offset);
|
void MoveCollisionPrimitive(const zeus::CVector3f& offset);
|
||||||
void SetBoundingBox(const zeus::CAABox& box);
|
void SetBoundingBox(const zeus::CAABox& box);
|
||||||
zeus::CAABox GetMotionVolume();
|
zeus::CAABox GetMotionVolume(float f31) const;
|
||||||
zeus::CAABox GetBoundingBox();
|
zeus::CVector3f CalculateNewVelocityWR_UsingImpulses() const;
|
||||||
|
zeus::CAABox GetBoundingBox() const;
|
||||||
const zeus::CAABox& GetBaseBoundingBox() const;
|
const zeus::CAABox& GetBaseBoundingBox() const;
|
||||||
|
void AddMotionState(const CMotionState& mst);
|
||||||
|
CMotionState GetMotionState() const;
|
||||||
|
void SetMotionState(const CMotionState& mst);
|
||||||
void SetInertiaTensorScalar(float tensor);
|
void SetInertiaTensorScalar(float tensor);
|
||||||
void SetMass(float mass);
|
void SetMass(float mass);
|
||||||
|
void SetAngularVelocityOR(const zeus::CAxisAngle& angVel);
|
||||||
|
zeus::CAxisAngle GetAngularVelocityOR() const;
|
||||||
|
void SetAngularVelocityWR(const zeus::CAxisAngle& angVel);
|
||||||
|
void SetVelocityWR(const zeus::CVector3f& vel);
|
||||||
|
void SetVelocityOR(const zeus::CVector3f& vel);
|
||||||
|
zeus::CVector3f GetTotalForcesWR() const;
|
||||||
|
void RotateInOneFrameOR(const zeus::CQuaternion& q, float d);
|
||||||
|
void MoveInOneFrameOR(const zeus::CVector3f& trans, float d);
|
||||||
|
void RotateToOR(const zeus::CQuaternion& q, float d);
|
||||||
|
void MoveToOR(const zeus::CVector3f& trans, float d);
|
||||||
|
void sub_8011B098(const zeus::CVector3f &v1, float d);
|
||||||
|
void MoveToWR(const zeus::CVector3f& trans, float d);
|
||||||
|
zeus::CAxisAngle GetRotateToORAngularMomentumWR(const zeus::CQuaternion& q, float d) const;
|
||||||
|
zeus::CVector3f GetMoveToORImpulseWR(const zeus::CVector3f& trans, float d) const;
|
||||||
|
void ClearImpulses();
|
||||||
|
void ClearForcesAndTorques();
|
||||||
|
void Stop();
|
||||||
|
void ComputeDerivedQuantities();
|
||||||
|
bool WillMove(const CStateManager&);
|
||||||
|
void SetPhysicsState(const CPhysicsState& state);
|
||||||
|
CPhysicsState GetPhysicsState() const;
|
||||||
|
|
||||||
|
CMotionState PredictMotion_Internal(float) const;
|
||||||
|
CMotionState PredictMotion(float dt) const;
|
||||||
|
CMotionState PredictLinearMotion(float dt) const;
|
||||||
|
CMotionState PredictAngularMotion(float dt) const;
|
||||||
|
void ApplyForceOR(const zeus::CVector3f& force, const zeus::CAxisAngle& angle);
|
||||||
|
void ApplyForceWR(const zeus::CVector3f& force, const zeus::CAxisAngle& angle);
|
||||||
|
void ApplyImpulseOR(const zeus::CVector3f& impulse, const zeus::CAxisAngle& angle);
|
||||||
|
void ApplyImpulseWR(const zeus::CVector3f& impulse, const zeus::CAxisAngle& angle);
|
||||||
|
void ApplyTorqueWR(const zeus::CVector3f& torque);
|
||||||
|
|
||||||
|
void UseCollisionImpulses();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,11 @@ static CModelData MakePlayerAnimRes(ResId resId, const zeus::CVector3f& scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox& aabb, unsigned int resId,
|
CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox& aabb, unsigned int resId,
|
||||||
const zeus::CVector3f& playerScale, float f1, float f2, float f3, float f4, const CMaterialList& ml)
|
const zeus::CVector3f& playerScale, float mass, float stepUp, float stepDown, float f4,
|
||||||
|
const CMaterialList& ml)
|
||||||
: CPhysicsActor(uid, true, "CPlayer", CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList),
|
: CPhysicsActor(uid, true, "CPlayer", CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList),
|
||||||
xf, MakePlayerAnimRes(resId, playerScale), ml, aabb, SMoverData(f1), CActorParameters::None(), f2, f3)
|
xf, MakePlayerAnimRes(resId, playerScale), ml, aabb, SMoverData(mass), CActorParameters::None(),
|
||||||
|
stepUp, stepDown)
|
||||||
{
|
{
|
||||||
x768_morphball.reset(new CMorphBall(*this, f4));
|
x768_morphball.reset(new CMorphBall(*this, f4));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,18 +4,6 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
bool close_enough(const zeus::CVector2f& a, const zeus::CVector2f& b, float epsilon = 0.000099999997f)
|
|
||||||
{
|
|
||||||
if (std::fabs(a.x - b.x) < epsilon && std::fabs(a.y - b.y) < epsilon)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool close_enough(float a, float b, double epsilon = 0.000009999999747378752)
|
|
||||||
{
|
|
||||||
return std::fabs(a - b) < epsilon;
|
|
||||||
}
|
|
||||||
|
|
||||||
CScriptDistanceFog::CScriptDistanceFog(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
CScriptDistanceFog::CScriptDistanceFog(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||||
const ERglFogMode& mode, const zeus::CColor& color,
|
const ERglFogMode& mode, const zeus::CColor& color,
|
||||||
const zeus::CVector2f& range, float colorDelta,
|
const zeus::CVector2f& range, float colorDelta,
|
||||||
|
@ -34,7 +22,7 @@ CScriptDistanceFog::CScriptDistanceFog(TUniqueId uid, const std::string& name, c
|
||||||
x60_explicit(expl)
|
x60_explicit(expl)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (close_enough(rangeDelta, zeus::CVector2f::skZero) && close_enough(colorDelta, 0.f))
|
if (zeus::close_enough(rangeDelta, zeus::CVector2f::skZero) && zeus::close_enough(colorDelta, 0.f))
|
||||||
x61_nonZero = false;
|
x61_nonZero = false;
|
||||||
else
|
else
|
||||||
x61_nonZero = true;
|
x61_nonZero = true;
|
||||||
|
@ -68,7 +56,7 @@ void CScriptDistanceFog::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId obj
|
||||||
else
|
else
|
||||||
fog->FadeFog(x34_mode, x38_color, x3c_range, x44_colorDelta, x48_rangeDelta);
|
fog->FadeFog(x34_mode, x38_color, x3c_range, x44_colorDelta, x48_rangeDelta);
|
||||||
|
|
||||||
if (close_enough(x54_thermalSpeed, 0.f) && !close_enough(x5c_xraySpeed, 0.f))
|
if (zeus::close_enough(x54_thermalSpeed, 0.f) && !zeus::close_enough(x5c_xraySpeed, 0.f))
|
||||||
{
|
{
|
||||||
CWorld* world = stateMgr.GetWorld();
|
CWorld* world = stateMgr.GetWorld();
|
||||||
CGameArea* area = world->GetArea(GetAreaId());
|
CGameArea* area = world->GetArea(GetAreaId());
|
||||||
|
|
|
@ -14,10 +14,12 @@ CMaterialList MakeDockMaterialList()
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
CScriptDock::CScriptDock(TUniqueId uid, const std::string &name, const CEntityInfo &info, const zeus::CVector3f position,
|
CScriptDock::CScriptDock(TUniqueId uid, const std::string &name, const CEntityInfo &info,
|
||||||
const zeus::CVector3f& extents, s32 dock, TAreaId area, bool active, s32 w1, bool b1)
|
const zeus::CVector3f position, const zeus::CVector3f& extents, s32 dock, TAreaId area,
|
||||||
|
bool active, s32 w1, bool b1)
|
||||||
: CPhysicsActor(uid, active, name, info, zeus::CTransform(zeus::CMatrix3f::skIdentityMatrix3f, position),
|
: CPhysicsActor(uid, active, name, info, zeus::CTransform(zeus::CMatrix3f::skIdentityMatrix3f, position),
|
||||||
CModelData::CModelDataNull(), MakeDockMaterialList(), zeus::CAABox(-extents * 0.5f, extents * 0.5f), SMoverData(1.f), CActorParameters::None(), 0.3f, 0.1f),
|
CModelData::CModelDataNull(), MakeDockMaterialList(), zeus::CAABox(-extents * 0.5f, extents * 0.5f),
|
||||||
|
SMoverData(1.f), CActorParameters::None(), 0.3f, 0.1f),
|
||||||
x258_(w1),
|
x258_(w1),
|
||||||
x25c_dock(dock),
|
x25c_dock(dock),
|
||||||
x260_area(area),
|
x260_area(area),
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
CScriptPickup::CScriptPickup(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
CScriptPickup::CScriptPickup(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||||
CModelData&& mData, const CActorParameters& aParams, const zeus::CAABox& aabb,
|
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& aParams,
|
||||||
s32, s32, s32, s32, float, float, float, float, bool active)
|
const zeus::CAABox& aabb, s32, s32, s32, s32, float, float, float, float, bool active)
|
||||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), CMaterialList(), aabb, SMoverData(1.f), aParams, 0.3f, 0.1f)
|
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), CMaterialList(), aabb, SMoverData(1.f), aParams,
|
||||||
|
0.3f, 0.1f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,13 @@ static CMaterialList MakePlatformMaterialList()
|
||||||
}
|
}
|
||||||
|
|
||||||
CScriptPlatform::CScriptPlatform(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
CScriptPlatform::CScriptPlatform(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||||
const zeus::CTransform& xf, CModelData&& mData,
|
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
|
||||||
const CActorParameters& actParms, const zeus::CAABox& aabb,
|
const zeus::CAABox& aabb, float, bool, float, bool active, const CHealthInfo& hInfo,
|
||||||
float, bool, float, bool active, const CHealthInfo& hInfo,
|
const CDamageVulnerability& dInfo,
|
||||||
const CDamageVulnerability& dInfo, const TLockedToken<CCollidableOBBTreeGroup>& dcln,
|
const rstl::optional_object<TLockedToken<CCollidableOBBTreeGroup>>& dcln, bool, u32,
|
||||||
bool, u32, u32)
|
u32)
|
||||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakePlatformMaterialList(),
|
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakePlatformMaterialList(), aabb, SMoverData(15000.f),
|
||||||
aabb, SMoverData(15000.f), actParms, 0.3f, 0.1f)
|
actParms, 0.3f, 0.1f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,13 +12,11 @@ class CCollidableOBBTreeGroup;
|
||||||
class CScriptPlatform : public CPhysicsActor
|
class CScriptPlatform : public CPhysicsActor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CScriptPlatform(TUniqueId, const std::string& name, const CEntityInfo& info,
|
CScriptPlatform(TUniqueId, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
const zeus::CTransform& xf, CModelData&& mData,
|
CModelData&& mData, const CActorParameters& actParms, const zeus::CAABox& aabb, float, bool, float,
|
||||||
const CActorParameters& actParms, const zeus::CAABox& aabb,
|
bool, const CHealthInfo& hInfo, const CDamageVulnerability& dInfo,
|
||||||
float, bool, float, bool, const CHealthInfo& hInfo, const CDamageVulnerability& dInfo,
|
const rstl::optional_object<TLockedToken<CCollidableOBBTreeGroup>>& dcln, bool, u32, u32);
|
||||||
const TLockedToken<CCollidableOBBTreeGroup>& dcln, bool, u32, u32);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __URDE_CSCRIPTPLATFORM_HPP__
|
#endif // __URDE_CSCRIPTPLATFORM_HPP__
|
||||||
|
|
|
@ -6,12 +6,11 @@ namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CScriptSpecialFunction::CScriptSpecialFunction(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
CScriptSpecialFunction::CScriptSpecialFunction(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||||
const zeus::CTransform& xf, ESpecialFunction,
|
const zeus::CTransform& xf, ESpecialFunction, const std::string&, float,
|
||||||
const std::string&, float, float, float, float, const zeus::CVector3f&,
|
float, float, float, const zeus::CVector3f&, const zeus::CColor&,
|
||||||
const zeus::CColor&, bool active, const CDamageInfo&, u32, u32, u32, u16, u16, u16)
|
bool active, const CDamageInfo&, u32, u32, u32, u16, u16, u16)
|
||||||
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None(), kInvalidUniqueId)
|
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None(),
|
||||||
|
kInvalidUniqueId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,17 +46,17 @@ public:
|
||||||
Ending,
|
Ending,
|
||||||
FusionRelay,
|
FusionRelay,
|
||||||
WeaponSwitch,
|
WeaponSwitch,
|
||||||
FourtySeven = 47,
|
FogVolume = 47,
|
||||||
FourtyEight = 48
|
RadialDamage = 48,
|
||||||
|
EnvFxDensityController = 49,
|
||||||
|
RumbleEffect = 50
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CScriptSpecialFunction(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, ESpecialFunction,
|
CScriptSpecialFunction(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, ESpecialFunction,
|
||||||
const std::string&, float, float, float, float, const zeus::CVector3f&, const zeus::CColor&, bool,
|
const std::string&, float, float, float, float, const zeus::CVector3f&, const zeus::CColor&,
|
||||||
const CDamageInfo&, u32, u32, u32, u16, u16, u16);
|
bool, const CDamageInfo&, u32, u32, u32, u16, u16, u16);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
2
specter
2
specter
|
@ -1 +1 @@
|
||||||
Subproject commit 8395c1d5be86448f5072534f0b6d8699c2d32443
|
Subproject commit 24414bf4d447697caa048a9346ffa9870cb530a5
|
Loading…
Reference in New Issue