[Scummvm-cvs-logs] CVS: scummvm/kyra kyra.cpp,1.91,1.92 kyra.h,1.48,1.49 screen.cpp,1.31,1.32 script_v1.cpp,1.41,1.42

Johannes Schickel lordhoto at users.sourceforge.net
Tue Dec 20 02:59:05 CET 2005


Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22822

Modified Files:
	kyra.cpp kyra.h screen.cpp script_v1.cpp 
Log Message:
Fixes gfx bug in the temple and the cave, also corrected 
the encodeShape and drawShape function for CD version.


Index: kyra.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- kyra.cpp	18 Dec 2005 18:50:15 -0000	1.91
+++ kyra.cpp	20 Dec 2005 10:58:07 -0000	1.92
@@ -522,7 +522,7 @@
 	enterNewScene(_currentCharacter->sceneId, _currentCharacter->facing, 0, 0, 1);
 }
 
-void KyraEngine::delay(uint32 amount) {
+void KyraEngine::delay(uint32 amount, bool update) {
 	OSystem::Event event;
 	char saveLoadSlot[20];
 
@@ -576,7 +576,8 @@
 			_debugger->onFrame();
 
 		_sprites->updateSceneAnims();
-		updateAllObjectShapes();
+		if (update)
+			updateAllObjectShapes();
 
 		if (_currentCharacter->sceneId == 210) {
 			//XXX
@@ -631,7 +632,7 @@
 		updateTextFade();
 
 		_handleInput = true;
-		delay((frameTime + _gameSpeed) - _system->getMillis());
+		delay((frameTime + _gameSpeed) - _system->getMillis(), true);
 		_handleInput = false;
 	}
 }
@@ -1916,12 +1917,15 @@
 	
 	for (int i = 1; i < 5; ++i) {
 		Character *ch = &_characterList[i];
+		curAnimState = &_charactersAnimState[addedObjects];
 		if (ch->sceneId != _currentCharacter->sceneId) {
+			curAnimState->active = 0;
+			curAnimState->refreshFlag = 0;
+			curAnimState->bkgdChangeFlag = 0;
 			++addedObjects;
 			continue;
 		}
 		
-		curAnimState = &_charactersAnimState[addedObjects];
 		curAnimState->drawY = ch->y1;
 		curAnimState->sceneAnimPtr = _shapes[4+ch->currentAnimFrame];
 		curAnimState->animFrameNumber = ch->currentAnimFrame;
@@ -2029,8 +2033,8 @@
 	curAnimState = _charactersAnimState;
 	curAnimState->bkgdChangeFlag = 1;
 	curAnimState->refreshFlag = 1;
-	for (int i = 0; i < 28; ++i) {
-		curAnimState = &_charactersAnimState[i];
+	for (int i = 1; i < 28; ++i) {
+		curAnimState = &_animStates[i];
 		if (curAnimState->active) {
 			curAnimState->bkgdChangeFlag = 1;
 			curAnimState->refreshFlag = 1;
@@ -3222,8 +3226,7 @@
 	_screen->_curPage = 2;
 	
 	while (curObject) {
-		// XXX
-		if (curObject->active) {
+		if (curObject->active && !curObject->unk1) {
 			preserveOrRestoreBackground(curObject, true);
 			curObject->x2 = curObject->x1;
 			curObject->y2 = curObject->y1;
@@ -3240,8 +3243,7 @@
 	_screen->_curPage = 2;
 	
 	while (curObject) {
-		// XXX
-		if (curObject->active && curObject->bkgdChangeFlag) {
+		if (curObject->active && !curObject->unk1 && curObject->bkgdChangeFlag) {
 			preserveOrRestoreBackground(curObject, false);
 			curObject->bkgdChangeFlag = 0;
 		}
@@ -3464,7 +3466,7 @@
 				int xpos = 0, ypos = 0, width = 0, height = 0;
 				xpos = curObject->x1 - (curObject->width2+1);
 				ypos = curObject->y1 - curObject->height2;				
-				width = (curObject->width + curObject->width2*2)<<3;
+				width = (curObject->width + ((curObject->width2)>>3)+2)<<3;
 				height = curObject->height + curObject->height2*2;
 				
 				if (xpos < 8) {

Index: kyra.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- kyra.h	14 Dec 2005 14:08:30 -0000	1.48
+++ kyra.h	20 Dec 2005 10:58:07 -0000	1.49
@@ -532,7 +532,7 @@
 	void res_loadShapeTable(const byte *src, Shape **loadTo, int *size);
 	
 	void waitForEvent();
-	void delay(uint32 millis);
+	void delay(uint32 millis, bool update = false);
 	void loadPalette(const char *filename, uint8 *palData);
 	void loadMouseShapes();
 	void loadCharacterShapes();

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/screen.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- screen.cpp	13 Dec 2005 15:10:20 -0000	1.31
+++ screen.cpp	20 Dec 2005 10:58:07 -0000	1.32
@@ -673,6 +673,13 @@
 	}
 	memset(_decodeShapeBuffer, 0, _decodeShapeBufferSize);
 	uint8 *decodedShapeFrame = _decodeShapeBuffer;
+	
+	// only used if shapeFlag & 1 is NOT zero
+	const uint8 *colorTable = shapeData + 10;
+	if (_vm->features() & GF_TALKIE) {
+		colorTable += 2;
+	}
+	
 	for (int j = 0; j < shapeHeight; ++j) {
 		uint8 *dsbNextLine = decodedShapeFrame + shapeWidth;
 		int count = shapeWidth;
@@ -681,8 +688,9 @@
 			if (code != 0) {
 				// this is guessed
 				if (shapeFlags & 1) {
-					const uint8 *colorTable = shapeData + 10;
-					*decodedShapeFrame++ = colorTable[code];
+					if (code < 16) {
+						*decodedShapeFrame++ = colorTable[code];
+					}
 				} else {
 					*decodedShapeFrame++ = code;
 				}
@@ -1427,6 +1435,9 @@
 	
 	if (flags & 1) {
 		dst = newShape + 10;
+		if (_vm->features() & GF_TALKIE) {
+			dst += 2;
+		}
 		src = &table[0x100];
 		memcpy(dst, src, sizeof(uint8)*16);
 	}

Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/script_v1.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- script_v1.cpp	14 Dec 2005 17:56:12 -0000	1.41
+++ script_v1.cpp	20 Dec 2005 10:58:07 -0000	1.42
@@ -576,7 +576,7 @@
 int KyraEngine::cmd_pauseSeconds(ScriptState *script) {
 	debug(3, "cmd_pauseSeconds(0x%X) (%d)", script, stackPos(0));
 	if (stackPos(0) > 0)
-		delay(stackPos(0)*1000);
+		delay(stackPos(0)*1000, false);
 	return 0;
 }
 
@@ -673,15 +673,20 @@
 	
 	while (running) {
 		wsa_play(_wsaObjects[wsaIndex], wsaFrame++, xpos, ypos, 0);
+		_updateScreen = true;
 		if (wsaFrame >= wsa_getNumFrames(_wsaObjects[wsaIndex]))
 			running = false;
 		
-		delay(waitTime * _tickLength);
-		if (worldUpdate) {
-			_sprites->updateSceneAnims();
-			updateAllObjectShapes();
+		uint32 continueTime = waitTime * _tickLength + _system->getMillis();
+		while (_system->getMillis() < continueTime) {
+			if (worldUpdate) {
+				_sprites->updateSceneAnims();
+				updateAllObjectShapes();
+			} else {
+				_screen->updateScreen();
+			}
+			delay(10);
 		}
-		_updateScreen = true;
 	}
 	
 	_screen->showMouse();
@@ -698,7 +703,12 @@
 	int wsaIndex = stackPos(4);
 	_screen->hideMouse();
 	wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 0);
-	delay(waitTime * _tickLength);
+	uint32 continueTime = waitTime * _tickLength + _system->getMillis();
+	while (_system->getMillis() < continueTime) {
+		_sprites->updateSceneAnims();
+		updateAllObjectShapes();
+		delay(10);
+	}
 	_updateScreen = true;
 	_screen->showMouse();
 	return 0;
@@ -893,9 +903,12 @@
 	
 	_screen->hideMouse();
 	wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 2);
-	delay(waitTime*_tickLength);
-	_sprites->updateSceneAnims();
-	updateAllObjectShapes();
+	uint32 continueTime = waitTime * _tickLength + _system->getMillis();
+	while (_system->getMillis() < continueTime) {
+		_sprites->updateSceneAnims();
+		updateAllObjectShapes();
+		delay(10);
+	}
 	_screen->showMouse();
 	
 	return 0;
@@ -920,16 +933,26 @@
 			int frame = startFrame;
 			while (endFrame >= frame) {
 				wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 0);
-				delay(waitTime * _tickLength);
 				_updateScreen = true;
+				uint32 continueTime = waitTime * _tickLength + _system->getMillis();
+				while (_system->getMillis() < continueTime) {
+					_sprites->updateSceneAnims();
+					updateAllObjectShapes();
+					delay(10);
+				}
 				++frame;
 			}
 		} else {
 			int frame = endFrame;
 			while (startFrame <= frame) {
 				wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 0);
-				delay(waitTime * _tickLength);
 				_updateScreen = true;
+				uint32 continueTime = waitTime * _tickLength + _system->getMillis();
+				while (_system->getMillis() < continueTime) {
+					_sprites->updateSceneAnims();
+					updateAllObjectShapes();
+					delay(10);
+				}
 				--frame;
 			}
 		}





More information about the Scummvm-git-logs mailing list