From 2e808aaa74dc9579fdb8843ac8819a33bd35d439 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 22:53:38 +0000 Subject: [PATCH] Decompile 3 functions in Source/Contents/Effects/EffectPrimitiveMotion.cpp, Source/Contents/Effects/EffectParticle.h, ... Batch #1853 by ragnarok-clanker: 1 byte-identical, 2 confirmed by peer review. - fn_19849 EffectPrimitiveState::UpdateColor: logic confirmed by peer review - fn_19762 EffectPrimitiveSlot::EffectPrimitiveSlot: byte-identical (already on main) - fn_19865 DrawEffectPrimitive15: logic confirmed by peer review Peer-reviewed-by: Yommy Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Actors/RenderObject.cpp | 2 +- Source/Contents/Actors/RenderObjectState.cpp | 2 +- Source/Contents/Actors/RenderObjectState.h | 2 +- Source/Contents/Effects/EffectParticle.h | 2 + .../Contents/Effects/EffectPrimitiveColor.cpp | 16 +- .../Effects/EffectPrimitiveMotion.cpp | 248 ++++++++++++++++-- .../Effects/EffectPrimitiveRecords.cpp | 4 +- .../Effects/EffectPrimitiveRendering.cpp | 2 +- .../Contents/Effects/EffectPrimitiveState.cpp | 8 +- .../Contents/Effects/EffectPrimitiveState.h | 6 +- Source/Contents/Sound/SoundMaker.cpp | 4 +- 11 files changed, 255 insertions(+), 41 deletions(-) diff --git a/Source/Contents/Actors/RenderObject.cpp b/Source/Contents/Actors/RenderObject.cpp index 0022d16..629b07c 100644 --- a/Source/Contents/Actors/RenderObject.cpp +++ b/Source/Contents/Actors/RenderObject.cpp @@ -113,7 +113,7 @@ void CRenderObject::SetAnimation(unsigned animation, int, int repeat) { this->render.animation = animation; this->render.previousAnimation = animation; - this->render.unknown_003C = 0; + this->render.curMotion = 0; this->render.unknown_006C = repeat; this->render.unknown_009C[1] = 0; this->render.unknown_0060 = 1.0f; diff --git a/Source/Contents/Actors/RenderObjectState.cpp b/Source/Contents/Actors/RenderObjectState.cpp index 5de5328..a108583 100644 --- a/Source/Contents/Actors/RenderObjectState.cpp +++ b/Source/Contents/Actors/RenderObjectState.cpp @@ -33,7 +33,7 @@ void RenderObjectState::Reset(ResourceMgr& resources, JobNames& names) { this->animation = 0; this->previousAnimation = 0; this->unknown_0040 = 0; - this->unknown_003C = 0; + this->curMotion = 0; this->unknown_0044 = 0; this->angle = 0; this->scale = 1; diff --git a/Source/Contents/Actors/RenderObjectState.h b/Source/Contents/Actors/RenderObjectState.h index b8ea9d3..26e1003 100644 --- a/Source/Contents/Actors/RenderObjectState.h +++ b/Source/Contents/Actors/RenderObjectState.h @@ -23,7 +23,7 @@ struct RenderObjectState { /* 001C */ std::string name; /* 0034 */ int animation; /* 0038 */ int previousAnimation; - /* 003C */ std::uint32_t unknown_003C; + /* 003C */ int curMotion; /* 0040 */ std::uint32_t unknown_0040; /* 0044 */ std::uint32_t unknown_0044; /* 0048 */ std::uint32_t unknown_0048; diff --git a/Source/Contents/Effects/EffectParticle.h b/Source/Contents/Effects/EffectParticle.h index 801afbe..fb611fb 100644 --- a/Source/Contents/Effects/EffectParticle.h +++ b/Source/Contents/Effects/EffectParticle.h @@ -36,6 +36,8 @@ struct EffectParticle : CRenderObject { void PrimGuard(); bool PrimLineLink(); void PrimSMA(); + void PrimShieldBoomerang3(); + bool PrimSuperAngel(); bool AdvanceFrame(); void UpdateRecords(); diff --git a/Source/Contents/Effects/EffectPrimitiveColor.cpp b/Source/Contents/Effects/EffectPrimitiveColor.cpp index 7ad0277..36f92fa 100644 --- a/Source/Contents/Effects/EffectPrimitiveColor.cpp +++ b/Source/Contents/Effects/EffectPrimitiveColor.cpp @@ -24,10 +24,10 @@ void EffectPrimitiveState::UpdateColor() { const float value = this->unknown_0258[1][index]; if (valuesAndLimit) { - this->unknown_0324 = value; + this->alpha = value; this->unknown_02D4 = this->unknown_0258[2][index]; } else { - this->unknown_0328 = value; + this->alphaSpeed = value; } this->unknown_01D8 = index + 1; @@ -37,10 +37,10 @@ void EffectPrimitiveState::UpdateColor() { const float lower = this->unknown_02D8; if ((this->flags & 0x80u) != 0) { - const bool below = this->unknown_0328 >= 0.0f ? this->unknown_0324 < this->unknown_02D4 : lower < this->unknown_0324; + const bool below = this->alphaSpeed >= 0.0f ? this->alpha < this->unknown_02D4 : lower < this->alpha; if (!below) { - this->unknown_0328 *= -1.0f; + this->alphaSpeed *= -1.0f; } } @@ -51,20 +51,20 @@ void EffectPrimitiveState::UpdateColor() { if (remaining > parentRemaining + 1) { this->unknown_015C = 1; this->flags &= ~0x80u; - this->unknown_0328 = -(this->unknown_0324 / static_cast(parentRemaining)); + this->alphaSpeed = -(this->alpha / static_cast(parentRemaining)); } } if (current == this->unknown_01F0) { this->flags &= ~0x80u; const int remaining = this->lifetime - current; - this->unknown_0328 = -(this->unknown_0324 / static_cast(remaining)) * this->unknown_032C; + this->alphaSpeed = -(this->alpha / static_cast(remaining)) * this->alphaDelta; } - const float sum = this->unknown_0328 + this->unknown_0324; + const float sum = this->alphaSpeed + this->alpha; const float minimum = lower > sum ? lower : sum; const float bounded = this->unknown_02D4 < minimum ? this->unknown_02D4 : minimum; - this->unknown_0324 = bounded; + this->alpha = bounded; const auto alpha = static_cast(TruncateToInt(bounded)); const auto color = ((alpha * 256u + static_cast(this->red)) * 256u + static_cast(this->green)) * 256u + static_cast(this->blue); diff --git a/Source/Contents/Effects/EffectPrimitiveMotion.cpp b/Source/Contents/Effects/EffectPrimitiveMotion.cpp index c7dabe4..3ed6502 100644 --- a/Source/Contents/Effects/EffectPrimitiveMotion.cpp +++ b/Source/Contents/Effects/EffectPrimitiveMotion.cpp @@ -271,11 +271,11 @@ bool MoveEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& rend particle.UpdateColor(); if (particle.unknown_01E0 % particle.unknown_01E8 == 0) { - const auto next = render.unknown_003C + 1u; - render.unknown_003C = next; + const auto next = render.curMotion + 1u; + render.curMotion = next; if (particle.unknown_0254 != 0) { - render.unknown_003C = static_cast(next) % static_cast(particle.textureCount); + render.curMotion = static_cast(next) % static_cast(particle.textureCount); } else if (next == particle.textureCount) { return false; } @@ -454,11 +454,11 @@ bool SpinEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& rend particle.UpdateColor(); if (particle.unknown_01E0 % particle.unknown_01E8 == 0) { - const auto next = render.unknown_003C + 1u; - render.unknown_003C = next; + const auto next = render.curMotion + 1u; + render.curMotion = next; if (particle.unknown_0254 != 0) { - render.unknown_003C = static_cast(next) % static_cast(particle.textureCount); + render.curMotion = static_cast(next) % static_cast(particle.textureCount); } else if (next == particle.textureCount) { return false; } @@ -507,11 +507,11 @@ bool RollEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& rend particle.UpdateColor(); if (particle.unknown_01E0 % particle.unknown_01E8 == 0) { - const auto next = render.unknown_003C + 1u; - render.unknown_003C = next; + const auto next = render.curMotion + 1u; + render.curMotion = next; if (particle.unknown_0254 != 0) { - render.unknown_003C = static_cast(next) % static_cast(particle.textureCount); + render.curMotion = static_cast(next) % static_cast(particle.textureCount); } else if (next == particle.textureCount) { return false; } @@ -567,23 +567,23 @@ bool EffectParticle::AdvanceFrame() { } const unsigned animation = static_cast(this->render.previousAnimation); - ++this->render.unknown_003C; + ++this->render.curMotion; if (this->state.unknown_0254 != 0) { - this->render.unknown_003C = - static_cast(static_cast(this->render.unknown_003C) % static_cast(action->FrameCount(animation))); + this->render.curMotion = + static_cast(static_cast(this->render.curMotion) % static_cast(action->FrameCount(animation))); return true; } if ((this->state.flags & 0x800u) != 0) { - if (this->render.unknown_003C == action->FrameCount(animation)) { - --this->render.unknown_003C; + if (this->render.curMotion == action->FrameCount(animation)) { + --this->render.curMotion; } return true; } - return this->render.unknown_003C != action->FrameCount(animation); + return this->render.curMotion != action->FrameCount(animation); } // OFFSET: 0x00BB5E80 @@ -1487,6 +1487,218 @@ void EffectParticle::PrimSMA() { } } +// OFFSET: 0x00BC2A60 +void EffectParticle::PrimShieldBoomerang3() { + EffectPrimitiveSlot* slots = this->state.slots; + FaceCamera(slots); + + const AttachedEffect* master = this->state.master; + this->render.position[0] = master->render.position[0]; + this->render.position[1] = master->render.position[1]; + this->render.position[2] = master->render.position[2]; + + EffectPrimitiveSlot& slot = slots[0]; + + if (slot.life != 1) { + return; + } + + ++slot.process; + + if (slot.process <= 0) { + return; + } + + const char interval = 3; + + if (slot.process % interval == 0) { + if (slot.process > 3) { + FollowTrail(slots[3], slots[2], 25); + } + + if (slot.process > 2) { + FollowTrail(slots[2], slots[1], 25); + } + + if (slot.process > 1) { + FollowTrail(slots[1], slot, 150); + } + } + + slot.fullDisplayAngle -= 15; + + if (slot.fullDisplayAngle < 0) { + slot.fullDisplayAngle += 360; + } + + if (slot.process <= 5) { + slot.alphaB += 45; + + if (slot.alphaB > 255) { + slot.alphaB = 255; + } + } + + if (slot.process >= 15) { + slot.alphaB -= 10; + + if (slot.alphaB < 0) { + slot.alphaB = 0; + } + } + + slot.vecBNow.x += slot.height[1] * g_cosTable[slot.rotStart]; + slot.vecBNow.z += slot.height[1] * g_sinTable[slot.rotStart]; +} + +// OFFSET: 0x00BC3C70 +bool EffectParticle::PrimSuperAngel() { + const AttachedEffect* master = this->state.master; + this->render.position[0] = master->render.position[0]; + this->render.position[1] = master->render.position[1]; + this->render.position[2] = master->render.position[2]; + + EffectPrimitiveSlot& slot = this->state.slots[0]; + + if (slot.life == 1) { + ++slot.process; + slot.vecBNow.y -= 0.1f; + slot.vecBPre = slot.vecBNow; + this->state.offset = slot.vecBPre; + + float& alpha = this->state.alpha; + const char kind = slot.flag1[0]; + + if (slot.process < 50) { + if (slot.flag1[1] == 0) { + if (kind == 1) { + if (alpha < 200.0f) { + alpha += 5.0f; + } + } else if (kind == 10) { + if (alpha < 255.0f) { + alpha += 10.0f; + } + + if (alpha > 255.0f) { + alpha = 255.0f; + } + } else if (kind == 11) { + alpha = 0.0f; + } else if (kind >= 2) { + if (slot.process < 30 && alpha < 150.0f) { + alpha += 5.0f; + } + } else if (alpha < 245.0f) { + alpha += 5.0f; + } + } else if (alpha < static_cast(40 - slot.flag1[1])) { + alpha += 1.0f; + } + } + + if (slot.process > 30) { + int& motion = this->render.curMotion; + + if (kind == 0) { + if (slot.process % 3 == 0) { + ++motion; + } + + if (motion > 29) { + motion = 29; + } + } else if (kind == 1) { + if (slot.process % 3 == 0) { + ++motion; + } + + if (motion > 29) { + motion = 29; + } + } else if (kind == 10 || kind == 11) { + if (slot.process % 4 == 0) { + ++motion; + } + + if (motion > 15) { + motion = 15; + } + } else if (kind >= 2) { + if (slot.process % 3 == 0) { + ++motion; + } + + if (motion > 29) { + motion = 29; + } + } + } + + if (kind == 0) { + if (slot.process > 100) { + alpha -= 4.0f; + + if (alpha < 0.0f) { + alpha = 0.0f; + } + } + } else if (kind == 2) { + if (slot.process > 30) { + alpha -= 3.0f; + + if (alpha < 0.0f) { + alpha = 0.0f; + } + } + } else if (kind == 3) { + if (slot.process > 60) { + alpha -= 3.0f; + + if (alpha < 0.0f) { + alpha = 0.0f; + } + } + } else if (kind == 4) { + if (slot.process > 70) { + alpha -= 3.0f; + + if (alpha < 0.0f) { + alpha = 0.0f; + } + } + } else if (kind == 10) { + if (slot.process > 100) { + alpha -= 6.0f; + + if (alpha < 0.0f) { + alpha = 0.0f; + } + } + } else if (slot.flag1[1] != 0) { + if (slot.process > 75) { + alpha -= 3.0f; + + if (alpha < 0.0f) { + alpha = 0.0f; + } + } + } else if (slot.process > 75) { + alpha -= 6.0f; + + if (alpha < 0.0f) { + alpha = 0.0f; + } + } + } + + this->render.position[0] = this->state.offset.x; + this->render.position[1] = this->state.offset.y; + this->render.position[2] = this->state.offset.z; + this->UpdateRecords(); + return true; +} + // OFFSET: 0x00BB6F30 // FUNCTION: fn_19779 bool EffectParticle::UpdateHit6() { @@ -1841,7 +2053,7 @@ void EffectParticle::UpdateRecords() { record.unknown_003C = previous.unknown_003C; record.angle = previous.angle; std::memcpy(record.matrix, previous.matrix, sizeof(record.matrix)); - record.alpha = this->state.unknown_0324 - this->state.unknown_0324 / static_cast(count) * static_cast(index); + record.alpha = this->state.alpha - this->state.alpha / static_cast(count) * static_cast(index); const std::uint32_t red = static_cast(this->state.red); const std::uint32_t green = static_cast(this->state.green); @@ -1863,10 +2075,10 @@ void EffectParticle::UpdateRecords() { first.scale = this->state.scale; first.angle = this->state.unknown_030C; std::memcpy(first.matrix, this->state.matrix1, sizeof(first.matrix)); - first.alpha = this->state.unknown_0324; + first.alpha = this->state.alpha; const std::uint32_t red = static_cast(this->state.red); const std::uint32_t green = static_cast(this->state.green); const std::uint32_t blue = static_cast(this->state.blue); - first.color = (static_cast(static_cast(this->state.unknown_0324)) << 24) | (red << 16) | (green << 8) | blue; + first.color = (static_cast(static_cast(this->state.alpha)) << 24) | (red << 16) | (green << 8) | blue; } diff --git a/Source/Contents/Effects/EffectPrimitiveRecords.cpp b/Source/Contents/Effects/EffectPrimitiveRecords.cpp index 0cbc2f5..9d5bbd2 100644 --- a/Source/Contents/Effects/EffectPrimitiveRecords.cpp +++ b/Source/Contents/Effects/EffectPrimitiveRecords.cpp @@ -15,12 +15,12 @@ void EffectPrimitiveState::InitializeRecords(const RenderObjectState& render) { record.scale = this->scale; record.angle = this->unknown_030C; std::memcpy(record.matrix, this->matrix1, sizeof(record.matrix)); - record.alpha = this->unknown_0324; + record.alpha = this->alpha; record.red = this->red; record.green = this->green; record.blue = this->blue; - const int alpha = TruncateToInt(this->unknown_0324); + const int alpha = TruncateToInt(this->alpha); record.color = static_cast(this->blue) + ((static_cast(this->green) + ((static_cast(this->red) + (static_cast(alpha) << 8)) << 8)) << 8); } diff --git a/Source/Contents/Effects/EffectPrimitiveRendering.cpp b/Source/Contents/Effects/EffectPrimitiveRendering.cpp index b4aa10b..5aec0e3 100644 --- a/Source/Contents/Effects/EffectPrimitiveRendering.cpp +++ b/Source/Contents/Effects/EffectPrimitiveRendering.cpp @@ -68,7 +68,7 @@ void DrawEffectPrimitive15(EffectPrimitiveState& particle, const RenderObjectSta vertex.v = v[triangleIndex][vertexIndex]; } - triangle.texture = particle.textures[render.unknown_003C]; + triangle.texture = particle.textures[render.curMotion]; } for (unsigned index = 0; index < 2; ++index) { diff --git a/Source/Contents/Effects/EffectPrimitiveState.cpp b/Source/Contents/Effects/EffectPrimitiveState.cpp index abafd74..2c1db86 100644 --- a/Source/Contents/Effects/EffectPrimitiveState.cpp +++ b/Source/Contents/Effects/EffectPrimitiveState.cpp @@ -54,7 +54,7 @@ EffectPrimitiveState::EffectPrimitiveState(RenderObjectState& render) { this->unknown_0338 = 0; this->unknown_0358 = 0.0f; this->unknown_0364 = 0.0f; - this->unknown_0328 = 0.0f; + this->alphaSpeed = 0.0f; this->unknown_02EC = 0; this->unknown_02C0 = 0.0f; this->unknown_0320 = 0; @@ -96,15 +96,15 @@ EffectPrimitiveState::EffectPrimitiveState(RenderObjectState& render) { this->unknown_01EC = -1; this->unknown_01F0 = -1; this->unknown_01C0 = -1; - this->unknown_0324 = 254.0f; - this->unknown_032C = 1.0f; + this->alpha = 254.0f; + this->alphaDelta = 1.0f; this->unknown_02D4 = 254.0f; this->unknown_02D8 = 0; this->unknown_0254 = 1; this->unknown_01F4 = 1; this->unknown_01E8 = 4; render.previousAnimation = 0; - render.unknown_003C = 0; + render.curMotion = 0; this->textureCount = 1; this->unknown_02E4 = 0; this->unknown_02DC = 0; diff --git a/Source/Contents/Effects/EffectPrimitiveState.h b/Source/Contents/Effects/EffectPrimitiveState.h index ee496a3..4b8067a 100644 --- a/Source/Contents/Effects/EffectPrimitiveState.h +++ b/Source/Contents/Effects/EffectPrimitiveState.h @@ -135,9 +135,9 @@ struct EffectPrimitiveState { /* 0318 */ float scale; /* 031C */ float unknown_031C; /* 0320 */ float unknown_0320; - /* 0324 */ float unknown_0324; - /* 0328 */ float unknown_0328; - /* 032C */ float unknown_032C; + /* 0324 */ float alpha; + /* 0328 */ float alphaSpeed; + /* 032C */ float alphaDelta; /* 0330 */ float unknown_0330; /* 0334 */ float unknown_0334; /* 0338 */ float unknown_0338; diff --git a/Source/Contents/Sound/SoundMaker.cpp b/Source/Contents/Sound/SoundMaker.cpp index c7b1f35..0866bfb 100644 --- a/Source/Contents/Sound/SoundMaker.cpp +++ b/Source/Contents/Sound/SoundMaker.cpp @@ -352,9 +352,9 @@ void CNumEffect::SendObjectMessage( this->render.position[1] -= 12.0f; this->baseHeight = this->render.position[1]; - this->render.unknown_003C = d; + this->render.curMotion = d; if (d > 9 || d < 0) { - this->render.unknown_003C = 0; + this->render.curMotion = 0; } this->render.unknown_0078 = f;