ScummVM API documentation
Kyra::KyraEngine_v1 Class Referenceabstract
Inheritance diagram for Kyra::KyraEngine_v1:
Engine Kyra::KyraEngine_LoK Kyra::KyraEngine_v2 Kyra::KyraEngine_HoF Kyra::KyraEngine_MR

Classes

struct  Event
 
struct  SaveHeader
 

Public Types

enum  kVolumeEntry { kVolumeMusic = 0, kVolumeSfx = 1, kVolumeSpeech = 2 }
 
- Public Types inherited from Engine
enum  EngineFeature {
  kSupportsSubtitleOptions, kSupportsReturnToLauncher, kSupportsLoadingDuringRuntime, kSupportsSavingDuringRuntime,
  kSupportsChangingOptionsDuringRuntime, kSupportsArbitraryResolutions, kSupportsHelp, kSupportsQuitDialogOverride
}
 

Public Member Functions

 KyraEngine_v1 (OSystem *system, const GameFlags &flags)
 
uint8 game () const
 
const GameFlagsgameFlags () const
 
Resourceresource ()
 
virtual Screenscreen ()=0
 
virtual TextDisplayertext ()
 
virtual GUIgui () const
 
Soundsound ()
 
StaticResourcestaticres ()
 
TimerManagertimer ()
 
uint32 tickLength () const
 
void setMousePos (int x, int y)
 
Common::Point getMousePos ()
 
bool speechEnabled ()
 
bool textEnabled ()
 
void setVolume (kVolumeEntry vol, uint8 value)
 
uint8 getVolume (kVolumeEntry vol)
 
void syncSoundSettings () override
 
int setGameFlag (int flag)
 
int queryGameFlag (int flag) const
 
int resetGameFlag (int flag)
 
virtual void snd_playTheme (int file, int track)
 
virtual void snd_playSoundEffect (int id, int volume=0xFF)
 
virtual void snd_playWanderScoreViaMap (int command, int restart)
 
virtual void snd_playVoiceFile (int id)=0
 
virtual bool snd_voiceIsPlaying ()
 
virtual void snd_stopVoice ()
 
virtual void delayUntil (uint32 timestamp, bool updateGameTimers=false, bool update=false, bool isMainLoop=false)
 
virtual void delay (uint32 millis, bool update=false, bool isMainLoop=false)
 
virtual void delayWithTicks (int ticks)
 
- Public Member Functions inherited from Engine
MetaEnginegetMetaEngine () const
 
void setMetaEngine (MetaEngine *metaEngine)
 
PauseToken pauseEngine ()
 
bool isPaused () const
 
void openMainMenuDialog ()
 
uint32 getTotalPlayTime () const
 
void setTotalPlayTime (uint32 time=0)
 
Common::TimerManagergetTimerManager ()
 
Common::EventManagergetEventManager ()
 
Common::SaveFileManagergetSaveFileManager ()
 
bool existExtractedCDAudioFiles (uint track=1)
 
bool isDataAndCDAudioReadFromSameCD ()
 
void warnMissingExtractedCDAudio ()
 
void handleAutoSave ()
 
void saveAutosaveIfEnabled ()
 
virtual bool canSaveAutosaveCurrently ()
 
 Engine (OSystem *syst)
 
virtual ~Engine ()
 
virtual void initializePath (const Common::FSNode &gamePath)
 
virtual void errorString (const char *buf_input, char *buf_output, int buf_output_size)
 
virtual GUI::DebuggergetDebugger () final
 
void setDebugger (GUI::Debugger *debugger)
 
GUI::DebuggergetOrCreateDebugger ()
 
virtual void applyGameSettings ()
 
virtual void flipMute ()
 
virtual Common::String getSaveStateName (int slot) const
 
virtual Common::Error loadGameStream (Common::SeekableReadStream *stream)
 
void setGameToLoadSlot (int slot)
 
virtual Common::Error saveGameStream (Common::WriteStream *stream, bool isAutosave=false)
 
bool saveGameDialog ()
 
bool loadGameDialog ()
 

Public Attributes

Common::RandomSource _rnd
 
- Public Attributes inherited from Engine
OSystem_system
 
Audio::Mixer_mixer
 

Protected Types

enum  ReadSaveHeaderError { kRSHENoError = 0, kRSHEInvalidType = 1, kRSHEInvalidVersion = 2, kRSHEIoError = 3 }
 
typedef Common::HashMap< Common::KeyCode, int16, KeyCodeHashKeyMap
 

