diff options
author | Torbjörn Andersson | 2006-01-01 16:29:23 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2006-01-01 16:29:23 +0000 |
commit | 5c75f5a6e57d922893bb473fc86123abec970917 (patch) | |
tree | bd5731c0fd06da4a87b8cad74136003b2034d493 /sword2 | |
parent | 77ca6708ee308243c923b7a5227c56a34bee4261 (diff) | |
download | scummvm-rg350-5c75f5a6e57d922893bb473fc86123abec970917.tar.gz scummvm-rg350-5c75f5a6e57d922893bb473fc86123abec970917.tar.bz2 scummvm-rg350-5c75f5a6e57d922893bb473fc86123abec970917.zip |
Some cleanup/paranoia fixes to the previous missing voices/music fix. Treat
files marked as being on both CDs (I haven't seen any such file -- ever),
treat it as if it's on the hard disk.
Also, the "cd" field of the ResourceFile struct now holds 0, 1 or 2, not
the bit flags from the data file. (This last change is not in the 0.8
branch.)
svn-id: r19884
Diffstat (limited to 'sword2')
-rw-r--r-- | sword2/console.cpp | 21 | ||||
-rw-r--r-- | sword2/resman.cpp | 22 | ||||
-rw-r--r-- | sword2/resman.h | 14 |
3 files changed, 21 insertions, 36 deletions
diff --git a/sword2/console.cpp b/sword2/console.cpp index a8062fb4aa..bedf8d709f 100644 --- a/sword2/console.cpp +++ b/sword2/console.cpp @@ -284,24 +284,9 @@ bool Debugger::Cmd_Res(int argc, const char **argv) { ResourceFile *resFiles = _vm->_resman->getResFiles(); for (uint i = 0; i < numClusters; i++) { - DebugPrintf("%-20s ", resFiles[i].fileName); - if (!(resFiles[i].cd & LOCAL_PERM)) { - switch (resFiles[i].cd & 3) { - case BOTH: - DebugPrintf("CD 1 & 2\n"); - break; - case CD1: - DebugPrintf("CD 1\n"); - break; - case CD2: - DebugPrintf("CD 2\n"); - break; - default: - DebugPrintf("CD 3? Huh?!\n"); - break; - } - } else - DebugPrintf("HD\n"); + const char *locStr[3] = { "HDD", "CD1", "CD2" }; + + DebugPrintf("%-20s %d\n", resFiles[i].fileName, locStr[resFiles[i].cd]); } DebugPrintf("%d resources\n", _vm->_resman->getNumResFiles()); diff --git a/sword2/resman.cpp b/sword2/resman.cpp index cf454b3fec..f57029f4ab 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -43,6 +43,14 @@ namespace Sword2 { // resource.tab which is a table which tells us which cluster a resource // is located in and the number within the cluster +enum { + BOTH = 0x0, // Cluster is on both CDs + CD1 = 0x1, // Cluster is on CD1 only + CD2 = 0x2, // Cluster is on CD2 only + LOCAL_CACHE = 0x4, // Cluster is cached on HDD + LOCAL_PERM = 0x8 // Cluster is on HDD. +}; + struct CdInf { uint8 clusterName[20]; // Null terminated cluster name. uint8 cd; // Cd cluster is on and whether it is on the local drive or not. @@ -53,7 +61,7 @@ ResourceManager::ResourceManager(Sword2Engine *vm) { // Until proven differently, assume we're on CD 1. This is so the start // dialog will be able to play any music at all. - setCD(CD1); + setCD(1); // We read in the resource info which tells us the names of the // resource cluster files ultimately, although there might be groups @@ -158,11 +166,13 @@ ResourceManager::ResourceManager(Sword2Engine *vm) { // all here. if (cdInf[i].cd & LOCAL_PERM) - cdInf[i].cd = LOCAL_PERM; + cdInf[i].cd = 0; + else if (cdInf[i].cd & CD1) + cdInf[i].cd = 1; else if (cdInf[i].cd & CD2) - cdInf[i].cd = CD2; + cdInf[i].cd = 2; else - cdInf[i].cd = CD1; + cdInf[i].cd = 0; } file.close(); @@ -402,10 +412,10 @@ Common::File *ResourceManager::openCluFile(uint16 fileNum) { // playing a demo, then we're in trouble if the file // can't be found! - if ((_vm->_features & GF_DEMO) || (_resFiles[fileNum].cd & LOCAL_PERM)) + if ((_vm->_features & GF_DEMO) || _resFiles[fileNum].cd == 0) error("Could not find '%s'", _resFiles[fileNum].fileName); - askForCD(_resFiles[fileNum].cd & 3); + askForCD(_resFiles[fileNum].cd); } return file; } diff --git a/sword2/resman.h b/sword2/resman.h index 42ebda120d..94ffe5addf 100644 --- a/sword2/resman.h +++ b/sword2/resman.h @@ -32,14 +32,6 @@ namespace Sword2 { class Sword2Engine; -enum { - BOTH = 0x0, // Cluster is on both CDs - CD1 = 0x1, // Cluster is on CD1 only - CD2 = 0x2, // Cluster is on CD2 only - LOCAL_CACHE = 0x4, // Cluster is cached on HDD - LOCAL_PERM = 0x8 // Cluster is on HDD. -}; - struct Resource { byte *ptr; uint32 size; @@ -119,10 +111,8 @@ public: void askForCD(int cd); void setCD(int cd) { - if (cd == CD1) - _curCD = 1; - else if (cd == CD2) - _curCD = 2; + if (cd) + _curCD = cd; } int getCD() { |