mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of https://github.com/AxioDL/urde
This commit is contained in:
commit
40179c02dc
|
@ -6,6 +6,8 @@ namespace DataSpec
|
||||||
{
|
{
|
||||||
struct ITweakTargeting : public ITweak
|
struct ITweakTargeting : public ITweak
|
||||||
{
|
{
|
||||||
|
virtual float GetOvershootOffset() const =0;
|
||||||
|
virtual float GetXD0() const = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct CTweakTargeting : public ITweakTargeting
|
||||||
Value<atVec4f> xdc_;
|
Value<atVec4f> xdc_;
|
||||||
Value<atVec4f> xe0_;
|
Value<atVec4f> xe0_;
|
||||||
Value<atVec4f> xe4_;
|
Value<atVec4f> xe4_;
|
||||||
Value<float> xe8_;
|
Value<float> xe8_overshootOffset;
|
||||||
Value<float> xec_;
|
Value<float> xec_;
|
||||||
Value<float> xf0_;
|
Value<float> xf0_;
|
||||||
Value<atVec4f> xf4_;
|
Value<atVec4f> xf4_;
|
||||||
|
@ -147,6 +147,9 @@ struct CTweakTargeting : public ITweakTargeting
|
||||||
x144_ = (2.f * M_PIF) * (0.003f * x144_);
|
x144_ = (2.f * M_PIF) * (0.003f * x144_);
|
||||||
x208_ = (2.f * M_PIF) * (0.003f * x208_);
|
x208_ = (2.f * M_PIF) * (0.003f * x208_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float GetOvershootOffset() const { return xe8_overshootOffset; }
|
||||||
|
float GetXD0() const { return xd0_; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class CObjectList
|
||||||
TUniqueId next = kInvalidUniqueId;
|
TUniqueId next = kInvalidUniqueId;
|
||||||
TUniqueId prev = kInvalidUniqueId;
|
TUniqueId prev = kInvalidUniqueId;
|
||||||
};
|
};
|
||||||
SObjectListEntry x0_list[1024];
|
SObjectListEntry x0_list[1024]; // was an rstl::prereserved_vector
|
||||||
EGameObjectList x2004_listEnum;
|
EGameObjectList x2004_listEnum;
|
||||||
TUniqueId x2008_firstId = kInvalidUniqueId;
|
TUniqueId x2008_firstId = kInvalidUniqueId;
|
||||||
u16 x200a_count = 0;
|
u16 x200a_count = 0;
|
||||||
|
|
|
@ -326,7 +326,7 @@ void CStateManager::TouchPlayerActor()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
CScriptPlayerActor* spa = TCastToPtr<CScriptPlayerActor>(GetObjectById(xf6c_playerActor));
|
TCastToPtr<CScriptPlayerActor> spa(ObjectById(xf6c_playerActor));
|
||||||
if (spa)
|
if (spa)
|
||||||
spa->TouchModels();
|
spa->TouchModels();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
#include "CCollisionActor.hpp"
|
||||||
|
#include "World/CActorParameters.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
static const CMaterialList gkDefaultCollisionActorMaterials =
|
||||||
|
CMaterialList(EMaterialTypes::Solid, EMaterialTypes::CollisionActor, EMaterialTypes::ScanPassthrough,
|
||||||
|
EMaterialTypes::CameraPassthrough);
|
||||||
|
|
||||||
|
CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, const zeus::CVector3f& vec1,
|
||||||
|
const zeus::CVector3f& vec2, bool active, float mass)
|
||||||
|
: CPhysicsActor(uid1, active, "CollisionActor", CEntityInfo(aId, CEntity::NullConnectionList),
|
||||||
|
zeus::CTransform::Identity(), CModelData::CModelDataNull(), gkDefaultCollisionActorMaterials,
|
||||||
|
zeus::CAABox::skNullBox, SMoverData(mass), CActorParameters::None(), 0.3f, 0.1f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, const zeus::CVector3f& vec, bool active,
|
||||||
|
float mass)
|
||||||
|
: CPhysicsActor(uid1, active, "CollisionActor", CEntityInfo(aId, CEntity::NullConnectionList),
|
||||||
|
zeus::CTransform::Identity(), CModelData::CModelDataNull(), gkDefaultCollisionActorMaterials,
|
||||||
|
zeus::CAABox::skNullBox, SMoverData(mass), CActorParameters::None(), 0.3f, 0.1f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, bool active, float, float mass)
|
||||||
|
: CPhysicsActor(uid1, active, "CollisionActor", CEntityInfo(aId, CEntity::NullConnectionList),
|
||||||
|
zeus::CTransform::Identity(), CModelData::CModelDataNull(), gkDefaultCollisionActorMaterials,
|
||||||
|
zeus::CAABox::skNullBox, SMoverData(mass), CActorParameters::None(), 0.3f, 0.1f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef __URDE_CCOLLISIONACTOR_HPP__
|
||||||
|
#define __URDE_CCOLLISIONACTOR_HPP__
|
||||||
|
|
||||||
|
#include "World/CPhysicsActor.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
class CCollisionActor : public CPhysicsActor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCollisionActor(TUniqueId, TAreaId, TUniqueId, const zeus::CVector3f&, const zeus::CVector3f&, bool, float);
|
||||||
|
CCollisionActor(TUniqueId, TAreaId, TUniqueId, const zeus::CVector3f&, bool, float);
|
||||||
|
CCollisionActor(TUniqueId, TAreaId, TUniqueId, bool, float, float);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CCOLLISIONACTOR_HPP__
|
|
@ -42,6 +42,7 @@ enum class EMaterialTypes
|
||||||
Character = 33,
|
Character = 33,
|
||||||
Trigger = 34,
|
Trigger = 34,
|
||||||
Projectile = 35,
|
Projectile = 35,
|
||||||
|
Bomb = 36,
|
||||||
GroundCollider = 37,
|
GroundCollider = 37,
|
||||||
ThirtyEight = 38,
|
ThirtyEight = 38,
|
||||||
Scannable = 39,
|
Scannable = 39,
|
||||||
|
@ -50,11 +51,15 @@ enum class EMaterialTypes
|
||||||
Occluder = 42,
|
Occluder = 42,
|
||||||
Immovable = 43,
|
Immovable = 43,
|
||||||
Debris = 44,
|
Debris = 44,
|
||||||
|
PowerBomb = 45,
|
||||||
|
Unknown46 = 46,
|
||||||
|
CollisionActor = 47,
|
||||||
AIBlock = 48,
|
AIBlock = 48,
|
||||||
Platform = 49,
|
Platform = 49,
|
||||||
NonSolidDamageable = 50,
|
NonSolidDamageable = 50,
|
||||||
|
PlatformSlave = 52,
|
||||||
Unknown54 = 54,
|
Unknown54 = 54,
|
||||||
Unknwon55 = 55,
|
Unknown55 = 55,
|
||||||
ExcludeFromLineOfSightTest = 56,
|
ExcludeFromLineOfSightTest = 56,
|
||||||
SixtyThree = 63
|
SixtyThree = 63
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,58 @@
|
||||||
#include "CCompoundTargetReticle.hpp"
|
#include "CCompoundTargetReticle.hpp"
|
||||||
|
#include "GameGlobalObjects.hpp"
|
||||||
|
#include "CSimplePool.hpp"
|
||||||
|
#include "Graphics/CModel.hpp"
|
||||||
|
#include "CStateManager.hpp"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
const CTargetReticleRenderState CTargetReticleRenderState::skZeroRenderState(kInvalidUniqueId, 1.f,
|
||||||
|
zeus::CVector3f::skZero, 0.f, 1.f, true);
|
||||||
|
|
||||||
|
static float offshoot_func(float f1, float f2, float f3) { return (f1 * 0.5f) + zeus::fastSinF((f3 - 0.5f) * f2); }
|
||||||
|
|
||||||
|
static float calculate_premultiplied_overshoot_offset(float f1) { return 2.f * (M_PIF - std::asin(1.f / f1)); }
|
||||||
|
|
||||||
|
CCompoundTargetReticle::SOuterItemInfo::SOuterItemInfo(const char* res) : x0_(g_SimplePool->GetObj(res)) {}
|
||||||
|
|
||||||
|
CTargetReticleRenderState::CTargetReticleRenderState(TUniqueId target, float f1, const zeus::CVector3f& vec, float f2,
|
||||||
|
float f3, bool b1)
|
||||||
|
: x0_target(target), x4_(f1), x8_(vec), x14_(f2), x18_(f3), x1c_(b1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr)
|
||||||
|
: x0_(static_cast<const CActor*>(mgr.GetCameraManager()->GetCurrentCamera(mgr))->GetTransform().buildMatrix3f())
|
||||||
|
, x10_(static_cast<const CActor*>(mgr.GetCameraManager()->GetCurrentCamera(mgr))->GetTransform().buildMatrix3f())
|
||||||
|
, x2c_overshootOffsetHalf(0.5f * g_tweakTargeting->GetOvershootOffset())
|
||||||
|
, x30_premultOvershootOffset(calculate_premultiplied_overshoot_offset(g_tweakTargeting->GetOvershootOffset()))
|
||||||
|
, x34_crosshairs(g_SimplePool->GetObj(skCrosshairsReticleAssetName))
|
||||||
|
, x40_seeker(g_SimplePool->GetObj(skSeekerAssetName))
|
||||||
|
, x4c_lockConfirm(g_SimplePool->GetObj(skLockConfirmAssetName))
|
||||||
|
, x58_targetFlower(g_SimplePool->GetObj(skTargetFlowerAssetName))
|
||||||
|
, x64_missileBracket(g_SimplePool->GetObj(skMissileBracketAssetName))
|
||||||
|
, x70_innerBeamIcon(g_SimplePool->GetObj(skInnerBeamIconName))
|
||||||
|
, x7c_lockFire(g_SimplePool->GetObj(skLockFireAssetName))
|
||||||
|
, x88_lockDagger(g_SimplePool->GetObj(skLockDaggerAssetName))
|
||||||
|
, x94_grapple(g_SimplePool->GetObj(skGrappleReticleAssetName))
|
||||||
|
, xa0_chargeTickFirst(g_SimplePool->GetObj(skChargeBeamTickAssetName))
|
||||||
|
, xac_xrayRetRing(g_SimplePool->GetObj(skXRayRingModelName))
|
||||||
|
, xb8_thermalReticle(g_SimplePool->GetObj(skThermalReticleAssetName))
|
||||||
|
, xc4_chargeGauge(skChargeGaugeAssetName)
|
||||||
|
, xf4_(CalculateOrbitZoneReticlePosition(mgr))
|
||||||
|
, x100_(CalculateOrbitZoneReticlePosition(mgr))
|
||||||
|
, x208_(g_tweakTargeting->GetXD0())
|
||||||
|
{
|
||||||
|
xe0_outerBeamIconSquares.reserve(9);
|
||||||
|
for (u32 i = 0; i < 9; ++i)
|
||||||
|
{
|
||||||
|
char name[1024];
|
||||||
|
sprintf(name, "%s%d", skOuterBeamIconSquareNameBase, i);
|
||||||
|
xe0_outerBeamIconSquares.emplace_back(name);
|
||||||
|
}
|
||||||
|
x34_crosshairs.Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CVector3f CCompoundTargetReticle::CalculateOrbitZoneReticlePosition(const CStateManager&) const { return {}; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,155 @@
|
||||||
#ifndef __CCOMPOUNDTARGETRETICLE_HPP__
|
#ifndef __CCOMPOUNDTARGETRETICLE_HPP__
|
||||||
#define __CCOMPOUNDTARGETRETICLE_HPP__
|
#define __CCOMPOUNDTARGETRETICLE_HPP__
|
||||||
|
|
||||||
|
#include "RetroTypes.hpp"
|
||||||
|
#include "zeus/CQuaternion.hpp"
|
||||||
|
#include "CToken.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
class CActor;
|
||||||
|
class CModel;
|
||||||
class CStateManager;
|
class CStateManager;
|
||||||
|
class CTargetReticleRenderState
|
||||||
|
{
|
||||||
|
TUniqueId x0_target;
|
||||||
|
float x4_;
|
||||||
|
zeus::CVector3f x8_;
|
||||||
|
float x14_;
|
||||||
|
float x18_;
|
||||||
|
bool x1c_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
static const CTargetReticleRenderState skZeroRenderState;
|
||||||
|
|
||||||
|
CTargetReticleRenderState(TUniqueId, float, const zeus::CVector3f&, float, float, bool);
|
||||||
|
void SetTargetId(TUniqueId);
|
||||||
|
void SetFactor(float);
|
||||||
|
void SetIsOrbitZoneIdlePosition(bool);
|
||||||
|
float GetMinViewportClampScale() const;
|
||||||
|
float GetFactor() const;
|
||||||
|
float GetRadiusWorld() const;
|
||||||
|
const zeus::CVector3f& GetTargetPositionWorld() const;
|
||||||
|
bool GetIsOrbitZoneIdlePosition() const;
|
||||||
|
void SetTargetPositionWorld(const zeus::CVector3f&);
|
||||||
|
void SetRadiusWorld(float);
|
||||||
|
TUniqueId GetTargetId() const;
|
||||||
|
static void InterpolateWithClamp(const CTargetReticleRenderState&, CTargetReticleRenderState&,
|
||||||
|
const CTargetReticleRenderState&, float);
|
||||||
|
float SetMinViewportClampScale(float);
|
||||||
|
};
|
||||||
|
|
||||||
class CCompoundTargetReticle
|
class CCompoundTargetReticle
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
struct SOuterItemInfo
|
||||||
|
{
|
||||||
|
TToken<CModel> x0_;
|
||||||
|
float xc_ = 0.f;
|
||||||
|
float x10_ = 0.f;
|
||||||
|
float x14_ = 0.f;
|
||||||
|
float x18_ = 0.f;
|
||||||
|
SOuterItemInfo(const char*);
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
static constexpr const char* skCrosshairsReticleAssetName = "CMDL_Crosshairs";
|
||||||
|
static constexpr const char* skOrbitZoneReticleAssetName = "CMDL_OrbitZone";
|
||||||
|
static constexpr const char* skSeekerAssetName = "CMDL_Seeker";
|
||||||
|
static constexpr const char* skLockConfirmAssetName = "CMDL_LockConfirm";
|
||||||
|
static constexpr const char* skTargetFlowerAssetName = "CMDL_TargetFlower";
|
||||||
|
static constexpr const char* skMissileBracketAssetName = "CMDL_MissileBracket";
|
||||||
|
static constexpr const char* skChargeGaugeAssetName = "CMDL_ChargeGauge";
|
||||||
|
static constexpr const char* skChargeBeamTickAssetName = "CMDL_ChargeTickFirst";
|
||||||
|
static constexpr const char* skOuterBeamIconSquareNameBase = "CMDL_BeamSquare";
|
||||||
|
static constexpr const char* skInnerBeamIconName = "CMDL_InnerBeamIcon";
|
||||||
|
static constexpr const char* skLockFireAssetName = "CMDL_LockFIre";
|
||||||
|
static constexpr const char* skLockDaggerAssetName = "CMDL_LockDagger0";
|
||||||
|
static constexpr const char* skGrappleReticleAssetName = "CMDL_Grapple";
|
||||||
|
static constexpr const char* skXRayRingModelName = "CMDL_XRayRetRing";
|
||||||
|
static constexpr const char* skThermalReticleAssetName = "CMDL_ThermalRet";
|
||||||
|
static constexpr const char* skOrbitPointAssetName = "CMDL_OrbitPoint";
|
||||||
|
zeus::CQuaternion x0_;
|
||||||
|
zeus::CQuaternion x10_;
|
||||||
|
u32 x20_ = 5;
|
||||||
|
u32 x24_ = 5;
|
||||||
|
u32 x28_ = 0;
|
||||||
|
float x2c_overshootOffsetHalf;
|
||||||
|
float x30_premultOvershootOffset;
|
||||||
|
TToken<CModel> x34_crosshairs;
|
||||||
|
TToken<CModel> x40_seeker;
|
||||||
|
TToken<CModel> x4c_lockConfirm;
|
||||||
|
TToken<CModel> x58_targetFlower;
|
||||||
|
TToken<CModel> x64_missileBracket;
|
||||||
|
TToken<CModel> x70_innerBeamIcon;
|
||||||
|
TToken<CModel> x7c_lockFire;
|
||||||
|
TToken<CModel> x88_lockDagger;
|
||||||
|
TToken<CModel> x94_grapple;
|
||||||
|
TToken<CModel> xa0_chargeTickFirst;
|
||||||
|
TToken<CModel> xac_xrayRetRing;
|
||||||
|
TToken<CModel> xb8_thermalReticle;
|
||||||
|
SOuterItemInfo xc4_chargeGauge;
|
||||||
|
std::vector<SOuterItemInfo> xe0_outerBeamIconSquares;
|
||||||
|
TUniqueId xf0_;
|
||||||
|
TUniqueId xf2_;
|
||||||
|
zeus::CVector3f xf4_;
|
||||||
|
zeus::CVector3f x100_;
|
||||||
|
CTargetReticleRenderState x10c_ = CTargetReticleRenderState::skZeroRenderState;
|
||||||
|
CTargetReticleRenderState x12c_ = CTargetReticleRenderState::skZeroRenderState;
|
||||||
|
CTargetReticleRenderState x14c_ = CTargetReticleRenderState::skZeroRenderState;
|
||||||
|
float x16c_ = 0.f;
|
||||||
|
float x170_ = 0.f;
|
||||||
|
CTargetReticleRenderState x174_ = CTargetReticleRenderState::skZeroRenderState;
|
||||||
|
CTargetReticleRenderState x194_ = CTargetReticleRenderState::skZeroRenderState;
|
||||||
|
CTargetReticleRenderState x1b4_ = CTargetReticleRenderState::skZeroRenderState;
|
||||||
|
float x1d4_ = 0.f;
|
||||||
|
float x1d8_ = 0.f;
|
||||||
|
TUniqueId x1dc_ = kInvalidUniqueId;
|
||||||
|
TUniqueId x1de_ = kInvalidUniqueId;
|
||||||
|
float x1e0_ = 0.f;
|
||||||
|
float x1e4_ = 0.f;
|
||||||
|
float x1e8_ = 0.f;
|
||||||
|
float x1ec_ = 0.f;
|
||||||
|
float x1f0_ = 0.f;
|
||||||
|
u8 x1f4_ = 0;
|
||||||
|
float x1f8_ = 0.f;
|
||||||
|
float x1fc_ = 0.f;
|
||||||
|
u32 x200_ = 0;
|
||||||
|
float x204_ = 0.f;
|
||||||
|
float x208_;
|
||||||
|
float x20c_ = 0.f;
|
||||||
|
float x210_ = 0.f;
|
||||||
|
float x214_ = 0.f;
|
||||||
|
u8 x218_ = 0;
|
||||||
|
u8 x219_ = 0;
|
||||||
|
u8 x21a_ = 0;
|
||||||
|
u8 x21b_ = 0;
|
||||||
|
u32 x21c_;
|
||||||
|
u32 x220_;
|
||||||
|
u32 x228_;
|
||||||
public:
|
public:
|
||||||
CCompoundTargetReticle(const CStateManager&);
|
CCompoundTargetReticle(const CStateManager&);
|
||||||
|
|
||||||
|
void SetLeadingOrientation(const zeus::CQuaternion&);
|
||||||
|
bool CheckLoadComplete() { return true; }
|
||||||
|
void GetDesiredReticleState(const CStateManager&) const;
|
||||||
|
void Update(float, const CStateManager&);
|
||||||
|
void UpdateCurrLockOnGroup(float, const CStateManager&);
|
||||||
|
void UpdateUpdateNextLockOnGroup(float, const CStateManager&);
|
||||||
|
void UpdateOrbitZoneGroup(float, const CStateManager&);
|
||||||
|
void Draw(const CStateManager&) const;
|
||||||
|
void DrawCurrLockOnGroup(const CStateManager&) const;
|
||||||
|
void DrawNextLockOnGroup(const CStateManager&) const;
|
||||||
|
void DrawOrbitZoneGroup(const CStateManager&) const;
|
||||||
|
void UpdateTargetParameters(CTargetReticleRenderState&, const CStateManager&);
|
||||||
|
float CalculateRadiusWorld(const CActor&, const CStateManager&) const;
|
||||||
|
zeus::CVector3f CalculatePositionWorld(const CActor&, const CStateManager&) const;
|
||||||
|
zeus::CVector3f CalculateOrbitZoneReticlePosition(const CStateManager&) const;
|
||||||
|
bool IsGrappleTarget(TUniqueId, const CStateManager&) const;
|
||||||
|
void CalculateClampedScale(const zeus::CVector3f&, float, float, float, const CStateManager&);
|
||||||
|
void Touch() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef __URDE_CORBITPOINTMARKER_HPP__
|
||||||
|
#define __URDE_CORBIGPOINTMARKER_HPP__
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
class CStateManager;
|
||||||
|
class COrbigPointMarker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif // __URDE_CORBIGPOINTMARKER_HPP__
|
|
@ -5,6 +5,7 @@
|
||||||
#include "Audio/CSfxManager.hpp"
|
#include "Audio/CSfxManager.hpp"
|
||||||
#include "TCastTo.hpp"
|
#include "TCastTo.hpp"
|
||||||
#include "Character/IAnimReader.hpp"
|
#include "Character/IAnimReader.hpp"
|
||||||
|
#include "Character/CActorLights.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -12,9 +13,9 @@ static CMaterialList MakeActorMaterialList(const CMaterialList& materialList, co
|
||||||
{
|
{
|
||||||
CMaterialList ret = materialList;
|
CMaterialList ret = materialList;
|
||||||
if (params.GetVisorParameters().x0_28_b3)
|
if (params.GetVisorParameters().x0_28_b3)
|
||||||
ret.Add(EMaterialTypes::Mud);
|
ret.Add(EMaterialTypes::Unknown46);
|
||||||
if (params.GetVisorParameters().x0_29_b4)
|
if (params.GetVisorParameters().x0_29_b4)
|
||||||
ret.Add(EMaterialTypes::Glass);
|
ret.Add(EMaterialTypes::ScanPassthrough);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,4 +306,10 @@ SAdvancementDeltas CActor::UpdateAnimation(float, CStateManager&, bool)
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CActor::SetActorLights(std::unique_ptr<CActorLights> lights)
|
||||||
|
{
|
||||||
|
x90_actorLights = std::move(lights);
|
||||||
|
xe4_31_lightsDirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ protected:
|
||||||
bool xe4_28_ : 1;
|
bool xe4_28_ : 1;
|
||||||
bool xe4_29_ : 1;
|
bool xe4_29_ : 1;
|
||||||
bool xe4_30_ : 1;
|
bool xe4_30_ : 1;
|
||||||
|
bool xe4_31_lightsDirty : 1;
|
||||||
bool xe5_24_ : 1;
|
bool xe5_24_ : 1;
|
||||||
bool xe5_25_ : 1;
|
bool xe5_25_ : 1;
|
||||||
bool xe5_26_muted : 1;
|
bool xe5_26_muted : 1;
|
||||||
|
@ -158,6 +159,7 @@ public:
|
||||||
void EnsureRendered(const CStateManager&);
|
void EnsureRendered(const CStateManager&);
|
||||||
void EnsureRendered(const CStateManager&, const zeus::CVector3f&, const zeus::CVector3f&);
|
void EnsureRendered(const CStateManager&, const zeus::CVector3f&, const zeus::CVector3f&);
|
||||||
SAdvancementDeltas UpdateAnimation(float, CStateManager&, bool);
|
SAdvancementDeltas UpdateAnimation(float, CStateManager&, bool);
|
||||||
|
void SetActorLights(std::unique_ptr<CActorLights>);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace urde
|
||||||
class CActorParameters
|
class CActorParameters
|
||||||
{
|
{
|
||||||
friend class ScriptLoader;
|
friend class ScriptLoader;
|
||||||
CLightParameters x4_lightParms;
|
CLightParameters x0_lightParms;
|
||||||
CScannableParameters x40_scanParms;
|
CScannableParameters x40_scanParms;
|
||||||
std::pair<ResId, ResId> x44_xrayAssets = {};
|
std::pair<ResId, ResId> x44_xrayAssets = {};
|
||||||
std::pair<ResId, ResId> x4c_thermalAssets = {};
|
std::pair<ResId, ResId> x4c_thermalAssets = {};
|
||||||
|
@ -23,15 +23,23 @@ class CActorParameters
|
||||||
float x5c_;
|
float x5c_;
|
||||||
float x60_;
|
float x60_;
|
||||||
float x64_;
|
float x64_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CActorParameters()
|
CActorParameters() : b1(true), b2(false), b3(false), b4(false) {}
|
||||||
: b1(true), b2(false), b3(false), b4(false) {}
|
|
||||||
CActorParameters(const CLightParameters& lightParms, const CScannableParameters& scanParms,
|
CActorParameters(const CLightParameters& lightParms, const CScannableParameters& scanParms,
|
||||||
const std::pair<ResId, ResId>& xrayAssets, const std::pair<ResId, ResId>& thermalAssets,
|
const std::pair<ResId, ResId>& xrayAssets, const std::pair<ResId, ResId>& thermalAssets,
|
||||||
const CVisorParameters& visorParms, bool a, bool b, bool c, bool d)
|
const CVisorParameters& visorParms, bool a, bool b, bool c, bool d)
|
||||||
: x4_lightParms(lightParms), x40_scanParms(scanParms),
|
: x0_lightParms(lightParms)
|
||||||
x44_xrayAssets(xrayAssets), x4c_thermalAssets(thermalAssets),
|
, x40_scanParms(scanParms)
|
||||||
x54_visorParms(visorParms), b1(a), b2(b), b3(c), b4(d) {}
|
, x44_xrayAssets(xrayAssets)
|
||||||
|
, x4c_thermalAssets(thermalAssets)
|
||||||
|
, x54_visorParms(visorParms)
|
||||||
|
, b1(a)
|
||||||
|
, b2(b)
|
||||||
|
, b3(c)
|
||||||
|
, b4(d)
|
||||||
|
{
|
||||||
|
}
|
||||||
CActorParameters Scannable(const CScannableParameters& sParms) const
|
CActorParameters Scannable(const CScannableParameters& sParms) const
|
||||||
{
|
{
|
||||||
CActorParameters aParms = *this;
|
CActorParameters aParms = *this;
|
||||||
|
@ -39,12 +47,12 @@ public:
|
||||||
return aParms;
|
return aParms;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CActorParameters None() {return CActorParameters();}
|
static CActorParameters None() { return CActorParameters(); }
|
||||||
|
|
||||||
void SetVisorParameters(const CVisorParameters& vParams) { x54_visorParms = vParams; }
|
void SetVisorParameters(const CVisorParameters& vParams) { x54_visorParms = vParams; }
|
||||||
CVisorParameters GetVisorParameters() const { return x54_visorParms; }
|
const CVisorParameters& GetVisorParameters() const { return x54_visorParms; }
|
||||||
|
const CLightParameters& GetLightParameters() const { return x0_lightParms; }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __URDE_CACTORPARAMETERS_HPP__
|
#endif // __URDE_CACTORPARAMETERS_HPP__
|
||||||
|
|
|
@ -11,11 +11,11 @@ namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CScriptActor::CScriptActor(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
CScriptActor::CScriptActor(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
CModelData&& mData, const zeus::CAABox& aabb, float f1, float zMomentum,
|
CModelData&& mData, const zeus::CAABox& aabb, float mass, float zMomentum,
|
||||||
const CMaterialList& matList, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
const CMaterialList& matList, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
||||||
const CActorParameters& actParms, bool looping, bool active, u32 w1, float f3, bool b2,
|
const CActorParameters& actParms, bool looping, bool active, u32 w1, float f3, bool b2,
|
||||||
bool castsShadow, bool b4, bool b5)
|
bool castsShadow, bool b4, bool b5)
|
||||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), matList, aabb, SMoverData(f1), actParms, 0.3f, 0.1f)
|
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), matList, aabb, SMoverData(mass), actParms, 0.3f, 0.1f)
|
||||||
, x258_initialHealth(hInfo)
|
, x258_initialHealth(hInfo)
|
||||||
, x260_currentHealth(hInfo)
|
, x260_currentHealth(hInfo)
|
||||||
, x268_damageVulnerability(dVuln)
|
, x268_damageVulnerability(dVuln)
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
#include "World/CScriptPlayerActor.hpp"
|
||||||
|
#include "World/CActorParameters.hpp"
|
||||||
|
#include "World/CLightParameters.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
CScriptPlayerActor::CScriptPlayerActor(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||||
|
const zeus::CTransform& xf, const CAnimRes& animRes, CModelData&& mData,
|
||||||
|
const zeus::CAABox& aabox, bool b1, const CMaterialList& list, float mass,
|
||||||
|
float zMomentum, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
||||||
|
const CActorParameters& aParams, bool loop, bool active, u32 w1, u32 w2)
|
||||||
|
: CScriptActor(uid, name, info, xf, std::move(mData), aabox, mass, zMomentum, list, hInfo, dVuln, aParams, loop, active,
|
||||||
|
0, 1.f, false, false, false, false)
|
||||||
|
, x2e8_(animRes)
|
||||||
|
, x304_(w2)
|
||||||
|
, x350_(w1)
|
||||||
|
{
|
||||||
|
x354_24_ = b1;
|
||||||
|
x354_29_ = true;
|
||||||
|
x354_30_ = true;
|
||||||
|
CMaterialList exclude = GetMaterialFilter().GetExcludeList();
|
||||||
|
CMaterialList include = GetMaterialFilter().GetIncludeList();
|
||||||
|
include.Add(EMaterialTypes::Player);
|
||||||
|
SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(include, exclude));
|
||||||
|
|
||||||
|
SetActorLights(aParams.GetLightParameters().MakeActorLights());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptPlayerActor::Think(float, CStateManager&)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptPlayerActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptPlayerActor::SetActive(bool active)
|
||||||
|
{
|
||||||
|
CActor::SetActive(active);
|
||||||
|
xe7_29_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptPlayerActor::PreRender(CStateManager&, const zeus::CFrustum&)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptPlayerActor::AddToRenderer(const zeus::CFrustum&, const CStateManager&) const
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptPlayerActor::Render(const CStateManager& mgr) const
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,55 @@
|
||||||
#ifndef __URDE_CSCRIPTPLAYERACTOR_HPP__
|
#ifndef __URDE_CSCRIPTPLAYERACTOR_HPP__
|
||||||
#define __URDE_CSCRIPTPLAYERACTOR_HPP__
|
#define __URDE_CSCRIPTPLAYERACTOR_HPP__
|
||||||
#include "CPhysicsActor.hpp"
|
|
||||||
|
#include "CScriptActor.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
class CScriptPlayerActor : CPhysicsActor
|
class CScriptPlayerActor : public CScriptActor
|
||||||
{
|
{
|
||||||
|
CAnimRes x2e8_;
|
||||||
|
u32 x304_;
|
||||||
|
s32 x308_ = -1;
|
||||||
|
s32 x30c_ = -1;
|
||||||
|
s32 x310_ = -1;
|
||||||
|
u32 x314_ = 0;
|
||||||
|
u32 x318_ = 0;
|
||||||
|
u32 x31c_ = 0;
|
||||||
|
u32 x320_ = 0;
|
||||||
|
u32 x324_ = 0;
|
||||||
|
u8 x334_ = 0;
|
||||||
|
u8 x344_ = 0;
|
||||||
|
u32 x348_ = 0;
|
||||||
|
float x34c_ = 0.f;
|
||||||
|
u32 x350_;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
bool x354_24_ : 1;
|
||||||
|
bool x354_25_ : 1;
|
||||||
|
bool x354_26_ : 1;
|
||||||
|
bool x354_27_ : 1;
|
||||||
|
bool x354_28_ : 1;
|
||||||
|
bool x354_29_ : 1;
|
||||||
|
bool x354_30_ : 1;
|
||||||
|
bool x354_31_ : 1;
|
||||||
|
bool x355_24_ : 1;
|
||||||
|
};
|
||||||
|
u8 x355_dummy = 0;
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
CScriptPlayerActor(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, const CAnimRes&,
|
||||||
|
CModelData&&, const zeus::CAABox&, bool, const CMaterialList&, float, float,
|
||||||
|
const CHealthInfo&, const CDamageVulnerability&, const CActorParameters&, bool, bool, u32, u32);
|
||||||
|
|
||||||
|
void Think(float, CStateManager &);
|
||||||
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager &);
|
||||||
|
void SetActive(bool active);
|
||||||
|
void PreRender(CStateManager &, const zeus::CFrustum &);
|
||||||
|
void AddToRenderer(const zeus::CFrustum &, const CStateManager &) const;
|
||||||
|
void Render(const CStateManager &mgr) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "CScriptGrapplePoint.hpp"
|
#include "CScriptGrapplePoint.hpp"
|
||||||
#include "CScriptPickupGenerator.hpp"
|
#include "CScriptPickupGenerator.hpp"
|
||||||
#include "CScriptPointOfInterest.hpp"
|
#include "CScriptPointOfInterest.hpp"
|
||||||
|
#include "CScriptPlayerActor.hpp"
|
||||||
#include "CScriptAreaAttributes.hpp"
|
#include "CScriptAreaAttributes.hpp"
|
||||||
#include "CScriptCameraWaypoint.hpp"
|
#include "CScriptCameraWaypoint.hpp"
|
||||||
#include "CScriptCoverPoint.hpp"
|
#include "CScriptCoverPoint.hpp"
|
||||||
|
@ -282,7 +283,6 @@ CLightParameters ScriptLoader::LoadLightParameters(CInputStream& in)
|
||||||
CLightParameters::EWorldLightingOptions lightOpts = CLightParameters::EWorldLightingOptions(in.readUint32Big());
|
CLightParameters::EWorldLightingOptions lightOpts = CLightParameters::EWorldLightingOptions(in.readUint32Big());
|
||||||
CLightParameters::ELightRecalculationOptions recalcOpts =
|
CLightParameters::ELightRecalculationOptions recalcOpts =
|
||||||
CLightParameters::ELightRecalculationOptions(in.readUint32Big());
|
CLightParameters::ELightRecalculationOptions(in.readUint32Big());
|
||||||
;
|
|
||||||
|
|
||||||
zeus::CVector3f vec;
|
zeus::CVector3f vec;
|
||||||
vec.readBig(in);
|
vec.readBig(in);
|
||||||
|
@ -419,17 +419,13 @@ CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in, int propC
|
||||||
if (cameraPassthrough) // Bool 4
|
if (cameraPassthrough) // Bool 4
|
||||||
list.Add(EMaterialTypes::CameraPassthrough);
|
list.Add(EMaterialTypes::CameraPassthrough);
|
||||||
|
|
||||||
bool generateExtent = false;
|
|
||||||
if (collisionExtent.x < 0.f || collisionExtent.y < 0.f || collisionExtent.z < 0.f)
|
|
||||||
generateExtent = true;
|
|
||||||
|
|
||||||
CModelData data;
|
CModelData data;
|
||||||
if (animType == SBIG('ANCS'))
|
if (animType == SBIG('ANCS'))
|
||||||
data = CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, true, aParms.GetInitialAnimation());
|
data = CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, true, aParms.GetInitialAnimation());
|
||||||
else
|
else
|
||||||
data = CStaticRes(staticId, head.x40_scale);
|
data = CStaticRes(staticId, head.x40_scale);
|
||||||
|
|
||||||
if (generateExtent || collisionExtent.isZero())
|
if ((collisionExtent.x < 0.f || collisionExtent.y < 0.f || collisionExtent.z < 0.f)|| collisionExtent.isZero())
|
||||||
aabb = data.GetBounds(head.x10_transform.getRotation());
|
aabb = data.GetBounds(head.x10_transform.getRotation());
|
||||||
|
|
||||||
return new CScriptActor(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(data), aabb, f1,
|
return new CScriptActor(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(data), aabb, f1,
|
||||||
|
@ -1650,7 +1646,45 @@ CEntity* ScriptLoader::LoadIceSheegoth(CStateManager& mgr, CInputStream& in, int
|
||||||
|
|
||||||
CEntity* ScriptLoader::LoadPlayerActor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
CEntity* ScriptLoader::LoadPlayerActor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||||
{
|
{
|
||||||
return nullptr;
|
if (!EnsurePropertyCount(propCount, 19, "PlayerActor"))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
SScaledActorHead aHead = LoadScaledActorHead(in, mgr);
|
||||||
|
zeus::CVector3f extents = zeus::CVector3f::ReadBig(in);
|
||||||
|
zeus::CVector3f offset = zeus::CVector3f::ReadBig(in);
|
||||||
|
float mass = in.readFloatBig();
|
||||||
|
float zMomentum = in.readFloatBig();
|
||||||
|
CHealthInfo hInfo(in);
|
||||||
|
CDamageVulnerability dVuln(in);
|
||||||
|
in.readUint32Big();
|
||||||
|
CAnimationParameters animParms = LoadAnimationParameters(in);
|
||||||
|
CActorParameters actParms = LoadActorParameters(in);
|
||||||
|
bool loop = in.readBool();
|
||||||
|
bool snow = in.readBool();
|
||||||
|
bool solid = in.readBool();
|
||||||
|
bool active = in.readBool();
|
||||||
|
u32 flags = LoadParameterFlags(in);
|
||||||
|
bool w1 = in.readUint32Big() - 1;
|
||||||
|
|
||||||
|
FourCC fcc = g_ResFactory->GetResourceTypeById(animParms.GetACSFile());
|
||||||
|
if (!fcc || fcc != SBIG('ANCS'))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
zeus::CAABox aabox = GetCollisionBox(mgr, info.GetAreaId(), extents, offset);
|
||||||
|
CMaterialList list;
|
||||||
|
if (snow)
|
||||||
|
list.Add(EMaterialTypes::Snow);
|
||||||
|
|
||||||
|
if (solid)
|
||||||
|
list.Add(EMaterialTypes::Solid);
|
||||||
|
|
||||||
|
if ((extents.x < 0.f || extents.y < 0.f || extents.z < 0.f) || extents.isZero())
|
||||||
|
aabox = zeus::CAABox({-.5f}, {0.5f});
|
||||||
|
|
||||||
|
return new CScriptPlayerActor(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform,
|
||||||
|
CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), aHead.x40_scale,
|
||||||
|
animParms.GetInitialAnimation(), loop), CModelData::CModelDataNull(),
|
||||||
|
aabox, true, list, mass, zMomentum, hInfo, dVuln, actParms, loop, active, flags, w1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity* ScriptLoader::LoadFlaahgra(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
CEntity* ScriptLoader::LoadFlaahgra(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||||
|
|
Loading…
Reference in New Issue