ScummVM
Tinsel::TinselEngine Class Reference

#include <tinsel.h>

+ Inheritance diagram for Tinsel::TinselEngine:
+ Collaboration diagram for Tinsel::TinselEngine:

Public Member Functions

 TinselEngine (OSystem *syst, const TinselGameDescription *gameDesc)
 
 ~TinselEngine () override
 
int getGameId ()
 
uint32 getGameID () const
 
uint32 getFeatures () const
 
Common::Language getLanguage () const
 
uint16 getVersion () const
 
Common::Platform getPlatform () const
 
bool getIsADGFDemo () const
 
bool isV1CD () const
 
const char * getSampleIndex (LANGUAGE lang)
 
const char * getSampleFile (LANGUAGE lang)
 
const char * getTextFile (LANGUAGE lang)
 
const Common::String getTargetName () const
 
Common::String getSavegameFilename (int16 saveNum) const
 
Common::SaveFileManagergetSaveFileMan ()
 
Graphics::Surfacescreen ()
 
Common::Point getMousePosition () const
 
void setMousePosition (Common::Point pt)
 
void divertKeyInput (KEYFPTR fptr)
 
int getRandomNumber (int maxNumber)
 
uint8 getKeyDirection () const
 
- Public Member Functions inherited from Engine
 Engine (OSystem *syst)
 
virtual ~Engine ()
 
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 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...
 
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)
 

Public Attributes

const TinselGameDescription_gameDescription
 
MidiDriver_driver
 
SoundManager_sound
 
MidiMusicPlayer_midiMusic
 
PCMMusicPlayer_pcmMusic
 
Music_music
 
BMVPlayer_bmv
 
Background_bg
 
Font_font
 
Config_config
 
KEYFPTR _keyHandler
 
Common::List< Common::EventType_mouseButtons
 Stack of pending mouse button events. More...
 
Common::List< Common::Event_keypresses
 Stack of pending keypresses. More...
 
RectList _clipRects
 List of all clip rectangles. More...
 
- Public Attributes inherited from Engine
OSystem_system
 
Audio::Mixer_mixer
 

Protected Member Functions

void initializePath (const Common::FSNode &gamePath) override
 Init SearchMan according to the game path. More...
 
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...
 
Common::Error loadGameState (int slot) override
 Load a game state. More...
 
Common::Error saveGameState (int slot, const Common::String &desc, bool isAutosave=false)
 Save a game state. More...
 
bool canLoadGameStateCurrently () override
 Indicates whether a game state can be loaded. More...
 
bool canSaveGameStateCurrently ()
 Indicates whether a game state can be saved. 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 NextGameCycle ()
 
void CreateConstProcesses ()
 Start the processes that continue between scenes. More...
 
void RestartGame ()
 Restart the game. More...
 
void RestartDrivers ()
 Init palette and object managers, scheduler, keyboard and mouse. More...
 
void ChopDrivers ()
 Remove keyboard, mouse and joystick drivers. More...
 
void ProcessKeyEvent (const Common::Event &event)
 Process a keyboard event. More...
 
bool pollEvent ()
 

Private Attributes

int _gameId
 
Common::KeyState _keyPressed
 
Common::RandomSource _random
 
Graphics::Surface _screenSurface
 
Common::Point _mousePos
 
uint8 _dosPlayerDir
 

Static Private Attributes

static const char *const _sampleIndices [][3]
 
static const char *const _sampleFiles [][3]
 
static const char *const _textFiles [][3]
 

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 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 150 of file tinsel.h.

Constructor & Destructor Documentation

◆ TinselEngine()

Tinsel::TinselEngine::TinselEngine ( OSystem syst,
const TinselGameDescription gameDesc 
)

Definition at line 816 of file tinsel.cpp.

◆ ~TinselEngine()

Tinsel::TinselEngine::~TinselEngine ( )
override

Definition at line 850 of file tinsel.cpp.

Member Function Documentation

◆ canLoadGameStateCurrently()

bool Tinsel::TinselEngine::canLoadGameStateCurrently ( )
overrideprotectedvirtual

Indicates whether a game state can be loaded.

Reimplemented from Engine.

Definition at line 453 of file detection.cpp.

◆ canSaveGameStateCurrently()

bool Tinsel::TinselEngine::canSaveGameStateCurrently ( )
protectedvirtual

Indicates whether a game state can be saved.

Reimplemented from Engine.

Definition at line 456 of file detection.cpp.

◆ ChopDrivers()

void Tinsel::TinselEngine::ChopDrivers ( )
private

Remove keyboard, mouse and joystick drivers.

Definition at line 1169 of file tinsel.cpp.

◆ CreateConstProcesses()

void Tinsel::TinselEngine::CreateConstProcesses ( )
private

Start the processes that continue between scenes.

Definition at line 1088 of file tinsel.cpp.

◆ divertKeyInput()

void Tinsel::TinselEngine::divertKeyInput ( KEYFPTR  fptr)
inline

