aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMax Horn2006-10-29 13:30:20 +0000
committerMax Horn2006-10-29 13:30:20 +0000
commit41b4a34b5b7f9f91f25204503ea9b951cbfc5c26 (patch)
tree0e35f4596e6a492fef8af02dc9680ee378e7ef84 /engines/scumm
parent25069065f39c2289992ebe7be20417d6451f3a21 (diff)
downloadscummvm-rg350-41b4a34b5b7f9f91f25204503ea9b951cbfc5c26.tar.gz
scummvm-rg350-41b4a34b5b7f9f91f25204503ea9b951cbfc5c26.tar.bz2
scummvm-rg350-41b4a34b5b7f9f91f25204503ea9b951cbfc5c26.zip
cleanup
svn-id: r24565
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/actor.cpp22
-rw-r--r--engines/scumm/boxes.cpp30
-rw-r--r--engines/scumm/boxes.h1
3 files changed, 26 insertions, 27 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 569c39dd19..681065b956 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -926,6 +926,28 @@ int Actor::getActorXYPos(int &xPos, int &yPos) const {
return 0;
}
+static bool inBoxQuickReject(const BoxCoords &box, int x, int y, int threshold) {
+ int t;
+
+ t = x - threshold;
+ if (t > box.ul.x && t > box.ur.x && t > box.lr.x && t > box.ll.x)
+ return true;
+
+ t = x + threshold;
+ if (t < box.ul.x && t < box.ur.x && t < box.lr.x && t < box.ll.x)
+ return true;
+
+ t = y - threshold;
+ if (t > box.ul.y && t > box.ur.y && t > box.lr.y && t > box.ll.y)
+ return true;
+
+ t = y + threshold;
+ if (t < box.ul.y && t < box.ur.y && t < box.lr.y && t < box.ll.y)
+ return true;
+
+ return false;
+}
+
AdjustBoxResult Actor::adjustXYToBeInBox(int dstX, int dstY) {
const uint thresholdTable[] = { 30, 80, 0 };
AdjustBoxResult abr;
diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp
index e6a5f86761..051cba5a13 100644
--- a/engines/scumm/boxes.cpp
+++ b/engines/scumm/boxes.cpp
@@ -629,28 +629,6 @@ BoxCoords ScummEngine::getBoxCoordinates(int boxnum) {
return *box;
}
-bool inBoxQuickReject(const BoxCoords &box, int x, int y, int threshold) {
- int t;
-
- t = x - threshold;
- if (t > box.ul.x && t > box.ur.x && t > box.lr.x && t > box.ll.x)
- return true;
-
- t = x + threshold;
- if (t < box.ul.x && t < box.ur.x && t < box.lr.x && t < box.ll.x)
- return true;
-
- t = y - threshold;
- if (t > box.ul.y && t > box.ur.y && t > box.lr.y && t > box.ll.y)
- return true;
-
- t = y + threshold;
- if (t < box.ul.y && t < box.ur.y && t < box.lr.y && t < box.ll.y)
- return true;
-
- return false;
-}
-
int getClosestPtOnBox(const BoxCoords &box, int x, int y, int16& outX, int16& outY) {
const Common::Point p(x, y);
Common::Point tmp;
@@ -1077,11 +1055,11 @@ bool ScummEngine::areBoxesNeighbours(int box1nr, int box2nr) {
if (box2.ur.x == box2.ul.x && box.ul.x == box2.ul.x && box.ur.x == box2.ul.x) {
bool swappedBox2 = false, swappedBox1 = false;
if (box2.ur.y < box2.ul.y) {
- swappedBox2 = 1;
+ swappedBox2 = true;
SWAP(box2.ur.y, box2.ul.y);
}
if (box.ur.y < box.ul.y) {
- swappedBox1 = 1;
+ swappedBox1 = true;
SWAP(box.ur.y, box.ul.y);
}
if (box.ur.y < box2.ul.y ||
@@ -1106,11 +1084,11 @@ bool ScummEngine::areBoxesNeighbours(int box1nr, int box2nr) {
if (box2.ur.y == box2.ul.y && box.ul.y == box2.ul.y && box.ur.y == box2.ul.y) {
bool swappedBox2 = false, swappedBox1 = false;
if (box2.ur.x < box2.ul.x) {
- swappedBox2 = 1;
+ swappedBox2 = true;
SWAP(box2.ur.x, box2.ul.x);
}
if (box.ur.x < box.ul.x) {
- swappedBox1 = 1;
+ swappedBox1 = true;
SWAP(box.ur.x, box.ul.x);
}
if (box.ur.x < box2.ul.x ||
diff --git a/engines/scumm/boxes.h b/engines/scumm/boxes.h
index 9803ad60b7..c78fd63e74 100644
--- a/engines/scumm/boxes.h
+++ b/engines/scumm/boxes.h
@@ -50,7 +50,6 @@ struct BoxCoords { /* Box coordinates */
Common::Point lr;
};
-bool inBoxQuickReject(const BoxCoords &box, int x, int y, int threshold);
int getClosestPtOnBox(const BoxCoords &box, int x, int y, int16& outX, int16& outY);
} // End of namespace Scumm