Tony::TonyEngine Class Reference

#include <tony.h>

+ Inheritance diagram for Tony::TonyEngine:
+ Collaboration diagram for Tony::TonyEngine:

Public Types

enum  DataDir {
- 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

 TonyEngine (OSystem *syst, const TonyGameDescription *gameDesc)
 ~TonyEngine () override
uint32 getFeatures () const
Common::Language getLanguage () const
uint16 getVersion () const
bool getIsDemo () const
bool isCompressed () const
RMGfxEnginegetEngine ()
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 &desc, bool isAutosave=false) override
 Save a game state. More...
void play ()
 Play the game. More...
void close ()
void getDataDirectory (DataDir dir, char *path)
void showLocation ()
void hideLocation ()
uint32 getTime ()
 Reads the time. More...
void freezeTime ()
void unfreezeTime ()
void playMusic (int nChannel, const Common::String &fn, int nFX, bool bLoop, int nSync)
void stopMusic (int nChannel)
void playSFX (int nSfx, int nFX=0)
void stopSFX (int nSfx)
void playUtilSFX (int nSfx, int nFX=0)
void stopUtilSFX (int nSfx)
FPSfxcreateSFX (Common::SeekableReadStream *stream)
void preloadSFX (int nSfx, const char *fn)
void unloadAllSFX ()
void preloadUtilSFX (int nSfx, const char *fn)
void unloadAllUtilSFX ()
void pauseSound (bool bPause)
 Stop all the audio. More...
void setMusicVolume (int nChannel, int volume)
int getMusicVolume (int nChannel)
void autoSave (CORO_PARAM)
 Handle saving. More...
void saveState (int n, const char *name)
void loadState (CORO_PARAM, int n)
virtual Common::String getSaveStateName (int slot) const override
 Generates the savegame filename. More...
void grabThumbnail ()
 Get a thumbnail. More...
uint16getThumbnail ()
void quitGame ()
void openInitLoadMenu (CORO_PARAM)
void openInitOptions (CORO_PARAM)
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 saveSoundSettings ()
- 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::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 getSaveStateFileName (int n)
- 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

Common::String _funcListStrings [300]
Common::RandomSource _randomSource
RMResUpdate _resUpdate
uint32 _hEndOfFrame
Common::File _vdbFP
SoundCodecs _vdbCodec
Common::Array< VoiceHeader_voices
FPSound _theSound
Common::List< FPSfx * > _activeSfx
Globals _globals
int16 _cTableDialog [256]
int16 _lTableDialog [256]
int16 _cTableMacc [256]
int16 _lTableMacc [256]
int16 _cTableCred [256]
int16 _lTableCred [256]
int16 _cTableObj [256]
int16 _lTableObj [256]
FPStream_stream [6]
bool _bPaused
bool _bDrawLocation
int _startTime
int _initialLoadSlotNumber
int _loadSlotNumber
RMGameBoxes _theBoxes
RMWindow _window
RMGfxEngine _theEngine
bool _bQuitNow
bool _bTimeFreezed
int _nTimeFreezed
const TonyGameDescription_gameDescription
- Public Attributes inherited from Engine

Protected Member Functions

Common::Error run () override
 Run the game. More...
bool hasFeature (EngineFeature f) const override
 Determine whether the engine supports the specified feature. 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 Member Functions

Common::ErrorCode init ()
 Initialize the game. More...
bool loadTonyDat ()
void initMusic ()
void closeMusic ()
bool openVoiceDatabase ()
void closeVoiceDatabase ()
void initCustomFunctionMap ()

Static Private Member Functions

static void playProcess (CORO_PARAM, const void *param)
 Main process for playing the game. More...
static void doNextMusic (CORO_PARAM, const void *param)

Additional Inherited Members

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

Detailed Description

Definition at line 84 of file tony.h.

Member Enumeration Documentation

◆ DataDir


Definition at line 122 of file tony.h.

Constructor & Destructor Documentation

◆ TonyEngine()

