ScummVM
Engine Class Referenceabstract

#include <engine.h>

Inherited by Access::AccessEngine, Adl::AdlEngine, Agi::AgiBase, AGOS::AGOSEngine, Avalanche::AvalancheEngine, Bbvs::BbvsEngine, BladeRunner::BladeRunnerEngine, CGE2::CGE2Engine, CGE::CGEEngine, Chewy::ChewyEngine, Cine::CineEngine, Composer::ComposerEngine, Cruise::CruiseEngine, Cryo::CryoEngine, CryOmni3D::CryOmni3DEngine, Director::DirectorEngine, DM::DMEngine, Draci::DraciEngine, Drascula::DrasculaEngine, DreamWeb::DreamWebEngine, Fullpipe::FullpipeEngine, Glk::GlkEngine, Gnap::GnapEngine, Gob::GobEngine, Griffon::GriffonEngine, Groovie::GroovieEngine, HDB::HDBGame, Hopkins::HopkinsEngine, Hugo::HugoEngine, Illusions::IllusionsEngine, Kyra::KyraEngine_v1, Lab::LabEngine, LastExpress::LastExpressEngine, Lilliput::LilliputEngine, Lure::LureEngine, MacVenture::MacVentureEngine, Made::MadeEngine, MADS::MADSEngine, Mohawk::MohawkEngine, Mortevielle::MortevielleEngine, MutationOfJB::MutationOfJBEngine, Neverhood::NeverhoodEngine, Parallaction::Parallaction, Pegasus::PegasusEngine, Pink::PinkEngine, Plumbers::PlumbersGame, Prince::PrinceEngine, Queen::QueenEngine, Saga::SagaEngine, Sci::SciEngine, Scumm::ScummEngine, Scumm::ScummEngine_vCUPhe, Sherlock::SherlockEngine, Sky::SkyEngine, Sludge::SludgeEngine, StarTrek::StarTrekEngine, Supernova::SupernovaEngine, Sword1::SwordEngine, Sword25::Sword25Engine, Sword2::Sword2Engine, TeenAgent::TeenAgentEngine, Testbed::TestbedEngine, Tinsel::TinselEngine, Titanic::TitanicEngine, Toltecs::ToltecsEngine, Tony::TonyEngine, Toon::ToonEngine, Touche::ToucheEngine, TsAGE::TSageEngine, Tucker::TuckerEngine, Ultima::Shared::UltimaEngine, Voyeur::VoyeurEngine, Wage::WageEngine, Wintermute::WintermuteEngine, Xeen::XeenEngine, and ZVision::ZVision.

+ Collaboration diagram for Engine:

Public Types

enum  EngineFeature { kSupportsSubtitleOptions, kSupportsRTL, kSupportsLoadingDuringRuntime, kSupportsSavingDuringRuntime }
 A feature in this context means an ability of the engine which can be either available or not. More...
 

Public Attributes

OSystem_system
 
Audio::Mixer_mixer
 

Protected Member Functions

virtual int runDialog (GUI::Dialog &dialog)
 

Protected Attributes

Common::TimerManager_timer
 
Common::EventManager_eventMan
 
Common::SaveFileManager_saveFileMan
 
GUI::Dialog_mainMenuDialog
 
const Common::String _targetName
 

Private Attributes

int _pauseLevel
 The pause level, 0 means 'running', a positive value indicates how often the engine has been paused (and hence how often it has to be un-paused before it resumes running). More...
 
uint32 _pauseStartTime
 The time when the pause was started. More...
 
int32 _engineStartTime
 The time when the engine was started. More...
 
const int _autosaveInterval
 Autosave interval. More...
 
int _lastAutosaveTime
 The last time an autosave was done. More...
 
int _saveSlotToLoad
 Save slot selected via global main menu. More...
 
GUI::Debugger_debugger
 Optional debugger for the engine. More...
 

Overloadable methods

All Engine subclasses should consider overloading some or all of the following methods.

virtual void pauseEngineIntern (bool pause)
 Actual implementation of pauseEngine by subclasses. More...
 
 Engine (OSystem *syst)
 
virtual ~Engine ()
 
virtual void initializePath (const Common::FSNode &gamePath)
 Init SearchMan according to the game path. More...
 
virtual Common::Error run ()=0
 Init the engine and start its main loop. More...
 
virtual void errorString (const char *buf_input, char *buf_output, int buf_output_size)
 Prepare an error string, which is printed by the error() function. More...
 
virtual GUI::DebuggergetDebugger ()
 Return the engine's debugger instance, if any. More...
 
