[Scummvm-cvs-logs] CVS: scummvm/scumm cursor.cpp,2.15,2.16 intern.h,2.259,2.260 script_v7he.cpp,2.95,2.96

Max Horn fingolfin at users.sourceforge.net
Sat Sep 18 15:24:09 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32200

Modified Files:
	cursor.cpp intern.h script_v7he.cpp 
Log Message:
Reduce code duplication a bit

Index: cursor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/cursor.cpp,v
retrieving revision 2.15
retrieving revision 2.16
diff -u -d -r2.15 -r2.16
--- cursor.cpp	18 Sep 2004 20:29:13 -0000	2.15
+++ cursor.cpp	18 Sep 2004 22:23:43 -0000	2.16
@@ -24,6 +24,7 @@
 #include "scumm/charset.h"
 #include "scumm/intern.h"
 #include "scumm/object.h"
+#include "scumm/resource_v7he.h"
 #include "scumm/scumm.h"
 
 
@@ -146,6 +147,10 @@
 	updateCursor();
 }
 
+void ScummEngine_v7he::setCursorFromImg(uint img, uint room, uint imgindex) {
+	_Win32ResExtractor->setCursor(img);
+}
+
 void ScummEngine_v6::setCursorFromImg(uint img, uint room, uint imgindex) {
 	int w, h;
 	const byte *dataptr, *bomp;

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.259
retrieving revision 2.260
diff -u -d -r2.259 -r2.260
--- intern.h	18 Sep 2004 22:09:34 -0000	2.259
+++ intern.h	18 Sep 2004 22:23:43 -0000	2.260
@@ -364,7 +364,7 @@
 	void setCursorTransparency(int a);
 	void setCursorHotspot(int x, int y);
 
-	void setCursorFromImg(uint img, uint room, uint imgindex);
+	virtual void setCursorFromImg(uint img, uint room, uint imgindex);
 	void useIm01Cursor(const byte *im, int w, int h);
 	void useBompCursor(const byte *im, int w, int h);
 	void grabCursor(int x, int y, int w, int h);
@@ -635,8 +635,9 @@
 	bool polygonDefined(int id);
 	int polygonHit(int id, int x, int y);
 
+	virtual void setCursorFromImg(uint img, uint room, uint imgindex);
+
 	/* HE version 70 script opcodes */
-	void o70he_cursorCommand();
 	void o70he_startSound();
 	void o70he_pickupObject();
 	void o70he_getActorRoom();

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.95
retrieving revision 2.96
diff -u -d -r2.95 -r2.96
--- script_v7he.cpp	18 Sep 2004 22:09:34 -0000	2.95
+++ script_v7he.cpp	18 Sep 2004 22:23:43 -0000	2.96
@@ -179,7 +179,7 @@
 		OPCODE(o6_cutscene),
 		OPCODE(o6_stopMusic),
 		OPCODE(o6_freezeUnfreeze),
-		OPCODE(o70he_cursorCommand),
+		OPCODE(o6_cursorCommand),
 		/* 6C */
 		OPCODE(o6_breakHere),
 		OPCODE(o6_ifClassOfIs),
@@ -404,68 +404,6 @@
 	writeArray(0, 0, edi + i, 0);
 }
 
-void ScummEngine_v7he::o70he_cursorCommand() {
-	int a, i;
-	int args[16];
-	int subOp = fetchScriptByte();
-
-	switch (subOp) {
-	case 0x90:		// SO_CURSOR_ON Turn cursor on
-		_cursor.state = 1;
-		verbMouseOver(0);
-		break;
-	case 0x91:		// SO_CURSOR_OFF Turn cursor off
-		_cursor.state = 0;
-		verbMouseOver(0);
-		break;
-	case 0x92:		// SO_USERPUT_ON
-		_userPut = 1;
-		break;
-	case 0x93:		// SO_USERPUT_OFF
-		_userPut = 0;
-		break;
-	case 0x94:		// SO_CURSOR_SOFT_ON Turn soft cursor on
-		_cursor.state++;
-		if (_cursor.state > 1)
-			error("Cursor state greater than 1 in script");
-		verbMouseOver(0);
-		break;
-	case 0x95:		// SO_CURSOR_SOFT_OFF Turn soft cursor off
-		_cursor.state--;
-		verbMouseOver(0);
-		break;
-	case 0x96:		// SO_USERPUT_SOFT_ON
-		_userPut++;
-		break;
-	case 0x97:		// SO_USERPUT_SOFT_OFF
-		_userPut--;
-		break;
-	case 0x99: 		// SO_CURSOR_IMAGE Set cursor image
-		_Win32ResExtractor->setCursor(pop()); 				/* Difference */
-		break;
-	case 0x9A:		// SO_CURSOR_HOTSPOT Set cursor hotspot
-		a = pop();
-		setCursorHotspot(pop(), a);
-		break;
-	case 0x9C:		// SO_CHARSET_SET
-		initCharset(pop());
-		break;
-	case 0x9D:		// SO_CHARSET_COLOR
-		getStackList(args, ARRAYSIZE(args));
-		for (i = 0; i < 16; i++)
-			_charsetColorMap[i] = _charsetData[_string[1]._default.charset][i] = (unsigned char)args[i];
-		break;
-	case 0xD6:		// SO_CURSOR_TRANSPARENT Set cursor transparent color
-		setCursorTransparency(pop());
-		break;
-	default:
-		error("o70he_cursorCommand: default case %x", subOp);
-	}
-
-	VAR(VAR_CURSORSTATE) = _cursor.state;
-	VAR(VAR_USERPUT) = _userPut;
-}
-
 void ScummEngine_v7he::o70he_startSound() {
 	byte op;
 	op = fetchScriptByte();





More information about the Scummvm-git-logs mailing list