ScummVM
Saga::SagaEngine Class Reference

#include <saga.h>

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

Public Member Functions

virtual Common::Error run ()
 Init the engine and start its main loop. More...
 
bool hasFeature (EngineFeature f) const
 Determine whether the engine supports the specified feature. More...
 
void 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. More...
 
void pauseEngineIntern (bool pause)
 Actual implementation of pauseEngine by subclasses. More...
 
GUI::DebuggergetDebugger ()
 Return the engine's debugger instance, if any. More...
 
 SagaEngine (OSystem *syst, const SAGAGameDescription *gameDesc)
 
 ~SagaEngine ()
 
void save (const char *fileName, const char *saveName)
 
void load (const char *fileName)
 
uint32 getCurrentLoadVersion () const
 
void fillSaveList ()
 
char * calcSaveFileName (uint slotNumber)
 
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)
 Load a game state. More...
 
Common::Error saveGameState (int slot, const Common::String &desc)
 Save a game state. More...
 
bool canLoadGameStateCurrently ()
 Indicates whether a game state can be loaded. More...
 
bool canSaveGameStateCurrently ()
 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
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 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

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
 
SndRes_sndRes
 
Sound_sound
 
Music_music
 
Anim_anim
 
Render_render
 
IsoMap_isoMap
 
Gfx_gfx
 
Script_script
 
Actor_actor
 
Font_font
 
Sprite_sprite
 
Scene_scene
 
Interface_interface
 
Console_console
 
Events_events
 
PalAnim_palanim
 
Puzzle_puzzle
 
Resource_resource
 
Common::RandomSource _rnd
 
int32 _frameCount
 
- Public Attributes inherited from Engine
OSystem_system
 
Audio::Mixer_mixer
 

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
 

Friends

class Scene
 

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...
 
- Protected Member Functions inherited from Engine
virtual int runDialog (GUI::Dialog &dialog)
 
bool shouldPerformAutoSave (int lastSaveTime)
 Indicate whether an autosave should be performed. More...
 
- Protected Attributes inherited from Engine
Common::TimerManager_timer
 
Common::EventManager_eventMan
 
Common::SaveFileManager_saveFileMan
 
GUI::Dialog_mainMenuDialog
 
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 ( )
virtual

Indicates whether a game state can be loaded.

Reimplemented from Engine.

Definition at line 342 of file detection.cpp.

◆ canSaveGameStateCurrently()

bool Saga::SagaEngine::canSaveGameStateCurrently ( )
virtual

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

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

Definition at line 286 of file image.cpp.

◆ getCurrentLoadVersion()

uint32 Saga::SagaEngine::getCurrentLoadVersion ( ) const
inline

Definition at line 481 of file saga.h.

◆ getDebugger()

GUI::Debugger * Saga::SagaEngine::getDebugger ( )
virtual

Return the engine's debugger instance, if any.

Used by error() to invoke the debugger when a severe error is reported.

Reimplemented from Engine.

Definition at line 629 of file saga.cpp.

◆ getDisplayClip()

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

Definition at line 631 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 524 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)
inline

Definition at line 549 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
inline

Definition at line 563 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 462 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
inline

Definition at line 493 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 625 of file saga.cpp.

◆ getTextString()

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

Definition at line 492 of file saga.cpp.

◆ hasFeature()

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

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

Definition at line 152 of file detection.cpp.

◆ incrementMouseClickCount()

void Saga::SagaEngine::incrementMouseClickCount ( )
inline

Definition at line 567 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
inline

Definition at line 497 of file saga.h.

◆ isMacResources()

bool Saga::SagaEngine::isMacResources ( ) const

Definition at line 55 of file detection.cpp.

◆ isSaga2()

bool Saga::SagaEngine::isSaga2 ( ) const
inline

Definition at line 614 of file saga.h.

◆ isSaveListFull()

bool Saga::SagaEngine::isSaveListFull ( ) const
inline

Definition at line 490 of file saga.h.

◆ KnownColor2ColorId()

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

Definition at line 549 of file saga.cpp.

◆ leftMouseButtonPressed()

bool Saga::SagaEngine::leftMouseButtonPressed ( ) const
inline

Definition at line 575 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)
virtual

Load a game state.

Parameters
slotthe slot from which a savestate should be loaded
Returns
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 394 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
inline

Definition at line 583 of file saga.h.

◆ mousePos()

Point Saga::SagaEngine::mousePos ( ) const

Definition at line 156 of file input.cpp.

◆ pauseEngineIntern()

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

Actual implementation of pauseEngine by subclasses.

See there for details.

Reimplemented from Engine.

Definition at line 647 of file saga.cpp.

◆ processInput()

int Saga::SagaEngine::processInput ( )

Definition at line 38 of file input.cpp.

◆ resetMouseClickCount()

void Saga::SagaEngine::resetMouseClickCount ( )
inline

Definition at line 571 of file saga.h.

◆ rightMouseButtonPressed()

bool Saga::SagaEngine::rightMouseButtonPressed ( ) const
inline

Definition at line 579 of file saga.h.

◆ run()

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

Init the engine and start its main loop.

Returns
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 
)
virtual

Save a game state.

Parameters
slotthe slot into which the savestate should be stored
desca description for the savestate, entered by the user
Returns
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 621 of file saga.cpp.

◆ syncSoundSettings()

void Saga::SagaEngine::syncSoundSettings ( )
virtual

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

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

Reimplemented from Engine.

Definition at line 633 of file saga.cpp.

◆ ticksToMSec()

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

Definition at line 587 of file saga.h.

◆ unbankBGImage()

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

Definition at line 314 of file image.cpp.