void setDebugger (GUI::Debugger *debugger)
 Sets the engine's debugger. More...
 
GUI::DebuggergetOrCreateDebugger ()
 Return the engine's debugger instance, or create one if none is present. More...
 
virtual bool hasFeature (EngineFeature f) const
 Determine whether the engine supports the specified feature. More...
 
virtual void syncSoundSettings ()
 Notify the engine that the sound settings in the config manager may have changed and that it hence should adjust any internal volume etc. More...
 
virtual void flipMute ()
 Flip mute all sound option. More...
 
virtual Common::String getSaveStateName (int slot) const
 Generates the savegame filename. More...
 
virtual Common::Error loadGameState (int slot)
 Load a game state. More...
 
virtual Common::Error loadGameStream (Common::SeekableReadStream *stream)
 Load a game state. More...
 
void setGameToLoadSlot (int slot)
 Sets the game slot for a savegame to be loaded after global main menu execution. More...
 
virtual bool canLoadGameStateCurrently ()
 Indicates whether a game state can be loaded. More...
 
virtual Common::Error saveGameState (int slot, const Common::String &desc, bool isAutosave=false)
 Save a game state. More...
 
virtual Common::Error saveGameStream (Common::WriteStream *stream, bool isAutosave=false)
 Save a game state. More...
 
virtual bool canSaveGameStateCurrently ()
 Indicates whether a game state can be saved. More...
 
bool saveGameDialog ()
 Shows the ScummVM save dialog, allowing users to save their game. More...
 
bool loadGameDialog ()
 Shows the ScummVM Restore dialog, allowing users to load a game. More...
 
void pauseEngine (bool pause)
 Pause or resume the engine. More...
 
bool isPaused () const
 Return whether the engine is currently paused or not. More...
 
void openMainMenuDialog ()
 Run the Global Main Menu Dialog. More...
 
uint32 getTotalPlayTime () const
 Get the total play time. More...
 
void setTotalPlayTime (uint32 time=0)
 Set the game time counter to the specified time. More...
 
Common::TimerManagergetTimerManager ()
 
Common::EventManagergetEventManager ()
 
Common::SaveFileManagergetSaveFileManager ()
 
void checkCD ()
 On some systems, check if the game appears to be run from CD. More...
 
void handleAutoSave ()
 Checks for whether it's time to do an autosave, and if so, does it. More...
 
void saveAutosaveIfEnabled ()
 Does an autosave immediately if autosaves are turned on. More...
 
virtual bool canSaveAutosaveCurrently ()
 Indicates whether an autosave can currently be saved. More...
 
virtual int getAutosaveSlot () const
 Returns the slot that should be used for autosaves. More...
 
bool shouldPerformAutoSave (int lastSaveTime)
 
static void quitGame ()
 Request the engine to quit. More...
 
static bool shouldQuit ()
 Return whether the ENGINE should quit respectively should return to the launcher. More...
 
static MetaEnginegetMetaEngine ()
 
static bool warnUserAboutUnsupportedGame ()
 Display a warning to the user that the game is not fully supported. More...
 

Detailed Description

Definition at line 60 of file engine.h.

Member Enumeration Documentation

◆ EngineFeature

A feature in this context means an ability of the engine which can be either available or not.

See also
Engine::hasFeature()
Enumerator
kSupportsSubtitleOptions 

Enables the subtitle speed and toggle items in the Options section of the global main menu.

kSupportsRTL 

'Return to launcher' feature is supported, i.e., EVENT_RTL is handled either directly, or indirectly (that is, the engine calls and honors the result of the Engine::shouldQuit() method appropriately).

kSupportsLoadingDuringRuntime 

Loading savestates during runtime is supported, that is, this engine implements loadGameState() and canLoadGameStateCurrently().

If this feature is supported, then the corresponding MetaEngine must support the kSupportsListSaves feature.

kSupportsSavingDuringRuntime 

Loading savestates during runtime is supported, that is, this engine implements saveGameState() and canSaveGameStateCurrently().

If this feature is supported, then the corresponding MetaEngine must support the kSupportsListSaves feature.

Definition at line 124 of file engine.h.

Constructor & Destructor Documentation

◆ Engine()

Engine::Engine ( OSystem syst)

Definition at line 139 of file engine.cpp.

◆ ~Engine()

Engine::~Engine ( )
virtual

Definition at line 184 of file engine.cpp.

Member Function Documentation

◆ canLoadGameStateCurrently()

bool Engine::canLoadGameStateCurrently ( )
virtual

