From f4827a0cb65ca54f20a469a971eeb588a45c0f4d Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Tue, 23 Aug 2022 11:22:47 +0900 Subject: [PATCH] Replace default palette PCX files with PAL files These PCX files were only used to load the default palette. Replaces them with PAL files. --- CMake/Assets.cmake | 4 +- .../resources/assets/ui_art/black_diablo.pcx | Bin 899 -> 0 bytes Packaging/resources/assets/ui_art/diablo.pal | Bin 0 -> 768 bytes .../{black_hellfire.pcx => hellfire.pal} | Bin 899 -> 768 bytes Source/DiabloUI/diabloui.cpp | 47 ++++++++++-------- Source/DiabloUI/diabloui.h | 1 + 6 files changed, 29 insertions(+), 23 deletions(-) delete mode 100644 Packaging/resources/assets/ui_art/black_diablo.pcx create mode 100644 Packaging/resources/assets/ui_art/diablo.pal rename Packaging/resources/assets/ui_art/{black_hellfire.pcx => hellfire.pal} (79%) diff --git a/CMake/Assets.cmake b/CMake/Assets.cmake index 5e37f152e..4da83d212 100644 --- a/CMake/Assets.cmake +++ b/CMake/Assets.cmake @@ -161,8 +161,8 @@ set(devilutionx_assets levels/l2data/bonechat.dun nlevels/l5data/cornerstone.dun nlevels/l5data/uberroom.dun - ui_art/black_diablo.pcx - ui_art/black_hellfire.pcx + ui_art/diablo.pal + ui_art/hellfire.pal ui_art/creditsw.clx ui_art/dvl_but_sml.clx ui_art/dvl_lrpopup.clx diff --git a/Packaging/resources/assets/ui_art/black_diablo.pcx b/Packaging/resources/assets/ui_art/black_diablo.pcx deleted file mode 100644 index d1cfd330dc157f7286fd3019681c480b222805a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 899 zcma))T}V@57{{O0hR1rfGkUEvJ*}f2@kndU9I?^F4R^88s1>Wtk7(r>3Ii1ll+t$L z2c#n5kSuY69~gB}D!9P4fznJC83=k|5)~v7HPAb2r`J(;UHI^O|NsB{JkNXg9+F8Y z_*;`O`7iF@B?myV|Ly;5BGQYbP9$X!a*ITwq&A|H%ZXVJM18R2houf~B>=1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al similarity index 79% rename from Packaging/resources/assets/ui_art/black_hellfire.pcx rename to Packaging/resources/assets/ui_art/hellfire.pal index d1cb7cf7c21f7c3a80825085313666375a7be560..8fec9adb47ca115101f6ef5b5734b129c9d0b357 100644 GIT binary patch delta 7 OcmZo>Z(v*4%nSetN&+|l delta 139 ncmZo*Yi6(KVrArDfPx052aGT_(KI6y1L>OJrn3N9JPVisjE)1s diff --git a/Source/DiabloUI/diabloui.cpp b/Source/DiabloUI/diabloui.cpp index 3686ed782..3c9d165cd 100644 --- a/Source/DiabloUI/diabloui.cpp +++ b/Source/DiabloUI/diabloui.cpp @@ -319,6 +319,23 @@ bool HandleMenuAction(MenuAction menuAction) } } +void UiOnBackgroundChange() +{ + fadeTc = 0; + fadeValue = 0; + + if (IsHardwareCursorEnabled() && ArtCursor && ControlDevice == ControlTypes::KeyboardAndMouse && GetCurrentCursorInfo().type() != CursorType::UserInterface) { + SetHardwareCursor(CursorInfo::UserInterfaceCursor()); + } + + BlackPalette(); + + SDL_FillRect(DiabloUiSurface(), nullptr, 0x000000); + if (DiabloUiSurface() == PalSurface) + BltFast(nullptr, nullptr); + RenderPresent(); +} + } // namespace void UiFocusNavigation(SDL_Event *event) @@ -664,16 +681,17 @@ Sint16 GetCenterOffset(Sint16 w, Sint16 bw) return (bw - w) / 2; } -bool UiLoadBlackBackground() +void UiLoadDefaultPalette() { - LoadBackgroundArt(gbIsHellfire ? "ui_art\\black_hellfire.pcx" : "ui_art\\black_diablo.pcx"); - - if (!ArtBackground) - return false; + LoadPalette(gbIsHellfire ? "ui_art\\hellfire.pal" : "ui_art\\diablo.pal", /*blend=*/false); + ApplyGamma(logical_palette, orig_palette, 256); +} - // We only needed the black background for the palette, can now deallocate it. +bool UiLoadBlackBackground() +{ ArtBackground = std::nullopt; - + UiLoadDefaultPalette(); + UiOnBackgroundChange(); return true; } @@ -687,20 +705,7 @@ void LoadBackgroundArt(const char *pszFile, int frames) LoadPalInMem(pPal); ApplyGamma(logical_palette, orig_palette, 256); - - fadeTc = 0; - fadeValue = 0; - - if (IsHardwareCursorEnabled() && ArtCursor && ControlDevice == ControlTypes::KeyboardAndMouse && GetCurrentCursorInfo().type() != CursorType::UserInterface) { - SetHardwareCursor(CursorInfo::UserInterfaceCursor()); - } - - BlackPalette(); - - SDL_FillRect(DiabloUiSurface(), nullptr, 0x000000); - if (DiabloUiSurface() == PalSurface) - BltFast(nullptr, nullptr); - RenderPresent(); + UiOnBackgroundChange(); } void UiAddBackground(std::vector> *vecDialog) diff --git a/Source/DiabloUI/diabloui.h b/Source/DiabloUI/diabloui.h index 52aeed533..6e49424c6 100644 --- a/Source/DiabloUI/diabloui.h +++ b/Source/DiabloUI/diabloui.h @@ -94,6 +94,7 @@ bool UiItemMouseEvents(SDL_Event *event, const std::vector> *vecDialog);