[Scummvm-cvs-logs] scummvm master -> 0730d108c304db1fe138c5c398330bef47ee44cf

tramboi bertrand_augereau at yahoo.fr
Tue Nov 15 18:48:04 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:
0730d108c3 DREAMWEB: 'initrain' ported to C++


Commit: 0730d108c304db1fe138c5c398330bef47ee44cf
    https://github.com/scummvm/scummvm/commit/0730d108c304db1fe138c5c398330bef47ee44cf
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2011-11-15T09:46:57-08:00

Commit Message:
DREAMWEB: 'initrain' 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 cb3fd41..88156b1 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -221,6 +221,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'zoomonoff',
 	'inventory',
 	'mainscreen',
-	'doload'
+	'doload',
+	'initrain',
 	])
 generator.generate('dreamweb') #start routine
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index f33ee0c..6643ab0 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2262,73 +2262,6 @@ forgotone:
 	setuptimeduse();
 }
 
-void DreamGenContext::initrain() {
-	STACK_CHECK;
-	es = data.word(kBuffers);
-	di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30));
-	bx = offset_rainlocations;
-checkmorerain:
-	al = cs.byte(bx);
-	_cmp(al, 255);
-	if (flags.z())
-		goto finishinitrain;
-	_cmp(al, data.byte(kReallocation));
-	if (!flags.z())
-		goto checkrain;
-	al = cs.byte(bx+1);
-	_cmp(al, data.byte(kMapx));
-	if (!flags.z())
-		goto checkrain;
-	al = cs.byte(bx+2);
-	_cmp(al, data.byte(kMapy));
-	if (!flags.z())
-		goto checkrain;
-	al = cs.byte(bx+3);
-	data.byte(kRainspace) = al;
-	goto dorain;
-checkrain:
-	_add(bx, 4);
-	goto checkmorerain;
-dorain:
-	cx = 4;
-initraintop:
-	randomnumber();
-	_and(al, 31);
-	_add(al, 3);
-	_cmp(al, data.byte(kRainspace));
-	if (!flags.c())
-		goto initraintop;
-	_add(cl, al);
-	_cmp(cl, data.byte(kMapxsize));
-	if (!flags.c())
-		goto initrainside;
-	push(cx);
-	splitintolines();
-	cx = pop();
-	goto initraintop;
-initrainside:
-	cl = data.byte(kMapxsize);
-	_dec(cl);
-initrainside2:
-	randomnumber();
-	_and(al, 31);
-	_add(al, 3);
-	_cmp(al, data.byte(kRainspace));
-	if (!flags.c())
-		goto initrainside2;
-	_add(ch, al);
-	_cmp(ch, data.byte(kMapysize));
-	if (!flags.c())
-		goto finishinitrain;
-	push(cx);
-	splitintolines();
-	cx = pop();
-	goto initrainside2;
-finishinitrain:
-	al = 255;
-	_stosb();
-}
-
 void DreamGenContext::liftnoise() {
 	STACK_CHECK;
 	_cmp(data.byte(kReallocation), 5);
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index 6c8c8db..f6083ff 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -932,5 +932,55 @@ Rain *DreamGenContext::splitintolines(uint8 x, uint8 y, Rain *rain) {
 	return rain;
 }
 
+struct RainLocation {
+	uint8 location;
+	uint8 x, y;
+	uint8 rainSpace;
+};
+
+void DreamGenContext::initrain() {
+	Rain *rainList = (Rain *)segRef(data.word(kBuffers)).ptr(kRainlist, 0);
+	Rain *rain = rainList;
+	const RainLocation *rainLocationList = (const RainLocation *)cs.ptr(offset_rainlocations, 0);
+	const RainLocation *rainLocation = rainLocationList;
+
+	do {
+		if (rainLocation->location == 0xff) {
+			rain->x = 0xff;
+			return;
+		}
+		if ((rainLocation->location == data.byte(kReallocation)) &&
+		    (rainLocation->x == data.byte(kMapx)) &&
+  		    (rainLocation->y == data.byte(kMapy))) {
+			data.byte(kRainspace) = rainLocation->rainSpace;
+			break;
+		}
+		++rainLocation;
+	} while (true);
+
+	uint8 x = 4;
+	do {
+		uint8 delta = (engine->randomNumber() & 31) + 3;
+		if (delta >= data.byte(kRainspace))
+			continue;
+		x += delta;
+		if (x >= data.byte(kMapxsize))
+			break;
+		rain = splitintolines(x, 0, rain);
+	} while (true);
+	uint8 y = 0;
+	do {
+		uint8 delta = (engine->randomNumber() & 31) + 3;
+		if (delta >= data.byte(kRainspace))
+			continue;
+		y += delta;
+		if (y >= data.byte(kMapysize))
+			break;
+		rain = splitintolines(data.byte(kMapxsize) - 1, y, rain);
+	} while (true);
+
+	rain->x = 0xff;
+}
+
 } /*namespace dreamgen */
 






More information about the Scummvm-git-logs mailing list