[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.47,1.48 actor.h,1.9,1.10 script.cpp,1.37,1.38 script_v5.cpp,1.11,1.12 script_v6.cpp,1.33,1.34 scumm.h,1.124,1.125

Max Horn fingolfin at users.sourceforge.net
Wed Jan 1 10:23:14 CET 2003


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

Modified Files:
	actor.cpp actor.h script.cpp script_v5.cpp script_v6.cpp 
	scumm.h 
Log Message:
moved Scumm::faceActorToObj to Actor::faceToObject; moved various functions in script.cpp (grouping cutscene/override related stuff)

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- actor.cpp	31 Dec 2002 16:44:54 -0000	1.47
+++ actor.cpp	1 Jan 2003 18:22:40 -0000	1.48
@@ -27,7 +27,7 @@
 #include "charset.h"
 #include "costume.h"
 #include "resource.h"
-#include "scumm/sound.h"
+#include "sound.h"
 
 #include <math.h>
 
@@ -720,6 +720,20 @@
 	if (flags & 7) {
 		turnToDirection(facing);
 	}
+}
+
+void Actor::factToObject(int obj)
+{
+	int x2, y2, dir;
+	
+	if (!isInCurrentRoom())
+		return;
+
+	if (_vm->getObjectOrActorXY(obj, x2, y2) == -1)
+		return;
+
+	dir = (x2 > x) ? 90 : 270;
+	turnToDirection(dir);
 }
 
 void Actor::turnToDirection(int newdir)

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- actor.h	25 Dec 2002 21:04:47 -0000	1.9
+++ actor.h	1 Jan 2003 18:22:40 -0000	1.10
@@ -124,23 +124,16 @@
 	int actorWalkStep();
 	int remapDirection(int dir, bool is_walking);
 	void setupActorScale();
-public:
-	void stopActorMoving();
-	void startWalkAnim(int cmd, int angle);
-	void startAnimActor(int frame);
 
-protected:
 	void setBox(int box);
 	int updateActorDirection(bool is_walking);
+	void adjustActorPos();
 
 public:
-	void setDirection(int direction);
-	int getActorXYPos(int &x, int &y);
-
 	AdjustBoxResult adjustXYToBeInBox(int dstX, int dstY, int pathfrom);
-protected:
-	void adjustActorPos();
-public:
+
+	void setDirection(int direction);
+	void factToObject(int obj);
 	void turnToDirection(int newdir);
 	void walkActor();
 	void drawActorCostume();
@@ -148,6 +141,9 @@
 	void setActorCostume(int c);
 	byte *getActorName();
 	void startWalkActor(int x, int y, int dir);
+	void stopActorMoving();
+	void startWalkAnim(int cmd, int angle);
+	void startAnimActor(int frame);
 
 	void remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold);
 	void walkActorOld();
@@ -158,6 +154,8 @@
 		return room == _vm->_currentRoom;
 	}
 	
+	int getActorXYPos(int &x, int &y);
+
 	int getRoom() {
 		return room;
 	}

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- script.cpp	1 Jan 2003 17:57:13 -0000	1.37
+++ script.cpp	1 Jan 2003 18:22:40 -0000	1.38
@@ -758,6 +758,43 @@
 	}
 }
 
+void Scumm::doSentence(int c, int b, int a)
+{
+	SentenceTab *st;
+
+	if (_features & GF_AFTER_V7) {
+
+		if (b == a)
+			return;
+
+		st = &_sentence[_sentenceNum - 1];
+		
+		
+		// Check if this doSentence request is identical to the previous one;
+		// if yes, ignore this invocation.
+		if (_sentenceNum && st->unk5 == c && st->unk4 == b && st->unk3 == a)
+			return;
+
+		_sentenceNum++;
+		st++;
+
+	} else {
+
+		st = &_sentence[_sentenceNum++];
+
+		if (!(st->unk3 & 0xFF00))
+			st->unk2 = 0;
+		else
+			st->unk2 = 1;
+
+	}
+
+	st->unk5 = c;
+	st->unk4 = b;
+	st->unk3 = a;
+	st->freezeCount = 0;
+}
+
 void Scumm::checkAndRunSentenceScript()
 {
 	int i;
@@ -915,62 +952,6 @@
 	}
 }
 
