[Scummvm-cvs-logs] CVS: scummvm/saga saga.h,1.42,1.43 scene.cpp,1.48,1.49 scene.h,1.14,1.15 script.h,1.23,1.24 sfuncs.cpp,1.30,1.31 sthread.cpp,1.34,1.35 xref.txt,1.9,1.10

Eugene Sandulenko sev at users.sourceforge.net
Wed Oct 27 15:20:03 CEST 2004


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

Modified Files:
	saga.h scene.cpp scene.h script.h sfuncs.cpp sthread.cpp 
	xref.txt 
Log Message:
Implement some script functions and report stubs.


Index: saga.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- saga.h	27 Oct 2004 21:32:27 -0000	1.42
+++ saga.h	27 Oct 2004 22:17:09 -0000	1.43
@@ -116,6 +116,9 @@
 	Events *_events;
 	PalAnim *_palanim;
 	
+	/** Random number generator */
+	Common::RandomSource _rnd;
+
 private:
 	int decodeBGImageRLE(const byte *inbuf, size_t inbuf_len, byte *outbuf, size_t outbuf_len);
 	int flipImage(byte *img_buf, int columns, int scanlines);

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- scene.cpp	27 Oct 2004 21:32:27 -0000	1.48
+++ scene.cpp	27 Oct 2004 22:17:09 -0000	1.49
@@ -411,6 +411,12 @@
 	return SUCCESS;
 }
 
+int Scene::getSceneLUT(int scene_num) { 
+	assert((scene_num > 0) && (scene_num < _sceneMax));
+
+	return _sceneLUT[scene_num];
+};
+
 int Scene::loadScene(int scene_num, int load_flag, SCENE_PROC scene_proc, SCENE_DESC *scene_desc_param, int fadeType) {
 	SCENE_INFO scene_info;
 	uint32 res_number = 0;

Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- scene.h	27 Oct 2004 21:32:28 -0000	1.14
+++ scene.h	27 Oct 2004 22:17:10 -0000	1.15
@@ -238,6 +238,9 @@
 	void sceneInfoCmd(int argc, char *argv[]);
 	void sceneChangeCmd(int argc, char *argv[]);
 
+	int getSceneLUT(int num);
+	int currentSceneNumber() { return _sceneNumber; }
+
  private:
 	int loadScene(int scene, int load_flag, SCENE_PROC scene_proc, SCENE_DESC *, 
 				  int fadeIn);

Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- script.h	27 Oct 2004 21:32:28 -0000	1.23
+++ script.h	27 Oct 2004 22:17:10 -0000	1.24
@@ -301,6 +301,11 @@
 	int SF_enableEscape(SCRIPTFUNC_PARAMS);
 	int SF_playSound(SCRIPTFUNC_PARAMS);
 	int SF_gotoScene(SCRIPTFUNC_PARAMS);
+	int SF_rand(SCRIPTFUNC_PARAMS);
+	int SF_sceneEq(SCRIPTFUNC_PARAMS);
+	int SF_placard(SCRIPTFUNC_PARAMS);
+	int SF_placardOff(SCRIPTFUNC_PARAMS);
+	int SF_fadeMusic(SCRIPTFUNC_PARAMS);
 };
 
 } // End of namespace Saga

Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- sfuncs.cpp	27 Oct 2004 21:32:28 -0000	1.30
+++ sfuncs.cpp	27 Oct 2004 22:17:10 -0000	1.31
@@ -37,6 +37,8 @@
 #include "saga/script.h"
 #include "saga/sdata.h"
 
+#include "saga/scene.h"
+
 namespace Saga {
 
 #define OPCODE(x) &Script::x
@@ -74,7 +76,7 @@
 		{28, 0, NULL},
 		{29, 2, OPCODE(SF_setActorState)},
 		{30, 3, OPCODE(SF_moveTo)},
-		{31, 0, NULL},
+		{31, 1, OPCODE(SF_sceneEq)},
 		{32, 0, NULL},
 		{33, 1, OPCODE(SF_finishBgdAnim)},
 		{34, 2, OPCODE(SF_swapActors)},
@@ -91,8 +93,8 @@
 		{45, 5, OPCODE(SF_walkRelative)},
 		{46, 5, OPCODE(SF_moveRelative)},
 		{47, 0, NULL},
-		{48, 0, NULL},
-		{49, 0, NULL},
+		{48, 0, OPCODE(SF_placard)},
+		{49, 0, OPCODE(SF_placardOff)},
 		{50, 0, NULL},
 		{51, 0, NULL},
 		{52, 6, OPCODE(SF_throwActor)},
@@ -118,8 +120,8 @@
 		{72, 0, NULL},
 		{73, 0, NULL},
 		{74, 0, NULL},
-		{75, 0, NULL},
-		{76, 0, NULL},
+		{75, 1, OPCODE(SF_rand)},
+		{76, 0, OPCODE(SF_fadeMusic)},
 		{77, 0, NULL}
 	};
 	_SFuncList = SFuncList;
