[Scummvm-cvs-logs] SF.net SVN: scummvm: [23429] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sat Jul 8 18:37:40 CEST 2006


Revision: 23429
Author:   drmccoy
Date:     2006-07-08 09:37:23 -0700 (Sat, 08 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23429&view=rev

Log Message:
-----------
- Fixed a few mistakes that added up to look correct, fixing bargon's cursor
- Updated cursor drawing in general

Modified Paths:
--------------
    scummvm/trunk/engines/gob/draw.cpp
    scummvm/trunk/engines/gob/draw.h
    scummvm/trunk/engines/gob/draw_v1.cpp
    scummvm/trunk/engines/gob/draw_v2.cpp
    scummvm/trunk/engines/gob/game_v2.cpp
    scummvm/trunk/engines/gob/goblin_v2.cpp
    scummvm/trunk/engines/gob/inter.h
    scummvm/trunk/engines/gob/inter_v1.cpp
    scummvm/trunk/engines/gob/inter_v2.cpp
    scummvm/trunk/engines/gob/map.h
    scummvm/trunk/engines/gob/map_v2.cpp
    scummvm/trunk/engines/gob/mult.cpp
    scummvm/trunk/engines/gob/mult.h
    scummvm/trunk/engines/gob/mult_v2.cpp
    scummvm/trunk/engines/gob/scenery.cpp
    scummvm/trunk/engines/gob/util.h
Modified: scummvm/trunk/engines/gob/draw.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw.cpp	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/draw.cpp	2006-07-08 16:37:23 UTC (rev 23429)
@@ -306,138 +306,6 @@
 	}
 }
 
-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;
 

Modified: scummvm/trunk/engines/gob/draw.h
===================================================================
--- scummvm/trunk/engines/gob/draw.h	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/draw.h	2006-07-08 16:37:23 UTC (rev 23429)
@@ -113,10 +113,7 @@
 	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);
 	void fillRect(int16 index, int16 left, int16 top, int16 right,
@@ -135,6 +132,8 @@
 	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 @@
 	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 @@
 	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() {};

Modified: scummvm/trunk/engines/gob/draw_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw_v1.cpp	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/draw_v1.cpp	2006-07-08 16:37:23 UTC (rev 23429)
@@ -489,4 +489,136 @@
 	}
 }
 
+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

Modified: scummvm/trunk/engines/gob/draw_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw_v2.cpp	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/draw_v2.cpp	2006-07-08 16:37:23 UTC (rev 23429)
@@ -542,7 +542,8 @@
 				_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 @@
 		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 @@
 						_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::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

Modified: scummvm/trunk/engines/gob/game_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v2.cpp	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/game_v2.cpp	2006-07-08 16:37:23 UTC (rev 23429)
@@ -782,7 +782,7 @@
 		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;

Modified: scummvm/trunk/engines/gob/goblin_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/goblin_v2.cpp	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/goblin_v2.cpp	2006-07-08 16:37:23 UTC (rev 23429)
@@ -339,7 +339,7 @@
 		break;
 	}
 
-	switch(animData->state) {
+	switch (animData->state) {
 	case 0:
 	case 1:
 	case 7:

Modified: scummvm/trunk/engines/gob/inter.h
===================================================================
--- scummvm/trunk/engines/gob/inter.h	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/inter.h	2006-07-08 16:37:23 UTC (rev 23429)
@@ -338,6 +338,7 @@
 	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);

Modified: scummvm/trunk/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v1.cpp	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/inter_v1.cpp	2006-07-08 16:37:23 UTC (rev 23429)
@@ -1594,7 +1594,20 @@
 }
 
 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) {

Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/inter_v2.cpp	2006-07-08 16:37:23 UTC (rev 23429)
@@ -156,7 +156,7 @@
 		OPCODE(o1_multLoadMult),
 		/* 18 */
 		OPCODE(o1_storeParams),
-		OPCODE(o1_getObjAnimSize),
+		OPCODE(o2_getObjAnimSize),
 		OPCODE(o1_loadStatic),
 		OPCODE(o1_freeStatic),
 		/* 1C */
@@ -1078,11 +1078,11 @@
 	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 @@
 	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 @@
 		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,

Modified: scummvm/trunk/engines/gob/map.h
===================================================================
--- scummvm/trunk/engines/gob/map.h	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/map.h	2006-07-08 16:37:23 UTC (rev 23429)
@@ -142,13 +142,13 @@
 	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);

Modified: scummvm/trunk/engines/gob/map_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/map_v2.cpp	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/map_v2.cpp	2006-07-08 16:37:23 UTC (rev 23429)
@@ -112,12 +112,12 @@
 
 	// 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());
 			}

Modified: scummvm/trunk/engines/gob/mult.cpp
===================================================================
--- scummvm/trunk/engines/gob/mult.cpp	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/mult.cpp	2006-07-08 16:37:23 UTC (rev 23429)
@@ -121,23 +121,6 @@
 	_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;
 

Modified: scummvm/trunk/engines/gob/mult.h
===================================================================
--- scummvm/trunk/engines/gob/mult.h	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/mult.h	2006-07-08 16:37:23 UTC (rev 23429)
@@ -231,7 +231,6 @@
 
 	void zeroMultData(void);
 	void checkFreeMult(void);
-	void interGetObjAnimSize(void);
 	void freeAll(void);
 	void initAll(void);
 

Modified: scummvm/trunk/engines/gob/mult_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/mult_v2.cpp	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/mult_v2.cpp	2006-07-08 16:37:23 UTC (rev 23429)
@@ -957,7 +957,7 @@
 							_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 @@
 			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--;

Modified: scummvm/trunk/engines/gob/scenery.cpp
===================================================================
--- scummvm/trunk/engines/gob/scenery.cpp	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/scenery.cpp	2006-07-08 16:37:23 UTC (rev 23429)
@@ -451,7 +451,7 @@
 		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);
 			}

Modified: scummvm/trunk/engines/gob/util.h
===================================================================
--- scummvm/trunk/engines/gob/util.h	2006-07-08 15:39:26 UTC (rev 23428)
+++ scummvm/trunk/engines/gob/util.h	2006-07-08 16:37:23 UTC (rev 23429)
@@ -88,22 +88,6 @@
 	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:


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list