mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 14:24:56 +00:00
CActorContraption fixes, better CMake dependency handling
This commit is contained in:
@@ -21,7 +21,7 @@ void CDecalManager::Initialize() {
|
||||
|
||||
m_DecalPool.clear();
|
||||
for (int i = 0; i < 64; ++i)
|
||||
m_DecalPool.emplace_back(rstl::optional<CDecal>{}, 0, i - 1, false);
|
||||
m_DecalPool.emplace_back(std::optional<CDecal>{}, 0, i - 1, false);
|
||||
|
||||
m_FreeIndex = 63;
|
||||
m_PoolInitialized = true;
|
||||
@@ -39,7 +39,7 @@ void CDecalManager::Reinitialize() {
|
||||
|
||||
m_DecalPool.clear();
|
||||
for (int i = 0; i < 64; ++i)
|
||||
m_DecalPool.emplace_back(rstl::optional<CDecal>{}, 0, i - 1, false);
|
||||
m_DecalPool.emplace_back(std::optional<CDecal>{}, 0, i - 1, false);
|
||||
|
||||
m_ActiveIndexList.clear();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "rstl.hpp"
|
||||
#include "optional.hpp"
|
||||
#include <optional>
|
||||
#include "CToken.hpp"
|
||||
#include "CDecal.hpp"
|
||||
#include "zeus/CFrustum.hpp"
|
||||
@@ -12,11 +12,11 @@ class CStateManager;
|
||||
|
||||
class CDecalManager {
|
||||
struct SDecal {
|
||||
rstl::optional<CDecal> x0_decal;
|
||||
std::optional<CDecal> x0_decal;
|
||||
TAreaId x70_areaId;
|
||||
s8 x74_index;
|
||||
bool x75_24_notIce : 1;
|
||||
SDecal(const rstl::optional<CDecal>& decal, TAreaId aid, s8 idx, bool notIce)
|
||||
SDecal(const std::optional<CDecal>& decal, TAreaId aid, s8 idx, bool notIce)
|
||||
: x0_decal(decal), x70_areaId(aid), x74_index(idx) {
|
||||
x75_24_notIce = notIce;
|
||||
}
|
||||
|
||||
@@ -1849,9 +1849,9 @@ bool CElementGen::IsSystemDeletable() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
rstl::optional<zeus::CAABox> CElementGen::GetBounds() const {
|
||||
std::optional<zeus::CAABox> CElementGen::GetBounds() const {
|
||||
if (GetParticleCountAll() == 0)
|
||||
return rstl::nullopt;
|
||||
return std::nullopt;
|
||||
else
|
||||
return {x2f0_systemBounds};
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
const zeus::CColor& GetModulationColor() const;
|
||||
float GetGeneratorRate() const { return x98_generatorRate; }
|
||||
bool IsSystemDeletable() const;
|
||||
rstl::optional<zeus::CAABox> GetBounds() const;
|
||||
std::optional<zeus::CAABox> GetBounds() const;
|
||||
u32 GetParticleCount() const;
|
||||
bool SystemHasLight() const;
|
||||
CLight GetLight() const;
|
||||
|
||||
@@ -65,17 +65,24 @@ void CFlameWarp::ModifyParticles(std::vector<CParticle>& particles) {
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
CParticle& part = particles[vec[i].second];
|
||||
x4_vecs[i] = part.x4_pos;
|
||||
x4_points[i] = part.x4_pos;
|
||||
if (i > 0) {
|
||||
zeus::CVector3f delta = x4_vecs[i] - x4_vecs[i - 1];
|
||||
zeus::CVector3f delta = x4_points[i] - x4_points[i - 1];
|
||||
if (delta.magnitude() < 0.0011920929f)
|
||||
x4_vecs[i] += delta.normalized() * 0.0011920929f;
|
||||
x4_points[i] += delta.normalized() * 0.0011920929f;
|
||||
}
|
||||
}
|
||||
|
||||
x4_vecs[0] = x74_warpPoint;
|
||||
x80_floatingPoint = x4_vecs[8];
|
||||
x4_points[0] = x74_warpPoint;
|
||||
x80_floatingPoint = x4_points[8];
|
||||
xa0_26_processed = true;
|
||||
}
|
||||
|
||||
zeus::CAABox CFlameWarp::CalculateBounds() const {
|
||||
zeus::CAABox ret;
|
||||
for (const auto& v : x4_points)
|
||||
ret.accumulateBounds(v);
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace urde {
|
||||
class CStateManager;
|
||||
|
||||
class CFlameWarp : public CWarp {
|
||||
rstl::reserved_vector<zeus::CVector3f, 9> x4_vecs;
|
||||
rstl::reserved_vector<zeus::CVector3f, 9> x4_points;
|
||||
zeus::CVector3f x74_warpPoint;
|
||||
zeus::CVector3f x80_floatingPoint;
|
||||
float x8c_maxDistSq = 0.f;
|
||||
@@ -23,22 +23,32 @@ public:
|
||||
: x74_warpPoint(warpPoint)
|
||||
, x80_floatingPoint(warpPoint)
|
||||
, x98_maxInfluenceDistSq(maxInfluenceDist * maxInfluenceDist) {
|
||||
x4_vecs.resize(9, warpPoint);
|
||||
x4_points.resize(9, warpPoint);
|
||||
xa0_24_activated = false;
|
||||
xa0_25_collisionWarp = collisionWarp;
|
||||
xa0_26_processed = false;
|
||||
}
|
||||
|
||||
const rstl::reserved_vector<zeus::CVector3f, 9>& GetPoints() const { return x4_points; }
|
||||
float GetMinSize() const { return x90_minSize; }
|
||||
float GetMaxSize() const { return x94_maxSize; }
|
||||
void SetWarpPoint(const zeus::CVector3f& p) { x74_warpPoint = p; }
|
||||
void SetFloatingPoint(const zeus::CVector3f& p) { x80_floatingPoint = p; }
|
||||
const zeus::CVector3f& GetFloatingPoint() const { return x80_floatingPoint; }
|
||||
void SetMaxDistSq(float d) { x8c_maxDistSq = d; }
|
||||
void SetStateManager(CStateManager& mgr) { x9c_stateMgr = &mgr; }
|
||||
bool UpdateWarp() { return xa0_24_activated; }
|
||||
void ModifyParticles(std::vector<CParticle>& particles);
|
||||
void Activate(bool val) { xa0_24_activated = val; }
|
||||
bool IsActivated() { return xa0_24_activated; }
|
||||
bool IsProcessed() const { return xa0_26_processed; }
|
||||
FourCC Get4CharID() { return FOURCC('FWRP'); }
|
||||
void ResetPosition(const zeus::CVector3f& pos) {
|
||||
for (auto& vec : x4_vecs) {
|
||||
for (auto& vec : x4_points) {
|
||||
vec = pos;
|
||||
}
|
||||
xa0_26_processed = false;
|
||||
}
|
||||
zeus::CAABox CalculateBounds() const;
|
||||
};
|
||||
} // namespace urde
|
||||
|
||||
@@ -688,7 +688,7 @@ bool CParticleElectric::IsSystemDeletable() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
rstl::optional<zeus::CAABox> CParticleElectric::GetBounds() const {
|
||||
std::optional<zeus::CAABox> CParticleElectric::GetBounds() const {
|
||||
if (GetParticleCount() <= 0)
|
||||
return {};
|
||||
else
|
||||
|
||||
@@ -59,10 +59,10 @@ private:
|
||||
int x158 = 0;
|
||||
float x15c_genRem = 0.f;
|
||||
zeus::CAABox x160_systemBounds = zeus::CAABox();
|
||||
rstl::optional<zeus::CVector3f> x178_overrideIPos;
|
||||
rstl::optional<zeus::CVector3f> x188_overrideIVel;
|
||||
rstl::optional<zeus::CVector3f> x198_overrideFPos;
|
||||
rstl::optional<zeus::CVector3f> x1a8_overrideFVel;
|
||||
std::optional<zeus::CVector3f> x178_overrideIPos;
|
||||
std::optional<zeus::CVector3f> x188_overrideIVel;
|
||||
std::optional<zeus::CVector3f> x198_overrideFPos;
|
||||
std::optional<zeus::CVector3f> x1a8_overrideFVel;
|
||||
zeus::CColor x1b8_moduColor;
|
||||
rstl::reserved_vector<bool, 32> x1bc_allocated;
|
||||
rstl::reserved_vector<std::unique_ptr<CParticleSwoosh>, 32> x1e0_swooshGenerators;
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
const zeus::CVector3f& GetGlobalScale() const;
|
||||
const zeus::CColor& GetModulationColor() const;
|
||||
bool IsSystemDeletable() const;
|
||||
rstl::optional<zeus::CAABox> GetBounds() const;
|
||||
std::optional<zeus::CAABox> GetBounds() const;
|
||||
u32 GetParticleCount() const;
|
||||
bool SystemHasLight() const;
|
||||
CLight GetLight() const;
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
virtual const zeus::CColor& GetModulationColor() const = 0;
|
||||
virtual float GetGeneratorRate() const { return 1.f; }
|
||||
virtual bool IsSystemDeletable() const = 0;
|
||||
virtual rstl::optional<zeus::CAABox> GetBounds() const = 0;
|
||||
virtual std::optional<zeus::CAABox> GetBounds() const = 0;
|
||||
virtual u32 GetParticleCount() const = 0;
|
||||
virtual bool SystemHasLight() const = 0;
|
||||
virtual CLight GetLight() const = 0;
|
||||
|
||||
@@ -989,7 +989,7 @@ bool CParticleSwoosh::IsSystemDeletable() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
rstl::optional<zeus::CAABox> CParticleSwoosh::GetBounds() const {
|
||||
std::optional<zeus::CAABox> CParticleSwoosh::GetBounds() const {
|
||||
if (GetParticleCount() <= 1) {
|
||||
zeus::CVector3f trans = x38_translation + xa4_globalTranslation;
|
||||
return zeus::CAABox(trans, trans);
|
||||
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
const zeus::CVector3f& GetGlobalScale() const;
|
||||
const zeus::CColor& GetModulationColor() const;
|
||||
bool IsSystemDeletable() const;
|
||||
rstl::optional<zeus::CAABox> GetBounds() const;
|
||||
std::optional<zeus::CAABox> GetBounds() const;
|
||||
u32 GetParticleCount() const;
|
||||
bool SystemHasLight() const;
|
||||
CLight GetLight() const;
|
||||
@@ -166,7 +166,7 @@ public:
|
||||
}
|
||||
|
||||
void DoElectricWarmup() {
|
||||
for (int i = 0; i < x15c_swooshes.size(); ++i) {
|
||||
for (size_t i = 0; i < x15c_swooshes.size(); ++i) {
|
||||
x1d0_26_forceOneUpdate = true;
|
||||
Update(0.0);
|
||||
}
|
||||
@@ -174,14 +174,14 @@ public:
|
||||
|
||||
void DoElectricCreate(const std::vector<zeus::CVector3f>& offsets) {
|
||||
u32 curIdx = x158_curParticle;
|
||||
for (int i = 0; i < x15c_swooshes.size(); ++i) {
|
||||
for (size_t i = 0; i < x15c_swooshes.size(); ++i) {
|
||||
curIdx = u32((curIdx + 1) % x15c_swooshes.size());
|
||||
x15c_swooshes[curIdx].xc_translation = offsets[i];
|
||||
}
|
||||
}
|
||||
|
||||
void DoGrappleWarmup() {
|
||||
for (int i = 0; i < x15c_swooshes.size() - 1; ++i) {
|
||||
for (size_t i = 0; i < x15c_swooshes.size() - 1; ++i) {
|
||||
x1d0_26_forceOneUpdate = true;
|
||||
Update(0.0);
|
||||
}
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
float xAmplitude, float zAmplitude, const zeus::CVector3f& swooshSegDelta) {
|
||||
float rot = x15c_swooshes.back().x30_irot;
|
||||
zeus::CVector3f trans = beamGunPos;
|
||||
for (int i = 0; i < x15c_swooshes.size(); ++i) {
|
||||
for (size_t i = 0; i < x15c_swooshes.size(); ++i) {
|
||||
SSwooshData& data = x15c_swooshes[i];
|
||||
zeus::CVector3f vec;
|
||||
if (i > 0)
|
||||
|
||||
Reference in New Issue
Block a user