aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukaslw2014-05-28 15:57:46 +0200
committerlukaslw2014-06-22 20:08:18 +0200
commitac845b5b98849ed328534abe5dd82e528255ae05 (patch)
tree60e36442468c136bb011b6fbba631d2f18dd52d1
parentada532cf2ead17e5e7e2483328a14d1907ad9e7b (diff)
downloadscummvm-rg350-ac845b5b98849ed328534abe5dd82e528255ae05.tar.gz
scummvm-rg350-ac845b5b98849ed328534abe5dd82e528255ae05.tar.bz2
scummvm-rg350-ac845b5b98849ed328534abe5dd82e528255ae05.zip
PRINCE: showBackAnims bug fixing
-rw-r--r--engines/prince/prince.cpp38
1 files changed, 30 insertions, 8 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index 48bf932f41..73789efedb 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -784,13 +784,17 @@ void PrinceEngine::showBackAnims() {
//change_back_anim
if (_backAnimList[i]._seq._type == 0) {
//show_bugger
- _backAnimList[i].backAnims[activeSubAnim]._frame++;
+ if (_backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseCount() > 1) {
+ _backAnimList[i].backAnims[activeSubAnim]._frame++;
+ }
//not_end
} else if (_backAnimList[i]._seq._type == 1) {
//repeat_rnd
if (_backAnimList[i]._seq._anims <= 1) {
//show_bugger
- _backAnimList[i].backAnims[activeSubAnim]._frame++;
+ if (_backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseCount() > 1) {
+ _backAnimList[i].backAnims[activeSubAnim]._frame++;
+ }
//not_end
} else {
int rnd;
@@ -816,7 +820,9 @@ void PrinceEngine::showBackAnims() {
_backAnimList[i]._seq._counter = 0;
_backAnimList[i].backAnims[activeSubAnim]._state = 0;
//show_bugger
- _backAnimList[i].backAnims[activeSubAnim]._frame++;
+ if (_backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseCount() > 1) {
+ _backAnimList[i].backAnims[activeSubAnim]._frame++;
+ }
//not_end
}
} else if (_backAnimList[i]._seq._type == 2) {
@@ -884,11 +890,27 @@ void PrinceEngine::showBackAnims() {
_backAnimList[i].backAnims[activeSubAnim]._showFrame = _backAnimList[i].backAnims[activeSubAnim]._frame;
//ShowFrameCode
- int frame = _backAnimList[i].backAnims[activeSubAnim]._showFrame;
- int phaseFrameIndex = _backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseFrameIndex(frame);
- Graphics::Surface *backAnimSurface = _backAnimList[i].backAnims[activeSubAnim]._animData->getFrame(phaseFrameIndex);
- int x = _backAnimList[i].backAnims[activeSubAnim]._x + _backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseOffsetX(frame);
- int y = _backAnimList[i].backAnims[activeSubAnim]._y + _backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseOffsetY(frame);
+ int phaseCount = _backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseCount();
+ int frameCount = _backAnimList[i].backAnims[activeSubAnim]._animData->getFrameCount();
+ //debug("frameCount: %d", frameCount);
+ //debug("phaseCount: %d", phaseCount);
+ int phase = _backAnimList[i].backAnims[activeSubAnim]._showFrame;
+ if (phase >= phaseCount) {
+ debug("p >= pC: i-%d, activ-%d, phase-%d, phaseC-%d", i, activeSubAnim, phase, phaseCount);
+ debug("type: %d", _backAnimList[i]._seq._type);
+ }
+ int phaseFrameIndex = _backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseFrameIndex(phase);
+ if (phaseFrameIndex < 0) {
+ debug("pFrameIndex: i-%d, activ-%d, phaseFrInd-%d, frameC-%d", i, activeSubAnim, phaseFrameIndex, frameCount);
+ debug("type: %d", _backAnimList[i]._seq._type);
+ }
+ if (phaseFrameIndex >= frameCount) {
+ debug("pFrameIndex2: i-%d, activ-%d, phaseFrInd-%d, frameC-%d", i, activeSubAnim, phaseFrameIndex, frameCount);
+ debug("type: %d", _backAnimList[i]._seq._type);
+ }
+ Graphics::Surface *backAnimSurface = _backAnimList[i].backAnims[activeSubAnim]._animData->getFrame(phaseFrameIndex); //still out of bounds
+ int x = _backAnimList[i].backAnims[activeSubAnim]._x + _backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseOffsetX(phase);
+ int y = _backAnimList[i].backAnims[activeSubAnim]._y + _backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseOffsetY(phase);
//debug("x: %d", x);
//debug("picWindowX: %d", _picWindowX);
//if (x >= _picWindowX) { // || x - _picWindowX + _backAnimList[i].backAnims[activeSubAnim]._animData->getPhaseOffsetX(frame) >= 0 ??