[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.65,2.66 script.cpp,1.65,1.66 script_v2.cpp,2.26,2.27 script_v5.cpp,1.42,1.43 scumm.h,1.168,1.169

Pawel Kolodziejski aquadran at users.sourceforge.net
Sun Apr 27 02:40:05 CEST 2003


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

Modified Files:
	intern.h script.cpp script_v2.cpp script_v5.cpp scumm.h 
Log Message:
and more share code

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.65
retrieving revision 2.66
diff -u -d -r2.65 -r2.66
--- intern.h	27 Apr 2003 07:52:25 -0000	2.65
+++ intern.h	27 Apr 2003 09:39:51 -0000	2.66
@@ -46,8 +46,6 @@
 
 	void decodeParseString();
 	int getWordVararg(int *ptr);
-	int getVarOrDirectWord(byte mask);
-	int getVarOrDirectByte(byte mask);
 
 	/* Version 5 script opcodes */
 	void o5_actorFollowCamera();
@@ -248,23 +246,13 @@
 	void o2_notEqualZero();
 	void o2_startScript();
 	void o2_panCameraTo();
-	void o2_move();
-	void o2_startMusic();
-	void o2_getActorRoom();
 	void o2_getActorElevation();
-	void o2_walkActorToActor();
 	void o2_walkActorToObject();
-	void o2_faceActor();
 	void o2_putActorAtObject();
-	void o2_getObjectOwner();
 	void o2_animateActor();
 	void o2_print();
 	void o2_actorFromPos();
 	void o2_getVerbEntrypoint();
-	void o2_isScriptRunning();
-	void o2_getRandomNr();
-	void o2_startSound();
-	void o2_getAnimCounter();
 	void o2_saveLoadGame();
 	void o2_getActorX();
 	void o2_getActorY();
@@ -283,18 +271,11 @@
 	void o2_pickupObject();
 	void o2_actorFollowCamera();
 	void o2_setObjectName();
-	void o2_getActorMoving();
 	void o2_cursorCommand();
 	void o2_stopScript();
-	void o2_getActorFacing();
 	void o2_getClosestObjActor();
-	void o2_lights();
-	void o2_getActorCostume();
 	void o2_loadRoom();
 	void o2_getActorWalkBox();
-	void o2_isSoundRunning();
-	void o2_delay();
-	void o2_stopSound();
 	void o2_endCutscene();
 	void o2_drawSentence();
 };

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- script.cpp	27 Apr 2003 07:52:25 -0000	1.65
+++ script.cpp	27 Apr 2003 09:39:52 -0000	1.66
@@ -336,7 +336,6 @@
 			return readVar(fetchScriptByte());
 		else
 			return readVar(fetchScriptWord());
-
 	return fetchScriptByte();
 }
 
@@ -346,7 +345,7 @@
 			return readVar(fetchScriptByte());
 		else
 			return readVar(fetchScriptWord());
-	return fetchScriptWord();
+	return (int16)fetchScriptWord();
 }
 
 #ifndef BYPASS_COPY_PROT

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.26
retrieving revision 2.27
diff -u -d -r2.26 -r2.27
--- script_v2.cpp	27 Apr 2003 09:03:26 -0000	2.26
+++ script_v2.cpp	27 Apr 2003 09:39:52 -0000	2.27
@@ -35,8 +35,8 @@
 		/* 00 */
 		OPCODE(o5_stopObjectCode),
 		OPCODE(o2_putActor),
-		OPCODE(o2_startMusic),
-		OPCODE(o2_getActorRoom),
+		OPCODE(o5_startMusic),
+		OPCODE(o5_getActorRoom),
 		/* 04 */
 		OPCODE(o2_isGreaterEqual),
 		OPCODE(o2_drawObject),
@@ -44,31 +44,31 @@
 		OPCODE(o2_setState08),
 		/* 08 */
 		OPCODE(o2_isNotEqual),
