diff options
| author | Sylvain Dupont | 2010-10-11 23:16:15 +0000 | 
|---|---|---|
| committer | Sylvain Dupont | 2010-10-11 23:16:15 +0000 | 
| commit | eb52eb32a065375ef996af438261be3b70a27c33 (patch) | |
| tree | 0472cfda64a05accf27041a62c7d07d114789c40 /engines/toon/flux.cpp | |
| parent | 95c0e6cc4270cc32e371094437c3a2beeb59eed6 (diff) | |
| download | scummvm-rg350-eb52eb32a065375ef996af438261be3b70a27c33.tar.gz scummvm-rg350-eb52eb32a065375ef996af438261be3b70a27c33.tar.bz2 scummvm-rg350-eb52eb32a065375ef996af438261be3b70a27c33.zip | |
TOON: Fixed Flux disappearing in barn when talking to the cow
Several animations are not present for every Flux facing.
There is an hardcoded table to handle this.
svn-id: r53157
Diffstat (limited to 'engines/toon/flux.cpp')
| -rw-r--r-- | engines/toon/flux.cpp | 33 | 
1 files changed, 33 insertions, 0 deletions
| diff --git a/engines/toon/flux.cpp b/engines/toon/flux.cpp index f7c6bebf0b..524b058e63 100644 --- a/engines/toon/flux.cpp +++ b/engines/toon/flux.cpp @@ -67,6 +67,39 @@ void CharacterFlux::playWalkAnim(int32 start, int32 end) {  	_animationInstance->setLooping(true);  } +int32 CharacterFlux::fixFacingForAnimation(int32 originalFacing, int32 animationId) { + +	static const byte fixFluxAnimationFacing[] = { +		0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +		0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xee, 0xff, 0xff, 0xff, +		0xff, 0xff, 0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x55, +		0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + +	byte animFacingFlag = fixFluxAnimationFacing[animationId]; +	int32 v5 = 1 << originalFacing; +	int32 v6 = 1 << originalFacing; +	int32 facingMask = 0; +	do { +		if ( v6 & animFacingFlag) { +			facingMask = v6; +		} else if (v5 & animFacingFlag) { +			facingMask = v5; +		} +		v5 >>= 1; +		v6 <<= 1; +	} +	while (!facingMask); + +	int32 finalFacing = 0; +	for (finalFacing = 0; ; ++finalFacing ) { +		facingMask >>= 1; +		if ( !facingMask ) +			break; +	} +	 +	return finalFacing; +} +  void CharacterFlux::setPosition(int32 x, int32 y) {  	debugC(5, kDebugCharacter, "setPosition(%d, %d)", x, y); | 
