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 ()
 
GUI::DebuggergetDebugger ()
 Return the engine's debugger instance, if any. More...
 
uint32 getFeatures () const
 
const char * getGameId () const
 
GameType getGameType () const
 
Common::Platform getPlatform () const
 
bool isPacked () const
 
virtual bool canLoadGameStateCurrently ()
 Indicates whether a game state can be loaded. More...
 
virtual bool canSaveGameStateCurrently ()
 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 ()
 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)
 Save a game state. More...
 
Common::Error loadGameState (int slot)
 Load a game state. More...
 
bool hasFeature (EngineFeature f) const
 Determine whether the engine supports the specified feature. More...
 
const char * getCopyrightString () const
 
Common::String getSavegameFilename (int slot)
 
uint16 ** loadLongArray (Common::SeekableReadStream &in)
 
- Public Member Functions inherited from Engine
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...
 
 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 void initKeymap ()
 
virtual void deinitKeymap ()
 
virtual void flipMute ()
 Flip mute all sound option. More...
 
void setGameToLoadSlot (int slot)
 Sets the game slot for a savegame to be loaded after global main menu execution. More...
 

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 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 ()
 Init the engine and start its main loop. More...
 
- Protected Member Functions inherited from Engine
virtual int runDialog (GUI::Dialog &dialog)
 
bool shouldPerformAutoSave (int lastSaveTime)
 Indicate whether an autosave should be performed. More...
 
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
 
HugoConsole_console
 
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,
  kSupportsJoystick
}
 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 ( )

Definition at line 122 of file hugo.cpp.

Member Function Documentation

◆ adjustScore()

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

Definition at line 172 of file hugo.cpp.

◆ calcMaxScore()

void Hugo::HugoEngine::calcMaxScore ( )
private

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

Definition at line 714 of file hugo.cpp.

◆ canLoadGameStateCurrently()

bool Hugo::HugoEngine::canLoadGameStateCurrently ( )
virtual

Indicates whether a game state can be loaded.

Reimplemented from Engine.

Definition at line 732 of file hugo.cpp.

◆ canSaveGameStateCurrently()

bool Hugo::HugoEngine::canSaveGameStateCurrently ( )
virtual

Indicates whether a game state can be saved.

Reimplemented from Engine.

Definition at line 736 of file hugo.cpp.

◆ endGame()

void Hugo::HugoEngine::endGame ( )

Exit game, advertise trilogy, show copyright.

Definition at line 723 of file hugo.cpp.

◆ gameOverMsg()

void Hugo::HugoEngine::gameOverMsg ( )

Print options for user when dead.

Definition at line 215 of file hugo.cpp.

◆ get()

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

Definition at line 261 of file hugo.h.

◆ getCopyrightString()

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

Definition at line 196 of file hugo.cpp.

◆ getDebugger()

GUI::Debugger * Hugo::HugoEngine::getDebugger ( )
virtual

Return the engine's debugger instance, if any.

Used by error() to invoke the debugger when a severe error is reported.

Reimplemented from Engine.

Definition at line 156 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 160 of file hugo.cpp.

◆ getGameType()

GameType Hugo::HugoEngine::getGameType ( ) const

Definition at line 200 of file hugo.cpp.

◆ getMaxScore()

int Hugo::HugoEngine::getMaxScore ( ) const

Definition at line 176 of file hugo.cpp.

◆ getPlatform()

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

Definition at line 204 of file hugo.cpp.

◆ getSavegameFilename()

Common::String Hugo::HugoEngine::getSavegameFilename ( int  slot)

Definition at line 750 of file hugo.cpp.

◆ getScore()

int Hugo::HugoEngine::getScore ( ) const

Definition at line 164 of file hugo.cpp.

◆ getTPS()

int8 Hugo::HugoEngine::getTPS ( ) const

Definition at line 740 of file hugo.cpp.

◆ hasFeature()

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

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

Definition at line 192 of file hugo.cpp.

◆ initConfig()

void Hugo::HugoEngine::initConfig ( )
private

Initialize default config values.

Must be done before Initialize().

Definition at line 607 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 632 of file hugo.cpp.

◆ initMachine()

void Hugo::HugoEngine::initMachine ( )
private

Definition at line 363 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 574 of file hugo.cpp.

