[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.62,2.63 script_v2.cpp,2.22,2.23

Pawel Kolodziejski aquadran at users.sourceforge.net
Sat Apr 26 13:04:05 CEST 2003


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

Modified Files:
	intern.h script_v2.cpp 
Log Message:
added more v2 opcodes

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.62
retrieving revision 2.63
diff -u -d -r2.62 -r2.63
--- intern.h	26 Apr 2003 16:37:34 -0000	2.62
+++ intern.h	26 Apr 2003 20:03:38 -0000	2.63
@@ -292,6 +292,20 @@
 	void o2_setObjectName();
 	void o2_getActorMoving();
 	void o2_add();
+	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_decrement();
+	void o2_divide();
 };
 
 class Scumm_v4 : public Scumm_v3 {

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.22
retrieving revision 2.23
diff -u -d -r2.22 -r2.23
--- script_v2.cpp	26 Apr 2003 16:56:59 -0000	2.22
+++ script_v2.cpp	26 Apr 2003 20:03:38 -0000	2.23
@@ -90,7 +90,7 @@
 		/* 2C */
 		OPCODE(o2_assignVarByte),
 		OPCODE(o2_putActorInRoom),
-		OPCODE(o5_delay),
+		OPCODE(o2_delay),
 		OPCODE(o2_ifNotState04),
 		/* 30 */
 		OPCODE(o2_matrixOps),
@@ -108,7 +108,7 @@
 		OPCODE(o2_subtract),
 		OPCODE(o2_waitForActor),
 		/* 3C */
-		OPCODE(o5_stopSound),
+		OPCODE(o2_stopSound),
 		OPCODE(o2_getActorElevation),
 		OPCODE(o2_walkActorTo),
 		OPCODE(o2_ifNotState01),
@@ -153,17 +153,17 @@
 		OPCODE(o2_walkActorTo),
 		OPCODE(o2_ifNotState02),
 		/* 60 */
-		OPCODE(o5_cursorCommand),
+		OPCODE(o2_cursorCommand),
 		OPCODE(o2_putActor),
-		OPCODE(o5_stopScript),
-		OPCODE(o5_getActorFacing),
+		OPCODE(o2_stopScript),
+		OPCODE(o2_getActorFacing),
 		/* 64 */
-		OPCODE(o5_loadRoomWithEgo),
-		OPCODE(o5_pickupObject),
-		OPCODE(o5_getClosestObjActor),
+		OPCODE(o2_loadRoomWithEgo),
+		OPCODE(o2_drawObject),
+		OPCODE(o2_getClosestObjActor),
 		OPCODE(o2_clearState04),
 		/* 68 */
-		OPCODE(o5_isScriptRunning),
+		OPCODE(o2_isScriptRunning),
 		OPCODE(o2_setOwnerOf),
 		OPCODE(o2_subDirect),
 		OPCODE(o5_dummy),
@@ -173,9 +173,9 @@
 		OPCODE(o5_dummy),
 		OPCODE(o2_ifState04),
 		/* 70 */
-		OPCODE(o5_lights),
-		OPCODE(o5_getActorCostume),
-		OPCODE(o5_loadRoom),
+		OPCODE(o2_lights),
+		OPCODE(o2_getActorCostume),
+		OPCODE(o2_loadRoom),
 		OPCODE(o2_roomOps),
 		/* 74 */
 		OPCODE(o2_getDist),
@@ -186,9 +186,9 @@
 		OPCODE(o2_isGreater),
 		OPCODE(o2_doSentence),
 		OPCODE(o2_verbOps),
-		OPCODE(o5_getActorWalkBox),
+		OPCODE(o2_getActorWalkBox),
 		/* 7C */
-		OPCODE(o5_isSoundRunning),
+		OPCODE(o2_isSoundRunning),
 		OPCODE(o2_getActorElevation),
 		OPCODE(o2_walkActorTo),
 		OPCODE(o2_ifNotState01),
@@ -235,11 +235,11 @@
 		/* A0 */
 		OPCODE(o5_stopObjectCode),
 		OPCODE(o2_putActor),
-		OPCODE(o5_getAnimCounter),
+		OPCODE(o2_saveLoadGame),
 		OPCODE(o2_getActorY),
 		/* A4 */
-		OPCODE(o5_loadRoomWithEgo),
-		OPCODE(o5_pickupObject),
+		OPCODE(o2_loadRoomWithEgo),
+		OPCODE(o2_drawObject),
 		OPCODE(o2_setVarRange),
 		OPCODE(o2_setState04),
 		/* A8 */
@@ -248,7 +248,7 @@
 		OPCODE(o2_addDirect),
 		OPCODE(o5_dummy),
 		/* AC */
-		OPCODE(o5_delay),
+		OPCODE(o2_delay),
 		OPCODE(o2_putActorInRoom),
 		OPCODE(o2_waitForSentence),
 		OPCODE(o2_ifNotState04),
@@ -268,19 +268,19 @@
 		OPCODE(o2_subtract),
 		OPCODE(o2_waitForActor),
 		/* BC */
-		OPCODE(o5_stopSound),
+		OPCODE(o2_stopSound),
 		OPCODE(o2_getActorElevation),
 		OPCODE(o2_walkActorTo),
 		OPCODE(o2_ifNotState01),
 		/* C0 */
-		OPCODE(o5_endCutscene),
+		OPCODE(o2_endCutscene),
 		OPCODE(o2_putActor),
 		OPCODE(o2_startScript),
 		OPCODE(o2_getActorX),
 		/* C4 */
 		OPCODE(o2_isLess),
 		OPCODE(o2_drawObject),
-		OPCODE(o5_decrement),
+		OPCODE(o2_decrement),
 		OPCODE(o2_clearState08),
 		/* C8 */
 		OPCODE(o2_isEqual),
@@ -306,24 +306,24 @@
 		OPCODE(o2_printEgo),
 		OPCODE(o2_doSentence),
 		OPCODE(o2_add),
-		OPCODE(o5_divide),
+		OPCODE(o2_divide),
 		/* DC */
 		OPCODE(o5_dummy),
 		OPCODE(o2_ifClassOfIs),
 		OPCODE(o2_walkActorTo),
 		OPCODE(o2_ifNotState02),
 		/* E0 */
-		OPCODE(o5_cursorCommand),
+		OPCODE(o2_cursorCommand),
 		OPCODE(o2_putActor),
-		OPCODE(o5_stopScript),
-		OPCODE(o5_getActorFacing),
+		OPCODE(o2_stopScript),
+		OPCODE(o2_getActorFacing),
 		/* E4 */
-		OPCODE(o5_loadRoomWithEgo),
-		OPCODE(o5_pickupObject),
-		OPCODE(o5_getClosestObjActor),
+		OPCODE(o2_loadRoomWithEgo),
+		OPCODE(o2_drawObject),
+		OPCODE(o2_getClosestObjActor),
 		OPCODE(o2_clearState04),
 		/* E8 */
-		OPCODE(o5_isScriptRunning),
+		OPCODE(o2_isScriptRunning),
 		OPCODE(o2_setOwnerOf),
 		OPCODE(o2_subDirect),
 		OPCODE(o5_dummy),
@@ -333,9 +333,9 @@
 		OPCODE(o5_dummy),
 		OPCODE(o2_ifState04),
 		/* F0 */
-		OPCODE(o5_lights),
-		OPCODE(o5_getActorCostume),
-		OPCODE(o5_loadRoom),
+		OPCODE(o2_lights),
+		OPCODE(o2_getActorCostume),
+		OPCODE(o2_loadRoom),
 		OPCODE(o2_roomOps),
 		/* F4 */
 		OPCODE(o2_getDist),
@@ -346,9 +346,9 @@
 		OPCODE(o2_isGreater),
 		OPCODE(o2_doSentence),
 		OPCODE(o2_verbOps),
-		OPCODE(o5_getActorWalkBox),
+		OPCODE(o2_getActorWalkBox),
 		/* FC */
-		OPCODE(o5_isSoundRunning),
+		OPCODE(o2_isSoundRunning),
 		OPCODE(o2_getActorElevation),
 		OPCODE(o2_walkActorTo),
 		OPCODE(o2_ifState01)
@@ -1246,11 +1246,20 @@
 	// TODO
 }
 
