From 3ccaa683cdaae11db02e22087fdb7390281378d3 Mon Sep 17 00:00:00 2001 From: elasota <1137273+elasota@users.noreply.github.com> Date: Wed, 24 Jan 2024 22:48:08 -0500 Subject: [PATCH] VCRUISE: Fix AD2044 fullscreen UI --- engines/vcruise/runtime.cpp | 29 +++++++++++++++++++++++++---- engines/vcruise/runtime.h | 2 ++ engines/vcruise/vcruise.cpp | 1 + 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp index d432da4b081..17f584d6471 100644 --- a/engines/vcruise/runtime.cpp +++ b/engines/vcruise/runtime.cpp @@ -1553,6 +1553,9 @@ bool Runtime::bootGame(bool newGame) { _trayCornerGraphic = loadGraphic("Select_2", true); } + if (_gameID == GID_AD2044) + _backgroundGraphic = loadGraphicFromPath("SCR0.BMP", true); + Common::Language lang = _defaultLanguage; if (ConfMan.hasKey("language")) { @@ -5002,7 +5005,11 @@ void Runtime::inventoryRemoveItem(uint itemID) { } void Runtime::clearScreen() { - _system->fillScreen(_system->getScreenFormat().RGBToColor(0, 0, 0)); + if (_gameID == GID_AD2044) { + _fullscreenMenuSection.surf->blitFrom(*_backgroundGraphic); + commitSectionToScreen(_fullscreenMenuSection, _fullscreenMenuSection.rect); + } else + _system->fillScreen(_system->getScreenFormat().RGBToColor(0, 0, 0)); } void Runtime::redrawTray() { @@ -5018,10 +5025,17 @@ void Runtime::redrawTray() { } void Runtime::clearTray() { - uint32 blackColor = _traySection.surf->format.RGBToColor(0, 0, 0); - Common::Rect trayRect(0, 0, _traySection.surf->w, _traySection.surf->h); + Common::Rect trayRect; + if (_gameID == GID_AD2044) { + trayRect = _traySection.rect; + trayRect.translate(-trayRect.left, -trayRect.top); + _traySection.surf->blitFrom(*_backgroundGraphic, _traySection.rect, trayRect); + } else { + uint32 blackColor = _traySection.surf->format.RGBToColor(0, 0, 0); + trayRect = Common::Rect(0, 0, _traySection.surf->w, _traySection.surf->h); - _traySection.surf->fillRect(trayRect, blackColor); + _traySection.surf->fillRect(trayRect, blackColor); + } this->commitSectionToScreen(_traySection, trayRect); } @@ -5030,6 +5044,9 @@ void Runtime::drawInventory(uint slot) { if (!isTrayVisible()) return; + if (_gameID == GID_AD2044) + return; + Common::Rect trayRect = _traySection.rect; trayRect.translate(-trayRect.left, -trayRect.top); @@ -5196,6 +5213,10 @@ Common::SharedPtr Runtime::loadGraphic(const Common::String & filePath.appendInPlace(graphicName); filePath.appendInPlace(".bmp"); + return loadGraphicFromPath(filePath, required); +} + +Common::SharedPtr Runtime::loadGraphicFromPath(const Common::Path &filePath, bool required) { Common::File f; if (!f.open(filePath)) { warning("Couldn't open BMP file '%s'", filePath.toString(Common::Path::kNativeSeparator).c_str()); diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h index 89d72a1ccad..a1d53e9899a 100644 --- a/engines/vcruise/runtime.h +++ b/engines/vcruise/runtime.h @@ -947,6 +947,7 @@ private: Common::String getFileNameForItemGraphic(uint itemID) const; Common::SharedPtr loadGraphic(const Common::String &graphicName, bool required); + Common::SharedPtr loadGraphicFromPath(const Common::Path &path, bool required); bool loadSubtitles(Common::CodePage codePage, bool guessCodePage); @@ -1186,6 +1187,7 @@ private: Common::SharedPtr _trayBackgroundGraphic; Common::SharedPtr _trayHighlightGraphic; Common::SharedPtr _trayCornerGraphic; + Common::SharedPtr _backgroundGraphic; Common::Array > _uiGraphics; diff --git a/engines/vcruise/vcruise.cpp b/engines/vcruise/vcruise.cpp index 809eceeb546..3967182491e 100644 --- a/engines/vcruise/vcruise.cpp +++ b/engines/vcruise/vcruise.cpp @@ -80,6 +80,7 @@ Common::Error VCruiseEngine::run() { #if !defined(USE_JPEG) if (_gameDescription->desc.flags & VCRUISE_GF_NEED_JPEG) { + . return Common::Error(Common::kUnknownError, _s("This game requires JPEG support, which was not compiled in.")); } #endif