CActorModelParticles: Dehardcode container sizes where applicable

This commit is contained in:
Lioncash 2020-04-03 00:06:22 -04:00
parent 93dd28988d
commit c913502d90
1 changed files with 17 additions and 14 deletions

View File

@ -456,12 +456,13 @@ void CActorModelParticles::AddStragglersToRenderer(const CStateManager& mgr) {
continue; continue;
} }
if (isNotCold) { if (isNotCold) {
/* Hot Draw */ // Hot Draw
for (int i = 0; i < 8; ++i) { for (auto& entry : item.x8_onFireGens) {
std::unique_ptr<CElementGen>& gen = item.x8_onFireGens[i].first; std::unique_ptr<CElementGen>& gen = entry.first;
if (gen) if (gen) {
g_Renderer->AddParticleGen(*gen); g_Renderer->AddParticleGen(*gen);
} }
}
if (mgr.GetThermalDrawFlag() != EThermalDrawFlag::Hot && item.x78_ashGen) if (mgr.GetThermalDrawFlag() != EThermalDrawFlag::Hot && item.x78_ashGen)
g_Renderer->AddParticleGen(*item.x78_ashGen); g_Renderer->AddParticleGen(*item.x78_ashGen);
if (item.xb8_firePopGen) if (item.xb8_firePopGen)
@ -485,20 +486,22 @@ void CActorModelParticles::AddStragglersToRenderer(const CStateManager& mgr) {
} }
void CActorModelParticles::UpdateLoad() { void CActorModelParticles::UpdateLoad() {
if (xe4_loadingDeps) { if (!xe4_loadingDeps) {
return;
}
xe5_justLoadedDeps = 0; xe5_justLoadedDeps = 0;
for (int i = 0; i < 6; ++i) { for (size_t i = 0; i < x50_dgrps.size(); ++i) {
if (xe4_loadingDeps & (1 << i)) { if ((xe4_loadingDeps & (1U << i)) != 0) {
x50_dgrps[i].UpdateLoad(); x50_dgrps[i].UpdateLoad();
if (x50_dgrps[i].x14_loaded) { if (x50_dgrps[i].x14_loaded) {
xe5_justLoadedDeps |= (1 << i); xe5_justLoadedDeps |= (1U << i);
xe4_loadingDeps &= ~(1 << i); xe4_loadingDeps &= ~(1U << i);
} }
} }
} }
xe6_loadedDeps |= xe5_justLoadedDeps; xe6_loadedDeps |= xe5_justLoadedDeps;
} }
}
void CActorModelParticles::Update(float dt, CStateManager& mgr) { void CActorModelParticles::Update(float dt, CStateManager& mgr) {
UpdateLoad(); UpdateLoad();