Toltecs::ToltecsEngine Class Reference

#include <toltecs.h>

+ Inheritance diagram for Toltecs::ToltecsEngine:
+ Collaboration diagram for Toltecs::ToltecsEngine:


struct  SaveHeader

Public Types

enum  kReadSaveHeaderError { kRSHENoError = 0, kRSHEInvalidType = 1, kRSHEInvalidVersion = 2, kRSHEIoError = 3 }
- 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...

Public Member Functions

 ToltecsEngine (OSystem *syst, const ToltecsGameDescription *gameDesc)
 ~ToltecsEngine () override
bool hasFeature (EngineFeature f) const override
 Determine whether the engine supports the specified feature. More...
uint32 getFeatures () const
Common::Language getLanguage () const
const Common::StringgetTargetName () const
void syncSoundSettings () override
 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...
void setupSysStrings ()
void requestSavegame (int slotNum, Common::String &description)
void requestLoadgame (int slotNum)
void loadScene (uint resIndex)
void updateScreen ()
void drawScreen ()
void updateInput ()
void setGuiHeight (int16 guiHeight)
void setCamera (int16 x, int16 y)
bool getCameraChanged ()
void scrollCameraUp (int16 delta)
void scrollCameraDown (int16 delta)
void scrollCameraLeft (int16 delta)
void scrollCameraRight (int16 delta)
void updateCamera ()
void showMenu (MenuID menuId)
void talk (int16 slotIndex, int16 slotOffset)
void walk (byte *walkData)
int16 findRectAtPoint (byte *rectData, int16 x, int16 y, int16 index, int16 itemSize, byte *rectDataEnd)
const char * getSysString (int index) const
bool canLoadGameStateCurrently () override
 Indicates whether a game state can be loaded. More...
bool canSaveGameStateCurrently () override
 Indicates whether a game state can be saved. More...
Common::Error loadGameState (int slot) override
 Load a game state. More...
Common::Error saveGameState (int slot, const Common::String &description, bool isAutosave=false) override
 Save a game state. More...
void savegame (const char *filename, const char *description)
void loadgame (const char *filename)
const char * getSavegameFilename (int num)
- 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)

Static Public Member Functions

static Common::String getSavegameFilename (const Common::String &target, int num)
static WARN_UNUSED_RESULT kReadSaveHeaderError readSaveHeader (Common::SeekableReadStream *in, SaveHeader &header, bool skipThumbnail=true)
- 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...

Public Attributes

const ToltecsGameDescription_gameDescription
int _cfgVoicesVolume
int _cfgMusicVolume
int _cfgSoundFXVolume
bool _cfgText
bool _cfgVoices
Input * _input
Common::String _sysStrings [kSysStrCount]
int _saveLoadRequested
int _saveLoadSlot
Common::String _saveLoadDescription
uint _sceneResIndex
int16 _sceneWidth
int16 _sceneHeight
int _counter01
int _counter02
bool _movieSceneFlag
byte _flag01
int16 _cameraX
int16 _cameraY
int16 _newCameraX
int16 _newCameraY
int16 _cameraHeight
int16 _guiHeight
bool _doSpeech
bool _doText
int16 _walkSpeedY
int16 _walkSpeedX
Common::KeyState _keyState
int16 _mouseX
int16 _mouseY
int16 _mouseDblClickTicks
bool _mouseWaitForRelease
byte _mouseButton
int16 _mouseDisabled
bool _leftButtonDown
bool _rightButtonDown
bool _isSaveAllowed
- Public Attributes inherited from Engine

Protected Member Functions

Common::Error run () override
 Init the engine and start its main loop. 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...

Private Attributes

Common::KeyState _keyPressed

Additional Inherited Members

- Protected Attributes inherited from Engine
const Common::String _targetName

Detailed Description

Definition at line 95 of file toltecs.h.

Member Enumeration Documentation

◆ kReadSaveHeaderError


Definition at line 195 of file toltecs.h.

Constructor & Destructor Documentation

◆ ToltecsEngine()

