ScummVM
Hugo::HugoEngine Class Reference

#include <hugo.h>

+ Inheritance diagram for Hugo::HugoEngine:
+ Collaboration diagram for Hugo::HugoEngine:

Public Member Functions

 HugoEngine (OSystem *syst, const HugoGameDescription *gd)
 
 ~HugoEngine () override
 
uint32 getFeatures () const
 
const char * getGameId () const
 
GameType getGameType () const
 
Common::Platform getPlatform () const
 
bool isPacked () const
 
bool canLoadGameStateCurrently () override
 Indicates whether a game state can be loaded. More...
 
bool canSaveGameStateCurrently () override
 Indicates whether a game state can be saved. More...
 
bool loadHugoDat ()
 Loads Hugo.dat file, which contains all the hardcoded data in the original executables. More...
 
int8 getTPS () const
 
void initGame (const HugoGameDescription *gd)
 
void initGamePart (const HugoGameDescription *gd)
 
void endGame ()
 Exit game, advertise trilogy, show copyright. More...
 
void gameOverMsg ()
 Print options for user when dead. More...
 
void initStatus ()
 Initialize the dynamic game status. More...
 
void readScreenFiles (const int screen)
 Read scenery, overlay files for given screen number. More...
 
void setNewScreen (const int screen)
 Set the new screen number into the hero object and any carried objects. More...
 
void shutdown ()
 
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...
 
StatusgetGameStatus ()
 
int getScore () const
 
void setScore (const int newScore)
 
void adjustScore (const int adjustment)
 
int getMaxScore () const
 
void setMaxScore (const int newScore)
 
Common::Error saveGameState (int slot, const Common::String &desc, bool isAutosave=false) override
 Save a game state. More...
 
Common::Error loadGameState (int slot) override
 Load a game state. More...
 
bool hasFeature (EngineFeature f) const override
 Determine whether the engine supports the specified feature. More...
 
const char * getCopyrightString () const
 
virtual Common::String getSaveStateName (int slot) const override
 Generates the savegame filename. More...
 
uint16 ** loadLongArray (Common::SeekableReadStream &in)
 
- 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 HugoEngineget ()
 
- 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

OSystem_system
 
byte _numVariant
 
byte _gameVariant
 
int8 _soundSilence
 
int8 _soundTest
 
int8 _tunesNbr
 
uint16 _numScreens
 
uint16 _numStates
 
int8 _normalTPS
 
Object_hero
 
byte_screenPtr
 
byte _heroImage
 
byte_screenStates
 
Command _line
 
Config _config
 
int16_defltTunes
 
uint16 _look
 
uint16 _take
 
uint16 _drop
 
Maze _maze
 
hugoBoot _boot
 
Common::RandomSource_rnd
 
const char * _episode
 
Common::String _picDir
 
Command _statusLine
 
Command _scoreLine
 
const HugoGameDescription_gameDescription
 
FileManager_file
 
Scheduler_scheduler
 
Screen_screen
 
MouseHandler_mouse
 
InventoryHandler_inventory
 
Parser_parser
 
Route_route
 
SoundHandler_sound
 
IntroHandler_intro
 
ObjectHandler_object
 
TextHandler_text
 
TopMenu_topMenu
 
- Public Attributes inherited from Engine
OSystem_system
 
Audio::Mixer_mixer
 

Protected Member Functions

Common::Error run () override
 Init the engine and start its main loop. 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 initPlaylist (bool playlist[kMaxTunes])
 Sets the playlist to be the default tune selection. More...
 
void initConfig ()
 Initialize default config values. More...
 
void initialize ()
 
void initMachine ()
 
void calcMaxScore ()
 Add up all the object values and all the bonus points. More...
 
void resetConfig ()
 Reset config parts. More...
 
void runMachine ()
 Hugo game state machine - called during onIdle. More...
 

Private Attributes

Status _status
 
uint32 _lastTime
 
uint32 _curTime
 
GameType _gameType
 
Common::Platform _platform
 
bool _packedFl
 
int _score
 
int _maxscore
 

Static Private Attributes

static const int kTurboTps = 16
 
static HugoEngines_Engine = nullptr
 

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 212 of file hugo.h.

