[Scummvm-cvs-logs] SF.net SVN: scummvm: [23887] scummvm/trunk/engines/kyra
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sat Sep 16 16:36:59 CEST 2006
Revision: 23887
http://svn.sourceforge.net/scummvm/?rev=23887&view=rev
Author: lordhoto
Date: 2006-09-16 07:36:53 -0700 (Sat, 16 Sep 2006)
Log Message:
-----------
Simplifies resource handling for the CD version of Kyrandia.
(also less file loading at startup, but more on room change)
Modified Paths:
--------------
scummvm/trunk/engines/kyra/kyra.h
scummvm/trunk/engines/kyra/resource.cpp
scummvm/trunk/engines/kyra/scene.cpp
Modified: scummvm/trunk/engines/kyra/kyra.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra.h 2006-09-16 13:40:28 UTC (rev 23886)
+++ scummvm/trunk/engines/kyra/kyra.h 2006-09-16 14:36:53 UTC (rev 23887)
@@ -509,6 +509,8 @@
int queryGameFlag(int flag);
int resetGameFlag(int flag);
+ void setupSceneResource(int sceneId);
+
void enterNewScene(int sceneId, int facing, int unk1, int unk2, int brandonAlive);
void transcendScenes(int roomIndex, int roomName);
void setSceneFile(int roomIndex, int roomName);
Modified: scummvm/trunk/engines/kyra/resource.cpp
===================================================================
--- scummvm/trunk/engines/kyra/resource.cpp 2006-09-16 13:40:28 UTC (rev 23886)
+++ scummvm/trunk/engines/kyra/resource.cpp 2006-09-16 14:36:53 UTC (rev 23887)
@@ -69,12 +69,24 @@
error("invalid game path '%s'", dir.path().c_str());
}
- for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
- Common::String filename = file->name();
- filename.toUppercase();
- if (filename.hasSuffix("PAK") || filename.hasSuffix("APK")) {
- if (!loadPakFile(file->name())) {
- error("couldn't open pakfile '%s'", file->name().c_str());
+ if (_engine->game() == GI_KYRA1 && (_engine->features() & GF_TALKIE)) {
+ static const char *list[] = {
+ "adl.pak", "col.pak", "finale.pak", "intro1.pak", "intro2.pak", "intro3.pak", "intro4.pak",
+ "misc.pak", "snd.pak", "startup.pak", "xmi.pak", 0
+ };
+
+ for (int i = 0; list[i]; ++i) {
+ if (!loadPakFile(list[i]))
+ error("couldn't open pakfile '%s'", list[i]);
+ }
+ } else {
+ for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
+ Common::String filename = file->name();
+ filename.toUppercase();
+ if (filename.hasSuffix("PAK") || filename.hasSuffix("APK")) {
+ if (!loadPakFile(file->name())) {
+ error("couldn't open pakfile '%s'", file->name().c_str());
+ }
}
}
}
Modified: scummvm/trunk/engines/kyra/scene.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene.cpp 2006-09-16 13:40:28 UTC (rev 23886)
+++ scummvm/trunk/engines/kyra/scene.cpp 2006-09-16 14:36:53 UTC (rev 23887)
@@ -143,15 +143,7 @@
Room *currentRoom = &_roomTable[sceneId];
- if (_currentRoom != 0xFFFF && (_features & GF_TALKIE)) {
- char file[32];
- assert(_currentRoom < _roomTableSize);
- int tableId = _roomTable[_currentRoom].nameIndex;
- assert(tableId < _roomFilenameTableSize);
- strcpy(file, _roomFilenameTable[tableId]);
- strcat(file, ".VRM");
- _res->unloadPakFile(file);
- }
+ setupSceneResource(sceneId);
_currentRoom = sceneId;
@@ -164,12 +156,6 @@
_scriptInterpreter->unloadScript(_scriptClickData);
loadSceneMSC();
- if ((_features & GF_TALKIE)) {
- strcpy(fileNameBuffer, _roomFilenameTable[tableId]);
- strcat(fileNameBuffer, ".VRM");
- _res->loadPakFile(fileNameBuffer);
- }
-
_walkBlockNorth = currentRoom->northExit;
_walkBlockEast = currentRoom->eastExit;
_walkBlockSouth = currentRoom->southExit;
@@ -1569,4 +1555,44 @@
return retValue;
}
+void KyraEngine::setupSceneResource(int sceneId) {
+ debugC(9, kDebugLevelMain, "KyraEngine::setupSceneResource(%d)", sceneId);
+ if (_features & GF_FLOPPY)
+ return;
+
+ if (_currentRoom != 0xFFFF) {
+ assert(_currentRoom < _roomTableSize);
+ int tableId = _roomTable[_currentRoom].nameIndex;
+ assert(tableId < _roomFilenameTableSize);
+
+ // unload our old room
+ char file[64];
+ strcpy(file, _roomFilenameTable[tableId]);
+ strcat(file, ".VRM");
+ _res->unloadPakFile(file);
+ strcpy(file, _roomFilenameTable[tableId]);
+ strcat(file, ".PAK");
+ _res->unloadPakFile(file);
+ strcpy(file, _roomFilenameTable[tableId]);
+ strcat(file, ".APK");
+ _res->unloadPakFile(file);
+ }
+
+ assert(sceneId < _roomTableSize);
+ int tableId = _roomTable[sceneId].nameIndex;
+ assert(tableId < _roomFilenameTableSize);
+
+ // load our new room
+ char file[64];
+ strcpy(file, _roomFilenameTable[tableId]);
+ strcat(file, ".VRM");
+ _res->loadPakFile(file);
+ strcpy(file, _roomFilenameTable[tableId]);
+ strcat(file, ".PAK");
+ _res->loadPakFile(file);
+ strcpy(file, _roomFilenameTable[tableId]);
+ strcat(file, ".APK");
+ _res->loadPakFile(file);
+}
+
} // end of namespace Kyra
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list