Various implementations

This commit is contained in:
Phillip Stephens 2016-04-23 19:46:13 -07:00
parent 4272e8207b
commit f2d4040cdc
11 changed files with 310 additions and 77 deletions

View File

@ -16,6 +16,7 @@ enum class EMaterialTypes
Fourteen = 14,
Fifteen = 15,
Nineteen = 19,
TwentyOne = 21,
ThirtyTwo = 32,
ThirtyFour = 34,
FourtyOne = 41,

View File

@ -63,7 +63,7 @@ public:
const zeus::CTransform&, CModelData&&, const CMaterialList&,
const CActorParameters&, TUniqueId);
virtual void Accept(IVisitor&) /*= 0*/;
virtual void Accept(IVisitor&) {}/*= 0;*/
virtual void AddToRenderer(const zeus::CFrustum&, CStateManager&) {}
virtual void Render(CStateManager&) {}
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}

View File

@ -1,6 +1,184 @@
#include "CAi.hpp"
#include "Character/CModelData.hpp"
#include "CStateManager.hpp"
namespace urde
{
CAiFuncMap::CAiFuncMap()
{
/* Ai States */
x0_stateFuncs["Patrol"] = &CAi::Patrol;
x0_stateFuncs["FollowPattern"] = &CAi::FollowPattern;
x0_stateFuncs["Dead"] = &CAi::Dead;
x0_stateFuncs["PathFind"] = &CAi::PathFind;
x0_stateFuncs["Start"] = &CAi::Start;
x0_stateFuncs["SelectTarget"] = &CAi::SelectTarget;
x0_stateFuncs["TargetPatrol"] = &CAi::TargetPatrol;
x0_stateFuncs["TargetPlayer"] = &CAi::TargetPlayer;
x0_stateFuncs["TargetCover"] = &CAi::TargetCover;
x0_stateFuncs["Halt"] = &CAi::Halt;
x0_stateFuncs["Walk"] = &CAi::Walk;
x0_stateFuncs["Run"] = &CAi::Run;
x0_stateFuncs["Generate"] = &CAi::Generate;
x0_stateFuncs["Deactivate"] = &CAi::Deactivate;
x0_stateFuncs["Attack"] = &CAi::Attack;
x0_stateFuncs["LoopedAttack"] = &CAi::LoopedAttack;
x0_stateFuncs["JumpBack"] = &CAi::JumpBack;
x0_stateFuncs["DoubleSnap"] = &CAi::DoubleSnap;
x0_stateFuncs["Shuffle"] = &CAi::Shuffle;
x0_stateFuncs["TurnAround"] = &CAi::TurnAround;
x0_stateFuncs["Skid"] = &CAi::Skid;
x0_stateFuncs["Active"] = &CAi::Active;
x0_stateFuncs["InActive"] = &CAi::InActive;
x0_stateFuncs["CoverAttack"] = &CAi::CoverAttack;
x0_stateFuncs["Crouch"] = &CAi::Crouch;
x0_stateFuncs["FadeIn"] = &CAi::FadeIn;
x0_stateFuncs["FadeOut"] = &CAi::FadeOut;
x0_stateFuncs["GetUp"] = &CAi::GetUp;
x0_stateFuncs["Taunt"] = &CAi::Taunt;
x0_stateFuncs["Suck"] = &CAi::Suck;
x0_stateFuncs["Flee"] = &CAi::Flee;
x0_stateFuncs["Lurk"] = &CAi::Lurk;
x0_stateFuncs["ProjectileAttack"] = &CAi::ProjectileAttack;
x0_stateFuncs["Flinch"] = &CAi::Flinch;
x0_stateFuncs["Hurled"] = &CAi::Hurled;
x0_stateFuncs["TelegraphAttack"] = &CAi::TelegraphAttack;
x0_stateFuncs["Jump"] = &CAi::Jump;
x0_stateFuncs["Explode"] = &CAi::Explode;
x0_stateFuncs["Dodge"] = &CAi::Dodge;
x0_stateFuncs["Retreat"] = &CAi::Retreat;
x0_stateFuncs["Cover"] = &CAi::Cover;
x0_stateFuncs["Approach"] = &CAi::Approach;
x0_stateFuncs["WallHang"] = &CAi::WallHang;
x0_stateFuncs["WallDetach"] = &CAi::WallDetach;
x0_stateFuncs["Enraged"] = &CAi::Enraged;
x0_stateFuncs["SpecialAttack"] = &CAi::SpecialAttack;
x0_stateFuncs["Growth"] = &CAi::Growth;
x0_stateFuncs["Faint"] = &CAi::Faint;
x0_stateFuncs["Land"] = &CAi::Land;
x0_stateFuncs["Bounce"] = &CAi::Bounce;
x0_stateFuncs["PathFindEx"] = &CAi::PathFindEx;
x0_stateFuncs["Dizzy"] = &CAi::Dizzy;
x0_stateFuncs["CallForBackup"] = &CAi::CallForBackup;
x0_stateFuncs["BulbAttack"] = &CAi::BulbAttack;
x0_stateFuncs["PodAttack"] = &CAi::PodAttack;
/* Ai Triggers */
x10_triggerFuncs["InAttackPosition"] = &CAi::InAttackPosition;
x10_triggerFuncs["Leash"] = &CAi::Leash;
x10_triggerFuncs["OffLine"] = &CAi::OffLine;
x10_triggerFuncs["Attacked"] = &CAi::Attacked;
x10_triggerFuncs["PathShagged"] = &CAi::PathShagged;
x10_triggerFuncs["TooClose"] = &CAi::TooClose;
x10_triggerFuncs["InRange"] = &CAi::InRange;
x10_triggerFuncs["InMaxRange"] = &CAi::InMaxRange;
x10_triggerFuncs["InDetectionRange"] = &CAi::InDetectionRange;
x10_triggerFuncs["SpotPlayer"] = &CAi::SpotPlayer;
x10_triggerFuncs["PlayerSpot"] = &CAi::PlayerSpot;
x10_triggerFuncs["PatternOver"] = &CAi::PatternOver;
x10_triggerFuncs["PatternShagged"] = &CAi::PatternShagged;
x10_triggerFuncs["HasAttackPattern"] = &CAi::HasAttackPattern;
x10_triggerFuncs["HasPatrolPath"] = &CAi::HasPatrolPath;
x10_triggerFuncs["HasRetreatPattern"] = &CAi::HasRetreatPattern;
x10_triggerFuncs["Delay"] = &CAi::Delay;
x10_triggerFuncs["RandomDelay"] = &CAi::RandomDelay;
x10_triggerFuncs["FixedDelay"] = &CAi::FixedDelay;
x10_triggerFuncs["Default"] = &CAi::Default;
x10_triggerFuncs["AnimOver"] = &CAi::AnimOver;
x10_triggerFuncs["ShouldAttack"] = &CAi::ShouldAttack;
x10_triggerFuncs["ShouldDoubleSnap"] = &CAi::ShouldDoubleSnap;
x10_triggerFuncs["InPosition"] = &CAi::InPosition;
x10_triggerFuncs["ShouldTurn"] = &CAi::ShouldTurn;
x10_triggerFuncs["HitSomething"] = &CAi::HitSomething;
x10_triggerFuncs["ShouldJumpBack"] = &CAi::ShouldJumpBack;
x10_triggerFuncs["Stuck"] = &CAi::Stuck;
x10_triggerFuncs["NoPathNodes"] = &CAi::NoPathNodes;
x10_triggerFuncs["Landed"] = &CAi::Landed;
x10_triggerFuncs["HearShot"] = &CAi::HearShot;
x10_triggerFuncs["HearPlayer"] = &CAi::HearPlayer;
x10_triggerFuncs["CoverCheck"] = &CAi::CoverCheck;
x10_triggerFuncs["CoverFind"] = &CAi::CoverFind;
x10_triggerFuncs["CoverBlown"] = &CAi::CoverBlown;
x10_triggerFuncs["CoverNearlyBlown"] = &CAi::CoverNearlyBlown;
x10_triggerFuncs["CoveringFire"] = &CAi::CoveringFire;
x10_triggerFuncs["GotUp"] = &CAi::GotUp;
x10_triggerFuncs["LineOfSight"] = &CAi::LineOfSight;
x10_triggerFuncs["AggressionCheck"] = &CAi::AggressionCheck;
x10_triggerFuncs["AttackOver"] = &CAi::AttackOver;
x10_triggerFuncs["ShouldTaunt"] = &CAi::ShouldTaunt;
x10_triggerFuncs["Inside"] = &CAi::Inside;
x10_triggerFuncs["ShouldFire"] = &CAi::ShouldFire;
x10_triggerFuncs["ShouldFlinch"] = &CAi::ShouldFlinch;
x10_triggerFuncs["PatrolPathOver"] = &CAi::PatrolPathOver;
x10_triggerFuncs["ShouldDodge"] = &CAi::ShouldDodge;
x10_triggerFuncs["ShouldRetreat"] = &CAi::ShouldRetreat;
x10_triggerFuncs["ShouldCrouch"] = &CAi::ShouldCrouch;
x10_triggerFuncs["ShouldMove"] = &CAi::ShouldMove;
x10_triggerFuncs["ShotAt"] = &CAi::ShotAt;
x10_triggerFuncs["HasTargetingPoint"] = &CAi::HasTargetingPoint;
x10_triggerFuncs["ShouldWallHang"] = &CAi::ShouldWallHang;
x10_triggerFuncs["SetAIStage"] = &CAi::SetAIStage;
x10_triggerFuncs["AIStage"] = &CAi::AIStage;
x10_triggerFuncs["StartAttack"] = &CAi::StartAttack;
x10_triggerFuncs["BreakAttack"] = &CAi::BreakAttack;
x10_triggerFuncs["ShouldStrafe"] = &CAi::ShouldStrafe;
x10_triggerFuncs["ShouldSpecialAttack"] = &CAi::ShouldSpecialAttack;
x10_triggerFuncs["LostInterest"] = &CAi::LostInterest;
x10_triggerFuncs["CodeTrigger"] = &CAi::CodeTrigger;
x10_triggerFuncs["BounceFind"] = &CAi::BounceFind;
x10_triggerFuncs["Random"] = &CAi::Random;
x10_triggerFuncs["FixedRandom"] = &CAi::FixedRandom;
x10_triggerFuncs["IsDizzy"] = &CAi::IsDizzy;
x10_triggerFuncs["ShouldCallForBackup"] = &CAi::ShouldCallForBackup;
CAi::CreateFuncLookup(this);
}
CAiStateFunc CAiFuncMap::GetStateFunc(const char* func)
{
if (x0_stateFuncs.find(func) == x0_stateFuncs.end())
return nullptr;
return x0_stateFuncs[func];
}
CAiTriggerFunc CAiFuncMap::GetTriggerFunc(const char* func)
{
if (x10_triggerFuncs.find(func) == x10_triggerFuncs.end())
return nullptr;
return x10_triggerFuncs[func];
}
static CMaterialList MakeAiMaterialList(const CMaterialList& in)
{
CMaterialList ret = in;
ret.Add(EMaterialTypes::FourtyEight);
ret.Add(EMaterialTypes::TwentyOne);
return ret;
}
CAi::CAi(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const zeus::CAABox& box, float f1, const CHealthInfo& hInfo, const CDamageVulnerability& dmgVuln,
const CMaterialList& list, ResId, const CActorParameters& actorParams, float f2, float f3)
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeAiMaterialList(list), box, SMoverData(f1), actorParams,
f2, f3),
x258_healthInfo(hInfo),
x260_damageVulnerability(dmgVuln)
{
}
CAiStateFunc CAi::GetStateFunc(const char* func)
{
return m_FuncMap->GetStateFunc(func);
}
CAiTriggerFunc CAi::GetTrigerFunc(const char* func)
{
return m_FuncMap->GetTriggerFunc(func);
}
void CAi::CreateFuncLookup(CAiFuncMap* funcMap)
{
m_FuncMap = funcMap;
}
CAiFuncMap* CAi::m_FuncMap = nullptr;
}

