From 8c753c96a097c3b6e67b061470606278a0d8f102 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 1 Sep 2012 01:05:22 +0200 Subject: TONY: Move some functions from .h to .cpp files --- engines/tony/game.cpp | 31 ++++++++++++++++++++++++++++ engines/tony/game.h | 44 ++++++++++++++-------------------------- engines/tony/gfxengine.cpp | 23 +++++++++++++++++++++ engines/tony/gfxengine.h | 21 ++++++------------- engines/tony/loc.h | 1 + engines/tony/sound.h | 8 +++----- engines/tony/tony.cpp | 16 +++++++++++++++ engines/tony/tony.h | 16 ++++----------- engines/tony/tonychar.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++ engines/tony/tonychar.h | 33 +++++++++--------------------- 10 files changed, 158 insertions(+), 85 deletions(-) (limited to 'engines') diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp index 3031dabf3c..3abc7a20f8 100644 --- a/engines/tony/game.cpp +++ b/engines/tony/game.cpp @@ -1571,4 +1571,35 @@ void RMPointer::updateCursor() { CursorMan.replaceCursor(cursorData, 64, 64, _cursorHotspot._x, _cursorHotspot._y, 0, 1, &pixelFormat); } +/** + * Sets a new action as current + */ +void RMPointer::setAction(RMTonyAction action) { + _nCurPointer = action; + updateCursor(); +} + +/** + * Sets a new pointer + */ +void RMPointer::setSpecialPointer(PointerType ptr) { + _nCurSpecialPointer = ptr; + if (_nCurSpecialPointer && _nCurSpecialPointer != PTR_CUSTOM) + _specialPointer[ptr - 1]->setPattern(1); + + updateCursor(); +} + +RMPointer::PointerType RMPointer::getSpecialPointer() { + return (PointerType)_nCurSpecialPointer; +} + +/** + * Set the new custom pointer + */ +void RMPointer::setCustomPointer(RMGfxSourceBuffer8 *ptr) { + _nCurCustomPointer = ptr; + updateCursor(); +} + } // End of namespace Tony diff --git a/engines/tony/game.h b/engines/tony/game.h index 626ec73afb..bb6a356f0a 100644 --- a/engines/tony/game.h +++ b/engines/tony/game.h @@ -53,8 +53,18 @@ namespace Tony { (buf8)->init(*raw, raw->width(), raw->height(), true); \ delete raw; - class RMPointer { +public: + enum PointerType { + PTR_NONE = 0, + PTR_ARROWUP, + PTR_ARROWDOWN, + PTR_ARROWLEFT, + PTR_ARROWRIGHT, + PTR_ARROWMAP, + PTR_CUSTOM + }; + private: RMGfxSourceBuffer8 *_pointer[16]; RMPoint _hotspot[16]; @@ -67,17 +77,6 @@ private: RMGfxSourceBuffer8 *_nCurCustomPointer; -public: - enum PointerType { - PTR_NONE = 0, - PTR_ARROWUP, - PTR_ARROWDOWN, - PTR_ARROWLEFT, - PTR_ARROWRIGHT, - PTR_ARROWMAP, - PTR_CUSTOM - }; - public: /** * Constructor & destructor @@ -108,32 +107,19 @@ public: /** * Sets a new action as current */ - void setAction(RMTonyAction action) { - _nCurPointer = action; - updateCursor(); - } + void setAction(RMTonyAction action); /** * Sets a new pointer */ - void setSpecialPointer(PointerType ptr) { - _nCurSpecialPointer = ptr; - if (_nCurSpecialPointer && _nCurSpecialPointer != PTR_CUSTOM) - _specialPointer[ptr - 1]->setPattern(1); + void setSpecialPointer(PointerType ptr); - updateCursor(); - } - PointerType getSpecialPointer() { - return (PointerType)_nCurSpecialPointer; - } + PointerType getSpecialPointer(); /** * Set the new custom pointer */ - void setCustomPointer(RMGfxSourceBuffer8 *ptr) { - _nCurCustomPointer = ptr; - updateCursor(); - } + void setCustomPointer(RMGfxSourceBuffer8 *ptr); /** * Return the current action to be applied according to the pointer diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 6f976ef37c..5c038e154d 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -836,4 +836,27 @@ bool RMGfxEngine::canLoadSave() { return _bInput && !_tony.inAction() && !g_vm->getIsDemo(); } +RMGfxEngine::operator RMGfxTargetBuffer &() { + return _bigBuf; +} + +RMInput &RMGfxEngine::getInput() { + return _input; +} + +RMPointer &RMGfxEngine::getPointer() { + return _point; +} + +/** + * Link to graphic task + */ +void RMGfxEngine::linkGraphicTask(RMGfxTask *task) { + _bigBuf.addPrim(new RMGfxPrimitive(task)); +} + +void RMGfxEngine::setPerorate(bool bpal) { + _inter.setPerorate(bpal); +} + } // End of namespace Tony diff --git a/engines/tony/gfxengine.h b/engines/tony/gfxengine.h index 2e22e1ca62..ab32a01972 100644 --- a/engines/tony/gfxengine.h +++ b/engines/tony/gfxengine.h @@ -102,23 +102,15 @@ public: void enableMouse(); void disableMouse(); - operator RMGfxTargetBuffer &() { - return _bigBuf; - } - RMInput &getInput() { - return _input; - } - RMPointer &getPointer() { - return _point; - } + operator RMGfxTargetBuffer &(); + RMInput &getInput(); + RMPointer &getPointer(); // Link to the custom function list void initCustomDll(); // Link to graphic task - void linkGraphicTask(RMGfxTask *task) { - _bigBuf.addPrim(new RMGfxPrimitive(task)); - }; + void linkGraphicTask(RMGfxTask *task); // Manage a location uint32 loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start); @@ -137,9 +129,8 @@ public: void closeWipe(); void waitWipeEnd(CORO_PARAM); - void setPerorate(bool bpal) { - _inter.setPerorate(bpal); - } + void setPerorate(bool bpal); + bool canLoadSave(); }; diff --git a/engines/tony/loc.h b/engines/tony/loc.h index 7b0a2ddd6b..6c28a66f65 100644 --- a/engines/tony/loc.h +++ b/engines/tony/loc.h @@ -529,6 +529,7 @@ private: public: // @@@@@@@@@@@@@@@@@@@@@@@ + RMPoint TEMPTonyStart; RMPoint TEMPGetTonyStart() { return TEMPTonyStart; diff --git a/engines/tony/sound.h b/engines/tony/sound.h index 73938ecd8c..c859f781f4 100644 --- a/engines/tony/sound.h +++ b/engines/tony/sound.h @@ -49,11 +49,9 @@ enum SoundCodecs { FPCODEC_ADPCM }; -//**************************************************************************** -//* class FPSound -//* ------------- -//* Description: Sound driver For Tony Tough -//**************************************************************************** +/** + * Sound driver For Tony Tough + */ class FPSound { private: diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp index 9426a37a8b..4ffb84ced8 100644 --- a/engines/tony/tony.cpp +++ b/engines/tony/tony.cpp @@ -615,6 +615,14 @@ void TonyEngine::grabThumbnail() { _window.grabThumbnail(_curThumbnail); } +uint16 *TonyEngine::getThumbnail() { + return _curThumbnail; +} + +void TonyEngine::quitGame() { + _bQuitNow = true; +} + void TonyEngine::openInitLoadMenu(CORO_PARAM) { _theEngine.openOptionScreen(coroParam, 1); } @@ -776,4 +784,12 @@ void TonyEngine::saveSoundSettings() { ConfMan.setInt("talkspeed", GLOBALS._nCfgTextSpeed * 256 / 10); } +void TonyEngine::showLocation() { + _bDrawLocation = true; +} + +void TonyEngine::hideLocation() { + _bDrawLocation = false; +} + } // End of namespace Tony diff --git a/engines/tony/tony.h b/engines/tony/tony.h index 9a25f2ce35..22090dfe51 100644 --- a/engines/tony/tony.h +++ b/engines/tony/tony.h @@ -173,12 +173,8 @@ public: void getDataDirectory(DataDir dir, char *path); - void showLocation() { - _bDrawLocation = true; - } - void hideLocation() { - _bDrawLocation = false; - } + void showLocation(); + void hideLocation(); /** * Reads the time @@ -226,13 +222,9 @@ public: * Get a thumbnail */ void grabThumbnail(); - uint16 *getThumbnail() { - return _curThumbnail; - } + uint16 *getThumbnail(); - void quitGame() { - _bQuitNow = true; - } + void quitGame(); void openInitLoadMenu(CORO_PARAM); void openInitOptions(CORO_PARAM); diff --git a/engines/tony/tonychar.cpp b/engines/tony/tonychar.cpp index c80203fae2..c7fa1e4a7b 100644 --- a/engines/tony/tonychar.cpp +++ b/engines/tony/tonychar.cpp @@ -1892,4 +1892,54 @@ void RMTony::endStatic(CORO_PARAM, CharacterTalkType nTalk) { CORO_END_CODE; } +/** + * Waits until the end of a pattern + */ +void RMTony::waitForEndPattern(CORO_PARAM, uint32 hCustomSkip) { + RMCharacter::waitForEndPattern(coroParam, hCustomSkip); +} + +/** + * Check if currently in an action + */ +bool RMTony::inAction() { + return (_bActionPending && _action != 0) | _bAction; +} + +/** + * Check if there needs to be an update for scrolling movement + */ +bool RMTony::mustUpdateScrolling() { + return ((!inAction()) || (isMoving())); +} + +/** + * Returns Tony's position + */ +RMPoint RMTony::position() { + return _pos; +} + +/** + * Set the scrolling position + */ +void RMTony::setScrollPosition(const RMPoint &pt) { + RMCharacter::setScrollPosition(pt); +} + +/** + * Tony disguises himself! + */ +void RMTony::setShepherdess(bool bIsPast) { + _bShepherdess = bIsPast; +} + +int RMTony::getShepherdess() { + return _bShepherdess; +} + +void RMTony::playSfx(int nSfx) { + RMItem::playSfx(nSfx); +} + } // End of namespace Tony diff --git a/engines/tony/tonychar.h b/engines/tony/tonychar.h index 775c27a4e0..d9f18f61ec 100644 --- a/engines/tony/tonychar.h +++ b/engines/tony/tonychar.h @@ -416,37 +416,27 @@ public: /** * Waits until the end of a pattern */ - void waitForEndPattern(CORO_PARAM, uint32 hCustomSkip = CORO_INVALID_PID_VALUE) { - RMCharacter::waitForEndPattern(coroParam, hCustomSkip); - } + void waitForEndPattern(CORO_PARAM, uint32 hCustomSkip = CORO_INVALID_PID_VALUE); /** * Check if currently in an action */ - bool inAction() { - return (_bActionPending && _action != 0) | _bAction; - } + bool inAction(); /** * Check if there needs to be an update for scrolling movement */ - bool mustUpdateScrolling() { - return ((!inAction()) || (isMoving())); - } + bool mustUpdateScrolling(); /** * Returns Tony's position */ - RMPoint position() { - return _pos; - } + RMPoint position(); /** * Set the scrolling position */ - void setScrollPosition(const RMPoint &pt) { - RMCharacter::setScrollPosition(pt); - } + void setScrollPosition(const RMPoint &pt); /** * Set the take animation @@ -475,21 +465,16 @@ public: /** * Tony disguises himself! */ - void setShepherdess(bool bIsPast) { - _bShepherdess = bIsPast; - } - int getShepherdess() { - return _bShepherdess; - } + void setShepherdess(bool bIsPast); + + int getShepherdess(); /** * Perform an action */ void executeAction(int nAction, int nActionItem, int nParm); - void playSfx(int nSfx) { - RMItem::playSfx(nSfx); - } + void playSfx(int nSfx); }; } // End of namespace Tony -- cgit v1.2.3