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

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sat Mar 25 02:12:00 CET 2006


Revision: 21448
Author:   eriktorbjorn
Date:     2006-03-25 02:11:38 -0800 (Sat, 25 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21448&view=rev

Log Message:
-----------
I believe that the purpose of updateCallback45() is to add a signed value to a
channel's unsigned tempo. Rewrote the function to make this clearer, and
renamed it update_changeChannelTempo().

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/sound_adlib.cpp
Modified: scummvm/trunk/engines/kyra/sound_adlib.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_adlib.cpp	2006-03-25 09:55:28 UTC (rev 21447)
+++ scummvm/trunk/engines/kyra/sound_adlib.cpp	2006-03-25 10:11:38 UTC (rev 21448)
@@ -275,7 +275,7 @@
 	int update_resetToGlobalTempo(uint8 *&dataptr, Channel &channel, uint8 value);
 	int update_nop1(uint8 *&dataptr, Channel &channel, uint8 value);
 	int update_setDurationRandomness(uint8 *&dataptr, Channel &channel, uint8 value);
-	int updateCallback45(uint8 *&dataptr, Channel &channel, uint8 value);
+	int update_changeChannelTempo(uint8 *&dataptr, Channel &channel, uint8 value);
 	int updateCallback46(uint8 *&dataptr, Channel &channel, uint8 value);
 	int update_nop2(uint8 *&dataptr, Channel &channel, uint8 value);
 	int update_setupRhythmSection(uint8 *&dataptr, Channel &channel, uint8 value);
@@ -1560,18 +1560,15 @@
 	return 0;
 }
 
-int AdlibDriver::updateCallback45(uint8 *&dataptr, Channel &channel, uint8 value) {
-	if (value & 0x80) {
-		value += channel.tempo;
-		if (value >= channel.tempo)
-			value = 1;
-	} else {
-		uint8 temp = value;
-		value += channel.tempo;
-		if (value < temp)
-			value = 0xFF;
-	}
-	channel.tempo = value;
+int AdlibDriver::update_changeChannelTempo(uint8 *&dataptr, Channel &channel, uint8 value) {
+	int tempo = channel.tempo + (int8)value;
+
+	if (tempo <= 0)
+		tempo = 1;
+	else if (tempo > 255)
+		tempo = 255;
+
+	channel.tempo = tempo;
 	return 0;
 }
 
@@ -1922,7 +1919,7 @@
 
 	// 60
 	COMMAND(update_setDurationRandomness),
-	COMMAND(updateCallback45),
+	COMMAND(update_changeChannelTempo),
 	COMMAND(update_stopChannel),
 	COMMAND(updateCallback46),
 


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