[Scummvm-cvs-logs] scummvm master -> 6cab258032b72054f901d4a19a85ac6ef8ef4513

tramboi bertrand_augereau at yahoo.fr
Sat Aug 20 12:31:08 CEST 2011


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

Summary:
663ca4774f DREAMWEB: 'findormake' ported to C++
eaa342fdd8 DREAMWEB: 'setallchanges' ported to C++
6cab258032 DREAMWEB: Ported 'dochange' to C++


Commit: 663ca4774f2a51287212140b39a4c1e96309a06d
    https://github.com/scummvm/scummvm/commit/663ca4774f2a51287212140b39a4c1e96309a06d
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2011-08-20T03:09:24-07:00

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

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



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 2c785ec..0de0b84 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -134,6 +134,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'walktotext',
 	'personnametext',
 	'findxyfrompath',
+	'findormake',
 	], skip_output = [
 	# These functions are processed but not output
 	'dreamweb',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index a20d03c..789a016 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -11328,35 +11328,6 @@ void DreamGenContext::removefreeobject() {
 	es = pop();
 }
 
-void DreamGenContext::findormake() {
-	STACK_CHECK;
-	bx = (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));
-	push(ax);
-	es = data.word(kBuffers);
-	ah = data.byte(kReallocation);
-changeloop:
-	_cmp(es.byte(bx), 255);
-	if (flags.z())
-		goto haventfound;
-	_cmp(ax, es.word(bx));
-	if (!flags.z())
-		goto nofoundchange;
-	_cmp(ch, es.byte(bx+3));
-	if (flags.z())
-		goto foundchange;
-nofoundchange:
-	_add(bx, 4);
-	goto changeloop;
-foundchange:
-	ax = pop();
-	es.byte(bx+2) = cl;
-	return;
-haventfound:
-	es.word(bx) = ax;
-	es.word(bx+2) = cx;
-	ax = pop();
-}
-
 void DreamGenContext::switchryanon() {
 	STACK_CHECK;
 	data.byte(kRyanon) = 255;
@@ -18719,7 +18690,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
 		case addr_issetobonmap: issetobonmap(); break;
 		case addr_placefreeobject: placefreeobject(); break;
 		case addr_removefreeobject: removefreeobject(); break;
-		case addr_findormake: findormake(); break;
 		case addr_switchryanon: switchryanon(); break;
 		case addr_switchryanoff: switchryanoff(); break;
 		case addr_setallchanges: setallchanges(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 028df36..9496c50 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -307,7 +307,6 @@ public:
 	static const uint16 addr_setallchanges = 0xc704;
 	static const uint16 addr_switchryanoff = 0xc700;
 	static const uint16 addr_switchryanon = 0xc6fc;
-	static const uint16 addr_findormake = 0xc6f8;
 	static const uint16 addr_removefreeobject = 0xc6f4;
 	static const uint16 addr_placefreeobject = 0xc6f0;
 	static const uint16 addr_issetobonmap = 0xc6ec;
@@ -1372,6 +1371,7 @@ public:
 	void getexpos();
 	void fadedos();
 	//void fillspace();
+	void selectlocation();
 	//void multiget();
 	//void autosetwalk();
 	void fadeupmonfirst();
@@ -1407,7 +1407,7 @@ public:
 	void useelevator5();
 	void useelevator4();
 	void useelevator1();
-	void attendant();
+	//void findormake();
 	void useelevator3();
 	void useelevator2();
 	void buttonone();
@@ -1427,7 +1427,7 @@ public:
 	void slabdoore();
 	void slabdoord();
 	void adjustup();
-	void readsetdata();
+	void slabdoorf();
 	void loadintotemp();
 	void loadintroroom();
 	void saveseg();
@@ -1443,7 +1443,6 @@ public:
 	void showdiary();
 	void purgealocation();
 	//void updatepeople();
-	void slabdoorf();
 	void addtopeoplelist();
 	void hangoncurs();
 	void sparkydrip();
@@ -1571,7 +1570,7 @@ public:
 	//void doblocks();
 	void restoreall();
 	void allpalette();
-	void findormake();
+	void attendant();
 	void nextsymbol();
 	void monks2text();
 	void clearpalette();
@@ -1868,7 +1867,7 @@ public:
 	void calledensdlift();
 	void checkinside();
 	void gates();
-	void selectlocation();
+	void newgame();
 	void showwatch();
 	void turnanypathon();
 	void restorereels();
@@ -2025,7 +2024,7 @@ public:
 	void getridoftempsp();
 	void scanfornames();
 	void setallchanges();
-	void newgame();
+	void readsetdata();
 	//void printboth();
 	void standardload();
 	void undertextline();
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index 8a9d81c..8b8e115 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -194,3 +194,11 @@ struct Rain {
 	uint8 b5;
 };
 
+struct Change {
+	uint8 b0;
+	uint8 location;
+	uint8 b2;
+	uint8 b3;
+};
+
+
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 7d809f2..76f6de4 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1041,6 +1041,31 @@ void DreamGenContext::walktotext() {
 	commandwithob(3, data.byte(kCommandtype), data.byte(kCommand));
 }
 
+void DreamGenContext::findormake() {
+	uint8 b0 = al;
+	uint8 b2 = cl;
+	uint8 b3 = ch;
+	findormake(b0, b2, b3);
+}
+
+void DreamGenContext::findormake(uint8 b0, uint8 b2, uint8 b3) {
+	Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change));
+	while (true) {
+		if (change->b0 == 0xff) {
+			change->b0 = b0;
+			change->location = data.byte(kReallocation);
+			change->b2 = b2;
+			change->b3 = b3;
+			return;
+		}
+		if ((b0 == change->b0) && (data.byte(kReallocation) == change->location) && (b3 == change->b3)) {
+			change->b2 = b2;
+			return;
+		}
+		++change;
+	}
+}
+
 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
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 705fcd9..dd5b639 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -149,5 +149,7 @@
 	void walktotext();
 	void personnametext();
 	void findxyfrompath();