@@ -143,7 +145,9 @@
 
 // Script function #2 (0x02)
 int Script::SF_takeObject(SCRIPTFUNC_PARAMS) {
-	thread->pop();
+	SDataWord_T param = thread->pop();
+
+	debug(1, "stub: SF_takeObject(%d)", param);
 	return SUCCESS;
 }
 
@@ -211,10 +215,12 @@
 
 // Script function #7 (0x07)
 int Script::SF_doAction(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+	SDataWord_T param3 = thread->pop();
+	SDataWord_T param4 = thread->pop();
+
+	debug(1, "stub: SF_doAction(%d, %d, %d, %d)", param1, param2, param3, param4);
 	return SUCCESS;
 }
 
@@ -246,14 +252,18 @@
 
 // Script function #9 (0x09)
 int Script::SF_startBgdAnim(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+
+	debug(1, "stub: SF_startBgdAnim(%d, %d)", param1, param2);
 	return SUCCESS;
 }
 
 // Script function #10 (0x0A)
 int Script::SF_stopBgdAnim(SCRIPTFUNC_PARAMS) {
-	thread->pop();
+	SDataWord_T param = thread->pop();
+
+	debug(1, "stub: SF_stopBgdAnim(%d)", param);
 	return SUCCESS;
 }
 
@@ -284,35 +294,45 @@
 
 // Script function #14 (0x0E)
 int Script::SF_faceTowards(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+
+	debug(1, "stub: SF_faceTowards(%d, %d)", param1, param2);
 	return SUCCESS;
 }
 
 // Script function #15 (0x0F)
 int Script::SF_setFollower(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+
+	debug(1, "stub: SF_setFollower(%d, %d)", param1, param2);
 	return SUCCESS;
 }
 
 // Script function #16 (0x10)
 int Script::SF_gotoScene(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+
+	debug(1, "stub: SF_gotoScene(%d, %d)", param1, param2);
 	return SUCCESS;
 }
 
 // Script function #23 (0x17)
 int Script::SF_setBgdAnimSpeed(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+
+	debug(1, "stub: SF_setBgdAnimSpeed(%d, %d)", param1, param2);
 	return SUCCESS;
 }
 
 // Script function #25 (0x19)
 int Script::SF_centerActor(SCRIPTFUNC_PARAMS) {
-	thread->pop();
+	SDataWord_T param = thread->pop();
+
+	debug(1, "stub: SF_centerActor(%d)", param);
 	return SUCCESS;
 }
 
@@ -378,8 +398,10 @@
 
 // Script function #29 (0x1D)
 int Script::SF_setActorState(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+
+	debug(1, "stub: SF_setActorState(%d, %d)", param1, param2);
 	return SUCCESS;
 }
 
@@ -420,16 +442,32 @@
 	return SUCCESS;
 }
 
+// Script function #31 (0x21)
+int Script::SF_sceneEq(SCRIPTFUNC_PARAMS) {
+	SDataWord_T param = thread->pop();
+
+	if (_vm->_scene->getSceneLUT(param) == _vm->_scene->currentSceneNumber())
+		thread->retVal = 1;
+	else 
+		thread->retVal = 0;
+	return SUCCESS;
+}
+
+
 // Script function #33 (0x21)
 int Script::SF_finishBgdAnim(SCRIPTFUNC_PARAMS) {
-	thread->pop();
+	SDataWord_T param = thread->pop();
+
+	debug(1, "stub: SF_finishBgdAnim(%d)", param);
 	return SUCCESS;
 }
 
 // Script function #34 (0x22)
 int Script::SF_swapActors(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+
+	debug(1, "stub: SF_swapActors(%d, %d)", param1, param2);
 	return SUCCESS;
 }
 
@@ -587,10 +625,12 @@
 
 // Script function #42 (0x2A)
 int Script::SF_scriptSpecialWalk(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+	SDataWord_T param3 = thread->pop();
+	SDataWord_T param4 = thread->pop();
+
+	debug(1, "stub: SF_scriptSpecialWalk(%d, %d, %d, %d)", param1, param2, param3, param4);
 	return SUCCESS;
 }
 
