ScummVM
ZVision::ZVision Class Reference

#include <zvision.h>

+ Inheritance diagram for ZVision::ZVision:
+ Collaboration diagram for ZVision::ZVision:

Public Member Functions

 ZVision (OSystem *syst, const ZVisionGameDescription *gameDesc)
 
 ~ZVision () override
 
Common::Error run () override
 Init the engine and start its main loop. More...
 
void pauseEngineIntern (bool pause) override
 Actual implementation of pauseEngine by subclasses. More...
 
ZVisionGameId getGameId () const
 
Common::Language getLanguage () const
 
uint32 getFeatures () const
 
ScriptManagergetScriptManager () const
 
RenderManagergetRenderManager () const
 
CursorManagergetCursorManager () const
 
SaveManagergetSaveManager () const
 
StringManagergetStringManager () const
 
SearchManagergetSearchManager () const
 
TextRenderergetTextRenderer () const
 
MidiManagergetMidiManager () const
 
MenuHandlergetMenuHandler () const
 
Common::RandomSourcegetRandomSource () const
 
int16 getKeyboardVelocity () const
 
int16 getMouseVelocity () const
 
uint8 getZvisionKey (Common::KeyCode scummKeyCode)
 
void startClock ()
 
void stopClock ()
 
void initScreen ()
 
void initHiresScreen ()
 
void playVideo (Video::VideoDecoder &videoDecoder, const Common::Rect &destRect=Common::Rect(0, 0, 0, 0), bool skippable=true, Subtitle *sub=NULL)
 Play a video until it is finished. More...
 
Video::VideoDecoderloadAnimation (const Common::String &fileName)
 
void setRenderDelay (uint)
 
bool canRender ()
 
void fpsTimer ()
 
int getFPS () const
 
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 loadSettings ()
 
void saveSettings ()
 
bool ifQuit ()
 
bool hasFeature (EngineFeature f) const override
 Determine whether the engine supports the specified feature. 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...
 
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...
 
- 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::String getSaveStateName (int slot) const
 Generates the savegame filename. 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 void fpsTimerCallback (void *refCon)
 
- 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::Rect _workingWindow
 A Rectangle centered inside the actual window. More...
 
const Graphics::PixelFormat _resourcePixelFormat
 
const Graphics::PixelFormat _screenPixelFormat
 
- Public Attributes inherited from Engine
OSystem_system
 
Audio::Mixer_mixer
 

Private Member Functions

void initialize ()
 
void initFonts ()
 
void parseStrFile (const Common::String fileName)
 
void processEvents ()
 Called every frame from ZVision::run() to process any events from EventMan. More...
 
void onMouseMove (const Common::Point &pos)
 
void registerDefaultSettings ()
 
void shortKeys (Common::Event)
 
void cheatCodes (uint8 key)
 
void pushKeyToCheatBuf (uint8 key)
 
bool checkCode (const char *code)
 
uint8 getBufferedKey (uint8 pos)
 
double getVobAmplification (Common::String fileName) const
 

Private Attributes

const ZVisionGameDescription_gameDescription
 
const int _desiredFrameTime
 
Common::RandomSource_rnd
 
ScriptManager_scriptManager
 
RenderManager_renderManager
 
CursorManager_cursorManager
 
StringManager_stringManager
 
SearchManager_searchManager
 
TextRenderer_textRenderer
 
MidiManager_midiManager
 
SaveManager_saveManager
 
MenuHandler_menu
 
Clock _clock
 
int _audioId
 
Common::Event _event
 
int _frameRenderDelay
 
int _renderedFrameCount
 
int _fps
 
int16 _mouseVelocity
 
int16 _keyboardVelocity
 
bool _doubleFPS
 
bool _videoIsPlaying
 
uint8 _cheatBuffer [KEYBUF_SIZE]
 

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 Member Functions inherited from Engine
virtual int runDialog (GUI::Dialog &dialog)
 
- 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 99 of file zvision.h.

Constructor & Destructor Documentation

