From 5505e830fb3320306242e51fbeed00c18db6e24a Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Thu, 4 Aug 2022 03:13:22 +0100 Subject: [PATCH] Render XP bar as CLX Missed in #5183. Also, the previous conversion command was incorrect (missing --transparent-color 1), re-converted with: ``` pcx2clx --transparent-color 1 data/xpbar.pcx ``` --- Packaging/resources/assets/data/xpbar.clx | Bin 1546 -> 1543 bytes Source/qol/xpbar.cpp | 14 ++++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Packaging/resources/assets/data/xpbar.clx b/Packaging/resources/assets/data/xpbar.clx index 154f132a0b7dca317978984d778391c2d969e9da..98f7e9170df3d79b7ea2fd3ff07174bc941db11b 100644 GIT binary patch delta 143 zcmeC;Y3Jc&WME+60b=%voDbOk{rbJ{7xTvVER3xGPwzX!y!i*CA|vzOP-hE6lGLZ%^LOqRI@^ OzWF(eJR|eIBg_DmNj=Q~ delta 146 zcmZqY>EhvJWME+60b;I+oDbOk{`&oE597x7ER3xGPM_JsxcLX8B9M9f_#Vc|GR)R? z|IQrU!}#yiu?7YRY-9L$1}OLMG_uHPkebs+(AAteHd&t8f)#AU -#include "DiabloUI/art_draw.h" #include "control.h" +#include "engine/clx_sprite.hpp" +#include "engine/load_clx.hpp" #include "engine/point.hpp" +#include "engine/render/clx_render.hpp" #include "options.h" #include "utils/format_int.hpp" #include "utils/language.h" @@ -29,7 +31,7 @@ constexpr ColorGradient SilverGradient = { 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0 constexpr int BackWidth = 313; constexpr int BackHeight = 9; -Art xpbarArt; +OptionalOwnedClxSpriteList xpbarArt; void DrawBar(const Surface &out, Point screenPosition, int width, const ColorGradient &gradient) { @@ -50,9 +52,9 @@ void DrawEndCap(const Surface &out, Point point, int idx, const ColorGradient &g void InitXPBar() { if (*sgOptions.Gameplay.experienceBar) { - LoadMaskedArt("data\\xpbar.pcx", &xpbarArt, 1, 1); + xpbarArt = LoadOptionalClx("data\\xpbar.clx"); - if (xpbarArt.surface == nullptr) { + if (!xpbarArt) { app_fatal(_("Failed to load UI resources.\n" "\n" "Make sure devilutionx.mpq is in the game folder and that it is up to date.")); @@ -62,7 +64,7 @@ void InitXPBar() void FreeXPBar() { - xpbarArt.Unload(); + xpbarArt = std::nullopt; } void DrawXPBar(const Surface &out) @@ -76,7 +78,7 @@ void DrawXPBar(const Surface &out) const Point back = { mainPanel.position.x + mainPanel.size.width / 2 - 155, mainPanel.position.y + mainPanel.size.height - 11 }; const Point position = back + Displacement { 3, 2 }; - DrawArt(out, back, &xpbarArt); + RenderClxSprite(out, (*xpbarArt)[0], back); const int8_t charLevel = player._pLevel;