aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorurukgit2013-10-16 00:04:07 +0200
committerWillem Jan Palenstijn2013-10-17 22:17:09 +0200
commitb82a5e6a8b0c2998622392292f5ada4fc4b7e7de (patch)
tree9d56c2593897e00ce2fecf47344ace67d2bcc04a
parent96ae25eca9492a113d8d89f85edec8a98632b3eb (diff)
downloadscummvm-rg350-b82a5e6a8b0c2998622392292f5ada4fc4b7e7de.tar.gz
scummvm-rg350-b82a5e6a8b0c2998622392292f5ada4fc4b7e7de.tar.bz2
scummvm-rg350-b82a5e6a8b0c2998622392292f5ada4fc4b7e7de.zip
AVALANCHE: Rework AvalancheEngine::bearing(), repair Background::update().
-rw-r--r--engines/avalanche/avalot.cpp7
-rw-r--r--engines/avalanche/background.cpp2
2 files changed, 5 insertions, 4 deletions
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index 352ac6a852..d7d800767e 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -1379,10 +1379,11 @@ uint16 AvalancheEngine::bearing(byte whichPed) {
int16 deltaX = avvy->_x - curPed->_x;
int16 deltaY = avvy->_y - curPed->_y;
- if (deltaX < 0) {
- return (uint16)((atan((float)(deltaY / deltaX)) * 180 / M_PI) + 90);
+ uint16 result = (uint16)(atan((float)(deltaY / deltaX)) * 180 / M_PI);
+ if (avvy->_x < curPed->_x) {
+ return result + 90;
} else {
- return (uint16)((atan((float)(deltaY / deltaX)) * 180 / M_PI) + 270);
+ return result + 270;
}
}
diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp
index fc172871cc..c84c049c8f 100644
--- a/engines/avalanche/background.cpp
+++ b/engines/avalanche/background.cpp
@@ -115,7 +115,7 @@ void Background::update() {
direction = 3;
else if ((angle >= 293) && (angle <= 357))
direction = 2;
- else if ((angle >= 271) && (angle <= 292))
+ else if ((angle >= 270) && (angle <= 292))
direction = 4;
if (direction != _vm->_npcFacing) { // Dogfood.