◆ ZVision()

ZVision::ZVision::ZVision ( OSystem syst,
const ZVisionGameDescription gameDesc 
)

Definition at line 79 of file zvision.cpp.

◆ ~ZVision()

ZVision::ZVision::~ZVision ( )
override

Definition at line 110 of file zvision.cpp.

Member Function Documentation

◆ canLoadGameStateCurrently()

bool ZVision::ZVision::canLoadGameStateCurrently ( )
overridevirtual

Indicates whether a game state can be loaded.

Reimplemented from Engine.

Definition at line 114 of file detection.cpp.

◆ canRender()

bool ZVision::ZVision::canRender ( )

Definition at line 371 of file zvision.cpp.

◆ canSaveGameStateCurrently()

bool ZVision::ZVision::canSaveGameStateCurrently ( )
overridevirtual

Indicates whether a game state can be saved.

Reimplemented from Engine.

Definition at line 118 of file detection.cpp.

◆ cheatCodes()

void ZVision::ZVision::cheatCodes ( uint8  key)
private

Definition at line 96 of file events.cpp.

◆ checkCode()

bool ZVision::ZVision::checkCode ( const char *  code)
private

Definition at line 51 of file events.cpp.

◆ fpsTimer()

void ZVision::ZVision::fpsTimer ( )

Definition at line 385 of file zvision.cpp.

◆ fpsTimerCallback()

void ZVision::ZVision::fpsTimerCallback ( void *  refCon)
static

Definition at line 381 of file zvision.cpp.

◆ getBufferedKey()

uint8 ZVision::ZVision::getBufferedKey ( uint8  pos)
private

Definition at line 64 of file events.cpp.

◆ getCursorManager()

CursorManager* ZVision::ZVision::getCursorManager ( ) const
inline

Definition at line 166 of file zvision.h.

◆ getFeatures()

uint32 ZVision::ZVision::getFeatures ( ) const

Definition at line 51 of file detection.cpp.

◆ getFPS()

int ZVision::ZVision::getFPS ( ) const
inline

Definition at line 227 of file zvision.h.

◆ getGameId()

ZVisionGameId ZVision::ZVision::getGameId ( ) const

Definition at line 45 of file detection.cpp.

◆ getKeyboardVelocity()

int16 ZVision::ZVision::getKeyboardVelocity ( ) const
inline

Definition at line 191 of file zvision.h.

◆ getLanguage()

Common::Language ZVision::ZVision::getLanguage ( ) const

Definition at line 48 of file detection.cpp.

◆ getMenuHandler()

MenuHandler* ZVision::ZVision::getMenuHandler ( ) const
inline

Definition at line 184 of file zvision.h.

◆ getMidiManager()

MidiManager* ZVision::ZVision::getMidiManager ( ) const
inline

Definition at line 181 of file zvision.h.

◆ getMouseVelocity()

int16 ZVision::ZVision::getMouseVelocity ( ) const
inline

Definition at line 194 of file zvision.h.

◆ getRandomSource()

Common::RandomSource* ZVision::ZVision::getRandomSource ( ) const
inline

Definition at line 188 of file zvision.h.

◆ getRenderManager()

RenderManager* ZVision::ZVision::getRenderManager ( ) const
inline

Definition at line 163 of file zvision.h.

◆ getSaveManager()

SaveManager* ZVision::ZVision::getSaveManager ( ) const
inline

Definition at line 169 of file zvision.h.

◆ getScriptManager()

ScriptManager* ZVision::ZVision::getScriptManager ( ) const
inline

Definition at line 160 of file zvision.h.

◆ getSearchManager()

SearchManager* ZVision::ZVision::getSearchManager ( ) const
inline

Definition at line 175 of file zvision.h.

◆ getStringManager()

StringManager* ZVision::ZVision::getStringManager ( ) const
inline

Definition at line 172 of file zvision.h.

◆ getTextRenderer()

TextRenderer* ZVision::ZVision::getTextRenderer ( ) const
inline

