[Scummvm-cvs-logs] scummvm master -> f539d8f80f7f1b9dc62d6d68ac4aa1e32b2e3164

tramboi bertrand_augereau at yahoo.fr
Thu Dec 1 09:09:23 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:
f539d8f80f DREAMWEB: Mechanism to allow reel callbacks to be specified either with a ReelRoutine or es:bx as parameters


Commit: f539d8f80f7f1b9dc62d6d68ac4aa1e32b2e3164
    https://github.com/scummvm/scummvm/commit/f539d8f80f7f1b9dc62d6d68ac4aa1e32b2e3164
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2011-12-01T01:08:16-08:00

Commit Message:
DREAMWEB: Mechanism to allow reel callbacks to be specified either with a ReelRoutine or es:bx as parameters

Changed paths:
    engines/dreamweb/sprite.cpp



diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index 8d3d76a..7224837 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -567,7 +567,7 @@ void DreamGenContext::showrain() {
 	playchannel1(soundIndex);
 }
 
-static void (DreamGenContext::*reelCallbacks[])() = {
+static void (DreamGenContext::*reelCallbacks[57])() = {
 	&DreamGenContext::gamer, &DreamGenContext::sparkydrip,
 	&DreamGenContext::eden, &DreamGenContext::edeninbath,
 	&DreamGenContext::sparky, &DreamGenContext::smokebloke,
@@ -599,24 +599,61 @@ static void (DreamGenContext::*reelCallbacks[])() = {
 	&DreamGenContext::carparkdrip
 };
 
+static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = {
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL, NULL,
+	NULL
+};
 
 void DreamGenContext::updatepeople() {
 	data.word(kListpos) = kPeoplelist;
 	memset(segRef(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People));
 	++data.word(kMaintimer);
 
-	// The callbacks are called with es:bx pointing to their reelRoutine entry.
-	// They use some of the fields in it to store state.
+	// The original callbacks are called with es:bx pointing to their reelRoutine entry.
+	// The new callbacks take a mutable ReelRoutine parameter.
 
 	es = cs;
-	const ReelRoutine *r = (const ReelRoutine *)cs.ptr(kReelroutines, 0);
+	ReelRoutine *r = (ReelRoutine *)cs.ptr(kReelroutines, 0);
 
 	for (int i = 0; r[i].reallocation != 255; ++i) {
 		bx = kReelroutines + 8*i;
 		if (r[i].reallocation == data.byte(kReallocation) &&
 		        r[i].mapX == data.byte(kMapx) &&
 		        r[i].mapY == data.byte(kMapy)) {
-			(this->*(reelCallbacks[i]))();
+			if (reelCallbacks[i]) {
+				assert(!reelCallbacksCPP[i]);
+				(this->*(reelCallbacks[i]))();
+			} else {
+				assert(reelCallbacksCPP[i]);
+				(this->*(reelCallbacksCPP[i]))(r[i]);
+			}
 		}
 	}
 }






More information about the Scummvm-git-logs mailing list