From 566c3566124d3de3203f89b33dd20161419ad173 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Wed, 11 Mar 2020 05:25:45 -0700 Subject: [PATCH] Initial ElitePirate imps --- Runtime/MP1/World/CElitePirate.cpp | 40 ++++++++++++++++++++++++++---- Runtime/MP1/World/CElitePirate.hpp | 5 ++-- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/Runtime/MP1/World/CElitePirate.cpp b/Runtime/MP1/World/CElitePirate.cpp index 3775fec07..bb7334b49 100644 --- a/Runtime/MP1/World/CElitePirate.cpp +++ b/Runtime/MP1/World/CElitePirate.cpp @@ -2,6 +2,7 @@ #include "Runtime/Collision/CCollisionActorManager.hpp" #include "Runtime/CSimplePool.hpp" +#include "Runtime/CStateManager.hpp" #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/World/CPatternedInfo.hpp" #include "Runtime/World/ScriptLoader.hpp" @@ -39,6 +40,7 @@ CElitePirateData::CElitePirateData(CInputStream& in, u32 propCount) , xec_(zeus::degToRad(in.readFloatBig())) , xf0_(in.readUint32Big()) , xf4_(CSfxManager::TranslateSFXID(in.readUint32Big())) +, xf6_(CSfxManager::TranslateSFXID(in.readUint32Big())) , xf8_(in) , xfc_(in) , x118_(in) @@ -71,6 +73,36 @@ CElitePirate::CElitePirate(TUniqueId uid, std::string_view name, const CEntityIn void CElitePirate::Accept(IVisitor& visitor) { visitor.Visit(this); } void CElitePirate::Think(float dt, CStateManager& mgr) { CPatterned::Think(dt, mgr); } void CElitePirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) { + + switch (msg) { + case EScriptObjectMessage::Activate: { + if (V179()) + x730_->SetActive(mgr, true); + if (CEntity* ent = mgr.ObjectById(x772_)) + ent->SetActive(true); + break; + } + case EScriptObjectMessage::Deactivate: { + if (V179()) + x730_->SetActive(mgr, false); + x5d4_->SetActive(mgr, false); + + if (CEntity* ent = mgr.ObjectById(x772_)) + ent->SetActive(false); + break; + } + case EScriptObjectMessage::Alert: + x988_28_ = true; + break; + case EScriptObjectMessage::Touched: + break; + case EScriptObjectMessage::Registered: + x450_bodyController->Activate(mgr); + SetupCollisionManager(mgr); + default: + break; + } + CPatterned::AcceptScriptMsg(msg, uid, mgr); } void CElitePirate::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) { CPatterned::PreRender(mgr, frustum); } @@ -91,16 +123,14 @@ void CElitePirate::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node const CCollisionPrimitive* CElitePirate::GetCollisionPrimitive() const { return CPhysicsActor::GetCollisionPrimitive(); } -void CElitePirate::KnockBack(const zeus::CVector3f& pos, CStateManager& mgr, const CDamageInfo& info, EKnockBackType type, - bool inDeferred, float magnitude) { +void CElitePirate::KnockBack(const zeus::CVector3f& pos, CStateManager& mgr, const CDamageInfo& info, + EKnockBackType type, bool inDeferred, float magnitude) { CPatterned::KnockBack(pos, mgr, info, type, inDeferred, magnitude); } void CElitePirate::TakeDamage(const zeus::CVector3f& pos, float arg) { CPatterned::TakeDamage(pos, arg); } void CElitePirate::Patrol(CStateManager& mgr, EStateMsg msg, float dt) { CPatterned::Patrol(mgr, msg, dt); } void CElitePirate::PathFind(CStateManager& mgr, EStateMsg msg, float dt) { CPatterned::PathFind(mgr, msg, dt); } -void CElitePirate::TargetPatrol(CStateManager& mgr, EStateMsg msg, float dt) { - CPatterned::TargetPatrol(mgr, msg, dt); -} +void CElitePirate::TargetPatrol(CStateManager& mgr, EStateMsg msg, float dt) { CPatterned::TargetPatrol(mgr, msg, dt); } void CElitePirate::Halt(CStateManager& mgr, EStateMsg msg, float dt) { CAi::Halt(mgr, msg, dt); } void CElitePirate::Run(CStateManager& mgr, EStateMsg msg, float dt) { CAi::Run(mgr, msg, dt); } void CElitePirate::Generate(CStateManager& mgr, EStateMsg msg, float dt) { CAi::Generate(mgr, msg, dt); } diff --git a/Runtime/MP1/World/CElitePirate.hpp b/Runtime/MP1/World/CElitePirate.hpp index 6ff8e3ead..4f4c2a733 100644 --- a/Runtime/MP1/World/CElitePirate.hpp +++ b/Runtime/MP1/World/CElitePirate.hpp @@ -40,7 +40,8 @@ class CElitePirateData { float xe8_; float xec_; u32 xf0_; - u32 xf4_; + u16 xf4_; + u16 xf6_; CAssetId xf8_; CDamageInfo xfc_; CAssetId x118_; @@ -170,7 +171,7 @@ public: virtual bool V180() { return true; } virtual void V181(CStateManager& mgr); virtual void v182(CStateManager& mgr, bool b); - virtual SUnknownStruct2 V182() const {return {x5d8_.GetXF8(), x5d8_.GetXFC(), x5d8_.GetX118(), x5d8_.GetX11C()}; } + virtual SUnknownStruct2 V183() const {return {x5d8_.GetXF8(), x5d8_.GetXFC(), x5d8_.GetX118(), x5d8_.GetX11C()}; } }; } // namespace MP1 } // namespace urde \ No newline at end of file