[Scummvm-cvs-logs] scummvm master -> 11ae1d594044051a0c6d19bf57dcec14904157b6

tramboi bertrand_augereau at yahoo.fr
Tue Nov 15 15:52:48 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:
11ae1d5940 DREAMWEB: 'splitintolines' ported to C++


Commit: 11ae1d594044051a0c6d19bf57dcec14904157b6
    https://github.com/scummvm/scummvm/commit/11ae1d594044051a0c6d19bf57dcec14904157b6
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2011-11-15T06:50:53-08:00

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

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



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 470209b..cb3fd41 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -209,6 +209,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'showwatch',
 	'roomname',
 	'transfertext',
+	'splitintolines',
 	], skip_output = [
 	# These functions are processed but not output
 	'dreamweb',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index aa1ea88..f33ee0c 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2329,62 +2329,6 @@ finishinitrain:
 	_stosb();
 }
 
-void DreamGenContext::splitintolines() {
-	STACK_CHECK;
-lookforlinestart:
-	getblockofpixel();
-	_cmp(al, 0);
-	if (!flags.z())
-		goto foundlinestart;
-	_dec(cl);
-	_inc(ch);
-	_cmp(cl, 0);
-	if (flags.z())
-		return /* (endofthisline) */;
-	_cmp(ch, data.byte(kMapysize));
-	if (!flags.c())
-		return /* (endofthisline) */;
-	goto lookforlinestart;
-foundlinestart:
-	es.word(di) = cx;
-	bh = 1;
-lookforlineend:
-	getblockofpixel();
-	_cmp(al, 0);
-	if (flags.z())
-		goto foundlineend;
-	_dec(cl);
-	_inc(ch);
-	_cmp(cl, 0);
-	if (flags.z())
-		goto foundlineend;
-	_cmp(ch, data.byte(kMapysize));
-	if (!flags.c())
-		goto foundlineend;
-	_inc(bh);
-	goto lookforlineend;
-foundlineend:
-	push(cx);
-	es.byte(di+2) = bh;
-	randomnumber();
-	es.byte(di+3) = al;
-	randomnumber();
-	es.byte(di+4) = al;
-	randomnumber();
-	_and(al, 3);
-	_add(al, 4);
-	es.byte(di+5) = al;
-	_add(di, 6);
-	cx = pop();
-	_cmp(cl, 0);
-	if (flags.z())
-		return /* (endofthisline) */;
-	_cmp(ch, data.byte(kMapysize));
-	if (!flags.c())
-		return /* (endofthisline) */;
-	goto lookforlinestart;
-}
-
 void DreamGenContext::liftnoise() {
 	STACK_CHECK;
 	_cmp(data.byte(kReallocation), 5);
@@ -16342,7 +16286,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
 		case addr_adjustright: adjustright(); break;
 		case addr_reminders: reminders(); break;
 		case addr_initrain: initrain(); break;
-		case addr_splitintolines: splitintolines(); break;
 		case addr_backobject: backobject(); break;
 		case addr_liftnoise: liftnoise(); break;
 		case addr_random: random(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 990bba0..8ff6bbe 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -541,7 +541,6 @@ public:
 	static const uint16 addr_random = 0xc17c;
 	static const uint16 addr_liftnoise = 0xc178;
 	static const uint16 addr_backobject = 0xc170;
-	static const uint16 addr_splitintolines = 0xc164;
 	static const uint16 addr_initrain = 0xc160;
 	static const uint16 addr_reminders = 0xc15c;
 	static const uint16 addr_adjustright = 0xc158;
@@ -1360,7 +1359,7 @@ public:
 	void watchcount();
 	void fadedownmon();
 	void loadcart();
-	//void calcfrframe();
+	//void splitintolines();
 	void bartender();
 	void eden();
 	void showdiary();
@@ -1882,7 +1881,7 @@ public:
 	void closefile();
 	void delcurs();
 	void randomaccess();
-	void splitintolines();
+	//void calcfrframe();
 	//void checkifex();
 	//void findobname();
 	void initialmoncols();
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index 3c3d148..7ac3a8a 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -890,5 +890,58 @@ void DreamGenContext::addtopeoplelist(ReelRoutine *routine) {
 	data.word(kListpos) += sizeof(People);
 }
 
+void DreamGenContext::splitintolines() {
+	uint8 x = cl;
+	uint8 y = ch;
+	Rain *rain = (Rain *)es.ptr(di, 0);
+	Rain *newRain = splitintolines(x, y, rain);
+	di += (newRain - rain) * sizeof(Rain);
+}
+
+Rain *DreamGenContext::splitintolines(uint8 x, uint8 y, Rain *rain) {
+	do {
+		// Look for line start
+		do {
+			if (getblockofpixel(x, y))
+				break;
+			--x;
+			++y;
+			if (x == 0)
+				return rain;
+			if (y >= data.byte(kMapysize))
+				return rain;
+		} while (true);
+
+		rain->x = x;
+		rain->y = y;
+
+		uint8 length = 1;
+
+		// Look for line end
+		do {
+			if (! getblockofpixel(x, y))
+				break;
+			--x;
+			++y;
+			if (x == 0)
+				break;
+			if (y >= data.byte(kMapysize))
+				break;
+			++length;
+		} while (true);
+
+		rain->size = length;
+		rain->w3_lo = engine->randomNumber();
+		rain->w3_hi = engine->randomNumber();
+		rain->b5 = (engine->randomNumber() & 3) + 4;
+		++rain;
+		if (x == 0)
+			return rain;
+		if (y >= data.byte(kMapysize))
+			return rain;
+	} while (true);
+	return rain;
+}
+
 } /*namespace dreamgen */
 
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index a838c77..31086d7 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -253,4 +253,6 @@
 	void showwatch();
 	void roomname();
 	void transfertext();
+	void splitintolines();
+	Rain *splitintolines(uint8 x, uint8 y, Rain *rain);
 






More information about the Scummvm-git-logs mailing list