Protected Member Functions

virtual Common::Error init ()
 
virtual Common::Error go ()=0
 
Common::Error run () override
 
bool hasFeature (EngineFeature f) const override
 
void pauseEngineIntern (bool pause) override
 
void setupKeyMap ()
 
void updateInput ()
 
int checkInput (Button *buttonList, bool mainLoop=false, int eventFlag=0x8000)
 
void removeInputTop ()
 
void transposeScreenOutputY (int yAdd)
 
virtual void registerDefaultSettings ()
 
virtual void readSettings ()
 
virtual void writeSettings ()
 
virtual bool skipFlag () const
 
virtual void resetSkipFlag (bool removeEvent=true)
 
virtual void setupTimers ()=0
 
virtual void setWalkspeed (uint8 speed)=0
 
virtual void setupOpcodeTable ()=0
 
int o1_queryGameFlag (EMCState *script)
 
int o1_setGameFlag (EMCState *script)
 
int o1_resetGameFlag (EMCState *script)
 
int o1_getRand (EMCState *script)
 
int o1_hideMouse (EMCState *script)
 
int o1_showMouse (EMCState *script)
 
int o1_setMousePos (EMCState *script)
 
int o1_setHandItem (EMCState *script)
 
int o1_removeHandItem (EMCState *script)
 
int o1_getMouseState (EMCState *script)
 
int o1_setDeathHandler (EMCState *script)
 
int o1_playWanderScoreViaMap (EMCState *script)
 
int o1_fillRect (EMCState *script)
 
int o1_blockInWalkableRegion (EMCState *script)
 
int o1_blockOutWalkableRegion (EMCState *script)
 
int o1_playSoundEffect (EMCState *script)
 
int16 emcSafeReadStack (EMCState *s, int x, int line, const char *file)
 
virtual void setHandItem (Item item)=0
 
virtual void removeHandItem ()=0
 
virtual int convertVolumeToMixer (int value)
 
virtual int convertVolumeFromMixer (int value)
 
virtual int findWay (int x, int y, int toX, int toY, int *moveTable, int moveTableSize)
 
int findSubPath (int x, int y, int toX, int toY, int *moveTable, int start, int end)
 
int getFacingFromPointToPoint (int x, int y, int toX, int toY)
 
int getOppositeFacingDirection (int dir)
 
void changePosTowardsFacing (int &x, int &y, int facing)
 
int getMoveTableSize (int *moveTable)
 
virtual bool lineIsPassable (int x, int y)=0
 
bool canLoadGameStateCurrently (Common::U32String *msg=nullptr) override
 
bool canSaveGameStateCurrently (Common::U32String *msg=nullptr) override
 
int getAutosaveSlot () const override
 
const char * getSavegameFilename (int num)
 
bool saveFileLoadable (int slot)
 
void loadGameStateCheck (int slot)
 
Common::Error loadGameState (int slot) override=0
 
Common::Error saveGameState (int slot, const Common::String &desc, bool isAutosave=false) override
 
virtual Common::Error saveGameStateIntern (int slot, const char *saveName, const Graphics::Surface *thumbnail)=0
 
Common::SeekableReadStreamopenSaveForReading (const char *filename, SaveHeader &header, bool checkID=true)
 
Common::OutSaveFileopenSaveForWriting (const char *filename, const char *saveName, const Graphics::Surface *thumbnail) const
 
virtual Graphics::SurfacegenerateSaveThumbnail () const
 
void updatePlayTimer ()
 
void restartPlayTimerAt (uint32 totalPlaySecs)
 
void pausePlayTimer (bool pause)
 
- Protected Member Functions inherited from Engine
virtual int runDialog (GUI::Dialog &dialog)
 
void defaultSyncSoundSettings ()
 

Static Protected Member Functions

static Common::String getSavegameFilename (const Common::String &target, int num)
 
static WARN_UNUSED_RESULT ReadSaveHeaderError readSaveHeader (Common::SeekableReadStream *file, SaveHeader &header, bool skipThumbnail=true)
 

Protected Attributes

Resource_res
 
Sound_sound
 
TextDisplayer_text
 
StaticResource_staticres
 
TimerManager_timer
 
EMCInterpreter_emc
 
int _mouseX
 
int _mouseY
 
int _transOffsY
 
Common::List< Event_eventList
 
KeyMap _keyMap
 
bool _asciiCodeEvents
 
bool _kbEventSkip
 
