mirror of https://github.com/AxioDL/metaforce.git
More ScriptLoader imps
This commit is contained in:
parent
c614d2d2d1
commit
76afccbdbe
|
@ -648,7 +648,7 @@ FourCC ProjectResourceFactoryBase::GetResourceTypeById(ResId id) const
|
|||
void ProjectResourceFactoryBase::AsyncIdle()
|
||||
{
|
||||
/* Consume completed transactions, they will be processed this cycle at the latest */
|
||||
std::list<std::unique_ptr<hecl::ClientProcess::Transaction>> completed;
|
||||
std::list<std::shared_ptr<hecl::ClientProcess::Transaction>> completed;
|
||||
m_clientProc.swapCompletedQueue(completed);
|
||||
|
||||
/* Begin self-profiling loop */
|
||||
|
|
|
@ -48,8 +48,8 @@ protected:
|
|||
|
||||
hecl::ProjectPath m_workingPath;
|
||||
hecl::ProjectPath m_cookedPath;
|
||||
const hecl::ClientProcess::CookTransaction* m_cookTransaction = nullptr;
|
||||
const hecl::ClientProcess::BufferTransaction* m_bufTransaction = nullptr;
|
||||
std::shared_ptr<const hecl::ClientProcess::CookTransaction> m_cookTransaction;
|
||||
std::shared_ptr<const hecl::ClientProcess::BufferTransaction> m_bufTransaction;
|
||||
bool m_failed = false;
|
||||
bool m_complete = false;
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "Input/CRumbleManager.hpp"
|
||||
#include "World/CWorld.hpp"
|
||||
#include "Graphics/CLight.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -160,6 +162,8 @@ CStateManager::CStateManager(const std::weak_ptr<CScriptMailbox>&,
|
|||
x904_loaderFuncs[int(EScriptObjectType::NewCameraShaker)] = ScriptLoader::LoadNewCameraShaker;
|
||||
x904_loaderFuncs[int(EScriptObjectType::ShadowProjector)] = ScriptLoader::LoadShadowProjector;
|
||||
x904_loaderFuncs[int(EScriptObjectType::EnergyBall)] = ScriptLoader::LoadEnergyBall;
|
||||
|
||||
x8ec_shadowTex = g_SimplePool->GetObj("DefaultShadow");
|
||||
}
|
||||
|
||||
void CStateManager::RenderLast(TUniqueId)
|
||||
|
|
|
@ -231,6 +231,8 @@ public:
|
|||
CRandom16* GetActiveRandom() {return x8fc_activeRandom;}
|
||||
CRumbleManager& GetRumbleManager() {return *x88c_rumbleManager;}
|
||||
CCameraFilterPass& GetCameraFilterPass(int idx) {return xaf8_camFilterPasses[idx];}
|
||||
|
||||
CWorld* GetWorld() {return x850_world.get();}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "CParticleDatabase.hpp"
|
||||
#include "CPoseAsTransforms.hpp"
|
||||
#include "CHierarchyPoseBuilder.hpp"
|
||||
#include "CAdditiveAnimPlayback.hpp"
|
||||
#include <set>
|
||||
|
||||
enum class EUserEventType
|
||||
|
@ -36,7 +37,6 @@ class CSkinRules;
|
|||
class CAnimTreeNode;
|
||||
class CSegIdList;
|
||||
class CSegStatementSet;
|
||||
class CAdditiveAnimPlayback;
|
||||
class CBoolPOINode;
|
||||
class CInt32POINode;
|
||||
class CParticlePOINode;
|
||||
|
|
|
@ -23,16 +23,16 @@ CModelData::CModelData() {}
|
|||
CModelData CModelData::CModelDataNull() {return CModelData();}
|
||||
|
||||
CModelData::CModelData(const CStaticRes& res)
|
||||
: x0_particleScale(res.x4_particleScale)
|
||||
: x0_particleScale(res.x4_scale)
|
||||
{
|
||||
x1c_normalModel = g_SimplePool->GetObj({SBIG('CMDL'), res.x0_cmdlId});
|
||||
}
|
||||
|
||||
CModelData::CModelData(const CAnimRes& res)
|
||||
: x0_particleScale(res.x8_particleScale)
|
||||
: x0_particleScale(res.x8_scale)
|
||||
{
|
||||
TToken<CCharacterFactory> factory = g_CharFactoryBuilder->GetFactory(res);
|
||||
xc_animData = factory->CreateCharacter(res.x4_charIdx, res.x14_, factory, res.x1c_);
|
||||
xc_animData = factory->CreateCharacter(res.x4_charIdx, res.x14_, factory, res.x1c_defaultAnim);
|
||||
}
|
||||
|
||||
SAdvancementDeltas CModelData::GetAdvancementDeltas(const CCharAnimTime& a,
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "zeus/CColor.hpp"
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CToken.hpp"
|
||||
#include "CAnimData.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -23,16 +24,16 @@ struct SAdvancementDeltas;
|
|||
struct CStaticRes
|
||||
{
|
||||
ResId x0_cmdlId;
|
||||
zeus::CVector3f x4_particleScale;
|
||||
zeus::CVector3f x4_scale;
|
||||
};
|
||||
|
||||
struct CAnimRes
|
||||
{
|
||||
ResId x0_ancsId;
|
||||
u32 x4_charIdx;
|
||||
zeus::CVector3f x8_particleScale;
|
||||
s32 x4_charIdx;
|
||||
zeus::CVector3f x8_scale;
|
||||
bool x14_;
|
||||
int x1c_;
|
||||
s32 x1c_defaultAnim;
|
||||
};
|
||||
|
||||
class CModelData
|
||||
|
@ -53,8 +54,6 @@ class CModelData
|
|||
TLockedToken<CModel> x2c_xrayModel;
|
||||
TLockedToken<CModel> x3c_infraModel;
|
||||
|
||||
CModelData();
|
||||
|
||||
public:
|
||||
enum class EWhichModel
|
||||
{
|
||||
|
@ -67,6 +66,8 @@ public:
|
|||
CModelData(const CStaticRes& res);
|
||||
CModelData(const CAnimRes& res);
|
||||
CModelData(CModelData&&) = default;
|
||||
CModelData& operator=(CModelData&&) = default;
|
||||
CModelData();
|
||||
CModelData CModelDataNull();
|
||||
|
||||
SAdvancementDeltas GetAdvancementDeltas(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
||||
|
|
|
@ -2,4 +2,5 @@ add_library(RuntimeCommonCollision
|
|||
CGameCollision.hpp CGameCollision.cpp
|
||||
CCollisionInfo.hpp CCollisionInfo.cpp
|
||||
CCollidableOBBTree.hpp CCollidableOBBTree.cpp
|
||||
CCollidableOBBTreeGroup.hpp CCollidableOBBTreeGroup.cpp)
|
||||
CCollidableOBBTreeGroup.hpp CCollidableOBBTreeGroup.cpp
|
||||
CMaterialList.hpp)
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef __URDE_CMATERIALLIST_HPP__
|
||||
#define __URDE_CMATERIALLIST_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CMaterialList
|
||||
{
|
||||
friend class ScriptLoader;
|
||||
u64 x0_ = 0;
|
||||
public:
|
||||
CMaterialList() = default;
|
||||
CMaterialList(int idx) : x0_(1 << idx) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CMATERIALLIST_HPP__
|
|
@ -29,6 +29,11 @@ struct SObjectTag
|
|||
in.readBytesToBuf(&type, 4);
|
||||
id = in.readUint32Big();
|
||||
}
|
||||
void readMLVL(CInputStream& in)
|
||||
{
|
||||
id = in.readUint32Big();
|
||||
in.readBytesToBuf(&type, 4);
|
||||
}
|
||||
};
|
||||
|
||||
using TUniqueId = s16;
|
||||
|
|
|
@ -2,4 +2,12 @@
|
|||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CActor::CActor(TUniqueId uid, bool active, const std::string&, const CEntityInfo& info,
|
||||
const zeus::CTransform&, const CModelData&, const CMaterialList&,
|
||||
const CActorParameters&, TUniqueId)
|
||||
: CEntity(uid, info, active)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,9 @@ class CModelData;
|
|||
class CMaterialList;
|
||||
class CActorParameters;
|
||||
class CWeaponMode;
|
||||
class CHealthInfo;
|
||||
class CDamageVulnerability;
|
||||
class CLightParameters;
|
||||
|
||||
class CActor : public CEntity
|
||||
{
|
||||
|
@ -45,6 +48,7 @@ public:
|
|||
const zeus::CTransform&, const CModelData&, const CMaterialList&,
|
||||
const CActorParameters&, TUniqueId);
|
||||
|
||||
virtual void Accept(IVisitor&);
|
||||
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
|
||||
virtual zeus::CVector3f GetAimPosition(const CStateManager&, float)
|
||||
{ return zeus::CVector3f(x40_unknown, x50_unknown, x60_unknown); }
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace urde
|
|||
|
||||
class CActorParameters
|
||||
{
|
||||
friend class ScriptLoader;
|
||||
CLightParameters x4_lightParms;
|
||||
CScannableParameters x40_scanParms;
|
||||
std::pair<ResId, ResId> x44_xrayAssets = {};
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "RetroTypes.hpp"
|
||||
#include "CEntity.hpp"
|
||||
#include "CPhysicsActor.hpp"
|
||||
#include "CDamageVulnerability.hpp"
|
||||
|
||||
#include "zeus/zeus.hpp"
|
||||
|
||||
|
@ -37,57 +38,6 @@ public:
|
|||
CHealthInfo(CInputStream& in) : x0_(in.readFloatBig()), x4_(in.readFloatBig()) {}
|
||||
};
|
||||
|
||||
enum class EVulnerability
|
||||
{
|
||||
};
|
||||
|
||||
class CDamageVulnerability
|
||||
{
|
||||
EVulnerability x0_power;
|
||||
EVulnerability x4_ice;
|
||||
EVulnerability x8_wave;
|
||||
EVulnerability xc_plasma;
|
||||
EVulnerability x10_bomb;
|
||||
EVulnerability x14_powerbomb;
|
||||
EVulnerability x18_missile;
|
||||
EVulnerability x1c_boostBall;
|
||||
EVulnerability x20_phazon;
|
||||
EVulnerability x24_enemyWp1;
|
||||
EVulnerability x28_enemyWp2Poison;
|
||||
EVulnerability x2c_enemyWp3Lava;
|
||||
EVulnerability x30_enemyWp4;
|
||||
EVulnerability x34_unk1;
|
||||
EVulnerability x38_unk2;
|
||||
EVulnerability x3c_unk3;
|
||||
|
||||
#if 0
|
||||
struct ChargedBeams : BigYAML
|
||||
{
|
||||
DECL_YAML
|
||||
Value<atUint32> propertyCount;
|
||||
Value<atUint32> power;
|
||||
Value<atUint32> ice;
|
||||
Value<atUint32> wave;
|
||||
Value<atUint32> plasma;
|
||||
Value<atUint32> phazon;
|
||||
} chargedBeams;
|
||||
|
||||
struct BeamCombos : BigYAML
|
||||
{
|
||||
DECL_YAML
|
||||
Value<atUint32> propertyCount;
|
||||
Value<atUint32> superMissiles;
|
||||
Value<atUint32> iceSpreader;
|
||||
Value<atUint32> wavebuster;
|
||||
Value<atUint32> flameThrower;
|
||||
Value<atUint32> phazonCombo;
|
||||
} beamCombos;
|
||||
#endif
|
||||
|
||||
public:
|
||||
CDamageVulnerability(CInputStream& in) {}
|
||||
};
|
||||
|
||||
class CStateManager;
|
||||
class CAi : public CPhysicsActor
|
||||
{
|
||||
|
|
|
@ -8,10 +8,10 @@ namespace urde
|
|||
|
||||
class CAnimationParameters
|
||||
{
|
||||
public:
|
||||
ResId x0_ancs;
|
||||
s32 x4_charIdx;
|
||||
u32 x8_defaultAnim;
|
||||
public:
|
||||
CAnimationParameters(ResId ancs, s32 charIdx, u32 defaultAnim)
|
||||
: x0_ancs(ancs), x4_charIdx(charIdx), x8_defaultAnim(defaultAnim) {}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
#ifndef __URDE_CDAMAGEVULNERABILITY_HPP__
|
||||
#define __URDE_CDAMAGEVULNERABILITY_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
enum class EVulnerability
|
||||
{
|
||||
DoubleDamage,
|
||||
Normal,
|
||||
Reflect,
|
||||
Immune,
|
||||
PassThrough,
|
||||
DirectDouble,
|
||||
Direct
|
||||
};
|
||||
|
||||
class CDamageVulnerability
|
||||
{
|
||||
EVulnerability x0_power;
|
||||
EVulnerability x4_ice;
|
||||
EVulnerability x8_wave;
|
||||
EVulnerability xc_plasma;
|
||||
EVulnerability x10_bomb;
|
||||
EVulnerability x14_powerbomb;
|
||||
EVulnerability x18_missile;
|
||||
EVulnerability x1c_boostBall;
|
||||
EVulnerability x20_phazon;
|
||||
EVulnerability x24_enemyWp1;
|
||||
EVulnerability x28_enemyWp2Poison;
|
||||
EVulnerability x2c_enemyWp3Lava;
|
||||
EVulnerability x30_enemyWp4;
|
||||
EVulnerability x34_unk1;
|
||||
EVulnerability x38_unk2;
|
||||
|
||||
EVulnerability x3c_chargedPower;
|
||||
EVulnerability x40_chargedIce;
|
||||
EVulnerability x44_chargedWave;
|
||||
EVulnerability x48_chargedPlasma;
|
||||
|
||||
EVulnerability x4c_superMissile;
|
||||
EVulnerability x50_iceSpreader;
|
||||
EVulnerability x54_wavebuster;
|
||||
EVulnerability x58_flamethrower;
|
||||
|
||||
u32 x5c_;
|
||||
u32 x60_;
|
||||
u32 x64_;
|
||||
|
||||
void ConstructNew(CInputStream& in, int propCount)
|
||||
{
|
||||
EVulnerability* vulns = &x0_power;
|
||||
for (int i=0 ; i<std::min(propCount - 3, 15) ; ++i)
|
||||
vulns[i] = EVulnerability(in.readUint32Big());
|
||||
|
||||
if (propCount < 15)
|
||||
{
|
||||
for (int i=propCount ; i<15 ; ++i)
|
||||
vulns[i] = EVulnerability::Reflect;
|
||||
}
|
||||
|
||||
for (int i=15 ; i<propCount ; ++i)
|
||||
in.readUint32Big();
|
||||
|
||||
x5c_ = in.readUint32Big();
|
||||
EVulnerability* vulns2 = &x3c_chargedPower;
|
||||
in.readUint32Big();
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
vulns2[i] = EVulnerability(in.readUint32Big());
|
||||
|
||||
x60_ = in.readUint32Big();
|
||||
EVulnerability* vulns3 = &x4c_superMissile;
|
||||
in.readUint32Big();
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
vulns3[i] = EVulnerability(in.readUint32Big());
|
||||
|
||||
x64_ = in.readUint32Big();
|
||||
}
|
||||
|
||||
public:
|
||||
CDamageVulnerability(CInputStream& in)
|
||||
{
|
||||
u32 propCount = in.readUint32Big();;
|
||||
if (propCount == 11)
|
||||
{
|
||||
EVulnerability* vulns = &x0_power;
|
||||
for (int i=0 ; i<15 ; ++i)
|
||||
vulns[i] = EVulnerability(in.readUint32Big());
|
||||
|
||||
if (propCount == 15)
|
||||
x5c_ = 0;
|
||||
else
|
||||
x5c_ = in.readUint32Big();
|
||||
|
||||
x3c_chargedPower = x0_power;
|
||||
x4c_superMissile = x0_power;
|
||||
x40_chargedIce = x4_ice;
|
||||
x50_iceSpreader = x4_ice;
|
||||
x44_chargedWave = x8_wave;
|
||||
x54_wavebuster = x8_wave;
|
||||
x48_chargedPlasma = xc_plasma;
|
||||
x58_flamethrower = xc_plasma;
|
||||
}
|
||||
else
|
||||
ConstructNew(in, propCount);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CDAMAGEVULNERABILITY_HPP__
|
|
@ -24,6 +24,7 @@ class CEntityInfo
|
|||
public:
|
||||
CEntityInfo(TAreaId aid, const std::vector<SConnection>& conns)
|
||||
: m_aid(aid), m_conns(conns) {}
|
||||
TAreaId GetAreaId() const {return m_aid;}
|
||||
};
|
||||
|
||||
class CEntity
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#include "CGameArea.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
static std::vector<SObjectTag> ReadDependencyList(CInputStream& in)
|
||||
{
|
||||
std::vector<SObjectTag> ret;
|
||||
u32 count = in.readUint32Big();
|
||||
ret.reserve(count);
|
||||
for (int i=0 ; i<count ; ++i)
|
||||
{
|
||||
ret.emplace_back();
|
||||
ret.back().readMLVL(in);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
CGameArea::CGameArea(CInputStream& in, int mlvlVersion)
|
||||
: x4_mlvlVersion(mlvlVersion), xf0_25_(true)
|
||||
{
|
||||
x8_nameSTRG = in.readUint32Big();
|
||||
xc_transform.read34RowMajor(in);
|
||||
x3c_invTransform = xc_transform.inverse();
|
||||
x6c_aabb.readBoundingBoxBig(in);
|
||||
x84_mrea = in.readUint32Big();
|
||||
x88_areaId = in.readUint32Big();
|
||||
|
||||
u32 attachedCount = in.readUint32Big();
|
||||
x8c_attachedAreaIndices.reserve(attachedCount);
|
||||
for (int i=0 ; i<attachedCount ; ++i)
|
||||
x8c_attachedAreaIndices.push_back(in.readUint16Big());
|
||||
|
||||
x9c_deps1 = ReadDependencyList(in);
|
||||
xac_deps2 = ReadDependencyList(in);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -3,7 +3,11 @@
|
|||
|
||||
#include "zeus/CVector2f.hpp"
|
||||
#include "zeus/CColor.hpp"
|
||||
#include "zeus/CAABox.hpp"
|
||||
#include "CToken.hpp"
|
||||
#include "RetroTypes.hpp"
|
||||
#include "IGameArea.hpp"
|
||||
#include "hecl/ClientProcess.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -13,8 +17,40 @@ enum class ERglFogMode
|
|||
Four = 4
|
||||
};
|
||||
|
||||
class CGameArea
|
||||
class CGameArea : public IGameArea
|
||||
{
|
||||
int x4_mlvlVersion;
|
||||
ResId x8_nameSTRG;
|
||||
zeus::CTransform xc_transform;
|
||||
zeus::CTransform x3c_invTransform;
|
||||
zeus::CAABox x6c_aabb;
|
||||
ResId x84_mrea;
|
||||
u32 x88_areaId;
|
||||
std::vector<u16> x8c_attachedAreaIndices;
|
||||
std::vector<SObjectTag> x9c_deps1;
|
||||
std::vector<SObjectTag> xac_deps2;
|
||||
|
||||
std::vector<u32> xbc_;
|
||||
std::vector<Dock> xcc_docks;
|
||||
std::vector<CToken> xdc_tokens;
|
||||
|
||||
u32 xec_totalResourcesSize = 0;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool xf0_24_ : 1;
|
||||
bool xf0_25_ : 1;
|
||||
bool xf0_26_ : 1;
|
||||
bool xf0_27_ : 1;
|
||||
bool xf0_28_ : 1;
|
||||
};
|
||||
u8 _dummy = 0;
|
||||
};
|
||||
|
||||
std::list<std::shared_ptr<const hecl::ClientProcess::BufferTransaction>> xf8_loadTransactions;
|
||||
|
||||
public:
|
||||
class CAreaFog
|
||||
{
|
||||
|
@ -29,6 +65,13 @@ public:
|
|||
void DisableFog();
|
||||
void Update(float dt);
|
||||
};
|
||||
|
||||
CGameArea(CInputStream& in, int mlvlVersion);
|
||||
|
||||
const zeus::CTransform& GetTransform() const {return xc_transform;}
|
||||
const zeus::CTransform& GetInverseTransform() const {return x3c_invTransform;}
|
||||
const zeus::CAABox& GetAABB() const {return x6c_aabb;}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -15,9 +15,12 @@ add_library(RuntimeCommonWorld
|
|||
ScriptObjectSupport.hpp ScriptObjectSupport.cpp
|
||||
ScriptLoader.hpp ScriptLoader.cpp
|
||||
CScriptWater.hpp CScriptWater.cpp
|
||||
CScriptActor.hpp CScriptActor.cpp
|
||||
CScriptWaypoint.hpp CScriptWaypoint.cpp
|
||||
CGrappleParameters.hpp
|
||||
CActorParameters.hpp
|
||||
CLightParameters.hpp
|
||||
CScannableParameters.hpp
|
||||
CVisorParameters.hpp
|
||||
CAnimationParameters.hpp)
|
||||
CAnimationParameters.hpp
|
||||
CDamageVulnerability.hpp)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#include "CPhysicsActor.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CPhysicsActor::CPhysicsActor(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, const CModelData& mData, const CMaterialList& matList,
|
||||
const zeus::CAABox& box, const SMoverData& moverData, const CActorParameters& actorParms,
|
||||
float, float)
|
||||
: CActor(uid, active, name, info, xf, mData, matList, actorParms, kInvalidUniqueId)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
namespace urde
|
||||
{
|
||||
struct SMoverData;
|
||||
|
||||
class CCollisionPrimitive
|
||||
{
|
||||
|
@ -16,6 +17,17 @@ class CCollisionInfoList
|
|||
{
|
||||
};
|
||||
|
||||
struct SMoverData
|
||||
{
|
||||
zeus::CVector3f x0_;
|
||||
zeus::CAxisAngle xc_;
|
||||
zeus::CVector3f x18_;
|
||||
zeus::CAxisAngle x24_;
|
||||
float x30_;
|
||||
|
||||
SMoverData(float a) : x30_(a) {}
|
||||
};
|
||||
|
||||
class CPhysicsActor : public CActor
|
||||
{
|
||||
protected:
|
||||
|
@ -30,6 +42,10 @@ protected:
|
|||
float x230_restitutionCoefModifier;
|
||||
float x234_collisionAccuracyModifier;
|
||||
public:
|
||||
CPhysicsActor(TUniqueId, bool, const std::string&, const CEntityInfo&,
|
||||
const zeus::CTransform&, const CModelData&, const CMaterialList&,
|
||||
const zeus::CAABox&, const SMoverData&, const CActorParameters&,
|
||||
float, float);
|
||||
|
||||
float GetCollisionAccuracyModifier()
|
||||
{ return x234_collisionAccuracyModifier; }
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#include "CScriptActor.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CScriptActor::CScriptActor(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, const CModelData& mData, const zeus::CAABox& aabb, float a, float,
|
||||
const CMaterialList& matList, const CHealthInfo&, const CDamageVulnerability&,
|
||||
const CActorParameters& actParms, bool, bool active, u32, float, bool, bool, bool, bool)
|
||||
: CPhysicsActor(uid, active, name, info, xf, mData, matList, aabb, SMoverData(a), actParms, 0.3f, 0.1f)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef __URDE_CSCRIPTACTOR_HPP__
|
||||
#define __URDE_CSCRIPTACTOR_HPP__
|
||||
|
||||
#include "CPhysicsActor.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CScriptActor : public CPhysicsActor
|
||||
{
|
||||
public:
|
||||
CScriptActor(TUniqueId, const std::string&, const CEntityInfo&,
|
||||
const zeus::CTransform&, const CModelData&, const zeus::CAABox& aabb, float, float,
|
||||
const CMaterialList& matList, const CHealthInfo&, const CDamageVulnerability&,
|
||||
const CActorParameters&, bool, bool, u32, float, bool, bool, bool, bool);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CSCRIPTACTOR_HPP__
|
|
@ -0,0 +1,17 @@
|
|||
#include "CScriptWaypoint.hpp"
|
||||
#include "Character/CModelData.hpp"
|
||||
#include "Collision/CMaterialList.hpp"
|
||||
#include "CActorParameters.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CScriptWaypoint::CScriptWaypoint(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, bool active, float, float,
|
||||
u32, u32, u32, u32, u32, u32, u32)
|
||||
: CActor(uid, active, name, info, xf, CModelData(), CMaterialList(1),
|
||||
CActorParameters::None(), kInvalidUniqueId)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __URDE_CSCRIPTWAYPOINT_HPP__
|
||||
#define __URDE_CSCRIPTWAYPOINT_HPP__
|
||||
|
||||
#include "CActor.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CScriptWaypoint : public CActor
|
||||
{
|
||||
public:
|
||||
CScriptWaypoint(TUniqueId, const std::string&, const CEntityInfo&,
|
||||
const zeus::CTransform&, bool, float, float,
|
||||
u32, u32, u32, u32, u32, u32, u32);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CSCRIPTWAYPOINT_HPP__
|
|
@ -1,11 +1,17 @@
|
|||
#ifndef __URDE_CWORLD_HPP__
|
||||
#define __URDE_CWORLD_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CGameArea;
|
||||
|
||||
class CWorld
|
||||
{
|
||||
std::vector<std::unique_ptr<CGameArea>> x18_areas;
|
||||
public:
|
||||
std::vector<std::unique_ptr<CGameArea>>& GetGameAreas() {return x18_areas;}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef __URDE_IGAMEAREA_HPP__
|
||||
#define __URDE_IGAMEAREA_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class IGameArea
|
||||
{
|
||||
public:
|
||||
class Dock
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_IGAMEAREA_HPP__
|
|
@ -7,6 +7,11 @@
|
|||
#include "CLightParameters.hpp"
|
||||
#include "CAnimationParameters.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CWorld.hpp"
|
||||
#include "Character/CModelData.hpp"
|
||||
#include "Collision/CMaterialList.hpp"
|
||||
#include "CScriptActor.hpp"
|
||||
#include "CScriptWaypoint.hpp"
|
||||
#include "logvisor/logvisor.hpp"
|
||||
|
||||
namespace urde
|
||||
|
@ -71,6 +76,14 @@ static SScaledActorHead LoadScaledActorHead(CInputStream& in, CStateManager& sta
|
|||
return ret;
|
||||
}
|
||||
|
||||
static zeus::CAABox GetCollisionBox(CStateManager& stateMgr, TAreaId id,
|
||||
const zeus::CVector3f& extent, const zeus::CVector3f& offset)
|
||||
{
|
||||
zeus::CAABox box(-extent * 0.5f + offset, extent * 0.5f + offset);
|
||||
zeus::CTransform rot = stateMgr.GetWorld()->GetGameAreas()[id]->GetTransform().getRotation();
|
||||
return box.getTransformedAABox(rot);
|
||||
}
|
||||
|
||||
u32 ScriptLoader::LoadParameterFlags(CInputStream& in)
|
||||
{
|
||||
u32 count = in.readUint32Big();
|
||||
|
@ -242,7 +255,8 @@ zeus::CTransform ScriptLoader::ConvertEditorEulerToTransform4f(const zeus::CVect
|
|||
zeus::CTransform::RotateX(zeus::degToRad(orientation.x)) + position;
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in,
|
||||
int propCount, const CEntityInfo& info)
|
||||
{
|
||||
if (!EnsurePropertyCount(propCount, 24, "Actor"))
|
||||
return nullptr;
|
||||
|
@ -262,11 +276,91 @@ CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in, int propC
|
|||
|
||||
CDamageVulnerability dInfo(in);
|
||||
|
||||
// TODO: Finish
|
||||
ResId staticId = in.readUint32Big();
|
||||
CAnimationParameters aParms = LoadAnimationParameters(in);
|
||||
|
||||
CActorParameters actParms = LoadActorParameters(in);
|
||||
|
||||
bool b1 = in.readBool();
|
||||
bool b2 = in.readBool();
|
||||
bool b3 = in.readBool();
|
||||
bool b4 = in.readBool();
|
||||
bool b5 = in.readBool();
|
||||
u32 w2 = in.readUint32Big();
|
||||
float f3 = in.readFloatBig();
|
||||
bool b6 = in.readBool();
|
||||
bool b7 = in.readBool();
|
||||
bool b8 = in.readBool();
|
||||
bool b9 = in.readBool();
|
||||
|
||||
FourCC animType = g_ResFactory->GetResourceTypeById(aParms.x0_ancs);
|
||||
if (!g_ResFactory->GetResourceTypeById(staticId) && !animType)
|
||||
return nullptr;
|
||||
|
||||
zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), collisionExtent, centroid);
|
||||
|
||||
CMaterialList list;
|
||||
if (b2)
|
||||
list.x0_ = 0x80000000000;
|
||||
|
||||
if (b3)
|
||||
list.x0_ |= 8;
|
||||
|
||||
if (b4)
|
||||
list.x0_ |= 32;
|
||||
|
||||
bool generateExtent = false;
|
||||
if (collisionExtent.x < 0.f || collisionExtent.y < 0.f || collisionExtent.z < 0.f)
|
||||
generateExtent = true;
|
||||
|
||||
CModelData data;
|
||||
if (animType == SBIG('ANCS'))
|
||||
{
|
||||
CAnimRes aRes;
|
||||
aRes.x0_ancsId = aParms.x0_ancs;
|
||||
aRes.x4_charIdx = aParms.x4_charIdx;
|
||||
aRes.x8_scale = head.x40_scale;
|
||||
aRes.x14_ = true;
|
||||
aRes.x1c_defaultAnim = aParms.x8_defaultAnim;
|
||||
data = aRes;
|
||||
}
|
||||
else
|
||||
{
|
||||
CStaticRes sRes;
|
||||
sRes.x0_cmdlId = staticId;
|
||||
sRes.x4_scale = head.x40_scale;
|
||||
data = sRes;
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadWaypoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
if (collisionExtent.isZero() || generateExtent)
|
||||
aabb = data.GetBounds(head.x10_transform.getRotation());
|
||||
|
||||
return new CScriptActor(mgr.AllocateUniqueId(), head.x0_name, info,
|
||||
head.x10_transform, data, aabb, f1, f2, list, hInfo, dInfo,
|
||||
actParms, b1, b5, w2, f3, b6, b7, b8, b9);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadWaypoint(CStateManager& mgr, CInputStream& in,
|
||||
int propCount, const CEntityInfo& info)
|
||||
{
|
||||
if (!EnsurePropertyCount(propCount, 13, "Waypoint"))
|
||||
return nullptr;
|
||||
|
||||
SActorHead head = LoadActorHead(in, mgr);
|
||||
|
||||
bool b1 = in.readBool();
|
||||
float f1 = in.readFloatBig();
|
||||
float f2 = in.readFloatBig();
|
||||
u32 w1 = in.readUint32Big();
|
||||
u32 w2 = in.readUint32Big();
|
||||
u32 w3 = in.readUint32Big();
|
||||
u32 w4 = in.readUint32Big();
|
||||
u32 w5 = in.readUint32Big();
|
||||
u32 w6 = in.readUint32Big();
|
||||
u32 w7 = in.readUint32Big();
|
||||
|
||||
return new CScriptWaypoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform,
|
||||
b1, f1, f2, w1, w2, w3, w4, w5, w6, w7);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadDoorArea(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit dabc519fe168e6a2db839119eb20f706cd39ddac
|
||||
Subproject commit 675d00d08a2713006dd64622ff61ae849f71c06f
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit 4c668ed85828e2ac11c160a2536dce60bc62657d
|
||||
Subproject commit c72304bae2d84106e2474fb08acdd9b127b76d7f
|
Loading…
Reference in New Issue