HUGO: Move several short function bodies from headers to cpp files

This commit is contained in:
strangerke 2011-02-18 22:24:32 +01:00
parent a6593c294e
commit ec559360ab
29 changed files with 380 additions and 141 deletions

View file

@ -105,6 +105,26 @@ Screen::Screen(HugoEngine *vm) : _vm(vm) {
Screen::~Screen() { 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 * Replace the palette by the main palette
*/ */

View file

@ -83,25 +83,11 @@ public:
void userHelp() const; void userHelp() const;
void writeStr(int16 sx, const int16 sy, const char *s, const byte color); void writeStr(int16 sx, const int16 sy, const char *s, const byte color);
icondib_t &getIconBuffer() { icondib_t &getIconBuffer();
return _iconBuffer; viewdib_t &getBackBuffer();
} viewdib_t &getBackBufferBackup();
viewdib_t &getFrontBuffer();
viewdib_t &getBackBuffer() { viewdib_t &getGUIBuffer();
return _backBuffer;
}
viewdib_t &getBackBufferBackup() {
return _backBufferBackup;
}
viewdib_t &getFrontBuffer() {
return _frontBuffer;
}
viewdib_t &getGUIBuffer() {
return _GUIBuffer;
}
protected: protected:
HugoEngine *_vm; HugoEngine *_vm;

View file

@ -54,6 +54,33 @@ FileManager::FileManager(HugoEngine *vm) : _vm(vm) {
FileManager::~FileManager() { 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 * Convert 4 planes (RGBI) data to 8-bit DIB format
* Return original plane data ptr * Return original plane data ptr

View file

@ -54,12 +54,12 @@ public:
bool saveGame(const int16 slot, const Common::String &descrip); bool saveGame(const int16 slot, const Common::String &descrip);
// Name scenery and objects picture databases // Name scenery and objects picture databases
const char *getBootFilename() const { return "HUGO.BSF"; } const char *getBootFilename() const;
const char *getObjectFilename() const { return "objects.dat"; } const char *getObjectFilename() const;
const char *getSceneryFilename() const { return "scenery.dat"; } const char *getSceneryFilename() const;
const char *getSoundFilename() const { return "sounds.dat"; } const char *getSoundFilename() const;
const char *getStringFilename() const { return "strings.dat"; } const char *getStringFilename() const;
const char *getUifFilename() const { return "uif.dat"; } const char *getUifFilename() const;
virtual void openDatabaseFiles() = 0; virtual void openDatabaseFiles() = 0;
virtual void closeDatabaseFiles() = 0; virtual void closeDatabaseFiles() = 0;

View file

@ -107,6 +107,50 @@ HugoEngine::~HugoEngine() {
delete _rnd; 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 { GameType HugoEngine::getGameType() const {
return _gameType; return _gameType;
} }
@ -119,6 +163,13 @@ bool HugoEngine::isPacked() const {
return _packedFl; return _packedFl;
} }
/**
* Print options for user when dead
*/
void HugoEngine::gameOverMsg() {
Utils::Box(kBoxOk, "%s", _text->getTextUtil(kGameOver));
}
Common::Error HugoEngine::run() { Common::Error HugoEngine::run() {
s_Engine = this; s_Engine = this;
initGraphics(320, 200, false); initGraphics(320, 200, false);

View file

@ -251,7 +251,7 @@ public:
uint16 _take; uint16 _take;
uint16 _drop; uint16 _drop;
GUI::Debugger *getDebugger() { return _console; } GUI::Debugger *getDebugger();
Common::RandomSource *_rnd; Common::RandomSource *_rnd;
@ -284,43 +284,23 @@ public:
void initGame(const HugoGameDescription *gd); void initGame(const HugoGameDescription *gd);
void initGamePart(const HugoGameDescription *gd); void initGamePart(const HugoGameDescription *gd);
void endGame(); void endGame();
void gameOverMsg();
void initStatus(); void initStatus();
void readScreenFiles(const int screen); void readScreenFiles(const int screen);
void setNewScreen(const int screen); void setNewScreen(const int screen);
void shutdown(); void shutdown();
void syncSoundSettings(); void syncSoundSettings();
status_t &getGameStatus() { status_t &getGameStatus();
return _status; int getScore() const;
} void setScore(const int newScore);
int getScore() const { void adjustScore(const int adjustment);
return _score; int getMaxScore() const;
} void setMaxScore(const int newScore);
void setScore(const int newScore) { Common::Error saveGameState(int slot, const char *desc);
_score = newScore; Common::Error loadGameState(int slot);
} bool hasFeature(EngineFeature f) const;
void adjustScore(const int adjustment) { const char *getCopyrightString() const;
_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."; }
Common::String getSavegameFilename(int slot); Common::String getSavegameFilename(int slot);
uint16 **loadLongArray(Common::SeekableReadStream &in); uint16 **loadLongArray(Common::SeekableReadStream &in);

View file

@ -48,6 +48,10 @@ IntroHandler::IntroHandler(HugoEngine *vm) : _vm(vm), _introX(0), _introY(0) {
IntroHandler::~IntroHandler() { IntroHandler::~IntroHandler() {
} }
byte IntroHandler::getIntroSize() const {
return _introXSize;
}
/** /**
* Read _introX and _introY from hugo.dat * Read _introX and _introY from hugo.dat
*/ */

View file

@ -57,7 +57,7 @@ public:
void freeIntroData(); void freeIntroData();
void loadIntroData(Common::SeekableReadStream &in); void loadIntroData(Common::SeekableReadStream &in);
byte getIntroSize() const { return _introXSize; } byte getIntroSize() const;
protected: protected:
HugoEngine *_vm; HugoEngine *_vm;

View file

@ -54,6 +54,26 @@ InventoryHandler::InventoryHandler(HugoEngine *vm) : _vm(vm), _invent(0) {
_maxInvent = 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 * Read _invent from Hugo.dat
*/ */

View file

@ -43,12 +43,12 @@ class InventoryHandler {
public: public:
InventoryHandler(HugoEngine *vm); InventoryHandler(HugoEngine *vm);
void setInventoryObjId(int16 objId) { _inventoryObjId = objId; } void setInventoryObjId(int16 objId);
void setInventoryState(istate_t state) { _inventoryState = state; } void setInventoryState(istate_t state);
void freeInvent() { free(_invent); } void freeInvent();
int16 getInventoryObjId() const { return _inventoryObjId; } int16 getInventoryObjId() const;
istate_t getInventoryState() const { return _inventoryState; } istate_t getInventoryState() const;
int16 findIconId(int16 objId); int16 findIconId(int16 objId);
void loadInvent(Common::SeekableReadStream &in); void loadInvent(Common::SeekableReadStream &in);

View file

@ -188,7 +188,7 @@ void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 d
close(); close();
if (_vm->getGameStatus().viewState == kViewPlay) { if (_vm->getGameStatus().viewState == kViewPlay) {
if (_vm->getGameStatus().gameOverFl) if (_vm->getGameStatus().gameOverFl)
Utils::gameOverMsg(); _vm->gameOverMsg();
else else
_vm->_file->saveGame(-1, Common::String()); _vm->_file->saveGame(-1, Common::String());
} }

View file

@ -55,6 +55,58 @@ MouseHandler::MouseHandler(HugoEngine *vm) : _vm(vm) {
_mouseY = kYPix / 2; _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 * Shadow-blit supplied string into dib_a at cx,cy and add to display list
*/ */

View file

@ -39,21 +39,21 @@ public:
MouseHandler(HugoEngine *vm); MouseHandler(HugoEngine *vm);
void mouseHandler(); void mouseHandler();
void resetLeftButton() { _leftButtonFl = false; } void resetLeftButton();
void resetRightButton() { _rightButtonFl = false; } void resetRightButton();
void setLeftButton() { _leftButtonFl = true; } void setLeftButton();
void setRightButton() { _rightButtonFl = true; } void setRightButton();
void setJumpExitFl(bool fl) { _jumpExitFl = fl; } void setJumpExitFl(bool fl);
void setMouseX(int x) { _mouseX = x; } void setMouseX(int x);
void setMouseY(int y) { _mouseY = y; } void setMouseY(int y);
void freeHotspots() { free(_hotspots); } void freeHotspots();
bool getJumpExitFl() const { return _jumpExitFl; } bool getJumpExitFl() const;
int getMouseX() const { return _mouseX; } int getMouseX() const;
int getMouseY() const { return _mouseY; } int getMouseY() const;
int16 getDirection(const int16 hotspotId) const { return _hotspots[hotspotId].direction; } int16 getDirection(const int16 hotspotId) const;
int16 getHotspotActIndex(const int16 hotspotId) const { return _hotspots[hotspotId].actIndex; } int16 getHotspotActIndex(const int16 hotspotId) const;
void drawHotspots() const; void drawHotspots() const;
int16 findExit(const int16 cx, const int16 cy, byte screenId); int16 findExit(const int16 cx, const int16 cy, byte screenId);

View file

@ -61,6 +61,41 @@ ObjectHandler::ObjectHandler(HugoEngine *vm) : _vm(vm), _objects(0), _uses(0) {
ObjectHandler::~ObjectHandler() { 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 * Save sequence number and image number in given object
*/ */

View file

@ -50,10 +50,10 @@ public:
object_t *_objects; object_t *_objects;
uint16 _numObj; uint16 _numObj;
byte getBoundaryOverlay(uint16 index) const { return _boundary[index]; } byte getBoundaryOverlay(uint16 index) const;
byte getObjectBoundary(uint16 index) const { return _objBound[index]; } byte getObjectBoundary(uint16 index) const;
byte getBaseBoundary(uint16 index) const { return _ovlBase[index]; } byte getBaseBoundary(uint16 index) const;
byte getFirstOverlay(uint16 index) const { return _overlay[index]; } byte getFirstOverlay(uint16 index) const;
int deltaX(const int x1, const int x2, const int vx, int y) 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; 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); static int y2comp(const void *a, const void *b);
bool isCarried(int objIndex) { bool isCarried(int objIndex) const;
return _objects[objIndex].carriedFl; 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: protected:
HugoEngine *_vm; HugoEngine *_vm;

View file

@ -64,6 +64,10 @@ Parser::Parser(HugoEngine *vm) : _vm(vm), _putIndex(0), _getIndex(0), _arrayReqs
Parser::~Parser() { Parser::~Parser() {
} }
uint16 Parser::getCmdDefaultVerbIdx(const uint16 index) const {
return _cmdList[index][0].verbIndex;
}
/** /**
* Read a cmd structure from Hugo.dat * Read a cmd structure from Hugo.dat
*/ */
@ -291,7 +295,7 @@ void Parser::keyHandler(Common::Event event) {
case Common::KEYCODE_s: case Common::KEYCODE_s:
if (gameStatus.viewState == kViewPlay) { if (gameStatus.viewState == kViewPlay) {
if (gameStatus.gameOverFl) if (gameStatus.gameOverFl)
Utils::gameOverMsg(); _vm->gameOverMsg();
else else
_vm->_file->saveGame(-1, Common::String()); _vm->_file->saveGame(-1, Common::String());
} }
@ -349,7 +353,7 @@ void Parser::keyHandler(Common::Event event) {
case Common::KEYCODE_F4: // Save game case Common::KEYCODE_F4: // Save game
if (gameStatus.viewState == kViewPlay) { if (gameStatus.viewState == kViewPlay) {
if (gameStatus.gameOverFl) if (gameStatus.gameOverFl)
Utils::gameOverMsg(); _vm->gameOverMsg();
else else
_vm->_file->saveGame(-1, Common::String()); _vm->_file->saveGame(-1, Common::String());
} }

View file

@ -49,7 +49,7 @@ public:
bool isWordPresent(char **wordArr) const; 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 charHandler();
void command(const char *format, ...); void command(const char *format, ...);

View file

@ -372,7 +372,7 @@ void Parser_v1d::lineHandler() {
// SAVE/RESTORE // SAVE/RESTORE
if (!strcmp("save", _vm->_line)) { if (!strcmp("save", _vm->_line)) {
if (gameStatus.gameOverFl) if (gameStatus.gameOverFl)
Utils::gameOverMsg(); _vm->gameOverMsg();
else else
_vm->_file->saveGame(-1, Common::String()); _vm->_file->saveGame(-1, Common::String());
return; return;
@ -391,8 +391,9 @@ void Parser_v1d::lineHandler() {
if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces! if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces!
return; return;
if (gameStatus.gameOverFl) { // No commands allowed! if (gameStatus.gameOverFl) {
Utils::gameOverMsg(); // No commands allowed!
_vm->gameOverMsg();
return; return;
} }
@ -430,7 +431,7 @@ void Parser_v1d::showInventory() const {
status_t &gameStatus = _vm->getGameStatus(); status_t &gameStatus = _vm->getGameStatus();
if (gameStatus.viewState == kViewPlay) { if (gameStatus.viewState == kViewPlay) {
if (gameStatus.gameOverFl) if (gameStatus.gameOverFl)
Utils::gameOverMsg(); _vm->gameOverMsg();
else else
showDosInventory(); showDosInventory();
} }

View file

@ -145,7 +145,7 @@ void Parser_v1w::lineHandler() {
if (gameStatus.gameOverFl) { if (gameStatus.gameOverFl) {
// No commands allowed! // No commands allowed!
Utils::gameOverMsg(); _vm->gameOverMsg();
return; return;
} }
@ -209,7 +209,7 @@ void Parser_v1w::showInventory() const {
status_t &gameStatus = _vm->getGameStatus(); status_t &gameStatus = _vm->getGameStatus();
istate_t inventState = _vm->_inventory->getInventoryState(); istate_t inventState = _vm->_inventory->getInventoryState();
if (gameStatus.gameOverFl) { if (gameStatus.gameOverFl) {
Utils::gameOverMsg(); _vm->gameOverMsg();
} else if ((inventState == kInventoryOff) && (gameStatus.viewState == kViewPlay)) { } else if ((inventState == kInventoryOff) && (gameStatus.viewState == kViewPlay)) {
_vm->_inventory->setInventoryState(kInventoryDown); _vm->_inventory->setInventoryState(kInventoryDown);
gameStatus.viewState = kViewInvent; gameStatus.viewState = kViewInvent;

View file

@ -123,7 +123,7 @@ void Parser_v2d::lineHandler() {
if (!strcmp("save", _vm->_line)) { if (!strcmp("save", _vm->_line)) {
_vm->_config.soundFl = false; _vm->_config.soundFl = false;
if (gameStatus.gameOverFl) if (gameStatus.gameOverFl)
Utils::gameOverMsg(); _vm->gameOverMsg();
else else
_vm->_file->saveGame(-1, Common::String()); _vm->_file->saveGame(-1, Common::String());
return; return;
@ -143,8 +143,9 @@ void Parser_v2d::lineHandler() {
if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces! if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces!
return; return;
if (gameStatus.gameOverFl) { // No commands allowed! if (gameStatus.gameOverFl) {
Utils::gameOverMsg(); // No commands allowed!
_vm->gameOverMsg();
return; return;
} }

View file

@ -125,7 +125,7 @@ void Parser_v3d::lineHandler() {
if (!strcmp("save", _vm->_line)) { if (!strcmp("save", _vm->_line)) {
_vm->_config.soundFl = false; _vm->_config.soundFl = false;
if (gameStatus.gameOverFl) if (gameStatus.gameOverFl)
Utils::gameOverMsg(); _vm->gameOverMsg();
else else
_vm->_file->saveGame(-1, Common::String()); _vm->_file->saveGame(-1, Common::String());
return; return;
@ -147,7 +147,7 @@ void Parser_v3d::lineHandler() {
if (gameStatus.gameOverFl) { if (gameStatus.gameOverFl) {
// No commands allowed! // No commands allowed!
Utils::gameOverMsg(); _vm->gameOverMsg();
return; return;
} }

View file

@ -49,6 +49,14 @@ Route::Route(HugoEngine *vm) : _vm(vm) {
_routeObjId = -1; // Hero not walking to anything _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. * Face hero in new direction, based on cursor key input by user.
*/ */

View file

@ -54,8 +54,8 @@ class Route {
public: public:
Route(HugoEngine *vm); Route(HugoEngine *vm);
void resetRoute() {_routeIndex = -1; } void resetRoute();
int16 getRouteIndex() const {return _routeIndex; } int16 getRouteIndex() const;
void processRoute(); void processRoute();
bool startRoute(const go_t routeType, const int16 objId, int16 cx, int16 cy); bool startRoute(const go_t routeType, const int16 objId, int16 cx, int16 cy);

View file

@ -63,6 +63,30 @@ MidiPlayer::~MidiPlayer() {
close(); 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) { void MidiPlayer::play(uint8 *stream, uint16 size) {
debugC(3, kDebugMusic, "MidiPlayer::play"); debugC(3, kDebugMusic, "MidiPlayer::play");
if (!stream) { if (!stream) {

View file

@ -45,15 +45,14 @@ public:
MidiPlayer(MidiDriver *driver); MidiPlayer(MidiDriver *driver);
~MidiPlayer(); ~MidiPlayer();
bool isPlaying() { return _isPlaying; } bool isPlaying() const;
int getVolume() const;
int getVolume() { return _masterVolume; }
void adjustVolume(int diff); void adjustVolume(int diff);
void pause(bool p); void pause(bool p);
void play(uint8 *stream, uint16 size); void play(uint8 *stream, uint16 size);
void setChannelVolume(int channel); void setChannelVolume(int channel);
void setLooping(bool loop) { _isLooping = loop; } void setLooping(bool loop);
void setVolume(int volume); void setVolume(int volume);
void stop(); void stop();
void syncVolume(); void syncVolume();
@ -62,15 +61,15 @@ public:
// MidiDriver interface // MidiDriver interface
int open(); int open();
MidiChannel *allocateChannel() { return 0; } MidiChannel *allocateChannel();
MidiChannel *getPercussionChannel() { return 0; } MidiChannel *getPercussionChannel();
void close(); void close();
void metaEvent(byte type, byte *data, uint16 length); void metaEvent(byte type, byte *data, uint16 length);
void send(uint32 b); void send(uint32 b);
void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { } void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
uint32 getBaseTempo() { return _driver ? _driver->getBaseTempo() : 0; } uint32 getBaseTempo();
private: private:
static void timerCallback(void *p); static void timerCallback(void *p);

View file

@ -37,6 +37,54 @@ TextHandler::TextHandler(HugoEngine *vm) : _vm(vm), _textData(0), _stringtData(0
TextHandler::~TextHandler() { 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) { char **TextHandler::loadTextsVariante(Common::ReadStream &in, uint16 *arraySize) {
int numTexts; int numTexts;
int entryLen; int entryLen;

View file

@ -32,18 +32,18 @@ public:
TextHandler(HugoEngine *vm); TextHandler(HugoEngine *vm);
~TextHandler(); ~TextHandler();
const char *getNoun(int idx1, int idx2) const { return _arrayNouns[idx1][idx2]; } const char *getNoun(int idx1, int idx2) const;
const char *getScreenNames(int screenIndex) const { return _screenNames[screenIndex]; } const char *getScreenNames(int screenIndex) const;
const char *getStringtData(int stringIndex) const { return _stringtData[stringIndex]; } const char *getStringtData(int stringIndex) const;
const char *getTextData(int textIndex) const { return _textData[textIndex]; } const char *getTextData(int textIndex) const;
const char *getTextEngine(int engineIndex) const { return _textEngine[engineIndex]; } const char *getTextEngine(int engineIndex) const;
const char *getTextIntro(int introIndex) const { return _textIntro[introIndex]; } const char *getTextIntro(int introIndex) const;
const char *getTextMouse(int mouseIndex) const { return _textMouse[mouseIndex]; } const char *getTextMouse(int mouseIndex) const;
const char *getTextParser(int parserIndex) const { return _textParser[parserIndex]; } const char *getTextParser(int parserIndex) const;
const char *getTextUtil(int utilIndex) const { return _textUtil[utilIndex]; } const char *getTextUtil(int utilIndex) const;
const char *getVerb(int idx1, int idx2) const { return _arrayVerbs[idx1][idx2]; } const char *getVerb(int idx1, int idx2) const;
char **getNounArray(int idx1) const { return _arrayNouns[idx1]; } char **getNounArray(int idx1) const;
char **getVerbArray(int idx1) const { return _arrayVerbs[idx1]; } char **getVerbArray(int idx1) const;
void loadAllTexts(Common::ReadStream &in); void loadAllTexts(Common::ReadStream &in);
void freeAllTexts(); void freeAllTexts();

View file

@ -140,13 +140,6 @@ char *Utils::Box(box_t dismiss, const char *s, ...) {
return buffer; 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 *Utils::strlwr(char *buffer) {
char *result = buffer; char *result = buffer;

View file

@ -45,7 +45,6 @@ static const int kMaxStrLength = 1024;
int firstBit(byte data); int firstBit(byte data);
int lastBit(byte data); int lastBit(byte data);
void gameOverMsg();
void reverseByte(byte *data); void reverseByte(byte *data);
char *Box(box_t, const char *, ...) GCC_PRINTF(2, 3); char *Box(box_t, const char *, ...) GCC_PRINTF(2, 3);