Friends And Related Function Documentation

◆ Scene

friend class Scene
friend

Definition at line 465 of file saga.h.

Member Data Documentation

◆ _actor

Actor* Saga::SagaEngine::_actor

Definition at line 526 of file saga.h.

◆ _anim

Anim* Saga::SagaEngine::_anim

Definition at line 521 of file saga.h.

◆ _console

Console* Saga::SagaEngine::_console

Definition at line 531 of file saga.h.

◆ _copyProtection

bool Saga::SagaEngine::_copyProtection

Definition at line 513 of file saga.h.

◆ _displayClip

Common::Rect Saga::SagaEngine::_displayClip
private

Definition at line 604 of file saga.h.

◆ _ethicsPoints

int16 Saga::SagaEngine::_ethicsPoints[8]

Definition at line 502 of file saga.h.

◆ _events

Events* Saga::SagaEngine::_events

Definition at line 532 of file saga.h.

◆ _font

Font* Saga::SagaEngine::_font

Definition at line 527 of file saga.h.

◆ _frameCount

int32 Saga::SagaEngine::_frameCount

Definition at line 607 of file saga.h.

◆ _framesEsc

int16 Saga::SagaEngine::_framesEsc

Definition at line 499 of file saga.h.

◆ _gameDescription

const SAGAGameDescription* Saga::SagaEngine::_gameDescription
private

Definition at line 602 of file saga.h.

◆ _gameNumber

int Saga::SagaEngine::_gameNumber
private

Definition at line 601 of file saga.h.

◆ _gameTitle

Common::String Saga::SagaEngine::_gameTitle
private

Definition at line 603 of file saga.h.

◆ _gfx

Gfx* Saga::SagaEngine::_gfx

Definition at line 524 of file saga.h.

◆ _globalFlags

uint32 Saga::SagaEngine::_globalFlags

Definition at line 501 of file saga.h.

◆ _hasITESceneSubstitutes

bool Saga::SagaEngine::_hasITESceneSubstitutes

Definition at line 516 of file saga.h.

◆ _interface

Interface* Saga::SagaEngine::_interface

Definition at line 530 of file saga.h.

◆ _isIHNMDemo

bool Saga::SagaEngine::_isIHNMDemo

Definition at line 515 of file saga.h.

◆ _isoMap

IsoMap* Saga::SagaEngine::_isoMap

Definition at line 523 of file saga.h.

◆ _leftMouseButtonPressed

bool Saga::SagaEngine::_leftMouseButtonPressed
private

Definition at line 596 of file saga.h.

◆ _mouseClickCount

int Saga::SagaEngine::_mouseClickCount
private

Definition at line 598 of file saga.h.

◆ _music

Music* Saga::SagaEngine::_music

Definition at line 520 of file saga.h.

◆ _musicVolume

int Saga::SagaEngine::_musicVolume

Definition at line 506 of file saga.h.

◆ _musicWasPlaying

bool Saga::SagaEngine::_musicWasPlaying

Definition at line 514 of file saga.h.

◆ _palanim

PalAnim* Saga::SagaEngine::_palanim

Definition at line 533 of file saga.h.

◆ _previousTicks

uint32 Saga::SagaEngine::_previousTicks
private

Definition at line 545 of file saga.h.

◆ _puzzle

Puzzle* Saga::SagaEngine::_puzzle

Definition at line 534 of file saga.h.

◆ _readingSpeed

int Saga::SagaEngine::_readingSpeed

Definition at line 511 of file saga.h.

◆ _render

Render* Saga::SagaEngine::_render

Definition at line 522 of file saga.h.

◆ _resource

Resource* Saga::SagaEngine::_resource

Definition at line 535 of file saga.h.

◆ _rightMouseButtonPressed

bool Saga::SagaEngine::_rightMouseButtonPressed
private

Definition at line 597 of file saga.h.

◆ _rnd

Common::RandomSource Saga::SagaEngine::_rnd

Definition at line 539 of file saga.h.

◆ _saveFiles

SaveFileData Saga::SagaEngine::_saveFiles[MAX_SAVES]
private

Definition at line 593 of file saga.h.

◆ _saveFilesCount

uint Saga::SagaEngine::_saveFilesCount
private

Definition at line 592 of file saga.h.

◆ _saveHeader

SaveGameHeader Saga::SagaEngine::_saveHeader
private

Definition at line 594 of file saga.h.

◆ _scene

Scene* Saga::SagaEngine::_scene

Definition at line 529 of file saga.h.

◆ _script

Script* Saga::SagaEngine::_script

Definition at line 525 of file saga.h.

◆ _sndRes

SndRes* Saga::SagaEngine::_sndRes

Definition at line 518 of file saga.h.

◆ _sound

Sound* Saga::SagaEngine::_sound

Definition at line 519 of file saga.h.

◆ _soundVolume

int Saga::SagaEngine::_soundVolume

Definition at line 505 of file saga.h.

◆ _speechVolume

int Saga::SagaEngine::_speechVolume

Definition at line 507 of file saga.h.

◆ _spiritualBarometer

int Saga::SagaEngine::_spiritualBarometer

Definition at line 503 of file saga.h.

◆ _sprite

Sprite* Saga::SagaEngine::_sprite

Definition at line 528 of file saga.h.

◆ _subtitlesEnabled

bool Saga::SagaEngine::_subtitlesEnabled

Definition at line 508 of file saga.h.

◆ _voiceFilesExist

bool Saga::SagaEngine::_voiceFilesExist

Definition at line 510 of file saga.h.

◆ _voicesEnabled

bool Saga::SagaEngine::_voicesEnabled

Definition at line 509 of file saga.h.


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