diff options
author | Paul Gilbert | 2014-08-07 20:31:42 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-07 20:31:42 -0400 |
commit | 0183007d0b4f3b951ef2c704894655e894ce4a71 (patch) | |
tree | 883c94e6fae6888f1205812650a0508e6adc5f68 | |
parent | 010ba5b1262f58eabd6e8fbca710309cf7e2c003 (diff) | |
download | scummvm-rg350-0183007d0b4f3b951ef2c704894655e894ce4a71.tar.gz scummvm-rg350-0183007d0b4f3b951ef2c704894655e894ce4a71.tar.bz2 scummvm-rg350-0183007d0b4f3b951ef2c704894655e894ce4a71.zip |
ACCESS: Fixes for loading room data
-rw-r--r-- | engines/access/access.cpp | 2 | ||||
-rw-r--r-- | engines/access/access.h | 2 | ||||
-rw-r--r-- | engines/access/files.cpp | 2 | ||||
-rw-r--r-- | engines/access/room.cpp | 24 | ||||
-rw-r--r-- | engines/access/room.h | 25 | ||||
-rw-r--r-- | engines/access/sound.cpp | 2 | ||||
-rw-r--r-- | engines/access/sound.h | 2 |
7 files changed, 36 insertions, 23 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index c263ae88fa..ce5d8640f0 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -198,7 +198,7 @@ int AccessEngine::getRandomNumber(int maxNumber) { return _randomSource.getRandomNumber(maxNumber); } -void AccessEngine::loadCells(Common::Array<CellIdent> &cells) { +void AccessEngine::loadCells(Common::Array<RoomInfo::CellIdent> &cells) { for (uint i = 0; i < cells.size(); ++i) { _objectsTable[cells[i]._cell] = _files->loadFile( cells[i]._fileNum, cells[i]._subfile); diff --git a/engines/access/access.h b/engines/access/access.h index 87de9ee4e6..a30c905dd7 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -213,7 +213,7 @@ public: void freeAnimationData(); - void loadCells(Common::Array<CellIdent> &cells); + void loadCells(Common::Array<RoomInfo::CellIdent> &cells); /** * Clear the cell table diff --git a/engines/access/files.cpp b/engines/access/files.cpp index 23171dcfe7..017102b92a 100644 --- a/engines/access/files.cpp +++ b/engines/access/files.cpp @@ -141,7 +141,7 @@ void FileManager::setAppended(int fileNum) { void FileManager::gotoAppended(int subfile) { uint32 offset = _fileIndex[subfile]; - uint32 size = (subfile == _fileIndex.size() - 1) ? _file.size() - offset : + uint32 size = (subfile == (int)_fileIndex.size() - 1) ? _file.size() - offset : _fileIndex[subfile + 1] - offset; _file.seek(offset); diff --git a/engines/access/room.cpp b/engines/access/room.cpp index 9ead04b2ac..afa42c82f0 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -186,10 +186,13 @@ void Room::loadRoomData(const byte *roomData) { _vm->_scaleI = roomInfo._scaleI; _vm->_screen->_scrollThreshold = roomInfo._scrollThreshold; - _vm->_screen->_startColor = roomInfo._startColor; - _vm->_screen->_numColors = roomInfo._numColors; - _vm->_screen->loadPalette(roomInfo._paletteFile._fileNum, - roomInfo._paletteFile._subfile); + // Handle loading scene palette data + if (roomInfo._paletteFile._fileNum != -1) { + _vm->_screen->_startColor = roomInfo._startColor; + _vm->_screen->_numColors = roomInfo._numColors; + _vm->_screen->loadPalette(roomInfo._paletteFile._fileNum, + roomInfo._paletteFile._subfile); + } // Load extra cells _vm->_extraCells.clear(); @@ -270,7 +273,7 @@ void Room::buildScreen() { RoomInfo::RoomInfo(const byte *data) { Common::MemoryReadStream stream(data, 999); - _roomFlag = stream.readByte() != 0; + _roomFlag = stream.readByte(); _estIndex = (int16)stream.readUint16LE(); _musicFile._fileNum = (int16)stream.readUint16LE(); _musicFile._subfile = stream.readUint16LE(); @@ -297,8 +300,12 @@ RoomInfo::RoomInfo(const byte *data) { _scrollThreshold = stream.readByte(); _paletteFile._fileNum = (int16)stream.readUint16LE(); _paletteFile._subfile = stream.readUint16LE(); - _startColor = stream.readUint16LE(); - _numColors = stream.readUint16LE(); + if (_paletteFile._fileNum == -1) { + _startColor = _numColors = 0; + } else { + _startColor = stream.readUint16LE(); + _numColors = stream.readUint16LE(); + } for (int16 v = (int16)stream.readUint16LE(); v != -1; v = (int16)stream.readUint16LE()) { @@ -309,9 +316,10 @@ RoomInfo::RoomInfo(const byte *data) { for (int16 fileNum = (int16)stream.readUint16LE(); fileNum != -1; fileNum = (int16)stream.readUint16LE()) { - FileIdent fi; + SoundIdent fi; fi._fileNum = fileNum; fi._subfile = stream.readUint16LE(); + fi._priority = stream.readUint16LE(); _sounds.push_back(fi); } diff --git a/engines/access/room.h b/engines/access/room.h index 70803b4f70..c42c3f1142 100644 --- a/engines/access/room.h +++ b/engines/access/room.h @@ -63,18 +63,23 @@ public: void clearRoom(); }; -struct FileIdent { - int _fileNum; - int _subfile; -}; - -struct CellIdent : FileIdent { - byte _cell; -}; class RoomInfo { public: - bool _roomFlag; + struct FileIdent { + int _fileNum; + int _subfile; + }; + + struct CellIdent : FileIdent { + byte _cell; + }; + + struct SoundIdent : FileIdent { + int _priority; + }; +public: + int _roomFlag; int _estIndex; FileIdent _musicFile; int _scaleH1; @@ -90,7 +95,7 @@ public: int _startColor; int _numColors; Common::Array<uint32> _vidTable; - Common::Array<FileIdent> _sounds; + Common::Array<SoundIdent> _sounds; public: RoomInfo(const byte *data); }; diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp index 7ac0e4d558..c6897282fa 100644 --- a/engines/access/sound.cpp +++ b/engines/access/sound.cpp @@ -68,7 +68,7 @@ void SoundManager::playSound(byte *data, uint32 size) { */ } -void SoundManager::loadSounds(Common::Array<FileIdent> &sounds) { +void SoundManager::loadSounds(Common::Array<RoomInfo::SoundIdent> &sounds) { // TODO } diff --git a/engines/access/sound.h b/engines/access/sound.h index a127051b29..dd94396fa9 100644 --- a/engines/access/sound.h +++ b/engines/access/sound.h @@ -60,7 +60,7 @@ public: void playSound(int soundIndex); - void loadSounds(Common::Array<FileIdent> &sounds); + void loadSounds(Common::Array<RoomInfo::SoundIdent> &sounds); void midiPlay(); |