aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/mult_v2.cpp
diff options
context:
space:
mode:
authorSven Hesse2008-05-07 02:56:18 +0000
committerSven Hesse2008-05-07 02:56:18 +0000
commit5681ae1e82ba2c125928ecbfbd937cb187c06aa4 (patch)
treecba149be0c1e7639633a435bfbd499e86429820f /engines/gob/mult_v2.cpp
parentf1514641ee8263503e59654fc46856364a96e144 (diff)
downloadscummvm-rg350-5681ae1e82ba2c125928ecbfbd937cb187c06aa4.tar.gz
scummvm-rg350-5681ae1e82ba2c125928ecbfbd937cb187c06aa4.tar.bz2
scummvm-rg350-5681ae1e82ba2c125928ecbfbd937cb187c06aa4.zip
Draw order related fixes.
This also (finally) fixes the Gob3 draw order glitch (for real, this time) svn-id: r31915
Diffstat (limited to 'engines/gob/mult_v2.cpp')
-rw-r--r--engines/gob/mult_v2.cpp100
1 files changed, 49 insertions, 51 deletions
diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp
index 02211880ba..9045089632 100644
--- a/engines/gob/mult_v2.cpp
+++ b/engines/gob/mult_v2.cpp
@@ -526,14 +526,14 @@ void Mult_v2::playMultInit() {
delete[] _animArrayData;
_objects = new Mult_Object[_objCount];
- _orderArray = new uint8[_objCount];
+ _orderArray = new int8[_objCount];
_renderObjs = new Mult_Object*[_objCount];
_animArrayX = new int32[_objCount];
_animArrayY = new int32[_objCount];
_animArrayData = new Mult_AnimData[_objCount];
memset(_objects, 0, _objCount * sizeof(Mult_Object));
- memset(_orderArray, 0, _objCount * sizeof(uint8));
+ memset(_orderArray, 0, _objCount * sizeof(int8));
memset(_renderObjs, 0, _objCount * sizeof(Mult_Object *));
memset(_animArrayX, 0, _objCount * sizeof(int32));
memset(_animArrayY, 0, _objCount * sizeof(int32));
@@ -768,9 +768,9 @@ void Mult_v2::newCycleAnim(Mult_Object &animObj) {
}
void Mult_v2::animate() {
- uint8 minOrder = 100;
- uint8 maxOrder = 0;
- uint8 *orderArray;
+ int8 minOrder = 100;
+ int8 maxOrder = 0;
+ int8 *orderArray;
int orderArrayPos = 0;
int8 animIndices[150];
int numAnims = 0;
@@ -952,60 +952,58 @@ void Mult_v2::animate() {
Mult_Object &animObj1 = *_renderObjs[orderArray[i]];
Mult_AnimData &animData1 = *(animObj1.pAnimData);
- if (!animObj1.needRedraw && !animData1.isStatic) {
- for (int j = 0; j < orderArrayPos; j++) {
- Mult_Object &animObj2 = *_renderObjs[orderArray[j]];
+ if (!animObj1.needRedraw) {
- if (!animObj2.needRedraw)
- continue;
+ if (!animData1.isStatic) {
+ for (int j = 0; j < orderArrayPos; j++) {
+ Mult_Object &animObj2 = *_renderObjs[orderArray[j]];
- if ((animObj1.newRight >= animObj2.newLeft) &&
- (animObj2.newRight >= animObj1.newLeft) &&
- (animObj1.newBottom >= animObj2.newTop) &&
- (animObj2.newBottom >= animObj1.newTop)) {
+ if (!animObj2.needRedraw)
+ continue;
- _vm->_scenery->_toRedrawLeft = animObj2.newLeft;
- _vm->_scenery->_toRedrawRight = animObj2.newRight;
- _vm->_scenery->_toRedrawTop = animObj2.newTop;
- _vm->_scenery->_toRedrawBottom = animObj2.newBottom;
+ if ((animObj1.newRight >= animObj2.newLeft) &&
+ (animObj2.newRight >= animObj1.newLeft) &&
+ (animObj1.newBottom >= animObj2.newTop) &&
+ (animObj2.newBottom >= animObj1.newTop)) {
- _vm->_scenery->updateAnim(animData1.layer, animData1.frame,
- animData1.animation, 12, *animObj1.pPosX, *animObj1.pPosY, 1);
- _vm->_scenery->updateStatic(animData1.order + 1);
+ _vm->_scenery->_toRedrawLeft = animObj2.newLeft;
+ _vm->_scenery->_toRedrawRight = animObj2.newRight;
+ _vm->_scenery->_toRedrawTop = animObj2.newTop;
+ _vm->_scenery->_toRedrawBottom = animObj2.newBottom;
+
+ _vm->_scenery->updateAnim(animData1.layer, animData1.frame,
+ animData1.animation, 12, *animObj1.pPosX, *animObj1.pPosY, 1);
+ _vm->_scenery->updateStatic(animData1.order + 1);
+ }
}
}
- } else if (!animData1.isStatic) {
- _vm->_scenery->updateAnim(animData1.layer, animData1.frame,
- animData1.animation, 10, *animObj1.pPosX, *animObj1.pPosY, 1);
-
- if (_vm->_scenery->_toRedrawLeft != -12345) {
- if (_vm->_global->_pressedKeys[0x36]) {
- _vm->_video->drawLine(_vm->_draw->_frontSurface,
- _vm->_scenery->_toRedrawLeft, _vm->_scenery->_toRedrawTop,
- _vm->_scenery->_toRedrawRight, _vm->_scenery->_toRedrawTop, 15);
- _vm->_video->drawLine(_vm->_draw->_frontSurface,
- _vm->_scenery->_toRedrawLeft, _vm->_scenery->_toRedrawBottom,
- _vm->_scenery->_toRedrawRight, _vm->_scenery->_toRedrawBottom, 15);
- _vm->_video->drawLine(_vm->_draw->_frontSurface,
- _vm->_scenery->_toRedrawLeft, _vm->_scenery->_toRedrawTop,
- _vm->_scenery->_toRedrawLeft, _vm->_scenery->_toRedrawBottom, 15);
- _vm->_video->drawLine(_vm->_draw->_frontSurface,
- _vm->_scenery->_toRedrawRight, _vm->_scenery->_toRedrawTop,
- _vm->_scenery->_toRedrawRight, _vm->_scenery->_toRedrawBottom, 15);
- }
- animObj1.lastLeft = _vm->_scenery->_toRedrawLeft;
- animObj1.lastRight = _vm->_scenery->_toRedrawRight;
- animObj1.lastTop = _vm->_scenery->_toRedrawTop;
- animObj1.lastBottom = _vm->_scenery->_toRedrawBottom;
- } else
- animObj1.lastLeft = -1;
+
} else {
- _vm->_scenery->_toRedrawLeft = animObj1.newLeft;
- _vm->_scenery->_toRedrawRight = animObj1.newRight;
- _vm->_scenery->_toRedrawTop = animObj1.newTop;
- _vm->_scenery->_toRedrawBottom = animObj1.newBottom;
+
+ if (animData1.isStatic != 0) {
+ _vm->_scenery->_toRedrawLeft = animObj1.newLeft;
+ _vm->_scenery->_toRedrawRight = animObj1.newRight;
+ _vm->_scenery->_toRedrawTop = animObj1.newTop;
+ _vm->_scenery->_toRedrawBottom = animObj1.newBottom;
+ } else {
+ _vm->_scenery->updateAnim(animData1.layer, animData1.frame,
+ animData1.animation, 10, *animObj1.pPosX, *animObj1.pPosY, 1);
+
+ if (_vm->_scenery->_toRedrawLeft != -12345) {
+ animObj1.lastLeft = _vm->_scenery->_toRedrawLeft;
+ animObj1.lastRight = _vm->_scenery->_toRedrawRight;
+ animObj1.lastTop = _vm->_scenery->_toRedrawTop;
+ animObj1.lastBottom = _vm->_scenery->_toRedrawBottom;
+ } else {
+ animObj1.lastLeft = -1;
+ }
+
+ }
+
+ _vm->_scenery->updateStatic(animData1.order + 1);
+
}
- _vm->_scenery->updateStatic(animData1.order + 1);
+
}
// Advance animations