aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSven Hesse2006-07-08 16:37:23 +0000
committerSven Hesse2006-07-08 16:37:23 +0000
commitb7997a723105534dcefe50ae5b1448638480f0da (patch)
treeaefb4b62b77d618f7a114c031f9ac065e831abe3 /engines
parent5aff1df2200e9d12a87d4ce4d6d146b17b0b5467 (diff)
downloadscummvm-rg350-b7997a723105534dcefe50ae5b1448638480f0da.tar.gz
scummvm-rg350-b7997a723105534dcefe50ae5b1448638480f0da.tar.bz2
scummvm-rg350-b7997a723105534dcefe50ae5b1448638480f0da.zip
- Fixed a few mistakes that added up to look correct, fixing bargon's cursor
- Updated cursor drawing in general svn-id: r23429
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/draw.cpp132
-rw-r--r--engines/gob/draw.h9
-rw-r--r--engines/gob/draw_v1.cpp132
-rw-r--r--engines/gob/draw_v2.cpp175
-rw-r--r--engines/gob/game_v2.cpp2
-rw-r--r--engines/gob/goblin_v2.cpp2
-rw-r--r--engines/gob/inter.h1
-rw-r--r--engines/gob/inter_v1.cpp15
-rw-r--r--engines/gob/inter_v2.cpp37
-rw-r--r--engines/gob/map.h4
-rw-r--r--engines/gob/map_v2.cpp2
-rw-r--r--engines/gob/mult.cpp17
-rw-r--r--engines/gob/mult.h1
-rw-r--r--engines/gob/mult_v2.cpp4
-rw-r--r--engines/gob/scenery.cpp2
-rw-r--r--engines/gob/util.h16
16 files changed, 360 insertions, 191 deletions
diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp
index ff023640af..4d305c49a1 100644
--- a/engines/gob/draw.cpp
+++ b/engines/gob/draw.cpp
@@ -306,138 +306,6 @@ void Draw::clearPalette(void) {
}
}
-void Draw::blitCursor(void) {
- if (_cursorIndex == -1)
- return;
-
- _cursorIndex = -1;
-
- if (_noInvalidated) {
- _vm->_video->drawSprite(_backSurface, _frontSurface,
- _cursorX, _cursorY,
- _cursorX + _cursorWidth - 1,
- _cursorY + _cursorHeight - 1, _cursorX,
- _cursorY, 0);
- } else {
- invalidateRect(_cursorX, _cursorY,
- _cursorX + _cursorWidth - 1,
- _cursorY + _cursorHeight - 1);
- }
-}
-
-void Draw::animateCursor(int16 cursor) {
- int16 newX = 0;
- int16 newY = 0;
- Game::Collision *ptr;
- int16 minX;
- int16 minY;
- int16 maxX;
- int16 maxY;
- int16 cursorIndex;
-
- cursorIndex = cursor;
-
- if (cursorIndex == -1) {
- cursorIndex = 0;
- for (ptr = _vm->_game->_collisionAreas; ptr->left != -1; ptr++) {
- if (ptr->flags & 0xfff0)
- continue;
-
- if (ptr->left > _vm->_global->_inter_mouseX)
- continue;
-
- if (ptr->right < _vm->_global->_inter_mouseX)
- continue;
-
- if (ptr->top > _vm->_global->_inter_mouseY)
- continue;
-
- if (ptr->bottom < _vm->_global->_inter_mouseY)
- continue;
-
- if ((ptr->flags & 0xf) < 3)
- cursorIndex = 1;
- else
- cursorIndex = 3;
- break;
- }
- if (_cursorAnimLow[cursorIndex] == -1)
- cursorIndex = 1;
- }
-
- if (_cursorAnimLow[cursorIndex] != -1) {
- if (cursorIndex == _cursorIndex) {
- if (_cursorAnimDelays[_cursorIndex] != 0 &&
- _cursorAnimDelays[_cursorIndex] * 10 +
- _cursorTimeKey <= _vm->_util->getTimeKey()) {
- _cursorAnim++;
- _cursorTimeKey = _vm->_util->getTimeKey();
- } else {
-/* if (_noInvalidated &&
- inter_mouseX == _cursorX && inter_mouseY == _cursorY)
- return;*/
- }
- } else {
- _cursorIndex = cursorIndex;
- if (_cursorAnimDelays[_cursorIndex] != 0) {
- _cursorAnim =
- _cursorAnimLow[_cursorIndex];
- _cursorTimeKey = _vm->_util->getTimeKey();
- } else {
- _cursorAnim = _cursorIndex;
- }
- }
-
- if (_cursorAnimDelays[_cursorIndex] != 0 &&
- (_cursorAnimHigh[_cursorIndex] < _cursorAnim ||
- _cursorAnimLow[_cursorIndex] >
- _cursorAnim)) {
- _cursorAnim = _cursorAnimLow[_cursorIndex];
- }
-
- newX = _vm->_global->_inter_mouseX;
- newY = _vm->_global->_inter_mouseY;
- if (_cursorXDeltaVar != -1) {
- newX -= (uint16)VAR_OFFSET(_cursorIndex * 4 + (_cursorXDeltaVar / 4) * 4);
- newY -= (uint16)VAR_OFFSET(_cursorIndex * 4 + (_cursorYDeltaVar / 4) * 4);
- }
-
- minX = MIN(newX, _cursorX);
- minY = MIN(newY, _cursorY);
- maxX = MAX(_cursorX, newX) + _cursorWidth - 1;
- maxY = MAX(_cursorY, newY) + _cursorHeight - 1;
- _vm->_video->drawSprite(_backSurface, _cursorBack,
- newX, newY, newX + _cursorWidth - 1,
- newY + _cursorHeight - 1, 0, 0, 0);
-
- _vm->_video->drawSprite(_cursorSprites, _backSurface,
- _cursorWidth * _cursorAnim, 0,
- _cursorWidth * (_cursorAnim + 1) - 1,
- _cursorHeight - 1, newX, newY, _transparentCursor);
-
- if (_noInvalidated == 0) {
- cursorIndex = _cursorIndex;
- _cursorIndex = -1;
- blitInvalidated();
- _cursorIndex = cursorIndex;
- } else {
- _vm->_video->waitRetrace(_vm->_global->_videoMode);
- }
-
- _vm->_video->drawSprite(_backSurface, _frontSurface,
- minX, minY, maxX, maxY, minX, minY, 0);
-
- _vm->_video->drawSprite(_cursorBack, _backSurface,
- 0, 0, _cursorWidth - 1, _cursorHeight - 1,
- newX, newY, 0);
- } else {
- blitCursor();
- }
-
- _cursorX = newX;
- _cursorY = newY;
-}
-
void Draw::freeSprite(int16 index) {
int i;
diff --git a/engines/gob/draw.h b/engines/gob/draw.h
index f9350b816d..7010f95425 100644
--- a/engines/gob/draw.h
+++ b/engines/gob/draw.h
@@ -113,9 +113,6 @@ public:
void blitInvalidated(void);
void setPalette(void);
void clearPalette(void);
- void blitCursor(void);
-
- void animateCursor(int16 cursor);
void freeSprite(int16 index);
void adjustCoords(char adjust, int16 *coord1, int16 *coord2);
@@ -135,6 +132,8 @@ public:
virtual void initBigSprite(int16 index, int16 width, int16 height, int16 flags) = 0;
virtual void printText(void) = 0;
virtual void spriteOperation(int16 operation) = 0;
+ virtual void blitCursor(void) = 0;
+ virtual void animateCursor(int16 cursor) = 0;
Draw(GobEngine *vm);
virtual ~Draw() {};
@@ -148,6 +147,8 @@ public:
virtual void initBigSprite(int16 index, int16 width, int16 height, int16 flags);
virtual void printText(void);
virtual void spriteOperation(int16 operation);
+ virtual void blitCursor(void);
+ virtual void animateCursor(int16 cursor);
Draw_v1(GobEngine *vm);
virtual ~Draw_v1() {};
@@ -158,6 +159,8 @@ public:
virtual void initBigSprite(int16 index, int16 width, int16 height, int16 flags);
virtual void printText(void);
virtual void spriteOperation(int16 operation);
+ virtual void blitCursor(void);
+ virtual void animateCursor(int16 cursor);
Draw_v2(GobEngine *vm);
virtual ~Draw_v2() {};
diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp
index 31377059b7..e355ebcfcb 100644
--- a/engines/gob/draw_v1.cpp
+++ b/engines/gob/draw_v1.cpp
@@ -489,4 +489,136 @@ void Draw_v1::spriteOperation(int16 operation) {
}
}
+void Draw_v1::blitCursor(void) {
+ if (_cursorIndex == -1)
+ return;
+
+ _cursorIndex = -1;
+
+ if (_noInvalidated) {
+ _vm->_video->drawSprite(_backSurface, _frontSurface,
+ _cursorX, _cursorY,
+ _cursorX + _cursorWidth - 1,
+ _cursorY + _cursorHeight - 1, _cursorX,
+ _cursorY, 0);
+ } else {
+ invalidateRect(_cursorX, _cursorY,
+ _cursorX + _cursorWidth - 1,
+ _cursorY + _cursorHeight - 1);
+ }
+}
+
+void Draw_v1::animateCursor(int16 cursor) {
+ int16 newX = 0;
+ int16 newY = 0;
+ Game::Collision *ptr;
+ int16 minX;
+ int16 minY;
+ int16 maxX;
+ int16 maxY;
+ int16 cursorIndex;
+
+ cursorIndex = cursor;
+
+ if (cursorIndex == -1) {
+ cursorIndex = 0;
+ for (ptr = _vm->_game->_collisionAreas; ptr->left != -1; ptr++) {
+ if (ptr->flags & 0xfff0)
+ continue;
+
+ if (ptr->left > _vm->_global->_inter_mouseX)
+ continue;
+
+ if (ptr->right < _vm->_global->_inter_mouseX)
+ continue;
+
+ if (ptr->top > _vm->_global->_inter_mouseY)
+ continue;
+
+ if (ptr->bottom < _vm->_global->_inter_mouseY)
+ continue;
+
+ if ((ptr->flags & 0xf) < 3)
+ cursorIndex = 1;
+ else
+ cursorIndex = 3;
+ break;
+ }
+ if (_cursorAnimLow[cursorIndex] == -1)
+ cursorIndex = 1;
+ }
+
+ if (_cursorAnimLow[cursorIndex] != -1) {
+ if (cursorIndex == _cursorIndex) {
+ if (_cursorAnimDelays[_cursorIndex] != 0 &&
+ _cursorAnimDelays[_cursorIndex] * 10 +
+ _cursorTimeKey <= _vm->_util->getTimeKey()) {
+ _cursorAnim++;
+ _cursorTimeKey = _vm->_util->getTimeKey();
+ } else {
+/* if (_noInvalidated &&
+ inter_mouseX == _cursorX && inter_mouseY == _cursorY)
+ return;*/
+ }
+ } else {
+ _cursorIndex = cursorIndex;
+ if (_cursorAnimDelays[_cursorIndex] != 0) {
+ _cursorAnim =
+ _cursorAnimLow[_cursorIndex];
+ _cursorTimeKey = _vm->_util->getTimeKey();
+ } else {
+ _cursorAnim = _cursorIndex;
+ }
+ }
+
+ if (_cursorAnimDelays[_cursorIndex] != 0 &&
+ (_cursorAnimHigh[_cursorIndex] < _cursorAnim ||
+ _cursorAnimLow[_cursorIndex] >
+ _cursorAnim)) {
+ _cursorAnim = _cursorAnimLow[_cursorIndex];
+ }
+
+ newX = _vm->_global->_inter_mouseX;
+ newY = _vm->_global->_inter_mouseY;
+ if (_cursorXDeltaVar != -1) {
+ newX -= (uint16)VAR_OFFSET(_cursorIndex * 4 + (_cursorXDeltaVar / 4) * 4);
+ newY -= (uint16)VAR_OFFSET(_cursorIndex * 4 + (_cursorYDeltaVar / 4) * 4);
+ }
+
+ minX = MIN(newX, _cursorX);
+ minY = MIN(newY, _cursorY);
+ maxX = MAX(_cursorX, newX) + _cursorWidth - 1;
+ maxY = MAX(_cursorY, newY) + _cursorHeight - 1;
+ _vm->_video->drawSprite(_backSurface, _cursorBack,
+ newX, newY, newX + _cursorWidth - 1,
+ newY + _cursorHeight - 1, 0, 0, 0);
+
+ _vm->_video->drawSprite(_cursorSprites, _backSurface,
+ _cursorWidth * _cursorAnim, 0,
+ _cursorWidth * (_cursorAnim + 1) - 1,
+ _cursorHeight - 1, newX, newY, _transparentCursor);
+
+ if (_noInvalidated == 0) {
+ cursorIndex = _cursorIndex;
+ _cursorIndex = -1;
+ blitInvalidated();
+ _cursorIndex = cursorIndex;
+ } else {
+ _vm->_video->waitRetrace(_vm->_global->_videoMode);
+ }
+
+ _vm->_video->drawSprite(_backSurface, _frontSurface,
+ minX, minY, maxX, maxY, minX, minY, 0);
+
+ _vm->_video->drawSprite(_cursorBack, _backSurface,
+ 0, 0, _cursorWidth - 1, _cursorHeight - 1,
+ newX, newY, 0);
+ } else {
+ blitCursor();
+ }
+
+ _cursorX = newX;
+ _cursorY = newY;
+}
+
} // End of namespace Gob
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp
index b9795153ca..af1d61fbb3 100644
--- a/engines/gob/draw_v2.cpp
+++ b/engines/gob/draw_v2.cpp
@@ -542,7 +542,8 @@ void Draw_v2::spriteOperation(int16 operation) {
_spriteBottom -= _frontSurface->height;
}
if (_destSurface == 21)
- invalidateRect(0, _frontSurface->height, 319, _frontSurface->height+_vm->_game->_off_2E51B->height-1);
+ invalidateRect(0, _frontSurface->height, 319,
+ _frontSurface->height + _vm->_game->_off_2E51B->height - 1);
destSurface += 4;
}
if ((_frontSurface->height <= _spriteTop) && (operation == DRAW_BLITSURF)
@@ -653,7 +654,8 @@ void Draw_v2::spriteOperation(int16 operation) {
break;
case DRAW_INVALIDATE:
- _vm->_video->drawCircle(_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _spriteRight, _frontColor);
+ _vm->_video->drawCircle(_spritesArray[_destSurface], _destSpriteX,
+ _destSpriteY, _spriteRight, _frontColor);
if (_destSurface == 21) {
invalidateRect(_destSpriteX - _spriteRight, _destSpriteY - _spriteBottom, // !!
_destSpriteX + _spriteRight,
@@ -734,8 +736,8 @@ void Draw_v2::spriteOperation(int16 operation) {
_vm->_video->drawLetter(_textToPrint[i], _destSpriteX,
_destSpriteY, _fonts[_fontIndex], _transparency,
_frontColor, _backColor, _spritesArray[_destSurface]);
- _destSpriteX +=
- *(((char*)_fonts[_fontIndex]->extraData) + (_textToPrint[i] - _fonts[_fontIndex]->startItem));
+ _destSpriteX += *(((char*)_fonts[_fontIndex]->extraData) +
+ (_textToPrint[i] - _fonts[_fontIndex]->startItem));
}
} else { // loc_DBE9
warning("Untested, does that work?");
@@ -874,4 +876,169 @@ void Draw_v2::spriteOperation(int16 operation) {
}
}
+void Draw_v2::blitCursor(void) {
+ int16 width;
+ int16 height;
+
+ if (_cursorIndex == -1)
+ return;
+
+ _cursorIndex = -1;
+ width = _cursorWidth;
+ height = _cursorHeight;
+ if(_backSurface->width < (_cursorX + _cursorWidth))
+ width -= _cursorX;
+ if(_backSurface->height < (_cursorY + _cursorHeight))
+ height -= _cursorY;
+ if (_frontSurface == _backSurface)
+ _vm->_video->drawSprite(_cursorBack, _frontSurface, 0, 0, width - 1, height - 1,
+ _cursorX, _cursorY, 0);
+ else if (_noInvalidated == 0)
+ invalidateRect(_cursorX, _cursorY, _cursorX + width - 1, _cursorY + height - 1);
+ else
+ _vm->_video->drawSprite(_backSurface, _frontSurface, _cursorX, _cursorY,
+ _cursorX + width - 1, _cursorY + height - 1, _cursorX, _cursorY, 0);
+}
+
+void Draw_v2::animateCursor(int16 cursor) {
+ int16 newX = 0;
+ int16 newY = 0;
+ Game::Collision *ptr;
+ int16 minX;
+ int16 minY;
+ int16 maxX;
+ int16 maxY;
+ int16 cursorIndex;
+ bool oldCursor;
+
+ oldCursor = _cursorIndex != -1;
+
+ if (((_backSurface->width - 9) < _vm->_global->_inter_mouseX) ||
+ ((_backSurface->height - 4) < _vm->_global->_inter_mouseY)) {
+ _vm->_global->_inter_mouseX = MIN((int) _vm->_global->_inter_mouseX, _backSurface->width - 9);
+ _vm->_global->_inter_mouseY = MIN((int) _vm->_global->_inter_mouseY, _backSurface->height - 4);
+ _vm->_util->setMousePos(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY);
+ }
+
+ // .-- _draw_animateCursorSUB1 ---
+ cursorIndex = cursor;
+ if (cursorIndex == -1) {
+ cursorIndex = 0;
+ for (ptr = _vm->_game->_collisionAreas; ptr->left != -1; ptr++) {
+ if ((ptr->flags & 0xF00) || (ptr->flags & 0x4000))
+ continue;
+
+ if (ptr->left > _vm->_global->_inter_mouseX)
+ continue;
+
+ if (ptr->right < _vm->_global->_inter_mouseX)
+ continue;
+
+ if (ptr->top > _vm->_global->_inter_mouseY)
+ continue;
+
+ if (ptr->bottom < _vm->_global->_inter_mouseY)
+ continue;
+
+ if ((ptr->flags & 0xF000) == 0) {
+ if ((ptr->flags & 0xF) >= 3) {
+ cursorIndex = 3;
+ break;
+ } else if (((ptr->flags & 0xF0) != 0x10) && (cursorIndex == 0))
+ cursorIndex = 1;
+ } else if (cursorIndex == 0)
+ cursorIndex = (ptr->flags >> 12) & 0xF;
+ }
+ if (_cursorAnimLow[cursorIndex] == -1)
+ cursorIndex = 1;
+ }
+ // '------
+
+ if (_cursorAnimLow[cursorIndex] != -1) {
+ // .-- _draw_animateCursorSUB2 ---
+ if (cursorIndex == _cursorIndex) {
+ if ((_cursorAnimDelays[_cursorIndex] != 0) &&
+ ((_cursorTimeKey + (_cursorAnimDelays[_cursorIndex] * 10)) <=
+ _vm->_util->getTimeKey())) {
+ _cursorAnim++;
+ if ((_cursorAnimHigh[_cursorIndex] < _cursorAnim) ||
+ (_cursorAnimLow[_cursorIndex] > _cursorAnim))
+ _cursorAnim = _cursorAnimLow[_cursorIndex];
+ _cursorTimeKey = _vm->_util->getTimeKey();
+ } else {
+ if ((_noInvalidated != 0) && (_vm->_global->_inter_mouseX == _cursorX) &&
+ (_vm->_global->_inter_mouseY == _cursorY)) {
+ _vm->_video->waitRetrace(_vm->_global->_videoMode);
+ return;
+ }
+ }
+ } else {
+ _cursorIndex = cursorIndex;
+ if (_cursorAnimDelays[cursorIndex] != 0) {
+ _cursorAnim = _cursorAnimLow[cursorIndex];
+ _cursorTimeKey = _vm->_util->getTimeKey();
+ }
+ }
+
+ if (_cursorAnimDelays[_cursorIndex] != 0) {
+ if ((_cursorAnimHigh[_cursorIndex] < _cursorAnim) ||
+ (_cursorAnimLow[_cursorIndex] > _cursorAnim))
+ _cursorAnim = _cursorAnimLow[_cursorIndex];
+
+ cursorIndex = _cursorAnim;
+ }
+ // '------
+
+ newX = _vm->_global->_inter_mouseX;
+ newY = _vm->_global->_inter_mouseY;
+ if (_cursorXDeltaVar != -1) {
+ newX -= (uint16)VAR(_cursorIndex + _cursorXDeltaVar);
+ newY -= (uint16)VAR(_cursorIndex + _cursorYDeltaVar);
+ }
+
+ minX = MIN(newX, _cursorX);
+ minY = MIN(newY, _cursorY);
+ maxX = MAX(_cursorX, newX) + _cursorWidth - 1;
+ maxY = MAX(_cursorY, newY) + _cursorHeight - 1;
+ if (_frontSurface == _backSurface) { // loc_177C2
+ if ((newX != _cursorX) || (newY != _cursorY)) {
+ if (oldCursor)
+ _vm->_video->drawSprite(_cursorBack, _frontSurface, 0, 0,
+ _cursorWidth - 1, _cursorHeight - 1, _cursorX, _cursorY, 0);
+ _vm->_video->drawSprite(_frontSurface, _cursorBack, newX, newY,
+ newX + _cursorWidth - 1, newY + _cursorHeight - 1, 0, 0, 0);
+ _vm->_video->drawSprite(_cursorSprites, _frontSurface,
+ cursorIndex * _cursorWidth, 0,
+ (cursorIndex * _cursorWidth) + _cursorWidth - 1, _cursorHeight - 1,
+ newX, newY, _transparentCursor);
+ }
+ } else { // loc_1787D
+ _vm->_video->drawSprite(_backSurface, _cursorBack, newX, newY,
+ newX + _cursorWidth - 1, newY + _cursorHeight - 1, 0, 0, 0);
+ _vm->_video->drawSprite(_cursorSprites, _backSurface,
+ cursorIndex * _cursorWidth, 0,
+ (cursorIndex * _cursorWidth) + _cursorWidth - 1, _cursorHeight - 1,
+ newX, newY, _transparentCursor);
+ if (_noInvalidated == 0) {
+ int16 tmp = _cursorIndex;
+ _cursorIndex = -1;
+ blitInvalidated();
+ _cursorIndex = tmp;
+ } else {
+ _vm->_video->waitRetrace(_vm->_global->_videoMode);
+ if (minY < 50)
+ _vm->_util->delay(5);
+ }
+ _vm->_video->drawSprite(_backSurface, _frontSurface,
+ minX, minY, maxX, maxY, minX, minY, 0);
+ _vm->_video->drawSprite(_cursorBack, _backSurface, 0, 0,
+ _cursorWidth - 1, _cursorHeight - 1, newX, newY, 0);
+ }
+ } else
+ blitCursor();
+
+ _cursorX = newX;
+ _cursorY = newY;
+}
+
} // End of namespace Gob
diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp
index ab14eec6de..ec0ef0a27b 100644
--- a/engines/gob/game_v2.cpp
+++ b/engines/gob/game_v2.cpp
@@ -782,7 +782,7 @@ void Game_v2::collisionsBlock(void) {
cmd &= 0x7f;
debugC(1, DEBUG_COLLISIONS, "collisionsBlock(%d)", cmd);
- switch(cmd) {
+ switch (cmd) {
case 0:
_vm->_global->_inter_execPtr += 6;
startIP = _vm->_global->_inter_execPtr;
diff --git a/engines/gob/goblin_v2.cpp b/engines/gob/goblin_v2.cpp
index d52300a8d9..d8f9ab4aa3 100644
--- a/engines/gob/goblin_v2.cpp
+++ b/engines/gob/goblin_v2.cpp
@@ -339,7 +339,7 @@ void Goblin_v2::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc,
break;
}
- switch(animData->state) {
+ switch (animData->state) {
case 0:
case 1:
case 7:
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index 7a365a5544..a539173200 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -338,6 +338,7 @@ protected:
void o2_multSub(void);
void o2_setRenderFlags(void);
void o2_initMult(void);
+ void o2_getObjAnimSize(void);
void o2_loadCurLayer(void);
void o2_playCDTrack(void);
void o2_stopCD(void);
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp
index 1db6498945..c83e76874a 100644
--- a/engines/gob/inter_v1.cpp
+++ b/engines/gob/inter_v1.cpp
@@ -1594,7 +1594,20 @@ void Inter_v1::o1_storeParams(void) {
}
void Inter_v1::o1_getObjAnimSize(void) {
- _vm->_mult->interGetObjAnimSize();
+ Mult::Mult_AnimData *pAnimData;
+ int16 objIndex;
+
+ evalExpr(&objIndex);
+ pAnimData = _vm->_mult->_objects[objIndex].pAnimData;
+ if (pAnimData->isStatic == 0) {
+ _vm->_scenery->updateAnim(pAnimData->layer, pAnimData->frame,
+ pAnimData->animation, 0, *(_vm->_mult->_objects[objIndex].pPosX),
+ *(_vm->_mult->_objects[objIndex].pPosY), 0);
+ }
+ WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawLeft);
+ WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawTop);
+ WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawRight);
+ WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawBottom);
}
void Inter_v1::o1_loadStatic(void) {
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp
index 5a692e9aaf..2c3454e406 100644
--- a/engines/gob/inter_v2.cpp
+++ b/engines/gob/inter_v2.cpp
@@ -156,7 +156,7 @@ void Inter_v2::setupOpcodes(void) {
OPCODE(o1_multLoadMult),
/* 18 */
OPCODE(o1_storeParams),
- OPCODE(o1_getObjAnimSize),
+ OPCODE(o2_getObjAnimSize),
OPCODE(o1_loadStatic),
OPCODE(o1_freeStatic),
/* 1C */
@@ -1078,11 +1078,11 @@ void Inter_v2::o2_writeGoblinPos(void) {
int16 var2;
int16 index;
- var1 = _vm->_parse->parseVarIndex() >> 2;
- var2 = _vm->_parse->parseVarIndex() >> 2;
+ var1 = _vm->_parse->parseVarIndex();
+ var2 = _vm->_parse->parseVarIndex();
index = _vm->_parse->parseValExpr();
- WRITE_VAR(var1, _vm->_mult->_objects[index].goblinX);
- WRITE_VAR(var2, _vm->_mult->_objects[index].goblinY);
+ WRITE_VAR_OFFSET(var1, _vm->_mult->_objects[index].goblinX);
+ WRITE_VAR_OFFSET(var2, _vm->_mult->_objects[index].goblinY);
}
void Inter_v2::o2_multSub(void) {
@@ -1707,6 +1707,25 @@ void Inter_v2::o2_initMult(void) {
debugC(4, DEBUG_GRAPHICS, " _vm->_mult->_objCount = %d, animation data size = %d", _vm->_mult->_objCount, _vm->_global->_inter_animDataSize);
}
+void Inter_v2::o2_getObjAnimSize(void) {
+ Mult::Mult_AnimData *pAnimData;
+ int16 objIndex;
+
+ objIndex = _vm->_parse->parseValExpr();
+ pAnimData = _vm->_mult->_objects[objIndex].pAnimData;
+ if (pAnimData->isStatic == 0) {
+ _vm->_scenery->updateAnim(pAnimData->layer, pAnimData->frame,
+ pAnimData->animation, 0, *(_vm->_mult->_objects[objIndex].pPosX),
+ *(_vm->_mult->_objects[objIndex].pPosY), 0);
+ }
+ _vm->_scenery->_toRedrawLeft = MAX(_vm->_scenery->_toRedrawLeft, (int16) 0);
+ _vm->_scenery->_toRedrawTop = MAX(_vm->_scenery->_toRedrawTop, (int16) 0);
+ WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawLeft);
+ WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawTop);
+ WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawRight);
+ WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawBottom);
+}
+
void Inter_v2::o2_loadCurLayer(void) {
_vm->_scenery->_curStatic = _vm->_parse->parseValExpr();
_vm->_scenery->_curStaticLayer = _vm->_parse->parseValExpr();
@@ -1806,10 +1825,10 @@ void Inter_v2::o2_initCursor(void) {
if (count > 0x80)
count -= 0x80;
- _vm->_draw->_cursorSprites =
- _vm->_video->initSurfDesc(_vm->_global->_videoMode, _vm->_draw->_cursorWidth * count,
- _vm->_draw->_cursorHeight, 2);
- _vm->_draw->_spritesArray[23] = _vm->_draw->_cursorSprites;
+ _vm->_draw->initBigSprite(23, _vm->_draw->_cursorWidth * count,
+ _vm->_draw->_cursorHeight, 2);
+ _vm->_draw->_cursorSpritesBack = _vm->_draw->_spritesArray[23];
+ _vm->_draw->_cursorSprites = _vm->_draw->_cursorSpritesBack;
_vm->_draw->_cursorBack =
_vm->_video->initSurfDesc(_vm->_global->_videoMode, _vm->_draw->_cursorWidth,
diff --git a/engines/gob/map.h b/engines/gob/map.h
index c550fe0add..606af141d0 100644
--- a/engines/gob/map.h
+++ b/engines/gob/map.h
@@ -142,13 +142,13 @@ public:
virtual inline int8 getPass(int x, int y, int heightOff = -1) {
if (heightOff == -1)
heightOff = _passWidth;
- return _vm->_util->readVariableByte((char *) (_passMap + y * heightOff + x));
+ return _passMap[y * heightOff + x];
}
virtual inline void setPass(int x, int y, int8 pass, int heightOff = -1) {
if (heightOff == -1)
heightOff = _passWidth;
- _vm->_util->writeVariableByte((char *) (_passMap + y * heightOff + x) , pass);
+ _passMap[y * heightOff + x] = pass;
}
Map_v2(GobEngine *vm);
diff --git a/engines/gob/map_v2.cpp b/engines/gob/map_v2.cpp
index aca3f0eae1..561f13a8d1 100644
--- a/engines/gob/map_v2.cpp
+++ b/engines/gob/map_v2.cpp
@@ -112,12 +112,12 @@ void Map_v2::loadMapObjects(char *avjFile) {
// In the original asm, this writes byte-wise into the variables-array
dataPos1 = mapData.pos();
+ mapData.seek(dataPos2);
if (variables != _vm->_global->_inter_variables) {
_passMap = (int8 *) variables;
mapHeight = 200 / _tilesHeight;
mapWidth = _screenWidth / _tilesWidth;
for (i = 0; i < mapHeight; i++) {
- mapData.seek(dataPos2 + (mapWidth * i));
for (j = 0; j < mapWidth; j++) {
setPass(j, i, mapData.readSByte());
}
diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp
index 1ff363ef9a..710fa7bfc5 100644
--- a/engines/gob/mult.cpp
+++ b/engines/gob/mult.cpp
@@ -121,23 +121,6 @@ Mult::Mult(GobEngine *vm) : _vm(vm) {
_orderArray = 0;
}
-void Mult::interGetObjAnimSize(void) {
- Mult_AnimData *pAnimData;
- int16 objIndex;
-
- _vm->_inter->evalExpr(&objIndex);
- pAnimData = _objects[objIndex].pAnimData;
- if (pAnimData->isStatic == 0) {
- _vm->_scenery->updateAnim(pAnimData->layer, pAnimData->frame,
- pAnimData->animation, 0, *(_objects[objIndex].pPosX),
- *(_objects[objIndex].pPosY), 0);
- }
- WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawLeft);
- WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawTop);
- WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawRight);
- WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawBottom);
-}
-
void Mult::freeAll(void) {
int16 i;
diff --git a/engines/gob/mult.h b/engines/gob/mult.h
index c5e252cd40..54c2526a32 100644
--- a/engines/gob/mult.h
+++ b/engines/gob/mult.h
@@ -231,7 +231,6 @@ public:
void zeroMultData(void);
void checkFreeMult(void);
- void interGetObjAnimSize(void);
void freeAll(void);
void initAll(void);
diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp
index ff5ee59757..b73ed50eb6 100644
--- a/engines/gob/mult_v2.cpp
+++ b/engines/gob/mult_v2.cpp
@@ -957,7 +957,7 @@ void Mult_v2::sub_62DD(int16 index) {
_multData2->someKeysIndices[i] = j - 1;
} else
_multData2->someKeysIndices[i] = -1;
- } else if(someKey1->frame > frame)
+ } else if (someKey1->frame > frame)
break;
}
}
@@ -988,7 +988,7 @@ void Mult_v2::sub_62DD(int16 index) {
if ((_multData2->field_124[index][i] != -1) && (_multData2->field_124[index][i] != 1024))
_objects[_multData2->field_124[index][i]].pAnimData->animType =
_objects[_multData2->field_124[index][i]].pAnimData->field_17;
- } else if(_multData2->animDirection == 1)
+ } else if (_multData2->animDirection == 1)
frame++;
else
frame--;
diff --git a/engines/gob/scenery.cpp b/engines/gob/scenery.cpp
index 29c4db41d5..281049edb7 100644
--- a/engines/gob/scenery.cpp
+++ b/engines/gob/scenery.cpp
@@ -451,7 +451,7 @@ int16 Scenery::loadAnim(char search) {
framesCount = 0;
layerData.seek(4, SEEK_CUR);
for (j = 0; j < ptr->layers[i].framesCount; j++, framesCount++, layerData.seek(4, SEEK_CUR)) {
- while(layerData.readByte() == 1) {
+ while (layerData.readByte() == 1) {
framesCount++;
layerData.seek(4, SEEK_CUR);
}
diff --git a/engines/gob/util.h b/engines/gob/util.h
index 17c3c09155..1b9b40b72e 100644
--- a/engines/gob/util.h
+++ b/engines/gob/util.h
@@ -88,22 +88,6 @@ public:
static const char trStr2[];
static const char trStr3[];
- inline uint8 readVariableByte(char *address) {
- int16 whichVar = address - _vm->_global->_inter_variables;
- int16 whichVarByte = whichVar % 4;
-
- whichVar >>= 2;
- return ((VAR(whichVar) >> 8 * (3-whichVarByte)) & 0xFF);
- }
- inline void writeVariableByte(char *address, uint8 value) {
- int16 whichVar = address - _vm->_global->_inter_variables;
- int16 whichVarByte = whichVar % 4;
-
- whichVar >>= 2;
- VAR(whichVar) &= ~(0xFF << 8 * (3-whichVarByte));
- VAR(whichVar) |= ((uint32) value) << 8 * (3-whichVarByte);
- }
-
Util(GobEngine *vm);
protected: