Decompile fn_18887 (CCherryBlossomEffect::OnProcess)

Batch #18351 by eAthena: 0 byte-identical, 1 confirmed by peer review.

- fn_18887 CCherryBlossomEffect::OnProcess: logic confirmed by peer review

Peer-reviewed-by: kyoshi, cremane, bibinir
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-11-12 15:43:22 +00:00
commit 67916300ea

View file

@ -83,16 +83,16 @@ void CCherryBlossomEffect::OnProcess() {
if (particle) {
const int index = particle->columnIndex + particle->rowIndex * 4;
const float speed = particle->speedParameter;
EffectPoint& offset = this->offsets[index];
if (offset.y < 0.0f) {
if (offset.y < -30.0f) {
offset.x = 0.0f;
offset.y = static_cast<float>(Random(100));
offset.z = 0.0f;
if (this->offsets[index].y < 0.0f) {
if (this->offsets[index].y < -30.0f) {
const float height = static_cast<float>(Random(100));
this->offsets[index].x = 0.0f;
this->offsets[index].y = height;
this->offsets[index].z = 0.0f;
float* angles = &particle->animationParameter;
float* angle = &particle->animationParameter;
for (int i = 0; i < 4; ++i) {
angles[i] = static_cast<float>(Random(360));
*angle++ = static_cast<float>(Random(360));
}
particle->alpha = 0;
@ -103,28 +103,26 @@ void CCherryBlossomEffect::OnProcess() {
const int delta = static_cast<int>(angles[i + 2]) - current;
angles[i] = static_cast<float>(current + (delta > 0 ? 3 : -2));
if (std::abs(delta) < 3) {
int target;
if (delta > 0) {
target = Random(current);
angles[i + 2] = static_cast<float>(Random(current));
} else {
target = 359 - Random(current);
angles[i + 2] = static_cast<float>(359 - Random(current));
}
angles[i + 2] = static_cast<float>(target);
}
}
offset.x += speed * g_sinTable[static_cast<int>(angles[0])];
offset.z += speed * g_sinTable[static_cast<int>(angles[1])];
if (offset.y < -20.0f) {
particle->alpha = std::max(particle->alpha - 4, 0);
this->offsets[index].x += speed * g_sinTable[static_cast<int>(angles[0])];
this->offsets[index].z += speed * g_sinTable[static_cast<int>(angles[1])];
if (this->offsets[index].y < -20.0f) {
const int alpha = particle->alpha - 4;
particle->alpha = alpha >= 0 ? alpha : 0;
} else if (particle->alpha != 255) {
particle->alpha = 255;
}
}
}
offset.y -= speed;
this->offsets[index].y -= speed;
matrix rotation;
std::memcpy(rotation.values, g_identityMatrix, sizeof(rotation.values));
@ -133,7 +131,7 @@ void CCherryBlossomEffect::OnProcess() {
matrix translation;
std::memcpy(translation.values, g_identityMatrix, sizeof(translation.values));
translation.MakeTranslate(offset.x, offset.y, offset.z);
translation.MakeTranslate(this->offsets[index].x, this->offsets[index].y, this->offsets[index].z);
matrix scale;
std::memcpy(scale.values, g_identityMatrix, sizeof(scale.values));