From ba54955bffec15ed95aa1ca1ec955aecaa315478 Mon Sep 17 00:00:00 2001 From: Walter van Niftrik Date: Mon, 29 Feb 2016 16:50:24 +0100 Subject: ADL: Add loading from launcher --- engines/adl/hires1.cpp | 60 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 24 deletions(-) (limited to 'engines/adl/hires1.cpp') diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp index 45a011ad63..ba6f19a8e4 100644 --- a/engines/adl/hires1.cpp +++ b/engines/adl/hires1.cpp @@ -136,6 +136,8 @@ void HiRes1Engine::runIntro() { file.seek(IDI_HR1_OFS_GAME_OR_HELP); str = readString(file); + bool instructions = false; + while (1) { _display->printString(str); Common::String s = _display->inputString(); @@ -146,28 +148,47 @@ void HiRes1Engine::runIntro() { if (s.empty()) continue; - if ((byte)s[0] == ('I' | 0x80)) + if (s[0] == APPLECHAR('I')) { + instructions = true; break; - else if ((byte)s[0] == ('G' | 0x80)) - return; + } else if (s[0] == APPLECHAR('G')) { + break; + } }; - _display->setMode(Display::kModeText); - file.seek(IDI_HR1_OFS_INTRO_TEXT); + if (instructions) { + _display->setMode(Display::kModeText); + file.seek(IDI_HR1_OFS_INTRO_TEXT); - const uint pages[] = { 6, 6, 4, 5, 8, 7, 0 }; + const uint pages[] = { 6, 6, 4, 5, 8, 7, 0 }; - uint page = 0; - while (pages[page] != 0) { - _display->home(); - printStrings(file, pages[page++]); - _display->inputString(); + uint page = 0; + while (pages[page] != 0) { + _display->home(); + printStrings(file, pages[page++]); + _display->inputString(); - if (g_engine->shouldQuit()) - return; + if (g_engine->shouldQuit()) + return; - file.seek(9, SEEK_CUR); + file.seek(9, SEEK_CUR); + } } + + _display->printASCIIString("\r"); + + file.close(); + + _display->setMode(Display::kModeMixed); + + if (!file.open("ADVENTURE")) + error("Failed to open file"); + + // Title screen shown during loading + file.seek(0x1800); + _display->loadFrameBuffer(file); + _display->decodeFrameBuffer(); + _display->delay(2000); } void HiRes1Engine::drawPic(Common::ReadStream &stream, Common::Point pos) { @@ -278,8 +299,7 @@ void HiRes1Engine::restartGame() { } void HiRes1Engine::runGame() { - runIntro(); - _display->printASCIIString("\r"); + _display->setMode(Display::kModeMixed); Common::File f; @@ -291,8 +311,6 @@ void HiRes1Engine::runGame() { f.close(); - initState(); - if (!f.open("ADVENTURE")) error("Failed to open file"); @@ -345,12 +363,6 @@ void HiRes1Engine::runGame() { _lineArt.push_back(lineArt); } - // Title screen shown during loading - f.seek(0x1800); - _display->loadFrameBuffer(f); - _display->decodeFrameBuffer(); - _display->delay(2000); - f.seek(0x3800); _parser->loadVerbs(f); -- cgit v1.2.3