From 1933e237da4f051066456a8a727b469f1b70ed60 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sun, 19 Jun 2022 15:47:23 +0100 Subject: [PATCH] Remove `FallbackPalette` Copies `black.pcx` into the MPQ to handle the case where we have `devilutionx.mpq` but not `diabdat.mpq` --- CMake/Assets.cmake | 1 + Packaging/resources/assets/ui_art/black.pcx | Bin 0 -> 899 bytes Source/DiabloUI/dialogs.cpp | 130 +------------------- 3 files changed, 2 insertions(+), 129 deletions(-) create mode 100644 Packaging/resources/assets/ui_art/black.pcx diff --git a/CMake/Assets.cmake b/CMake/Assets.cmake index a18907cdf..0ad621bab 100644 --- a/CMake/Assets.cmake +++ b/CMake/Assets.cmake @@ -159,6 +159,7 @@ set(devilutionx_assets gendata/cutstartw.pcx Levels/L1Data/SklKngT.dun Levels/L2Data/BonechaT.dun + ui_art/black.pcx ui_art/creditsw.pcx ui_art/dvl_but_sml.pcx ui_art/dvl_lrpopup.pcx diff --git a/Packaging/resources/assets/ui_art/black.pcx b/Packaging/resources/assets/ui_art/black.pcx new file mode 100644 index 0000000000000000000000000000000000000000..d1cfd330dc157f7286fd3019681c480b222805a6 GIT binary patch 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>=1AfB`T9 z6@b8jK?-IJb{eXAup6P4gJvys7{Kp=fCa`~Fx(83REj8yMiizg1|yE41rAFoDTT;H zN)e&<3Lz;%L=mD9O;a?DFac9ErZFagW*G9E#taDr%rZ2~QY?cR7PBnLm}6;0q zIF8{t%|=bUH|0m1pK5HJsH_~eT6;{UR=vKqxcFL8kvTWFM4`yZ%tUEvOK-nT&#eU~UJnet z?CyKkdT-R*FyyM~yXa~wx7F)SH_n{17o0LFl&3S~IkGe)ejfkvzW2jodwlNp{FLwM zqnd|3*Sp&tE%nwqcUjeCt;JZVFFsK$9LvTOJ`CcgnVmO-UuW7kf(RcO-){}x1yrLX0w%+ yma5firBW%E%gINM23po> vecNULL; std::vector> vecOkDialog; -// clang-format off -#define BLANKCOLOR { 0, 0xFF, 0, 0 } -// clang-format on - -void LoadFallbackPalette() -{ - // clang-format off - static const SDL_Color FallbackPalette[256] = { - { 0x00, 0x00, 0x00, 0 }, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, - { 0xff, 0xfd, 0x9f, 0 }, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - { 0xe8, 0xca, 0xca, 0 }, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - { 0x05, 0x07, 0x0c, 0 }, - { 0xff, 0xe3, 0xa4, 0 }, - { 0xee, 0xd1, 0x8c, 0 }, - { 0xdd, 0xc4, 0x7e, 0 }, - { 0xcc, 0xb7, 0x75, 0 }, - { 0xbc, 0xa8, 0x6c, 0 }, - { 0xab, 0x9a, 0x63, 0 }, - { 0x98, 0x8b, 0x5d, 0 }, - { 0x87, 0x7e, 0x54, 0 }, - { 0x78, 0x6f, 0x49, 0 }, - { 0x69, 0x60, 0x3f, 0 }, - { 0x5b, 0x51, 0x34, 0 }, - { 0x48, 0x40, 0x27, 0 }, - { 0x39, 0x31, 0x1d, 0 }, - { 0x31, 0x28, 0x16, 0 }, - { 0x1a, 0x14, 0x08, 0 }, - { 0x14, 0x0b, 0x00, 0 }, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, - { 0xff, 0xbd, 0xbd, 0 }, - { 0xf4, 0x96, 0x96, 0 }, - { 0xe8, 0x7d, 0x7d, 0 }, - { 0xe0, 0x6c, 0x6c, 0 }, - { 0xd8, 0x5b, 0x5b, 0 }, - { 0xcf, 0x49, 0x49, 0 }, - { 0xc7, 0x38, 0x38, 0 }, - { 0xbf, 0x27, 0x27, 0 }, - { 0xa9, 0x22, 0x22, 0 }, - { 0x93, 0x1e, 0x1e, 0 }, - { 0x7c, 0x19, 0x19, 0 }, - { 0x66, 0x15, 0x15, 0 }, - { 0x4f, 0x11, 0x11, 0 }, - { 0x39, 0x0d, 0x0d, 0 }, - { 0x23, 0x09, 0x09, 0 }, - { 0x0c, 0x05, 0x05, 0 }, - { 0xf3, 0xf3, 0xf3, 0 }, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, BLANKCOLOR, - { 0xff, 0xff, 0x00, 0 }, - BLANKCOLOR, BLANKCOLOR, BLANKCOLOR, - BLANKCOLOR, - }; - // clang-format on - ApplyGamma(logical_palette, FallbackPalette, 256); - BlackPalette(); -} - std::optional LoadDialogSprite(bool hasCaption, bool isError) { constexpr uint8_t TransparentColor = 255; @@ -185,9 +58,8 @@ bool Init(string_view caption, string_view text, bool error, bool renderBehind) ArtBackground = std::nullopt; LoadBackgroundArt("ui_art\\black.pcx"); if (!ArtBackground) { - LoadFallbackPalette(); if (SDL_ShowCursor(SDL_ENABLE) <= -1) - Log("{}", SDL_GetError()); + LogError("{}", SDL_GetError()); } } LoadDialogButtonGraphics();