aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorMax Horn2010-02-13 17:44:58 +0000
committerMax Horn2010-02-13 17:44:58 +0000
commit9575cc08a2d54af57ada390f0f736d64857a49d1 (patch)
treee2966a582ffb7b9828c25e0ce25fa991d6586836 /engines/sci/engine
parenta82939c9bee20f2969f1006c1c9a836cea5c7903 (diff)
downloadscummvm-rg350-9575cc08a2d54af57ada390f0f736d64857a49d1.tar.gz
scummvm-rg350-9575cc08a2d54af57ada390f0f736d64857a49d1.tar.bz2
scummvm-rg350-9575cc08a2d54af57ada390f0f736d64857a49d1.zip
SCI: Move GameFeatures from EngineState to SciEngine
svn-id: r48049
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/game.cpp7
-rw-r--r--engines/sci/engine/kernel32.cpp3
-rw-r--r--engines/sci/engine/kevent.cpp3
-rw-r--r--engines/sci/engine/kgraphics.cpp5
-rw-r--r--engines/sci/engine/kmovement.cpp3
-rw-r--r--engines/sci/engine/ksound.cpp5
-rw-r--r--engines/sci/engine/savegame.cpp5
-rw-r--r--engines/sci/engine/script.cpp3
-rw-r--r--engines/sci/engine/state.cpp3
-rw-r--r--engines/sci/engine/state.h4
-rw-r--r--engines/sci/engine/vm.cpp5
11 files changed, 24 insertions, 22 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 5b61fdd734..52fc47c4d6 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -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 @@ int script_init_engine(EngineState *s) {
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 @@ int game_init(EngineState *s) {
#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 @@ int game_exit(EngineState *s) {
#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();
diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp
index 035388cbc2..f37631ec80 100644
--- a/engines/sci/engine/kernel32.cpp
+++ b/engines/sci/engine/kernel32.cpp
@@ -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 @@ void Kernel::setKernelNamesSci21(EngineState *s) {
// 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
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index 72dba8b6d5..156035b30d 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -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 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
}
#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
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index e82bf17182..8eb2401b3a 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -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 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
}
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 @@ reg_t kDrawPic(EngineState *s, int argc, reg_t *argv) {
if (argc >= 3) {
if (!argv[2].isNull())
addToFlag = true;
- if (!s->_features->usesOldGfxFunctions())
+ if (!g_sci->_features->usesOldGfxFunctions())
addToFlag = !addToFlag;
}
if (argc >= 4)
diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp
index 67fd835d67..b91ccadce6 100644
--- a/engines/sci/engine/kmovement.cpp
+++ b/engines/sci/engine/kmovement.cpp
@@ -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 @@ reg_t kDoBresen(EngineState *s, int argc, reg_t *argv) {
//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?
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index 21a22438d2..c3d572c174 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -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 kDoCdAudio(EngineState *s, int argc, reg_t *argv) {
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();
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index d579b29b9e..cef8525200 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -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 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
#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 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
} 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
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 58302b1aeb..b09462e70c 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -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 @@ opcode_format g_opcode_formats[128][4] = {
// 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;
}
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 6599a8b287..d61bc7ede8 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -40,8 +40,6 @@ EngineState::EngineState(Kernel *kernel, Vocabulary *voc, SegManager *segMan, Au
sfx_init_flags = 0;
#endif
- _features = new GameFeatures(_segMan, _kernel);
-
restarting_flags = 0;
last_wait_time = 0;
@@ -80,7 +78,6 @@ EngineState::EngineState(Kernel *kernel, Vocabulary *voc, SegManager *segMan, Au
}
EngineState::~EngineState() {
- delete _features;
delete _msgState;
}
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index afa3389464..eca061027c 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -36,8 +36,6 @@ namespace Common {
}
#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 @@ public:
Common::String _gameId; /**< Designation of the primary object (which inherits from Game) */
- GameFeatures *_features;
-
/* Non-VM information */
SciEvent *_event; // Event handling
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index aac08c09e2..9c1e203c5f 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -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 @@ void run_vm(EngineState *s, bool restoring) {
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 @@ void run_vm(EngineState *s, bool restoring) {
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;