rodecomp/Source/Render/UIRPDataDrawing.cpp
ragnarok-clanker 87bb32cef8 Decompile 48 functions in Source/Client/ModeFade.cpp, Source/Client/ModeFade.h, ...
Batch #2457 by ragnarok-clanker: 0 byte-identical, 48 confirmed by peer review.

- fn_00152 TextureCache::TextureCache: logic confirmed by peer review
- fn_01952 DrawAlphaRectangle: logic confirmed by peer review
- fn_01953 DrawBlendedRectangle: logic confirmed by peer review
- fn_01954 DrawTexturedRectangle: logic confirmed by peer review
- fn_01955 DrawTextureRegion: logic confirmed by peer review
- fn_02237 CRendererDX9::SaveLogo: logic confirmed by peer review
- fn_02353 CRenderSystemDX9::CRenderSystemDX9: logic confirmed by peer review
- fn_02447 TextureCache::~TextureCache: logic confirmed by peer review (already on main)
- fn_02449 TextureCache::Upload: logic confirmed by peer review
- fn_02451 TextureCache::Clear: logic confirmed by peer review (already on main)
- fn_02452 TextureCache::Remove: logic confirmed by peer review (already on main)
- fn_02453 TextureCache::Default: logic confirmed by peer review
- fn_02454 TextureCache::Load: logic confirmed by peer review (already on main)
- fn_02455 TextureCache::Create: logic confirmed by peer review
- fn_02456 TextureCache::Reload: logic confirmed by peer review
- fn_02457 TextureCache::ClearUnused: logic confirmed by peer review
- fn_07897 EZeffectClip::Texture: logic confirmed by peer review
- fn_07898 EZeffectClip::Texture: logic confirmed by peer review
- fn_07958 C3dAnimModelRes::Load: logic confirmed by peer review
- fn_07996 ModelNode::~ModelNode: logic confirmed by peer review
- fn_08010 C3dGrannyModelRes::CreateTexture: logic confirmed by peer review
- fn_08020 C3dModelResV2::ReadVersion1: logic confirmed by peer review
- fn_08021 C3dModelResV2::ReadVersion2: logic confirmed by peer review
- fn_08022 C3dModelResV2::ReadVersion3: logic confirmed by peer review
- fn_09166 BinkMovies::Update: logic confirmed by peer review
- fn_10122 UIRPData::DrawNamed: logic confirmed by peer review
- fn_12091 UIWhisperWnd::Slot43: logic confirmed by peer review
- fn_17556 GroundGeometry::Build: logic confirmed by peer review
- fn_17565 GroundGeometry::BuildLightmaps: logic confirmed by peer review
- fn_17581 GroundWaterState::Update: logic confirmed by peer review
- fn_17587 GroundGeometry::DrawGrid: logic confirmed by peer review
- fn_17599 GroundWaterState::Import: logic confirmed by peer review
- fn_17842 ModeFade::Draw: logic confirmed by peer review
- fn_17847 FadeOutMode: logic confirmed by peer review
- fn_20019 CRagEffect::Blessing: logic confirmed by peer review
- fn_20023 CRagEffect::Bottom: logic confirmed by peer review
- fn_20024 CRagEffect::BowlingBash: logic confirmed by peer review
- fn_20025 CRagEffect::CartRevolution: logic confirmed by peer review
- fn_20042 CRagEffect::Entry: logic confirmed by peer review
- fn_20054 CRagEffect::FrostDiver: logic confirmed by peer review
- fn_20058 CRagEffect::GrimTooth: logic confirmed by peer review
- fn_20066 CRagEffect::Hit4: logic confirmed by peer review
- fn_20088 UpdatePartyEffect: logic confirmed by peer review
- fn_20105 CRagEffect::SonicBlowHit: logic confirmed by peer review
- fn_20109 CRagEffect::SprayPond: logic confirmed by peer review
- fn_20124 CRagEffect::Yufitel: logic confirmed by peer review
- fn_20132 CRagEffect::AirTexture: logic confirmed by peer review
- fn_20133 CRagEffect::AttackEnergy2: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
2026-10-29 18:23:21 +00:00

123 lines
4.9 KiB
C++

