rodecomp/Source/UI/Shop/ItemDrawing.cpp
ragnarok-clanker 3659ac2f71 Maintenance: [forced, user-approved] Family D7 (resubmit of #10212, returned only for conflicts with newer main; regenerated on e6188
Batch #10213 by ragnarok-clanker: forced by an admin (38 lower score(s), 147 changed function(s)); checked with 352 compiled unit(s), including every includer of Source/Client/Mode/ModeDragState.h, Source/Client/Session.h, Source/Contents/Items/ItemDescription.h, Source/Contents/Items/ItemInfo.h, Source/Contents/Items/ItemLink.h, Source/Contents/Items/ItemResources.h, Source/UI/Shop/ItemDrawing.h, Source/UI/Shortcuts/ShortcutPainting.h, Source/UI/Shortcuts/ShortcutPress.h, Source/UI/Shortcuts/UIQuickSlotWnd.h, Source/UI/Text/TextWrapping.h, Source/UI/Text/UIBalloonText.h, Source/UI/UIStaticItem.h.
2026-11-02 23:43:46 +00:00

94 lines
3.3 KiB
C++

#include "Client/Session.h"
#include "Contents/Items/ItemDescription.h"
#include "Contents/Items/ItemInfo.h"
#include "Resource/Bitmap/BitmapResource.h"
#include "Resource/ResourceMgr.h"
#include "Resource/TextureNames.h"
#include "UI/Shop/ItemDrawing.h"
#include "UI/Window/UIWindow.h"
#include <cstdio>
// OFFSET: 0x008A8D30
// FUNCTION: fn_11716
void DrawItemWithQuantityAuxiliary(
UIWindow& window, int mode, int x, int y, const ITEM_INFO& item,
unsigned char identified, unsigned char plain
) {
char text[128] = {};
g_session.IconPath(text, item.itemId.c_str(), identified);
CBitmapRes* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(text)));
window.DrawAuxiliary(mode, x, y, bitmap ? &bitmap->image : nullptr, true, false);
if (item.quantity == 0) {
return;
}
std::sprintf(text, "%d", item.quantity);
if (plain != 0) {
window.DrawTextAt(x + 16, y + 20, text, 0, 0, 11, 0, 0, 0);
} else {
const int left = x + (item.quantity < 1000 ? 14 : 0);
window.DrawTextAt(left + 1, y + 15, text, 0, 0, 11, 0xFFFFFF, 0, 0);
window.DrawTextAt(left - 1, y + 15, text, 0, 0, 11, 0xFFFFFF, 0, 0);
window.DrawTextAt(left, y + 16, text, 0, 0, 11, 0xFFFFFF, 0, 0);
window.DrawTextAt(left, y + 14, text, 0, 0, 11, 0xFFFFFF, 0, 0);
window.DrawTextAt(left, y + 15, text, 0, 0, 11, 0, 0, 0);
}
}
// OFFSET: 0x008A8EE0
// FUNCTION: fn_11717
void DrawItemIcon(UIWindow& window, ResourceMgr& resources, int x, int y, const ITEM_INFO& item, unsigned char identified) {
char path[128];
g_session.IconPath(path, item.itemId.c_str(), item.identified != 0 || identified != 0);
CBitmapRes* bitmap = static_cast<CBitmapRes*>(resources.Load(path));
if (bitmap) {
window.DrawBitmap(x, y, &bitmap->image, true);
}
}
// OFFSET: 0x008A8F80
// FUNCTION: fn_11718
void DrawItemIconById(UIWindow& window, int x, int y, const char* id, unsigned char identified) {
char path[128];
g_session.IconPath(path, id, identified);
CBitmapRes* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(path)));
if (bitmap) {
window.DrawBitmap(x, y, &bitmap->image, true);
}
}
// OFFSET: 0x008A9000
// FUNCTION: fn_11719
void DrawItemSlotBackground(UIWindow& window, int x, int y) {
CBitmapRes* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\itemwin_mid.bmp")));
window.DrawBitmap(x, y, bitmap ? &bitmap->image : nullptr, false);
}
// OFFSET: 0x008A9040
// FUNCTION: fn_11720
void DrawItemWithQuantity(
UIWindow& window, ResourceMgr& resources, int x, int y, const ITEM_INFO& item,
unsigned char identified, unsigned char plain
) {
DrawItemIcon(window, resources, x, y, item, identified);
if (item.quantity == -1 || item.quantity == 0) {
return;
}
char text[16];
std::sprintf(text, "%d", item.quantity);
if (plain != 0) {
window.DrawTextAt(x + 16, y + 20, text, 0, 0, 11, 0, 0, 0);
} else {
const int left = x + (item.quantity < 1000 ? 14 : 0);
window.DrawTextAt(left + 1, y + 15, text, 0, 0, 11, 0xFFFFFF, 0, 0);
window.DrawTextAt(left - 1, y + 15, text, 0, 0, 11, 0xFFFFFF, 0, 0);
window.DrawTextAt(left, y + 16, text, 0, 0, 11, 0xFFFFFF, 0, 0);
window.DrawTextAt(left, y + 14, text, 0, 0, 11, 0xFFFFFF, 0, 0);
window.DrawTextAt(left, y + 15, text, 0, 0, 11, 0, 0, 0);
}
}