-		OPCODE(o2_faceActor),
+		OPCODE(o5_faceActor),
 		OPCODE(o2_assignVarWordDirect),
 		OPCODE(o2_setObjY),
 		/* 0C */
 		OPCODE(o2_resourceRoutines),
-		OPCODE(o2_walkActorToActor),
+		OPCODE(o5_walkActorToActor),
 		OPCODE(o2_putActorAtObject),
 		OPCODE(o2_ifNotState08),
 		/* 10 */
-		OPCODE(o2_getObjectOwner),
+		OPCODE(o5_getObjectOwner),
 		OPCODE(o2_animateActor),
 		OPCODE(o2_panCameraTo),
 		OPCODE(o2_actorSet),
 		/* 14 */
 		OPCODE(o2_print),
 		OPCODE(o2_actorFromPos),
-		OPCODE(o2_getRandomNr),
+		OPCODE(o5_getRandomNr),
 		OPCODE(o2_setState04),
 		/* 18 */
 		OPCODE(o5_jumpRelative),
 		OPCODE(o2_doSentence),
-		OPCODE(o2_move),
+		OPCODE(o5_move),
 		OPCODE(o2_setBitVar),
 		/* 1C */
-		OPCODE(o2_startSound),
+		OPCODE(o5_startSound),
 		OPCODE(o2_ifClassOfIs),
 		OPCODE(o2_walkActorTo),
 		OPCODE(o2_ifState02),
@@ -90,7 +90,7 @@
 		/* 2C */
 		OPCODE(o2_assignVarByte),
 		OPCODE(o2_putActorInRoom),
-		OPCODE(o2_delay),
+		OPCODE(o5_delay),
 		OPCODE(o2_ifNotState04),
 		/* 30 */
 		OPCODE(o2_matrixOps),
@@ -108,7 +108,7 @@
 		OPCODE(o5_subtract),
 		OPCODE(o2_waitForActor),
 		/* 3C */
-		OPCODE(o2_stopSound),
+		OPCODE(o5_stopSound),
 		OPCODE(o2_getActorElevation),
 		OPCODE(o2_walkActorTo),
 		OPCODE(o2_ifNotState01),
@@ -124,12 +124,12 @@
 		OPCODE(o2_setState08),
 		/* 48 */
 		OPCODE(o2_isEqual),
-		OPCODE(o2_faceActor),
+		OPCODE(o5_faceActor),
 		OPCODE(o2_chainScript),
 		OPCODE(o2_setObjY),
 		/* 4C */
 		OPCODE(o2_waitForSentence),
-		OPCODE(o2_walkActorToActor),
+		OPCODE(o5_walkActorToActor),
 		OPCODE(o2_putActorAtObject),
 		OPCODE(o2_ifState08),
 		/* 50 */
@@ -140,7 +140,7 @@
 		/* 54 */
 		OPCODE(o2_setObjectName),
 		OPCODE(o2_actorFromPos),
-		OPCODE(o2_getActorMoving),
+		OPCODE(o5_getActorMoving),
 		OPCODE(o2_setState02),
 		/* 58 */
 		OPCODE(beginOverride),
@@ -156,14 +156,14 @@
 		OPCODE(o2_cursorCommand),
 		OPCODE(o2_putActor),
 		OPCODE(o2_stopScript),
-		OPCODE(o2_getActorFacing),
+		OPCODE(o5_getActorFacing),
 		/* 64 */
 		OPCODE(o2_loadRoomWithEgo),
 		OPCODE(o2_drawObject),
 		OPCODE(o2_getClosestObjActor),
 		OPCODE(o2_clearState04),
 		/* 68 */
-		OPCODE(o2_isScriptRunning),
+		OPCODE(o5_isScriptRunning),
 		OPCODE(o2_setOwnerOf),
 		OPCODE(o2_subDirect),
 		OPCODE(o5_dummy),
