diff options
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/draw.h | 16 | ||||
-rw-r--r-- | engines/gob/draw_v2.cpp | 39 | ||||
-rw-r--r-- | engines/gob/game_v2.cpp | 2 | ||||
-rw-r--r-- | engines/gob/inter_v1.cpp | 9 |
4 files changed, 53 insertions, 13 deletions
diff --git a/engines/gob/draw.h b/engines/gob/draw.h index e37ecda334..8108a18d12 100644 --- a/engines/gob/draw.h +++ b/engines/gob/draw.h @@ -32,13 +32,15 @@ namespace Gob { #define SPRITES_COUNT 50 -#define RENDERFLAG_NOINVALIDATE 0x001 -#define RENDERFLAG_CAPTUREPUSH 0x002 -#define RENDERFLAG_COLLISIONS 0x004 -#define RENDERFLAG_CAPTUREPOP 0x008 -#define RENDERFLAG_USEDELTAS 0x010 -#define RENDERFLAG_NOBLITINVALIDATED 0x200 -#define RENDERFLAG_SKIPOPTIONALTEXT 0x400 +#define RENDERFLAG_NOINVALIDATE 0x0001 +#define RENDERFLAG_CAPTUREPUSH 0x0002 +#define RENDERFLAG_COLLISIONS 0x0004 +#define RENDERFLAG_CAPTUREPOP 0x0008 +#define RENDERFLAG_USEDELTAS 0x0010 +#define RENDERFLAG_NOBLITINVALIDATED 0x0200 +#define RENDERFLAG_SKIPOPTIONALTEXT 0x0400 +#define RENDERFLAG_FROMSPLIT 0x0800 +#define RENDERFLAG_DOUBLECOORDS 0x1000 class Draw { public: diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index c45bd0de27..55585f5619 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -197,7 +197,12 @@ void Draw_v2::printTotText(int16 id) { int16 rectLeft, rectTop, rectRight, rectBottom; int16 size; - if (!_vm->_game->_totTextData || !_vm->_game->_totTextData->dataPtr) + id &= 0xFFF; + + if (!_vm->_game->_totTextData || !_vm->_game->_totTextData->dataPtr || + (id >= _vm->_game->_totTextData->itemsCount) || + (_vm->_game->_totTextData->items[id].offset == -1) || + (_vm->_game->_totTextData->items[id].size == 0)) return; _vm->validateLanguage(); @@ -210,10 +215,34 @@ void Draw_v2::printTotText(int16 id) { if ((_renderFlags & RENDERFLAG_SKIPOPTIONALTEXT) && (ptr[1] & 0x80)) return; - destX = READ_LE_UINT16(ptr) & 0x7FFF; - destY = READ_LE_UINT16(ptr + 2); - spriteRight = READ_LE_UINT16(ptr + 4); - spriteBottom = READ_LE_UINT16(ptr + 6); + if (_renderFlags & RENDERFLAG_DOUBLECOORDS) { + destX = (READ_LE_UINT16(ptr) & 0x7FFF) * 2; + spriteRight = READ_LE_UINT16(ptr + 4) * 2 + 1; + } else { + destX = READ_LE_UINT16(ptr) & 0x7FFF; + spriteRight = READ_LE_UINT16(ptr + 4); + } + + if (_renderFlags & RENDERFLAG_FROMSPLIT) { + destY = _vm->_video->_splitHeight1; + spriteBottom = READ_LE_UINT16(ptr + 6) - READ_LE_UINT16(ptr + 2); + if (_renderFlags & RENDERFLAG_DOUBLECOORDS) + spriteBottom *= 3; + spriteBottom += _vm->_video->_splitHeight1; + if (_renderFlags & RENDERFLAG_DOUBLECOORDS) { + spriteBottom += _backDeltaX; + destY += _backDeltaX; + } + } else { + if (_renderFlags & RENDERFLAG_DOUBLECOORDS) { + destY = READ_LE_UINT16(ptr + 2) * 2; + spriteBottom = READ_LE_UINT16(ptr + 6) * 2; + } else { + destY = READ_LE_UINT16(ptr + 2); + spriteBottom = READ_LE_UINT16(ptr + 6); + } + } + ptr += 8; if (_renderFlags & RENDERFLAG_CAPTUREPUSH) { diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index d5c237c974..4ccd6d718e 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -151,7 +151,7 @@ void Game_v2::playTot(int16 skipPlay) { if (_totTextData->dataPtr != 0) { Common::MemoryReadStream totTextData(_totTextData->dataPtr, 4294967295U); - _totTextData->itemsCount = MIN<int32>(totTextData.readSint16LE(), (size - 2) / 4); + _totTextData->itemsCount = totTextData.readSint16LE() & 0x3FFF; _totTextData->items = new TotTextItem[_totTextData->itemsCount]; for (int i = 0; i < _totTextData->itemsCount; ++i) { diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index 572f133e33..5ea307bf28 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -1908,6 +1908,15 @@ bool Inter_v1::o1_fillRect(OpFuncParams ¶ms) { if (!_vm->_draw->_spritesArray[_vm->_draw->_destSurface]) return false; + if (_vm->_draw->_spriteRight < 0) { + _vm->_draw->_destSpriteX += _vm->_draw->_spriteRight - 1; + _vm->_draw->_spriteRight = -_vm->_draw->_spriteRight + 2; + } + if (_vm->_draw->_spriteBottom < 0) { + _vm->_draw->_destSpriteY += _vm->_draw->_spriteBottom - 1; + _vm->_draw->_spriteBottom = -_vm->_draw->_spriteBottom + 2; + } + _vm->_draw->spriteOperation(DRAW_FILLRECT); return false; } |