Indicates whether a game state can be loaded.

Reimplemented in Glk::Magnetic::Magnetic, Agi::AgiBase, Tucker::TuckerEngine, Saga::SagaEngine, Touche::ToucheEngine, Adl::AdlEngine, Mortevielle::MortevielleEngine, Scumm::ScummEngine, Griffon::GriffonEngine, Bbvs::BbvsEngine, Kyra::KyraEngine_v1, Fullpipe::FullpipeEngine, Drascula::DrasculaEngine, Access::AccessEngine, Prince::PrinceEngine, Xeen::XeenEngine, Hugo::HugoEngine, Sci::SciEngine, BladeRunner::BladeRunnerEngine, ZVision::ZVision, Lab::LabEngine, DM::DMEngine, Illusions::IllusionsEngine, Toltecs::ToltecsEngine, Toon::ToonEngine, Voyeur::VoyeurEngine, HDB::HDBGame, MacVenture::MacVentureEngine, Mohawk::MohawkEngine_Myst, Tinsel::TinselEngine, Composer::ComposerEngine, Sword2::Sword2Engine, Tony::TonyEngine, Hopkins::HopkinsEngine, CGE2::CGE2Engine, Sherlock::SherlockEngine, CGE::CGEEngine, Titanic::TitanicEngine, Ultima::Shared::UltimaEngine, Cine::CineEngine, MADS::MADSEngine, Glk::GlkEngine, Lure::LureEngine, Wage::WageEngine, Neverhood::NeverhoodEngine, DreamWeb::DreamWebEngine, CryOmni3D::CryOmni3DEngine, Avalanche::AvalancheEngine, Sword1::SwordEngine, Sherlock::Tattoo::TattooEngine, Groovie::GroovieEngine, Mohawk::MohawkEngine_Riven, Sky::SkyEngine, Pink::PinkEngine, Queen::QueenEngine, Cruise::CruiseEngine, TeenAgent::TeenAgentEngine, Pegasus::PegasusEngine, Glk::Quest::Quest, TsAGE::TSageEngine, Draci::DraciEngine, MutationOfJB::MutationOfJBEngine, Supernova::SupernovaEngine, and Wintermute::WintermuteEngine.

Definition at line 697 of file engine.cpp.

◆ canSaveAutosaveCurrently()

virtual bool Engine::canSaveAutosaveCurrently ( )
inlinevirtual

Indicates whether an autosave can currently be saved.

Reimplemented in Tucker::TuckerEngine, Scumm::ScummEngine, Xeen::XeenEngine, and Mohawk::MohawkEngine_Riven.

Definition at line 399 of file engine.h.

◆ canSaveGameStateCurrently()

bool Engine::canSaveGameStateCurrently ( )
virtual

Indicates whether a game state can be saved.

Reimplemented in Glk::Magnetic::Magnetic, Agi::AgiBase, Tucker::TuckerEngine, Saga::SagaEngine, Touche::ToucheEngine, Mortevielle::MortevielleEngine, Scumm::ScummEngine, Griffon::GriffonEngine, Bbvs::BbvsEngine, Kyra::KyraEngine_v1, Fullpipe::FullpipeEngine, Drascula::DrasculaEngine, Access::AccessEngine, Prince::PrinceEngine, Xeen::XeenEngine, Hugo::HugoEngine, Sci::SciEngine, BladeRunner::BladeRunnerEngine, Adl::AdlEngine, ZVision::ZVision, Lab::LabEngine, Illusions::IllusionsEngine, Toltecs::ToltecsEngine, Toon::ToonEngine, Voyeur::VoyeurEngine, HDB::HDBGame, MacVenture::MacVentureEngine, Mohawk::MohawkEngine_Myst, Composer::ComposerEngine, Sword2::Sword2Engine, Tony::TonyEngine, Hopkins::HopkinsEngine, CGE2::CGE2Engine, Sherlock::SherlockEngine, Ultima::Shared::UltimaEngine, Titanic::TitanicEngine, CGE::CGEEngine, Glk::GlkEngine, MADS::MADSEngine, Cine::CineEngine, Lure::LureEngine, Wage::WageEngine, Neverhood::NeverhoodEngine, DreamWeb::DreamWebEngine, CryOmni3D::CryOmni3DEngine, Sword1::SwordEngine, Sherlock::Tattoo::TattooEngine, Avalanche::AvalancheEngine, Groovie::GroovieEngine, Mohawk::MohawkEngine_Riven, Sky::SkyEngine, Pink::PinkEngine, Queen::QueenEngine, Cruise::CruiseEngine, TeenAgent::TeenAgentEngine, Glk::Quest::Quest, Pegasus::PegasusEngine, TsAGE::TSageEngine, Draci::DraciEngine, MutationOfJB::MutationOfJBEngine, Supernova::SupernovaEngine, Wintermute::WintermuteEngine, Adl::HiRes6Engine, Adl::AdlEngine_v2, and Tinsel::TinselEngine.

