From 4999677c579631cd54b4919a5766dcb8f2201366 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Sun, 25 Jan 2009 18:08:26 +0000 Subject: added a few more code differences, demo version is now completable svn-id: r36063 --- engines/tucker/resource.cpp | 8 +++++--- engines/tucker/staticres.cpp | 19 +++++++++++++++++-- engines/tucker/tucker.cpp | 20 +++++++++++++------- engines/tucker/tucker.h | 8 ++++++-- 4 files changed, 41 insertions(+), 14 deletions(-) (limited to 'engines') diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index d36024393c..88957e7543 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -415,9 +415,11 @@ void TuckerEngine::loadCTable02(int fl) { } int start = 0; _spriteAnimationsTable[entry].firstFrameIndex = i; - // 9999 is also used as the end marker in the demo version - while (start != 999 && start != 9999) { + while (start != 999) { start = t.getNextInteger(); + if (start == 9999) { // end marker in the demo version + start = 999; + } _spriteAnimationFramesTable[i] = start; ++i; } @@ -452,7 +454,7 @@ void TuckerEngine::loadLoc() { copyLocBitmap(filename, 0, false); Graphics::copyRect(_quadBackgroundGfxBuf + 89600, 320, _locationBackgroundGfxBuf, 640, 320, 140); } - if ((_gameFlags & kGameFlagDemo) == 0 && _locationNum == 1) { + if (_locationNum == 1) { _loadLocBufPtr = _quadBackgroundGfxBuf + 89600; loadImage("rochpath.pcx", _loadLocBufPtr, 0); } diff --git a/engines/tucker/staticres.cpp b/engines/tucker/staticres.cpp index 3efb34c58a..d10402cc59 100644 --- a/engines/tucker/staticres.cpp +++ b/engines/tucker/staticres.cpp @@ -28,7 +28,7 @@ namespace Tucker { -const int TuckerEngine::_locationWidthTable[85] = { +const uint8 TuckerEngine::_locationWidthTableGame[85] = { 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 4, 2, 1, 1, 2, 1, 2, 4, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 4, 1, @@ -36,6 +36,13 @@ const int TuckerEngine::_locationWidthTable[85] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 }; +const uint8 TuckerEngine::_locationWidthTableDemo[70] = { + 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, + 1, 2, 1, 2, 4, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, + 1, 1, 1, 1, 2, 1, 2, 2, 2, 4, 4, 2, 2, 1, 1, 0 +}; + const uint8 TuckerEngine::_sprA02LookupTable[88] = { 0, 6, 2, 8, 1, 0, 6, 0, 2, 2, 2, 1, 2, 0, 1, 1, 6, 0, 1, 2, 1, 2, 3, 0, 6, 12, 7, 7, 1, 8, 1, 0, 3, 0, 4, @@ -165,7 +172,7 @@ const int TuckerEngine::_staticData3Table[1600] = { 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000 }; -int TuckerEngine::_locationHeightTable[80] = { +uint8 TuckerEngine::_locationHeightTableGame[80] = { 0x00, 0x1C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -173,6 +180,14 @@ int TuckerEngine::_locationHeightTable[80] = { 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; +uint8 TuckerEngine::_locationHeightTableDemo[70] = { + 0x00, 0x1C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3C, 0x00, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + int TuckerEngine::_objectKeysPosXTable[80] = { 0x000, 0x0A0, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x12B, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x140, 0x000, 0x000, 0x000, 0x000, 0x09E, 0x060, 0x0C0, 0x040, 0x0A0, 0x12C, 0x068, 0x098, diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 2d17417b78..d4de367dc4 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -143,6 +143,14 @@ void TuckerEngine::restart() { _gameHintsDisplayText = 0; _gameHintsStringNum = 0; + if ((_gameFlags & kGameFlagDemo) == 0) { + _locationWidthTable = _locationWidthTableGame; + _locationHeightTable = _locationHeightTableGame; + } else { + _locationWidthTable = _locationWidthTableDemo; + _locationHeightTable = _locationHeightTableDemo; + } + memset(_sprA02Table, 0, sizeof(_sprA02Table)); memset(_sprC02Table, 0, sizeof(_sprC02Table)); memset(_actionsTable, 0, sizeof(_actionsTable)); @@ -1527,9 +1535,7 @@ void TuckerEngine::drawData3() { void TuckerEngine::execData3PreUpdate() { switch (_locationNum) { case 1: - if ((_gameFlags & kGameFlagDemo) == 0) { - execData3PreUpdate_locationNum1(); - } + execData3PreUpdate_locationNum1(); break; case 2: execData3PreUpdate_locationNum2(); @@ -2819,7 +2825,7 @@ void TuckerEngine::drawStringAlt(int offset, int color, const uint8 *str, int st offset += _charWidthTable[chr]; ++pos; } - addDirtyRect(startOffset % 640, startOffset / 640, (offset - startOffset) % 640, Graphics::_charset.charH); + addDirtyRect(startOffset % 640, startOffset / 640, Graphics::_charset.charW * pos, Graphics::_charset.charH); } void TuckerEngine::drawItemString(int offset, int num, const uint8 *str) { @@ -3776,13 +3782,13 @@ int TuckerEngine::splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int void TuckerEngine::drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int dstOffset, uint8 color) { int startOffset = dstOffset; - while (count > 0 && dataPtr[pos] != '\n') { + int i = 0; + for (; i < count && dataPtr[pos] != '\n'; ++i) { Graphics::drawStringChar(_locationBackgroundGfxBuf + dstOffset, dataPtr[pos], 640, color, _charsetGfxBuf); dstOffset += _charWidthTable[dataPtr[pos]]; ++pos; - --count; } - addDirtyRect(startOffset % 640, startOffset / 640, (dstOffset - startOffset) % 640, Graphics::_charset.charH); + addDirtyRect(startOffset % 640, startOffset / 640, Graphics::_charset.charW * i, Graphics::_charset.charH); } void TuckerEngine::redrawScreen(int offset) { diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h index 782b5f2e15..577b600952 100644 --- a/engines/tucker/tucker.h +++ b/engines/tucker/tucker.h @@ -624,6 +624,8 @@ protected: uint8 *_csDataBuf; int _csDataSize; uint8 _charWidthTable[256]; + const uint8 *_locationWidthTable; + uint8 *_locationHeightTable; int _mousePosX, _mousePosY; int _prevMousePosX, _prevMousePosY; @@ -817,12 +819,14 @@ protected: int _updateLocation70StringLen; uint8 _updateLocation70String[20]; - static const int _locationWidthTable[85]; + static const uint8 _locationWidthTableGame[85]; + static const uint8 _locationWidthTableDemo[70]; static const uint8 _sprA02LookupTable[88]; static const uint8 _sprC02LookupTable[100]; static const uint8 _sprC02LookupTable2[100]; static const int _staticData3Table[1600]; - static int _locationHeightTable[80]; + static uint8 _locationHeightTableGame[80]; + static uint8 _locationHeightTableDemo[70]; static int _objectKeysPosXTable[80]; static int _objectKeysPosYTable[80]; static int _objectKeysLocationTable[80]; -- cgit v1.2.3