[Scummvm-cvs-logs] scummvm master -> 1ef77a580fe382f002dad6d0ae38ab43e4d2540b

tramboi bertrand_augereau at yahoo.fr
Wed Nov 16 15:51:50 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1ef77a580f DREAMWEB: 'fadecalculation' ported to C++


Commit: 1ef77a580fe382f002dad6d0ae38ab43e4d2540b
    https://github.com/scummvm/scummvm/commit/1ef77a580fe382f002dad6d0ae38ab43e4d2540b
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2011-11-16T08:50:51-08:00

Commit Message:
DREAMWEB: 'fadecalculation' ported to C++

Changed paths:
    devtools/tasmrecover/tasm-recover
    engines/dreamweb/dreamgen.cpp
    engines/dreamweb/dreamgen.h
    engines/dreamweb/stubs.h
    engines/dreamweb/vgafades.cpp



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index a2e4055..972d00e 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -217,6 +217,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'endpaltostart',
 	'startpaltoend',
 	'paltoendpal',
+	'fadecalculation',
 	], skip_output = [
 	# These functions are processed but not output
 	'dreamweb',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 4560c15..6c605e6 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2843,45 +2843,6 @@ endearly2:
 	cx = pop();
 }
 
-void DreamGenContext::fadecalculation() {
-	STACK_CHECK;
-	_cmp(data.byte(kFadecount), 0);
-	if (flags.z())
-		goto nomorefading;
-	bl = data.byte(kFadecount);
-	es = data.word(kBuffers);
-	si = (0+(228*13)+32+60+(32*32)+(11*10*3));
-	di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
-	cx = 768;
-fadecolloop:
-	al = es.byte(si);
-	ah = es.byte(di);
-	_cmp(al, ah);
-	if (flags.z())
-		goto gotthere;
-	if (flags.c())
-		goto lesscolour;
-	_dec(es.byte(si));
-	goto gotthere;
-lesscolour:
-	_cmp(bl, ah);
-	if (flags.z())
-		goto withit;
-	if (!flags.c())
-		goto gotthere;
-withit:
-	_inc(es.byte(si));
-gotthere:
-	_inc(si);
-	_inc(di);
-	if (--cx)
-		goto fadecolloop;
-	_dec(data.byte(kFadecount));
-	return;
-nomorefading:
-	data.byte(kFadedirection) = 0;
-}
-
 void DreamGenContext::greyscalesum() {
 	STACK_CHECK;
 	es = data.word(kBuffers);
@@ -16189,7 +16150,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
 		case addr_showgun: showgun(); break;
 		case addr_rollendcredits2: rollendcredits2(); break;
 		case addr_rollem: rollem(); break;
-		case addr_fadecalculation: fadecalculation(); break;
 		case addr_greyscalesum: greyscalesum(); break;
 		case addr_showgroup: showgroup(); break;
 		case addr_allpalette: allpalette(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index e6c105f..564b52e 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -502,7 +502,6 @@ public:
 	static const uint16 addr_allpalette = 0xc2a4;
 	static const uint16 addr_showgroup = 0xc290;
 	static const uint16 addr_greyscalesum = 0xc28c;
-	static const uint16 addr_fadecalculation = 0xc288;
 	static const uint16 addr_rollem = 0xc284;
 	static const uint16 addr_rollendcredits2 = 0xc280;
 	static const uint16 addr_showgun = 0xc27c;
@@ -1857,7 +1856,7 @@ public:
 	void usechurchhole();
 	void searchforfiles();
 	void monkspeaking();
-	void fadecalculation();
+	//void fadecalculation();
 	//void waitframes();
 	void clearrest();
 	//void getreelframeax();
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 4cdd11d..2fcb914 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -263,5 +263,5 @@
 	void endpaltostart();
 	void startpaltoend();
 	void paltoendpal();
-
+	void fadecalculation();
 
diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp
index 79a7cce..abb1a9b 100644
--- a/engines/dreamweb/vgafades.cpp
+++ b/engines/dreamweb/vgafades.cpp
@@ -56,5 +56,28 @@ void DreamGenContext::paltoendpal() {
 	memcpy(endPalette(), mainPalette(), 256*3);
 }
 
+void DreamGenContext::fadecalculation() {
+	if (data.byte(kFadecount) == 0) {
+		data.byte(kFadedirection) = 0;
+		return;
+	}
+
+	uint8 *startPal = startPalette();
+	const uint8 *endPal = endPalette();
+	for (size_t i = 0; i < 256 * 3; ++i, ++si, ++di) {
+		uint8 s = startPal[i];
+		uint8 e = endPal[i];
+		if (s == e)
+			continue;
+		else if (s > e)
+			--startPal[i];
+		else {
+			if (data.byte(kFadecount) <= e)
+				++startPal[i];
+		}
+	}
+	--data.byte(kFadecount);
+}
+
 } /*namespace dreamgen */
 






More information about the Scummvm-git-logs mailing list