From d81782977e2f17f9906db7548023f748be09a6a6 Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Sun, 28 Dec 2008 22:09:31 +0000 Subject: LOL: - fixed some bugs in the main menu code (premature pak file unloading etc.) and added floppy support svn-id: r35595 --- engines/kyra/gui.cpp | 6 ++++++ engines/kyra/lol.cpp | 52 ++++++++++++++++++++++++++++++++++------------ engines/kyra/staticres.cpp | 5 +++-- 3 files changed, 48 insertions(+), 15 deletions(-) (limited to 'engines/kyra') diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index f03f028b98..fd21e080fa 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -476,6 +476,12 @@ int MainMenu::handle(int dim) { Common::Rect menuRect(x + 16, y + 4, x + width - 16, y + 4 + fh * _static.menuTable[3]); + Common::Event evt; + while(_system->getEventManager()->pollEvent(evt)) { + if (evt.type != Common::EVENT_LBUTTONUP && evt.type != Common::EVENT_LBUTTONDOWN) + break; + } + while (!_vm->shouldQuit()) { updateAnimation(); bool mousePressed = getInput(); diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 050537617e..2c22ebc97c 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -111,6 +111,7 @@ Common::Error LoLEngine::go() { setupPrologueData(false); } + setupPrologueData(true); preInit(); int processSelection = -1; @@ -120,6 +121,7 @@ Common::Error LoLEngine::go() { _screen->fadePalette(_screen->getPalette(0), 0x1E); int selection = mainMenu(); + _screen->clearPage(0); switch (selection) { case 0: // New game @@ -127,11 +129,10 @@ Common::Error LoLEngine::go() { break; case 1: // Show intro - setupPrologueData(true); _screen->hideMouse(); showIntro(); _screen->showMouse(); - setupPrologueData(false); + break; case 2: // "Lore of the Lands" @@ -157,17 +158,17 @@ Common::Error LoLEngine::go() { memset(_screen->getPalette(0), 0, 768); _screen->fadePalette(_screen->getPalette(0), 0x54); - setupPrologueData(true); _sound->loadSoundFile("LOREINTR"); _sound->playTrack(6); /*int character = */chooseCharacter(); _sound->playTrack(1); _screen->fadeToBlack(); - setupPrologueData(false); } else if (processSelection == 3) { //XXX } + setupPrologueData(false); + return Common::kNoError; } @@ -218,7 +219,6 @@ void LoLEngine::initializeCursors() { _screen->setMouseCursor(0, 0, _shapes[0]); } - int LoLEngine::mainMenu() { debugC(9, kDebugLevelMain, "LoLEngine::mainMenu()"); @@ -234,25 +234,32 @@ int LoLEngine::mainMenu() { if (hasSave) ++data.menuTable[3]; - static const uint16 mainMenuStrings[2][5] = { + static const uint16 mainMenuStrings[4][5] = { { 0x4248, 0x4249, 0x42DD, 0x424A, 0x0000 }, - { 0x4248, 0x4249, 0x42DD, 0x4001, 0x424A } + { 0x4248, 0x4249, 0x42DD, 0x4001, 0x424A }, + { 0x4248, 0x4249, 0x424A, 0x0000, 0x0000 }, + { 0x4248, 0x4249, 0x4001, 0x424A, 0x0000 } }; + int tableOffs = _flags.isTalkie ? 0 : 2; + for (int i = 0; i < 5; ++i) { if (hasSave) - data.strings[i] = getLangString(mainMenuStrings[1][i]); + data.strings[i] = getLangString(mainMenuStrings[1 + tableOffs][i]); else - data.strings[i] = getLangString(mainMenuStrings[0][i]); + data.strings[i] = getLangString(mainMenuStrings[tableOffs][i]); } MainMenu *menu = new MainMenu(this); assert(menu); menu->init(data, MainMenu::Animation()); - int selection = menu->handle(hasSave ? 12 : 6); + int selection = menu->handle(_flags.isTalkie ? (hasSave ? 12 : 6) :(hasSave ? 6 : 13)); delete menu; + if (!_flags.isTalkie && selection >= 2) + selection++; + if (!hasSave && selection == 3) selection = 4; @@ -303,14 +310,28 @@ uint8 *LoLEngine::getTableEntry(uint8 *buffer, uint16 id) { void LoLEngine::setupPrologueData(bool load) { debugC(9, kDebugLevelMain, "LoLEngine::setupPrologueData(%d)", load); - static const char * const fileList[] = { + _res->unloadAllPakFiles(); + + static const char * const fileListCD[] = { "GENERAL.PAK", "INTROVOC.PAK", "STARTUP.PAK", "INTRO1.PAK", "INTRO2.PAK", "INTRO3.PAK", "INTRO4.PAK", "INTRO5.PAK", - "INTRO6.PAK", "INTRO7.PAK", "INTRO8.PAK", "INTRO9.PAK" + "INTRO6.PAK", "INTRO7.PAK", "INTRO8.PAK", "INTRO9.PAK", 0 }; + static const char * const fileListFloppyExtracted[] = { + "general.pak", "intro.pak", "introvoc.pak", 0 + }; + + static const char * const fileListFloppy[] = { + "general.pak", "intro.pak", "introvoc.cmp", 0 + }; + + const char * const *fileList = _flags.isTalkie ? fileListCD : + (_flags.useInstallerPackage ? fileListFloppy : fileListFloppyExtracted); + + char filename[32]; - for (uint i = 0; i < ARRAYSIZE(fileList); ++i) { + for (uint i = 0; fileList[i]; ++i) { filename[0] = '\0'; if (_flags.isTalkie) { @@ -332,6 +353,11 @@ void LoLEngine::setupPrologueData(bool load) { _screen->clearPage(3); if (load) { + if (_flags.isTalkie) { + _res->loadPakFile("startup.pak"); + _res->loadPakFile("general.pak"); + } + _chargenWSA = new WSAMovie_v2(this, _screen); assert(_chargenWSA); diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index ca03451201..674d3e172d 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -2363,13 +2363,14 @@ const ScreenDim Screen_LoL::_screenDimTable[] = { { 0x0B, 0x7B, 0x1C, 0x12, 0xFE, 0xFC, 0x00, 0x00 }, { 0x0B, 0x7B, 0x1C, 0x2D, 0xFE, 0xFC, 0x00, 0x00 }, { 0x55, 0x7B, 0xE9, 0x37, 0xFE, 0xFC, 0x00, 0x00 }, - { 0x0B, 0x8C, 0x10, 0x2B, 0x3D, 0x01, 0x00, 0x00 }, // Main menu box (3 entries) + { 0x0B, 0x8C, 0x10, 0x2B, 0x3D, 0x01, 0x00, 0x00 }, // Main menu box (4 entries) { 0x04, 0x59, 0x20, 0x3C, 0x00, 0x00, 0x00, 0x00 }, { 0x05, 0x6E, 0x1E, 0x0C, 0xFE, 0x01, 0x00, 0x00 }, { 0x07, 0x19, 0x1A, 0x97, 0x00, 0x00, 0x00, 0x00 }, { 0x03, 0x1E, 0x22, 0x8C, 0x00, 0x00, 0x00, 0x00 }, { 0x02, 0x48, 0x24, 0x34, 0x00, 0x00, 0x00, 0x00 }, - { 0x0B, 0x8C, 0x10, 0x33, 0x3D, 0x01, 0x00, 0x00 } // Main menu box (4 entries) + { 0x0B, 0x8C, 0x10, 0x33, 0x3D, 0x01, 0x00, 0x00 }, // Main menu box (5 entries) + { 0x0B, 0x8C, 0x10, 0x23, 0x3D, 0x01, 0x00, 0x00 } // Main menu box (3 entries) }; const int Screen_LoL::_screenDimTableCount = ARRAYSIZE(Screen_LoL::_screenDimTable); -- cgit v1.2.3