diff --git a/Runtime/Character/CModelData.hpp b/Runtime/Character/CModelData.hpp index bc3756234..49404fe27 100644 --- a/Runtime/Character/CModelData.hpp +++ b/Runtime/Character/CModelData.hpp @@ -103,7 +103,7 @@ public: void Render(EWhichModel, const zeus::CTransform& xf, const CActorLights* lights, const CModelFlags& drawFlags) const; - std::unique_ptr& AnimationData() { return xc_animData; } + CAnimData* AnimationData() { return xc_animData.get(); } }; } diff --git a/Runtime/World/CActor.hpp b/Runtime/World/CActor.hpp index 295bbe44e..ea59366dd 100644 --- a/Runtime/World/CActor.hpp +++ b/Runtime/World/CActor.hpp @@ -79,7 +79,7 @@ public: virtual bool ValidAimTarget() { return true; } virtual bool ValidOrbitTarget() { return true; } virtual bool GetOrbitDistanceCheck() { return true; } - virtual zeus::CVector3f GetOrbitPosition() + virtual zeus::CVector3f GetOrbitPosition(const CStateManager&) { return x34_transform.m_origin; } virtual ECollisionResponseType GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, CWeaponMode&, int) { return ECollisionResponseType::Unknown12; } diff --git a/Runtime/World/CScriptDock.hpp b/Runtime/World/CScriptDock.hpp index 621d7c268..7df04a0ab 100644 --- a/Runtime/World/CScriptDock.hpp +++ b/Runtime/World/CScriptDock.hpp @@ -8,6 +8,7 @@ namespace urde class CScriptDock : public CPhysicsActor { + friend class CScriptDoor; s32 x258_; s32 x25c_dock; TAreaId x260_area; diff --git a/Runtime/World/CScriptDoor.cpp b/Runtime/World/CScriptDoor.cpp index 2ae408a91..e0e763667 100644 --- a/Runtime/World/CScriptDoor.cpp +++ b/Runtime/World/CScriptDoor.cpp @@ -1,9 +1,11 @@ #include "CScriptDoor.hpp" +#include "CScriptDock.hpp" #include "Collision/CMaterialList.hpp" #include "Character/CAnimData.hpp" #include "Character/CAnimPlaybackParms.hpp" #include "AutoMapper/CMapWorldInfo.hpp" #include "CStateManager.hpp" +#include "CWorld.hpp" namespace urde { @@ -30,6 +32,18 @@ CScriptDoor::CScriptDoor(TUniqueId uid, const std::string& name, const CEntityIn x264_ = GetBoundingBox(); } +/* ORIGINAL 0-00 OFFSET: 8007F054 */ +zeus::CVector3f CScriptDoor::GetOrbitPosition(const CStateManager &mgr) const +{ + return x34_transform.m_origin + x29c_; +} + +/* ORIGINAL 0-00 OFFSET: 8007E550 */ +void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager &mgr) +{ +} + +/* ORIGINAL 0-00 OFFSET: 8007E0BC */ void CScriptDoor::ForceClosed(CStateManager & mgr) { if (x2a8_26_) @@ -58,6 +72,23 @@ void CScriptDoor::ForceClosed(CStateManager & mgr) } } +/* ORIGINAL 0-00 OFFSET: 8007E1C4 */ +bool CScriptDoor::IsConnectedToArea(const CStateManager& mgr, TAreaId area) +{ + const CScriptDock* dock = dynamic_cast(mgr.GetObjectById(x282_dockId)); + if (dock) + { + if (dock->x260_area == area) + return true; + /* + * TODO: Determine what's going on here + * CWorld* world = mgr.GetWorld(); + */ + } + return false; +} + +/* ORIGINAL 0-00 OFFSET: 8007EA64 */ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr) { TEditorId eid = mgr.GetEditorIdForUniqueId(uid); @@ -79,6 +110,22 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr) } } +/* ORIGINAL 0-00 OFFSET: 8007ED4C */ +u32 CScriptDoor::GetDoorOpenCondition(CStateManager& mgr) +{ + const CScriptDock* dock = dynamic_cast(mgr.GetObjectById(x282_dockId)); + + if (!dock) + return 2; + + if (x25c_ < 0.05f) + return 1; + + /* TODO: Finish this */ + return 0; +} + +/* ORIGINAL 0-00 OFFSET: 8007E9D0 */ void CScriptDoor::SetDoorAnimation(CScriptDoor::EDoorAnimType type) { CModelData* modelData = x64_modelData.get(); diff --git a/Runtime/World/CScriptDoor.hpp b/Runtime/World/CScriptDoor.hpp index 4001393a5..58ee01cf7 100644 --- a/Runtime/World/CScriptDoor.hpp +++ b/Runtime/World/CScriptDoor.hpp @@ -21,7 +21,9 @@ public: EDoorAnimType x260_doorState = EDoorAnimType::Zero; zeus::CAABox x264_; TUniqueId x27c_otherId = kInvalidUniqueId; + TUniqueId x282_dockId = kInvalidUniqueId; + zeus::CVector3f x29c_; union { struct @@ -50,8 +52,12 @@ public: const zeus::CVector3f&, const zeus::CAABox&, bool active, bool material, bool, float, bool ballDoor); + zeus::CVector3f GetOrbitPosition(const CStateManager& mgr) const; + void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr); void ForceClosed(CStateManager&); + bool IsConnectedToArea(const CStateManager& mgr, TAreaId area); void OpenDoor(TUniqueId, CStateManager&); + u32 GetDoorOpenCondition(CStateManager& mgr); void SetDoorAnimation(EDoorAnimType); };