ScummVM
Glk::GlkEngine Class Referenceabstract

Base class for the different interpreters. More...

#include <glk.h>

+ Inheritance diagram for Glk::GlkEngine:
+ Collaboration diagram for Glk::GlkEngine:

Public Member Functions

 GlkEngine (OSystem *syst, const GlkGameDescription &gameDesc)
 
 ~GlkEngine () override
 
bool canLoadGameStateCurrently () override
 Returns true if a savegame can be loaded. More...
 
bool canSaveGameStateCurrently () override
 Returns true if the game can be saved. More...
 
Common::Language getLanguage () const
 Returns the language. More...
 
virtual InterpreterType getInterpreterType () const =0
 Returns the running interpreter type. More...
 
const Common::StringgetGameID () const
 Returns the game's Id. More...
 
const Common::StringgetGameMD5 () const
 Returns the game's md5. More...
 
const Common::StringgetFilename () const
 Returns the primary filename for the game. More...
 
uint getOptions () const
 Returns any options returned with the game's detection entry. More...
 
const Common::StringgetTargetName () const
 Return the game engine's target name. More...
 
Common::String getSaveName (uint slot) const
 Return the filename for a given save slot. More...
 
Common::Error loadGame ()
 Prompt the user for a savegame to load, and then load it. More...
 
Common::Error saveGame ()
 Prompt the user to save their game, and then save it. More...
 
Common::Error loadGameState (int slot) override
 Load a savegame from a given slot. More...
 
Common::Error saveGameState (int slot, const Common::String &desc, bool isAutosave=false) override
 Save the game to a given slot. More...
 
virtual Common::Error readSaveData (Common::SeekableReadStream *rs)=0
 Load a savegame from the passed Quetzal file chunk stream. More...
 
virtual Common::Error writeGameData (Common::WriteStream *ws)=0
 Save the game. More...
 
void syncSoundSettings () override
 Updates sound settings. More...
 
void beep ()
 Generate a beep. More...
 
uint getRandomNumber (uint max)
 Get a random number. More...
 
void setRandomNumberSeed (uint seed)
 Set a random number seed. More...
 
void quitGame ()
 Flags to quit the game. More...
 
bool shouldQuit () const
 Returns true if the game should be quit. More...
 
- Public Member Functions inherited from Engine
 Engine (OSystem *syst)
 
virtual ~Engine ()
 
virtual void initializePath (const Common::FSNode &gamePath)
 Init SearchMan according to the game path. 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 void flipMute ()
 Flip mute all sound option. More...
 
virtual Common::String getSaveStateName (int slot) const
 Generates the savegame filename. 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 Common::Error saveGameStream (Common::WriteStream *stream, bool isAutosave=false)
 Save a game state. 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)
 

Public Attributes

Blorb_blorb
 
Clipboard_clipboard
 
Conf_conf
 
Events_events
 
Pictures_pictures
 
Screen_screen
 
Selection_selection
 
Streams_streams
 
Sounds_sounds
 
Windows_windows
 
bool _copySelect
 
bool _terminated
 
gidispatch_rock_t(* gli_register_obj )(void *obj, uint objclass)
 
void(* gli_unregister_obj )(void *obj, uint objclass, gidispatch_rock_t objrock)
 
gidispatch_rock_t(* gli_register_arr )(void *array, uint len, const char *typecode)
 
void(* gli_unregister_arr )(void *array, uint len, const char *typecode, gidispatch_rock_t objrock)
 
- Public Attributes inherited from Engine
OSystem_system
 
Audio::Mixer_mixer
 

Protected Member Functions

Common::Error run () override
 Init the engine and start its main loop. More...
 
bool hasFeature (EngineFeature f) const override
 Returns true whether a given feature is supported by the engine. More...
 
virtual void initGraphicsMode ()
 Setup the video mode. More...
 
virtual ScreencreateScreen ()
 Create the screen. More...
 
virtual void runGame ()=0
 Main game loop for the individual interpreters. More...
 
- Protected Member Functions inherited from Engine
virtual int runDialog (GUI::Dialog &dialog)
 
virtual void pauseEngineIntern (bool pause)
 Actual implementation of pauseEngine by subclasses. More...
 

Protected Attributes

const GlkGameDescription _gameDescription
 
Common::RandomSource _random
 
int _loadSaveSlot
 
Common::File _gameFile
 
PCSpeaker_pcSpeaker
 
bool _quitFlag
 
