From 9605cda50ba32dfb96020ffe4dc92c2353cad222 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 25 Oct 2010 03:39:28 +0000 Subject: GOB: Fix the Gob3 stairs walking bug Fix the bug where blount keeps moving between two steps of wide stairs. svn-id: r53793 --- engines/gob/goblin.cpp | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'engines/gob') diff --git a/engines/gob/goblin.cpp b/engines/gob/goblin.cpp index d11c7c82ec..1d4996ce78 100644 --- a/engines/gob/goblin.cpp +++ b/engines/gob/goblin.cpp @@ -1781,40 +1781,47 @@ void Goblin::animate(Mult::Mult_Object *obj) { } void Goblin::move(int16 destX, int16 destY, int16 objIndex) { - Mult::Mult_Object *obj; - Mult::Mult_AnimData *animData; - int16 mouseX; - int16 mouseY; - int16 gobDestX; - int16 gobDestY; - obj = &_vm->_mult->_objects[objIndex]; - animData = obj->pAnimData; + Mult::Mult_Object *obj = &_vm->_mult->_objects[objIndex]; + Mult::Mult_AnimData *animData = obj->pAnimData; - obj->gobDestX = destX; - obj->gobDestY = destY; + obj->gobDestX = destX; + obj->gobDestY = destY; animData->destX = destX; animData->destY = destY; if (animData->isBusy != 0) { if ((destX == -1) && (destY == -1)) { - mouseX = _vm->_global->_inter_mouseX; - mouseY = _vm->_global->_inter_mouseY; + int16 mouseX = _vm->_global->_inter_mouseX; + int16 mouseY = _vm->_global->_inter_mouseY; + if (_vm->_map->_bigTiles) mouseY += ((_vm->_global->_inter_mouseY / _vm->_map->_tilesHeight) + 1) / 2; - gobDestX = mouseX / _vm->_map->_tilesWidth; - gobDestY = mouseY / _vm->_map->_tilesHeight; + int16 gobDestX = mouseX / _vm->_map->_tilesWidth; + int16 gobDestY = mouseY / _vm->_map->_tilesHeight; if (_vm->_map->getPass(gobDestX, gobDestY) == 0) _vm->_map->findNearestWalkable(gobDestX, gobDestY, mouseX, mouseY); - animData->destX = obj->gobDestX = - (gobDestX == -1) ? obj->goblinX : gobDestX; - animData->destY = obj->gobDestY = - (gobDestY == -1) ? obj->goblinY : gobDestY; + obj->gobDestX = (gobDestX == -1) ? obj->goblinX : gobDestX; + obj->gobDestY = (gobDestY == -1) ? obj->goblinY : gobDestY; + + animData->destX = obj->gobDestX; + animData->destY = obj->gobDestY; } } + + WRITE_VAR(56, 0); + + // Prevent continous walking on wide stairs + if (_vm->_map->getPass(obj->gobDestX, obj->gobDestY) == 11) { + if (_vm->_map->_screenWidth == 640) { + obj->gobDestY++; + animData->destY++; + } + } + initiateMove(obj); } -- cgit v1.2.3