From 3c8b89df77ff8aefbe828231debae0db06c340d5 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 12:02:49 +0000 Subject: [PATCH] Decompile fn_10109 (CCharacterRender::DrawShadow) Batch #15754 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_10109 CCharacterRender::DrawShadow: logic confirmed by peer review Peer-reviewed-by: eAthena, bgamez23 Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/SpriteShadow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Contents/SpriteShadow.cpp b/Source/Contents/SpriteShadow.cpp index ea02f662e..cb1b0d348 100644 --- a/Source/Contents/SpriteShadow.cpp +++ b/Source/Contents/SpriteShadow.cpp @@ -17,15 +17,16 @@ // OFFSET: 0x00811C10 // FUNCTION: fn_10109 __declspec(safebuffers) RenderPrimitive* CCharacterRender::DrawShadow(const float* matrix, float scale) const { - if (scale == 0.0f || !g_modeMgr.GetGameMode() || !static_cast(g_modeMgr.GetGameMode())->scene) { + if (0.0f == scale || !g_modeMgr.GetGameMode() || !static_cast(g_modeMgr.GetGameMode())->scene) { return nullptr; } CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); const float* origin = reinterpret_cast(&this->positionX); + const float height = mode->scene->terrain->Height(origin[0], origin[2]); float position[3]; position[0] = origin[0]; - position[1] = mode->scene->terrain->Height(origin[0], origin[2]); + position[1] = height; position[2] = origin[2]; const float depth = position[0] * matrix[2] + position[1] * matrix[5] + position[2] * matrix[8] + matrix[11]; @@ -62,8 +63,7 @@ __declspec(safebuffers) RenderPrimitive* CCharacterRender::DrawShadow(const floa return nullptr; } - quad.color = static_cast(((static_cast(cell.color >> 24) << 8 | (cell.color & 0xFF)) << 8 | (cell.color >> 8 & 0xFF)) << 8) | - (cell.color >> 16 & 0xFF); + quad.color = (((((((cell.color >> 24) & 0xFF) << 8) + (cell.color & 0xFF)) << 8) + ((cell.color >> 8) & 0xFF)) << 8) + ((cell.color >> 16) & 0xFF); quad.bottomRhw = 1.0f / (depth - (quad.bottom - screenY) * g_cotangent) + 0.00001f; quad.topRhw = 1.0f / (depth - (quad.top - screenY) * g_cotangent) + 0.00001f; quad.angle = static_cast(cell.rotation);