Tony::TonyEngine::TonyEngine ( OSystem syst,
const TonyGameDescription gameDesc 

Definition at line 41 of file tony.cpp.

◆ ~TonyEngine()

Tony::TonyEngine::~TonyEngine ( )

Definition at line 91 of file tony.cpp.

Member Function Documentation

◆ autoSave()

void Tony::TonyEngine::autoSave ( CORO_PARAM  )

Handle saving.

Definition at line 550 of file tony.cpp.

◆ canLoadGameStateCurrently()

bool Tony::TonyEngine::canLoadGameStateCurrently ( )

Indicates whether a game state can be loaded.

Reimplemented from Engine.

Definition at line 746 of file tony.cpp.

◆ canSaveGameStateCurrently()

bool Tony::TonyEngine::canSaveGameStateCurrently ( )

Indicates whether a game state can be saved.

Reimplemented from Engine.

Definition at line 750 of file tony.cpp.

◆ close()

void Tony::TonyEngine::close ( )

Definition at line 719 of file tony.cpp.

◆ closeMusic()

void Tony::TonyEngine::closeMusic ( )

Definition at line 506 of file tony.cpp.

◆ closeVoiceDatabase()

void Tony::TonyEngine::closeVoiceDatabase ( )

Definition at line 624 of file tony.cpp.

◆ createSFX()

FPSfx * Tony::TonyEngine::createSFX ( Common::SeekableReadStream stream)

Definition at line 444 of file tony.cpp.

◆ doNextMusic()

void Tony::TonyEngine::doNextMusic ( CORO_PARAM  ,
const void *  param 

Definition at line 348 of file tony.cpp.

◆ freezeTime()

void Tony::TonyEngine::freezeTime ( )

Definition at line 730 of file tony.cpp.

◆ getDataDirectory()

void Tony::TonyEngine::getDataDirectory ( DataDir  dir,
char *  path 

◆ getEngine()

RMGfxEngine* Tony::TonyEngine::getEngine ( )

Definition at line 161 of file tony.h.

◆ getFeatures()

uint32 Tony::TonyEngine::getFeatures ( ) const

Definition at line 44 of file detection.cpp.

◆ getIsDemo()

bool Tony::TonyEngine::getIsDemo ( ) const

Definition at line 52 of file detection.cpp.

◆ getLanguage()

Common::Language Tony::TonyEngine::getLanguage ( ) const

Definition at line 48 of file detection.cpp.

◆ getMusicVolume()

int Tony::TonyEngine::getMusicVolume ( int  nChannel)

Definition at line 536 of file tony.cpp.

◆ getSaveStateFileName()

Common::String Tony::TonyEngine::getSaveStateFileName ( int  n)

Definition at line 542 of file tony.cpp.

◆ getSaveStateName()

Common::String Tony::TonyEngine::getSaveStateName ( int  slot) const

Generates the savegame filename.

Reimplemented from Engine.

Definition at line 546 of file tony.cpp.

◆ getThumbnail()

uint16 * Tony::TonyEngine::getThumbnail ( )

Definition at line 636 of file tony.cpp.

◆ getTime()

uint32 Tony::TonyEngine::getTime ( )

Reads the time.

Returns the millisecond timer.

Definition at line 742 of file tony.cpp.

◆ getVersion()

uint16 Tony::TonyEngine::getVersion ( ) const

◆ grabThumbnail()

void Tony::TonyEngine::grabThumbnail ( )

Get a thumbnail.

Definition at line 632 of file tony.cpp.

◆ hasFeature()

bool Tony::TonyEngine::hasFeature ( EngineFeature  f) const

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

Definition at line 103 of file detection.cpp.

◆ hideLocation()

void Tony::TonyEngine::hideLocation ( )

Definition at line 803 of file tony.cpp.

◆ init()

Common::ErrorCode Tony::TonyEngine::init ( void  )

Initialize the game.

Definition at line 117 of file tony.cpp.

◆ initCustomFunctionMap()

void Tony::TonyEngine::initCustomFunctionMap ( )

Definition at line 278 of file tony.cpp.

◆ initMusic()

void Tony::TonyEngine::initMusic ( )

Definition at line 485 of file tony.cpp.

◆ isCompressed()

bool Tony::TonyEngine::isCompressed ( ) const

Definition at line 56 of file detection.cpp.

◆ loadGameState()

Common::Error Tony::TonyEngine::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 754 of file tony.cpp.

◆ loadState()

void Tony::TonyEngine::loadState ( CORO_PARAM  ,
int  n 

Definition at line 571 of file tony.cpp.

◆ loadTonyDat()

bool Tony::TonyEngine::loadTonyDat ( )

Definition at line 188 of file tony.cpp.

◆ openInitLoadMenu()

void Tony::TonyEngine::openInitLoadMenu ( CORO_PARAM  )

Definition at line 644 of file tony.cpp.

◆ openInitOptions()

void Tony::TonyEngine::openInitOptions ( CORO_PARAM  )

Definition at line 648 of file tony.cpp.

◆ openVoiceDatabase()

bool Tony::TonyEngine::openVoiceDatabase ( )

Definition at line 584 of file tony.cpp.

◆ pauseSound()

void Tony::TonyEngine::pauseSound ( bool  bPause)

Stop all the audio.

Definition at line 517 of file tony.cpp.

◆ play()

void Tony::TonyEngine::play ( )

Play the game.

Definition at line 705 of file tony.cpp.

◆ playMusic()

void Tony::TonyEngine::playMusic ( int  nChannel,
const Common::String fn,
int  nFX,
bool  bLoop,
int  nSync 

Definition at line 282 of file tony.cpp.

◆ playProcess()

void Tony::TonyEngine::playProcess ( CORO_PARAM  ,
const void *  param 

Main process for playing the game.

This needs to be in a separate process, since there are some things that can briefly block the execution of process. For now, all ScummVm event handling is dispatched to within the context of this process. If it ever proves a problem, we may have to look into whether it's feasible to have it still remain in the outer 'main' process.

Definition at line 660 of file tony.cpp.

◆ playSFX()

void Tony::TonyEngine::playSFX ( int  nSfx,
int  nFX = 0 

Definition at line 376 of file tony.cpp.

◆ playUtilSFX()

void Tony::TonyEngine::playUtilSFX ( int  nSfx,
int  nFX = 0 

Definition at line 407 of file tony.cpp.

◆ preloadSFX()

void Tony::TonyEngine::preloadSFX ( int  nSfx,
const char *  fn 

Definition at line 432 of file tony.cpp.

◆ preloadUtilSFX()

void Tony::TonyEngine::preloadUtilSFX ( int  nSfx,
const char *  fn 

Definition at line 452 of file tony.cpp.

◆ quitGame()

void Tony::TonyEngine::quitGame ( )

Definition at line 640 of file tony.cpp.

◆ run()

Common::Error Tony::TonyEngine::run ( )

Run the game.

Implements Engine.

Definition at line 103 of file tony.cpp.

◆ saveGameState()

Common::Error Tony::TonyEngine::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 759 of file tony.cpp.

◆ saveSoundSettings()

void Tony::TonyEngine::saveSoundSettings ( )

Definition at line 786 of file tony.cpp.

◆ saveState()

void Tony::TonyEngine::saveState ( int  n,
const char *  name 

Definition at line 566 of file tony.cpp.

◆ setMusicVolume()

void Tony::TonyEngine::setMusicVolume ( int  nChannel,
int  volume 

Definition at line 532 of file tony.cpp.

◆ showLocation()

void Tony::TonyEngine::showLocation ( )

Definition at line 799 of file tony.cpp.

◆ stopMusic()

void Tony::TonyEngine::stopMusic ( int  nChannel)

Definition at line 396 of file tony.cpp.

◆ stopSFX()

void Tony::TonyEngine::stopSFX ( int  nSfx)

Definition at line 403 of file tony.cpp.

◆ stopUtilSFX()

void Tony::TonyEngine::stopUtilSFX ( int  nSfx)

Definition at line 428 of file tony.cpp.

◆ syncSoundSettings()

void Tony::TonyEngine::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 771 of file tony.cpp.

◆ unfreezeTime()

void Tony::TonyEngine::unfreezeTime ( )

Definition at line 735 of file tony.cpp.

◆ unloadAllSFX()

void Tony::TonyEngine::unloadAllSFX ( )

Definition at line 465 of file tony.cpp.

◆ unloadAllUtilSFX()

void Tony::TonyEngine::unloadAllUtilSFX ( )

Definition at line 475 of file tony.cpp.

Member Data Documentation

◆ _activeSfx

Common::List<FPSfx *> Tony::TonyEngine::_activeSfx

Definition at line 110 of file tony.h.

◆ _bDrawLocation

bool Tony::TonyEngine::_bDrawLocation

Definition at line 137 of file tony.h.

◆ _bPaused

bool Tony::TonyEngine::_bPaused

Definition at line 136 of file tony.h.

◆ _bQuitNow

bool Tony::TonyEngine::_bQuitNow

Definition at line 148 of file tony.h.

◆ _bTimeFreezed

bool Tony::TonyEngine::_bTimeFreezed

Definition at line 149 of file tony.h.

◆ _cTableCred

int16 Tony::TonyEngine::_cTableCred[256]

Definition at line 117 of file tony.h.

◆ _cTableDialog

int16 Tony::TonyEngine::_cTableDialog[256]

Definition at line 113 of file tony.h.

◆ _cTableMacc

int16 Tony::TonyEngine::_cTableMacc[256]

Definition at line 115 of file tony.h.

◆ _cTableObj

int16 Tony::TonyEngine::_cTableObj[256]

Definition at line 119 of file tony.h.

◆ _curThumbnail

uint16* Tony::TonyEngine::_curThumbnail

Definition at line 139 of file tony.h.

◆ _funcList

LPCUSTOMFUNCTION Tony::TonyEngine::_funcList[300]

Definition at line 101 of file tony.h.

◆ _funcListStrings

Common::String Tony::TonyEngine::_funcListStrings[300]

Definition at line 102 of file tony.h.

◆ _gameDescription

const TonyGameDescription* Tony::TonyEngine::_gameDescription

Definition at line 155 of file tony.h.

◆ _globals

Globals Tony::TonyEngine::_globals

Definition at line 111 of file tony.h.

◆ _hEndOfFrame

uint32 Tony::TonyEngine::_hEndOfFrame

Definition at line 105 of file tony.h.

◆ _initialLoadSlotNumber

int Tony::TonyEngine::_initialLoadSlotNumber

Definition at line 140 of file tony.h.

◆ _loadSlotNumber

int Tony::TonyEngine::_loadSlotNumber

Definition at line 141 of file tony.h.

◆ _lTableCred

int16 Tony::TonyEngine::_lTableCred[256]

Definition at line 118 of file tony.h.

◆ _lTableDialog

int16 Tony::TonyEngine::_lTableDialog[256]

Definition at line 114 of file tony.h.

◆ _lTableMacc

int16 Tony::TonyEngine::_lTableMacc[256]

Definition at line 116 of file tony.h.

◆ _lTableObj

int16 Tony::TonyEngine::_lTableObj[256]

Definition at line 120 of file tony.h.

◆ _nTimeFreezed

int Tony::TonyEngine::_nTimeFreezed

Definition at line 150 of file tony.h.

◆ _randomSource

Common::RandomSource Tony::TonyEngine::_randomSource

Definition at line 103 of file tony.h.

◆ _resUpdate

RMResUpdate Tony::TonyEngine::_resUpdate

Definition at line 104 of file tony.h.

◆ _sfx

FPSfx* Tony::TonyEngine::_sfx[MAX_SFX_CHANNELS]

Definition at line 134 of file tony.h.

◆ _startTime

int Tony::TonyEngine::_startTime

Definition at line 138 of file tony.h.

◆ _stream

FPStream* Tony::TonyEngine::_stream[6]

Definition at line 133 of file tony.h.

◆ _theBoxes

RMGameBoxes Tony::TonyEngine::_theBoxes

Definition at line 144 of file tony.h.

◆ _theEngine

RMGfxEngine Tony::TonyEngine::_theEngine

Definition at line 146 of file tony.h.

◆ _theSound

FPSound Tony::TonyEngine::_theSound

Definition at line 109 of file tony.h.

◆ _utilSfx

FPSfx* Tony::TonyEngine::_utilSfx[MAX_SFX_CHANNELS]

Definition at line 135 of file tony.h.

◆ _vdbCodec

SoundCodecs Tony::TonyEngine::_vdbCodec

Definition at line 107 of file tony.h.

◆ _vdbFP

Common::File Tony::TonyEngine::_vdbFP

Definition at line 106 of file tony.h.

◆ _voices

Common::Array<VoiceHeader> Tony::TonyEngine::_voices

Definition at line 108 of file tony.h.

◆ _window

RMWindow Tony::TonyEngine::_window

Definition at line 145 of file tony.h.

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