[Scummvm-cvs-logs] SF.net SVN: scummvm: [24628] scummvm/trunk/engines/touche

cyx at users.sourceforge.net cyx at users.sourceforge.net
Sun Nov 5 23:24:29 CET 2006


Revision: 24628
          http://svn.sourceforge.net/scummvm/?rev=24628&view=rev
Author:   cyx
Date:     2006-11-05 14:24:15 -0800 (Sun, 05 Nov 2006)

Log Message:
-----------
various fixes

Modified Paths:
--------------
    scummvm/trunk/engines/touche/graphics.cpp
    scummvm/trunk/engines/touche/opcodes.cpp
    scummvm/trunk/engines/touche/resource.cpp
    scummvm/trunk/engines/touche/touche.cpp
    scummvm/trunk/engines/touche/touche.h

Modified: scummvm/trunk/engines/touche/graphics.cpp
===================================================================
--- scummvm/trunk/engines/touche/graphics.cpp	2006-11-05 13:00:20 UTC (rev 24627)
+++ scummvm/trunk/engines/touche/graphics.cpp	2006-11-05 22:24:15 UTC (rev 24628)
@@ -176,7 +176,7 @@
 }
 
 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) {

Modified: scummvm/trunk/engines/touche/opcodes.cpp
===================================================================
--- scummvm/trunk/engines/touche/opcodes.cpp	2006-11-05 13:00:20 UTC (rev 24627)
+++ scummvm/trunk/engines/touche/opcodes.cpp	2006-11-05 22:24:15 UTC (rev 24628)
@@ -843,9 +843,9 @@
 
 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);
 }
 

Modified: scummvm/trunk/engines/touche/resource.cpp
===================================================================
--- scummvm/trunk/engines/touche/resource.cpp	2006-11-05 13:00:20 UTC (rev 24627)
+++ scummvm/trunk/engines/touche/resource.cpp	2006-11-05 22:24:15 UTC (rev 24628)
@@ -454,9 +454,9 @@
 	}
 	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 @@
 	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) {

Modified: scummvm/trunk/engines/touche/touche.cpp
===================================================================
--- scummvm/trunk/engines/touche/touche.cpp	2006-11-05 13:00:20 UTC (rev 24627)
+++ scummvm/trunk/engines/touche/touche.cpp	2006-11-05 22:24:15 UTC (rev 24628)
@@ -420,7 +420,7 @@
 		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 @@
 			scale = 0;
 		}
 		setPalette(firstColor, lastColor, scale, scale, scale);
+		_system->updateScreen();
+		_system->delayMillis(10);
 	}
 }
 
@@ -1186,7 +1188,7 @@
 }
 
 void ToucheEngine::setKeyCharMoney() {
-	_keyCharsTable[_currentKeyCharNum].money = _currentAmountOfMoney;
+	_keyCharsTable[_currentKeyCharNum].money += _currentAmountOfMoney;
 	drawAmountOfMoneyInInventory();
 }
 
@@ -1251,7 +1253,7 @@
 	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::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::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 @@
 }
 
 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 @@
 		if (*y < 0) {
 			*y = 1;
 		}
-		return _talkTextBuffer;
+		return talkTextBuffer;
 	}
 }
 
@@ -3067,11 +3070,12 @@
 			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 @@
 			anim->dy = yPos;
 			anim->displayCounter = 8;
 			anim->displayRect.left = -1;
+			break;
 		}
 	}
 }

Modified: scummvm/trunk/engines/touche/touche.h
===================================================================
--- scummvm/trunk/engines/touche/touche.h	2006-11-05 13:00:20 UTC (rev 24627)
+++ scummvm/trunk/engines/touche/touche.h	2006-11-05 22:24:15 UTC (rev 24628)
@@ -632,7 +632,6 @@
 	int _talkTableLastOtherKeyChar;
 	int _talkTableLastStringNum;
 	int _objectDescriptionNum;
-	char _talkTextBuffer[200];
 	TalkEntry _talkTable[NUM_TALK_ENTRIES];
 
 	bool _conversationChoicesUpdated;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list