#include "Render/Primitives/RenderPrimitivePool.h"
#include "Render/Primitives/UIRPData.h"
#include "Render/Textures/Texture.h"
#include "Render/Textures/TextureCache.h"
// OFFSET: 0x008130A0
// FUNCTION: fn_10121
void UIRPData::DrawStretched(RenderPrimitivePool& pool, int x, int y, CTexture* texture, std::uint32_t color, int width, int height) {
if (!texture) {
return;
}
RenderPrimitive* primitive = pool.Acquire();
primitive->texture = texture;
const int right = x + width;
const int bottom = y + height;
primitive->quad[0].x = static_cast<float>(x);
primitive->quad[0].y = static_cast<float>(y);
primitive->quad[0].u = g_textureOffsetX / static_cast<float>(texture->TextureWidth());
primitive->quad[0].v = g_textureOffsetY / static_cast<float>(texture->TextureHeight());
primitive->quad[1].x = static_cast<float>(right);
primitive->quad[1].y = static_cast<float>(y);
primitive->quad[1].u = (static_cast<float>(texture->Width()) + g_textureOffsetX) / static_cast<float>(texture->TextureWidth());
primitive->quad[1].v = g_textureOffsetY / static_cast<float>(texture->TextureHeight());
primitive->quad[2].x = static_cast<float>(x);
primitive->quad[2].y = static_cast<float>(bottom);
primitive->quad[2].u = g_textureOffsetX / static_cast<float>(texture->TextureWidth());
primitive->quad[2].v = (static_cast<float>(texture->Height()) + g_textureOffsetX) / static_cast<float>(texture->TextureHeight());
primitive->quad[3].x = static_cast<float>(right);
primitive->quad[3].y = static_cast<float>(bottom);
primitive->quad[3].u = (static_cast<float>(texture->Width()) + g_textureOffsetX) / static_cast<float>(texture->TextureWidth());
primitive->quad[3].v = (static_cast<float>(texture->Height()) + g_textureOffsetX) / static_cast<float>(texture->TextureHeight());
for (RenderVertex& vertex : primitive->quad) {
vertex.diffuse = color;
}
for (RenderVertex& vertex : primitive->quad) {
vertex.z = 0.000001f;
vertex.rhw = 0.999999f;
}
this->m_primitives.push_back(primitive);
}
// OFFSET: 0x008134B0
// FUNCTION: fn_10122
void UIRPData::DrawNamed(RenderPrimitivePool& pool, int x, int y, std::string name, std::uint32_t color, int width, int height) {
CTexture* texture = g_texMgr.Load(name.c_str(), 0, true, true, false);
if (!texture) {
return;
}
RenderPrimitive* primitive = pool.Acquire();
primitive->texture = texture;
const int imageWidth = texture->Width();
const int imageHeight = texture->Height();
if (!width) {
width = texture->Width();
}
if (!height) {
height = texture->Height();
}
const float textureWidth = static_cast<float>(texture->TextureWidth());
const float textureHeight = static_cast<float>(texture->TextureHeight());
const int right = x + width;
const float bottom = static_cast<float>(y + height);
primitive->quad[0].x = static_cast<float>(x);
primitive->quad[0].y = static_cast<float>(y);
primitive->quad[0].u = g_textureOffsetX / textureWidth;
primitive->quad[0].v = g_textureOffsetY / textureHeight;
primitive->quad[1].x = static_cast<float>(right);
primitive->quad[1].y = static_cast<float>(y);
primitive->quad[1].u = (static_cast<float>(width <= imageWidth ? width : imageWidth) + g_textureOffsetX) / textureWidth;
primitive->quad[1].v = g_textureOffsetY / textureHeight;
primitive->quad[2].x = static_cast<float>(x);
primitive->quad[2].y = bottom;
primitive->quad[2].u = g_textureOffsetX / textureWidth;
primitive->quad[2].v =
(height <= imageHeight ? static_cast<float>(height) + g_textureOffsetX : static_cast<float>(imageHeight) + g_textureOffsetY) / textureHeight;
primitive->quad[3].x = static_cast<float>(right);
primitive->quad[3].y = bottom;
primitive->quad[3].u = (static_cast<float>(width <= imageWidth ? width : imageWidth) + g_textureOffsetX) / textureWidth;
primitive->quad[3].v =
(height <= imageHeight ? static_cast<float>(height) + g_textureOffsetX : static_cast<float>(imageHeight) + g_textureOffsetY) / textureHeight;
for (RenderVertex& vertex : primitive->quad) {
vertex.diffuse = color;
}
for (RenderVertex& vertex : primitive->quad) {
vertex.z = 0.000001f;
vertex.rhw = 0.999999f;
}
this->m_primitives.push_back(primitive);
}
// OFFSET: 0x00813A00
// FUNCTION: fn_10123
void UIRPData::SetSolid(RenderPrimitivePool& pool, int width, int height, std::uint32_t color) {
this->m_primitives.clear();
RenderPrimitive* primitive = pool.Acquire();
primitive->texture = nullptr;
primitive->quad[0].x = 0.0f;
primitive->quad[0].y = 0.0f;
primitive->quad[1].x = static_cast<float>(width);
primitive->quad[1].y = 0.0f;
primitive->quad[2].x = 0.0f;
primitive->quad[2].y = static_cast<float>(height);
primitive->quad[3].x = static_cast<float>(width);
primitive->quad[3].y = static_cast<float>(height);
for (RenderVertex& vertex : primitive->quad) {
vertex.u = 0.0f;
vertex.v = 0.0f;
vertex.z = 0.000001f;
vertex.rhw = 0.999999f;
vertex.diffuse = color;
}
this->m_primitives.push_back(primitive);
}