2010-08-17 09:28:20 +00:00
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers , whose names
* are too numerous to list here . Please refer to the COPYRIGHT
* file distributed with this source distribution .
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
*
* $ URL $
* $ Id $
*
*/
# include "common/system.h"
2010-10-15 06:16:27 +00:00
# include "common/random.h"
2010-08-17 09:28:20 +00:00
# include "common/events.h"
2010-10-15 06:16:27 +00:00
# include "common/EventRecorder.h"
2010-08-17 09:28:20 +00:00
# include "common/debug-channels.h"
# include "hugo/hugo.h"
# include "hugo/game.h"
# include "hugo/file.h"
# include "hugo/schedule.h"
# include "hugo/display.h"
# include "hugo/mouse.h"
# include "hugo/inventory.h"
# include "hugo/parser.h"
# include "hugo/route.h"
2010-10-15 06:16:27 +00:00
# include "hugo/util.h"
2010-08-17 09:28:20 +00:00
# include "hugo/sound.h"
# include "hugo/intro.h"
2010-10-21 17:09:57 +00:00
# include "hugo/object.h"
2011-01-25 00:32:48 +00:00
# include "hugo/text.h"
2010-08-17 09:28:20 +00:00
# include "engines/util.h"
namespace Hugo {
2010-10-03 08:08:42 +00:00
HugoEngine * HugoEngine : : s_Engine = 0 ;
2010-08-17 09:28:20 +00:00
2011-01-23 00:05:52 +00:00
maze_t _maze ; // Default to not in maze
2010-10-15 06:16:27 +00:00
hugo_boot_t _boot ; // Boot info structure file
2011-02-08 20:52:26 +00:00
HugoEngine : : HugoEngine ( OSystem * syst , const HugoGameDescription * gd ) : Engine ( syst ) , _gameDescription ( gd ) ,
2011-02-14 07:31:01 +00:00
_arrayReqs ( 0 ) , _invent ( 0 ) , _uses ( 0 ) , _catchallList ( 0 ) , _backgroundObjects ( 0 ) , _points ( 0 ) , _cmdList ( 0 ) ,
2011-01-25 00:32:48 +00:00
_screenActs ( 0 ) , _hero ( 0 ) , _heroImage ( 0 ) , _defltTunes ( 0 ) , _introX ( 0 ) , _introY ( 0 ) , _maxInvent ( 0 ) , _numBonuses ( 0 ) ,
2010-11-12 18:05:23 +00:00
_numScreens ( 0 ) , _tunesNbr ( 0 ) , _soundSilence ( 0 ) , _soundTest ( 0 ) , _screenStates ( 0 ) , _score ( 0 ) , _maxscore ( 0 ) ,
2011-02-03 18:25:38 +00:00
_backgroundObjectsSize ( 0 ) , _screenActsSize ( 0 ) , _usesSize ( 0 ) , _lastTime ( 0 ) , _curTime ( 0 )
2010-08-17 09:28:20 +00:00
{
2010-11-29 17:42:08 +00:00
_system = syst ;
2010-08-17 09:28:20 +00:00
DebugMan . addDebugChannel ( kDebugSchedule , " Schedule " , " Script Schedule debug level " ) ;
DebugMan . addDebugChannel ( kDebugEngine , " Engine " , " Engine debug level " ) ;
DebugMan . addDebugChannel ( kDebugDisplay , " Display " , " Display debug level " ) ;
DebugMan . addDebugChannel ( kDebugMouse , " Mouse " , " Mouse debug level " ) ;
DebugMan . addDebugChannel ( kDebugParser , " Parser " , " Parser debug level " ) ;
DebugMan . addDebugChannel ( kDebugFile , " File " , " File IO debug level " ) ;
DebugMan . addDebugChannel ( kDebugRoute , " Route " , " Route debug level " ) ;
DebugMan . addDebugChannel ( kDebugInventory , " Inventory " , " Inventory debug level " ) ;
2010-10-25 14:03:01 +00:00
DebugMan . addDebugChannel ( kDebugObject , " Object " , " Object debug level " ) ;
2010-12-22 09:09:38 +00:00
DebugMan . addDebugChannel ( kDebugMusic , " Music " , " Music debug level " ) ;
2010-09-17 22:40:53 +00:00
2010-11-07 15:04:47 +00:00
_console = new HugoConsole ( this ) ;
2010-11-30 00:01:54 +00:00
_rnd = 0 ;
2010-08-17 09:28:20 +00:00
}
HugoEngine : : ~ HugoEngine ( ) {
2010-12-05 22:02:04 +00:00
shutdown ( ) ;
2010-12-01 23:15:28 +00:00
2010-11-06 13:21:18 +00:00
_screen - > freePalette ( ) ;
2011-01-25 00:32:48 +00:00
_text - > freeAllTexts ( ) ;
2010-10-30 20:48:54 +00:00
free ( _introX ) ;
free ( _introY ) ;
2010-11-09 20:26:12 +00:00
if ( _arrayReqs ) {
for ( int i = 0 ; _arrayReqs [ i ] ! = 0 ; i + + )
free ( _arrayReqs [ i ] ) ;
free ( _arrayReqs ) ;
}
2011-02-14 07:31:01 +00:00
_mouse - > freeHotspots ( ) ;
2010-08-17 09:28:20 +00:00
free ( _invent ) ;
2010-10-30 20:48:54 +00:00
2010-11-07 18:52:47 +00:00
if ( _uses ) {
for ( int i = 0 ; i < _usesSize ; i + + )
free ( _uses [ i ] . targets ) ;
free ( _uses ) ;
}
2010-10-30 20:48:54 +00:00
2010-08-17 09:28:20 +00:00
free ( _catchallList ) ;
2010-11-07 18:52:47 +00:00
if ( _backgroundObjects ) {
for ( int i = 0 ; i < _backgroundObjectsSize ; i + + )
free ( _backgroundObjects [ i ] ) ;
free ( _backgroundObjects ) ;
}
2010-08-17 09:28:20 +00:00
free ( _points ) ;
2010-11-07 18:52:47 +00:00
if ( _cmdList ) {
for ( int i = 0 ; i < _cmdListSize ; i + + )
free ( _cmdList [ i ] ) ;
free ( _cmdList ) ;
}
2011-02-12 18:29:56 +00:00
if ( _screenActs ) {
2010-11-07 18:52:47 +00:00
for ( int i = 0 ; i < _screenActsSize ; i + + )
free ( _screenActs [ i ] ) ;
free ( _screenActs ) ;
}
2010-10-30 16:04:43 +00:00
_object - > freeObjectArr ( ) ;
2010-11-01 00:27:11 +00:00
_scheduler - > freeActListArr ( ) ;
2010-08-17 09:28:20 +00:00
free ( _defltTunes ) ;
free ( _screenStates ) ;
2010-09-12 22:59:32 +00:00
2010-11-07 00:02:48 +00:00
_screen - > freeFonts ( ) ;
2010-10-30 16:04:43 +00:00
2011-01-03 12:38:13 +00:00
delete _topMenu ;
2010-10-30 16:04:43 +00:00
delete _object ;
delete _sound ;
delete _route ;
delete _parser ;
delete _inventory ;
delete _mouse ;
delete _screen ;
2010-11-13 08:08:58 +00:00
delete _intro ;
2010-10-30 16:04:43 +00:00
delete _scheduler ;
delete _file ;
2011-02-05 14:45:36 +00:00
delete _text ;
2010-11-07 15:04:47 +00:00
DebugMan . clearAllDebugChannels ( ) ;
delete _console ;
2010-11-30 00:01:54 +00:00
delete _rnd ;
2010-08-17 09:28:20 +00:00
}
GameType HugoEngine : : getGameType ( ) const {
return _gameType ;
}
Common : : Platform HugoEngine : : getPlatform ( ) const {
return _platform ;
}
bool HugoEngine : : isPacked ( ) const {
return _packedFl ;
}
Common : : Error HugoEngine : : run ( ) {
s_Engine = this ;
initGraphics ( 320 , 200 , false ) ;
2010-10-21 17:09:57 +00:00
_mouse = new MouseHandler ( this ) ;
_inventory = new InventoryHandler ( this ) ;
_route = new Route ( this ) ;
_sound = new SoundHandler ( this ) ;
2011-01-25 00:32:48 +00:00
_text = new TextHandler ( this ) ;
2010-08-18 13:44:22 +00:00
2011-01-03 12:38:13 +00:00
_topMenu = new TopMenu ( this ) ;
2010-09-04 16:02:16 +00:00
switch ( _gameVariant ) {
2011-01-18 18:26:33 +00:00
case kGameVariantH1Win : // H1 Win
2010-10-21 17:09:57 +00:00
_file = new FileManager_v1w ( this ) ;
2010-10-25 19:59:32 +00:00
_scheduler = new Scheduler_v1w ( this ) ;
2010-10-21 17:09:57 +00:00
_intro = new intro_v1w ( this ) ;
_screen = new Screen_v1w ( this ) ;
_parser = new Parser_v1w ( this ) ;
2010-10-25 09:13:57 +00:00
_object = new ObjectHandler_v1w ( this ) ;
2010-12-12 07:40:00 +00:00
_normalTPS = 9 ;
2010-09-04 16:02:16 +00:00
break ;
2011-01-18 18:26:33 +00:00
case kGameVariantH2Win :
2011-01-04 08:36:03 +00:00
_file = new FileManager_v2w ( this ) ;
2010-10-25 19:59:32 +00:00
_scheduler = new Scheduler_v1w ( this ) ;
2010-10-21 17:09:57 +00:00
_intro = new intro_v2w ( this ) ;
_screen = new Screen_v1w ( this ) ;
_parser = new Parser_v1w ( this ) ;
2010-10-25 09:13:57 +00:00
_object = new ObjectHandler_v1w ( this ) ;
2010-12-12 07:40:00 +00:00
_normalTPS = 9 ;
2010-09-04 16:02:16 +00:00
break ;
2011-01-18 18:26:33 +00:00
case kGameVariantH3Win :
2011-01-04 08:36:03 +00:00
_file = new FileManager_v2w ( this ) ;
2010-10-25 19:59:32 +00:00
_scheduler = new Scheduler_v1w ( this ) ;
2010-10-21 17:09:57 +00:00
_intro = new intro_v3w ( this ) ;
_screen = new Screen_v1w ( this ) ;
_parser = new Parser_v1w ( this ) ;
2010-10-25 09:13:57 +00:00
_object = new ObjectHandler_v1w ( this ) ;
2010-12-12 07:40:00 +00:00
_normalTPS = 9 ;
2010-09-04 16:02:16 +00:00
break ;
2011-01-18 18:26:33 +00:00
case kGameVariantH1Dos : // H1 DOS
2010-10-21 17:09:57 +00:00
_file = new FileManager_v1d ( this ) ;
_scheduler = new Scheduler_v1d ( this ) ;
_intro = new intro_v1d ( this ) ;
_screen = new Screen_v1d ( this ) ;
_parser = new Parser_v1d ( this ) ;
2010-10-25 09:13:57 +00:00
_object = new ObjectHandler_v1d ( this ) ;
2010-12-12 07:40:00 +00:00
_normalTPS = 8 ;
2010-09-04 16:02:16 +00:00
break ;
2011-01-18 18:26:33 +00:00
case kGameVariantH2Dos :
2010-10-21 17:09:57 +00:00
_file = new FileManager_v2d ( this ) ;
2010-10-25 19:59:32 +00:00
_scheduler = new Scheduler_v2d ( this ) ;
2010-10-21 17:09:57 +00:00
_intro = new intro_v2d ( this ) ;
_screen = new Screen_v1d ( this ) ;
_parser = new Parser_v2d ( this ) ;
2010-10-25 12:07:07 +00:00
_object = new ObjectHandler_v2d ( this ) ;
2010-12-12 07:40:00 +00:00
_normalTPS = 8 ;
2010-09-04 16:02:16 +00:00
break ;
2011-01-18 18:26:33 +00:00
case kGameVariantH3Dos :
2010-10-21 17:09:57 +00:00
_file = new FileManager_v3d ( this ) ;
_scheduler = new Scheduler_v3d ( this ) ;
_intro = new intro_v3d ( this ) ;
_screen = new Screen_v1d ( this ) ;
_parser = new Parser_v3d ( this ) ;
2010-12-12 07:40:00 +00:00
_object = new ObjectHandler_v3d ( this ) ;
_normalTPS = 9 ;
2010-09-04 16:02:16 +00:00
break ;
}
2010-08-17 09:28:20 +00:00
if ( ! loadHugoDat ( ) )
return Common : : kUnknownError ;
2011-01-20 19:33:31 +00:00
// Use Windows-looking mouse cursor
2011-01-08 16:56:52 +00:00
_screen - > setCursorPal ( ) ;
_screen - > resetInventoryObjId ( ) ;
2010-08-17 09:28:20 +00:00
initStatus ( ) ; // Initialize game status
2011-01-23 00:05:52 +00:00
initConfig ( ) ; // Initialize user's config
2010-08-17 09:28:20 +00:00
initialize ( ) ;
2011-01-23 00:05:52 +00:00
resetConfig ( ) ; // Reset user's config
2010-08-17 09:28:20 +00:00
initMachine ( ) ;
// Start the state machine
2011-01-23 00:05:52 +00:00
_status . viewState = kViewIntroInit ;
2010-08-17 09:28:20 +00:00
2010-10-10 13:06:48 +00:00
_status . doQuitFl = false ;
2010-08-17 09:28:20 +00:00
2010-10-10 13:06:48 +00:00
while ( ! _status . doQuitFl ) {
2011-02-14 07:31:01 +00:00
_screen - > drawBoundaries ( ) ;
2011-01-28 19:54:48 +00:00
2010-08-17 09:28:20 +00:00
g_system - > updateScreen ( ) ;
runMachine ( ) ;
// Handle input
Common : : Event event ;
while ( _eventMan - > pollEvent ( event ) ) {
switch ( event . type ) {
case Common : : EVENT_KEYDOWN :
2010-12-20 17:25:58 +00:00
_parser - > keyHandler ( event ) ;
2010-08-17 09:28:20 +00:00
break ;
case Common : : EVENT_MOUSEMOVE :
2011-02-08 20:52:26 +00:00
_mouse - > setMouseX ( event . mouse . x ) ;
_mouse - > setMouseY ( event . mouse . y ) ;
2010-08-17 09:28:20 +00:00
break ;
case Common : : EVENT_LBUTTONUP :
2011-02-08 20:52:26 +00:00
_mouse - > setLeftButton ( ) ;
2010-08-17 09:28:20 +00:00
break ;
case Common : : EVENT_RBUTTONUP :
2011-02-08 20:52:26 +00:00
_mouse - > setRightButton ( ) ;
2010-08-17 09:28:20 +00:00
break ;
case Common : : EVENT_QUIT :
2010-10-10 13:06:48 +00:00
_status . doQuitFl = true ;
2010-08-17 09:28:20 +00:00
break ;
default :
break ;
}
}
2011-01-19 18:02:53 +00:00
_mouse - > mouseHandler ( ) ; // Mouse activity - adds to display list
2011-01-23 00:05:52 +00:00
_screen - > displayList ( kDisplayDisplay ) ; // Blit the display list to screen
2010-11-03 23:56:34 +00:00
_status . doQuitFl | = shouldQuit ( ) ; // update game quit flag
2010-08-17 09:28:20 +00:00
}
return Common : : kNoError ;
}
void HugoEngine : : initMachine ( ) {
2010-09-17 22:40:53 +00:00
if ( _gameVariant = = kGameVariantH1Dos )
2010-09-16 23:03:03 +00:00
readScreenFiles ( 0 ) ;
else
2010-10-21 17:09:57 +00:00
_file - > readBackground ( _numScreens - 1 ) ; // Splash screen
2010-11-11 23:04:04 +00:00
_object - > readObjectImages ( ) ; // Read all object images
2010-08-17 09:28:20 +00:00
if ( _platform = = Common : : kPlatformWindows )
2010-10-21 17:09:57 +00:00
_file - > readUIFImages ( ) ; // Read all uif images (only in Win versions)
2011-02-01 00:08:12 +00:00
_sound - > initPcspkrPlayer ( ) ;
2010-08-17 09:28:20 +00:00
}
2010-11-01 20:20:21 +00:00
/**
2011-02-11 20:27:48 +00:00
* Hugo game state machine - called during onIdle
*/
2010-08-17 09:28:20 +00:00
void HugoEngine : : runMachine ( ) {
status_t & gameStatus = getGameStatus ( ) ;
// Don't process if we're in a textbox
if ( gameStatus . textBoxFl )
return ;
// Don't process if gameover
if ( gameStatus . gameOverFl )
return ;
2011-02-03 18:25:38 +00:00
_curTime = g_system - > getMillis ( ) ;
2010-08-17 09:28:20 +00:00
// Process machine once every tick
2011-02-03 18:25:38 +00:00
while ( _curTime - _lastTime < ( uint32 ) ( 1000 / getTPS ( ) ) ) {
2011-01-01 10:13:42 +00:00
g_system - > delayMillis ( 5 ) ;
2011-02-03 18:25:38 +00:00
_curTime = g_system - > getMillis ( ) ;
2011-01-01 10:13:42 +00:00
}
2011-02-05 14:45:36 +00:00
2011-02-03 18:25:38 +00:00
_lastTime = _curTime ;
2010-08-17 09:28:20 +00:00
switch ( gameStatus . viewState ) {
2011-01-23 00:05:52 +00:00
case kViewIdle : // Not processing state machine
2011-01-08 16:56:52 +00:00
_screen - > hideCursor ( ) ;
2010-10-21 17:09:57 +00:00
_intro - > preNewGame ( ) ; // Any processing before New Game selected
2010-08-17 09:28:20 +00:00
break ;
2011-01-23 00:05:52 +00:00
case kViewIntroInit : // Initialization before intro begins
2010-10-21 17:09:57 +00:00
_intro - > introInit ( ) ;
2011-01-23 00:05:52 +00:00
gameStatus . viewState = kViewIntro ;
2010-08-17 09:28:20 +00:00
break ;
2011-01-23 00:05:52 +00:00
case kViewIntro : // Do any game-dependant preamble
2010-12-15 20:37:09 +00:00
if ( _intro - > introPlay ( ) ) { // Process intro screen
2010-10-21 17:09:57 +00:00
_scheduler - > newScreen ( 0 ) ; // Initialize first screen
2011-01-23 00:05:52 +00:00
gameStatus . viewState = kViewPlay ;
2010-08-17 09:28:20 +00:00
}
break ;
2011-01-23 00:05:52 +00:00
case kViewPlay : // Playing game
2011-01-08 16:56:52 +00:00
_screen - > showCursor ( ) ;
2010-10-21 17:09:57 +00:00
_parser - > charHandler ( ) ; // Process user cmd input
_object - > moveObjects ( ) ; // Process object movement
_scheduler - > runScheduler ( ) ; // Process any actions
2011-01-23 00:05:52 +00:00
_screen - > displayList ( kDisplayRestore ) ; // Restore previous background
2010-10-21 17:09:57 +00:00
_object - > updateImages ( ) ; // Draw into _frontBuffer, compile display list
_screen - > drawStatusText ( ) ;
2011-01-23 00:05:52 +00:00
_screen - > displayList ( kDisplayDisplay ) ; // Blit the display list to screen
2011-01-01 10:51:57 +00:00
_sound - > checkMusic ( ) ;
2010-08-17 09:28:20 +00:00
break ;
2011-01-23 00:05:52 +00:00
case kViewInvent : // Accessing inventory
2010-10-21 17:09:57 +00:00
_inventory - > runInventory ( ) ; // Process Inventory state machine
2010-08-17 09:28:20 +00:00
break ;
2011-01-23 00:05:52 +00:00
case kViewExit : // Game over or user exited
gameStatus . viewState = kViewIdle ;
2010-10-10 13:06:48 +00:00
_status . doQuitFl = true ;
2010-08-17 09:28:20 +00:00
break ;
}
}
2010-11-01 20:20:21 +00:00
/**
2011-02-11 20:27:48 +00:00
* Loads Hugo . dat file , which contains all the hardcoded data in the original executables
*/
2010-08-17 09:28:20 +00:00
bool HugoEngine : : loadHugoDat ( ) {
Common : : File in ;
in . open ( " hugo.dat " ) ;
if ( ! in . isOpen ( ) ) {
Common : : String errorMessage = " You're missing the 'hugo.dat' file. Get it from the ScummVM website " ;
GUIErrorMessage ( errorMessage ) ;
warning ( " %s " , errorMessage . c_str ( ) ) ;
return false ;
}
// Read header
2011-02-08 20:52:26 +00:00
char buf [ 4 ] ;
2010-08-17 09:28:20 +00:00
in . read ( buf , 4 ) ;
2011-02-08 20:52:26 +00:00
if ( memcmp ( buf , " HUGO " , 4 ) ) {
2010-08-17 09:28:20 +00:00
Common : : String errorMessage = " File 'hugo.dat' is corrupt. Get it from the ScummVM website " ;
GUIErrorMessage ( errorMessage ) ;
return false ;
}
2010-10-03 08:08:42 +00:00
int majVer = in . readByte ( ) ;
int minVer = in . readByte ( ) ;
2010-08-17 09:28:20 +00:00
if ( ( majVer ! = HUGO_DAT_VER_MAJ ) | | ( minVer ! = HUGO_DAT_VER_MIN ) ) {
2011-02-08 20:52:26 +00:00
Common : : String errorMessage = Common : : String : : format ( " File 'hugo.dat' is wrong version. Expected %d.%d but got %d.%d. Get it from the ScummVM website " , HUGO_DAT_VER_MAJ , HUGO_DAT_VER_MIN , majVer , minVer ) ;
GUIErrorMessage ( errorMessage ) ;
2010-08-17 09:28:20 +00:00
return false ;
}
_numVariant = in . readUint16BE ( ) ;
2010-11-06 13:21:18 +00:00
_screen - > loadPalette ( in ) ;
2011-01-25 00:32:48 +00:00
_text - > loadAllTexts ( in ) ;
2010-08-17 09:28:20 +00:00
// Read x_intro and y_intro
2010-09-26 11:32:52 +00:00
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
int numRows = in . readUint16BE ( ) ;
if ( varnt = = _gameVariant ) {
_introXSize = numRows ;
_introX = ( byte * ) malloc ( sizeof ( byte ) * _introXSize ) ;
_introY = ( byte * ) malloc ( sizeof ( byte ) * _introXSize ) ;
for ( int i = 0 ; i < _introXSize ; i + + ) {
_introX [ i ] = in . readByte ( ) ;
_introY [ i ] = in . readByte ( ) ;
}
} else {
for ( int i = 0 ; i < numRows ; i + + ) {
in . readByte ( ) ;
in . readByte ( ) ;
}
}
2010-08-17 09:28:20 +00:00
}
// Read _arrayReqs
_arrayReqs = loadLongArray ( in ) ;
2011-02-14 07:31:01 +00:00
_mouse - > loadHotspots ( in ) ;
2010-08-17 09:28:20 +00:00
2010-11-01 00:27:11 +00:00
int numElem , numSubElem ;
2010-08-17 09:28:20 +00:00
//Read _invent
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
numElem = in . readUint16BE ( ) ;
if ( varnt = = _gameVariant ) {
_maxInvent = numElem ;
_invent = ( int16 * ) malloc ( sizeof ( int16 ) * numElem ) ;
for ( int i = 0 ; i < numElem ; i + + )
_invent [ i ] = in . readSint16BE ( ) ;
} else {
for ( int i = 0 ; i < numElem ; i + + )
in . readSint16BE ( ) ;
}
}
//Read _uses
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
numElem = in . readUint16BE ( ) ;
2011-02-12 18:01:46 +00:00
uses_t * wrkUses = ( uses_t * ) malloc ( sizeof ( uses_t ) * numElem ) ;
for ( int i = 0 ; i < numElem ; i + + ) {
wrkUses [ i ] . objId = in . readSint16BE ( ) ;
wrkUses [ i ] . dataIndex = in . readUint16BE ( ) ;
numSubElem = in . readUint16BE ( ) ;
wrkUses [ i ] . targets = ( target_t * ) malloc ( sizeof ( target_t ) * numSubElem ) ;
for ( int j = 0 ; j < numSubElem ; j + + ) {
wrkUses [ i ] . targets [ j ] . nounIndex = in . readUint16BE ( ) ;
wrkUses [ i ] . targets [ j ] . verbIndex = in . readUint16BE ( ) ;
}
}
2010-08-17 09:28:20 +00:00
if ( varnt = = _gameVariant ) {
2010-10-30 20:48:54 +00:00
_usesSize = numElem ;
2011-02-12 18:01:46 +00:00
_uses = wrkUses ;
2010-08-17 09:28:20 +00:00
} else {
2011-02-12 18:01:46 +00:00
for ( int i = 0 ; i < numElem ; i + + )
free ( wrkUses [ i ] . targets ) ;
free ( wrkUses ) ;
2010-08-17 09:28:20 +00:00
}
}
//Read _catchallList
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
numElem = in . readUint16BE ( ) ;
2011-02-12 18:01:46 +00:00
background_t * wrkCatchallList = ( background_t * ) malloc ( sizeof ( background_t ) * numElem ) ;
for ( int i = 0 ; i < numElem ; i + + ) {
wrkCatchallList [ i ] . verbIndex = in . readUint16BE ( ) ;
wrkCatchallList [ i ] . nounIndex = in . readUint16BE ( ) ;
wrkCatchallList [ i ] . commentIndex = in . readSint16BE ( ) ;
wrkCatchallList [ i ] . matchFl = ( in . readByte ( ) ! = 0 ) ;
wrkCatchallList [ i ] . roomState = in . readByte ( ) ;
wrkCatchallList [ i ] . bonusIndex = in . readByte ( ) ;
2010-08-17 09:28:20 +00:00
}
2011-02-12 18:01:46 +00:00
if ( varnt = = _gameVariant )
_catchallList = wrkCatchallList ;
else
free ( wrkCatchallList ) ;
2010-08-17 09:28:20 +00:00
}
2011-02-08 20:52:26 +00:00
// Read _background_objects
2010-08-17 09:28:20 +00:00
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
numElem = in . readUint16BE ( ) ;
2011-02-12 18:01:46 +00:00
background_t * * wrkBackgroundObjects = ( background_t * * ) malloc ( sizeof ( background_t * ) * numElem ) ;
for ( int i = 0 ; i < numElem ; i + + ) {
numSubElem = in . readUint16BE ( ) ;
wrkBackgroundObjects [ i ] = ( background_t * ) malloc ( sizeof ( background_t ) * numSubElem ) ;
for ( int j = 0 ; j < numSubElem ; j + + ) {
wrkBackgroundObjects [ i ] [ j ] . verbIndex = in . readUint16BE ( ) ;
wrkBackgroundObjects [ i ] [ j ] . nounIndex = in . readUint16BE ( ) ;
wrkBackgroundObjects [ i ] [ j ] . commentIndex = in . readSint16BE ( ) ;
wrkBackgroundObjects [ i ] [ j ] . matchFl = ( in . readByte ( ) ! = 0 ) ;
wrkBackgroundObjects [ i ] [ j ] . roomState = in . readByte ( ) ;
wrkBackgroundObjects [ i ] [ j ] . bonusIndex = in . readByte ( ) ;
}
}
2010-08-17 09:28:20 +00:00
if ( varnt = = _gameVariant ) {
2010-10-30 16:04:43 +00:00
_backgroundObjectsSize = numElem ;
2011-02-12 18:01:46 +00:00
_backgroundObjects = wrkBackgroundObjects ;
2010-08-17 09:28:20 +00:00
} else {
2011-02-12 18:01:46 +00:00
for ( int i = 0 ; i < numElem ; i + + )
free ( wrkBackgroundObjects [ i ] ) ;
free ( wrkBackgroundObjects ) ;
2010-08-17 09:28:20 +00:00
}
}
// Read _points
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
numElem = in . readUint16BE ( ) ;
if ( varnt = = _gameVariant ) {
_numBonuses = numElem ;
_points = ( point_t * ) malloc ( sizeof ( point_t ) * _numBonuses ) ;
for ( int i = 0 ; i < _numBonuses ; i + + ) {
_points [ i ] . score = in . readByte ( ) ;
_points [ i ] . scoredFl = false ;
}
} else {
for ( int i = 0 ; i < numElem ; i + + )
in . readByte ( ) ;
}
}
// Read _cmdList
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
numElem = in . readUint16BE ( ) ;
if ( varnt = = _gameVariant ) {
2010-10-30 16:04:43 +00:00
_cmdListSize = numElem ;
_cmdList = ( cmd * * ) malloc ( sizeof ( cmd * ) * _cmdListSize ) ;
for ( int i = 0 ; i < _cmdListSize ; i + + ) {
2010-08-17 09:28:20 +00:00
numSubElem = in . readUint16BE ( ) ;
_cmdList [ i ] = ( cmd * ) malloc ( sizeof ( cmd ) * numSubElem ) ;
for ( int j = 0 ; j < numSubElem ; j + + ) {
_cmdList [ i ] [ j ] . verbIndex = in . readUint16BE ( ) ;
_cmdList [ i ] [ j ] . reqIndex = in . readUint16BE ( ) ;
_cmdList [ i ] [ j ] . textDataNoCarryIndex = in . readUint16BE ( ) ;
_cmdList [ i ] [ j ] . reqState = in . readByte ( ) ;
_cmdList [ i ] [ j ] . newState = in . readByte ( ) ;
_cmdList [ i ] [ j ] . textDataWrongIndex = in . readUint16BE ( ) ;
_cmdList [ i ] [ j ] . textDataDoneIndex = in . readUint16BE ( ) ;
_cmdList [ i ] [ j ] . actIndex = in . readUint16BE ( ) ;
}
}
} else {
for ( int i = 0 ; i < numElem ; i + + ) {
numSubElem = in . readUint16BE ( ) ;
for ( int j = 0 ; j < numSubElem ; j + + ) {
in . readUint16BE ( ) ;
in . readUint16BE ( ) ;
in . readUint16BE ( ) ;
in . readByte ( ) ;
in . readByte ( ) ;
in . readUint16BE ( ) ;
in . readUint16BE ( ) ;
in . readUint16BE ( ) ;
}
}
}
}
// Read _screenActs
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
numElem = in . readUint16BE ( ) ;
2011-02-12 18:01:46 +00:00
uint16 * * wrkScreenActs = ( uint16 * * ) malloc ( sizeof ( uint16 * ) * numElem ) ;
for ( int i = 0 ; i < numElem ; i + + ) {
numSubElem = in . readUint16BE ( ) ;
if ( numSubElem = = 0 ) {
wrkScreenActs [ i ] = 0 ;
} else {
wrkScreenActs [ i ] = ( uint16 * ) malloc ( sizeof ( uint16 ) * numSubElem ) ;
for ( int j = 0 ; j < numSubElem ; j + + )
wrkScreenActs [ i ] [ j ] = in . readUint16BE ( ) ;
}
}
2010-08-17 09:28:20 +00:00
if ( varnt = = _gameVariant ) {
2010-10-30 16:04:43 +00:00
_screenActsSize = numElem ;
2011-02-12 18:01:46 +00:00
_screenActs = wrkScreenActs ;
2010-08-17 09:28:20 +00:00
} else {
2011-02-12 18:01:46 +00:00
for ( int i = 0 ; i < numElem ; i + + )
free ( wrkScreenActs [ i ] ) ;
free ( wrkScreenActs ) ;
2010-08-17 09:28:20 +00:00
}
}
2010-10-30 16:04:43 +00:00
_object - > loadObjectArr ( in ) ;
2010-11-01 15:29:06 +00:00
2011-01-23 00:05:52 +00:00
_hero = & _object - > _objects [ kHeroIndex ] ; // This always points to hero
_screen_p = & ( _object - > _objects [ kHeroIndex ] . screenIndex ) ; // Current screen is hero's
_heroImage = kHeroIndex ; // Current in use hero image
2010-08-17 09:28:20 +00:00
2010-11-01 00:27:11 +00:00
_scheduler - > loadActListArr ( in ) ;
2010-11-01 20:20:21 +00:00
2010-08-17 09:28:20 +00:00
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
if ( varnt = = _gameVariant ) {
2010-10-31 21:20:22 +00:00
_tunesNbr = in . readSByte ( ) ;
_soundSilence = in . readSByte ( ) ;
_soundTest = in . readSByte ( ) ;
2010-08-17 09:28:20 +00:00
} else {
2010-10-31 21:20:22 +00:00
in . readSByte ( ) ;
in . readSByte ( ) ;
in . readSByte ( ) ;
2010-08-17 09:28:20 +00:00
}
}
//Read _defltTunes
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
numElem = in . readUint16BE ( ) ;
if ( varnt = = _gameVariant ) {
_defltTunes = ( int16 * ) malloc ( sizeof ( int16 ) * numElem ) ;
for ( int i = 0 ; i < numElem ; i + + )
_defltTunes [ i ] = in . readSint16BE ( ) ;
} else {
for ( int i = 0 ; i < numElem ; i + + )
in . readSint16BE ( ) ;
}
}
//Read _screenStates size
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
numElem = in . readUint16BE ( ) ;
if ( varnt = = _gameVariant ) {
_screenStates = ( byte * ) malloc ( sizeof ( byte ) * numElem ) ;
for ( int i = 0 ; i < numElem ; i + + )
_screenStates [ i ] = 0 ;
}
}
//Read look, take and drop special verbs indexes
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
if ( varnt = = _gameVariant ) {
_look = in . readUint16BE ( ) ;
_take = in . readUint16BE ( ) ;
_drop = in . readUint16BE ( ) ;
} else {
in . readUint16BE ( ) ;
in . readUint16BE ( ) ;
in . readUint16BE ( ) ;
}
}
2010-11-11 23:04:04 +00:00
_object - > loadNumObj ( in ) ;
2010-11-01 00:27:11 +00:00
_scheduler - > loadAlNewscrIndex ( in ) ;
2011-01-07 15:14:38 +00:00
_sound - > loadIntroSong ( in ) ;
2010-11-07 00:02:48 +00:00
_screen - > loadFontArr ( in ) ;
2011-01-03 16:19:00 +00:00
_topMenu - > loadBmpArr ( in ) ;
2010-08-17 09:28:20 +00:00
return true ;
}
2011-02-12 16:20:57 +00:00
uint16 * * HugoEngine : : loadLongArray ( Common : : ReadStream & in ) {
2010-08-17 09:28:20 +00:00
uint16 * * resArray = 0 ;
for ( int varnt = 0 ; varnt < _numVariant ; varnt + + ) {
2010-10-03 08:08:42 +00:00
uint16 numRows = in . readUint16BE ( ) ;
2010-08-17 09:28:20 +00:00
if ( varnt = = _gameVariant ) {
resArray = ( uint16 * * ) malloc ( sizeof ( uint16 * ) * ( numRows + 1 ) ) ;
resArray [ numRows ] = 0 ;
}
for ( int i = 0 ; i < numRows ; i + + ) {
2010-10-03 08:08:42 +00:00
uint16 numElems = in . readUint16BE ( ) ;
2010-08-17 09:28:20 +00:00
if ( varnt = = _gameVariant ) {
2010-10-03 08:08:42 +00:00
uint16 * resRow = ( uint16 * ) malloc ( sizeof ( uint16 ) * numElems ) ;
2010-08-17 09:28:20 +00:00
for ( int j = 0 ; j < numElems ; j + + )
resRow [ j ] = in . readUint16BE ( ) ;
resArray [ i ] = resRow ;
} else {
for ( int j = 0 ; j < numElems ; j + + )
2010-10-03 08:08:42 +00:00
in . readUint16BE ( ) ;
2010-08-17 09:28:20 +00:00
}
}
}
return resArray ;
}
2010-11-01 20:20:21 +00:00
/**
2011-02-11 20:27:48 +00:00
* Sets the playlist to be the default tune selection
*/
2011-01-23 00:05:52 +00:00
void HugoEngine : : initPlaylist ( bool playlist [ kMaxTunes ] ) {
2010-10-15 06:16:27 +00:00
debugC ( 1 , kDebugEngine , " initPlaylist " ) ;
2011-01-23 00:05:52 +00:00
for ( int16 i = 0 ; i < kMaxTunes ; i + + )
2010-10-15 06:16:27 +00:00
playlist [ i ] = false ;
for ( int16 i = 0 ; _defltTunes [ i ] ! = - 1 ; i + + )
playlist [ _defltTunes [ i ] ] = true ;
}
2010-11-01 20:20:21 +00:00
/**
2011-02-11 20:27:48 +00:00
* Initialize the dynamic game status
*/
2010-10-15 06:16:27 +00:00
void HugoEngine : : initStatus ( ) {
debugC ( 1 , kDebugEngine , " initStatus " ) ;
_status . storyModeFl = false ; // Not in story mode
_status . gameOverFl = false ; // Hero not knobbled yet
_status . textBoxFl = false ; // Not processing a text box
_status . lookFl = false ; // Toolbar "look" button
_status . recallFl = false ; // Toolbar "recall" button
_status . newScreenFl = false ; // Screen not just loaded
_status . godModeFl = false ; // No special cheats allowed
_status . doQuitFl = false ;
2011-01-09 22:42:56 +00:00
_status . skipIntroFl = false ;
2010-10-15 06:16:27 +00:00
// Initialize every start of new game
_status . tick = 0 ; // Tick count
2011-01-23 00:05:52 +00:00
_status . viewState = kViewIdle ; // View state
2010-11-26 23:17:16 +00:00
// Strangerke - Suppress as related to playback
// _status.recordFl = false; // Not record mode
// _status.playbackFl = false; // Not playback mode
// Strangerke - Not used ?
// _status.mmtime = false; // Multimedia timer support
2011-02-08 20:52:26 +00:00
// _status.helpFl = false; // Not calling WinHelp()
// _status.demoFl = false; // Not demo mode
// _status.path[0] = 0; // Path to write files
2010-11-26 23:17:16 +00:00
// _status.screenWidth = 0; // Desktop screen width
// _status.saveTick = 0; // Time of last save
2010-11-29 17:42:08 +00:00
// _status.saveSlot = 0; // Slot to save/restore game
2010-10-15 06:16:27 +00:00
}
2010-11-01 20:20:21 +00:00
/**
2011-02-11 20:27:48 +00:00
* Initialize default config values . Must be done before Initialize ( ) .
*/
2011-01-23 00:05:52 +00:00
void HugoEngine : : initConfig ( ) {
debugC ( 1 , kDebugEngine , " initConfig() " ) ;
_config . musicFl = true ; // Music state initially on
_config . soundFl = true ; // Sound state initially on
_config . turboFl = false ; // Turbo state initially off
initPlaylist ( _config . playlist ) ; // Initialize default tune playlist
_file - > readBootFile ( ) ; // Read startup structure
}
/**
2011-02-11 20:27:48 +00:00
* Reset config parts . Currently only reset music played based on playlist
*/
2011-01-23 00:05:52 +00:00
void HugoEngine : : resetConfig ( ) {
debugC ( 1 , kDebugEngine , " resetConfig() " ) ;
// Find first tune and play it
for ( int16 i = 0 ; i < kMaxTunes ; i + + ) {
if ( _config . playlist [ i ] ) {
_sound - > playMusic ( i ) ;
break ;
2010-10-15 06:16:27 +00:00
}
}
}
void HugoEngine : : initialize ( ) {
debugC ( 1 , kDebugEngine , " initialize " ) ;
_maze . enabledFl = false ;
_line [ 0 ] = ' \0 ' ;
2010-10-21 17:09:57 +00:00
_sound - > initSound ( ) ;
_scheduler - > initEventQueue ( ) ; // Init scheduler stuff
_screen - > initDisplay ( ) ; // Create Dibs and palette
_file - > openDatabaseFiles ( ) ; // Open database files
2010-10-15 06:16:27 +00:00
calcMaxScore ( ) ; // Initialise maxscore
_rnd = new Common : : RandomSource ( ) ;
g_eventRec . registerRandomSource ( * _rnd , " hugo " ) ;
_rnd - > setSeed ( 42 ) ; // Kick random number generator
2010-11-07 22:10:29 +00:00
switch ( _gameVariant ) {
case kGameVariantH1Dos :
_episode = " \" Hugo's House of Horrors \" " ;
2011-01-31 18:22:20 +00:00
_picDir = " " ;
2010-11-07 22:10:29 +00:00
break ;
case kGameVariantH2Dos :
2010-12-08 20:51:44 +00:00
_episode = " \" Hugo II: Whodunit? \" " ;
2011-01-31 18:22:20 +00:00
_picDir = " " ;
2010-11-07 22:10:29 +00:00
break ;
case kGameVariantH3Dos :
_episode = " \" Hugo III: Jungle of Doom \" " ;
2011-01-31 18:22:20 +00:00
_picDir = " pictures/ " ;
2010-11-07 22:10:29 +00:00
break ;
case kGameVariantH1Win :
_episode = " \" Hugo's Horrific Adventure \" " ;
2011-01-31 18:22:20 +00:00
_picDir = " hugo1/ " ;
2010-10-15 06:16:27 +00:00
break ;
2010-11-07 22:10:29 +00:00
case kGameVariantH2Win :
2010-10-15 06:16:27 +00:00
_episode = " \" Hugo's Mystery Adventure \" " ;
2011-01-31 18:22:20 +00:00
_picDir = " hugo2/ " ;
2010-10-15 06:16:27 +00:00
break ;
2010-11-07 22:10:29 +00:00
case kGameVariantH3Win :
2010-10-15 06:16:27 +00:00
_episode = " \" Hugo's Amazon Adventure \" " ;
2011-01-31 18:22:20 +00:00
_picDir = " hugo3/ " ;
2010-10-15 06:16:27 +00:00
break ;
default :
error ( " Unknown game " ) ;
}
}
2010-11-01 20:20:21 +00:00
/**
2011-02-11 20:27:48 +00:00
* Restore all resources before termination
*/
2010-10-15 06:16:27 +00:00
void HugoEngine : : shutdown ( ) {
debugC ( 1 , kDebugEngine , " shutdown " ) ;
2010-10-21 17:09:57 +00:00
_file - > closeDatabaseFiles ( ) ;
_object - > freeObjects ( ) ;
2010-10-15 06:16:27 +00:00
}
2010-11-01 20:20:21 +00:00
/**
2011-02-11 20:27:48 +00:00
* Read scenery , overlay files for given screen number
*/
2011-02-02 21:12:51 +00:00
void HugoEngine : : readScreenFiles ( const int screenNum ) {
2010-10-15 06:16:27 +00:00
debugC ( 1 , kDebugEngine , " readScreenFiles(%d) " , screenNum ) ;
2010-10-21 17:09:57 +00:00
_file - > readBackground ( screenNum ) ; // Scenery file
2011-01-23 00:05:52 +00:00
memcpy ( _screen - > getBackBuffer ( ) , _screen - > getFrontBuffer ( ) , sizeof ( _screen - > getFrontBuffer ( ) ) ) ; // Make a copy
2011-02-11 07:12:29 +00:00
_file - > readOverlay ( screenNum , _object - > _boundary , kOvlBoundary ) ; // Boundary file
_file - > readOverlay ( screenNum , _object - > _overlay , kOvlOverlay ) ; // Overlay file
_file - > readOverlay ( screenNum , _object - > _ovlBase , kOvlBase ) ; // Overlay base file
2011-01-18 09:16:52 +00:00
2011-01-18 18:26:33 +00:00
// Suppress a boundary used in H3 DOS in 'Crash' screen, which blocks
// pathfinding and is useless.
if ( ( screenNum = = 0 ) & & ( _gameVariant = = kGameVariantH3Dos ) )
2011-02-11 07:12:29 +00:00
_object - > clearScreenBoundary ( 50 , 311 , 152 ) ;
2011-01-18 09:16:52 +00:00
}
2010-11-01 20:20:21 +00:00
/**
2011-02-11 20:27:48 +00:00
* Search background command list for this screen for supplied object .
* Return first associated verb ( not " look " ) or 0 if none found .
*/
2011-02-12 08:13:35 +00:00
const char * HugoEngine : : useBG ( const char * name ) {
2010-10-15 06:16:27 +00:00
debugC ( 1 , kDebugEngine , " useBG(%s) " , name ) ;
objectList_t p = _backgroundObjects [ * _screen_p ] ;
2011-01-02 21:32:56 +00:00
for ( int i = 0 ; p [ i ] . verbIndex ! = 0 ; i + + ) {
2011-01-25 00:32:48 +00:00
if ( ( name = = _text - > getNoun ( p [ i ] . nounIndex , 0 ) & &
2010-10-15 06:16:27 +00:00
p [ i ] . verbIndex ! = _look ) & &
2011-01-23 00:05:52 +00:00
( ( p [ i ] . roomState = = kStateDontCare ) | | ( p [ i ] . roomState = = _screenStates [ * _screen_p ] ) ) )
2011-01-25 00:32:48 +00:00
return _text - > getVerb ( p [ i ] . verbIndex , 0 ) ;
2010-10-15 06:16:27 +00:00
}
return 0 ;
}
2010-11-01 20:20:21 +00:00
/**
2011-02-11 20:27:48 +00:00
* Add action lists for this screen to event queue
*/
2011-02-02 21:12:51 +00:00
void HugoEngine : : screenActions ( const int screenNum ) {
2010-10-15 06:16:27 +00:00
debugC ( 1 , kDebugEngine , " screenActions(%d) " , screenNum ) ;
uint16 * screenAct = _screenActs [ screenNum ] ;
if ( screenAct ) {
for ( int i = 0 ; screenAct [ i ] ; i + + )
2010-10-21 17:09:57 +00:00
_scheduler - > insertActionList ( screenAct [ i ] ) ;
2010-10-15 06:16:27 +00:00
}
}
2010-11-01 20:20:21 +00:00
/**
2011-02-11 20:27:48 +00:00
* Set the new screen number into the hero object and any carried objects
*/
2011-02-02 21:12:51 +00:00
void HugoEngine : : setNewScreen ( const int screenNum ) {
2010-10-15 06:16:27 +00:00
debugC ( 1 , kDebugEngine , " setNewScreen(%d) " , screenNum ) ;
2010-11-01 20:20:21 +00:00
* _screen_p = screenNum ; // HERO object
2010-11-11 23:04:04 +00:00
_object - > setCarriedScreen ( screenNum ) ; // Carried objects
2010-10-15 06:16:27 +00:00
}
2010-11-01 20:20:21 +00:00
/**
2011-02-11 20:27:48 +00:00
* Add up all the object values and all the bonus points
*/
2010-10-15 06:16:27 +00:00
void HugoEngine : : calcMaxScore ( ) {
debugC ( 1 , kDebugEngine , " calcMaxScore " ) ;
2010-11-11 23:04:04 +00:00
_maxscore = _object - > calcMaxScore ( ) ;
2010-10-15 06:16:27 +00:00
for ( int i = 0 ; i < _numBonuses ; i + + )
_maxscore + = _points [ i ] . score ;
}
2010-11-01 20:20:21 +00:00
/**
2011-02-11 20:27:48 +00:00
* Exit game , advertise trilogy , show copyright
*/
2010-10-15 06:16:27 +00:00
void HugoEngine : : endGame ( ) {
debugC ( 1 , kDebugEngine , " endGame " ) ;
if ( ! _boot . registered )
2011-01-25 00:32:48 +00:00
Utils : : Box ( kBoxAny , " %s " , _text - > getTextEngine ( kEsAdvertise ) ) ;
2011-01-23 22:51:12 +00:00
Utils : : Box ( kBoxAny , " %s \n %s " , _episode , getCopyrightString ( ) ) ;
2011-01-23 00:05:52 +00:00
_status . viewState = kViewExit ;
2010-10-15 06:16:27 +00:00
}
2011-02-07 22:58:22 +00:00
bool HugoEngine : : canLoadGameStateCurrently ( ) {
2010-11-29 17:42:08 +00:00
return true ;
}
2011-02-07 22:58:22 +00:00
bool HugoEngine : : canSaveGameStateCurrently ( ) {
2011-01-23 00:05:52 +00:00
return ( _status . viewState = = kViewPlay ) ;
2010-11-29 17:42:08 +00:00
}
2011-02-02 21:12:51 +00:00
int8 HugoEngine : : getTPS ( ) const {
2011-01-23 00:05:52 +00:00
return ( ( _config . turboFl ) ? kTurboTps : _normalTPS ) ;
2010-12-12 07:40:00 +00:00
}
2010-12-22 22:25:52 +00:00
void HugoEngine : : syncSoundSettings ( ) {
Engine : : syncSoundSettings ( ) ;
_sound - > syncVolume ( ) ;
}
2011-02-12 08:13:35 +00:00
Common : : String HugoEngine : : getSavegameFilename ( int slot ) {
return _targetName + Common : : String : : format ( " -%02d.SAV " , slot ) ;
}
2010-12-22 22:25:52 +00:00
2010-08-17 09:28:20 +00:00
} // End of namespace Hugo