uint8 _configWalkspeed
 
int _configMusic
 
bool _configSounds
 
uint8 _configVoice
 
bool _configNullSound
 
Common::RenderMode _configRenderMode
 
uint16 _tickLength
 
uint16 _gameSpeed
 
int8 _deathHandler
 
GameFlags _flags
 
Common::Array< const Opcode * > _opcodes
 
int _mouseState
 
uint8 _flagsTable [100]
 
Audio::SoundHandle _speechHandle
 
int _curMusicTheme
 
int _curSfxFile
 
int16 _lastMusicCommand
 
const int8 * _trackMap
 
int _trackMapSize
 
bool _preventScriptSfx
 
int _gameToLoad
 
bool _isSaveAllowed
 
Common::String _savegameFilename
 
uint32 _lastSecTick
 
uint32 _lastSecTickAtPauseStart
 
uint32 _totalPlaySecs
 
- Protected Attributes inherited from Engine
Common::TimerManager_timer
 
Common::EventManager_eventMan
 
Common::SaveFileManager_saveFileMan
 
GUI::Dialog_mainMenuDialog
 
const Common::String _targetName
 

Static Protected Attributes

static const int8 _addXPosTable []
 
static const int8 _addYPosTable []
 
static const int8 _charAddXPosTable []
 
static const int8 _charAddYPosTable []
 

Additional Inherited Members

- Static Public Member Functions inherited from Engine
static void quitGame ()
 
static bool shouldQuit ()
 
static MetaEngineDetectiongetMetaEngineDetection ()
 
static bool warnUserAboutUnsupportedGame (Common::String msg=Common::String())
 
static void errorUnsupportedGame (Common::String extraMsg)
 

Member Function Documentation

◆ syncSoundSettings()

void Kyra::KyraEngine_v1::syncSoundSettings ( )
overridevirtual

Notify the engine that the sound settings in the config manager might have changed and that it should adjust any internal volume (and other) 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.

Reimplemented from Engine.

◆ run()

Common::Error Kyra::KyraEngine_v1::run ( )
inlineoverrideprotectedvirtual

Initialize the engine and start its main loop.

Returns
kNoError on success, otherwise an error code.

Implements Engine.

◆ hasFeature()

bool Kyra::KyraEngine_v1::hasFeature ( EngineFeature  f) const
overrideprotectedvirtual

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

◆ pauseEngineIntern()

void Kyra::KyraEngine_v1::pauseEngineIntern ( bool  pause)
overrideprotectedvirtual

Actual implementation of pauseEngine by subclasses.

See also
Engine::pauseEngine

Reimplemented from Engine.

◆ canLoadGameStateCurrently()

bool Kyra::KyraEngine_v1::canLoadGameStateCurrently ( Common::U32String msg = nullptr)
inlineoverrideprotectedvirtual

Indicate whether a game state can be loaded.

Parameters
msgOptional pointer to message explaining why it is disabled

Reimplemented from Engine.

◆ canSaveGameStateCurrently()

bool Kyra::KyraEngine_v1::canSaveGameStateCurrently ( Common::U32String msg = nullptr)
inlineoverrideprotectedvirtual

Indicate whether a game state can be saved.

Parameters
msgOptional pointer to message explaining why it is disabled

Reimplemented from Engine.

◆ getAutosaveSlot()

int Kyra::KyraEngine_v1::getAutosaveSlot ( ) const
inlineoverrideprotectedvirtual

Return the slot that should be used for autosaves, or -1 for engines that don't support autosave.

Note
This should match the meta engine getAutosaveSlot() method.

Reimplemented from Engine.

◆ loadGameState()

Common::Error Kyra::KyraEngine_v1::loadGameState ( int  slot)
overrideprotectedpure virtual

Load a game state.

Parameters
slotThe slot from which a save state should be loaded.
Returns
kNoError on success, otherwise an error code.

Reimplemented from Engine.

Implemented in Kyra::KyraEngine_HoF, and Kyra::KyraEngine_LoK.

◆ saveGameState()

Common::Error Kyra::KyraEngine_v1::saveGameState ( int  slot,
const Common::String desc,
bool  isAutosave = false 
)
inlineoverrideprotectedvirtual

Save a game state.

Parameters
slotThe slot into which the save state should be stored.
descDescription for the save state, entered by the user.
isAutosaveExpected to be true if an autosave is being created.
Returns
kNoError on success, otherwise an error code.

Reimplemented from Engine.


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