mirror of https://github.com/AxioDL/metaforce.git
More preliminary implementations
This commit is contained in:
parent
8f78aa5f16
commit
4272e8207b
|
@ -13,13 +13,13 @@ class CAnimPlaybackParms
|
|||
bool xc_;
|
||||
s32 x10_ = 0;
|
||||
s32 x14_ = 0;
|
||||
bool x28_ = false;
|
||||
s32 x2c_ = 0;
|
||||
s32 x30_ = 0;
|
||||
s32 x34_ = 0;
|
||||
bool x18_ = false;
|
||||
s32 x1c_ = 0;
|
||||
s32 x20_ = 0;
|
||||
s32 x24_ = 0;
|
||||
public:
|
||||
CAnimPlaybackParms(s32 a, s32 b, float c, bool d)
|
||||
: x0_(a), x4_(b), xc_(c), x10_(d)
|
||||
: x0_(a), x4_(b), x8_(c), xc_(d)
|
||||
{}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#define __URDE_CCOLLISIONPRIMITIVE_HPP__
|
||||
|
||||
#include "Collision/CMaterialList.hpp"
|
||||
#include <functional>
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
@ -9,16 +11,35 @@ class CCollisionPrimitive
|
|||
{
|
||||
CMaterialList x8_material;
|
||||
public:
|
||||
enum class Type
|
||||
class Type
|
||||
{
|
||||
std::function<void(u32)> x0_setter;
|
||||
const char* x4_info;
|
||||
public:
|
||||
Type() = default;
|
||||
Type(std::function<void(unsigned int)> setter, const char * info)
|
||||
: x0_setter(setter),
|
||||
x4_info(info)
|
||||
{
|
||||
}
|
||||
|
||||
const char* GetInfo() const
|
||||
{
|
||||
return x4_info;
|
||||
}
|
||||
|
||||
std::function<void(u32)> GetSetter() const
|
||||
{
|
||||
return x0_setter;
|
||||
}
|
||||
};
|
||||
|
||||
static void InitBeginTypes();
|
||||
static void InitAddType(Type tp);
|
||||
static void InitAddType(const Type& tp);
|
||||
static void InitEndTypes();
|
||||
|
||||
static void InitBeginColliders();
|
||||
static void InitAddCollider(Type tp);
|
||||
static void InitAddCollider(const Type& tp);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -115,7 +115,6 @@ public:
|
|||
{
|
||||
return xe5_27_useInSortedLists;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ protected:
|
|||
bool x30_24_active : 1;
|
||||
bool x30_25_ : 1;
|
||||
bool x30_26_ : 1;
|
||||
bool x30_27_ : 1;
|
||||
};
|
||||
u8 _dummy = 0;
|
||||
};
|
||||
|
@ -60,7 +61,12 @@ public:
|
|||
bool GetActive() const {return x30_24_active;}
|
||||
virtual void SetActive(bool active) {x30_24_active = active;}
|
||||
|
||||
TAreaId GetAreaId() const { return x4_areaId; }
|
||||
TAreaId GetAreaId() const
|
||||
{
|
||||
if (x30_27_)
|
||||
return x4_areaId;
|
||||
return kInvalidAreaId;
|
||||
}
|
||||
TUniqueId GetUniqueId() const {return x8_uid;}
|
||||
void SendScriptMsgs(EScriptObjectState state, CStateManager& stateMgr, EScriptObjectMessage msg);
|
||||
};
|
||||
|
|
|
@ -4,6 +4,20 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
enum class EEnvFxType
|
||||
{
|
||||
None,
|
||||
Rain,
|
||||
Snow
|
||||
};
|
||||
|
||||
enum class EPhazonType
|
||||
{
|
||||
None,
|
||||
Blue,
|
||||
Orange
|
||||
};
|
||||
|
||||
class CEnvFxManager
|
||||
{
|
||||
};
|
||||
|
|
|
@ -17,14 +17,18 @@ static std::vector<SObjectTag> ReadDependencyList(CInputStream& in)
|
|||
}
|
||||
|
||||
CGameArea::CGameArea(CInputStream& in, int mlvlVersion)
|
||||
: x4_mlvlVersion(mlvlVersion), xf0_25_(true)
|
||||
: x4_mlvlVersion(mlvlVersion), xf0_25_active(true)
|
||||
{
|
||||
x8_nameSTRG = in.readUint32Big();
|
||||
xc_transform.read34RowMajor(in);
|
||||
x3c_invTransform = xc_transform.inverse();
|
||||
x6c_aabb.readBoundingBoxBig(in);
|
||||
|
||||
x84_mrea = in.readUint32Big();
|
||||
if (mlvlVersion > 15)
|
||||
x88_areaId = in.readUint32Big();
|
||||
else
|
||||
x88_areaId = -1;
|
||||
|
||||
u32 attachedCount = in.readUint32Big();
|
||||
x8c_attachedAreaIndices.reserve(attachedCount);
|
||||
|
|
|
@ -41,7 +41,7 @@ class CGameArea : public IGameArea
|
|||
struct
|
||||
{
|
||||
bool xf0_24_ : 1;
|
||||
bool xf0_25_ : 1;
|
||||
bool xf0_25_active : 1;
|
||||
bool xf0_26_ : 1;
|
||||
bool xf0_27_ : 1;
|
||||
bool xf0_28_ : 1;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
add_library(RuntimeCommonWorld
|
||||
CWorld.hpp CWorld.cpp
|
||||
IGameArea.hpp IGameArea.cpp
|
||||
CGameArea.hpp CGameArea.cpp
|
||||
CPathFindArea.hpp CPathFindArea.cpp
|
||||
CAreaOctTree.hpp CAreaOctTree.cpp
|
||||
|
@ -27,6 +28,7 @@ add_library(RuntimeCommonWorld
|
|||
CScriptDock.hpp CScriptDock.cpp
|
||||
CScriptWater.hpp CScriptWater.cpp
|
||||
CScriptGrapplePoint.hpp CScriptGrapplePoint.cpp
|
||||
CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp
|
||||
CGrappleParameters.hpp
|
||||
CActorParameters.hpp
|
||||
CLightParameters.hpp
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#include "CScriptAreaAttributes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CScriptAreaAttributes::CScriptAreaAttributes(TUniqueId uid, const CEntityInfo& info, bool showSkybox, EEnvFxType fxType,
|
||||
float envFxDensity, float thermalHeat, float xrayFogDistance,
|
||||
float worldLightingLevel, ResId skybox, EPhazonType phazonType)
|
||||
: CEntity(uid, info, true, std::string()),
|
||||
x34_24_showSkybox(showSkybox),
|
||||
x38_envFx(fxType),
|
||||
x3c_envFxDensity(envFxDensity),
|
||||
x40_thermalHeat(thermalHeat),
|
||||
x44_xrayFogDistance(xrayFogDistance),
|
||||
x48_worldLightingLevel(worldLightingLevel),
|
||||
x4c_skybox(skybox),
|
||||
x50_phazon(phazonType)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef __URDE_CSCRIPTAREAATTRIBUTES_HPP__
|
||||
#define __URDE_CSCRIPTAREAATTRIBUTES_HPP__
|
||||
|
||||
#include "CEntity.hpp"
|
||||
#include "CEnvFxManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CScriptAreaAttributes : public CEntity
|
||||
{
|
||||
bool x34_24_showSkybox : 1;
|
||||
EEnvFxType x38_envFx;
|
||||
float x3c_envFxDensity;
|
||||
float x40_thermalHeat;
|
||||
float x44_xrayFogDistance;
|
||||
float x48_worldLightingLevel;
|
||||
ResId x4c_skybox;
|
||||
EPhazonType x50_phazon;
|
||||
public:
|
||||
CScriptAreaAttributes(TUniqueId uid, const CEntityInfo& info, bool showSkybox, EEnvFxType fxType,
|
||||
float envFxDensity, float thermalHeat, float xrayFogDistance,
|
||||
float worldLightingLevel, ResId skybox, EPhazonType phazonType);
|
||||
|
||||
void Accept(IVisitor&) {}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __URDE_CSCRIPTAREAATTRIBUTES_HPP__
|
|
@ -25,15 +25,26 @@ static CMaterialList MakeDoorMaterialList(bool material)
|
|||
CScriptDoor::CScriptDoor(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
|
||||
const zeus::CVector3f&, const zeus::CAABox& aabb, bool active,
|
||||
bool material, bool, float, bool ballDoor)
|
||||
bool material, bool b2, float, bool ballDoor)
|
||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeDoorMaterialList(material),
|
||||
aabb, SMoverData(1.f), actParms, 0.3f, 0.1f)
|
||||
aabb, SMoverData(1.f), actParms, 0.3f, 0.1f),
|
||||
x2a8_29_ballDoor(ballDoor),
|
||||
x2a8_25_(material),
|
||||
x2a8_26_(material),
|
||||
x2a8_28_(b2),
|
||||
x2a8_27_(true)
|
||||
{
|
||||
x264_ = GetBoundingBox();
|
||||
x284_modelBounds = x64_modelData->GetBounds(xf.getRotation());
|
||||
|
||||
if (material)
|
||||
SetDoorAnimation(EDoorAnimType::Open);
|
||||
|
||||
SetMass(0.f);
|
||||
}
|
||||
|
||||
/* ORIGINAL 0-00 OFFSET: 8007F054 */
|
||||
zeus::CVector3f CScriptDoor::GetOrbitPosition(const CStateManager &mgr) const
|
||||
zeus::CVector3f CScriptDoor::GetOrbitPosition(const CStateManager& /*mgr*/) const
|
||||
{
|
||||
return x34_transform.m_origin + x29c_;
|
||||
}
|
||||
|
@ -41,6 +52,9 @@ zeus::CVector3f CScriptDoor::GetOrbitPosition(const CStateManager &mgr) const
|
|||
/* ORIGINAL 0-00 OFFSET: 8007E550 */
|
||||
void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager &mgr)
|
||||
{
|
||||
(void)mgr;
|
||||
(void)uid;
|
||||
(void)msg;
|
||||
}
|
||||
|
||||
void CScriptDoor::AddToRenderer(const zeus::CFrustum& /*frustum*/, CStateManager &mgr)
|
||||
|
@ -63,7 +77,7 @@ void CScriptDoor::ForceClosed(CStateManager & mgr)
|
|||
* mgr->x870->x80_->sub_800830F4(x8_uid)
|
||||
*/
|
||||
|
||||
SetDoorAnimation(EDoorAnimType::One);
|
||||
SetDoorAnimation(EDoorAnimType::Close);
|
||||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
||||
|
||||
x25c_ = 0.f;
|
||||
|
@ -103,10 +117,10 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr)
|
|||
const CScriptDoor* door = dynamic_cast<const CScriptDoor*>(mgr.GetObjectById(uid));
|
||||
|
||||
if (door)
|
||||
x27c_otherId = door->x8_uid;
|
||||
x27c_partner = door->x8_uid;
|
||||
|
||||
SetDoorAnimation(EDoorAnimType::Zero);
|
||||
if (x27c_otherId != kInvalidUniqueId)
|
||||
SetDoorAnimation(EDoorAnimType::Open);
|
||||
if (x27c_partner != kInvalidUniqueId)
|
||||
SendScriptMsgs(EScriptObjectState::MaxReached, mgr, EScriptObjectMessage::None);
|
||||
else
|
||||
{
|
||||
|
@ -134,12 +148,10 @@ u32 CScriptDoor::GetDoorOpenCondition(CStateManager& mgr)
|
|||
/* ORIGINAL 0-00 OFFSET: 8007E9D0 */
|
||||
void CScriptDoor::SetDoorAnimation(CScriptDoor::EDoorAnimType type)
|
||||
{
|
||||
x260_doorState = type;
|
||||
CModelData* modelData = x64_modelData.get();
|
||||
if (x260_doorState == EDoorAnimType::Zero)
|
||||
return;
|
||||
|
||||
if (modelData->AnimationData())
|
||||
modelData->AnimationData()->SetAnimation(CAnimPlaybackParms(0, -1, 1.f, true), false);
|
||||
if (modelData && modelData->AnimationData())
|
||||
modelData->AnimationData()->SetAnimation(CAnimPlaybackParms(s32(type), -1, 1.f, true), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,17 +11,19 @@ class CScriptDoor : public CPhysicsActor
|
|||
public:
|
||||
enum class EDoorAnimType
|
||||
{
|
||||
Zero,
|
||||
One,
|
||||
Two,
|
||||
Open,
|
||||
Close,
|
||||
Ready,
|
||||
Three
|
||||
};
|
||||
|
||||
float x25c_;
|
||||
EDoorAnimType x260_doorState = EDoorAnimType::Zero;
|
||||
EDoorAnimType x260_doorState = EDoorAnimType::Open;
|
||||
zeus::CAABox x264_;
|
||||
TUniqueId x27c_otherId = kInvalidUniqueId;
|
||||
TUniqueId x27c_partner = kInvalidUniqueId;
|
||||
TUniqueId x280_ = kInvalidUniqueId;
|
||||
TUniqueId x282_dockId = kInvalidUniqueId;
|
||||
zeus::CAABox x284_modelBounds;
|
||||
|
||||
zeus::CVector3f x29c_;
|
||||
union
|
||||
|
@ -41,7 +43,8 @@ public:
|
|||
bool x2a8_25_ : 1;
|
||||
bool x2a8_26_ : 1;
|
||||
bool x2a8_27_ : 1;
|
||||
bool x2a8_29_ : 1;
|
||||
bool x2a8_28_ : 1;
|
||||
bool x2a8_29_ballDoor : 1;
|
||||
bool x2a8_30_ : 1;
|
||||
};
|
||||
u32 dummy2 = 0;
|
||||
|
|
|
@ -2,18 +2,60 @@
|
|||
#define __URDE_CWORLD_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "ScriptObjectSupport.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CGameArea;
|
||||
class IObjectStore;
|
||||
class CResFactory;
|
||||
|
||||
class CWorld
|
||||
{
|
||||
ResId xc_worldId = -1;
|
||||
ResId x10_ = -1;
|
||||
ResId x24_ = -1;
|
||||
|
||||
std::vector<std::unique_ptr<CGameArea>> x18_areas;
|
||||
|
||||
std::unique_ptr<u8[]> x40_;
|
||||
std::unique_ptr<u8[]> x44_;
|
||||
|
||||
IObjectStore* x60_objectStore;
|
||||
CResFactory* x64_resFactory;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x70_24_ : 1;
|
||||
bool x70_25_ : 1;
|
||||
bool x70_26_ : 1;
|
||||
};
|
||||
};
|
||||
public:
|
||||
|
||||
class CRelay
|
||||
{
|
||||
TEditorId x0_relay = kInvalidEditorId;
|
||||
TEditorId x4_target = kInvalidEditorId;
|
||||
s16 x8_msg = -1;
|
||||
bool xa_active = false;
|
||||
public:
|
||||
CRelay() = default;
|
||||
CRelay(CInputStream& in);
|
||||
|
||||
TEditorId GetRelayId() const { return x0_relay; }
|
||||
TEditorId GetTargetId() const { return x4_target; }
|
||||
s16 GetMessage() const { return x8_msg; }
|
||||
bool GetActive() const { return xa_active; }
|
||||
};
|
||||
|
||||
CWorld(IObjectStore& objStore, CResFactory& resFactory, ResId);
|
||||
std::vector<std::unique_ptr<CGameArea>>& GetGameAreas() {return x18_areas;}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CWORLD_HPP__
|
||||
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
#include "IGameArea.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
IGameArea::Dock::Dock(urde::CInputStream& in, const zeus::CTransform& xf)
|
||||
{
|
||||
u32 refCount = in.readUint32Big();
|
||||
x4_dockReferences.reserve(refCount);
|
||||
for (u32 i = 0 ; i < refCount ; i++)
|
||||
{
|
||||
SDockReference ref;
|
||||
ref.x0_area = in.readUint32Big();
|
||||
ref.x4_dock = in.readUint32Big();
|
||||
x4_dockReferences.push_back(ref);
|
||||
}
|
||||
|
||||
u32 vertCount = in.readUint32Big();
|
||||
|
||||
for (u32 i = 0 ; i < vertCount ; i++)
|
||||
{
|
||||
zeus::CVector3f vert;
|
||||
vert.readBig(in);
|
||||
x14_planeVertices.push_back(xf * vert);
|
||||
}
|
||||
}
|
||||
|
||||
TAreaId IGameArea::Dock::GetConnectedAreaId(s32 other) const
|
||||
{
|
||||
if (other >= x4_dockReferences.size() || other < 0)
|
||||
return kInvalidAreaId;
|
||||
|
||||
return x4_dockReferences[other].x0_area;
|
||||
}
|
||||
|
||||
s16 IGameArea::Dock::GetOtherDockNumber(s32 other) const
|
||||
{
|
||||
if (other >= x4_dockReferences.size() || other < 0)
|
||||
return kInvalidAreaId;
|
||||
|
||||
return x4_dockReferences[other].x4_dock;
|
||||
}
|
||||
|
||||
bool IGameArea::Dock::GetShouldLoadOther(s32 other) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void IGameArea::Dock::SetShouldLoadOther(s32 other, bool should)
|
||||
{
|
||||
}
|
||||
|
||||
bool IGameArea::Dock::ShouldLoadOtherArea(s32 other) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
zeus::CVector3f IGameArea::Dock::GetPoint(s32 idx) const
|
||||
{
|
||||
if (idx >= x14_planeVertices.size() || idx < 0)
|
||||
return zeus::CVector3f();
|
||||
|
||||
return x14_planeVertices[idx];
|
||||
}
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef __URDE_IGAMEAREA_HPP__
|
||||
#define __URDE_IGAMEAREA_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "zeus/CTransform.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
@ -9,9 +12,38 @@ class IGameArea
|
|||
public:
|
||||
class Dock
|
||||
{
|
||||
public:
|
||||
struct SDockReference
|
||||
{
|
||||
u32 x0_area;
|
||||
s16 x4_dock;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x6_16_ : 1;
|
||||
};
|
||||
u16 x6_ = 0;
|
||||
};
|
||||
SDockReference() = default;
|
||||
};
|
||||
private:
|
||||
u32 x0_ = 0;
|
||||
std::vector<SDockReference> x4_dockReferences;
|
||||
rstl::reserved_vector<zeus::CVector3f, 4> x14_planeVertices;
|
||||
bool x48_;
|
||||
public:
|
||||
|
||||
u32 GetReferenceCount() const { return x0_; }
|
||||
Dock(CInputStream& in, const zeus::CTransform& xf);
|
||||
TAreaId GetConnectedAreaId(s32 other) const;
|
||||
s16 GetOtherDockNumber(s32 other) const;
|
||||
bool GetShouldLoadOther(s32 other) const;
|
||||
void SetShouldLoadOther(s32 other, bool should);
|
||||
bool ShouldLoadOtherArea(s32 other) const;
|
||||
zeus::CVector3f GetPoint(s32 idx) const;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_IGAMEAREA_HPP__
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "CScriptSound.hpp"
|
||||
#include "CScriptGenerator.hpp"
|
||||
#include "CScriptGrapplePoint.hpp"
|
||||
#include "CScriptAreaAttributes.hpp"
|
||||
#include "Camera/CCinematicCamera.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
#include "Collision/CCollidableOBBTreeGroup.hpp"
|
||||
|
@ -1163,6 +1164,24 @@ CEntity* ScriptLoader::LoadFlaahgra(CStateManager& mgr, CInputStream& in,
|
|||
CEntity* ScriptLoader::LoadAreaAttributes(CStateManager& mgr, CInputStream& in,
|
||||
int propCount, const CEntityInfo& info)
|
||||
{
|
||||
if (!EnsurePropertyCount(propCount, 9, "AreaAttributes"))
|
||||
return nullptr;
|
||||
|
||||
bool load = in.readUint32Big() != 0;
|
||||
if (!load)
|
||||
return nullptr;
|
||||
|
||||
bool showSkybox = in.readBool();
|
||||
EEnvFxType fxType = EEnvFxType(in.readUint32Big());
|
||||
float envFxDensity = in.readFloatBig();
|
||||
float thermalHeat = in.readFloatBig();
|
||||
float xrayFogDistance = in.readFloatBig();
|
||||
float worldLightingLevel = in.readFloatBig();
|
||||
ResId skybox = in.readUint32Big();
|
||||
EPhazonType phazonType = EPhazonType(in.readUint32Big());
|
||||
|
||||
return new CScriptAreaAttributes(mgr.AllocateUniqueId(), info, showSkybox, fxType, envFxDensity, thermalHeat,
|
||||
xrayFogDistance, worldLightingLevel, skybox, phazonType);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadFishCloud(CStateManager& mgr, CInputStream& in,
|
||||
|
|
Loading…
Reference in New Issue