Toltecs::ToltecsEngine::ToltecsEngine ( OSystem syst,
const ToltecsGameDescription gameDesc 

Definition at line 64 of file toltecs.cpp.

◆ ~ToltecsEngine()

Toltecs::ToltecsEngine::~ToltecsEngine ( )

Definition at line 68 of file toltecs.cpp.

Member Function Documentation

◆ canLoadGameStateCurrently()

bool Toltecs::ToltecsEngine::canLoadGameStateCurrently ( )

Indicates whether a game state can be loaded.

Reimplemented from Engine.

Definition at line 215 of file toltecs.h.

◆ canSaveGameStateCurrently()

bool Toltecs::ToltecsEngine::canSaveGameStateCurrently ( )

Indicates whether a game state can be saved.

Reimplemented from Engine.

Definition at line 216 of file toltecs.h.

◆ drawScreen()

void Toltecs::ToltecsEngine::drawScreen ( )

Definition at line 289 of file toltecs.cpp.

◆ findRectAtPoint()

int16 Toltecs::ToltecsEngine::findRectAtPoint ( byte rectData,
int16  x,
int16  y,
int16  index,
int16  itemSize,
byte rectDataEnd 

Definition at line 605 of file toltecs.cpp.

◆ getCameraChanged()

bool Toltecs::ToltecsEngine::getCameraChanged ( )

Definition at line 424 of file toltecs.cpp.

◆ getFeatures()

uint32 Toltecs::ToltecsEngine::getFeatures ( ) const

Definition at line 41 of file detection.cpp.

◆ getLanguage()

Common::Language Toltecs::ToltecsEngine::getLanguage ( ) const

Definition at line 45 of file detection.cpp.

◆ getSavegameFilename() [1/2]

Common::String Toltecs::ToltecsEngine::getSavegameFilename ( const Common::String target,
int  num 

Definition at line 220 of file saveload.cpp.

◆ getSavegameFilename() [2/2]

const char * Toltecs::ToltecsEngine::getSavegameFilename ( int  num)

Definition at line 214 of file saveload.cpp.

◆ getSysString()

const char* Toltecs::ToltecsEngine::getSysString ( int  index) const

Definition at line 191 of file toltecs.h.

◆ getTargetName()

const Common::String& Toltecs::ToltecsEngine::getTargetName ( ) const

Definition at line 112 of file toltecs.h.

◆ hasFeature()

bool Toltecs::ToltecsEngine::hasFeature ( EngineFeature  f) const

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

Definition at line 272 of file detection.cpp.

◆ loadgame()

void Toltecs::ToltecsEngine::loadgame ( const char *  filename)

Definition at line 139 of file saveload.cpp.

◆ loadGameState()

Common::Error Toltecs::ToltecsEngine::loadGameState ( int  slot)

Load a game state.

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

Reimplemented from Engine.

Definition at line 202 of file saveload.cpp.

◆ loadScene()

void Toltecs::ToltecsEngine::loadScene ( uint  resIndex)

Definition at line 217 of file toltecs.cpp.

◆ readSaveHeader()

WARN_UNUSED_RESULT ToltecsEngine::kReadSaveHeaderError Toltecs::ToltecsEngine::readSaveHeader ( Common::SeekableReadStream in,
SaveHeader header,
bool  skipThumbnail = true 

Definition at line 44 of file saveload.cpp.

◆ requestLoadgame()

void Toltecs::ToltecsEngine::requestLoadgame ( int  slotNum)

Definition at line 212 of file toltecs.cpp.

◆ requestSavegame()

void Toltecs::ToltecsEngine::requestSavegame ( int  slotNum,
Common::String description 

Definition at line 206 of file toltecs.cpp.

◆ run()

Common::Error Toltecs::ToltecsEngine::run ( )

Init the engine and start its main loop.

returns kNoError on success, else an error code.

Implements Engine.

Definition at line 72 of file toltecs.cpp.

◆ savegame()

void Toltecs::ToltecsEngine::savegame ( const char *  filename,
const char *  description 

Definition at line 76 of file saveload.cpp.

◆ saveGameState()

Common::Error Toltecs::ToltecsEngine::saveGameState ( int  slot,
const Common::String desc,
bool  isAutosave = false 

Save a game state.

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

Reimplemented from Engine.

Definition at line 208 of file saveload.cpp.

◆ scrollCameraDown()

void Toltecs::ToltecsEngine::scrollCameraDown ( int16  delta)

Definition at line 437 of file toltecs.cpp.

◆ scrollCameraLeft()

void Toltecs::ToltecsEngine::scrollCameraLeft ( int16  delta)

Definition at line 447 of file toltecs.cpp.

◆ scrollCameraRight()

void Toltecs::ToltecsEngine::scrollCameraRight ( int16  delta)

Definition at line 456 of file toltecs.cpp.

◆ scrollCameraUp()

void Toltecs::ToltecsEngine::scrollCameraUp ( int16  delta)

Definition at line 428 of file toltecs.cpp.

◆ setCamera()

void Toltecs::ToltecsEngine::setCamera ( int16  x,
int16  y 

Definition at line 414 of file toltecs.cpp.

◆ setGuiHeight()

void Toltecs::ToltecsEngine::setGuiHeight ( int16  guiHeight)

Definition at line 404 of file toltecs.cpp.

◆ setupSysStrings()

void Toltecs::ToltecsEngine::setupSysStrings ( )

Definition at line 195 of file toltecs.cpp.

◆ showMenu()

void Toltecs::ToltecsEngine::showMenu ( MenuID  menuId)

Definition at line 631 of file toltecs.cpp.

◆ syncSoundSettings()

void Toltecs::ToltecsEngine::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.

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

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.
find a better name for this

Reimplemented from Engine.

Definition at line 642 of file toltecs.cpp.

◆ talk()

void Toltecs::ToltecsEngine::talk ( int16  slotIndex,
int16  slotOffset 

Definition at line 482 of file toltecs.cpp.

◆ updateCamera()

void Toltecs::ToltecsEngine::updateCamera ( )

Definition at line 466 of file toltecs.cpp.

◆ updateInput()

void Toltecs::ToltecsEngine::updateInput ( )

Definition at line 313 of file toltecs.cpp.

◆ updateScreen()

void Toltecs::ToltecsEngine::updateScreen ( void  )

Definition at line 254 of file toltecs.cpp.

◆ walk()

void Toltecs::ToltecsEngine::walk ( byte walkData)

Definition at line 520 of file toltecs.cpp.

Member Data Documentation

◆ _anim

AnimationPlayer* Toltecs::ToltecsEngine::_anim

Definition at line 148 of file toltecs.h.

◆ _arc

ArchiveReader* Toltecs::ToltecsEngine::_arc

Definition at line 149 of file toltecs.h.

◆ _cameraHeight

int16 Toltecs::ToltecsEngine::_cameraHeight

Definition at line 176 of file toltecs.h.

◆ _cameraX

int16 Toltecs::ToltecsEngine::_cameraX

Definition at line 174 of file toltecs.h.

◆ _cameraY

int16 Toltecs::ToltecsEngine::_cameraY

Definition at line 174 of file toltecs.h.

◆ _cfgMusicVolume

int Toltecs::ToltecsEngine::_cfgMusicVolume

Definition at line 144 of file toltecs.h.

◆ _cfgSoundFXVolume

int Toltecs::ToltecsEngine::_cfgSoundFXVolume

Definition at line 144 of file toltecs.h.

◆ _cfgText

bool Toltecs::ToltecsEngine::_cfgText

Definition at line 145 of file toltecs.h.

◆ _cfgVoices

bool Toltecs::ToltecsEngine::_cfgVoices

Definition at line 145 of file toltecs.h.

◆ _cfgVoicesVolume

int Toltecs::ToltecsEngine::_cfgVoicesVolume

Definition at line 144 of file toltecs.h.

◆ _counter01

int Toltecs::ToltecsEngine::_counter01

Definition at line 170 of file toltecs.h.

◆ _counter02

int Toltecs::ToltecsEngine::_counter02

Definition at line 170 of file toltecs.h.

◆ _doSpeech

bool Toltecs::ToltecsEngine::_doSpeech

Definition at line 179 of file toltecs.h.

◆ _doText

bool Toltecs::ToltecsEngine::_doText

Definition at line 179 of file toltecs.h.

◆ _flag01

byte Toltecs::ToltecsEngine::_flag01

Definition at line 172 of file toltecs.h.

◆ _gameDescription

const ToltecsGameDescription* Toltecs::ToltecsEngine::_gameDescription

Definition at line 109 of file toltecs.h.

◆ _guiHeight

int16 Toltecs::ToltecsEngine::_guiHeight

Definition at line 177 of file toltecs.h.

◆ _input

Input* Toltecs::ToltecsEngine::_input

Definition at line 150 of file toltecs.h.

◆ _isSaveAllowed

bool Toltecs::ToltecsEngine::_isSaveAllowed

Definition at line 213 of file toltecs.h.

◆ _keyPressed

Common::KeyState Toltecs::ToltecsEngine::_keyPressed

Definition at line 96 of file toltecs.h.

◆ _keyState

Common::KeyState Toltecs::ToltecsEngine::_keyState

Definition at line 183 of file toltecs.h.

◆ _leftButtonDown

bool Toltecs::ToltecsEngine::_leftButtonDown

Definition at line 189 of file toltecs.h.

◆ _menuSystem

MenuSystem* Toltecs::ToltecsEngine::_menuSystem

Definition at line 151 of file toltecs.h.

◆ _mouseButton

byte Toltecs::ToltecsEngine::_mouseButton

Definition at line 187 of file toltecs.h.

◆ _mouseDblClickTicks

int16 Toltecs::ToltecsEngine::_mouseDblClickTicks

Definition at line 185 of file toltecs.h.

◆ _mouseDisabled

int16 Toltecs::ToltecsEngine::_mouseDisabled

Definition at line 188 of file toltecs.h.

◆ _mouseWaitForRelease

bool Toltecs::ToltecsEngine::_mouseWaitForRelease

Definition at line 186 of file toltecs.h.

◆ _mouseX

int16 Toltecs::ToltecsEngine::_mouseX

Definition at line 184 of file toltecs.h.

◆ _mouseY

int16 Toltecs::ToltecsEngine::_mouseY

Definition at line 184 of file toltecs.h.

◆ _moviePlayer

MoviePlayer* Toltecs::ToltecsEngine::_moviePlayer

Definition at line 152 of file toltecs.h.

◆ _movieSceneFlag

bool Toltecs::ToltecsEngine::_movieSceneFlag

Definition at line 171 of file toltecs.h.

◆ _music

Music* Toltecs::ToltecsEngine::_music

Definition at line 153 of file toltecs.h.

◆ _newCameraX

int16 Toltecs::ToltecsEngine::_newCameraX

Definition at line 175 of file toltecs.h.

◆ _newCameraY

int16 Toltecs::ToltecsEngine::_newCameraY

Definition at line 175 of file toltecs.h.

◆ _palette

Palette* Toltecs::ToltecsEngine::_palette

Definition at line 154 of file toltecs.h.

◆ _res

ResourceCache* Toltecs::ToltecsEngine::_res

Definition at line 155 of file toltecs.h.

◆ _rightButtonDown

bool Toltecs::ToltecsEngine::_rightButtonDown

Definition at line 189 of file toltecs.h.

◆ _rnd

Common::RandomSource* Toltecs::ToltecsEngine::_rnd

Definition at line 108 of file toltecs.h.

◆ _saveLoadDescription

Common::String Toltecs::ToltecsEngine::_saveLoadDescription

Definition at line 165 of file toltecs.h.

◆ _saveLoadRequested

int Toltecs::ToltecsEngine::_saveLoadRequested

Definition at line 163 of file toltecs.h.

◆ _saveLoadSlot

int Toltecs::ToltecsEngine::_saveLoadSlot

Definition at line 164 of file toltecs.h.

◆ _sceneHeight

int16 Toltecs::ToltecsEngine::_sceneHeight

Definition at line 168 of file toltecs.h.

◆ _sceneResIndex

uint Toltecs::ToltecsEngine::_sceneResIndex

Definition at line 167 of file toltecs.h.

◆ _sceneWidth

int16 Toltecs::ToltecsEngine::_sceneWidth

Definition at line 168 of file toltecs.h.

◆ _screen

Screen* Toltecs::ToltecsEngine::_screen

Definition at line 157 of file toltecs.h.

◆ _script

ScriptInterpreter* Toltecs::ToltecsEngine::_script

Definition at line 156 of file toltecs.h.

◆ _segmap

SegmentMap* Toltecs::ToltecsEngine::_segmap

Definition at line 158 of file toltecs.h.

◆ _sound

Sound* Toltecs::ToltecsEngine::_sound

Definition at line 159 of file toltecs.h.

◆ _sysStrings

Common::String Toltecs::ToltecsEngine::_sysStrings[kSysStrCount]

Definition at line 161 of file toltecs.h.

◆ _walkSpeedX

int16 Toltecs::ToltecsEngine::_walkSpeedX

Definition at line 181 of file toltecs.h.

◆ _walkSpeedY

int16 Toltecs::ToltecsEngine::_walkSpeedY

Definition at line 181 of file toltecs.h.

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