diff options
author | Robert Göffringmann | 2003-12-20 16:30:58 +0000 |
---|---|---|
committer | Robert Göffringmann | 2003-12-20 16:30:58 +0000 |
commit | 2c19e18fc85becb52fceab42c7bddf19a0913459 (patch) | |
tree | ba93322f116326734fb3dd16c9174cbbc5f601f3 /sword1 | |
parent | f533de72e48fa909240ecf3c0fffa5bfd895753b (diff) | |
download | scummvm-rg350-2c19e18fc85becb52fceab42c7bddf19a0913459.tar.gz scummvm-rg350-2c19e18fc85becb52fceab42c7bddf19a0913459.tar.bz2 scummvm-rg350-2c19e18fc85becb52fceab42c7bddf19a0913459.zip |
I hope this fixes the control panel for other BS1 versions.
svn-id: r11785
Diffstat (limited to 'sword1')
-rw-r--r-- | sword1/resman.cpp | 42 | ||||
-rw-r--r-- | sword1/resman.h | 5 |
2 files changed, 45 insertions, 2 deletions
diff --git a/sword1/resman.cpp b/sword1/resman.cpp index 61b5a95581..b3a39d9166 100644 --- a/sword1/resman.cpp +++ b/sword1/resman.cpp @@ -92,6 +92,10 @@ void ResMan::loadCluDescript(const char *fileName) { } else _prj.clu[clusCnt] = NULL; free(cluIndex); + + if (_prj.clu[3]->grp[5]->noRes == 29) + for (uint8 cnt = 0; cnt < 29; cnt++) + _srIdList[cnt] = 0x04050000 | cnt; } void ResMan::freeCluDescript(void) { @@ -236,6 +240,8 @@ File *ResMan::openClusterFile(uint32 id) { BsMemHandle *ResMan::resHandle(uint32 id) { uint8 cluster = (uint8)((id >> 24) - 1); uint8 group = (uint8)(id >> 16); + if ((id >> 16) == 0x0405) + id = _srIdList[id & 0xFFFF]; return &(_prj.clu[cluster]->grp[group]->resHandle[id & 0xFFFF]); } @@ -243,6 +249,8 @@ BsMemHandle *ResMan::resHandle(uint32 id) { uint32 ResMan::resLength(uint32 id) { uint8 cluster = (uint8)((id >> 24) - 1); uint8 group = (uint8)(id >> 16); + if ((id >> 16) == 0x0405) + id = _srIdList[id & 0xFFFF]; return _prj.clu[cluster]->grp[group]->length[id & 0xFFFF]; } @@ -250,6 +258,8 @@ uint32 ResMan::resLength(uint32 id) { uint32 ResMan::resOffset(uint32 id) { uint8 cluster = (uint8)((id >> 24) - 1); uint8 group = (uint8)(id >> 16); + if ((id >> 16) == 0x0405) + id = _srIdList[id & 0xFFFF]; return _prj.clu[cluster]->grp[group]->offset[id & 0xFFFF]; } @@ -313,3 +323,35 @@ void ResMan::openScriptResourceBigEndian(uint32 id) { data++; } } + +uint32 ResMan::_srIdList[29] = { // the file numbers differ for the control panel file IDs, so we need this array + 0, + 0x04050000, + 0, + 0x04050001, + 0x04050002, + 0x04050003, + 0x04050004, + 0x04050005, + 0x04050006, + 0x04050007, + 0x04050000, + 0x04050009, + 0x0405000A, + 0x0405000B, + 0x0405000C, + 0x0405000D, + 0x0405000E, + 0x0405000F, + 0x04050010, + 0x04050011, + 0x04050012, + 0x04050013, + 0x04050014, + 0x04050015, + 0x04050016, + 0x04050017, + 0x04050018, + 0x04050019, + 0, +}; diff --git a/sword1/resman.h b/sword1/resman.h index 23367c70b2..830f4be672 100644 --- a/sword1/resman.h +++ b/sword1/resman.h @@ -61,9 +61,9 @@ public: Header *lockScript(uint32 scrID); void unlockScript(uint32 scrID); FrameHeader *fetchFrame(void *resourceData, uint32 frameNo); - uint32 resLength(uint32 id); // this should be private. it's used in SwordSound for endian conversion, though - // make it private again when the mixer supports little endian data. private: + uint32 filesInGroup(uint32 id); + uint32 resLength(uint32 id); BsMemHandle *resHandle(uint32 id); uint32 resOffset(uint32 id); void openCptResourceBigEndian(uint32 id); @@ -76,6 +76,7 @@ private: BsPrj _prj; MemMan *_memMan; static const uint32 _scriptList[TOTAL_SECTIONS]; //a table of resource tags + static uint32 _srIdList[29]; }; #endif //RESMAN_H |