aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/resource.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2008-01-10 23:25:19 +0000
committerJohannes Schickel2008-01-10 23:25:19 +0000
commit2dd6db4ca5b65c4976f3e61b8009474591978dcb (patch)
treeccdf084c580ff5b80e41dd88a8f4ed6643b2e4e7 /engines/kyra/resource.cpp
parent89cedb5d1e87da3da1e65e9b7714926f8ea1fb5c (diff)
downloadscummvm-rg350-2dd6db4ca5b65c4976f3e61b8009474591978dcb.tar.gz
scummvm-rg350-2dd6db4ca5b65c4976f3e61b8009474591978dcb.tar.bz2
scummvm-rg350-2dd6db4ca5b65c4976f3e61b8009474591978dcb.zip
Commit slighty modified patch #1865509 "KYRA: kyradat support for hof".
svn-id: r30394
Diffstat (limited to 'engines/kyra/resource.cpp')
-rw-r--r--engines/kyra/resource.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp
index 45e3416616..57094d8e68 100644
--- a/engines/kyra/resource.cpp
+++ b/engines/kyra/resource.cpp
@@ -67,15 +67,16 @@ bool Resource::reset() {
if (!dir.exists() || !dir.isDirectory())
error("invalid game path '%s'", dir.getPath().c_str());
- if (_vm->game() == GI_KYRA1) {
- // we're loading KYRA.DAT here too (but just for Kyrandia 1)
+ if (_vm->game() != GI_KYRA3) {
if (!loadPakFile(StaticResource::staticDataFilename()) || !StaticResource::checkKyraDat()) {
Common::String errorMessage = "You're missing the '" + StaticResource::staticDataFilename() + "' file or it got corrupted, (re)get it from the ScummVM website";
GUI::MessageDialog errorMsg(errorMessage);
errorMsg.runModal();
error(errorMessage.c_str());
}
+ }
+ if (_vm->game() == GI_KYRA1) {
// We only need kyra.dat for the demo.
if (_vm->gameFlags().isDemo)
return true;
@@ -83,6 +84,16 @@ bool Resource::reset() {
// only VRM file we need in the *whole* game for kyra1
if (_vm->gameFlags().isTalkie)
loadPakFile("CHAPTER1.VRM");
+ } else if (_vm->game() == GI_KYRA2) {
+ // mouse pointer, fonts, etc. required for initializing
+ if (_vm->gameFlags().isDemo) {
+ loadPakFile("GENERAL.PAK");
+ } else {
+ loadPakFile("INTROGEN.PAK");
+ loadPakFile("OTHER.PAK");
+ }
+
+ return true;
} else if (_vm->game() == GI_KYRA3) {
// load the installation package file for kyra3
INSFile *insFile = new INSFile("WESTWOOD.001");
@@ -106,10 +117,6 @@ bool Resource::reset() {
Common::for_each(list, list + ARRAYSIZE(list), Common::bind1st(Common::mem_fun(&Resource::loadPakFile), this));
Common::for_each(_pakfiles.begin(), _pakfiles.end(), Common::bind2nd(Common::mem_fun(&ResourceFile::protect), true));
} else {
- // TODO: Kyra 2 InGame uses a special pak file list shipped with the game "FILEDATA.FDT", so we just have to load
- // the files needed for Kyra 2 intro here. What has to be done is, checking what files are required in the intro
- // and make a list similar to that for Kyra 1 and just load the files from the list and not all pak files we find.
-
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
Common::String filename = file->getName();
filename.toUppercase();
@@ -199,6 +206,20 @@ bool Resource::loadFileList(const Common::String &filedata) {
return true;
}
+bool Resource::loadFileList(const char * const *filelist, uint32 numFiles) {
+ if (!filelist)
+ return false;
+
+ while (numFiles--) {
+ if (!loadPakFile(filelist[numFiles])) {
+ error("couldn't load file '%s'", filelist[numFiles]);
+ return false;
+ }
+ }
+
+ return true;
+}
+
void Resource::unloadPakFile(const Common::String &filename) {
ResIterator pak = Common::find_if(_pakfiles.begin(), _pakfiles.end(), ResFilenameEqual(Common::hashit_lower(filename)));
if (pak != _pakfiles.end())