[Scummvm-cvs-logs] CVS: scummvm scumm.h,1.205,1.206 engine.h,1.2,1.3 engine.cpp,1.1,1.2 main.cpp,1.28,1.29 scummvm.cpp,1.206,1.207

Max Horn fingolfin at users.sourceforge.net
Sun Aug 18 11:40:03 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv464

Modified Files:
	scumm.h engine.h engine.cpp main.cpp scummvm.cpp 
Log Message:
some more cleanup

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -d -r1.205 -r1.206
--- scumm.h	18 Aug 2002 17:48:18 -0000	1.205
+++ scumm.h	18 Aug 2002 18:39:41 -0000	1.206
@@ -1335,7 +1335,6 @@
 	Scumm(GameDetector *detector, OSystem *syst);
 	virtual ~Scumm();
 
-	static Scumm *createFromDetector(GameDetector *detector, OSystem *syst);
 	void go();
 
 	void setupGUIColors();

Index: engine.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/engine.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- engine.h	18 Aug 2002 17:48:18 -0000	1.2
+++ engine.h	18 Aug 2002 18:39:41 -0000	1.3
@@ -40,7 +40,12 @@
 	Engine(GameDetector *detector, OSystem *syst);
 	virtual ~Engine();
 
+	// Invoke the main engine loop using this method
 	virtual void go() = 0;
+
+	// Create a new engine object based on the detector - either 
+	// a Scumm or a SimonState object currently.
+	static Engine *createFromDetector(GameDetector *detector, OSystem *syst);
 };
 
 

Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/engine.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- engine.cpp	18 Aug 2002 18:04:07 -0000	1.1
+++ engine.cpp	18 Aug 2002 18:39:41 -0000	1.2
@@ -21,6 +21,8 @@
 #include "engine.h"
 #include "sound/mixer.h"
 #include "gameDetector.h"
+#include "scumm.h"
+#include "simon/simon.h"
 
 /* FIXME - BIG HACK for MidiEmu */
 OSystem *g_system = 0;
@@ -39,4 +41,29 @@
 Engine::~Engine()
 {
 	delete _mixer;
+}
+
+Engine *Engine::createFromDetector(GameDetector *detector, OSystem *syst)
+{
+	Engine *engine;
+
+	if (detector->_gameId >= GID_SIMON_FIRST && detector->_gameId <= GID_SIMON_LAST) {
+		// Simon the Sorcerer
+		detector->_gameId -= GID_SIMON_FIRST;
+		engine = new SimonState(detector, syst);
+	} else {
+		// Some kind of Scumm game
+		if (detector->_features & GF_OLD256)
+			engine = new Scumm_v3(detector, syst);
+		else if (detector->_features & GF_SMALL_HEADER)	// this force loomCD as v4
+			engine = new Scumm_v4(detector, syst);
+		else if (detector->_features & GF_AFTER_V7)
+			engine = new Scumm_v7(detector, syst);
+		else if (detector->_features & GF_AFTER_V6)	// this force SamnmaxCD as v6
+			engine = new Scumm_v6(detector, syst);
+		else
+			engine = new Scumm_v5(detector, syst);
+	}
+
+	return engine;
 }

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/main.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- main.cpp	18 Aug 2002 17:48:18 -0000	1.28
+++ main.cpp	18 Aug 2002 18:39:41 -0000	1.29
@@ -128,7 +128,6 @@
 		return (-1);
 
 	OSystem *system = detector.createSystem();
-	Engine *engine;
 
 	{
 		char *s = detector.getGameName();
@@ -139,16 +138,10 @@
 		free(s);
 	}
 
-	/* Simon the Sorcerer? */
-	if (detector._gameId >= GID_SIMON_FIRST && detector._gameId <= GID_SIMON_LAST) {
-		/* Simon the Sorcerer initialization */
-		detector._gameId -= GID_SIMON_FIRST;
-		engine = SimonState::createFromDetector(&detector, system);
-
-	} else {
-		engine = Scumm::createFromDetector(&detector, system);
-	}
+	// Create the game engine
+	Engine *engine = Engine::createFromDetector(&detector, system);
 
