ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

#include <engine.h>

Inheritance diagram for Engine:
Collaboration diagram for Engine:

List of all members.

Public Types

enum  EngineFeature {
  kSupportsSubtitleOptions, kSupportsRTL, kSupportsLoadingDuringRuntime, kSupportsSavingDuringRuntime,
  kSupportsArbitraryResolutions, kSupportsJoystick
}
 

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

More...

Public Member Functions

void pauseEngine (bool pause)
 Pause or resume the engine.
bool isPaused () const
 Return whether the engine is currently paused or not.
void openMainMenuDialog ()
 Run the Global Main Menu Dialog.
uint32 getTotalPlayTime () const
 Get the total play time.
void setTotalPlayTime (uint32 time=0)
 Set the game time counter to the specified time.
Common::TimerManagergetTimerManager ()
Common::EventManagergetEventManager ()
Common::SaveFileManagergetSaveFileManager ()
void checkCD ()
 On some systems, check if the game appears to be run from CD.

Static Public Member Functions

static void quitGame ()
 Request the engine to quit.
static bool shouldQuit ()
 Return whether the ENGINE should quit respectively should return to the launcher.
static bool warnUserAboutUnsupportedGame ()
 Display a warning to the user that the game is not fully supported.

Public Attributes

OSystem_system
Audio::Mixer_mixer

Protected Member Functions

virtual int runDialog (GUI::Dialog &dialog)
bool shouldPerformAutoSave (int lastSaveTime)
 Indicate whether an autosave should be performed.

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).
uint32 _pauseStartTime
 The time when the pause was started.
int32 _engineStartTime
 The time when the engine was started.
int _saveSlotToLoad
 Save slot selected via global main menu.

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.
 Engine (OSystem *syst)
virtual ~Engine ()
virtual void initializePath (const Common::FSNode &gamePath)
 Init SearchMan according to the game path.
virtual Common::Error run ()=0
 Init the engine and start its main loop.
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.
virtual GUI::DebuggergetDebugger ()
 Return the engine's debugger instance, if any.
virtual bool hasFeature (EngineFeature f) const
 Determine whether the engine supports the specified feature.
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.
virtual void initKeymap ()
virtual void deinitKeymap ()
virtual void flipMute ()
 Flip mute all sound option.
virtual Common::Error loadGameState (int slot)
 Load a game state.
void setGameToLoadSlot (int slot)
 Sets the game slot for a savegame to be loaded after global main menu execution.
virtual bool canLoadGameStateCurrently ()
 Indicates whether a game state can be loaded.
virtual Common::Error saveGameState (int slot, const Common::String &desc)
 Save a game state.
virtual bool canSaveGameStateCurrently ()
 Indicates whether a game state can be saved.

Detailed Description

Definition at line 57 of file engine.h.


Member Enumeration Documentation

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.

kSupportsArbitraryResolutions 

Arbitrary resolutions are supported, that is, this engine allows the backend to override the resolution passed to OSystem::setupScreen.

The engine will need to read the actual resolution used by the backend using OSystem::getWidth and OSystem::getHeight.

kSupportsJoystick 

Engine must receive joystick events because the game uses them.

For engines which have not this feature, joystick events are converted to mouse events.

Definition at line 107 of file engine.h.


Constructor & Destructor Documentation

Engine::Engine ( OSystem syst  ) 

Definition at line 139 of file engine.cpp.

Engine::~Engine (  )  [virtual]

Definition at line 181 of file engine.cpp.


Member Function Documentation

bool Engine::canLoadGameStateCurrently (  )  [virtual]

Indicates whether a game state can be loaded.

Reimplemented in Grim::GrimEngine, Myst3::Myst3Engine, and Stark::StarkEngine.

Definition at line 639 of file engine.cpp.

bool Engine::canSaveGameStateCurrently (  )  [virtual]

Indicates whether a game state can be saved.

Reimplemented in Myst3::Myst3Engine, and Stark::StarkEngine.

Definition at line 649 of file engine.cpp.

void Engine::checkCD (  ) 

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

Definition at line 414 of file engine.cpp.

void Engine::deinitKeymap (  )  [virtual]

Definition at line 613 of file engine.cpp.

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.

