From c2ee6a5488a958ff37ddff017e73cd4ea2176742 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 20:01:01 +0000 Subject: [PATCH] Decompile fn_12581 (DrawScreenQuad) Batch #16473 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_12581 DrawScreenQuad: logic confirmed by peer review Peer-reviewed-by: Yommy, KWDev, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/FlyingShipRouteInfo.cpp | 5 ++--- Source/Render/ScreenGeometry.cpp | 20 +++++++------------- Source/Render/ScreenGeometry.h | 10 +++------- Source/UI/Window/UIRoMapWnd.cpp | 16 +++------------- 4 files changed, 15 insertions(+), 36 deletions(-) diff --git a/Source/Contents/FlyingShipRouteInfo.cpp b/Source/Contents/FlyingShipRouteInfo.cpp index c66b7bb76..1f4425029 100644 --- a/Source/Contents/FlyingShipRouteInfo.cpp +++ b/Source/Contents/FlyingShipRouteInfo.cpp @@ -34,9 +34,8 @@ void CFlyingShipRouteInfo::Draw(UIRoMapWnd* wnd) { targets.insert(std::pair(entry.name, entry)); DrawScreenLine( - g_renderer->primitives, g_renderer->queues, from.screenPosition[0], from.screenPosition[1], entry.screenPosition[0], entry.screenPosition[1], 2, - g_texMgr.Load(this->lineTextureName.c_str(), 0, true, true, false), static_cast(this->lineColor), g_renderer->fog.supported != 0, - g_depthStart, g_depthEnd + from.screenPosition[0], from.screenPosition[1], entry.screenPosition[0], entry.screenPosition[1], 2, + g_texMgr.Load(this->lineTextureName.c_str(), 0, true, true, false), static_cast(this->lineColor) ); } diff --git a/Source/Render/ScreenGeometry.cpp b/Source/Render/ScreenGeometry.cpp index cb041678d..af6c4a610 100644 --- a/Source/Render/ScreenGeometry.cpp +++ b/Source/Render/ScreenGeometry.cpp @@ -1,4 +1,5 @@ #include "Render/ScreenGeometry.h" +#include "Render/DX9/RendererDX9.h" #include "Render/Primitives/RenderPrimitivePool.h" #include "Render/Primitives/RenderQueues.h" #include "Render/Renderer.h" @@ -9,10 +10,7 @@ // OFFSET: 0x0054E2B0 // FUNCTION: fn_01951 -void DrawScreenLine( - RenderPrimitivePool& primitives, RenderQueues& queues, float startX, float startY, float endX, float endY, int thickness, CTexture* texture, - std::uint32_t color, bool depthAlpha, float depthStart, float depthEnd -) { +void DrawScreenLine(float startX, float startY, float endX, float endY, int thickness, CTexture* texture, std::uint32_t color) { if (SquareRoot((endY - startY) * (endY - startY) + (endX - startX) * (endX - startX)) == 0.0f) { return; } @@ -30,18 +28,14 @@ void DrawScreenLine( const float offsetY = std::sin(angle) * width; const float offsetX = std::cos(angle) * width; DrawScreenQuad( - primitives, queues, startX - offsetX, startY - offsetY, startX + offsetX, startY + offsetY, endX - offsetX, endY - offsetY, endX + offsetX, - endY + offsetY, texture, color, depthAlpha, depthStart, depthEnd + startX - offsetX, startY - offsetY, startX + offsetX, startY + offsetY, endX - offsetX, endY - offsetY, endX + offsetX, endY + offsetY, texture, color ); } // OFFSET: 0x0054DB40 // FUNCTION: fn_01944 -void DrawScreenQuad( - RenderPrimitivePool& primitives, RenderQueues& queues, float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, CTexture* texture, - std::uint32_t color, bool depthAlpha, float depthStart, float depthEnd -) { - RenderPrimitive* primitive = primitives.Acquire(); +void DrawScreenQuad(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, CTexture* texture, std::uint32_t color) { + RenderPrimitive* primitive = g_renderer->primitives.Acquire(); RenderVertex* vertices = primitive->vertices; vertices[0].x = x0; vertices[0].y = y0; @@ -74,7 +68,7 @@ void DrawScreenQuad( primitive->texture = texture; primitive->sourceBlend = 2; primitive->destinationBlend = 4; - queues.Submit(primitive, 513, depthAlpha, depthStart, depthEnd); + static_cast(g_renderer)->Submit(primitive, 513); } // OFFSET: 0x00915F60 @@ -113,5 +107,5 @@ void DrawScreenQuad(ScreenPoint p0, ScreenPoint p1, ScreenPoint p2, ScreenPoint primitive->texture = texture; primitive->sourceBlend = 2; primitive->destinationBlend = 4; - g_renderer->queues.Submit(primitive, 513, g_renderer->fog.supported != 0, g_depthStart, g_depthEnd); + static_cast(g_renderer)->Submit(primitive, 513); } diff --git a/Source/Render/ScreenGeometry.h b/Source/Render/ScreenGeometry.h index 0b936e801..dd9a8b902 100644 --- a/Source/Render/ScreenGeometry.h +++ b/Source/Render/ScreenGeometry.h @@ -12,14 +12,10 @@ struct ScreenPoint { /* 0004 */ float y; }; -void DrawScreenQuad( - RenderPrimitivePool& primitives, RenderQueues& queues, float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, CTexture* texture, - std::uint32_t color, bool depthAlpha, float depthStart, float depthEnd -); -void DrawScreenLine( - RenderPrimitivePool& primitives, RenderQueues& queues, float startX, float startY, float endX, float endY, int thickness, CTexture* texture, - std::uint32_t color, bool depthAlpha, float depthStart, float depthEnd +__declspec(noinline) void DrawScreenQuad( + float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, CTexture* texture, std::uint32_t color ); +void DrawScreenLine(float startX, float startY, float endX, float endY, int thickness, CTexture* texture, std::uint32_t color); void DrawScreenQuad(ScreenPoint p0, ScreenPoint p1, ScreenPoint p2, ScreenPoint p3, CTexture* texture, std::uint32_t color); #endif diff --git a/Source/UI/Window/UIRoMapWnd.cpp b/Source/UI/Window/UIRoMapWnd.cpp index 297b75a50..9319d104c 100644 --- a/Source/UI/Window/UIRoMapWnd.cpp +++ b/Source/UI/Window/UIRoMapWnd.cpp @@ -338,15 +338,9 @@ void UIRoMapWnd::DrawDungeonLinks() { const float endY = static_cast(mapHeight) * g_depthAverageHalf + static_cast(map->top) + 1.0f; CTexture* const lineTexture = g_texMgr.Default(); if (isSelected) { - DrawScreenLine( - g_renderer->primitives, g_renderer->queues, startX, startY, endX, endY, 1, lineTexture, (selectColor & 0xFFFFFF) - 0x1000000, - g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawScreenLine(startX, startY, endX, endY, 1, lineTexture, (selectColor & 0xFFFFFF) - 0x1000000); } else { - DrawScreenLine( - g_renderer->primitives, g_renderer->queues, startX, startY, endX, endY, 1, lineTexture, lineColor, g_renderer->fog.supported != 0, - g_depthStart, g_depthEnd - ); + DrawScreenLine(startX, startY, endX, endY, 1, lineTexture, lineColor); } DrawTexturedRectangle(map->left, map->top, mapWidth, mapHeight, isSelected ? 0xFFFFFFFF : rectColor, positionTexture); @@ -380,11 +374,7 @@ void UIRoMapWnd::DrawMarks() { const float startY = static_cast(previous[3] - previous[1]) * g_depthAverageHalf + static_cast(previous[1]); const float endX = static_cast(area[2] - area[0]) * g_depthAverageHalf + static_cast(area[0]); const float endY = static_cast(area[3] - area[1]) * g_depthAverageHalf + static_cast(area[1]); - DrawScreenLine( - g_renderer->primitives, g_renderer->queues, startX, startY, endX, endY, 5, - g_texMgr.Load("유저인터페이스\\worldview_interface\\wv_Airf2.bmp", 0, false, true, false), 0x99FFFFFF, - g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawScreenLine(startX, startY, endX, endY, 5, g_texMgr.Load("유저인터페이스\\worldview_interface\\wv_Airf2.bmp", 0, false, true, false), 0x99FFFFFF); } }