View File

@ -22,14 +22,22 @@ enum class EListenNoiseType
{
};
class CAi;
class CStateMachine;
typedef void (CAi::*CAiStateFunc)(CStateManager&, EStateMsg, float);
typedef bool (CAi::*CAiTriggerFunc)(CStateManager&, float);
class CAiFuncMap
{
/* TODO: Figure out return type, I think it's a string */
void GetStateFunc(const char*);
void GetTriggerFunc(const char*);
std::map<const char*, CAiStateFunc> x0_stateFuncs;
std::map<const char*, CAiTriggerFunc> x10_triggerFuncs;
public:
CAiFuncMap();
CAiStateFunc GetStateFunc(const char*);
CAiTriggerFunc GetTriggerFunc(const char*);
};
/* TODO: Move these */
class CHealthInfo
{
float x0_;
@ -41,20 +49,26 @@ public:
class CStateManager;
class CAi : public CPhysicsActor
{
CHealthInfo x240_healthInfo;
CDamageVulnerability x248_damageVulnerability;
static CAiFuncMap* m_FuncMap;
CHealthInfo x258_healthInfo;
CDamageVulnerability x260_damageVulnerability;
TLockedToken<CStateMachine> x2c8_stateMachine;
public:
void CreateFuncLookup(CAiFuncMap* funcMap) { }
void GetStateFunc(const char*) {}
void GetTrigerFunc(const char*) {}
CAi(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const zeus::CAABox& box, float f1, const CHealthInfo& hInfo, const CDamageVulnerability&,
const CMaterialList& list, ResId, const CActorParameters&, float f2, float f3);
static void CreateFuncLookup(CAiFuncMap* funcMap);
CAiStateFunc GetStateFunc(const char* func);
CAiTriggerFunc GetTrigerFunc(const char* func);
void GetStateMachine() {}
/* TODO: Figure out the return types, if any, and fix these prototypes */
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
virtual CHealthInfo HealthInfo(CStateManager&) { return x240_healthInfo; }
virtual CHealthInfo GetHealthInfo(const CStateManager&) { return x240_healthInfo; }
virtual CDamageVulnerability GetDamageVulnerability() { return x248_damageVulnerability; }
virtual CHealthInfo HealthInfo(CStateManager&) { return x258_healthInfo; }
virtual CHealthInfo GetHealthInfo(const CStateManager&) { return x258_healthInfo; }
virtual CDamageVulnerability GetDamageVulnerability() { return x260_damageVulnerability; }
virtual void TakeDamage(const zeus::CVector3f&, float) {}
virtual bool CanBeShot(const CStateManager&, int) { return true; }
@ -109,69 +123,82 @@ public:
virtual void SpecialAttack(CStateManager&, EStateMsg, float) {}
virtual void Growth(CStateManager&, EStateMsg, float) {}
virtual void Faint(CStateManager&, EStateMsg, float) {}
virtual void Land(CStateManager&, EStateMsg, float) {}
virtual void Bounce(CStateManager&, EStateMsg, float) {}
virtual void PathFindEx(CStateManager&, EStateMsg, float) {}
virtual void Dizzy(CStateManager&, EStateMsg, float) {}
virtual void CallForBackup(CStateManager&, EStateMsg, float) {}
virtual void BulbAttack(CStateManager&, EStateMsg, float) {}
virtual void PodAttack(CStateManager&, EStateMsg, float) {}
virtual void InAttackPosition(CStateManager&, float) {}
virtual void Leash(CStateManager&, float) {}
virtual void OffLine(CStateManager&,float) {}
virtual void Attacked(CStateManager&, float) {}
virtual void PathShagged(CStateManager&,float) {}
virtual void PathOver(CStateManager&,float) {}
virtual void TooClose(CStateManager&,float) {}
virtual void InRange(CStateManager&,float) {}
virtual void InMaxRange(CStateManager&,float) {}
virtual void InDetectionRange(CStateManager&,float) {}
virtual void SpotPlayer(CStateManager&,float) {}
virtual void PlayerSpot(CStateManager&,float) {}
virtual void PatternOver(CStateManager&,float) {}
virtual void PatternedShagged(CStateManager&,float) {}
virtual void HasAttackPattern(CStateManager&,float) {}
virtual void HasPatrolPath(CStateManager&,float) {}
virtual void HasRetreatPattern(CStateManager&,float) {}
virtual void Delay(CStateManager&,float) {}
virtual void RandomDelay(CStateManager&,float) {}
virtual void FixedDelay(CStateManager&,float) {}
virtual void AnimOver(CStateManager&, float) {}
virtual void ShouldAttack(CStateManager&,float) {}
virtual void ShouldDoubleSnap(CStateManager&,float) {}
virtual void InPosition(CStateManager&,float) {}
virtual void ShouldTurn(CStateManager&,float) {}
virtual void HitSomething(CStateManager&,float) {}
virtual void ShouldJumpBack(CStateManager&,float) {}
virtual void Stuck(CStateManager&,float) {}
virtual void NoPathNodes(CStateManager&,float) {}
virtual void Landed(CStateManager&,float) {}
virtual void HearShot(CStateManager&,float) {}
virtual void HearPlayer(CStateManager&,float) {}
virtual void CoverCheck(CStateManager&, float) {}
virtual void CoverFind(CStateManager&, float) {}
virtual void CoverBlown(CStateManager&, float) {}
virtual void CoverNearlyBlown(CStateManager&, float) {}
virtual void CoveringFire(CStateManager&, float) {}
virtual void GotUp(CStateManager&,float) {}
virtual void LineOfSight(CStateManager&,float) {}
virtual void AggressionCheck(CStateManager&, float) {}
virtual void AttackOver(CStateManager&, float) {}
virtual void ShouldTaunt(CStateManager&,float) {}
virtual void Inside(CStateManager&,float) {}
virtual void ShouldFire(CStateManager&,float) {}
virtual void ShouldFlinch(CStateManager&,float) {}
virtual void PatrolPathOver(CStateManager&,float) {}
virtual void ShouldDodge(CStateManager&,float) {}
virtual void ShouldRetreat(CStateManager&,float) {}
virtual void ShouldCrouch(CStateManager&,float) {}
virtual void ShouldMove(CStateManager&,float) {}
virtual void ShotAt(CStateManager&,float) {}
virtual void HasTargettingPoint(CStateManager&,float) {}
virtual void ShouldWallHang(CStateManager&,float) {}
virtual void SetAIStage(CStateManager&,float) {}
virtual void AIStage(CStateManager&,float) {}
virtual void StartAttack(CStateManager&,float) {}
virtual void BreakAttack(CStateManager&, float) {}
virtual void ShoulStrafe(CStateManager&,float) {}
virtual void ShouldSpecialAttack(CStateManager&,float) {}
virtual void LostInterest(CStateManager&,float) {}
virtual bool InAttackPosition(CStateManager&, float) { return false; }
virtual bool Leash(CStateManager&, float) { return false; }
virtual bool OffLine(CStateManager&,float) { return false; }
virtual bool Attacked(CStateManager&, float) { return false; }
virtual bool PathShagged(CStateManager&, float) { return false; }
virtual bool PathOver(CStateManager&, float) { return false; }
virtual bool PathFound(CStateManager&, float) { return false; }
virtual bool TooClose(CStateManager&, float) { return false; }
virtual bool InRange(CStateManager&, float) { return false; }
virtual bool InMaxRange(CStateManager&, float) { return false; }
virtual bool InDetectionRange(CStateManager&, float) { return false; }
virtual bool SpotPlayer(CStateManager&, float) { return false; }
virtual bool PlayerSpot(CStateManager&, float) { return false; }
virtual bool PatternOver(CStateManager&, float) { return false; }
virtual bool PatternShagged(CStateManager&, float) { return false; }
virtual bool HasAttackPattern(CStateManager&, float) { return false; }
virtual bool HasPatrolPath(CStateManager&, float) { return false; }
virtual bool HasRetreatPattern(CStateManager&, float) { return false; }
virtual bool Delay(CStateManager&,float) { return false; }
virtual bool RandomDelay(CStateManager&, float) { return false; }
virtual bool FixedDelay(CStateManager&, float) { return false; }
virtual bool Default(CStateManager&, float) { return false; }
virtual bool AnimOver(CStateManager&, float) { return false; }
virtual bool ShouldAttack(CStateManager&, float) { return false; }
virtual bool ShouldDoubleSnap(CStateManager&, float) { return false; }
virtual bool InPosition(CStateManager&, float) { return false; }
virtual bool ShouldTurn(CStateManager&, float) { return false; }
virtual bool HitSomething(CStateManager&, float) { return false; }
virtual bool ShouldJumpBack(CStateManager&, float) { return false; }
virtual bool Stuck(CStateManager&, float) { return false; }
virtual bool NoPathNodes(CStateManager&, float) { return false; }
virtual bool Landed(CStateManager&, float) { return false; }
virtual bool HearShot(CStateManager&,float) { return false; }
virtual bool HearPlayer(CStateManager&,float) { return false; }
virtual bool CoverCheck(CStateManager&, float) { return false; }
virtual bool CoverFind(CStateManager&, float) { return false; }
virtual bool CoverBlown(CStateManager&, float) { return false; }
virtual bool CoverNearlyBlown(CStateManager&, float) { return false; }
virtual bool CoveringFire(CStateManager&, float) { return false; }
virtual bool GotUp(CStateManager&, float) { return false; }
virtual bool LineOfSight(CStateManager&,float) { return false; }
virtual bool AggressionCheck(CStateManager&, float) { return false; }
virtual bool AttackOver(CStateManager&, float) { return false; }
virtual bool ShouldTaunt(CStateManager&,float) { return false; }
virtual bool Inside(CStateManager&,float) { return false; }
virtual bool ShouldFire(CStateManager&,float) { return false; }
virtual bool ShouldFlinch(CStateManager&, float) { return false; }
virtual bool PatrolPathOver(CStateManager&, float) { return false; }
virtual bool ShouldDodge(CStateManager&, float) { return false; }
virtual bool ShouldRetreat(CStateManager&, float) { return false; }
virtual bool ShouldCrouch(CStateManager&, float) { return false; }
virtual bool ShouldMove(CStateManager&, float) { return false; }
virtual bool ShotAt(CStateManager&, float) { return false; }
virtual bool HasTargetingPoint(CStateManager&, float) { return false; }
virtual bool ShouldWallHang(CStateManager&, float) { return false; }
virtual bool SetAIStage(CStateManager&, float) { return false; }
virtual bool AIStage(CStateManager&, float) { return false; }
virtual bool StartAttack(CStateManager&, float) { return false; }
virtual bool BreakAttack(CStateManager&, float) { return false; }
virtual bool ShouldStrafe(CStateManager&, float) { return false; }
virtual bool ShouldSpecialAttack(CStateManager&, float) { return false; }
virtual bool LostInterest(CStateManager&, float) { return false; }
virtual bool CodeTrigger(CStateManager&, float) { return false; }
virtual bool BounceFind(CStateManager&, float) { return false; }
virtual bool Random(CStateManager&, float) { return false; }
virtual bool FixedRandom(CStateManager&, float) { return false; }
virtual bool IsDizzy(CStateManager&, float) { return false; }
virtual bool ShouldCallForBackup(CStateManager&, float) { return false; }
};
}

