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)
 
virtual ~GlkEngine ()
 
virtual bool canLoadGameStateCurrently () override
 Returns true if a savegame can be loaded. More...
 
virtual 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...
 
virtual Common::Error loadGameState (int slot) override
 Load a savegame from a given slot. More...
 
virtual Common::Error saveGameState (int slot, const Common::String &desc) 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...
 
virtual 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...
 
- Public Member Functions inherited from Engine
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...
 
 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...
 
virtual void initKeymap ()
 
virtual void deinitKeymap ()
 
virtual void flipMute ()
 Flip mute all sound option. More...
 
void setGameToLoadSlot (int slot)
 Sets the game slot for a savegame to be loaded after global main menu execution. More...
 

Public Attributes

Blorb_blorb
 
Clipboard_clipboard
 
Conf_conf
 
Debugger_debugger
 
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

virtual Common::Error run ()
 Init the engine and start its main loop. More...
 
virtual 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 DebuggercreateDebugger ()
 Creates a debugger instance. 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)
 
bool shouldPerformAutoSave (int lastSaveTime)
 Indicate whether an autosave should be performed. More...
 
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
 
- 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,
  kSupportsJoystick
}
 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 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 71 of file glk.h.

Constructor & Destructor Documentation

◆ GlkEngine()

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

Definition at line 48 of file glk.cpp.

◆ ~GlkEngine()

Glk::GlkEngine::~GlkEngine ( )
virtual

Definition at line 64 of file glk.cpp.

Member Function Documentation

◆ beep()

void Glk::GlkEngine::beep ( )

Generate a beep.

Definition at line 263 of file glk.cpp.

◆ canLoadGameStateCurrently()

virtual bool Glk::GlkEngine::canLoadGameStateCurrently ( )
inlineoverridevirtual

Returns true if a savegame can be loaded.

Reimplemented from Engine.

Reimplemented in Glk::Quest::Quest.

Definition at line 139 of file glk.h.

◆ canSaveGameStateCurrently()

virtual bool Glk::GlkEngine::canSaveGameStateCurrently ( )
inlineoverridevirtual

Returns true if the game can be saved.

Reimplemented from Engine.

Reimplemented in Glk::Quest::Quest.

Definition at line 146 of file glk.h.

◆ createDebugger()

virtual Debugger* Glk::GlkEngine::createDebugger ( )
inlineprotectedvirtual

Creates a debugger instance.

Definition at line 105 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 173 of file glk.h.

◆ getGameID()

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

Returns the game's Id.

Definition at line 163 of file glk.h.

◆ getGameMD5()

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

Returns the game's md5.

Definition at line 168 of file glk.h.

◆ getInterpreterType()

◆ getLanguage()

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

Returns the language.

Definition at line 153 of file glk.h.

◆ getOptions()

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

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

Definition at line 178 of file glk.h.

◆ getRandomNumber()

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

Get a random number.

Definition at line 238 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 190 of file glk.h.

◆ getTargetName()

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

Return the game engine's target name.

Definition at line 183 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 153 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.

Reimplemented in Glk::Frotz::Frotz.

Definition at line 184 of file glk.cpp.

◆ readSaveData()

◆ run()

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

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 
)
overridevirtual

Save the game to a given slot.

Reimplemented from Engine.

Reimplemented in Glk::Frotz::Frotz.

Definition at line 231 of file glk.cpp.

◆ setRandomNumberSeed()

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

Set a random number seed.

Definition at line 243 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

Save the game.

The passed write stream represents access to the UMem chunk in the Quetzal save file that will be created

Implemented in Glk::Hugo::Hugo, Glk::Glulxe::Glulxe, Glk::Magnetic::Magnetic, Glk::Scott::Scott, Glk::Alan2::Alan2, Glk::Quest::Quest, Glk::Frotz::Frotz, Glk::Adrift::Adrift, Glk::AdvSys::AdvSys, Glk::Level9::Level9, Glk::JACL::JACL, Glk::Alan3::Alan3, and Glk::TADS::TADS.

Member Data Documentation

◆ _blorb

Blorb* Glk::GlkEngine::_blorb

Definition at line 114 of file glk.h.

◆ _clipboard

Clipboard* Glk::GlkEngine::_clipboard

Definition at line 115 of file glk.h.

◆ _conf

Conf* Glk::GlkEngine::_conf

Definition at line 116 of file glk.h.

◆ _copySelect

bool Glk::GlkEngine::_copySelect

Definition at line 125 of file glk.h.

◆ _debugger

Debugger* Glk::GlkEngine::_debugger

Definition at line 117 of file glk.h.

◆ _events

Events* Glk::GlkEngine::_events

Definition at line 118 of file glk.h.

◆ _gameDescription

const GlkGameDescription Glk::GlkEngine::_gameDescription
protected

Definition at line 78 of file glk.h.

◆ _gameFile

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

Definition at line 81 of file glk.h.

◆ _loadSaveSlot

int Glk::GlkEngine::_loadSaveSlot
protected

Definition at line 80 of file glk.h.

◆ _pcSpeaker

PCSpeaker* Glk::GlkEngine::_pcSpeaker
protected

Definition at line 82 of file glk.h.

◆ _pictures

Pictures* Glk::GlkEngine::_pictures

Definition at line 119 of file glk.h.

◆ _random

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

Definition at line 79 of file glk.h.

◆ _screen

Screen* Glk::GlkEngine::_screen

Definition at line 120 of file glk.h.

◆ _selection

Selection* Glk::GlkEngine::_selection

Definition at line 121 of file glk.h.

◆ _sounds

Sounds* Glk::GlkEngine::_sounds

Definition at line 123 of file glk.h.

◆ _streams

Streams* Glk::GlkEngine::_streams

Definition at line 122 of file glk.h.

◆ _terminated

bool Glk::GlkEngine::_terminated

Definition at line 126 of file glk.h.

◆ _windows

Windows* Glk::GlkEngine::_windows

Definition at line 124 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 130 of file glk.h.

◆ gli_register_obj

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

Definition at line 128 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 131 of file glk.h.

◆ gli_unregister_obj

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

Definition at line 129 of file glk.h.


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