From 9255f0eeb06d14688cbc42469ff9a86f4d305f7f Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Mon, 15 Jan 2018 04:36:04 -0800 Subject: [PATCH] Update hecl, various fixes --- Runtime/World/CActor.cpp | 12 +++++- Runtime/World/CScriptCameraHint.cpp | 45 +++++++++++------------ Runtime/World/CScriptControllerAction.cpp | 2 +- Runtime/World/CScriptDebris.cpp | 27 +++++++++++++- Runtime/World/CScriptDebris.hpp | 12 ++++++ hecl | 2 +- 6 files changed, 70 insertions(+), 30 deletions(-) diff --git a/Runtime/World/CActor.cpp b/Runtime/World/CActor.cpp index f692daaff..3c6aa2207 100644 --- a/Runtime/World/CActor.cpp +++ b/Runtime/World/CActor.cpp @@ -219,7 +219,11 @@ void CActor::OnScanStateChanged(EScanState state, CStateManager& mgr) zeus::CAABox CActor::GetSortingBounds(const CStateManager&) const { return x9c_renderBounds; } -void CActor::DoUserAnimEvent(CStateManager&, CInt32POINode&, EUserEventType, float dt) {} +void CActor::DoUserAnimEvent(CStateManager&, CInt32POINode&, EUserEventType event, float) +{ + if (event == EUserEventType::LoopedSoundStop) + RemoveEmitter(); +} void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, CStateManager& mgr) @@ -234,7 +238,11 @@ void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes RemoveMaterial(t2, t3, mgr); } -void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, CStateManager& mgr) { x68_material.Remove(t1); } +void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, CStateManager& mgr) +{ + x68_material.Remove(t1); + RemoveMaterial(t2, mgr); +} void CActor::RemoveMaterial(EMaterialTypes t, CStateManager& mgr) { diff --git a/Runtime/World/CScriptCameraHint.cpp b/Runtime/World/CScriptCameraHint.cpp index 491af57e4..a529241ee 100644 --- a/Runtime/World/CScriptCameraHint.cpp +++ b/Runtime/World/CScriptCameraHint.cpp @@ -31,36 +31,33 @@ void CScriptCameraHint::Accept(IVisitor& visitor) void CScriptCameraHint::InitializeInArea(CStateManager& mgr) { x164_delegatedCamera = kInvalidUniqueId; - for (CEntity* e : mgr.GetAllObjectList()) + for (CEntity* ent : mgr.GetAllObjectList()) { - if (TCastToPtr ent = e) + for (const SConnection& conn : ent->GetConnectionList()) { - for (const SConnection& conn : ent->GetConnectionList()) - { - if (mgr.GetIdForScript(conn.x8_objId) != GetUniqueId()) - continue; - if (conn.x4_msg != EScriptObjectMessage::Increment && - conn.x4_msg != EScriptObjectMessage::Decrement) - continue; + if (mgr.GetIdForScript(conn.x8_objId) != GetUniqueId()) + continue; + if (conn.x4_msg != EScriptObjectMessage::Increment && + conn.x4_msg != EScriptObjectMessage::Decrement) + continue; - for (auto it = ent->GetConnectionList().begin() ; it != ent->GetConnectionList().cend() ; ++it) + for (auto it = ent->GetConnectionList().begin() ; it != ent->GetConnectionList().cend() ; ++it) + { + const SConnection& conn2 = *it; + if (conn2.x4_msg != EScriptObjectMessage::Increment && + conn2.x4_msg != EScriptObjectMessage::Decrement) + continue; + TUniqueId id = mgr.GetIdForScript(conn2.x8_objId); + if (TCastToPtr(mgr.ObjectById(id)) || + TCastToPtr(mgr.ObjectById((id)))) { - const SConnection& conn2 = *it; - if (conn2.x4_msg != EScriptObjectMessage::Increment && - conn2.x4_msg != EScriptObjectMessage::Decrement) - continue; - TUniqueId id = mgr.GetIdForScript(conn2.x8_objId); - if (TCastToPtr(mgr.ObjectById(id)) || - TCastToPtr(mgr.ObjectById((id)))) - { - ent->ConnectionList().erase(it); - if (x164_delegatedCamera != id) - x164_delegatedCamera = id; - break; - } + ent->ConnectionList().erase(it); + if (x164_delegatedCamera != id) + x164_delegatedCamera = id; + break; } - break; } + break; } } } diff --git a/Runtime/World/CScriptControllerAction.cpp b/Runtime/World/CScriptControllerAction.cpp index acf2e38b6..a69b8b84a 100644 --- a/Runtime/World/CScriptControllerAction.cpp +++ b/Runtime/World/CScriptControllerAction.cpp @@ -20,7 +20,7 @@ void CScriptControllerAction::Accept(IVisitor& visitor) visitor.Visit(this); } -void CScriptControllerAction::Think(float dt, CStateManager& stateMgr) +void CScriptControllerAction::Think(float, CStateManager& stateMgr) { bool oldPressed = x3c_26_pressed; if (x3c_24_mapScreenResponse) diff --git a/Runtime/World/CScriptDebris.cpp b/Runtime/World/CScriptDebris.cpp index 46dc097e4..4a613df4b 100644 --- a/Runtime/World/CScriptDebris.cpp +++ b/Runtime/World/CScriptDebris.cpp @@ -1,4 +1,6 @@ #include "CScriptDebris.hpp" +#include "Collision/CCollisionInfoList.hpp" +#include "Particle/CElementGen.hpp" #include "TCastTo.hpp" namespace urde @@ -11,8 +13,8 @@ CScriptDebris::CScriptDebris(TUniqueId uid, std::string_view name, const CEntity : CPhysicsActor(uid, active, name, info, xf, std::move(mData), CMaterialList(EMaterialTypes::Solid, EMaterialTypes::Debris), mData.GetBounds(xf.getRotation()), SMoverData(f2), aParams, 0.3f, 0.1f) -{ +{ } CScriptDebris::CScriptDebris(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, @@ -26,7 +28,7 @@ CScriptDebris::CScriptDebris(TUniqueId uid, std::string_view name, const CEntity : CPhysicsActor(uid, active, name, info, xf, std::move(mData), CMaterialList(EMaterialTypes::Solid, EMaterialTypes::Debris), mData.GetBounds(xf.getRotation()), SMoverData(1.f), aParams, 0.3f, 0.1f) -{ +{ } void CScriptDebris::Accept(IVisitor& visitor) @@ -34,4 +36,25 @@ void CScriptDebris::Accept(IVisitor& visitor) visitor.Visit(this); } +rstl::optional_object CScriptDebris::GetTouchBounds() const +{ + return {}; +} + +void CScriptDebris::CollidedWith(TUniqueId, const CCollisionInfoList& colList, CStateManager&) +{ + if (colList.GetCount() == 0) + return; + + if (x282_24_) + { + x274_ = x270_; + SetVelocityWR(zeus::CVector3f::skZero); + } + else + { + x2c8_collisionNormal = colList.GetItem(0).GetNormalLeft(); + } +} + } diff --git a/Runtime/World/CScriptDebris.hpp b/Runtime/World/CScriptDebris.hpp index b91abab45..a3eb30a17 100644 --- a/Runtime/World/CScriptDebris.hpp +++ b/Runtime/World/CScriptDebris.hpp @@ -5,6 +5,7 @@ namespace urde { +class CElementGen; class CScriptDebris : public CPhysicsActor { public: @@ -17,6 +18,14 @@ public: }; private: + + float x270_; + float x274_; + bool x282_24_ : 1; + zeus::CVector3f x2c8_collisionNormal; + std::unique_ptr x2d4_; + std::unique_ptr x2d8_; + std::unique_ptr x2dc_; TReservedAverage x2e0_; public: CScriptDebris(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&, @@ -31,6 +40,9 @@ public: bool, bool, bool, bool); void Accept(IVisitor& visitor); + rstl::optional_object GetTouchBounds() const; + + void CollidedWith(TUniqueId uid, const CCollisionInfoList&, CStateManager&); }; } diff --git a/hecl b/hecl index 6b3abdd21..3a8dc560c 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 6b3abdd21acc0274c0bedff5d6cbd3bea3f21730 +Subproject commit 3a8dc560c3c8d92826f0c5d214f5027884ddab9f