diff options
| author | Bertrand Augereau | 2011-08-19 10:35:29 +0200 | 
|---|---|---|
| committer | Bertrand Augereau | 2011-08-20 12:09:24 +0200 | 
| commit | 663ca4774f2a51287212140b39a4c1e96309a06d (patch) | |
| tree | 3745e94e906b540252f03ad88b088af44cebf08c | |
| parent | a21133ed12228e9a818b696bbc148f5b53946a30 (diff) | |
| download | scummvm-rg350-663ca4774f2a51287212140b39a4c1e96309a06d.tar.gz scummvm-rg350-663ca4774f2a51287212140b39a4c1e96309a06d.tar.bz2 scummvm-rg350-663ca4774f2a51287212140b39a4c1e96309a06d.zip  | |
DREAMWEB: 'findormake' ported to C++
| -rwxr-xr-x | devtools/tasmrecover/tasm-recover | 1 | ||||
| -rw-r--r-- | engines/dreamweb/dreamgen.cpp | 30 | ||||
| -rw-r--r-- | engines/dreamweb/dreamgen.h | 13 | ||||
| -rw-r--r-- | engines/dreamweb/structs.h | 8 | ||||
| -rw-r--r-- | engines/dreamweb/stubs.cpp | 25 | ||||
| -rw-r--r-- | engines/dreamweb/stubs.h | 2 | 
6 files changed, 42 insertions, 37 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index 2c785ec32c..0de0b840aa 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 a20d03c6b0..789a016f6b 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 028df367a0..9496c50607 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 8a9d81c9a5..8b8e1153e5 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 7d809f2ca0..76f6de4d7c 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 705fcd90f1..dd5b6399e7 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();  | 
