From c869814da3e2e66a4c1123ef7b7fd766f7586fc8 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Wed, 31 Aug 2016 21:10:08 -0700 Subject: [PATCH 1/5] CPhysicsActor imps --- Runtime/World/CActor.cpp | 8 ++ Runtime/World/CActor.hpp | 1 + Runtime/World/CPhysicsActor.cpp | 150 +++++++++++++++++++++++++-- Runtime/World/CPhysicsActor.hpp | 46 ++++++-- Runtime/World/CScriptDistanceFog.cpp | 16 +-- specter | 2 +- 6 files changed, 187 insertions(+), 36 deletions(-) diff --git a/Runtime/World/CActor.cpp b/Runtime/World/CActor.cpp index 3f71cb13d..4c8c893bb 100644 --- a/Runtime/World/CActor.cpp +++ b/Runtime/World/CActor.cpp @@ -293,4 +293,12 @@ void CActor::SetSfxPitchBend(s32 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; +} + } diff --git a/Runtime/World/CActor.hpp b/Runtime/World/CActor.hpp index 22dc43711..2411e6249 100644 --- a/Runtime/World/CActor.hpp +++ b/Runtime/World/CActor.hpp @@ -138,6 +138,7 @@ public: bool HasModelData() const; const CSfxHandle* GetSfxHandle() const; void SetSfxPitchBend(s32); + void SetTranslation(const zeus::CVector3f& tr); }; } diff --git a/Runtime/World/CPhysicsActor.cpp b/Runtime/World/CPhysicsActor.cpp index d8070387b..e1177c55a 100644 --- a/Runtime/World/CPhysicsActor.cpp +++ b/Runtime/World/CPhysicsActor.cpp @@ -38,22 +38,22 @@ const CCollisionPrimitive& CPhysicsActor::GetCollisionPrimitive() const 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; } -float CPhysicsActor::GetStepDownHeight() +float CPhysicsActor::GetStepDownHeight() const { return x240_stepDownHeight; } -float CPhysicsActor::GetWeight() +float CPhysicsActor::GetWeight() const { return 24.525002f * xe8_mass; } @@ -79,27 +79,69 @@ void CPhysicsActor::SetBoundingBox(const zeus::CAABox &box) 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::CVector3f CPhysicsActor::CalculateNewVelocityWR_UsingImpulses() const +{ + return x138_velocity + (xec_massRecip * (x168_ + x18c_)); } zeus::CAABox CPhysicsActor::GetBoundingBox() { - return {}; + return { x1a4_baseBoundingBox.min + x1e8_primitiveOffset + x34_transform.origin, + x1a4_baseBoundingBox.max + x1e8_primitiveOffset + x34_transform.origin }; } -const zeus::CAABox &CPhysicsActor::GetBaseBoundingBox() const +const zeus::CAABox& CPhysicsActor::GetBaseBoundingBox() const { 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_origin); + + x108_ += mst.x1c_; + + ComputeDerivedQuantities(); +} + +CMotionState CPhysicsActor::GetMotionState() const +{ + return {x34_transform.origin, {x34_transform.buildMatrix3f()}, xfc_, x108_}; +} + void CPhysicsActor::SetInertiaTensorScalar(float tensor) { if (tensor <= 0.0f) tensor = 1.0f; - xf0_inertialTensor = tensor; - xf4_inertialTensorRecip = 1.0f / tensor; + xf0_inertiaTensor = tensor; + xf4_inertiaTensorRecip = 1.0f / tensor; } void CPhysicsActor::SetMass(float mass) @@ -113,4 +155,90 @@ void CPhysicsActor::SetMass(float mass) SetInertiaTensorScalar(mass * tensor); } +void CPhysicsActor::SetAngularVelocityOR(const zeus::CAxisAngle& angVel) +{ + x144_angularVelocity = x34_transform.rotate(angVel); + x108_ = 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_ = xf0_inertiaTensor * x144_angularVelocity; +} + +void CPhysicsActor::SetVelocityWR(const zeus::CVector3f &vel) +{ + x138_velocity = vel; + xfc_ = xe8_mass * x138_velocity; +} + +void CPhysicsActor::SetVelocityOR(const zeus::CVector3f& vel) +{ + SetVelocityWR(x34_transform.rotate(vel)); +} + +zeus::CVector3f CPhysicsActor::GetTotalForcesWR() const +{ + return x15c_ + x150_; +} + +void CPhysicsActor::RotateInOneFrameOR(const zeus::CQuaternion &q, float d) +{ + x198_ += GetRotateToORAngularMomentumWR(q, d); +} + +zeus::CVector3f CPhysicsActor::GetRotateToORAngularMomentumWR(const zeus::CQuaternion& q, float d) const +{ + if (q.w > 0.99999976) + return zeus::CVector3f::skZero; + return (xf0_inertiaTensor * (((2.f * std::acos(q.w)) * (1.f / d)) * + x34_transform.rotate({q.x, q.y, q.z}).normalized())); +} + +void CPhysicsActor::ClearImpulses() +{ + x18c_ = x168_ = zeus::CVector3f::skZero; + x198_ = x180_ = zeus::CAxisAngle::skZero; +} + +void CPhysicsActor::ClearForcesAndTorques() +{ + x18c_ = x168_ = x15c_ = zeus::CVector3f::skZero; + x198_ = x180_ = x174_ = zeus::CAxisAngle::skZero; +} + +void CPhysicsActor::Stop() +{ + ClearForcesAndTorques(); + xfc_ = zeus::CVector3f::skZero; + x108_ = zeus::CAxisAngle::skZero; + ComputeDerivedQuantities(); +} + +void CPhysicsActor::ComputeDerivedQuantities() +{ + x138_velocity = xec_massRecip * xfc_; + x114_ = x34_transform.buildMatrix3f(); + x144_angularVelocity = xf0_inertiaTensor * x108_; +} + +bool CPhysicsActor::WillMove(const CStateManager&) +{ + if (!zeus::close_enough(zeus::CVector3f::skZero, x138_velocity) || + !zeus::close_enough(zeus::CVector3f::skZero, x168_) || + !zeus::close_enough(zeus::CVector3f::skZero, x18c_) || + !zeus::close_enough(zeus::CVector3f::skZero, x144_angularVelocity) || + !zeus::close_enough(zeus::CVector3f::skZero, x180_) || + !zeus::close_enough(zeus::CVector3f::skZero, GetTotalForcesWR())) + return true; + + return false; +} + } diff --git a/Runtime/World/CPhysicsActor.hpp b/Runtime/World/CPhysicsActor.hpp index 4de6794aa..b98ad83bd 100644 --- a/Runtime/World/CPhysicsActor.hpp +++ b/Runtime/World/CPhysicsActor.hpp @@ -22,7 +22,17 @@ struct SMoverData struct CMotionState { - CMotionState(const zeus::CVector3f&, const zeus::CNUQuaternion&, const zeus::CVector3f&, const zeus::CAxisAngle&); + zeus::CVector3f x0_origin; + zeus::CQuaternion xc_rotation; + zeus::CVector3f x1c_; + zeus::CAxisAngle x28_; + CMotionState(const zeus::CVector3f& origin, const zeus::CNUQuaternion& rotation, + const zeus::CVector3f& v2, const zeus::CAxisAngle& angle) + : x0_origin(origin) + , xc_rotation(rotation) + , x1c_(v2) + , x28_(angle) + {} }; class CPhysicsActor : public CActor @@ -30,15 +40,15 @@ class CPhysicsActor : public CActor protected: float xe8_mass; float xec_massRecip; - float xf0_inertialTensor; - float xf4_inertialTensorRecip; + float xf0_inertiaTensor; + float xf4_inertiaTensorRecip; bool xf8_; bool xf9_; zeus::CVector3f xfc_; zeus::CAxisAngle x108_; zeus::CMatrix3f x114_; - zeus::CVector3f x138_; - zeus::CAxisAngle x144_; + zeus::CVector3f x138_velocity; + zeus::CAxisAngle x144_angularVelocity; zeus::CVector3f x150_; zeus::CVector3f x15c_; zeus::CVector3f x168_; @@ -70,21 +80,37 @@ public: zeus::CVector3f GetOrbitPosition(const CStateManager&); zeus::CVector3f GetAimPosition(const CStateManager&, float val); virtual const CCollisionPrimitive& GetCollisionPrimitive() const; - virtual zeus::CTransform GetPrimitiveTransform(); + virtual zeus::CTransform GetPrimitiveTransform() const; virtual void CollidedWith(const TUniqueId&, const CCollisionInfoList&, CStateManager&); - virtual float GetStepUpHeight(); - virtual float GetStepDownHeight(); - virtual float GetWeight(); + virtual float GetStepUpHeight() const; + virtual float GetStepDownHeight() const; + virtual float GetWeight() const; void SetPrimitiveOffset(const zeus::CVector2f& offset); zeus::CVector3f GetPrimitiveOffset(); void MoveCollisionPrimitive(const zeus::CVector3f& offset); void SetBoundingBox(const zeus::CAABox& box); - zeus::CAABox GetMotionVolume(); + zeus::CAABox GetMotionVolume(float f31) const; + zeus::CVector3f CalculateNewVelocityWR_UsingImpulses() const; zeus::CAABox GetBoundingBox(); const zeus::CAABox& GetBaseBoundingBox() const; + void AddMotionState(const CMotionState& mst); + CMotionState GetMotionState() const; void SetInertiaTensorScalar(float tensor); 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); + zeus::CVector3f GetRotateToORAngularMomentumWR(const zeus::CQuaternion& q, float d) const; + void ClearImpulses(); + void ClearForcesAndTorques(); + void Stop(); + void ComputeDerivedQuantities(); + bool WillMove(const CStateManager&); }; } diff --git a/Runtime/World/CScriptDistanceFog.cpp b/Runtime/World/CScriptDistanceFog.cpp index d29706ac0..ac094f1ab 100644 --- a/Runtime/World/CScriptDistanceFog.cpp +++ b/Runtime/World/CScriptDistanceFog.cpp @@ -4,18 +4,6 @@ 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, const ERglFogMode& mode, const zeus::CColor& color, const zeus::CVector2f& range, float colorDelta, @@ -34,7 +22,7 @@ CScriptDistanceFog::CScriptDistanceFog(TUniqueId uid, const std::string& name, c 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; else x61_nonZero = true; @@ -68,7 +56,7 @@ void CScriptDistanceFog::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId obj else 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(); CGameArea* area = world->GetArea(GetAreaId()); diff --git a/specter b/specter index 8395c1d5b..50749d771 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit 8395c1d5be86448f5072534f0b6d8699c2d32443 +Subproject commit 50749d771218db49aac420fe3e7aa11d9ffc3612 From 130108070d6d81c3c0c3508a9dd0444a96f1784c Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Thu, 1 Sep 2016 02:31:18 -0700 Subject: [PATCH 2/5] More CPhysicsActor imps --- Runtime/CToken.hpp | 3 +- Runtime/Collision/CCollidableAABox.cpp | 6 + Runtime/Collision/CCollidableAABox.hpp | 1 + Runtime/World/CAi.cpp | 9 +- Runtime/World/CPhysicsActor.cpp | 290 ++++++++++++++++++++++--- Runtime/World/CPhysicsActor.hpp | 114 +++++++--- Runtime/World/CPlayer.cpp | 6 +- Runtime/World/CScriptDock.cpp | 8 +- Runtime/World/CScriptPickup.cpp | 9 +- 9 files changed, 372 insertions(+), 74 deletions(-) diff --git a/Runtime/CToken.hpp b/Runtime/CToken.hpp index 0be1c4ff9..2c8ba7e7a 100644 --- a/Runtime/CToken.hpp +++ b/Runtime/CToken.hpp @@ -36,7 +36,8 @@ class CObjectReference Unload(); if (IsLoading()) CancelLoad(); - xC_objectStore->ObjectUnreferenced(x4_objTag); + if (xC_objectStore) + xC_objectStore->ObjectUnreferenced(x4_objTag); } return x0_refCount; } diff --git a/Runtime/Collision/CCollidableAABox.cpp b/Runtime/Collision/CCollidableAABox.cpp index 6b75d91ae..af5ebee9d 100644 --- a/Runtime/Collision/CCollidableAABox.cpp +++ b/Runtime/Collision/CCollidableAABox.cpp @@ -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 { return {xf.origin + x10_aabox.min, xf.origin + x10_aabox.max}; diff --git a/Runtime/Collision/CCollidableAABox.hpp b/Runtime/Collision/CCollidableAABox.hpp index 9e5d9a099..2793ef3f9 100644 --- a/Runtime/Collision/CCollidableAABox.hpp +++ b/Runtime/Collision/CCollidableAABox.hpp @@ -19,6 +19,7 @@ class CCollidableAABox : public CCollisionPrimitive zeus::CAABox x10_aabox; public: CCollidableAABox(); + CCollidableAABox(const zeus::CAABox&, const CMaterialList&); zeus::CAABox Transform(const zeus::CTransform&) const; virtual u32 GetTableIndex() const; diff --git a/Runtime/World/CAi.cpp b/Runtime/World/CAi.cpp index aac3b33df..be7cfe400 100644 --- a/Runtime/World/CAi.cpp +++ b/Runtime/World/CAi.cpp @@ -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, - CModelData&& mData, const zeus::CAABox& box, float mass, const CHealthInfo& hInfo, const CDamageVulnerability& dmgVuln, - const CMaterialList& list, ResId, const CActorParameters& actorParams, float f1, float f2) - : CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeAiMaterialList(list), box, SMoverData(mass), actorParams, - f1, f2), + CModelData&& mData, const zeus::CAABox& box, float mass, const CHealthInfo& hInfo, + const CDamageVulnerability& dmgVuln, const CMaterialList& list, ResId, const CActorParameters& actorParams, + float stepUp, float stepDown) + : CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeAiMaterialList(list), box, SMoverData(mass), + actorParams, stepUp, stepDown), x258_healthInfo(hInfo), x260_damageVulnerability(dmgVuln) { diff --git a/Runtime/World/CPhysicsActor.cpp b/Runtime/World/CPhysicsActor.cpp index e1177c55a..004629468 100644 --- a/Runtime/World/CPhysicsActor.cpp +++ b/Runtime/World/CPhysicsActor.cpp @@ -6,27 +6,40 @@ namespace urde CPhysicsActor::CPhysicsActor(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData, const CMaterialList& matList, 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) + , 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) + , x200_(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); } -zeus::CVector3f CPhysicsActor::GetOrbitPosition(const CStateManager &) +zeus::CVector3f CPhysicsActor::GetOrbitPosition(const CStateManager &) const { 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(); - //zeus::CVector3f delta = PredictMotion(val); - return zeus::CVector3f(); + zeus::CVector3f trans = PredictMotion(dt).x0_translation; + return GetBoundingBox().center() + trans; } void CPhysicsActor::CollidedWith(const TUniqueId &, const CCollisionInfoList &, CStateManager &) @@ -100,13 +113,13 @@ zeus::CAABox CPhysicsActor::GetMotionVolume(float dt) const zeus::CVector3f CPhysicsActor::CalculateNewVelocityWR_UsingImpulses() const { - return x138_velocity + (xec_massRecip * (x168_ + x18c_)); + return x138_velocity + (xec_massRecip * (x168_impulse + x18c_)); } -zeus::CAABox CPhysicsActor::GetBoundingBox() +zeus::CAABox CPhysicsActor::GetBoundingBox() const { return { x1a4_baseBoundingBox.min + x1e8_primitiveOffset + x34_transform.origin, - x1a4_baseBoundingBox.max + x1e8_primitiveOffset + x34_transform.origin }; + x1a4_baseBoundingBox.max + x1e8_primitiveOffset + x34_transform.origin }; } const zeus::CAABox& CPhysicsActor::GetBaseBoundingBox() const @@ -124,16 +137,27 @@ void CPhysicsActor::AddMotionState(const CMotionState& mst) xe4_28_ = true; xe4_29_ = true; - SetTranslation(x34_transform.origin + mst.x0_origin); + SetTranslation(x34_transform.origin + mst.x0_translation); - x108_ += mst.x1c_; + x108_angularMomentum += mst.x1c_velocity; ComputeDerivedQuantities(); } CMotionState CPhysicsActor::GetMotionState() const { - return {x34_transform.origin, {x34_transform.buildMatrix3f()}, xfc_, x108_}; + 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); + ComputeDerivedQuantities(); } void CPhysicsActor::SetInertiaTensorScalar(float tensor) @@ -158,7 +182,7 @@ void CPhysicsActor::SetMass(float mass) void CPhysicsActor::SetAngularVelocityOR(const zeus::CAxisAngle& angVel) { x144_angularVelocity = x34_transform.rotate(angVel); - x108_ = xf0_inertiaTensor * x144_angularVelocity; + x108_angularMomentum = xf0_inertiaTensor * x144_angularVelocity; } zeus::CAxisAngle CPhysicsActor::GetAngularVelocityOR() const @@ -169,13 +193,13 @@ zeus::CAxisAngle CPhysicsActor::GetAngularVelocityOR() const void CPhysicsActor::SetAngularVelocityWR(const zeus::CAxisAngle& angVel) { x144_angularVelocity = angVel; - x108_ = xf0_inertiaTensor * x144_angularVelocity; + x108_angularMomentum = xf0_inertiaTensor * x144_angularVelocity; } void CPhysicsActor::SetVelocityWR(const zeus::CVector3f &vel) { x138_velocity = vel; - xfc_ = xe8_mass * x138_velocity; + xfc_constantForce = xe8_mass * x138_velocity; } void CPhysicsActor::SetVelocityOR(const zeus::CVector3f& vel) @@ -185,7 +209,7 @@ void CPhysicsActor::SetVelocityOR(const zeus::CVector3f& vel) zeus::CVector3f CPhysicsActor::GetTotalForcesWR() const { - return x15c_ + x150_; + return x15c_force + x150_momentum; } void CPhysicsActor::RotateInOneFrameOR(const zeus::CQuaternion &q, float d) @@ -193,52 +217,254 @@ void CPhysicsActor::RotateInOneFrameOR(const zeus::CQuaternion &q, float d) x198_ += GetRotateToORAngularMomentumWR(q, d); } -zeus::CVector3f CPhysicsActor::GetRotateToORAngularMomentumWR(const zeus::CQuaternion& q, float d) const +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::CVector3f::skZero; + 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_ = zeus::CVector3f::skZero; - x198_ = x180_ = zeus::CAxisAngle::skZero; + x18c_ = x168_impulse = zeus::CVector3f::skZero; + x198_ = x180_angularImpulse = zeus::CAxisAngle::skZero; } void CPhysicsActor::ClearForcesAndTorques() { - x18c_ = x168_ = x15c_ = zeus::CVector3f::skZero; - x198_ = x180_ = x174_ = zeus::CAxisAngle::skZero; + x18c_ = x168_impulse = x15c_force = zeus::CVector3f::skZero; + x198_ = x180_angularImpulse = x174_torque = zeus::CAxisAngle::skZero; } void CPhysicsActor::Stop() { ClearForcesAndTorques(); - xfc_ = zeus::CVector3f::skZero; - x108_ = zeus::CAxisAngle::skZero; + xfc_constantForce = zeus::CVector3f::skZero; + x108_angularMomentum = zeus::CAxisAngle::skZero; ComputeDerivedQuantities(); } void CPhysicsActor::ComputeDerivedQuantities() { - x138_velocity = xec_massRecip * xfc_; + x138_velocity = xec_massRecip * xfc_constantForce; x114_ = x34_transform.buildMatrix3f(); - x144_angularVelocity = xf0_inertiaTensor * x108_; + 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_) || - !zeus::close_enough(zeus::CVector3f::skZero, x18c_) || - !zeus::close_enough(zeus::CVector3f::skZero, x144_angularVelocity) || - !zeus::close_enough(zeus::CVector3f::skZero, x180_) || - !zeus::close_enough(zeus::CVector3f::skZero, GetTotalForcesWR())) + !zeus::close_enough(zeus::CVector3f::skZero, x168_impulse) || + !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, 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_angularVelocity}; +} + +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}; +} + +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::SetOrientation(const zeus::CQuaternion& orient) +{ + xc_orientation = orient; +} + +const zeus::CQuaternion& CPhysicsState::GetOrientation() const +{ + return xc_orientation; +} + +void CPhysicsState::SetTranslation(const zeus::CVector3f& tr) +{ + x0_translation = tr; +} + +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; +} + } diff --git a/Runtime/World/CPhysicsActor.hpp b/Runtime/World/CPhysicsActor.hpp index b98ad83bd..e532c2067 100644 --- a/Runtime/World/CPhysicsActor.hpp +++ b/Runtime/World/CPhysicsActor.hpp @@ -22,19 +22,48 @@ struct SMoverData struct CMotionState { - zeus::CVector3f x0_origin; - zeus::CQuaternion xc_rotation; - zeus::CVector3f x1c_; - zeus::CAxisAngle x28_; - CMotionState(const zeus::CVector3f& origin, const zeus::CNUQuaternion& rotation, - const zeus::CVector3f& v2, const zeus::CAxisAngle& angle) - : x0_origin(origin) - , xc_rotation(rotation) - , x1c_(v2) - , x28_(angle) + zeus::CVector3f x0_translation; + zeus::CNUQuaternion xc_orientation; + zeus::CVector3f x1c_velocity; + zeus::CAxisAngle x28_angularVelocity; + 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) {} }; +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 { protected: @@ -42,27 +71,35 @@ protected: float xec_massRecip; float xf0_inertiaTensor; float xf4_inertiaTensorRecip; - bool xf8_; - bool xf9_; - zeus::CVector3f xfc_; - zeus::CAxisAngle x108_; + union + { + struct + { + 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::CVector3f x138_velocity; zeus::CAxisAngle x144_angularVelocity; - zeus::CVector3f x150_; - zeus::CVector3f x15c_; - zeus::CVector3f x168_; - zeus::CAxisAngle x174_; - zeus::CAxisAngle x180_; + zeus::CVector3f x150_momentum; + zeus::CVector3f x15c_force; + zeus::CVector3f x168_impulse; + zeus::CAxisAngle x174_torque; + zeus::CAxisAngle x180_angularImpulse; zeus::CVector3f x18c_; zeus::CAxisAngle x198_; zeus::CAABox x1a4_baseBoundingBox; CCollidableAABox x1c0_collisionPrimitive; zeus::CVector3f x1e8_primitiveOffset; - zeus::CQuaternion x200_; - zeus::CVector3f x210_; - zeus::CVector3f x21c_; - bool x234_; + zeus::CNUQuaternion x200_; + zeus::CAxisAngle x210_; + zeus::CAxisAngle x21c_; + bool x234_ = false; float x238_ = 1000000.0f; float x23c_stepUpHeight; float x240_stepDownHeight; @@ -76,9 +113,9 @@ public: const zeus::CAABox&, const SMoverData&, const CActorParameters&, float, float); - void Render(const CStateManager& mgr); - zeus::CVector3f GetOrbitPosition(const CStateManager&); - zeus::CVector3f GetAimPosition(const CStateManager&, float val); + void Render(const CStateManager& mgr) const; + zeus::CVector3f GetOrbitPosition(const CStateManager&) const; + zeus::CVector3f GetAimPosition(const CStateManager&, float val) const; virtual const CCollisionPrimitive& GetCollisionPrimitive() const; virtual zeus::CTransform GetPrimitiveTransform() const; virtual void CollidedWith(const TUniqueId&, const CCollisionInfoList&, CStateManager&); @@ -92,10 +129,11 @@ public: void SetBoundingBox(const zeus::CAABox& box); zeus::CAABox GetMotionVolume(float f31) const; zeus::CVector3f CalculateNewVelocityWR_UsingImpulses() const; - zeus::CAABox GetBoundingBox(); + zeus::CAABox GetBoundingBox() const; const zeus::CAABox& GetBaseBoundingBox() const; void AddMotionState(const CMotionState& mst); CMotionState GetMotionState() const; + void SetMotionState(const CMotionState& mst); void SetInertiaTensorScalar(float tensor); void SetMass(float mass); void SetAngularVelocityOR(const zeus::CAxisAngle& angVel); @@ -105,12 +143,32 @@ public: void SetVelocityOR(const zeus::CVector3f& vel); zeus::CVector3f GetTotalForcesWR() const; void RotateInOneFrameOR(const zeus::CQuaternion& q, float d); - zeus::CVector3f GetRotateToORAngularMomentumWR(const zeus::CQuaternion& q, float d) const; + 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(); }; } diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index f593c0175..a2161dfde 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -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, - 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), - 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)); } diff --git a/Runtime/World/CScriptDock.cpp b/Runtime/World/CScriptDock.cpp index 975a5cda8..3fbe8eed9 100644 --- a/Runtime/World/CScriptDock.cpp +++ b/Runtime/World/CScriptDock.cpp @@ -14,10 +14,12 @@ CMaterialList MakeDockMaterialList() return list; } -CScriptDock::CScriptDock(TUniqueId uid, const std::string &name, const CEntityInfo &info, const zeus::CVector3f position, - const zeus::CVector3f& extents, s32 dock, TAreaId area, bool active, s32 w1, bool b1) +CScriptDock::CScriptDock(TUniqueId uid, const std::string &name, const CEntityInfo &info, + 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), - 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), x25c_dock(dock), x260_area(area), diff --git a/Runtime/World/CScriptPickup.cpp b/Runtime/World/CScriptPickup.cpp index 16314ad65..5beabf65f 100644 --- a/Runtime/World/CScriptPickup.cpp +++ b/Runtime/World/CScriptPickup.cpp @@ -2,10 +2,11 @@ namespace urde { -CScriptPickup::CScriptPickup(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf, - CModelData&& mData, const CActorParameters& aParams, 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) +CScriptPickup::CScriptPickup(TUniqueId uid, const std::string& name, const CEntityInfo& info, + const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& aParams, + 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) { } } From 9a1a434605aa2858cc7d26750777cf2d06f55833 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Thu, 1 Sep 2016 12:39:13 -0700 Subject: [PATCH 3/5] Add missing CPhysicsActor class member --- Runtime/MP1/CWarWasp.cpp | 4 ++-- Runtime/World/CPatterned.cpp | 5 +++-- Runtime/World/CPatternedInfo.cpp | 2 +- Runtime/World/CPatternedInfo.hpp | 2 +- Runtime/World/CPhysicsActor.cpp | 13 +++++++------ Runtime/World/CPhysicsActor.hpp | 7 ++++--- Runtime/World/ScriptLoader.cpp | 14 +++++++++----- specter | 2 +- 8 files changed, 28 insertions(+), 21 deletions(-) diff --git a/Runtime/MP1/CWarWasp.cpp b/Runtime/MP1/CWarWasp.cpp index b8df93c5e..13326d47a 100644 --- a/Runtime/MP1/CWarWasp.cpp +++ b/Runtime/MP1/CWarWasp.cpp @@ -9,8 +9,8 @@ CWarWasp::CWarWasp(TUniqueId uid, const std::string& name, const CEntityInfo& in CModelData&& mData, const CPatternedInfo& pInfo, CPatterned::EFlavorType flavor, CPatterned::EColliderType collider, const CDamageInfo& dInfo1, const CActorParameters& actorParms, 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, - actorParms, false) + : CPatterned(EUnknown::ThirtyNine, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer, + collider, EBodyType::Three, actorParms, false) { } diff --git a/Runtime/World/CPatterned.cpp b/Runtime/World/CPatterned.cpp index b84424640..c99f611fe 100644 --- a/Runtime/World/CPatterned.cpp +++ b/Runtime/World/CPatterned.cpp @@ -20,10 +20,11 @@ CPatterned::CPatterned(EUnknown, TUniqueId uid, const std::string& name, CPatter EBodyType, const CActorParameters& actorParms, bool) : 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}, - 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, moveType == EMovementType::Flyer ? gkPatternedFlyerMaterialList : gkPatternedGroundMaterialList, - pInfo.xfc_stateMachineId, actorParms, pInfo.xd8_, 0.8f) + pInfo.xfc_stateMachineId, actorParms, pInfo.xd8_stepUpHeight, 0.8f) { } diff --git a/Runtime/World/CPatternedInfo.cpp b/Runtime/World/CPatternedInfo.cpp index 97105831d..a832cc9a0 100644 --- a/Runtime/World/CPatternedInfo.cpp +++ b/Runtime/World/CPatternedInfo.cpp @@ -25,7 +25,7 @@ CPatternedInfo::CPatternedInfo(CInputStream& in, u32 pcount) xc4_halfExtent(in.readFloatBig()), xc8_height(in.readFloatBig()), xcc_bodyOrigin(zeus::CVector3f::ReadBig(in)), - xd8_(in.readFloatBig()), + xd8_stepUpHeight(in.readFloatBig()), xdc_(in.readFloatBig()), xe0_(in.readFloatBig()), xe4_(in.readFloatBig()), diff --git a/Runtime/World/CPatternedInfo.hpp b/Runtime/World/CPatternedInfo.hpp index 2617be295..915fdb4f3 100644 --- a/Runtime/World/CPatternedInfo.hpp +++ b/Runtime/World/CPatternedInfo.hpp @@ -34,7 +34,7 @@ class CPatternedInfo float xc4_halfExtent; float xc8_height; zeus::CVector3f xcc_bodyOrigin; - float xd8_; + float xd8_stepUpHeight; float xdc_; float xe0_; float xe4_; diff --git a/Runtime/World/CPhysicsActor.cpp b/Runtime/World/CPhysicsActor.cpp index 004629468..26b313fa7 100644 --- a/Runtime/World/CPhysicsActor.cpp +++ b/Runtime/World/CPhysicsActor.cpp @@ -13,7 +13,8 @@ CPhysicsActor::CPhysicsActor(TUniqueId uid, bool active, const std::string& name , xf8_24_(true) , x150_momentum(moverData.x18_) , x1c0_collisionPrimitive(box, matList) - , x200_(xf.buildMatrix3f()) + , x1f4_translation(xf.origin) + , x200_orientation(xf.buildMatrix3f()) , x23c_stepUpHeight(stepUp) , x240_stepDownHeight(stepDown) { @@ -412,6 +413,11 @@ CPhysicsState::CPhysicsState(const zeus::CVector3f& translation, const zeus::CQu { } +void CPhysicsState::SetTranslation(const zeus::CVector3f& tr) +{ + x0_translation = tr; +} + void CPhysicsState::SetOrientation(const zeus::CQuaternion& orient) { xc_orientation = orient; @@ -422,11 +428,6 @@ const zeus::CQuaternion& CPhysicsState::GetOrientation() const return xc_orientation; } -void CPhysicsState::SetTranslation(const zeus::CVector3f& tr) -{ - x0_translation = tr; -} - const zeus::CVector3f& CPhysicsState::GetTranslation() const { return x0_translation; diff --git a/Runtime/World/CPhysicsActor.hpp b/Runtime/World/CPhysicsActor.hpp index e532c2067..2e751a8c4 100644 --- a/Runtime/World/CPhysicsActor.hpp +++ b/Runtime/World/CPhysicsActor.hpp @@ -96,15 +96,16 @@ protected: zeus::CAABox x1a4_baseBoundingBox; CCollidableAABox x1c0_collisionPrimitive; zeus::CVector3f x1e8_primitiveOffset; - zeus::CNUQuaternion x200_; + zeus::CVector3f x1f4_translation; + zeus::CNUQuaternion x200_orientation; zeus::CAxisAngle x210_; zeus::CAxisAngle x21c_; bool x234_ = false; float x238_ = 1000000.0f; float x23c_stepUpHeight; float x240_stepDownHeight; - float x244_restitutionCoefModifier; - float x248_collisionAccuracyModifier; + float x244_restitutionCoefModifier = 0.f; + float x248_collisionAccuracyModifier = 1.f; u32 x24c_; u32 x250_; public: diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 6eaa45458..765062892 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -1319,8 +1319,8 @@ CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, CAnimRes res(aParms.GetACSFile(), aParms.GetCharacter(), scale, true, aParms.GetInitialAnimation()); CModelData mData(res); - return new MP1::CWarWasp(mgr.AllocateUniqueId(), *name, info, xf, std::move(mData), pInfo, flavor, collider, damageInfo1, actorParms, weaponDesc, - damageInfo2, particle, w1); + return new MP1::CWarWasp(mgr.AllocateUniqueId(), *name, info, xf, std::move(mData), pInfo, flavor, collider, + damageInfo1, actorParms, weaponDesc, damageInfo2, particle, w1); } CEntity* ScriptLoader::LoadSpacePirate(CStateManager& mgr, CInputStream& in, @@ -1342,13 +1342,17 @@ CEntity* ScriptLoader::LoadSpacePirate(CStateManager& mgr, CInputStream& in, if (animParms.GetCharacter() == 0) { - Log.report(logvisor::Warning, "SpacePirate <%s> has AnimationInformation property with invalid character selected", head.x0_name.c_str()); + Log.report(logvisor::Warning, + "SpacePirate <%s> has AnimationInformation property with invalid character selected", + head.x0_name.c_str()); animParms.SetCharacter(2); } - CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), head.x40_scale, animParms.GetInitialAnimation(), true)); + CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), head.x40_scale, + animParms.GetInitialAnimation(), true)); - return new MP1::CSpacePirate(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(mData), aParams, pInfo, in, propCount); + return new MP1::CSpacePirate(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(mData), + aParams, pInfo, in, propCount); } CEntity* ScriptLoader::LoadFlyingPirate(CStateManager& mgr, CInputStream& in, diff --git a/specter b/specter index 50749d771..6109a0512 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit 50749d771218db49aac420fe3e7aa11d9ffc3612 +Subproject commit 6109a051271b811bb687165ddf195d21e1db824e From 67b6ccf2ff145e975a720ff3910471015ed3e93b Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Thu, 1 Sep 2016 13:18:55 -0700 Subject: [PATCH 4/5] Update specter --- specter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specter b/specter index 6109a0512..24414bf4d 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit 6109a051271b811bb687165ddf195d21e1db824e +Subproject commit 24414bf4d447697caa048a9346ffa9870cb530a5 From 022c2feb6cd2f07912e857b5748403ef05cb4a9d Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 2 Sep 2016 08:26:29 -0700 Subject: [PATCH 5/5] CPhysicsActor fixes, initial clang-format --- .clang-format | 1 - DataSpec/DNAMP1/ScriptObjects/Flaahgra.hpp | 2 +- .../DNAMP1/ScriptObjects/IScriptObject.hpp | 5 +- Runtime/Audio/CSfxManager.cpp | 6 +- Runtime/CStateManager.hpp | 4 +- Runtime/Character/CAnimData.cpp | 2 +- Runtime/Character/CPOINode.hpp | 2 +- Runtime/World/CPatternedInfo.cpp | 4 +- Runtime/World/CPatternedInfo.hpp | 4 +- Runtime/World/CPhysicsActor.cpp | 21 +- Runtime/World/CPhysicsActor.hpp | 6 +- Runtime/World/CScriptPlatform.cpp | 15 +- Runtime/World/CScriptPlatform.hpp | 10 +- Runtime/World/CScriptSpecialFunction.cpp | 11 +- Runtime/World/CScriptSpecialFunction.hpp | 12 +- Runtime/World/ScriptLoader.cpp | 558 +++++++----------- 16 files changed, 283 insertions(+), 380 deletions(-) diff --git a/.clang-format b/.clang-format index 21fb3c4bc..2573430fb 100644 --- a/.clang-format +++ b/.clang-format @@ -16,7 +16,6 @@ AlignTrailingComments: true AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: true BreakConstructorInitializersBeforeComma: true -BreakStringLiterals: true AlwaysBreakAfterReturnType: None AlwaysBreakAfterDefinitionReturnType: None AllowShortFunctionsOnASingleLine: All diff --git a/DataSpec/DNAMP1/ScriptObjects/Flaahgra.hpp b/DataSpec/DNAMP1/ScriptObjects/Flaahgra.hpp index c921ba1ab..f99336396 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Flaahgra.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Flaahgra.hpp @@ -37,7 +37,7 @@ struct Flaahgra : IScriptObject UniqueID32 dependencyGroup; void addCMDLRigPairs(PAKRouter& pakRouter, - std::unordered_map>& addTo) const + std::unordered_map>& addTo) const { actorParameters1.addCMDLRigPairs(addTo, patternedInfo.animationParameters.getCINF(pakRouter)); actorParameters2.addCMDLRigPairs(addTo, animationParameters.getCINF(pakRouter)); diff --git a/DataSpec/DNAMP1/ScriptObjects/IScriptObject.hpp b/DataSpec/DNAMP1/ScriptObjects/IScriptObject.hpp index 08d21fc98..db008e9d9 100644 --- a/DataSpec/DNAMP1/ScriptObjects/IScriptObject.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/IScriptObject.hpp @@ -19,7 +19,6 @@ struct IScriptObject : BigYAML Value state; Value msg; Value target; - }; Value connectionCount; @@ -28,7 +27,9 @@ struct IScriptObject : BigYAML virtual ~IScriptObject() = default; virtual void addCMDLRigPairs(PAKRouter&, - std::unordered_map>&) const {} + std::unordered_map>&) const + { + } virtual void nameIDs(PAKRouter& pakRouter) const {} }; } diff --git a/Runtime/Audio/CSfxManager.cpp b/Runtime/Audio/CSfxManager.cpp index 718cbc247..d0da72ec3 100644 --- a/Runtime/Audio/CSfxManager.cpp +++ b/Runtime/Audio/CSfxManager.cpp @@ -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; } } diff --git a/Runtime/CStateManager.hpp b/Runtime/CStateManager.hpp index fb3bd49e9..dc83b8d48 100644 --- a/Runtime/CStateManager.hpp +++ b/Runtime/CStateManager.hpp @@ -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; diff --git a/Runtime/Character/CAnimData.cpp b/Runtime/Character/CAnimData.cpp index 6a79dd49c..50d4e485d 100644 --- a/Runtime/Character/CAnimData.cpp +++ b/Runtime/Character/CAnimData.cpp @@ -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_); diff --git a/Runtime/Character/CPOINode.hpp b/Runtime/Character/CPOINode.hpp index fda27a9a5..ef9cd235b 100644 --- a/Runtime/Character/CPOINode.hpp +++ b/Runtime/Character/CPOINode.hpp @@ -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; } }; diff --git a/Runtime/World/CPatternedInfo.cpp b/Runtime/World/CPatternedInfo.cpp index a832cc9a0..5bfd3a363 100644 --- a/Runtime/World/CPatternedInfo.cpp +++ b/Runtime/World/CPatternedInfo.cpp @@ -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 CPatternedInfo::HasCorrectParameterCount(CInputStream& in) diff --git a/Runtime/World/CPatternedInfo.hpp b/Runtime/World/CPatternedInfo.hpp index 915fdb4f3..9cf6dd15a 100644 --- a/Runtime/World/CPatternedInfo.hpp +++ b/Runtime/World/CPatternedInfo.hpp @@ -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); diff --git a/Runtime/World/CPhysicsActor.cpp b/Runtime/World/CPhysicsActor.cpp index 26b313fa7..f8f3251ff 100644 --- a/Runtime/World/CPhysicsActor.cpp +++ b/Runtime/World/CPhysicsActor.cpp @@ -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 diff --git a/Runtime/World/CPhysicsActor.hpp b/Runtime/World/CPhysicsActor.hpp index 2e751a8c4..dd56fee46 100644 --- a/Runtime/World/CPhysicsActor.hpp +++ b/Runtime/World/CPhysicsActor.hpp @@ -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); diff --git a/Runtime/World/CScriptPlatform.cpp b/Runtime/World/CScriptPlatform.cpp index 2bfa64d47..4d0b3bcbf 100644 --- a/Runtime/World/CScriptPlatform.cpp +++ b/Runtime/World/CScriptPlatform.cpp @@ -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& 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>& dcln, bool, u32, + u32) +: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakePlatformMaterialList(), aabb, SMoverData(15000.f), + actParms, 0.3f, 0.1f) { } - } diff --git a/Runtime/World/CScriptPlatform.hpp b/Runtime/World/CScriptPlatform.hpp index b048a634c..c8895f29a 100644 --- a/Runtime/World/CScriptPlatform.hpp +++ b/Runtime/World/CScriptPlatform.hpp @@ -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& 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>& dcln, bool, u32, u32); }; - } #endif // __URDE_CSCRIPTPLATFORM_HPP__ diff --git a/Runtime/World/CScriptSpecialFunction.cpp b/Runtime/World/CScriptSpecialFunction.cpp index e6354eff0..ed7757e5c 100644 --- a/Runtime/World/CScriptSpecialFunction.cpp +++ b/Runtime/World/CScriptSpecialFunction.cpp @@ -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) { } - - } diff --git a/Runtime/World/CScriptSpecialFunction.hpp b/Runtime/World/CScriptSpecialFunction.hpp index 3409904b2..61b2731ad 100644 --- a/Runtime/World/CScriptSpecialFunction.hpp +++ b/Runtime/World/CScriptSpecialFunction.hpp @@ -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); }; } diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 765062892..abcfbc163 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -62,8 +62,8 @@ static SObjectTag MorphballDoorANCS = {}; static const SObjectTag& GetMorphballDoorACS() { if (!MorphballDoorANCS) - MorphballDoorANCS = static_cast(g_ResFactory)-> - TagFromPath(_S("MP1/Shared/ANCS_1F9DA858.blend")); + MorphballDoorANCS = + static_cast(g_ResFactory)->TagFromPath(_S("MP1/Shared/ANCS_1F9DA858.blend")); return MorphballDoorANCS; } @@ -71,8 +71,8 @@ static bool EnsurePropertyCount(int count, int expected, const char* structName) { if (count < expected) { - Log.report(logvisor::Warning, "Insufficient number of props (%d/%d) for %s entity", - count, expected, structName); + Log.report(logvisor::Warning, "Insufficient number of props (%d/%d) for %s entity", count, expected, + structName); return false; } return true; @@ -125,8 +125,8 @@ static SScaledActorHead LoadScaledActorHead(CInputStream& in, CStateManager& sta return ret; } -static zeus::CAABox GetCollisionBox(CStateManager& stateMgr, TAreaId id, - const zeus::CVector3f& extent, const zeus::CVector3f& offset) +static zeus::CAABox GetCollisionBox(CStateManager& stateMgr, TAreaId id, const zeus::CVector3f& extent, + const zeus::CVector3f& offset) { zeus::CAABox box(-extent * 0.5f + offset, extent * 0.5f + offset); const zeus::CTransform& rot = stateMgr.GetWorld()->GetGameAreas()[id]->GetTransform().getRotation(); @@ -137,7 +137,7 @@ u32 ScriptLoader::LoadParameterFlags(CInputStream& in) { u32 count = in.readUint32Big(); u32 ret = 0; - for (u32 i=0 ; i 14) return nullptr; @@ -469,7 +466,8 @@ CEntity* ScriptLoader::LoadDoor(CStateManager& mgr, CInputStream& in, if (!g_ResFactory->GetResourceTypeById(aParms.GetACSFile())) return nullptr; - CModelData mData = CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, true, aParms.GetInitialAnimation()); + CModelData mData = + CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, true, aParms.GetInitialAnimation()); if (collisionExtent.isZero()) aabb = mData.GetBounds(head.x10_transform.getRotation()); @@ -482,12 +480,11 @@ CEntity* ScriptLoader::LoadDoor(CStateManager& mgr, CInputStream& in, else if (propCount == 14) isMorphballDoor = in.readBool(); - return new CScriptDoor(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, - std::move(mData), actParms, v1, aabb, b1, b2, b3, f1, isMorphballDoor); + return new CScriptDoor(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(mData), actParms, + v1, aabb, b1, b2, b3, f1, isMorphballDoor); } -CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 9, "Trigger")) return nullptr; @@ -515,12 +512,10 @@ CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, const zeus::CTransform& areaXf = mgr.GetWorld()->GetGameAreas()[info.GetAreaId()]->GetTransform(); zeus::CVector3f orientedForce = areaXf.basis * forceVec; - return new CScriptTrigger(mgr.AllocateUniqueId(), *name, info, position, box, dInfo, - orientedForce, w1, b1, b2, b3); + return new CScriptTrigger(mgr.AllocateUniqueId(), *name, info, position, box, dInfo, orientedForce, w1, b1, b2, b3); } -CEntity* ScriptLoader::LoadTimer(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadTimer(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 6, "Timer")) return nullptr; @@ -536,8 +531,7 @@ CEntity* ScriptLoader::LoadTimer(CStateManager& mgr, CInputStream& in, return new CScriptTimer(mgr.AllocateUniqueId(), *name, info, f1, f2, b1, b2, b3); } -CEntity* ScriptLoader::LoadCounter(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadCounter(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 5, "Counter")) return nullptr; @@ -552,8 +546,7 @@ CEntity* ScriptLoader::LoadCounter(CStateManager& mgr, CInputStream& in, return new CScriptCounter(mgr.AllocateUniqueId(), *name, info, w1, w2, b1, b2); } -CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 24, "Effect")) return nullptr; @@ -570,8 +563,7 @@ CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, if (partId == 0xffffffff && elscId == 0xffffffff) return nullptr; - if (!g_ResFactory->GetResourceTypeById(partId) && - !g_ResFactory->GetResourceTypeById(elscId)) + if (!g_ResFactory->GetResourceTypeById(partId) && !g_ResFactory->GetResourceTypeById(elscId)) return nullptr; bool b5 = in.readBool(); @@ -590,13 +582,11 @@ CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, CLightParameters lParms = LoadLightParameters(in); - return new CScriptEffect(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, - head.x40_scale, partId, elscId, b1, b2, b3, b4, b5, f1, f2, f3, f4, - b6, f5, f6, f7, b7, b8, b9, lParms, b10); + return new CScriptEffect(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, head.x40_scale, partId, + elscId, b1, b2, b3, b4, b5, f1, f2, f3, f4, b6, f5, f6, f7, b7, b8, b9, lParms, b10); } -CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 19, "Platform")) return nullptr; @@ -635,11 +625,11 @@ CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), extent, centroid); FourCC dclnType = g_ResFactory->GetResourceTypeById(dclnId); - TLockedToken dclnToken; + rstl::optional_object> dclnToken; if (dclnType) { - dclnToken = g_SimplePool->GetObj({SBIG('DCLN'), dclnId}); - dclnToken.GetObj(); + dclnToken.emplace(g_SimplePool->GetObj({SBIG('DCLN'), dclnId})); + dclnToken->GetObj(); } CModelData data; @@ -651,12 +641,11 @@ CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, if (extent.isZero()) aabb = data.GetBounds(head.x10_transform.getRotation()); - return new CScriptPlatform(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, - std::move(data), actParms, aabb, f1, b2, f2, b1, hInfo, dInfo, dclnToken, b3, w2, w3); + return new CScriptPlatform(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(data), + actParms, aabb, f1, b2, f2, b1, hInfo, dInfo, dclnToken, b3, w2, w3); } -CEntity* ScriptLoader::LoadSound(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadSound(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 20, "Sound")) return nullptr; @@ -684,12 +673,11 @@ CEntity* ScriptLoader::LoadSound(CStateManager& mgr, CInputStream& in, if (soundId < 0) return nullptr; - return new CScriptSound(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, - soundId, b1, f1, f2, f3, w2, w3, w4, w5, w6, 0, b2, b3, b4, b5, b6, b7, b8, w6); + return new CScriptSound(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, soundId, b1, f1, f2, f3, w2, + w3, w4, w5, w6, 0, b2, b3, b4, b5, b6, b7, b8, w6); } -CEntity* ScriptLoader::LoadGenerator(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadGenerator(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 8, "Generator")) return nullptr; @@ -710,9 +698,8 @@ CEntity* ScriptLoader::LoadGenerator(CStateManager& mgr, CInputStream& in, return new CScriptGenerator(mgr.AllocateUniqueId(), *name, info, w1, b1, v1, b2, b3, f1, f2); } -CEntity* ScriptLoader::LoadDock(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) -{ +CEntity* ScriptLoader::LoadDock(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) +{ if (!EnsurePropertyCount(propCount, 7, "Dock")) return nullptr; @@ -728,8 +715,7 @@ CEntity* ScriptLoader::LoadDock(CStateManager& mgr, CInputStream& in, return new CScriptDock(mgr.AllocateUniqueId(), *name, info, position, scale, dock, area, active, 0, b1); } -CEntity* ScriptLoader::LoadCamera(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 14, "Camera")) return nullptr; @@ -754,14 +740,12 @@ CEntity* ScriptLoader::LoadCamera(CStateManager& mgr, CInputStream& in, u32 flags = b2 | b3 << 1 | b4 << 2 | b5 << 3 | b6 << 4 | b7 << 5 | b8 << 6 | b9 << 8; - return new CCinematicCamera(mgr.AllocateUniqueId(), head.x0_name, info, - head.x10_transform, b1, f1, f2 / CCameraManager::DefaultAspect(), - CCameraManager::DefaultNearPlane(), CCameraManager::DefaultFarPlane(), - CCameraManager::DefaultAspect(), flags); + return new CCinematicCamera(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, b1, f1, + f2 / CCameraManager::DefaultAspect(), CCameraManager::DefaultNearPlane(), + CCameraManager::DefaultFarPlane(), CCameraManager::DefaultAspect(), flags); } -CEntity* ScriptLoader::LoadCameraWaypoint(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadCameraWaypoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 6, "CameraWaypoint")) return nullptr; @@ -772,12 +756,10 @@ CEntity* ScriptLoader::LoadCameraWaypoint(CStateManager& mgr, CInputStream& in, float f1 = in.readFloatBig(); u32 w1 = in.readUint32Big(); - return new CScriptCameraWaypoint(mgr.AllocateUniqueId(), head.x0_name, info, - head.x10_transform, b1, f1, w1); + return new CScriptCameraWaypoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, b1, f1, w1); } -CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 13, "NewIntroBoss")) return nullptr; @@ -809,14 +791,11 @@ CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in, CAnimRes res(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, true, aParms.GetInitialAnimation()); - - return new MP1::CNewIntroBoss(mgr.AllocateUniqueId(), head.x0_name, info, - head.x10_transform, res, pInfo, actParms, f1, w1, - dInfo, w2, w3, w4, w5); + return new MP1::CNewIntroBoss(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, res, pInfo, actParms, + f1, w1, dInfo, w2, w3, w4, w5); } -CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 35, "SpawnPoint")) return nullptr; @@ -830,8 +809,8 @@ CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, rotation.readBig(in); std::vector itemCounts; - itemCounts.reserve(propCount-6); - for (int i=0 ; i 4) return nullptr; @@ -950,8 +924,7 @@ CEntity* ScriptLoader::LoadMemoryRelay(CStateManager& mgr, CInputStream& in, return new CScriptMemoryRelay(mgr.AllocateUniqueId(), *name, info, b1, b2, b3); } -CEntity* ScriptLoader::LoadRandomRelay(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadRandomRelay(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 5, "RandomRelay")) return nullptr; @@ -964,8 +937,7 @@ CEntity* ScriptLoader::LoadRandomRelay(CStateManager& mgr, CInputStream& in, return new CScriptRandomRelay(mgr.AllocateUniqueId(), *name, info, w1, w2, b1, b2); } -CEntity* ScriptLoader::LoadRelay(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadRelay(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 2, "Relay") || propCount > 3) return nullptr; @@ -978,8 +950,7 @@ CEntity* ScriptLoader::LoadRelay(CStateManager& mgr, CInputStream& in, return new CScriptRelay(mgr.AllocateUniqueId(), *name, info, b1); } -CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 16, "Beetle")) return nullptr; @@ -1014,12 +985,11 @@ CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, const CAnimationParameters& animParams = pInfo.GetAnimationParameters(); CAnimRes animRes(animParams.GetACSFile(), animParams.GetCharacter(), scale, animParams.GetInitialAnimation(), true); - return new MP1::CBeetle(mgr.AllocateUniqueId(), *name, info, xfrm, animRes, pInfo, flavor, entrance, dInfo, dVuln2, v1, f2, - f3, f1, dVuln1, aParams, abdomenRes); + return new MP1::CBeetle(mgr.AllocateUniqueId(), *name, info, xfrm, animRes, pInfo, flavor, entrance, dInfo, dVuln2, + v1, f2, f3, f1, dVuln1, aParams, abdomenRes); } -CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (propCount != 5 && !EnsurePropertyCount(propCount, 6, "HUDMemo")) return 0; @@ -1034,8 +1004,8 @@ CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, return new CScriptHUDMemo(mgr.AllocateUniqueId(), *name, info, hParms, displayType, message, active); } -CEntity* ScriptLoader::LoadCameraFilterKeyframe(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadCameraFilterKeyframe(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 10, "CameraFilterKeyframe")) return nullptr; @@ -1051,11 +1021,12 @@ CEntity* ScriptLoader::LoadCameraFilterKeyframe(CStateManager& mgr, CInputStream float f2 = in.readFloatBig(); u32 w5 = in.readUint32Big(); - return new CScriptCameraFilterKeyframe(mgr.AllocateUniqueId(), *name, info, w1, w2, w3, w4, color, f1, f2, w5, active); + return new CScriptCameraFilterKeyframe(mgr.AllocateUniqueId(), *name, info, w1, w2, w3, w4, color, f1, f2, w5, + active); } -CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 7, "CameraBlurKeyframe")) return nullptr; @@ -1077,7 +1048,6 @@ u32 ClassifyVector(const zeus::CVector3f& dir) u32 max = (absDir.x > absDir.y ? 0 : 1); max = (absDir[max] > absDir.z ? max : 2); - bool positive = (absDir[max] == dir[max]); if (max == 0) return (positive ? 0x08 : 0x04); @@ -1110,8 +1080,8 @@ u32 TransformDamagableTriggerFlags(CStateManager& mgr, TAreaId aId, u32 flags) return ret; } -CEntity* ScriptLoader::LoadDamageableTrigger(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadDamageableTrigger(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 12, "DamageableTrigger")) return nullptr; @@ -1130,12 +1100,11 @@ CEntity* ScriptLoader::LoadDamageableTrigger(CStateManager& mgr, CInputStream& i CScriptDamageableTrigger::ECanOrbit canOrbit = CScriptDamageableTrigger::ECanOrbit(in.readBool()); bool active = in.readBool(); CVisorParameters vParms = LoadVisorParameters(in); - return new CScriptDamageableTrigger(mgr.AllocateUniqueId(), *name, info, position, volume, hInfo, dVuln, triggerFlags, w1, - w2, w3, canOrbit, active, vParms); + return new CScriptDamageableTrigger(mgr.AllocateUniqueId(), *name, info, position, volume, hInfo, dVuln, + triggerFlags, w1, w2, w3, canOrbit, active, vParms); } -CEntity* ScriptLoader::LoadDebris(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadDebris(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 18, "Debris")) return nullptr; @@ -1159,24 +1128,22 @@ CEntity* ScriptLoader::LoadDebris(CStateManager& mgr, CInputStream& in, if (!g_ResFactory->GetResourceTypeById(model)) return nullptr; - return new CScriptDebris(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, CStaticRes(model, head.x40_scale), - aParams, w3, v2, f1, v1, color, f2, f3, f4, scaleType, b2, b1, b3); + return new CScriptDebris(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, + CStaticRes(model, head.x40_scale), aParams, w3, v2, f1, v1, color, f2, f3, f4, scaleType, + b2, b1, b3); } -CEntity* ScriptLoader::LoadCameraShaker(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadCameraShaker(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadActorKeyframe(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadActorKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 63, "Water")) return nullptr; @@ -1257,8 +1224,8 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, bool b5 = in.readBool(); u32* bitset = nullptr; - u32 bitVal0 = 0; - u32 bitVal1 = 0; + u32 bitVal0 = 0; + u32 bitVal1 = 0; if (b5) { @@ -1279,16 +1246,15 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, if (textureId4 == -1) realTextureId5 = textureId5; - return new CScriptWater(mgr, mgr.AllocateUniqueId(), *name, info, position, box, dInfo, orientedForce, triggerFlags, b1, displaySurface, - textureId1, textureId2, textureId3, textureId4, realTextureId5, realTextureId6, -1, otherV2, f1, f2, - f3, active, fluidType, b4, f4, fluidMotion, f5, f6, f7, f8, f9, f10, f11, f12, c1, c2, enterParticle, - partId2, partId3, partId4, partId5, soundId1, soundId2, soundId3, soundId4, soundId5, - f13, w19, f14, f15, f16, f17, f18, f19, heatWaveHeight, heatWaveSpeed, heatWaveColor, lightmap, f22, f23, f24, - w21, w22, b5, bitVal0, bitVal1, bitset); + return new CScriptWater( + mgr, mgr.AllocateUniqueId(), *name, info, position, box, dInfo, orientedForce, triggerFlags, b1, displaySurface, + textureId1, textureId2, textureId3, textureId4, realTextureId5, realTextureId6, -1, otherV2, f1, f2, f3, active, + fluidType, b4, f4, fluidMotion, f5, f6, f7, f8, f9, f10, f11, f12, c1, c2, enterParticle, partId2, partId3, + partId4, partId5, soundId1, soundId2, soundId3, soundId4, soundId5, f13, w19, f14, f15, f16, f17, f18, f19, + heatWaveHeight, heatWaveSpeed, heatWaveColor, lightmap, f22, f23, f24, w21, w22, b5, bitVal0, bitVal1, bitset); } -CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 13, "WarWasp")) return nullptr; @@ -1323,8 +1289,7 @@ CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, damageInfo1, actorParms, weaponDesc, damageInfo2, particle, w1); } -CEntity* ScriptLoader::LoadSpacePirate(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadSpacePirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 34, "SpacePirate")) return nullptr; @@ -1355,32 +1320,27 @@ CEntity* ScriptLoader::LoadSpacePirate(CStateManager& mgr, CInputStream& in, aParams, pInfo, in, propCount); } -CEntity* ScriptLoader::LoadFlyingPirate(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadFlyingPirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadElitePirate(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadElitePirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadMetroidBeta(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadMetroidBeta(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadChozoGhost(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadChozoGhost(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadCoverPoint(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadCoverPoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 9, "CoverPoint")) return nullptr; @@ -1393,35 +1353,32 @@ CEntity* ScriptLoader::LoadCoverPoint(CStateManager& mgr, CInputStream& in, float f2 = in.readFloatBig(); float f3 = in.readFloatBig(); - return new CScriptCoverPoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, b1, w1, b2, f1, f2, f3); + return new CScriptCoverPoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, b1, w1, b2, f1, f2, + f3); } -CEntity* ScriptLoader::LoadSpiderBallWaypoint(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadSpiderBallWaypoint(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadBloodFlower(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadBloodFlower(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadFlickerBat(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadFlickerBat(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadPathCamera(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadPathCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadGrapplePoint(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadGrapplePoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 5, "GrapplePoint")) return nullptr; @@ -1433,32 +1390,29 @@ CEntity* ScriptLoader::LoadGrapplePoint(CStateManager& mgr, CInputStream& in, return new CScriptGrapplePoint(mgr.AllocateUniqueId(), *name, info, grappleXf, active, parameters); } -CEntity* ScriptLoader::LoadPuddleSpore(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadPuddleSpore(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadDebugCameraWaypoint(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadDebugCameraWaypoint(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadSpiderBallAttractionSurface(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadSpiderBallAttractionSurface(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadPuddleToadGamma(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadPuddleToadGamma(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadDistanceFog(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadDistanceFog(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 8, "DistanceFog")) return nullptr; @@ -1493,26 +1447,22 @@ CEntity* ScriptLoader::LoadDistanceFog(CStateManager& mgr, CInputStream& in, expl, active, 0.f, 0.f, 0.f, 0.f); } -CEntity* ScriptLoader::LoadFireFlea(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadFireFlea(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadMetareeAlpha(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadMetareeAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadDockAreaChange(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadDockAreaChange(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadActorRotate(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadActorRotate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 6, "ActorRotate")) return nullptr; @@ -1527,15 +1477,15 @@ CEntity* ScriptLoader::LoadActorRotate(CStateManager& mgr, CInputStream& in, return new CScriptActorRotate(mgr.AllocateUniqueId(), *name, info, rotation, scale, b1, b2, active); } -CEntity* ScriptLoader::LoadSpecialFunction(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadSpecialFunction(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 15, "SpecialFunction")) return nullptr; SActorHead head = LoadActorHead(in, mgr); - CScriptSpecialFunction::ESpecialFunction specialFunction = CScriptSpecialFunction::ESpecialFunction(in.readUint32Big()); - std::string str = in.readString(); + CScriptSpecialFunction::ESpecialFunction specialFunction = + CScriptSpecialFunction::ESpecialFunction(in.readUint32Big()); + std::string str = in.readString(); float f1 = in.readFloatBig(); float f2 = in.readFloatBig(); float f3 = in.readFloatBig(); @@ -1547,125 +1497,106 @@ CEntity* ScriptLoader::LoadSpecialFunction(CStateManager& mgr, CInputStream& in, s16 w5 = in.readUint32Big() & 0xFFFF; s16 w6 = in.readUint32Big() & 0xFFFF; s16 w7 = in.readUint32Big() & 0xFFFF; - if (specialFunction == CScriptSpecialFunction::ESpecialFunction::FourtySeven || - specialFunction == CScriptSpecialFunction::ESpecialFunction::FourtySeven) + if (specialFunction == CScriptSpecialFunction::ESpecialFunction::FogVolume || + specialFunction == CScriptSpecialFunction::ESpecialFunction::RadialDamage) return nullptr; - return new CScriptSpecialFunction(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, specialFunction, str, f1, f2, - f3, f4, zeus::CVector3f::skZero, zeus::CColor::skBlack, active1, CDamageInfo(), w2, w3, w4, - w5, w6, w7); + return new CScriptSpecialFunction(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, specialFunction, + str, f1, f2, f3, f4, zeus::CVector3f::skZero, zeus::CColor::skBlack, active1, + CDamageInfo(), w2, w3, w4, w5, w6, w7); } -CEntity* ScriptLoader::LoadSpankWeed(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadSpankWeed(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadPlayerHint(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadPlayerHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadRipper(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadRipper(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadPickupGenerator(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadPickupGenerator(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadAIKeyframe(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadAIKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadPointOfInterest(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadPointOfInterest(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadDrone(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadDrone(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadMetroidAlpha(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadMetroidAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadDebrisExtended(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadDebrisExtended(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadSteam(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadSteam(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadRipple(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadRipple(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadBallTrigger(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadBallTrigger(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadTargetingPoint(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadTargetingPoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadEMPulse(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadEMPulse(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadIceSheegoth(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadIceSheegoth(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadPlayerActor(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadPlayerActor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadFlaahgra(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadFlaahgra(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadAreaAttributes(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadAreaAttributes(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 9, "AreaAttributes")) return nullptr; @@ -1687,92 +1618,82 @@ CEntity* ScriptLoader::LoadAreaAttributes(CStateManager& mgr, CInputStream& in, xrayFogDistance, worldLightingLevel, skybox, phazonType); } -CEntity* ScriptLoader::LoadFishCloud(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadFishCloud(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadFishCloudModifier(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadFishCloudModifier(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadVisorFlare(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadVisorFlare(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadWorldTeleporter(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadWorldTeleporter(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadVisorGoo(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadVisorGoo(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadJellyZap(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadJellyZap(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadControllerAction(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadControllerAction(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadSwitch(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadSwitch(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadPlayerStateChange(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadPlayerStateChange(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadThardus(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadThardus(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadWallCrawlerSwarm(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadWallCrawlerSwarm(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadAIJumpPoint(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadAIJumpPoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadFlaahgraTentacle(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadFlaahgraTentacle(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadRoomAcoustics(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadRoomAcoustics(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadColorModulate(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadColorModulate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 12, "ColorModulate")) return nullptr; @@ -1791,185 +1712,162 @@ CEntity* ScriptLoader::LoadColorModulate(CStateManager& mgr, CInputStream& in, bool b4 = in.readBool(); bool b5 = in.readBool(); bool active = in.readBool(); - return new CScriptColorModulate(mgr.AllocateUniqueId(), *name, info, c1, c2, bm, f1, f2, b1, b2, b3, b4, b5, active); + return new CScriptColorModulate(mgr.AllocateUniqueId(), *name, info, c1, c2, bm, f1, f2, b1, b2, b3, b4, b5, + active); } -CEntity* ScriptLoader::LoadThardusRockProjectile(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadThardusRockProjectile(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadMidi(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadMidi(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadStreamedAudio(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadStreamedAudio(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadRepulsor(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadRepulsor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadGunTurret(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadGunTurret(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadFogVolume(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadFogVolume(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadBabygoth(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadBabygoth(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadEyeball(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadEyeball(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadRadialDamage(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadRadialDamage(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadCameraPitchVolume(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadCameraPitchVolume(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadEnvFxDensityController(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadEnvFxDensityController(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadMagdolite(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadMagdolite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadTeamAIMgr(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadTeamAIMgr(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadSnakeWeedSwarm(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadSnakeWeedSwarm(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::Load(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::Load(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadOculus(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadOculus(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadGeemer(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadGeemer(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadSpindleCamera(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadSpindleCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadAtomicAlpha(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadAtomicAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadCameraHintTrigger(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadCameraHintTrigger(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadRumbleEffect(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadRumbleEffect(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadAmbientAI(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadAmbientAI(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadAtomicBeta(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadAtomicBeta(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadIceZoomer(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadIceZoomer(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadPuffer(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadPuffer(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadTryclops(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadTryclops(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadRidley(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadRidley(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadSeedling(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadSeedling(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadThermalHeatFader(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadThermalHeatFader(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 4, "ThermalHeatFader")) return nullptr; @@ -1977,20 +1875,17 @@ CEntity* ScriptLoader::LoadThermalHeatFader(CStateManager& mgr, CInputStream& in return LoadWorldLightFader(mgr, in, propCount, info); } -CEntity* ScriptLoader::LoadBurrower(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadBurrower(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadScriptBeam(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadScriptBeam(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadWorldLightFader(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadWorldLightFader(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 4, "WorldLightFader")) return nullptr; @@ -1998,58 +1893,51 @@ CEntity* ScriptLoader::LoadWorldLightFader(CStateManager& mgr, CInputStream& in, return nullptr; } -CEntity* ScriptLoader::LoadMetroidPrimeStage2(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadMetroidPrimeStage2(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadMetroidPrimeStage1(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadMetroidPrimeStage1(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadMazeNode(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadMazeNode(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadOmegaPirate(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadOmegaPirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadPhazonPool(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadPhazonPool(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadPhazonHealingNodule(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadPhazonHealingNodule(CStateManager& mgr, CInputStream& in, int propCount, + const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadNewCameraShaker(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadNewCameraShaker(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadShadowProjector(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadShadowProjector(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } -CEntity* ScriptLoader::LoadEnergyBall(CStateManager& mgr, CInputStream& in, - int propCount, const CEntityInfo& info) +CEntity* ScriptLoader::LoadEnergyBall(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { return nullptr; } - }