Constructor & Destructor Documentation

◆ HugoEngine()

Hugo::HugoEngine::HugoEngine ( OSystem syst,
const HugoGameDescription gd 
)

Definition at line 55 of file hugo.cpp.

◆ ~HugoEngine()

Hugo::HugoEngine::~HugoEngine ( )
override

Definition at line 122 of file hugo.cpp.

Member Function Documentation

◆ adjustScore()

void Hugo::HugoEngine::adjustScore ( const int  adjustment)

Definition at line 167 of file hugo.cpp.

◆ calcMaxScore()

void Hugo::HugoEngine::calcMaxScore ( )
private

Add up all the object values and all the bonus points.

Definition at line 709 of file hugo.cpp.

◆ canLoadGameStateCurrently()

bool Hugo::HugoEngine::canLoadGameStateCurrently ( )
overridevirtual

Indicates whether a game state can be loaded.

Reimplemented from Engine.

Definition at line 727 of file hugo.cpp.

◆ canSaveGameStateCurrently()

bool Hugo::HugoEngine::canSaveGameStateCurrently ( )
overridevirtual

Indicates whether a game state can be saved.

Reimplemented from Engine.

Definition at line 731 of file hugo.cpp.

◆ endGame()

void Hugo::HugoEngine::endGame ( )

Exit game, advertise trilogy, show copyright.

Definition at line 718 of file hugo.cpp.

◆ gameOverMsg()

void Hugo::HugoEngine::gameOverMsg ( )

Print options for user when dead.

Definition at line 210 of file hugo.cpp.

◆ get()

static HugoEngine& Hugo::HugoEngine::get ( )
inlinestatic

Definition at line 259 of file hugo.h.

◆ getCopyrightString()

const char * Hugo::HugoEngine::getCopyrightString ( ) const

Definition at line 191 of file hugo.cpp.

◆ getFeatures()

uint32 Hugo::HugoEngine::getFeatures ( ) const

Definition at line 39 of file detection.cpp.

◆ getGameId()

const char * Hugo::HugoEngine::getGameId ( ) const

Definition at line 43 of file detection.cpp.

◆ getGameStatus()

Status & Hugo::HugoEngine::getGameStatus ( )

Definition at line 155 of file hugo.cpp.

◆ getGameType()

GameType Hugo::HugoEngine::getGameType ( ) const

Definition at line 195 of file hugo.cpp.

◆ getMaxScore()

int Hugo::HugoEngine::getMaxScore ( ) const

Definition at line 171 of file hugo.cpp.

◆ getPlatform()

Common::Platform Hugo::HugoEngine::getPlatform ( ) const

Definition at line 199 of file hugo.cpp.

◆ getSaveStateName()

Common::String Hugo::HugoEngine::getSaveStateName ( int  slot) const
overridevirtual

Generates the savegame filename.

Reimplemented from Engine.

Definition at line 745 of file hugo.cpp.

◆ getScore()

int Hugo::HugoEngine::getScore ( ) const

Definition at line 159 of file hugo.cpp.

◆ getTPS()

int8 Hugo::HugoEngine::getTPS ( ) const

Definition at line 735 of file hugo.cpp.

◆ hasFeature()

bool Hugo::HugoEngine::hasFeature ( EngineFeature  f) const
overridevirtual

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

Definition at line 187 of file hugo.cpp.

◆ initConfig()

void Hugo::HugoEngine::initConfig ( )
private

Initialize default config values.

Must be done before Initialize().

Definition at line 602 of file hugo.cpp.

◆ initGame()

void Hugo::HugoEngine::initGame ( const HugoGameDescription gd)

Definition at line 295 of file detection.cpp.

◆ initGamePart()

void Hugo::HugoEngine::initGamePart ( const HugoGameDescription gd)

◆ initialize()

void Hugo::HugoEngine::initialize ( )
private

Definition at line 627 of file hugo.cpp.

◆ initMachine()

void Hugo::HugoEngine::initMachine ( )
private

Definition at line 358 of file hugo.cpp.

◆ initPlaylist()

void Hugo::HugoEngine::initPlaylist ( bool  playlist[kMaxTunes])
private