-void Scumm::endCutscene()
-{
-	ScriptSlot *ss = &vm.slot[_currentScript];
-	int args[16];
-
-	memset(args, 0, sizeof(args));
-
-	if (ss->cutsceneOverride > 0)	// Only terminate if active
-		ss->cutsceneOverride--;
-
-	args[0] = vm.cutSceneData[vm.cutSceneStackPointer];
-	_vars[VAR_OVERRIDE] = 0;
-
-	if (vm.cutScenePtr[vm.cutSceneStackPointer] && (ss->cutsceneOverride > 0))	// Only terminate if active
-		ss->cutsceneOverride--;
-
-	vm.cutSceneScript[vm.cutSceneStackPointer] = 0;
-	vm.cutScenePtr[vm.cutSceneStackPointer] = 0;
-	vm.cutSceneStackPointer--;
-
-	if (_vars[VAR_CUTSCENE_END_SCRIPT])
-		runScript(_vars[VAR_CUTSCENE_END_SCRIPT], 0, 0, args);
-}
-
-void Scumm::cutscene(int *args)
-{
-	int scr = _currentScript;
-	vm.slot[scr].cutsceneOverride++;
-
-	if (++vm.cutSceneStackPointer > sizeof(vm.cutSceneData) / sizeof(vm.cutSceneData[0]))
-		error("Cutscene stack overflow");
-
-	vm.cutSceneData[vm.cutSceneStackPointer] = args[0];
-	vm.cutSceneScript[vm.cutSceneStackPointer] = 0;
-	vm.cutScenePtr[vm.cutSceneStackPointer] = 0;
-
-	vm.cutSceneScriptIndex = scr;
-	if (_vars[VAR_CUTSCENE_START_SCRIPT])
-		runScript(_vars[VAR_CUTSCENE_START_SCRIPT], 0, 0, args);
-	vm.cutSceneScriptIndex = 0xFF;
-}
-
-void Scumm::faceActorToObj(int act, int obj)
-{
-	int x, x2, y, dir;
-
-	if (getObjectOrActorXY(act, x, y) == -1)
-		return;
-
-	if (getObjectOrActorXY(obj, x2, y) == -1)
-		return;
-
-	dir = (x2 > x) ? 90 : 270;
-	derefActorSafe(act, "faceActorToObj")->turnToDirection(dir);
-}
-
 bool Scumm::isScriptRunning(int script)
 {
 	int i;
@@ -992,38 +973,6 @@
 
 }
 
-
-void Scumm::beginOverride()
-{
-	int idx;
-
-	idx = vm.cutSceneStackPointer;
-	assert(idx < 5);
-
-	vm.cutScenePtr[idx] = _scriptPointer - _scriptOrgPointer;
-	vm.cutSceneScript[idx] = _currentScript;
-
-	// Skip the jump instruction following the override instruction
-	// (the jump is responsible for "skipping" cutscenes, and the reason
-	// why we record the current script position in vm.cutScenePtr).
-	fetchScriptByte();
-	fetchScriptWord();
-	_vars[VAR_OVERRIDE] = 0;
-}
-
-void Scumm::endOverride()
-{
-	int idx;
-
-	idx = vm.cutSceneStackPointer;
-	assert(idx < 5);
-
-	vm.cutScenePtr[idx] = 0;
-	vm.cutSceneScript[idx] = 0;
-	_vars[VAR_OVERRIDE] = 0;
-}
-
-
 int Scumm::defineArray(int array, int type, int dim2, int dim1)
 {
 	int id;
@@ -1139,6 +1088,48 @@
 	return num;
 }
 
+void Scumm::cutscene(int *args)
+{
+	int scr = _currentScript;
+	vm.slot[scr].cutsceneOverride++;
+
+	if (++vm.cutSceneStackPointer > sizeof(vm.cutSceneData) / sizeof(vm.cutSceneData[0]))
+		error("Cutscene stack overflow");
+
+	vm.cutSceneData[vm.cutSceneStackPointer] = args[0];
+	vm.cutSceneScript[vm.cutSceneStackPointer] = 0;
+	vm.cutScenePtr[vm.cutSceneStackPointer] = 0;
+
+	vm.cutSceneScriptIndex = scr;
+	if (_vars[VAR_CUTSCENE_START_SCRIPT])
+		runScript(_vars[VAR_CUTSCENE_START_SCRIPT], 0, 0, args);
+	vm.cutSceneScriptIndex = 0xFF;
+}
+
+void Scumm::endCutscene()
+{
+	ScriptSlot *ss = &vm.slot[_currentScript];
+	int args[16];
+
+	memset(args, 0, sizeof(args));
+
+	if (ss->cutsceneOverride > 0)	// Only terminate if active
+		ss->cutsceneOverride--;
+
+	args[0] = vm.cutSceneData[vm.cutSceneStackPointer];
+	_vars[VAR_OVERRIDE] = 0;
+
+	if (vm.cutScenePtr[vm.cutSceneStackPointer] && (ss->cutsceneOverride > 0))	// Only terminate if active
+		ss->cutsceneOverride--;
+
+	vm.cutSceneScript[vm.cutSceneStackPointer] = 0;
+	vm.cutScenePtr[vm.cutSceneStackPointer] = 0;
+	vm.cutSceneStackPointer--;
+
+	if (_vars[VAR_CUTSCENE_END_SCRIPT])
+		runScript(_vars[VAR_CUTSCENE_END_SCRIPT], 0, 0, args);
+}
+
 void Scumm::exitCutscene()
 {
 	uint32 offs = vm.cutScenePtr[vm.cutSceneStackPointer];
@@ -1151,44 +1142,37 @@
 		if (ss->cutsceneOverride > 0)
 			ss->cutsceneOverride--;
 
-printf("exitCutscene()\n");
 		_vars[VAR_OVERRIDE] = 1;
 		vm.cutScenePtr[vm.cutSceneStackPointer] = 0;
 	}
 }
