Decompile fn_22253 (CItem::SetRenderInfo)

Batch #8459 by SapitoSucio: 0 byte-identical, 1 confirmed by peer review.

- fn_22253 CItem::SetRenderInfo: logic confirmed by peer review

Peer-reviewed-by: Yommy, Romain, System4z
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-10-31 18:02:04 +00:00
commit c94bfebccc
2 changed files with 44 additions and 0 deletions

View file

@ -1,5 +1,6 @@
#include "Contents/Actors/Item.h"
#include "ActorPickNode.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Input/InputCharset.h"
#include "Client/Mode/ModeMgr.h"
@ -16,8 +17,10 @@
#include "Contents/World/World.h"
#include "Resource/ResourceMgr.h"
#include "Resource/World/TerrainResource.h"
#include "Render/Renderer.h"
#include "Utility/Text/FormatString.h"
#include <algorithm>
#include <cstdlib>
#include <windows.h>
#include <timeapi.h>
@ -37,6 +40,46 @@ struct ItemFallEntry {
/* 0042 */ std::uint16_t grade;
};
// OFFSET: 0x00D8BE00
// FUNCTION: fn_22253
void CItem::SetRenderInfo(const float* bounds, float x, float y) {
enum { ItemPickJob = 32003 };
if (this->render.unknown_00A4Bytes[1]) {
// GLOBAL: gl_25149
static const int minimumSize = static_cast<int>(g_renderer->UiScaleX() * 34.0f);
ActorPickInfo* info = new ActorPickInfo;
info->left = std::min(bounds[0], bounds[2]);
info->top = bounds[1];
info->depth = bounds[4] + 300.0f;
info->right = std::max(bounds[0], bounds[2]);
info->bottom = bounds[3];
info->depthOffset = bounds[4] + 300.0f;
info->accountId = this->itemAid;
info->job = ItemPickJob;
info->unknown_0024 = 0;
info->kind = 1;
const int width = static_cast<int>(info->right - info->left);
if (width < minimumSize) {
const float grow = static_cast<float>((minimumSize - width) / 2);
info->left -= grow;
info->right += grow;
}
const int height = static_cast<int>(info->bottom - info->top);
if (height < minimumSize) {
const float grow = static_cast<float>((minimumSize - height) / 2);
info->top -= grow;
info->bottom += grow;
}
g_actorPickNode.AddPickInfo(info);
}
this->SetTlvert(x, y);
}
// OFFSET: 0x00D8B340
// FUNCTION: fn_22246
CItem::CItem() : name() {

View file

@ -15,6 +15,7 @@ public:
bool OnProcess() override;
void SendMsg(CGameObject* sender, int message, int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m) override;
void Render(int argument) override;
void SetRenderInfo(const float* bounds, float x, float y) override;
/* 0158 */ std::string name;
/* 0170 */ std::uint32_t itemId;