+	// Run the game engine
 	engine->go();
 	
 	delete scummcfg;

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -d -r1.206 -r1.207
--- scummvm.cpp	18 Aug 2002 17:48:18 -0000	1.206
+++ scummvm.cpp	18 Aug 2002 18:39:41 -0000	1.207
@@ -70,6 +70,8 @@
 Scumm::Scumm (GameDetector *detector, OSystem *syst) 
 	: Engine(detector, syst)
 {
+	OSystem::Property prop;
+
 	// Use g_scumm from error() ONLY
 	g_scumm = this;
 
@@ -105,6 +107,44 @@
 	_sound->_sound_volume_master = 0;
 	_sound->_sound_volume_sfx = detector->_sfx_volume;	
 	_sound->_sound_volume_music = detector->_music_volume;	
+
+	/* Initialize backend */
+	syst->init_size(_realWidth, _realHeight);
+	prop.cd_num = detector->_cdrom;
+	syst->property(OSystem::PROP_OPEN_CD, &prop);
+
+	/* Bind the mixer to the system => mixer will be invoked
+	 * automatically when samples need to be generated */	
+	if (!_mixer->bind_to_system(syst)) {         
+		warning("Sound initialization failed");
+		if (detector->_use_adlib) {
+			_use_adlib = false;   
+			detector->_use_adlib = false;   
+			detector->_midi_driver = MD_NULL;   
+			warning("Adlib music was selected, switching to midi null driver");   
+		}   
+	} 
+	_mixer->set_volume(kDefaultSFXVolume);
+	_mixer->set_music_volume(kDefaultMusicVolume);
+
+
+	// Init iMuse
+	if (detector->_use_adlib) {
+		_imuse = IMuse::create_adlib(syst, _mixer);
+	} else {
+		_imuse = IMuse::create_midi(syst, detector->createMidi());
+	}
+	if (detector->_gameTempo != 0)
+		_imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo);
+	_imuse->set_music_volume(_sound->_sound_volume_music);
+
+
+	// Load game from specified slot, if any
+	if (detector->_save_slot != -1) {
+		_saveLoadSlot = detector->_save_slot;
+		_saveLoadFlag = 2;
+		_saveLoadCompatible = false;
+	}
 }
 
 Scumm::~Scumm ()
@@ -1544,66 +1584,6 @@
 	runScript(1, 0, 0, &_bootParam);
 
 //  _scummTimer = 0;
-}
-
-Scumm *Scumm::createFromDetector(GameDetector *detector, OSystem *syst)
-{
-	Scumm *scumm;
-	OSystem::Property prop;
-
-	if (detector->_features & GF_OLD256)
-		scumm = new Scumm_v3(detector, syst);
-	else if (detector->_features & GF_SMALL_HEADER)	// this force loomCD as v4
-		scumm = new Scumm_v4(detector, syst);
-	else if (detector->_features & GF_AFTER_V7)
-		scumm = new Scumm_v7(detector, syst);
-	else if (detector->_features & GF_AFTER_V6)	// this force SamnmaxCD as v6
-		scumm = new Scumm_v6(detector, syst);
-	else
-		scumm = new Scumm_v5(detector, syst);
-
-	/* This initializes SDL */
-	syst->init_size(scumm->_realWidth, scumm->_realHeight);
-	prop.cd_num = detector->_cdrom;
-	syst->property(OSystem::PROP_OPEN_CD, &prop);
-
-	/* bind the mixer to the system => mixer will be invoked
-	 * automatically when samples need to be generated */	
-	if (!scumm->_mixer->bind_to_system(syst)) {         
-		warning("Sound initialization failed");   
-		if (detector->_use_adlib) {
-			scumm->_use_adlib = false;   
-			detector->_use_adlib = false;   
-			detector->_midi_driver = MD_NULL;   
-			warning("Adlib music was selected, switching to midi null driver");   
-		}   
-	} 
-	scumm->_mixer->set_volume(kDefaultSFXVolume);
-	scumm->_mixer->set_music_volume(kDefaultMusicVolume);
-
-	{
-		IMuse *imuse;
-
-		if (detector->_use_adlib) {
-			imuse = IMuse::create_adlib(syst, scumm->_mixer);
-		} else {
-			imuse = IMuse::create_midi(syst, detector->createMidi());
-		}
-		
-		if (detector->_gameTempo != 0)
-			imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo);
-		
-		imuse->set_music_volume(scumm->_sound->_sound_volume_music);
-		scumm->_imuse = imuse;
-	}
-
-	if (detector->_save_slot != -1) {
-		scumm->_saveLoadSlot = detector->_save_slot;
-		scumm->_saveLoadFlag = 2;
-		scumm->_saveLoadCompatible = false;
-	}
-
-	return scumm;
 }
 
 void Scumm::go() {





More information about the Scummvm-git-logs mailing list