aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-11-12 13:43:42 -0600
committerEugene Sandulenko2017-11-18 22:35:12 +0100
commit88a2eaba93a454562b99bd59f797533b9f6b4848 (patch)
treefb3211337eab804ec349add0783193d42b52123f
parent136223026ecb4569bbd425ed586eb7de42979c9f (diff)
downloadscummvm-rg350-88a2eaba93a454562b99bd59f797533b9f6b4848.tar.gz
scummvm-rg350-88a2eaba93a454562b99bd59f797533b9f6b4848.tar.bz2
scummvm-rg350-88a2eaba93a454562b99bd59f797533b9f6b4848.zip
FULLPIPE: Make dimensions/coordinate getters pure functions
-rw-r--r--engines/fullpipe/anihandler.cpp93
-rw-r--r--engines/fullpipe/anihandler.h4
-rw-r--r--engines/fullpipe/gfx.cpp38
-rw-r--r--engines/fullpipe/gfx.h6
-rw-r--r--engines/fullpipe/input.cpp20
-rw-r--r--engines/fullpipe/inventory.cpp12
-rw-r--r--engines/fullpipe/modal.cpp59
-rw-r--r--engines/fullpipe/motion.cpp18
-rw-r--r--engines/fullpipe/scene.cpp48
-rw-r--r--engines/fullpipe/scenes.cpp2
-rw-r--r--engines/fullpipe/scenes/scene04.cpp10
-rw-r--r--engines/fullpipe/scenes/scene06.cpp8
-rw-r--r--engines/fullpipe/scenes/scene08.cpp8
-rw-r--r--engines/fullpipe/scenes/scene25.cpp4
-rw-r--r--engines/fullpipe/scenes/sceneDbg.cpp7
-rw-r--r--engines/fullpipe/statics.cpp240
-rw-r--r--engines/fullpipe/statics.h20
17 files changed, 240 insertions, 357 deletions
diff --git a/engines/fullpipe/anihandler.cpp b/engines/fullpipe/anihandler.cpp
index 060047975a..7c91f8f1ad 100644
--- a/engines/fullpipe/anihandler.cpp
+++ b/engines/fullpipe/anihandler.cpp
@@ -77,7 +77,7 @@ MessageQueue *AniHandler::makeQueue(StaticANIObject *ani, int staticsIndex, int
do {
subidx = startidx + endidx * _items[idx]->statics.size();
- _items[idx]->subItems[subidx]->movement->calcSomeXY(point, 0, -1);
+ point = _items[idx]->subItems[subidx]->movement->calcSomeXY(0, -1);
if (pointArr) {
int sz;
@@ -254,9 +254,7 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
int n1x = mkQueue->x1 - mkQueue->x2 - sub1->x - sub2->x;
int n1y = mkQueue->y1 - mkQueue->y2 - sub1->y - sub2->y;
- Common::Point point1;
-
- mov->calcSomeXY(point1, 0, -1);
+ const Common::Point point1 = mov->calcSomeXY(0, -1);
int n2x = point1.x;
int n2y = point1.y;
@@ -269,7 +267,7 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
n2x *= mult;
n2y *= mult;
} else {
- getNumCycles(&point, mov, n1x, n1y, &mult, &len, 1);
+ point = getNumCycles(mov, n1x, n1y, &mult, &len, 1);
n2x = point.x;
n2y = point.y;
}
@@ -435,9 +433,7 @@ void AniHandler::putObjectToStatics(StaticANIObject *ani, int staticsId) {
}
if (ani->_statics) {
- Common::Point point;
-
- getTransitionSize(&point, ani->_id, ani->_statics->_staticsId, staticsId);
+ const Common::Point point = getTransitionSize(ani->_id, ani->_statics->_staticsId, staticsId);
ani->setOXY(ani->_ox + point.x, ani->_oy + point.y);
@@ -445,47 +441,41 @@ void AniHandler::putObjectToStatics(StaticANIObject *ani, int staticsId) {
}
}
-Common::Point *AniHandler::getTransitionSize(Common::Point *point, int objectId, int staticsId1, int staticsId2) {
- debugC(4, kDebugPathfinding, "AniHandler::getTransitionSize([%d, %d], %d, %d, %d)", point->x, point->y, objectId, staticsId1, staticsId2);
+Common::Point AniHandler::getTransitionSize(int objectId, int staticsId1, int staticsId2) {
+ debugC(4, kDebugPathfinding, "AniHandler::getTransitionSize(%d, %d, %d)", objectId, staticsId1, staticsId2);
int idx = getIndex(objectId);
if (idx == -1) {
- point->x = -1;
- point->y = -1;
- } else {
- int st1idx = getStaticsIndexById(idx, staticsId1);
- int st2idx = getStaticsIndexById(idx, staticsId2);
+ return Common::Point(-1, -1);
+ }
- if (st1idx == st2idx) {
- point->x = 0;
- point->y = 0;
- } else {
- int subidx = st1idx + st2idx * _items[idx]->statics.size();
+ int st1idx = getStaticsIndexById(idx, staticsId1);
+ int st2idx = getStaticsIndexById(idx, staticsId2);
- if (!_items[idx]->subItems[subidx]->movement) {
- clearVisitsList(idx);
- seekWay(idx, st1idx, st2idx, false, true);
+ if (st1idx == st2idx) {
+ return Common::Point(0, 0);
+ }
- if (!_items[idx]->subItems[subidx]->movement) {
- clearVisitsList(idx);
- seekWay(idx, st1idx, st2idx, true, false);
- }
- }
+ int subidx = st1idx + st2idx * _items[idx]->statics.size();
- MGMSubItem *sub = _items[idx]->subItems[subidx];
+ if (!_items[idx]->subItems[subidx]->movement) {
+ clearVisitsList(idx);
+ seekWay(idx, st1idx, st2idx, false, true);
- if (sub->movement) {
- point->x = sub->x;
- point->y = sub->y;
- } else {
- point->x = 0;
- point->y = 0;
- }
+ if (!_items[idx]->subItems[subidx]->movement) {
+ clearVisitsList(idx);
+ seekWay(idx, st1idx, st2idx, true, false);
}
}
- return point;
+ const MGMSubItem *sub = _items[idx]->subItems[subidx];
+
+ if (!sub->movement) {
+ return Common::Point(0, 0);
+ }
+
+ return Common::Point(sub->x, sub->y);
}
int AniHandler::getStaticsIndexById(int idx, int16 id) {
@@ -565,7 +555,7 @@ int AniHandler::seekWay(int idx, int st1idx, int st2idx, bool flip, bool flop) {
item->subItems[subIdx]->field_8 = recalc + 1;
item->subItems[subIdx]->field_C = newsz;
- mov->calcSomeXY(point, 0, -1);
+ point = mov->calcSomeXY(0, -1);
item->subItems[subIdx]->x = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->x + point.x;
item->subItems[subIdx]->y = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->y + point.y;
@@ -594,7 +584,7 @@ int AniHandler::seekWay(int idx, int st1idx, int st2idx, bool flip, bool flop) {
item->subItems[subIdx]->field_C = sz + item->subItems[stidx + st2idx * _items[idx]->statics.size()]->field_C;
- mov->calcSomeXY(point, 0, -1);
+ point = mov->calcSomeXY(0, -1);
item->subItems[subIdx]->x = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->x - point.x;
item->subItems[subIdx]->y = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->y - point.y;
@@ -631,20 +621,18 @@ int AniHandler::getNumMovements(int objectId, int idx1, int idx2) {
return idx;
}
-Common::Point *AniHandler::getNumCycles(Common::Point *pRes, Movement *mov, int x, int y, int *mult, int *len, int flag) {
- Common::Point point;
-
- mov->calcSomeXY(point, 0, -1);
+Common::Point AniHandler::getNumCycles(Movement *mov, int x, int y, int *mult, int *len, int flag) {
+ Common::Point point = mov->calcSomeXY(0, -1);
int p1x = point.x;
int p1y = point.y;
int newmult = 0;
if (abs(p1y) > abs(p1x)) {
- if (mov->calcSomeXY(point, 0, -1)->y)
- newmult = (int)((double)y / mov->calcSomeXY(point, 0, -1)->y);
- } else if (mov->calcSomeXY(point, 0, -1)->x) {
- newmult = (int)((double)x / mov->calcSomeXY(point, 0, -1)->x);
+ if (mov->calcSomeXY(0, -1).y)
+ newmult = (int)((double)y / mov->calcSomeXY(0, -1).y);
+ } else if (mov->calcSomeXY(0, -1).x) {
+ newmult = (int)((double)x / mov->calcSomeXY(0, -1).x);
}
if (newmult < 0)
@@ -657,7 +645,7 @@ Common::Point *AniHandler::getNumCycles(Common::Point *pRes, Movement *mov, int
if (flag) {
if (abs(p1y) > abs(p1x)) {
- while (abs(p1y * newmult + mov->calcSomeXY(point, 0, phase)->y) < abs(y)) {
+ while (abs(p1y * newmult + mov->calcSomeXY(0, phase).y) < abs(y)) {
sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
if (phase > sz)
@@ -666,7 +654,7 @@ Common::Point *AniHandler::getNumCycles(Common::Point *pRes, Movement *mov, int
phase++;
}
} else {
- while (abs(p1x * newmult + mov->calcSomeXY(point, 0, phase)->x) < abs(x)) {
+ while (abs(p1x * newmult + mov->calcSomeXY(0, phase).x) < abs(x)) {
sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
if (phase >= sz)
@@ -690,7 +678,7 @@ Common::Point *AniHandler::getNumCycles(Common::Point *pRes, Movement *mov, int
if (*len > 0) {
++*mult;
- mov->calcSomeXY(point, 0, *len);
+ point = mov->calcSomeXY(0, *len);
p2x = point.x;
p2y = point.y;
@@ -700,10 +688,7 @@ Common::Point *AniHandler::getNumCycles(Common::Point *pRes, Movement *mov, int
p2y = p1y;
}
- pRes->x = p2x + p1x * newmult;
- pRes->y = p2y + p1y * newmult;
-
- return pRes;
+ return Common::Point(p2x + p1x * newmult, p2y + p1y * newmult);
}
ExCommand2 *AniHandler::createCommand(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len) {
diff --git a/engines/fullpipe/anihandler.h b/engines/fullpipe/anihandler.h
index ae16f91ba8..6807629ead 100644
--- a/engines/fullpipe/anihandler.h
+++ b/engines/fullpipe/anihandler.h
@@ -78,12 +78,12 @@ public:
MessageQueue *makeRunQueue(MakeQueueStruct *mkQueue);
void putObjectToStatics(StaticANIObject *ani, int staticsId);
- Common::Point *getTransitionSize(Common::Point *point, int aniId, int staticsId1, int staticsId2);
+ Common::Point getTransitionSize(int aniId, int staticsId1, int staticsId2);
int getStaticsIndexById(int idx, int16 id);
int getStaticsIndex(int idx, Statics *st);
void clearVisitsList(int idx);
int seekWay(int idx, int st1idx, int st2idx, bool flip, bool flop);
- Common::Point *getNumCycles(Common::Point *point, Movement *mov, int x, int y, int *mult, int *len, int flag);
+ Common::Point getNumCycles(Movement *mov, int x, int y, int *mult, int *len, int flag);
ExCommand2 *createCommand(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len);
MessageQueue *makeQueue(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr);
int getFramesCount(int idx, int subIdx, int subOffset, int flag);
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 7153ae77fd..95609a3e0b 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -168,12 +168,6 @@ bool PictureObject::load(MfcArchive &file, bool bigPicture) {
return true;
}
-Common::Point *PictureObject::getDimensions(Common::Point *p) {
- _picture->getDimensions(p);
-
- return p;
-}
-
void PictureObject::draw() {
if (_flags & 1)
_picture->draw(_ox, _oy, 2, 0);
@@ -562,13 +556,6 @@ void Picture::init() {
_bitmap->_flags |= 0x1000000;
}
-Common::Point *Picture::getDimensions(Common::Point *p) {
- p->x = _width;
- p->y = _height;
-
- return p;
-}
-
void Picture::getDibInfo() {
int off = _dataSize & ~0xf;
@@ -635,14 +622,13 @@ void Picture::draw(int x, int y, int style, int angle) {
pal = g_fp->_globalPalette;
}
- Common::Point point;
-
switch (style) {
- case 1:
+ case 1: {
//flip
- getDimensions(&point);
- _bitmap->flipVertical()->drawShaded(1, x1, y1 + 30 + point.y, pal, _alpha);
+ const Dims dims = getDimensions();
+ _bitmap->flipVertical()->drawShaded(1, x1, y1 + 30 + dims.y, pal, _alpha);
break;
+ }
case 2:
//vrtSetFadeRatio(g_vrtDrawHandle, 0.34999999);
//vrtSetFadeTable(g_vrtDrawHandle, &unk_477F88, 1.0, 1000.0, 0, 0);
@@ -1214,18 +1200,16 @@ void Shadows::initMovement(Movement *mov) {
_items.clear();
_items.resize(num);
- Common::Point point;
-
- _items[0].dynPhase = (DynamicPhase *)mov->_staticsObj1;
- _items[0].dynPhase->getDimensions(&point);
- _items[0].width = point.x;
- _items[0].height = point.y;
+ _items[0].dynPhase = mov->_staticsObj1;
+ Dims dims = _items[0].dynPhase->getDimensions();
+ _items[0].width = dims.x;
+ _items[0].height = dims.y;
for (uint i = 1; i < num; i++) {
_items[i].dynPhase = mov->getDynamicPhaseByIndex(i - 1);
- _items[i].dynPhase->getDimensions(&point);
- _items[i].width = point.x;
- _items[i].height = point.y;
+ dims = _items[i].dynPhase->getDimensions();
+ _items[i].width = dims.x;
+ _items[i].height = dims.y;
}
}
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index 13f4464167..41214eef1b 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -34,6 +34,8 @@ class DynamicPhase;
class Movement;
struct PicAniInfo;
+typedef Common::Point Dims;
+
struct Bitmap {
int _x;
int _y;
@@ -105,7 +107,7 @@ class Picture : public MemoryObject {
byte getAlpha() { return (byte)_alpha; }
void setAlpha(byte alpha) { _alpha = alpha; }
- Common::Point *getDimensions(Common::Point *p);
+ Dims getDimensions() const { return Dims(_width, _height); }
bool isPointInside(int x, int y);
bool isPixelHitAtPos(int x, int y);
int getPixelAtPos(int x, int y);
@@ -171,7 +173,7 @@ class PictureObject : public GameObject {
virtual bool load(MfcArchive &file, bool bigPicture);
virtual bool load(MfcArchive &file) { assert(0); return false; } // Disable base class
- Common::Point *getDimensions(Common::Point *p);
+ Dims getDimensions() const { return _picture->getDimensions(); }
void draw();
void drawAt(int x, int y);
diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp
index 4bcc2acc17..0448c1b3c4 100644
--- a/engines/fullpipe/input.cpp
+++ b/engines/fullpipe/input.cpp
@@ -72,12 +72,10 @@ void setInputDisabled(bool state) {
void InputController::addCursor(CursorInfo *cursor) {
CursorInfo *newc = new CursorInfo(cursor);
- Common::Point p;
+ const Dims dims = cursor->picture->getDimensions();
- cursor->picture->getDimensions(&p);
-
- newc->width = p.x;
- newc->height = p.y;
+ newc->width = dims.x;
+ newc->height = dims.y;
newc->picture->_x = -1;
newc->picture->_y = -1;
@@ -331,20 +329,18 @@ void FullpipeEngine::processArcade(ExCommand *cmd) {
}
void FullpipeEngine::setArcadeOverlay(int picId) {
- Common::Point point;
- Common::Point point2;
-
_arcadeOverlayX = 800;
_arcadeOverlayY = 545;
_arcadeOverlayHelper = accessScene(SC_INV)->getPictureObjectById(PIC_CSR_HELPERBGR, 0);
_arcadeOverlay = accessScene(SC_INV)->getPictureObjectById(picId, 0);
- _arcadeOverlay->getDimensions(&point);
- _arcadeOverlayHelper->getDimensions(&point2);
+ const Dims dims = _arcadeOverlay->getDimensions();
+ const Dims dims2 = _arcadeOverlayHelper->getDimensions();
- _arcadeOverlayMidX = (point2.x - point.x) / 2;
- _arcadeOverlayMidY = abs(point2.y - point.y) / 2;
+ // TODO: Only Y gets abs?
+ _arcadeOverlayMidX = (dims2.x - dims.x) / 2;
+ _arcadeOverlayMidY = abs(dims2.y - dims.y) / 2;
}
int FullpipeEngine::drawArcadeOverlay(int adjust) {
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp
index 345a02c83e..9d6152d5a0 100644
--- a/engines/fullpipe/inventory.cpp
+++ b/engines/fullpipe/inventory.cpp
@@ -256,8 +256,6 @@ void Inventory2::rebuildItemRects() {
}
for (uint i = 0; i < _inventoryItems.size(); i++) {
- Common::Point point;
-
int idx = getInventoryPoolItemIndexById(_inventoryItems[i]->itemId);
InventoryIcon *icn = new InventoryIcon();
@@ -268,19 +266,19 @@ void Inventory2::rebuildItemRects() {
icn->pictureObjectHover = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectHover, 0);
icn->pictureObjectSelected = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectSelected, 0);
- icn->pictureObjectNormal->getDimensions(&point);
+ const Dims dims = icn->pictureObjectNormal->getDimensions();
if (_itemsPool[idx]->flags & 0x10000) {
icn->x1 = 730;
icn->y1 = itemY;
- icn->x2 = point.x + 730;
- icn->y2 = point.y + itemY + 10;
+ icn->x2 = dims.x + 730;
+ icn->y2 = dims.y + itemY + 10;
} else {
icn->x1 = itemX;
icn->y1 = itemY;
- icn->x2 = itemX + point.x;
+ icn->x2 = itemX + dims.x;
itemX = icn->x2 + 1;
- icn->y2 = point.y + itemY + 10;
+ icn->y2 = dims.y + itemY + 10;
}
_inventoryIcons.push_back(icn);
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp
index 6589ba6991..68f04552c5 100644
--- a/engines/fullpipe/modal.cpp
+++ b/engines/fullpipe/modal.cpp
@@ -525,12 +525,10 @@ bool ModalMap::init2(int counterdiff) {
g_fp->playSound(SND_CMN_070, 0);
} else {
- Common::Point p1, p2;
+ const Dims d1 = _picI03->getDimensions();
+ const Dims d2 = _highlightedPic->getDimensions();
- _picI03->getDimensions(&p1);
- _highlightedPic->getDimensions(&p2);
-
- _picI03->setOXY(_highlightedPic->_ox + p2.x / 2 - p1.x / 2, _highlightedPic->_oy + p2.y / 2 - p1.y / 2);
+ _picI03->setOXY(_highlightedPic->_ox + d2.x / 2 - d1.x / 2, _highlightedPic->_oy + d2.y / 2 - d1.y / 2);
_picI03->_flags |= 4;
}
}
@@ -644,14 +642,12 @@ void ModalMap::initMap() {
pic = getScenePicture(g_fp->_currentScene->_sceneId);
- Common::Point point;
- Common::Point point2;
-
if (pic) {
- pic->getDimensions(&point);
+ const Dims dims = pic->getDimensions();
+ Dims dims2;
- _rect2.left = point.x / 2 + pic->_ox - 400;
- _rect2.top = point.y / 2 + pic->_oy - 300;
+ _rect2.left = dims.x / 2 + pic->_ox - 400;
+ _rect2.top = dims.y / 2 + pic->_oy - 300;
_rect2.right = _rect2.left + 800;
_rect2.bottom = _rect2.top + 600;
@@ -660,15 +656,15 @@ void ModalMap::initMap() {
_mapScene->updateScrolling2();
_pic = _mapScene->getPictureObjectById(PIC_MAP_I02, 0);
- _pic->getDimensions(&point2);
+ dims2 = _pic->getDimensions();
- _pic->setOXY(pic->_ox + point.x / 2 - point2.x / 2, point.y - point2.y / 2 + pic->_oy - 24);
+ _pic->setOXY(pic->_ox + dims.x / 2 - dims2.x / 2, dims.y - dims2.y / 2 + pic->_oy - 24);
_pic->_flags |= 4;
_pic = _mapScene->getPictureObjectById(PIC_MAP_I01, 0);
- _pic->getDimensions(&point2);
+ dims2 = _pic->getDimensions();
- _pic->setOXY(pic->_ox + point.x / 2 - point2.x / 2, point.y - point2.y / 2 + pic->_oy - 25);
+ _pic->setOXY(pic->_ox + dims.x / 2 - dims2.x / 2, dims.y - dims2.y / 2 + pic->_oy - 25);
_pic->_flags |= 4;
}
@@ -1134,8 +1130,6 @@ void ModalFinal::update() {
}
ModalCredits::ModalCredits() {
- Common::Point point;
-
_sceneTitles = g_fp->accessScene(SC_TITLES);
_creditsPic = _sceneTitles->getPictureObjectById(PIC_TTL_CREDITS, 0);
@@ -1144,15 +1138,15 @@ ModalCredits::ModalCredits() {
_fadeIn = true;
_fadeOut = false;
- _creditsPic->getDimensions(&point);
+ const Dims dims = _creditsPic->getDimensions();
- _countdown = point.y / 2 + 470;
+ _countdown = dims.y / 2 + 470;
_sfxVolume = g_fp->_sfxVolume;
_currY = 630;
- _maxY = -1000 - point.y;
+ _maxY = -1000 - dims.y;
- _currX = 400 - point.x / 2;
+ _currX = 400 - dims.x / 2;
_creditsPic->setOXY(_currX, _currY);
}
@@ -1641,16 +1635,14 @@ int ModalMainMenu::checkHover(Common::Point &point) {
}
bool ModalMainMenu::isOverArea(PictureObject *obj, Common::Point *point) {
- Common::Point p;
-
- obj->getDimensions(&p);
+ const Dims dims = obj->getDimensions();
int left = point->x - 8;
int right = point->x + 12;
int down = point->y - 11;
int up = point->y + 9;
- if (left >= obj->_ox && right < obj->_ox + p.x && down >= obj->_oy && up < obj->_oy + p.y)
+ if (left >= obj->_ox && right < obj->_ox + dims.x && down >= obj->_oy && up < obj->_oy + dims.y)
return true;
return false;
@@ -2091,9 +2083,7 @@ void ModalSaveGame::setup(Scene *sc, int mode) {
_arrayL.push_back(sc->getPictureObjectById(PIC_MSV_SPACE_D, 0));
_arrayD.push_back(sc->getPictureObjectById(PIC_MSV_SPACE_L, 0));
- Common::Point point;
-
- int x = _bgr->_ox + _bgr->getDimensions(&point)->x / 2;
+ int x = _bgr->_ox + _bgr->getDimensions().x / 2;
int y = _bgr->_oy + 90;
int w;
FileInfo *fileinfo;
@@ -2106,20 +2096,19 @@ void ModalSaveGame::setup(Scene *sc, int mode) {
if (!getFileInfo(i, fileinfo)) {
fileinfo->empty = true;
- w = _emptyD->getDimensions(&point)->x;
+ w = _emptyD->getDimensions().x;
} else {
w = 0;
for (uint j = 0; j < _arrayL.size(); j++) {
- _arrayL[j]->getDimensions(&point);
- w += point.x + 2;
+ w += _arrayL[j]->getDimensions().x + 2;
}
}
fileinfo->fx1 = x - w / 2;
fileinfo->fx2 = x + w / 2;
fileinfo->fy1 = y;
- fileinfo->fy2 = y + _emptyD->getDimensions(&point)->y;
+ fileinfo->fy2 = y + _emptyD->getDimensions().y;
_files.push_back(fileinfo);
@@ -2200,8 +2189,6 @@ void ModalSaveGame::update() {
g_fp->setCursor(g_fp->_cursorId);
- Common::Point point;
-
for (uint i = 0; i < _files.size(); i++) {
if (g_fp->_mouseScreenPos.x < _files[i]->fx1 || g_fp->_mouseScreenPos.x > _files[i]->fx2 ||
g_fp->_mouseScreenPos.y < _files[i]->fy1 || g_fp->_mouseScreenPos.y > _files[i]->fy2 ) {
@@ -2215,7 +2202,7 @@ void ModalSaveGame::update() {
_arrayL[_files[i]->date[j]]->setOXY(x + 1, _files[i]->fy1);
_arrayL[_files[i]->date[j]]->draw();
- x += _arrayL[_files[i]->date[j]]->getDimensions(&point)->x + 2;
+ x += _arrayL[_files[i]->date[j]]->getDimensions().x + 2;
}
}
} else {
@@ -2229,7 +2216,7 @@ void ModalSaveGame::update() {
_arrayD[_files[i]->date[j]]->setOXY(x + 1, _files[i]->fy1);
_arrayD[_files[i]->date[j]]->draw();
- x += _arrayD[_files[i]->date[j]]->getDimensions(&point)->x + 2;
+ x += _arrayD[_files[i]->date[j]]->getDimensions().x + 2;
}
}
}
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 5297b9e527..eedd266378 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -495,7 +495,7 @@ MessageQueue *MctlLadder::makeQueue(StaticANIObject *ani, int xpos, int ypos, in
int ox = ani->_ox;
int oy = ani->_oy;
- ani->_movement->calcSomeXY(point, 1, ani->_someDynamicPhaseIndex);
+ point = ani->_movement->calcSomeXY(1, ani->_someDynamicPhaseIndex);
ani->_statics = ani->_movement->_staticsObj2;
ani->_movement = 0;
ani->setOXY(point.x + ox, point.y + oy);
@@ -545,7 +545,7 @@ MessageQueue *MctlLadder::makeQueue(StaticANIObject *ani, int xpos, int ypos, in
int ox = ani->_ox;
int oy = ani->_oy;
- ani->getMovementById(_ladmovements[pos]->movVars->varUpStop)->calcSomeXY(point, 0, -1);
+ point = ani->getMovementById(_ladmovements[pos]->movVars->varUpStop)->calcSomeXY(0, -1);
mkQueue.ani = ani;
@@ -583,7 +583,7 @@ MessageQueue *MctlLadder::makeQueue(StaticANIObject *ani, int xpos, int ypos, in
int nx = ani->_ox;
int ny = ani->_oy;
- _aniHandler.getTransitionSize(&point, ani->_id, ani->_statics->_staticsId, _ladmovements[pos]->staticIds[0]);
+ point = _aniHandler.getTransitionSize(ani->_id, ani->_statics->_staticsId, _ladmovements[pos]->staticIds[0]);
nx += point.x;
ny += point.y;
@@ -609,7 +609,7 @@ MessageQueue *MctlLadder::makeQueue(StaticANIObject *ani, int xpos, int ypos, in
int nx = ani->_ox;
int ny = ani->_oy;
- ani->getMovementById(_ladmovements[pos]->movVars->varDownStop)->calcSomeXY(point, 0, -1);
+ point = ani->getMovementById(_ladmovements[pos]->movVars->varDownStop)->calcSomeXY(0, -1);
nx += point.x;
ny += point.y;
@@ -1796,7 +1796,7 @@ bool MctlGraph::fillData(StaticANIObject *obj, MctlAni *item) {
item->_subItems[dir]._walk[act]._mov = mov;
if (mov) {
- mov->calcSomeXY(point, 0, -1);
+ point = mov->calcSomeXY(0, -1);
item->_subItems[dir]._walk[act]._mx = point.x;
item->_subItems[dir]._walk[act]._my = point.y;
}
@@ -1826,7 +1826,7 @@ bool MctlGraph::fillData(StaticANIObject *obj, MctlAni *item) {
item->_subItems[dir]._turn[act]._mov = mov;
if (mov) {
- mov->calcSomeXY(point, 0, -1);
+ point = mov->calcSomeXY(0, -1);
item->_subItems[dir]._turn[act]._mx = point.x;
item->_subItems[dir]._turn[act]._my = point.y;
}
@@ -1856,7 +1856,7 @@ bool MctlGraph::fillData(StaticANIObject *obj, MctlAni *item) {
item->_subItems[dir]._turnS[act]._mov = mov;
if (mov) {
- mov->calcSomeXY(point, 0, -1);
+ point = mov->calcSomeXY(0, -1);
item->_subItems[dir]._turnS[act]._mx = point.x;
item->_subItems[dir]._turnS[act]._my = point.y;
}
@@ -2242,7 +2242,7 @@ MessageQueue *MctlGraph::makeQueue(StaticANIObject *obj, int xpos, int ypos, int
newx = obj->_ox;
newy = obj->_oy;
} else {
- obj->_movement->calcSomeXY(point, 0, picAniInfo.dynamicPhaseIndex);
+ point = obj->_movement->calcSomeXY(0, picAniInfo.dynamicPhaseIndex);
newx = obj->_movement->_ox - point.x;
newy = obj->_movement->_oy - point.y;
if (idxsub != 1 && idxsub) {
@@ -2540,7 +2540,7 @@ MessageQueue *MctlGraph::makeLineQueue(MctlMQ *info) {
int a2 = 0;
int mgmLen;
- _aniHandler.getNumCycles(&point, _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov, x, y, &mgmLen, &a2, info->flags & 1);
+ point = _aniHandler.getNumCycles(_items2[info->index]->_subItems[info->subIndex]._walk[1]._mov, x, y, &mgmLen, &a2, info->flags & 1);
int x1 = point.x;
int y1 = point.y;
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index 3d39683431..5e92c5f1eb 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -591,13 +591,11 @@ void Scene::updateScrolling() {
void Scene::updateScrolling2() {
if (_picObjList.size()) {
- Common::Point point;
int offsetY = 0;
int offsetX = 0;
- ((PictureObject *)_picObjList[0])->getDimensions(&point);
-
- int flags = ((PictureObject *)_picObjList[0])->_flags;
+ const Dims dims = _picObjList[0]->getDimensions();
+ const int flags = _picObjList[0]->_flags;
if (g_fp->_sceneRect.left < 0 && !(flags & 2))
offsetX = -g_fp->_sceneRect.left;
@@ -605,11 +603,11 @@ void Scene::updateScrolling2() {
if (g_fp->_sceneRect.top < 0 && !(flags & 0x20))
offsetY = -g_fp->_sceneRect.top;
- if (g_fp->_sceneRect.right > point.x - 1 && g_fp->_sceneRect.left > 0 && !(flags & 2))
- offsetX = point.x - g_fp->_sceneRect.right - 1;
+ if (g_fp->_sceneRect.right > dims.x - 1 && g_fp->_sceneRect.left > 0 && !(flags & 2))
+ offsetX = dims.x - g_fp->_sceneRect.right - 1;
- if (g_fp->_sceneRect.bottom > point.y - 1 && g_fp->_sceneRect.top > 0 && !(flags & 0x20))
- offsetY = point.y - g_fp->_sceneRect.bottom - 1;
+ if (g_fp->_sceneRect.bottom > dims.y - 1 && g_fp->_sceneRect.top > 0 && !(flags & 0x20))
+ offsetY = dims.y - g_fp->_sceneRect.bottom - 1;
g_fp->_sceneRect.translate(offsetX, offsetY);
}
@@ -694,35 +692,35 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
debugC(1, kDebugDrawing, "-> Scene::drawContent(>%d, <%d, %d)", minPri, maxPri, drawBg);
- Common::Point point;
+ Dims dims;
debugC(1, kDebugDrawing, "_bigPict: %d objlist: %d", _bigPictureArray1Count, _picObjList.size());
if (drawBg && _bigPictureArray1Count && _picObjList.size()) {
- _bigPictureArray[0][0]->getDimensions(&point);
+ dims = _bigPictureArray[0][0]->getDimensions();
- int width = point.x;
- int height = point.y;
+ int width = dims.x;
+ int height = dims.y;
debugC(8, kDebugDrawing, "w: %d h:%d", width, height);
- ((PictureObject *)_picObjList[0])->getDimensions(&point);
+ dims = _picObjList[0]->getDimensions();
- debugC(8, kDebugDrawing, "w2: %d h2:%d", point.x, point.y);
+ debugC(8, kDebugDrawing, "w2: %d h2:%d", dims.x, dims.y);
- int bgStX = g_fp->_sceneRect.left % point.x;
+ int bgStX = g_fp->_sceneRect.left % dims.x;
if (bgStX < 0)
- bgStX += point.x;
+ bgStX += dims.x;
int bgNumX = bgStX / width;
int bgOffsetX = bgStX % width;
- int bgStY = g_fp->_sceneRect.top % point.y;
+ int bgStY = g_fp->_sceneRect.top % dims.y;
if (bgStY < 0)
- bgStY += point.y;
+ bgStY += dims.y;
int bgNumY = bgStY / height;
int bgOffsetY = bgStY % height;
@@ -735,7 +733,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
for (int y = g_fp->_sceneRect.top - bgOffsetY; y < g_fp->_sceneRect.bottom - 1;) {
BigPicture *v27 = _bigPictureArray[bgNumX][v25];
v27->draw(bgPosX, y, 0, 0);
- y += v27->getDimensions(&point)->y;
+ y += v27->getDimensions().y;
v25++;
if (v25 >= _bigPictureArray2Count) {
@@ -744,9 +742,9 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
v25 = 0;
}
}
- _bigPictureArray[bgNumX][0]->getDimensions(&point);
- int oldx = point.x + bgPosX;
- bgPosX += point.x;
+ dims = _bigPictureArray[bgNumX][0]->getDimensions();
+ int oldx = dims.x + bgPosX;
+ bgPosX += dims.x;
bgNumX++;
if (bgNumX >= _bigPictureArray1Count) {
@@ -772,10 +770,10 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
debugC(8, kDebugDrawing, "obj: %d %d", objX, objY);
- obj->getDimensions(&point);
+ dims = obj->getDimensions();
- int width = point.x;
- int height = point.y;
+ int width = dims.x;
+ int height = dims.y;
if (obj->_flags & 8) {
while (objX > g_fp->_sceneRect.right) {
diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp
index 7825a1eb2d..896ea5a3fb 100644
--- a/engines/fullpipe/scenes.cpp
+++ b/engines/fullpipe/scenes.cpp
@@ -539,7 +539,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
if (!scene)
return 0;
- ((PictureObject *)scene->_picObjList.front())->getDimensions(&sceneDim);
+ sceneDim = scene->_picObjList.front()->getDimensions();
_sceneWidth = sceneDim.x;
_sceneHeight = sceneDim.y;
diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp
index 0e5040097c..228fc77aae 100644
--- a/engines/fullpipe/scenes/scene04.cpp
+++ b/engines/fullpipe/scenes/scene04.cpp
@@ -1003,9 +1003,7 @@ void sceneHandler04_springWobble() {
}
}
- Common::Point point;
-
- int oldpos = g_vars->scene04_spring->getCurrDimensions(point)->y - oldDynIndex;
+ int oldpos = g_vars->scene04_spring->getCurrDimensions().y - oldDynIndex;
if (g_vars->scene04_dynamicPhaseIndex) {
if (!g_vars->scene04_spring->_movement)
@@ -1017,7 +1015,7 @@ void sceneHandler04_springWobble() {
}
if (g_vars->scene04_dynamicPhaseIndex != oldDynIndex) {
- sceneHandler04_bottleUpdateObjects(oldpos - (g_vars->scene04_spring->getCurrDimensions(point)->y - g_vars->scene04_dynamicPhaseIndex));
+ sceneHandler04_bottleUpdateObjects(oldpos - (g_vars->scene04_spring->getCurrDimensions().y - g_vars->scene04_dynamicPhaseIndex));
}
}
@@ -1316,8 +1314,6 @@ void sceneHandler04_testPlank(ExCommand *ex) {
}
void sceneHandler04_updateBottle() {
- Common::Point point;
-
int yoff;
if (g_vars->scene04_hand->_movement)
@@ -1325,7 +1321,7 @@ void sceneHandler04_updateBottle() {
else
yoff = g_vars->scene04_hand->_oy;
- int newy = g_vars->scene04_hand->getSomeXY(point)->y + yoff + 140;
+ int newy = g_vars->scene04_hand->getSomeXY().y + yoff + 140;
sceneHandler04_bottleUpdateObjects(newy - g_vars->scene04_spring->_oy);
diff --git a/engines/fullpipe/scenes/scene06.cpp b/engines/fullpipe/scenes/scene06.cpp
index a6d93b69bd..4e003c6954 100644
--- a/engines/fullpipe/scenes/scene06.cpp
+++ b/engines/fullpipe/scenes/scene06.cpp
@@ -437,23 +437,23 @@ void sceneHandler06_catchBall() {
if (g_vars->scene06_mumsy->_movement->_id == MV_MOM_JUMPFW) {
if (g_vars->scene06_mumsy->_movement->_currDynamicPhaseIndex <= 5) {
- g_vars->scene06_mumsy->_movement->calcSomeXY(point, 0, g_vars->scene06_mumsy->_movement->_currDynamicPhaseIndex);
+ point = g_vars->scene06_mumsy->_movement->calcSomeXY(0, g_vars->scene06_mumsy->_movement->_currDynamicPhaseIndex);
point.x = -point.x;
point.y = -point.y;
} else {
- g_vars->scene06_mumsy->_movement->calcSomeXY(point, 1, -1);
+ point = g_vars->scene06_mumsy->_movement->calcSomeXY(1, -1);
g_vars->scene06_mumsyPos++;
}
} else if (g_vars->scene06_mumsy->_movement->_id == MV_MOM_JUMPBK) {
if (g_vars->scene06_mumsy->_movement->_currDynamicPhaseIndex <= 4) {
- g_vars->scene06_mumsy->_movement->calcSomeXY(point, 0, g_vars->scene06_mumsy->_movement->_currDynamicPhaseIndex);
+ point = g_vars->scene06_mumsy->_movement->calcSomeXY(0, g_vars->scene06_mumsy->_movement->_currDynamicPhaseIndex);
point.x = -point.x;
point.y = -point.y;
} else {
- g_vars->scene06_mumsy->_movement->calcSomeXY(point, 1, -1);
+ point = g_vars->scene06_mumsy->_movement->calcSomeXY(1, -1);
g_vars->scene06_mumsyPos--;
}
diff --git a/engines/fullpipe/scenes/scene08.cpp b/engines/fullpipe/scenes/scene08.cpp
index 24b23c1506..00f8f93354 100644
--- a/engines/fullpipe/scenes/scene08.cpp
+++ b/engines/fullpipe/scenes/scene08.cpp
@@ -193,9 +193,7 @@ int sceneHandler08_calcOffset(int off, int flag) {
}
void sceneHandler08_pushCallback(int *par) {
- Common::Point point;
-
- int y = g_fp->_aniMan->_oy + g_fp->_aniMan->getSomeXY(point)->y;
+ int y = g_fp->_aniMan->_oy + g_fp->_aniMan->getSomeXY().y;
if (g_fp->_aniMan->_statics && g_fp->_aniMan->_statics->_staticsId == ST_MAN8_FLYDOWN)
y -= 25;
@@ -253,7 +251,7 @@ void sceneHandler08_airMoves() {
int y = g_fp->_aniMan->_oy;
Common::Point point;
- if (703 - g_fp->_aniMan->getSomeXY(point)->y - y < 150) {
+ if (703 - g_fp->_aniMan->getSomeXY().y - y < 150) {
if (g_fp->_aniMan->_statics) {
if (g_fp->_aniMan->_statics->_staticsId == ST_MAN8_FLYDOWN) {
y -= 25;
@@ -358,7 +356,7 @@ void sceneHandler08_calcFlight() {
if (g_vars->scene08_manOffsetY < g_vars->scene08_stairsOffset)
g_vars->scene08_manOffsetY = g_vars->scene08_stairsOffset;
- y = y + g_fp->_aniMan->getSomeXY(point)->y;
+ y = y + g_fp->_aniMan->getSomeXY().y;
if (g_fp->_aniMan->_statics && g_fp->_aniMan->_statics->_staticsId == ST_MAN8_FLYDOWN)
y -= 25;
diff --git a/engines/fullpipe/scenes/scene25.cpp b/engines/fullpipe/scenes/scene25.cpp
index 83a0ee0a72..8323e3d705 100644
--- a/engines/fullpipe/scenes/scene25.cpp
+++ b/engines/fullpipe/scenes/scene25.cpp
@@ -441,7 +441,7 @@ void sceneHandler25_walkOnLadder(StaticANIObject *ani, Common::Point *pnt, Messa
if (flag) {
if (ani->_movement) {
- ani->_movement->calcSomeXY(point, 0, ani->_movement->_currDynamicPhaseIndex);
+ point = ani->_movement->calcSomeXY(0, ani->_movement->_currDynamicPhaseIndex);
newx = point.x;
aniY = ani->_oy - point.y;
}
@@ -478,7 +478,7 @@ void sceneHandler25_walkOnLadder(StaticANIObject *ani, Common::Point *pnt, Messa
newy = pnty;
}
- ani->getMovementById(ex->_messageNum)->calcSomeXY(point, 0, -1);
+ point = ani->getMovementById(ex->_messageNum)->calcSomeXY(0, -1);
pntx += point.x;
pnty += point.y;
}
diff --git a/engines/fullpipe/scenes/sceneDbg.cpp b/engines/fullpipe/scenes/sceneDbg.cpp
index 2ba59778ba..4d061e603c 100644
--- a/engines/fullpipe/scenes/sceneDbg.cpp
+++ b/engines/fullpipe/scenes/sceneDbg.cpp
@@ -48,11 +48,8 @@ GameObject *sceneHandlerDbgMenu_getObjectAtXY(int x, int y) {
PictureObject *pic = (PictureObject *)g_fp->_currentScene->_picObjList[i];
if (x >= pic->_ox && y >= pic->_oy) {
- Common::Point point;
-
- pic->getDimensions(&point);
-
- if (x <= pic->_ox + point.x && y <= pic->_oy + point.y && pic != g_vars->selector)
+ const Dims dims = pic->getDimensions();
+ if (x <= pic->_ox + dims.x && y <= pic->_oy + dims.y && pic != g_vars->selector)
return pic;
}
}
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index 21b9ba89a6..98854f98d2 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -64,30 +64,27 @@ void StepArray::clear() {
}
}
-Common::Point *StepArray::getCurrPoint(Common::Point *point) {
+Common::Point StepArray::getCurrPoint() const {
if (_isEos || _points == 0) {
- point->x = 0;
- point->y = 0;
- } else {
- point->x = _points[_currPointIndex]->x;
- point->y = _points[_currPointIndex]->y;
+ return Common::Point();
}
- return point;
+
+ return Common::Point(_points[_currPointIndex]->x,
+ _points[_currPointIndex]->y);
}
-Common::Point *StepArray::getPoint(Common::Point *point, int index, int offset) {
+Common::Point StepArray::getPoint(int index, int offset) const {
if (index == -1)
index = _currPointIndex;
if (index + offset > _maxPointIndex - 1)
offset = _maxPointIndex - index;
- point->x = 0;
- point->y = 0;
+ Common::Point point;
while (offset >= 1) {
- point->x += _points[index]->x;
- point->y += _points[index]->y;
+ point.x += _points[index]->x;
+ point.y += _points[index]->y;
index++;
offset--;
@@ -240,7 +237,7 @@ bool StaticANIObject::load(MfcArchive &file) {
Common::Point pt;
if (count) { // We have movements
- _movements[0]->getCurrDynamicPhaseXY(pt);
+ pt = _movements[0]->getCurrDynamicPhaseXY();
} else {
pt.x = pt.y = 100;
}
@@ -476,7 +473,6 @@ bool StaticANIObject::getPixelAtPos(int x, int y, uint32 *pixel, bool hitOnly) {
int ongoing;
int xani, yani;
int oxani, oyani;
- Common::Point point;
if (_movement)
ongoing = _movement->_currMovement != 0;
@@ -484,13 +480,13 @@ bool StaticANIObject::getPixelAtPos(int x, int y, uint32 *pixel, bool hitOnly) {
ongoing = _statics->_staticsId & 0x4000;
if (_movement) {
- _movement->getCurrDynamicPhaseXY(point);
+ const Common::Point point = _movement->getCurrDynamicPhaseXY();
xani = point.x;
yani = point.y;
oxani = _movement->_ox;
oyani = _movement->_oy;
} else {
- _statics->getSomeXY(point);
+ const Common::Point point = _statics->getSomeXY();
xani = point.x;
yani = point.y;
oxani = _ox;
@@ -501,7 +497,7 @@ bool StaticANIObject::getPixelAtPos(int x, int y, uint32 *pixel, bool hitOnly) {
int ytarget = y - (oyani - yani);
if (ongoing && _movement)
- xtarget = pic->getDimensions(&point)->x - xtarget;
+ xtarget = pic->getDimensions().x - xtarget;
x = pic->_x;
y = pic->_y;
@@ -527,9 +523,7 @@ bool StaticANIObject::getPixelAtPos(int x, int y, uint32 *pixel, bool hitOnly) {
void Movement::draw(bool flipFlag, int angle) {
debugC(3, kDebugDrawing, "Movement::draw(%d, %d)", flipFlag, angle);
- Common::Point point;
-
- getCurrDynamicPhaseXY(point);
+ Common::Point point = getCurrDynamicPhaseXY();
int x = _ox - point.x;
int y = _oy - point.y;
@@ -601,13 +595,12 @@ void StaticANIObject::draw() {
if ((_flags & 4) == 0)
return;
- Common::Point point;
Common::Rect rect;
debugC(6, kDebugDrawing, "StaticANIObject::draw() (%s) [%d] [%d, %d]", transCyrillic(_objectName), _id, _ox, _oy);
if (_shadowsOn && g_fp->_currentScene && g_fp->_currentScene->_shadows
- && (getCurrDimensions(point)->x != 1 || getCurrDimensions(point)->y != 1)) {
+ && (getCurrDimensions().x != 1 || getCurrDimensions().y != 1)) {
DynamicPhase *dyn;
@@ -626,16 +619,16 @@ void StaticANIObject::draw() {
DynamicPhase *shd = g_fp->_currentScene->_shadows->findSize(rect.width(), rect.height());
if (shd) {
- shd->getDimensions(&point);
- int midx = _ox - point.x / 2 - dyn->_someX;
- int midy = _oy - point.y / 2 - dyn->_someY + rect.bottom - 3;
- int shdw = point.y;
+ const Dims dims = shd->getDimensions();
+ int midx = _ox - dims.x / 2 - dyn->_someX;
+ int midy = _oy - dims.y / 2 - dyn->_someY + rect.bottom - 3;
+ int shdw = dims.y;
int px;
if (!_movement || (_flags & 0x20))
- px = _statics->getCenter(&point)->x;
+ px = _statics->getCenter().x;
else
- px = _movement->getCenter(&point)->x;
+ px = _movement->getCenter().x;
if (_shadowsOn != 1)
midy = _shadowsOn - shdw / 2;
@@ -654,7 +647,7 @@ void StaticANIObject::draw() {
}
if (!_movement || (_flags & 0x20)) {
- _statics->getSomeXY(point);
+ const Common::Point point = _statics->getSomeXY();
_statics->_x = _ox - point.x;
_statics->_y = _oy - point.y;
_statics->draw(_statics->_x, _statics->_y, 0, angle);
@@ -670,10 +663,7 @@ void StaticANIObject::draw2() {
if (_movement) {
_movement->draw(1, 0);
} else {
- Common::Point point;
-
- _statics->getSomeXY(point);
-
+ const Common::Point point = _statics->getSomeXY();
_statics->draw(_ox - point.x, _oy - point.y, 1, 0);
}
}
@@ -751,7 +741,7 @@ void StaticANIObject::preloadMovements(MovTable *mt) {
}
}
-Common::Point *StaticANIObject::getCurrDimensions(Common::Point &p) {
+Dims StaticANIObject::getCurrDimensions() const {
Picture *pic;
if (_movement)
@@ -760,30 +750,21 @@ Common::Point *StaticANIObject::getCurrDimensions(Common::Point &p) {
pic = _statics;
if (pic) {
- Common::Point point;
-
- pic->getDimensions(&point);
- p.x = point.x;
- p.y = point.y;
- } else {
- p.x = 0;
- p.y = 0;
+ return pic->getDimensions();
}
- return &p;
+ return Dims();
}
-Common::Point *StaticANIObject::getSomeXY(Common::Point &p) {
+Common::Point StaticANIObject::getSomeXY() const {
if (_movement) {
- _movement->getCurrDynamicPhaseXY(p);
-
- return &p;
+ return _movement->getCurrDynamicPhaseXY();
}
if (_statics)
- _statics->getSomeXY(p);
+ return _statics->getSomeXY();
- return &p;
+ error("No someXY found");
}
void StaticANIObject::update(int counterdiff) {
@@ -804,7 +785,6 @@ void StaticANIObject::update(int counterdiff) {
return;
}
- Common::Point point;
ExCommand *ex, *newex;
if (_movement) {
@@ -870,7 +850,7 @@ void StaticANIObject::update(int counterdiff) {
if (!_movement)
return;
- _stepArray.getCurrPoint(&point);
+ const Common::Point point = _stepArray.getCurrPoint();
setOXY(point.x + _ox, point.y + _oy);
_stepArray.gotoNextPoint();
if (_someDynamicPhaseIndex == _movement->_currDynamicPhaseIndex)
@@ -880,10 +860,9 @@ void StaticANIObject::update(int counterdiff) {
_flags |= 1;
_movement->gotoFirstFrame();
- _movement->getCurrDynamicPhaseXY(point);
- Common::Point pointS;
- _statics->getSomeXY(pointS);
+ const Common::Point point = _movement->getCurrDynamicPhaseXY();
+ const Common::Point pointS = _statics->getSomeXY();
_movement->setOXY(_ox + point.x + _movement->_mx - pointS.x,
_oy + point.y + _movement->_my - pointS.y);
}
@@ -908,11 +887,11 @@ void StaticANIObject::updateStepPos() {
int ox = _movement->_ox;
int oy = _movement->_oy;
- _movement->calcSomeXY(point, 1, _someDynamicPhaseIndex);
+ point = _movement->calcSomeXY(1, _someDynamicPhaseIndex);
int x = point.x;
int y = point.y;
- _stepArray.getPoint(&point, -1, _stepArray.getPointsCount());
+ point = _stepArray.getPoint(-1, _stepArray.getPointsCount());
x += point.x;
y += point.y;
@@ -930,9 +909,7 @@ Common::Point *StaticANIObject::calcNextStep(Common::Point *pRes) {
return pRes;
}
- Common::Point point;
-
- _movement->calcSomeXY(point, 1, _someDynamicPhaseIndex);
+ Common::Point point = _movement->calcSomeXY(1, _someDynamicPhaseIndex);
int resX = point.x;
int resY = point.y;
@@ -948,7 +925,7 @@ Common::Point *StaticANIObject::calcNextStep(Common::Point *pRes) {
}
if (pointN >= 0) {
- _stepArray.getPoint(&point, pointN, offset);
+ point = _stepArray.getPoint(pointN, offset);
resX += point.x;
resY += point.y;
@@ -981,18 +958,18 @@ void StaticANIObject::stopAnim_maybe() {
goto L11;
L8:
_statics = _movement->_staticsObj1;
- _movement->getCurrDynamicPhaseXY(point);
+ point = _movement->getCurrDynamicPhaseXY();
_ox -= point.x;
_oy -= point.y;
_ox -= _movement->_mx;
_oy -= _movement->_my;
- _statics->getSomeXY(point);
+ point = _statics->getSomeXY();
if (_movement->_currMovement) {
_oy += point.y;
_ox -= point.x;
- _ox += _statics->getDimensions(&point)->x;
+ _ox += _statics->getDimensions().x;
} else {
_ox += point.x;
_oy += point.y;
@@ -1005,7 +982,7 @@ L8:
L11:
_statics = _movement->_staticsObj2;
L12:
- _statics->getSomeXY(point);
+ point = _statics->getSomeXY();
_statics->_x = _ox - point.x;
_statics->_y = _oy - point.y;
@@ -1036,11 +1013,11 @@ void StaticANIObject::adjustSomeXY() {
if (_movement) {
Common::Point point;
- _movement->calcSomeXY(point, 0, -1);
+ point = _movement->calcSomeXY(0, -1);
int diff = abs(point.y) - abs(point.x);
- _movement->calcSomeXY(point, 1, -1);
+ point = _movement->calcSomeXY(1, -1);
if (diff > 0)
_ox += point.x;
@@ -1131,9 +1108,7 @@ void StaticANIObject::show1(int x, int y, int movId, int mqId) {
_statics = mov->_staticsObj1;
- Common::Point point;
-
- mov->_staticsObj1->getSomeXY(point);
+ const Common::Point point = mov->_staticsObj1->getSomeXY();
_statics->_x = x - point.x;
_statics->_y = y - point.y;
@@ -1173,13 +1148,11 @@ void StaticANIObject::show2(int x, int y, int movementId, int mqId) {
mov->setOXY(x, y);
mov->gotoFirstFrame();
- Common::Point point;
-
- mov->getCurrDynamicPhaseXY(point);
+ Common::Point point = mov->getCurrDynamicPhaseXY();
_statics->_x = mov->_ox - point.x - mov->_mx;
_statics->_y = mov->_oy - point.y - mov->_my;
- _statics->getSomeXY(point);
+ point = _statics->getSomeXY();
_flags |= 4;
_ox = _statics->_x + point.x;
_oy = _statics->_y + point.y;
@@ -1227,9 +1200,7 @@ void StaticANIObject::startAnimSteps(int movementId, int messageQueueId, int x,
if (_movement || !_statics)
return;
- Common::Point point;
-
- _statics->getSomeXY(point);
+ Common::Point point = _statics->getSomeXY();
int newx = _ox - point.x;
int newy = _oy - point.y;
@@ -1246,7 +1217,7 @@ void StaticANIObject::startAnimSteps(int movementId, int messageQueueId, int x,
if (!(_flags & 0x40)) {
if (!_movement->_currDynamicPhaseIndex) {
- _stepArray.getCurrPoint(&point);
+ point = _stepArray.getCurrPoint();
newx += point.x + _movement->_mx;
newy += point.y + _movement->_my;
_stepArray.gotoNextPoint();
@@ -1264,7 +1235,7 @@ void StaticANIObject::startAnimSteps(int movementId, int messageQueueId, int x,
}
}
- _movement->getCurrDynamicPhaseXY(point);
+ point = _movement->getCurrDynamicPhaseXY();
setOXY(point.x + newx, point.y + newy);
if ((_movement->_staticsObj2->_staticsId >> 8) & 0x40)
@@ -1332,13 +1303,13 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase
Common::Point point;
if (_movement) {
- _movement->getCurrDynamicPhaseXY(point);
+ point = _movement->getCurrDynamicPhaseXY();
newx -= point.x;
newy -= point.y;
} else if (_statics) {
- _statics->getSomeXY(point);
+ point = _statics->getSomeXY();
newx -= point.x;
newy -= point.y;
@@ -1355,7 +1326,7 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase
if (!(_flags & 0x40)) {
if (!_movement->_currDynamicPhaseIndex) {
- _stepArray.getCurrPoint(&point);
+ point = _stepArray.getCurrPoint();
newx += point.x + _movement->_mx;
newy += point.y + _movement->_my;
@@ -1372,7 +1343,7 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase
}
}
- _movement->getCurrDynamicPhaseXY(point);
+ point = _movement->getCurrDynamicPhaseXY();
setOXY(point.x + newx, point.y + newy);
if (_movement->_staticsObj2->_staticsId & 0x4000)
@@ -1405,7 +1376,7 @@ Common::Point *StaticANIObject::calcStepLen(Common::Point *p) {
if (_movement) {
Common::Point point;
- _movement->calcSomeXY(point, 0, _movement->_currDynamicPhaseIndex);
+ point = _movement->calcSomeXY(0, _movement->_currDynamicPhaseIndex);
p->x = point.x;
p->y = point.y;
@@ -1413,8 +1384,7 @@ Common::Point *StaticANIObject::calcStepLen(Common::Point *p) {
int idx = _stepArray.getCurrPointIndex() - _movement->_currDynamicPhaseIndex - 1;
if (idx >= 0) {
- _stepArray.getPoint(&point, idx, _movement->_currDynamicPhaseIndex + 2);
-
+ point = _stepArray.getPoint(idx, _movement->_currDynamicPhaseIndex + 2);
p->x += point.x;
p->y += point.y;
}
@@ -1479,29 +1449,22 @@ void Statics::init() {
}
}
-Common::Point *Statics::getSomeXY(Common::Point &p) {
- p.x = _someX;
- p.y = _someY;
-
- return &p;
+Common::Point Statics::getSomeXY() const {
+ return Common::Point(_someX, _someY);
}
-Common::Point *Statics::getCenter(Common::Point *p) {
+Common::Point Statics::getCenter() const {
Common::Rect rect;
rect = *_rect;
if (_staticsId & 0x4000) {
- Common::Point point;
-
- getDimensions(&point);
- rect.moveTo(point.x - _rect->right, _rect->top);
+ const Dims dims = getDimensions();
+ rect.moveTo(dims.x - _rect->right, _rect->top);
}
- p->x = rect.left + _rect->width() / 2;
- p->y = rect.top + _rect->height() / 2;
-
- return p;
+ return Common::Point(rect.left + _rect->width() / 2,
+ rect.top + _rect->height() / 2);
}
Movement::Movement() {
@@ -1766,14 +1729,11 @@ bool Movement::load(MfcArchive &file, StaticANIObject *ani) {
return true;
}
-Common::Point *Movement::getCurrDynamicPhaseXY(Common::Point &p) {
- p.x = _currDynamicPhase->_someX;
- p.y = _currDynamicPhase->_someY;
-
- return &p;
+Common::Point Movement::getCurrDynamicPhaseXY() const {
+ return Common::Point(_currDynamicPhase->_someX, _currDynamicPhase->_someY);
}
-Common::Point *Movement::calcSomeXY(Common::Point &p, int idx, int dynidx) {
+Common::Point Movement::calcSomeXY(int idx, int dynidx) {
int oldox = _ox;
int oldoy = _oy;
int oldidx = _currDynamicPhaseIndex;
@@ -1782,9 +1742,7 @@ Common::Point *Movement::calcSomeXY(Common::Point &p, int idx, int dynidx) {
int y = 0;
if (!idx) {
- Common::Point point;
-
- _staticsObj1->getSomeXY(point);
+ const Common::Point point = _staticsObj1->getSomeXY();
int x1 = _mx - point.x;
int y1 = _my - point.y;
@@ -1799,13 +1757,12 @@ Common::Point *Movement::calcSomeXY(Common::Point &p, int idx, int dynidx) {
while (_currDynamicPhaseIndex != dynidx && gotoNextFrame(0, 0))
;
- p.x = _ox;
- p.y = _oy;
+ Common::Point p(_ox, _oy);
setDynamicPhaseIndex(oldidx);
setOXY(oldox, oldoy);
- return &p;
+ return p;
}
void Movement::setAlpha(int alpha) {
@@ -1819,7 +1776,7 @@ void Movement::setAlpha(int alpha) {
}
}
-Common::Point *Movement::getDimensionsOfPhase(Common::Point *p, int phaseIndex) {
+Dims Movement::getDimensionsOfPhase(int phaseIndex) const {
int idx = phaseIndex;
if (idx == -1)
@@ -1832,13 +1789,7 @@ Common::Point *Movement::getDimensionsOfPhase(Common::Point *p, int phaseIndex)
else
dyn = _dynamicPhases[idx];
- Common::Point point;
-
- dyn->getDimensions(&point);
-
- *p = point;
-
- return p;
+ return dyn->getDimensions();
}
void Movement::initStatics(StaticANIObject *ani) {
@@ -1857,9 +1808,9 @@ void Movement::initStatics(StaticANIObject *ani) {
Common::Point point;
- int x1 = _currMovement->_staticsObj1->getDimensions(&point)->x - _mx;
+ int x1 = _currMovement->_staticsObj1->getDimensions().x - _mx;
- _mx = x1 - _currMovement->_currDynamicPhase->getDimensions(&point)->x;
+ _mx = x1 - _currMovement->_currDynamicPhase->getDimensions().x;
_currMovement->setDynamicPhaseIndex(_currMovement->_currDynamicPhaseIndex);
@@ -1867,8 +1818,8 @@ void Movement::initStatics(StaticANIObject *ani) {
_m2y = _currMovement->_m2y;
_currMovement->gotoLastFrame();
- x1 = _currMovement->_staticsObj2->getDimensions(&point)->x;
- _m2x = _currMovement->_currDynamicPhase->getDimensions(&point)->x - _m2x - x1;
+ x1 = _currMovement->_staticsObj2->getDimensions().x;
+ _m2x = _currMovement->_currDynamicPhase->getDimensions().x - _m2x - x1;
}
void Movement::updateCurrDynamicPhase() {
@@ -2011,16 +1962,14 @@ bool Movement::gotoNextFrame(void (*callback1)(int, Common::Point *point, int, i
return true;
}
- Common::Point point;
-
- getCurrDynamicPhaseXY(point);
+ Common::Point point = getCurrDynamicPhaseXY();
_ox -= point.x;
_oy -= point.y;
int deltax = 0;
if (_currMovement)
- deltax = _currMovement->getDimensionsOfPhase(&point, _currDynamicPhaseIndex)->x;
+ deltax = _currMovement->getDimensionsOfPhase(_currDynamicPhaseIndex).x;
int oldDynIndex = _currDynamicPhaseIndex;
@@ -2048,25 +1997,25 @@ bool Movement::gotoNextFrame(void (*callback1)(int, Common::Point *point, int, i
_ox += deltax - point.x;
_oy += point.y;
- _ox -= _currMovement->getDimensionsOfPhase(&point, _currDynamicPhaseIndex)->x;
+ _ox -= _currMovement->getDimensionsOfPhase(_currDynamicPhaseIndex).x;
} else if (oldDynIndex >= _currDynamicPhaseIndex) {
while (oldDynIndex > _currDynamicPhaseIndex) {
_ox += deltax;
- deltax = _currMovement->getDimensionsOfPhase(&point, oldDynIndex)->x;
+ deltax = _currMovement->getDimensionsOfPhase(oldDynIndex).x;
_ox += _currMovement->_framePosOffsets[oldDynIndex]->x;
_oy -= _currMovement->_framePosOffsets[oldDynIndex]->y;
oldDynIndex--;
- _ox -= _currMovement->getDimensionsOfPhase(&point, oldDynIndex)->x;
+ _ox -= _currMovement->getDimensionsOfPhase(oldDynIndex).x;
}
} else {
for (int i = oldDynIndex + 1; i <= _currDynamicPhaseIndex; i++) {
_ox += deltax;
- deltax = _currMovement->getDimensionsOfPhase(&point, i)->x;
+ deltax = _currMovement->getDimensionsOfPhase(i).x;
_ox -= _currMovement->_framePosOffsets[i]->x;
_oy += _currMovement->_framePosOffsets[i]->y;
- _ox -= _currMovement->getDimensionsOfPhase(&point, i)->x;
+ _ox -= _currMovement->getDimensionsOfPhase(i).x;
}
}
}
@@ -2103,7 +2052,7 @@ bool Movement::gotoNextFrame(void (*callback1)(int, Common::Point *point, int, i
}
updateCurrDynamicPhase();
- getCurrDynamicPhaseXY(point);
+ point = getCurrDynamicPhaseXY();
_ox += point.x;
_oy += point.y;
@@ -2120,16 +2069,14 @@ bool Movement::gotoPrevFrame() {
return false;
}
- Common::Point point;
-
- getCurrDynamicPhaseXY(point);
+ Common::Point point = getCurrDynamicPhaseXY();
_ox -= point.x;
_oy -= point.y;
if (_currMovement) {
if (_currMovement->_framePosOffsets) {
- _ox += _currMovement->getDimensionsOfPhase(&point, _currDynamicPhaseIndex)->x;
+ _ox += _currMovement->getDimensionsOfPhase(_currDynamicPhaseIndex).x;
_ox += _currMovement->_framePosOffsets[_currDynamicPhaseIndex]->x;
_oy -= _currMovement->_framePosOffsets[_currDynamicPhaseIndex]->y;
}
@@ -2138,7 +2085,7 @@ bool Movement::gotoPrevFrame() {
if (_currDynamicPhaseIndex < 0)
_currDynamicPhaseIndex = _currMovement->_dynamicPhases.size() - 1;
- _ox -= _currMovement->getDimensionsOfPhase(&point, _currDynamicPhaseIndex)->x;
+ _ox -= _currMovement->getDimensionsOfPhase(_currDynamicPhaseIndex).x;
} else {
if (_framePosOffsets) {
_ox -= _framePosOffsets[_currDynamicPhaseIndex]->x;
@@ -2151,7 +2098,7 @@ bool Movement::gotoPrevFrame() {
}
updateCurrDynamicPhase();
- getCurrDynamicPhaseXY(point);
+ point = getCurrDynamicPhaseXY();
_ox += point.x;
_oy += point.y;
@@ -2180,23 +2127,18 @@ void Movement::gotoLastFrame() {
}
}
-Common::Point *Movement::getCenter(Common::Point *p) {
+Common::Point Movement::getCenter() const {
Common::Rect rect;
rect = *_currDynamicPhase->_rect;
if (_currMovement) {
- Common::Point point;
-
- _currMovement->getDimensionsOfPhase(&point, _currDynamicPhaseIndex);
-
- rect.moveTo(point.x - _currDynamicPhase->_rect->right, _currDynamicPhase->_rect->top);
+ const Dims dims = _currMovement->getDimensionsOfPhase(_currDynamicPhaseIndex);
+ rect.moveTo(dims.x - _currDynamicPhase->_rect->right, _currDynamicPhase->_rect->top);
}
- p->x = rect.left + _currDynamicPhase->_rect->width() / 2;
- p->y = rect.top + _currDynamicPhase->_rect->height() / 2;
-
- return p;
+ return Common::Point(rect.left + _currDynamicPhase->_rect->width() / 2,
+ rect.top + _currDynamicPhase->_rect->height() / 2);
}
DynamicPhase::DynamicPhase() {
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index f19d981553..71137ddf61 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -44,8 +44,8 @@ class StepArray : public CObject {
int getCurrPointIndex() { return _currPointIndex; }
int getPointsCount() { return _maxPointIndex; }
- Common::Point *getCurrPoint(Common::Point *point);
- Common::Point *getPoint(Common::Point *point, int index, int offset);
+ Common::Point getCurrPoint() const;
+ Common::Point getPoint(int index, int offset) const;
bool gotoNextPoint();
void insertPoints(Common::Point **points, int pointsCount);
};
@@ -101,8 +101,8 @@ class Statics : public DynamicPhase {
virtual void init();
Statics *getStaticsById(int itemId);
- Common::Point *getSomeXY(Common::Point &p);
- Common::Point *getCenter(Common::Point *p);
+ Common::Point getSomeXY() const;
+ Common::Point getCenter() const;
};
class StaticANIObject;
@@ -142,11 +142,11 @@ class Movement : public GameObject {
virtual bool load(MfcArchive &file);
bool load(MfcArchive &file, StaticANIObject *ani);
- Common::Point *getCurrDynamicPhaseXY(Common::Point &p);
- Common::Point *getCenter(Common::Point *p);
- Common::Point *getDimensionsOfPhase(Common::Point *p, int phaseIndex);
+ Common::Point getCurrDynamicPhaseXY() const;
+ Common::Point getCenter() const;
+ Dims getDimensionsOfPhase(int phaseIndex) const;
- Common::Point *calcSomeXY(Common::Point &p, int idx, int dynidx);
+ Common::Point calcSomeXY(int idx, int dynidx);
void initStatics(StaticANIObject *ani);
void updateCurrDynamicPhase();
@@ -208,9 +208,9 @@ public:
Movement *getMovementById(int id);
int getMovementIdById(int itemId);
Movement *getMovementByName(const Common::String &name);
- Common::Point *getCurrDimensions(Common::Point &p);
+ Common::Point getCurrDimensions() const;
- Common::Point *getSomeXY(Common::Point &p);
+ Common::Point getSomeXY() const;
void clearFlags();
void setFlags40(bool state);