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()
{
const bool devilutionxMpqOutOfDate = devilutionx_mpq && devilutionx_mpq->HasFile("fonts\\12-00.pcx");
const bool fontsMpqOutOfDate = font_mpq && font_mpq->HasFile("fonts\\12-4e.pcx");
const bool devilutionxMpqOutOfDate = devilutionx_mpq && !devilutionx_mpq->HasFile("data\\charbg.clx");
const bool fontsMpqOutOfDate = font_mpq && !font_mpq->HasFile("fonts\\12-4e.clx");
if (devilutionxMpqOutOfDate && fontsMpqOutOfDate) {
app_fatal(_("Please update devilutionx.mpq and fonts.mpq to the latest version"));
} 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) {
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()
{
OptionalOwnedClxSpriteList background = LoadOptionalClx("data\\charbg.clx");
if (!background)
app_fatal(_("Please update devilutionx.mpq to the latest version"));
OptionalOwnedClxSpriteList background = LoadClx("data\\charbg.clx");
OwnedSurface out((*background)[0].width(), (*background)[0].height());
RenderClxSprite(out, (*background)[0], { 0, 0 });
background = std::nullopt;

4
Source/panels/mainpanel.cpp

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

10
Source/qol/stash.cpp

@ -268,14 +268,8 @@ void InitStash()
{
InitialWithdrawGoldValue = 0;
StashPanelArt = LoadOptionalClx("data\\stash.clx");
StashNavButtonArt = LoadOptionalClx("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."));
}
StashPanelArt = LoadClx("data\\stash.clx");
StashNavButtonArt = LoadClx("data\\stashnavbtns.clx");
}
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()
{
if (*sgOptions.Gameplay.experienceBar) {
xpbarArt = LoadOptionalClx("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."));
}
xpbarArt = LoadClx("data\\xpbar.clx");
}
}

Loading…
Cancel
Save