Fascination:

- Fix a potential bug in winDraw
- Add a hack (and a todo) to work around the missing texts and windows in Amiga, Atari and early PC floppy version.

svn-id: r48053
This commit is contained in:
Arnaud Boutonné 2010-02-13 21:59:45 +00:00
parent b9a11ddb0b
commit 5ba36c8216
2 changed files with 13 additions and 4 deletions

View File

@ -974,7 +974,7 @@ void Draw::winDraw(int16 fct) {
case DRAW_LOADSPRITE: // 5 - Uncompress and load a sprite case DRAW_LOADSPRITE: // 5 - Uncompress and load a sprite
// TODO: check the implementation, currently dirty cut and paste of DRAW_SPRITE code // TODO: check the implementation, currently dirty cut and paste of DRAW_SPRITE code
resource = _vm->_game->_resources->getResource((uint16) _spriteLeft, resource = _vm->_game->_resources->getResource((_spriteLeft & 0x3FFF),
&_spriteRight, &_spriteBottom); &_spriteRight, &_spriteBottom);
if (!resource) { if (!resource) {

View File

@ -277,6 +277,7 @@ bool Resources::loadTOTResourceTable() {
_totResStart = totProps.scriptEnd; _totResStart = totProps.scriptEnd;
_totSize = stream->size() - _totResStart; _totSize = stream->size() - _totResStart;
if (_totSize <= 0) if (_totSize <= 0)
return false; return false;
@ -571,8 +572,14 @@ TextItem *Resources::getTextItem(uint16 id) const {
if ((totItem.offset == 0xFFFF) || (totItem.size == 0)) if ((totItem.offset == 0xFFFF) || (totItem.size == 0))
return 0; return 0;
if ((totItem.offset + totItem.size) > (_totTextTable->size)) if ((totItem.offset + totItem.size) > (_totTextTable->size)) {
// HACK: Some Fascination versions (Amiga, Atari and first PC floppies) have a different header, which is a problem here.
// TODO: Handle that in a proper way
if ((_vm->getGameType() == kGameTypeFascination) & (_totTextTable->size < 0))
warning("totTextTable with negative size id:%d offset:%d in file %s : (size: %d)", id, totItem.offset, totItem.size, _totFile.c_str(), _totTextTable->size);
else
return 0; return 0;
}
return new TextItem(_totTextTable->data + totItem.offset, totItem.size); return new TextItem(_totTextTable->data + totItem.offset, totItem.size);
} }
@ -701,8 +708,10 @@ byte *Resources::getTOTData(TOTResourceItem &totItem) const {
int32 offset = _totResourceTable->dataOffset + totItem.offset - _totResStart; int32 offset = _totResourceTable->dataOffset + totItem.offset - _totResStart;
if ((offset < 0) || (((uint32) (offset + totItem.size)) > _totSize)) if ((offset < 0) || (((uint32) (offset + totItem.size)) > _totSize)) {
warning("Skipping data id:%d offset:%d size :%d in file %s : out of _totTextTable", totItem.index, totItem.offset, totItem.size, _totFile.c_str());
return 0; return 0;
}
return _totData + offset; return _totData + offset;
} }