Definition at line 724 of file engine.cpp.

◆ checkCD()

void Engine::checkCD ( )

On some systems, check if the game appears to be run from CD.

Definition at line 418 of file engine.cpp.

◆ errorString()

void Engine::errorString ( const char *  buf_input,
char *  buf_output,
int  buf_output_size 
)
virtual

Prepare an error string, which is printed by the error() function.

Reimplemented in Scumm::ScummEngine.

Definition at line 525 of file engine.cpp.

◆ flipMute()

void Engine::flipMute ( )
virtual

Flip mute all sound option.

Definition at line 657 of file engine.cpp.

◆ getAutosaveSlot()

virtual int Engine::getAutosaveSlot ( ) const
inlinevirtual

Returns the slot that should be used for autosaves.

Note
This should match the meta engine getAutosaveSlot() method

Reimplemented in Tucker::TuckerEngine, Griffon::GriffonEngine, Kyra::KyraEngine_v1, and Queen::QueenEngine.

Definition at line 407 of file engine.h.

◆ getDebugger()

virtual GUI::Debugger* Engine::getDebugger ( )
inlinevirtual

Return the engine's debugger instance, if any.

Definition at line 190 of file engine.h.

◆ getEventManager()

Common::EventManager* Engine::getEventManager ( )
inline

Definition at line 378 of file engine.h.

◆ getMetaEngine()

MetaEngine & Engine::getMetaEngine ( )
static

Definition at line 812 of file engine.cpp.

◆ getOrCreateDebugger()

GUI::Debugger * Engine::getOrCreateDebugger ( )

Return the engine's debugger instance, or create one if none is present.

Used by error() to invoke the debugger when a severe error is reported.

Definition at line 796 of file engine.cpp.

◆ getSaveFileManager()

Common::SaveFileManager* Engine::getSaveFileManager ( )
inline

Definition at line 379 of file engine.h.

◆ getSaveStateName()

◆ getTimerManager()

Common::TimerManager* Engine::getTimerManager ( )
inline

Definition at line 377 of file engine.h.

◆ getTotalPlayTime()

uint32 Engine::getTotalPlayTime ( ) const

Get the total play time.

Returns
How long the player has been playing in ms.

Definition at line 597 of file engine.cpp.

◆ handleAutoSave()

void Engine::handleAutoSave ( )

Checks for whether it's time to do an autosave, and if so, does it.

Definition at line 487 of file engine.cpp.

◆ hasFeature()

virtual bool Engine::hasFeature ( EngineFeature  f) const
inlinevirtual

Determine whether the engine supports the specified feature.

Reimplemented in Agi::AgiBase, Touche::ToucheEngine, Saga::SagaEngine, Tucker::TuckerEngine, Adl::AdlEngine, Mortevielle::MortevielleEngine, Griffon::GriffonEngine, Scumm::ScummEngine, Fullpipe::FullpipeEngine, Toon::ToonEngine, Drascula::DrasculaEngine, Lilliput::LilliputEngine, Hugo::HugoEngine, Prince::PrinceEngine, Parallaction::Parallaction, Kyra::KyraEngine_v1, Sci::SciEngine, BladeRunner::BladeRunnerEngine, ZVision::ZVision, CryOmni3D::Versailles::CryOmni3DEngine_Versailles, AGOS::AGOSEngine, DM::DMEngine, Gnap::GnapEngine, Bbvs::BbvsEngine, Lab::LabEngine, Mohawk::MohawkEngine_Myst, MacVenture::MacVentureEngine, Gob::GobEngine, Composer::ComposerEngine, Tinsel::TinselEngine, Voyeur::VoyeurEngine, CGE2::CGE2Engine, Sword2::Sword2Engine, CGE::CGEEngine, Xeen::XeenEngine, Hopkins::HopkinsEngine, Sky::SkyEngine, Queen::QueenEngine, Access::AccessEngine, Wage::WageEngine, CryOmni3D::CryOmni3DEngine, Mohawk::MohawkEngine_Riven, Director::DirectorEngine, Titanic::TitanicEngine, Avalanche::AvalancheEngine, DreamWeb::DreamWebEngine, Sword1::SwordEngine, Cine::CineEngine, Sherlock::SherlockEngine, Toltecs::ToltecsEngine, Groovie::GroovieEngine, Lure::LureEngine, Tony::TonyEngine, Mohawk::MohawkEngine, Pink::PinkEngine, TeenAgent::TeenAgentEngine, MADS::MADSEngine, Glk::GlkEngine, Illusions::IllusionsEngine_Duckman, Cruise::CruiseEngine, Made::MadeEngine, Pegasus::PegasusEngine, Sword25::Sword25Engine, Neverhood::NeverhoodEngine, LastExpress::LastExpressEngine, Ultima::Shared::UltimaEngine, Chewy::ChewyEngine, Supernova::SupernovaEngine, MutationOfJB::MutationOfJBEngine, TsAGE::TSageEngine, Illusions::IllusionsEngine_BBDOU, Wintermute::WintermuteEngine, Testbed::TestbedEngine, Glk::TADS::TADS, HDB::HDBGame, and Draci::DraciEngine.