@@ -173,8 +173,8 @@
 		OPCODE(o5_dummy),
 		OPCODE(o2_ifState04),
 		/* 70 */
-		OPCODE(o2_lights),
-		OPCODE(o2_getActorCostume),
+		OPCODE(o5_lights),
+		OPCODE(o5_getActorCostume),
 		OPCODE(o2_loadRoom),
 		OPCODE(o2_roomOps),
 		/* 74 */
@@ -188,15 +188,15 @@
 		OPCODE(o2_verbOps),
 		OPCODE(o2_getActorWalkBox),
 		/* 7C */
-		OPCODE(o2_isSoundRunning),
+		OPCODE(o5_isSoundRunning),
 		OPCODE(o2_getActorElevation),
 		OPCODE(o2_walkActorTo),
 		OPCODE(o2_ifNotState01),
 		/* 80 */
 		OPCODE(o5_breakHere),
 		OPCODE(o2_putActor),
-		OPCODE(o2_startMusic),
-		OPCODE(o2_getActorRoom),
+		OPCODE(o5_startMusic),
+		OPCODE(o5_getActorRoom),
 		/* 84 */
 		OPCODE(o2_isGreaterEqual),
 		OPCODE(o2_drawObject),
@@ -204,23 +204,23 @@
 		OPCODE(o2_setState08),
 		/* 88 */
 		OPCODE(o2_isNotEqual),
-		OPCODE(o2_faceActor),
+		OPCODE(o5_faceActor),
 		OPCODE(o2_assignVarWordDirect),
 		OPCODE(o2_setObjY),
 		/* 8C */
 		OPCODE(o2_resourceRoutines),
-		OPCODE(o2_walkActorToActor),
+		OPCODE(o5_walkActorToActor),
 		OPCODE(o2_putActorAtObject),
 		OPCODE(o2_ifNotState08),
 		/* 90 */
-		OPCODE(o2_getObjectOwner),
+		OPCODE(o5_getObjectOwner),
 		OPCODE(o2_animateActor),
 		OPCODE(o2_panCameraTo),
 		OPCODE(o2_actorSet),
 		/* 94 */
 		OPCODE(o2_print),
 		OPCODE(o2_actorFromPos),
-		OPCODE(o2_getRandomNr),
+		OPCODE(o5_getRandomNr),
 		OPCODE(o2_setState02),
 		/* 98 */
 		OPCODE(o2_restart),
@@ -228,7 +228,7 @@
 		OPCODE(o2_assignVarWord),
 		OPCODE(o2_setBitVar),
 		/* 9C */
-		OPCODE(o2_startSound),
+		OPCODE(o5_startSound),
 		OPCODE(o2_ifClassOfIs),
 		OPCODE(o2_walkActorTo),
 		OPCODE(o2_ifState02),
@@ -268,7 +268,7 @@
 		OPCODE(o5_subtract),
 		OPCODE(o2_waitForActor),
 		/* BC */
-		OPCODE(o2_stopSound),
+		OPCODE(o5_stopSound),
 		OPCODE(o2_getActorElevation),
 		OPCODE(o2_walkActorTo),
 		OPCODE(o2_ifNotState01),
@@ -284,12 +284,12 @@
 		OPCODE(o2_clearState08),
 		/* C8 */
 		OPCODE(o2_isEqual),
-		OPCODE(o2_faceActor),
+		OPCODE(o5_faceActor),
 		OPCODE(o2_chainScript),
 		OPCODE(o2_setObjY),
 		/* CC */
 		OPCODE(o5_pseudoRoom),
-		OPCODE(o2_walkActorToActor),
+		OPCODE(o5_walkActorToActor),
 		OPCODE(o2_putActorAtObject),
 		OPCODE(o2_ifState08),
 		/* D0 */
@@ -300,7 +300,7 @@
 		/* D4 */
 		OPCODE(o2_setObjectName),
 		OPCODE(o2_actorFromPos),