Sets the playlist to be the default tune selection.

Definition at line 569 of file hugo.cpp.

◆ initStatus()

void Hugo::HugoEngine::initStatus ( )

Initialize the dynamic game status.

Definition at line 581 of file hugo.cpp.

◆ isPacked()

bool Hugo::HugoEngine::isPacked ( ) const

Definition at line 203 of file hugo.cpp.

◆ loadGameState()

Common::Error Hugo::HugoEngine::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 183 of file hugo.cpp.

◆ loadHugoDat()

bool Hugo::HugoEngine::loadHugoDat ( )

Loads Hugo.dat file, which contains all the hardcoded data in the original executables.

Definition at line 430 of file hugo.cpp.

◆ loadLongArray()

uint16 ** Hugo::HugoEngine::loadLongArray ( Common::SeekableReadStream in)

Definition at line 542 of file hugo.cpp.

◆ readScreenFiles()

void Hugo::HugoEngine::readScreenFiles ( const int  screen)

Read scenery, overlay files for given screen number.

Definition at line 674 of file hugo.cpp.

◆ resetConfig()

void Hugo::HugoEngine::resetConfig ( )
private

Reset config parts.

Currently only reset music played based on playlist

Definition at line 615 of file hugo.cpp.

◆ run()

Common::Error Hugo::HugoEngine::run ( )
overrideprotectedvirtual

Init the engine and start its main loop.

Returns
returns kNoError on success, else an error code.

Implements Engine.

Definition at line 214 of file hugo.cpp.

◆ runMachine()

void Hugo::HugoEngine::runMachine ( )
private

Hugo game state machine - called during onIdle.

Definition at line 373 of file hugo.cpp.

◆ saveGameState()

Common::Error Hugo::HugoEngine::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 179 of file hugo.cpp.

◆ setMaxScore()

void Hugo::HugoEngine::setMaxScore ( const int  newScore)

Definition at line 175 of file hugo.cpp.

◆ setNewScreen()

void Hugo::HugoEngine::setNewScreen ( const int  screen)

Set the new screen number into the hero object and any carried objects.

Definition at line 699 of file hugo.cpp.

◆ setScore()

void Hugo::HugoEngine::setScore ( const int  newScore)

Definition at line 163 of file hugo.cpp.

◆ shutdown()

void Hugo::HugoEngine::shutdown ( )

◆ syncSoundSettings()

void Hugo::HugoEngine::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 739 of file hugo.cpp.

Member Data Documentation

◆ _boot

hugoBoot Hugo::HugoEngine::_boot

Definition at line 240 of file hugo.h.

◆ _config

Config Hugo::HugoEngine::_config

Definition at line 233 of file hugo.h.

◆ _curTime

uint32 Hugo::HugoEngine::_curTime
private

Definition at line 317 of file hugo.h.

◆ _defltTunes

int16* Hugo::HugoEngine::_defltTunes

Definition at line 234 of file hugo.h.

◆ _drop

uint16 Hugo::HugoEngine::_drop

Definition at line 237 of file hugo.h.

◆ _episode

const char* Hugo::HugoEngine::_episode

Definition at line 244 of file hugo.h.

◆ _file

FileManager* Hugo::HugoEngine::_file

Definition at line 294 of file hugo.h.

◆ _gameDescription

const HugoGameDescription* Hugo::HugoEngine::_gameDescription

Definition at line 250 of file hugo.h.

◆ _gameType

GameType Hugo::HugoEngine::_gameType
private

Definition at line 321 of file hugo.h.

◆ _gameVariant

byte Hugo::HugoEngine::_gameVariant

Definition at line 220 of file hugo.h.

◆ _hero

Object* Hugo::HugoEngine::_hero

Definition at line 228 of file hugo.h.

◆ _heroImage

byte Hugo::HugoEngine::_heroImage

Definition at line 230 of file hugo.h.

◆ _intro

IntroHandler* Hugo::HugoEngine::_intro

Definition at line 302 of file hugo.h.

◆ _inventory

InventoryHandler* Hugo::HugoEngine::_inventory

Definition at line 298 of file hugo.h.

