Maintenance: [forced, user-approved] Family W2: remove invented SpriteDrawingPolicy and AccessoryLayerDepth reference structs; their

Batch #10252 by ragnarok-clanker: forced by an admin (1 lower score(s), 10 changed function(s)); checked with 11 compiled unit(s), including every includer of Source/Contents/Actors/CharacterRender.h, Source/Contents/Actors/SpriteDrawingPolicy.h.
Deletes: Source/Contents/Actors/SpriteDrawingPolicy.h
This commit is contained in:
ragnarok-clanker 2026-11-03 12:41:12 +00:00
commit 2fa3c6677c
13 changed files with 78 additions and 107 deletions

View file

@ -231,16 +231,3 @@ void CView::Reset() {
// FUNCTION: fn_17929
void CView::Slot2() {
}
// OFFSET: 0x00ADBF60
// FUNCTION: fn_17927
void CView::Update() {
const vector3d& position = this->scene->player->render.position;
this->camera.desiredTarget[0] = position.x;
this->camera.desiredTarget[1] = position.y;
this->camera.desiredTarget[2] = position.z;
this->camera.Smooth();
this->shake.Apply(this->camera, g_worldViewDrawn);
const TerrainHeight terrain = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Grid();
this->frame.Refresh(this->camera, terrain, *g_renderer);
}

View file

@ -5,7 +5,6 @@
#include "Client/Session.h"
#include "Contents/Actors/Pc.h"
#include "Contents/Actors/RenderObject.h"
#include "Contents/Actors/SpriteDrawingPolicy.h"
#include "Contents/Camera/Camera.h"
#include "Contents/Skills/ClientSkills.h"
#include "Contents/SpriteLayerDrawing.h"
@ -93,7 +92,7 @@ std::list<CharacterRenderDrawItem> CCharacterRender::BuildDrawList(unsigned char
std::list<CharacterRenderDrawItem> commands;
if (this->unknown_00B0 == 1) {
if (RenderPrimitive* shadow = reinterpret_cast<const SpriteDrawingPolicy*>(this)->DrawShadow(view, 1.0f)) {
if (RenderPrimitive* shadow = this->DrawShadow(view, 1.0f)) {
CharacterRenderDrawItem item;
item.flags = 0x101;
item.command = shadow;
@ -303,7 +302,7 @@ std::list<CharacterRenderDrawItem> CCharacterRender::BuildDrawList(unsigned char
std::memset(&quad, 0, sizeof(quad));
SpriteColor color = {};
tagRECT rect;
if (!reinterpret_cast<const SpriteDrawingPolicy*>(this)->ProjectCell(
if (!this->ProjectCell(
index, layer, distanceScale, *cell, screenX, screenY, position, 0.0f, bottomDepth, topDepth, *image,
reinterpret_cast<SpriteCellQuad&>(quad), rect, color, offsetX, offsetY, 0
)) {
@ -317,10 +316,10 @@ std::list<CharacterRenderDrawItem> CCharacterRender::BuildDrawList(unsigned char
case 3:
case 4:
case 8:
reinterpret_cast<const SpriteDrawingPolicy*>(this)->OffsetLayerDepth(type, reinterpret_cast<SpriteCellQuad&>(quad), bottomDepth, topDepth);
this->OffsetLayerDepth(type, reinterpret_cast<SpriteCellQuad&>(quad), bottomDepth, topDepth);
break;
default:
reinterpret_cast<const AccessoryLayerDepth*>(this)->OffsetLayerDepth(type, reinterpret_cast<SpriteCellQuad&>(quad), bottomDepth, topDepth);
this->OffsetAccessoryLayerDepth(type, reinterpret_cast<SpriteCellQuad&>(quad), bottomDepth, topDepth);
break;
}

View file

@ -9,6 +9,11 @@
class CActRes;
struct CharacterRenderDrawItem;
struct RenderPrimitive;
struct SpriteCellQuad;
struct SpriteColor;
struct SpriteFrameCell;
struct SpriteRleImage;
struct tagRECT;
class CCharacterRender {
public:
@ -24,6 +29,15 @@ public:
float shift, float
);
std::list<CharacterRenderDrawItem> BuildDrawList(unsigned char trackBounds, char* boundsUpdated);
bool DrawOnTop() const;
bool SetRobe(int robe);
bool ProjectCell(
int unused, int layer, float scale, const SpriteFrameCell& cell, float x, float y, const float* position, float shift, float& bottomDepth,
float& topDepth, const SpriteRleImage& image, SpriteCellQuad& quad, tagRECT& bounds, SpriteColor& color, int offsetX, int offsetY, int flags
) const;
void OffsetLayerDepth(int layer, SpriteCellQuad& quad, float bottomDepth, float topDepth) const;
void OffsetAccessoryLayerDepth(int layer, SpriteCellQuad& quad, float bottomDepth, float topDepth) const;
RenderPrimitive* DrawShadow(const float* matrix, float scale) const;
/* 0004 */ int unknown_0004;
/* 0008 */ int unknown_0008;
@ -42,7 +56,7 @@ public:
/* 0048 */ int unknown_0048;
/* 004C */ unsigned char unknown_004C;
/* 0050 */ int unknown_0050;
/* 0054 */ int unknown_0054;
/* 0054 */ float unknown_0054;
/* 0058 */ float unknown_0058;
/* 005C */ int unknown_005C;
/* 0060 */ int unknown_0060;
@ -64,7 +78,7 @@ public:
/* 00B0 */ unsigned char unknown_00B0;
/* 00B4 */ std::map<int, int> unknown_00B4;
/* 00BC */ int unknown_00BC;
/* 00C0 */ unsigned char unknown_00C0;
/* 00C0 */ bool unknown_00C0;
};
#if defined(_WIN32) && !defined(_WIN64)

View file

@ -10,7 +10,6 @@
#include "Contents/Camera/Camera.h"
#include "Contents/Actors/ActorStateFlags.h"
#include "Contents/Actors/CharacterRender.h"
#include "Contents/Actors/SpriteDrawingPolicy.h"
#include "Render/DX9/RendererDX9.h"
#include "Contents/Actors/GameActor.h"
#include "Contents/Actors/GroundScope.h"
@ -2695,7 +2694,7 @@ __declspec(noinline) static void FillCharacterNpcRenderPrimary(
characterRender->unknown_0028 = info->unknown_0030;
characterRender->unknown_002C = info->unknown_004C;
characterRender->unknown_0030 = info->unknown_0050;
reinterpret_cast<SpriteDrawingPolicy*>(characterRender)->SetRobe(info->robe);
characterRender->SetRobe(info->robe);
characterRender->unknown_0050 = info->unknown_0078;
}
@ -2713,7 +2712,7 @@ __declspec(noinline) static void FillCharacterNpcRenderSecondary(
characterRender->unknown_0028 = info->unknown_0038;
characterRender->unknown_002C = info->unknown_0050;
characterRender->unknown_0030 = info->unknown_0054;
reinterpret_cast<SpriteDrawingPolicy*>(characterRender)->SetRobe(info->robeAlt);
characterRender->SetRobe(info->robeAlt);
characterRender->unknown_0050 = info->unknown_007C;
}

View file

@ -1,19 +1,20 @@
#include "Contents/Actors/SpriteDrawingPolicy.h"
#include "Client/Session.h"
#include "Contents/Actors/CharacterRender.h"
#include "Script/LuaScript.h"
// OFFSET: 0x0080E3A0
// FUNCTION: fn_10106
bool SpriteDrawingPolicy::DrawOnTop() const {
bool CCharacterRender::DrawOnTop() const {
bool drawOnTop = true;
if (this->newDrawOnTop == 1) {
if (g_session.m_newRobeDrawOnTop == 1) {
int unusedPriority = 1;
this->script.Call(
"_New_DrawOnTop", "ddddd>bd", this->argument00BC, this->argument0018, this->argument0010, this->argument0040, this->argument0044, &drawOnTop,
g_luaScript->Call(
"_New_DrawOnTop", "ddddd>bd", this->unknown_00BC, this->unknown_0018[0], this->unknown_0010, this->unknown_0040, this->unknown_0044, &drawOnTop,
&unusedPriority
);
} else {
this->script.Call("DrawOnTop", "ddddd>b", this->argument00BC, this->argument0018, this->argument0010, this->argument0040, this->argument0044, &drawOnTop);
g_luaScript->Call("DrawOnTop", "ddddd>b", this->unknown_00BC, this->unknown_0018[0], this->unknown_0010, this->unknown_0040, this->unknown_0044, &drawOnTop);
}
return drawOnTop;
@ -21,7 +22,7 @@ bool SpriteDrawingPolicy::DrawOnTop() const {
// OFFSET: 0x008124B0
// FUNCTION: fn_10111
bool SpriteDrawingPolicy::SetRobe(int robe) {
this->argument00BC = robe;
return this->script.CallTable("TB_Layer_Priority", "IsHelmRobe", "d>b", robe, &this->helmRobe);
bool CCharacterRender::SetRobe(int robe) {
this->unknown_00BC = robe;
return g_luaScript->CallTable("TB_Layer_Priority", "IsHelmRobe", "d>b", robe, &this->unknown_00C0);
}

View file

@ -1,47 +0,0 @@
#ifndef RAGNAROK_SOURCE_CONTENTS_ACTORS_SPRITEDRAWINGPOLICY_H
#define RAGNAROK_SOURCE_CONTENTS_ACTORS_SPRITEDRAWINGPOLICY_H
class LuaScript;
struct RenderPrimitive;
struct SpriteCellQuad;
struct SpriteColor;
struct SpriteFrameCell;
struct SpriteRleImage;
struct tagRECT;
struct vector3d;
struct AccessoryLayerDepth {
const int& bottomAccessory;
const int& topAccessory;
const int& middleAccessory;
void OffsetLayerDepth(int layer, SpriteCellQuad& quad, float bottomDepth, float topDepth) const;
};
struct SpriteDrawingPolicy {
LuaScript& script;
const unsigned char& newDrawOnTop;
int& argument00BC;
const int& argument0018;
const int& argument0010;
const int& argument0040;
const int& argument0044;
bool& helmRobe;
const vector3d& position;
const unsigned char& riding;
const float& offsetX;
const float& offsetY;
const int& shiftX;
const int& shiftY;
bool DrawOnTop() const;
bool SetRobe(int robe);
bool ProjectCell(
int unused, int layer, float scale, const SpriteFrameCell& cell, float x, float y, const float* position, float shift, float& bottomDepth,
float& topDepth, const SpriteRleImage& image, SpriteCellQuad& quad, tagRECT& bounds, SpriteColor& color, int offsetX, int offsetY, int flags
) const;
void OffsetLayerDepth(int layer, SpriteCellQuad& quad, float bottomDepth, float topDepth) const;
RenderPrimitive* DrawShadow(const float* matrix, float scale) const;
};
#endif

View file

@ -1,9 +1,15 @@
#include "Contents/Camera/CameraFrame.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Mode/ModeMgr.h"
#include "Contents/Actors/Pc.h"
#include "Contents/Camera/Camera.h"
#include "Contents/Ground/TerrainHeight.h"
#include "Contents/World/World.h"
#include "Render/Renderer.h"
#include "Resource/World/TerrainResource.h"
// INLINED
void CameraFrame::Build(const CameraState& camera, const TerrainHeight& terrain) {
__forceinline void CameraFrame::Build(const CameraState& camera, const TerrainHeight& terrain) {
constexpr float pi = 3.141592f;
matrix orbit;
orbit.MakeXRotation((camera.pitch / 180.0f) * pi);
@ -30,3 +36,17 @@ void CameraFrame::Refresh(const CameraState& camera, const TerrainHeight& terrai
this->Build(camera, terrain);
renderer.SetCamera(this->eye, camera.target, this->up);
}
// OFFSET: 0x00ADBF60
// FUNCTION: fn_17927
void CView::Update() {
const vector3d& position = this->scene->player->render.position;
this->camera.desiredTarget[0] = position.x;
this->camera.desiredTarget[1] = position.y;
this->camera.desiredTarget[2] = position.z;
this->camera.Smooth();
this->shake.Apply(this->camera, g_worldViewDrawn);
const TerrainHeight terrain = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Grid();
this->frame.Build(this->camera, terrain);
g_renderer->SetCamera(this->frame.eye, this->camera.target, this->frame.up);
}

View file

@ -1,4 +1,4 @@
#include "Contents/Actors/SpriteDrawingPolicy.h"
#include "Contents/Actors/CharacterRender.h"
#include "Client/Session.h"
#include "Contents/Camera/Camera.h"
#include "Render/SpriteGeometry.h"
@ -11,7 +11,7 @@ float g_cameraDistance = 300.0f;
// OFFSET: 0x0080DAA0
// FUNCTION: fn_10103
void SpriteDrawingPolicy::OffsetLayerDepth(int layer, SpriteCellQuad& quad, float bottomDepth, float topDepth) const {
void CCharacterRender::OffsetLayerDepth(int layer, SpriteCellQuad& quad, float bottomDepth, float topDepth) const {
switch (layer) {
case 2:
if (g_cameraDistance < robeTopLayerThreshold) {
@ -44,13 +44,13 @@ void SpriteDrawingPolicy::OffsetLayerDepth(int layer, SpriteCellQuad& quad, floa
// OFFSET: 0x0080E4D0
// FUNCTION: fn_10107
void AccessoryLayerDepth::OffsetLayerDepth(int layer, SpriteCellQuad& quad, float bottomDepth, float topDepth) const {
void CCharacterRender::OffsetAccessoryLayerDepth(int layer, SpriteCellQuad& quad, float bottomDepth, float topDepth) const {
float bottom = bottomDepth;
float top = topDepth;
switch (layer) {
case 1:
if (this->topAccessory == 1095) {
if (this->unknown_002C == 1095) {
if (g_cameraDistance < 32.0f) {
bottom = bottomDepth - 0.000008f;
top = topDepth - 0.000008f;
@ -64,7 +64,7 @@ void AccessoryLayerDepth::OffsetLayerDepth(int layer, SpriteCellQuad& quad, floa
}
break;
case 2:
switch (this->bottomAccessory) {
switch (this->unknown_0028) {
case 1041:
case 1358:
case 1478:
@ -112,7 +112,7 @@ void AccessoryLayerDepth::OffsetLayerDepth(int layer, SpriteCellQuad& quad, floa
}
break;
case 4:
if (this->topAccessory == 1485) {
if (this->unknown_002C == 1485) {
if (g_cameraDistance < robeTopLayerThreshold) {
bottom = 0.00035f + bottomDepth;
top = 0.0006f + topDepth;
@ -121,7 +121,7 @@ void AccessoryLayerDepth::OffsetLayerDepth(int layer, SpriteCellQuad& quad, floa
top = 0.00015f + topDepth;
}
} else {
switch (this->middleAccessory) {
switch (this->unknown_0030) {
case 1318:
if (g_cameraDistance < robeTopLayerThreshold) {
bottom = 0.00025f + bottomDepth;
@ -172,7 +172,7 @@ void AccessoryLayerDepth::OffsetLayerDepth(int layer, SpriteCellQuad& quad, floa
bool enabled = false;
double nearOffset = 0.0;
double farOffset = 0.0;
g_session.m_hotkeyScript->Call("OffsetItemPos_GetUppingBottomItem", "d>bll", this->bottomAccessory, &enabled, &nearOffset, &farOffset);
g_session.m_hotkeyScript->Call("OffsetItemPos_GetUppingBottomItem", "d>bll", this->unknown_0028, &enabled, &nearOffset, &farOffset);
if (layer == 2 && enabled) {
if (nearOffset == 0.0) {

View file

@ -2,7 +2,6 @@
#include "Client/Mode/ModeMgr.h"
#include "Client/Session.h"
#include "Contents/Actors/CharacterRender.h"
#include "Contents/Actors/SpriteDrawingPolicy.h"
#include "Contents/Camera/Camera.h"
#include "Render/DeviceContext/DCSurface.h"
#include "Render/SpriteGeometry.h"
@ -27,7 +26,7 @@ void CCharacterRender::RenderRobe(
return;
}
if (reinterpret_cast<const SpriteDrawingPolicy*>(this)->DrawOnTop() == drawOnTop) {
if (this->DrawOnTop() == drawOnTop) {
std::string sprName = g_session.GetRobeSprName(
this->unknown_0010, this->unknown_0014, this->unknown_0018[0], this->unknown_00BC, this->unknown_004C, this->unknown_0050
);
@ -65,7 +64,7 @@ void CCharacterRender::RenderRobe(
SpriteColor color;
float bottomDepth;
float topDepth;
reinterpret_cast<const SpriteDrawingPolicy*>(this)->ProjectCell(
this->ProjectCell(
layer, layer, scale, cell, x, y, position, shift, bottomDepth, topDepth, *image, reinterpret_cast<SpriteCellQuad&>(quad), bounds, color, 0, 0,
!drawOnTop
);

View file

@ -2,7 +2,6 @@
#include "Client/Mode/ModeMgr.h"
#include "Client/Session.h"
#include "Contents/Actors/CharacterRender.h"
#include "Contents/Actors/SpriteDrawingPolicy.h"
#include "Contents/Camera/Camera.h"
#include "Render/DeviceContext/DCSurface.h"
#include "Render/Primitives/RenderPrimitive.h"
@ -33,7 +32,7 @@ void CCharacterRender::RenderRobeCommands(
return;
}
if (reinterpret_cast<const SpriteDrawingPolicy*>(this)->DrawOnTop() == drawOnTop) {
if (this->DrawOnTop() == drawOnTop) {
std::string sprName = g_session.GetRobeSprName(
this->unknown_0010, this->unknown_0014, this->unknown_0018[0], this->unknown_00BC, this->unknown_004C, this->unknown_0050
);
@ -62,7 +61,7 @@ void CCharacterRender::RenderRobeCommands(
SpriteColor color;
float bottomDepth;
float topDepth;
reinterpret_cast<const SpriteDrawingPolicy*>(this)->ProjectCell(
this->ProjectCell(
layer, layer, scale, cell, x, y, position, shift, bottomDepth, topDepth, *image, reinterpret_cast<SpriteCellQuad&>(quad), bounds, color, 0, 0,
!drawOnTop
);

View file

@ -1,4 +1,4 @@
#include "Contents/Actors/SpriteDrawingPolicy.h"
#include "Contents/Actors/CharacterRender.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Mode/ModeMgr.h"
#include "Client/Session.h"
@ -16,26 +16,27 @@
// OFFSET: 0x00811C10
// FUNCTION: fn_10109
RenderPrimitive* SpriteDrawingPolicy::DrawShadow(const float* matrix, float scale) const {
RenderPrimitive* CCharacterRender::DrawShadow(const float* matrix, float scale) const {
if (scale == 0.0f || !g_modeMgr.GetGameMode() || !static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene) {
return nullptr;
}
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
const float* origin = reinterpret_cast<const float*>(&this->unknown_0004);
float position[3];
position[0] = this->position.x;
position[1] = mode->scene->terrain->Grid().Height(this->position.x, this->position.z);
position[2] = this->position.z;
position[0] = origin[0];
position[1] = mode->scene->terrain->Grid().Height(origin[0], origin[2]);
position[2] = origin[2];
const float depth = position[0] * matrix[2] + position[1] * matrix[5] + position[2] * matrix[8] + matrix[11];
float screenX;
float screenY;
float reciprocalDepth;
if (this->shiftX == 0 && this->shiftY == 0) {
if (this->unknown_0068 == 0 && this->unknown_006C == 0) {
g_renderer->ProjectViewport(position, matrix, &screenX, &screenY, &reciprocalDepth);
} else {
g_renderer->ProjectViewportCentered(
position, matrix, &screenX, &screenY, &reciprocalDepth, static_cast<float>(this->shiftX) + this->offsetX, static_cast<float>(this->shiftY) + this->offsetY
position, matrix, &screenX, &screenY, &reciprocalDepth, static_cast<float>(this->unknown_0068) + this->unknown_0054, static_cast<float>(this->unknown_006C) + this->unknown_0058
);
}
const float distanceScale = g_renderer->ScaleDistance(reciprocalDepth);
@ -48,7 +49,7 @@ RenderPrimitive* SpriteDrawingPolicy::DrawShadow(const float* matrix, float scal
}
const SpriteRleImage* image = sprite->images[cell.imageType][0];
const float size = g_session.GetNpcLocationRadius(this->argument0010, this->riding) * scale;
const float size = g_session.GetNpcLocationRadius(this->unknown_0010, this->unknown_004C) * scale;
const double factor = distanceScale;
SpriteQuad quad;

View file

@ -1,4 +1,4 @@
#include "Contents/Actors/SpriteDrawingPolicy.h"
#include "Contents/Actors/CharacterRender.h"
#include "Render/Renderer.h"
#include "Render/SpriteGeometry.h"
#include "Render/Textures/SpritePixels.h"
@ -16,7 +16,7 @@ float g_heightScale = 1.34f;
// OFFSET: 0x0080D7B0
// FUNCTION: fn_10102
bool SpriteDrawingPolicy::ProjectCell(
bool CCharacterRender::ProjectCell(
int unused, int layer, float scale, const SpriteFrameCell& cell, float x, float y, const float* position, float shift, float& bottomDepth,
float& topDepth, const SpriteRleImage& image, SpriteCellQuad& quad, tagRECT& bounds, SpriteColor& color, int offsetX, int offsetY, int flags
) const {

View file

@ -5,7 +5,6 @@
#include "Client/Session.h"
#include "Contents/Actors/CharacterRender.h"
#include "Contents/Actors/Pc.h"
#include "Contents/Actors/SpriteDrawingPolicy.h"
#include "Contents/Items/ItemInfo.h"
#include "Contents/MessageTable.h"
#include "Contents/UserData/NormalItemSlots.h"
@ -157,7 +156,7 @@ void UIPreviewEquipWnd::SyncFromPlayer() {
this->m_render->unknown_0028 = player->unknown_0450;
this->m_render->unknown_002C = player->unknown_0454;
this->m_render->unknown_0030 = player->unknown_0458;
reinterpret_cast<SpriteDrawingPolicy*>(this->m_render)->SetRobe(player->unknown_049C);
this->m_render->SetRobe(player->unknown_049C);
this->m_render->unknown_0048 = player->Slot56();
this->m_render->unknown_004C = player->unknown_02CC;
this->m_render->unknown_0050 = player->Slot46();
@ -287,7 +286,7 @@ int UIPreviewEquipWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, s
break;
case 4:
case 0x2000:
reinterpret_cast<SpriteDrawingPolicy*>(render)->SetRobe(value);
render->SetRobe(value);
break;
}
}