Saga::SagaEngine Class Reference

#include <saga.h>

+ Inheritance diagram for Saga::SagaEngine:
+ Collaboration diagram for Saga::SagaEngine:

Public Member Functions

Common::Error run () override
 Init the engine and start its main loop. More...
bool hasFeature (EngineFeature f) const override
 Determine whether the engine supports the specified feature. More...
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 pauseEngineIntern (bool pause) override
 Actual implementation of pauseEngine by subclasses. More...
 SagaEngine (OSystem *syst, const SAGAGameDescription *gameDesc)
 ~SagaEngine () override
void save (const char *fileName, const char *saveName)
void load (const char *fileName)
uint32 getCurrentLoadVersion () const
void fillSaveList ()
char * calcSaveFileName (uint slotNumber)
virtual Common::String getSaveStateName (int slot) const override
 Generates the savegame filename. More...
SaveFileDatagetSaveFile (uint idx)
uint getNewSaveSlotNumber () const
bool locateSaveFile (char *saveName, uint &titleNumber)
bool isSaveListFull () const
uint getSaveFilesCount () const
bool isIHNMDemo () const
bool decodeBGImage (const ByteArray &imageData, ByteArray &outputBuffer, int *w, int *h, bool flip=false)
const bytegetImagePal (const ByteArray &imageData)
void loadStrings (StringsTable &stringsTable, const ByteArray &stringsData)
const char * getObjectName (uint16 objectId) const
int processInput ()
Point mousePos () const
int getMouseClickCount () const
void incrementMouseClickCount ()
void resetMouseClickCount ()
bool leftMouseButtonPressed () const
bool rightMouseButtonPressed () const
bool mouseButtonPressed () const
int ticksToMSec (int tick) const
bool initGame ()
bool isBigEndian () const
bool isMacResources () const
bool isSaga2 () const
const GameResourceDescriptiongetResourceDescription () const
const GameFontDescriptiongetFontDescription (int index) const
int getFontsCount () const
int getGameId () const
uint32 getFeatures () const
Common::Language getLanguage () const
Common::Platform getPlatform () const
int getGameNumber () const
int getStartSceneNumber () const
const GamePatchDescriptiongetPatchDescriptions () const
const ADGameFileDescriptiongetFilesDescriptions () const
const Common::RectgetDisplayClip () const
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...
bool canLoadGameStateCurrently () override
 Indicates whether a game state can be loaded. More...
bool canSaveGameStateCurrently () override
 Indicates whether a game state can be saved. More...
const GameDisplayInfogetDisplayInfo ()
const char * getTextString (int textStringId)
void getExcuseInfo (int verb, const char *&textString, int &soundResourceId)
ColorId KnownColor2ColorId (KnownColor knownColor)
void setTalkspeed (int talkspeed)
int getTalkspeed () const
- 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)

Public Attributes

int16 _framesEsc
uint32 _globalFlags
int16 _ethicsPoints [8]
int _spiritualBarometer
int _soundVolume
int _musicVolume
int _speechVolume
bool _subtitlesEnabled
bool _voicesEnabled
bool _voiceFilesExist
int _readingSpeed
bool _copyProtection
bool _musicWasPlaying
bool _isIHNMDemo
bool _hasITESceneSubstitutes
Common::RandomSource _rnd
int32 _frameCount
- Public Attributes inherited from Engine

Private Member Functions

bool decodeBGImageRLE (const byte *inbuf, size_t inbuf_len, ByteArray &outbuf)
void flipImage (byte *imageBuffer, int columns, int scanlines)
void unbankBGImage (byte *dest_buf, const byte *src_buf, int columns, int scanlines)

Private Attributes

uint32 _previousTicks
uint _saveFilesCount
SaveFileData _saveFiles [MAX_SAVES]
SaveGameHeader _saveHeader
bool _leftMouseButtonPressed
bool _rightMouseButtonPressed
int _mouseClickCount
int _gameNumber
const SAGAGameDescription_gameDescription
Common::String _gameTitle
Common::Rect _displayClip


class Scene

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...
- Protected Member Functions inherited from Engine
virtual int runDialog (GUI::Dialog &dialog)
- Protected Attributes inherited from Engine
const Common::String _targetName

Detailed Description

Definition at line 464 of file saga.h.

Constructor & Destructor Documentation

◆ SagaEngine()

