mirror of https://github.com/AxioDL/metaforce.git
Rework particle token descriptions
This commit is contained in:
parent
d7dbec5be0
commit
929bb65417
|
@ -88,7 +88,7 @@ void CCollisionResponseData::AddParticleSystemToResponse(EWeaponCollisionRespons
|
||||||
CSimplePool* resPool) {
|
CSimplePool* resPool) {
|
||||||
const auto i = size_t(type);
|
const auto i = size_t(type);
|
||||||
const std::vector<CAssetId> tracker(8);
|
const std::vector<CAssetId> tracker(8);
|
||||||
x0_generators[i].emplace(CPF::GetChildGeneratorDesc(in, resPool, tracker).m_token);
|
x0_generators[i] = CPF::GetChildGeneratorDesc(in, resPool, tracker).x0_res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCollisionResponseData::CheckAndAddDecalToResponse(FourCC clsId, CInputStream& in, CSimplePool* resPool) {
|
bool CCollisionResponseData::CheckAndAddDecalToResponse(FourCC clsId, CInputStream& in, CSimplePool* resPool) {
|
||||||
|
|
|
@ -212,14 +212,14 @@ void CDecal::RenderMdl() {
|
||||||
|
|
||||||
if (desc.x5c_24_DMAB) {
|
if (desc.x5c_24_DMAB) {
|
||||||
const CModelFlags flags(7, 0, 1, color);
|
const CModelFlags flags(7, 0, 1, color);
|
||||||
desc.x38_DMDL.m_token->Draw(flags);
|
desc.x38_DMDL->Draw(flags);
|
||||||
} else {
|
} else {
|
||||||
if (color.a() == 1.f) {
|
if (color.a() == 1.f) {
|
||||||
constexpr CModelFlags flags(0, 0, 3, zeus::skWhite);
|
constexpr CModelFlags flags(0, 0, 3, zeus::skWhite);
|
||||||
desc.x38_DMDL.m_token->Draw(flags);
|
desc.x38_DMDL->Draw(flags);
|
||||||
} else {
|
} else {
|
||||||
const CModelFlags flags(5, 0, 1, color);
|
const CModelFlags flags(5, 0, 1, color);
|
||||||
desc.x38_DMDL.m_token->Draw(flags);
|
desc.x38_DMDL->Draw(flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -631,27 +631,27 @@ void CElementGen::UpdateChildParticleSystems(double dt) {
|
||||||
CGlobalRandom gr(x27c_randState);
|
CGlobalRandom gr(x27c_randState);
|
||||||
|
|
||||||
SChildGeneratorDesc& icts = desc->x8c_x78_ICTS;
|
SChildGeneratorDesc& icts = desc->x8c_x78_ICTS;
|
||||||
if (icts.m_found && x84_prevFrame != x74_curFrame && x2a0_CSSD == x74_curFrame) {
|
if (icts && x84_prevFrame != x74_curFrame && x2a0_CSSD == x74_curFrame) {
|
||||||
int ncsyVal = 1;
|
int ncsyVal = 1;
|
||||||
if (CIntElement* ncsy = desc->x9c_x88_NCSY.get())
|
if (CIntElement* ncsy = desc->x9c_x88_NCSY.get())
|
||||||
ncsy->GetValue(x74_curFrame, ncsyVal);
|
ncsy->GetValue(x74_curFrame, ncsyVal);
|
||||||
|
|
||||||
CGenDescription* ictsDesc = icts.m_token.GetObj();
|
CGenDescription* ictsDesc = icts.GetObj();
|
||||||
if (!(x26d_27_enableOPTS && ictsDesc->x45_31_x32_25_OPTS)) {
|
if (!(x26d_27_enableOPTS && ictsDesc->x45_31_x32_25_OPTS)) {
|
||||||
x290_activePartChildren.reserve(ncsyVal + x290_activePartChildren.size());
|
x290_activePartChildren.reserve(ncsyVal + x290_activePartChildren.size());
|
||||||
for (int i = 0; i < ncsyVal; ++i) {
|
for (int i = 0; i < ncsyVal; ++i) {
|
||||||
std::unique_ptr<CParticleGen> chGen = ConstructChildParticleSystem(icts.m_token);
|
std::unique_ptr<CParticleGen> chGen = ConstructChildParticleSystem(*icts);
|
||||||
x290_activePartChildren.emplace_back(std::move(chGen));
|
x290_activePartChildren.emplace_back(std::move(chGen));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SChildGeneratorDesc& iits = desc->xb8_xa4_IITS;
|
SChildGeneratorDesc& iits = desc->xb8_xa4_IITS;
|
||||||
if (iits.m_found && x84_prevFrame != x74_curFrame && x74_curFrame < x268_PSLT && x88_particleEmission == 1 &&
|
if (iits && x84_prevFrame != x74_curFrame && x74_curFrame < x268_PSLT && x88_particleEmission == 1 &&
|
||||||
x74_curFrame >= x2a4_SISY && ((x74_curFrame - x2a4_SISY) % x2a8_PISY) == 0) {
|
x74_curFrame >= x2a4_SISY && ((x74_curFrame - x2a4_SISY) % x2a8_PISY) == 0) {
|
||||||
CGenDescription* iitsDesc = iits.m_token.GetObj();
|
CGenDescription* iitsDesc = iits.GetObj();
|
||||||
if (!(x26d_27_enableOPTS && iitsDesc->x45_31_x32_25_OPTS)) {
|
if (!(x26d_27_enableOPTS && iitsDesc->x45_31_x32_25_OPTS)) {
|
||||||
std::unique_ptr<CParticleGen> chGen = ConstructChildParticleSystem(iits.m_token);
|
std::unique_ptr<CParticleGen> chGen = ConstructChildParticleSystem(*iits);
|
||||||
x290_activePartChildren.emplace_back(std::move(chGen));
|
x290_activePartChildren.emplace_back(std::move(chGen));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -678,24 +678,24 @@ void CElementGen::UpdateChildParticleSystems(double dt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SChildGeneratorDesc& idts = desc->xa4_x90_IDTS;
|
SChildGeneratorDesc& idts = desc->xa4_x90_IDTS;
|
||||||
if (idts.m_found && x74_curFrame == x268_PSLT && x84_prevFrame != x74_curFrame) {
|
if (idts && x74_curFrame == x268_PSLT && x84_prevFrame != x74_curFrame) {
|
||||||
int ndsyVal = 1;
|
int ndsyVal = 1;
|
||||||
if (CIntElement* ndsy = desc->xb4_xa0_NDSY.get())
|
if (CIntElement* ndsy = desc->xb4_xa0_NDSY.get())
|
||||||
ndsy->GetValue(0, ndsyVal);
|
ndsy->GetValue(0, ndsyVal);
|
||||||
|
|
||||||
CGenDescription* idtsDesc = idts.m_token.GetObj();
|
CGenDescription* idtsDesc = idts.GetObj();
|
||||||
if (!(x26d_27_enableOPTS && idtsDesc->x45_31_x32_25_OPTS)) {
|
if (!(x26d_27_enableOPTS && idtsDesc->x45_31_x32_25_OPTS)) {
|
||||||
x290_activePartChildren.reserve(ndsyVal + x290_activePartChildren.size());
|
x290_activePartChildren.reserve(ndsyVal + x290_activePartChildren.size());
|
||||||
for (int i = 0; i < ndsyVal; ++i) {
|
for (int i = 0; i < ndsyVal; ++i) {
|
||||||
std::unique_ptr<CParticleGen> chGen = ConstructChildParticleSystem(idts.m_token);
|
std::unique_ptr<CParticleGen> chGen = ConstructChildParticleSystem(*idts);
|
||||||
x290_activePartChildren.emplace_back(std::move(chGen));
|
x290_activePartChildren.emplace_back(std::move(chGen));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSwooshGeneratorDesc& sswh = desc->xd4_xc0_SSWH;
|
SSwooshGeneratorDesc& sswh = desc->xd4_xc0_SSWH;
|
||||||
if (sswh.m_found && x84_prevFrame != x74_curFrame && x74_curFrame == x2ac_SSSD) {
|
if (sswh && x84_prevFrame != x74_curFrame && x74_curFrame == x2ac_SSSD) {
|
||||||
std::unique_ptr<CParticleGen> sswhGen = std::make_unique<CParticleSwoosh>(sswh.m_token, 0);
|
std::unique_ptr<CParticleGen> sswhGen = std::make_unique<CParticleSwoosh>(*sswh, 0);
|
||||||
sswhGen->SetGlobalTranslation(xe8_globalTranslation);
|
sswhGen->SetGlobalTranslation(xe8_globalTranslation);
|
||||||
sswhGen->SetGlobalScale(x100_globalScale);
|
sswhGen->SetGlobalScale(x100_globalScale);
|
||||||
sswhGen->SetLocalScale(x16c_localScale);
|
sswhGen->SetLocalScale(x16c_localScale);
|
||||||
|
@ -706,8 +706,8 @@ void CElementGen::UpdateChildParticleSystems(double dt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SElectricGeneratorDesc& selc = desc->xec_xd8_SELC;
|
SElectricGeneratorDesc& selc = desc->xec_xd8_SELC;
|
||||||
if (selc.m_found && x84_prevFrame != x74_curFrame && x74_curFrame == x2bc_SESD) {
|
if (selc && x84_prevFrame != x74_curFrame && x74_curFrame == x2bc_SESD) {
|
||||||
std::unique_ptr<CParticleGen> selcGen = std::make_unique<CParticleElectric>(selc.m_token);
|
std::unique_ptr<CParticleGen> selcGen = std::make_unique<CParticleElectric>(*selc);
|
||||||
selcGen->SetGlobalTranslation(xe8_globalTranslation);
|
selcGen->SetGlobalTranslation(xe8_globalTranslation);
|
||||||
selcGen->SetGlobalScale(x100_globalScale);
|
selcGen->SetGlobalScale(x100_globalScale);
|
||||||
selcGen->SetLocalScale(x16c_localScale);
|
selcGen->SetLocalScale(x16c_localScale);
|
||||||
|
@ -862,7 +862,7 @@ void CElementGen::Render(const CActorLights* actorLights) {
|
||||||
|
|
||||||
if (x30_particles.size()) {
|
if (x30_particles.size()) {
|
||||||
SParticleModel& pmdl = desc->x5c_x48_PMDL;
|
SParticleModel& pmdl = desc->x5c_x48_PMDL;
|
||||||
if (pmdl.m_found || desc->x45_24_x31_26_PMUS)
|
if (pmdl || desc->x45_24_x31_26_PMUS)
|
||||||
RenderModels(actorLights);
|
RenderModels(actorLights);
|
||||||
|
|
||||||
if (x26c_31_LINE)
|
if (x26c_31_LINE)
|
||||||
|
@ -1076,7 +1076,7 @@ void CElementGen::RenderModels(const CActorLights* actorLights) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CModel* model = desc->x5c_x48_PMDL.m_token.GetObj();
|
CModel* model = desc->x5c_x48_PMDL.GetObj();
|
||||||
if (actorLights)
|
if (actorLights)
|
||||||
actorLights->ActivateLights();
|
actorLights->ActivateLights();
|
||||||
if (g_subtractBlend) {
|
if (g_subtractBlend) {
|
||||||
|
|
|
@ -37,13 +37,13 @@ SParticleModel CParticleDataFactory::GetModel(CInputStream& in, CSimplePool* res
|
||||||
CAssetId id = in.Get<CAssetId>();
|
CAssetId id = in.Get<CAssetId>();
|
||||||
if (!id.IsValid())
|
if (!id.IsValid())
|
||||||
return {};
|
return {};
|
||||||
return {resPool->GetObj({FOURCC('CMDL'), id}), true};
|
return resPool->GetObj({FOURCC('CMDL'), id});
|
||||||
}
|
}
|
||||||
|
|
||||||
SChildGeneratorDesc CParticleDataFactory::GetChildGeneratorDesc(CAssetId res, CSimplePool* resPool,
|
SChildGeneratorDesc CParticleDataFactory::GetChildGeneratorDesc(CAssetId res, CSimplePool* resPool,
|
||||||
const std::vector<CAssetId>& tracker) {
|
const std::vector<CAssetId>& tracker) {
|
||||||
if (std::count(tracker.cbegin(), tracker.cend(), res) == 0)
|
if (std::count(tracker.cbegin(), tracker.cend(), res) == 0)
|
||||||
return {resPool->GetObj({FOURCC('PART'), res}), true};
|
return resPool->GetObj({FOURCC('PART'), res});
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ SSwooshGeneratorDesc CParticleDataFactory::GetSwooshGeneratorDesc(CInputStream&
|
||||||
CAssetId id = in.Get<CAssetId>();
|
CAssetId id = in.Get<CAssetId>();
|
||||||
if (!id.IsValid())
|
if (!id.IsValid())
|
||||||
return {};
|
return {};
|
||||||
return {resPool->GetObj({FOURCC('SWHC'), id}), true};
|
return resPool->GetObj({FOURCC('SWHC'), id});
|
||||||
}
|
}
|
||||||
|
|
||||||
SElectricGeneratorDesc CParticleDataFactory::GetElectricGeneratorDesc(CInputStream& in, CSimplePool* resPool) {
|
SElectricGeneratorDesc CParticleDataFactory::GetElectricGeneratorDesc(CInputStream& in, CSimplePool* resPool) {
|
||||||
|
@ -75,7 +75,7 @@ SElectricGeneratorDesc CParticleDataFactory::GetElectricGeneratorDesc(CInputStre
|
||||||
CAssetId id = in.Get<CAssetId>();
|
CAssetId id = in.Get<CAssetId>();
|
||||||
if (!id.IsValid())
|
if (!id.IsValid())
|
||||||
return {};
|
return {};
|
||||||
return {resPool->GetObj({FOURCC('ELSC'), id}), true};
|
return resPool->GetObj({FOURCC('ELSC'), id});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CUVElement> CParticleDataFactory::GetTextureElement(CInputStream& in, CSimplePool* resPool) {
|
std::unique_ptr<CUVElement> CParticleDataFactory::GetTextureElement(CInputStream& in, CSimplePool* resPool) {
|
||||||
|
@ -1012,20 +1012,11 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleDataFactory::LoadGPSMTokens(CGenDescription* desc) {
|
void CParticleDataFactory::LoadGPSMTokens(CGenDescription* desc) {
|
||||||
if (desc->x5c_x48_PMDL.m_found)
|
desc->x5c_x48_PMDL.Load();
|
||||||
desc->x5c_x48_PMDL.m_model = desc->x5c_x48_PMDL.m_token.GetObj();
|
desc->x8c_x78_ICTS.Load();
|
||||||
|
desc->xa4_x90_IDTS.Load();
|
||||||
if (desc->x8c_x78_ICTS.m_found)
|
desc->xb8_xa4_IITS.Load();
|
||||||
desc->x8c_x78_ICTS.m_gen = desc->x8c_x78_ICTS.m_token.GetObj();
|
desc->xd4_xc0_SSWH.Load();
|
||||||
|
|
||||||
if (desc->xa4_x90_IDTS.m_found)
|
|
||||||
desc->xa4_x90_IDTS.m_gen = desc->xa4_x90_IDTS.m_token.GetObj();
|
|
||||||
|
|
||||||
if (desc->xb8_xa4_IITS.m_found)
|
|
||||||
desc->xb8_xa4_IITS.m_gen = desc->xb8_xa4_IITS.m_token.GetObj();
|
|
||||||
|
|
||||||
if (desc->xd4_xc0_SSWH.m_found)
|
|
||||||
desc->xd4_xc0_SSWH.m_swoosh = desc->xd4_xc0_SSWH.m_token.GetObj();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFactoryFnReturn FParticleFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
|
CFactoryFnReturn FParticleFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
|
||||||
|
|
|
@ -24,41 +24,29 @@ class CUVElement;
|
||||||
class CVParamTransfer;
|
class CVParamTransfer;
|
||||||
class CVectorElement;
|
class CVectorElement;
|
||||||
|
|
||||||
struct SParticleModel {
|
template <typename T>
|
||||||
TLockedToken<CModel> m_token;
|
struct STokenDesc {
|
||||||
bool m_found = false;
|
std::optional<TLockedToken<T>> x0_res;
|
||||||
CModel* m_model = nullptr;
|
STokenDesc() = default;
|
||||||
SParticleModel() = default;
|
STokenDesc(CToken&& tok) : x0_res(std::move(tok)) {}
|
||||||
SParticleModel(CToken&& tok, bool found) : m_token(std::move(tok)), m_found(found) {}
|
void Load() {
|
||||||
explicit operator bool() const { return m_found; }
|
if (x0_res) {
|
||||||
|
x0_res->GetObj();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
explicit operator bool() const { return x0_res.has_value(); }
|
||||||
|
auto* GetObj() { return x0_res ? x0_res->GetObj() : nullptr; }
|
||||||
|
const auto* GetObj() const { return x0_res ? x0_res->GetObj() : nullptr; }
|
||||||
|
auto& operator*() { return *x0_res; }
|
||||||
|
const auto& operator*() const { return *x0_res; }
|
||||||
|
auto& operator->() { return *x0_res; }
|
||||||
|
const auto& operator->() const { return *x0_res; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SChildGeneratorDesc {
|
using SParticleModel = STokenDesc<CModel>;
|
||||||
TLockedToken<CGenDescription> m_token;
|
using SChildGeneratorDesc = STokenDesc<CGenDescription>;
|
||||||
bool m_found = false;
|
using SSwooshGeneratorDesc = STokenDesc<CSwooshDescription>;
|
||||||
CGenDescription* m_gen = nullptr;
|
using SElectricGeneratorDesc = STokenDesc<CElectricDescription>;
|
||||||
SChildGeneratorDesc() = default;
|
|
||||||
SChildGeneratorDesc(CToken&& tok, bool found) : m_token(std::move(tok)), m_found(found) {}
|
|
||||||
explicit operator bool() const { return m_found; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SSwooshGeneratorDesc {
|
|
||||||
TLockedToken<CSwooshDescription> m_token;
|
|
||||||
bool m_found = false;
|
|
||||||
CSwooshDescription* m_swoosh = nullptr;
|
|
||||||
SSwooshGeneratorDesc() = default;
|
|
||||||
SSwooshGeneratorDesc(CToken&& tok, bool found) : m_token(std::move(tok)), m_found(found) {}
|
|
||||||
explicit operator bool() const { return m_found; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SElectricGeneratorDesc {
|
|
||||||
TLockedToken<CElectricDescription> m_token;
|
|
||||||
bool m_found = false;
|
|
||||||
CElectricDescription* m_electric = nullptr;
|
|
||||||
SElectricGeneratorDesc() = default;
|
|
||||||
SElectricGeneratorDesc(CToken&& tok, bool found) : m_token(std::move(tok)), m_found(found) {}
|
|
||||||
explicit operator bool() const { return m_found; }
|
|
||||||
};
|
|
||||||
|
|
||||||
class CParticleDataFactory {
|
class CParticleDataFactory {
|
||||||
friend class CDecalDataFactory;
|
friend class CDecalDataFactory;
|
||||||
|
@ -105,4 +93,4 @@ CFactoryFnReturn FParticleFactory(const SObjectTag& tag, CInputStream& in, const
|
||||||
// but introduce circular dependencies if included at the start
|
// but introduce circular dependencies if included at the start
|
||||||
#include "Runtime/Particle/CGenDescription.hpp"
|
#include "Runtime/Particle/CGenDescription.hpp"
|
||||||
#include "Runtime/Particle/CSwooshDescription.hpp"
|
#include "Runtime/Particle/CSwooshDescription.hpp"
|
||||||
#include "Runtime/Particle/CElectricDescription.hpp"
|
#include "Runtime/Particle/CElectricDescription.hpp"
|
||||||
|
|
|
@ -45,7 +45,7 @@ CParticleElectric::CParticleElectric(const TToken<CElectricDescription>& token)
|
||||||
if (desc->x40_SSWH) {
|
if (desc->x40_SSWH) {
|
||||||
x450_27_haveSSWH = true;
|
x450_27_haveSSWH = true;
|
||||||
for (int i = 0; i < x154_SCNT; ++i) {
|
for (int i = 0; i < x154_SCNT; ++i) {
|
||||||
x1e0_swooshGenerators.emplace_back(std::make_unique<CParticleSwoosh>(desc->x40_SSWH.m_token, x150_SSEG));
|
x1e0_swooshGenerators.emplace_back(std::make_unique<CParticleSwoosh>(*desc->x40_SSWH, x150_SSEG));
|
||||||
x1e0_swooshGenerators.back()->DoElectricWarmup();
|
x1e0_swooshGenerators.back()->DoElectricWarmup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ CParticleElectric::CParticleElectric(const TToken<CElectricDescription>& token)
|
||||||
x450_25_haveGPSM = true;
|
x450_25_haveGPSM = true;
|
||||||
x400_gpsmGenerators.reserve(x154_SCNT);
|
x400_gpsmGenerators.reserve(x154_SCNT);
|
||||||
for (int i = 0; i < x154_SCNT; ++i) {
|
for (int i = 0; i < x154_SCNT; ++i) {
|
||||||
x400_gpsmGenerators.emplace_back(std::make_unique<CElementGen>(desc->x50_GPSM.m_token));
|
x400_gpsmGenerators.emplace_back(std::make_unique<CElementGen>(*desc->x50_GPSM));
|
||||||
x400_gpsmGenerators.back()->SetParticleEmission(false);
|
x400_gpsmGenerators.back()->SetParticleEmission(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ CParticleElectric::CParticleElectric(const TToken<CElectricDescription>& token)
|
||||||
x450_26_haveEPSM = true;
|
x450_26_haveEPSM = true;
|
||||||
x410_epsmGenerators.reserve(x154_SCNT);
|
x410_epsmGenerators.reserve(x154_SCNT);
|
||||||
for (int i = 0; i < x154_SCNT; ++i) {
|
for (int i = 0; i < x154_SCNT; ++i) {
|
||||||
x410_epsmGenerators.emplace_back(std::make_unique<CElementGen>(desc->x60_EPSM.m_token));
|
x410_epsmGenerators.emplace_back(std::make_unique<CElementGen>(*desc->x60_EPSM));
|
||||||
x410_epsmGenerators.back()->SetParticleEmission(false);
|
x410_epsmGenerators.back()->SetParticleEmission(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,12 +116,9 @@ bool CParticleElectricDataFactory::CreateELSM(CElectricDescription* desc, CInput
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleElectricDataFactory::LoadELSMTokens(CElectricDescription* desc) {
|
void CParticleElectricDataFactory::LoadELSMTokens(CElectricDescription* desc) {
|
||||||
if (desc->x40_SSWH.m_found)
|
desc->x40_SSWH.Load();
|
||||||
desc->x40_SSWH.m_swoosh = desc->x40_SSWH.m_token.GetObj();
|
desc->x50_GPSM.Load();
|
||||||
if (desc->x50_GPSM.m_found)
|
desc->x60_EPSM.Load();
|
||||||
desc->x50_GPSM.m_gen = desc->x50_GPSM.m_token.GetObj();
|
|
||||||
if (desc->x60_EPSM.m_found)
|
|
||||||
desc->x60_EPSM.m_gen = desc->x60_EPSM.m_token.GetObj();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFactoryFnReturn FParticleElectricDataFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
|
CFactoryFnReturn FParticleElectricDataFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
|
||||||
|
|
|
@ -124,7 +124,7 @@ bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputSt
|
||||||
break;
|
break;
|
||||||
CAssetId id(in);
|
CAssetId id(in);
|
||||||
if (id.IsValid())
|
if (id.IsValid())
|
||||||
desc->x94_COLR = {resPool->GetObj({FOURCC('CRSC'), id}), true};
|
desc->x94_COLR = resPool->GetObj({FOURCC('CRSC'), id});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SBIG('EWTR'):
|
case SBIG('EWTR'):
|
||||||
|
|
|
@ -13,13 +13,7 @@
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
class CCollisionResponseData;
|
class CCollisionResponseData;
|
||||||
|
|
||||||
struct SCollisionResponseData {
|
using SCollisionResponseData = STokenDesc<CCollisionResponseData>;
|
||||||
TToken<CCollisionResponseData> m_res;
|
|
||||||
bool m_found = false;
|
|
||||||
SCollisionResponseData() = default;
|
|
||||||
SCollisionResponseData(CToken&& tok, bool found) : m_res(std::move(tok)), m_found(found) {}
|
|
||||||
explicit operator bool() const { return m_found; }
|
|
||||||
};
|
|
||||||
|
|
||||||
class CWeaponDescription {
|
class CWeaponDescription {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -496,7 +496,7 @@ void CGrappleArm::RenderXRayModel(const CStateManager& mgr, const zeus::CTransfo
|
||||||
// g_Renderer->SetAmbientColor(zeus::skWhite);
|
// g_Renderer->SetAmbientColor(zeus::skWhite);
|
||||||
CSkinnedModel& model = *x50_grappleArmSkeletonModel->GetAnimationData()->GetModelData();
|
CSkinnedModel& model = *x50_grappleArmSkeletonModel->GetAnimationData()->GetModelData();
|
||||||
// model.GetModelInst()->ActivateLights({CLight::BuildLocalAmbient({}, zeus::skWhite)});
|
// model.GetModelInst()->ActivateLights({CLight::BuildLocalAmbient({}, zeus::skWhite)});
|
||||||
x0_grappleArmModel->GetAnimationData()->Render(model, flags, std::nullopt, nullptr);
|
x0_grappleArmModel->GetAnimationData()->Render(model, flags, nullptr, nullptr);
|
||||||
// g_Renderer->SetAmbientColor(zeus::skWhite);
|
// g_Renderer->SetAmbientColor(zeus::skWhite);
|
||||||
// CGraphics::DisableAllLights();
|
// CGraphics::DisableAllLights();
|
||||||
}
|
}
|
||||||
|
|
|
@ -511,7 +511,7 @@ void CGunWeapon::DrawHologram(const CStateManager& mgr, const zeus::CTransform&
|
||||||
// g_Renderer->SetAmbientColor(zeus::skWhite);
|
// g_Renderer->SetAmbientColor(zeus::skWhite);
|
||||||
CSkinnedModel& model = *x60_holoModelData->GetAnimationData()->GetModelData();
|
CSkinnedModel& model = *x60_holoModelData->GetAnimationData()->GetModelData();
|
||||||
// model.GetModelInst()->ActivateLights({CLight::BuildLocalAmbient({}, zeus::skWhite)});
|
// model.GetModelInst()->ActivateLights({CLight::BuildLocalAmbient({}, zeus::skWhite)});
|
||||||
x10_solidModelData->GetAnimationData()->Render(model, flags, std::nullopt, nullptr);
|
x10_solidModelData->GetAnimationData()->Render(model, flags, nullptr, nullptr);
|
||||||
// g_Renderer->SetAmbientColor(zeus::skWhite);
|
// g_Renderer->SetAmbientColor(zeus::skWhite);
|
||||||
// CGraphics::DisableAllLights();
|
// CGraphics::DisableAllLights();
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,12 +252,11 @@ void CPlasmaProjectile::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId send
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case EScriptObjectMessage::Registered: {
|
case EScriptObjectMessage::Registered: {
|
||||||
xe6_27_thermalVisorFlags = 2;
|
xe6_27_thermalVisorFlags = 2;
|
||||||
const SChildGeneratorDesc& apsm = x170_projectile.GetWeaponDescription()->x34_APSM;
|
const auto& weaponDesc = x170_projectile.GetWeaponDescription();
|
||||||
if (apsm)
|
if (weaponDesc->x34_APSM)
|
||||||
x520_weaponGen = std::make_unique<CElementGen>(apsm.m_token);
|
x520_weaponGen = std::make_unique<CElementGen>(*weaponDesc->x34_APSM);
|
||||||
if (x520_weaponGen && x520_weaponGen->SystemHasLight())
|
if (x520_weaponGen && x520_weaponGen->SystemHasLight())
|
||||||
CreatePlasmaLights(x170_projectile.GetWeaponDescription().GetObjectTag()->id.Value(), x520_weaponGen->GetLight(),
|
CreatePlasmaLights(weaponDesc.GetObjectTag()->id.Value(), x520_weaponGen->GetLight(), mgr);
|
||||||
mgr);
|
|
||||||
else
|
else
|
||||||
x520_weaponGen.reset();
|
x520_weaponGen.reset();
|
||||||
if (x548_28_drawOwnerFirst)
|
if (x548_28_drawOwnerFirst)
|
||||||
|
|
|
@ -21,26 +21,26 @@ CProjectileWeapon::CProjectileWeapon(const TToken<CWeaponDescription>& wDesc, co
|
||||||
x124_25_APSO = x4_weaponDesc->x28_APSO;
|
x124_25_APSO = x4_weaponDesc->x28_APSO;
|
||||||
if (x4_weaponDesc->x34_APSM) {
|
if (x4_weaponDesc->x34_APSM) {
|
||||||
xfc_APSMGen = std::make_unique<CElementGen>(
|
xfc_APSMGen = std::make_unique<CElementGen>(
|
||||||
x4_weaponDesc->x34_APSM.m_token, CElementGen::EModelOrientationType::Normal,
|
*x4_weaponDesc->x34_APSM, CElementGen::EModelOrientationType::Normal,
|
||||||
(xe4_flags & 0x1) == 0x1 ? CElementGen::EOptionalSystemFlags::Two : CElementGen::EOptionalSystemFlags::One);
|
(xe4_flags & 0x1) == 0x1 ? CElementGen::EOptionalSystemFlags::Two : CElementGen::EOptionalSystemFlags::One);
|
||||||
xfc_APSMGen->SetGlobalScale(scale);
|
xfc_APSMGen->SetGlobalScale(scale);
|
||||||
}
|
}
|
||||||
if (x4_weaponDesc->x44_APS2) {
|
if (x4_weaponDesc->x44_APS2) {
|
||||||
x100_APS2Gen = std::make_unique<CElementGen>(
|
x100_APS2Gen = std::make_unique<CElementGen>(
|
||||||
x4_weaponDesc->x44_APS2.m_token, CElementGen::EModelOrientationType::Normal,
|
*x4_weaponDesc->x44_APS2, CElementGen::EModelOrientationType::Normal,
|
||||||
(xe4_flags & 0x1) == 0x1 ? CElementGen::EOptionalSystemFlags::Two : CElementGen::EOptionalSystemFlags::One);
|
(xe4_flags & 0x1) == 0x1 ? CElementGen::EOptionalSystemFlags::Two : CElementGen::EOptionalSystemFlags::One);
|
||||||
x100_APS2Gen->SetGlobalScale(scale);
|
x100_APS2Gen->SetGlobalScale(scale);
|
||||||
}
|
}
|
||||||
if (x4_weaponDesc->x54_ASW1) {
|
if (x4_weaponDesc->x54_ASW1) {
|
||||||
x118_swoosh1 = std::make_unique<CParticleSwoosh>(x4_weaponDesc->x54_ASW1.m_token, 0);
|
x118_swoosh1 = std::make_unique<CParticleSwoosh>(*x4_weaponDesc->x54_ASW1, 0);
|
||||||
x118_swoosh1->SetGlobalScale(scale);
|
x118_swoosh1->SetGlobalScale(scale);
|
||||||
}
|
}
|
||||||
if (x4_weaponDesc->x64_ASW2) {
|
if (x4_weaponDesc->x64_ASW2) {
|
||||||
x11c_swoosh2 = std::make_unique<CParticleSwoosh>(x4_weaponDesc->x64_ASW2.m_token, 0);
|
x11c_swoosh2 = std::make_unique<CParticleSwoosh>(*x4_weaponDesc->x64_ASW2, 0);
|
||||||
x11c_swoosh2->SetGlobalScale(scale);
|
x11c_swoosh2->SetGlobalScale(scale);
|
||||||
}
|
}
|
||||||
if (x4_weaponDesc->x74_ASW3) {
|
if (x4_weaponDesc->x74_ASW3) {
|
||||||
x120_swoosh3 = std::make_unique<CParticleSwoosh>(x4_weaponDesc->x74_ASW3.m_token, 0);
|
x120_swoosh3 = std::make_unique<CParticleSwoosh>(*x4_weaponDesc->x74_ASW3, 0);
|
||||||
x120_swoosh3->SetGlobalScale(scale);
|
x120_swoosh3->SetGlobalScale(scale);
|
||||||
}
|
}
|
||||||
if (CIntElement* pslt = x4_weaponDesc->x14_PSLT.get())
|
if (CIntElement* pslt = x4_weaponDesc->x14_PSLT.get())
|
||||||
|
@ -60,8 +60,7 @@ CProjectileWeapon::CProjectileWeapon(const TToken<CWeaponDescription>& wDesc, co
|
||||||
} else {
|
} else {
|
||||||
SetRelativeOrientation(zeus::CTransform());
|
SetRelativeOrientation(zeus::CTransform());
|
||||||
}
|
}
|
||||||
if (x4_weaponDesc->x84_OHEF)
|
x108_model = x4_weaponDesc->x84_OHEF.x0_res;
|
||||||
x108_model.emplace(x4_weaponDesc->x84_OHEF.m_token);
|
|
||||||
x124_26_AP11 = x4_weaponDesc->x2a_AP11;
|
x124_26_AP11 = x4_weaponDesc->x2a_AP11;
|
||||||
x124_27_AP21 = x4_weaponDesc->x2b_AP21;
|
x124_27_AP21 = x4_weaponDesc->x2b_AP21;
|
||||||
x124_28_AS11 = x4_weaponDesc->x2c_AS11;
|
x124_28_AS11 = x4_weaponDesc->x2c_AS11;
|
||||||
|
@ -124,13 +123,13 @@ std::optional<zeus::CAABox> CProjectileWeapon::GetBounds() const {
|
||||||
float CProjectileWeapon::GetAudibleFallOff() const {
|
float CProjectileWeapon::GetAudibleFallOff() const {
|
||||||
if (!x4_weaponDesc->x94_COLR)
|
if (!x4_weaponDesc->x94_COLR)
|
||||||
return 0.f;
|
return 0.f;
|
||||||
return x4_weaponDesc->x94_COLR.m_res->GetAudibleFallOff();
|
return x4_weaponDesc->x94_COLR->GetAudibleFallOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
float CProjectileWeapon::GetAudibleRange() const {
|
float CProjectileWeapon::GetAudibleRange() const {
|
||||||
if (!x4_weaponDesc->x94_COLR)
|
if (!x4_weaponDesc->x94_COLR)
|
||||||
return 0.f;
|
return 0.f;
|
||||||
return x4_weaponDesc->x94_COLR.m_res->GetAudibleRange();
|
return x4_weaponDesc->x94_COLR->GetAudibleRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<TLockedToken<CDecalDescription>>
|
std::optional<TLockedToken<CDecalDescription>>
|
||||||
|
@ -138,13 +137,13 @@ CProjectileWeapon::GetDecalForCollision(EWeaponCollisionResponseTypes type) cons
|
||||||
if (!x4_weaponDesc->x94_COLR) {
|
if (!x4_weaponDesc->x94_COLR) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
return x4_weaponDesc->x94_COLR.m_res->GetDecalDescription(type);
|
return x4_weaponDesc->x94_COLR->GetDecalDescription(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 CProjectileWeapon::GetSoundIdForCollision(EWeaponCollisionResponseTypes type) const {
|
s32 CProjectileWeapon::GetSoundIdForCollision(EWeaponCollisionResponseTypes type) const {
|
||||||
if (!x4_weaponDesc->x94_COLR)
|
if (!x4_weaponDesc->x94_COLR)
|
||||||
return -1;
|
return -1;
|
||||||
return x4_weaponDesc->x94_COLR.m_res->GetSoundEffectId(type);
|
return x4_weaponDesc->x94_COLR->GetSoundEffectId(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<TLockedToken<CGenDescription>> CProjectileWeapon::CollisionOccured(EWeaponCollisionResponseTypes type,
|
std::optional<TLockedToken<CGenDescription>> CProjectileWeapon::CollisionOccured(EWeaponCollisionResponseTypes type,
|
||||||
|
@ -183,7 +182,7 @@ std::optional<TLockedToken<CGenDescription>> CProjectileWeapon::CollisionOccured
|
||||||
if (!x4_weaponDesc->x94_COLR) {
|
if (!x4_weaponDesc->x94_COLR) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
return x4_weaponDesc->x94_COLR.m_res->GetParticleDescription(type);
|
return x4_weaponDesc->x94_COLR->GetParticleDescription(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue