Decompile fn_18958 (CMappillarEffect::Slot03)

Batch #4078 by Yommy: 0 byte-identical, 1 confirmed by peer review.

- fn_18958 CMappillarEffect::Slot03: logic confirmed by peer review

Peer-reviewed-by: ragnarok-clanker, superintelligence, KWDev
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-10-30 00:59:38 +00:00
commit b8a7798874
2 changed files with 48 additions and 0 deletions

View file

@ -1,6 +1,10 @@
#include "Contents/Effects/MappillarEffect.h"
#include "Contents/Effects/Particle.h"
#include "Utility/Math/AffineMatrix.h"
#include <algorithm>
#include <cstring>
// OFFSET: 0x00B4C0B0
// FUNCTION: fn_18957
@ -8,6 +12,49 @@ bool CMappillarEffect::Slot06() {
return this->ActorExists();
}
// OFFSET: 0x00B4C0C0
// FUNCTION: fn_18958
void CMappillarEffect::Slot03() {
for (auto it = this->particles.begin(); it != this->particles.end(); ++it) {
(*it)->position.x = this->position[0];
(*it)->position.y = this->position[1];
(*it)->position.z = this->position[2];
if (CParticle* particle = *it) {
if (particle->unknown_0010 != 3 || particle->unknown_000C != 21 || particle->unknown_00E8 <= 999) {
const int frame = particle->unknown_00E8;
const int angle = static_cast<int>(*reinterpret_cast<float*>(&particle->unknown_00C4) - static_cast<float>(frame));
float height;
if (frame >= 800) {
particle->unknown_00C0 = std::max(0.0f, particle->unknown_00C0 - 1.0f);
height = particle->unknown_00C0;
} else if (frame < 200) {
height = 0.0f;
} else if (frame > 290) {
height = particle->unknown_00C0;
} else {
height = g_sinTable[frame - 200] * particle->unknown_00C0;
}
particle->unknown_0054 = height;
if (height < 0.0f) {
particle->unknown_0054 = 0.0f;
}
matrix rotation;
std::memcpy(rotation.values, g_identityMatrix, sizeof(rotation.values));
rotation.MakeYRotation(static_cast<float>(angle) / 180.0f * 3.141592f);
matrix scale;
std::memcpy(scale.values, g_identityMatrix, sizeof(scale.values));
scale.SetScale(1.0f, particle->unknown_0054 / 100.0f * 1.1f, 1.0f);
const matrix first = rotation;
rotation.Compose(first, scale);
particle->transform = rotation;
}
}
++(*it)->unknown_00E8;
}
}
// OFFSET: 0x00B4C4C0
// FUNCTION: fn_18959
void CMappillarEffect::Slot04() {

View file

@ -10,6 +10,7 @@ class CParticle;
class CMappillarEffect : public CEffect {
public:
void Slot03() override;
void Slot04() override;
bool Slot06() override;