ScummVM
Sword1::SwordEngine Class Reference

#include <sword1.h>

+ Inheritance diagram for Sword1::SwordEngine:
+ Collaboration diagram for Sword1::SwordEngine:

Public Member Functions

 SwordEngine (OSystem *syst)
 
 ~SwordEngine () override
 
void reinitialize ()
 
bool mouseIsActive ()
 
- 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 bool isMac ()
 
static bool isPsx ()
 
static bool isWindows ()
 
- 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

uint32 _features
 
- Public Attributes inherited from Engine
OSystem_system
 
Audio::Mixer_mixer
 

Static Public Attributes

static SystemVars _systemVars
 

Protected Member Functions

Common::Error init ()
 
Common::Error go ()
 
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...
 
Common::Error loadGameState (int slot) override
 Load a game state. More...
 
bool canLoadGameStateCurrently () override
 Indicates whether a game state can be loaded. More...
 
Common::Error saveGameState (int slot, const Common::String &desc, bool isAutosave=false) override
 Save a game state. More...
 
bool canSaveGameStateCurrently () override
 Indicates whether a game state can be saved. More...
 
virtual Common::String getSaveStateName (int slot) const override
 Generates the savegame filename. 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

void delay (int32 amount)
 
void checkCdFiles ()
 
void checkCd ()
 
void showFileErrorMsg (uint8 type, bool *fileExists)
 
void flagsToBool (bool *dest, uint8 flags)
 
void reinitRes ()
 
uint8 mainLoop ()
 

Private Attributes

Common::Point _mouseCoord
 
uint16 _mouseState
 
Common::KeyState _keyPressed
 
ResMan_resMan
 
ObjectMan_objectMan
 
Screen_screen
 
Mouse_mouse
 
Logic_logic
 
Sound_sound
 
Menu_menu
 
Music_music
 
Control_control
 

Static Private Attributes

static const uint8 _cdList [TOTAL_SECTIONS]
 
static const CdFile _pcCdFileList []
 
static const CdFile _macCdFileList []
 
static const CdFile _psxCdFileList []
 

Friends

class SwordConsole
 

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...
 
- 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 81 of file sword1.h.

Constructor & Destructor Documentation

◆ SwordEngine()

Sword1::SwordEngine::SwordEngine ( OSystem syst)

Definition at line 47 of file sword1.cpp.

◆ ~SwordEngine()

Sword1::SwordEngine::~SwordEngine ( )
override

Definition at line 82 of file sword1.cpp.

Member Function Documentation

◆ canLoadGameStateCurrently()

bool Sword1::SwordEngine::canLoadGameStateCurrently ( )
overrideprotectedvirtual

Indicates whether a game state can be loaded.

Reimplemented from Engine.

Definition at line 365 of file detection.cpp.

◆ canSaveGameStateCurrently()

bool Sword1::SwordEngine::canSaveGameStateCurrently ( )
overrideprotectedvirtual

Indicates whether a game state can be saved.

Reimplemented from Engine.

Definition at line 375 of file detection.cpp.

◆ checkCd()

void Sword1::SwordEngine::checkCd ( )
private

Definition at line 621 of file sword1.cpp.

◆ checkCdFiles()

void Sword1::SwordEngine::checkCdFiles ( )
private

Definition at line 440 of file sword1.cpp.

◆ delay()

void Sword1::SwordEngine::delay ( int32  amount)
private

Definition at line 715 of file sword1.cpp.

◆ flagsToBool()

void Sword1::SwordEngine::flagsToBool ( bool *  dest,
uint8  flags 
)
private

Definition at line 245 of file sword1.cpp.

◆ getSaveStateName()

virtual Common::String Sword1::SwordEngine::getSaveStateName ( int  slot) const
inlineoverrideprotectedvirtual

Generates the savegame filename.

Reimplemented from Engine.

Definition at line 115 of file sword1.h.

◆ go()

Common::Error Sword1::SwordEngine::go ( )
protected

Definition at line 576 of file sword1.cpp.

◆ hasFeature()

bool Sword1::SwordEngine::hasFeature ( EngineFeature  f) const
overrideprotectedvirtual

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

Definition at line 116 of file detection.cpp.

◆ init()

Common::Error Sword1::SwordEngine::init ( void  )
protected

Definition at line 94 of file sword1.cpp.

◆ isMac()

static bool Sword1::SwordEngine::isMac ( )
inlinestatic

Definition at line 93 of file sword1.h.

◆ isPsx()

static bool Sword1::SwordEngine::isPsx ( )
inlinestatic

Definition at line 94 of file sword1.h.

◆ isWindows()

static bool Sword1::SwordEngine::isWindows ( )
inlinestatic

Definition at line 95 of file sword1.h.

◆ loadGameState()

Common::Error Sword1::SwordEngine::loadGameState ( int  slot)
overrideprotectedvirtual

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 355 of file detection.cpp.

◆ mainLoop()

uint8 Sword1::SwordEngine::mainLoop ( )
private

Definition at line 643 of file sword1.cpp.

◆ mouseIsActive()

bool Sword1::SwordEngine::mouseIsActive ( )

