[Scummvm-cvs-logs] SF.net SVN: scummvm:[46431] scummvm/trunk/engines/kyra

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sun Dec 20 15:11:56 CET 2009


Revision: 46431
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46431&view=rev
Author:   athrxx
Date:     2009-12-20 14:11:56 +0000 (Sun, 20 Dec 2009)

Log Message:
-----------
LOL: fixed text fading

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/screen_lol.cpp
    scummvm/trunk/engines/kyra/screen_lol.h
    scummvm/trunk/engines/kyra/sound_towns.cpp

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-12-20 13:38:13 UTC (rev 46430)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-12-20 14:11:56 UTC (rev 46431)
@@ -1649,7 +1649,7 @@
 	if (!_fadeText)
 		return;
 
-	if (_screen->fadeColor(192, 252, _system->getMillis() - _palUpdateTimer, 60 * _tickLength))
+	if (_screen->fadeColor(192, 252, (_system->getMillis() - _palUpdateTimer) / _tickLength, 60))
 		return;
 
 	if (_needSceneRestore)

Modified: scummvm/trunk/engines/kyra/screen_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.cpp	2009-12-20 13:38:13 UTC (rev 46430)
+++ scummvm/trunk/engines/kyra/screen_lol.cpp	2009-12-20 14:11:56 UTC (rev 46431)
@@ -866,7 +866,7 @@
 	_system->setPalette(ci, dstColorIndex, 1);
 }
 
-bool Screen_LoL::fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTime, uint32 targetTime) {
+bool Screen_LoL::fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTicks, uint32 totalTicks) {
 	if (_use16ColorMode)
 		return false;
 
@@ -876,30 +876,28 @@
 
 	bool res = false;
 
-	int16 t1 = 0;
-	int16 t2 = 0;
-	int32 t3 = 0;
+	int16 srcV = 0;
+	int16 dstV = 0;
+	int32 outV = 0;
 
 	uint8 tmpPalEntry[3];
 
 	for (int i = 0; i < 3; i++) {
-		if (elapsedTime < targetTime) {
-			t1 = *src & 0x3f;
-			t2 = *dst & 0x3f;
+		if (elapsedTicks < totalTicks) {
+			srcV = *src & 0x3f;
+			dstV = *dst & 0x3f;
 
-			t3 = t1 - t2;
-			if (t3)
+			outV = srcV - dstV;
+			if (outV)
 				res = true;
 
-			t3 = (((t3 << 8) / (int)targetTime) * (int)elapsedTime) >> 8;
-			t3 =  t2 + t3;
+			outV = dstV + ((((outV << 8) / (int32)totalTicks) * (int32)elapsedTicks) >> 8);
 		} else {
-			t1 = *dst & 0x3f;
-			*p = t3 = t1;
+			*p = outV = *src;
 			res = false;
 		}
 
-		tmpPalEntry[i] = t3 & 0xff;
+		tmpPalEntry[i] = outV & 0xff;
 		src++;
 		dst++;
 		p++;

Modified: scummvm/trunk/engines/kyra/screen_lol.h
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.h	2009-12-20 13:38:13 UTC (rev 46430)
+++ scummvm/trunk/engines/kyra/screen_lol.h	2009-12-20 14:11:56 UTC (rev 46431)
@@ -74,7 +74,7 @@
 	void fadeToPalette1(int delay);
 	void loadSpecialColors(Palette &dst);
 	void copyColor(int dstColorIndex, int srcColorIndex);
-	bool fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTime, uint32 targetTime);
+	bool fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTicks, uint32 totalTicks);
 	bool fadePaletteStep(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, uint32 targetTime);
 	Palette **generateFadeTable(Palette **dst, Palette *src1, Palette *src2, int numTabs);
 

Modified: scummvm/trunk/engines/kyra/sound_towns.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_towns.cpp	2009-12-20 13:38:13 UTC (rev 46430)
+++ scummvm/trunk/engines/kyra/sound_towns.cpp	2009-12-20 14:11:56 UTC (rev 46431)
@@ -3561,6 +3561,14 @@
 
 void TownsPC98_OpnDriver::reset() {
 	Common::StackLock lock(_mutex);
+	
+	_musicPlaying = false;
+	_sfxPlaying = false;
+	_fading = false;
+	_looping = 0;
+	_musicTickCounter = 0;
+	_sfxData = 0;
+
 	TownsPC98_OpnCore::reset();
 
 	for (int i = 0; i < _numChan; i++)
@@ -3577,13 +3585,6 @@
 
 	if (_rhythmChannel)
 		_rhythmChannel->reset();
-
-	_musicPlaying = false;
-	_sfxPlaying = false;
-	_fading = false;
-	_looping = 0;
-	_musicTickCounter = 0;
-	_sfxData = 0;
 }
 
 void TownsPC98_OpnDriver::fadeStep() {


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