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, Fourteen = 14,
Fifteen = 15, Fifteen = 15,
Nineteen = 19, Nineteen = 19,
TwentyOne = 21,
ThirtyTwo = 32, ThirtyTwo = 32,
ThirtyFour = 34, ThirtyFour = 34,
FourtyOne = 41, FourtyOne = 41,

View File

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

View File

@ -1,6 +1,184 @@
#include "CAi.hpp" #include "CAi.hpp"
#include "Character/CModelData.hpp"
#include "CStateManager.hpp"
namespace urde 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 class CAiFuncMap
{ {
/* TODO: Figure out return type, I think it's a string */ std::map<const char*, CAiStateFunc> x0_stateFuncs;
void GetStateFunc(const char*); std::map<const char*, CAiTriggerFunc> x10_triggerFuncs;
void GetTriggerFunc(const char*); public:
CAiFuncMap();
CAiStateFunc GetStateFunc(const char*);
CAiTriggerFunc GetTriggerFunc(const char*);
}; };
/* TODO: Move these */
class CHealthInfo class CHealthInfo
{ {
float x0_; float x0_;
@ -41,20 +49,26 @@ public:
class CStateManager; class CStateManager;
class CAi : public CPhysicsActor class CAi : public CPhysicsActor
{ {
CHealthInfo x240_healthInfo; static CAiFuncMap* m_FuncMap;
CDamageVulnerability x248_damageVulnerability; CHealthInfo x258_healthInfo;
CDamageVulnerability x260_damageVulnerability;
TLockedToken<CStateMachine> x2c8_stateMachine;
public: public:
void CreateFuncLookup(CAiFuncMap* funcMap) { } CAi(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
void GetStateFunc(const char*) {} CModelData&& mData, const zeus::CAABox& box, float f1, const CHealthInfo& hInfo, const CDamageVulnerability&,
void GetTrigerFunc(const char*) {} 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() {} void GetStateMachine() {}
/* TODO: Figure out the return types, if any, and fix these prototypes */
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {} virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
virtual CHealthInfo HealthInfo(CStateManager&) { return x240_healthInfo; } virtual CHealthInfo HealthInfo(CStateManager&) { return x258_healthInfo; }
virtual CHealthInfo GetHealthInfo(const CStateManager&) { return x240_healthInfo; } virtual CHealthInfo GetHealthInfo(const CStateManager&) { return x258_healthInfo; }
virtual CDamageVulnerability GetDamageVulnerability() { return x248_damageVulnerability; } virtual CDamageVulnerability GetDamageVulnerability() { return x260_damageVulnerability; }
virtual void TakeDamage(const zeus::CVector3f&, float) {} virtual void TakeDamage(const zeus::CVector3f&, float) {}
virtual bool CanBeShot(const CStateManager&, int) { return true; } virtual bool CanBeShot(const CStateManager&, int) { return true; }
@ -109,69 +123,82 @@ public:
virtual void SpecialAttack(CStateManager&, EStateMsg, float) {} virtual void SpecialAttack(CStateManager&, EStateMsg, float) {}
virtual void Growth(CStateManager&, EStateMsg, float) {} virtual void Growth(CStateManager&, EStateMsg, float) {}
virtual void Faint(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 BulbAttack(CStateManager&, EStateMsg, float) {}
virtual void PodAttack(CStateManager&, EStateMsg, float) {} virtual void PodAttack(CStateManager&, EStateMsg, float) {}
virtual void InAttackPosition(CStateManager&, float) {} virtual bool InAttackPosition(CStateManager&, float) { return false; }
virtual void Leash(CStateManager&, float) {} virtual bool Leash(CStateManager&, float) { return false; }
virtual void OffLine(CStateManager&,float) {} virtual bool OffLine(CStateManager&,float) { return false; }
virtual void Attacked(CStateManager&, float) {} virtual bool Attacked(CStateManager&, float) { return false; }
virtual void PathShagged(CStateManager&,float) {} virtual bool PathShagged(CStateManager&, float) { return false; }
virtual void PathOver(CStateManager&,float) {} virtual bool PathOver(CStateManager&, float) { return false; }
virtual void TooClose(CStateManager&,float) {} virtual bool PathFound(CStateManager&, float) { return false; }
virtual void InRange(CStateManager&,float) {} virtual bool TooClose(CStateManager&, float) { return false; }
virtual void InMaxRange(CStateManager&,float) {} virtual bool InRange(CStateManager&, float) { return false; }
virtual void InDetectionRange(CStateManager&,float) {} virtual bool InMaxRange(CStateManager&, float) { return false; }
virtual void SpotPlayer(CStateManager&,float) {} virtual bool InDetectionRange(CStateManager&, float) { return false; }
virtual void PlayerSpot(CStateManager&,float) {} virtual bool SpotPlayer(CStateManager&, float) { return false; }
virtual void PatternOver(CStateManager&,float) {} virtual bool PlayerSpot(CStateManager&, float) { return false; }
virtual void PatternedShagged(CStateManager&,float) {} virtual bool PatternOver(CStateManager&, float) { return false; }
virtual void HasAttackPattern(CStateManager&,float) {} virtual bool PatternShagged(CStateManager&, float) { return false; }
virtual void HasPatrolPath(CStateManager&,float) {} virtual bool HasAttackPattern(CStateManager&, float) { return false; }
virtual void HasRetreatPattern(CStateManager&,float) {} virtual bool HasPatrolPath(CStateManager&, float) { return false; }
virtual void Delay(CStateManager&,float) {} virtual bool HasRetreatPattern(CStateManager&, float) { return false; }
virtual void RandomDelay(CStateManager&,float) {} virtual bool Delay(CStateManager&,float) { return false; }
virtual void FixedDelay(CStateManager&,float) {} virtual bool RandomDelay(CStateManager&, float) { return false; }
virtual void AnimOver(CStateManager&, float) {} virtual bool FixedDelay(CStateManager&, float) { return false; }
virtual void ShouldAttack(CStateManager&,float) {} virtual bool Default(CStateManager&, float) { return false; }
virtual void ShouldDoubleSnap(CStateManager&,float) {} virtual bool AnimOver(CStateManager&, float) { return false; }
virtual void InPosition(CStateManager&,float) {} virtual bool ShouldAttack(CStateManager&, float) { return false; }
virtual void ShouldTurn(CStateManager&,float) {} virtual bool ShouldDoubleSnap(CStateManager&, float) { return false; }
virtual void HitSomething(CStateManager&,float) {} virtual bool InPosition(CStateManager&, float) { return false; }
virtual void ShouldJumpBack(CStateManager&,float) {} virtual bool ShouldTurn(CStateManager&, float) { return false; }
virtual void Stuck(CStateManager&,float) {} virtual bool HitSomething(CStateManager&, float) { return false; }
virtual void NoPathNodes(CStateManager&,float) {} virtual bool ShouldJumpBack(CStateManager&, float) { return false; }
virtual void Landed(CStateManager&,float) {} virtual bool Stuck(CStateManager&, float) { return false; }
virtual void HearShot(CStateManager&,float) {} virtual bool NoPathNodes(CStateManager&, float) { return false; }
virtual void HearPlayer(CStateManager&,float) {} virtual bool Landed(CStateManager&, float) { return false; }
virtual void CoverCheck(CStateManager&, float) {} virtual bool HearShot(CStateManager&,float) { return false; }
virtual void CoverFind(CStateManager&, float) {} virtual bool HearPlayer(CStateManager&,float) { return false; }
virtual void CoverBlown(CStateManager&, float) {} virtual bool CoverCheck(CStateManager&, float) { return false; }
virtual void CoverNearlyBlown(CStateManager&, float) {} virtual bool CoverFind(CStateManager&, float) { return false; }
virtual void CoveringFire(CStateManager&, float) {} virtual bool CoverBlown(CStateManager&, float) { return false; }
virtual void GotUp(CStateManager&,float) {} virtual bool CoverNearlyBlown(CStateManager&, float) { return false; }
virtual void LineOfSight(CStateManager&,float) {} virtual bool CoveringFire(CStateManager&, float) { return false; }
virtual void AggressionCheck(CStateManager&, float) {} virtual bool GotUp(CStateManager&, float) { return false; }
virtual void AttackOver(CStateManager&, float) {} virtual bool LineOfSight(CStateManager&,float) { return false; }
virtual void ShouldTaunt(CStateManager&,float) {} virtual bool AggressionCheck(CStateManager&, float) { return false; }
virtual void Inside(CStateManager&,float) {} virtual bool AttackOver(CStateManager&, float) { return false; }
virtual void ShouldFire(CStateManager&,float) {} virtual bool ShouldTaunt(CStateManager&,float) { return false; }
virtual void ShouldFlinch(CStateManager&,float) {} virtual bool Inside(CStateManager&,float) { return false; }
virtual void PatrolPathOver(CStateManager&,float) {} virtual bool ShouldFire(CStateManager&,float) { return false; }
virtual void ShouldDodge(CStateManager&,float) {} virtual bool ShouldFlinch(CStateManager&, float) { return false; }
virtual void ShouldRetreat(CStateManager&,float) {} virtual bool PatrolPathOver(CStateManager&, float) { return false; }
virtual void ShouldCrouch(CStateManager&,float) {} virtual bool ShouldDodge(CStateManager&, float) { return false; }
virtual void ShouldMove(CStateManager&,float) {} virtual bool ShouldRetreat(CStateManager&, float) { return false; }
virtual void ShotAt(CStateManager&,float) {} virtual bool ShouldCrouch(CStateManager&, float) { return false; }
virtual void HasTargettingPoint(CStateManager&,float) {} virtual bool ShouldMove(CStateManager&, float) { return false; }
virtual void ShouldWallHang(CStateManager&,float) {} virtual bool ShotAt(CStateManager&, float) { return false; }
virtual void SetAIStage(CStateManager&,float) {} virtual bool HasTargetingPoint(CStateManager&, float) { return false; }
virtual void AIStage(CStateManager&,float) {} virtual bool ShouldWallHang(CStateManager&, float) { return false; }
virtual void StartAttack(CStateManager&,float) {} virtual bool SetAIStage(CStateManager&, float) { return false; }
virtual void BreakAttack(CStateManager&, float) {} virtual bool AIStage(CStateManager&, float) { return false; }
virtual void ShoulStrafe(CStateManager&,float) {} virtual bool StartAttack(CStateManager&, float) { return false; }
virtual void ShouldSpecialAttack(CStateManager&,float) {} virtual bool BreakAttack(CStateManager&, float) { return false; }
virtual void LostInterest(CStateManager&,float) {} 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: protected:
TAreaId x4_areaId; TAreaId x4_areaId;
TUniqueId x8_uid; TUniqueId x8_uid;
ResId xc_editorId; TEditorId xc_editorId;
std::string x10_name; std::string x10_name;
std::vector<SConnection> x20_conns; std::vector<SConnection> x20_conns;

View File

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

View File

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

View File

@ -57,6 +57,18 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
(void)msg; (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) void CScriptDoor::AddToRenderer(const zeus::CFrustum& /*frustum*/, CStateManager &mgr)
{ {
if (!xe4_30_) if (!xe4_30_)
@ -117,7 +129,7 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr)
const CScriptDoor* door = dynamic_cast<const CScriptDoor*>(mgr.GetObjectById(uid)); const CScriptDoor* door = dynamic_cast<const CScriptDoor*>(mgr.GetObjectById(uid));
if (door) if (door)
x27c_partner = door->x8_uid; x27c_partner = door->GetUniqueId();
SetDoorAnimation(EDoorAnimType::Open); SetDoorAnimation(EDoorAnimType::Open);
if (x27c_partner != kInvalidUniqueId) if (x27c_partner != kInvalidUniqueId)

View File

@ -57,6 +57,7 @@ public:
zeus::CVector3f GetOrbitPosition(const CStateManager& mgr) const; zeus::CVector3f GetOrbitPosition(const CStateManager& mgr) const;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr); void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr);
void Think(float, CStateManager& mgr);
void AddToRenderer(const zeus::CFrustum&, CStateManager& mgr); void AddToRenderer(const zeus::CFrustum&, CStateManager& mgr);
zeus::CAABox GetTouchBounds() const {} zeus::CAABox GetTouchBounds() const {}
void Render(const CStateManager&) {} 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); CWorld(IObjectStore& objStore, CResFactory& resFactory, ResId);
bool DoesAreaExist(TAreaId area) const;
std::vector<std::unique_ptr<CGameArea>>& GetGameAreas() {return x18_areas;} std::vector<std::unique_ptr<CGameArea>>& GetGameAreas() {return x18_areas;}
}; };