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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Mon Mar 6 08:38:00 CET 2006


Revision: 21111
Author:   lordhoto
Date:     2006-03-06 08:37:03 -0800 (Mon, 06 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=21111&view=rev

Log Message:
-----------
Renamed setTempo to update_setTempo, also fixed tempo handling (intro is too fast now though, but seems to be another problem).
Also changed some unsigned values to signed.

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-06 16:31:19 UTC (rev 21110)
+++ scummvm/trunk/engines/kyra/sound_adlib.cpp	2006-03-06 16:37:03 UTC (rev 21111)
@@ -116,8 +116,8 @@
 		uint8 unk26;
 		uint8 unk7;
 		uint8 unk15;
-		uint8 unk1;
-		uint8 unk4;
+		int8 unk1;
+		int8 unk4;
 		uint8 unk17;
 		uint8 unkOutputValue1;
 		typedef void (AdlibDriver::*Callback)(OutputState&);
@@ -212,7 +212,7 @@
 	int updateCallback26(uint8 *&dataptr, OutputState &state, uint8 value);
 	int updateCallback27(uint8 *&dataptr, OutputState &state, uint8 value);
 	int updateCallback28(uint8 *&dataptr, OutputState &state, uint8 value);
-	int setTempo(uint8 *&dataptr, OutputState &state, uint8 value);
+	int update_setTempo(uint8 *&dataptr, OutputState &state, uint8 value);
 	int updateCallback30(uint8 *&dataptr, OutputState &state, uint8 value);
 	int updateCallback31(uint8 *&dataptr, OutputState &state, uint8 value);
 	int updateCallback32(uint8 *&dataptr, OutputState &state, uint8 value);
@@ -242,7 +242,7 @@
 	int updateCallback56(uint8 *&dataptr, OutputState &state, uint8 value);
 private:
 	int _lastProcessed;
-	uint8 _flagTrigger;
+	int8 _flagTrigger;
 	int _curTable;
 	uint8 _unk4;
 	uint8 _unk5;
@@ -253,7 +253,7 @@
 
 	uint8 _unkValue1;
 	uint8 _unkValue2;
-	uint8 _unkValue3;
+	int8 _unkValue3;
 	uint8 _unkValue4;
 	uint8 _unkValue5;
 	uint8 _unkValue6;
@@ -282,7 +282,7 @@
 
 	uint8 _unkOutputByte2;
 	uint8 _unkOutputByte1;
-	uint8 _tempo;
+	int8 _tempo;
 
 	const uint8 *_tablePtr1;
 	const uint8 *_tablePtr2;
@@ -325,7 +325,7 @@
 
 	_tempo = 0;
 
-	_unkValue3 = 0xFF;
+	_unkValue3 = -1;
 	_unkValue1 = _unkValue2 = _unkValue4 = _unkValue5 = 0;
 	_unkValue6 = _unkValue7 = _unkValue8 = _unkValue9 = _unkValue10 = 0;
 	_unkValue11 = _unkValue12 = _unkValue13 = _unkValue14 = _unkValue15 =
@@ -508,13 +508,13 @@
 void AdlibDriver::callback() {
 	lock();
 	--_flagTrigger;
-	if ((int8)_flagTrigger < 0)
+	if (_flagTrigger < 0)
 		_flags &= ~8;
 	callbackOutput();
 	callbackProcess();
 
 	_unkValue3 += _tempo;
-	if ((int8)_unkValue3 < 0) {
+	if (_unkValue3 < 0) {
 		if (!(--_unkValue2)) {
 			_unkValue2 = _unkValue1;
 			++_unkValue4;
@@ -536,8 +536,8 @@
 			initTable(table);
 			table.unk2 = unk2;
 			table.dataptr = ptr;
-			table.unk1 = 0xFF;
-			table.unk4 = 0xFF;
+			table.unk1 = -1;
+			table.unk4 = -1;
 			table.unk5 = 1;
 			if (index != 9) {
 				unkOutput2(index);
@@ -562,9 +562,8 @@
 			table.unk1 = _tempo;
 		}
 
-		uint16 temp = table.unk4 + table.unk1;
 		table.unk4 += table.unk1;
-		if (temp > 0xFF) {
+		if (table.unk4 < 0) {
 			if (--table.unk5) {
 				if (table.unk5 == table.unk7)
 					unkOutput1(table);
@@ -645,7 +644,7 @@
 	debugC(9, kDebugLevelSound, "initTable(%d)", &table - _outputTables);
 	memset(&table.dataptr, 0, sizeof(OutputState) - ((char*)&table.dataptr - (char*)&table));
 
-	table.unk1 = 0xFF;
+	table.unk1 = -1;
 	table.unk2 = 0;
 	// normally here are nullfuncs but we set 0 for now
 	table.callback1 = 0;
@@ -962,8 +961,8 @@
 		initTable(state2);
 		state2.unk2 = temp;
 		state2.dataptr = ptr;
-		state2.unk1 = 0xFF;
-		state2.unk4 = 0xFF;
+		state2.unk1 = -1;
+		state2.unk4 = -1;
 		state2.unk5 = 1;
 		unkOutput2(table);
 	}
@@ -1107,7 +1106,7 @@
 int AdlibDriver::updateCallback23(uint8 *&dataptr, OutputState &state, uint8 value) {
 	value >>= 1;
 	_unkValue1 = _unkValue2 = value;
-	_unkValue3 = 0xFF;
+	_unkValue3 = -1;
 	_unkValue4 = _unkValue5 = 0;
 	return 0;
 }
@@ -1151,8 +1150,8 @@
 	return 0;
 }
 
-int AdlibDriver::setTempo(uint8 *&dataptr, OutputState &state, uint8 value) {
-	_tempo = value;
+int AdlibDriver::update_setTempo(uint8 *&dataptr, OutputState &state, uint8 value) {
+	_tempo = (int8)value;
 	return 0;
 }
 
@@ -1163,7 +1162,7 @@
 }
 
 int AdlibDriver::updateCallback31(uint8 *&dataptr, OutputState &state, uint8 value) {
-	state.unk1 = value;
+	state.unk1 = (int8)value;
 	return 0;
 }
 
@@ -1349,7 +1348,7 @@
 		if ((int8)value < 0)
 			value = (uint8)-1;
 	}
-	state.unk1 = value;
+	state.unk1 = (int8)value;
 	return 0;
 }
 
@@ -1727,7 +1726,7 @@
 	// 36
 	COMMAND(updateCallback28),
 	COMMAND(updateCallback9),
-	COMMAND(setTempo),
+	COMMAND(update_setTempo),
 	COMMAND(updateCallback30),
 
 	// 40







More information about the Scummvm-git-logs mailing list