Definition at line 245 of file tinsel.h.

◆ getFeatures()

uint32 Tinsel::TinselEngine::getFeatures ( ) const

Definition at line 50 of file detection.cpp.

◆ getGameId()

int Tinsel::TinselEngine::getGameId ( )
inline

Definition at line 180 of file tinsel.h.

◆ getGameID()

uint32 Tinsel::TinselEngine::getGameID ( ) const

Definition at line 46 of file detection.cpp.

◆ getIsADGFDemo()

bool Tinsel::TinselEngine::getIsADGFDemo ( ) const

Definition at line 66 of file detection.cpp.

◆ getKeyDirection()

uint8 Tinsel::TinselEngine::getKeyDirection ( ) const
inline

Definition at line 247 of file tinsel.h.

◆ getLanguage()

Common::Language Tinsel::TinselEngine::getLanguage ( ) const

Definition at line 54 of file detection.cpp.

◆ getMousePosition()

Common::Point Tinsel::TinselEngine::getMousePosition ( ) const
inline

Definition at line 235 of file tinsel.h.

◆ getPlatform()

Common::Platform Tinsel::TinselEngine::getPlatform ( ) const

Definition at line 58 of file detection.cpp.

◆ getRandomNumber()

int Tinsel::TinselEngine::getRandomNumber ( int  maxNumber)
inline

Definition at line 246 of file tinsel.h.

◆ getSampleFile()

const char * Tinsel::TinselEngine::getSampleFile ( LANGUAGE  lang)

Definition at line 1238 of file tinsel.cpp.

◆ getSampleIndex()

const char * Tinsel::TinselEngine::getSampleIndex ( LANGUAGE  lang)

Definition at line 1218 of file tinsel.cpp.

◆ getSaveFileMan()

Common::SaveFileManager* Tinsel::TinselEngine::getSaveFileMan ( )
inline

Definition at line 232 of file tinsel.h.

◆ getSavegameFilename()

Common::String Tinsel::TinselEngine::getSavegameFilename ( int16  saveNum) const

Definition at line 873 of file tinsel.cpp.

◆ getTargetName()

const Common::String Tinsel::TinselEngine::getTargetName ( ) const
inline

Definition at line 230 of file tinsel.h.

◆ getTextFile()

const char * Tinsel::TinselEngine::getTextFile ( LANGUAGE  lang)

Definition at line 1258 of file tinsel.cpp.

◆ getVersion()

uint16 Tinsel::TinselEngine::getVersion ( ) const

Definition at line 62 of file detection.cpp.

◆ hasFeature()

bool Tinsel::TinselEngine::hasFeature ( EngineFeature  f) const
overrideprotectedvirtual

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

Definition at line 122 of file detection.cpp.

◆ initializePath()

void Tinsel::TinselEngine::initializePath ( const Common::FSNode gamePath)
overrideprotectedvirtual

Init SearchMan according to the game path.

By default it adds the directory in non-flat mode with a depth of 4 as priority 0 to SearchMan.

Parameters
gamePathThe base directory of the game data.

Reimplemented from Engine.

Definition at line 877 of file tinsel.cpp.

◆ isV1CD()

bool Tinsel::TinselEngine::isV1CD ( ) const

Definition at line 70 of file detection.cpp.

◆ loadGameState()

Common::Error Tinsel::TinselEngine::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 399 of file detection.cpp.

◆ NextGameCycle()

void Tinsel::TinselEngine::NextGameCycle ( )
private

Definition at line 1021 of file tinsel.cpp.

◆ pollEvent()

bool Tinsel::TinselEngine::pollEvent ( )
private

Definition at line 1045 of file tinsel.cpp.

◆ ProcessKeyEvent()

void Tinsel::TinselEngine::ProcessKeyEvent ( const Common::Event event)
private

Process a keyboard event.

Definition at line 1183 of file tinsel.cpp.

◆ RestartDrivers()

void Tinsel::TinselEngine::RestartDrivers ( )
private

Init palette and object managers, scheduler, keyboard and mouse.

Definition at line 1136 of file tinsel.cpp.

◆ RestartGame()

void Tinsel::TinselEngine::RestartGame ( )
private

Restart the game.

Definition at line 1100 of file tinsel.cpp.

◆ run()

Common::Error Tinsel::TinselEngine::run ( )
overrideprotectedvirtual

Init the engine and start its main loop.

Returns
returns kNoError on success, else an error code.

Implements Engine.

Definition at line 891 of file tinsel.cpp.

◆ saveGameState()

Common::Error Tinsel::TinselEngine::saveGameState ( int  slot,
const Common::String desc,
bool  isAutosave = false 
)
protectedvirtual

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

◆ screen()

Graphics::Surface& Tinsel::TinselEngine::screen ( )
inline

Definition at line 233 of file tinsel.h.

◆ setMousePosition()

void Tinsel::TinselEngine::setMousePosition ( Common::Point  pt)
inline

Definition at line 236 of file tinsel.h.

