TONY: Move code from .h to .cpp files

This commit is contained in:
Strangerke 2012-09-02 10:34:11 +02:00
parent 1f41e55731
commit c737e64298
12 changed files with 279 additions and 145 deletions

View file

@ -188,6 +188,17 @@ void RMFontColor::setBaseColor(byte r1, byte g1, byte b1) {
_letter[i].loadPaletteWA(pal); _letter[i].loadPaletteWA(pal);
} }
/***************************************************************************\
* 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 * RMFontDialog Methods
\****************************************************************************/ \****************************************************************************/
@ -359,7 +370,6 @@ RMText::RMText() {
} }
RMText::~RMText() { RMText::~RMText() {
} }
void RMText::unload() { void RMText::unload() {
@ -571,6 +581,23 @@ void RMText::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_END_CODE; 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 * RMTextDialog Methods
\****************************************************************************/ \****************************************************************************/
@ -751,6 +778,13 @@ void RMTextDialog::setInput(RMInput *input) {
_input = input; _input = input;
} }
/**
* Set the position
*/
void RMTextDialog::setPosition(const RMPoint &pt) {
_dst = pt;
}
/****************************************************************************\ /****************************************************************************\
* RMTextDialogScrolling Methods * RMTextDialogScrolling Methods
\****************************************************************************/ \****************************************************************************/
@ -801,7 +835,6 @@ RMTextItemName::RMTextItemName() : RMText() {
} }
RMTextItemName::~RMTextItemName() { RMTextItemName::~RMTextItemName() {
} }
void RMTextItemName::doFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv) { void RMTextItemName::doFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv) {
@ -886,6 +919,13 @@ bool RMTextItemName::isItemSelected() {
return _item != NULL; return _item != NULL;
} }
void RMTextItemName::setMouseCoord(const RMPoint &m) {
_mpos = m;
}
void RMTextItemName::removeThis(CORO_PARAM, bool &result) {
result = true;
}
/****************************************************************************\ /****************************************************************************\
* RMDialogChoice Methods * RMDialogChoice Methods

View file

@ -126,12 +126,8 @@ protected:
protected: protected:
// Overloaded methods // Overloaded methods
int convertToLetter(byte nChar) { int convertToLetter(byte nChar);
return _cTable[nChar]; int letterLength(int nChar, int nNext = 0);
}
int letterLength(int nChar, int nNext = 0) {
return (nChar != -1 ? _lTable[(byte)nChar] + _l2Table[(byte)nChar][(byte)nNext] : _lDefault);
}
public: public:
int letterHeight() { int letterHeight() {
@ -206,10 +202,7 @@ public:
static void unload(); static void unload();
// Set the alignment type // Set the alignment type
void setAlignType(HorAlign aHor, VerAlign aVer) { void setAlignType(HorAlign aHor, VerAlign aVer);
_aHorType = aHor;
_aVerType = aVer;
}
// Sets the maximum length of a line in pixels (used to format the text) // Sets the maximum length of a line in pixels (used to format the text)
void setMaxLineLength(int max); void setMaxLineLength(int max);
@ -225,11 +218,7 @@ public:
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
// Set the base color // Set the base color
void setColor(byte r, byte g, byte b) { void setColor(byte r, byte g, byte b);
_textR = r;
_textG = g;
_textB = b;
}
}; };
/** /**
@ -269,9 +258,7 @@ public:
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
// Set the position // Set the position
void setPosition(const RMPoint &pt) { void setPosition(const RMPoint &pt);
_dst = pt;
}
// Waiting // Waiting
void waitForEndDisplay(CORO_PARAM); void waitForEndDisplay(CORO_PARAM);
@ -320,9 +307,7 @@ public:
RMTextItemName(); RMTextItemName();
virtual ~RMTextItemName(); virtual ~RMTextItemName();
void setMouseCoord(const RMPoint &m) { void setMouseCoord(const RMPoint &m);
_mpos = m;
}
void doFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv); void doFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv);
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
@ -331,9 +316,7 @@ public:
RMItem *getSelectedItem(); RMItem *getSelectedItem();
bool isItemSelected(); bool isItemSelected();
virtual void removeThis(CORO_PARAM, bool &result) { virtual void removeThis(CORO_PARAM, bool &result);
result = true;
}
}; };

View file

@ -128,6 +128,14 @@ void RMOptionButton::addToList(RMGfxTargetBuffer &bigBuf) {
bigBuf.addPrim(new RMGfxPrimitive(this, _rect)); bigBuf.addPrim(new RMGfxPrimitive(this, _rect));
} }
bool RMOptionButton::isActive() {
return _bActive;
}
void RMOptionButton::setActiveState(bool bState) {
_bActive = bState;
}
/****************************************************************************\ /****************************************************************************\
* RMOptionSlide Methods * RMOptionSlide Methods
\****************************************************************************/ \****************************************************************************/
@ -253,6 +261,10 @@ void RMOptionSlide::addToList(RMGfxTargetBuffer &bigBuf) {
bigBuf.addPrim(new RMGfxPrimitive(this)); bigBuf.addPrim(new RMGfxPrimitive(this));
} }
int RMOptionSlide::getValue() {
return _nValue;
}
/****************************************************************************\ /****************************************************************************\
* RMOptionScreen Methods * RMOptionScreen Methods
\****************************************************************************/ \****************************************************************************/

