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

tramboi bertrand_augereau at yahoo.fr
Tue Aug 16 02:01:49 CEST 2011


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

Summary:
d8ff4182f7 DREAMWEB: Encapsulate the hack to guess if this is a CD build or not
1fb3cb182f DREAMWEB: 'madman' ported to C++


Commit: d8ff4182f7cf249c560f4917c2a4faa0cc0f95a9
    https://github.com/scummvm/scummvm/commit/d8ff4182f7cf249c560f4917c2a4faa0cc0f95a9
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2011-08-15T18:24:13-07:00

Commit Message:
DREAMWEB: Encapsulate the hack to guess if this is a CD build or not

Changed paths:
    engines/dreamweb/sprite.cpp
    engines/dreamweb/stubs.cpp
    engines/dreamweb/stubs.h



diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index da9d8c9..e01fdca 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -765,10 +765,7 @@ void DreamGenContext::updatepeople() {
 }
 
 void DreamGenContext::madmantext() {
-	// The original sources has two codepaths depending if the game is 'if cd' or not
-	// This is a hack to guess which version to use with the assumption that if we have a cd version
-	// we managed to load the speech.
-	if (data.byte(kSpeechloaded)) {
+	if (isCD()) {
 		if (data.byte(kSpeechcount) >= 63)
 			return;
 		_cmp(data.byte(kCh1playing), 255);
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 9130a6c..c7c78e3 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1071,5 +1071,12 @@ void DreamGenContext::showpanel() {
 	showframe(frame, 192, 0, 19, 0, &width, &height);
 }
 
+bool DreamGenContext::isCD() {
+	// The original sources has two codepaths depending if the game is 'if cd' or not
+	// This is a hack to guess which version to use with the assumption that if we have a cd version
+	// we managed to load the speech. At least it is isolated in this function and can be changed.
+	// Maybe detect the version during game id?
+	return (data.byte(kSpeechloaded) == 1);
+}
 } /*namespace dreamgen */
 
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 5b8839f..81fbf0e 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -129,5 +129,5 @@
 	void showpanel();
 	void updatepeople();
 	void madmantext();
-
+	bool isCD();
 


Commit: 1fb3cb182f6b71a681c646d35e56322de3e38660
    https://github.com/scummvm/scummvm/commit/1fb3cb182f6b71a681c646d35e56322de3e38660
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2011-08-15T18:57:52-07:00

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

Changed paths:
    devtools/tasmrecover/tasm-recover
    engines/dreamweb/dreamgen.cpp
    engines/dreamweb/sprite.cpp



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index e05e58c..376e2dc 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -118,5 +118,6 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'dreamweb',
 	'backobject',
 	'mainman',
+	'madman',
 	])
 generator.generate('dreamweb') #start routine
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 9306acd..34bb64b 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -1694,84 +1694,6 @@ notendtelly:
 	showgamereel();
 }
 