Definition at line 178 of file zvision.h.

◆ getVobAmplification()

double ZVision::ZVision::getVobAmplification ( Common::String  fileName) const
private

Definition at line 149 of file video.cpp.

◆ getZvisionKey()

uint8 ZVision::ZVision::getZvisionKey ( Common::KeyCode  scummKeyCode)

Definition at line 389 of file events.cpp.

◆ hasFeature()

bool ZVision::ZVision::hasFeature ( EngineFeature  f) const
overridevirtual

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

Definition at line 98 of file detection.cpp.

◆ ifQuit()

bool ZVision::ZVision::ifQuit ( )

Definition at line 491 of file events.cpp.

◆ initFonts()

void ZVision::ZVision::initFonts ( )
private

◆ initHiresScreen()

void ZVision::ZVision::initHiresScreen ( )

Definition at line 403 of file zvision.cpp.

◆ initialize()

void ZVision::ZVision::initialize ( )
private

Definition at line 173 of file zvision.cpp.

◆ initScreen()

void ZVision::ZVision::initScreen ( )

Definition at line 390 of file zvision.cpp.

◆ loadAnimation()

Video::VideoDecoder * ZVision::ZVision::loadAnimation ( const Common::String fileName)

Definition at line 42 of file video.cpp.

◆ loadGameState()

Common::Error ZVision::ZVision::loadGameState ( int  slot)
overridevirtual

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

◆ loadSettings()

void ZVision::ZVision::loadSettings ( )

Definition at line 139 of file zvision.cpp.

◆ onMouseMove()

void ZVision::ZVision::onMouseMove ( const Common::Point pos)
private

Definition at line 284 of file events.cpp.

◆ parseStrFile()

void ZVision::ZVision::parseStrFile ( const Common::String  fileName)
private

◆ pauseEngineIntern()

void ZVision::ZVision::pauseEngineIntern ( bool  pause)
overridevirtual

Actual implementation of pauseEngine by subclasses.

See there for details.

Reimplemented from Engine.

Definition at line 357 of file zvision.cpp.

◆ playVideo()

void ZVision::ZVision::playVideo ( Video::VideoDecoder videoDecoder,
const Common::Rect destRect = Common::Rect(0, 0, 0, 0),
bool  skippable = true,
Subtitle sub = NULL 
)

Play a video until it is finished.

This is a blocking call. It will call _clock.stop() when the video starts and _clock.start() when the video finishes. It will also consume all events during video playback.

Parameters
videoDecoderThe video to play
destRectWhere to put the video. (In working window coords)
skippableIf true, the video can be skipped at any time using [Spacebar]

Definition at line 71 of file video.cpp.

◆ processEvents()

void ZVision::ZVision::processEvents ( )
private

Called every frame from ZVision::run() to process any events from EventMan.

Definition at line 191 of file events.cpp.

◆ pushKeyToCheatBuf()

void ZVision::ZVision::pushKeyToCheatBuf ( uint8  key)
private

Definition at line 44 of file events.cpp.

◆ registerDefaultSettings()

void ZVision::ZVision::registerDefaultSettings ( )
private

Definition at line 128 of file zvision.cpp.

◆ run()

Common::Error ZVision::ZVision::run ( )
overridevirtual

Init the engine and start its main loop.

Returns
returns kNoError on success, else an error code.

Implements Engine.

Definition at line 244 of file zvision.cpp.

◆ saveGameState()

Common::Error ZVision::ZVision::saveGameState ( int  slot,
const Common::String desc,
bool  isAutosave = false 
)
overridevirtual

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

◆ saveSettings()

void ZVision::ZVision::saveSettings ( )

Definition at line 160 of file zvision.cpp.

◆ setRenderDelay()

void ZVision::ZVision::setRenderDelay ( uint  delay)

Definition at line 367 of file zvision.cpp.

◆ shortKeys()

void ZVision::ZVision::shortKeys ( Common::Event  event)
private