-		OPCODE(o2_getActorMoving),
+		OPCODE(o5_getActorMoving),
 		OPCODE(o2_setState02),
 		/* D8 */
 		OPCODE(o2_printEgo),
@@ -316,14 +316,14 @@
 		OPCODE(o2_cursorCommand),
 		OPCODE(o2_putActor),
 		OPCODE(o2_stopScript),
-		OPCODE(o2_getActorFacing),
+		OPCODE(o5_getActorFacing),
 		/* E4 */
 		OPCODE(o2_loadRoomWithEgo),
 		OPCODE(o2_drawObject),
 		OPCODE(o2_getClosestObjActor),
 		OPCODE(o2_clearState04),
 		/* E8 */
-		OPCODE(o2_isScriptRunning),
+		OPCODE(o5_isScriptRunning),
 		OPCODE(o2_setOwnerOf),
 		OPCODE(o2_subDirect),
 		OPCODE(o5_dummy),
@@ -333,8 +333,8 @@
 		OPCODE(o5_dummy),
 		OPCODE(o2_ifState04),
 		/* F0 */
-		OPCODE(o2_lights),
-		OPCODE(o2_getActorCostume),
+		OPCODE(o5_lights),
+		OPCODE(o5_getActorCostume),
 		OPCODE(o2_loadRoom),
 		OPCODE(o2_roomOps),
 		/* F4 */
@@ -348,7 +348,7 @@
 		OPCODE(o2_verbOps),
 		OPCODE(o2_getActorWalkBox),
 		/* FC */
-		OPCODE(o2_isSoundRunning),
+		OPCODE(o5_isSoundRunning),
 		OPCODE(o2_getActorElevation),
 		OPCODE(o2_walkActorTo),
 		OPCODE(o2_ifState01)
@@ -463,7 +463,7 @@
 
 	int bit_var = (hi << 8) + lo + a;
 	int bit_offset = bit_var & 0x0f;
-  bit_var >>= 4;
+	bit_var >>= 4;
 
 	if (getVarOrDirectByte(0x80))
 		_vars[bit_var] |= (1 << bit_offset);
@@ -479,7 +479,7 @@
 
 	int bit_var = (hi << 8) + lo + a;
 	int bit_offset = bit_var & 0x0f;
-  bit_var >>= 4;
+	bit_var >>= 4;
 
 	_vars[_resultVarNumber] = (_vars[bit_var] & (1 << bit_offset)) ? 1 : 0;
 }
@@ -887,30 +887,6 @@
 	panCameraTo(getVarOrDirectByte(0x80), 0);
 }
 
-void Scumm_v2::o2_move() {
-	getResultPos();
-	_vars[_resultVarNumber] = getVarOrDirectWord(0x80);
-}
-
-void Scumm_v2::o2_startMusic() {
-	_sound->addSoundToQueue(getVarOrDirectByte(0x80));
-}
-
-void Scumm_v2::o2_getActorRoom() {
-	int act;
-	Actor *a;
-	getResultPos();
-	act = getVarOrDirectByte(0x80);
-
-	a = derefActorSafe(act, "o2_getActorRoom");
-	if (!a) {
-		warning("Invalid actor %d in o2_getActorRoom", act);
-		return;
-	}
-
-	_vars[_resultVarNumber] = a->room;
-}
-
 void Scumm_v2::o2_getActorElevation() {
 	int act;
 	Actor *a;
@@ -926,51 +902,12 @@
 	_vars[_resultVarNumber] = a->elevation;
 }
 
