diff options
| author | Eugene Sandulenko | 2013-08-05 00:17:53 +0300 | 
|---|---|---|
| committer | Eugene Sandulenko | 2013-09-06 14:51:10 +0300 | 
| commit | 35fbf39448f2450db4d03760a0a1e227a68c9cb0 (patch) | |
| tree | 47ccac29bde6a16c726f702efc7f3f57db6f0242 /engines/fullpipe/statics.cpp | |
| parent | 766c5552fe7162246afc46070c1bb27aa2ef2963 (diff) | |
| download | scummvm-rg350-35fbf39448f2450db4d03760a0a1e227a68c9cb0.tar.gz scummvm-rg350-35fbf39448f2450db4d03760a0a1e227a68c9cb0.tar.bz2 scummvm-rg350-35fbf39448f2450db4d03760a0a1e227a68c9cb0.zip | |
FULLPIPE: Implement Movement::gotoNextFrame()
Diffstat (limited to 'engines/fullpipe/statics.cpp')
| -rw-r--r-- | engines/fullpipe/statics.cpp | 103 | 
1 files changed, 102 insertions, 1 deletions
| diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 20ce75f365..0bb61fb803 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -641,7 +641,108 @@ void Movement::removeFirstPhase() {  }  void Movement::gotoNextFrame(int callback1, int callback2) { -	warning("STUB: Movement::gotoNextFrame()"); +	if (!callback2) { +		if (_currMovement) { +			if ((uint)_currDynamicPhaseIndex == _currMovement->_dynamicPhases.size() - 1 +				&& !(((DynamicPhase *)(_currMovement->_dynamicPhases.back()))->_countdown)) +				return; +		} else if ((uint)_currDynamicPhaseIndex == _dynamicPhases.size() - 1 +					&& !(((DynamicPhase *)(_dynamicPhases.back()))->_countdown)) +			return; +	} + +	if (_currDynamicPhase->_countdown) { +		_currDynamicPhase->_countdown--; +		return; +	} + +	Common::Point point; + +	getCurrDynamicPhaseXY(point); +	_ox -= point.x; +	_oy -= point.y; + +	int deltax = 0; + +	if (_currMovement) +		deltax = _currMovement->getDimensionsOfPhase(&point, _currDynamicPhaseIndex)->x; + +	int oldDynIndex = _currDynamicPhaseIndex; + +	if (callback2) +		; //callback2(&_currDynamicPhaseIndex); +	else +		_currDynamicPhaseIndex++; + +	if (_currMovement) { +		if (_currMovement->_dynamicPhases.size() <= (uint)_currDynamicPhaseIndex) +			_currDynamicPhaseIndex = _currMovement->_dynamicPhases.size() - 1; +		if (_currDynamicPhaseIndex < 0) +			_currDynamicPhaseIndex = 0; +		if (_currMovement->_framePosOffsets) { +			if (callback1) { +				point = *_currMovement->_framePosOffsets[_currDynamicPhaseIndex]; +				//callback1(_currDynamicPhaseIndex, &point, _ox, _oy); + +				_ox += deltax - point.x; +				_oy += point.y; + +				_ox -= _currMovement->getDimensionsOfPhase(&point, _currDynamicPhaseIndex)->x; +			} else if (oldDynIndex >= _currDynamicPhaseIndex) { +				while (oldDynIndex > _currDynamicPhaseIndex) { +					_ox += deltax; +					deltax = _currMovement->getDimensionsOfPhase(&point, oldDynIndex)->x; + +					_ox += _currMovement->_framePosOffsets[oldDynIndex]->x; +					_oy -= _currMovement->_framePosOffsets[oldDynIndex]->y; +					oldDynIndex--; + +					_ox -= _currMovement->getDimensionsOfPhase(&point, oldDynIndex)->x; +				} +			} else { +				for (int i = oldDynIndex + 1; i <= _currDynamicPhaseIndex; i++) { +					_ox += deltax; +					deltax = _currMovement->getDimensionsOfPhase(&point, i)->x; +					_ox -= _currMovement->_framePosOffsets[i]->x; +					_oy += _currMovement->_framePosOffsets[i]->y; +					_ox -= _currMovement->getDimensionsOfPhase(&point, i)->x; +				} +			} +		} +	} else { +		if (_dynamicPhases.size() <= (uint)_currDynamicPhaseIndex) +			_currDynamicPhaseIndex = _dynamicPhases.size() - 1; +		if (_currDynamicPhaseIndex < 0) +			_currDynamicPhaseIndex = 0; + +		if (_framePosOffsets) { +			if (callback1) { +				point.x = _framePosOffsets[_currDynamicPhaseIndex]->x; +				point.y = _framePosOffsets[_currDynamicPhaseIndex]->y; + +				//callback1(_currDynamicPhaseIndex, &point, _ox, _oy); +				_ox += point.x; +				_oy += point.y; +			} else if (oldDynIndex >= _currDynamicPhaseIndex) { +				for (int i = oldDynIndex; i > _currDynamicPhaseIndex; i--) { +					_ox -= _framePosOffsets[i]->x; +					_oy -= _framePosOffsets[i]->y; +				} +			} else { +				for (int i = oldDynIndex + 1; i <= _currDynamicPhaseIndex; i++) { +					_ox += _framePosOffsets[i]->x; +					_oy += _framePosOffsets[i]->y; +				} +			} +		} +	} + +	updateCurrDynamicPhase(); +	getCurrDynamicPhaseXY(point); +	_ox += point.x; +	_oy += point.y; + +	_currDynamicPhase->_countdown = _currDynamicPhase->_initialCountdown;  }  void Movement::gotoPrevFrame(int callback1, int callback2) { | 
