More door imps

This commit is contained in:
Phillip Stephens 2016-04-22 17:29:55 -07:00
parent 884900b892
commit 43685b9119
5 changed files with 56 additions and 2 deletions

View File

@ -103,7 +103,7 @@ public:
void Render(EWhichModel, const zeus::CTransform& xf,
const CActorLights* lights, const CModelFlags& drawFlags) const;
std::unique_ptr<CAnimData>& AnimationData() { return xc_animData; }
CAnimData* AnimationData() { return xc_animData.get(); }
};
}

View File

@ -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; }

View File

@ -8,6 +8,7 @@ namespace urde
class CScriptDock : public CPhysicsActor
{
friend class CScriptDoor;
s32 x258_;
s32 x25c_dock;
TAreaId x260_area;

View File

@ -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<const CScriptDock*>(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<const CScriptDock*>(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();

View File

@ -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);
};