- Protected Attributes inherited from Engine
Common::TimerManager_timer
 
Common::EventManager_eventMan
 
Common::SaveFileManager_saveFileMan
 
GUI::Dialog_mainMenuDialog
 
const Common::String _targetName
 

Private Member Functions

void initialize ()
 Handles basic initialization. More...
 

Additional Inherited Members

- Public Types inherited from Engine
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...
 
- Static Public Member Functions inherited from Engine
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

Base class for the different interpreters.

Definition at line 70 of file glk.h.

Constructor & Destructor Documentation

◆ GlkEngine()

Glk::GlkEngine::GlkEngine ( OSystem syst,
const GlkGameDescription gameDesc 
)

Definition at line 49 of file glk.cpp.

◆ ~GlkEngine()

Glk::GlkEngine::~GlkEngine ( )
override

Definition at line 65 of file glk.cpp.

Member Function Documentation

◆ beep()

void Glk::GlkEngine::beep ( )

Generate a beep.

Definition at line 263 of file glk.cpp.

◆ canLoadGameStateCurrently()

bool Glk::GlkEngine::canLoadGameStateCurrently ( )
inlineoverridevirtual

Returns true if a savegame can be loaded.

Reimplemented from Engine.

Reimplemented in Glk::Magnetic::Magnetic, and Glk::Quest::Quest.

Definition at line 131 of file glk.h.

◆ canSaveGameStateCurrently()

bool Glk::GlkEngine::canSaveGameStateCurrently ( )
inlineoverridevirtual

Returns true if the game can be saved.

Reimplemented from Engine.

Reimplemented in Glk::Magnetic::Magnetic, and Glk::Quest::Quest.

Definition at line 138 of file glk.h.

◆ createScreen()

Screen * Glk::GlkEngine::createScreen ( )
protectedvirtual

Create the screen.

Reimplemented in Glk::Frotz::Frotz.

Definition at line 99 of file glk.cpp.

◆ getFilename()

const Common::String& Glk::GlkEngine::getFilename ( ) const
inline

Returns the primary filename for the game.

Definition at line 165 of file glk.h.

◆ getGameID()

const Common::String& Glk::GlkEngine::getGameID ( ) const
inline

Returns the game's Id.

Definition at line 155 of file glk.h.

◆ getGameMD5()

const Common::String& Glk::GlkEngine::getGameMD5 ( ) const
inline

Returns the game's md5.

Definition at line 160 of file glk.h.

◆ getInterpreterType()

◆ getLanguage()

Common::Language Glk::GlkEngine::getLanguage ( ) const
inline

Returns the language.

Definition at line 145 of file glk.h.

◆ getOptions()

uint Glk::GlkEngine::getOptions ( ) const
inline

Returns any options returned with the game's detection entry.

Definition at line 170 of file glk.h.

◆ getRandomNumber()

uint Glk::GlkEngine::getRandomNumber ( uint  max)
inline

Get a random number.

Definition at line 230 of file glk.h.

◆ getSaveName()

Common::String Glk::GlkEngine::getSaveName ( uint  slot) const
inline

Return the filename for a given save slot.

Definition at line 182 of file glk.h.

◆ getTargetName()

const Common::String& Glk::GlkEngine::getTargetName ( ) const
inline

Return the game engine's target name.

Definition at line 175 of file glk.h.

◆ hasFeature()

bool Glk::GlkEngine::hasFeature ( EngineFeature  f) const
overrideprotectedvirtual

Returns true whether a given feature is supported by the engine.

Reimplemented from Engine.

Reimplemented in Glk::TADS::TADS.

Definition at line 163 of file detection.cpp.

◆ initGraphicsMode()

void Glk::GlkEngine::initGraphicsMode ( )
protectedvirtual

Setup the video mode.

Reimplemented in Glk::Frotz::Frotz.

Definition at line 103 of file glk.cpp.

◆ initialize()

void Glk::GlkEngine::initialize ( )
private

Handles basic initialization.

Definition at line 79 of file glk.cpp.

◆ loadGame()

Common::Error Glk::GlkEngine::loadGame ( )

Prompt the user for a savegame to load, and then load it.

Definition at line 159 of file glk.cpp.

◆ loadGameState()

Common::Error Glk::GlkEngine::loadGameState ( int  slot)
overridevirtual

Load a savegame from a given slot.

Reimplemented from Engine.

Definition at line 184 of file glk.cpp.

◆ quitGame()

