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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Thu Jul 26 03:01:01 CEST 2007


Revision: 28207
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28207&view=rev
Author:   drmccoy
Date:     2007-07-25 18:01:00 -0700 (Wed, 25 Jul 2007)

Log Message:
-----------
sub0x18 is o2_addCollision().
It already existed in Gob2 (alongside with sub0x19 - o2_freeCollision()), but wasn't used there.
Hotspots and menus work now (in a way)

Modified Paths:
--------------
    scummvm/trunk/engines/gob/game.h
    scummvm/trunk/engines/gob/inter.h
    scummvm/trunk/engines/gob/inter_v2.cpp
    scummvm/trunk/engines/gob/inter_v3.cpp
    scummvm/trunk/engines/gob/inter_v4.cpp

Modified: scummvm/trunk/engines/gob/game.h
===================================================================
--- scummvm/trunk/engines/gob/game.h	2007-07-25 22:55:00 UTC (rev 28206)
+++ scummvm/trunk/engines/gob/game.h	2007-07-26 01:01:00 UTC (rev 28207)
@@ -152,6 +152,8 @@
 	void totSub(int8 flags, const char *newTotFile);
 	void switchTotSub(int16 index, int16 skipPlay);
 
+	void freeCollision(int16 id);
+
 	virtual void playTot(int16 skipPlay) = 0;
 
 	virtual void clearCollisions(void) = 0;
@@ -221,7 +223,6 @@
 	void loadImFile(void);
 
 	void setCollisions(void);
-	void freeCollision(int16 id);
 	void collSub(uint16 offset);
 	void collAreaSub(int16 index, int8 enter);
 	int16 openLocTextFile(char *locTextFile, int language);

Modified: scummvm/trunk/engines/gob/inter.h
===================================================================
--- scummvm/trunk/engines/gob/inter.h	2007-07-25 22:55:00 UTC (rev 28206)
+++ scummvm/trunk/engines/gob/inter.h	2007-07-26 01:01:00 UTC (rev 28207)
@@ -379,6 +379,8 @@
 	bool o2_evaluateStore(OpFuncParams &params);
 	bool o2_printText(OpFuncParams &params);
 	bool o2_animPalInit(OpFuncParams &params);
+	bool o2_addCollision(OpFuncParams &params);
+	bool o2_freeCollision(OpFuncParams &params);
 	bool o2_goblinFunc(OpFuncParams &params);
 	bool o2_createSprite(OpFuncParams &params);
 	bool o2_stopSound(OpFuncParams &params);
@@ -514,8 +516,6 @@
 	virtual const char *getOpcodeDrawDesc(byte i);
 	virtual const char *getOpcodeFuncDesc(byte i, byte j);
 	virtual const char *getOpcodeGoblinDesc(int i);
-
-	bool o4_stub0x18(OpFuncParams &params);
 };
 
 } // End of namespace Gob

Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp	2007-07-25 22:55:00 UTC (rev 28206)
+++ scummvm/trunk/engines/gob/inter_v2.cpp	2007-07-26 01:01:00 UTC (rev 28207)
@@ -485,10 +485,10 @@
 		OPCODE(o1_capturePop),
 		OPCODE(o2_animPalInit),
 		/* 18 */
+		OPCODE(o2_addCollision),
+		OPCODE(o2_freeCollision),
 		{NULL, ""},
 		{NULL, ""},
-		{NULL, ""},
-		{NULL, ""},
 		/* 1C */
 		{NULL, ""},
 		{NULL, ""},
@@ -1733,6 +1733,71 @@
 	return false;
 }
 
