[Scummvm-cvs-logs] SF.net SVN: scummvm:[48049] scummvm/trunk/engines/sci

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Feb 13 18:44:58 CET 2010


Revision: 48049
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48049&view=rev
Author:   fingolfin
Date:     2010-02-13 17:44:58 +0000 (Sat, 13 Feb 2010)

Log Message:
-----------
SCI: Move GameFeatures from EngineState to SciEngine

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/engine/game.cpp
    scummvm/trunk/engines/sci/engine/kernel32.cpp
    scummvm/trunk/engines/sci/engine/kevent.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/kmovement.cpp
    scummvm/trunk/engines/sci/engine/ksound.cpp
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/script.cpp
    scummvm/trunk/engines/sci/engine/state.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/sci.cpp
    scummvm/trunk/engines/sci/sci.h

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/console.cpp	2010-02-13 17:44:58 UTC (rev 48049)
@@ -30,11 +30,12 @@
 #include "sci/debug.h"
 #include "sci/event.h"
 #include "sci/resource.h"
-#include "sci/engine/savegame.h"
 #include "sci/engine/state.h"
 #include "sci/engine/selector.h"
+#include "sci/engine/savegame.h"
+#include "sci/engine/kernel_types.h"	// for determine_reg_type
 #include "sci/engine/gc.h"
-#include "sci/engine/kernel_types.h"	// for determine_reg_type
+#include "sci/engine/features.h"
 #ifdef USE_OLD_MUSIC_FUNCTIONS
 #include "sci/sound/iterator/songlib.h"	// for SongLibrary
 #include "sci/sound/iterator/iterator.h"	// for SCI_SONG_ITERATOR_TYPE_SCI0
@@ -418,11 +419,11 @@
 	DebugPrintf("\n");
 	DebugPrintf("Detected features:\n");
 	DebugPrintf("------------------\n");
-	DebugPrintf("Sound type: %s\n", getSciVersionDesc(s->_features->detectDoSoundType()));
-	DebugPrintf("Graphics functions type: %s\n", getSciVersionDesc(s->_features->detectGfxFunctionsType()));
-	DebugPrintf("Lofs type: %s\n", getSciVersionDesc(s->_features->detectLofsType()));
-	DebugPrintf("Move count type: %s\n", (s->_features->detectMoveCountType() == kIncrementMoveCount) ? "increment" : "ignore");
-	DebugPrintf("SetCursor type: %s\n", getSciVersionDesc(s->_features->detectSetCursorType()));
+	DebugPrintf("Sound type: %s\n", getSciVersionDesc(_engine->_features->detectDoSoundType()));
+	DebugPrintf("Graphics functions type: %s\n", getSciVersionDesc(_engine->_features->detectGfxFunctionsType()));
+	DebugPrintf("Lofs type: %s\n", getSciVersionDesc(_engine->_features->detectLofsType()));
+	DebugPrintf("Move count type: %s\n", (_engine->_features->detectMoveCountType() == kIncrementMoveCount) ? "increment" : "ignore");
+	DebugPrintf("SetCursor type: %s\n", getSciVersionDesc(_engine->_features->detectSetCursorType()));
 	DebugPrintf("View type: %s\n", viewTypeDesc[g_sci->getResMan()->getViewType()]);
 	DebugPrintf("Resource volume version: %s\n", g_sci->getResMan()->getVolVersionDesc());
 	DebugPrintf("Resource map version: %s\n", g_sci->getResMan()->getMapVersionDesc());
@@ -1593,7 +1594,7 @@
 		return true;
 	}
 
