[Scummvm-cvs-logs] SF.net SVN: scummvm:[34247] scummvm/trunk/engines/queen

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Sep 1 19:55:53 CEST 2008


Revision: 34247
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34247&view=rev
Author:   fingolfin
Date:     2008-09-01 17:55:52 +0000 (Mon, 01 Sep 2008)

Log Message:
-----------
Merging more of the GSoC 2008 RTL branch: QUEEN

Modified Paths:
--------------
    scummvm/trunk/engines/queen/input.cpp
    scummvm/trunk/engines/queen/journal.cpp
    scummvm/trunk/engines/queen/logic.cpp
    scummvm/trunk/engines/queen/midiadlib.cpp
    scummvm/trunk/engines/queen/queen.cpp
    scummvm/trunk/engines/queen/queen.h
    scummvm/trunk/engines/queen/sound.cpp
    scummvm/trunk/engines/queen/talk.cpp

Modified: scummvm/trunk/engines/queen/input.cpp
===================================================================
--- scummvm/trunk/engines/queen/input.cpp	2008-09-01 17:52:50 UTC (rev 34246)
+++ scummvm/trunk/engines/queen/input.cpp	2008-09-01 17:55:52 UTC (rev 34247)
@@ -118,9 +118,10 @@
 			case Common::EVENT_RBUTTONDOWN:
 				_mouseButton |= MOUSE_RBUTTON;
 				break;
-
+			case Common::EVENT_RTL:
 			case Common::EVENT_QUIT:
-				_vm->quitGame();
+				if (_cutawayRunning)
+					_cutawayQuit = true;
 				return;
 
 			default:

Modified: scummvm/trunk/engines/queen/journal.cpp
===================================================================
--- scummvm/trunk/engines/queen/journal.cpp	2008-09-01 17:52:50 UTC (rev 34246)
+++ scummvm/trunk/engines/queen/journal.cpp	2008-09-01 17:55:52 UTC (rev 34247)
@@ -84,8 +84,8 @@
 			case Common::EVENT_WHEELDOWN:
 				handleMouseWheel(1);
 				break;
+			case Common::EVENT_RTL:
 			case Common::EVENT_QUIT:
-				_vm->quitGame();
 				return;
 			default:
 				break;

Modified: scummvm/trunk/engines/queen/logic.cpp
===================================================================
--- scummvm/trunk/engines/queen/logic.cpp	2008-09-01 17:52:50 UTC (rev 34246)
+++ scummvm/trunk/engines/queen/logic.cpp	2008-09-01 17:55:52 UTC (rev 34247)
@@ -2076,6 +2076,8 @@
 		displayRoom(currentRoom(), RDM_FADE_NOJOE, 100, 2, true);
 		playCutaway("CLOGO.CUT");
 		sceneReset();
+		if (_vm->quit())
+			return true;
 		currentRoom(ROOM_HOTEL_LOBBY);
 		entryObj(584);
 		displayRoom(currentRoom(), RDM_FADE_JOE, 100, 2, true);
@@ -2129,7 +2131,11 @@
 	} else if (currentRoom() == FOTAQ_LOGO && gameState(VAR_INTRO_PLAYED) == 0) {
 		displayRoom(currentRoom(), RDM_FADE_NOJOE, 100, 2, true);
 		playCutaway("COPY.CUT");
+		if (_vm->quit())
+			return true;
 		playCutaway("CLOGO.CUT");
+		if (_vm->quit())
+			return true;
 		if (_vm->resource()->getPlatform() != Common::kPlatformAmiga) {
 			if (ConfMan.getBool("alt_intro") && _vm->resource()->isCD()) {
 				playCutaway("CINTR.CUT");
@@ -2137,7 +2143,11 @@
 				playCutaway("CDINT.CUT");
 			}
 		}
+		if (_vm->quit())
+			return true;
 		playCutaway("CRED.CUT");
+		if (_vm->quit())
+			return true;
 		_vm->display()->palSetPanel();
 		sceneReset();
 		currentRoom(ROOM_HOTEL_LOBBY);

Modified: scummvm/trunk/engines/queen/midiadlib.cpp
===================================================================
--- scummvm/trunk/engines/queen/midiadlib.cpp	2008-09-01 17:52:50 UTC (rev 34246)
+++ scummvm/trunk/engines/queen/midiadlib.cpp	2008-09-01 17:55:52 UTC (rev 34247)
@@ -132,7 +132,7 @@
 		adlibSetNoteVolume(i, 0);
 		adlibTurnNoteOff(i);
 	}
-	_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, false, true);
+	_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, false, true);
 	return 0;
 }
 

Modified: scummvm/trunk/engines/queen/queen.cpp
===================================================================
--- scummvm/trunk/engines/queen/queen.cpp	2008-09-01 17:52:50 UTC (rev 34246)
+++ scummvm/trunk/engines/queen/queen.cpp	2008-09-01 17:55:52 UTC (rev 34247)
@@ -60,9 +60,11 @@
 	virtual const char *getName() const;
 	virtual const char *getCopyright() const;
 
+	virtual bool hasFeature(MetaEngineFeature f) const;
 	virtual GameList getSupportedGames() const;
 	virtual GameDescriptor findGame(const char *gameid) const;
 	virtual GameList detectGames(const FSList &fslist) const;
+	virtual SaveStateList listSaves(const char *target) const;
 
 	virtual PluginError createInstance(OSystem *syst, Engine **engine) const;
 };
@@ -75,6 +77,14 @@
 	return "Flight of the Amazon Queen (C) John Passfield and Steve Stamatiadis";
 }
 
