Browse Source

Remove redundant devilutionx.mpq check

We now check it only once in `CheckArchivesUpToDate`.
We then use `LoadClx` instead of `LoadOptionalClx` throughout.
pull/5191/head
Gleb Mazovetskiy 4 years ago committed by Anders Jenbo
parent
commit
c351acbf7e
  1. 8
      Source/diablo.cpp
  2. 4
      Source/panels/charpanel.cpp
  3. 4
      Source/panels/mainpanel.cpp
  4. 10
      Source/qol/stash.cpp
  5. 8
      Source/qol/xpbar.cpp

8
Source/diablo.cpp

@ -943,13 +943,15 @@ void SetApplicationVersions()
void CheckArchivesUpToDate() void CheckArchivesUpToDate()
{ {
const bool devilutionxMpqOutOfDate = devilutionx_mpq && devilutionx_mpq->HasFile("fonts\\12-00.pcx"); const bool devilutionxMpqOutOfDate = devilutionx_mpq && !devilutionx_mpq->HasFile("data\\charbg.clx");
const bool fontsMpqOutOfDate = font_mpq && font_mpq->HasFile("fonts\\12-4e.pcx"); const bool fontsMpqOutOfDate = font_mpq && !font_mpq->HasFile("fonts\\12-4e.clx");
if (devilutionxMpqOutOfDate && fontsMpqOutOfDate) { if (devilutionxMpqOutOfDate && fontsMpqOutOfDate) {
app_fatal(_("Please update devilutionx.mpq and fonts.mpq to the latest version")); app_fatal(_("Please update devilutionx.mpq and fonts.mpq to the latest version"));
} else if (devilutionxMpqOutOfDate) { } else if (devilutionxMpqOutOfDate) {
app_fatal(_("Please update devilutionx.mpq to the latest version")); 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."));
} else if (fontsMpqOutOfDate) { } else if (fontsMpqOutOfDate) {
app_fatal(_("Please update fonts.mpq to the latest version")); app_fatal(_("Please update fonts.mpq to the latest version"));
} }

4
Source/panels/charpanel.cpp

@ -265,9 +265,7 @@ void DrawStatButtons(const Surface &out)
void LoadCharPanel() void LoadCharPanel()
{ {
OptionalOwnedClxSpriteList background = LoadOptionalClx("data\\charbg.clx"); OptionalOwnedClxSpriteList background = LoadClx("data\\charbg.clx");
if (!background)
app_fatal(_("Please update devilutionx.mpq to the latest version"));
OwnedSurface out((*background)[0].width(), (*background)[0].height()); OwnedSurface out((*background)[0].width(), (*background)[0].height());
RenderClxSprite(out, (*background)[0], { 0, 0 }); RenderClxSprite(out, (*background)[0], { 0, 0 });
background = std::nullopt; background = std::nullopt;

4
Source/panels/mainpanel.cpp

@ -67,9 +67,7 @@ void LoadMainPanel()
std::optional<OwnedSurface> out; std::optional<OwnedSurface> out;
constexpr uint16_t NumButtonSprites = 6; constexpr uint16_t NumButtonSprites = 6;
{ {
OptionalOwnedClxSpriteList background = LoadOptionalClx("data\\panel8bucp.clx"); OptionalOwnedClxSpriteList background = LoadClx("data\\panel8bucp.clx");
if (!background)
app_fatal(_("Please update devilutionx.mpq to the latest version"));
out.emplace((*background)[0].width(), (*background)[0].height() * NumButtonSprites); out.emplace((*background)[0].width(), (*background)[0].height() * NumButtonSprites);
int y = 0; int y = 0;
for (ClxSprite sprite : ClxSpriteList(*background)) { for (ClxSprite sprite : ClxSpriteList(*background)) {

10
Source/qol/stash.cpp

@ -268,14 +268,8 @@ void InitStash()
{ {
InitialWithdrawGoldValue = 0; InitialWithdrawGoldValue = 0;
StashPanelArt = LoadOptionalClx("data\\stash.clx"); StashPanelArt = LoadClx("data\\stash.clx");
StashNavButtonArt = LoadOptionalClx("data\\stashnavbtns.clx"); StashNavButtonArt = LoadClx("data\\stashnavbtns.clx");
if (!StashPanelArt || !StashNavButtonArt) {
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."));
}
} }
void TransferItemToInventory(Player &player, uint16_t itemId) void TransferItemToInventory(Player &player, uint16_t itemId)

8
Source/qol/xpbar.cpp

@ -52,13 +52,7 @@ void DrawEndCap(const Surface &out, Point point, int idx, const ColorGradient &g
void InitXPBar() void InitXPBar()
{ {
if (*sgOptions.Gameplay.experienceBar) { if (*sgOptions.Gameplay.experienceBar) {
xpbarArt = LoadOptionalClx("data\\xpbar.clx"); xpbarArt = LoadClx("data\\xpbar.clx");
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."));
}
} }
} }

Loading…
Cancel
Save