Fix build error

This commit is contained in:
Phillip Stephens 2017-08-01 03:08:42 -07:00
parent 9afacd791b
commit 2dee7c72cb
6 changed files with 60 additions and 15 deletions

View File

@ -116,10 +116,10 @@ public:
void SetLocalScale(const zeus::CVector3f&); void SetLocalScale(const zeus::CVector3f&);
void SetParticleEmission(bool); void SetParticleEmission(bool);
void SetModulationColor(const zeus::CColor&); void SetModulationColor(const zeus::CColor&);
void SetOverrideIPos(const zeus::CVector3f& vec) { x178_overrideIPos = vec; } void SetOverrideIPos(const zeus::CVector3f& vec) { x178_overrideIPos.emplace(vec); }
void SetOverrideIVel(const zeus::CVector3f& vec) { x188_overrideIVel = vec; } void SetOverrideIVel(const zeus::CVector3f& vec) { x188_overrideIVel.emplace(vec); }
void SetOverrideFPos(const zeus::CVector3f& vec) { x198_overrideFPos = vec; } void SetOverrideFPos(const zeus::CVector3f& vec) { x198_overrideFPos.emplace(vec); }
void SetOverrideFVel(const zeus::CVector3f& vec) { x1a8_overrideFVel = vec; } void SetOverrideFVel(const zeus::CVector3f& vec) { x1a8_overrideFVel.emplace(vec); }
const zeus::CTransform& GetOrientation() const; const zeus::CTransform& GetOrientation() const;
const zeus::CVector3f& GetTranslation() const; const zeus::CVector3f& GetTranslation() const;
const zeus::CTransform& GetGlobalOrientation() const; const zeus::CTransform& GetGlobalOrientation() const;
@ -134,6 +134,11 @@ public:
bool GetParticleEmission() const; bool GetParticleEmission() const;
void DestroyParticles(); void DestroyParticles();
void Reset() {} void Reset() {}
void ForceParticleCreation(s32 count)
{
CGlobalRandom gRnd{x14c_randState};
CreateNewParticles(count);
}
FourCC Get4CharId() const { return FOURCC('ELSC'); } FourCC Get4CharId() const { return FOURCC('ELSC'); }
}; };

View File

