ScummVM API documentation
M4::M4Engine Class Referenceabstract
Inheritance diagram for M4::M4Engine:
Engine M4::Sections M4::Burger::BurgerEngine M4::Riddle::RiddleEngine

Public Types

enum  LoadDialogSource { kLoadFromMainMenu, kLoadFromGameDialog, kLoadFromHotkey }
 
- Public Types inherited from Engine
enum  EngineFeature {
  kSupportsSubtitleOptions, kSupportsReturnToLauncher, kSupportsLoadingDuringRuntime, kSupportsSavingDuringRuntime,
  kSupportsChangingOptionsDuringRuntime, kSupportsArbitraryResolutions, kSupportsHelp, kSupportsQuitDialogOverride
}
 

Public Member Functions

 M4Engine (OSystem *syst, const M4GameDescription *gameDesc)
 
uint32 getFeatures () const
 
bool useOriginalSaveLoad () const
 
Common::String getGameId () const
 
int getGameType () const
 
Common::Language getLanguage () const
 
int isDemo () const
 
uint32 getRandomNumber (uint maxNum)
 
bool hasFeature (EngineFeature f) const override
 
bool canLoadGameStateCurrently (Common::U32String *msg=nullptr) override
 
bool canSaveGameStateCurrently (Common::U32String *msg=nullptr) override
 
void syncSoundSettings () override
 
Common::Error loadGameState (int slot) override
 
Common::Error loadGameStateDoIt (int slot)
 
Common::Error syncGame (Common::Serializer &s)
 
virtual void syncFlags (Common::Serializer &s)=0
 
Common::Error saveGameStream (Common::WriteStream *stream, bool isAutosave=false) override
 
Common::Error loadGameStream (Common::SeekableReadStream *stream) override
 
bool autosaveExists () const
 
bool savesExist () const
 
SaveStateList listSaves () const
 
bool loadSaveThumbnail (int slotNum, M4sprite *thumbnail) const
 
bool saveGameFromMenu (int slotNum, const Common::String &desc, Graphics::Surface &thumbnail)
 
virtual void showSaveScreen ()
 
virtual void showLoadScreen (LoadDialogSource fromMainMenu)
 
virtual void showEngineInfo ()=0
 
- Public Member Functions inherited from Engine
MetaEnginegetMetaEngine () const
 
void setMetaEngine (MetaEngine *metaEngine)
 
PauseToken pauseEngine ()
 
bool isPaused () const
 
void openMainMenuDialog ()
 
uint32 getTotalPlayTime () const
 
void setTotalPlayTime (uint32 time=0)
 
Common::TimerManagergetTimerManager ()
 
Common::EventManagergetEventManager ()
 
Common::SaveFileManagergetSaveFileManager ()
 
bool existExtractedCDAudioFiles (uint track=1)
 
bool isDataAndCDAudioReadFromSameCD ()
 
void warnMissingExtractedCDAudio ()
 
void handleAutoSave ()
 
void saveAutosaveIfEnabled ()
 
virtual bool canSaveAutosaveCurrently ()
 
virtual int getAutosaveSlot () const
 
 Engine (OSystem *syst)
 
virtual ~Engine ()
 
virtual void initializePath (const Common::FSNode &gamePath)
 
virtual void errorString (const char *buf_input, char *buf_output, int buf_output_size)
 
virtual GUI::DebuggergetDebugger () final
 
void setDebugger (GUI::Debugger *debugger)
 
GUI::DebuggergetOrCreateDebugger ()
 
virtual void applyGameSettings ()
 
virtual void flipMute ()
 
virtual Common::String getSaveStateName (int slot) const
 
void setGameToLoadSlot (int slot)
 
virtual Common::Error saveGameState (int slot, const Common::String &desc, bool isAutosave=false)
 
bool saveGameDialog ()
 
bool loadGameDialog ()
 
- Public Member Functions inherited from M4::Sections
void global_section_constructor ()
 
void section_room_constructor ()
 
void game_daemon_code ()
 
void parse_player_command_now ()
 
void section_init ()
 
void daemon ()
 
void global_room_init ()
 
void tick ()
 
void section_parser ()
 
void room_preload ()
 
void room_init ()
 
void room_daemon ()
 
void room_pre_parser ()
 
void room_parser ()
 
void parser_code ()
 
void room_error ()
 
void room_shutdown ()
 
HotSpotReccustom_hotspot_which (int x, int y)
 
void m4SceneLoad ()
 
void m4RunScene ()
 
void m4EndScene ()
 
void pal_game_task ()
 
virtual void global_daemon ()=0
 
virtual void global_pre_parser ()=0
 
virtual void global_parser ()=0
 
void global_error_code ()
 

Protected Member Functions

Common::Error run () override
 
virtual VarscreateVars ()=0
 
virtual void setupConsole ()=0
 
- Protected Member Functions inherited from Engine
virtual int runDialog (GUI::Dialog &dialog)
 
void defaultSyncSoundSettings ()
 
virtual void pauseEngineIntern (bool pause)
 

Protected Attributes

bool _useOriginalSaveLoad = false
 
- Protected Attributes inherited from Engine
Common::TimerManager_timer
 
Common::EventManager_eventMan
 
