ACCESS: Fixes for loading room data

This commit is contained in:
Paul Gilbert 2014-08-07 20:31:42 -04:00
parent 010ba5b126
commit 0183007d0b
7 changed files with 36 additions and 23 deletions

View File

@ -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);

View File

@ -213,7 +213,7 @@ public:
void freeAnimationData();
void loadCells(Common::Array<CellIdent> &cells);
void loadCells(Common::Array<RoomInfo::CellIdent> &cells);
/**
* Clear the cell table

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
};

View File

@ -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
}

View File

@ -60,7 +60,7 @@ public:
void playSound(int soundIndex);
void loadSounds(Common::Array<FileIdent> &sounds);
void loadSounds(Common::Array<RoomInfo::SoundIdent> &sounds);
void midiPlay();