From 3ab8ebc4f72e54a5ffcabaa22d3cf8e250062457 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 1 Sep 2012 02:27:31 +0200 Subject: TONY: Move some more code from .h to .cpp files --- engines/tony/gfxcore.cpp | 136 ++++++++++++++++++++++++++++++++++++++++ engines/tony/gfxcore.h | 136 +++++++--------------------------------- engines/tony/globals.h | 4 +- engines/tony/input.cpp | 34 ++++++++++ engines/tony/input.h | 28 +++------ engines/tony/mpal/memory.h | 14 ++--- engines/tony/mpal/mpalutils.cpp | 4 ++ engines/tony/mpal/mpalutils.h | 6 +- engines/tony/window.cpp | 4 ++ engines/tony/window.h | 2 +- 10 files changed, 221 insertions(+), 147 deletions(-) diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp index 53f64aad12..38d8d0046d 100644 --- a/engines/tony/gfxcore.cpp +++ b/engines/tony/gfxcore.cpp @@ -111,6 +111,15 @@ RMGfxBuffer::RMGfxBuffer(int dimx, int dimy, int nBpp) { create(dimx, dimy, nBpp); } +int RMGfxBuffer::getDimx() { + return _dimx; +} + +int RMGfxBuffer::getDimy() { + return _dimy; +} + + /****************************************************************************\ * RMGfxSourceBuffer Methods \****************************************************************************/ @@ -2031,4 +2040,131 @@ void RMGfxClearTask::removeThis(CORO_PARAM, bool &result) { result = true; } +/****************************************************************************\ +* RMGfxPrimitive Methods +\****************************************************************************/ + +RMGfxPrimitive::RMGfxPrimitive() { + _bFlag = 0; + _task = NULL; + _src.setEmpty(); + _dst.setEmpty(); + _bStretch = false; +} + +RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task) { + _task = task; + _bFlag = 0; + _bStretch = false; +} + +RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMRect &dst) { + _task = task; + _src = src; + _dst = dst; + _bFlag = 0; + _bStretch = (src.width() != dst.width() || src.height() != dst.height()); +} + +RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMRect &dst) { + _task = task; + _src.topLeft() = src; + _dst = dst; + _bFlag = 0; + _bStretch = false; +} + +RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMPoint &dst) { + _task = task; + _src.topLeft() = src; + _dst.topLeft() = dst; + _bFlag = 0; + _bStretch = false; +} + +RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMPoint &dst) { + _task = task; + _src = src; + _dst.topLeft() = dst; + _bFlag = 0; + _bStretch = false; +} + +RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task, const RMRect &dst) { + _task = task; + _dst = dst; + _src.setEmpty(); + _bFlag = 0; + _bStretch = false; +} + +RMGfxPrimitive::RMGfxPrimitive(RMGfxTask *task, const RMPoint &dst) { + _task = task; + _dst.topLeft() = dst; + _src.setEmpty(); + _bFlag = 0; + _bStretch = false; +} + +RMGfxPrimitive::~RMGfxPrimitive() { +} + +void RMGfxPrimitive::setFlag(byte bFlag) { + _bFlag = bFlag; +} + +void RMGfxPrimitive::setTask(RMGfxTask *task) { + _task = task; +} + +void RMGfxPrimitive::setSrc(const RMRect &src) { + _src = src; +} + +void RMGfxPrimitive::setSrc(const RMPoint &src) { + _src.topLeft() = src; +} + +void RMGfxPrimitive::setDst(const RMRect &dst) { + _dst = dst; +} + +void RMGfxPrimitive::setDst(const RMPoint &dst) { + _dst.topLeft() = dst; +} + +void RMGfxPrimitive::setStretch(bool bStretch) { + _bStretch = bStretch; +} + +bool RMGfxPrimitive::haveDst() { + return !_dst.isEmpty(); +} + +RMRect &RMGfxPrimitive::getDst() { + return _dst; +} + +bool RMGfxPrimitive::haveSrc() { + return !_src.isEmpty(); +} + +RMRect &RMGfxPrimitive::getSrc() { + return _src; +} + +/** + * Flags + */ +bool RMGfxPrimitive::isFlipped() { + return _bFlag & 1; +} + +/** + * Duplicate + */ +RMGfxPrimitive *RMGfxPrimitive::duplicate() { + return new RMGfxPrimitive(*this); +} + } // End of namespace Tony diff --git a/engines/tony/gfxcore.h b/engines/tony/gfxcore.h index 472a4ad13a..4750e42d00 100644 --- a/engines/tony/gfxcore.h +++ b/engines/tony/gfxcore.h @@ -68,12 +68,8 @@ public: virtual ~RMGfxBuffer(); // Attributes - int getDimx() { - return _dimx; - } - int getDimy() { - return _dimy; - } + int getDimx(); + int getDimy(); // Creation virtual void create(int dimx, int dimy, int nBpp); @@ -102,116 +98,32 @@ protected: byte _bFlag; public: - RMGfxPrimitive() { - _bFlag = 0; - _task = NULL; - _src.setEmpty(); - _dst.setEmpty(); - _bStretch = false; - } - - RMGfxPrimitive(RMGfxTask *task) { - _task = task; - _bFlag = 0; - _bStretch = false; - } - - RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMRect &dst) { - _task = task; - _src = src; - _dst = dst; - _bFlag = 0; - _bStretch = (src.width() != dst.width() || src.height() != dst.height()); - } - - RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMRect &dst) { - _task = task; - _src.topLeft() = src; - _dst = dst; - _bFlag = 0; - _bStretch = false; - } - - RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMPoint &dst) { - _task = task; - _src.topLeft() = src; - _dst.topLeft() = dst; - _bFlag = 0; - _bStretch = false; - } - - RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMPoint &dst) { - _task = task; - _src = src; - _dst.topLeft() = dst; - _bFlag = 0; - _bStretch = false; - } - - RMGfxPrimitive(RMGfxTask *task, const RMRect &dst) { - _task = task; - _dst = dst; - _src.setEmpty(); - _bFlag = 0; - _bStretch = false; - } - - RMGfxPrimitive(RMGfxTask *task, const RMPoint &dst) { - _task = task; - _dst.topLeft() = dst; - _src.setEmpty(); - _bFlag = 0; - _bStretch = false; - } - - virtual ~RMGfxPrimitive() { } - - void setFlag(byte bFlag) { - _bFlag = bFlag; - } - void setTask(RMGfxTask *task) { - _task = task; - } - void setSrc(const RMRect &src) { - _src = src; - } - void setSrc(const RMPoint &src) { - _src.topLeft() = src; - } - void setDst(const RMRect &dst) { - _dst = dst; - } - void setDst(const RMPoint &dst) { - _dst.topLeft() = dst; - } - void setStretch(bool bStretch) { - _bStretch = bStretch; - } - - bool haveDst() { - return !_dst.isEmpty(); - } - - RMRect &getDst() { - return _dst; - } - - bool haveSrc() { - return !_src.isEmpty(); - } - RMRect &getSrc() { - return _src; - } + RMGfxPrimitive(); + RMGfxPrimitive(RMGfxTask *task); + RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMRect &dst); + RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMRect &dst); + RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMPoint &dst); + RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMPoint &dst); + RMGfxPrimitive(RMGfxTask *task, const RMRect &dst); + RMGfxPrimitive(RMGfxTask *task, const RMPoint &dst); + virtual ~RMGfxPrimitive(); + void setFlag(byte bFlag); + void setTask(RMGfxTask *task); + void setSrc(const RMRect &src); + void setSrc(const RMPoint &src); + void setDst(const RMRect &dst); + void setDst(const RMPoint &dst); + void setStretch(bool bStretch); + bool haveDst(); + RMRect &getDst(); + bool haveSrc(); + RMRect &getSrc(); // Flags - bool isFlipped() { - return _bFlag & 1; - } + bool isFlipped(); // Duplicate - virtual RMGfxPrimitive *duplicate() { - return new RMGfxPrimitive(*this); - } + virtual RMGfxPrimitive *duplicate(); }; diff --git a/engines/tony/globals.h b/engines/tony/globals.h index eda99eeee2..75f7f8d1dd 100644 --- a/engines/tony/globals.h +++ b/engines/tony/globals.h @@ -148,12 +148,10 @@ struct ChangedHotspotStruct { */ typedef struct { int _nCf; - int _arg1, _arg2, _arg3, _arg4; } CfCall; -typedef CfCall *LpCfCall; -typedef LpCfCall *LPLPCFCALL; +typedef CfCall *LpCfCall; struct CoroutineMutex { CoroutineMutex() : _eventId(0), _ownerPid(0), _lockCount(0) { } diff --git a/engines/tony/input.cpp b/engines/tony/input.cpp index 88bc3f4092..b96ccaf842 100644 --- a/engines/tony/input.cpp +++ b/engines/tony/input.cpp @@ -120,4 +120,38 @@ bool RMInput::getAsyncKeyState(Common::KeyCode kc) { return result; } +/** + * Reading of the mouse + */ +RMPoint RMInput::mousePos() { + return _mousePos; +} + +/** + * Events of mouse clicks + */ +bool RMInput::mouseLeftClicked() { + return _leftClickMouse; +} + +bool RMInput::mouseRightClicked() { + return _rightClickMouse; +} + +bool RMInput::mouseBothClicked() { + return _leftClickMouse && _rightClickMouse; +} + +bool RMInput::mouseLeftReleased() { + return _leftReleaseMouse; +} + +bool RMInput::mouseRightReleased() { + return _rightReleaseMouse; +} + +bool RMInput::mouseBothReleased() { + return _leftReleaseMouse && _rightReleaseMouse; +} + } // End of namespace Tony diff --git a/engines/tony/input.h b/engines/tony/input.h index 55b067ec43..d07eaefe34 100644 --- a/engines/tony/input.h +++ b/engines/tony/input.h @@ -59,9 +59,7 @@ public: /** * Reading of the mouse */ - RMPoint mousePos() { - return _mousePos; - } + RMPoint mousePos(); /** * Current status of the mouse buttons @@ -72,24 +70,12 @@ public: /** * Events of mouse clicks */ - bool mouseLeftClicked() { - return _leftClickMouse; - } - bool mouseRightClicked() { - return _rightClickMouse; - } - bool mouseBothClicked() { - return _leftClickMouse && _rightClickMouse; - } - bool mouseLeftReleased() { - return _leftReleaseMouse; - } - bool mouseRightReleased() { - return _rightReleaseMouse; - } - bool mouseBothReleased() { - return _leftReleaseMouse && _rightReleaseMouse; - } + bool mouseLeftClicked(); + bool mouseRightClicked(); + bool mouseBothClicked(); + bool mouseLeftReleased(); + bool mouseRightReleased(); + bool mouseBothReleased(); /** * Returns true if the given key is pressed diff --git a/engines/tony/mpal/memory.h b/engines/tony/mpal/memory.h index b557743512..ba7865938f 100644 --- a/engines/tony/mpal/memory.h +++ b/engines/tony/mpal/memory.h @@ -57,13 +57,13 @@ public: }; // defines -#define globalAlloc(flags, size) MemoryManager::alloc(size, flags) -#define globalAllocate(flags, size) MemoryManager::allocate(size, flags) -#define globalFree(handle) MemoryManager::freeBlock(handle) -#define globalDestroy(handle) MemoryManager::destroyItem(handle) -#define globalLock(handle) MemoryManager::lockItem(handle) -#define globalUnlock(handle) MemoryManager::unlockItem(handle) -#define globalSize(handle) MemoryManager::getSize(handle) +#define globalAlloc(flags, size) MemoryManager::alloc(size, flags) +#define globalAllocate(flags, size) MemoryManager::allocate(size, flags) +#define globalFree(handle) MemoryManager::freeBlock(handle) +#define globalDestroy(handle) MemoryManager::destroyItem(handle) +#define globalLock(handle) MemoryManager::lockItem(handle) +#define globalUnlock(handle) MemoryManager::unlockItem(handle) +#define globalSize(handle) MemoryManager::getSize(handle) #define GMEM_FIXED 1 #define GMEM_MOVEABLE 2 diff --git a/engines/tony/mpal/mpalutils.cpp b/engines/tony/mpal/mpalutils.cpp index bfc97a5f3d..92d4af37fc 100644 --- a/engines/tony/mpal/mpalutils.cpp +++ b/engines/tony/mpal/mpalutils.cpp @@ -80,6 +80,10 @@ Common::SeekableReadStream *RMRes::getReadStream() { return new Common::MemoryReadStream(_buf, size()); } +bool RMRes::isValid() { + return _h != NULL; +} + /****************************************************************************\ * RMResRaw methods \****************************************************************************/ diff --git a/engines/tony/mpal/mpalutils.h b/engines/tony/mpal/mpalutils.h index 8bc3e1d7c6..629e157e29 100644 --- a/engines/tony/mpal/mpalutils.h +++ b/engines/tony/mpal/mpalutils.h @@ -47,7 +47,7 @@ public: // Attributes unsigned int size(); const byte *dataPointer(); - bool isValid() { return _h != NULL; } + bool isValid(); // Casting for access to data operator const byte*(); @@ -63,8 +63,8 @@ public: const byte *dataPointer(); operator const byte*(); - int width(); - int height(); + int width(); + int height(); }; } // end of namespace MPAL diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp index 0746b267bd..013be84b4b 100644 --- a/engines/tony/window.cpp +++ b/engines/tony/window.cpp @@ -255,6 +255,10 @@ void RMWindow::plotLines(const byte *lpBuf, const Common::Point ¢er, int x, } } +void RMWindow::showDirtyRects(bool v) { + _showDirtyRects = v; +} + /****************************************************************************\ * RMSnapshot Methods \****************************************************************************/ diff --git a/engines/tony/window.h b/engines/tony/window.h index c4cbcb6643..b2732a3f0c 100644 --- a/engines/tony/window.h +++ b/engines/tony/window.h @@ -90,7 +90,7 @@ public: */ void grabThumbnail(uint16 *buf); - void showDirtyRects(bool v) { _showDirtyRects = v; } + void showDirtyRects(bool v); }; } // End of namespace Tony -- cgit v1.2.3