Definition at line 210 of file engine.h.

◆ initializePath()

void Engine::initializePath ( const Common::FSNode gamePath)
virtual

Init SearchMan according to the game path.

By default it adds the directory in non-flat mode with a depth of 4 as priority 0 to SearchMan.

Parameters
gamePathThe base directory of the game data.

Reimplemented in CryOmni3D::Versailles::CryOmni3DEngine_Versailles, Tinsel::TinselEngine, HDB::HDBGame, and Titanic::TitanicEngine.

Definition at line 196 of file engine.cpp.

◆ isPaused()

bool Engine::isPaused ( ) const
inline

Return whether the engine is currently paused or not.

Definition at line 345 of file engine.h.

◆ loadGameDialog()

bool Engine::loadGameDialog ( )

Shows the ScummVM Restore dialog, allowing users to load a game.

Definition at line 729 of file engine.cpp.

◆ loadGameState()

Common::Error Engine::loadGameState ( int  slot)
virtual

Load a game state.

Parameters
slotthe slot from which a savestate should be loaded
Returns
returns kNoError on success, else an error code.

Reimplemented in Kyra::KyraEngine_v1, Kyra::KyraRpgEngine, Kyra::LoLEngine, Kyra::EoBCoreEngine, Agi::AgiEngine, Tucker::TuckerEngine, Kyra::KyraEngine_HoF, Saga::SagaEngine, Kyra::KyraEngine_MR, Mortevielle::MortevielleEngine, Scumm::ScummEngine, Griffon::GriffonEngine, Bbvs::BbvsEngine, Fullpipe::FullpipeEngine, Drascula::DrasculaEngine, Toon::ToonEngine, Gnap::GnapEngine, Prince::PrinceEngine, Hugo::HugoEngine, Access::AccessEngine, Sci::SciEngine, Xeen::XeenEngine, BladeRunner::BladeRunnerEngine, Adl::AdlEngine, ZVision::ZVision, CryOmni3D::Versailles::CryOmni3DEngine_Versailles, DM::DMEngine, Illusions::IllusionsEngine, Lab::LabEngine, Toltecs::ToltecsEngine, Kyra::KyraEngine_LoK, Wage::WageEngine, Voyeur::VoyeurEngine, MacVenture::MacVentureEngine, Glk::GlkEngine, HDB::HDBGame, Mohawk::MohawkEngine_Myst, Composer::ComposerEngine, Sword2::Sword2Engine, Tinsel::TinselEngine, Tony::TonyEngine, Hopkins::HopkinsEngine, CGE2::CGE2Engine, Sherlock::SherlockEngine, Titanic::TitanicEngine, CGE::CGEEngine, MADS::MADSEngine, Cine::CineEngine, Neverhood::NeverhoodEngine, Lure::LureEngine, Avalanche::AvalancheEngine, DreamWeb::DreamWebEngine, Sword1::SwordEngine, Groovie::GroovieEngine, Mohawk::MohawkEngine_Riven, Sky::SkyEngine, Queen::QueenEngine, Pink::PinkEngine, Cruise::CruiseEngine, TeenAgent::TeenAgentEngine, Ultima::Nuvie::NuvieEngine, Pegasus::PegasusEngine, TsAGE::TSageEngine, Glk::Frotz::Frotz, Draci::DraciEngine, MutationOfJB::MutationOfJBEngine, Supernova::SupernovaEngine, Wintermute::WintermuteEngine, and Touche::ToucheEngine.

