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).
This commit is contained in:
ragnarok-clanker 2026-11-10 20:01:01 +00:00
commit c2ee6a5488
4 changed files with 15 additions and 36 deletions

View file

@ -34,9 +34,8 @@ void CFlyingShipRouteInfo::Draw(UIRoMapWnd* wnd) {
targets.insert(std::pair<std::string, FlyingShipRouteEntry>(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<std::uint32_t>(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<std::uint32_t>(this->lineColor)
);
}

View file

@ -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<CRendererDX9*>(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<CRendererDX9*>(g_renderer)->Submit(primitive, 513);
}

View file

@ -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

View file

@ -338,15 +338,9 @@ void UIRoMapWnd::DrawDungeonLinks() {
const float endY = static_cast<float>(mapHeight) * g_depthAverageHalf + static_cast<float>(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<float>(previous[3] - previous[1]) * g_depthAverageHalf + static_cast<float>(previous[1]);
const float endX = static_cast<float>(area[2] - area[0]) * g_depthAverageHalf + static_cast<float>(area[0]);
const float endY = static_cast<float>(area[3] - area[1]) * g_depthAverageHalf + static_cast<float>(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);
}
}