rodecomp/Source/Resource/SkinPalette.cpp
ragnarok-clanker db06607726 Decompile fn_09684 (SkinPaletteColor)
Batch #16375 by youko: 0 byte-identical, 1 confirmed by peer review.

- fn_09684 SkinPaletteColor: logic confirmed by peer review (annotation added to existing code)

Peer-reviewed-by: eAthena, Yommy, Toshiro
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-11-10 18:48:17 +00:00

31 lines
1.2 KiB
C++

#include "Resource/SkinPalette.h"
#include "Resource/Bitmap/BitmapResource.h"
#include "Resource/ResourceMgr.h"
#include "Resource/TextureNames.h"
// INLINED
std::uint32_t SkinPaletteColor(ResourceMgr& resources, const SkinPaletteCell& cell, bool resolveSkin) {
auto* bitmap = static_cast<CBitmapRes*>(
resources.Load(resolveSkin ? Resolve("유저인터페이스\\colorchip.bmp") : "유저인터페이스\\colorchip.bmp"));
if (bitmap) {
const std::uint32_t color = bitmap->image.Pixel(4 * cell.column + 2, 4 * cell.row + 2);
return RGB((color >> 16) & 255, (color >> 8) & 255, color & 255);
}
return 0;
}
// OFFSET: 0x007E0F40
// FUNCTION: fn_09684
std::uint32_t __stdcall SkinPaletteColor(const SkinPaletteCell& cell, bool resolveSkin) {
return SkinPaletteColor(ResourceMgr::Instance(), cell, resolveSkin);
}
// OFFSET: 0x007E0FC0
// FUNCTION: fn_09685
void SkinPaletteChannels(ResourceMgr& resources, int x, int y, unsigned& red, unsigned& green, unsigned& blue) {
auto* bitmap = static_cast<CBitmapRes*>(resources.Load(Resolve("유저인터페이스\\colorchip.bmp")));
const std::uint32_t color = bitmap->image.Pixel(x, y);
red = (color >> 16) & 255;
green = (color >> 8) & 255;
blue = color & 255;
}