@@ -658,73 +698,103 @@
 
 // Script function #45 (0x2D)
 int Script::SF_walkRelative(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+	SDataWord_T param3 = thread->pop();
+	SDataWord_T param4 = thread->pop();
+	SDataWord_T param5 = thread->pop();
+
+	debug(1, "stub: SF_walkRelative(%d, %d, %d, %d, %d)", param1, param2, param3, param4, param5);
 	return SUCCESS;
 }
 
 // Script function #46 (0x2E)
 int Script::SF_moveRelative(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+	SDataWord_T param3 = thread->pop();
+	SDataWord_T param4 = thread->pop();
+	SDataWord_T param5 = thread->pop();
+
+	debug(1, "stub: SF_moveRelative(%d, %d, %d, %d, %d)", param1, param2, param3, param4, param5);
+	return SUCCESS;
+}
+
+// Script function #48 (0x30)
+int Script::SF_placard(SCRIPTFUNC_PARAMS) {
+	debug(1, "stub: SF_placard()");
+	return SUCCESS;
+}
+
+// Script function #49 (0x31)
+int Script::SF_placardOff(SCRIPTFUNC_PARAMS) {
+	debug(1, "stub: SF_placardOff()");
 	return SUCCESS;
 }
 
 // Script function #52 (0x34)
 int Script::SF_throwActor(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+	SDataWord_T param3 = thread->pop();
+	SDataWord_T param4 = thread->pop();
+	SDataWord_T param5 = thread->pop();
+	SDataWord_T param6 = thread->pop();
+
+	debug(1, "stub: SF_throwActor(%d, %d, %d, %d, %d, %d)", param1, param2, param3, param4, param5, param6);
 	return SUCCESS;
 }
 
 // Script function #53 (0x35)
 int Script::SF_waitWalk(SCRIPTFUNC_PARAMS) {
-	thread->pop();
+	SDataWord_T param = thread->pop();
+
+	debug(1, "stub: SF_waitWalk(%d)", param);
 	return SUCCESS;
 }
 
 // Script function #55 (0x37)
 int Script::SF_changeActorScene(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+
+	debug(1, "stub: SF_changeActorScene(%d, %d)", param1, param2);
 	return SUCCESS;
 }
 
 // Script function #56 (0x38)
 int Script::SF_climb(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+	SDataWord_T param3 = thread->pop();
+	SDataWord_T param4 = thread->pop();
+
+	debug(1, "stub: SF_climb(%d, %d, %d, %d)", param1, param2, param3, param4);
 	return SUCCESS;
 }
 
 // Script function #58 (0x3A)
 int Script::SF_setActorZ(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
+	SDataWord_T param1 = thread->pop();
+	SDataWord_T param2 = thread->pop();
+
+	debug(1, "stub: SF_setActorZ(%d, %d)", param1, param2);
 	return SUCCESS;
 }
 
 // Script function #60 (0x3C)
 int Script::SF_getActorX(SCRIPTFUNC_PARAMS) {
-	thread->pop();
+	SDataWord_T param = thread->pop();
+
+	debug(1, "stub: SF_getActorX(%d)", param);
 	return SUCCESS;
 }
 
 // Script function #61 (0x3D)
 int Script::SF_getActorY(SCRIPTFUNC_PARAMS) {
-	thread->pop();
+	SDataWord_T param = thread->pop();
+
+	debug(1, "stub: SF_getActorY(%d)", param);
 	return SUCCESS;
 }
 
@@ -835,4 +905,19 @@
 	return SUCCESS;
 }
 
+// Script function #75 (0x4d)
+int Script::SF_rand(SCRIPTFUNC_PARAMS) {
+	SDataWord_T param = thread->pop();
+
+	thread->retVal = (_vm->_rnd.getRandomNumber(param));
+
+	return SUCCESS;
+}
+
+// Script function #76 (0x4c)
+int Script::SF_fadeMusic(SCRIPTFUNC_PARAMS) {
+	debug(1, "stub: SF_fadeMusic()");
+	return SUCCESS;
+}
+
 } // End of namespace Saga

Index: sthread.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- sthread.cpp	27 Oct 2004 21:32:28 -0000	1.34
+++ sthread.cpp	27 Oct 2004 22:17:10 -0000	1.35
@@ -274,7 +274,7 @@
 		saved_offset = thread->i_offset;
 		in_char = scriptS.readByte();
 
-		debug(1, "Executing thread offset: %lu (%x) stack: %d", thread->i_offset, in_char, thread->stackSize());
+		debug(2, "Executing thread offset: %lu (%x) stack: %d", thread->i_offset, in_char, thread->stackSize());
 
 		switch (in_char) {
 		case 0x01: // nextblock
@@ -390,8 +390,8 @@
 
 				sfunc = _SFuncList[func_num].sfunc_fp;
 				if (sfunc == NULL) {
-					_vm->_console->print(S_WARN_PREFIX "%X: Undefined script function number: (%X)\n",
-							thread->i_offset, func_num);
+					_vm->_console->print(S_WARN_PREFIX "%X: Undefined script function number: #%d (%X)\n",
+							thread->i_offset, func_num, func_num);
 					_vm->_console->print(S_WARN_PREFIX "Removing %d operand(s) from stack.\n", n_args);
 					for (i = 0; i < n_args; i++) {
 						thread->pop();

Index: xref.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/xref.txt,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- xref.txt	27 Oct 2004 02:27:54 -0000	1.9
+++ xref.txt	27 Oct 2004 22:17:11 -0000	1.10
@@ -56,6 +56,7 @@
  resInfo->entryScript      _desc.sceneScriptNum
  resInfo->preScript        _desc.startScriptNum
  resInfo->backgroundMusic  _desc.musicRN
+ thisScene->ID             currentSceneNumber()
 
 Interp.c
 ========
@@ -73,3 +74,8 @@
 Actor.c
 =======
  abortAllSpeeches()        SThreadAbortAll()
+
+Main.c
+======
+ sceneIndexTable           _scene->getSceneLUT()
+





More information about the Scummvm-git-logs mailing list