diff --git a/Packaging/resources/devilutionx.mpq b/Packaging/resources/devilutionx.mpq new file mode 100644 index 000000000..1419a161a Binary files /dev/null and b/Packaging/resources/devilutionx.mpq differ diff --git a/Source/init.cpp b/Source/init.cpp index 70dfdfe71..b0fc608a2 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -38,6 +38,7 @@ HANDLE hfmusic_mpq; HANDLE hfvoice_mpq; HANDLE hfopt1_mpq; HANDLE hfopt2_mpq; +HANDLE devilutionx_mpq; namespace { @@ -116,6 +117,10 @@ void init_cleanup() SFileCloseArchive(hfopt2_mpq); hfopt2_mpq = NULL; } + if (devilutionx_mpq) { + SFileCloseArchive(patch_rt_mpq); + patch_rt_mpq = NULL; + } NetClose(); } @@ -161,6 +166,7 @@ void init_archives() hfvoice_mpq = init_test_access("hfvoice.mpq", "DiabloInstall", 8500, FS_PC); hfopt1_mpq = init_test_access("hfopt1.mpq", "DiabloInstall", 8600, FS_PC); hfopt2_mpq = init_test_access("hfopt2.mpq", "DiabloInstall", 8610, FS_PC); + devilutionx_mpq = init_test_access("devilutionx.mpq", "DiabloInstall", 9000, FS_PC); } void init_create_window() diff --git a/Source/init.h b/Source/init.h index 604ecb4d2..5c50a9dac 100644 --- a/Source/init.h +++ b/Source/init.h @@ -28,6 +28,7 @@ extern HANDLE hfmusic_mpq; extern HANDLE hfvoice_mpq; extern HANDLE hfopt1_mpq; extern HANDLE hfopt2_mpq; +extern HANDLE devilutionx_mpq; void init_cleanup(); void init_archives(); diff --git a/SourceX/DiabloUI/art.cpp b/SourceX/DiabloUI/art.cpp index 734498f32..2cbe8235c 100644 --- a/SourceX/DiabloUI/art.cpp +++ b/SourceX/DiabloUI/art.cpp @@ -11,8 +11,10 @@ void LoadArt(const char *pszFile, Art *art, int frames, SDL_Color *pPalette) art->frames = frames; DWORD width, height, bpp; - if (!SBmpLoadImage(pszFile, 0, 0, 0, &width, &height, &bpp)) + if (!SBmpLoadImage(pszFile, 0, 0, 0, &width, &height, &bpp)) { + SDL_Log("Failed to load image meta"); return; + } Uint32 format; switch (bpp) { @@ -57,7 +59,7 @@ void LoadArt(Art *art, const BYTE *artData, int w, int h, int frames) { art->frames = frames; art->surface = SDL_CreateRGBSurfaceWithFormatFrom( - const_cast(artData), w, h, 8, w, SDL_PIXELFORMAT_INDEX8); + const_cast(artData), w, h, 8, w, SDL_PIXELFORMAT_INDEX8); art->logical_width = w; art->frame_height = h / frames; ScaleSurfaceToOutput(&art->surface); diff --git a/SourceX/DiabloUI/credits.cpp b/SourceX/DiabloUI/credits.cpp index 389ee125c..f07dc3d33 100644 --- a/SourceX/DiabloUI/credits.cpp +++ b/SourceX/DiabloUI/credits.cpp @@ -105,6 +105,7 @@ class CreditsRenderer { public: CreditsRenderer() { + LoadArt("ui_art\\creditsw.pcx", &ArtBackgroundWidescreen); LoadBackgroundArt("ui_art\\credits.pcx"); LoadTtfFont(); ticks_begin_ = SDL_GetTicks(); @@ -114,6 +115,7 @@ public: ~CreditsRenderer() { + ArtBackgroundWidescreen.Unload(); ArtBackground.Unload(); UnloadTtfFont(); @@ -145,6 +147,7 @@ void CreditsRenderer::Render() prev_offset_y_ = offset_y; SDL_FillRect(GetOutputSurface(), NULL, 0x000000); + DrawArt(PANEL_LEFT - 320, UI_OFFSET_Y, &ArtBackgroundWidescreen); DrawArt(PANEL_LEFT, UI_OFFSET_Y, &ArtBackground); if (font == NULL) return; diff --git a/SourceX/DiabloUI/diabloui.cpp b/SourceX/DiabloUI/diabloui.cpp index 0a7120461..f34e7d419 100644 --- a/SourceX/DiabloUI/diabloui.cpp +++ b/SourceX/DiabloUI/diabloui.cpp @@ -30,6 +30,7 @@ const std::size_t *ListOffset = NULL; Art ArtLogos[3]; Art ArtFocus[3]; +Art ArtBackgroundWidescreen; Art ArtBackground; Art ArtCursor; Art ArtHero; @@ -607,8 +608,13 @@ void LoadBackgroundArt(const char *pszFile, int frames) void UiAddBackground(std::vector *vecDialog) { - SDL_Rect rect = { PANEL_LEFT, UI_OFFSET_Y, 640, 480 }; - vecDialog->push_back(new UiImage(&ArtBackground, rect)); + if (ArtBackgroundWidescreen.surface != NULL) { + SDL_Rect rectw = { 0, UI_OFFSET_Y, 0, 0 }; + vecDialog->push_back(new UiImage(&ArtBackgroundWidescreen, /*animated=*/false, /*frame=*/0, rectw, UIS_CENTER)); + } + + SDL_Rect rect = { 0, UI_OFFSET_Y, 0, 0 }; + vecDialog->push_back(new UiImage(&ArtBackground, /*animated=*/false, /*frame=*/0, rect, UIS_CENTER)); } void UiAddLogo(std::vector *vecDialog, int size, int y) diff --git a/SourceX/DiabloUI/diabloui.h b/SourceX/DiabloUI/diabloui.h index bfaad2e62..f9c4d6f82 100644 --- a/SourceX/DiabloUI/diabloui.h +++ b/SourceX/DiabloUI/diabloui.h @@ -26,6 +26,7 @@ typedef enum _artLogo { extern Art ArtLogos[3]; extern Art ArtFocus[3]; extern Art ArtBackground; +extern Art ArtBackgroundWidescreen; extern Art ArtCursor; extern Art ArtHero; extern bool gbSpawned; diff --git a/SourceX/DiabloUI/mainmenu.cpp b/SourceX/DiabloUI/mainmenu.cpp index 4fc4fd51d..b5a997ab5 100644 --- a/SourceX/DiabloUI/mainmenu.cpp +++ b/SourceX/DiabloUI/mainmenu.cpp @@ -48,6 +48,14 @@ void mainmenu_Load(const char *name, void (*fnSound)(const char *file)) vecMenuItems.push_back(new UiListItem("Exit Diablo", MAINMENU_EXIT_DIABLO)); } + if (!gbSpawned || gbIsHellfire) { + if (gbIsHellfire) + LoadArt("ui_art\\mainmenuw.pcx", &ArtBackgroundWidescreen); + LoadBackgroundArt("ui_art\\mainmenu.pcx"); + } else { + LoadBackgroundArt("ui_art\\swmmenu.pcx"); + } + UiAddBackground(&vecMainMenuDialog); UiAddLogo(&vecMainMenuDialog); @@ -56,17 +64,12 @@ void mainmenu_Load(const char *name, void (*fnSound)(const char *file)) SDL_Rect rect = { 17, (SCREEN_HEIGHT - 36), 605, 21 }; vecMainMenuDialog.push_back(new UiArtText(name, rect, UIS_SMALL)); - if (!gbSpawned || gbIsHellfire) { - LoadBackgroundArt("ui_art\\mainmenu.pcx"); - } else { - LoadBackgroundArt("ui_art\\swmmenu.pcx"); - } - UiInitList(vecMenuItems.size(), NULL, UiMainMenuSelect, mainmenu_Esc, vecMainMenuDialog, true); } void mainmenu_Free() { + ArtBackgroundWidescreen.Unload(); ArtBackground.Unload(); for (std::size_t i = 0; i < vecMainMenuDialog.size(); i++) { diff --git a/SourceX/DiabloUI/title.cpp b/SourceX/DiabloUI/title.cpp index cd0582285..a4bc00bf4 100644 --- a/SourceX/DiabloUI/title.cpp +++ b/SourceX/DiabloUI/title.cpp @@ -10,6 +10,7 @@ void title_Load() { if (gbIsHellfire) { LoadBackgroundArt("ui_art\\hf_logo1.pcx", 16); + LoadArt("ui_art\\hf_titlew.pcx", &ArtBackgroundWidescreen); } else { LoadBackgroundArt("ui_art\\title.pcx"); LoadMaskedArt("ui_art\\logo.pcx", &ArtLogos[LOGO_BIG], 15); @@ -19,6 +20,7 @@ void title_Load() void title_Free() { ArtBackground.Unload(); + ArtBackgroundWidescreen.Unload(); ArtLogos[LOGO_BIG].Unload(); for (std::size_t i = 0; i < vecTitleScreen.size(); i++) { @@ -32,6 +34,7 @@ void UiTitleDialog() { if (gbIsHellfire) { SDL_Rect rect = { 0, UI_OFFSET_Y, 0, 0 }; + vecTitleScreen.push_back(new UiImage(&ArtBackgroundWidescreen, /*animated=*/true, /*frame=*/0, rect, UIS_CENTER)); vecTitleScreen.push_back(new UiImage(&ArtBackground, /*animated=*/true, /*frame=*/0, rect, UIS_CENTER)); } else { UiAddBackground(&vecTitleScreen); diff --git a/SourceX/storm/storm.cpp b/SourceX/storm/storm.cpp index 4b48f270f..a59b0a772 100644 --- a/SourceX/storm/storm.cpp +++ b/SourceX/storm/storm.cpp @@ -153,6 +153,9 @@ BOOL SFileOpenFile(const char *filename, HANDLE *phFile) result = SFileOpenFileEx((HANDLE)0, path.c_str(), 0xFFFFFFFF, phFile); } + if (!result) { + result = SFileOpenFileEx((HANDLE)devilutionx_mpq, filename, 0, phFile); + } if (gbIsHellfire) { if (!result) { result = SFileOpenFileEx((HANDLE)hfopt2_mpq, filename, 0, phFile);