View File

@ -34,7 +34,7 @@ class CEntity
protected:
TAreaId x4_areaId;
TUniqueId x8_uid;
ResId xc_editorId;
TEditorId xc_editorId;
std::string x10_name;
std::vector<SConnection> x20_conns;

View File

@ -2,11 +2,11 @@ add_library(RuntimeCommonWorld
CWorld.hpp CWorld.cpp
IGameArea.hpp IGameArea.cpp
CGameArea.hpp CGameArea.cpp
CAi.hpp CAi.cpp
CPathFindArea.hpp CPathFindArea.cpp
CAreaOctTree.hpp CAreaOctTree.cpp
CActor.hpp CActor.cpp
CPhysicsActor.hpp CPhysicsActor.cpp
CAi.hpp CAi.cpp
CEntity.hpp CEntity.cpp
CPhysicsActor.hpp CPhysicsActor.cpp
CWorldTransManager.hpp CWorldTransManager.cpp

View File

@ -26,6 +26,8 @@ class CScriptDock : public CPhysicsActor
public:
CScriptDock(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CVector3f position,
const zeus::CVector3f& extent, s32, TAreaId, bool active, s32 w1, bool b1);
s32 GetDockId() const { return x25c_dock; }
};
}
#endif // __URDE_CSCRIPTDOCK_HPP__