-void Scumm::doSentence(int c, int b, int a)
-{
-	SentenceTab *st;
 
-	if (_features & GF_AFTER_V7) {
-
-		if (b == a)
-			return;
-
-		st = &_sentence[_sentenceNum - 1];
-		
-		
-		// Check if this doSentence request is identical to the previous one;
-		// if yes, ignore this invocation.
-		if (_sentenceNum && st->unk5 == c && st->unk4 == b && st->unk3 == a)
-			return;
+void Scumm::beginOverride()
+{
+	int idx;
 
-		_sentenceNum++;
-		st++;
+	idx = vm.cutSceneStackPointer;
+	assert(idx < 5);
 
-	} else {
+	vm.cutScenePtr[idx] = _scriptPointer - _scriptOrgPointer;
+	vm.cutSceneScript[idx] = _currentScript;
 
-		st = &_sentence[_sentenceNum++];
+	// Skip the jump instruction following the override instruction
+	// (the jump is responsible for "skipping" cutscenes, and the reason
+	// why we record the current script position in vm.cutScenePtr).
+	fetchScriptByte();
+	fetchScriptWord();
+	_vars[VAR_OVERRIDE] = 0;
+}
 
-		if (!(st->unk3 & 0xFF00))
-			st->unk2 = 0;
-		else
-			st->unk2 = 1;
+void Scumm::endOverride()
+{
+	int idx;
 
-	}
+	idx = vm.cutSceneStackPointer;
+	assert(idx < 5);
 
-	st->unk5 = c;
-	st->unk4 = b;
-	st->unk3 = a;
-	st->freezeCount = 0;
+	vm.cutScenePtr[idx] = 0;
+	vm.cutSceneScript[idx] = 0;
+	_vars[VAR_OVERRIDE] = 0;
 }

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- script_v5.cpp	28 Dec 2002 01:57:18 -0000	1.11
+++ script_v5.cpp	1 Jan 2003 18:22:40 -0000	1.12
@@ -866,9 +866,14 @@
 void Scumm_v5::o5_faceActor()
 {
 	int act, obj;
+	Actor *a;
 	act = getVarOrDirectByte(0x80);
 	obj = getVarOrDirectWord(0x40);
-	faceActorToObj(act, obj);
+
+	a = derefActorSafe(act, "o5_faceActor");
+	assert(a);
+
+	a->factToObject(obj);
 }
 
 void Scumm_v5::o5_findInventory()

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- script_v6.cpp	1 Jan 2003 17:57:13 -0000	1.33
+++ script_v6.cpp	1 Jan 2003 18:22:40 -0000	1.34
@@ -1135,10 +1135,11 @@
 
 void Scumm_v6::o6_faceActor()
 {
-	int act, obj;
-	obj = pop();
-	act = pop();
-	faceActorToObj(act, obj);
+	int obj = pop();
+	Actor *a = derefActorSafe(pop(), "o6_faceActor");
+	assert(a);
+
+	a->factToObject(obj);
 }
 
 void Scumm_v6::o6_animateActor()

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- scumm.h	1 Jan 2003 02:56:21 -0000	1.124
+++ scumm.h	1 Jan 2003 18:22:41 -0000	1.125
@@ -644,7 +644,6 @@
 	void resetActorBgs();
 	void processActors();
 	int getActorFromPos(int x, int y);
-	void faceActorToObj(int act, int obj);
 	void actorFollowCamera(int act);
 	
 	bool isCostumeInUse(int i);





More information about the Scummvm-git-logs mailing list