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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Fri Apr 6 15:30:10 CEST 2007


Revision: 26390
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26390&view=rev
Author:   drmccoy
Date:     2007-04-06 06:30:09 -0700 (Fri, 06 Apr 2007)

Log Message:
-----------
Some Gob3 fixes:
- wrong positioning of the inventory
- walking
- close-up fadeing in the CD version

Modified Paths:
--------------
    scummvm/trunk/engines/gob/game_v2.cpp
    scummvm/trunk/engines/gob/gob.cpp
    scummvm/trunk/engines/gob/goblin.h
    scummvm/trunk/engines/gob/goblin_v2.cpp
    scummvm/trunk/engines/gob/imd.cpp
    scummvm/trunk/engines/gob/inter.h
    scummvm/trunk/engines/gob/inter_v1.cpp
    scummvm/trunk/engines/gob/inter_v3.cpp
    scummvm/trunk/engines/gob/module.mk
    scummvm/trunk/engines/gob/util.cpp
    scummvm/trunk/engines/gob/video.cpp
    scummvm/trunk/engines/gob/video.h

Added Paths:
-----------
    scummvm/trunk/engines/gob/goblin_v3.cpp

Modified: scummvm/trunk/engines/gob/game_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v2.cpp	2007-04-06 13:28:33 UTC (rev 26389)
+++ scummvm/trunk/engines/gob/game_v2.cpp	2007-04-06 13:30:09 UTC (rev 26390)
@@ -448,19 +448,20 @@
 			int16 cursorRight;
 			int16 screenRight;
 			
-			if ((_vm->_global->_inter_mouseX == 0) &&
+			if ((_vm->_global->_inter_mouseX == _vm->_draw->_scrollOffsetX) &&
 				  (_vm->_draw->_scrollOffsetX > 0)) {
 				uint16 off;
+				int16 min;
 
 				off = MIN(_vm->_draw->_cursorWidth, _vm->_draw->_scrollOffsetX);
 				off = MAX(off / 2, 1);
+				min = _vm->_draw->_scrollOffsetX - off + 1;
+
 				_vm->_draw->_scrollOffsetX -= off;
 				_vm->_global->_inter_mouseX -= off;
-				_vm->_global->_inter_mouseX =
-					MAX(_vm->_global->_inter_mouseX, (int16) 1);
+				_vm->_global->_inter_mouseX = MAX(_vm->_global->_inter_mouseX, min);
 			}
 
-			_vm->_global->_inter_mouseX += _vm->_draw->_scrollOffsetX;
 			cursorRight = _vm->_global->_inter_mouseX + _vm->_draw->_cursorWidth;
 			screenRight = _vm->_draw->_scrollOffsetX + 320;
 

Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp	2007-04-06 13:28:33 UTC (rev 26389)
+++ scummvm/trunk/engines/gob/gob.cpp	2007-04-06 13:30:09 UTC (rev 26390)
@@ -627,7 +627,7 @@
 		_draw = new Draw_v2(this);
 		_game = new Game_v2(this);
 		_map = new Map_v2(this);
-		_goblin = new Goblin_v2(this);
+		_goblin = new Goblin_v3(this);
 		_scenery = new Scenery_v2(this);
 	} else
 		error("GobEngine::init(): Unknown version of game engine");

Modified: scummvm/trunk/engines/gob/goblin.h
===================================================================
--- scummvm/trunk/engines/gob/goblin.h	2007-04-06 13:28:33 UTC (rev 26389)
+++ scummvm/trunk/engines/gob/goblin.h	2007-04-06 13:30:09 UTC (rev 26390)
@@ -254,6 +254,8 @@
 	void moveTreatRopeStairs(Gob_Object *gobDesc);
 	void playSounds(Mult::Mult_Object *obj);
 
+	virtual bool isMovement(int8 state) = 0;
+	virtual void advMovement(Mult::Mult_Object *obj, int8 state) = 0;
 	virtual void movePathFind(Mult::Mult_Object *obj,
 			Gob_Object *gobDesc, int16 nextAct) = 0;
 };
@@ -272,6 +274,8 @@
 	virtual ~Goblin_v1() {};
 
 protected:
+	virtual bool isMovement(int8 state) { return false; }
+	virtual void advMovement(Mult::Mult_Object *obj, int8 state) {}
 	virtual void movePathFind(Mult::Mult_Object *obj,
 			Gob_Object *gobDesc, int16 nextAct);
 };
@@ -290,10 +294,22 @@
 	virtual ~Goblin_v2() {};
 
 protected:
