[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.69,2.70 script_v2.cpp,2.30,2.31 script_v5.cpp,1.55,1.56 scumm.h,1.172,1.173 vars.cpp,1.42,1.43

Max Horn fingolfin at users.sourceforge.net
Wed Apr 30 04:16:06 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv27370

Modified Files:
	intern.h script_v2.cpp script_v5.cpp scumm.h vars.cpp 
Log Message:
cleanup

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.69
retrieving revision 2.70
diff -u -d -r2.69 -r2.70
--- intern.h	28 Apr 2003 14:46:52 -0000	2.69
+++ intern.h	30 Apr 2003 11:15:07 -0000	2.70
@@ -262,13 +262,11 @@
 	void o2_matrixOps();
 	void o2_setCameraAt();
 	void o2_roomOps();
-	void o2_findObject();
 	void o2_cutscene();
 	void o2_chainScript();
 	void o2_pickupObject();
 	void o2_setObjectName();
 	void o2_cursorCommand();
-	void o2_getClosestObjActor();
 	void o2_getActorWalkBox();
 	void o2_endCutscene();
 	void o2_drawSentence();

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.30
retrieving revision 2.31
diff -u -d -r2.30 -r2.31
--- script_v2.cpp	28 Apr 2003 03:13:47 -0000	2.30
+++ script_v2.cpp	30 Apr 2003 11:15:08 -0000	2.31
@@ -99,7 +99,7 @@
 		OPCODE(o2_roomOps),
 		/* 34 */
 		OPCODE(o5_getDist),
-		OPCODE(o2_findObject),
+		OPCODE(o5_findObject),
 		OPCODE(o2_walkActorToObject),
 		OPCODE(o2_setState01),
 		/* 38 */
@@ -160,7 +160,7 @@
 		/* 64 */
 		OPCODE(o2_loadRoomWithEgo),
 		OPCODE(o2_drawObject),
-		OPCODE(o2_getClosestObjActor),
+		OPCODE(o5_getClosestObjActor),
 		OPCODE(o2_clearState04),
 		/* 68 */
 		OPCODE(o5_isScriptRunning),
@@ -179,7 +179,7 @@
 		OPCODE(o2_roomOps),
 		/* 74 */
 		OPCODE(o5_getDist),
-		OPCODE(o2_findObject),
+		OPCODE(o5_findObject),
 		OPCODE(o2_walkActorToObject),
 		OPCODE(o2_clearState01),
 		/* 78 */
@@ -259,7 +259,7 @@
 		OPCODE(o2_roomOps),
 		/* B4 */
 		OPCODE(o5_getDist),
-		OPCODE(o2_findObject),
+		OPCODE(o5_findObject),
 		OPCODE(o2_walkActorToObject),
 		OPCODE(o2_setState02),
 		/* B8 */
@@ -320,7 +320,7 @@
 		/* E4 */
 		OPCODE(o2_loadRoomWithEgo),
 		OPCODE(o2_drawObject),
-		OPCODE(o2_getClosestObjActor),
+		OPCODE(o5_getClosestObjActor),
 		OPCODE(o2_clearState04),
 		/* E8 */
 		OPCODE(o5_isScriptRunning),
@@ -339,7 +339,7 @@
 		OPCODE(o2_roomOps),
 		/* F4 */
 		OPCODE(o5_getDist),
-		OPCODE(o2_findObject),
+		OPCODE(o5_findObject),
 		OPCODE(o2_walkActorToObject),
 		OPCODE(o2_clearState01),
 		/* F8 */
@@ -450,9 +450,9 @@
 
 	if (whereIsObject(obj) != WIO_NOT_FOUND) {
 		ObjectData *od = &_objs[getObjectIndex(obj)];
-		_vars[_resultVarNumber] = od->walk_y >> 5;
+		setResult(od->walk_y >> 5);
 	} else {
-		_vars[_resultVarNumber] = 0xFF;
+		setResult(0xFF);
 	}
 }
 
@@ -481,7 +481,7 @@
 	int bit_offset = bit_var & 0x0f;
 	bit_var >>= 4;
 
-	_vars[_resultVarNumber] = (_vars[bit_var] & (1 << bit_offset)) ? 1 : 0;
+	setResult((_vars[bit_var] & (1 << bit_offset)) ? 1 : 0);
 }
 
 void Scumm_v2::ifStateCommon(byte type) {
@@ -944,7 +944,7 @@
 	getResultPos();
 	x = getVarOrDirectByte(0x80);
 	y = getVarOrDirectByte(0x40);
-	_vars[_resultVarNumber] = getActorFromPos(x, y);
+	setResult(getActorFromPos(x, y));
 }
 
 void Scumm_v2::o2_saveLoadGame() {
@@ -952,7 +952,7 @@
 	byte a = getVarOrDirectByte(0x80);
 
 	error("TODO: o2_saveLoadGame(%d)", a);
-	_vars[_resultVarNumber] = 0;
+	setResult(0);
 }
 
 void Scumm_v2::o2_getActorX() {
@@ -960,7 +960,7 @@
 	getResultPos();
 
 	a = getVarOrDirectByte(0x80);
-	_vars[_resultVarNumber] = getObjX(a);
+	setResult(getObjX(a));
 }
 
 void Scumm_v2::o2_getActorY() {
@@ -968,7 +968,7 @@
 	getResultPos();
 
 	a = getVarOrDirectByte(0x80);
-	_vars[_resultVarNumber] = getObjY(a);
+	setResult(getObjY(a));
 }
 
 void Scumm_v2::o2_loadRoomWithEgo() {
@@ -1053,13 +1053,6 @@
 	}
 }
 
