mirror of https://github.com/AxioDL/metaforce.git
Various implementatations
This commit is contained in:
parent
10dcbaa6c9
commit
00a98bce85
|
@ -138,6 +138,7 @@ public:
|
|||
const zeus::CVector3f& heading, const zeus::CVector3f& up,
|
||||
u8 vol);
|
||||
|
||||
static void RemoveEmitter(const CSfxHandle&) {}
|
||||
static u16 TranslateSFXID(u16);
|
||||
};
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ void CCameraManager::SetInsideFluid(bool val, TUniqueId fluidId)
|
|||
void CCameraManager::Update(float dt, CStateManager& stateMgr)
|
||||
{
|
||||
const CGameCamera* camera = GetCurrentCamera(stateMgr);
|
||||
zeus::CVector3f heading = camera->GetTransform().m_basis * zeus::CVector3f{0.f, 1.f, 0.f};
|
||||
CSfxManager::UpdateListener(camera->GetTransform().m_origin, zeus::CVector3f::skZero,
|
||||
zeus::CVector3f heading = camera->GetTransform().basis * zeus::CVector3f{0.f, 1.f, 0.f};
|
||||
CSfxManager::UpdateListener(camera->GetTransform().origin, zeus::CVector3f::skZero,
|
||||
heading, {0.f, 0.f, 1.f}, 0x7f);
|
||||
x30_shakeOffset = zeus::CVector3f::skZero;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ CAnimData::CAnimData(ResId id,
|
|||
int defaultAnim, int charIdx, bool loop,
|
||||
const TLockedToken<CCharLayoutInfo>& layout,
|
||||
const TToken<CSkinnedModel>& model,
|
||||
const std::experimental::optional<TToken<CMorphableSkinnedModel>>& iceModel,
|
||||
const rstl::optional_object<TToken<CMorphableSkinnedModel>>& iceModel,
|
||||
const std::weak_ptr<CAnimSysContext>& ctx,
|
||||
const std::shared_ptr<CAnimationManager>& animMgr,
|
||||
const std::shared_ptr<CTransitionManager>& transMgr,
|
||||
|
@ -199,13 +199,13 @@ void CAnimData::RenderAuxiliary(const CFrustumPlanes& frustum) const
|
|||
}
|
||||
|
||||
void CAnimData::Render(const CSkinnedModel& model, const CModelFlags& drawFlags,
|
||||
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
||||
const rstl::optional_object<CVertexMorphEffect>& morphEffect,
|
||||
const float* morphMagnitudes) const
|
||||
{
|
||||
}
|
||||
|
||||
void CAnimData::SetupRender(const CSkinnedModel& model,
|
||||
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
||||
const rstl::optional_object<CVertexMorphEffect>& morphEffect,
|
||||
const float* morphMagnitudes) const
|
||||
{
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ void CAnimData::SetInfraModel(const TLockedToken<CModel>& model, const TLockedTo
|
|||
}
|
||||
|
||||
void CAnimData::PoseSkinnedModel(const CSkinnedModel& model, const CPoseAsTransforms& pose,
|
||||
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
||||
const rstl::optional_object<CVertexMorphEffect>& morphEffect,
|
||||
const float* morphMagnitudes) const
|
||||
{
|
||||
}
|
||||
|
|
|
@ -182,6 +182,7 @@ public:
|
|||
|
||||
static void FreeCache();
|
||||
static void InitializeCache();
|
||||
const CParticleDatabase& GetParticleDB() const { return x120_particleDB; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ CCharacterFactory::CreateCharacter(int charIdx, bool loop,
|
|||
TToken<CSkinnedModel> skinnedModel =
|
||||
((CCharacterFactory*)this)->x70_cacheResPool.GetObj({FourCC(), charInfo.GetModelId()}, charParm);
|
||||
|
||||
std::experimental::optional<TToken<CMorphableSkinnedModel>> iceModel;
|
||||
rstl::optional_object<TToken<CMorphableSkinnedModel>> iceModel;
|
||||
if (charInfo.GetIceModelId() && charInfo.GetIceSkinRulesId())
|
||||
iceModel.emplace(((CCharacterFactory*)this)->x70_cacheResPool.GetObj({FourCC(1), charInfo.GetIceModelId()}, charParm));
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ void CHierarchyPoseBuilder::BuildTransform(const CSegId& boneId, zeus::CTransfor
|
|||
}
|
||||
|
||||
xfOut.setRotation(accumXF);
|
||||
xfOut.m_origin = accumPos;
|
||||
xfOut.origin = accumPos;
|
||||
}
|
||||
|
||||
void CHierarchyPoseBuilder::BuildNoScale(CPoseAsTransforms& pose)
|
||||
|
|
|
@ -32,14 +32,14 @@ CModelData::CModelData(const CAnimRes& res)
|
|||
: x0_particleScale(res.GetScale())
|
||||
{
|
||||
TToken<CCharacterFactory> factory = g_CharFactoryBuilder->GetFactory(res);
|
||||
xc_animData = factory->CreateCharacter(res.GetCharacterNodeId(), res.CanLoop(), factory, res.GetDefaultAnim());
|
||||
x10_animData = factory->CreateCharacter(res.GetCharacterNodeId(), res.CanLoop(), factory, res.GetDefaultAnim());
|
||||
}
|
||||
|
||||
SAdvancementDeltas CModelData::GetAdvancementDeltas(const CCharAnimTime& a,
|
||||
const CCharAnimTime& b) const
|
||||
{
|
||||
if (xc_animData)
|
||||
return xc_animData->GetAdvancementDeltas(a, b);
|
||||
if (x10_animData)
|
||||
return x10_animData->GetAdvancementDeltas(a, b);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
@ -69,14 +69,14 @@ const CSkinnedModel& CModelData::PickAnimatedModel(EWhichModel which) const
|
|||
switch (which)
|
||||
{
|
||||
case EWhichModel::XRay:
|
||||
ret = xc_animData->xf4_xrayModel.get();
|
||||
ret = x10_animData->xf4_xrayModel.get();
|
||||
case EWhichModel::Thermal:
|
||||
ret = xc_animData->xf8_infraModel.get();
|
||||
ret = x10_animData->xf8_infraModel.get();
|
||||
default: break;
|
||||
}
|
||||
if (ret)
|
||||
return *ret;
|
||||
return *xc_animData->xd8_modelData.GetObj();
|
||||
return *x10_animData->xd8_modelData.GetObj();
|
||||
}
|
||||
|
||||
const TLockedToken<CModel>& CModelData::PickStaticModel(EWhichModel which) const
|
||||
|
@ -101,10 +101,10 @@ void CModelData::SetXRayModel(const std::pair<ResId, ResId>& modelSkin)
|
|||
{
|
||||
if (g_ResFactory->GetResourceTypeById(modelSkin.first) == SBIG('CMDL'))
|
||||
{
|
||||
if (xc_animData && modelSkin.second &&
|
||||
if (x10_animData && modelSkin.second &&
|
||||
g_ResFactory->GetResourceTypeById(modelSkin.second) == SBIG('CSKR'))
|
||||
{
|
||||
xc_animData->SetXRayModel(g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first}),
|
||||
x10_animData->SetXRayModel(g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first}),
|
||||
g_SimplePool->GetObj({SBIG('CSKR'), modelSkin.second}));
|
||||
}
|
||||
else
|
||||
|
@ -121,10 +121,10 @@ void CModelData::SetInfraModel(const std::pair<ResId, ResId>& modelSkin)
|
|||
{
|
||||
if (g_ResFactory->GetResourceTypeById(modelSkin.first) == SBIG('CMDL'))
|
||||
{
|
||||
if (xc_animData && modelSkin.second &&
|
||||
if (x10_animData && modelSkin.second &&
|
||||
g_ResFactory->GetResourceTypeById(modelSkin.second) == SBIG('CSKR'))
|
||||
{
|
||||
xc_animData->SetInfraModel(g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first}),
|
||||
x10_animData->SetInfraModel(g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first}),
|
||||
g_SimplePool->GetObj({SBIG('CSKR'), modelSkin.second}));
|
||||
}
|
||||
else
|
||||
|
@ -137,7 +137,7 @@ void CModelData::SetInfraModel(const std::pair<ResId, ResId>& modelSkin)
|
|||
|
||||
bool CModelData::IsDefinitelyOpaque(EWhichModel which) const
|
||||
{
|
||||
if (xc_animData)
|
||||
if (x10_animData)
|
||||
{
|
||||
const CSkinnedModel& model = PickAnimatedModel(which);
|
||||
return model.GetModel()->GetInstance().IsOpaque();
|
||||
|
@ -151,51 +151,51 @@ bool CModelData::IsDefinitelyOpaque(EWhichModel which) const
|
|||
|
||||
bool CModelData::GetIsLoop() const
|
||||
{
|
||||
if (!xc_animData)
|
||||
if (!x10_animData)
|
||||
return false;
|
||||
return xc_animData->GetIsLoop();
|
||||
return x10_animData->GetIsLoop();
|
||||
}
|
||||
|
||||
float CModelData::GetAnimationDuration(int idx) const
|
||||
{
|
||||
if (!xc_animData)
|
||||
if (!x10_animData)
|
||||
return 0.f;
|
||||
return xc_animData->GetAnimationDuration(idx);
|
||||
return x10_animData->GetAnimationDuration(idx);
|
||||
}
|
||||
|
||||
void CModelData::EnableLooping(bool enable)
|
||||
{
|
||||
if (!xc_animData)
|
||||
if (!x10_animData)
|
||||
return;
|
||||
xc_animData->EnableLooping(enable);
|
||||
x10_animData->EnableLooping(enable);
|
||||
}
|
||||
|
||||
void CModelData::AdvanceParticles(const zeus::CTransform& xf, float dt,
|
||||
CStateManager& stateMgr)
|
||||
{
|
||||
if (!xc_animData)
|
||||
if (!x10_animData)
|
||||
return;
|
||||
xc_animData->AdvanceParticles(xf, dt, x0_particleScale, stateMgr);
|
||||
x10_animData->AdvanceParticles(xf, dt, x0_particleScale, stateMgr);
|
||||
}
|
||||
|
||||
zeus::CAABox CModelData::GetBounds() const
|
||||
{
|
||||
if (xc_animData)
|
||||
if (x10_animData)
|
||||
{
|
||||
return xc_animData->GetBoundingBox(zeus::CTransform::Scale(x0_particleScale));
|
||||
return x10_animData->GetBoundingBox(zeus::CTransform::Scale(x0_particleScale));
|
||||
}
|
||||
else
|
||||
{
|
||||
const zeus::CAABox& aabb = x1c_normalModel->GetAABB();
|
||||
return zeus::CAABox(aabb.m_min * x0_particleScale, aabb.m_max * x0_particleScale);
|
||||
return zeus::CAABox(aabb.min * x0_particleScale, aabb.max * x0_particleScale);
|
||||
}
|
||||
}
|
||||
|
||||
zeus::CAABox CModelData::GetBounds(const zeus::CTransform& xf) const
|
||||
{
|
||||
zeus::CTransform xf2 = xf * zeus::CTransform::Scale(x0_particleScale);
|
||||
if (xc_animData)
|
||||
return xc_animData->GetBoundingBox(xf2);
|
||||
if (x10_animData)
|
||||
return x10_animData->GetBoundingBox(xf2);
|
||||
else
|
||||
return x1c_normalModel->GetAABB().getTransformedAABox(xf2);
|
||||
}
|
||||
|
@ -204,75 +204,75 @@ zeus::CTransform CModelData::GetScaledLocatorTransformDynamic(const std::string&
|
|||
const CCharAnimTime* time) const
|
||||
{
|
||||
zeus::CTransform xf = GetLocatorTransformDynamic(name, time);
|
||||
xf.m_origin *= x0_particleScale;
|
||||
xf.origin *= x0_particleScale;
|
||||
return xf;
|
||||
}
|
||||
|
||||
zeus::CTransform CModelData::GetScaledLocatorTransform(const std::string& name) const
|
||||
{
|
||||
zeus::CTransform xf = GetLocatorTransform(name);
|
||||
xf.m_origin *= x0_particleScale;
|
||||
xf.origin *= x0_particleScale;
|
||||
return xf;
|
||||
}
|
||||
|
||||
zeus::CTransform CModelData::GetLocatorTransformDynamic(const std::string& name,
|
||||
const CCharAnimTime* time) const
|
||||
{
|
||||
if (xc_animData)
|
||||
return xc_animData->GetLocatorTransform(name, time);
|
||||
if (x10_animData)
|
||||
return x10_animData->GetLocatorTransform(name, time);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
zeus::CTransform CModelData::GetLocatorTransform(const std::string& name) const
|
||||
{
|
||||
if (xc_animData)
|
||||
return xc_animData->GetLocatorTransform(name, nullptr);
|
||||
if (x10_animData)
|
||||
return x10_animData->GetLocatorTransform(name, nullptr);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
SAdvancementDeltas CModelData::AdvanceAnimationIgnoreParticles(float dt, CRandom16& rand, bool flag)
|
||||
{
|
||||
if (xc_animData)
|
||||
return xc_animData->AdvanceIgnoreParticles(dt, rand, flag);
|
||||
if (x10_animData)
|
||||
return x10_animData->AdvanceIgnoreParticles(dt, rand, flag);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
SAdvancementDeltas CModelData::AdvanceAnimation(float dt, CStateManager& stateMgr, bool flag)
|
||||
{
|
||||
if (xc_animData)
|
||||
return xc_animData->Advance(dt, x0_particleScale, stateMgr, flag);
|
||||
if (x10_animData)
|
||||
return x10_animData->Advance(dt, x0_particleScale, stateMgr, flag);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
bool CModelData::IsAnimating() const
|
||||
{
|
||||
if (!xc_animData)
|
||||
if (!x10_animData)
|
||||
return false;
|
||||
return xc_animData->IsAnimating();
|
||||
return x10_animData->IsAnimating();
|
||||
}
|
||||
|
||||
bool CModelData::IsInFrustum(const zeus::CTransform& xf,
|
||||
const CFrustumPlanes& frustum) const
|
||||
{
|
||||
if (!xc_animData && !x1c_normalModel)
|
||||
if (!x10_animData && !x1c_normalModel)
|
||||
return true;
|
||||
return frustum.BoxInFrustumPlanes(GetBounds(xf));
|
||||
}
|
||||
|
||||
void CModelData::RenderParticles(const CFrustumPlanes& frustum) const
|
||||
{
|
||||
if (xc_animData)
|
||||
xc_animData->RenderAuxiliary(frustum);
|
||||
if (x10_animData)
|
||||
x10_animData->RenderAuxiliary(frustum);
|
||||
}
|
||||
|
||||
void CModelData::Touch(EWhichModel which, int shaderIdx) const
|
||||
{
|
||||
if (xc_animData)
|
||||
xc_animData->Touch(PickAnimatedModel(which), shaderIdx);
|
||||
if (x10_animData)
|
||||
x10_animData->Touch(PickAnimatedModel(which), shaderIdx);
|
||||
else
|
||||
PickStaticModel(which)->Touch(shaderIdx);
|
||||
}
|
||||
|
@ -290,10 +290,10 @@ void CModelData::RenderThermal(const zeus::CTransform& xf,
|
|||
CModelFlags drawFlags;
|
||||
drawFlags.m_extendedShaderIdx = 3;
|
||||
|
||||
if (xc_animData)
|
||||
if (x10_animData)
|
||||
{
|
||||
const CSkinnedModel& model = PickAnimatedModel(EWhichModel::Thermal);
|
||||
xc_animData->SetupRender(model, {}, nullptr);
|
||||
x10_animData->SetupRender(model, {}, nullptr);
|
||||
model.Draw(drawFlags);
|
||||
}
|
||||
else
|
||||
|
@ -307,7 +307,7 @@ void CModelData::RenderUnsortedParts(EWhichModel which, const zeus::CTransform&
|
|||
const CActorLights* lights, const CModelFlags& drawFlags) const
|
||||
{
|
||||
if ((x14_25_sortThermal && which == EWhichModel::Thermal) ||
|
||||
xc_animData || !x1c_normalModel || drawFlags.m_blendMode > 2)
|
||||
x10_animData || !x1c_normalModel || drawFlags.m_blendMode > 2)
|
||||
{
|
||||
((CModelData*)this)->x14_24_renderSorted = false;
|
||||
return;
|
||||
|
@ -347,9 +347,9 @@ void CModelData::Render(EWhichModel which, const zeus::CTransform& xf,
|
|||
// Also set ambient to x18_ambientColor
|
||||
}
|
||||
|
||||
if (xc_animData)
|
||||
if (x10_animData)
|
||||
{
|
||||
xc_animData->Render(PickAnimatedModel(which), drawFlags, {}, nullptr);
|
||||
x10_animData->Render(PickAnimatedModel(which), drawFlags, {}, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -65,7 +65,8 @@ class CModelData
|
|||
{
|
||||
friend class CActor;
|
||||
zeus::CVector3f x0_particleScale;
|
||||
std::unique_ptr<CAnimData> xc_animData;
|
||||
bool xc_ = false;
|
||||
std::unique_ptr<CAnimData> x10_animData;
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
@ -128,7 +129,7 @@ public:
|
|||
void Render(EWhichModel, const zeus::CTransform& xf,
|
||||
const CActorLights* lights, const CModelFlags& drawFlags) const;
|
||||
|
||||
CAnimData* AnimationData() { return xc_animData.get(); }
|
||||
CAnimData* AnimationData() { return x10_animData.get(); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -51,6 +51,11 @@ CPASAnimState::CPASAnimState(CInputStream& in)
|
|||
}
|
||||
}
|
||||
|
||||
const CPASAnimParmData&CPASAnimState::GetAnimParmData(s32, u32) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::pair<float, s32> CPASAnimState::FindBestAnimation(const rstl::reserved_vector<CPASAnimParm, 8>&, CRandom16&, s32) const
|
||||
{
|
||||
}
|
||||
|
|
|
@ -40,10 +40,10 @@ public:
|
|||
|
||||
bool HasState(s32 id) const
|
||||
{
|
||||
for (const CPASAnimState& state : x0_states)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
const auto& st = std::find_if(x0_states.begin(), x0_states.end(),
|
||||
[&id](const CPASAnimState& other)->bool
|
||||
{ return other.GetStateId() == id; });
|
||||
return st != x0_states.end();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -39,13 +39,13 @@ const zeus::CTransform& CPoseAsTransforms::GetTransform(const CSegId& id) const
|
|||
const zeus::CVector3f& CPoseAsTransforms::GetOffset(const CSegId& id) const
|
||||
{
|
||||
const std::pair<CSegId, CSegId>& link = x8_links[id];
|
||||
return xd0_transformArr[link.second].m_origin;
|
||||
return xd0_transformArr[link.second].origin;
|
||||
}
|
||||
|
||||
const zeus::CMatrix3f& CPoseAsTransforms::GetRotation(const CSegId& id) const
|
||||
{
|
||||
const std::pair<CSegId, CSegId>& link = x8_links[id];
|
||||
return xd0_transformArr[link.second].m_basis;
|
||||
return xd0_transformArr[link.second].basis;
|
||||
}
|
||||
|
||||
void CPoseAsTransforms::Insert(const CSegId& id,
|
||||
|
|
|
@ -19,7 +19,7 @@ bool CFrustumPlanes::BoxInFrustumPlanes(const zeus::CAABox& box) const
|
|||
{
|
||||
}
|
||||
|
||||
bool CFrustumPlanes::BoxInFrustumPlanes(const std::experimental::optional<zeus::CAABox>& box) const
|
||||
bool CFrustumPlanes::BoxInFrustumPlanes(const rstl::optional_object<zeus::CAABox>& box) const
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "zeus/CTransform.hpp"
|
||||
#include "zeus/CAABox.hpp"
|
||||
#include "optional.hpp"
|
||||
#include "rstl.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ public:
|
|||
bool PointInFrustumPlanes(const zeus::CVector3f& point) const;
|
||||
bool SphereInFrustumPlanes(const zeus::CSphere& sphere) const;
|
||||
bool BoxInFrustumPlanes(const zeus::CAABox& box) const;
|
||||
bool BoxInFrustumPlanes(const std::experimental::optional<zeus::CAABox>& box) const;
|
||||
bool BoxInFrustumPlanes(const rstl::optional_object<zeus::CAABox>& box) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -103,8 +103,8 @@ void CGraphics::SetAlphaCompare(ERglAlphaFunc comp0, u8 ref0, ERglAlphaOp op, ER
|
|||
void CGraphics::SetViewPointMatrix(const zeus::CTransform& xf)
|
||||
{
|
||||
g_ViewMatrix = xf;
|
||||
g_ViewPoint = xf.m_origin;
|
||||
zeus::CMatrix3f tmp(xf.m_basis[0], xf.m_basis[2], -xf.m_basis[1]);
|
||||
g_ViewPoint = xf.origin;
|
||||
zeus::CMatrix3f tmp(xf.basis[0], xf.basis[2], -xf.basis[1]);
|
||||
g_GXViewPointMatrix = zeus::CTransform(tmp.transposed());
|
||||
SetViewMatrix();
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ void CGraphics::SetViewMatrix()
|
|||
/* Load position matrix */
|
||||
/* Inverse-transpose */
|
||||
g_GXModelViewInvXpose = g_GXModelView.inverse();
|
||||
g_GXModelViewInvXpose.m_origin.zeroOut();
|
||||
g_GXModelViewInvXpose.m_basis.transpose();
|
||||
g_GXModelViewInvXpose.origin.zeroOut();
|
||||
g_GXModelViewInvXpose.basis.transpose();
|
||||
/* Load normal matrix */
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace urde
|
|||
static logvisor::Module Log("urde::CModelBoo");
|
||||
bool CBooModel::g_DrawingOccluders = false;
|
||||
|
||||
static std::experimental::optional<CModelShaders> g_ModelShaders;
|
||||
static rstl::optional_object<CModelShaders> g_ModelShaders;
|
||||
|
||||
CBooModel::CBooModel(std::vector<CBooSurface>* surfaces, SShader& shader,
|
||||
boo::IVertexFormat* vtxFmt, boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo,
|
||||
|
@ -204,7 +204,7 @@ void CBooModel::ActivateLights(const std::vector<CLight>& lights)
|
|||
continue;
|
||||
CModelShaders::Light& lightOut = m_lightingData.lights[curLight++];
|
||||
lightOut.pos = CGraphics::g_CameraMatrix * light.x0_pos;
|
||||
lightOut.dir = CGraphics::g_CameraMatrix.m_basis * light.xc_dir;
|
||||
lightOut.dir = CGraphics::g_CameraMatrix.basis * light.xc_dir;
|
||||
lightOut.dir.normalize();
|
||||
lightOut.color = light.x18_color;
|
||||
lightOut.linAtt[0] = light.x24_distC;
|
||||
|
@ -372,14 +372,14 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
|
|||
matrixOut.vec[0].x = 0.5f;
|
||||
matrixOut.vec[1].y = 0.0f;
|
||||
matrixOut.vec[2].y = 0.5f;
|
||||
matrixOut.vec[3].x = CGraphics::g_GXModelMatrix.m_origin.x * 0.5f;
|
||||
matrixOut.vec[3].y = CGraphics::g_GXModelMatrix.m_origin.y * 0.5f;
|
||||
matrixOut.vec[3].x = CGraphics::g_GXModelMatrix.origin.x * 0.5f;
|
||||
matrixOut.vec[3].y = CGraphics::g_GXModelMatrix.origin.y * 0.5f;
|
||||
break;
|
||||
}
|
||||
case UVAnimation::Mode::WhoMustNotBeNamed:
|
||||
{
|
||||
zeus::CTransform texmtx = CGraphics::g_ViewMatrix.inverse() * CGraphics::g_GXModelMatrix;
|
||||
texmtx.m_origin.zeroOut();
|
||||
texmtx.origin.zeroOut();
|
||||
/* TODO: Finish */
|
||||
matrixOut = texmtx.toMatrix4f();
|
||||
break;
|
||||
|
|
|
@ -18,7 +18,7 @@ CSkinnedModel::CSkinnedModel(IObjectStore& store, ResId model,
|
|||
}
|
||||
|
||||
void CSkinnedModel::Calculate(const CPoseAsTransforms& pose,
|
||||
const std::experimental::optional<CVertexMorphEffect>&)
|
||||
const rstl::optional_object<CVertexMorphEffect>&)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -31,13 +31,13 @@ CLight CGuiLight::BuildLight() const
|
|||
switch (xf8_type)
|
||||
{
|
||||
case ELightType::Spot:
|
||||
ret = CLight::BuildSpot(GetWorldPosition(), x34_worldXF.m_basis[1], xbc_color, xfc_spotCutoff);
|
||||
ret = CLight::BuildSpot(GetWorldPosition(), x34_worldXF.basis[1], xbc_color, xfc_spotCutoff);
|
||||
break;
|
||||
case ELightType::Point:
|
||||
ret = CLight::BuildPoint(GetWorldPosition(), xbc_color);
|
||||
break;
|
||||
case ELightType::Directional:
|
||||
ret = CLight::BuildDirectional(x34_worldXF.m_basis[1], xbc_color);
|
||||
ret = CLight::BuildDirectional(x34_worldXF.basis[1], xbc_color);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
|
|
@ -31,19 +31,19 @@ void CGuiObject::MoveInWorld(const zeus::CVector3f& vec)
|
|||
{
|
||||
if (x70_parent)
|
||||
x70_parent->RotateW2O(vec);
|
||||
x4_localXF.m_origin += vec;
|
||||
x4_localXF.origin += vec;
|
||||
Reorthogonalize();
|
||||
RecalculateTransforms();
|
||||
}
|
||||
|
||||
void CGuiObject::SetLocalPosition(const zeus::CVector3f& pos)
|
||||
{
|
||||
MoveInWorld(pos - x4_localXF.m_origin);
|
||||
MoveInWorld(pos - x4_localXF.origin);
|
||||
}
|
||||
|
||||
void CGuiObject::RotateReset()
|
||||
{
|
||||
x4_localXF.m_basis = zeus::CMatrix3f::skIdentityMatrix3f;
|
||||
x4_localXF.basis = zeus::CMatrix3f::skIdentityMatrix3f;
|
||||
Reorthogonalize();
|
||||
RecalculateTransforms();
|
||||
}
|
||||
|
@ -60,14 +60,14 @@ zeus::CVector3f CGuiObject::RotateO2P(const zeus::CVector3f& vec) const
|
|||
|
||||
zeus::CVector3f CGuiObject::RotateTranslateW2O(const zeus::CVector3f& vec) const
|
||||
{
|
||||
return x34_worldXF.transposeRotate(vec - x34_worldXF.m_origin);
|
||||
return x34_worldXF.transposeRotate(vec - x34_worldXF.origin);
|
||||
}
|
||||
|
||||
void CGuiObject::MultiplyO2P(const zeus::CTransform& xf)
|
||||
{
|
||||
x4_localXF.m_origin += x64_rotationCenter;
|
||||
x4_localXF.origin += x64_rotationCenter;
|
||||
x4_localXF = xf * x4_localXF;
|
||||
x4_localXF.m_origin -= x64_rotationCenter;
|
||||
x4_localXF.origin -= x64_rotationCenter;
|
||||
Reorthogonalize();
|
||||
RecalculateTransforms();
|
||||
}
|
||||
|
@ -96,11 +96,11 @@ void CGuiObject::AddChildObject(CGuiObject* obj, bool makeWorldLocal, bool atEnd
|
|||
|
||||
if (makeWorldLocal)
|
||||
{
|
||||
zeus::CVector3f negParentWorld = -x34_worldXF.m_origin;
|
||||
zeus::CVector3f negParentWorld = -x34_worldXF.origin;
|
||||
zeus::CMatrix3f basisMat(
|
||||
x34_worldXF.m_basis[0] / x34_worldXF.m_basis[0].magnitude(),
|
||||
x34_worldXF.m_basis[1] / x34_worldXF.m_basis[1].magnitude(),
|
||||
x34_worldXF.m_basis[2] / x34_worldXF.m_basis[2].magnitude());
|
||||
x34_worldXF.basis[0] / x34_worldXF.basis[0].magnitude(),
|
||||
x34_worldXF.basis[1] / x34_worldXF.basis[1].magnitude(),
|
||||
x34_worldXF.basis[2] / x34_worldXF.basis[2].magnitude());
|
||||
zeus::CVector3f xfWorld = basisMat * negParentWorld;
|
||||
obj->x4_localXF = zeus::CTransform(basisMat, xfWorld) * obj->x34_worldXF;
|
||||
}
|
||||
|
@ -131,10 +131,10 @@ void CGuiObject::RecalculateTransforms()
|
|||
{
|
||||
if (x70_parent)
|
||||
{
|
||||
x4_localXF.m_origin += x64_rotationCenter;
|
||||
x4_localXF.origin += x64_rotationCenter;
|
||||
x34_worldXF = x70_parent->x34_worldXF * x4_localXF;
|
||||
x4_localXF.m_origin -= x64_rotationCenter;
|
||||
x34_worldXF.m_origin -= x64_rotationCenter;
|
||||
x4_localXF.origin -= x64_rotationCenter;
|
||||
x34_worldXF.origin -= x64_rotationCenter;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -28,9 +28,9 @@ public:
|
|||
virtual bool Message(const CGuiMessage& msg)=0;
|
||||
|
||||
void MoveInWorld(const zeus::CVector3f& vec);
|
||||
const zeus::CVector3f& GetLocalPosition() const {return x4_localXF.m_origin;}
|
||||
const zeus::CVector3f& GetLocalPosition() const {return x4_localXF.origin;}
|
||||
void SetLocalPosition(const zeus::CVector3f& pos);
|
||||
const zeus::CVector3f& GetWorldPosition() const {return x34_worldXF.m_origin;}
|
||||
const zeus::CVector3f& GetWorldPosition() const {return x34_worldXF.origin;}
|
||||
void SetRotationCenter(const zeus::CVector3f& center) {x64_rotationCenter = center;}
|
||||
void RotateReset();
|
||||
zeus::CVector3f RotateW2O(const zeus::CVector3f& vec) const;
|
||||
|
|
|
@ -228,7 +228,7 @@ void CGuiWidget::AddFunctionDef(s32 id, std::unique_ptr<CGuiFunctionDef>&& def)
|
|||
|
||||
void CGuiWidget::SetIdlePosition(const zeus::CVector3f& pos, bool reapply)
|
||||
{
|
||||
x80_transform.m_origin = pos;
|
||||
x80_transform.origin = pos;
|
||||
if (reapply)
|
||||
ReapplyXform();
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ public:
|
|||
void AddTrigger(std::unique_ptr<CGuiLogicalEventTrigger>&& trigger);
|
||||
std::vector<std::unique_ptr<CGuiFunctionDef>>* FindFunctionDefList(int id);
|
||||
void AddFunctionDef(s32 id, std::unique_ptr<CGuiFunctionDef>&& def);
|
||||
const zeus::CVector3f& GetIdlePosition() const {return x80_transform.m_origin;}
|
||||
const zeus::CVector3f& GetIdlePosition() const {return x80_transform.origin;}
|
||||
void SetIdlePosition(const zeus::CVector3f& pos, bool reapply);
|
||||
void ReapplyXform();
|
||||
void SetIsVisible(bool);
|
||||
|
|
|
@ -1195,8 +1195,8 @@ void CElementGen::BuildParticleSystemBounds()
|
|||
zeus::CVector3f scale = xa0_globalScale * x2c0_maxSize;
|
||||
zeus::CTransform xf = (xac_globalScaleTransform * x1d8_globalOrientation) * x118_localScaleTransform;
|
||||
zeus::CAABox box = zeus::CAABox(x2a8_aabbMin, x2b4_aabbMax).getTransformedAABox(xf);
|
||||
zeus::CVector3f min = box.m_min + x88_globalTranslation - scale;
|
||||
zeus::CVector3f max = box.m_max + x88_globalTranslation + scale;
|
||||
zeus::CVector3f min = box.min + x88_globalTranslation - scale;
|
||||
zeus::CVector3f max = box.max + x88_globalTranslation + scale;
|
||||
x2c4_systemBounds = zeus::CAABox(min, max);
|
||||
}
|
||||
else
|
||||
|
@ -1454,7 +1454,7 @@ void CElementGen::RenderLines()
|
|||
CGlobalRandom gr(x230_randState);
|
||||
|
||||
zeus::CTransform systemViewPointMatrix(CGraphics::g_ViewMatrix);
|
||||
systemViewPointMatrix.m_origin.zeroOut();
|
||||
systemViewPointMatrix.origin.zeroOut();
|
||||
zeus::CTransform systemCameraMatrix = systemViewPointMatrix.inverse() * x1d8_globalOrientation;
|
||||
systemViewPointMatrix = ((zeus::CTransform::Translate(x88_globalTranslation) * xac_globalScaleTransform) * systemViewPointMatrix) * x118_localScaleTransform;
|
||||
CGraphics::SetModelMatrix(systemViewPointMatrix);
|
||||
|
@ -1585,7 +1585,7 @@ void CElementGen::RenderParticles()
|
|||
}
|
||||
|
||||
zeus::CTransform systemViewPointMatrix(CGraphics::g_ViewMatrix);
|
||||
systemViewPointMatrix.m_origin.zeroOut();
|
||||
systemViewPointMatrix.origin.zeroOut();
|
||||
zeus::CTransform systemCameraMatrix = systemViewPointMatrix.inverse() * x1d8_globalOrientation;
|
||||
systemViewPointMatrix = ((zeus::CTransform::Translate(x88_globalTranslation) * xac_globalScaleTransform) * systemViewPointMatrix) * x118_localScaleTransform;
|
||||
CGraphics::SetModelMatrix(systemViewPointMatrix);
|
||||
|
@ -1927,7 +1927,7 @@ void CElementGen::RenderParticlesIndirectTexture()
|
|||
CGenDescription* desc = x1c_genDesc.GetObj();
|
||||
|
||||
zeus::CTransform systemViewPointMatrix(CGraphics::g_ViewMatrix);
|
||||
systemViewPointMatrix.m_origin.zeroOut();
|
||||
systemViewPointMatrix.origin.zeroOut();
|
||||
zeus::CTransform systemCameraMatrix = systemViewPointMatrix.inverse() * x1d8_globalOrientation;
|
||||
systemViewPointMatrix = ((zeus::CTransform::Translate(x88_globalTranslation) * xac_globalScaleTransform) * systemViewPointMatrix) * x118_localScaleTransform;
|
||||
CGraphics::SetModelMatrix(systemViewPointMatrix);
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "CActorParameters.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "Collision/CMaterialList.hpp"
|
||||
#include "Graphics/CGraphics.hpp"
|
||||
#include "Audio/CSfxManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -19,65 +21,143 @@ static CMaterialList MakeActorMaterialList(const CMaterialList& materialList, co
|
|||
CActor::CActor(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform&, CModelData&& mData, const CMaterialList& list,
|
||||
const CActorParameters& params, TUniqueId)
|
||||
: CEntity(uid, info, active, name),
|
||||
x68_(MakeActorMaterialList(list, params)),
|
||||
x70_(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Nineteen}, {EMaterialTypes::Zero}))
|
||||
: CEntity(uid, info, active, name),
|
||||
x68_material(MakeActorMaterialList(list, params)),
|
||||
x70_(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Nineteen}, {EMaterialTypes::Zero}))
|
||||
{
|
||||
if (mData.x1c_normalModel)
|
||||
x64_modelData = std::make_unique<CModelData>(std::move(mData));
|
||||
}
|
||||
|
||||
void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case EScriptObjectMessage::Activate:
|
||||
{
|
||||
if (!x30_24_active)
|
||||
xbc_time = CGraphics::GetSecondsMod900();
|
||||
}
|
||||
break;
|
||||
case EScriptObjectMessage::Decrement:
|
||||
RemoveEmitter();
|
||||
break;
|
||||
case EScriptObjectMessage::UNKM13: // 33
|
||||
{
|
||||
/* TODO: What's x98_?
|
||||
if (x98_)
|
||||
AddMaterial(EMaterialTypes::ThirtyNine, mgr);
|
||||
else
|
||||
RemoveMaterial(EMaterialTypes::ThirtyNine, mgr);
|
||||
*/
|
||||
/*
|
||||
if (HasModelData() && x64_modelData->AnimationData())
|
||||
{
|
||||
TAreaId aid = GetCurrentAreaId();
|
||||
x64_modelData->AnimationData()->sub_8002AE6C(mgr, aid, x64_modelData->x0_particleScale);
|
||||
}
|
||||
*/
|
||||
}
|
||||
break;
|
||||
case EScriptObjectMessage::UNKM14: // 34
|
||||
{
|
||||
RemoveEmitter();
|
||||
/* TODO: Not sure about this
|
||||
if (HasModelData() && x64_modelData->AnimationData() && x64_modelData->x28_)
|
||||
x64_modelData->AnimationData().GetParticleDB().GetActiveParticleLightIds(mgr);
|
||||
*/
|
||||
}
|
||||
break;
|
||||
case EScriptObjectMessage::UNKM15: // 35
|
||||
{
|
||||
for (const SConnection& conn : x20_conns)
|
||||
{
|
||||
if (conn.x0_state != EScriptObjectState::DFST)
|
||||
continue;
|
||||
|
||||
const CActor* act = dynamic_cast<const CActor*>(mgr.GetObjectById(mgr.GetIdForScript(conn.x8_objId)));
|
||||
if (act && xc6_ == kInvalidUniqueId)
|
||||
xc6_ = act->GetUniqueId();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EScriptObjectMessage::UNKM17: // 37
|
||||
//SetInFluid(true, uid);
|
||||
break;
|
||||
case EScriptObjectMessage::UNKM19: // 39
|
||||
//SetInFluid(false, kInvalidUniqueId);
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
CEntity::AcceptScriptMsg(msg, uid, mgr);
|
||||
}
|
||||
|
||||
void CActor::RemoveEmitter()
|
||||
{
|
||||
if (x8c_sfxHandle)
|
||||
{
|
||||
CSfxManager::RemoveEmitter(*x8c_sfxHandle.get());
|
||||
x88_sfxId = -1;
|
||||
x8c_sfxHandle.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, CStateManager& mgr)
|
||||
{
|
||||
x68_.Remove(t1);
|
||||
x68_material.Remove(t1);
|
||||
RemoveMaterial(t2, t3, t4, mgr);
|
||||
}
|
||||
|
||||
void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, CStateManager & mgr)
|
||||
{
|
||||
x68_.Remove(t1);
|
||||
x68_material.Remove(t1);
|
||||
RemoveMaterial(t2, t3, mgr);
|
||||
}
|
||||
|
||||
void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, CStateManager& mgr)
|
||||
{
|
||||
x68_.Remove(t1);
|
||||
x68_material.Remove(t1);
|
||||
}
|
||||
|
||||
void CActor::RemoveMaterial(EMaterialTypes t, CStateManager& mgr)
|
||||
{
|
||||
x68_.Remove(t);
|
||||
x68_material.Remove(t);
|
||||
mgr.UpdateObjectInLists(*this);
|
||||
}
|
||||
|
||||
void CActor::AddMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, EMaterialTypes t5, CStateManager& mgr)
|
||||
{
|
||||
x68_.Add(t1);
|
||||
x68_material.Add(t1);
|
||||
AddMaterial(t2, t3, t4, t5, mgr);
|
||||
}
|
||||
|
||||
void CActor::AddMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, CStateManager& mgr)
|
||||
{
|
||||
x68_.Add(t1);
|
||||
x68_material.Add(t1);
|
||||
AddMaterial(t2, t3, t4, mgr);
|
||||
}
|
||||
|
||||
void CActor::AddMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, CStateManager& mgr)
|
||||
{
|
||||
x68_.Add(t1);
|
||||
x68_material.Add(t1);
|
||||
AddMaterial(t2, t3, mgr);
|
||||
}
|
||||
|
||||
void CActor::AddMaterial(EMaterialTypes t1, EMaterialTypes t2, CStateManager& mgr)
|
||||
{
|
||||
x68_.Add(t1);
|
||||
x68_material.Add(t1);
|
||||
AddMaterial(t2, mgr);
|
||||
}
|
||||
|
||||
void CActor::AddMaterial(EMaterialTypes type, CStateManager& mgr)
|
||||
{
|
||||
x68_.Add(type);
|
||||
x68_material.Add(type);
|
||||
mgr.UpdateObjectInLists(*this);
|
||||
}
|
||||
|
||||
bool CActor::HasModelData() const
|
||||
{
|
||||
return x64_modelData.operator bool();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define __URDE_CACTOR_HPP__
|
||||
|
||||
#include "CEntity.hpp"
|
||||
#include "Audio/CSfxHandle.hpp"
|
||||
#include "zeus/zeus.hpp"
|
||||
#include "Collision/CMaterialFilter.hpp"
|
||||
#include "Character/CModelData.hpp"
|
||||
|
@ -15,7 +16,7 @@ class CWeaponMode;
|
|||
class CHealthInfo;
|
||||
class CDamageVulnerability;
|
||||
class CLightParameters;
|
||||
|
||||
class CSfxHandle;
|
||||
class CActor : public CEntity
|
||||
{
|
||||
protected:
|
||||
|
@ -28,8 +29,12 @@ protected:
|
|||
|
||||
zeus::CTransform x34_transform;
|
||||
std::unique_ptr<CModelData> x64_modelData;
|
||||
CMaterialList x68_;
|
||||
CMaterialList x68_material;
|
||||
CMaterialFilter x70_;
|
||||
s16 x88_sfxId;
|
||||
std::unique_ptr<CSfxHandle> x8c_sfxHandle;
|
||||
TUniqueId xc6_ = kInvalidUniqueId;
|
||||
float xbc_time;
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
@ -61,7 +66,7 @@ public:
|
|||
|
||||
virtual void AddToRenderer(const zeus::CFrustum&, CStateManager&) {}
|
||||
virtual void Render(CStateManager&) {}
|
||||
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
|
||||
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||
virtual void SetActive(bool active)
|
||||
{
|
||||
xe4_27_ = true;
|
||||
|
@ -72,15 +77,17 @@ public:
|
|||
}
|
||||
|
||||
virtual zeus::CVector3f GetAimPosition(const CStateManager&, float)
|
||||
{ return x34_transform.m_origin; }
|
||||
{ return x34_transform.origin; }
|
||||
|
||||
virtual bool ValidAimTarget() { return true; }
|
||||
virtual bool ValidOrbitTarget() { return true; }
|
||||
virtual bool GetOrbitDistanceCheck() { return true; }
|
||||
virtual zeus::CVector3f GetOrbitPosition(const CStateManager&)
|
||||
{ return x34_transform.m_origin; }
|
||||
{ return x34_transform.origin; }
|
||||
|
||||
virtual const zeus::CAABox* GetTouchBounds() const { return nullptr; }
|
||||
void RemoveEmitter();
|
||||
|
||||
virtual std::experimental::optional<zeus::CAABox> GetTouchBounds() const { return {} ; }
|
||||
|
||||
virtual EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, CWeaponMode&, int) { return EWeaponCollisionResponseTypes::Unknown13; }
|
||||
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||
|
@ -114,6 +121,8 @@ public:
|
|||
}
|
||||
|
||||
const CMaterialFilter& GetMaterialFilter() const { return x70_; }
|
||||
|
||||
bool HasModelData() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -58,8 +58,12 @@ public:
|
|||
virtual void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
|
||||
bool GetActive() const {return x30_24_active;}
|
||||
virtual void SetActive(bool active) {x30_24_active = active;}
|
||||
void ToggleActive()
|
||||
{
|
||||
x30_24_active ^= 1;
|
||||
}
|
||||
|
||||
TAreaId GetAreaId() const
|
||||
TAreaId GetCurrentAreaId() const
|
||||
{
|
||||
if (x30_27_)
|
||||
return x4_areaId;
|
||||
|
|
|
@ -35,6 +35,9 @@ private:
|
|||
float x50_;
|
||||
public:
|
||||
CFluidUVMotion(float a, float b, const SFluidLayerMotion& c, const SFluidLayerMotion& d, const SFluidLayerMotion& e);
|
||||
|
||||
void GetOrientation() const;
|
||||
void GetOOTimeToWrapTexPage() const;
|
||||
};
|
||||
}
|
||||
#endif // __URDE_CFLUIDUVMOTION_HPP__
|
||||
|
|
|
@ -26,12 +26,12 @@ void CScriptCoverPoint::Think(float delta, CStateManager&)
|
|||
x11c_timeLeft -= delta;
|
||||
}
|
||||
|
||||
const zeus::CAABox* CScriptCoverPoint::GetTouchBounds() const
|
||||
rstl::optional_object<zeus::CAABox> CScriptCoverPoint::GetTouchBounds() const
|
||||
{
|
||||
if (x100_touchBounds)
|
||||
return &x100_touchBounds.value();
|
||||
return x100_touchBounds;
|
||||
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
void CScriptCoverPoint::SetInUse(bool inUse)
|
||||
|
@ -119,7 +119,7 @@ void CScriptCoverPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid,
|
|||
{
|
||||
CActor::AcceptScriptMsg(msg, uid, mgr);
|
||||
|
||||
if (msg == EScriptObjectMessage::UNKM4)
|
||||
if (msg == EScriptObjectMessage::UNKM15)
|
||||
{
|
||||
for (const SConnection& con : x20_conns)
|
||||
if (con.x0_state == EScriptObjectState::Retreat)
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
void AddToRenderer(const zeus::CFrustum &, CStateManager &) {}
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager &);
|
||||
void Render(CStateManager &) {}
|
||||
const zeus::CAABox* GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
void SetInUse(bool inUse);
|
||||
bool GetInUse(TUniqueId uid) const;
|
||||
bool ShouldLandHere() const;
|
||||
|
|
|
@ -46,7 +46,7 @@ CScriptDoor::CScriptDoor(TUniqueId uid, const std::string& name, const CEntityIn
|
|||
/* ORIGINAL 0-00 OFFSET: 8007F054 */
|
||||
zeus::CVector3f CScriptDoor::GetOrbitPosition(const CStateManager& /*mgr*/) const
|
||||
{
|
||||
return x34_transform.m_origin + x29c_;
|
||||
return x34_transform.origin + x29c_;
|
||||
}
|
||||
|
||||
/* ORIGINAL 0-00 OFFSET: 8007E550 */
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr);
|
||||
void Think(float, CStateManager& mgr);
|
||||
void AddToRenderer(const zeus::CFrustum&, CStateManager& mgr);
|
||||
const zeus::CAABox* GetTouchBounds() const { return nullptr; }
|
||||
void Render(const CStateManager&) {}
|
||||
void ForceClosed(CStateManager&);
|
||||
bool IsConnectedToArea(const CStateManager& mgr, TAreaId area);
|
||||
|
|
|
@ -10,8 +10,8 @@ CScriptGrapplePoint::CScriptGrapplePoint(TUniqueId uid, const std::string &name,
|
|||
: CActor(uid, active, name, info, transform, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::FourtyOne),
|
||||
CActorParameters::None(),
|
||||
kInvalidUniqueId),
|
||||
xe8_(x34_transform.m_origin - 0.5f,
|
||||
x34_transform.m_origin + 0.5f),
|
||||
xe8_(x34_transform.origin - 0.5f,
|
||||
x34_transform.origin + 0.5f),
|
||||
x100_parameters(params)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -2,17 +2,56 @@
|
|||
#include "Character/CModelData.hpp"
|
||||
#include "CActorParameters.hpp"
|
||||
#include "Collision/CMaterialList.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CScriptTrigger::CScriptTrigger(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CVector3f& pos, const zeus::CAABox&,
|
||||
const CDamageInfo& dInfo, const zeus::CVector3f& orientedForce,
|
||||
u32 triggerFlags, bool active, bool, bool)
|
||||
const zeus::CVector3f& pos, const zeus::CAABox& bounds,
|
||||
const CDamageInfo& dInfo, const zeus::CVector3f& forceField,
|
||||
u32 triggerFlags, bool active, bool b2, bool b3)
|
||||
: CActor(uid, active, name, info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(),
|
||||
CMaterialList(EMaterialTypes::ThirtyFour), CActorParameters::None(), kInvalidUniqueId)
|
||||
CMaterialList(EMaterialTypes::ThirtyFour), CActorParameters::None(), kInvalidUniqueId),
|
||||
x100_damageInfo(dInfo),
|
||||
x11c_forceField(forceField),
|
||||
x128_forceMagnitude(forceField.magnitude()),
|
||||
x12c_flags(triggerFlags),
|
||||
x130_bounds(bounds),
|
||||
x148_26_(b2),
|
||||
x148_27_(b3)
|
||||
{
|
||||
}
|
||||
|
||||
CScriptTrigger::CObjectTracker* CScriptTrigger::FindInhabitant(TUniqueId id)
|
||||
{
|
||||
const auto& iter = std::find_if(xe8_inhabitants.begin(), xe8_inhabitants.end(), [&id](CObjectTracker& tr)->bool{
|
||||
return tr.GetObjectId() == id;
|
||||
});
|
||||
if (iter != xe8_inhabitants.end())
|
||||
return &(*iter);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CScriptTrigger::UpdateInhabitants(CStateManager& mgr)
|
||||
{
|
||||
}
|
||||
|
||||
const std::list<CScriptTrigger::CObjectTracker>&CScriptTrigger::GetInhabitants() const
|
||||
{
|
||||
return xe8_inhabitants;
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptTrigger::GetTouchBounds() const
|
||||
{
|
||||
if (x30_24_active)
|
||||
return {GetTriggerBoundsWR()};
|
||||
return {};
|
||||
}
|
||||
|
||||
zeus::CAABox CScriptTrigger::GetTriggerBoundsWR() const
|
||||
{
|
||||
return {x130_bounds.min + x34_transform.origin, x130_bounds.max + x34_transform.origin};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,18 +2,60 @@
|
|||
#define __URDE_CSCRIPTTRIGGER_HPP__
|
||||
|
||||
#include "CActor.hpp"
|
||||
#include "CDamageInfo.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CDamageInfo;
|
||||
|
||||
class CScriptTrigger : public CActor
|
||||
{
|
||||
public:
|
||||
class CObjectTracker
|
||||
{
|
||||
TUniqueId x0_id;
|
||||
public:
|
||||
CObjectTracker(TUniqueId id)
|
||||
: x0_id(id)
|
||||
{}
|
||||
|
||||
TUniqueId GetObjectId() const { return x0_id; }
|
||||
};
|
||||
|
||||
private:
|
||||
std::list<CObjectTracker> xe8_inhabitants; /* Used to be CObjectTracker */
|
||||
CDamageInfo x100_damageInfo;
|
||||
zeus::CVector3f x11c_forceField;
|
||||
float x128_forceMagnitude;
|
||||
u32 x12c_flags;
|
||||
zeus::CAABox x130_bounds;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x148_24_ : 1;
|
||||
bool x148_25_ : 1;
|
||||
bool x148_26_ : 1;
|
||||
bool x148_27_ : 1;
|
||||
bool x148_28_ : 1;
|
||||
bool x148_29_ : 1;
|
||||
};
|
||||
u8 dummy = 0;
|
||||
};
|
||||
public:
|
||||
CScriptTrigger(TUniqueId, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CVector3f& pos, const zeus::CAABox&,
|
||||
const CDamageInfo& dInfo, const zeus::CVector3f& orientedForce,
|
||||
u32 triggerFlags, bool, bool, bool);
|
||||
|
||||
virtual void InhabitantRejected(CActor&, CStateManager&) {}
|
||||
virtual void InhabitantExited(CActor&, CStateManager&) {}
|
||||
virtual void InhabitantIdle(CActor&, CStateManager&) {}
|
||||
virtual void InhabitantAdded(CActor&, CStateManager&) {}
|
||||
CObjectTracker* FindInhabitant(TUniqueId);
|
||||
void UpdateInhabitants(CStateManager&);
|
||||
const std::list<CObjectTracker>& GetInhabitants() const;
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
zeus::CAABox GetTriggerBoundsWR() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -491,7 +491,7 @@ CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in,
|
|||
zeus::CAABox box(-extent * 0.5f, extent * 0.5f);
|
||||
|
||||
const zeus::CTransform& areaXf = mgr.GetWorld()->GetGameAreas()[info.GetAreaId()]->GetTransform();
|
||||
zeus::CVector3f orientedForce = areaXf.m_basis * forceVec;
|
||||
zeus::CVector3f orientedForce = areaXf.basis * forceVec;
|
||||
|
||||
return new CScriptTrigger(mgr.AllocateUniqueId(), *name, info, position, box, dInfo,
|
||||
orientedForce, w1, b1, b2, b3);
|
||||
|
|
|
@ -199,9 +199,24 @@ enum class EScriptObjectMessage
|
|||
Action,
|
||||
Play,
|
||||
Alert,
|
||||
ObjectAdded = 0x1f,
|
||||
DeleteRequested = 0x20,
|
||||
UNKM4 = 0x23
|
||||
UNKM4,
|
||||
UNKM5,
|
||||
UNKM6,
|
||||
UNKM7,
|
||||
UNKM8,
|
||||
UNKM9,
|
||||
UNKM10,
|
||||
UNKM11,
|
||||
UNKM12,
|
||||
ObjectAdded,
|
||||
DeleteRequested,
|
||||
UNKM13,
|
||||
UNKM14,
|
||||
UNKM15,
|
||||
UNKM16,
|
||||
UNKM17,
|
||||
UNKM18,
|
||||
UNKM19
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -3,10 +3,14 @@
|
|||
|
||||
#include <vector>
|
||||
#include <stdlib.h>
|
||||
#include "optional.hpp"
|
||||
|
||||
namespace rstl
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
using optional_object = std::experimental::optional<T>;
|
||||
|
||||
/**
|
||||
* @brief Vector reserved on construction
|
||||
*/
|
||||
|
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit 5352a5842ac0b2b6ba075f2c885fa172a93a54c0
|
||||
Subproject commit 44d56fe9435329c1a70a60ec70b88be51e9c3c44
|
Loading…
Reference in New Issue