Member Data Documentation

◆ _bg

Background* Tinsel::TinselEngine::_bg

Definition at line 203 of file tinsel.h.

◆ _bmv

BMVPlayer* Tinsel::TinselEngine::_bmv

Definition at line 202 of file tinsel.h.

◆ _clipRects

RectList Tinsel::TinselEngine::_clipRects

List of all clip rectangles.

Definition at line 218 of file tinsel.h.

◆ _config

Config* Tinsel::TinselEngine::_config

Definition at line 206 of file tinsel.h.

◆ _dosPlayerDir

uint8 Tinsel::TinselEngine::_dosPlayerDir
private

Definition at line 156 of file tinsel.h.

◆ _driver

MidiDriver* Tinsel::TinselEngine::_driver

Definition at line 197 of file tinsel.h.

◆ _font

Font* Tinsel::TinselEngine::_font

Definition at line 204 of file tinsel.h.

◆ _gameDescription

const TinselGameDescription* Tinsel::TinselEngine::_gameDescription

Definition at line 184 of file tinsel.h.

◆ _gameId

int Tinsel::TinselEngine::_gameId
private

Definition at line 151 of file tinsel.h.

◆ _keyHandler

KEYFPTR Tinsel::TinselEngine::_keyHandler

Definition at line 208 of file tinsel.h.

◆ _keyPressed

Common::KeyState Tinsel::TinselEngine::_keyPressed
private

Definition at line 152 of file tinsel.h.

◆ _keypresses

Common::List<Common::Event> Tinsel::TinselEngine::_keypresses

Stack of pending keypresses.

Definition at line 214 of file tinsel.h.

◆ _midiMusic

MidiMusicPlayer* Tinsel::TinselEngine::_midiMusic

Definition at line 199 of file tinsel.h.

◆ _mouseButtons

Common::List<Common::EventType> Tinsel::TinselEngine::_mouseButtons

Stack of pending mouse button events.

Definition at line 211 of file tinsel.h.

◆ _mousePos

Common::Point Tinsel::TinselEngine::_mousePos
private

Definition at line 155 of file tinsel.h.

◆ _music

Music* Tinsel::TinselEngine::_music

Definition at line 201 of file tinsel.h.

◆ _pcmMusic

PCMMusicPlayer* Tinsel::TinselEngine::_pcmMusic

Definition at line 200 of file tinsel.h.

◆ _random

Common::RandomSource Tinsel::TinselEngine::_random
private

Definition at line 153 of file tinsel.h.

◆ _sampleFiles

const char *const Tinsel::TinselEngine::_sampleFiles
staticprivate
Initial value:
= {
{ "english.smp", "english1.smp", "english2.smp" },
{ "french.smp", "french1.smp", "french2.smp" },
{ "german.smp", "german1.smp", "german2.smp" },
{ "english.smp", "english1.smp", "english2.smp" },
{ "english.smp", "english1.smp", "english2.smp" },
{ "english.smp", "english1.smp", "english2.smp" },
{ "english.smp", "english1.smp", "english2.smp" },
{ "english.smp", "english1.smp", "english2.smp" },
{ "us.smp", "us1.smp", "us2.smp" },
}

Definition at line 159 of file tinsel.h.

◆ _sampleIndices

const char *const Tinsel::TinselEngine::_sampleIndices
staticprivate
Initial value:
= {
{ "english.idx", "english1.idx", "english2.idx" },
{ "french.idx", "french1.idx", "french2.idx" },
{ "german.idx", "german1.idx", "german2.idx" },
{ "english.idx", "english1.idx", "english2.idx" },
{ "english.idx", "english1.idx", "english2.idx" },
{ "english.idx", "english1.idx", "english2.idx" },
{ "english.idx", "english1.idx", "english2.idx" },
{ "english.idx", "english1.idx", "english2.idx" },
{ "us.idx", "us1.idx", "us2.idx" }
}

Definition at line 158 of file tinsel.h.

◆ _screenSurface

Graphics::Surface Tinsel::TinselEngine::_screenSurface
private

Definition at line 154 of file tinsel.h.

◆ _sound

SoundManager* Tinsel::TinselEngine::_sound

Definition at line 198 of file tinsel.h.

◆ _textFiles

const char *const Tinsel::TinselEngine::_textFiles
staticprivate
Initial value:
= {
{ "english.txt", "english1.txt", "english2.txt" },
{ "french.txt", "french1.txt", "french2.txt" },
{ "german.txt", "german1.txt", "german2.txt" },
{ "italian.txt", "italian1.txt", "italian2.txt" },
{ "spanish.txt", "spanish1.txt", "spanish2.txt" },
{ "english.txt", "english1.txt", "english2.txt" },
{ "english.txt", "english1.txt", "english2.txt" },
{ "english.txt", "english1.txt", "english2.txt" },
{ "us.txt", "us1.txt", "us2.txt" }
}

Definition at line 160 of file tinsel.h.


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