From ec559360ab48b2c1044dd36ae54e01d9a180055c Mon Sep 17 00:00:00 2001 From: strangerke Date: Fri, 18 Feb 2011 22:24:32 +0100 Subject: HUGO: Move several short function bodies from headers to cpp files --- engines/hugo/display.cpp | 20 +++++++++++++++++ engines/hugo/display.h | 24 +++++---------------- engines/hugo/file.cpp | 27 +++++++++++++++++++++++ engines/hugo/file.h | 12 +++++------ engines/hugo/hugo.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++++ engines/hugo/hugo.h | 44 +++++++++++--------------------------- engines/hugo/intro.cpp | 4 ++++ engines/hugo/intro.h | 2 +- engines/hugo/inventory.cpp | 20 +++++++++++++++++ engines/hugo/inventory.h | 10 ++++----- engines/hugo/menu.cpp | 2 +- engines/hugo/mouse.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++++ engines/hugo/mouse.h | 30 +++++++++++++------------- engines/hugo/object.cpp | 35 ++++++++++++++++++++++++++++++ engines/hugo/object.h | 29 +++++++------------------ engines/hugo/parser.cpp | 8 +++++-- engines/hugo/parser.h | 2 +- engines/hugo/parser_v1d.cpp | 9 ++++---- engines/hugo/parser_v1w.cpp | 4 ++-- engines/hugo/parser_v2d.cpp | 7 +++--- engines/hugo/parser_v3d.cpp | 4 ++-- engines/hugo/route.cpp | 8 +++++++ engines/hugo/route.h | 4 ++-- engines/hugo/sound.cpp | 24 +++++++++++++++++++++ engines/hugo/sound.h | 13 ++++++------ engines/hugo/text.cpp | 48 +++++++++++++++++++++++++++++++++++++++++ engines/hugo/text.h | 24 ++++++++++----------- engines/hugo/util.cpp | 7 ------ engines/hugo/util.h | 1 - 29 files changed, 382 insertions(+), 143 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp index fffa5b207d..3bc283acba 100644 --- a/engines/hugo/display.cpp +++ b/engines/hugo/display.cpp @@ -105,6 +105,26 @@ Screen::Screen(HugoEngine *vm) : _vm(vm) { Screen::~Screen() { } +icondib_t &Screen::getIconBuffer() { + return _iconBuffer; +} + +viewdib_t &Screen::getBackBuffer() { + return _backBuffer; +} + +viewdib_t &Screen::getBackBufferBackup() { + return _backBufferBackup; +} + +viewdib_t &Screen::getFrontBuffer() { + return _frontBuffer; +} + +viewdib_t &Screen::getGUIBuffer() { + return _GUIBuffer; +} + /** * Replace the palette by the main palette */ diff --git a/engines/hugo/display.h b/engines/hugo/display.h index 8c504cead4..f234f76019 100644 --- a/engines/hugo/display.h +++ b/engines/hugo/display.h @@ -83,25 +83,11 @@ public: void userHelp() const; void writeStr(int16 sx, const int16 sy, const char *s, const byte color); - icondib_t &getIconBuffer() { - return _iconBuffer; - } - - viewdib_t &getBackBuffer() { - return _backBuffer; - } - - viewdib_t &getBackBufferBackup() { - return _backBufferBackup; - } - - viewdib_t &getFrontBuffer() { - return _frontBuffer; - } - - viewdib_t &getGUIBuffer() { - return _GUIBuffer; - } + icondib_t &getIconBuffer(); + viewdib_t &getBackBuffer(); + viewdib_t &getBackBufferBackup(); + viewdib_t &getFrontBuffer(); + viewdib_t &getGUIBuffer(); protected: HugoEngine *_vm; diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index a0602f0636..cf16e4086d 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -54,6 +54,33 @@ FileManager::FileManager(HugoEngine *vm) : _vm(vm) { FileManager::~FileManager() { } +/** + * Name scenery and objects picture databases + */ +const char *FileManager::getBootFilename() const { + return "HUGO.BSF"; +} + +const char *FileManager::getObjectFilename() const { + return "objects.dat"; +} + +const char *FileManager::getSceneryFilename() const { + return "scenery.dat"; +} + +const char *FileManager::getSoundFilename() const { + return "sounds.dat"; +} + +const char *FileManager::getStringFilename() const { + return "strings.dat"; +} + +const char *FileManager::getUifFilename() const { + return "uif.dat"; +} + /** * Convert 4 planes (RGBI) data to 8-bit DIB format * Return original plane data ptr diff --git a/engines/hugo/file.h b/engines/hugo/file.h index f62c78e580..46dcabd108 100644 --- a/engines/hugo/file.h +++ b/engines/hugo/file.h @@ -54,12 +54,12 @@ public: bool saveGame(const int16 slot, const Common::String &descrip); // Name scenery and objects picture databases - const char *getBootFilename() const { return "HUGO.BSF"; } - const char *getObjectFilename() const { return "objects.dat"; } - const char *getSceneryFilename() const { return "scenery.dat"; } - const char *getSoundFilename() const { return "sounds.dat"; } - const char *getStringFilename() const { return "strings.dat"; } - const char *getUifFilename() const { return "uif.dat"; } + const char *getBootFilename() const; + const char *getObjectFilename() const; + const char *getSceneryFilename() const; + const char *getSoundFilename() const; + const char *getStringFilename() const; + const char *getUifFilename() const; virtual void openDatabaseFiles() = 0; virtual void closeDatabaseFiles() = 0; diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index 831fd36a9f..23183dff6c 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -107,6 +107,50 @@ HugoEngine::~HugoEngine() { delete _rnd; } +GUI::Debugger *HugoEngine::getDebugger() { + return _console; +} + +status_t &HugoEngine::getGameStatus() { + return _status; +} + +int HugoEngine::getScore() const { + return _score; +} + +void HugoEngine::setScore(const int newScore) { + _score = newScore; +} + +void HugoEngine::adjustScore(const int adjustment) { + _score += adjustment; +} + +int HugoEngine::getMaxScore() const { + return _maxscore; +} + +void HugoEngine::setMaxScore(const int newScore) { + _maxscore = newScore; +} + +Common::Error HugoEngine::saveGameState(int slot, const char *desc) { + return (_file->saveGame(slot, desc) ? Common::kWritingFailed : Common::kNoError); +} + +Common::Error HugoEngine::loadGameState(int slot) { + return (_file->restoreGame(slot) ? Common::kReadingFailed : Common::kNoError); +} + +bool HugoEngine::hasFeature(EngineFeature f) const { + return (f == kSupportsRTL) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime); +} + +const char *HugoEngine::getCopyrightString() const { + return "Copyright 1989-1997 David P Gray, All Rights Reserved."; +} + GameType HugoEngine::getGameType() const { return _gameType; } @@ -119,6 +163,13 @@ bool HugoEngine::isPacked() const { return _packedFl; } +/** + * Print options for user when dead + */ +void HugoEngine::gameOverMsg() { + Utils::Box(kBoxOk, "%s", _text->getTextUtil(kGameOver)); +} + Common::Error HugoEngine::run() { s_Engine = this; initGraphics(320, 200, false); diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h index 848001c4ef..239b20fab5 100644 --- a/engines/hugo/hugo.h +++ b/engines/hugo/hugo.h @@ -251,7 +251,7 @@ public: uint16 _take; uint16 _drop; - GUI::Debugger *getDebugger() { return _console; } + GUI::Debugger *getDebugger(); Common::RandomSource *_rnd; @@ -284,43 +284,23 @@ public: void initGame(const HugoGameDescription *gd); void initGamePart(const HugoGameDescription *gd); void endGame(); + void gameOverMsg(); void initStatus(); void readScreenFiles(const int screen); void setNewScreen(const int screen); void shutdown(); void syncSoundSettings(); - status_t &getGameStatus() { - return _status; - } - int getScore() const { - return _score; - } - void setScore(const int newScore) { - _score = newScore; - } - void adjustScore(const int adjustment) { - _score += adjustment; - } - int getMaxScore() const { - return _maxscore; - } - void setMaxScore(const int newScore) { - _maxscore = newScore; - } - Common::Error saveGameState(int slot, const char *desc) { - return (_file->saveGame(slot, desc) ? Common::kWritingFailed : Common::kNoError); - } - - Common::Error loadGameState(int slot) { - return (_file->restoreGame(slot) ? Common::kReadingFailed : Common::kNoError); - } - - bool hasFeature(EngineFeature f) const { - return (f == kSupportsRTL) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime); - } - - const char *getCopyrightString() const { return "Copyright 1989-1997 David P Gray, All Rights Reserved."; } + status_t &getGameStatus(); + 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 char *desc); + Common::Error loadGameState(int slot); + bool hasFeature(EngineFeature f) const; + const char *getCopyrightString() const; Common::String getSavegameFilename(int slot); uint16 **loadLongArray(Common::SeekableReadStream &in); diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp index 3a11baf620..080fbc8f8d 100644 --- a/engines/hugo/intro.cpp +++ b/engines/hugo/intro.cpp @@ -48,6 +48,10 @@ IntroHandler::IntroHandler(HugoEngine *vm) : _vm(vm), _introX(0), _introY(0) { IntroHandler::~IntroHandler() { } +byte IntroHandler::getIntroSize() const { + return _introXSize; +} + /** * Read _introX and _introY from hugo.dat */ diff --git a/engines/hugo/intro.h b/engines/hugo/intro.h index c743475644..772d98e244 100644 --- a/engines/hugo/intro.h +++ b/engines/hugo/intro.h @@ -57,7 +57,7 @@ public: void freeIntroData(); void loadIntroData(Common::SeekableReadStream &in); - byte getIntroSize() const { return _introXSize; } + byte getIntroSize() const; protected: HugoEngine *_vm; diff --git a/engines/hugo/inventory.cpp b/engines/hugo/inventory.cpp index 7862805d8b..7cd025025d 100644 --- a/engines/hugo/inventory.cpp +++ b/engines/hugo/inventory.cpp @@ -54,6 +54,26 @@ InventoryHandler::InventoryHandler(HugoEngine *vm) : _vm(vm), _invent(0) { _maxInvent = 0; } +void InventoryHandler::setInventoryObjId(int16 objId) { + _inventoryObjId = objId; +} + +void InventoryHandler::setInventoryState(istate_t state) { + _inventoryState = state; +} + +void InventoryHandler::freeInvent() { + free(_invent); +} + +int16 InventoryHandler::getInventoryObjId() const { + return _inventoryObjId; +} + +istate_t InventoryHandler::getInventoryState() const { + return _inventoryState; +} + /** * Read _invent from Hugo.dat */ diff --git a/engines/hugo/inventory.h b/engines/hugo/inventory.h index 7b1390a3ce..ec102f3cce 100644 --- a/engines/hugo/inventory.h +++ b/engines/hugo/inventory.h @@ -43,12 +43,12 @@ class InventoryHandler { public: InventoryHandler(HugoEngine *vm); - void setInventoryObjId(int16 objId) { _inventoryObjId = objId; } - void setInventoryState(istate_t state) { _inventoryState = state; } - void freeInvent() { free(_invent); } + void setInventoryObjId(int16 objId); + void setInventoryState(istate_t state); + void freeInvent(); - int16 getInventoryObjId() const { return _inventoryObjId; } - istate_t getInventoryState() const { return _inventoryState; } + int16 getInventoryObjId() const; + istate_t getInventoryState() const; int16 findIconId(int16 objId); void loadInvent(Common::SeekableReadStream &in); diff --git a/engines/hugo/menu.cpp b/engines/hugo/menu.cpp index 065d68bdc5..21c438bbbc 100644 --- a/engines/hugo/menu.cpp +++ b/engines/hugo/menu.cpp @@ -188,7 +188,7 @@ void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 d close(); if (_vm->getGameStatus().viewState == kViewPlay) { if (_vm->getGameStatus().gameOverFl) - Utils::gameOverMsg(); + _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); } diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp index 3464fea869..0bbc74e992 100644 --- a/engines/hugo/mouse.cpp +++ b/engines/hugo/mouse.cpp @@ -55,6 +55,58 @@ MouseHandler::MouseHandler(HugoEngine *vm) : _vm(vm) { _mouseY = kYPix / 2; } +void MouseHandler::resetLeftButton() { + _leftButtonFl = false; +} + +void MouseHandler::resetRightButton() { + _rightButtonFl = false; +} + +void MouseHandler::setLeftButton() { + _leftButtonFl = true; +} + +void MouseHandler::setRightButton() { + _rightButtonFl = true; +} + +void MouseHandler::setJumpExitFl(bool fl) { + _jumpExitFl = fl; +} + +void MouseHandler::setMouseX(int x) { + _mouseX = x; +} + +void MouseHandler::setMouseY(int y) { + _mouseY = y; +} + +void MouseHandler::freeHotspots() { + free(_hotspots); +} + +bool MouseHandler::getJumpExitFl() const { + return _jumpExitFl; +} + +int MouseHandler::getMouseX() const { + return _mouseX; +} + +int MouseHandler::getMouseY() const { + return _mouseY; +} + +int16 MouseHandler::getDirection(const int16 hotspotId) const { + return _hotspots[hotspotId].direction; +} + +int16 MouseHandler::getHotspotActIndex(const int16 hotspotId) const { + return _hotspots[hotspotId].actIndex; +} + /** * Shadow-blit supplied string into dib_a at cx,cy and add to display list */ diff --git a/engines/hugo/mouse.h b/engines/hugo/mouse.h index d43ca054dd..ae1974b726 100644 --- a/engines/hugo/mouse.h +++ b/engines/hugo/mouse.h @@ -39,21 +39,21 @@ public: MouseHandler(HugoEngine *vm); void mouseHandler(); - void resetLeftButton() { _leftButtonFl = false; } - void resetRightButton() { _rightButtonFl = false; } - void setLeftButton() { _leftButtonFl = true; } - void setRightButton() { _rightButtonFl = true; } - void setJumpExitFl(bool fl) { _jumpExitFl = fl; } - void setMouseX(int x) { _mouseX = x; } - void setMouseY(int y) { _mouseY = y; } - void freeHotspots() { free(_hotspots); } - - bool getJumpExitFl() const { return _jumpExitFl; } - int getMouseX() const { return _mouseX; } - int getMouseY() const { return _mouseY; } - - int16 getDirection(const int16 hotspotId) const { return _hotspots[hotspotId].direction; } - int16 getHotspotActIndex(const int16 hotspotId) const { return _hotspots[hotspotId].actIndex; } + void resetLeftButton(); + void resetRightButton(); + void setLeftButton(); + void setRightButton(); + void setJumpExitFl(bool fl); + void setMouseX(int x); + void setMouseY(int y); + void freeHotspots(); + + bool getJumpExitFl() const; + int getMouseX() const; + int getMouseY() const; + + int16 getDirection(const int16 hotspotId) const; + int16 getHotspotActIndex(const int16 hotspotId) const; void drawHotspots() const; int16 findExit(const int16 cx, const int16 cy, byte screenId); diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp index f9364a8781..386689bf5e 100644 --- a/engines/hugo/object.cpp +++ b/engines/hugo/object.cpp @@ -61,6 +61,41 @@ ObjectHandler::ObjectHandler(HugoEngine *vm) : _vm(vm), _objects(0), _uses(0) { ObjectHandler::~ObjectHandler() { } +byte ObjectHandler::getBoundaryOverlay(uint16 index) const { + return _boundary[index]; +} + +byte ObjectHandler::getObjectBoundary(uint16 index) const { + return _objBound[index]; +} + +byte ObjectHandler::getBaseBoundary(uint16 index) const { + return _ovlBase[index]; +} + +byte ObjectHandler::getFirstOverlay(uint16 index) const { + return _overlay[index]; +} + +bool ObjectHandler::isCarried(int objIndex) const { + return _objects[objIndex].carriedFl; +} + +void ObjectHandler::setCarry(int objIndex, bool val) { + _objects[objIndex].carriedFl = val; +} + +void ObjectHandler::setVelocity(int objIndex, int8 vx, int8 vy) { + _objects[objIndex].vx = vx; + _objects[objIndex].vy = vy; +} + +void ObjectHandler::setPath(int objIndex, path_t pathType, int16 vxPath, int16 vyPath) { + _objects[objIndex].pathType = pathType; + _objects[objIndex].vxPath = vxPath; + _objects[objIndex].vyPath = vyPath; +} + /** * Save sequence number and image number in given object */ diff --git a/engines/hugo/object.h b/engines/hugo/object.h index dc69411bfa..a3b1ecb56a 100644 --- a/engines/hugo/object.h +++ b/engines/hugo/object.h @@ -50,10 +50,10 @@ public: object_t *_objects; uint16 _numObj; - byte getBoundaryOverlay(uint16 index) const { return _boundary[index]; } - byte getObjectBoundary(uint16 index) const { return _objBound[index]; } - byte getBaseBoundary(uint16 index) const { return _ovlBase[index]; } - byte getFirstOverlay(uint16 index) const { return _overlay[index]; } + byte getBoundaryOverlay(uint16 index) const; + byte getObjectBoundary(uint16 index) const; + byte getBaseBoundary(uint16 index) const; + byte getFirstOverlay(uint16 index) const; int deltaX(const int x1, const int x2, const int vx, int y) const; int deltaY(const int x1, const int x2, const int vy, const int y) const; @@ -90,24 +90,11 @@ public: static int y2comp(const void *a, const void *b); - bool isCarried(int objIndex) { - return _objects[objIndex].carriedFl; - } + bool isCarried(int objIndex) const; + void setCarry(int objIndex, bool val); + void setVelocity(int objIndex, int8 vx, int8 vy); + void setPath(int objIndex, path_t pathType, int16 vxPath, int16 vyPath); - void setCarry(int objIndex, bool val) { - _objects[objIndex].carriedFl = val; - } - - void setVelocity(int objIndex, int8 vx, int8 vy) { - _objects[objIndex].vx = vx; - _objects[objIndex].vy = vy; - } - - void setPath(int objIndex, path_t pathType, int16 vxPath, int16 vyPath) { - _objects[objIndex].pathType = pathType; - _objects[objIndex].vxPath = vxPath; - _objects[objIndex].vyPath = vyPath; - } protected: HugoEngine *_vm; diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index 2d5f6c99bb..d034da62cd 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -64,6 +64,10 @@ Parser::Parser(HugoEngine *vm) : _vm(vm), _putIndex(0), _getIndex(0), _arrayReqs Parser::~Parser() { } +uint16 Parser::getCmdDefaultVerbIdx(const uint16 index) const { + return _cmdList[index][0].verbIndex; +} + /** * Read a cmd structure from Hugo.dat */ @@ -291,7 +295,7 @@ void Parser::keyHandler(Common::Event event) { case Common::KEYCODE_s: if (gameStatus.viewState == kViewPlay) { if (gameStatus.gameOverFl) - Utils::gameOverMsg(); + _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); } @@ -349,7 +353,7 @@ void Parser::keyHandler(Common::Event event) { case Common::KEYCODE_F4: // Save game if (gameStatus.viewState == kViewPlay) { if (gameStatus.gameOverFl) - Utils::gameOverMsg(); + _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); } diff --git a/engines/hugo/parser.h b/engines/hugo/parser.h index 41b40f0527..33851d6a2c 100644 --- a/engines/hugo/parser.h +++ b/engines/hugo/parser.h @@ -49,7 +49,7 @@ public: bool isWordPresent(char **wordArr) const; - uint16 getCmdDefaultVerbIdx(const uint16 index) const { return _cmdList[index][0].verbIndex; } + uint16 getCmdDefaultVerbIdx(const uint16 index) const; void charHandler(); void command(const char *format, ...); diff --git a/engines/hugo/parser_v1d.cpp b/engines/hugo/parser_v1d.cpp index 5796749354..007924904f 100644 --- a/engines/hugo/parser_v1d.cpp +++ b/engines/hugo/parser_v1d.cpp @@ -372,7 +372,7 @@ void Parser_v1d::lineHandler() { // SAVE/RESTORE if (!strcmp("save", _vm->_line)) { if (gameStatus.gameOverFl) - Utils::gameOverMsg(); + _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); return; @@ -391,8 +391,9 @@ void Parser_v1d::lineHandler() { if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces! return; - if (gameStatus.gameOverFl) { // No commands allowed! - Utils::gameOverMsg(); + if (gameStatus.gameOverFl) { + // No commands allowed! + _vm->gameOverMsg(); return; } @@ -430,7 +431,7 @@ void Parser_v1d::showInventory() const { status_t &gameStatus = _vm->getGameStatus(); if (gameStatus.viewState == kViewPlay) { if (gameStatus.gameOverFl) - Utils::gameOverMsg(); + _vm->gameOverMsg(); else showDosInventory(); } diff --git a/engines/hugo/parser_v1w.cpp b/engines/hugo/parser_v1w.cpp index ad00549dcc..4b55f7977a 100644 --- a/engines/hugo/parser_v1w.cpp +++ b/engines/hugo/parser_v1w.cpp @@ -145,7 +145,7 @@ void Parser_v1w::lineHandler() { if (gameStatus.gameOverFl) { // No commands allowed! - Utils::gameOverMsg(); + _vm->gameOverMsg(); return; } @@ -209,7 +209,7 @@ void Parser_v1w::showInventory() const { status_t &gameStatus = _vm->getGameStatus(); istate_t inventState = _vm->_inventory->getInventoryState(); if (gameStatus.gameOverFl) { - Utils::gameOverMsg(); + _vm->gameOverMsg(); } else if ((inventState == kInventoryOff) && (gameStatus.viewState == kViewPlay)) { _vm->_inventory->setInventoryState(kInventoryDown); gameStatus.viewState = kViewInvent; diff --git a/engines/hugo/parser_v2d.cpp b/engines/hugo/parser_v2d.cpp index c963441481..d87ae59416 100644 --- a/engines/hugo/parser_v2d.cpp +++ b/engines/hugo/parser_v2d.cpp @@ -123,7 +123,7 @@ void Parser_v2d::lineHandler() { if (!strcmp("save", _vm->_line)) { _vm->_config.soundFl = false; if (gameStatus.gameOverFl) - Utils::gameOverMsg(); + _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); return; @@ -143,8 +143,9 @@ void Parser_v2d::lineHandler() { if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces! return; - if (gameStatus.gameOverFl) { // No commands allowed! - Utils::gameOverMsg(); + if (gameStatus.gameOverFl) { + // No commands allowed! + _vm->gameOverMsg(); return; } diff --git a/engines/hugo/parser_v3d.cpp b/engines/hugo/parser_v3d.cpp index 670f6efb73..3c1eefe732 100644 --- a/engines/hugo/parser_v3d.cpp +++ b/engines/hugo/parser_v3d.cpp @@ -125,7 +125,7 @@ void Parser_v3d::lineHandler() { if (!strcmp("save", _vm->_line)) { _vm->_config.soundFl = false; if (gameStatus.gameOverFl) - Utils::gameOverMsg(); + _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); return; @@ -147,7 +147,7 @@ void Parser_v3d::lineHandler() { if (gameStatus.gameOverFl) { // No commands allowed! - Utils::gameOverMsg(); + _vm->gameOverMsg(); return; } diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp index c122439c70..3bf10d78f4 100644 --- a/engines/hugo/route.cpp +++ b/engines/hugo/route.cpp @@ -49,6 +49,14 @@ Route::Route(HugoEngine *vm) : _vm(vm) { _routeObjId = -1; // Hero not walking to anything } +void Route::resetRoute() { + _routeIndex = -1; +} + +int16 Route::getRouteIndex() const { + return _routeIndex; +} + /** * Face hero in new direction, based on cursor key input by user. */ diff --git a/engines/hugo/route.h b/engines/hugo/route.h index 727c7d77eb..83a36f27ef 100644 --- a/engines/hugo/route.h +++ b/engines/hugo/route.h @@ -54,8 +54,8 @@ class Route { public: Route(HugoEngine *vm); - void resetRoute() {_routeIndex = -1; } - int16 getRouteIndex() const {return _routeIndex; } + void resetRoute(); + int16 getRouteIndex() const; void processRoute(); bool startRoute(const go_t routeType, const int16 objId, int16 cx, int16 cy); diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp index 3fa7e9fd4e..80086b0e5c 100644 --- a/engines/hugo/sound.cpp +++ b/engines/hugo/sound.cpp @@ -63,6 +63,30 @@ MidiPlayer::~MidiPlayer() { close(); } +bool MidiPlayer::isPlaying() const { + return _isPlaying; +} + +int MidiPlayer::getVolume() const { + return _masterVolume; +} + +void MidiPlayer::setLooping(bool loop) { + _isLooping = loop; +} + +MidiChannel *MidiPlayer::allocateChannel() { + return 0; +} + +MidiChannel *MidiPlayer::getPercussionChannel() { + return 0; +} + +uint32 MidiPlayer::getBaseTempo() { + return _driver ? _driver->getBaseTempo() : 0; +} + void MidiPlayer::play(uint8 *stream, uint16 size) { debugC(3, kDebugMusic, "MidiPlayer::play"); if (!stream) { diff --git a/engines/hugo/sound.h b/engines/hugo/sound.h index 1b29ffcef9..49e78a4aeb 100644 --- a/engines/hugo/sound.h +++ b/engines/hugo/sound.h @@ -45,15 +45,14 @@ public: MidiPlayer(MidiDriver *driver); ~MidiPlayer(); - bool isPlaying() { return _isPlaying; } - - int getVolume() { return _masterVolume; } + bool isPlaying() const; + int getVolume() const; void adjustVolume(int diff); void pause(bool p); void play(uint8 *stream, uint16 size); void setChannelVolume(int channel); - void setLooping(bool loop) { _isLooping = loop; } + void setLooping(bool loop); void setVolume(int volume); void stop(); void syncVolume(); @@ -62,15 +61,15 @@ public: // MidiDriver interface int open(); - MidiChannel *allocateChannel() { return 0; } - MidiChannel *getPercussionChannel() { return 0; } + MidiChannel *allocateChannel(); + MidiChannel *getPercussionChannel(); void close(); void metaEvent(byte type, byte *data, uint16 length); void send(uint32 b); void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { } - uint32 getBaseTempo() { return _driver ? _driver->getBaseTempo() : 0; } + uint32 getBaseTempo(); private: static void timerCallback(void *p); diff --git a/engines/hugo/text.cpp b/engines/hugo/text.cpp index 00a485a730..af3338737d 100644 --- a/engines/hugo/text.cpp +++ b/engines/hugo/text.cpp @@ -37,6 +37,54 @@ TextHandler::TextHandler(HugoEngine *vm) : _vm(vm), _textData(0), _stringtData(0 TextHandler::~TextHandler() { } +const char *TextHandler::getNoun(int idx1, int idx2) const { + return _arrayNouns[idx1][idx2]; +} + +const char *TextHandler::getScreenNames(int screenIndex) const { + return _screenNames[screenIndex]; +} + +const char *TextHandler::getStringtData(int stringIndex) const { + return _stringtData[stringIndex]; +} + +const char *TextHandler::getTextData(int textIndex) const { + return _textData[textIndex]; +} + +const char *TextHandler::getTextEngine(int engineIndex) const { + return _textEngine[engineIndex]; +} + +const char *TextHandler::getTextIntro(int introIndex) const { + return _textIntro[introIndex]; +} + +const char *TextHandler::getTextMouse(int mouseIndex) const { + return _textMouse[mouseIndex]; +} + +const char *TextHandler::getTextParser(int parserIndex) const { + return _textParser[parserIndex]; +} + +const char *TextHandler::getTextUtil(int utilIndex) const { + return _textUtil[utilIndex]; +} + +const char *TextHandler::getVerb(int idx1, int idx2) const { + return _arrayVerbs[idx1][idx2]; +} + +char **TextHandler::getNounArray(int idx1) const { + return _arrayNouns[idx1]; +} + +char **TextHandler::getVerbArray(int idx1) const { + return _arrayVerbs[idx1]; +} + char **TextHandler::loadTextsVariante(Common::ReadStream &in, uint16 *arraySize) { int numTexts; int entryLen; diff --git a/engines/hugo/text.h b/engines/hugo/text.h index ec4001567d..0854bf3f6e 100644 --- a/engines/hugo/text.h +++ b/engines/hugo/text.h @@ -32,18 +32,18 @@ public: TextHandler(HugoEngine *vm); ~TextHandler(); - const char *getNoun(int idx1, int idx2) const { return _arrayNouns[idx1][idx2]; } - const char *getScreenNames(int screenIndex) const { return _screenNames[screenIndex]; } - const char *getStringtData(int stringIndex) const { return _stringtData[stringIndex]; } - const char *getTextData(int textIndex) const { return _textData[textIndex]; } - const char *getTextEngine(int engineIndex) const { return _textEngine[engineIndex]; } - const char *getTextIntro(int introIndex) const { return _textIntro[introIndex]; } - const char *getTextMouse(int mouseIndex) const { return _textMouse[mouseIndex]; } - const char *getTextParser(int parserIndex) const { return _textParser[parserIndex]; } - const char *getTextUtil(int utilIndex) const { return _textUtil[utilIndex]; } - const char *getVerb(int idx1, int idx2) const { return _arrayVerbs[idx1][idx2]; } - char **getNounArray(int idx1) const { return _arrayNouns[idx1]; } - char **getVerbArray(int idx1) const { return _arrayVerbs[idx1]; } + const char *getNoun(int idx1, int idx2) const; + const char *getScreenNames(int screenIndex) const; + const char *getStringtData(int stringIndex) const; + const char *getTextData(int textIndex) const; + const char *getTextEngine(int engineIndex) const; + const char *getTextIntro(int introIndex) const; + const char *getTextMouse(int mouseIndex) const; + const char *getTextParser(int parserIndex) const; + const char *getTextUtil(int utilIndex) const; + const char *getVerb(int idx1, int idx2) const; + char **getNounArray(int idx1) const; + char **getVerbArray(int idx1) const; void loadAllTexts(Common::ReadStream &in); void freeAllTexts(); diff --git a/engines/hugo/util.cpp b/engines/hugo/util.cpp index f8f9f5a0a5..f342d4e354 100644 --- a/engines/hugo/util.cpp +++ b/engines/hugo/util.cpp @@ -140,13 +140,6 @@ char *Utils::Box(box_t dismiss, const char *s, ...) { return buffer; } -/** - * Print options for user when dead - */ -void Utils::gameOverMsg(void) { - Utils::Box(kBoxOk, "%s", HugoEngine::get()._text->getTextUtil(kGameOver)); -} - char *Utils::strlwr(char *buffer) { char *result = buffer; diff --git a/engines/hugo/util.h b/engines/hugo/util.h index 84f69858fd..10376c8381 100644 --- a/engines/hugo/util.h +++ b/engines/hugo/util.h @@ -45,7 +45,6 @@ static const int kMaxStrLength = 1024; int firstBit(byte data); int lastBit(byte data); -void gameOverMsg(); void reverseByte(byte *data); char *Box(box_t, const char *, ...) GCC_PRINTF(2, 3); -- cgit v1.2.3