void Glk::GlkEngine::quitGame ( )
inline

Flags to quit the game.

Definition at line 240 of file glk.h.

◆ readSaveData()

◆ run()

Common::Error Glk::GlkEngine::run ( )
overrideprotectedvirtual

Init the engine and start its main loop.

Returns
returns kNoError on success, else an error code.

Implements Engine.

Definition at line 119 of file glk.cpp.

◆ runGame()

◆ saveGame()

Common::Error Glk::GlkEngine::saveGame ( )

Prompt the user to save their game, and then save it.

Definition at line 171 of file glk.cpp.

◆ saveGameState()

Common::Error Glk::GlkEngine::saveGameState ( int  slot,
const Common::String desc,
bool  isAutosave = false 
)
overridevirtual

Save the game to a given slot.

Reimplemented from Engine.

Definition at line 231 of file glk.cpp.

◆ setRandomNumberSeed()

void Glk::GlkEngine::setRandomNumberSeed ( uint  seed)
inline

Set a random number seed.

Definition at line 235 of file glk.h.

◆ shouldQuit()

bool Glk::GlkEngine::shouldQuit ( ) const
inline

Returns true if the game should be quit.

Definition at line 248 of file glk.h.

◆ syncSoundSettings()

void Glk::GlkEngine::syncSoundSettings ( )
overridevirtual

Updates sound settings.

Reimplemented from Engine.

Definition at line 256 of file glk.cpp.

◆ writeGameData()

virtual Common::Error Glk::GlkEngine::writeGameData ( Common::WriteStream ws)
pure virtual

Member Data Documentation

◆ _blorb

Blorb* Glk::GlkEngine::_blorb

Definition at line 107 of file glk.h.

◆ _clipboard

Clipboard* Glk::GlkEngine::_clipboard

Definition at line 108 of file glk.h.

◆ _conf

Conf* Glk::GlkEngine::_conf

Definition at line 109 of file glk.h.

◆ _copySelect

bool Glk::GlkEngine::_copySelect

Definition at line 117 of file glk.h.

◆ _events

Events* Glk::GlkEngine::_events

Definition at line 110 of file glk.h.

◆ _gameDescription

const GlkGameDescription Glk::GlkEngine::_gameDescription
protected

Definition at line 77 of file glk.h.

◆ _gameFile

Common::File Glk::GlkEngine::_gameFile
protected

Definition at line 80 of file glk.h.

◆ _loadSaveSlot

int Glk::GlkEngine::_loadSaveSlot
protected

Definition at line 79 of file glk.h.

◆ _pcSpeaker

PCSpeaker* Glk::GlkEngine::_pcSpeaker
protected

Definition at line 81 of file glk.h.

◆ _pictures

Pictures* Glk::GlkEngine::_pictures

Definition at line 111 of file glk.h.

◆ _quitFlag

bool Glk::GlkEngine::_quitFlag
protected

Definition at line 82 of file glk.h.

◆ _random

Common::RandomSource Glk::GlkEngine::_random
protected

Definition at line 78 of file glk.h.

◆ _screen

Screen* Glk::GlkEngine::_screen

Definition at line 112 of file glk.h.

◆ _selection

Selection* Glk::GlkEngine::_selection

Definition at line 113 of file glk.h.

◆ _sounds

Sounds* Glk::GlkEngine::_sounds

Definition at line 115 of file glk.h.

◆ _streams

Streams* Glk::GlkEngine::_streams

Definition at line 114 of file glk.h.

◆ _terminated

bool Glk::GlkEngine::_terminated

Definition at line 118 of file glk.h.

◆ _windows

Windows* Glk::GlkEngine::_windows

Definition at line 116 of file glk.h.

◆ gli_register_arr

gidispatch_rock_t(* Glk::GlkEngine::gli_register_arr) (void *array, uint len, const char *typecode)

Definition at line 122 of file glk.h.

◆ gli_register_obj

gidispatch_rock_t(* Glk::GlkEngine::gli_register_obj) (void *obj, uint objclass)

Definition at line 120 of file glk.h.

◆ gli_unregister_arr

void(* Glk::GlkEngine::gli_unregister_arr) (void *array, uint len, const char *typecode, gidispatch_rock_t objrock)

Definition at line 123 of file glk.h.

◆ gli_unregister_obj

void(* Glk::GlkEngine::gli_unregister_obj) (void *obj, uint objclass, gidispatch_rock_t objrock)

Definition at line 121 of file glk.h.


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