diff options
author | Filippos Karapetis | 2017-02-10 02:51:52 +0200 |
---|---|---|
committer | Filippos Karapetis | 2017-02-10 04:33:36 +0200 |
commit | 01e072fbbc1baaf8aaa48aba0842bf8977510b93 (patch) | |
tree | 82d7da31a1661ecc929b336a80daeae8b05db1f4 | |
parent | 1db02c7bd8ffee2aa0a27264669d11f83d95b491 (diff) | |
download | scummvm-rg350-01e072fbbc1baaf8aaa48aba0842bf8977510b93.tar.gz scummvm-rg350-01e072fbbc1baaf8aaa48aba0842bf8977510b93.tar.bz2 scummvm-rg350-01e072fbbc1baaf8aaa48aba0842bf8977510b93.zip |
CRYO: Add handling for the cryo.dat aux data file
-rw-r--r-- | engines/cryo/eden.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index b8e191c50b..4ff18bf307 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -48,6 +48,8 @@ namespace Cryo { +#define CRYO_DAT_VER 1 // 1 byte + int16 _torchTick = 0; int16 _glowIndex = 0; int16 _torchCurIndex = 0; @@ -4733,11 +4735,23 @@ void EdenGame::loadpermfiles() { // Since PC version stores hotspots and rooms info in the executable, load them from premade resource file Common::File f; - if (f.open("led.dat")) { + if (f.open("cryo.dat")) { const int kNumIcons = 136; const int kNumRooms = 424; - if (f.size() != kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room)) - error("Mismatching aux data"); + const int dataSize = f.size() - 8 - 1; // CRYODATA + version + char headerId[9]; + + f.read(headerId, 8); + headerId[8] = '\0'; + if (strcmp(headerId, "CRYODATA")) + error("Invalid aux data file"); + + if (f.readByte() != CRYO_DAT_VER) + error("Incorrect aux data version"); + + if (dataSize != kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room)) + error("Mismatching data in aux data file"); + for (int i = 0; i < kNumIcons; i++) { _gameIcons[i].sx = f.readSint16LE(); _gameIcons[i].sy = f.readSint16LE(); |