+	void findormake();
+	void findormake(uint8 b0, uint8 b2, uint8 b3);
 	bool isCD();
 


Commit: eaa342fdd88227e71ee95551a064f95df3eb0dd6
    https://github.com/scummvm/scummvm/commit/eaa342fdd88227e71ee95551a064f95df3eb0dd6
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2011-08-20T03:09:24-07:00

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

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



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 0de0b84..24d2199 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -135,6 +135,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'personnametext',
 	'findxyfrompath',
 	'findormake',
+	'setallchanges',
 	], skip_output = [
 	# These functions are processed but not output
 	'dreamweb',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 789a016..541a938 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -11338,28 +11338,6 @@ void DreamGenContext::switchryanoff() {
 	data.byte(kRyanon) = 1;
 }
 
-void DreamGenContext::setallchanges() {
-	STACK_CHECK;
-	es = data.word(kBuffers);
-	bx = (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));
-setallloop:
-	ax = es.word(bx);
-	_cmp(al, 255);
-	if (flags.z())
-		return /* (endsetloop) */;
-	cx = es.word(bx+2);
-	_add(bx, 4);
-	_cmp(ah, data.byte(kReallocation));
-	if (!flags.z())
-		goto setallloop;
-	push(es);
-	push(bx);
-	dochange();
-	bx = pop();
-	es = pop();
-	goto setallloop;
-}
-
 void DreamGenContext::dochange() {
 	STACK_CHECK;
 	_cmp(ch, 0);
@@ -18692,7 +18670,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
 		case addr_removefreeobject: removefreeobject(); break;
 		case addr_switchryanon: switchryanon(); break;
 		case addr_switchryanoff: switchryanoff(); break;
-		case addr_setallchanges: setallchanges(); break;
 		case addr_dochange: dochange(); break;
 		case addr_autoappear: autoappear(); break;
 		case addr_setuptimeduse: setuptimeduse(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 9496c50..8f14cbd 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -304,7 +304,6 @@ public:
 	static const uint16 addr_setuptimeduse = 0xc71c;
 	static const uint16 addr_autoappear = 0xc70c;
 	static const uint16 addr_dochange = 0xc708;
-	static const uint16 addr_setallchanges = 0xc704;
 	static const uint16 addr_switchryanoff = 0xc700;
 	static const uint16 addr_switchryanon = 0xc6fc;
 	static const uint16 addr_removefreeobject = 0xc6f4;
@@ -2023,7 +2022,7 @@ public:
 	void openhoteldoor2();
 	void getridoftempsp();
 	void scanfornames();
-	void setallchanges();
+	//void setallchanges();
 	void readsetdata();
 	//void printboth();
 	void standardload();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 76f6de4..0adb11e 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1066,6 +1066,20 @@ void DreamGenContext::findormake(uint8 b0, uint8 b2, uint8 b3) {
 	}
 }
 
+void DreamGenContext::setallchanges() {
+	Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change));
+	while (change->b0 != 0xff) {
+		if (change->location == data.byte(kReallocation)) {
+			al = change->b0;
+			ah = change->location;
+			cl = change->b2;
+			ch = change->b3;
+			dochange();
+		}
+		++change;
+	}
+}
+
 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
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index dd5b639..53d6458 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -151,5 +151,6 @@
 	void findxyfrompath();
 	void findormake();
 	void findormake(uint8 b0, uint8 b2, uint8 b3);