View file

@ -189,12 +189,8 @@ public:
bool doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick); bool doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick);
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
void addToList(RMGfxTargetBuffer &bigBuf); void addToList(RMGfxTargetBuffer &bigBuf);
bool isActive() { bool isActive();
return _bActive; void setActiveState(bool bState);
}
void setActiveState(bool bState) {
_bActive = bState;
}
}; };
class RMOptionSlide : public RMGfxTaskSetPrior { class RMOptionSlide : public RMGfxTaskSetPrior {
@ -219,9 +215,7 @@ public:
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
void addToList(RMGfxTargetBuffer &bigBuf); void addToList(RMGfxTargetBuffer &bigBuf);
int getValue() { int getValue();
return _nValue;
}
}; };
class RMOptionScreen : public RMGfxWoodyBuffer { class RMOptionScreen : public RMGfxWoodyBuffer {

View file

@ -49,6 +49,17 @@ void RMGfxTask::removeThis(CORO_PARAM, bool &result) {
result = true; result = true;
} }
/**
* Registration
*/
void RMGfxTask::Register() {
_nInList++;
}
void RMGfxTask::Unregister() {
_nInList--;
assert(_nInList >= 0);
}
/****************************************************************************\ /****************************************************************************\
* RMGfxTaskSetPrior Methods * 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); return (width > 1 && height > 1);
} }
/** /**
* Initializes a surface by resource Id * 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); return init(RMRes(resID), dimx, dimy, bLoadPalette);
} }
void RMGfxSourceBuffer::offsetY(int nLines) {
RMGfxBuffer::offsetY(nLines, getBpp());
}
/****************************************************************************\ /****************************************************************************\
* RMGfxWoodyBuffer Methods * RMGfxWoodyBuffer Methods
\****************************************************************************/ \****************************************************************************/
@ -440,6 +454,34 @@ void RMGfxTargetBuffer::freeBWPrecalcTable() {
_precalcTable = NULL; _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 * RMGfxSourceBufferPal Methods
\****************************************************************************/ \****************************************************************************/

View file

@ -145,13 +145,8 @@ public:
virtual void removeThis(CORO_PARAM, bool &result); virtual void removeThis(CORO_PARAM, bool &result);
// Registration // Registration
virtual void Register() { virtual void Register();
_nInList++; virtual void Unregister();
}
virtual void Unregister() {
_nInList--;
assert(_nInList >= 0);
}
}; };
@ -209,9 +204,7 @@ public:
protected: protected:
virtual void prepareImage(); virtual void prepareImage();
bool clip2D(int &x1, int &y1, int &u, int &v, int &width, int &height, bool bUseSrc, RMGfxTargetBuffer *buf); bool clip2D(int &x1, int &y1, int &u, int &v, int &width, int &height, bool bUseSrc, RMGfxTargetBuffer *buf);
void offsetY(int nLines) { void offsetY(int nLines);
RMGfxBuffer::offsetY(nLines, getBpp());
}
public: public:
virtual int getBpp() = 0; virtual int getBpp() = 0;
@ -490,32 +483,19 @@ public:
void drawOT(CORO_PARAM); void drawOT(CORO_PARAM);
void addPrim(RMGfxPrimitive *prim); // The pointer must be delted void addPrim(RMGfxPrimitive *prim); // The pointer must be delted
operator byte *() { operator byte *();
return _buf; operator void *();
} operator uint16 *();
operator void *() {
return (void *)_buf;
}
operator uint16 *() {
// FIXME: This may not be endian safe
return (uint16 *)_buf;
}
// Offseting buffer // Offseting buffer
void offsetY(int nLines) { void offsetY(int nLines);
RMGfxBuffer::offsetY(nLines, 16);
}
// Dirty rect methods // Dirty rect methods
void addDirtyRect(const Common::Rect &r); void addDirtyRect(const Common::Rect &r);
Common::List<Common::Rect> &getDirtyRects(); Common::List<Common::Rect> &getDirtyRects();
void clearDirtyRects(); void clearDirtyRects();
void setTrackDirtyRects(bool v) { void setTrackDirtyRects(bool v);
_trackDirtyRects = v; bool getTrackDirtyRects() const;
}
bool getTrackDirtyRects() const {
return _trackDirtyRects;
}
}; };