Common::SaveFileManager_saveFileMan
 
GUI::Dialog_mainMenuDialog
 
const Common::String _targetName
 
- Protected Attributes inherited from M4::Sections
Common::Array< Section * > _sections
 

Additional Inherited Members

- Static Public Member Functions inherited from Engine
static void quitGame ()
 
static bool shouldQuit ()
 
static MetaEngineDetectiongetMetaEngineDetection ()
 
static bool warnUserAboutUnsupportedGame (Common::String msg=Common::String())
 
static void errorUnsupportedGame (Common::String extraMsg)
 
- Public Attributes inherited from Engine
OSystem_system
 
Audio::Mixer_mixer
 
- Public Attributes inherited from M4::Sections
Section_activeSection = nullptr
 
Room_activeRoom = nullptr
 

Member Function Documentation

◆ run()

Common::Error M4::M4Engine::run ( )
overrideprotectedvirtual

Initialize the engine and start its main loop.

Returns
kNoError on success, otherwise an error code.

Implements Engine.

◆ createVars()

virtual Vars* M4::M4Engine::createVars ( )
protectedpure virtual

Creates globals

Implemented in M4::Burger::BurgerEngine, and M4::Riddle::RiddleEngine.

◆ setupConsole()

virtual void M4::M4Engine::setupConsole ( )
protectedpure virtual

Sets up the debugging console

Implemented in M4::Burger::BurgerEngine, and M4::Riddle::RiddleEngine.

◆ getGameId()

Common::String M4::M4Engine::getGameId ( ) const

Returns the game Id

◆ getGameType()

int M4::M4Engine::getGameType ( ) const

Returns the game type

◆ getLanguage()

Common::Language M4::M4Engine::getLanguage ( ) const

Return game language

◆ isDemo()

int M4::M4Engine::isDemo ( ) const

Return if it's a demo

◆ getRandomNumber()

uint32 M4::M4Engine::getRandomNumber ( uint  maxNum)
inline

Gets a random number

◆ hasFeature()

bool M4::M4Engine::hasFeature ( EngineFeature  f) const
inlineoverridevirtual

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

◆ canLoadGameStateCurrently()

bool M4::M4Engine::canLoadGameStateCurrently ( Common::U32String msg = nullptr)
overridevirtual

Indicate whether a game state can be loaded.

Parameters
msgOptional pointer to message explaining why it is disabled

Reimplemented from Engine.

◆ canSaveGameStateCurrently()

bool M4::M4Engine::canSaveGameStateCurrently ( Common::U32String msg = nullptr)
overridevirtual

Indicate whether a game state can be saved.

Parameters
msgOptional pointer to message explaining why it is disabled

Reimplemented from Engine.

◆ syncSoundSettings()

void M4::M4Engine::syncSoundSettings ( )
overridevirtual

Notify the engine that the sound settings in the config manager might have changed and that it should adjust any internal volume (and other) 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.

Reimplemented from Engine.

◆ loadGameState()

Common::Error M4::M4Engine::loadGameState ( int  slot)
overridevirtual

Load a game state.

Parameters
slotThe slot from which a save state should be loaded.
Returns
kNoError on success, otherwise an error code.

Reimplemented from Engine.

◆ syncGame()

Common::Error M4::M4Engine::syncGame ( Common::Serializer s)

Uses a serializer to allow implementing savegame loading and saving using a single method

◆ saveGameStream()

Common::Error M4::M4Engine::saveGameStream ( Common::WriteStream stream,
bool  isAutosave = false 
)
overridevirtual

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
kNoError on success, otherwise an error code.

Reimplemented from Engine.

◆ loadGameStream()

Common::Error M4::M4Engine::loadGameStream ( Common::SeekableReadStream stream)
overridevirtual

Load a game state.

Parameters
streamThe stream to load the save state from.
Returns
kNoError on success, otherwise an error code.

Reimplemented from Engine.

◆ autosaveExists()

bool M4::M4Engine::autosaveExists ( ) const

Returns true if an autosave exists

◆ savesExist()

bool M4::M4Engine::savesExist ( ) const

Returns true if any saves exist

◆ listSaves()

SaveStateList M4::M4Engine::listSaves ( ) const

Lists the saves

◆ loadSaveThumbnail()

bool M4::M4Engine::loadSaveThumbnail ( int  slotNum,
M4sprite thumbnail 
) const

Returns the savegame thumbnail for a save

◆ saveGameFromMenu()

bool M4::M4Engine::saveGameFromMenu ( int  slotNum,
const Common::String desc,
Graphics::Surface thumbnail 
)

Save game from in-game save menu

◆ showSaveScreen()

virtual void M4::M4Engine::showSaveScreen ( )
virtual

Show save game dialog

Reimplemented in M4::Burger::BurgerEngine.

◆ showLoadScreen()

virtual void M4::M4Engine::showLoadScreen ( LoadDialogSource  fromMainMenu)
virtual

Show restore game dialog

Reimplemented in M4::Burger::BurgerEngine.

◆ showEngineInfo()

virtual void M4::M4Engine::showEngineInfo ( )
pure virtual

Show the engine information

Implemented in M4::Burger::BurgerEngine, and M4::Riddle::RiddleEngine.


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