aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2014-06-23 18:10:05 +0200
committerStrangerke2014-06-23 18:10:05 +0200
commit840eef8eb199c032a119357bd6bad394d287e78f (patch)
tree3672c12d78111429a7100ae458abbffcbbc8f8fb
parent0eece817ebb5f6463467294f274da1dfb0b3164c (diff)
downloadscummvm-rg350-840eef8eb199c032a119357bd6bad394d287e78f.tar.gz
scummvm-rg350-840eef8eb199c032a119357bd6bad394d287e78f.tar.bz2
scummvm-rg350-840eef8eb199c032a119357bd6bad394d287e78f.zip
CGE2: Add a big hack to work around the coordinates issue
-rw-r--r--engines/cge2/cge2_main.cpp3
-rw-r--r--engines/cge2/hero.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index 6c572d0b46..2940833deb 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -1010,7 +1010,8 @@ void Sprite::touch(uint16 mask, V2D pos, Common::KeyCode keyCode) {
} else { // sprite NOT in pocket
Hero *h = _vm->_heroTab[_vm->_sex]->_ptr;
if (!_vm->_talk) {
- if ((_ref & 0xFF) < 200 && h->distance(this) > (h->_maxDist << 1))
+ // HACK: the "+3" is a ugly hack used to compensate a pathfinding issue. To be fixed!!
+ if ((_ref & 0xFF) < 200 && h->distance(this) > (h->_maxDist << 1) + 3)
h->walkTo(this);
else if (_vm->_sys->_blinkSprite) {
if (works(_vm->_sys->_blinkSprite)) {
diff --git a/engines/cge2/hero.cpp b/engines/cge2/hero.cpp
index 3e9a439f1a..d1caf1f43e 100644
--- a/engines/cge2/hero.cpp
+++ b/engines/cge2/hero.cpp
@@ -314,7 +314,8 @@ int Hero::distance(V3D pos) {
V3D di = _pos3D - pos;
int x = di._x.round();
int z = di._z.round();
- return ((int)sqrt((long double)x * x + z * z));
+ int retval = (int)sqrt((long double)x * x + z * z);
+ return retval;
}
int Hero::distance(Sprite *spr) {