Definition at line 489 of file engine.cpp.

void Engine::flipMute (  )  [virtual]

Flip mute all sound option.

Definition at line 619 of file engine.cpp.

virtual GUI::Debugger* Engine::getDebugger (  )  [inline, virtual]

Return the engine's debugger instance, if any.

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

Reimplemented in Grim::GrimEngine, Myst3::Myst3Engine, and Stark::StarkEngine.

Definition at line 189 of file engine.h.

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

Definition at line 338 of file engine.h.

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

Definition at line 339 of file engine.h.

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

Definition at line 337 of file engine.h.

uint32 Engine::getTotalPlayTime (  )  const

Get the total play time.

Returns:
How long the player has been playing in ms.

Definition at line 553 of file engine.cpp.

virtual bool Engine::hasFeature ( EngineFeature  f  )  const [inline, virtual]

Determine whether the engine supports the specified feature.

Reimplemented in Grim::GrimEngine, Myst3::Myst3Engine, and Stark::StarkEngine.

Definition at line 194 of file engine.h.

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:
gamePath The base directory of the game data.

Definition at line 192 of file engine.cpp.

virtual void Engine::initKeymap (  )  [inline, virtual]

Definition at line 218 of file engine.h.

bool Engine::isPaused (  )  const [inline]

Return whether the engine is currently paused or not.

Definition at line 305 of file engine.h.

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

Load a game state.

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

Reimplemented in Grim::GrimEngine, Myst3::Myst3Engine, and Stark::StarkEngine.

Definition at line 634 of file engine.cpp.

void Engine::openMainMenuDialog (  ) 

Run the Global Main Menu Dialog.

Definition at line 516 of file engine.cpp.

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:
pause true to pause the engine, false to resume it

Definition at line 493 of file engine.cpp.

void Engine::pauseEngineIntern ( bool  pause  )  [protected, virtual]

Actual implementation of pauseEngine by subclasses.

See there for details.

Reimplemented in Grim::GrimEngine, Myst3::Myst3Engine, and Stark::StarkEngine.

Definition at line 511 of file engine.cpp.

void Engine::quitGame (  )  [static]

Request the engine to quit.

Sends a EVENT_QUIT event to the Event Manager.

Definition at line 654 of file engine.cpp.

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 Grim::GrimEngine, Myst3::Myst3Engine, and Stark::StarkEngine.

int Engine::runDialog ( GUI::Dialog dialog  )  [protected, virtual]

Definition at line 571 of file engine.cpp.

Common::Error Engine::saveGameState ( int  slot,
const Common::String desc 
) [virtual]

Save a game state.

Parameters:
slot the slot into which the savestate should be stored
desc a description for the savestate, entered by the user
Returns:
returns kNoError on success, else an error code.

Reimplemented in Myst3::Myst3Engine, and Stark::StarkEngine.

Definition at line 644 of file engine.cpp.

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:
slot the slot from which a savestate should be loaded.

Definition at line 579 of file engine.cpp.

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:
time Play time to set up in ms.

Definition at line 560 of file engine.cpp.

bool Engine::shouldPerformAutoSave ( int  lastSaveTime  )  [protected]

Indicate whether an autosave should be performed.

Definition at line 483 of file engine.cpp.

bool Engine::shouldQuit (  )  [static]

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

Definition at line 661 of file engine.cpp.

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 Myst3::Myst3Engine.

Definition at line 583 of file engine.cpp.

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 542 of file engine.cpp.


Member Data Documentation

The time when the engine was started.

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

Definition at line 90 of file engine.h.

Definition at line 64 of file engine.h.

Definition at line 67 of file engine.h.

Definition at line 60 of file engine.h.

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 79 of file engine.h.

The time when the pause was started.

Reimplemented in Grim::GrimEngine.

Definition at line 84 of file engine.h.

Definition at line 65 of file engine.h.

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 97 of file engine.h.

Reimplemented in Myst3::Myst3Engine.

Definition at line 59 of file engine.h.

Definition at line 70 of file engine.h.

Definition at line 63 of file engine.h.


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


Generated on Sat Jul 20 2019 05:02:14 for ResidualVM by doxygen 1.7.1
curved edge   curved edge