aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/tony/font.cpp44
-rw-r--r--engines/tony/font.h31
-rw-r--r--engines/tony/game.cpp12
-rw-r--r--engines/tony/game.h12
-rw-r--r--engines/tony/gfxcore.cpp44
-rw-r--r--engines/tony/gfxcore.h38
-rw-r--r--engines/tony/inventory.cpp15
-rw-r--r--engines/tony/inventory.h15
-rw-r--r--engines/tony/loc.cpp89
-rw-r--r--engines/tony/loc.h77
-rw-r--r--engines/tony/utils.cpp30
-rw-r--r--engines/tony/utils.h17
12 files changed, 279 insertions, 145 deletions
diff --git a/engines/tony/font.cpp b/engines/tony/font.cpp
index 901a41b7c4..927adf9006 100644
--- a/engines/tony/font.cpp
+++ b/engines/tony/font.cpp
@@ -189,6 +189,17 @@ void RMFontColor::setBaseColor(byte r1, byte g1, byte b1) {
}
/***************************************************************************\
+* RMFontWithTables Methods
+\****************************************************************************/
+int RMFontWithTables::convertToLetter(byte nChar) {
+ return _cTable[nChar];
+}
+
+int RMFontWithTables::letterLength(int nChar, int nNext) {
+ return (nChar != -1 ? _lTable[(byte)nChar] + _l2Table[(byte)nChar][(byte)nNext] : _lDefault);
+}
+
+/***************************************************************************\
* RMFontDialog Methods
\****************************************************************************/
@@ -359,7 +370,6 @@ RMText::RMText() {
}
RMText::~RMText() {
-
}
void RMText::unload() {
@@ -571,6 +581,23 @@ void RMText::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_END_CODE;
}
+/**
+ * Set the alignment type
+ */
+void RMText::setAlignType(HorAlign aHor, VerAlign aVer) {
+ _aHorType = aHor;
+ _aVerType = aVer;
+}
+
+/**
+ * Set the base color
+ */
+void RMText::setColor(byte r, byte g, byte b) {
+ _textR = r;
+ _textG = g;
+ _textB = b;
+}
+
/****************************************************************************\
* RMTextDialog Methods
\****************************************************************************/
@@ -751,6 +778,13 @@ void RMTextDialog::setInput(RMInput *input) {
_input = input;
}
+/**
+ * Set the position
+ */
+void RMTextDialog::setPosition(const RMPoint &pt) {
+ _dst = pt;
+}
+
/****************************************************************************\
* RMTextDialogScrolling Methods
\****************************************************************************/
@@ -801,7 +835,6 @@ RMTextItemName::RMTextItemName() : RMText() {
}
RMTextItemName::~RMTextItemName() {
-
}
void RMTextItemName::doFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv) {
@@ -886,6 +919,13 @@ bool RMTextItemName::isItemSelected() {
return _item != NULL;
}
+void RMTextItemName::setMouseCoord(const RMPoint &m) {
+ _mpos = m;
+}
+
+void RMTextItemName::removeThis(CORO_PARAM, bool &result) {
+ result = true;
+}
/****************************************************************************\
* RMDialogChoice Methods
diff --git a/engines/tony/font.h b/engines/tony/font.h
index 97434b9770..99b20571b1 100644
--- a/engines/tony/font.h
+++ b/engines/tony/font.h
@@ -126,12 +126,8 @@ protected:
protected:
// Overloaded methods
- int convertToLetter(byte nChar) {
- return _cTable[nChar];
- }
- int letterLength(int nChar, int nNext = 0) {
- return (nChar != -1 ? _lTable[(byte)nChar] + _l2Table[(byte)nChar][(byte)nNext] : _lDefault);
- }
+ int convertToLetter(byte nChar);
+ int letterLength(int nChar, int nNext = 0);
public:
int letterHeight() {
@@ -206,10 +202,7 @@ public:
static void unload();
// Set the alignment type
- void setAlignType(HorAlign aHor, VerAlign aVer) {
- _aHorType = aHor;
- _aVerType = aVer;
- }
+ void setAlignType(HorAlign aHor, VerAlign aVer);
// Sets the maximum length of a line in pixels (used to format the text)
void setMaxLineLength(int max);
@@ -225,11 +218,7 @@ public:
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
// Set the base color
- void setColor(byte r, byte g, byte b) {
- _textR = r;
- _textG = g;
- _textB = b;
- }
+ void setColor(byte r, byte g, byte b);
};
/**
@@ -269,9 +258,7 @@ public:
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
// Set the position
- void setPosition(const RMPoint &pt) {
- _dst = pt;
- }
+ void setPosition(const RMPoint &pt);
// Waiting
void waitForEndDisplay(CORO_PARAM);
@@ -320,9 +307,7 @@ public:
RMTextItemName();
virtual ~RMTextItemName();
- void setMouseCoord(const RMPoint &m) {
- _mpos = m;
- }
+ void setMouseCoord(const RMPoint &m);
void doFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv);
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
@@ -331,9 +316,7 @@ public:
RMItem *getSelectedItem();
bool isItemSelected();
- virtual void removeThis(CORO_PARAM, bool &result) {
- result = true;
- }
+ virtual void removeThis(CORO_PARAM, bool &result);
};
diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp
index 3abc7a20f8..2bcfdc7fc2 100644
--- a/engines/tony/game.cpp
+++ b/engines/tony/game.cpp
@@ -128,6 +128,14 @@ void RMOptionButton::addToList(RMGfxTargetBuffer &bigBuf) {
bigBuf.addPrim(new RMGfxPrimitive(this, _rect));
}
+bool RMOptionButton::isActive() {
+ return _bActive;
+}
+
+void RMOptionButton::setActiveState(bool bState) {
+ _bActive = bState;
+}
+
/****************************************************************************\
* RMOptionSlide Methods
\****************************************************************************/
@@ -253,6 +261,10 @@ void RMOptionSlide::addToList(RMGfxTargetBuffer &bigBuf) {
bigBuf.addPrim(new RMGfxPrimitive(this));
}
+int RMOptionSlide::getValue() {
+ return _nValue;
+}
+
/****************************************************************************\
* RMOptionScreen Methods
\****************************************************************************/
diff --git a/engines/tony/game.h b/engines/tony/game.h
index 1c955176bf..83a1ddaea1 100644
--- a/engines/tony/game.h
+++ b/engines/tony/game.h
@@ -189,12 +189,8 @@ public:
bool doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick);
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
void addToList(RMGfxTargetBuffer &bigBuf);
- bool isActive() {
- return _bActive;
- }
- void setActiveState(bool bState) {
- _bActive = bState;
- }
+ bool isActive();
+ void setActiveState(bool bState);
};
class RMOptionSlide : public RMGfxTaskSetPrior {
@@ -219,9 +215,7 @@ public:
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
void addToList(RMGfxTargetBuffer &bigBuf);
- int getValue() {
- return _nValue;
- }
+ int getValue();
};
class RMOptionScreen : public RMGfxWoodyBuffer {
diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp
index 38d8d0046d..71bf31396c 100644
--- a/engines/tony/gfxcore.cpp
+++ b/engines/tony/gfxcore.cpp
@@ -49,6 +49,17 @@ void RMGfxTask::removeThis(CORO_PARAM, bool &result) {
result = true;
}
+/**
+ * Registration
+ */
+void RMGfxTask::Register() {
+ _nInList++;
+}
+
+void RMGfxTask::Unregister() {
+ _nInList--;
+ assert(_nInList >= 0);
+}
/****************************************************************************\
* RMGfxTaskSetPrior Methods
@@ -192,7 +203,6 @@ bool RMGfxSourceBuffer::clip2D(int &x1, int &y1, int &u, int &v, int &width, int
return (width > 1 && height > 1);
}
-
/**
* Initializes a surface by resource Id
*
@@ -204,6 +214,10 @@ int RMGfxSourceBuffer::init(uint32 resID, int dimx, int dimy, bool bLoadPalette)
return init(RMRes(resID), dimx, dimy, bLoadPalette);
}
+void RMGfxSourceBuffer::offsetY(int nLines) {
+ RMGfxBuffer::offsetY(nLines, getBpp());
+}
+
/****************************************************************************\
* RMGfxWoodyBuffer Methods
\****************************************************************************/
@@ -440,6 +454,34 @@ void RMGfxTargetBuffer::freeBWPrecalcTable() {
_precalcTable = NULL;
}
+RMGfxTargetBuffer::operator byte *() {
+ return _buf;
+}
+
+RMGfxTargetBuffer::operator void *() {
+ return (void *)_buf;
+}
+
+RMGfxTargetBuffer::operator uint16 *() {
+ // FIXME: This may not be endian safe
+ return (uint16 *)_buf;
+}
+
+/**
+ * Offseting buffer
+ */
+void RMGfxTargetBuffer::offsetY(int nLines) {
+ RMGfxBuffer::offsetY(nLines, 16);
+}
+
+void RMGfxTargetBuffer::setTrackDirtyRects(bool v) {
+ _trackDirtyRects = v;
+}
+
+bool RMGfxTargetBuffer::getTrackDirtyRects() const {
+ return _trackDirtyRects;
+}
+
/****************************************************************************\
* RMGfxSourceBufferPal Methods
\****************************************************************************/
diff --git a/engines/tony/gfxcore.h b/engines/tony/gfxcore.h
index 4750e42d00..ac4eee05e4 100644
--- a/engines/tony/gfxcore.h
+++ b/engines/tony/gfxcore.h
@@ -145,13 +145,8 @@ public:
virtual void removeThis(CORO_PARAM, bool &result);
// Registration
- virtual void Register() {
- _nInList++;
- }
- virtual void Unregister() {
- _nInList--;
- assert(_nInList >= 0);
- }
+ virtual void Register();
+ virtual void Unregister();
};
@@ -209,9 +204,7 @@ public:
protected:
virtual void prepareImage();
bool clip2D(int &x1, int &y1, int &u, int &v, int &width, int &height, bool bUseSrc, RMGfxTargetBuffer *buf);
- void offsetY(int nLines) {
- RMGfxBuffer::offsetY(nLines, getBpp());
- }
+ void offsetY(int nLines);
public:
virtual int getBpp() = 0;
@@ -490,32 +483,19 @@ public:
void drawOT(CORO_PARAM);
void addPrim(RMGfxPrimitive *prim); // The pointer must be delted
- operator byte *() {
- return _buf;
- }
- operator void *() {
- return (void *)_buf;
- }
- operator uint16 *() {
- // FIXME: This may not be endian safe
- return (uint16 *)_buf;
- }
+ operator byte *();
+ operator void *();
+ operator uint16 *();
// Offseting buffer
- void offsetY(int nLines) {
- RMGfxBuffer::offsetY(nLines, 16);
- }
+ void offsetY(int nLines);
// Dirty rect methods
void addDirtyRect(const Common::Rect &r);
Common::List<Common::Rect> &getDirtyRects();
void clearDirtyRects();
- void setTrackDirtyRects(bool v) {
- _trackDirtyRects = v;
- }
- bool getTrackDirtyRects() const {
- return _trackDirtyRects;
- }
+ void setTrackDirtyRects(bool v);
+ bool getTrackDirtyRects() const;
};
diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp
index 647e4264c7..81d62a035c 100644
--- a/engines/tony/inventory.cpp
+++ b/engines/tony/inventory.cpp
@@ -736,6 +736,21 @@ int RMInventory::loadState(byte *state) {
return getSaveStateSize();
}
+RMInventory &RMInventory::operator+=(RMItem *item) {
+ addItem(item->mpalCode());
+ return *this;
+}
+
+RMInventory &RMInventory::operator+=(RMItem &item) {
+ addItem(item.mpalCode());
+ return *this;
+}
+
+RMInventory &RMInventory::operator+=(int code) {
+ addItem(code);
+ return *this;
+}
+
/****************************************************************************\
* RMInterface methods
\****************************************************************************/
diff --git a/engines/tony/inventory.h b/engines/tony/inventory.h
index a5b37748c3..ce94c86c1b 100644
--- a/engines/tony/inventory.h
+++ b/engines/tony/inventory.h
@@ -146,18 +146,9 @@ public:
* Add an item to the inventory
*/
void addItem(int code);
- RMInventory &operator+=(RMItem *item) {
- addItem(item->mpalCode());
- return *this;
- }
- RMInventory &operator+=(RMItem &item) {
- addItem(item.mpalCode());
- return *this;
- }
- RMInventory &operator+=(int code) {
- addItem(code);
- return *this;
- }
+ RMInventory &operator+=(RMItem *item);
+ RMInventory &operator+=(RMItem &item);
+ RMInventory &operator+=(int code);
/**
* Removes an item
diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp
index 7a151ac292..4fe19594f9 100644
--- a/engines/tony/loc.cpp
+++ b/engines/tony/loc.cpp
@@ -255,6 +255,13 @@ RMPattern::RMPattern() {
_slots = NULL;
}
+/**
+ * Reads the position of the pattern
+ */
+RMPoint RMPattern::pos() {
+ return _curPos;
+}
+
RMPattern::~RMPattern() {
if (_slots != NULL) {
delete[] _slots;
@@ -400,6 +407,10 @@ void RMSfx::stop() {
* RMItem Methods
\****************************************************************************/
+int RMItem::getCurPattern() {
+ return _nCurPattern;
+}
+
RMGfxSourceBuffer *RMItem::newItemSpriteBuffer(int dimx, int dimy, bool bPreRLE) {
if (_cm == CM_256) {
RMGfxSourceBuffer8RLE *spr;
@@ -627,6 +638,19 @@ void RMItem::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_END_CODE;
}
+/**
+ * Overloaded priority: it's based on Z ordering
+ */
+int RMItem::priority() {
+ return _z;
+}
+
+/**
+ * Pattern number
+ */
+int RMItem::numPattern() {
+ return _nPatterns;
+}
void RMItem::removeThis(CORO_PARAM, bool &result) {
// Remove from the OT list if the current frame is -1 (pattern over)
@@ -638,6 +662,14 @@ void RMItem::setStatus(int nStatus) {
_bIsActive = (nStatus > 0);
}
+RMPoint RMItem::hotspot() {
+ return _hot;
+}
+
+int RMItem::mpalCode() {
+ return _mpalCode;
+}
+
void RMItem::setPattern(int nPattern, bool bPlayP0) {
assert(nPattern >= 0 && nPattern <= _nPatterns);
@@ -747,6 +779,10 @@ void RMItem::changeHotspot(const RMPoint &pt) {
_hot = pt;
}
+void RMItem::setInitCurPattern(bool status) {
+ _bInitCurPattern = status;
+}
+
void RMItem::playSfx(int nSfx) {
if (nSfx < _nSfx)
_sfx[nSfx].play();
@@ -1429,6 +1465,10 @@ void RMCharacter::doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int loc) {
CORO_END_CODE;
}
+bool RMCharacter::endOfPath() {
+ return _bEndOfPath;
+}
+
void RMCharacter::stop(CORO_PARAM) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -1471,6 +1511,13 @@ void RMCharacter::stop(CORO_PARAM) {
CORO_END_CODE;
}
+/**
+ * Check if the character is moving
+ */
+bool RMCharacter::isMoving() {
+ return _bMoving;
+}
+
inline int RMCharacter::inWhichBox(const RMPoint &pt) {
return _theBoxes->whichBox(_curLocation, pt);
}
@@ -1582,6 +1629,14 @@ void RMCharacter::waitForEndMovement(CORO_PARAM) {
CORO_END_CODE;
}
+void RMCharacter::setFixedScroll(const RMPoint &fix) {
+ _fixedScroll = fix;
+}
+
+void RMCharacter::setSpeed(int speed) {
+ _curSpeed = speed;
+}
+
void RMCharacter::removeThis(CORO_PARAM, bool &result) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -1764,6 +1819,10 @@ RMBoxLoc *RMGameBoxes::getBoxes(int nLoc) {
return _allBoxes[nLoc];
}
+int RMGameBoxes::getLocBoxesCount() const {
+ return _nLocBoxes;
+}
+
bool RMGameBoxes::isInBox(int nLoc, int nBox, const RMPoint &pt) {
RMBoxLoc *cur = getBoxes(nLoc);
@@ -1869,6 +1928,14 @@ RMLocation::RMLocation() {
_cmode = CM_256;
}
+RMPoint RMLocation::TEMPGetTonyStart() {
+ return TEMPTonyStart;
+}
+
+int RMLocation::TEMPGetNumLoc() {
+ return TEMPNumLoc;
+}
+
/**
* Load a location (.LOC) from a given data stream
*
@@ -2178,6 +2245,12 @@ void RMLocation::pauseSound(bool bPause) {
_items[i].pauseSound(bPause);
}
+/**
+ * Read the current scroll position
+ */
+RMPoint RMLocation::scrollPosition() {
+ return _curScroll;
+}
/****************************************************************************\
* RMMessage Methods
@@ -2230,4 +2303,20 @@ void RMMessage::parseMessage() {
}
}
+bool RMMessage::isValid() {
+ return _lpMessage != NULL;
+}
+
+int RMMessage::numPeriods() {
+ return _nPeriods;
+}
+
+char *RMMessage::period(int num) {
+ return _lpPeriods[num];
+}
+
+char *RMMessage::operator[](int num) {
+ return _lpPeriods[num];
+}
+
} // End of namespace Tony
diff --git a/engines/tony/loc.h b/engines/tony/loc.h
index 6c28a66f65..61eece2440 100644
--- a/engines/tony/loc.h
+++ b/engines/tony/loc.h
@@ -152,9 +152,7 @@ public:
void stopSfx(RMSfx *sfx);
// Reads the position of the pattern
- RMPoint pos() {
- return _curPos;
- }
+ RMPoint pos();
void readFromStream(Common::ReadStream &ds, bool bLOX = false);
@@ -197,16 +195,14 @@ public:
protected:
int _z;
- RMPoint _pos; // Coordinate nonno
+ RMPoint _pos; // Coordinate ancestor
RMColorMode _cm;
RMPoint _curScroll;
byte _FX;
byte _FXparm;
- virtual int getCurPattern() {
- return _nCurPattern;
- }
+ virtual int getCurPattern();
private:
int _nCurPattern;
@@ -248,14 +244,10 @@ public:
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
// Overloaded priority: it's based on Z ordering
- virtual int priority() {
- return _z;
- }
+ virtual int priority();
// Pattern number
- int numPattern() {
- return _nPatterns;
- }
+ int numPattern();
// Set anew animation pattern, changing abruptly from the current
virtual void setPattern(int nPattern, bool bPlayP0 = false);
@@ -264,13 +256,9 @@ public:
void setStatus(int nStatus);
bool isIn(const RMPoint &pt, int *size = NULL);
- RMPoint hotspot() {
- return _hot;
- }
+ RMPoint hotspot();
bool getName(Common::String &name);
- int mpalCode() {
- return _mpalCode;
- }
+ int mpalCode();
// Unload
void unload();
@@ -281,9 +269,7 @@ public:
// Sets a new hotspot fro the object
void changeHotspot(const RMPoint &pt);
- void setInitCurPattern(bool status) {
- _bInitCurPattern = status;
- }
+ void setInitCurPattern(bool status);
void playSfx(int nSfx);
@@ -354,7 +340,7 @@ public:
// Get binding boxes for a given location
RMBoxLoc *getBoxes(int nLoc);
- int getLocBoxesCount() const { return _nLocBoxes; }
+ int getLocBoxesCount() const;
// Return the box which contains a given point
int whichBox(int nLoc, const RMPoint &pt);
@@ -431,7 +417,6 @@ protected:
bool _bMoving;
bool _bDrawNow;
bool _bNeedToStop;
-// virtual RMGfxPrimitive *NewItemPrimitive();
public:
RMCharacter();
@@ -448,17 +433,13 @@ public:
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
// TRUE if you just stopped
- bool endOfPath() {
- return _bEndOfPath;
- }
+ bool endOfPath();
// Change the pattern of a character to STOP
virtual void stop(CORO_PARAM);
// Check if the character is moving
- bool isMoving() {
- return _bMoving;
- }
+ bool isMoving();
// Move the character to a certain position
void move(CORO_PARAM, RMPoint pt, bool *result = NULL);
@@ -469,12 +450,8 @@ public:
// Wait for the end of movement
void waitForEndMovement(CORO_PARAM);
- void setFixedScroll(const RMPoint &fix) {
- _fixedScroll = fix;
- }
- void setSpeed(int speed) {
- _curSpeed = speed;
- }
+ void setFixedScroll(const RMPoint &fix);
+ void setSpeed(int speed);
};
@@ -531,14 +508,10 @@ public:
// @@@@@@@@@@@@@@@@@@@@@@@
RMPoint TEMPTonyStart;
- RMPoint TEMPGetTonyStart() {
- return TEMPTonyStart;
- }
+ RMPoint TEMPGetTonyStart();
int TEMPNumLoc;
- int TEMPGetNumLoc() {
- return TEMPNumLoc;
- }
+ int TEMPGetNumLoc();
public:
RMLocation();
@@ -573,9 +546,7 @@ public:
void updateScrolling(const RMPoint &ptShowThis);
// Read the current scroll position
- RMPoint scrollPosition() {
- return _curScroll;
- }
+ RMPoint scrollPosition();
// Pause sound
void pauseSound(bool bPause);
@@ -600,18 +571,10 @@ public:
virtual ~RMMessage();
void load(uint32 dwId);
- bool isValid() {
- return _lpMessage != NULL;
- }
- int numPeriods() {
- return _nPeriods;
- }
- char *period(int num) {
- return _lpPeriods[num];
- }
- char *operator[](int num) {
- return _lpPeriods[num];
- }
+ bool isValid();
+ int numPeriods();
+ char *period(int num);
+ char *operator[](int num);
};
} // End of namespace Tony
diff --git a/engines/tony/utils.cpp b/engines/tony/utils.cpp
index 99ba84ab19..3cc09a1454 100644
--- a/engines/tony/utils.cpp
+++ b/engines/tony/utils.cpp
@@ -87,6 +87,14 @@ RMPoint &RMPoint::operator=(RMPoint p) {
}
/**
+ * Set a point
+ */
+void RMPoint::set(int x1, int y1) {
+ _x = x1;
+ _y = y1;
+}
+
+/**
* Offsets the point by another point
*/
void RMPoint::offset(const RMPoint &p) {
@@ -174,6 +182,9 @@ void RMPoint::readFromStream(Common::ReadStream &ds) {
* RMPointReference methods
\****************************************************************************/
+RMPointReference::RMPointReference(int &x, int &y): _x(x), _y(y) {
+}
+
RMPointReference &RMPointReference::operator=(const RMPoint &p) {
_x = p._x; _y = p._y;
return *this;
@@ -184,6 +195,10 @@ RMPointReference &RMPointReference::operator-=(const RMPoint &p) {
return *this;
}
+RMPointReference::operator RMPoint() const {
+ return RMPoint(_x, _y);
+}
+
/****************************************************************************\
* RMRect methods
\****************************************************************************/
@@ -233,6 +248,14 @@ void RMRect::copyRect(const RMRect &rc) {
_y2 = rc._y2;
}
+RMPointReference &RMRect::topLeft() {
+ return _topLeft;
+}
+
+RMPointReference &RMRect::bottomRight() {
+ return _bottomRight;
+}
+
RMPoint RMRect::center() {
return RMPoint((_x2 - _x1) / 2, (_y2 - _y1) / 2);
}
@@ -328,6 +351,13 @@ void RMRect::readFromStream(Common::ReadStream &ds) {
_y2 = ds.readSint32LE();
}
+/**
+ * Check if RMPoint is in RMRect
+ */
+bool RMRect::ptInRect(const RMPoint &pt) {
+ return (pt._x >= _x1 && pt._x <= _x2 && pt._y >= _y1 && pt._y <= _y2);
+}
+
/****************************************************************************\
* Resource Update
\****************************************************************************/
diff --git a/engines/tony/utils.h b/engines/tony/utils.h
index a24e11f2b6..9f13e5f19b 100644
--- a/engines/tony/utils.h
+++ b/engines/tony/utils.h
@@ -58,10 +58,7 @@ public:
RMPoint &operator=(RMPoint p);
// Set
- void set(int x1, int y1) {
- _x = x1;
- _y = y1;
- }
+ void set(int x1, int y1);
// Offset
void offset(int xOff, int yOff);
@@ -88,10 +85,10 @@ public:
int &_x;
int &_y;
- RMPointReference(int &x, int &y): _x(x), _y(y) {}
+ RMPointReference(int &x, int &y);
RMPointReference &operator=(const RMPoint &p);
RMPointReference &operator-=(const RMPoint &p);
- operator RMPoint() const { return RMPoint(_x, _y); }
+ operator RMPoint() const;
};
class RMRect {
@@ -108,8 +105,8 @@ public:
RMRect(const RMRect &rc);
// Attributes
- RMPointReference &topLeft() { return _topLeft; }
- RMPointReference &bottomRight() { return _bottomRight; }
+ RMPointReference &topLeft();
+ RMPointReference &bottomRight();
RMPoint center();
int width() const;
int height() const;
@@ -145,9 +142,7 @@ public:
void normalizeRect();
// Point in rect
- bool ptInRect(const RMPoint &pt) {
- return (pt._x >= _x1 && pt._x <= _x2 && pt._y >= _y1 && pt._y <= _y2);
- }
+ bool ptInRect(const RMPoint &pt);
// Extract from data stream
void readFromStream(Common::ReadStream &ds);