View File

@ -57,6 +57,18 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
(void)msg;
}
void CScriptDoor::Think(float dt, CStateManager& mgr)
{
if (!GetActive())
return;
if (!x2a8_26_)
{
if (x25c_ < 0.5f)
x25c_ += dt;
}
}
void CScriptDoor::AddToRenderer(const zeus::CFrustum& /*frustum*/, CStateManager &mgr)
{
if (!xe4_30_)
@ -117,7 +129,7 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr)
const CScriptDoor* door = dynamic_cast<const CScriptDoor*>(mgr.GetObjectById(uid));
if (door)
x27c_partner = door->x8_uid;
x27c_partner = door->GetUniqueId();
SetDoorAnimation(EDoorAnimType::Open);
if (x27c_partner != kInvalidUniqueId)

View File

@ -57,6 +57,7 @@ public:
zeus::CVector3f GetOrbitPosition(const CStateManager& mgr) const;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr);
void Think(float, CStateManager& mgr);
void AddToRenderer(const zeus::CFrustum&, CStateManager& mgr);
zeus::CAABox GetTouchBounds() const {}
void Render(const CStateManager&) {}

View File

@ -0,0 +1,11 @@
#include "CWorld.hpp"
namespace urde
{
bool CWorld::DoesAreaExist(TAreaId area) const
{
return (area >= 0 && area < x18_areas.size());
}
}

View File

@ -52,6 +52,7 @@ public:
};
CWorld(IObjectStore& objStore, CResFactory& resFactory, ResId);
bool DoesAreaExist(TAreaId area) const;
std::vector<std::unique_ptr<CGameArea>>& GetGameAreas() {return x18_areas;}
};