CPhysicsActor fixes, initial clang-format

This commit is contained in:
Phillip Stephens 2016-09-02 08:26:29 -07:00
parent 67b6ccf2ff
commit 022c2feb6c
16 changed files with 283 additions and 380 deletions

View File

@ -16,7 +16,6 @@ AlignTrailingComments: true
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BreakConstructorInitializersBeforeComma: true
BreakStringLiterals: true
AlwaysBreakAfterReturnType: None
AlwaysBreakAfterDefinitionReturnType: None
AllowShortFunctionsOnASingleLine: All

View File

@ -37,7 +37,7 @@ struct Flaahgra : IScriptObject
UniqueID32 dependencyGroup;
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));
actorParameters2.addCMDLRigPairs(addTo, animationParameters.getCINF(pakRouter));

View File

@ -19,7 +19,6 @@ struct IScriptObject : BigYAML
Value<atUint32> state;
Value<atUint32> msg;
Value<atUint32> target;
};
Value<atUint32> connectionCount;
@ -28,7 +27,9 @@ struct IScriptObject : BigYAML
virtual ~IScriptObject() = default;
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 {}
};
}

View File

@ -19,17 +19,17 @@ void CSfxManager::UpdateListener(const zeus::CVector3f& pos, const zeus::CVector
u16 CSfxManager::TranslateSFXID(u16 id)
{
if (mpSfxTranslationTable)
if (mpSfxTranslationTable == nullptr)
return 0;
u16 index = id & 0xFFFF;
u16 index = id;
if (index >= mpSfxTranslationTable->size())
return 0;
s16 ret = mpSfxTranslationTable->at(index);
if (ret == -1)
return 0;
return ret & 0xFFFF;
return ret;
}
}

View File

@ -152,7 +152,9 @@ class CStateManager
};
u16 _dummy = 0;
};
s32 xef4_;
zeus::CVector2i xef8_;
zeus::CVector2i xf00_;
float xf24_thermColdScale1 = 0.f;
float xf28_thermColdScale2 = 0.f;
float xf2c_ = 1.f;

View File

@ -371,7 +371,7 @@ SAdvancementDeltas CAnimData::Advance(float dt, const zeus::CVector3f& scale,
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(),
scale, stateMgr, aid, x21c_);

View File

@ -42,7 +42,7 @@ public:
EPOIType GetPoiType() const { return x18_type; }
u32 GetIndex() const {return x24_index;}
float GetWeight() const { return x2c_weight; }
u32 GetCharIdx() const { return x30_charIdx; }
u32 GetCharacterIndex() const { return x30_charIdx; }
u32 GetFlags() const { return x34_flags; }
};

View File

@ -29,7 +29,7 @@ CPatternedInfo::CPatternedInfo(CInputStream& in, u32 pcount)
xdc_(in.readFloatBig()),
xe0_(in.readFloatBig()),
xe4_(in.readFloatBig()),
xe8_sfxId(CSfxManager::TranslateSFXID(in.readUint32Big())),
xe8_deathSfx(CSfxManager::TranslateSFXID(in.readUint32Big())),
xec_animParams(in),
xf8_active(in.readBool()),
xfc_stateMachineId(in.readUint32Big()),
@ -46,7 +46,7 @@ CPatternedInfo::CPatternedInfo(CInputStream& in, u32 pcount)
if (pcount >= 37)
x130_particle2 = in.readUint32Big();
if (pcount >= 38)
x134_sfxId2 = CSfxManager::TranslateSFXID(in.readUint32Big());
x134_iceShatterSfx = CSfxManager::TranslateSFXID(in.readUint32Big());
}
std::pair<bool, u32> CPatternedInfo::HasCorrectParameterCount(CInputStream& in)

View File

@ -38,7 +38,7 @@ class CPatternedInfo
float xdc_;
float xe0_;
float xe4_;
u16 xe8_sfxId;
u16 xe8_deathSfx;
CAnimationParameters xec_animParams;
bool xf8_active;
ResId xfc_stateMachineId;
@ -54,7 +54,7 @@ class CPatternedInfo
zeus::CVector3f x124_particle2Scale;
ResId x130_particle2 = -1;
u16 x134_sfxId2 = -1;
u16 x134_iceShatterSfx = -1;
public:
CPatternedInfo(CInputStream& in, u32 pcount);

View File