Saga::SagaEngine::SagaEngine ( OSystem syst,
const SAGAGameDescription gameDesc 

Definition at line 57 of file saga.cpp.

◆ ~SagaEngine()

Saga::SagaEngine::~SagaEngine ( )

Definition at line 139 of file saga.cpp.

Member Function Documentation

◆ calcSaveFileName()

char * Saga::SagaEngine::calcSaveFileName ( uint  slotNumber)

Definition at line 45 of file saveload.cpp.

◆ canLoadGameStateCurrently()

bool Saga::SagaEngine::canLoadGameStateCurrently ( )

Indicates whether a game state can be loaded.

Reimplemented from Engine.

Definition at line 342 of file detection.cpp.

◆ canSaveGameStateCurrently()

bool Saga::SagaEngine::canSaveGameStateCurrently ( )

Indicates whether a game state can be saved.

Reimplemented from Engine.

Definition at line 347 of file detection.cpp.

◆ decodeBGImage()

bool Saga::SagaEngine::decodeBGImage ( const ByteArray imageData,
ByteArray outputBuffer,
int *  w,
int *  h,
bool  flip = false 

Definition at line 47 of file image.cpp.

◆ decodeBGImageRLE()

bool Saga::SagaEngine::decodeBGImageRLE ( const byte inbuf,
size_t  inbuf_len,
ByteArray outbuf 

Definition at line 92 of file image.cpp.

◆ fillSaveList()

void Saga::SagaEngine::fillSaveList ( )

Definition at line 112 of file saveload.cpp.

◆ flipImage()

void Saga::SagaEngine::flipImage ( byte imageBuffer,
int  columns,
int  scanlines 

Definition at line 286 of file image.cpp.

◆ getCurrentLoadVersion()

uint32 Saga::SagaEngine::getCurrentLoadVersion ( ) const

Definition at line 479 of file saga.h.

◆ getDisplayClip()

const Common::Rect& Saga::SagaEngine::getDisplayClip ( ) const

Definition at line 632 of file saga.h.

◆ getDisplayInfo()

const GameDisplayInfo & Saga::SagaEngine::getDisplayInfo ( )

Definition at line 297 of file detection.cpp.

◆ getExcuseInfo()

void Saga::SagaEngine::getExcuseInfo ( int  verb,
const char *&  textString,
int &  soundResourceId 

Definition at line 527 of file saga.cpp.

◆ getFeatures()

uint32 Saga::SagaEngine::getFeatures ( ) const

Definition at line 66 of file detection.cpp.

◆ getFilesDescriptions()

const ADGameFileDescription * Saga::SagaEngine::getFilesDescriptions ( ) const

Definition at line 78 of file detection.cpp.

◆ getFontDescription()

const GameFontDescription * Saga::SagaEngine::getFontDescription ( int  index) const

Definition at line 58 of file detection.cpp.

◆ getFontsCount()

int Saga::SagaEngine::getFontsCount ( ) const

Definition at line 62 of file detection.cpp.

◆ getGameId()

int Saga::SagaEngine::getGameId ( ) const

Definition at line 64 of file detection.cpp.

◆ getGameNumber()

int Saga::SagaEngine::getGameNumber ( ) const

Definition at line 74 of file detection.cpp.

◆ getImagePal()

const byte* Saga::SagaEngine::getImagePal ( const ByteArray imageData)

Definition at line 550 of file saga.h.

◆ getLanguage()

Common::Language Saga::SagaEngine::getLanguage ( ) const

Definition at line 72 of file detection.cpp.

◆ getMouseClickCount()

int Saga::SagaEngine::getMouseClickCount ( ) const

Definition at line 564 of file saga.h.

◆ getNewSaveSlotNumber()

uint Saga::SagaEngine::getNewSaveSlotNumber ( ) const

Definition at line 80 of file saveload.cpp.

◆ getObjectName()

const char * Saga::SagaEngine::getObjectName ( uint16  objectId) const

Definition at line 463 of file saga.cpp.

◆ getPatchDescriptions()

const GamePatchDescription * Saga::SagaEngine::getPatchDescriptions ( ) const

Definition at line 77 of file detection.cpp.

◆ getPlatform()

Common::Platform Saga::SagaEngine::getPlatform ( ) const

Definition at line 73 of file detection.cpp.

◆ getResourceDescription()

const GameResourceDescription * Saga::SagaEngine::getResourceDescription ( ) const

Definition at line 56 of file detection.cpp.

◆ getSaveFile()

SaveFileData * Saga::SagaEngine::getSaveFile ( uint  idx)

Definition at line 51 of file saveload.cpp.

◆ getSaveFilesCount()

uint Saga::SagaEngine::getSaveFilesCount ( ) const

Definition at line 494 of file saga.h.

◆ getSaveStateName()

virtual Common::String Saga::SagaEngine::getSaveStateName ( int  slot) const

Generates the savegame filename.

Reimplemented from Engine.

Definition at line 484 of file saga.h.

◆ getStartSceneNumber()

int Saga::SagaEngine::getStartSceneNumber ( ) const

Definition at line 75 of file detection.cpp.

◆ getTalkspeed()

int Saga::SagaEngine::getTalkspeed ( ) const

Definition at line 628 of file saga.cpp.

◆ getTextString()

const char * Saga::SagaEngine::getTextString ( int  textStringId)

Definition at line 495 of file saga.cpp.

◆ hasFeature()

bool Saga::SagaEngine::hasFeature ( EngineFeature  f) const

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

Definition at line 152 of file detection.cpp.

◆ incrementMouseClickCount()

void Saga::SagaEngine::incrementMouseClickCount ( )

Definition at line 568 of file saga.h.

◆ initGame()

bool Saga::SagaEngine::initGame ( )

Definition at line 290 of file detection.cpp.

◆ isBigEndian()

bool Saga::SagaEngine::isBigEndian ( ) const

Definition at line 54 of file detection.cpp.

◆ isIHNMDemo()

bool Saga::SagaEngine::isIHNMDemo ( ) const

Definition at line 498 of file saga.h.

◆ isMacResources()

bool Saga::SagaEngine::isMacResources ( ) const

Definition at line 55 of file detection.cpp.

◆ isSaga2()

bool Saga::SagaEngine::isSaga2 ( ) const

Definition at line 615 of file saga.h.

◆ isSaveListFull()

bool Saga::SagaEngine::isSaveListFull ( ) const

Definition at line 491 of file saga.h.

◆ KnownColor2ColorId()

ColorId Saga::SagaEngine::KnownColor2ColorId ( KnownColor  knownColor)

Definition at line 552 of file saga.cpp.

◆ leftMouseButtonPressed()

bool Saga::SagaEngine::leftMouseButtonPressed ( ) const

Definition at line 576 of file saga.h.

◆ load()

void Saga::SagaEngine::load ( const char *  fileName)

Definition at line 259 of file saveload.cpp.

◆ loadGameState()

Common::Error Saga::SagaEngine::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 317 of file detection.cpp.

◆ loadStrings()

void Saga::SagaEngine::loadStrings ( StringsTable stringsTable,
const ByteArray stringsData 

Definition at line 395 of file saga.cpp.

◆ locateSaveFile()

bool Saga::SagaEngine::locateSaveFile ( char *  saveName,
uint titleNumber 

Definition at line 65 of file saveload.cpp.

◆ mouseButtonPressed()

bool Saga::SagaEngine::mouseButtonPressed ( ) const

Definition at line 584 of file saga.h.

◆ mousePos()

Point Saga::SagaEngine::mousePos ( ) const

Definition at line 147 of file input.cpp.

◆ pauseEngineIntern()

void Saga::SagaEngine::pauseEngineIntern ( bool  pause)

Actual implementation of pauseEngine by subclasses.

See there for details.

Reimplemented from Engine.

Definition at line 646 of file saga.cpp.

◆ processInput()

int Saga::SagaEngine::processInput ( )

Definition at line 38 of file input.cpp.

◆ resetMouseClickCount()

void Saga::SagaEngine::resetMouseClickCount ( )

Definition at line 572 of file saga.h.

◆ rightMouseButtonPressed()

bool Saga::SagaEngine::rightMouseButtonPressed ( ) const

Definition at line 580 of file saga.h.

◆ run()

Common::Error Saga::SagaEngine::run ( )

Init the engine and start its main loop.

returns kNoError on success, else an error code.

Implements Engine.

Definition at line 207 of file saga.cpp.

◆ save()

void Saga::SagaEngine::save ( const char *  fileName,
const char *  saveName 

Definition at line 165 of file saveload.cpp.

◆ saveGameState()

Common::Error Saga::SagaEngine::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 337 of file detection.cpp.

◆ setTalkspeed()

void Saga::SagaEngine::setTalkspeed ( int  talkspeed)

Definition at line 624 of file saga.cpp.

◆ syncSoundSettings()

void Saga::SagaEngine::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 632 of file saga.cpp.

◆ ticksToMSec()

int Saga::SagaEngine::ticksToMSec ( int  tick) const

Definition at line 588 of file saga.h.

◆ unbankBGImage()

void Saga::SagaEngine::unbankBGImage ( byte dest_buf,
const byte src_buf,
int  columns,
int  scanlines 

Definition at line 314 of file image.cpp.

Friends And Related Function Documentation

◆ Scene

friend class Scene

Definition at line 465 of file saga.h.

Member Data Documentation

◆ _actor

Actor* Saga::SagaEngine::_actor

Definition at line 527 of file saga.h.

◆ _anim

Anim* Saga::SagaEngine::_anim

Definition at line 522 of file saga.h.

◆ _console

Console* Saga::SagaEngine::_console

Definition at line 532 of file saga.h.

◆ _copyProtection

bool Saga::SagaEngine::_copyProtection

Definition at line 514 of file saga.h.

◆ _displayClip

Common::Rect Saga::SagaEngine::_displayClip

Definition at line 605 of file saga.h.

◆ _ethicsPoints

int16 Saga::SagaEngine::_ethicsPoints[8]

Definition at line 503 of file saga.h.

◆ _events

Events* Saga::SagaEngine::_events

Definition at line 533 of file saga.h.

◆ _font

Font* Saga::SagaEngine::_font

Definition at line 528 of file saga.h.

◆ _frameCount

int32 Saga::SagaEngine::_frameCount

Definition at line 608 of file saga.h.

◆ _framesEsc

int16 Saga::SagaEngine::_framesEsc

Definition at line 500 of file saga.h.

◆ _gameDescription

const SAGAGameDescription* Saga::SagaEngine::_gameDescription

Definition at line 603 of file saga.h.

◆ _gameNumber

int Saga::SagaEngine::_gameNumber

Definition at line 602 of file saga.h.

◆ _gameTitle

Common::String Saga::SagaEngine::_gameTitle

Definition at line 604 of file saga.h.

◆ _gfx

Gfx* Saga::SagaEngine::_gfx

Definition at line 525 of file saga.h.

◆ _globalFlags

uint32 Saga::SagaEngine::_globalFlags

Definition at line 502 of file saga.h.

◆ _hasITESceneSubstitutes

bool Saga::SagaEngine::_hasITESceneSubstitutes

Definition at line 517 of file saga.h.

◆ _interface

Interface* Saga::SagaEngine::_interface

Definition at line 531 of file saga.h.

◆ _isIHNMDemo

bool Saga::SagaEngine::_isIHNMDemo

Definition at line 516 of file saga.h.

◆ _isoMap

IsoMap* Saga::SagaEngine::_isoMap

Definition at line 524 of file saga.h.

◆ _leftMouseButtonPressed

bool Saga::SagaEngine::_leftMouseButtonPressed

Definition at line 597 of file saga.h.

◆ _mouseClickCount

int Saga::SagaEngine::_mouseClickCount

Definition at line 599 of file saga.h.

◆ _music

Music* Saga::SagaEngine::_music

Definition at line 521 of file saga.h.

◆ _musicVolume

int Saga::SagaEngine::_musicVolume

Definition at line 507 of file saga.h.

◆ _musicWasPlaying

bool Saga::SagaEngine::_musicWasPlaying

Definition at line 515 of file saga.h.

◆ _palanim

PalAnim* Saga::SagaEngine::_palanim

Definition at line 534 of file saga.h.

◆ _previousTicks

uint32 Saga::SagaEngine::_previousTicks

Definition at line 546 of file saga.h.

◆ _puzzle

Puzzle* Saga::SagaEngine::_puzzle

Definition at line 535 of file saga.h.

◆ _readingSpeed

int Saga::SagaEngine::_readingSpeed

Definition at line 512 of file saga.h.

◆ _render

Render* Saga::SagaEngine::_render

Definition at line 523 of file saga.h.

◆ _resource

Resource* Saga::SagaEngine::_resource

Definition at line 536 of file saga.h.

◆ _rightMouseButtonPressed

bool Saga::SagaEngine::_rightMouseButtonPressed

Definition at line 598 of file saga.h.

◆ _rnd

Common::RandomSource Saga::SagaEngine::_rnd

Definition at line 540 of file saga.h.

◆ _saveFiles

SaveFileData Saga::SagaEngine::_saveFiles[MAX_SAVES]

Definition at line 594 of file saga.h.

◆ _saveFilesCount

uint Saga::SagaEngine::_saveFilesCount

Definition at line 593 of file saga.h.

◆ _saveHeader

SaveGameHeader Saga::SagaEngine::_saveHeader

Definition at line 595 of file saga.h.

◆ _scene

Scene* Saga::SagaEngine::_scene

Definition at line 530 of file saga.h.

◆ _script

Script* Saga::SagaEngine::_script

Definition at line 526 of file saga.h.

◆ _sndRes

SndRes* Saga::SagaEngine::_sndRes

Definition at line 519 of file saga.h.

◆ _sound

Sound* Saga::SagaEngine::_sound

Definition at line 520 of file saga.h.

◆ _soundVolume

int Saga::SagaEngine::_soundVolume

Definition at line 506 of file saga.h.

◆ _speechVolume

int Saga::SagaEngine::_speechVolume

Definition at line 508 of file saga.h.

◆ _spiritualBarometer

int Saga::SagaEngine::_spiritualBarometer

Definition at line 504 of file saga.h.

◆ _sprite

Sprite* Saga::SagaEngine::_sprite

Definition at line 529 of file saga.h.

◆ _subtitlesEnabled

bool Saga::SagaEngine::_subtitlesEnabled

Definition at line 509 of file saga.h.

◆ _voiceFilesExist

bool Saga::SagaEngine::_voiceFilesExist

Definition at line 511 of file saga.h.

◆ _voicesEnabled

bool Saga::SagaEngine::_voicesEnabled

Definition at line 510 of file saga.h.

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