diff options
| -rwxr-xr-x | devtools/tasmrecover/tasm-recover | 3 | ||||
| -rw-r--r-- | engines/dreamweb/dreamgen.cpp | 67 | ||||
| -rw-r--r-- | engines/dreamweb/sprite.cpp | 50 | 
3 files changed, 52 insertions, 68 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index cb3fd41ba8..88156b139a 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 f33ee0c8d2..6643ab0204 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 6c8c8db86b..f6083ff705 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 */  | 
