aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/gui.cpp6
-rw-r--r--engines/kyra/lol.cpp28
-rw-r--r--engines/kyra/resource.cpp45
-rw-r--r--engines/kyra/resource.h2
4 files changed, 42 insertions, 39 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index fd21e080fa..f03f028b98 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -476,12 +476,6 @@ 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 2c22ebc97c..73a6f569af 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -111,7 +111,6 @@ Common::Error LoLEngine::go() {
setupPrologueData(false);
}
- setupPrologueData(true);
preInit();
int processSelection = -1;
@@ -120,8 +119,8 @@ Common::Error LoLEngine::go() {
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
_screen->fadePalette(_screen->getPalette(0), 0x1E);
+ _eventList.clear();
int selection = mainMenu();
- _screen->clearPage(0);
switch (selection) {
case 0: // New game
@@ -129,10 +128,14 @@ Common::Error LoLEngine::go() {
break;
case 1: // Show intro
+ memset(_screen->getPalette(0), 0, 768);
+ _screen->fadePalette(_screen->getPalette(0), 0x54);
+
+ setupPrologueData(true);
_screen->hideMouse();
showIntro();
_screen->showMouse();
-
+ setupPrologueData(true);
break;
case 2: // "Lore of the Lands"
@@ -158,6 +161,8 @@ Common::Error LoLEngine::go() {
memset(_screen->getPalette(0), 0, 768);
_screen->fadePalette(_screen->getPalette(0), 0x54);
+ _screen->clearPage(0);
+
_sound->loadSoundFile("LOREINTR");
_sound->playTrack(6);
/*int character = */chooseCharacter();
@@ -167,8 +172,6 @@ Common::Error LoLEngine::go() {
//XXX
}
- setupPrologueData(false);
-
return Common::kNoError;
}
@@ -177,7 +180,9 @@ Common::Error LoLEngine::go() {
void LoLEngine::preInit() {
debugC(9, kDebugLevelMain, "LoLEngine::preInit()");
- _res->loadFileList("FILEDATA.FDT");
+ if (!_res->loadFileList("FILEDATA.FDT"))
+ error("Couldn't load file list: 'FILEDATA.FDT'");
+
_screen->loadFont(Screen::FID_9_FNT, "FONT9P.FNT");
_screen->loadFont(Screen::FID_6_FNT, "FONT6P.FNT");
@@ -310,8 +315,6 @@ uint8 *LoLEngine::getTableEntry(uint8 *buffer, uint16 id) {
void LoLEngine::setupPrologueData(bool load) {
debugC(9, kDebugLevelMain, "LoLEngine::setupPrologueData(%d)", load);
- _res->unloadAllPakFiles();
-
static const char * const fileListCD[] = {
"GENERAL.PAK", "INTROVOC.PAK", "STARTUP.PAK", "INTRO1.PAK",
"INTRO2.PAK", "INTRO3.PAK", "INTRO4.PAK", "INTRO5.PAK",
@@ -319,11 +322,11 @@ void LoLEngine::setupPrologueData(bool load) {
};
static const char * const fileListFloppyExtracted[] = {
- "general.pak", "intro.pak", "introvoc.pak", 0
+ "INTRO.PAK", "INTROVOC.PAK", 0
};
static const char * const fileListFloppy[] = {
- "general.pak", "intro.pak", "introvoc.cmp", 0
+ "INTRO.PAK", "INTROVOC.CMP", 0
};
const char * const *fileList = _flags.isTalkie ? fileListCD :
@@ -353,11 +356,6 @@ 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/resource.cpp b/engines/kyra/resource.cpp
index 4b41b6b4f8..85378659da 100644
--- a/engines/kyra/resource.cpp
+++ b/engines/kyra/resource.cpp
@@ -68,23 +68,13 @@ bool Resource::reset() {
if (_vm->gameFlags().isTalkie) {
// List of files in the talkie version, which can never be unload.
- static const char *list[] = {
+ static const char * const list[] = {
"ADL.PAK", "CHAPTER1.VRM", "COL.PAK", "FINALE.PAK", "INTRO1.PAK", "INTRO2.PAK",
"INTRO3.PAK", "INTRO4.PAK", "MISC.PAK", "SND.PAK", "STARTUP.PAK", "XMI.PAK",
- "CAVE.APK", "DRAGON1.APK", "DRAGON2.APK", "LAGOON.APK"
+ "CAVE.APK", "DRAGON1.APK", "DRAGON2.APK", "LAGOON.APK", 0
};
- for (uint i = 0; i < ARRAYSIZE(list); ++i) {
- Common::ArchiveMemberPtr file = _files.getMember(list[i]);
- if (!file)
- error("Couldn't find PAK file '%s'", list[i]);
-
- Common::Archive *archive = loadArchive(list[i], file);
- if (archive)
- _protectedFiles.add(list[i], archive, 0, false);
- else
- error("Couldn't load PAK file '%s'", list[i]);
- }
+ loadProtectedFiles(list);
} else {
Common::ArchiveMemberList files;
@@ -132,11 +122,14 @@ bool Resource::reset() {
} else if (_vm->game() == GI_LOL) {
if (_vm->gameFlags().useInstallerPackage)
_files.add("installer", loadInstallerArchive("WESTWOOD", "%d", 0), 2, false);
-
- // mouse pointer, fonts, etc. required for initializing
- loadPakFile("GENERAL.PAK");
- if (_vm->gameFlags().isTalkie)
- loadPakFile("STARTUP.PAK");
+
+ if (!_vm->gameFlags().isTalkie) {
+ static const char * const list[] = {
+ "GENERAL.PAK", "STARTUP.PAK", 0
+ };
+
+ loadProtectedFiles(list);
+ }
} else {
error("Unknown game id: %d", _vm->game());
return false;
@@ -221,6 +214,22 @@ bool Resource::loadFileList(const char * const *filelist, uint32 numFiles) {
return true;
}
+bool Resource::loadProtectedFiles(const char * const * list) {
+ for (uint i = 0; list[i]; ++i) {
+ Common::ArchiveMemberPtr file = _files.getMember(list[i]);
+ if (!file)
+ error("Couldn't find PAK file '%s'", list[i]);
+
+ Common::Archive *archive = loadArchive(list[i], file);
+ if (archive)
+ _protectedFiles.add(list[i], archive, 0, false);
+ else
+ error("Couldn't load PAK file '%s'", list[i]);
+ }
+
+ return true;
+}
+
void Resource::unloadPakFile(Common::String filename, bool remFromCache) {
filename.toUppercase();
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h
index 72846e273a..5ef26caa78 100644
--- a/engines/kyra/resource.h
+++ b/engines/kyra/resource.h
@@ -88,6 +88,8 @@ protected:
Common::Archive *loadArchive(const Common::String &name, Common::SharedPtr<Common::ArchiveMember> member);
Common::Archive *loadInstallerArchive(const Common::String &file, const Common::String &ext, const uint8 offset);
+ bool loadProtectedFiles(const char * const * list);
+
void initializeLoaders();
typedef Common::List<Common::SharedPtr<ResArchiveLoader> > LoaderList;