[Scummvm-cvs-logs] SF.net SVN: scummvm: [27936] scummvm/trunk/engines/saga

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Jul 6 14:39:01 CEST 2007


Revision: 27936
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27936&view=rev
Author:   thebluegr
Date:     2007-07-06 05:39:00 -0700 (Fri, 06 Jul 2007)

Log Message:
-----------
IHNM: sf103 is sfQueueMusic. Now, when doing a good/bad deed in IHNM, the music changes correctly

Modified Paths:
--------------
    scummvm/trunk/engines/saga/script.h
    scummvm/trunk/engines/saga/sfuncs.cpp

Modified: scummvm/trunk/engines/saga/script.h
===================================================================
--- scummvm/trunk/engines/saga/script.h	2007-07-06 12:34:57 UTC (rev 27935)
+++ scummvm/trunk/engines/saga/script.h	2007-07-06 12:39:00 UTC (rev 27936)
@@ -598,7 +598,7 @@
 	void sfClearGlobalFlag(SCRIPTFUNC_PARAMS);
 	void sfTestGlobalFlag(SCRIPTFUNC_PARAMS);
 	void sfSetPoints(SCRIPTFUNC_PARAMS);
-	void sf103(SCRIPTFUNC_PARAMS);
+	void sfQueueMusic(SCRIPTFUNC_PARAMS);
 	void sfDisableAbortSpeeches(SCRIPTFUNC_PARAMS);
 
 	void SF_stub(const char *name, ScriptThread *thread, int nArgs);

Modified: scummvm/trunk/engines/saga/sfuncs.cpp
===================================================================
--- scummvm/trunk/engines/saga/sfuncs.cpp	2007-07-06 12:34:57 UTC (rev 27935)
+++ scummvm/trunk/engines/saga/sfuncs.cpp	2007-07-06 12:39:00 UTC (rev 27936)
@@ -240,7 +240,7 @@
 		OPCODE(sfSetSpeechBox),
 		OPCODE(sfDebugShowData),
 		OPCODE(sfWaitFramesEsc),
-		OPCODE(sf103),
+		OPCODE(sfQueueMusic),
 		OPCODE(sfDisableAbortSpeeches)
 	};
 	if (_vm->getGameType() == GType_IHNM)
@@ -2119,8 +2119,38 @@
 	thread->_returnValue = _vm->_framesEsc;
 }
 
-void Script::sf103(SCRIPTFUNC_PARAMS) {
-	SF_stub("sf103", thread, nArgs);
+void Script::sfQueueMusic(SCRIPTFUNC_PARAMS) {
+	int16 param1 = thread->pop();
+	int16 param2 = thread->pop();
+	Event event;
+
+	if (param1 < 0) {
+		_vm->_music->stop();
+		return;
+	}
+
+	if (param1 >= _vm->_music->_songTableLen) {
+		warning("sfQueueMusic: Wrong song number (%d > %d)", param1, _vm->_music->_songTableLen - 1);
+	} else {
+		_vm->_music->setVolume(-1, 1);
+		event.type = kEvTOneshot;
+		event.code = kMusicEvent;
+		event.param = _vm->_music->_songTable[param1];
+		event.param2 = param2 ? MUSIC_LOOP : MUSIC_NORMAL;
+		event.op = kEventPlay;
+		event.time = 5 * 1000;	// we wait for 5x the duration here, to let the previous music track end
+								// TODO: original waits for 1000ms here, why is the 5x duration needed?
+
+		_vm->_events->queue(&event);
+
+		if (!_vm->_scene->haveChapterPointsChanged()) {
+			_vm->_scene->setCurrentMusicTrack(param1);
+			_vm->_scene->setCurrentMusicRepeat(param2);
+		} else {
+			// Don't save this music track when saving in IHNM
+			_vm->_scene->setChapterPointsChanged(false);
+		}
+	}
 }
 
 void Script::sfDisableAbortSpeeches(SCRIPTFUNC_PARAMS) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list