+void Scumm_v2::o2_endCutscene() {
+	// TODO
+}
+
 void Scumm_v2::o2_increment() {
 	getResultPos();
 	_vars[_resultVarNumber]++;
 }
 
+void Scumm_v2::o2_decrement() {
+	getResultPos();
+	_vars[_resultVarNumber]--;
+}
+
 void Scumm_v2::o2_chainScript() {
 	int data = getVarOrDirectByte(0x80);
 	int cur = _currentScript;
@@ -1346,3 +1355,138 @@
 	_vars[_resultVarNumber] += a;
 }
 
+void Scumm_v2::o2_cursorCommand() {
+	getVarOrDirectWord(0x80);
+	// TODO
+}
+
+void Scumm_v2::o2_stopScript() {
+	int script;
+
+	script = getVarOrDirectByte(0x80);
+	if (!script)
+		stopObjectCode();
+	else
+		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;
+	int closest_obj = 0xFF, closest_dist = 0xFF;
+	int dist;
+
+	getResultPos();
+
+	act = getVarOrDirectWord(0x80);
+	obj = _vars[VAR_V5_OBJECT_HI];
+
+	do {
+		dist = getObjActToObjActDist(act, obj);
+		if (dist < closest_dist) {
+			closest_dist = dist;
+			closest_obj = obj;
+		}
+	} while (--obj >= _vars[VAR_V5_OBJECT_LO]);
+
+	_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;
+
+	room = getVarOrDirectByte(0x80);
+
+	if (room != _currentRoom)
+		startScene(room, 0, 0);
+	_fullRedraw = 1;
+}
+
+void Scumm_v2::o2_getActorWalkBox() {
+	Actor *a;
+	getResultPos();
+	a = derefActorSafe(getVarOrDirectByte(0x80), "o2_getActorWalkbox");
+	if (a)
+		_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_divide() {
+	int a;
+	getResultPos();
+	a = getVarOrDirectWord(0x80);
+	if (a == 0) {
+		error("Divide by zero");
+		_vars[_resultVarNumber] = 0;
+	} else
+		_vars[_resultVarNumber] /= a;
+}





More information about the Scummvm-git-logs mailing list