[Scummvm-cvs-logs] CVS: scummvm/saga scene.cpp,1.37,1.38 script.h,1.15,1.16 sfuncs.cpp,1.18,1.19

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Wed Sep 22 23:54:06 CEST 2004


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

Modified Files:
	scene.cpp script.h sfuncs.cpp 
Log Message:
Added support for scene music and the music-playing opcode to make the
opening scene a bit nicer.


Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- scene.cpp	22 Sep 2004 07:05:23 -0000	1.37
+++ scene.cpp	23 Sep 2004 06:53:46 -0000	1.38
@@ -962,6 +962,17 @@
 			_vm->_script->SThreadCompleteThread();
 		}
 
+		if (_desc.musicRN >= 0) {
+			event.type = R_ONESHOT_EVENT;
+			event.code = R_MUSIC_EVENT;
+			event.param = _desc.musicRN;
+			event.op = EVENT_PLAY;
+			event.time = 0;
+
+			_vm->_events->queue(&event);
+		} else
+			_vm->_music->stop();
+
 		if (_desc.sceneScriptNum > 0) {
 			R_SCRIPT_THREAD *_sceneScriptThread;
 

Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- script.h	23 Sep 2004 06:46:44 -0000	1.15
+++ script.h	23 Sep 2004 06:53:46 -0000	1.16
@@ -252,6 +252,7 @@
 	int SF_setActorZ(R_SCRIPTFUNC_PARAMS);
 	int SF_getActorX(R_SCRIPTFUNC_PARAMS);
 	int SF_getActorY(R_SCRIPTFUNC_PARAMS);
+	int SF_playMusic(R_SCRIPTFUNC_PARAMS);
 };
 
 } // End of namespace Saga

Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- sfuncs.cpp	23 Sep 2004 06:46:44 -0000	1.18
+++ sfuncs.cpp	23 Sep 2004 06:53:46 -0000	1.19
@@ -104,7 +104,7 @@
 		{60, 0, OPCODE(SF_getActorX)},
 		{61, 0, OPCODE(SF_getActorY)},
 		{62, 0, NULL},
-		{63, 0, NULL},
+		{63, 0, OPCODE(SF_playMusic)},
 		{64, 0, NULL},
 		{65, 0, NULL},
 		{66, 0, NULL},
@@ -619,4 +619,47 @@
 	return R_SUCCESS;
 }
 
+static int musicTable[] = {
+	MUSIC_1,
+	MUSIC_2,
+	MUSIC_3,
+	MUSIC_4,
+	MUSIC_5,
+	MUSIC_6,
+	MUSIC_7,
+	MUSIC_8,
+	MUSIC_9,
+	MUSIC_10,
+	MUSIC_11,
+	MUSIC_12,
+	MUSIC_13,
+	MUSIC_14,
+	MUSIC_15,
+	MUSIC_16,
+	MUSIC_17,
+	MUSIC_18,
+	MUSIC_19,
+	MUSIC_20,
+	MUSIC_21,
+	MUSIC_22,
+	MUSIC_23,
+	MUSIC_24,
+	MUSIC_25,
+	MUSIC_26
+};
+
+// Script function #63
+int Script::SF_playMusic(R_SCRIPTFUNC_PARAMS) {
+	SDataWord_T param;
+
+	param = thread->pop();
+
+	if (/* param >= 0 && */ param < ARRAYSIZE(musicTable))
+		_vm->_music->play(musicTable[param], 0);
+	else
+		_vm->_music->stop();
+
+	return R_SUCCESS;
+}
+
 } // End of namespace Saga





More information about the Scummvm-git-logs mailing list