[Scummvm-cvs-logs] SF.net SVN: scummvm: [25632] scummvm/trunk/engines/agos

kirben at users.sourceforge.net kirben at users.sourceforge.net
Fri Feb 16 14:55:02 CET 2007


Revision: 25632
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25632&view=rev
Author:   kirben
Date:     2007-02-16 05:55:01 -0800 (Fri, 16 Feb 2007)

Log Message:
-----------
Add support for using soundtrack from the Simon the Sorcerer 1 - Music Enhancement Project.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/event.cpp
    scummvm/trunk/engines/agos/res_snd.cpp

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2007-02-16 13:41:38 UTC (rev 25631)
+++ scummvm/trunk/engines/agos/agos.h	2007-02-16 13:55:01 UTC (rev 25632)
@@ -1397,6 +1397,8 @@
 	void windowDrawChar(WindowBlock *window, uint x, uint y, byte chr);
 
 	void loadMusic(uint music);
+	void loadModule(uint music);
+
 	void checkTimerCallback();
 	void delay(uint delay);
 	void pause();

Modified: scummvm/trunk/engines/agos/event.cpp
===================================================================
--- scummvm/trunk/engines/agos/event.cpp	2007-02-16 13:41:38 UTC (rev 25631)
+++ scummvm/trunk/engines/agos/event.cpp	2007-02-16 13:55:01 UTC (rev 25632)
@@ -31,6 +31,8 @@
 
 #include "gui/about.h"
 
+#include "sound/audiocd.h"
+
 namespace AGOS {
 
 void AGOSEngine::addTimeEvent(uint timeout, uint subroutine_id) {
@@ -302,6 +304,8 @@
 	uint32 cur = start;
 	uint this_delay, vga_period;
 
+	AudioCD.updateCD();
+
 	if (_debugger->isAttached())
 		_debugger->onFrame();
 
@@ -415,6 +419,8 @@
 		if (_leftButton == 1)
 			_leftButtonCount++;
 
+		AudioCD.updateCD();
+
 		_system->updateScreen();
 
 		if (amount == 0)

Modified: scummvm/trunk/engines/agos/res_snd.cpp
===================================================================
--- scummvm/trunk/engines/agos/res_snd.cpp	2007-02-16 13:41:38 UTC (rev 25631)
+++ scummvm/trunk/engines/agos/res_snd.cpp	2007-02-16 13:55:01 UTC (rev 25632)
@@ -30,6 +30,7 @@
 #include "agos/agos.h"
 #include "agos/vga.h"
 
+#include "sound/audiocd.h"
 #include "sound/audiostream.h"
 #include "sound/mididrv.h"
 #include "sound/mods/protracker.h"
@@ -117,14 +118,7 @@
 	}
 }
 
-void AGOSEngine::loadMusic(uint music) {
-	char buf[4];
-
-	if (getGameId() == GID_SIMON1ACORN) {
-		// TODO: Add support for music format used by Simon 1 Floppy
-	} else if (getPlatform() == Common::kPlatformAtariST) {
-		// TODO: Add support for music format used by Elvira 2
-	} else if (getPlatform() == Common::kPlatformAmiga) {
+void AGOSEngine::loadModule(uint music) {
 		_mixer->stopHandle(_modHandle);
 
 		char filename[15];
@@ -163,7 +157,12 @@
 		}
 
 		_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_modHandle, audioStream);
-	} else if (getGameType() == GType_SIMON2) {
+}
+
+void AGOSEngine::loadMusic(uint music) {
+	char buf[4];
+
+	if (getGameType() == GType_SIMON2) {
 		midi.stop();
 		_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
 		_gameFile->read(buf, 4);
@@ -179,16 +178,24 @@
 		_nextMusicToPlay = -1;
 	} else if (getGameType() == GType_SIMON1) {
 		midi.stop();
-		midi.setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.)
 
-		if (getFeatures() & GF_TALKIE) {
+		// Support for compressed music from the music enhancement project
+		AudioCD.stop();
+		AudioCD.play(music, -1, 0, 0);
+		if (AudioCD.isPlaying())
+			return;
+
+		if (getGameId() == GID_SIMON1ACORN) {
+			// TODO: Add support for music format used by Simon 1 Floppy
+		} else if (getPlatform() == Common::kPlatformAmiga) {
+			loadModule(music);
+		} else if (getFeatures() & GF_TALKIE) {
 			// FIXME: The very last music resource, a cymbal crash for when the
 			// two demons crash into each other, should NOT be looped like the
 			// other music tracks. In simon1dos/talkie the GMF resource includes
 			// a loop override that acomplishes this, but there seems to be nothing
 			// for this in the SMF resources.
-			if (music == 35)
-				midi.setLoop(false);
+			midi.setLoop(music != 35);; // Must do this BEFORE loading music. (GMF may have its own override.)
 
 			_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
 			_gameFile->read(buf, 4);
@@ -200,6 +207,7 @@
 				midi.loadMultipleSMF(_gameFile);
 			}
 
+			midi.startTrack(0);
 		} else {
 			char filename[15];
 			File f;
@@ -208,26 +216,33 @@
 			if (f.isOpen() == false)
 				error("loadMusic: Can't load music from '%s'", filename);
 
+			midi.setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.)
 			if (getFeatures() & GF_DEMO)
 				midi.loadS1D(&f);
 			else
 				midi.loadSMF(&f, music);
+
+			midi.startTrack(0);
 		}
-
-		midi.startTrack(0);
 	} else {
-		midi.stop();
-		midi.setLoop(true); // Must do this BEFORE loading music.
+		if (getPlatform() == Common::kPlatformAmiga) {
+			loadModule(music);
+		} else if (getPlatform() == Common::kPlatformAtariST) {
+			// TODO: Add support for music formats used
+		} else {
+			midi.stop();
+			midi.setLoop(true); // Must do this BEFORE loading music.
 
-		char filename[15];
-		File f;
-		sprintf(filename, "MOD%d.MUS", music);
-		f.open(filename);
-		if (f.isOpen() == false)
-			error("loadMusic: Can't load music from '%s'", filename);
+			char filename[15];
+			File f;
+			sprintf(filename, "MOD%d.MUS", music);
+			f.open(filename);
+			if (f.isOpen() == false)
+				error("loadMusic: Can't load music from '%s'", filename);
 
-		midi.loadS1D(&f);
-		midi.startTrack(0);
+			midi.loadS1D(&f);
+			midi.startTrack(0);
+		}
 	}
 }
 


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