Definition at line 71 of file events.cpp.

◆ startClock()

void ZVision::ZVision::startClock ( )
inline

Definition at line 200 of file zvision.h.

◆ stopClock()

void ZVision::ZVision::stopClock ( )
inline

Definition at line 204 of file zvision.h.

◆ syncSoundSettings()

void ZVision::ZVision::syncSoundSettings ( )
overridevirtual

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 375 of file zvision.cpp.

Member Data Documentation

◆ _audioId

int ZVision::ZVision::_audioId
private

Definition at line 137 of file zvision.h.

◆ _cheatBuffer

uint8 ZVision::ZVision::_cheatBuffer[KEYBUF_SIZE]
private

Definition at line 150 of file zvision.h.

◆ _clock

Clock ZVision::ZVision::_clock
private

Definition at line 134 of file zvision.h.

◆ _cursorManager

CursorManager* ZVision::ZVision::_cursorManager
private

Definition at line 125 of file zvision.h.

◆ _desiredFrameTime

const int ZVision::ZVision::_desiredFrameTime
private

Definition at line 117 of file zvision.h.

◆ _doubleFPS

bool ZVision::ZVision::_doubleFPS
private

Definition at line 147 of file zvision.h.

◆ _event

Common::Event ZVision::ZVision::_event
private

Definition at line 140 of file zvision.h.

◆ _fps

int ZVision::ZVision::_fps
private

Definition at line 144 of file zvision.h.

◆ _frameRenderDelay

int ZVision::ZVision::_frameRenderDelay
private

Definition at line 142 of file zvision.h.

◆ _gameDescription

const ZVisionGameDescription* ZVision::ZVision::_gameDescription
private

Definition at line 115 of file zvision.h.

◆ _keyboardVelocity

int16 ZVision::ZVision::_keyboardVelocity
private

Definition at line 146 of file zvision.h.

◆ _menu

MenuHandler* ZVision::ZVision::_menu
private

Definition at line 131 of file zvision.h.

◆ _midiManager

MidiManager* ZVision::ZVision::_midiManager
private

Definition at line 129 of file zvision.h.

◆ _mouseVelocity

int16 ZVision::ZVision::_mouseVelocity
private

Definition at line 145 of file zvision.h.

◆ _renderedFrameCount

int ZVision::ZVision::_renderedFrameCount
private

Definition at line 143 of file zvision.h.

◆ _renderManager

RenderManager* ZVision::ZVision::_renderManager
private

Definition at line 124 of file zvision.h.

◆ _resourcePixelFormat

const Graphics::PixelFormat ZVision::ZVision::_resourcePixelFormat

Definition at line 111 of file zvision.h.

◆ _rnd

Common::RandomSource* ZVision::ZVision::_rnd
private

Definition at line 120 of file zvision.h.

◆ _saveManager

SaveManager* ZVision::ZVision::_saveManager
private

Definition at line 130 of file zvision.h.

◆ _screenPixelFormat

const Graphics::PixelFormat ZVision::ZVision::_screenPixelFormat

Definition at line 112 of file zvision.h.

◆ _scriptManager

ScriptManager* ZVision::ZVision::_scriptManager
private

Definition at line 123 of file zvision.h.

◆ _searchManager

SearchManager* ZVision::ZVision::_searchManager
private

Definition at line 127 of file zvision.h.

◆ _stringManager

StringManager* ZVision::ZVision::_stringManager
private

Definition at line 126 of file zvision.h.

◆ _textRenderer

TextRenderer* ZVision::ZVision::_textRenderer
private

Definition at line 128 of file zvision.h.

◆ _videoIsPlaying

bool ZVision::ZVision::_videoIsPlaying
private

Definition at line 148 of file zvision.h.

◆ _workingWindow

Common::Rect ZVision::ZVision::_workingWindow

A Rectangle centered inside the actual window.

All in-game coordinates are given in this coordinate space. Also, all images are clipped to the edges of this Rectangle

Definition at line 110 of file zvision.h.


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