-void Scumm_v2::o2_walkActorToActor() {
-	int b, x, y;
-	Actor *a, *a2;
-	int nr;
-	int nr2 = getVarOrDirectByte(0x80);
-	a = derefActorSafe(nr2, "o2_walkActorToActor");
-	if (!a)
-		return;
-
-	if (!a->isInCurrentRoom()) {
-		getVarOrDirectByte(0x40);
-		fetchScriptByte();
-		return;
-	}
-
-	nr = getVarOrDirectByte(0x40);
-	a2 = derefActorSafe(nr, "o2_walkActorToActor(2)");
-	if (!a2)
-		return;
-
-	if (!a2->isInCurrentRoom()) {
-		fetchScriptByte();
-		return;
-	}
-	b = fetchScriptByte();				/* distance from actor */
-	if (b == 0xFF) {
-		b = a2->scalex * a->width / 0xFF;
-		b = b + b / 2;
-	}
-	x = a2->x;
-	y = a2->y;
-	if (x < a->x)
-		x += b;
-	else
-		x -= b;
-
-	a->startWalkActor(x, y, -1);
-}
-
 void Scumm_v2::o2_walkActorToObject() {
 	int obj;
 	Actor *a;
 
 	a = derefActorSafe(getVarOrDirectByte(0x80), "o2_walkActorToObject");
-	obj = getVarOrDirectWord(0x40);
+	obj = getVarOrDirectByte(0x40);
 	if (whereIsObject(obj) != WIO_NOT_FOUND) {
 		int x, y, dir;
 		getObjectXYPos(obj, x, y, dir);
@@ -978,24 +915,12 @@
 	}
 }
 