Definition at line 672 of file engine.cpp.

◆ loadGameStream()

Common::Error Engine::loadGameStream ( Common::SeekableReadStream stream)
virtual

Load a game state.

Parameters
streamthe stream to load the savestate from
Returns
returns kNoError on success, else an error code.

Reimplemented in Ultima::Ultima8::Ultima8Engine, Ultima::Shared::UltimaEarlyEngine, and Griffon::GriffonEngine.

Definition at line 692 of file engine.cpp.

◆ openMainMenuDialog()

void Engine::openMainMenuDialog ( )

Run the Global Main Menu Dialog.

Definition at line 552 of file engine.cpp.

◆ pauseEngine()

void Engine::pauseEngine ( bool  pause)

Pause or resume the engine.

This should stop/resume any audio playback and other stuff. Called right before the system runs a global dialog (like a global pause, main menu, options or 'confirm exit' dialog).

This is a convenience tracker which automatically keeps track on how often the engine has been paused, ensuring that after pausing an engine e.g. twice, it has to be unpaused twice before actuallying resuming.

Parameters
pausetrue to pause the engine, false to resume it

Definition at line 529 of file engine.cpp.

◆ pauseEngineIntern()

◆ quitGame()

void Engine::quitGame ( )
static

Request the engine to quit.

Sends a EVENT_QUIT event to the Event Manager.

Definition at line 784 of file engine.cpp.

◆ run()

virtual Common::Error Engine::run ( )
pure virtual

Init the engine and start its main loop.

Returns
returns kNoError on success, else an error code.

Implemented in Agi::AgiBase, Mohawk::MohawkEngine_LivingBooks, Scumm::ScummEngine_vCUPhe, Touche::ToucheEngine, Saga::SagaEngine, Tucker::TuckerEngine, Adl::AdlEngine, Mortevielle::MortevielleEngine, Scumm::ScummEngine, Lilliput::LilliputEngine, Griffon::GriffonEngine, Drascula::DrasculaEngine, Hugo::HugoEngine, Prince::PrinceEngine, Parallaction::Parallaction, BladeRunner::BladeRunnerEngine, Sci::SciEngine, Kyra::KyraEngine_v1, DM::DMEngine, StarTrek::StarTrekEngine, CryOmni3D::Versailles::CryOmni3DEngine_Versailles, Gnap::GnapEngine, Bbvs::BbvsEngine, AGOS::AGOSEngine, CGE::CGEEngine, Lab::LabEngine, Pegasus::PegasusEngine, MacVenture::MacVentureEngine, Gob::GobEngine, Ultima::Ultima8::Ultima8Engine, Tinsel::TinselEngine, CGE2::CGE2Engine, Voyeur::VoyeurEngine, Composer::ComposerEngine, ZVision::ZVision, HDB::HDBGame, Sherlock::SherlockEngine, Sword2::Sword2Engine, Director::DirectorEngine, Xeen::XeenEngine, Mohawk::MohawkEngine_CSTime, Hopkins::HopkinsEngine, Mohawk::MohawkEngine_Myst, Avalanche::AvalancheEngine, Queen::QueenEngine, Wage::WageEngine, Sky::SkyEngine, Access::AccessEngine, Toon::ToonEngine, Titanic::TitanicEngine, DreamWeb::DreamWebEngine, Cine::CineEngine, Fullpipe::FullpipeEngine, CryOmni3D::CryOmni3DEngine, Groovie::GroovieEngine, Sword1::SwordEngine, Toltecs::ToltecsEngine, Tony::TonyEngine, Ultima::Shared::UltimaEarlyEngine, Lure::LureEngine, Pink::PinkEngine, MADS::MADSEngine, TeenAgent::TeenAgentEngine, Mohawk::MohawkEngine_Riven, Glk::GlkEngine, Illusions::IllusionsEngine_Duckman, Mohawk::MohawkEngine, Sword25::Sword25Engine, TsAGE::TSageEngine, Made::MadeEngine, Cruise::CruiseEngine, LastExpress::LastExpressEngine, Ultima::Nuvie::NuvieEngine, Chewy::ChewyEngine, Sludge::SludgeEngine, Supernova::SupernovaEngine, Illusions::IllusionsEngine_BBDOU, MutationOfJB::MutationOfJBEngine, Wintermute::WintermuteEngine, Draci::DraciEngine, Neverhood::NeverhoodEngine, Cryo::CryoEngine, Plumbers::PlumbersGame, and Testbed::TestbedEngine.

◆ runDialog()