◆ _lastTime

uint32 Hugo::HugoEngine::_lastTime
private

Definition at line 316 of file hugo.h.

◆ _line

Command Hugo::HugoEngine::_line

Definition at line 232 of file hugo.h.

◆ _look

uint16 Hugo::HugoEngine::_look

Definition at line 235 of file hugo.h.

◆ _maxscore

int Hugo::HugoEngine::_maxscore
private

Definition at line 326 of file hugo.h.

◆ _maze

Maze Hugo::HugoEngine::_maze

Definition at line 239 of file hugo.h.

◆ _mouse

MouseHandler* Hugo::HugoEngine::_mouse

Definition at line 297 of file hugo.h.

◆ _normalTPS

int8 Hugo::HugoEngine::_normalTPS

Definition at line 226 of file hugo.h.

◆ _numScreens

uint16 Hugo::HugoEngine::_numScreens

Definition at line 224 of file hugo.h.

◆ _numStates

uint16 Hugo::HugoEngine::_numStates

Definition at line 225 of file hugo.h.

◆ _numVariant

byte Hugo::HugoEngine::_numVariant

Definition at line 219 of file hugo.h.

◆ _object

ObjectHandler* Hugo::HugoEngine::_object

Definition at line 303 of file hugo.h.

◆ _packedFl

bool Hugo::HugoEngine::_packedFl
private

Definition at line 323 of file hugo.h.

◆ _parser

Parser* Hugo::HugoEngine::_parser

Definition at line 299 of file hugo.h.

◆ _picDir

Common::String Hugo::HugoEngine::_picDir

Definition at line 245 of file hugo.h.

◆ _platform

Common::Platform Hugo::HugoEngine::_platform
private

Definition at line 322 of file hugo.h.

◆ _rnd

Common::RandomSource* Hugo::HugoEngine::_rnd

Definition at line 242 of file hugo.h.

◆ _route

Route* Hugo::HugoEngine::_route

Definition at line 300 of file hugo.h.

◆ _scheduler

Scheduler* Hugo::HugoEngine::_scheduler

Definition at line 295 of file hugo.h.

◆ _score

int Hugo::HugoEngine::_score
private

Definition at line 325 of file hugo.h.

◆ _scoreLine

Command Hugo::HugoEngine::_scoreLine

Definition at line 248 of file hugo.h.

◆ _screen

Screen* Hugo::HugoEngine::_screen

Definition at line 296 of file hugo.h.

◆ _screenPtr

byte* Hugo::HugoEngine::_screenPtr

Definition at line 229 of file hugo.h.

◆ _screenStates

byte* Hugo::HugoEngine::_screenStates

Definition at line 231 of file hugo.h.

◆ _sound

SoundHandler* Hugo::HugoEngine::_sound

Definition at line 301 of file hugo.h.

◆ _soundSilence

int8 Hugo::HugoEngine::_soundSilence

Definition at line 221 of file hugo.h.

◆ _soundTest

int8 Hugo::HugoEngine::_soundTest

Definition at line 222 of file hugo.h.

◆ _status

Status Hugo::HugoEngine::_status
private

Definition at line 315 of file hugo.h.

◆ _statusLine

Command Hugo::HugoEngine::_statusLine

Definition at line 247 of file hugo.h.

◆ _system

OSystem* Hugo::HugoEngine::_system

Definition at line 217 of file hugo.h.

◆ _take

uint16 Hugo::HugoEngine::_take

Definition at line 236 of file hugo.h.

◆ _text

TextHandler* Hugo::HugoEngine::_text

Definition at line 304 of file hugo.h.

◆ _topMenu

TopMenu* Hugo::HugoEngine::_topMenu

Definition at line 305 of file hugo.h.

◆ _tunesNbr

int8 Hugo::HugoEngine::_tunesNbr

Definition at line 223 of file hugo.h.

◆ kTurboTps

const int Hugo::HugoEngine::kTurboTps = 16
staticprivate

Definition at line 313 of file hugo.h.

◆ s_Engine

HugoEngine * Hugo::HugoEngine::s_Engine = nullptr
staticprivate

Definition at line 319 of file hugo.h.


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