TONY: Rename variables in utils.h

This commit is contained in:
Strangerke 2012-06-11 20:24:25 +02:00
parent 71329df502
commit 02c8ccebcb
10 changed files with 256 additions and 252 deletions

View file

@ -477,7 +477,7 @@ DECLARE_CUSTOM_FUNCTION(ClearScreen)(CORO_PARAM, uint32, uint32, uint32, uint32)
DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgEnd)(CORO_PARAM, uint32 bNotEnableTony, uint32, uint32, uint32) {
GLOBALS.Freeze();
GLOBALS.LoadLocation(GLOBALS.SFM_nLoc, RMPoint(GLOBALS.SFM_pt.x, GLOBALS.SFM_pt.y), RMPoint(-1, -1));
GLOBALS.LoadLocation(GLOBALS.SFM_nLoc, RMPoint(GLOBALS.SFM_pt._x, GLOBALS.SFM_pt._y), RMPoint(-1, -1));
if (!bNotEnableTony)
GLOBALS._tony->show();
GLOBALS.Unfreeze();
@ -593,7 +593,7 @@ DECLARE_CUSTOM_FUNCTION(RestoreTonyPosition)(CORO_PARAM, uint32, uint32, uint32,
CORO_BEGIN_CODE(_ctx);
CORO_INVOKE_4(ChangeLocation, GLOBALS._saveTonyLoc, GLOBALS._saveTonyPos.x, GLOBALS._saveTonyPos.y, 0);
CORO_INVOKE_4(ChangeLocation, GLOBALS._saveTonyLoc, GLOBALS._saveTonyPos._x, GLOBALS._saveTonyPos._y, 0);
MCharResetCodes();
@ -1299,14 +1299,14 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui
if (sX) {
if (_ctx->lx > 0)
_ctx->pt.x += (_ctx->dimx * _ctx->dwCurTime) / _ctx->dwTotalTime;
_ctx->pt._x += (_ctx->dimx * _ctx->dwCurTime) / _ctx->dwTotalTime;
else
_ctx->pt.x -= (_ctx->dimx * _ctx->dwCurTime) / _ctx->dwTotalTime;
_ctx->pt._x -= (_ctx->dimx * _ctx->dwCurTime) / _ctx->dwTotalTime;
} else {
if (_ctx->ly > 0)
_ctx->pt.y += (_ctx->dimy * _ctx->dwCurTime) / _ctx->dwTotalTime;
_ctx->pt._y += (_ctx->dimy * _ctx->dwCurTime) / _ctx->dwTotalTime;
else
_ctx->pt.y -= (_ctx->dimy * _ctx->dwCurTime) / _ctx->dwTotalTime;
_ctx->pt._y -= (_ctx->dimy * _ctx->dwCurTime) / _ctx->dwTotalTime;
}
@ -1323,14 +1323,14 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui
// Set the position finale
if (sX) {
if (_ctx->lx > 0)
_ctx->pt.x = _ctx->startpt.x + _ctx->dimx;
_ctx->pt._x = _ctx->startpt._x + _ctx->dimx;
else
_ctx->pt.x = _ctx->startpt.x - _ctx->dimx;
_ctx->pt._x = _ctx->startpt._x - _ctx->dimx;
} else {
if (_ctx->ly > 0)
_ctx->pt.y = _ctx->startpt.y + _ctx->dimy;
_ctx->pt._y = _ctx->startpt._y + _ctx->dimy;
else
_ctx->pt.y = _ctx->startpt.y - _ctx->dimy;
_ctx->pt._y = _ctx->startpt._y - _ctx->dimy;
}
GLOBALS.Freeze();
@ -1345,12 +1345,13 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui
DECLARE_CUSTOM_FUNCTION(ChangeHotspot)(CORO_PARAM, uint32 dwCode, uint32 nX, uint32 nY, uint32) {
int i;
for (i = 0; i < GLOBALS._curChangedHotspot; i++)
for (i = 0; i < GLOBALS._curChangedHotspot; i++) {
if (GLOBALS._changedHotspot[i]._dwCode == dwCode) {
GLOBALS._changedHotspot[i]._nX = nX;
GLOBALS._changedHotspot[i]._nY = nY;
break;
}
}
if (i == GLOBALS._curChangedHotspot) {
GLOBALS._changedHotspot[i]._dwCode = dwCode;

View file

@ -94,8 +94,8 @@ bool Debugger::Cmd_Scene(int argc, const char **argv) {
RMPoint scenePos;
if (argc >= 4) {
scenePos.x = strToInt(argv[2]);
scenePos.y = strToInt(argv[3]);
scenePos._x = strToInt(argv[2]);
scenePos._y = strToInt(argv[3]);
} else {
// Get the box areas for the scene, and choose one so as to have a default
// position for Tony that will be in the walkable areas
@ -106,8 +106,8 @@ bool Debugger::Cmd_Scene(int argc, const char **argv) {
// Set up a process to change the scene
ChangeSceneDetails details;
details.sceneNumber = sceneNumber;
details.x = scenePos.x;
details.y = scenePos.y;
details.x = scenePos._x;
details.y = scenePos._y;
CoroScheduler.createProcess(DebugChangeScene, &details, sizeof(ChangeSceneDetails));
return false;

View file

@ -1930,8 +1930,8 @@ void RMText::writeText(const RMString &text, RMFontColor *font, int *time) {
}
prim = font->makeLetterPrimitive(*p, len);
prim->getDst().x1 = x;
prim->getDst().y1 = y;
prim->getDst()._x1 = x;
prim->getDst()._y1 = y;
addPrim(prim);
numchar++;
@ -1949,14 +1949,14 @@ void RMText::writeText(const RMString &text, RMFontColor *font, int *time) {
void RMText::clipOnScreen(RMGfxPrimitive *prim) {
// Don't let it go outside the screen
if (prim->getDst().x1 < 5)
prim->getDst().x1 = 5;
if (prim->getDst().y1 < 5)
prim->getDst().y1 = 5;
if (prim->getDst().x1 + _dimx > 635)
prim->getDst().x1 = 635 - _dimx;
if (prim->getDst().y1 + _dimy > 475)
prim->getDst().y1 = 475 - _dimy;
if (prim->getDst()._x1 < 5)
prim->getDst()._x1 = 5;
if (prim->getDst()._y1 < 5)
prim->getDst()._y1 = 5;
if (prim->getDst()._x1 + _dimx > 635)
prim->getDst()._x1 = 635 - _dimx;
if (prim->getDst()._y1 + _dimy > 475)
prim->getDst()._y1 = 475 - _dimy;
}
void RMText::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
@ -1975,10 +1975,10 @@ void RMText::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
if (_aVerType == VTOP) {
} else if (_aVerType == VCENTER) {
prim->getDst().y1 -= _dimy / 2;
prim->getDst()._y1 -= _dimy / 2;
} else if (_aVerType == VBOTTOM) {
prim->getDst().y1 -= _dimy;
prim->getDst()._y1 -= _dimy;
}
clipOnScreen(prim);
@ -2416,7 +2416,7 @@ void RMDialogChoice::prepare(CORO_PARAM) {
CORO_INVOKE_0(drawOT);
clearOT();
_ptDrawPos.set(0, 480 - _ctx->ptPos.y);
_ptDrawPos.set(0, 480 - _ctx->ptPos._y);
CORO_END_CODE;
}
@ -2436,7 +2436,7 @@ void RMDialogChoice::setSelected(CORO_PARAM, int pos) {
if (_curSelection != -1) {
_ctx->box.setColor(0xCC, 0xCC, 0xFF);
_ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[_curSelection].y);
_ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[_curSelection]._y);
_ctx->rc.bottomRight() = _ctx->rc.topLeft() + RMPoint(597, _drawedStrings[_curSelection].getDimy());
addPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc));
@ -2447,7 +2447,7 @@ void RMDialogChoice::setSelected(CORO_PARAM, int pos) {
if (pos != -1) {
_ctx->box.setColor(100, 100, 100);
_ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[pos].y);
_ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[pos]._y);
_ctx->rc.bottomRight() = _ctx->rc.topLeft() + RMPoint(597, _drawedStrings[pos].getDimy());
addPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc));
addPrim(new RMGfxPrimitive(&_drawedStrings[pos], _ptDrawStrings[pos]));
@ -2481,7 +2481,7 @@ void RMDialogChoice::show(CORO_PARAM, RMGfxTargetBuffer *bigBuf) {
_bShow = true;
} else {
_ctx->starttime = _vm->getTime();
_ctx->deltay = 480 - _ptDrawPos.y;
_ctx->deltay = 480 - _ptDrawPos._y;
_ctx->destpt = _ptDrawPos;
_ptDrawPos.set(0, 480);
@ -2494,11 +2494,11 @@ void RMDialogChoice::show(CORO_PARAM, RMGfxTargetBuffer *bigBuf) {
CORO_INVOKE_0(mainWaitFrame);
mainFreeze();
_ctx->elaps = _vm->getTime() - _ctx->starttime;
_ptDrawPos.y = 480 - ((_ctx->deltay * 100) / 700 * _ctx->elaps) / 100;
_ptDrawPos._y = 480 - ((_ctx->deltay * 100) / 700 * _ctx->elaps) / 100;
mainUnfreeze();
}
_ptDrawPos.y = _ctx->destpt.y;
_ptDrawPos._y = _ctx->destpt._y;
}
CORO_END_CODE;
@ -2532,13 +2532,13 @@ void RMDialogChoice::hide(CORO_PARAM) {
if (1) {
_ctx->starttime = _vm->getTime();
_ctx->deltay = 480 - _ptDrawPos.y;
_ctx->deltay = 480 - _ptDrawPos._y;
_ctx->elaps = 0;
while (_ctx->elaps < 700) {
CORO_INVOKE_0(mainWaitFrame);
mainFreeze();
_ctx->elaps = _vm->getTime() - _ctx->starttime;
_ptDrawPos.y = 480 - ((_ctx->deltay * 100) / 700 * (700 - _ctx->elaps)) / 100;
_ptDrawPos._y = 480 - ((_ctx->deltay * 100) / 700 * (700 - _ctx->elaps)) / 100;
mainUnfreeze();
}
}
@ -2562,9 +2562,9 @@ void RMDialogChoice::doFrame(CORO_PARAM, RMPoint ptMousePos) {
CORO_BEGIN_CODE(_ctx);
if (ptMousePos.y > _ptDrawPos.y) {
if (ptMousePos._y > _ptDrawPos._y) {
for (_ctx->i = 0; _ctx->i < _numChoices; _ctx->i++) {
if ((ptMousePos.y >= _ptDrawPos.y + _ptDrawStrings[_ctx->i].y) && (ptMousePos.y < _ptDrawPos.y + _ptDrawStrings[_ctx->i].y + _drawedStrings[_ctx->i].getDimy())) {
if ((ptMousePos._y >= _ptDrawPos._y + _ptDrawStrings[_ctx->i]._y) && (ptMousePos._y < _ptDrawPos._y + _ptDrawStrings[_ctx->i]._y + _drawedStrings[_ctx->i].getDimy())) {
CORO_INVOKE_1(setSelected, _ctx->i);
break;
}

View file

@ -128,7 +128,7 @@ RMOptionButton::RMOptionButton(uint32 dwRes, RMPoint pt, bool bDoubleState) {
_buf = new RMGfxSourceBuffer16(false);
_buf->init(raw, raw.width(), raw.height());
_rect.setRect(pt.x, pt.y, pt.x + raw.width() - 1, pt.y + raw.height() - 1);
_rect.setRect(pt._x, pt._y, pt._x + raw.width() - 1, pt._y + raw.height() - 1);
_bActive = false;
_bHasGfx = true;
_bDoubleState = bDoubleState;
@ -215,8 +215,8 @@ RMOptionSlide::RMOptionSlide(const RMPoint &pt, int nRange, int nStartValue, int
INIT_GFX16_FROMRAW(20032, _SliderSingle);
// Buttons
_PushLeft = new RMOptionButton(RMRect(pt.x - 23, pt.y, pt.x - 23 + 22, pt.y + 26));
_PushRight = new RMOptionButton(RMRect(pt.x + _nSlideSize, pt.y, pt.x + _nSlideSize + 5 + 22, pt.y + 26));
_PushLeft = new RMOptionButton(RMRect(pt._x - 23, pt._y, pt._x - 23 + 22, pt._y + 26));
_PushRight = new RMOptionButton(RMRect(pt._x + _nSlideSize, pt._y, pt._x + _nSlideSize + 5 + 22, pt._y + 26));
}
@ -280,8 +280,8 @@ void RMOptionSlide::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *
CORO_BEGIN_CODE(_ctx);
_ctx->pos = _pos;
_ctx->pos.x += 4;
_ctx->pos.y += 4;
_ctx->pos._x += 4;
_ctx->pos._y += 4;
_ctx->val = _nValue * _nStep;
if (_ctx->val < 1)
@ -295,17 +295,17 @@ void RMOptionSlide::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *
} else {
prim->setDst(_ctx->pos);
CORO_INVOKE_2(_SliderLeft->draw, bigBuf, prim);
_ctx->pos.x += 3;
_ctx->pos._x += 3;
for (_ctx->i = 1; _ctx->i < _ctx->val - 1; _ctx->i++) {
prim->setDst(_ctx->pos);
CORO_INVOKE_2(_SliderCenter->draw, bigBuf, prim);
_ctx->pos.x += 3;
_ctx->pos._x += 3;
}
prim->setDst(_ctx->pos);
CORO_INVOKE_2(_SliderRight->draw, bigBuf, prim);
_ctx->pos.x += 3;
_ctx->pos._x += 3;
}
CORO_END_CODE;
@ -1546,7 +1546,7 @@ void RMPointer::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim
// Copy the destination coordinates in the primitive
prim->setDst(_pos);
if (_pos.x >= 0 && _pos.y >= 0 && _pos.x < RM_SX && _pos.y < RM_SY) {
if (_pos._x >= 0 && _pos._y >= 0 && _pos._x < RM_SX && _pos._y < RM_SY) {
// Call the Draw method of the poitner
prim->getDst() -= _hotspot[_ctx->n];

View file

@ -509,18 +509,18 @@ void RMGfxSourceBuffer8::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimit
// Clipping
if (prim->haveSrc()) {
u = prim->getSrc().x1;
v = prim->getSrc().y1;
u = prim->getSrc()._x1;
v = prim->getSrc()._y1;
width = prim->getSrc().width();
height = prim->getSrc().height();
}
if (!clip2D(dst.x1, dst.y1, u, v, width, height, prim->haveSrc(), &bigBuf))
if (!clip2D(dst._x1, dst._y1, u, v, width, height, prim->haveSrc(), &bigBuf))
return;
// Starting offset into the buffer
buf += dst.y1 * bufx + dst.x1;
buf += dst._y1 * bufx + dst._x1;
// Normal step
if (_bTrasp0) {
@ -617,18 +617,18 @@ void RMGfxSourceBuffer8AB::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrim
// Clipping
if (prim->haveSrc()) {
u = prim->getSrc().x1;
v = prim->getSrc().y1;
u = prim->getSrc()._x1;
v = prim->getSrc()._y1;
width = prim->getSrc().width();
height = prim->getSrc().height();
}
if (!clip2D(dst.x1, dst.y1, u, v, width, height, prim->haveSrc(), &bigBuf))
if (!clip2D(dst._x1, dst._y1, u, v, width, height, prim->haveSrc(), &bigBuf))
return;
// Starting offset into the buffer
buf += dst.y1 * bufx + dst.x1;
buf += dst._y1 * bufx + dst._x1;
// Passaggio normale
if (_bTrasp0) {
@ -813,8 +813,8 @@ void RMGfxSourceBuffer8RLE::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPri
int x1, y1, u, v, width, height;
// Clipping
x1 = prim->getDst().x1;
y1 = prim->getDst().y1;
x1 = prim->getDst()._x1;
y1 = prim->getDst()._y1;
if (!clip2D(x1, y1, u, v, width, height, false, &bigBuf))
return;
@ -834,7 +834,7 @@ void RMGfxSourceBuffer8RLE::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPri
// Clipping
u = _dimx - (width + u);
x1 = (prim->getDst().x1 + _dimx - 1) - u;
x1 = (prim->getDst()._x1 + _dimx - 1) - u;
for (y = 0; y < height; y++) {
// Decompressione
@ -1611,8 +1611,8 @@ void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
int step;
// Clip the sprite
x1 = prim->getDst().x1;
y1 = prim->getDst().y1;
x1 = prim->getDst()._x1;
y1 = prim->getDst()._y1;
if (!clip2D(x1, y1, u, v, width, height, false, &bigBuf))
return;
@ -1625,7 +1625,7 @@ void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
if (prim->isFlipped()) {
u = _dimx - (width + u);
x1 = (prim->getDst().x1 + _dimx - 1) - u;
x1 = (prim->getDst()._x1 + _dimx - 1) - u;
}
// width = _dimx;
// x1 = prim->Dst().x1;
@ -1837,15 +1837,15 @@ void RMGfxSourceBuffer16::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimi
y1 = 0;
if (prim->haveSrc()) {
u = prim->getSrc().x1;
v = prim->getSrc().y1;
u = prim->getSrc()._x1;
v = prim->getSrc()._y1;
dimx = prim->getSrc().width();
dimy = prim->getSrc().height();
}
if (prim->haveDst()) {
x1 = prim->getDst().x1;
y1 = prim->getDst().y1;
x1 = prim->getDst()._x1;
y1 = prim->getDst()._y1;
}
if (!clip2D(x1, y1, u, v, dimx, dimy, true, &bigBuf))
@ -1929,7 +1929,7 @@ void RMGfxBox::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim)
// It takes the destination rectangle
rcDst = prim->getDst();
buf += rcDst.y1 * bigBuf.getDimx() + rcDst.x1;
buf += rcDst._y1 * bigBuf.getDimx() + rcDst._x1;
// Loop through the pixels
for (j = 0; j < rcDst.height(); j++) {

View file

@ -208,7 +208,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) {
// ************
if (_bGUIOption) {
if (!_tony.inAction() && _bInput) {
if ((_input.mouseLeftClicked() && _input.mousePos().x < 3 && _input.mousePos().y < 3)) {
if ((_input.mouseLeftClicked() && _input.mousePos()._x < 3 && _input.mousePos()._y < 3)) {
CORO_INVOKE_1(openOptionScreen, 0);
goto SKIPCLICKSINISTRO;
} else if (_input.getAsyncKeyState(Common::KEYCODE_ESCAPE))
@ -297,7 +297,7 @@ SKIPCLICKSINISTRO:
// Update screen scrolling to keep Tony in focus
if (_tony.mustUpdateScrolling() && _bLocationLoaded) {
RMPoint showThis = _tony.position();
showThis.y -= 60;
showThis._y -= 60;
_loc.updateScrolling(showThis);
}
@ -379,14 +379,14 @@ void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) {
void RMGfxEngine::initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
if (start.x == -1 || start.y == -1) {
start.x = ptTonyStart.x - RM_SX / 2;
start.y = ptTonyStart.y - RM_SY / 2;
if (start._x == -1 || start._y == -1) {
start._x = ptTonyStart._x - RM_SX / 2;
start._y = ptTonyStart._y - RM_SY / 2;
}
_loc.setScrollPosition(start);
if (ptTonyStart.x == 0 && ptTonyStart.y == 0) {
if (ptTonyStart._x == 0 && ptTonyStart._y == 0) {
} else {
_tony.setPosition(ptTonyStart, nLoc);
_tony.setScrollPosition(start);
@ -616,8 +616,8 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm
f->writeByte(i);
f->write(name.c_str(), i);
f->writeUint32LE(_nCurLoc);
f->writeUint32LE(tp.x);
f->writeUint32LE(tp.y);
f->writeUint32LE(tp._x);
f->writeUint32LE(tp._y);
f->writeUint32LE(size);
f->write(state, size);
@ -738,8 +738,8 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) {
}
_ctx->loc = _ctx->f->readUint32LE();
_ctx->tp.x = _ctx->f->readUint32LE();
_ctx->tp.y = _ctx->f->readUint32LE();
_ctx->tp._x = _ctx->f->readUint32LE();
_ctx->tp._y = _ctx->f->readUint32LE();
_ctx->size = _ctx->f->readUint32LE();
if ((_ctx->ver >= 0x5) && (_ctx->ver <= 7)) {

View file

@ -66,9 +66,9 @@ RMInventory::~RMInventory() {
bool RMInventory::checkPointInside(const RMPoint &pt) {
if (!GLOBALS._bCfgInvUp)
return pt.y > RM_SY - 70;
return pt._y > RM_SY - 70;
else
return pt.y < 70;
return pt._y < 70;
}
@ -313,7 +313,7 @@ bool RMInventory::miniActive(void) {
bool RMInventory::haveFocus(const RMPoint &mpos) {
// When we combine, have the focus only if we are on an arrow (to scroll)
if (_state == OPENED && _bCombining && checkPointInside(mpos) && (mpos.x < 64 || mpos.x > RM_SX - 64))
if (_state == OPENED && _bCombining && checkPointInside(mpos) && (mpos._x < 64 || mpos._x > RM_SX - 64))
return true;
// If the inventory is open, focus we we go over it
@ -335,7 +335,7 @@ bool RMInventory::leftClick(const RMPoint &mpos, int &nCombineObj) {
int n;
// The left click picks an item from your inventory to use it with the background
n = mpos.x / 64;
n = mpos._x / 64;
if (_state == OPENED) {
if (n > 0 && n < RM_SX / 64 - 1 && _inv[n - 1 + _curPos] != 0) {
@ -401,7 +401,7 @@ void RMInventory::rightClick(const RMPoint &mpos) {
if (_state == OPENED && !_bCombining) {
// Open the context interface
n = mpos.x / 64;
n = mpos._x / 64;
if (n > 0 && n < RM_SX / 64 - 1 && _inv[n - 1 + _curPos] != 0) {
_state = SELECTING;
@ -493,7 +493,7 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
bNeedRedraw = true;
if ((_state == CLOSING || _state == OPENING || _state == OPENED) && checkPointInside(mpos)) {
if (mpos.x > RM_SX - 64) {
if (mpos._x > RM_SX - 64) {
if (_curPos + 8 < _nInv && !_bBlinkingRight) {
_items[28]._icon.setPattern(3);
_bBlinkingRight = true;
@ -505,7 +505,7 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
bNeedRedraw = true;
}
if (mpos.x < 64) {
if (mpos._x < 64) {
if (_curPos > 0 && !_bBlinkingLeft) {
_items[29]._icon.setPattern(3);
_bBlinkingLeft = true;
@ -540,7 +540,7 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
}
if (!GLOBALS._bCfgInvUp) {
if ((_state == CLOSED) && (mpos.y > RM_SY - 10 || GLOBALS._bCfgInvLocked) && bCanOpen) {
if ((_state == CLOSED) && (mpos._y > RM_SY - 10 || GLOBALS._bCfgInvLocked) && bCanOpen) {
if (!GLOBALS._bCfgInvNoScroll) {
_state = OPENING;
_curPutY = RM_SY - 1;
@ -550,7 +550,7 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
_curPutY = RM_SY - 68;
}
} else if (_state == OPENED) {
if ((mpos.y < RM_SY - 70 && !GLOBALS._bCfgInvLocked) || !bCanOpen) {
if ((mpos._y < RM_SY - 70 && !GLOBALS._bCfgInvLocked) || !bCanOpen) {
if (!GLOBALS._bCfgInvNoScroll) {
_state = CLOSING;
_curPutY = RM_SY - 68;
@ -580,7 +580,7 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
_state = CLOSED;
}
} else {
if ((_state == CLOSED) && (mpos.y < 10 || GLOBALS._bCfgInvLocked) && bCanOpen) {
if ((_state == CLOSED) && (mpos._y < 10 || GLOBALS._bCfgInvLocked) && bCanOpen) {
if (!GLOBALS._bCfgInvNoScroll) {
_state = OPENING;
_curPutY = - 68;
@ -590,7 +590,7 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
_curPutY = 0;
}
} else if (_state == OPENED) {
if ((mpos.y > 70 && !GLOBALS._bCfgInvLocked) || !bCanOpen) {
if ((mpos._y > 70 && !GLOBALS._bCfgInvLocked) || !bCanOpen) {
if (!GLOBALS._bCfgInvNoScroll) {
_state = CLOSING;
_curPutY = -2;
@ -630,20 +630,20 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
starty = 70;
// Make sure it is on one of the verbs
if (mpos.y > starty && mpos.y < starty + 45) {
if (mpos.x > startx && mpos.x < startx + 40) {
if (mpos._y > starty && mpos._y < starty + 45) {
if (mpos._x > startx && mpos._x < startx + 40) {
if (_miniAction != 1) {
_miniInterface.setPattern(2);
_miniAction = 1;
_vm->playUtilSFX(1);
}
} else if (mpos.x >= startx + 40 && mpos.x < startx + 80) {
} else if (mpos._x >= startx + 40 && mpos._x < startx + 80) {
if (_miniAction != 2) {
_miniInterface.setPattern(3);
_miniAction = 2;
_vm->playUtilSFX(1);
}
} else if (mpos.x >= startx + 80 && mpos.x < startx + 108) {
} else if (mpos._x >= startx + 80 && mpos._x < startx + 108) {
if (_miniAction != 3) {
_miniInterface.setPattern(4);
_miniAction = 3;
@ -680,7 +680,7 @@ RMItem *RMInventory::whichItemIsIn(const RMPoint &mpt) {
if (_state == OPENED) {
if (checkPointInside(mpt)) {
n = mpt.x / 64;
n = mpt._x / 64;
if (n > 0 && n < RM_SX / 64 - 1 && _inv[n - 1 + _curPos] != 0 && (!_bCombining || _inv[n - 1 + _curPos] != _nCombine))
return &_items[_inv[n - 1 + _curPos]]._icon;
}
@ -830,14 +830,14 @@ void RMInterface::clicked(const RMPoint &mousepos) {
_lastHotZone = -1;
// Keep it inside the screen
if (_openStart.x < 0)
_openStart.x = 0;
if (_openStart.y < 0)
_openStart.y = 0;
if (_openStart.x + _dimx > RM_SX)
_openStart.x = RM_SX - _dimx;
if (_openStart.y + _dimy > RM_SY)
_openStart.y = RM_SY - _dimy;
if (_openStart._x < 0)
_openStart._x = 0;
if (_openStart._y < 0)
_openStart._y = 0;
if (_openStart._x + _dimx > RM_SX)
_openStart._x = RM_SX - _dimx;
if (_openStart._y + _dimy > RM_SY)
_openStart._y = RM_SY - _dimy;
// Play the sound effect
_vm->playUtilSFX(0);

View file

@ -183,23 +183,23 @@ int RMPattern::init(RMSfx *sfx, bool bPlayP0, byte *bFlag) {
if (_slots[i]._type == SOUND) {
if (i == 0) {
if (sfx[_slots[i]._data]._name[0] == '_') {
sfx[_slots[i]._data].setVolume(_slots[i].pos().x);
sfx[_slots[i]._data].setVolume(_slots[i].pos()._x);
sfx[_slots[i]._data].play(true);
} else {
sfx[_slots[i]._data].setVolume(_slots[i].pos().x);
sfx[_slots[i]._data].setVolume(_slots[i].pos()._x);
sfx[_slots[i]._data].play();
}
} else if (_speed == 0) {
if (bPlayP0) {
sfx[_slots[i]._data].setVolume(_slots[i].pos().x);
sfx[_slots[i]._data].setVolume(_slots[i].pos()._x);
sfx[_slots[i]._data].play();
} else if (sfx[_slots[i]._data]._name[0] == '_') {
sfx[_slots[i]._data].setVolume(_slots[i].pos().x);
sfx[_slots[i]._data].setVolume(_slots[i].pos()._x);
sfx[_slots[i]._data].play(true);
}
} else {
if (_bLoop && sfx[_slots[i]._data]._name[0] == '_') {
sfx[_slots[i]._data].setVolume(_slots[i].pos().x);
sfx[_slots[i]._data].setVolume(_slots[i].pos()._x);
sfx[_slots[i]._data].play(true);
}
}
@ -251,7 +251,7 @@ int RMPattern::update(uint32 hEndPattern, byte &bFlag, RMSfx *sfx) {
case SOUND:
if (sfx != NULL) {
sfx[_slots[_nCurSlot]._data].setVolume(_slots[_nCurSlot].pos().x);
sfx[_slots[_nCurSlot]._data].setVolume(_slots[_nCurSlot].pos()._x);
if (sfx[_slots[_nCurSlot]._data]._name[0] != '_')
sfx[_slots[_nCurSlot]._data].play(false);
@ -1054,8 +1054,8 @@ void RMCharacter::goTo(CORO_PARAM, RMPoint destcoord, bool bReversed) {
_status = WALK;
_lineStart = _pos;
_lineEnd = destcoord;
_dx = _lineStart.x - _lineEnd.x;
_dy = _lineStart.y - _lineEnd.y;
_dx = _lineStart._x - _lineEnd._x;
_dy = _lineStart._y - _lineEnd._y;
_fx = _dx;
_fy = _dy;
_dx = ABS(_dx);
@ -1071,7 +1071,7 @@ void RMCharacter::goTo(CORO_PARAM, RMPoint destcoord, bool bReversed) {
if (_dx > _dy) {
_slope = _fy / _fx;
if (_lineEnd.x < _lineStart.x)
if (_lineEnd._x < _lineStart._x)
_walkSpeed = -_walkSpeed;
_walkStatus = 1;
@ -1086,7 +1086,7 @@ void RMCharacter::goTo(CORO_PARAM, RMPoint destcoord, bool bReversed) {
}
} else {
_slope = _fx / _fy;
if (_lineEnd.y < _lineStart.y)
if (_lineEnd._y < _lineStart._y)
_walkSpeed = -_walkSpeed;
_walkStatus = 0;
@ -1115,14 +1115,14 @@ RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoin
if (UP) {
nuovo = punto;
passi = 0;
while ((inWhichBox(nuovo) == -1) && (nuovo.y >= 0)) {
nuovo.y--;
while ((inWhichBox(nuovo) == -1) && (nuovo._y >= 0)) {
nuovo._y--;
passi++;
}
if ((inWhichBox(nuovo) != -1) && (passi < minimo) &&
findPath(inWhichBox(_pos), inWhichBox(nuovo))) {
minimo = passi;
nuovo.y--; // to avoid error?
nuovo._y--; // to avoid error?
trovato = nuovo;
}
}
@ -1130,14 +1130,14 @@ RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoin
if (DOWN) {
nuovo = punto;
passi = 0;
while ((inWhichBox(nuovo) == -1) && (nuovo.y < 480)) {
nuovo.y++;
while ((inWhichBox(nuovo) == -1) && (nuovo._y < 480)) {
nuovo._y++;
passi++;
}
if ((inWhichBox(nuovo) != -1) && (passi < minimo) &&
findPath(inWhichBox(_pos), inWhichBox(nuovo))) {
minimo = passi;
nuovo.y++; // to avoid error?
nuovo._y++; // to avoid error?
trovato = nuovo;
}
}
@ -1145,14 +1145,14 @@ RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoin
if (RIGHT) {
nuovo = punto;
passi = 0;
while ((inWhichBox(nuovo) == -1) && (nuovo.x < 640)) {
nuovo.x++;
while ((inWhichBox(nuovo) == -1) && (nuovo._x < 640)) {
nuovo._x++;
passi++;
}
if ((inWhichBox(nuovo) != -1) && (passi < minimo) &&
findPath(inWhichBox(_pos), inWhichBox(nuovo))) {
minimo = passi;
nuovo.x++; // to avoid error?
nuovo._x++; // to avoid error?
trovato = nuovo;
}
}
@ -1160,14 +1160,14 @@ RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoin
if (LEFT) {
nuovo = punto;
passi = 0;
while ((inWhichBox(nuovo) == -1) && (nuovo.x >= 0)) {
nuovo.x--;
while ((inWhichBox(nuovo) == -1) && (nuovo._x >= 0)) {
nuovo._x--;
passi++;
}
if ((inWhichBox(nuovo) != -1) && (passi < minimo) &&
findPath(inWhichBox(_pos), inWhichBox(nuovo))) {
minimo = passi;
nuovo.x--; // to avoid error?
nuovo._x--; // to avoid error?
trovato = nuovo;
}
}
@ -1190,8 +1190,8 @@ short RMCharacter::scanLine(const RMPoint &punto) {
Lstart = _pos;
Lend = punto;
Ldx = Lstart.x - Lend.x;
Ldy = Lstart.y - Lend.y;
Ldx = Lstart._x - Lend._x;
Ldy = Lstart._y - Lend._y;
Lfx = Ldx;
Lfy = Ldy;
Ldx = ABS(Ldx);
@ -1201,11 +1201,11 @@ short RMCharacter::scanLine(const RMPoint &punto) {
if (Ldx > Ldy) {
Lslope = Lfy / Lfx;
if (Lend.x < Lstart.x) Lspeed = -Lspeed;
if (Lend._x < Lstart._x) Lspeed = -Lspeed;
Lstatus = 1;
} else {
Lslope = Lfx / Lfy;
if (Lend.y < Lstart.y) Lspeed = - Lspeed;
if (Lend._y < Lstart._y) Lspeed = - Lspeed;
Lstatus = 0;
}
@ -1220,10 +1220,11 @@ short RMCharacter::scanLine(const RMPoint &punto) {
Ldx = (int)(Lslope * Ldy);
}
Lscan.x = Lstart.x + Ldx;
Lscan.y = Lstart.y + Ldy;
Lscan._x = Lstart._x + Ldx;
Lscan._y = Lstart._y + Ldy;
if ((ABS(Lscan.x - Lend.x) <= 1) && (ABS(Lscan.y - Lend.y) <= 1)) return 1;
if ((ABS(Lscan._x - Lend._x) <= 1) && (ABS(Lscan._y - Lend._y) <= 1))
return 1;
}
return 0;
@ -1240,8 +1241,8 @@ RMPoint RMCharacter::invScanLine(const RMPoint &punto) {
Lstart = punto; // Exchange!
Lend = _pos; // :-)
Ldx = Lstart.x - Lend.x;
Ldy = Lstart.y - Lend.y;
Ldx = Lstart._x - Lend._x;
Ldy = Lstart._y - Lend._y;
Lfx = Ldx;
Lfy = Ldy;
Ldx = ABS(Ldx);
@ -1251,11 +1252,13 @@ RMPoint RMCharacter::invScanLine(const RMPoint &punto) {
if (Ldx > Ldy) {
Lslope = Lfy / Lfx;
if (Lend.x < Lstart.x) Lspeed = -Lspeed;
if (Lend._x < Lstart._x)
Lspeed = -Lspeed;
Lstatus = 1;
} else {
Lslope = Lfx / Lfy;
if (Lend.y < Lstart.y) Lspeed = -Lspeed;
if (Lend._y < Lstart._y)
Lspeed = -Lspeed;
Lstatus = 0;
}
Lscan = Lstart;
@ -1278,11 +1281,11 @@ RMPoint RMCharacter::invScanLine(const RMPoint &punto) {
Ldy = Lspeed * Lcount;
Ldx = (int)(Lslope * Ldy);
}
Lscan.x = Lstart.x + Ldx;
Lscan.y = Lstart.y + Ldy;
Lscan._x = Lstart._x + Ldx;
Lscan._y = Lstart._y + Ldy;
// WORKAROUND: Handles cases where the points never fall inside a bounding box
if (Lscan.x < -100 || Lscan.y < -100 || Lscan.x >= 1000 || Lscan.y >= 1000)
if (Lscan._x < -100 || Lscan._y < -100 || Lscan._x >= 1000 || Lscan._y >= 1000)
return punto;
}
}
@ -1301,13 +1304,13 @@ RMPoint RMCharacter::nearestHotSpot(int sourcebox, int destbox) {
for (cc = 0; cc < cur->_boxes[sourcebox]._numHotspot; cc++)
if ((cur->_boxes[sourcebox]._hotspot[cc]._destination) == destbox) {
x = ABS(cur->_boxes[sourcebox]._hotspot[cc]._hotx - _pos.x);
y = ABS(cur->_boxes[sourcebox]._hotspot[cc]._hoty - _pos.y);
x = ABS(cur->_boxes[sourcebox]._hotspot[cc]._hotx - _pos._x);
y = ABS(cur->_boxes[sourcebox]._hotspot[cc]._hoty - _pos._y);
if ((x * x + y * y) < distanzaminima) {
distanzaminima = x * x + y * y;
puntocaldo.x = cur->_boxes[sourcebox]._hotspot[cc]._hotx;
puntocaldo.y = cur->_boxes[sourcebox]._hotspot[cc]._hoty;
puntocaldo._x = cur->_boxes[sourcebox]._hotspot[cc]._hotx;
puntocaldo._y = cur->_boxes[sourcebox]._hotspot[cc]._hoty;
}
}
@ -1391,11 +1394,11 @@ void RMCharacter::doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int loc) {
if (_walkStatus == 1) {
_dx = _walkSpeed * _walkCount;
_dy = (int)(_slope * _dx);
_pos.x = _lineStart.x + _dx;
_pos.y = _lineStart.y + _dy;
_pos._x = _lineStart._x + _dx;
_pos._y = _lineStart._y + _dy;
// Right
if (((_walkSpeed > 0) && (_pos.x > _lineEnd.x)) || ((_walkSpeed < 0) && (_pos.x < _lineEnd.x))) {
if (((_walkSpeed > 0) && (_pos._x > _lineEnd._x)) || ((_walkSpeed < 0) && (_pos._x < _lineEnd._x))) {
_pos = _lineEnd;
_status = STAND;
_ctx->bEndNow = true;
@ -1406,11 +1409,11 @@ void RMCharacter::doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int loc) {
if (_walkStatus == 0) {
_dy = _walkSpeed * _walkCount;
_dx = (int)(_slope * _dy);
_pos.x = _lineStart.x + _dx;
_pos.y = _lineStart.y + _dy;
_pos._x = _lineStart._x + _dx;
_pos._y = _lineStart._y + _dy;
// Down
if (((_walkSpeed > 0) && (_pos.y > _lineEnd.y)) || ((_walkSpeed < 0) && (_pos.y < _lineEnd.y))) {
if (((_walkSpeed > 0) && (_pos._y > _lineEnd._y)) || ((_walkSpeed < 0) && (_pos._y < _lineEnd._y))) {
_pos = _lineEnd;
_status = STAND;
_ctx->bEndNow = true;
@ -1419,8 +1422,8 @@ void RMCharacter::doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int loc) {
// Check if the character came out of the BOX in error, in which case he returns immediately
if (inWhichBox(_pos) == -1) {
_pos.x = _lineStart.x + _olddx;
_pos.y = _lineStart.y + _olddy;
_pos._x = _lineStart._x + _olddx;
_pos._y = _lineStart._y + _olddy;
}
// If we have just moved to a temporary location, and is over the shortest path, we stop permanently
@ -1545,7 +1548,7 @@ void RMCharacter::move(CORO_PARAM, RMPoint pt, bool *result) {
_bMoving = true;
// 0, 0 does not do anything, just stops the character
if (pt.x == 0 && pt.y == 0) {
if (pt._x == 0 && pt._y == 0) {
_minPath = 0;
_status = STAND;
CORO_INVOKE_0(stop);
@ -1833,8 +1836,8 @@ RMBoxLoc *RMGameBoxes::getBoxes(int nLoc) {
bool RMGameBoxes::isInBox(int nLoc, int nBox, const RMPoint &pt) {
RMBoxLoc *cur = getBoxes(nLoc);
if ((pt.x >= cur->_boxes[nBox]._left) && (pt.x <= cur->_boxes[nBox]._right) &&
(pt.y >= cur->_boxes[nBox]._top) && (pt.y <= cur->_boxes[nBox]._bottom))
if ((pt._x >= cur->_boxes[nBox]._left) && (pt._x <= cur->_boxes[nBox]._right) &&
(pt._y >= cur->_boxes[nBox]._top) && (pt._y <= cur->_boxes[nBox]._bottom))
return true;
else
return false;
@ -1849,8 +1852,8 @@ int RMGameBoxes::whichBox(int nLoc, const RMPoint &punto) {
for (i = 0; i < cur->numbbox; i++)
if (cur->_boxes[i]._attivo)
if ((punto.x >= cur->_boxes[i]._left) && (punto.x <= cur->_boxes[i]._right) &&
(punto.y >= cur->_boxes[i]._top) && (punto.y <= cur->_boxes[i]._bottom))
if ((punto._x >= cur->_boxes[i]._left) && (punto._x <= cur->_boxes[i]._right) &&
(punto._y >= cur->_boxes[i]._top) && (punto._y <= cur->_boxes[i]._bottom))
return i;
return -1;
@ -2025,7 +2028,7 @@ bool RMLocation::load(RMDataStream &ds) {
// Skip the MPAL bailouts (64 bytes)
ds >> TEMPNumLoc;
ds >> TEMPTonyStart.x >> TEMPTonyStart.y;
ds >> TEMPTonyStart._x >> TEMPTonyStart._y;
ds += 64 - 4 * 3;
// Skip flag associated with the background (?)
@ -2091,7 +2094,7 @@ bool RMLocation::loadLOX(RMDataStream &ds) {
// Location number
ds >> TEMPNumLoc;
ds >> TEMPTonyStart.x >> TEMPTonyStart.y;
ds >> TEMPTonyStart._x >> TEMPTonyStart._y;
// Dimensions
ds >> dimx >> dimy;
@ -2210,36 +2213,36 @@ void RMLocation::unload(void) {
void RMLocation::updateScrolling(const RMPoint &ptShowThis) {
RMPoint oldScroll = _curScroll;
if (_curScroll.x + 250 > ptShowThis.x) {
_curScroll.x = ptShowThis.x - 250;
} else if (_curScroll.x + RM_SX - 250 < ptShowThis.x) {
_curScroll.x = ptShowThis.x + 250 - RM_SX;
} else if (ABS(_curScroll.x + RM_SX / 2 - ptShowThis.x) > 32 && _buf->getDimx() > RM_SX) {
if (_curScroll.x + RM_SX / 2 < ptShowThis.x)
_curScroll.x++;
if (_curScroll._x + 250 > ptShowThis._x) {
_curScroll._x = ptShowThis._x - 250;
} else if (_curScroll._x + RM_SX - 250 < ptShowThis._x) {
_curScroll._x = ptShowThis._x + 250 - RM_SX;
} else if (ABS(_curScroll._x + RM_SX / 2 - ptShowThis._x) > 32 && _buf->getDimx() > RM_SX) {
if (_curScroll._x + RM_SX / 2 < ptShowThis._x)
_curScroll._x++;
else
_curScroll.x--;
_curScroll._x--;
}
if (_curScroll.y + 180 > ptShowThis.y) {
_curScroll.y = ptShowThis.y - 180;
} else if (_curScroll.y + RM_SY - 180 < ptShowThis.y) {
_curScroll.y = ptShowThis.y + 180 - RM_SY;
} else if (ABS(_curScroll.y + RM_SY / 2 - ptShowThis.y) > 16 && _buf->getDimy() > RM_SY) {
if (_curScroll.y + RM_SY / 2 < ptShowThis.y)
_curScroll.y++;
if (_curScroll._y + 180 > ptShowThis._y) {
_curScroll._y = ptShowThis._y - 180;
} else if (_curScroll._y + RM_SY - 180 < ptShowThis._y) {
_curScroll._y = ptShowThis._y + 180 - RM_SY;
} else if (ABS(_curScroll._y + RM_SY / 2 - ptShowThis._y) > 16 && _buf->getDimy() > RM_SY) {
if (_curScroll._y + RM_SY / 2 < ptShowThis._y)
_curScroll._y++;
else
_curScroll.y--;
_curScroll._y--;
}
if (_curScroll.x < 0)
_curScroll.x = 0;
if (_curScroll.y < 0)
_curScroll.y = 0;
if (_curScroll.x + RM_SX > _buf->getDimx())
_curScroll.x = _buf->getDimx() - RM_SX;
if (_curScroll.y + RM_SY > _buf->getDimy())
_curScroll.y = _buf->getDimy() - RM_SY;
if (_curScroll._x < 0)
_curScroll._x = 0;
if (_curScroll._y < 0)
_curScroll._y = 0;
if (_curScroll._x + RM_SX > _buf->getDimx())
_curScroll._x = _buf->getDimx() - RM_SX;
if (_curScroll._y + RM_SY > _buf->getDimy())
_curScroll._y = _buf->getDimy() - RM_SY;
if (oldScroll != _curScroll)
for (int i = 0; i < _nItems; i++)
@ -2255,14 +2258,14 @@ void RMLocation::setFixedScroll(const RMPoint &scroll) {
void RMLocation::setScrollPosition(const RMPoint &scroll) {
RMPoint pt = scroll;
if (pt.x < 0)
pt.x = 0;
if (pt.y < 0)
pt.y = 0;
if (pt.x + RM_SX > _buf->getDimx())
pt.x = _buf->getDimx() - RM_SX;
if (pt.y + RM_SY > _buf->getDimy())
pt.y = _buf->getDimy() - RM_SY;
if (pt._x < 0)
pt._x = 0;
if (pt._y < 0)
pt._y = 0;
if (pt._x + RM_SX > _buf->getDimx())
pt._x = _buf->getDimx() - RM_SX;
if (pt._y + RM_SY > _buf->getDimy())
pt._y = _buf->getDimy() - RM_SY;
_curScroll = pt;

View file

@ -734,31 +734,31 @@ int RMDataStream::getError() {
* Constructor
*/
RMPoint::RMPoint() {
x = y = 0;
_x = _y = 0;
}
/**
* Copy constructor
*/
RMPoint::RMPoint(const RMPoint &p) {
x = p.x;
y = p.y;
_x = p._x;
_y = p._y;
}
/**
* Constructor with integer parameters
*/
RMPoint::RMPoint(int x1, int y1) {
x = x1;
y = y1;
_x = x1;
_y = y1;
}
/**
* Copy operator
*/
RMPoint &RMPoint::operator=(RMPoint p) {
x = p.x;
y = p.y;
_x = p._x;
_y = p._y;
return *this;
}
@ -767,16 +767,16 @@ RMPoint &RMPoint::operator=(RMPoint p) {
* Offsets the point by another point
*/
void RMPoint::offset(const RMPoint &p) {
x += p.x;
y += p.y;
_x += p._x;
_y += p._y;
}
/**
* Offsets the point by a specified offset
*/
void RMPoint::offset(int xOff, int yOff) {
x += xOff;
y += yOff;
_x += xOff;
_y += yOff;
}
/**
@ -819,8 +819,8 @@ RMPoint &RMPoint::operator-=(RMPoint p) {
RMPoint RMPoint::operator-() {
RMPoint p;
p.x = -x;
p.y = -y;
p._x = -_x;
p._y = -_y;
return p;
}
@ -829,21 +829,21 @@ RMPoint RMPoint::operator-() {
* Equality operator
*/
bool RMPoint::operator==(RMPoint p) {
return ((x == p.x) && (y == p.y));
return ((_x == p._x) && (_y == p._y));
}
/**
* Not equal operator
*/
bool RMPoint::operator!=(RMPoint p) {
return ((x != p.x) || (y != p.y));
return ((_x != p._x) || (_y != p._y));
}
/**
* Reads a point from a stream
*/
RMDataStream &operator>>(RMDataStream &ds, RMPoint &p) {
ds >> p.x >> p.y;
ds >> p._x >> p._y;
return ds;
}
@ -856,7 +856,7 @@ RMRect::RMRect() {
}
void RMRect::setEmpty(void) {
x1 = y1 = x2 = y2 = 0;
_x1 = _y1 = _x2 = _y2 = 0;
}
RMRect::RMRect(const RMPoint &p1, const RMPoint &p2) {
@ -872,17 +872,17 @@ RMRect::RMRect(const RMRect &rc) {
}
void RMRect::setRect(const RMPoint &p1, const RMPoint &p2) {
x1 = p1.x;
y1 = p1.y;
x2 = p2.x;
y2 = p2.y;
_x1 = p1._x;
_y1 = p1._y;
_x2 = p2._x;
_y2 = p2._y;
}
void RMRect::setRect(int X1, int Y1, int X2, int Y2) {
x1 = X1;
y1 = Y1;
x2 = X2;
y2 = Y2;
_x1 = X1;
_y1 = Y1;
_x2 = X2;
_y2 = Y2;
}
void RMRect::setRect(const RMRect &rc) {
@ -890,10 +890,10 @@ void RMRect::setRect(const RMRect &rc) {
}
void RMRect::copyRect(const RMRect &rc) {
x1 = rc.x1;
y1 = rc.y1;
x2 = rc.x2;
y2 = rc.y2;
_x1 = rc._x1;
_y1 = rc._y1;
_x2 = rc._x2;
_y2 = rc._y2;
}
RMPoint &RMRect::topLeft() {
@ -907,15 +907,15 @@ RMPoint &RMRect::bottomRight() {
}
RMPoint RMRect::center() {
return RMPoint((x2 - x1) / 2, (y2 - y1) / 2);
return RMPoint((_x2 - _x1) / 2, (_y2 - _y1) / 2);
}
int RMRect::width() const {
return x2 - x1;
return _x2 - _x1;
}
int RMRect::height() const {
return y2 - y1;
return _y2 - _y1;
}
int RMRect::size() const {
@ -923,7 +923,7 @@ int RMRect::size() const {
}
bool RMRect::isEmpty() const {
return (x1 == 0 && y1 == 0 && x2 == 0 && y2 == 0);
return (_x1 == 0 && _y1 == 0 && _x2 == 0 && _y2 == 0);
}
const RMRect &RMRect::operator=(const RMRect &rc) {
@ -932,17 +932,17 @@ const RMRect &RMRect::operator=(const RMRect &rc) {
}
void RMRect::offset(int xOff, int yOff) {
x1 += xOff;
y1 += yOff;
x2 += xOff;
y2 += yOff;
_x1 += xOff;
_y1 += yOff;
_x2 += xOff;
_y2 += yOff;
}
void RMRect::offset(const RMPoint &p) {
x1 += p.x;
y1 += p.y;
x2 += p.x;
y2 += p.y;
_x1 += p._x;
_y1 += p._y;
_x2 += p._x;
_y2 += p._y;
}
const RMRect &RMRect::operator+=(RMPoint p) {
@ -979,19 +979,19 @@ RMRect operator-(RMPoint p, const RMRect &rc) {
}
bool RMRect::operator==(const RMRect &rc) {
return ((x1 == rc.x1) && (y1 == rc.y1) && (x2 == rc.x2) && (y2 == rc.y2));
return ((_x1 == rc._x1) && (_y1 == rc._y1) && (_x2 == rc._x2) && (_y2 == rc._y2));
}
bool RMRect::operator!=(const RMRect &rc) {
return ((x1 != rc.x1) || (y1 != rc.y1) || (x2 != rc.x2) || (y2 != rc.y2));
return ((_x1 != rc._x1) || (_y1 != rc._y1) || (_x2 != rc._x2) || (_y2 != rc._y2));
}
void RMRect::normalizeRect(void) {
setRect(MIN(x1, x2), MIN(y1, y2), MAX(x1, x2), MAX(y1, y2));
setRect(MIN(_x1, _x2), MIN(_y1, _y2), MAX(_x1, _x2), MAX(_y1, _y2));
}
RMDataStream &operator>>(RMDataStream &ds, RMRect &rc) {
ds >> rc.x1 >> rc.y1 >> rc.x2 >> rc.y2;
ds >> rc._x1 >> rc._y1 >> rc._x2 >> rc._y2;
return ds;
}
@ -1032,10 +1032,10 @@ void RMResUpdate::init(const Common::String &fileName) {
for (i = 0; i < _numUpd; ++i) {
ResUpdInfo &info = _infos[i];
info.dwRes = _hFile.readUint32LE();
info.offset = _hFile.readUint32LE();
info.size = _hFile.readUint32LE();
info.cmpSize = _hFile.readUint32LE();
info._dwRes = _hFile.readUint32LE();
info._offset = _hFile.readUint32LE();
info._size = _hFile.readUint32LE();
info._cmpSize = _hFile.readUint32LE();
}
}
@ -1046,7 +1046,7 @@ HGLOBAL RMResUpdate::queryResource(uint32 dwRes) {
uint32 i;
for (i = 0; i < _numUpd; ++i)
if (_infos[i].dwRes == dwRes)
if (_infos[i]._dwRes == dwRes)
// Found the index
break;
@ -1055,26 +1055,26 @@ HGLOBAL RMResUpdate::queryResource(uint32 dwRes) {
return NULL;
const ResUpdInfo &info = _infos[i];
byte *cmpBuf = new byte[info.cmpSize];
byte *cmpBuf = new byte[info._cmpSize];
uint32 dwRead;
// Move to the correct offset and read in the compressed data
_hFile.seek(info.offset);
dwRead = _hFile.read(cmpBuf, info.cmpSize);
_hFile.seek(info._offset);
dwRead = _hFile.read(cmpBuf, info._cmpSize);
if (info.cmpSize > dwRead) {
if (info._cmpSize > dwRead) {
// Error occurred reading data, so return NULL
delete[] cmpBuf;
return NULL;
}
// Allocate space for the output resource
HGLOBAL destBuf = globalAllocate(0, info.size);
HGLOBAL destBuf = globalAllocate(0, info._size);
byte *lpDestBuf = (byte *)globalLock(destBuf);
uint32 dwSize;
// Decompress the data
lzo1x_decompress(cmpBuf, info.cmpSize, lpDestBuf, &dwSize);
lzo1x_decompress(cmpBuf, info._cmpSize, lpDestBuf, &dwSize);
// Delete buffer for compressed data
delete [] cmpBuf;

View file

@ -212,7 +212,7 @@ private:
*/
class RMPoint {
public:
int x, y;
int _x, _y;
public:
// Constructor
@ -225,8 +225,8 @@ public:
// Set
void set(int x1, int y1) {
x = x1;
y = y1;
_x = x1;
_y = y1;
}
// Offset
@ -251,8 +251,8 @@ public:
class RMRect {
public:
int x1, y1;
int x2, y2;
int _x1, _y1;
int _x2, _y2;
public:
RMRect();
@ -298,7 +298,7 @@ public:
// Point in rect
bool ptInRect(const RMPoint &pt) {
return (pt.x >= x1 && pt.x <= x2 && pt.y >= y1 && pt.y <= y2);
return (pt._x >= _x1 && pt._x <= _x2 && pt._y >= _y1 && pt._y <= _y2);
}
// Extract from data stream
@ -310,10 +310,10 @@ public:
*/
class RMResUpdate {
struct ResUpdInfo {
uint32 dwRes;
uint32 offset;
uint32 size;
uint32 cmpSize;
uint32 _dwRes;
uint32 _offset;
uint32 _size;
uint32 _cmpSize;
};
uint32 _numUpd;