+bool Inter_v2::o2_addCollision(OpFuncParams &params) {
+	int16 id;
+	int16 left, top, width, height;
+	int16 flags;
+	int16 key;
+	int16 funcSub;
+
+	id = _vm->_parse->parseValExpr();
+	funcSub = _vm->_global->_inter_execPtr - _vm->_game->_totFileData;
+	left = _vm->_parse->parseValExpr();
+	top = _vm->_parse->parseValExpr();
+	width = _vm->_parse->parseValExpr();
+	height = _vm->_parse->parseValExpr();
+	flags = _vm->_parse->parseValExpr();
+	key = load16();
+
+	if (key == 0)
+		key = ABS(id) + 41960;
+
+	_vm->_draw->adjustCoords(0, &left, &top);
+	_vm->_draw->adjustCoords(2, &width, &height);
+
+	if (left < 0) {
+		width += left;
+		left = 0;
+	}
+
+	if (top < 0) {
+		height += top;
+		top = 0;
+	}
+
+	int16 index;
+	if (id < 0)
+		index = _vm->_game->addNewCollision(0xD000 - id, left & 0xFFFC, top & 0xFFFC,
+				left + width + 3, top + height + 3, flags, key, 0, 0);
+	else
+		index = _vm->_game->addNewCollision(0xE000 + id, left, top,
+				left + width - 1, top + height - 1, flags, key, 0, 0);
+
+	_vm->_game->_collisionAreas[index].funcSub = funcSub;
+
+	return false;
+}
+
+bool Inter_v2::o2_freeCollision(OpFuncParams &params) {
+	int16 id;
+
+	id = _vm->_parse->parseValExpr();
+	if (id == -2) {
+		for (int i = 0; i < 150; i++) {
+			if ((_vm->_game->_collisionAreas[i].id & 0xF000) == 0xD000)
+				_vm->_game->_collisionAreas[i].left = 0xFFFF;
+		}
+	} else if (id == -1) {
+		for (int i = 0; i < 150; i++) {
+			if ((_vm->_game->_collisionAreas[i].id & 0xF000) == 0xE000)
+				_vm->_game->_collisionAreas[i].left = 0xFFFF;
+		}
+	} else
+		_vm->_game->freeCollision(0xE000 + id);
+
+	return false;
+}
+
 bool Inter_v2::o2_goblinFunc(OpFuncParams &params) {
 	OpGobParams gobParams;
 	int16 cmd;

Modified: scummvm/trunk/engines/gob/inter_v3.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v3.cpp	2007-07-25 22:55:00 UTC (rev 28206)
+++ scummvm/trunk/engines/gob/inter_v3.cpp	2007-07-26 01:01:00 UTC (rev 28207)
@@ -473,8 +473,8 @@
 		OPCODE(o1_capturePop),
 		OPCODE(o2_animPalInit),
 		/* 18 */
-		{NULL, ""},
-		{NULL, ""},
+		OPCODE(o2_addCollision),
+		OPCODE(o2_freeCollision),
 		OPCODE(o3_getTotTextItemPart),
 		{NULL, ""},
 		/* 1C */

Modified: scummvm/trunk/engines/gob/inter_v4.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v4.cpp	2007-07-25 22:55:00 UTC (rev 28206)
+++ scummvm/trunk/engines/gob/inter_v4.cpp	2007-07-26 01:01:00 UTC (rev 28207)
@@ -473,8 +473,8 @@
 		OPCODE(o1_capturePop),
 		OPCODE(o2_animPalInit),
 		/* 18 */
-		OPCODE(o4_stub0x18),
-		{NULL, ""},
+		OPCODE(o2_addCollision),
+		OPCODE(o2_freeCollision),
 		OPCODE(o3_getTotTextItemPart),
 		{NULL, ""},
 		/* 1C */
@@ -712,19 +712,4 @@
 	return "";
 }
 
-bool Inter_v4::o4_stub0x18(OpFuncParams &params) {
-	int16 val1 = _vm->_parse->parseValExpr();
-	int16 val2 = _vm->_parse->parseValExpr();
-	int16 val3 = _vm->_parse->parseValExpr();
-	int16 val4 = _vm->_parse->parseValExpr();
-	int16 val5 = _vm->_parse->parseValExpr();
-	int16 val6 = _vm->_parse->parseValExpr();
-	int16 val7 = load16();
-
-	warning("Stub! Woodruff Func 0x18: %d, %d, %d, %d, %d, %d, %d",
-			val1, val2, val3, val4, val5, val6, val7);
-
-	return false;
-}
-
 } // End of namespace Gob


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