int Engine::runDialog ( GUI::Dialog dialog)
protectedvirtual

Reimplemented in Scumm::ScummEngine.

Definition at line 615 of file engine.cpp.

◆ saveAutosaveIfEnabled()

void Engine::saveAutosaveIfEnabled ( )

Does an autosave immediately if autosaves are turned on.

Definition at line 496 of file engine.cpp.

◆ saveGameDialog()

bool Engine::saveGameDialog ( )

Shows the ScummVM save dialog, allowing users to save their game.

Definition at line 754 of file engine.cpp.

◆ saveGameState()

Common::Error Engine::saveGameState ( int  slot,
const Common::String desc,
bool  isAutosave = false 
)
virtual

Save a game state.

Parameters
slotthe slot into which the savestate should be stored
desca description for the savestate, entered by the user
isAutosaveExpected to be true if an autosave is being created
Returns
returns kNoError on success, else an error code.

Reimplemented in Agi::AgiEngine, Bbvs::BbvsEngine, Fullpipe::FullpipeEngine, Toltecs::ToltecsEngine, Neverhood::NeverhoodEngine, Tucker::TuckerEngine, Saga::SagaEngine, Mortevielle::MortevielleEngine, Scumm::ScummEngine, Kyra::KyraEngine_v1, Griffon::GriffonEngine, Drascula::DrasculaEngine, Toon::ToonEngine, Gnap::GnapEngine, Prince::PrinceEngine, Access::AccessEngine, Hugo::HugoEngine, Xeen::XeenEngine, Sci::SciEngine, BladeRunner::BladeRunnerEngine, Adl::AdlEngine, ZVision::ZVision, CryOmni3D::Versailles::CryOmni3DEngine_Versailles, Illusions::IllusionsEngine, Lab::LabEngine, Wage::WageEngine, Voyeur::VoyeurEngine, Glk::GlkEngine, MacVenture::MacVentureEngine, HDB::HDBGame, Mohawk::MohawkEngine_Myst, Composer::ComposerEngine, Tony::TonyEngine, Hopkins::HopkinsEngine, Sword2::Sword2Engine, Sherlock::SherlockEngine, CGE2::CGE2Engine, Titanic::TitanicEngine, MADS::MADSEngine, CGE::CGEEngine, Cine::CineEngine, Lure::LureEngine, DreamWeb::DreamWebEngine, Avalanche::AvalancheEngine, Sword1::SwordEngine, Groovie::GroovieEngine, Mohawk::MohawkEngine_Riven, Pink::PinkEngine, Sky::SkyEngine, Queen::QueenEngine, Cruise::CruiseEngine, TeenAgent::TeenAgentEngine, Pegasus::PegasusEngine, Glk::Frotz::Frotz, TsAGE::TSageEngine, Draci::DraciEngine, MutationOfJB::MutationOfJBEngine, Supernova::SupernovaEngine, Wintermute::WintermuteEngine, Tinsel::TinselEngine, Ultima::Nuvie::NuvieEngine, and Touche::ToucheEngine.

Definition at line 702 of file engine.cpp.

◆ saveGameStream()

Common::Error Engine::saveGameStream ( Common::WriteStream stream,
bool  isAutosave = false 
)
virtual

Save a game state.

Parameters
streamThe write stream to save the savegame data to
isAutosaveExpected to be true if an autosave is being created
Returns
returns kNoError on success, else an error code.

Reimplemented in Ultima::Shared::UltimaEarlyEngine, Ultima::Ultima8::Ultima8Engine, and Griffon::GriffonEngine.

Definition at line 719 of file engine.cpp.

◆ setDebugger()

void Engine::setDebugger ( GUI::Debugger debugger)
inline

Sets the engine's debugger.

Once set, the Engine class is responsible for managing the debugger, and freeing it on exit

Definition at line 196 of file engine.h.

◆ setGameToLoadSlot()

void Engine::setGameToLoadSlot ( int  slot)

Sets the game slot for a savegame to be loaded after global main menu execution.

This is to avoid loading a savegame from inside the menu loop which causes bugs like #2822778.

Parameters
slotthe slot from which a savestate should be loaded.

Definition at line 623 of file engine.cpp.

◆ setTotalPlayTime()

void Engine::setTotalPlayTime ( uint32  time = 0)

Set the game time counter to the specified time.

This can be used to set the play time counter after loading a savegame for example. Another use case is in case the engine wants to exclude time from the counter the user spent in original engine dialogs.

Parameters
timePlay time to set up in ms.

Definition at line 604 of file engine.cpp.

