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

- fn_09684 SkinPaletteColor: logic confirmed by peer review

Peer-reviewed-by: Yommy, Tanke
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-11-05 03:20:26 +00:00

29 lines
1.1 KiB
C++

#include "Resource/SkinPalette.h"
#include "Resource/Bitmap/BitmapResource.h"
#include "Resource/ResourceMgr.h"
#include "Resource/TextureNames.h"
// OFFSET: 0x007E0F40
// FUNCTION: fn_09684
std::uint32_t SkinPaletteColor(ResourceMgr& resources, const SkinPaletteCell& cell, bool resolveSkin) {
const char* filename = "유저인터페이스\\colorchip.bmp";
if (resolveSkin) {
filename = Resolve(filename);
}
auto* bitmap = static_cast<CBitmapRes*>(resources.Load(filename));
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: 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;
}