From 550a82e62ff04fe589a6d7d4adefa26176fe90ec Mon Sep 17 00:00:00 2001 From: neuromancer Date: Sun, 2 Oct 2022 20:18:23 +0200 Subject: [PATCH] FREESCAPE: implemented title display for some driller releases --- engines/freescape/freescape.cpp | 22 ++++++++++++++++---- engines/freescape/freescape.h | 2 ++ engines/freescape/games/driller.cpp | 31 +++++++++++++++++++++++++---- engines/freescape/neo.cpp | 3 ++- 4 files changed, 49 insertions(+), 9 deletions(-) diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp index 80100c7dfbc..3bcd6199b2b 100644 --- a/engines/freescape/freescape.cpp +++ b/engines/freescape/freescape.cpp @@ -76,6 +76,7 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd) _border = nullptr; _title = nullptr; + _titleTexture = nullptr; _borderTexture = nullptr; _uiTexture = nullptr; _fontLoaded = false; @@ -105,6 +106,17 @@ void FreescapeEngine::drawBorder() { _gfx->setViewport(_viewArea); } +void FreescapeEngine::drawTitle() { + if (!_title) + return; + + _gfx->setViewport(_fullscreenViewArea); + if (!_titleTexture) + _titleTexture = _gfx->createTexture(_title); + _gfx->drawTexturedRect2D(_fullscreenViewArea, _fullscreenViewArea, _titleTexture); + _gfx->setViewport(_viewArea); +} + void FreescapeEngine::loadAssets() { Common::SeekableReadStream *file = nullptr; Common::String path = ConfMan.get("path"); @@ -286,14 +298,16 @@ Common::Error FreescapeEngine::run() { } int saveSlot = ConfMan.getInt("save_slot"); - if (_border) { + if (_title) { if (saveSlot == -1) { - drawBorder(); + drawTitle(); _gfx->flipBuffer(); g_system->updateScreen(); - if (isDriller()) - g_system->delayMillis(1000); + g_system->delayMillis(3000); } + } + + if (_border) { _borderTexture = nullptr; _border->fillRect(_viewArea, 0xA0A0A0FF); diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h index 3ffe52c26c3..8153d79c6f4 100644 --- a/engines/freescape/freescape.h +++ b/engines/freescape/freescape.h @@ -98,10 +98,12 @@ public: void convertBorder(); void drawBorder(); + void drawTitle(); virtual void drawUI(); Graphics::Surface *_border; Graphics::Surface *_title; Texture *_borderTexture; + Texture *_titleTexture; Texture *_uiTexture; // Parsing assets diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp index 9e5d470ed27..ff44e4876f4 100644 --- a/engines/freescape/games/driller.cpp +++ b/engines/freescape/games/driller.cpp @@ -196,21 +196,44 @@ void DrillerEngine::loadAssetsFullGame() { Common::File exe; if (isAmiga()) { - file = gameDir.createReadStreamForMember("driller"); - if (file == nullptr) - error("Failed to open 'driller' executable for Amiga"); - if (_variant == "Retail") { + file = gameDir.createReadStreamForMember("driller"); + + if (file == nullptr) + error("Failed to open 'driller' executable for Amiga"); + + _border = loadAndConvertNeoImage(file, 0x137f4); + _title = loadAndConvertNeoImage(file, 0x1b572); + loadMessagesFixedSize(file, 0xc66e, 14, 20); loadGlobalObjects(file, 0xbd62); load8bitBinary(file, 0x29c16, 16); loadAmigaPalette(file, 0x297d4); loadAmigaSounds(file, 0x30e80, 25); } else if (_variant == "Kixx") { + file = gameDir.createReadStreamForMember("lift.neo"); + if (file == nullptr) + error("Failed to open 'lift.neo' file"); + + _title = loadAndConvertNeoImage(file, 0); + + file = gameDir.createReadStreamForMember("console.neo"); + if (file == nullptr) + error("Failed to open 'console.neo' file"); + + _border = loadAndConvertNeoImage(file, 0); + + file = gameDir.createReadStreamForMember("driller"); + if (file == nullptr) + error("Failed to open 'driller' executable for Amiga"); + load8bitBinary(file, 0x21a3e, 16); loadAmigaPalette(file, 0x215fc); file = gameDir.createReadStreamForMember("soundfx"); + if (file == nullptr) + error("Failed to open 'soundfx' executable for Amiga"); + loadAmigaSounds(file, 0, 25); } } else if (_renderMode == "ega") { diff --git a/engines/freescape/neo.cpp b/engines/freescape/neo.cpp index 7dc97a93154..bb3eba96c99 100644 --- a/engines/freescape/neo.cpp +++ b/engines/freescape/neo.cpp @@ -52,6 +52,7 @@ void NeoDecoder::destroy() { bool NeoDecoder::loadStream(Common::SeekableReadStream &stream) { destroy(); + int start = stream.pos(); if (stream.readUint16LE() != 0x00) return false; @@ -69,7 +70,7 @@ bool NeoDecoder::loadStream(Common::SeekableReadStream &stream) { _palette[i * 3 + 2] = floor((v2 & 0x07) * 255.0 / 7.0); } - stream.seek(128); + stream.seek(start + 128); int width = 320; int height = 200;