[Scummvm-cvs-logs] SF.net SVN: scummvm:[42709] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Fri Jul 24 23:33:55 CEST 2009


Revision: 42709
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42709&view=rev
Author:   drmccoy
Date:     2009-07-24 21:33:55 +0000 (Fri, 24 Jul 2009)

Log Message:
-----------
Adding ADL playback to the demoplayer

Modified Paths:
--------------
    scummvm/trunk/engines/gob/demos/demoplayer.cpp
    scummvm/trunk/engines/gob/demos/demoplayer.h
    scummvm/trunk/engines/gob/demos/scnplayer.cpp
    scummvm/trunk/engines/gob/detection.cpp

Modified: scummvm/trunk/engines/gob/demos/demoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/demos/demoplayer.cpp	2009-07-24 21:33:22 UTC (rev 42708)
+++ scummvm/trunk/engines/gob/demos/demoplayer.cpp	2009-07-24 21:33:55 UTC (rev 42709)
@@ -34,6 +34,7 @@
 #include "gob/draw.h"
 #include "gob/inter.h"
 #include "gob/videoplayer.h"
+#include "gob/sound/sound.h"
 
 namespace Gob {
 
@@ -186,6 +187,30 @@
 	free(filePtr);
 }
 
+void DemoPlayer::playADL(const char *params) {
+	const char *end;
+
+	end = strchr(params, ' ');
+	if (!end)
+		end = params + strlen(params);
+
+	Common::String fileName(params, end);
+	bool  waitEsc = true;
+	int32 repeat  = -1;
+
+	if (*end != '\0') {
+		const char *start = end + 1;
+
+		waitEsc = (*start != '0');
+
+		end = strchr(start, ' ');
+		if (end)
+			repeat = atoi(end + 1);
+	}
+
+	playADL(fileName, waitEsc, repeat);
+}
+
 void DemoPlayer::playVideoNormal() {
 	_vm->_vidPlayer->primaryPlay();
 }
@@ -233,6 +258,26 @@
 	}
 }
 
+void DemoPlayer::playADL(const Common::String &fileName, bool waitEsc, int32 repeat) {
+	debugC(1, kDebugDemo, "Playing ADL \"%s\" (%d, %d)", fileName.c_str(), waitEsc, repeat);
+
+	_vm->_sound->adlibUnload();
+	_vm->_sound->adlibLoadADL(fileName.c_str());
+	_vm->_sound->adlibSetRepeating(repeat);
+	_vm->_sound->adlibPlay();
+
+	if (!waitEsc)
+		return;
+
+	int16 key = 0;
+	while (!_vm->shouldQuit() && (key != kKeyEscape) && _vm->_sound->adlibIsPlaying()) {
+		_vm->_util->longDelay(1);
+		while (_vm->_util->checkKey(key))
+			if (key == kKeyEscape)
+				break;
+	}
+}
+
 void DemoPlayer::evaluateVideoMode(const char *mode) {
 	debugC(2, kDebugDemo, "Video mode \"%s\"", mode);
 

Modified: scummvm/trunk/engines/gob/demos/demoplayer.h
===================================================================
--- scummvm/trunk/engines/gob/demos/demoplayer.h	2009-07-24 21:33:22 UTC (rev 42708)
+++ scummvm/trunk/engines/gob/demos/demoplayer.h	2009-07-24 21:33:55 UTC (rev 42709)
@@ -57,9 +57,11 @@
 	void evaluateVideoMode(const char *mode);
 	void clearScreen();
 	void playVideo(const char *fileName);
+	void playADL(const char *params);
 
 	void playVideoNormal();
 	void playVideoDoubled();
+	void playADL(const Common::String &fileName, bool waitEsc = true, int32 repeat = -1);
 
 private:
 	enum ScriptSource {

Modified: scummvm/trunk/engines/gob/demos/scnplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/demos/scnplayer.cpp	2009-07-24 21:33:22 UTC (rev 42708)
+++ scummvm/trunk/engines/gob/demos/scnplayer.cpp	2009-07-24 21:33:55 UTC (rev 42709)
@@ -66,6 +66,8 @@
 			_rebase0 = true;
 		} else if (lineStartsWith(line, "REBASE0:OFF")) {
 			_rebase0 = false;
+		} else if (lineStartsWith(line, "ADL ")) {
+			playADL(line.c_str() + 4);
 		}
 
 		// Mind user input

Modified: scummvm/trunk/engines/gob/detection.cpp
===================================================================
--- scummvm/trunk/engines/gob/detection.cpp	2009-07-24 21:33:22 UTC (rev 42708)
+++ scummvm/trunk/engines/gob/detection.cpp	2009-07-24 21:33:55 UTC (rev 42709)
@@ -4299,7 +4299,7 @@
 			GUIO_NONE
 		},
 		kGameTypeUrban,
-		kFeatures640 | kFeaturesSCNDemo,
+		kFeaturesAdlib | kFeatures640 | kFeaturesSCNDemo,
 		"", "", 8
 	}
 };


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