-	SoundResource *soundRes = new SoundResource(number, _engine->getResMan(), _engine->_gamestate->_features->detectDoSoundType());
+	SoundResource *soundRes = new SoundResource(number, _engine->getResMan(), _engine->_features->detectDoSoundType());
 
 	if (!soundRes) {
 		DebugPrintf("Not a sound resource!\n");

Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/engine/game.cpp	2010-02-13 17:44:58 UTC (rev 48049)
@@ -30,6 +30,7 @@
 
 #include "sci/sci.h"
 #include "sci/resource.h"
+#include "sci/engine/features.h"
 #include "sci/engine/state.h"
 #include "sci/engine/kernel.h"
 #include "sci/engine/kernel_types.h"
@@ -221,7 +222,7 @@
 	s->_breakpoints.clear(); // No breakpoints defined
 	s->_activeBreakpointTypes = 0;
 
-	if (s->_features->detectLofsType() == SCI_VERSION_1_MIDDLE)
+	if (g_sci->_features->detectLofsType() == SCI_VERSION_1_MIDDLE)
 		s->_segMan->setExportAreWide(true);
 	else
 		s->_segMan->setExportAreWide(false);
@@ -280,7 +281,7 @@
 
 #ifdef USE_OLD_MUSIC_FUNCTIONS
 	if (s->sfx_init_flags & SFX_STATE_FLAG_NOSOUND)
-		game_init_sound(s, 0, s->_features->detectDoSoundType());
+		game_init_sound(s, 0, g_sci->_features->detectDoSoundType());
 #endif
 
 	// Load game language into printLang property of game object
@@ -296,7 +297,7 @@
 #ifdef USE_OLD_MUSIC_FUNCTIONS
 		s->_sound.sfx_exit();
 		// Reinit because some other code depends on having a valid state
-		game_init_sound(s, SFX_STATE_FLAG_NOSOUND, s->_features->detectDoSoundType());
+		game_init_sound(s, SFX_STATE_FLAG_NOSOUND, g_sci->_features->detectDoSoundType());
 #else
 		s->_audio->stopAllAudio();
 		s->_soundCmd->clearPlayList();

Modified: scummvm/trunk/engines/sci/engine/kernel32.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-02-13 17:44:58 UTC (rev 48049)
@@ -25,6 +25,7 @@
 
 #ifdef ENABLE_SCI32
 
+#include "sci/engine/features.h"
 #include "sci/engine/kernel.h"
 #include "sci/engine/segment.h"
 #include "sci/engine/state.h"
@@ -383,7 +384,7 @@
 	// This is interesting because they all have the same interpreter version (2.100.002), yet
 	// they would not be compatible with other games of the same interpreter.
 
-	if (s->_features->detectSci21KernelType() == SCI_VERSION_2) {
+	if (g_sci->_features->detectSci21KernelType() == SCI_VERSION_2) {
 		_kernelNames = Common::StringList(sci2_default_knames, kKernelEntriesGk2Demo);
 		// OnMe is IsOnMe here, but they should be compatible
 		_kernelNames[0x23] = "Robot"; // Graph in SCI2

Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2010-02-13 17:44:58 UTC (rev 48049)
@@ -24,6 +24,7 @@
  */
 
 #include "sci/sci.h"
+#include "sci/engine/features.h"
 #include "sci/engine/state.h"
 #include "sci/engine/selector.h"
 #include "sci/engine/kernel.h"
@@ -147,7 +148,7 @@
 	}
 
 #ifndef USE_OLD_MUSIC_FUNCTIONS
-	if (s->_features->detectDoSoundType() <= SCI_VERSION_0_LATE) {
+	if (g_sci->_features->detectDoSoundType() <= SCI_VERSION_0_LATE) {
 		// If we're running a SCI0 game, update the sound cues, to compensate
 		// for the fact that SCI0 does not poll to update the sound cues itself,
 		// like SCI01 and later do with cmdUpdateSoundCues. kGetEvent is called

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-02-13 17:44:58 UTC (rev 48049)
@@ -31,6 +31,7 @@
 #include "sci/debug.h"	// for g_debug_sleeptime_factor
 #include "sci/resource.h"
 #include "sci/video/seq_decoder.h"
+#include "sci/engine/features.h"
 #include "sci/engine/state.h"
 #include "sci/engine/selector.h"
 #include "sci/engine/kernel.h"
@@ -168,7 +169,7 @@
 }
 
 reg_t kSetCursor(EngineState *s, int argc, reg_t *argv) {
-	switch (s->_features->detectSetCursorType()) {
+	switch (g_sci->_features->detectSetCursorType()) {
 	case SCI_VERSION_0_EARLY:
 		return kSetCursorSci0(s, argc, argv);
 	case SCI_VERSION_1_1:
@@ -517,7 +518,7 @@
 	if (argc >= 3) {
 		if (!argv[2].isNull())
 			addToFlag = true;
-		if (!s->_features->usesOldGfxFunctions())
+		if (!g_sci->_features->usesOldGfxFunctions())
 			addToFlag = !addToFlag;
 	}
 	if (argc >= 4)

Modified: scummvm/trunk/engines/sci/engine/kmovement.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmovement.cpp	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/engine/kmovement.cpp	2010-02-13 17:44:58 UTC (rev 48049)
@@ -25,6 +25,7 @@
 
 #include "sci/sci.h"
 #include "sci/resource.h"
+#include "sci/engine/features.h"
 #include "sci/engine/state.h"
 #include "sci/engine/selector.h"
 #include "sci/engine/kernel.h"
@@ -267,7 +268,7 @@
 
 	//printf("movecnt %d, move speed %d\n", movcnt, max_movcnt);
 
-	if (s->_features->handleMoveCount()) {
+	if (g_sci->_features->handleMoveCount()) {
 		if (max_movcnt > movcnt) {
 			++movcnt;
 			PUT_SEL32V(segMan, mover, SELECTOR(b_movCnt), movcnt); // Needed for HQ1/Ogre?

Modified: scummvm/trunk/engines/sci/engine/ksound.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/ksound.cpp	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/engine/ksound.cpp	2010-02-13 17:44:58 UTC (rev 48049)
@@ -24,10 +24,11 @@
  */
 
 #include "sci/sci.h"
+#include "sci/engine/features.h"
 #include "sci/engine/state.h"
-#include "sci/sound/soundcmd.h"
 #include "sci/engine/kernel.h"
 #include "sci/engine/vm.h"		// for Object
+#include "sci/sound/soundcmd.h"
 
 #include "sound/mixer.h"
 
@@ -90,7 +91,7 @@
 reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) {
 	// JonesCD uses different functions based on the cdaudio.map file
 	// to use red book tracks.
-	if (s->_features->usesCdTrack())
+	if (g_sci->_features->usesCdTrack())
 		return kDoCdAudio(s, argc, argv);
 
 	Audio::Mixer *mixer = g_system->getMixer();

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2010-02-13 17:44:58 UTC (rev 48049)
@@ -32,6 +32,7 @@
 #include "sci/sci.h"
 #include "sci/event.h"
 
+#include "sci/engine/features.h"
 #include "sci/engine/state.h"
 #include "sci/engine/message.h"
 #include "sci/engine/savegame.h"
@@ -966,7 +967,7 @@
 
 #ifdef USE_OLD_MUSIC_FUNCTIONS
 	temp = retval->_sound._songlib;
-	retval->_sound.sfx_init(retval->resMan, s->sfx_init_flags, s->_features->detectDoSoundType());
+	retval->_sound.sfx_init(retval->resMan, s->sfx_init_flags, g_sci->_features->detectDoSoundType());
 	retval->sfx_init_flags = s->sfx_init_flags;
 	retval->_sound._songlib.freeSounds();
 	retval->_sound._songlib = temp;
@@ -1018,7 +1019,7 @@
 	} else {
 #endif
 		g_sci->_gui->resetEngineState(retval);
-		g_sci->_gui->init(retval->_features->usesOldGfxFunctions());
+		g_sci->_gui->init(g_sci->_features->usesOldGfxFunctions());
 #ifdef ENABLE_SCI32
 	}
 #endif

Modified: scummvm/trunk/engines/sci/engine/script.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script.cpp	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/engine/script.cpp	2010-02-13 17:44:58 UTC (rev 48049)
@@ -25,6 +25,7 @@
 
 #include "sci/sci.h"
 #include "sci/resource.h"
+#include "sci/engine/features.h"
 #include "sci/engine/state.h"
 #include "sci/engine/kernel.h"
 #include "sci/engine/script.h"
@@ -95,7 +96,7 @@
 // constructor (?) of a VirtualMachine or a ScriptManager class.
 void script_adjust_opcode_formats(EngineState *s) {
 	// TODO: Check that this is correct
-	if (s->_features->detectLofsType() != SCI_VERSION_0_EARLY) {
+	if (g_sci->_features->detectLofsType() != SCI_VERSION_0_EARLY) {
 		g_opcode_formats[op_lofsa][0] = Script_Offset;
 		g_opcode_formats[op_lofss][0] = Script_Offset;
 	}

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2010-02-13 17:44:58 UTC (rev 48049)
@@ -40,8 +40,6 @@
 	sfx_init_flags = 0;
 #endif
 
-	_features = new GameFeatures(_segMan, _kernel);
-
 	restarting_flags = 0;
 
 	last_wait_time = 0;
@@ -80,7 +78,6 @@
 }
 
 EngineState::~EngineState() {
-	delete _features;
 	delete _msgState;
 }
 

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/engine/state.h	2010-02-13 17:44:58 UTC (rev 48049)
@@ -36,8 +36,6 @@
 }
 
 #include "sci/sci.h"
-#include "sci/resource.h"
-#include "sci/engine/features.h"
 #include "sci/engine/seg_manager.h"
 
 #include "sci/parser/vocabulary.h"
@@ -122,8 +120,6 @@
 
 	Common::String _gameId; /**< Designation of the primary object (which inherits from Game) */
 
-	GameFeatures *_features;
-
 	/* Non-VM information */
 
 	SciEvent *_event; // Event handling

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2010-02-13 17:44:58 UTC (rev 48049)
@@ -31,6 +31,7 @@
 #include "sci/console.h"
 #include "sci/debug.h"	// for g_debugState
 #include "sci/resource.h"
+#include "sci/engine/features.h"
 #include "sci/engine/state.h"
 #include "sci/engine/kernel.h"
 #include "sci/engine/kernel_types.h"
@@ -1385,7 +1386,7 @@
 		case op_lofsa: // 0x39 (57)
 			s->r_acc.segment = scriptState.xs->addr.pc.segment;
 
-			switch (s->_features->detectLofsType()) {
+			switch (g_sci->_features->detectLofsType()) {
 			case SCI_VERSION_1_1:
 				s->r_acc.offset = opparams[0] + local_script->_scriptSize;
 				break;
@@ -1407,7 +1408,7 @@
 		case op_lofss: // 0x3a (58)
 			r_temp.segment = scriptState.xs->addr.pc.segment;
 
-			switch (s->_features->detectLofsType()) {
+			switch (g_sci->_features->detectLofsType()) {
 			case SCI_VERSION_1_1:
 				r_temp.offset = opparams[0] + local_script->_scriptSize;
 				break;

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-02-13 17:44:58 UTC (rev 48049)
@@ -33,6 +33,7 @@
 #include "sci/console.h"
 #include "sci/event.h"
 
+#include "sci/engine/features.h"
 #include "sci/engine/state.h"
 #include "sci/engine/kernel.h"
 #include "sci/engine/script.h"	// for script_adjust_opcode_formats
@@ -65,6 +66,7 @@
 
 	assert(g_sci = 0);
 	g_sci = this;
+	_features = 0;
 
 	// Set up the engine specific debug levels
 	Common::addDebugChannel(kDebugLevelError, "Error", "Script error debugging");
@@ -117,6 +119,7 @@
 	delete _vocabulary;
 	delete _console;
 	delete _resMan;
+	delete _features;
 
 	g_sci = 0;
 }
@@ -175,6 +178,8 @@
 
 	SegManager *segMan = new SegManager(_resMan);
 
+	_features = new GameFeatures(segMan, _kernel);
+
 	// We'll set the GUI below
 	_gamestate = new EngineState(_kernel, _vocabulary, segMan, _audio);
 	_gamestate->_event = new SciEvent();
@@ -223,7 +228,7 @@
 	assert(_gamestate->sys_strings->_strings[SYS_STRING_SAVEDIR]._value != 0);
 	strcpy(_gamestate->sys_strings->_strings[SYS_STRING_SAVEDIR]._value, "");
 
-	SciVersion soundVersion = _gamestate->_features->detectDoSoundType();
+	SciVersion soundVersion = _features->detectDoSoundType();
 
 	_gamestate->_soundCmd = new SoundCommandParser(_resMan, segMan, _kernel, _audio, soundVersion);
 
@@ -243,7 +248,7 @@
 		_gui32->init();
 	else
 #endif
-		_gui->init(_gamestate->_features->usesOldGfxFunctions());
+		_gui->init(_features->usesOldGfxFunctions());
 
 	debug("Emulating SCI version %s\n", getSciVersionDesc(getSciVersion()));
 

Modified: scummvm/trunk/engines/sci/sci.h
===================================================================
--- scummvm/trunk/engines/sci/sci.h	2010-02-13 17:44:19 UTC (rev 48048)
+++ scummvm/trunk/engines/sci/sci.h	2010-02-13 17:44:58 UTC (rev 48049)
@@ -44,14 +44,14 @@
 // Uncomment this to use old music functions
 //#define USE_OLD_MUSIC_FUNCTIONS
 
-class Console;
 struct EngineState;
-class Kernel;
 class Vocabulary;
 class ResourceManager;
+class Kernel;
+class GameFeatures;
+class Console;
 class AudioPlayer;
 
-class SciEvent;
 class GfxAnimate;
 class GfxCache;
 class GfxCompare;
@@ -185,6 +185,8 @@
 	GfxFrameout *_gfxFrameout; // kFrameout and the like for 32-bit gfx
 #endif
 
+	GameFeatures *_features;
+
 private:
 	const ADGameDescription *_gameDescription;
 	AudioPlayer *_audio;


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