aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorD G Turner2012-06-17 02:10:04 +0100
committerD G Turner2012-06-17 02:10:04 +0100
commitc825cc41a57b40a9af6ca51a3674b90e5f17e00f (patch)
treebca5314b1044fa2592f3ad7aecd4283369731442 /engines/saga
parentb7ae6a93a983c7feaa7cf029967354bd176b8efc (diff)
downloadscummvm-rg350-c825cc41a57b40a9af6ca51a3674b90e5f17e00f.tar.gz
scummvm-rg350-c825cc41a57b40a9af6ca51a3674b90e5f17e00f.tar.bz2
scummvm-rg350-c825cc41a57b40a9af6ca51a3674b90e5f17e00f.zip
SAGA: Workaround fix for IHNM pathfinding glitches.
This fixes bug #3360396 - "IHNM: Can't use right monitor with ellen". Have done a full playtest of IHNM to ensure this fixes the issue without any other regressions. Thanks to eriktorbjorn for creating this patch.
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/actor_path.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/engines/saga/actor_path.cpp b/engines/saga/actor_path.cpp
index 0fb072b201..d0f1cf2b5b 100644
--- a/engines/saga/actor_path.cpp
+++ b/engines/saga/actor_path.cpp
@@ -23,6 +23,7 @@
#include "saga/saga.h"
#include "saga/actor.h"
+#include "saga/objectmap.h"
#include "saga/scene.h"
namespace Saga {
@@ -99,6 +100,47 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point
_debugPointsCount = 0;
#endif
+ // WORKAROUND for bug #3360396. Path finding in IHNM is a bit buggy
+ // compared to the original, which occasionally leads to the player
+ // leaving the room instead of interacting with an object. So far, no
+ // one has figured out how to fix this properly. As a temporary [*]
+ // solution, we try to fix this on a case-by-case basis.
+ //
+ // The workaround is to assume that the player wants to stay in the
+ // room, unless he or she explicitly clicked on an exit zone.
+ //
+ // [*] And there is nothing more permanent than a temporary solution...
+
+ bool pathFindingWorkaround = false;
+
+ if (_vm->getGameId() == GID_IHNM) {
+ int chapter = _vm->_scene->currentChapterNumber();
+ int scene = _vm->_scene->currentSceneNumber();
+
+ // Ellen, in the room with the monitors.
+ if (chapter == 3 && scene == 54)
+ pathFindingWorkaround = true;
+
+ // Nimdok in the recovery room
+ if (chapter == 4 && scene == 71)
+ pathFindingWorkaround = true;
+ }
+
+ int hitZoneIndex;
+ const HitZone *hitZone;
+ bool restrictToRoom = false;
+
+ if (pathFindingWorkaround) {
+ restrictToRoom = true;
+ hitZoneIndex = _vm->_scene->_actionMap->hitTest(toPoint);
+ if (hitZoneIndex != -1) {
+ hitZone = _vm->_scene->_actionMap->getHitZone(hitZoneIndex);
+ if (hitZone->getFlags() & kHitZoneExit) {
+ restrictToRoom = false;
+ }
+ }
+ }
+
actor->_walkStepsCount = 0;
if (fromPoint == toPoint) {
actor->addWalkStepPoint(toPoint);
@@ -110,6 +152,15 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point
if (_vm->_scene->validBGMaskPoint(iteratorPoint)) {
maskType = _vm->_scene->getBGMaskType(iteratorPoint);
setPathCell(iteratorPoint, _vm->_scene->getDoorState(maskType) ? kPathCellBarrier : kPathCellEmpty);
+ if (restrictToRoom) {
+ hitZoneIndex = _vm->_scene->_actionMap->hitTest(iteratorPoint);
+ if (hitZoneIndex != -1) {
+ hitZone = _vm->_scene->_actionMap->getHitZone(hitZoneIndex);
+ if (hitZone->getFlags() & kHitZoneExit) {
+ setPathCell(iteratorPoint, kPathCellBarrier);
+ }
+ }
+ }
} else {
setPathCell(iteratorPoint, kPathCellBarrier);
}