mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
SCI: Move GameFeatures from EngineState to SciEngine
svn-id: r48049
This commit is contained in:
parent
a82939c9be
commit
9575cc08a2
@ -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/gc.h"
|
||||
#include "sci/engine/savegame.h"
|
||||
#include "sci/engine/kernel_types.h" // for determine_reg_type
|
||||
#include "sci/engine/gc.h"
|
||||
#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 @@ bool Console::cmdGetVersion(int argc, const char **argv) {
|
||||
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 @@ bool Console::cmdIsSample(int argc, const char **argv) {
|
||||
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");
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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?
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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 @@ SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc)
|
||||
|
||||
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 @@ SciEngine::~SciEngine() {
|
||||
delete _vocabulary;
|
||||
delete _console;
|
||||
delete _resMan;
|
||||
delete _features;
|
||||
|
||||
g_sci = 0;
|
||||
}
|
||||
@ -175,6 +178,8 @@ Common::Error SciEngine::run() {
|
||||
|
||||
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 @@ Common::Error SciEngine::run() {
|
||||
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 @@ Common::Error SciEngine::run() {
|
||||
_gui32->init();
|
||||
else
|
||||
#endif
|
||||
_gui->init(_gamestate->_features->usesOldGfxFunctions());
|
||||
_gui->init(_features->usesOldGfxFunctions());
|
||||
|
||||
debug("Emulating SCI version %s\n", getSciVersionDesc(getSciVersion()));
|
||||
|
||||
|
@ -44,14 +44,14 @@ namespace Sci {
|
||||
// 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 @@ public:
|
||||
GfxFrameout *_gfxFrameout; // kFrameout and the like for 32-bit gfx
|
||||
#endif
|
||||
|
||||
GameFeatures *_features;
|
||||
|
||||
private:
|
||||
const ADGameDescription *_gameDescription;
|
||||
AudioPlayer *_audio;
|
||||
|
Loading…
Reference in New Issue
Block a user