mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of https://github.com/AxioDL/urde
This commit is contained in:
commit
2f2ff96965
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeWorkspace" IGNORE_OUTSIDE_FILES="true" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
</project>
|
|
@ -681,8 +681,8 @@ std::unique_ptr<urde::IObj> ProjectResourceFactoryBase::Build(const urde::SObjec
|
|||
const urde::CVParamTransfer& paramXfer,
|
||||
CObjectReference* selfRef)
|
||||
{
|
||||
if ((tag.id & 0xffffffff) == 0xffffffff || !tag.id)
|
||||
Log.report(logvisor::Fatal, "attempted to access null id");
|
||||
if (tag.id == kInvalidResId || !tag.id)
|
||||
Log.report(logvisor::Fatal, "attempted to access null id on type '%s'", tag.type.toString().c_str());
|
||||
|
||||
const hecl::ProjectPath* resPath = nullptr;
|
||||
if (!WaitForTagReady(tag, resPath))
|
||||
|
@ -748,16 +748,16 @@ void ProjectResourceFactoryBase::BuildAsync(const urde::SObjectTag& tag,
|
|||
urde::IObj** objOut,
|
||||
CObjectReference* selfRef)
|
||||
{
|
||||
if ((tag.id & 0xffffffff) == 0xffffffff || !tag.id)
|
||||
Log.report(logvisor::Fatal, "attempted to access null id");
|
||||
if (tag.id == kInvalidResId || !tag.id)
|
||||
Log.report(logvisor::Fatal, "attempted to access null id on type '%s'", tag.type.toString().c_str());
|
||||
|
||||
BuildAsyncInternal(tag, paramXfer, objOut, selfRef);
|
||||
}
|
||||
|
||||
u32 ProjectResourceFactoryBase::ResourceSize(const SObjectTag& tag)
|
||||
{
|
||||
if ((tag.id & 0xffffffff) == 0xffffffff || !tag.id)
|
||||
Log.report(logvisor::Fatal, "attempted to access null id");
|
||||
if (tag.id == kInvalidResId || !tag.id)
|
||||
Log.report(logvisor::Fatal, "attempted to access null id on type '%s'", tag.type.toString().c_str());
|
||||
|
||||
/* Ensure resource at requested path is indexed and not cooking */
|
||||
const hecl::ProjectPath* resPath = nullptr;
|
||||
|
|
|
@ -116,6 +116,10 @@ public:
|
|||
void SetLocalScale(const zeus::CVector3f&);
|
||||
void SetParticleEmission(bool);
|
||||
void SetModulationColor(const zeus::CColor&);
|
||||
void SetOverrideIPos(const zeus::CVector3f& vec) { x178_overrideIPos.emplace(vec); }
|
||||
void SetOverrideIVel(const zeus::CVector3f& vec) { x188_overrideIVel.emplace(vec); }
|
||||
void SetOverrideFPos(const zeus::CVector3f& vec) { x198_overrideFPos.emplace(vec); }
|
||||
void SetOverrideFVel(const zeus::CVector3f& vec) { x1a8_overrideFVel.emplace(vec); }
|
||||
const zeus::CTransform& GetOrientation() const;
|
||||
const zeus::CVector3f& GetTranslation() const;
|
||||
const zeus::CTransform& GetGlobalOrientation() const;
|
||||
|
@ -130,6 +134,11 @@ public:
|
|||
bool GetParticleEmission() const;
|
||||
void DestroyParticles();
|
||||
void Reset() {}
|
||||
void ForceParticleCreation(s32 count)
|
||||
{
|
||||
CGlobalRandom gRnd{x14c_randState};
|
||||
CreateNewParticles(count);
|
||||
}
|
||||
FourCC Get4CharId() const { return FOURCC('ELSC'); }
|
||||
};
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
|
|||
{
|
||||
for (const SConnection& conn : x20_conns)
|
||||
{
|
||||
if (conn.x0_state != EScriptObjectState::DFST)
|
||||
if (conn.x0_state != EScriptObjectState::Default)
|
||||
continue;
|
||||
|
||||
const CActor* act = TCastToConstPtr<CActor>(mgr.GetObjectById(mgr.GetIdForScript(conn.x8_objId)));
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "CDependencyGroup.hpp"
|
||||
#include "Particle/CElementGen.hpp"
|
||||
#include "Particle/CParticleElectric.hpp"
|
||||
#include "Particle/CParticleSwoosh.hpp"
|
||||
#include "Particle/CGenDescription.hpp"
|
||||
#include "World/CWorld.hpp"
|
||||
#include "Graphics/CBooRenderer.hpp"
|
||||
|
@ -64,7 +63,8 @@ void CActorModelParticles::CItem::GeneratePoints(const zeus::CVector3f* v1, cons
|
|||
if (v.canBeNormalized())
|
||||
{
|
||||
v.normalize();
|
||||
x78_->SetOrientation(zeus::CTransform{zeus::CVector3f::skUp.cross(v), v, zeus::CVector3f::skUp, zeus::CVector3f::skZero});
|
||||
x78_->SetOrientation(zeus::CTransform{zeus::CVector3f::skUp.cross(v), v, zeus::CVector3f::skUp,
|
||||
zeus::CVector3f::skZero});
|
||||
}
|
||||
x78_->ForceParticleCreation(1);
|
||||
}
|
||||
|
@ -83,7 +83,39 @@ void CActorModelParticles::CItem::GeneratePoints(const zeus::CVector3f* v1, cons
|
|||
iceGen->SetTranslation(xec_ * v1[next]);
|
||||
|
||||
iceGen->SetOrientation(zeus::CTransform::MakeRotationsBasedOnY(zeus::CUnitVector3f(v2[next])));
|
||||
|
||||
x8c_.push_back(std::move(iceGen));
|
||||
xb0_ = (x8c_.size() == 4 ? -1 : next);
|
||||
}
|
||||
// TODO: Verify behavior
|
||||
if (xc0_particleElectric && xc0_particleElectric->GetParticleEmission())
|
||||
{
|
||||
CRandom16 rnd(xcc_seed3);
|
||||
u32 end = 1;
|
||||
#if 0
|
||||
if (4 < 1)
|
||||
end = 4;
|
||||
#endif
|
||||
u32 lastRnd;
|
||||
for (u32 i = 0; i < end; ++i)
|
||||
{
|
||||
xc0_particleElectric->SetOverrideIPos(v1[u32(rnd.Range(0, w1 - 1))] * xec_);
|
||||
lastRnd = u32(rnd.Range(0, w1 - 1));
|
||||
xc0_particleElectric->SetOverrideFPos(v1[lastRnd] * xec_);
|
||||
xc0_particleElectric->ForceParticleCreation(1);
|
||||
}
|
||||
|
||||
xcc_seed3 = rnd.GetSeed();
|
||||
xc8_ = lastRnd;
|
||||
}
|
||||
|
||||
// TODO: Finish
|
||||
#if 0
|
||||
if (xd4_)
|
||||
{
|
||||
xd4_->sub_8026A5E0(v1, v2, w1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CActorModelParticles::CItem::Update(float, CStateManager&)
|
||||
|
@ -206,8 +238,8 @@ void CActorModelParticles::AddStragglersToRenderer(const CStateManager& mgr)
|
|||
g_Renderer->AddParticleGen(*item.x78_);
|
||||
if (item.xb8_)
|
||||
g_Renderer->AddParticleGen(*item.xb8_);
|
||||
if (item.xc0_)
|
||||
g_Renderer->AddParticleGen(*item.xc0_);
|
||||
if (item.xc0_particleElectric)
|
||||
g_Renderer->AddParticleGen(*item.xc0_particleElectric);
|
||||
}
|
||||
if (isNotZero)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include "Audio/CSfxManager.hpp"
|
||||
#include "CToken.hpp"
|
||||
#include "zeus/CTransform.hpp"
|
||||
#include "Particle/CParticleElectric.hpp"
|
||||
#include "Particle/CParticleSwoosh.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -12,9 +14,7 @@ class CStateManager;
|
|||
class CEntity;
|
||||
class CElementGen;
|
||||
class CTexture;
|
||||
class CElectricDescription;
|
||||
class CGenDescription;
|
||||
class CParticleElectric;
|
||||
class CActor;
|
||||
|
||||
class CActorModelParticles
|
||||
|
@ -33,13 +33,13 @@ public:
|
|||
u32 x80_ = 0;
|
||||
u32 x84_ = -1;
|
||||
u32 x88_seed1 = 99;
|
||||
rstl::reserved_vector<std::unique_ptr<CElementGen>, 4> x8c_;
|
||||
u32 xb0_ = -1;
|
||||
rstl::prereserved_vector<std::unique_ptr<CElementGen>, 4> x8c_;
|
||||
s32 xb0_ = -1;
|
||||
u32 xb4_seed2 = 99;
|
||||
std::unique_ptr<CElementGen> xb8_;
|
||||
std::unique_ptr<CElementGen> xc0_;
|
||||
std::unique_ptr<CParticleElectric> xc0_particleElectric;
|
||||
u32 xc8_ = 0;
|
||||
u32 xcc_ = 99;
|
||||
u32 xcc_seed3 = 99;
|
||||
zeus::CColor xd0_;
|
||||
std::unique_ptr<u32> xd4_;
|
||||
TToken<CTexture> xdc_ashy;
|
||||
|
|
|
@ -169,7 +169,7 @@ enum class EScriptObjectState
|
|||
ScanProcessing,
|
||||
ScanDone,
|
||||
UnFrozen,
|
||||
DFST,
|
||||
Default,
|
||||
ReflectedDamage,
|
||||
InheritBounds
|
||||
};
|
||||
|
|
|
@ -30,6 +30,30 @@ class prereserved_vector
|
|||
T x4_data[N];
|
||||
|
||||
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)
|
||||
{
|
||||
if (n <= N)
|
||||
|
@ -42,8 +66,24 @@ public:
|
|||
|
||||
T& back() const { return x4_data[(x0_size == 0) ? 0 : x0_size - 1]; }
|
||||
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]; }
|
||||
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>
|
||||
|
|
Loading…
Reference in New Issue