diff options
author | Gregory Montoir | 2006-11-05 22:24:15 +0000 |
---|---|---|
committer | Gregory Montoir | 2006-11-05 22:24:15 +0000 |
commit | ec177bc6ce7cc7633c1551a7d1ee962d40664f0c (patch) | |
tree | ef956f4bd17b7663e3e271542f1acd5d3132a8ca | |
parent | 424e9e362e55b32406af950cc5e551b9a378f45c (diff) | |
download | scummvm-rg350-ec177bc6ce7cc7633c1551a7d1ee962d40664f0c.tar.gz scummvm-rg350-ec177bc6ce7cc7633c1551a7d1ee962d40664f0c.tar.bz2 scummvm-rg350-ec177bc6ce7cc7633c1551a7d1ee962d40664f0c.zip |
various fixes
svn-id: r24628
-rw-r--r-- | engines/touche/graphics.cpp | 2 | ||||
-rw-r--r-- | engines/touche/opcodes.cpp | 4 | ||||
-rw-r--r-- | engines/touche/resource.cpp | 8 | ||||
-rw-r--r-- | engines/touche/touche.cpp | 25 | ||||
-rw-r--r-- | engines/touche/touche.h | 1 |
5 files changed, 22 insertions, 18 deletions
diff --git a/engines/touche/graphics.cpp b/engines/touche/graphics.cpp index 859202103f..5f1e479d91 100644 --- a/engines/touche/graphics.cpp +++ b/engines/touche/graphics.cpp @@ -176,7 +176,7 @@ void Graphics::copyRect(uint8 *dst, int dstPitch, int dstX, int dstY, const uint } void Graphics::copyMask(uint8 *dst, int dstPitch, int dstX, int dstY, const uint8 *src, int srcPitch, int srcX, int srcY, int w, int h, uint8 fillColor) { - dst += dstY * dstPitch * dstX; + dst += dstY * dstPitch + dstX; src += srcY * srcPitch + srcX; while (h--) { for (int i = 0; i < w; ++i) { diff --git a/engines/touche/opcodes.cpp b/engines/touche/opcodes.cpp index 3fe0e093d7..e1492e4e08 100644 --- a/engines/touche/opcodes.cpp +++ b/engines/touche/opcodes.cpp @@ -843,9 +843,9 @@ void ToucheEngine::op_setupFollowingKeyChar() { void ToucheEngine::op_startAnimation() { debugC(9, kDebugOpcodes, "ToucheEngine::op_startAnimation()"); - int16 num = _script.readNextWord(); + int16 keyChar = _script.readNextWord(); int16 pos = _script.readNextWord(); - int16 keyChar = *_script.stackDataPtr; + int16 num = *_script.stackDataPtr; addToAnimationTable(num, pos, keyChar, 3); } diff --git a/engines/touche/resource.cpp b/engines/touche/resource.cpp index 7262077745..1296decdc9 100644 --- a/engines/touche/resource.cpp +++ b/engines/touche/resource.cpp @@ -454,9 +454,9 @@ void ToucheEngine::res_loadSprite(int num, int index) { } spr->w = _currentImageWidth; spr->h = _currentImageHeight; - Graphics::copyRect(_offscreenBuffer, 640, 0, 0, - _backdropBuffer, _currentImageWidth, _flagsTable[614], _flagsTable[615], - 640, 100); +// Graphics::copyRect(_offscreenBuffer, 640, 0, 0, +// _backdropBuffer, _currentBitmapWidth, _flagsTable[614], _flagsTable[615], +// 640, 100); } void ToucheEngine::res_loadSequence(int num, int index) { @@ -564,7 +564,7 @@ void ToucheEngine::res_loadMusic(int num) { uint32 size; const uint32 offs = res_getDataOffset(kResourceTypeMusic, num, &size); _fData.seek(offs); - _midiPlayer->play(_fData, size); + _midiPlayer->play(_fData, size, true); } void ToucheEngine::res_loadSpeech(int num) { diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp index 2352d22795..71d34348c0 100644 --- a/engines/touche/touche.cpp +++ b/engines/touche/touche.cpp @@ -420,7 +420,7 @@ void ToucheEngine::setupEpisode(int num) { if (_flagsTable[911] != 0) { // load scripts from external data files } - debug(0, "Setting up episode %d\n", num); + debug(0, "Setting up episode %d", num); res_loadProgram(num); _disabledInputCounter = 0; } @@ -830,6 +830,8 @@ void ToucheEngine::fadePalette(int firstColor, int lastColor, int scale, int sca scale = 0; } setPalette(firstColor, lastColor, scale, scale, scale); + _system->updateScreen(); + _system->delayMillis(10); } } @@ -1186,7 +1188,7 @@ void ToucheEngine::setKeyCharRandomFrame(KeyChar *key) { } void ToucheEngine::setKeyCharMoney() { - _keyCharsTable[_currentKeyCharNum].money = _currentAmountOfMoney; + _keyCharsTable[_currentKeyCharNum].money += _currentAmountOfMoney; drawAmountOfMoneyInInventory(); } @@ -1251,7 +1253,7 @@ int ToucheEngine::restartKeyCharScriptOnAction(int action, int obj1, int obj2) { for (uint i = 0; i < _programActionScriptOffsetTable.size(); ++i) { const ProgramActionScriptOffsetData *pasod = &_programActionScriptOffsetTable[i]; if (pasod->object1 == obj1 && pasod->action == action && pasod->object2 == obj2) { - debug(0, "Found matching action i=%d %d,%d,%d\n", i, pasod->action, pasod->object1, pasod->object2); + debug(0, "Found matching action i=%d %d,%d,%d", i, pasod->action, pasod->object1, pasod->object2); KeyChar *key = &_keyCharsTable[_currentKeyCharNum]; key->scriptDataOffset = pasod->offset; key->scriptStackPtr = &key->scriptStackTable[39]; @@ -1706,7 +1708,7 @@ void ToucheEngine::clearRoomArea() { } void ToucheEngine::startNewMusic() { -// bool unkMidiFlag = _flagsTable[619] != 0; +// bool loopMusic = _flagsTable[619] != 0; // ? if (_newMusicNum != 0 && _newMusicNum != _currentMusicNum) { res_loadMusic(_newMusicNum); _currentMusicNum = _newMusicNum; @@ -2054,15 +2056,15 @@ void ToucheEngine::drawInventory(int index, int flag) { void ToucheEngine::drawAmountOfMoneyInInventory() { if (_flagsTable[606] == 0 && !_hideInventoryTexts) { - char text[4]; - snprintf(text, sizeof(text)-1, "%d", _keyCharsTable[0].money); + char text[10]; + sprintf(text, "%d", _keyCharsTable[0].money); Graphics::fillRect(_offscreenBuffer, 640, 74, 354, 40, 16, 0xD2); drawGameString(16, 217, 94, 355, text); updateScreenArea(_offscreenBuffer, 640, 74, 354, 74, 354, 40, 16); Graphics::fillRect(_offscreenBuffer, 640, 150, 353, 40, 41, 0xD2); if (_currentAmountOfMoney != 0) { drawIcon(141, 348, 1); - snprintf(text, sizeof(text)-1, "%d", _currentAmountOfMoney); + sprintf(text, "%d", _currentAmountOfMoney); drawGameString(16, 217, 170, 378, text); } updateScreenArea(_offscreenBuffer, 640, 150, 353, 150, 353, 40, 41); @@ -2248,9 +2250,10 @@ int ToucheEngine::updateKeyCharTalk(int skipFlag) { } const char *ToucheEngine::formatTalkText(int mode, int *y, int *h, const char *text) { + static char talkTextBuffer[200]; int newLineWidth = 0; int lineWidth = 0; - char *textBuffer = _talkTextBuffer; + char *textBuffer = talkTextBuffer; char *textLine = textBuffer; if (mode != 16) { return text; @@ -2286,7 +2289,7 @@ const char *ToucheEngine::formatTalkText(int mode, int *y, int *h, const char *t if (*y < 0) { *y = 1; } - return _talkTextBuffer; + return talkTextBuffer; } } @@ -3067,11 +3070,12 @@ void ToucheEngine::addToAnimationTable(int num, int posNum, int keyChar, int del anim->posNum = posNum; int16 xPos, yPos, x2Pos, y2Pos; if (posNum >= 0) { - assert(posNum >= 0 && posNum < NUM_KEYCHARS); + assert(posNum < NUM_KEYCHARS); xPos = _keyCharsTable[posNum].xPos; yPos = _keyCharsTable[posNum].yPos - 50; } else { posNum = -posNum; + assert((uint)posNum < _programPointsTable.size()); xPos = _programPointsTable[posNum].x; yPos = _programPointsTable[posNum].y; } @@ -3090,6 +3094,7 @@ void ToucheEngine::addToAnimationTable(int num, int posNum, int keyChar, int del anim->dy = yPos; anim->displayCounter = 8; anim->displayRect.left = -1; + break; } } } diff --git a/engines/touche/touche.h b/engines/touche/touche.h index aaa62a8317..71763ed618 100644 --- a/engines/touche/touche.h +++ b/engines/touche/touche.h @@ -632,7 +632,6 @@ protected: int _talkTableLastOtherKeyChar; int _talkTableLastStringNum; int _objectDescriptionNum; - char _talkTextBuffer[200]; TalkEntry _talkTable[NUM_TALK_ENTRIES]; bool _conversationChoicesUpdated; |