Browse Source

Replace default palette PCX files with PAL files

These PCX files were only used to load the default palette.
Replaces them with PAL files.
pull/5279/head
Gleb Mazovetskiy 4 years ago
parent
commit
f4827a0cb6
  1. 4
      CMake/Assets.cmake
  2. BIN
      Packaging/resources/assets/ui_art/black_diablo.pcx
  3. BIN
      Packaging/resources/assets/ui_art/diablo.pal
  4. BIN
      Packaging/resources/assets/ui_art/hellfire.pal
  5. 47
      Source/DiabloUI/diabloui.cpp
  6. 1
      Source/DiabloUI/diabloui.h

4
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

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

Binary file not shown.

BIN
Packaging/resources/assets/ui_art/diablo.pal

Binary file not shown.

BIN
Packaging/resources/assets/ui_art/black_hellfire.pcx → Packaging/resources/assets/ui_art/hellfire.pal

Binary file not shown.

47
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<std::unique_ptr<UiItemBase>> *vecDialog)

1
Source/DiabloUI/diabloui.h

@ -94,6 +94,7 @@ bool UiItemMouseEvents(SDL_Event *event, const std::vector<std::unique_ptr<UiIte
Sint16 GetCenterOffset(Sint16 w, Sint16 bw = 0);
void LoadPalInMem(const SDL_Color *pPal);
void DrawMouse();
void UiLoadDefaultPalette();
bool UiLoadBlackBackground();
void LoadBackgroundArt(const char *pszFile, int frames = 1);
void UiAddBackground(std::vector<std::unique_ptr<UiItemBase>> *vecDialog);

Loading…
Cancel
Save