View file

@ -736,6 +736,21 @@ int RMInventory::loadState(byte *state) {
return getSaveStateSize(); 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 * RMInterface methods
\****************************************************************************/ \****************************************************************************/

View file

@ -146,18 +146,9 @@ public:
* Add an item to the inventory * Add an item to the inventory
*/ */
void addItem(int code); void addItem(int code);
RMInventory &operator+=(RMItem *item) { RMInventory &operator+=(RMItem *item);
addItem(item->mpalCode()); RMInventory &operator+=(RMItem &item);
return *this; RMInventory &operator+=(int code);
}
RMInventory &operator+=(RMItem &item) {
addItem(item.mpalCode());
return *this;
}
RMInventory &operator+=(int code) {
addItem(code);
return *this;
}
/** /**
* Removes an item * Removes an item

View file

@ -255,6 +255,13 @@ RMPattern::RMPattern() {
_slots = NULL; _slots = NULL;
} }
/**
* Reads the position of the pattern
*/
RMPoint RMPattern::pos() {
return _curPos;
}
RMPattern::~RMPattern() { RMPattern::~RMPattern() {
if (_slots != NULL) { if (_slots != NULL) {
delete[] _slots; delete[] _slots;
@ -400,6 +407,10 @@ void RMSfx::stop() {
* RMItem Methods * RMItem Methods
\****************************************************************************/ \****************************************************************************/
int RMItem::getCurPattern() {
return _nCurPattern;
}
RMGfxSourceBuffer *RMItem::newItemSpriteBuffer(int dimx, int dimy, bool bPreRLE) { RMGfxSourceBuffer *RMItem::newItemSpriteBuffer(int dimx, int dimy, bool bPreRLE) {
if (_cm == CM_256) { if (_cm == CM_256) {
RMGfxSourceBuffer8RLE *spr; RMGfxSourceBuffer8RLE *spr;
@ -627,6 +638,19 @@ void RMItem::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_END_CODE; 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) { void RMItem::removeThis(CORO_PARAM, bool &result) {
// Remove from the OT list if the current frame is -1 (pattern over) // 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); _bIsActive = (nStatus > 0);
} }
RMPoint RMItem::hotspot() {
return _hot;
}
int RMItem::mpalCode() {
return _mpalCode;
}
void RMItem::setPattern(int nPattern, bool bPlayP0) { void RMItem::setPattern(int nPattern, bool bPlayP0) {
assert(nPattern >= 0 && nPattern <= _nPatterns); assert(nPattern >= 0 && nPattern <= _nPatterns);
@ -747,6 +779,10 @@ void RMItem::changeHotspot(const RMPoint &pt) {
_hot = pt; _hot = pt;
} }
void RMItem::setInitCurPattern(bool status) {
_bInitCurPattern = status;
}
void RMItem::playSfx(int nSfx) { void RMItem::playSfx(int nSfx) {
if (nSfx < _nSfx) if (nSfx < _nSfx)
_sfx[nSfx].play(); _sfx[nSfx].play();
@ -1429,6 +1465,10 @@ void RMCharacter::doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int loc) {
CORO_END_CODE; CORO_END_CODE;
} }
bool RMCharacter::endOfPath() {
return _bEndOfPath;
}
void RMCharacter::stop(CORO_PARAM) { void RMCharacter::stop(CORO_PARAM) {
CORO_BEGIN_CONTEXT; CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx); CORO_END_CONTEXT(_ctx);
@ -1471,6 +1511,13 @@ void RMCharacter::stop(CORO_PARAM) {
CORO_END_CODE; CORO_END_CODE;
} }
/**
* Check if the character is moving
*/
bool RMCharacter::isMoving() {
return _bMoving;
}
inline int RMCharacter::inWhichBox(const RMPoint &pt) { inline int RMCharacter::inWhichBox(const RMPoint &pt) {
return _theBoxes->whichBox(_curLocation, pt); return _theBoxes->whichBox(_curLocation, pt);
} }
@ -1582,6 +1629,14 @@ void RMCharacter::waitForEndMovement(CORO_PARAM) {
CORO_END_CODE; 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) { void RMCharacter::removeThis(CORO_PARAM, bool &result) {
CORO_BEGIN_CONTEXT; CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx); CORO_END_CONTEXT(_ctx);
@ -1764,6 +1819,10 @@ RMBoxLoc *RMGameBoxes::getBoxes(int nLoc) {
return _allBoxes[nLoc]; return _allBoxes[nLoc];
} }
int RMGameBoxes::getLocBoxesCount() const {
return _nLocBoxes;
}
bool RMGameBoxes::isInBox(int nLoc, int nBox, const RMPoint &pt) { bool RMGameBoxes::isInBox(int nLoc, int nBox, const RMPoint &pt) {
RMBoxLoc *cur = getBoxes(nLoc); RMBoxLoc *cur = getBoxes(nLoc);
@ -1869,6 +1928,14 @@ RMLocation::RMLocation() {
_cmode = CM_256; _cmode = CM_256;
} }
RMPoint RMLocation::TEMPGetTonyStart() {
return TEMPTonyStart;
}
int RMLocation::TEMPGetNumLoc() {
return TEMPNumLoc;
}
/** /**
* Load a location (.LOC) from a given data stream * Load a location (.LOC) from a given data stream
* *
@ -2178,6 +2245,12 @@ void RMLocation::pauseSound(bool bPause) {
_items[i].pauseSound(bPause); _items[i].pauseSound(bPause);
} }
/**
* Read the current scroll position
*/
RMPoint RMLocation::scrollPosition() {
return _curScroll;
}
/****************************************************************************\ /****************************************************************************\
* RMMessage Methods * 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 } // End of namespace Tony

View file

@ -152,9 +152,7 @@ public:
void stopSfx(RMSfx *sfx); void stopSfx(RMSfx *sfx);
// Reads the position of the pattern // Reads the position of the pattern
RMPoint pos() { RMPoint pos();
return _curPos;
}
void readFromStream(Common::ReadStream &ds, bool bLOX = false); void readFromStream(Common::ReadStream &ds, bool bLOX = false);
@ -197,16 +195,14 @@ public:
protected: protected:
int _z; int _z;
RMPoint _pos; // Coordinate nonno RMPoint _pos; // Coordinate ancestor
RMColorMode _cm; RMColorMode _cm;
RMPoint _curScroll; RMPoint _curScroll;
byte _FX; byte _FX;
byte _FXparm; byte _FXparm;
virtual int getCurPattern() { virtual int getCurPattern();
return _nCurPattern;
}
private: private:
int _nCurPattern; int _nCurPattern;
@ -248,14 +244,10 @@ public:
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
// Overloaded priority: it's based on Z ordering // Overloaded priority: it's based on Z ordering
virtual int priority() { virtual int priority();
return _z;
}
// Pattern number // Pattern number
int numPattern() { int numPattern();
return _nPatterns;
}
// Set anew animation pattern, changing abruptly from the current // Set anew animation pattern, changing abruptly from the current
virtual void setPattern(int nPattern, bool bPlayP0 = false); virtual void setPattern(int nPattern, bool bPlayP0 = false);
@ -264,13 +256,9 @@ public:
void setStatus(int nStatus); void setStatus(int nStatus);
bool isIn(const RMPoint &pt, int *size = NULL); bool isIn(const RMPoint &pt, int *size = NULL);
RMPoint hotspot() { RMPoint hotspot();
return _hot;
}
bool getName(Common::String &name); bool getName(Common::String &name);
int mpalCode() { int mpalCode();
return _mpalCode;
}
// Unload // Unload
void unload(); void unload();
@ -281,9 +269,7 @@ public:
// Sets a new hotspot fro the object // Sets a new hotspot fro the object
void changeHotspot(const RMPoint &pt); void changeHotspot(const RMPoint &pt);
void setInitCurPattern(bool status) { void setInitCurPattern(bool status);
_bInitCurPattern = status;
}
void playSfx(int nSfx); void playSfx(int nSfx);
@ -354,7 +340,7 @@ public:
// Get binding boxes for a given location // Get binding boxes for a given location
RMBoxLoc *getBoxes(int nLoc); RMBoxLoc *getBoxes(int nLoc);
int getLocBoxesCount() const { return _nLocBoxes; } int getLocBoxesCount() const;
// Return the box which contains a given point // Return the box which contains a given point
int whichBox(int nLoc, const RMPoint &pt); int whichBox(int nLoc, const RMPoint &pt);
@ -431,7 +417,6 @@ protected:
bool _bMoving; bool _bMoving;
bool _bDrawNow; bool _bDrawNow;
bool _bNeedToStop; bool _bNeedToStop;
// virtual RMGfxPrimitive *NewItemPrimitive();
public: public:
RMCharacter(); RMCharacter();
@ -448,17 +433,13 @@ public:
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
// TRUE if you just stopped // TRUE if you just stopped
bool endOfPath() { bool endOfPath();
return _bEndOfPath;
}
// Change the pattern of a character to STOP // Change the pattern of a character to STOP
virtual void stop(CORO_PARAM); virtual void stop(CORO_PARAM);
// Check if the character is moving // Check if the character is moving
bool isMoving() { bool isMoving();
return _bMoving;
}
// Move the character to a certain position // Move the character to a certain position
void move(CORO_PARAM, RMPoint pt, bool *result = NULL); void move(CORO_PARAM, RMPoint pt, bool *result = NULL);
@ -469,12 +450,8 @@ public:
// Wait for the end of movement // Wait for the end of movement
void waitForEndMovement(CORO_PARAM); void waitForEndMovement(CORO_PARAM);
void setFixedScroll(const RMPoint &fix) { void setFixedScroll(const RMPoint &fix);
_fixedScroll = fix; void setSpeed(int speed);
}
void setSpeed(int speed) {
_curSpeed = speed;
}
}; };
@ -531,14 +508,10 @@ public:
// @@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@
RMPoint TEMPTonyStart; RMPoint TEMPTonyStart;
RMPoint TEMPGetTonyStart() { RMPoint TEMPGetTonyStart();
return TEMPTonyStart;
}
int TEMPNumLoc; int TEMPNumLoc;
int TEMPGetNumLoc() { int TEMPGetNumLoc();
return TEMPNumLoc;
}
public: public:
RMLocation(); RMLocation();
@ -573,9 +546,7 @@ public:
void updateScrolling(const RMPoint &ptShowThis); void updateScrolling(const RMPoint &ptShowThis);
// Read the current scroll position // Read the current scroll position
RMPoint scrollPosition() { RMPoint scrollPosition();
return _curScroll;
}
// Pause sound // Pause sound
void pauseSound(bool bPause); void pauseSound(bool bPause);
@ -600,18 +571,10 @@ public:
virtual ~RMMessage(); virtual ~RMMessage();
void load(uint32 dwId); void load(uint32 dwId);
bool isValid() { bool isValid();
return _lpMessage != NULL; int numPeriods();
} char *period(int num);
int numPeriods() { char *operator[](int num);
return _nPeriods;
}
char *period(int num) {
return _lpPeriods[num];
}
char *operator[](int num) {
return _lpPeriods[num];
}
}; };
} // End of namespace Tony } // End of namespace Tony

View file

@ -86,6 +86,14 @@ RMPoint &RMPoint::operator=(RMPoint p) {
return *this; return *this;
} }
/**
* Set a point
*/
void RMPoint::set(int x1, int y1) {
_x = x1;
_y = y1;
}
/** /**
* Offsets the point by another point * Offsets the point by another point
*/ */
@ -174,6 +182,9 @@ void RMPoint::readFromStream(Common::ReadStream &ds) {
* RMPointReference methods * RMPointReference methods
\****************************************************************************/ \****************************************************************************/
RMPointReference::RMPointReference(int &x, int &y): _x(x), _y(y) {
}
RMPointReference &RMPointReference::operator=(const RMPoint &p) { RMPointReference &RMPointReference::operator=(const RMPoint &p) {
_x = p._x; _y = p._y; _x = p._x; _y = p._y;
return *this; return *this;
@ -184,6 +195,10 @@ RMPointReference &RMPointReference::operator-=(const RMPoint &p) {
return *this; return *this;
} }
RMPointReference::operator RMPoint() const {
return RMPoint(_x, _y);
}
/****************************************************************************\ /****************************************************************************\
* RMRect methods * RMRect methods
\****************************************************************************/ \****************************************************************************/
@ -233,6 +248,14 @@ void RMRect::copyRect(const RMRect &rc) {
_y2 = rc._y2; _y2 = rc._y2;
} }
RMPointReference &RMRect::topLeft() {
return _topLeft;
}
RMPointReference &RMRect::bottomRight() {
return _bottomRight;
}
RMPoint RMRect::center() { RMPoint RMRect::center() {
return RMPoint((_x2 - _x1) / 2, (_y2 - _y1) / 2); return RMPoint((_x2 - _x1) / 2, (_y2 - _y1) / 2);
} }
@ -328,6 +351,13 @@ void RMRect::readFromStream(Common::ReadStream &ds) {
_y2 = ds.readSint32LE(); _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 * Resource Update
\****************************************************************************/ \****************************************************************************/

View file

@ -58,10 +58,7 @@ public:
RMPoint &operator=(RMPoint p); RMPoint &operator=(RMPoint p);
// Set // Set
void set(int x1, int y1) { void set(int x1, int y1);
_x = x1;
_y = y1;
}
// Offset // Offset
void offset(int xOff, int yOff); void offset(int xOff, int yOff);
@ -88,10 +85,10 @@ public:
int &_x; int &_x;
int &_y; 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);
RMPointReference &operator-=(const RMPoint &p); RMPointReference &operator-=(const RMPoint &p);
operator RMPoint() const { return RMPoint(_x, _y); } operator RMPoint() const;
}; };
class RMRect { class RMRect {
@ -108,8 +105,8 @@ public:
RMRect(const RMRect &rc); RMRect(const RMRect &rc);
// Attributes // Attributes
RMPointReference &topLeft() { return _topLeft; } RMPointReference &topLeft();
RMPointReference &bottomRight() { return _bottomRight; } RMPointReference &bottomRight();
RMPoint center(); RMPoint center();
int width() const; int width() const;
int height() const; int height() const;
@ -145,9 +142,7 @@ public:
void normalizeRect(); void normalizeRect();
// Point in rect // Point in rect
bool ptInRect(const RMPoint &pt) { bool ptInRect(const RMPoint &pt);
return (pt._x >= _x1 && pt._x <= _x2 && pt._y >= _y1 && pt._y <= _y2);
}
// Extract from data stream // Extract from data stream
void readFromStream(Common::ReadStream &ds); void readFromStream(Common::ReadStream &ds);