◆ initStatus()

void Hugo::HugoEngine::initStatus ( )

Initialize the dynamic game status.

Definition at line 586 of file hugo.cpp.

◆ isPacked()

bool Hugo::HugoEngine::isPacked ( ) const

Definition at line 208 of file hugo.cpp.

◆ loadGameState()

Common::Error Hugo::HugoEngine::loadGameState ( int  slot)
virtual

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 188 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 435 of file hugo.cpp.

◆ loadLongArray()

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

Definition at line 547 of file hugo.cpp.

◆ readScreenFiles()

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

Read scenery, overlay files for given screen number.

Definition at line 679 of file hugo.cpp.

◆ resetConfig()

void Hugo::HugoEngine::resetConfig ( )
private

Reset config parts.

Currently only reset music played based on playlist

Definition at line 620 of file hugo.cpp.

◆ run()

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

Init the engine and start its main loop.

Returns
returns kNoError on success, else an error code.

Implements Engine.

Definition at line 219 of file hugo.cpp.

◆ runMachine()

void Hugo::HugoEngine::runMachine ( )
private

Hugo game state machine - called during onIdle.

Definition at line 378 of file hugo.cpp.

◆ saveGameState()

Common::Error Hugo::HugoEngine::saveGameState ( int  slot,
const Common::String desc 
)
virtual

Save a game state.

Parameters
slotthe slot into which the savestate should be stored
desca description for the savestate, entered by the user
Returns
returns kNoError on success, else an error code.

Reimplemented from Engine.

Definition at line 184 of file hugo.cpp.

◆ setMaxScore()

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

Definition at line 180 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 704 of file hugo.cpp.

◆ setScore()

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

Definition at line 168 of file hugo.cpp.

◆ shutdown()

void Hugo::HugoEngine::shutdown ( )

◆ syncSoundSettings()

void Hugo::HugoEngine::syncSoundSettings ( )
virtual

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 744 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.

◆ _console

HugoConsole* Hugo::HugoEngine::_console
private

Definition at line 323 of file hugo.h.

◆ _curTime

uint32 Hugo::HugoEngine::_curTime
private

Definition at line 319 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 246 of file hugo.h.

◆ _file

FileManager* Hugo::HugoEngine::_file

Definition at line 296 of file hugo.h.

◆ _gameDescription

const HugoGameDescription* Hugo::HugoEngine::_gameDescription

Definition at line 252 of file hugo.h.

◆ _gameType

GameType Hugo::HugoEngine::_gameType
private

Definition at line 325 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 304 of file hugo.h.

◆ _inventory

InventoryHandler* Hugo::HugoEngine::_inventory

Definition at line 300 of file hugo.h.

◆ _lastTime

uint32 Hugo::HugoEngine::_lastTime
private

Definition at line 318 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 330 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 299 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 305 of file hugo.h.

◆ _packedFl

bool Hugo::HugoEngine::_packedFl
private

Definition at line 327 of file hugo.h.

◆ _parser

Parser* Hugo::HugoEngine::_parser

Definition at line 301 of file hugo.h.

◆ _picDir

Common::String Hugo::HugoEngine::_picDir

Definition at line 247 of file hugo.h.

◆ _platform

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

Definition at line 326 of file hugo.h.

◆ _rnd

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

Definition at line 244 of file hugo.h.

◆ _route

Route* Hugo::HugoEngine::_route

Definition at line 302 of file hugo.h.

◆ _scheduler

Scheduler* Hugo::HugoEngine::_scheduler

Definition at line 297 of file hugo.h.

◆ _score

int Hugo::HugoEngine::_score
private

Definition at line 329 of file hugo.h.

◆ _scoreLine

Command Hugo::HugoEngine::_scoreLine

Definition at line 250 of file hugo.h.

◆ _screen

Screen* Hugo::HugoEngine::_screen

Definition at line 298 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 303 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 317 of file hugo.h.

◆ _statusLine

Command Hugo::HugoEngine::_statusLine

Definition at line 249 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 306 of file hugo.h.

◆ _topMenu

TopMenu* Hugo::HugoEngine::_topMenu

Definition at line 307 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 315 of file hugo.h.

◆ s_Engine

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

Definition at line 321 of file hugo.h.


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