diff --git a/engines/access/access.cpp b/engines/access/access.cpp index c263ae88fa6..ce5d8640f00 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 &cells) { +void AccessEngine::loadCells(Common::Array &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 87de9ee4e60..a30c905dd79 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -213,7 +213,7 @@ public: void freeAnimationData(); - void loadCells(Common::Array &cells); + void loadCells(Common::Array &cells); /** * Clear the cell table diff --git a/engines/access/files.cpp b/engines/access/files.cpp index 23171dcfe77..017102b92a8 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 9ead04b2acb..afa42c82f02 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 70803b4f700..c42c3f11428 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 _vidTable; - Common::Array _sounds; + Common::Array _sounds; public: RoomInfo(const byte *data); }; diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp index 7ac0e4d5582..c6897282fa6 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 &sounds) { +void SoundManager::loadSounds(Common::Array &sounds) { // TODO } diff --git a/engines/access/sound.h b/engines/access/sound.h index a127051b291..dd94396fa9d 100644 --- a/engines/access/sound.h +++ b/engines/access/sound.h @@ -60,7 +60,7 @@ public: void playSound(int soundIndex); - void loadSounds(Common::Array &sounds); + void loadSounds(Common::Array &sounds); void midiPlay();