Browse Source

Remove `FallbackPalette`

Copies `black.pcx` into the MPQ to handle the case where we have
`devilutionx.mpq` but not `diabdat.mpq`
pull/4757/head
Gleb Mazovetskiy 4 years ago committed by Anders Jenbo
parent
commit
1933e237da
  1. 1
      CMake/Assets.cmake
  2. BIN
      Packaging/resources/assets/ui_art/black.pcx
  3. 130
      Source/DiabloUI/dialogs.cpp

1
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

BIN
Packaging/resources/assets/ui_art/black.pcx

Binary file not shown.

130
Source/DiabloUI/dialogs.cpp

@ -34,133 +34,6 @@ void DialogActionOK()
std::vector<std::unique_ptr<UiItemBase>> vecNULL;
std::vector<std::unique_ptr<UiItemBase>> 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<PcxSprite> 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();

Loading…
Cancel
Save