Definition at line 758 of file sword1.cpp.

◆ reinitialize()

void Sword1::SwordEngine::reinitialize ( )

Definition at line 171 of file sword1.cpp.

◆ reinitRes()

void Sword1::SwordEngine::reinitRes ( )
private

Definition at line 763 of file sword1.cpp.

◆ run()

Common::Error Sword1::SwordEngine::run ( )
inlineoverrideprotectedvirtual

Init the engine and start its main loop.

Returns
returns kNoError on success, else an error code.

Implements Engine.

Definition at line 101 of file sword1.h.

◆ saveGameState()

Common::Error Sword1::SwordEngine::saveGameState ( int  slot,
const Common::String desc,
bool  isAutosave = false 
)
overrideprotectedvirtual

Save a game state.

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

Reimplemented from Engine.

Definition at line 369 of file detection.cpp.

◆ showFileErrorMsg()

void Sword1::SwordEngine::showFileErrorMsg ( uint8  type,
bool *  fileExists 
)
private

Definition at line 364 of file sword1.cpp.

◆ syncSoundSettings()

void Sword1::SwordEngine::syncSoundSettings ( )
overrideprotectedvirtual

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 182 of file sword1.cpp.

Friends And Related Function Documentation

◆ SwordConsole

friend class SwordConsole
friend

Definition at line 82 of file sword1.h.

Member Data Documentation

◆ _cdList

const uint8 Sword1::SwordEngine::_cdList
staticprivate

Definition at line 143 of file sword1.h.

◆ _control

Control* Sword1::SwordEngine::_control
private

Definition at line 142 of file sword1.h.

◆ _features

uint32 Sword1::SwordEngine::_features

Definition at line 89 of file sword1.h.

◆ _keyPressed

Common::KeyState Sword1::SwordEngine::_keyPressed
private

Definition at line 132 of file sword1.h.

◆ _logic

Logic* Sword1::SwordEngine::_logic
private

Definition at line 138 of file sword1.h.

◆ _macCdFileList

const CdFile Sword1::SwordEngine::_macCdFileList
staticprivate

Definition at line 145 of file sword1.h.

◆ _menu

Menu* Sword1::SwordEngine::_menu
private

Definition at line 140 of file sword1.h.

◆ _mouse

Mouse* Sword1::SwordEngine::_mouse
private

Definition at line 137 of file sword1.h.

◆ _mouseCoord

Common::Point Sword1::SwordEngine::_mouseCoord
private

Definition at line 130 of file sword1.h.

◆ _mouseState

uint16 Sword1::SwordEngine::_mouseState
private

Definition at line 131 of file sword1.h.

◆ _music

Music* Sword1::SwordEngine::_music
private

Definition at line 141 of file sword1.h.

◆ _objectMan

ObjectMan* Sword1::SwordEngine::_objectMan
private

Definition at line 135 of file sword1.h.

◆ _pcCdFileList

const CdFile Sword1::SwordEngine::_pcCdFileList
staticprivate

Definition at line 144 of file sword1.h.

◆ _psxCdFileList

const CdFile Sword1::SwordEngine::_psxCdFileList
staticprivate
Initial value:
= {
{ "paris2.clu", FLAG_CD1 },
{ "ireland.clu", FLAG_CD1 },
{ "paris3.clu", FLAG_CD1 },
{ "paris4.clu", FLAG_CD1 },
{ "scotland.clu", FLAG_CD1 },
{ "spain.clu", FLAG_CD1 },
{ "syria.clu", FLAG_CD1 },
{ "train.clu", FLAG_CD1 },
{ "train.plx", FLAG_CD1 },
{ "compacts.clu", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED },
{ "general.clu", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED },
{ "maps.clu", FLAG_CD1 | FLAG_DEMO },
{ "paris1.clu", FLAG_CD1 | FLAG_DEMO},
{ "scripts.clu", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED },
{ "swordres.rif", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED },
{ "text.clu", FLAG_CD1 | FLAG_DEMO },
{ "speech.dat", FLAG_SPEECH1 | FLAG_DEMO },
{ "speech.tab", FLAG_SPEECH1 | FLAG_DEMO },
{ "speech.inf", FLAG_SPEECH1 | FLAG_DEMO },
{ "speech.lis", FLAG_SPEECH1 | FLAG_DEMO }
}

Definition at line 146 of file sword1.h.

◆ _resMan

ResMan* Sword1::SwordEngine::_resMan
private

Definition at line 134 of file sword1.h.

◆ _screen

Screen* Sword1::SwordEngine::_screen
private

Definition at line 136 of file sword1.h.

◆ _sound

Sound* Sword1::SwordEngine::_sound
private

Definition at line 139 of file sword1.h.

◆ _systemVars

SystemVars Sword1::SwordEngine::_systemVars
static

Definition at line 86 of file sword1.h.


The documentation for this class was generated from the following files:
Sword1::FLAG_SPEECH1
Definition: sworddefs.h:151
Sword1::FLAG_DEMO
Definition: sworddefs.h:149
Sword1::FLAG_CD1
Definition: sworddefs.h:147
Sword1::FLAG_IMMED
Definition: sworddefs.h:150