mirror of https://github.com/AxioDL/metaforce.git
Various Implementations
This commit is contained in:
parent
57775d31bf
commit
6d9ccc7f89
|
@ -64,7 +64,7 @@ CStateManager::CStateManager(const std::weak_ptr<CScriptMailbox>&,
|
||||||
x904_loaderFuncs[int(EScriptObjectType::CameraShaker)] = ScriptLoader::LoadCameraShaker;
|
x904_loaderFuncs[int(EScriptObjectType::CameraShaker)] = ScriptLoader::LoadCameraShaker;
|
||||||
x904_loaderFuncs[int(EScriptObjectType::ActorKeyframe)] = ScriptLoader::LoadActorKeyframe;
|
x904_loaderFuncs[int(EScriptObjectType::ActorKeyframe)] = ScriptLoader::LoadActorKeyframe;
|
||||||
x904_loaderFuncs[int(EScriptObjectType::Water)] = ScriptLoader::LoadWater;
|
x904_loaderFuncs[int(EScriptObjectType::Water)] = ScriptLoader::LoadWater;
|
||||||
x904_loaderFuncs[int(EScriptObjectType::Warwasp)] = ScriptLoader::LoadWarwasp;
|
x904_loaderFuncs[int(EScriptObjectType::Warwasp)] = ScriptLoader::LoadWarWasp;
|
||||||
x904_loaderFuncs[int(EScriptObjectType::SpacePirate)] = ScriptLoader::LoadSpacePirate;
|
x904_loaderFuncs[int(EScriptObjectType::SpacePirate)] = ScriptLoader::LoadSpacePirate;
|
||||||
x904_loaderFuncs[int(EScriptObjectType::FlyingPirate)] = ScriptLoader::LoadFlyingPirate;
|
x904_loaderFuncs[int(EScriptObjectType::FlyingPirate)] = ScriptLoader::LoadFlyingPirate;
|
||||||
x904_loaderFuncs[int(EScriptObjectType::ElitePirate)] = ScriptLoader::LoadElitePirate;
|
x904_loaderFuncs[int(EScriptObjectType::ElitePirate)] = ScriptLoader::LoadElitePirate;
|
||||||
|
|
|
@ -15,6 +15,7 @@ enum class ELocomotionAnim
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CBodyController;
|
class CBodyController;
|
||||||
class CStateManager;
|
class CStateManager;
|
||||||
class CBodyState
|
class CBodyState
|
||||||
|
|
|
@ -32,7 +32,7 @@ CModelData::CModelData(const CAnimRes& res)
|
||||||
: x0_particleScale(res.x8_scale)
|
: x0_particleScale(res.x8_scale)
|
||||||
{
|
{
|
||||||
TToken<CCharacterFactory> factory = g_CharFactoryBuilder->GetFactory(res);
|
TToken<CCharacterFactory> factory = g_CharFactoryBuilder->GetFactory(res);
|
||||||
xc_animData = factory->CreateCharacter(res.x4_charIdx, res.x14_, factory, res.x1c_defaultAnim);
|
xc_animData = factory->CreateCharacter(res.x4_charIdx, res.x14_, factory, res.x18_defaultAnim);
|
||||||
}
|
}
|
||||||
|
|
||||||
SAdvancementDeltas CModelData::GetAdvancementDeltas(const CCharAnimTime& a,
|
SAdvancementDeltas CModelData::GetAdvancementDeltas(const CCharAnimTime& a,
|
||||||
|
|
|
@ -33,7 +33,7 @@ struct CAnimRes
|
||||||
s32 x4_charIdx = 0;
|
s32 x4_charIdx = 0;
|
||||||
zeus::CVector3f x8_scale;
|
zeus::CVector3f x8_scale;
|
||||||
bool x14_ = false;
|
bool x14_ = false;
|
||||||
s32 x1c_defaultAnim = 0;
|
s32 x18_defaultAnim = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CModelData
|
class CModelData
|
||||||
|
|
|
@ -7,10 +7,46 @@ namespace urde
|
||||||
{
|
{
|
||||||
class CMaterialFilter
|
class CMaterialFilter
|
||||||
{
|
{
|
||||||
CMaterialList x0_;
|
|
||||||
CMaterialList x8_;
|
|
||||||
u32 x10_ = 0;
|
|
||||||
public:
|
public:
|
||||||
|
enum class EFilterType
|
||||||
|
{
|
||||||
|
Zero,
|
||||||
|
One,
|
||||||
|
Two,
|
||||||
|
Three
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
|
||||||
|
CMaterialList x0_include;
|
||||||
|
CMaterialList x8_exclude;
|
||||||
|
EFilterType x10_type = EFilterType::Three;
|
||||||
|
public:
|
||||||
|
|
||||||
|
CMaterialFilter(const CMaterialList& include, const CMaterialList& exclude, EFilterType type)
|
||||||
|
: x0_include(include),
|
||||||
|
x8_exclude(exclude),
|
||||||
|
x10_type(type)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static CMaterialFilter MakeInclude(const CMaterialList& include)
|
||||||
|
{
|
||||||
|
return CMaterialFilter(include, {EMaterialTypes::Zero}, EFilterType::Zero);
|
||||||
|
}
|
||||||
|
|
||||||
|
static CMaterialFilter MakeExclude(const CMaterialList& exclude)
|
||||||
|
{
|
||||||
|
return CMaterialFilter({u64(0x00000000FFFFFFFF)}, exclude, EFilterType::Two);
|
||||||
|
}
|
||||||
|
|
||||||
|
static CMaterialFilter MakeIncludeExclude(const CMaterialList& include, const CMaterialList& exclude)
|
||||||
|
{
|
||||||
|
return CMaterialFilter(include, exclude, EFilterType::Three);
|
||||||
|
}
|
||||||
|
|
||||||
|
const CMaterialList& GetIncludeList() const { return x0_include; }
|
||||||
|
const CMaterialList& GetExcludeList() const { return x8_exclude; }
|
||||||
|
bool Passes(const CMaterialList&) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // __CMATERIALFILTER_HPP__
|
#endif // __CMATERIALFILTER_HPP__
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace urde
|
||||||
enum class EMaterialTypes
|
enum class EMaterialTypes
|
||||||
{
|
{
|
||||||
Zero = 0,
|
Zero = 0,
|
||||||
|
Three = 3,
|
||||||
Six = 6,
|
Six = 6,
|
||||||
Eight = 8,
|
Eight = 8,
|
||||||
Ten = 10,
|
Ten = 10,
|
||||||
|
@ -19,7 +20,10 @@ enum class EMaterialTypes
|
||||||
Nineteen = 19,
|
Nineteen = 19,
|
||||||
TwentyOne = 21,
|
TwentyOne = 21,
|
||||||
ThirtyTwo = 32,
|
ThirtyTwo = 32,
|
||||||
|
ThirtyThree = 33,
|
||||||
ThirtyFour = 34,
|
ThirtyFour = 34,
|
||||||
|
ThirtySeven = 37,
|
||||||
|
Fourty = 40,
|
||||||
FourtyOne = 41,
|
FourtyOne = 41,
|
||||||
FourtyTwo = 42,
|
FourtyTwo = 42,
|
||||||
FourtyThree = 43,
|
FourtyThree = 43,
|
||||||
|
|
|
@ -7,6 +7,7 @@ set(MP1_SOURCES
|
||||||
CPlayMovie.hpp CPlayMovie.cpp
|
CPlayMovie.hpp CPlayMovie.cpp
|
||||||
CFrontEndUI.hpp CFrontEndUI.cpp
|
CFrontEndUI.hpp CFrontEndUI.cpp
|
||||||
CNewIntroBoss.hpp CNewIntroBoss.cpp
|
CNewIntroBoss.hpp CNewIntroBoss.cpp
|
||||||
|
CWarWasp.hpp CWarWasp.cpp
|
||||||
MP1.hpp MP1.cpp)
|
MP1.hpp MP1.cpp)
|
||||||
|
|
||||||
runtime_add_list(MP1 MP1_SOURCES)
|
runtime_add_list(MP1 MP1_SOURCES)
|
||||||
|
|
|
@ -10,7 +10,7 @@ CNewIntroBoss::CNewIntroBoss(TUniqueId uid, const std::string& name, const CEnti
|
||||||
const CActorParameters& actParms, float, u32, const CDamageInfo& dInfo,
|
const CActorParameters& actParms, float, u32, const CDamageInfo& dInfo,
|
||||||
u32, u32, u32, u32)
|
u32, u32, u32, u32)
|
||||||
: CPatterned(EUnknown::TwentyThree, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
: CPatterned(EUnknown::TwentyThree, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
||||||
EMovementType::One, EColliderType::Flyer, EBodyType::Two, actParms)
|
EMovementType::Flyer, EColliderType::One, EBodyType::Two, actParms, 1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
#include "CWarWasp.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
namespace MP1
|
||||||
|
{
|
||||||
|
CWarWasp::CWarWasp(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
|
CModelData&& mData, const CPatternedInfo& pInfo, CPatterned::EFlavorType flavor,
|
||||||
|
CPatterned::EColliderType collider, const CDamageInfo& dInfo1, const CActorParameters& actorParms,
|
||||||
|
ResId weapon, const CDamageInfo& dInfo2, ResId particle, u32 w3)
|
||||||
|
: CPatterned(EUnknown::ThirtyNine, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer, collider, EBodyType::Three,
|
||||||
|
actorParms, 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef CWARWASP_HPP
|
||||||
|
#define CWARWASP_HPP
|
||||||
|
|
||||||
|
#include "World/CPatterned.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
class CDamageInfo;
|
||||||
|
namespace MP1
|
||||||
|
{
|
||||||
|
class CWarWasp : public CPatterned
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CWarWasp(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||||
|
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo,
|
||||||
|
CPatterned::EFlavorType flavor, CPatterned::EColliderType, const CDamageInfo& dInfo1, const CActorParameters&,
|
||||||
|
ResId weapon, const CDamageInfo& dInfo2, ResId particle, u32 w3);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // CWARWASP_HPP
|
|
@ -285,28 +285,22 @@ bool CVEParticleLocation::GetValue(int /*frame*/, zeus::CVector3f& valOut) const
|
||||||
|
|
||||||
bool CVEParticleSystemOrientationFront::GetValue(int /*frame*/, zeus::CVector3f& valOut) const
|
bool CVEParticleSystemOrientationFront::GetValue(int /*frame*/, zeus::CVector3f& valOut) const
|
||||||
{
|
{
|
||||||
zeus::CTransform trans= CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation();
|
zeus::CMatrix4f trans = CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation().toMatrix4f().transposed();
|
||||||
valOut.x = trans.m_basis.vec[1].x;
|
valOut.assign(trans.vec[0].y, trans.vec[1].z, trans.vec[3].x);
|
||||||
valOut.y = trans.m_basis.vec[2].y;
|
|
||||||
valOut.z = trans.m_origin.z;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVEParticleSystemOrientationUp::GetValue(int /*frame*/, zeus::CVector3f& valOut) const
|
bool CVEParticleSystemOrientationUp::GetValue(int /*frame*/, zeus::CVector3f& valOut) const
|
||||||
{
|
{
|
||||||
zeus::CTransform trans= CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation();
|
zeus::CMatrix4f trans = CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation().toMatrix4f().transposed();
|
||||||
valOut.x = trans.m_basis.vec[2].x;
|
valOut.assign(trans.vec[0].z, trans.vec[2].x, trans.vec[3].y);
|
||||||
valOut.y = trans.m_basis.vec[0].z;
|
|
||||||
valOut.z = trans.m_origin.y;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVEParticleSystemOrientationRight::GetValue(int /*frame*/, zeus::CVector3f& valOut) const
|
bool CVEParticleSystemOrientationRight::GetValue(int /*frame*/, zeus::CVector3f& valOut) const
|
||||||
{
|
{
|
||||||
zeus::CTransform trans = CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation();
|
zeus::CMatrix4f trans = CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation().toMatrix4f().transposed();
|
||||||
valOut.x = trans.m_basis.vec[0].x;
|
valOut.assign(trans.vec[0].x, trans.vec[1].y, trans.vec[2].z);
|
||||||
valOut.y = trans.m_basis.vec[1].y;
|
|
||||||
valOut.z = trans.m_basis.vec[2].z;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ CActor::CActor(TUniqueId uid, bool active, const std::string& name, const CEntit
|
||||||
const CActorParameters& params, TUniqueId)
|
const CActorParameters& params, TUniqueId)
|
||||||
: CEntity(uid, info, active, name),
|
: CEntity(uid, info, active, name),
|
||||||
x68_(MakeActorMaterialList(list, params)),
|
x68_(MakeActorMaterialList(list, params)),
|
||||||
x70_(EMaterialTypes::Nineteen)
|
x70_(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Nineteen}, {EMaterialTypes::Zero}))
|
||||||
{
|
{
|
||||||
if (mData.x1c_normalModel)
|
if (mData.x1c_normalModel)
|
||||||
x64_modelData = std::make_unique<CModelData>(std::move(mData));
|
x64_modelData = std::make_unique<CModelData>(std::move(mData));
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "CEntity.hpp"
|
#include "CEntity.hpp"
|
||||||
#include "zeus/zeus.hpp"
|
#include "zeus/zeus.hpp"
|
||||||
#include "Collision/CMaterialList.hpp"
|
#include "Collision/CMaterialFilter.hpp"
|
||||||
#include "Character/CModelData.hpp"
|
#include "Character/CModelData.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
|
@ -33,7 +33,7 @@ protected:
|
||||||
zeus::CTransform x34_transform;
|
zeus::CTransform x34_transform;
|
||||||
std::unique_ptr<CModelData> x64_modelData;
|
std::unique_ptr<CModelData> x64_modelData;
|
||||||
CMaterialList x68_;
|
CMaterialList x68_;
|
||||||
CMaterialList x70_;
|
CMaterialFilter x70_;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
@ -63,7 +63,6 @@ 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 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&) {}
|
||||||
|
@ -85,6 +84,8 @@ public:
|
||||||
virtual zeus::CVector3f GetOrbitPosition(const CStateManager&)
|
virtual zeus::CVector3f GetOrbitPosition(const CStateManager&)
|
||||||
{ return x34_transform.m_origin; }
|
{ return x34_transform.m_origin; }
|
||||||
|
|
||||||
|
virtual const zeus::CAABox* GetTouchBounds() const { return nullptr; }
|
||||||
|
|
||||||
virtual ECollisionResponseType GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, CWeaponMode&, int) { return ECollisionResponseType::Unknown12; }
|
virtual ECollisionResponseType GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, CWeaponMode&, int) { return ECollisionResponseType::Unknown12; }
|
||||||
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||||
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||||
|
@ -115,6 +116,8 @@ public:
|
||||||
{
|
{
|
||||||
return xe5_27_useInSortedLists;
|
return xe5_27_useInSortedLists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CMaterialFilter& GetMaterialFilter() const { return x70_; }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,149 +5,6 @@
|
||||||
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)
|
static CMaterialList MakeAiMaterialList(const CMaterialList& in)
|
||||||
{
|
{
|
||||||
CMaterialList ret = in;
|
CMaterialList ret = in;
|
||||||
|
@ -157,10 +14,10 @@ static CMaterialList MakeAiMaterialList(const CMaterialList& in)
|
||||||
}
|
}
|
||||||
|
|
||||||
CAi::CAi(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
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,
|
CModelData&& mData, const zeus::CAABox& box, float mass, const CHealthInfo& hInfo, const CDamageVulnerability& dmgVuln,
|
||||||
const CMaterialList& list, ResId, const CActorParameters& actorParams, float f2, float f3)
|
const CMaterialList& list, ResId, const CActorParameters& actorParams, float f1, float f2)
|
||||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeAiMaterialList(list), box, SMoverData(f1), actorParams,
|
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeAiMaterialList(list), box, SMoverData(mass), actorParams,
|
||||||
f2, f3),
|
f1, f2),
|
||||||
x258_healthInfo(hInfo),
|
x258_healthInfo(hInfo),
|
||||||
x260_damageVulnerability(dmgVuln)
|
x260_damageVulnerability(dmgVuln)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,37 +8,18 @@
|
||||||
#include "CPhysicsActor.hpp"
|
#include "CPhysicsActor.hpp"
|
||||||
#include "CDamageVulnerability.hpp"
|
#include "CDamageVulnerability.hpp"
|
||||||
#include "CHealthInfo.hpp"
|
#include "CHealthInfo.hpp"
|
||||||
|
#include "CStateMachine.hpp"
|
||||||
|
|
||||||
#include "zeus/zeus.hpp"
|
#include "zeus/zeus.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
/* TODO: Figure out what all this is for and move it somewhere appropriate */
|
|
||||||
enum class EStateMsg
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class EListenNoiseType
|
enum class EListenNoiseType
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
class CAi;
|
class CAiFuncMap;
|
||||||
class CStateMachine;
|
|
||||||
|
|
||||||
typedef void (CAi::*CAiStateFunc)(CStateManager&, EStateMsg, float);
|
|
||||||
typedef bool (CAi::*CAiTriggerFunc)(CStateManager&, float);
|
|
||||||
|
|
||||||
class CAiFuncMap
|
|
||||||
{
|
|
||||||
std::map<const char*, CAiStateFunc> x0_stateFuncs;
|
|
||||||
std::map<const char*, CAiTriggerFunc> x10_triggerFuncs;
|
|
||||||
public:
|
|
||||||
CAiFuncMap();
|
|
||||||
CAiStateFunc GetStateFunc(const char*);
|
|
||||||
CAiTriggerFunc GetTriggerFunc(const char*);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CStateManager;
|
class CStateManager;
|
||||||
class CAi : public CPhysicsActor
|
class CAi : public CPhysicsActor
|
||||||
{
|
{
|
||||||
|
@ -48,21 +29,22 @@ class CAi : public CPhysicsActor
|
||||||
TLockedToken<CStateMachine> x2c8_stateMachine;
|
TLockedToken<CStateMachine> x2c8_stateMachine;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CAi(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
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&,
|
CModelData&& mData, const zeus::CAABox& box, float mass, const CHealthInfo& hInfo, const CDamageVulnerability&,
|
||||||
const CMaterialList& list, ResId, const CActorParameters&, float f2, float f3);
|
const CMaterialList& list, ResId, const CActorParameters&, float f1, float f2);
|
||||||
|
|
||||||
static void CreateFuncLookup(CAiFuncMap* funcMap);
|
static void CreateFuncLookup(CAiFuncMap* funcMap);
|
||||||
CAiStateFunc GetStateFunc(const char* func);
|
static CAiStateFunc GetStateFunc(const char* func);
|
||||||
CAiTriggerFunc GetTrigerFunc(const char* func);
|
static CAiTriggerFunc GetTrigerFunc(const char* func);
|
||||||
|
|
||||||
void GetStateMachine() {}
|
void GetStateMachine() {}
|
||||||
|
|
||||||
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
|
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
|
||||||
virtual CHealthInfo HealthInfo(CStateManager&) { return x258_healthInfo; }
|
virtual CHealthInfo HealthInfo(CStateManager&) { return x258_healthInfo; }
|
||||||
virtual CHealthInfo GetHealthInfo(const CStateManager&) { return x258_healthInfo; }
|
virtual CHealthInfo GetHealthInfo(const CStateManager&) { return x258_healthInfo; }
|
||||||
|
virtual void Death(const zeus::CVector3f&, CStateManager&)=0;
|
||||||
|
virtual void KnockBack(const zeus::CVector3f&, CStateManager&)=0;
|
||||||
virtual CDamageVulnerability GetDamageVulnerability() { return x260_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; }
|
||||||
virtual bool IsListening() { return false; }
|
virtual bool IsListening() { return false; }
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
#include "CAiFuncMap.hpp"
|
||||||
|
#include "CAi.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];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef __URDE_CAIFUNCMAP_HPP__
|
||||||
|
#define __URDE_CAIFUNCMAP_HPP__
|
||||||
|
|
||||||
|
#include "RetroTypes.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
enum class EStateMsg
|
||||||
|
{
|
||||||
|
One,
|
||||||
|
};
|
||||||
|
|
||||||
|
class CStateManager;
|
||||||
|
class CAi;
|
||||||
|
typedef void (CAi::*CAiStateFunc)(CStateManager&, EStateMsg, float);
|
||||||
|
typedef bool (CAi::*CAiTriggerFunc)(CStateManager&, float);
|
||||||
|
class CAiFuncMap
|
||||||
|
{
|
||||||
|
std::map<const char*, CAiStateFunc> x0_stateFuncs;
|
||||||
|
std::map<const char*, CAiTriggerFunc> x10_triggerFuncs;
|
||||||
|
public:
|
||||||
|
CAiFuncMap();
|
||||||
|
CAiStateFunc GetStateFunc(const char*);
|
||||||
|
CAiTriggerFunc GetTriggerFunc(const char*);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CAIFUNCMAP_HPP__
|
|
@ -9,9 +9,10 @@ namespace urde
|
||||||
class CAnimationParameters
|
class CAnimationParameters
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ResId x0_ancs;
|
ResId x0_ancs = -1;
|
||||||
s32 x4_charIdx;
|
s32 x4_charIdx = -1;
|
||||||
u32 x8_defaultAnim;
|
u32 x8_defaultAnim = -1;
|
||||||
|
CAnimationParameters() = default;
|
||||||
CAnimationParameters(ResId ancs, s32 charIdx, u32 defaultAnim)
|
CAnimationParameters(ResId ancs, s32 charIdx, u32 defaultAnim)
|
||||||
: x0_ancs(ancs), x4_charIdx(charIdx), x8_defaultAnim(defaultAnim) {}
|
: x0_ancs(ancs), x4_charIdx(charIdx), x8_defaultAnim(defaultAnim) {}
|
||||||
CAnimationParameters(CInputStream& in)
|
CAnimationParameters(CInputStream& in)
|
||||||
|
|
|
@ -26,6 +26,7 @@ class CDamageInfo
|
||||||
float x14_knockback;
|
float x14_knockback;
|
||||||
bool x18_ = false;
|
bool x18_ = false;
|
||||||
public:
|
public:
|
||||||
|
CDamageInfo() = default;
|
||||||
CDamageInfo(CInputStream& in)
|
CDamageInfo(CInputStream& in)
|
||||||
{
|
{
|
||||||
in.readUint32Big();
|
in.readUint32Big();
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
class CStateManager;
|
class CStateManager;
|
||||||
class IVisitor;
|
|
||||||
|
|
||||||
struct SConnection
|
struct SConnection
|
||||||
{
|
{
|
||||||
|
@ -54,7 +53,6 @@ public:
|
||||||
static const std::vector<SConnection> NullConnectionList;
|
static const std::vector<SConnection> NullConnectionList;
|
||||||
virtual ~CEntity() {}
|
virtual ~CEntity() {}
|
||||||
CEntity(TUniqueId uid, const CEntityInfo& info, bool active, const std::string& name);
|
CEntity(TUniqueId uid, const CEntityInfo& info, bool active, const std::string& name);
|
||||||
virtual void Accept(IVisitor&)=0;
|
|
||||||
virtual void PreThink(float, CStateManager&) {}
|
virtual void PreThink(float, CStateManager&) {}
|
||||||
virtual void Think(float, CStateManager&) {}
|
virtual void Think(float, CStateManager&) {}
|
||||||
virtual void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
|
virtual void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
|
||||||
|
|
|
@ -3,6 +3,8 @@ set(WORLD_SOURCES
|
||||||
IGameArea.hpp IGameArea.cpp
|
IGameArea.hpp IGameArea.cpp
|
||||||
CGameArea.hpp CGameArea.cpp
|
CGameArea.hpp CGameArea.cpp
|
||||||
CAi.hpp CAi.cpp
|
CAi.hpp CAi.cpp
|
||||||
|
CAiFuncMap.hpp CAiFuncMap.cpp
|
||||||
|
CPatterned.hpp CPatterned.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
|
||||||
|
@ -30,6 +32,7 @@ set(WORLD_SOURCES
|
||||||
CScriptGrapplePoint.hpp CScriptGrapplePoint.cpp
|
CScriptGrapplePoint.hpp CScriptGrapplePoint.cpp
|
||||||
CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp
|
CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp
|
||||||
CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp
|
CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp
|
||||||
|
CScriptCoverPoint.hpp CScriptCoverPoint.cpp
|
||||||
CGrappleParameters.hpp
|
CGrappleParameters.hpp
|
||||||
CActorParameters.hpp
|
CActorParameters.hpp
|
||||||
CLightParameters.hpp
|
CLightParameters.hpp
|
||||||
|
|
|
@ -4,19 +4,27 @@
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CMaterialList gkPatternedGroundMaterialList;
|
CMaterialList gkPatternedGroundMaterialList(EMaterialTypes::ThirtyThree,
|
||||||
CMaterialList gkPatternedFlyerMaterialList;
|
EMaterialTypes::Nineteen,
|
||||||
|
EMaterialTypes::FourtyOne,
|
||||||
|
EMaterialTypes::Fourty);
|
||||||
|
CMaterialList gkPatternedFlyerMaterialList(EMaterialTypes::ThirtyThree,
|
||||||
|
EMaterialTypes::Nineteen,
|
||||||
|
EMaterialTypes::FourtyOne,
|
||||||
|
EMaterialTypes::ThirtySeven,
|
||||||
|
EMaterialTypes::Fourty);
|
||||||
|
|
||||||
CPatterned::CPatterned(EUnknown, TUniqueId uid, const std::string& name, EFlavorType, const CEntityInfo& info,
|
|
||||||
const zeus::CTransform& xf, CModelData&& mData,
|
CPatterned::CPatterned(EUnknown, TUniqueId uid, const std::string& name, CPatterned::EFlavorType flavor,
|
||||||
const CPatternedInfo& pInfo, EMovementType, EColliderType colType,
|
const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData,
|
||||||
EBodyType, const CActorParameters& actParms)
|
const CPatternedInfo& pInfo, CPatterned::EMovementType moveType, CPatterned::EColliderType,
|
||||||
: CAi(uid, pInfo.xf8_active, name, info, xf, std::move(mData),
|
EBodyType, const CActorParameters& actorParms, u32)
|
||||||
zeus::CAABox(pInfo.xcc_bodyOrigin - zeus::CVector3f{pInfo.xc4_halfExtent, pInfo.xc4_halfExtent, 0.f},
|
: CAi(uid, pInfo.xf8_active, name, info, xf, std::move(mData),
|
||||||
pInfo.xcc_bodyOrigin + zeus::CVector3f{pInfo.xc4_halfExtent, pInfo.xc4_halfExtent, pInfo.xc8_height}),
|
zeus::CAABox(pInfo.xcc_bodyOrigin - zeus::CVector3f{pInfo.xc4_halfExtent, pInfo.xc4_halfExtent, 0.f},
|
||||||
pInfo.x0_mass, pInfo.x54_healthInfo, pInfo.x5c_damageVulnerability,
|
pInfo.xcc_bodyOrigin + zeus::CVector3f{pInfo.xc4_halfExtent, pInfo.xc4_halfExtent, pInfo.xc8_height}),
|
||||||
colType == EColliderType::Flyer ? gkPatternedFlyerMaterialList : gkPatternedGroundMaterialList,
|
pInfo.x0_mass, pInfo.x54_healthInfo, pInfo.x5c_damageVulnerability,
|
||||||
pInfo.xfc_stateMachineId, actParms, pInfo.xd8_, 0.8f)
|
moveType == EMovementType::Flyer ? gkPatternedFlyerMaterialList : gkPatternedGroundMaterialList,
|
||||||
|
pInfo.xfc_stateMachineId, actorParms, pInfo.xd8_, 0.8f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ class CPatternedInfo;
|
||||||
|
|
||||||
enum class EBodyType
|
enum class EBodyType
|
||||||
{
|
{
|
||||||
Two = 2
|
Two = 2,
|
||||||
|
Three
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPatterned : public CAi
|
class CPatterned : public CAi
|
||||||
|
@ -17,29 +18,33 @@ class CPatterned : public CAi
|
||||||
public:
|
public:
|
||||||
enum class EUnknown
|
enum class EUnknown
|
||||||
{
|
{
|
||||||
TwentyThree = 23
|
TwentyThree = 23,
|
||||||
|
ThirtyNine
|
||||||
};
|
};
|
||||||
enum class EFlavorType
|
enum class EFlavorType
|
||||||
{
|
{
|
||||||
Zero = 0
|
Zero = 0
|
||||||
};
|
};
|
||||||
enum class EMovementType
|
enum class EMovementType
|
||||||
{
|
|
||||||
One = 1
|
|
||||||
};
|
|
||||||
enum class EColliderType
|
|
||||||
{
|
{
|
||||||
Ground = 0,
|
Ground = 0,
|
||||||
Flyer = 1
|
Flyer = 1
|
||||||
};
|
};
|
||||||
|
enum class EColliderType
|
||||||
|
{
|
||||||
|
One = 1
|
||||||
|
};
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
CPatterned(EUnknown, TUniqueId, const std::string& name, EFlavorType, const CEntityInfo& info,
|
|
||||||
const zeus::CTransform& xf, CModelData&& mData,
|
|
||||||
const CPatternedInfo& pInfo, EMovementType, EColliderType,
|
|
||||||
EBodyType, const CActorParameters& actParms);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
CPatterned(EUnknown unk, TUniqueId uid, const std::string& name, EFlavorType flavor,
|
||||||
|
const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData,
|
||||||
|
const CPatternedInfo& pinfo, CPatterned::EMovementType movement, EColliderType collider,
|
||||||
|
EBodyType body, const CActorParameters& params, u32 w1);
|
||||||
|
|
||||||
|
virtual void Death(const zeus::CVector3f& , CStateManager& ) {}
|
||||||
|
virtual void KnockBack(const zeus::CVector3f &, CStateManager &) {}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __URDE_CPATTERNED_HPP__
|
#endif // CPATTERNED_HPP
|
||||||
|
|
|
@ -21,8 +21,6 @@ public:
|
||||||
float envFxDensity, float thermalHeat, float xrayFogDistance,
|
float envFxDensity, float thermalHeat, float xrayFogDistance,
|
||||||
float worldLightingLevel, ResId skybox, EPhazonType phazonType);
|
float worldLightingLevel, ResId skybox, EPhazonType phazonType);
|
||||||
|
|
||||||
void Accept(IVisitor&) {}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,4 @@ CScriptCounter::CScriptCounter(TUniqueId uid, const std::string& name, const CEn
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptCounter::Accept(IVisitor&) {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ class CScriptCounter : public CEntity
|
||||||
public:
|
public:
|
||||||
CScriptCounter(TUniqueId, const std::string& name, const CEntityInfo& info,
|
CScriptCounter(TUniqueId, const std::string& name, const CEntityInfo& info,
|
||||||
u32, u32, bool, bool);
|
u32, u32, bool, bool);
|
||||||
virtual void Accept(IVisitor&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,134 @@
|
||||||
|
#include "CScriptCoverPoint.hpp"
|
||||||
|
#include "CActorParameters.hpp"
|
||||||
|
#include "CStateManager.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
CScriptCoverPoint::CScriptCoverPoint(TUniqueId uid, const std::string &name, const CEntityInfo &info,
|
||||||
|
zeus::CTransform xf, bool active, u32 flags, bool crouch, float horizontalAngle, float verticalAngle, float coverTime)
|
||||||
|
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(),
|
||||||
|
CMaterialList(EMaterialTypes::Zero), CActorParameters::None(), kInvalidUniqueId),
|
||||||
|
xe8_flags(flags),
|
||||||
|
xf4_coverTime(coverTime),
|
||||||
|
xf8_24_crouch(crouch)
|
||||||
|
{
|
||||||
|
xec_cosHorizontalAngle = std::cos(zeus::degToRad(horizontalAngle) * 0.5f);
|
||||||
|
xf0_sinVerticalAngle = std::sin(zeus::degToRad(verticalAngle) * 0.5f);
|
||||||
|
zeus::CMatrix4f mtx = xf.toMatrix4f().transposed();
|
||||||
|
x100_touchBounds.emplace(zeus::CAABox({mtx.vec[1].x, mtx.vec[2].y, mtx.vec[3].z},
|
||||||
|
{mtx.vec[1].x, mtx.vec[2].y, mtx.vec[3].z}));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptCoverPoint::Think(float delta, CStateManager&)
|
||||||
|
{
|
||||||
|
if (x11c_timeLeft <= 0.f)
|
||||||
|
return;
|
||||||
|
x11c_timeLeft -= delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
const zeus::CAABox* CScriptCoverPoint::GetTouchBounds() const
|
||||||
|
{
|
||||||
|
if (x100_touchBounds)
|
||||||
|
return &x100_touchBounds.value();
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptCoverPoint::SetInUse(bool inUse)
|
||||||
|
{
|
||||||
|
xf8_25_inUse = inUse;
|
||||||
|
if (inUse)
|
||||||
|
x11c_timeLeft = xf4_coverTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CScriptCoverPoint::GetInUse(TUniqueId uid) const
|
||||||
|
{
|
||||||
|
if (xf8_25_inUse || x11c_timeLeft > 0.f)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (xfa_occupant == kInvalidUniqueId || uid == kInvalidUniqueId || xfa_occupant == uid)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CScriptCoverPoint::Blown(const zeus::CVector3f& point) const
|
||||||
|
{
|
||||||
|
if (!x30_24_active)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (ShouldWallHang())
|
||||||
|
{
|
||||||
|
zeus::CMatrix4f mtx = x34_transform.toMatrix4f().transposed();
|
||||||
|
zeus::CVector3f posDif = point - zeus::CVector3f(mtx.vec[1].x, mtx.vec[2].y, mtx.vec[3].z);
|
||||||
|
posDif *= (1.0 / posDif.magnitude());
|
||||||
|
zeus::CVector3f normDif = posDif.normalized();
|
||||||
|
|
||||||
|
/* zeus::CVector3f unkVec(mtx.vec[0].y, mtx.vec[1].z, mtx.vec[3].x); */
|
||||||
|
zeus::CVector3f unkVec2(mtx.vec[1].z, mtx.vec[0].y, 0.f);
|
||||||
|
unkVec2.normalize();
|
||||||
|
|
||||||
|
if (unkVec2.dot(normDif) <= GetCosHorizontalAngle() || (posDif.z * posDif.z) >= GetSinSqVerticalAngle())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CScriptCoverPoint::GetSinSqVerticalAngle() const
|
||||||
|
{
|
||||||
|
return xf0_sinVerticalAngle * xf0_sinVerticalAngle;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CScriptCoverPoint::GetCosHorizontalAngle() const
|
||||||
|
{
|
||||||
|
return xec_cosHorizontalAngle;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CScriptCoverPoint::ShouldLandHere() const
|
||||||
|
{
|
||||||
|
return xe8_26_landHere;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CScriptCoverPoint::ShouldWallHang() const
|
||||||
|
{
|
||||||
|
return xe8_27_wallHang;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CScriptCoverPoint::ShouldStay() const
|
||||||
|
{
|
||||||
|
return xe8_28_stay;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CScriptCoverPoint::ShouldCrouch() const
|
||||||
|
{
|
||||||
|
return xf8_24_crouch;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CScriptCoverPoint::GetAttackDirection() const
|
||||||
|
{
|
||||||
|
return xe8_flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptCoverPoint::Reserve(TUniqueId id)
|
||||||
|
{
|
||||||
|
xfa_occupant = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptCoverPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||||
|
{
|
||||||
|
CActor::AcceptScriptMsg(msg, uid, mgr);
|
||||||
|
|
||||||
|
if (msg == EScriptObjectMessage::UNKM4)
|
||||||
|
{
|
||||||
|
for (const SConnection& con : x20_conns)
|
||||||
|
if (con.x0_state == EScriptObjectState::Retreat)
|
||||||
|
{
|
||||||
|
xfc_ = mgr.GetIdForScript(con.x8_objId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
#ifndef CSCRIPTCOVERPOINT_HPP
|
||||||
|
#define CSCRIPTCOVERPOINT_HPP
|
||||||
|
|
||||||
|
#include "CActor.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
class CScriptCoverPoint : public CActor
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
bool xe8_26_landHere : 1;
|
||||||
|
bool xe8_27_wallHang : 1;
|
||||||
|
bool xe8_28_stay : 1;
|
||||||
|
};
|
||||||
|
u32 xe8_flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
float xec_cosHorizontalAngle;
|
||||||
|
float xf0_sinVerticalAngle;
|
||||||
|
float xf4_coverTime;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
bool xf8_24_crouch : 1;
|
||||||
|
bool xf8_25_inUse : 1;
|
||||||
|
};
|
||||||
|
u32 xf8_flags = 0;
|
||||||
|
};
|
||||||
|
TUniqueId xfa_occupant = kInvalidUniqueId;
|
||||||
|
TUniqueId xfc_ = kInvalidUniqueId;
|
||||||
|
std::experimental::optional<zeus::CAABox> x100_touchBounds;
|
||||||
|
float x11c_timeLeft = 0.f;
|
||||||
|
public:
|
||||||
|
CScriptCoverPoint(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||||
|
zeus::CTransform xf, bool active, u32 flags, bool crouch, float horizontalAngle, float verticalAngle, float coverTime);
|
||||||
|
|
||||||
|
void Think(float, CStateManager &);
|
||||||
|
void AddToRenderer(const zeus::CFrustum &, CStateManager &) {}
|
||||||
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager &);
|
||||||
|
void Render(CStateManager &) {}
|
||||||
|
const zeus::CAABox* GetTouchBounds() const;
|
||||||
|
void SetInUse(bool inUse);
|
||||||
|
bool GetInUse(TUniqueId uid) const;
|
||||||
|
bool ShouldLandHere() const;
|
||||||
|
bool ShouldWallHang() const;
|
||||||
|
bool ShouldStay() const;
|
||||||
|
bool ShouldCrouch() const;
|
||||||
|
bool Blown(const zeus::CVector3f& pos) const;
|
||||||
|
float GetSinSqVerticalAngle() const;
|
||||||
|
float GetCosHorizontalAngle() const;
|
||||||
|
u32 GetAttackDirection() const;
|
||||||
|
void Reserve(TUniqueId id);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // CSCRIPTCOVERPOINT_HPP
|
|
@ -59,7 +59,7 @@ public:
|
||||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr);
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr);
|
||||||
void Think(float, 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 {}
|
const zeus::CAABox* GetTouchBounds() const { return nullptr; }
|
||||||
void Render(const CStateManager&) {}
|
void Render(const CStateManager&) {}
|
||||||
void ForceClosed(CStateManager&);
|
void ForceClosed(CStateManager&);
|
||||||
bool IsConnectedToArea(const CStateManager& mgr, TAreaId area);
|
bool IsConnectedToArea(const CStateManager& mgr, TAreaId area);
|
||||||
|
|
|
@ -8,7 +8,4 @@ CScriptGenerator::CScriptGenerator(TUniqueId uid, const std::string& name, const
|
||||||
: CEntity(uid, info, active, name)
|
: CEntity(uid, info, active, name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptGenerator::Accept(IVisitor&) {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ class CScriptGenerator : public CEntity
|
||||||
public:
|
public:
|
||||||
CScriptGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
CScriptGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||||
u32, bool, const zeus::CVector3f&, bool, bool, float, float);
|
u32, bool, const zeus::CVector3f&, bool, bool, float, float);
|
||||||
virtual void Accept(IVisitor&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,4 @@ CScriptTimer::CScriptTimer(TUniqueId uid, const std::string& name, const CEntity
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptTimer::Accept(IVisitor&) {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ class CScriptTimer : public CEntity
|
||||||
public:
|
public:
|
||||||
CScriptTimer(TUniqueId, const std::string& name, const CEntityInfo& info,
|
CScriptTimer(TUniqueId, const std::string& name, const CEntityInfo& info,
|
||||||
float, float, bool, bool, bool);
|
float, float, bool, bool, bool);
|
||||||
virtual void Accept(IVisitor&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#include "CStateMachine.hpp"
|
||||||
|
#include "CAi.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
CStateMachine::CStateMachine(CInputStream& in)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
#ifndef CSTATEMACHINE_HPP
|
||||||
|
#define CSTATEMACHINE_HPP
|
||||||
|
|
||||||
|
#include "RetroTypes.hpp"
|
||||||
|
#include "CAiFuncMap.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
class CAiState;
|
||||||
|
class CStateManager;
|
||||||
|
class CAiTrigger
|
||||||
|
{
|
||||||
|
|
||||||
|
float xc_ = 0.f;
|
||||||
|
u32 x10_;
|
||||||
|
bool x18_;
|
||||||
|
public:
|
||||||
|
CAiTrigger() = default;
|
||||||
|
bool GetAnd();
|
||||||
|
void GetState();
|
||||||
|
bool CallFunc(CStateManager&, CAi&)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Setup(CAiTriggerFunc func, bool, float, CAiTrigger*);
|
||||||
|
void Setup(CAiTriggerFunc func, bool, float, CAiState*);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CAiState
|
||||||
|
{
|
||||||
|
CAiStateFunc x0_func;
|
||||||
|
const char* x4_name;
|
||||||
|
u32 x8_;
|
||||||
|
u32 xc_;
|
||||||
|
u32 x10_;
|
||||||
|
u32 x14_;
|
||||||
|
u32 x18_;
|
||||||
|
u32 x1c_;
|
||||||
|
u32 x20_;
|
||||||
|
u32 x24_;
|
||||||
|
u32 x28_;
|
||||||
|
u32 x2c_;
|
||||||
|
u32 x30_;
|
||||||
|
public:
|
||||||
|
CAiState(CAiStateFunc func, const char* name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
u32 GetNumTriggers() const;
|
||||||
|
CAiTrigger& GetTrig(s32) const;
|
||||||
|
const char* GetName() const;
|
||||||
|
void SetTriggers(CAiTrigger* triggers);
|
||||||
|
void SetNumTriggers(s32 numTriggers);
|
||||||
|
void CallFunc(CStateManager& mgr, CAi& ai, EStateMsg msg, float delta) const
|
||||||
|
{
|
||||||
|
if (x0_func)
|
||||||
|
(ai.*x0_func)(mgr, msg, delta);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class CStateMachine
|
||||||
|
{
|
||||||
|
std::vector<CAiState> x0_states;
|
||||||
|
std::vector<CAiTrigger> x10_triggers;
|
||||||
|
public:
|
||||||
|
CStateMachine(CInputStream& in);
|
||||||
|
|
||||||
|
const std::vector<CAiState>& GetStateVector() const { return x0_states; }
|
||||||
|
};
|
||||||
|
|
||||||
|
class CStateMachineState
|
||||||
|
{
|
||||||
|
const CStateMachine* x0_ = nullptr;
|
||||||
|
CAiState* x4_state = nullptr;
|
||||||
|
float x8_ = 0;
|
||||||
|
float xc_ = 0;
|
||||||
|
float x10_ = 0;
|
||||||
|
public:
|
||||||
|
CStateMachineState()=default;
|
||||||
|
void Setup(const CStateMachine* machine)
|
||||||
|
{
|
||||||
|
x0_ = machine;
|
||||||
|
x4_state = nullptr;
|
||||||
|
x8_ = 0.f;
|
||||||
|
xc_ = 0.f;
|
||||||
|
x10_= 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetDelay(float);
|
||||||
|
float GetDelay() const;
|
||||||
|
|
||||||
|
void Update(CStateManager& mgr, CAi& ai, float delta)
|
||||||
|
{
|
||||||
|
x8_ += delta;
|
||||||
|
if (x4_state)
|
||||||
|
x4_state->CallFunc(mgr, ai, EStateMsg::One, delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // CSTATEMACHINE_HPP
|
|
@ -27,8 +27,10 @@
|
||||||
#include "CScriptGrapplePoint.hpp"
|
#include "CScriptGrapplePoint.hpp"
|
||||||
#include "CScriptAreaAttributes.hpp"
|
#include "CScriptAreaAttributes.hpp"
|
||||||
#include "CScriptCameraWaypoint.hpp"
|
#include "CScriptCameraWaypoint.hpp"
|
||||||
|
#include "CScriptCoverPoint.hpp"
|
||||||
#include "Camera/CCinematicCamera.hpp"
|
#include "Camera/CCinematicCamera.hpp"
|
||||||
#include "MP1/CNewIntroBoss.hpp"
|
#include "MP1/CNewIntroBoss.hpp"
|
||||||
|
#include "MP1/CWarWasp.hpp"
|
||||||
#include "CPatternedInfo.hpp"
|
#include "CPatternedInfo.hpp"
|
||||||
#include "CSimplePool.hpp"
|
#include "CSimplePool.hpp"
|
||||||
#include "Collision/CCollidableOBBTreeGroup.hpp"
|
#include "Collision/CCollidableOBBTreeGroup.hpp"
|
||||||
|
@ -44,7 +46,7 @@ static const SObjectTag& GetMorphballDoorANCS()
|
||||||
{
|
{
|
||||||
if (!MorphballDoorANCS)
|
if (!MorphballDoorANCS)
|
||||||
MorphballDoorANCS = static_cast<ProjectResourceFactoryBase*>(g_ResFactory)->
|
MorphballDoorANCS = static_cast<ProjectResourceFactoryBase*>(g_ResFactory)->
|
||||||
TagFromPath(_S("MP1/Shared/ANCS_1F9DA858.blend"));
|
TagFromPath(_S("MP1/Shared/ANCS_1F9DA858.blend"));
|
||||||
return MorphballDoorANCS;
|
return MorphballDoorANCS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,8 +317,8 @@ zeus::CTransform ScriptLoader::ConvertEditorEulerToTransform4f(const zeus::CVect
|
||||||
const zeus::CVector3f& position)
|
const zeus::CVector3f& position)
|
||||||
{
|
{
|
||||||
return zeus::CTransform::RotateZ(zeus::degToRad(orientation.z)) *
|
return zeus::CTransform::RotateZ(zeus::degToRad(orientation.z)) *
|
||||||
zeus::CTransform::RotateY(zeus::degToRad(orientation.y)) *
|
zeus::CTransform::RotateY(zeus::degToRad(orientation.y)) *
|
||||||
zeus::CTransform::RotateX(zeus::degToRad(orientation.x)) + position;
|
zeus::CTransform::RotateX(zeus::degToRad(orientation.x)) + position;
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in,
|
CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in,
|
||||||
|
@ -365,13 +367,13 @@ CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in,
|
||||||
|
|
||||||
CMaterialList list;
|
CMaterialList list;
|
||||||
if (b2)
|
if (b2)
|
||||||
list.Add(EMaterialTypes::SixtyThree);
|
list.Add(EMaterialTypes::Eleven);
|
||||||
|
|
||||||
if (b3)
|
if (b3)
|
||||||
list.Add(EMaterialTypes::Eight);
|
list.Add(EMaterialTypes::Three);
|
||||||
|
|
||||||
if (b4)
|
if (b4)
|
||||||
list.Add(EMaterialTypes::ThirtyTwo);
|
list.Add(EMaterialTypes::Six);
|
||||||
|
|
||||||
bool generateExtent = false;
|
bool generateExtent = false;
|
||||||
if (collisionExtent.x < 0.f || collisionExtent.y < 0.f || collisionExtent.z < 0.f)
|
if (collisionExtent.x < 0.f || collisionExtent.y < 0.f || collisionExtent.z < 0.f)
|
||||||
|
@ -385,7 +387,7 @@ CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in,
|
||||||
aRes.x4_charIdx = aParms.x4_charIdx;
|
aRes.x4_charIdx = aParms.x4_charIdx;
|
||||||
aRes.x8_scale = head.x40_scale;
|
aRes.x8_scale = head.x40_scale;
|
||||||
aRes.x14_ = true;
|
aRes.x14_ = true;
|
||||||
aRes.x1c_defaultAnim = aParms.x8_defaultAnim;
|
aRes.x18_defaultAnim = aParms.x8_defaultAnim;
|
||||||
data = aRes;
|
data = aRes;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -457,7 +459,7 @@ CEntity* ScriptLoader::LoadDoor(CStateManager& mgr, CInputStream& in,
|
||||||
CAnimRes aRes;
|
CAnimRes aRes;
|
||||||
aRes.x0_ancsId = aParms.x0_ancs;
|
aRes.x0_ancsId = aParms.x0_ancs;
|
||||||
aRes.x4_charIdx = aParms.x4_charIdx;
|
aRes.x4_charIdx = aParms.x4_charIdx;
|
||||||
aRes.x1c_defaultAnim = aParms.x8_defaultAnim;
|
aRes.x18_defaultAnim = aParms.x8_defaultAnim;
|
||||||
aRes.x8_scale = head.x40_scale;
|
aRes.x8_scale = head.x40_scale;
|
||||||
|
|
||||||
CModelData mData = aRes;
|
CModelData mData = aRes;
|
||||||
|
@ -562,7 +564,7 @@ CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!g_ResFactory->GetResourceTypeById(partId) &&
|
if (!g_ResFactory->GetResourceTypeById(partId) &&
|
||||||
!g_ResFactory->GetResourceTypeById(elscId))
|
!g_ResFactory->GetResourceTypeById(elscId))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
bool b5 = in.readBool();
|
bool b5 = in.readBool();
|
||||||
|
@ -629,8 +631,8 @@ CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in,
|
||||||
TLockedToken<CCollidableOBBTreeGroup> dclnToken;
|
TLockedToken<CCollidableOBBTreeGroup> dclnToken;
|
||||||
if (dclnType)
|
if (dclnType)
|
||||||
{
|
{
|
||||||
dclnToken = g_SimplePool->GetObj({SBIG('DCLN'), dclnId});
|
dclnToken = g_SimplePool->GetObj({SBIG('DCLN'), dclnId});
|
||||||
dclnToken.GetObj();
|
dclnToken.GetObj();
|
||||||
}
|
}
|
||||||
|
|
||||||
CModelData data;
|
CModelData data;
|
||||||
|
@ -641,7 +643,7 @@ CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in,
|
||||||
aRes.x4_charIdx = aParms.x4_charIdx;
|
aRes.x4_charIdx = aParms.x4_charIdx;
|
||||||
aRes.x8_scale = head.x40_scale;
|
aRes.x8_scale = head.x40_scale;
|
||||||
aRes.x14_ = true;
|
aRes.x14_ = true;
|
||||||
aRes.x1c_defaultAnim = aParms.x8_defaultAnim;
|
aRes.x18_defaultAnim = aParms.x8_defaultAnim;
|
||||||
data = aRes;
|
data = aRes;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -815,7 +817,7 @@ CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in,
|
||||||
res.x4_charIdx = animParms.x4_charIdx;
|
res.x4_charIdx = animParms.x4_charIdx;
|
||||||
res.x8_scale = head.x40_scale;
|
res.x8_scale = head.x40_scale;
|
||||||
res.x14_ = true;
|
res.x14_ = true;
|
||||||
res.x1c_defaultAnim = animParms.x8_defaultAnim;
|
res.x18_defaultAnim = animParms.x8_defaultAnim;
|
||||||
|
|
||||||
return new MP1::CNewIntroBoss(mgr.AllocateUniqueId(), head.x0_name, info,
|
return new MP1::CNewIntroBoss(mgr.AllocateUniqueId(), head.x0_name, info,
|
||||||
head.x10_transform, res, pInfo, actParms, f1, w1,
|
head.x10_transform, res, pInfo, actParms, f1, w1,
|
||||||
|
@ -1004,9 +1006,44 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in,
|
||||||
w21, w22, b5, bitVal0, bitVal0, bitset);
|
w21, w22, b5, bitVal0, bitVal0, bitset);
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity* ScriptLoader::LoadWarwasp(CStateManager& mgr, CInputStream& in,
|
CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in,
|
||||||
int propCount, const CEntityInfo& info)
|
int propCount, const CEntityInfo& info)
|
||||||
{
|
{
|
||||||
|
if (!EnsurePropertyCount(propCount, 13, "WarWasp"))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
std::string name = *mgr.HashInstanceName(in);
|
||||||
|
CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big());
|
||||||
|
zeus::CTransform xf = LoadEditorTransformPivotOnly(in);
|
||||||
|
zeus::CVector3f scale;
|
||||||
|
scale.readBig(in);
|
||||||
|
|
||||||
|
std::pair<bool, u32> verifyPair = CPatternedInfo::HasCorrectParameterCount(in);
|
||||||
|
if (!verifyPair.first)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
CPatternedInfo pInfo(in, verifyPair.second);
|
||||||
|
CActorParameters actorParms = LoadActorParameters(in);
|
||||||
|
CPatterned::EColliderType collider = CPatterned::EColliderType(in.readBool());
|
||||||
|
CDamageInfo damageInfo1(in);
|
||||||
|
ResId weaponDesc = in.readUint32Big();
|
||||||
|
CDamageInfo damageInfo2(in);
|
||||||
|
ResId particle = in.readUint32Big();
|
||||||
|
u32 w1 = in.readUint32Big();
|
||||||
|
|
||||||
|
FourCC animType = g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().x0_ancs);
|
||||||
|
if (animType != SBIG('ANCS'))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
CAnimRes res;
|
||||||
|
res.x0_ancsId = pInfo.GetAnimationParameters().x0_ancs;
|
||||||
|
res.x4_charIdx = pInfo.GetAnimationParameters().x4_charIdx;
|
||||||
|
res.x8_scale = scale;
|
||||||
|
res.x14_ = true;
|
||||||
|
res.x18_defaultAnim = pInfo.GetAnimationParameters().x8_defaultAnim;
|
||||||
|
CModelData mData(res);
|
||||||
|
return new MP1::CWarWasp(mgr.AllocateUniqueId(), name, info, xf, std::move(mData), pInfo, flavor, collider, damageInfo1, actorParms, weaponDesc,
|
||||||
|
damageInfo2, particle, w1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity* ScriptLoader::LoadSpacePirate(CStateManager& mgr, CInputStream& in,
|
CEntity* ScriptLoader::LoadSpacePirate(CStateManager& mgr, CInputStream& in,
|
||||||
|
@ -1037,6 +1074,18 @@ CEntity* ScriptLoader::LoadChozoGhost(CStateManager& mgr, CInputStream& in,
|
||||||
CEntity* ScriptLoader::LoadCoverPoint(CStateManager& mgr, CInputStream& in,
|
CEntity* ScriptLoader::LoadCoverPoint(CStateManager& mgr, CInputStream& in,
|
||||||
int propCount, const CEntityInfo& info)
|
int propCount, const CEntityInfo& info)
|
||||||
{
|
{
|
||||||
|
if (!EnsurePropertyCount(propCount, 9, "CoverPoint"))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
SActorHead head = LoadActorHead(in, mgr);
|
||||||
|
bool b1 = in.readBool();
|
||||||
|
u32 w1 = in.readUint32Big();
|
||||||
|
bool b2 = in.readBool();
|
||||||
|
float f1 = in.readFloatBig();
|
||||||
|
float f2 = in.readFloatBig();
|
||||||
|
float f3 = in.readFloatBig();
|
||||||
|
|
||||||
|
return new CScriptCoverPoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, b1, w1, b2, f1, f2, f3);
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity* ScriptLoader::LoadSpiderBallWaypoint(CStateManager& mgr, CInputStream& in,
|
CEntity* ScriptLoader::LoadSpiderBallWaypoint(CStateManager& mgr, CInputStream& in,
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
static CEntity* LoadCameraShaker(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
static CEntity* LoadCameraShaker(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||||
static CEntity* LoadActorKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
static CEntity* LoadActorKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||||
static CEntity* LoadWater(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
static CEntity* LoadWater(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||||
static CEntity* LoadWarwasp(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
static CEntity* LoadWarWasp(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||||
static CEntity* LoadSpacePirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
static CEntity* LoadSpacePirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||||
static CEntity* LoadFlyingPirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
static CEntity* LoadFlyingPirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||||
static CEntity* LoadElitePirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
static CEntity* LoadElitePirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||||
|
|
|
@ -200,7 +200,8 @@ enum class EScriptObjectMessage
|
||||||
Play,
|
Play,
|
||||||
Alert,
|
Alert,
|
||||||
ObjectAdded = 0x1f,
|
ObjectAdded = 0x1f,
|
||||||
DeleteRequested = 0x20
|
DeleteRequested = 0x20,
|
||||||
|
UNKM4 = 0x23
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue