From b141893db3dc6e7d08111cc8ace34f4013dffd0e Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 05:23:49 +0000 Subject: [PATCH] Decompile fn_19966 (CEffectPrim::FollowMasterAndAdvance) Batch #11912 by StrawberrysherbetIX: 1 byte-identical, 0 confirmed by peer review. - fn_19966 CEffectPrim::FollowMasterAndAdvance: byte-identical Merged automatically: every function is byte-identical to the original. --- Source/Contents/Effects/EffectPrim.h | 4 +- .../Effects/EffectPrimitiveMotion.cpp | 84 +++++++++++-------- 2 files changed, 49 insertions(+), 39 deletions(-) diff --git a/Source/Contents/Effects/EffectPrim.h b/Source/Contents/Effects/EffectPrim.h index f1dbcd17..c5e97b93 100644 --- a/Source/Contents/Effects/EffectPrim.h +++ b/Source/Contents/Effects/EffectPrim.h @@ -153,9 +153,9 @@ struct CEffectPrim : CRenderObject { bool PrimWind(); void Tei_TowardScreen(vector3d& vec1, vector3d& vec2, vector3d& vec3, vector3d& vec4, short rot0, short rot1); - bool AnimMotion(); + unsigned char AnimMotion(); bool IsPartyVisible(); - bool FollowMasterAndAdvance(); + unsigned char FollowMasterAndAdvance(); void FollowMasterAndTickSlots(); void FollowMasterAndTickSlots2(); void ShiftSegment(); diff --git a/Source/Contents/Effects/EffectPrimitiveMotion.cpp b/Source/Contents/Effects/EffectPrimitiveMotion.cpp index e032e2b2..eeecf58b 100644 --- a/Source/Contents/Effects/EffectPrimitiveMotion.cpp +++ b/Source/Contents/Effects/EffectPrimitiveMotion.cpp @@ -580,8 +580,8 @@ void CEffectPrim::AdvanceEffectPrimitive() { // OFFSET: 0x00BAE3A0 // FUNCTION: fn_19764 -bool CEffectPrim::AnimMotion() { - CActRes* action = this->render.action; +unsigned char CEffectPrim::AnimMotion() { + CActRes* action = this->GetActRes(); if (this->state.stateCnt % this->state.animSpeed != 0) { return true; @@ -590,21 +590,20 @@ bool CEffectPrim::AnimMotion() { const unsigned animation = static_cast(this->render.previousAnimation); ++this->render.curMotion; - if (this->state.repeatAnim != 0) { + if (this->state.repeatAnim == 0) { + if ((this->state.pattern & 0x800u) != 0) { + if (this->render.curMotion == action->FrameCount(animation)) { + --this->render.curMotion; + } + } else if (this->render.curMotion == action->FrameCount(animation)) { + return false; + } + } else { this->render.curMotion = static_cast(static_cast(this->render.curMotion) % static_cast(action->FrameCount(animation))); - return true; } - if ((this->state.pattern & 0x800u) != 0) { - if (this->render.curMotion == action->FrameCount(animation)) { - --this->render.curMotion; - } - - return true; - } - - return this->render.curMotion != action->FrameCount(animation); + return true; } // OFFSET: 0x00BB5E80 @@ -2977,7 +2976,7 @@ static void TickLiveSlots(EffectPrimitiveSlot* slots) { // OFFSET: 0x00BEB020 // FUNCTION: fn_19966 -bool CEffectPrim::FollowMasterAndAdvance() { +unsigned char CEffectPrim::FollowMasterAndAdvance() { FollowMaster(*this); return this->AnimMotion(); } @@ -5478,8 +5477,9 @@ void CEffectPrim::PrimWaveHeights() { const int offset = index * 45; for (int point = 0; point < 21; ++point) { const int angle = offset >= 90 ? 2 * (offset + slot.process) : phase + slot.process; - slot.height[point] = slot.maxHeight; - slot.height[point] = g_sinTable[9 * point] * slot.maxHeight * 0.3f * g_sinTable[angle % 360] + slot.maxHeight; + const float base = slot.maxHeight; + slot.height[point] = base; + slot.height[point] = g_sinTable[9 * point] * slot.maxHeight * 0.3f * g_sinTable[angle % 360] + base; } } } @@ -5520,8 +5520,9 @@ void CEffectPrim::PrimWaveHeightsSlow() { const int offset = index * 45; for (int point = 0; point < 21; ++point) { const int angle = offset >= 90 ? 2 * (offset + slot.process) : phase + slot.process; - slot.height[point] = slot.maxHeight; - slot.height[point] = g_sinTable[9 * point] * slot.maxHeight * 0.3f * g_sinTable[angle % 360] + slot.maxHeight; + const float base = slot.maxHeight; + slot.height[point] = base; + slot.height[point] = g_sinTable[9 * point] * slot.maxHeight * 0.3f * g_sinTable[angle % 360] + base; } } } @@ -5562,26 +5563,28 @@ void CEffectPrim::PrimWaveSpin() { } slot.riseAngle = static_cast(slot.riseAngle - 1); - slot.distance += this->state.accel == 99.0f ? 0.1f : 0.3f; - const int floor = this->state.accel == 99.0f ? 30 : 40; - if (slot.riseAngle < floor) { - slot.riseAngle = static_cast(floor); + slot.distance += this->state.accel != 99.0f ? 0.3f : 0.1f; + if (this->state.accel != 99.0f) { + if (slot.riseAngle < 40) { + slot.riseAngle = 40; + } + } else if (slot.riseAngle < 30) { + slot.riseAngle = 30; } if (process <= 10) { slot.alphaB = static_cast(slot.alphaB + (slot.alphaT == 1 ? 10 : 20)); } else { - switch (slot.alphaT) { - case 2: + if (slot.alphaT == 2) { slot.alphaB = static_cast(slot.alphaB - 8); - break; - case 3: - case 4: + } else if (slot.alphaT == 3) { slot.alphaB = static_cast(slot.alphaB - 5); - break; - default: - slot.alphaB = static_cast(slot.alphaB - (slot.alphaT == 5 ? 4 : 2)); - break; + } else if (slot.alphaT == 4) { + slot.alphaB = static_cast(slot.alphaB - 5); + } else if (slot.alphaT == 5) { + slot.alphaB = static_cast(slot.alphaB - 4); + } else { + slot.alphaB = static_cast(slot.alphaB - 2); } if (slot.alphaB <= 0) { @@ -5634,24 +5637,31 @@ void CEffectPrim::PrimBreathingWave() { slot.alphaB = 0; } - if (slot.distance < 4.0f) { - slot.alphaB = static_cast(slot.alphaB + (slot.alphaT == 22 ? 5 : 10)); - } else { + if (slot.distance >= 4.0f) { slot.alphaB = static_cast(slot.alphaB - 3); if (slot.alphaB <= 0) { slot.alphaB = 0; if (process < this->state.duration - 30) { slot.distance = 3.37f; - slot.riseAngle = static_cast(slot.alphaT == 22 ? 64 : 74); + if (slot.alphaT == 22) { + slot.riseAngle = 64; + } else { + slot.riseAngle = 74; + } } } + } else if (slot.alphaT == 22) { + slot.alphaB = static_cast(slot.alphaB + 5); + } else { + slot.alphaB = static_cast(slot.alphaB + 10); } const int offset = index * 45; for (int point = 0; point < 21; ++point) { const int angle = offset >= 90 ? 2 * (offset + slot.process) : phase + slot.process; - slot.height[point] = slot.maxHeight; - slot.height[point] = g_sinTable[9 * point] * slot.maxHeight * 0.3f * g_sinTable[angle % 360] + slot.maxHeight; + const float base = slot.maxHeight; + slot.height[point] = base; + slot.height[point] = g_sinTable[9 * point] * slot.maxHeight * 0.3f * g_sinTable[angle % 360] + base; } } }