Decompile 2 functions in Source/Contents/Effects/StarEffect.cpp

Batch #15640 by Yommy: 0 byte-identical, 2 confirmed by peer review.

- fn_19205 CStarEffect::SetupParticle: logic confirmed by peer review
- fn_19208 CStarEffect::UpdateParticle: logic confirmed by peer review

Peer-reviewed-by: ragnarok-clanker, eAthena
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-10 09:28:17 +00:00
commit de463d2c65

View file

@ -65,22 +65,22 @@ void CStarEffect::SetupParticle(CParticle* particle) {
particle->elapsedFrames = 0;
particle->alpha = 0;
for (int index = 0; index < 4; ++index) {
state.angles[index] = static_cast<float>(std::max(rand() % 360, 0));
state.angles[index] = static_cast<float>(std::max(0, rand() % 360));
}
state.lifetime = static_cast<float>(std::max(rand() % 200, 0) + 300);
state.lifetime = static_cast<float>(std::max(0, rand() % 200) + 300);
state.texture = 1.0f;
state.baseScale = static_cast<float>(std::max(rand() % 20, 0)) + 20.0f;
state.phase = static_cast<float>(std::max(rand() % 360, 0));
state.baseScale = static_cast<float>(std::max(0, rand() % 20)) + 20.0f;
state.phase = static_cast<float>(std::max(0, rand() % 360));
particle->SetTexture("effect\\star01.bmp");
float speedZ = static_cast<float>(std::max(rand() % 200, 0) + 25);
const float speedY = static_cast<float>(std::max(rand() % 10, 0)) + 80.0f;
float speedX = static_cast<float>(std::max(rand() % 200, 0) + 25);
if (std::max(rand() % 2, 0) == 0) {
float speedZ = static_cast<float>(std::max(0, rand() % 200) + 25);
const float speedY = static_cast<float>(std::max(0, rand() % 10)) + 80.0f;
float speedX = static_cast<float>(std::max(0, rand() % 200) + 25);
if (std::max(0, rand() % 2) == 0) {
speedX *= -1.0f;
}
if (std::max(rand() % 2, 0) == 0) {
if (std::max(0, rand() % 2) == 0) {
speedZ *= -1.0f;
}
@ -144,12 +144,12 @@ void CStarEffect::UpdateParticle(CParticle* particle) {
if (target > current) {
current = std::min(current + 1, 359);
if (target < current) {
target = current ? std::max(rand() % current, 0) : 0;
target = current ? std::max(0, rand() % current) : 0;
}
} else {
current = std::max(current - 1, 0);
current = std::max(0, current - 1);
if (target >= current) {
target = 359 - (current ? std::max(rand() % current, 0) : 0);
target = 359 - (current ? std::max(0, rand() % current) : 0);
}
}
state.angles[pair * 2 + 1] = static_cast<float>(target);
@ -170,7 +170,7 @@ void CStarEffect::UpdateParticle(CParticle* particle) {
if (phase >= 360) {
phase -= 360;
}
phase = std::max(phase, 0);
phase = std::max(0, phase);
particle->scale = state.baseScale * g_sinTable[phase] * 0.05f + state.baseScale;
state.phase = static_cast<float>(phase);