@ -72,6 +72,16 @@ float CPhysicsActor::GetWeight() const
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)
{
x1e8_primitiveOffset = offset;
@ -140,7 +150,7 @@ void CPhysicsActor::AddMotionState(const CMotionState& mst)
SetTranslation(x34_transform.origin + mst.x0_translation);
x108_angularMomentum += mst.x1c_velocity;
xfc_constantForce += mst.x1c_velocity;
ComputeDerivedQuantities();
}
@ -158,6 +168,9 @@ void CPhysicsActor::SetMotionState(const CMotionState &mst)
xe4_28_ = true;
xe4_29_ = true;
SetTranslation(mst.x0_translation);
xfc_constantForce = mst.x1c_velocity;
x108_angularMomentum = mst.x28_angularMomentum;
ComputeDerivedQuantities();
}
@ -290,9 +303,11 @@ 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;
@ -330,14 +345,14 @@ CMotionState CPhysicsActor::PredictMotion_Internal(float dt) const
CMotionState msl = PredictLinearMotion(dt);
CMotionState msa = PredictAngularMotion(dt);
return {msl.x0_translation, msa.xc_orientation, msl.x1c_velocity, msa.x28_angularVelocity};
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_angularVelocity};
return {msl.x0_translation, msa.xc_orientation, msl.x1c_velocity, msa.x28_angularMomentum};
}
CMotionState CPhysicsActor::PredictLinearMotion(float dt) const

View File

@ -25,13 +25,13 @@ struct CMotionState
zeus::CVector3f x0_translation;
zeus::CNUQuaternion xc_orientation;
zeus::CVector3f x1c_velocity;
zeus::CAxisAngle x28_angularVelocity;
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_angularVelocity(angle)
, x28_angularMomentum(angle)
{}
};
@ -124,6 +124,8 @@ public:
virtual float GetStepDownHeight() const;
virtual float GetWeight() const;
void sub_8011A4C(float f);
float sub_8011A4B8() const;
void SetPrimitiveOffset(const zeus::CVector2f& offset);
zeus::CVector3f GetPrimitiveOffset();
void MoveCollisionPrimitive(const zeus::CVector3f& offset);

View File

@ -15,14 +15,13 @@ static CMaterialList MakePlatformMaterialList()
}
CScriptPlatform::CScriptPlatform(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData,
const CActorParameters& actParms, const zeus::CAABox& aabb,
float, bool, float, bool active, const CHealthInfo& hInfo,
const CDamageVulnerability& dInfo, const TLockedToken<CCollidableOBBTreeGroup>& dcln,
bool, u32, u32)
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakePlatformMaterialList(),
aabb, SMoverData(15000.f), actParms, 0.3f, 0.1f)
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
const zeus::CAABox& aabb, float, bool, float, bool active, const CHealthInfo& hInfo,
const CDamageVulnerability& dInfo,
const rstl::optional_object<TLockedToken<CCollidableOBBTreeGroup>>& dcln, bool, u32,
u32)
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakePlatformMaterialList(), aabb, SMoverData(15000.f),
actParms, 0.3f, 0.1f)
{
}
}

View File

@ -12,13 +12,11 @@ class CCollidableOBBTreeGroup;
class CScriptPlatform : public CPhysicsActor
{
public:
CScriptPlatform(TUniqueId, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData,
const CActorParameters& actParms, const zeus::CAABox& aabb,
float, bool, float, bool, const CHealthInfo& hInfo, const CDamageVulnerability& dInfo,
const TLockedToken<CCollidableOBBTreeGroup>& dcln, bool, u32, u32);
CScriptPlatform(TUniqueId, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CActorParameters& actParms, const zeus::CAABox& aabb, float, bool, float,
bool, const CHealthInfo& hInfo, const CDamageVulnerability& dInfo,
const rstl::optional_object<TLockedToken<CCollidableOBBTreeGroup>>& dcln, bool, u32, u32);
};
}
#endif // __URDE_CSCRIPTPLATFORM_HPP__

View File

@ -6,12 +6,11 @@ namespace urde
{
CScriptSpecialFunction::CScriptSpecialFunction(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, ESpecialFunction,
const std::string&, float, float, float, float, const zeus::CVector3f&,
const zeus::CColor&, bool active, const CDamageInfo&, u32, u32, u32, u16, u16, u16)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None(), kInvalidUniqueId)
const zeus::CTransform& xf, ESpecialFunction, const std::string&, float,
float, float, float, const zeus::CVector3f&, const zeus::CColor&,
bool active, const CDamageInfo&, u32, u32, u32, u16, u16, u16)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None(),
kInvalidUniqueId)
{
}
}

View File

@ -46,17 +46,17 @@ public:
Ending,
FusionRelay,
WeaponSwitch,
FourtySeven = 47,
FourtyEight = 48
FogVolume = 47,
RadialDamage = 48,
EnvFxDensityController = 49,
RumbleEffect = 50
};
private:
public:
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 CDamageInfo&, u32, u32, u32, u16, u16, u16);
const std::string&, float, float, float, float, const zeus::CVector3f&, const zeus::CColor&,
bool, const CDamageInfo&, u32, u32, u32, u16, u16, u16);
};
}

File diff suppressed because it is too large Load Diff