+	void setallchanges();
 	bool isCD();
 


Commit: 6cab258032b72054f901d4a19a85ac6ef8ef4513
    https://github.com/scummvm/scummvm/commit/6cab258032b72054f901d4a19a85ac6ef8ef4513
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2011-08-20T03:26:10-07:00

Commit Message:
DREAMWEB: Ported 'dochange' to C++

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



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 24d2199..c671111 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -136,6 +136,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'findxyfrompath',
 	'findormake',
 	'setallchanges',
+	'dochange',
 	], skip_output = [
 	# These functions are processed but not output
 	'dreamweb',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 541a938..0b3e57f 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -11338,48 +11338,6 @@ void DreamGenContext::switchryanoff() {
 	data.byte(kRyanon) = 1;
 }
 
-void DreamGenContext::dochange() {
-	STACK_CHECK;
-	_cmp(ch, 0);
-	if (flags.z())
-		goto object;
-	_cmp(ch, 1);
-	if (flags.z())
-		goto freeobject;
-	push(cx);
-	ah = 0;
-	_add(ax, ax);
-	_add(ax, ax);
-	_add(ax, ax);
-	push(ax);
-	al = ch;
-	_sub(al, 100);
-	ah = 0;
-	cx = 144;
-	_mul(cx);
-	bx = pop();
-	_add(bx, ax);
-	_add(bx, (0));
-	es = data.word(kReels);
-	cx = pop();
-	es.byte(bx+6) = cl;
-	return;
-object:
-	push(cx);
-	getsetad();
-	cx = pop();
-	es.byte(bx+58) = cl;
-	return;
-freeobject:
-	push(cx);
-	getfreead();
-	cx = pop();
-	_cmp(es.byte(bx+2), 255);
-	if (!flags.z())
-		return /* (beenpickedup) */;
-	es.byte(bx+2) = cl;
-}
-
 void DreamGenContext::autoappear() {
 	STACK_CHECK;
 	_cmp(data.byte(kLocation), 32);
@@ -18670,7 +18628,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
 		case addr_removefreeobject: removefreeobject(); break;
 		case addr_switchryanon: switchryanon(); break;
 		case addr_switchryanoff: switchryanoff(); break;
-		case addr_dochange: dochange(); break;
 		case addr_autoappear: autoappear(); break;
 		case addr_setuptimeduse: setuptimeduse(); break;
 		case addr_edenscdplayer: edenscdplayer(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 8f14cbd..7756a58 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -303,7 +303,6 @@ public:
 	static const uint16 addr_edenscdplayer = 0xc728;
 	static const uint16 addr_setuptimeduse = 0xc71c;
 	static const uint16 addr_autoappear = 0xc70c;
-	static const uint16 addr_dochange = 0xc708;
 	static const uint16 addr_switchryanoff = 0xc700;
 	static const uint16 addr_switchryanon = 0xc6fc;
 	static const uint16 addr_removefreeobject = 0xc6f4;
@@ -1389,7 +1388,7 @@ public:
 	void buttonfour();
 	void animpointer();
 	//void lockmon();
-	void dochange();
+	//void dochange();
 	void getanyaddir();
 	void showsaveops();
 	void intromonks1();
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index 8b8e115..e472561 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -105,6 +105,25 @@ struct ObjData {
 	uint8 b63;
 };
 
+struct FreeObject {
+	uint8 b0;
+	uint8 b1;
+	uint8 b2;
+	uint8 b3;
+	uint8 b4;
+	uint8 b5;
+	uint8 b6;
+	uint8 b7;
+	uint8 b8;
+	uint8 b9;
+	uint8 b10;
+	uint8 b11;
+	uint8 b12;
+	uint8 b13;
+	uint8 b14;
+	uint8 b15;
+};
+
 struct ObjPos {
 	uint8 xMin;
 	uint8 yMin;
@@ -195,10 +214,10 @@ struct Rain {
 };
 
 struct Change {
-	uint8 b0;
+	uint8 index;
 	uint8 location;
-	uint8 b2;
-	uint8 b3;
+	uint8 value;
+	uint8 type;
 };
 
 
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 0adb11e..39c6e14 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1048,18 +1048,18 @@ void DreamGenContext::findormake() {
 	findormake(b0, b2, b3);
 }
 
-void DreamGenContext::findormake(uint8 b0, uint8 b2, uint8 b3) {
+void DreamGenContext::findormake(uint8 index, uint8 value, uint8 type) {
 	Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change));
 	while (true) {
-		if (change->b0 == 0xff) {
-			change->b0 = b0;
+		if (change->index == 0xff) {
+			change->index = index;
 			change->location = data.byte(kReallocation);
-			change->b2 = b2;
-			change->b3 = b3;
+			change->value = value;
+			change->type = type;
 			return;
 		}
-		if ((b0 == change->b0) && (data.byte(kReallocation) == change->location) && (b3 == change->b3)) {
-			change->b2 = b2;
+		if ((index == change->index) && (data.byte(kReallocation) == change->location) && (type == change->type)) {
+			change->value = value;
 			return;
 		}
 		++change;
@@ -1068,18 +1068,39 @@ void DreamGenContext::findormake(uint8 b0, uint8 b2, uint8 b3) {
 
 void DreamGenContext::setallchanges() {
 	Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change));
-	while (change->b0 != 0xff) {
-		if (change->location == data.byte(kReallocation)) {
-			al = change->b0;
-			ah = change->location;
-			cl = change->b2;
-			ch = change->b3;
-			dochange();
-		}
+	while (change->index != 0xff) {
+		if (change->location == data.byte(kReallocation))
+			dochange(change->index, change->value, change->type);
 		++change;
 	}
 }
 
+FreeObject *DreamGenContext::getfreead(uint8 index) {
+	return (FreeObject *)segRef(data.word(kFreedat)).ptr(0, 0) + index;
+}
+
+ObjData *DreamGenContext::getsetad(uint8 index) {
+	return (ObjData *)segRef(data.word(kSetdat)).ptr(0, 0) + index;
+}
+
+void DreamGenContext::dochange() {
+	dochange(al, cl, ch);
+}
+
+void DreamGenContext::dochange(uint8 index, uint8 value, uint8 type) {
+	if (type == 0) { //object
+		getsetad(index)->b58[0] = value;
+	} else if (type == 1) { //freeobject
+		FreeObject *freeObject = getfreead(index);
+		if (freeObject->b2 == 0xff)
+			freeObject->b2 = value;
+	} else { //path
+		bx = kPathdata + (type - 100) * 144 + index * 8;
+		es = data.word(kReels);
+		es.byte(bx+6) = value;
+	}
+}
+
 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
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 53d6458..6d18ce4 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -150,7 +150,11 @@
 	void personnametext();
 	void findxyfrompath();
 	void findormake();
-	void findormake(uint8 b0, uint8 b2, uint8 b3);
+	void findormake(uint8 index, uint8 value, uint8 type);
+	FreeObject *getfreead(uint8 index);
+	ObjData *getsetad(uint8 index);
 	void setallchanges();
+	void dochange();
+	void dochange(uint8 index, uint8 value, uint8 type);
 	bool isCD();
 






More information about the Scummvm-git-logs mailing list