From 2a71b897c69f303f5c1df14a0c9bc22911bef741 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Mon, 10 Nov 2008 23:29:08 +0000 Subject: fixed charset issues & wrong state for locations 13,16,23 svn-id: r34999 --- engines/tucker/locations.cpp | 30 +++++++++++++++++------------- engines/tucker/resource.cpp | 20 ++++++++++++-------- engines/tucker/staticres.cpp | 19 ++++++++++++++++++- engines/tucker/tucker.cpp | 12 ++++-------- engines/tucker/tucker.h | 3 ++- 5 files changed, 53 insertions(+), 31 deletions(-) diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp index 7f0392a37a..514b2c3610 100644 --- a/engines/tucker/locations.cpp +++ b/engines/tucker/locations.cpp @@ -932,6 +932,7 @@ void TuckerEngine::updateSprite_locationNum13(int i) { state = 6; } else { setCharacterAnimation(0, 0); + return; } _spritesTable[i].state = state; } @@ -1123,20 +1124,21 @@ void TuckerEngine::updateSprite_locationNum16_0(int i) { } } else if (_csDataHandled) { _spritesTable[0].needUpdate = 0; - if (r < 30000) { - state = 4; - _spritesTable[0].updateDelay = 5; - } else if (r < 31000) { - state = 4; - if (_xPosCurrent < 300) { - _miscSoundFxDelayCounter[0] = 2; - _soundsMapTable[0] = 9; - } - } else if (r < 32000) { - state = 5; - } else { - state = 6; + state = 4; + _spritesTable[0].updateDelay = 5; + } else if (r < 30000) { + state = 4; + _spritesTable[0].updateDelay = 5; + } else if (r < 31000) { + state = 4; + if (_xPosCurrent < 300) { + _miscSoundFxDelayCounter[0] = 2; + _soundsMapTable[0] = 9; } + } else if (r < 32000) { + state = 5; + } else { + state = 6; } _spritesTable[i].state = state; } @@ -1475,6 +1477,8 @@ void TuckerEngine::updateSprite_locationNum23_2(int i) { state = (getRandomNumber() < 25000) ? 22 : 23; } } + } else { + state = 24; } _spritesTable[i].state = state; } diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index 25b5d40e3c..15bfe1a9c8 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -163,10 +163,12 @@ public: uint8 *TuckerEngine::loadFile(uint8 *p) { _fileLoadSize = 0; + bool decode = false; if (_useEnc) { char *ext = strrchr(_fileToLoad, '.'); if (ext && strcmp(ext + 1, "c") == 0) { strcpy(ext + 1, "enc"); + decode = true; } } Common::File f; @@ -179,7 +181,7 @@ uint8 *TuckerEngine::loadFile(uint8 *p) { } if (p) { f.read(p, sz); - if (_useEnc) { + if (decode) { decodeData(p, sz); } _fileLoadSize = sz; @@ -258,9 +260,7 @@ void TuckerEngine::loadCharset() { void TuckerEngine::loadCharset2() { _charWidthTable[58] = 7; _charWidthTable[32] = 15; - for (int i = 0; i < 58; ++i) { - _charWidthTable[65 + i] = _charWidthCharset2[i]; - } + memcpy(_charWidthTable + 65, _charWidthCharset2, 58); strcpy(_fileToLoad, "char2.pcx"); loadImage(_loadTempBuf, 0); loadCharsetHelper(kCharSet2CharW, kCharSet2CharH, 16, 6); @@ -278,11 +278,15 @@ void TuckerEngine::loadCharsetHelper(int charW, int charH, int xSize, int ySize) void TuckerEngine::loadCharSizeDta() { strcpy(_fileToLoad, "charsize.dta"); loadFile(_loadTempBuf); - DataTokenizer t(_loadTempBuf, _fileLoadSize, true); - for (int i = 0; i < 256; ++i) { - _charWidthTable[i] = t.getNextInteger(); + if (_fileLoadSize != 0) { + DataTokenizer t(_loadTempBuf, _fileLoadSize, true); + for (int i = 0; i < 256; ++i) { + _charWidthTable[i] = t.getNextInteger(); + } + _charWidthTable[225] = 0; + } else { + memcpy(_charWidthTable + 32, _charWidthCharset1, 224); } - _charWidthTable[225] = 0; } void TuckerEngine::loadPanel() { diff --git a/engines/tucker/staticres.cpp b/engines/tucker/staticres.cpp index dd3c449237..2a4cdefe9d 100644 --- a/engines/tucker/staticres.cpp +++ b/engines/tucker/staticres.cpp @@ -209,7 +209,24 @@ int TuckerEngine::_mapSequenceFlagsLocationTable[70] = { 1, 1, 1, 1, 0, 0, }; -const int TuckerEngine::_charWidthCharset2[58] = { +const uint8 TuckerEngine::_charWidthCharset1[224] = { + 0x06, 0x06, 0x04, 0x06, 0x07, 0x08, 0x08, 0x02, 0x04, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x07, 0x07, 0x08, 0x04, 0x04, 0x04, 0x04, 0x07, + 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x07, 0x07, 0x03, 0x05, 0x07, 0x04, 0x08, 0x07, 0x07, + 0x07, 0x08, 0x07, 0x07, 0x04, 0x07, 0x07, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x07, 0x04, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, + 0x08, 0x04, 0x08, 0x08, 0x07, 0x07, 0x06, 0x05, 0x07, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x00, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 +}; + +const uint8 TuckerEngine::_charWidthCharset2[58] = { 0x13, 0x0F, 0x10, 0x10, 0x10, 0x0E, 0x11, 0x10, 0x0D, 0x0A, 0x11, 0x0D, 0x14, 0x13, 0x13, 0x11, 0x13, 0x12, 0x10, 0x11, 0x13, 0x14, 0x14, 0x10, 0x13, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x0F, 0x10, 0x10, 0x10, 0x0E, 0x11, 0x10, 0x0D, 0x0A, 0x11, 0x0D, 0x14, 0x13, 0x13, 0x11, diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index d97d2ccd61..cfa8e850d2 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -328,12 +328,8 @@ void TuckerEngine::mainLoop() { strcpy(_fileToLoad, "csdata.c"); _csDataBuf = loadFile(); _csDataSize = _fileLoadSize; - strcpy(_fileToLoad, "nofiles.dta"); - loadFile(_loadTempBuf); - if (_fileLoadSize > 1) { - _maxSaveGameSlot = _loadTempBuf[0]; - _currentSaveGameSlot = _loadTempBuf[4]; - } + _currentSaveGameSlot = _firstSaveGameSlot = 1; + _maxSaveGameSlot = _lastSaveGameSlot = 99; loadBudSpr(0); loadCursor(); setCursorNum(_cursorNum); @@ -927,7 +923,7 @@ void TuckerEngine::fadeOutPalette(int colorsCount) { } _system->setPalette(pal, 0, colorsCount); _system->updateScreen(); - _system->delayMillis(20); + waitForTimer(1); } void TuckerEngine::fadeInPalette(int colorsCount) { @@ -941,7 +937,7 @@ void TuckerEngine::fadeInPalette(int colorsCount) { } _system->setPalette(pal, 0, colorsCount); _system->updateScreen(); - _system->delayMillis(20); + waitForTimer(1); } void TuckerEngine::fadePaletteColor(int color, int step) { diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h index f9458bebc9..a027bf56df 100644 --- a/engines/tucker/tucker.h +++ b/engines/tucker/tucker.h @@ -794,7 +794,8 @@ protected: static int _objectKeysPosYTable[80]; static int _objectKeysLocationTable[80]; static int _mapSequenceFlagsLocationTable[70]; - static const int _charWidthCharset2[58]; + static const uint8 _charWidthCharset1[224]; + static const uint8 _charWidthCharset2[58]; }; } // namespace Tucker -- cgit v1.2.3