-void Scumm_v2::o2_findObject() {
-	getResultPos();
-	int x = getVarOrDirectByte(0x80);
-	int y = getVarOrDirectByte(0x40);
-	_vars[_resultVarNumber] = findObject(x, y);
-}
-
 void Scumm_v2::o2_cutscene() {
 	warning("TODO o2_cutscene()");
 }
@@ -1142,36 +1135,14 @@
 	warning("TODO: o2_cursorCommand()");
 }
 
-void Scumm_v2::o2_getClosestObjActor() {
-	int obj;
-	int act;
-	int closest_obj = 0xFF, closest_dist = 0xFF;
-	int dist;
-
-	getResultPos();
-
-	act = getVarOrDirectWord(0x80);
-	obj = _vars[VAR_ACTOR_RANGE_MAX];
-
-	do {
-		dist = getObjActToObjActDist(act, obj);
-		if (dist < closest_dist) {
-			closest_dist = dist;
-			closest_obj = obj;
-		}
-	} while (--obj >= _vars[VAR_ACTOR_RANGE_MIN]);
-
-	_vars[_resultVarNumber] = closest_dist;
-}
-
 void Scumm_v2::o2_getActorWalkBox() {
 	Actor *a;
 	getResultPos();
 	a = derefActorSafe(getVarOrDirectByte(0x80), "o2_getActorWalkbox");
 	if (a)
-		_vars[_resultVarNumber] = a->walkbox;
+		setResult(a->walkbox);
 	else
-		_vars[_resultVarNumber] = 0;
+		setResult(0);
 }
 
 void Scumm_v2::o2_drawSentence() {

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- script_v5.cpp	30 Apr 2003 05:55:06 -0000	1.55
+++ script_v5.cpp	30 Apr 2003 11:15:09 -0000	1.56
@@ -889,17 +889,17 @@
 }
 
 void Scumm_v5::o5_findInventory() {
-	int t;
 	getResultPos();
-	t = getVarOrDirectByte(0x80);
-	setResult(findInventory(t, getVarOrDirectByte(0x40)));
+	int x = getVarOrDirectByte(0x80);
+	int y = getVarOrDirectByte(0x40);
+	setResult(findInventory(x, y));
 }
 
 void Scumm_v5::o5_findObject() {
-	int t;
 	getResultPos();
-	t = getVarOrDirectWord(0x80);
-	setResult(findObject(t, getVarOrDirectWord(0x40)));
+	int x = getVarOrDirectByte(0x80);
+	int y = getVarOrDirectByte(0x40);
+	setResult(findObject(x, y));
 }
 
 void Scumm_v5::o5_freezeScripts() {
@@ -1078,7 +1078,7 @@
 	getResultPos();
 
 	act = getVarOrDirectWord(0x80);
-	obj = _vars[VAR_V5_OBJECT_HI];
+	obj = _vars[VAR_ACTOR_RANGE_MAX];
 
 	do {
 		dist = getObjActToObjActDist(act, obj);
@@ -1086,7 +1086,7 @@
 			closest_dist = dist;
 			closest_obj = obj;
 		}
-	} while (--obj >= _vars[VAR_V5_OBJECT_LO]);
+	} while (--obj >= _vars[VAR_ACTOR_RANGE_MIN]);
 
 	setResult(closest_dist);
 }

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -d -r1.172 -r1.173
--- scumm.h	30 Apr 2003 05:48:55 -0000	1.172
+++ scumm.h	30 Apr 2003 11:15:10 -0000	1.173
@@ -615,6 +615,7 @@
 	int _roomResource;  // FIXME - should be protected but Sound::pauseSounds accesses it
 	byte *findResourceData(uint32 tag, byte *ptr);
 	int getResourceDataSize(byte *ptr);
+	void dumpResource(char *tag, int index, byte *ptr, int length = -1);
 
 protected:
 	int getArrayId();
@@ -627,7 +628,6 @@
 	void expireResources(uint32 size);
 	void freeResources();
 	void destroy();
-	void dumpResource(char *tag, int index, byte *ptr, int length = -1);
 
 public:
 	/* Should be in Object class */
@@ -1111,8 +1111,6 @@
 
 	byte VAR_V5_DRAWFLAGS;
 	byte VAR_MI1_TIMER;
-	byte VAR_V5_OBJECT_LO;
-	byte VAR_V5_OBJECT_HI;
 	byte VAR_V5_TALK_STRING_Y;
 	byte VAR_V5_CHARFLAG;
 

Index: vars.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/vars.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- vars.cpp	24 Apr 2003 11:35:46 -0000	1.42
+++ vars.cpp	30 Apr 2003 11:15:11 -0000	1.43
@@ -97,9 +97,6 @@
 	VAR_V5_DRAWFLAGS = 9;
 	VAR_MI1_TIMER = 14;
 
-	VAR_V5_OBJECT_LO = 15;
-	VAR_V5_OBJECT_HI = 16;
-
 	VAR_V5_TALK_STRING_Y = 54;
 	VAR_V5_CHARFLAG = 60;
 
@@ -204,8 +201,6 @@
 
 	//VAR_V5_DRAWFLAGS = 9;
 	VAR_MI1_TIMER = 14;
-	VAR_V5_OBJECT_LO = 15;
-	VAR_V5_OBJECT_HI = 16;
 	VAR_V5_TALK_STRING_Y = 54;
 	VAR_V5_CHARFLAG = 60;
 





More information about the Scummvm-git-logs mailing list