◆ shouldPerformAutoSave()

bool Engine::shouldPerformAutoSave ( int  lastSaveTime)
inline

Definition at line 411 of file engine.h.

◆ shouldQuit()

bool Engine::shouldQuit ( )
static

Return whether the ENGINE should quit respectively should return to the launcher.

Definition at line 791 of file engine.cpp.

◆ syncSoundSettings()

void Engine::syncSoundSettings ( )
virtual

Notify the engine that the sound settings in the config manager may have changed and that it hence should adjust any internal volume etc.

values accordingly. The default implementation sets the volume levels of all mixer sound types according to the config entries of the active domain. When overwriting, call the default implementation first, then adjust the volumes further (if required).

Note
When setting volume levels, respect the "mute" config entry.
The volume for the plain sound type is reset to the maximum volume. If the engine can associate its own value for this type, it needs to overwrite this member and set it accordingly.
Todo:
find a better name for this

Reimplemented in Agi::AgiEngine, Touche::ToucheEngine, Saga::SagaEngine, Scumm::ScummEngine, Griffon::GriffonEngine, Drascula::DrasculaEngine, Lilliput::LilliputEngine, BladeRunner::BladeRunnerEngine, Hugo::HugoEngine, Ultima::Ultima8::Ultima8Engine, Xeen::XeenEngine, Sci::SciEngine, CryOmni3D::Versailles::CryOmni3DEngine_Versailles, Tony::TonyEngine, ZVision::ZVision, AGOS::AGOSEngine, Kyra::KyraEngine_v1, Glk::GlkEngine, Gob::GobEngine, Hopkins::HopkinsEngine, Sherlock::SherlockEngine, Titanic::TitanicEngine, MADS::MADSEngine, Sword2::Sword2Engine, Queen::QueenEngine, Cine::CineEngine, Toltecs::ToltecsEngine, Groovie::GroovieEngine, Sword1::SwordEngine, Lure::LureEngine, Cruise::CruiseEngine, Sky::SkyEngine, TsAGE::TSageEngine, Made::MadeEngine, and Draci::DraciEngine.

Definition at line 627 of file engine.cpp.

◆ warnUserAboutUnsupportedGame()

bool Engine::warnUserAboutUnsupportedGame ( )
static

Display a warning to the user that the game is not fully supported.

Returns
true if the user chose to start anyway, false otherwise

Definition at line 586 of file engine.cpp.

Member Data Documentation

◆ _autosaveInterval

const int Engine::_autosaveInterval
private

Autosave interval.

Definition at line 98 of file engine.h.

◆ _debugger

GUI::Debugger* Engine::_debugger
private

Optional debugger for the engine.

Definition at line 115 of file engine.h.

◆ _engineStartTime

int32 Engine::_engineStartTime
private

The time when the engine was started.

This value is used to calculate the current play time of the game running.

Definition at line 93 of file engine.h.

◆ _eventMan

Common::EventManager* Engine::_eventMan
protected

Definition at line 67 of file engine.h.

◆ _lastAutosaveTime

int Engine::_lastAutosaveTime
private

The last time an autosave was done.

Definition at line 103 of file engine.h.

◆ _mainMenuDialog

GUI::Dialog* Engine::_mainMenuDialog
protected

Definition at line 70 of file engine.h.

◆ _mixer

Audio::Mixer* Engine::_mixer

Definition at line 63 of file engine.h.

◆ _pauseLevel

int Engine::_pauseLevel
private

The pause level, 0 means 'running', a positive value indicates how often the engine has been paused (and hence how often it has to be un-paused before it resumes running).

This makes it possible to nest code which pauses the engine.

Definition at line 82 of file engine.h.

◆ _pauseStartTime

uint32 Engine::_pauseStartTime
private

The time when the pause was started.

Definition at line 87 of file engine.h.

◆ _saveFileMan

Common::SaveFileManager* Engine::_saveFileMan
protected

Definition at line 68 of file engine.h.

◆ _saveSlotToLoad

int Engine::_saveSlotToLoad
private

Save slot selected via global main menu.

This slot will be loaded after main menu execution (not from inside the menu loop, to avoid bugs like #2822778).

Definition at line 110 of file engine.h.

◆ _system

OSystem* Engine::_system

Definition at line 62 of file engine.h.

◆ _targetName

const Common::String Engine::_targetName
protected

Definition at line 73 of file engine.h.

◆ _timer

Common::TimerManager* Engine::_timer
protected

Definition at line 66 of file engine.h.


The documentation for this class was generated from the following files: