rodecomp/Source/Contents/Effects/ParticlePool.cpp
ragnarok-clanker a98c2cece9 Decompile 7 functions in Source/Contents/Effects/ParticlePool.cpp, Source/Contents/Effects/ParticlePool.h
Batch #2836 by youko: 0 byte-identical, 7 confirmed by peer review.

- fn_18849 ParticlePool::ParticlePool: logic confirmed by peer review
- fn_18851 ParticlePool::~ParticlePool: logic confirmed by peer review
- fn_18854 ParticlePool::Acquire: logic confirmed by peer review
- fn_18856 ParticlePool::Release: logic confirmed by peer review
- fn_18857 ParticlePool::IsActive: logic confirmed by peer review
- fn_18858 ParticlePool::ActivateAll: logic confirmed by peer review
- fn_18860 ParticlePool::Add: logic confirmed by peer review

Peer-reviewed-by: willerthal, superintelligence
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-10-29 19:34:31 +00:00

83 lines
1.7 KiB
C++

#include "Contents/Effects/ParticlePool.h"
// OFFSET: 0x00B402F0
// FUNCTION: fn_18849
ParticlePool::ParticlePool() {
for (auto& entry : this->particles) {
entry.second = false;
}
this->active = 0;
}
// OFFSET: 0x00B40560
// FUNCTION: fn_18851
ParticlePool::~ParticlePool() {
this->Clear();
}
// OFFSET: 0x00B40740
// FUNCTION: fn_18854
CParticle* ParticlePool::Acquire() {
if (this->particles.size() <= this->active) {
return nullptr;
}
CParticle* particle = nullptr;
auto it = this->particles.begin();
for (; it != this->particles.end(); ++it) {
if (!it->second) {
break;
}
}
if (it != this->particles.end()) {
particle = it->first;
it->second = true;
++this->active;
}
return particle;
}
// OFFSET: 0x00B407A0
// FUNCTION: fn_18855
void ParticlePool::Clear() {
this->particles.clear();
this->active = 0;
}
// OFFSET: 0x00B407F0
// FUNCTION: fn_18856
void ParticlePool::Release(CParticle* particle) {
if (this->particles.find(particle) != this->particles.end() && this->particles[particle]) {
--this->active;
this->particles[particle] = false;
}
}
// OFFSET: 0x00B40890
// FUNCTION: fn_18857
bool ParticlePool::IsActive(CParticle* particle) {
if (this->particles.find(particle) != this->particles.end()) {
return this->particles[particle];
}
return false;
}
// OFFSET: 0x00B408E0
// FUNCTION: fn_18858
void ParticlePool::ActivateAll() {
for (auto& entry : this->particles) {
entry.second = true;
}
this->active = this->particles.size();
}
// OFFSET: 0x00B40B20
// FUNCTION: fn_18860
void ParticlePool::Add(CParticle* particle) {
if (this->particles.find(particle) == this->particles.end()) {
this->particles[particle] = false;
}
}