@ -72,7 +72,7 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
{ {
for (const SConnection& conn : x20_conns) for (const SConnection& conn : x20_conns)
{ {
if (conn.x0_state != EScriptObjectState::DFST) if (conn.x0_state != EScriptObjectState::Default)
continue; continue;
const CActor* act = TCastToConstPtr<CActor>(mgr.GetObjectById(mgr.GetIdForScript(conn.x8_objId))); const CActor* act = TCastToConstPtr<CActor>(mgr.GetObjectById(mgr.GetIdForScript(conn.x8_objId)));

View File

@ -5,7 +5,6 @@
#include "CDependencyGroup.hpp" #include "CDependencyGroup.hpp"
#include "Particle/CElementGen.hpp" #include "Particle/CElementGen.hpp"
#include "Particle/CParticleElectric.hpp" #include "Particle/CParticleElectric.hpp"
#include "Particle/CParticleSwoosh.hpp"
#include "Particle/CGenDescription.hpp" #include "Particle/CGenDescription.hpp"
#include "World/CWorld.hpp" #include "World/CWorld.hpp"
#include "Graphics/CBooRenderer.hpp" #include "Graphics/CBooRenderer.hpp"
@ -84,8 +83,9 @@ void CActorModelParticles::CItem::GeneratePoints(const zeus::CVector3f* v1, cons
iceGen->SetTranslation(xec_ * v1[next]); iceGen->SetTranslation(xec_ * v1[next]);
iceGen->SetOrientation(zeus::CTransform::MakeRotationsBasedOnY(zeus::CUnitVector3f(v2[next]))); iceGen->SetOrientation(zeus::CTransform::MakeRotationsBasedOnY(zeus::CUnitVector3f(v2[next])));
if (x8c_ == 4)
xb0_ = -1; x8c_.push_back(std::move(iceGen));
xb0_ = (x8c_.size() == 4 ? -1 : next);
} }
// TODO: Verify behavior // TODO: Verify behavior
if (xc0_particleElectric && xc0_particleElectric->GetParticleEmission()) if (xc0_particleElectric && xc0_particleElectric->GetParticleEmission())
@ -101,7 +101,7 @@ void CActorModelParticles::CItem::GeneratePoints(const zeus::CVector3f* v1, cons
{ {
xc0_particleElectric->SetOverrideIPos(v1[u32(rnd.Range(0, w1 - 1))] * xec_); xc0_particleElectric->SetOverrideIPos(v1[u32(rnd.Range(0, w1 - 1))] * xec_);
lastRnd = u32(rnd.Range(0, w1 - 1)); lastRnd = u32(rnd.Range(0, w1 - 1));
xc0_particleElectric->SetOverrideIPos(v1[lastRnd] * xec_); xc0_particleElectric->SetOverrideFPos(v1[lastRnd] * xec_);
xc0_particleElectric->ForceParticleCreation(1); xc0_particleElectric->ForceParticleCreation(1);
} }
@ -238,8 +238,8 @@ void CActorModelParticles::AddStragglersToRenderer(const CStateManager& mgr)
g_Renderer->AddParticleGen(*item.x78_); g_Renderer->AddParticleGen(*item.x78_);
if (item.xb8_) if (item.xb8_)
g_Renderer->AddParticleGen(*item.xb8_); g_Renderer->AddParticleGen(*item.xb8_);
if (item.xc0_) if (item.xc0_particleElectric)
g_Renderer->AddParticleGen(*item.xc0_); g_Renderer->AddParticleGen(*item.xc0_particleElectric);
} }
if (isNotZero) if (isNotZero)
{ {

View File

@ -5,6 +5,8 @@
#include "Audio/CSfxManager.hpp" #include "Audio/CSfxManager.hpp"
#include "CToken.hpp" #include "CToken.hpp"
#include "zeus/CTransform.hpp" #include "zeus/CTransform.hpp"
#include "Particle/CParticleElectric.hpp"
#include "Particle/CParticleSwoosh.hpp"
namespace urde namespace urde
{ {
@ -12,9 +14,7 @@ class CStateManager;
class CEntity; class CEntity;
class CElementGen; class CElementGen;
class CTexture; class CTexture;
class CElectricDescription;
class CGenDescription; class CGenDescription;
class CParticleElectric;
class CActor; class CActor;
class CActorModelParticles class CActorModelParticles
@ -33,7 +33,7 @@ public:
u32 x80_ = 0; u32 x80_ = 0;
u32 x84_ = -1; u32 x84_ = -1;
u32 x88_seed1 = 99; u32 x88_seed1 = 99;
rstl::reserved_vector<std::unique_ptr<CElementGen>, 4> x8c_; rstl::prereserved_vector<std::unique_ptr<CElementGen>, 4> x8c_;
s32 xb0_ = -1; s32 xb0_ = -1;
u32 xb4_seed2 = 99; u32 xb4_seed2 = 99;
std::unique_ptr<CElementGen> xb8_; std::unique_ptr<CElementGen> xb8_;

View File

@ -169,7 +169,7 @@ enum class EScriptObjectState
ScanProcessing, ScanProcessing,
ScanDone, ScanDone,
UnFrozen, UnFrozen,
DFST, Default,
ReflectedDamage, ReflectedDamage,
InheritBounds InheritBounds
}; };

View File

@ -30,6 +30,30 @@ class prereserved_vector
T x4_data[N]; T x4_data[N];
public: public:
class iterator
{
T* m_val;
public:
iterator(T* val) : m_val(val) {}
T& operator*() const { return *m_val; }
T* operator->() const { return m_val; }
iterator& operator++() { ++m_val; return *this; }
bool operator!=(const iterator& other) const { return m_val != other.m_val; }
bool operator==(const iterator& other) const { return m_val == other.m_val; }
};
class const_iterator
{
T* m_val;
public:
const_iterator(const T* val) : m_val(val) {}
const T& operator*() const { return *m_val; }
const T* operator->() const { return m_val; }
const_iterator& operator++() { ++m_val; return *this; }
bool operator!=(const const_iterator& other) const { return m_val != other.m_val; }
bool operator==(const const_iterator& other) const { return m_val == other.m_val; }
};
void set_size(size_t n) void set_size(size_t n)
{ {
if (n <= N) if (n <= N)
@ -42,8 +66,24 @@ public:
T& back() const { return x4_data[(x0_size == 0) ? 0 : x0_size - 1]; } T& back() const { return x4_data[(x0_size == 0) ? 0 : x0_size - 1]; }
T& front() const { return x4_data[0]; } T& front() const { return x4_data[0]; }
const_iterator cbegin() const { return const_iterator(&x4_data[0]); }
const_iterator cend() const { return const_iterator(&x4_data[x0_size - 1]); }
iterator begin() { return iterator(&x4_data[0]); }
iterator end() { return iterator(&x4_data[x0_size - 1]); }
T& operator[](size_t idx) { return x4_data[idx]; } T& operator[](size_t idx) { return x4_data[idx]; }
const T& operator[](size_t idx) const { return x4_data[idx]; } const T& operator[](size_t idx) const { return x4_data[idx]; }
void push_back(const T& d)
{
x4_data[x0_size] = d;
++x0_size;
}
void push_back(T&& d)
{
x4_data[x0_size] = std::move(d);
++x0_size;
}
}; };
template<class ForwardIt, class T> template<class ForwardIt, class T>