+bool QueenMetaEngine::hasFeature(MetaEngineFeature f) const {
+	return
+		(f == kSupportsRTL) ||
+		(f == kSupportsListSaves) ||
+		(f == kSupportsDirectLoad) ||
+		(f == kSupportsDeleteSave);
+}
+
 GameList QueenMetaEngine::getSupportedGames() const {
 	GameList games;
 	games.push_back(queenGameDescriptor);
@@ -121,6 +131,36 @@
 	return detectedGames;
 }
 
+SaveStateList QueenMetaEngine::listSaves(const char *target) const {
+	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+	Common::StringList filenames;
+	char saveDesc[32];
+	Common::String pattern = target;
+	pattern += ".s??";
+
+	filenames = saveFileMan->listSavefiles(pattern.c_str());
+	sort(filenames.begin(), filenames.end());	// Sort (hopefully ensuring we are sorted numerically..)
+
+	SaveStateList saveList;
+	for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
+		// Obtain the last 2 digits of the filename, since they correspond to the save slot
+		int slotNum = atoi(file->c_str() + file->size() - 2);
+		
+		if (slotNum >= 0 && slotNum <= 99) {
+			Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
+			if (in) {
+				for (int i = 0; i < 4; i++)
+					in->readUint32BE();
+				in->read(saveDesc, 32);	
+				saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), *file));
+				delete in;
+			}
+		}
+	}
+
+	return saveList;
+}
+
 PluginError QueenMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
 	assert(engine);
 	*engine = new Queen::QueenEngine(syst);
@@ -180,6 +220,10 @@
 	}
 }
 
+void QueenEngine::syncSoundSettings() {
+	readOptionSettings();
+}
+
 void QueenEngine::readOptionSettings() {
 	_sound->setVolume(ConfMan.getInt("music_volume"));
 	_sound->musicToggle(!ConfMan.getBool("music_mute"));
@@ -381,8 +425,8 @@
 		loadGameState(ConfMan.getInt("save_slot"));
 	}
 	_lastSaveTime = _lastUpdateTime = _system->getMillis();
-	_quit = false;
-	while (!_quit) {
+
+	while (!quit()) {
 		if (_logic->newRoom() > 0) {
 			_logic->update();
 			_logic->oldRoom(_logic->currentRoom());
@@ -400,7 +444,7 @@
 			update(true);
 		}
 	}
-	return 0;
+	return _eventMan->shouldRTL();
 }
 
 int QueenEngine::init() {
@@ -428,10 +472,6 @@
 		_logic = new LogicGame(this);
 	}
 
-	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
-	// Set mixer music volume to maximum, since music volume is regulated by MusicPlayer's MIDI messages
-	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, Audio::Mixer::kMaxMixerVolume);
-
 	_sound = Sound::makeSoundInstance(_mixer, this, _resource->getCompression());
 	_walk = new Walk(this);
 	//_talkspeedScale = (MAX_TEXT_SPEED - MIN_TEXT_SPEED) / 255.0;

Modified: scummvm/trunk/engines/queen/queen.h
===================================================================
--- scummvm/trunk/engines/queen/queen.h	2008-09-01 17:52:50 UTC (rev 34246)
+++ scummvm/trunk/engines/queen/queen.h	2008-09-01 17:55:52 UTC (rev 34247)
@@ -97,13 +97,13 @@
 	void checkOptionSettings();
 	void readOptionSettings();
 	void writeOptionSettings();
+	virtual void syncSoundSettings();
 
 	int talkSpeed() const { return _talkSpeed; }
 	void talkSpeed(int speed) { _talkSpeed = speed; }
 	bool subtitles() const { return _subtitles; }
 	void subtitles(bool enable) { _subtitles = enable; }
-	void quitGame() { _quit = true; }
-
+	
 	void update(bool checkPlayerInput = false);
 
 	bool canLoadOrSave() const;
@@ -137,7 +137,6 @@
 
 	int _talkSpeed;
 	bool _subtitles;
-	bool _quit;
 	uint32 _lastSaveTime;
 	uint32 _lastUpdateTime;
 

Modified: scummvm/trunk/engines/queen/sound.cpp
===================================================================
--- scummvm/trunk/engines/queen/sound.cpp	2008-09-01 17:52:50 UTC (rev 34246)
+++ scummvm/trunk/engines/queen/sound.cpp	2008-09-01 17:55:52 UTC (rev 34247)
@@ -278,8 +278,6 @@
 
 void PCSound::setVolume(int vol) {
 	Sound::setVolume(vol);
-	// Set mixer music volume to maximum, since music volume is regulated by MusicPlayer's MIDI messages
-	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, Audio::Mixer::kMaxMixerVolume);
 	_music->setVolume(vol);
 }
 
@@ -333,7 +331,8 @@
 	if (sound) {
 		f->read(sound, size);
 		byte flags = Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE;
-		_mixer->playRaw(Audio::Mixer::kSFXSoundType, soundHandle, sound, size, 11840, flags);
+		Audio::Mixer::SoundType type = (soundHandle == &_speechHandle) ? Audio::Mixer::kSpeechSoundType : Audio::Mixer::kSFXSoundType;
+		_mixer->playRaw(type, soundHandle, sound, size, 11840, flags);
 	}
 }
 

Modified: scummvm/trunk/engines/queen/talk.cpp
===================================================================
--- scummvm/trunk/engines/queen/talk.cpp	2008-09-01 17:52:50 UTC (rev 34246)
+++ scummvm/trunk/engines/queen/talk.cpp	2008-09-01 17:55:52 UTC (rev 34247)
@@ -807,7 +807,7 @@
 
 	switch (command) {
 	case SPEAK_PAUSE:
-		for (i = 0; i < 10 && !_vm->input()->talkQuit(); i++) {
+		for (i = 0; i < 10 && !_vm->input()->talkQuit() && !_vm->quit(); i++) {
 			_vm->update();
 		}
 		return;


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