rodecomp/Source/UI/Buttons/UIRadioBtn.cpp
ragnarok-clanker 5b831e2426 Decompile fn_10696 (UIRadioBtn::~UIRadioBtn)
Batch #4058 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review.

- fn_10696 UIRadioBtn::~UIRadioBtn: logic confirmed by peer review

Peer-reviewed-by: eAthena, Yommy, superintelligence
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-10-30 00:59:37 +00:00

56 lines
2.2 KiB
C++

#include "Resource/Bitmap/BitmapResource.h"
#include "Resource/ResourceMgr.h"
#include "Resource/TextureNames.h"
#include "UI/Buttons/UIButton.h"
#include "UI/Buttons/UIRadioBtn.h"
// OFFSET: 0x00851B00
// FUNCTION: fn_10696
UIRadioBtn::~UIRadioBtn() = default;
// OFFSET: 0x0085D470
// FUNCTION: fn_10814
void UIRadioBtn::Paint() {
UIButtonContext& controls = *this->m_controls;
if (!this->checkedBitmap.empty() && !this->uncheckedBitmap.empty()) {
this->ClearSurface(0xFFFF00FF);
CBitmapRes* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(this->checkedBitmap.c_str())));
if (this->geometry.unknown_0030 == 0) {
bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(this->uncheckedBitmap.c_str())));
}
if (bitmap) {
this->DrawBitmap(0, static_cast<int>((this->geometry.height - bitmap->image.height) * 0.5f), &bitmap->image, true);
}
const int textHeight = this->TextHeight(controls.fonts, controls.locale, this->text.c_str(), 0, 0, this->fontHeight, 0, 0);
const std::uint32_t color = this->enabled == 1 ? this->textColor : 0xB5B5B5;
this->DrawTextAt(
controls.fonts, controls.locale, bitmap->image.width + 3, static_cast<int>((this->geometry.height - textHeight) * 0.5f), this->text.c_str(), 0, 0,
this->fontHeight, color, 0, 0
);
return;
}
this->ClearSurface(0xFFFF00FF);
const char* name;
if (this->geometry.unknown_0030 == 0) {
name = "유저인터페이스\\radiobtn_off.bmp";
} else {
name = this->highlighted != 0 ? "유저인터페이스\\radiobtn_on1.bmp" : "유저인터페이스\\radiobtn_on.bmp";
}
CBitmapRes* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(name)));
this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false);
const std::uint32_t color = this->enabled != 0 ? this->textColor : 0xB5B5B5;
this->DrawTextAt(controls.fonts, controls.locale, 13, 0, this->text.c_str(), 0, 0, this->fontHeight, color, 0, 0);
}
// OFFSET: 0x0085ECB0
// FUNCTION: fn_10844
void UIRadioBtn::Slot25(int, int) {
if (this->parent && this->enabled != 0) {
this->parent->SendMsg(this, 6, this->geometry.id, this->value, 0, 0);
}
}