-void DreamGenContext::madman() {
-	STACK_CHECK;
-	data.word(kWatchingtime) = 2;
-	checkspeed();
-	if (!flags.z())
-		goto nomadspeed;
-	ax = es.word(bx+3);
-	_cmp(ax, 364);
-	if (!flags.c())
-		goto ryansded;
-	_cmp(ax, 10);
-	if (!flags.z())
-		goto notfirstmad;
-	push(es);
-	push(bx);
-	push(ax);
-	dx = 2247;
-	loadtemptext();
-	ax = pop();
-	bx = pop();
-	es = pop();
-	data.byte(kCombatcount) = -1;
-	data.byte(kSpeechcount) = 0;
-notfirstmad:
-	_inc(ax);
-	_cmp(ax, 294);
-	if (flags.z())
-		goto madmanspoken;
-	_cmp(ax, 66);
-	if (!flags.z())
-		goto nomadspeak;
-	_inc(data.byte(kCombatcount));
-	push(es);
-	push(bx);
-	madmantext();
-	bx = pop();
-	es = pop();
-	ax = 53;
-	_cmp(data.byte(kCombatcount), 64);
-	if (flags.c())
-		goto nomadspeak;
-	_cmp(data.byte(kCombatcount), 70);
-	if (flags.z())
-		goto killryan;
-	_cmp(data.byte(kLastweapon), 8);
-	if (!flags.z())
-		goto nomadspeak;
-	data.byte(kCombatcount) = 72;
-	data.byte(kLastweapon) = -1;
-	data.byte(kMadmanflag) = 1;
-	ax = 67;
-	goto nomadspeak;
-killryan:
-	ax = 310;
-nomadspeak:
-	es.word(bx+3) = ax;
-nomadspeed:
-	showgamereel();
-	al = data.byte(kMapx);
-	es.byte(bx+1) = al;
-	madmode();
-	return;
-madmanspoken:
-	_cmp(data.byte(kWongame), 1);
-	if (flags.z())
-		return /* (alreadywon) */;
-	data.byte(kWongame) = 1;
-	push(es);
-	push(bx);
-	getridoftemptext();
-	bx = pop();
-	es = pop();
-	return;
-ryansded:
-	data.byte(kMandead) = 2;
-	showgamereel();
-}
-
 void DreamGenContext::madmode() {
 	STACK_CHECK;
 	data.word(kWatchingtime) = 2;
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index e01fdca..0da5faa 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -768,9 +768,8 @@ void DreamGenContext::madmantext() {
 	if (isCD()) {
 		if (data.byte(kSpeechcount) >= 63)
 			return;
-		_cmp(data.byte(kCh1playing), 255);
-		if (!flags.z())
-			return /* (nomadtext) */;
+		if (data.byte(kCh1playing) != 255)
+			return;
 		al = data.byte(kSpeechcount);
 		++data.byte(kSpeechcount);
 	} else {
@@ -779,11 +778,73 @@ void DreamGenContext::madmantext() {
 		al = data.byte(kCombatcount);
 		_and(al, 3);
 		if (!flags.z())
-			return /* (nomadtext) */;
+			return;
 		al = data.byte(kCombatcount) / 4;
 	}
 	setuptimedtemp(47 + al, 82, 72, 80, 90, 1);
 }
 
+void DreamGenContext::madman() {
+	data.word(kWatchingtime) = 2;
+	checkspeed();
+	if (flags.z()) {
+		ax = es.word(bx+3);
+		if (ax >= 364) {
+			data.byte(kMandead) = 2;
+			showgamereel();
+			return;
+		}
+		if (ax == 10) {
+			push(es);
+			push(bx);
+			push(ax);
+			dx = kIntrotextname;
+			loadtemptext();
+			ax = pop();
+			bx = pop();
+			es = pop();
+			data.byte(kCombatcount) = -1;
+			data.byte(kSpeechcount) = 0;
+		}
+		++ax;
+		if (ax == 294) {
+			if (data.byte(kWongame) == 1)
+				return;
+			data.byte(kWongame) = 1;
+			push(es);
+			push(bx);
+			getridoftemptext();
+			bx = pop();
+			es = pop();
+			return;
+		}
+		if (ax == 66) {
+			++data.byte(kCombatcount);
+			push(es);
+			push(bx);
+			madmantext();
+			bx = pop();
+			es = pop();
+			ax = 53;
+			if (data.byte(kCombatcount) >= (isCD() ? 64 : 62)) {
+				if (data.byte(kCombatcount) == (isCD() ? 70 : 68))
+					ax = 310;
+				else {
+					if (data.byte(kLastweapon) == 8) {
+						data.byte(kCombatcount) = isCD() ? 72 : 70;
+						data.byte(kLastweapon) = -1;
+						data.byte(kMadmanflag) = 1;
+						ax = 67;
+					}
+				}
+			}
+		}
+		es.word(bx+3) = ax;
+	}
+	showgamereel();
+	es.byte(bx+1) = data.byte(kMapx);
+	madmode();
+}
+
 } /*namespace dreamgen */
 






More information about the Scummvm-git-logs mailing list