-void Scumm_v2::o2_faceActor() {
-	int act, obj;
-	Actor *a;
-	act = getVarOrDirectByte(0x80);
-	obj = getVarOrDirectWord(0x40);
-
-	a = derefActorSafe(act, "o2_faceActor");
-	assert(a);
-
-	a->faceToObject(obj);
-}
-
 void Scumm_v2::o2_putActorAtObject() {
 	int obj, x, y;
 	Actor *a;
 
 	a = derefActorSafe(getVarOrDirectByte(0x80), "o2_putActorAtObject");
-	obj = getVarOrDirectWord(0x40);
+	obj = getVarOrDirectByte(0x40);
 	if (whereIsObject(obj) != WIO_NOT_FOUND)
 		getObjectXYPos(obj, x, y);
 	else {
@@ -1005,11 +930,6 @@
 	a->putActor(x, y, a->room);
 }
 
-void Scumm_v2::o2_getObjectOwner() {
-	getResultPos();
-	_vars[_resultVarNumber] = getOwner(getVarOrDirectWord(0x80));
-}
-
 void Scumm_v2::o2_animateActor() {
 	int act = getVarOrDirectByte(0x80);
 	int anim = getVarOrDirectByte(0x40);
@@ -1034,16 +954,6 @@
 	_vars[_resultVarNumber] = getActorFromPos(x, y);
 }
 
-void Scumm_v2::o2_getRandomNr() {
-	getResultPos();
-	_vars[_resultVarNumber] = _rnd.getRandomNumber(getVarOrDirectByte(0x80));
-}
-
-void Scumm_v2::o2_isScriptRunning() {
-	getResultPos();
-	_vars[_resultVarNumber] = isScriptRunning(getVarOrDirectByte(0x80));
-}
-
 void Scumm_v2::o2_getVerbEntrypoint() {
 	int a, b;
 	getResultPos();
@@ -1053,11 +963,6 @@
 	_vars[_resultVarNumber] = getVerbEntrypoint(a, b);
 }
 
-void Scumm_v2::o2_startSound() {
-	_vars[VAR_MUSIC_FLAG] = 0;
-	_sound->addSoundToQueue(getVarOrDirectByte(0x80));
-}
-
 void Scumm_v2::o2_saveLoadGame() {
 	getResultPos();
 	byte a = getVarOrDirectByte(0x80);
@@ -1289,21 +1194,6 @@
 	runHook(0);
 }
 
-void Scumm_v2::o2_getActorMoving() {
-	int act;
-	Actor *a;
-	getResultPos();
-	act = getVarOrDirectByte(0x80);
-
-	a = derefActorSafe(act, "o2_getActorMoving");
-	if (!a) {
-		warning("Invalid actor %d in o2_getActorMoving", act);
-		return;
-	}
-
-	_vars[_resultVarNumber] = a->moving;
-}
-
 void Scumm_v2::o2_cursorCommand() {
 	getVarOrDirectWord(0x80);
 	// TODO
@@ -1319,21 +1209,6 @@
 		stopScriptNr(script);
 }
 
-void Scumm_v2::o2_getActorFacing() {
-	int act;
-	Actor *a;
-	getResultPos();
-	act = getVarOrDirectByte(0x80);
-
-	a = derefActorSafe(act, "o2_getActorFacing");
-	if (!a) {
-		warning("Invalid actor %d in o2_getActorFacing", act);
-		return;
-	}
-
-	_vars[_resultVarNumber] = newDirToOldDir(a->facing);
-}
-
 void Scumm_v2::o2_getClosestObjActor() {
 	int obj;
 	int act;
@@ -1356,37 +1231,6 @@
 	_vars[_resultVarNumber] = closest_dist;
 }
 
-void Scumm_v2::o2_lights() {
-	int a, b, c;
-
-	a = getVarOrDirectByte(0x80);
-	b = fetchScriptByte();
-	c = fetchScriptByte();
-
-	if (c == 0)
-		_vars[VAR_CURRENT_LIGHTS] = a;
-	else if (c == 1) {
-		_flashlightXStrips = a;
-		_flashlightYStrips = b;
-	}
-	_fullRedraw = 1;
-}
-
-void Scumm_v2::o2_getActorCostume() {
-	int act;
-	Actor *a;
-	getResultPos();
-	act = getVarOrDirectByte(0x80);
-
-	a = derefActorSafe(act, "o2_getActorCostume");
-	if (!a) {
-		warning("Invalid actor %d in o2_getActorCostume", act);
-		return;
-	}
-
-	_vars[_resultVarNumber] = a->costume;
-}
-
 void Scumm_v2::o2_loadRoom() {
 	int room;
 
@@ -1405,28 +1249,6 @@
 		_vars[_resultVarNumber] = a->walkbox;
 	else
 		_vars[_resultVarNumber] = 0;
-}
-
-void Scumm_v2::o2_isSoundRunning() {
-	int snd;
-	getResultPos();
-	snd = getVarOrDirectByte(0x80);
-	if (snd)
-		snd = _sound->isSoundRunning(snd);
-	_vars[_resultVarNumber] = snd;
-}
-
-void Scumm_v2::o2_delay() {
-	int delay = fetchScriptByte();
-	delay |= fetchScriptByte() << 8;
-	delay |= fetchScriptByte() << 16;
-	vm.slot[_currentScript].delay = delay;
-	vm.slot[_currentScript].status = 1;
-	o5_breakHere();
-}
-
-void Scumm_v2::o2_stopSound() {
-	_sound->stopSound(getVarOrDirectByte(0x80));
 }
 
 void Scumm_v2::o2_drawSentence() {

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- script_v5.cpp	26 Apr 2003 16:52:11 -0000	1.42
+++ script_v5.cpp	27 Apr 2003 09:39:52 -0000	1.43
@@ -2375,18 +2375,6 @@
 	return i;
 }
 
-int Scumm_v5::getVarOrDirectWord(byte mask) {
-	if (_opcode & mask)
-		return readVar(fetchScriptWord());
-	return (int16)fetchScriptWord();
-}
-
-int Scumm_v5::getVarOrDirectByte(byte mask) {
-	if (_opcode & mask)
-		return readVar(fetchScriptWord());
-	return fetchScriptByte();
-}
-
 void Scumm_v5::decodeParseString() {
 	int textSlot;
 

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -d -r1.168 -r1.169





More information about the Scummvm-git-logs mailing list