+	virtual bool isMovement(int8 state);
+	virtual void advMovement(Mult::Mult_Object *obj, int8 state);
 	virtual void movePathFind(Mult::Mult_Object *obj,
 			Gob_Object *gobDesc, int16 nextAct);
 };
 
+class Goblin_v3 : public Goblin_v2 {
+public:
+	Goblin_v3(GobEngine *vm);
+	virtual ~Goblin_v3() {};
+
+protected:
+	virtual bool isMovement(int8 state);
+	virtual void advMovement(Mult::Mult_Object *obj, int8 state);
+};
+
 } // End of namespace Gob
 
 #endif // GOB_GOBLIN_H

Modified: scummvm/trunk/engines/gob/goblin_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/goblin_v2.cpp	2007-04-06 13:28:33 UTC (rev 26389)
+++ scummvm/trunk/engines/gob/goblin_v2.cpp	2007-04-06 13:30:09 UTC (rev 26390)
@@ -398,51 +398,14 @@
 		animData->animation = animation;
 		animData->frame = 0;
 	} else {
-		if (((animData->state >= 0) && (animData->state < 8)) ||
-				(animData->state == 38) || (animData->state == 39)) {
+		if (isMovement(animData->state)) {
 			state = animData->nextState;
 			if (animData->frame == ((framesCount + 1) / 2)) {
 				gobX = obj->goblinX;
 				gobY = obj->goblinY;
-				switch (state) {
-				case 0:
-					obj->goblinX--;
-					break;
 
-				case 1:
-					obj->goblinX--;
-					obj->goblinY--;
-					break;
+				advMovement(obj, state);
 
-				case 2:
-				case 38:
-					obj->goblinY--;
-					break;
-
-				case 3:
-					obj->goblinX++;
-					obj->goblinY--;
-					break;
-
-				case 4:
-					obj->goblinX++;
-					break;
-
-				case 5:
-					obj->goblinX++;
-					obj->goblinY++;
-					break;
-
-				case 6:
-				case 39:
-					obj->goblinY++;
-					break;
-
-				case 7:
-					obj->goblinX--;
-					obj->goblinY++;
-					break;
-				}
 				if (animData->state != state) {
 					animation = obj->goblinStates[state][0].animation;
 					layer = obj->goblinStates[state][0].layer;
@@ -475,45 +438,9 @@
 			animData->state = state;
 			gobX = obj->goblinX;
 			gobY = obj->goblinY;
-			switch (state) {
-			case 0:
-				obj->goblinX--;
-				break;
 
-			case 1:
-				obj->goblinX--;
-				obj->goblinY--;
-				break;
+			advMovement(obj, state);
 
-			case 2:
-			case 38:
-				obj->goblinY--;
-				break;
-
-			case 3:
-				obj->goblinX++;
-				obj->goblinY--;
-				break;
-
-			case 4:
-				obj->goblinX++;
-				break;
-
-			case 5:
-				obj->goblinX++;
-				obj->goblinY++;
-				break;
-
-			case 6:
-			case 39:
-				obj->goblinY++;
-				break;
-
-			case 7:
-				obj->goblinX--;
-				obj->goblinY++;
-				break;
-			}
 			_vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0);
 			if (_vm->_map->_bigTiles)
 				*obj->pPosY = ((gobY + 1) * _vm->_map->_tilesHeight) -
@@ -687,4 +614,55 @@
 	}
 }
 
+bool Goblin_v2::isMovement(int8 state) {
+	if ((state >= 0) && (state < 8))
+		return true;
+	if ((state == 38) || (state == 39))
+		return true;
+
+	return false;
+}
+
+void Goblin_v2::advMovement(Mult::Mult_Object *obj, int8 state) {
+	switch (state) {
+	case 0:
+		obj->goblinX--;
+		break;
+
+	case 1:
+		obj->goblinX--;
+		obj->goblinY--;
+		break;
+
+	case 2:
+	case 38:
+		obj->goblinY--;
+		break;
+
+	case 3:
+		obj->goblinX++;
+		obj->goblinY--;
+		break;
+
+	case 4:
+		obj->goblinX++;
+		break;
+
+	case 5:
+		obj->goblinX++;
+		obj->goblinY++;
+		break;
+
+	case 6:
+	case 39:
+		obj->goblinY++;
+		break;
+
+	case 7:
+		obj->goblinX--;
+		obj->goblinY++;
+		break;
+	}
+}
+
 } // End of namespace Gob

Added: scummvm/trunk/engines/gob/goblin_v3.cpp
===================================================================
--- scummvm/trunk/engines/gob/goblin_v3.cpp	                        (rev 0)
+++ scummvm/trunk/engines/gob/goblin_v3.cpp	2007-04-06 13:30:09 UTC (rev 26390)
@@ -0,0 +1,110 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2004 Ivan Dubrov
+ * Copyright (C) 2004-2006 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "gob/gob.h"
+#include "gob/goblin.h"
+#include "gob/mult.h"
+
+namespace Gob {
+
+Goblin_v3::Goblin_v3(GobEngine *vm) : Goblin_v2(vm) {
+}
+
+bool Goblin_v3::isMovement(int8 state) {
+	if ((state >= 0) && (state < 8))
+		return true;
+	if ((state >= 40) && (state < 44))
+		return true;
+	if ((state == 26) || (state == 26))
+		return true;
+	if ((state == 38) || (state == 39))
+		return true;
+
+	return false;
+}
+
+void Goblin_v3::advMovement(Mult::Mult_Object *obj, int8 state) {
+	switch (state) {
+	case 0:
+		obj->goblinX--;
+		break;
+
+	case 1:
+		obj->goblinX--;
+		obj->goblinY--;
+		break;
+
+	case 2:
+	case 26:
+	case 38:
+		obj->goblinY--;
+		break;
+
+	case 3:
+		obj->goblinX++;
+		obj->goblinY--;
+		break;
+
+	case 4:
+		obj->goblinX++;
+		break;
+
+	case 5:
+		obj->goblinX++;
+		obj->goblinY++;
+		break;
+
+	case 6:
+	case 27:
+	case 39:
+		obj->goblinY++;
+		break;
+
+	case 7:
+		obj->goblinX--;
+		obj->goblinY++;
+		break;
+
+	case 40:
+		obj->goblinX--;
+		obj->goblinY -= 2;
+		break;
+
+	case 41:
+		obj->goblinX--;
+		obj->goblinY += 2;
+		break;
+
+	case 42:
+		obj->goblinX++;
+		obj->goblinY -= 2;
+		break;
+
+	case 43:
+		obj->goblinX++;
+		obj->goblinY += 2;
+		break;
+	}
+}
+
+} // End of namespace Gob


Property changes on: scummvm/trunk/engines/gob/goblin_v3.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/trunk/engines/gob/imd.cpp
===================================================================
--- scummvm/trunk/engines/gob/imd.cpp	2007-04-06 13:28:33 UTC (rev 26389)
+++ scummvm/trunk/engines/gob/imd.cpp	2007-04-06 13:30:09 UTC (rev 26390)
@@ -177,6 +177,8 @@
 		framesCordsPos = _vm->_dataIO->readUint32(handle);
 
 	_noSound = true;
+	_soundStage = 0;
+	_soundWaited = 0;
 	if (imdPtr->verMin & 0x4000) {
 		_soundFreq = _vm->_dataIO->readUint16(handle);
 		_soundSliceSize = _vm->_dataIO->readUint16(handle);

Modified: scummvm/trunk/engines/gob/inter.h
===================================================================
--- scummvm/trunk/engines/gob/inter.h	2007-04-06 13:28:33 UTC (rev 26389)
+++ scummvm/trunk/engines/gob/inter.h	2007-04-06 13:30:09 UTC (rev 26390)
@@ -472,6 +472,7 @@
 	virtual const char *getOpcodeGoblinDesc(int i);
 
 	bool o3_getTotTextItemPart(OpFuncParams &params);
+	bool o3_copySprite(OpFuncParams &params);
 	bool o3_checkData(OpFuncParams &params);
 	bool o3_readData(OpFuncParams &params);
 	bool o3_writeData(OpFuncParams &params);

Modified: scummvm/trunk/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v1.cpp	2007-04-06 13:28:33 UTC (rev 26389)
+++ scummvm/trunk/engines/gob/inter_v1.cpp	2007-04-06 13:30:09 UTC (rev 26390)
@@ -2152,8 +2152,8 @@
 bool Inter_v1::o1_setMousePos(OpFuncParams &params) {
 	_vm->_global->_inter_mouseX = _vm->_parse->parseValExpr();
 	_vm->_global->_inter_mouseY = _vm->_parse->parseValExpr();
-	_vm->_global->_inter_mouseX -= _vm->_draw->_scrollOffsetX;
-	_vm->_global->_inter_mouseY -= _vm->_draw->_scrollOffsetY;
+	_vm->_global->_inter_mouseX -= _vm->_video->_scrollOffsetX;
+	_vm->_global->_inter_mouseY -= _vm->_video->_scrollOffsetY;
 	if (_vm->_global->_useMouse != 0)
 		_vm->_util->setMousePos(_vm->_global->_inter_mouseX,
 				_vm->_global->_inter_mouseY);

Modified: scummvm/trunk/engines/gob/inter_v3.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v3.cpp	2007-04-06 13:28:33 UTC (rev 26389)
+++ scummvm/trunk/engines/gob/inter_v3.cpp	2007-04-06 13:30:09 UTC (rev 26390)
@@ -502,7 +502,7 @@
 		/* 30 */
 		OPCODE(o1_returnTo),
 		OPCODE(o1_loadSpriteContent),
-		OPCODE(o1_copySprite),
+		OPCODE(o3_copySprite),
 		OPCODE(o1_fillRect),
 		/* 34 */
 		OPCODE(o1_drawLine),
@@ -882,6 +882,15 @@
 	return false;
 }
 
+bool Inter_v3::o3_copySprite(OpFuncParams &params) {
+	o1_copySprite(params);
+
+	// For the close-up "fading" in the CD version
+	if (_vm->_draw->_destSurface == 20)
+		_vm->_video->sparseRetrace(20);
+	return false;
+}
+
 bool Inter_v3::o3_checkData(OpFuncParams &params) {
 	int16 handle;
 	int16 varOff;

Modified: scummvm/trunk/engines/gob/module.mk
===================================================================
--- scummvm/trunk/engines/gob/module.mk	2007-04-06 13:28:33 UTC (rev 26389)
+++ scummvm/trunk/engines/gob/module.mk	2007-04-06 13:30:09 UTC (rev 26390)
@@ -17,6 +17,7 @@
 	goblin.o \
 	goblin_v1.o \
 	goblin_v2.o \
+	goblin_v3.o \
 	imd.o \
 	init.o \
 	init_v1.o \

Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp	2007-04-06 13:28:33 UTC (rev 26389)
+++ scummvm/trunk/engines/gob/util.cpp	2007-04-06 13:30:09 UTC (rev 26390)
@@ -196,8 +196,8 @@
 
 void Util::getMouseState(int16 *pX, int16 *pY, int16 *pButtons) {
 	Common::Point mouse = g_system->getEventManager()->getMousePos();
-	*pX = mouse.x;
-	*pY = mouse.y;
+	*pX = mouse.x + _vm->_video->_scrollOffsetX;
+	*pY = mouse.y + _vm->_video->_scrollOffsetY;
 
 	if (pButtons != 0)
 		*pButtons = _mouseButtons;

Modified: scummvm/trunk/engines/gob/video.cpp
===================================================================
--- scummvm/trunk/engines/gob/video.cpp	2007-04-06 13:28:33 UTC (rev 26389)
+++ scummvm/trunk/engines/gob/video.cpp	2007-04-06 13:30:09 UTC (rev 26390)
@@ -90,6 +90,9 @@
 	_scrollOffsetX = 0;
 	_scrollOffsetY = 0;
 	_splitHeight = 200;
+
+	_curSparse = 0;
+	_lastSparse = 0xFFFFFFFF;
 }
 
 char Video::initDriver(int16 vidMode) {
@@ -176,6 +179,17 @@
 	_vm->_util->delay(MAX(1, 10 - (int)(_vm->_util->getTimeKey() - time)));
 }
 
+void Video::sparseRetrace(int max) {
+	uint32 timeKey = _vm->_util->getTimeKey();
+
+	if ((_curSparse++ > max) || ((timeKey - _lastSparse) > 1000)) {
+		_curSparse = 0;
+		retrace(false);
+	}
+
+	_lastSparse = timeKey;
+}
+
 void Video::putPixel(int16 x, int16 y, int16 color, SurfaceDesc *dest) {
 	if ((x >= dest->getWidth()) || (x < 0) ||
 	    (y >= dest->getHeight()) || (y < 0))

Modified: scummvm/trunk/engines/gob/video.h
===================================================================
--- scummvm/trunk/engines/gob/video.h	2007-04-06 13:28:33 UTC (rev 26389)
+++ scummvm/trunk/engines/gob/video.h	2007-04-06 13:30:09 UTC (rev 26390)
@@ -107,6 +107,7 @@
 			int16 height, int16 flags);
 	void retrace(bool mouse = true);
 	void waitRetrace(bool mouse = true);
+	void sparseRetrace(int max);
 
 	void putPixel(int16 x, int16 y, int16 color, SurfaceDesc *dest);
 	void fillRect(SurfaceDesc *dest, int16 left, int16 top,
@@ -150,6 +151,10 @@
 
 protected:
 	class VideoDriver *_videoDriver;
+
+	int _curSparse;
+	uint32 _lastSparse;
+
 	GobEngine *_vm;
 
 	char initDriver(int16 vidMode);


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