aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/gnap/character.cpp225
-rw-r--r--engines/gnap/character.h7
-rw-r--r--engines/gnap/gnap.cpp209
-rw-r--r--engines/gnap/gnap.h10
-rw-r--r--engines/gnap/grid.cpp24
-rw-r--r--engines/gnap/scenes/group0.cpp28
-rw-r--r--engines/gnap/scenes/group1.cpp26
7 files changed, 263 insertions, 266 deletions
diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp
index a15f4e9cad..6ae731671d 100644
--- a/engines/gnap/character.cpp
+++ b/engines/gnap/character.cpp
@@ -551,7 +551,7 @@ void PlayerGnap::initBrainPulseRndValue() {
void PlayerGnap::playSequence(int sequenceId) {
_vm->_timers[2] = _vm->getRandom(30) + 20;
_vm->_timers[3] = 300;
- _vm->gnapIdle();
+ idle();
_vm->_gameSys->insertSequence(sequenceId, _id,
makeRid(_sequenceDatNum, _sequenceId), _id,
kSeqScale | kSeqSyncWait, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY);
@@ -693,7 +693,7 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI
_walkDestY = CLIP(gridY, 0, _vm->_gridMaxY - 1);
if (animationIndex >= 0 && _walkDestX == _vm->_plat->_pos.x && _walkDestY == _vm->_plat->_pos.y)
- _vm->platypusMakeRoom();
+ _vm->_plat->makeRoom();
if (findPath1(_pos.x, _pos.y, 0))
done = true;
@@ -707,7 +707,7 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI
if (!done && findPath4(_pos.x, _pos.y))
done = true;
- _vm->gnapIdle();
+ idle();
int gnapSequenceId = _sequenceId;
int gnapId = _id;
@@ -765,7 +765,7 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI
if (_walkNodesCount > 0) {
_sequenceId = gnapSequenceId;
_id = gnapId;
- _idleFacing = _vm->getGnapWalkFacing(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY);
+ _idleFacing = getWalkFacing(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY);
_sequenceDatNum = datNum;
if (animationIndex >= 0)
_vm->_gameSys->setAnimation(makeRid(_sequenceDatNum, _sequenceId), _id, animationIndex);
@@ -794,8 +794,8 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI
}
} else {
if (_walkNodesCount > 0) {
- _sequenceId = _vm->getGnapWalkStopSequenceId(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY);
- _idleFacing = _vm->getGnapWalkFacing(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY);
+ _sequenceId = getWalkStopSequenceId(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY);
+ _idleFacing = getWalkFacing(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY);
} else if (gridX >= 0 || gridY >= 0) {
switch (_idleFacing) {
case kDirBottomRight:
@@ -819,8 +819,8 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI
++v10;
if (_vm->_leftClickMouseY == _vm->_gridMinY + 48 * _pos.y)
v11 = 1;
- _sequenceId = _vm->getGnapWalkStopSequenceId(v10 / abs(v10), v11 / abs(v11));
- _idleFacing = _vm->getGnapWalkFacing(v10 / abs(v10), v11 / abs(v11));
+ _sequenceId = getWalkStopSequenceId(v10 / abs(v10), v11 / abs(v11));
+ _idleFacing = getWalkFacing(v10 / abs(v10), v11 / abs(v11));
}
_sequenceDatNum = datNum;
}
@@ -848,6 +848,211 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI
return done;
}
+int PlayerGnap::getShowSequenceId(int index, int gridX, int gridY) {
+ int sequenceId;
+ Facing facing = _idleFacing;
+
+ if (gridY > 0 && gridX > 0) {
+ if (_pos.y > gridY) {
+ if (_pos.x > gridX)
+ _idleFacing = kDirUpLeft;
+ else
+ _idleFacing = kDirUpRight;
+ } else {
+ if (_pos.x > gridX)
+ _idleFacing = kDirUpLeft;
+ else
+ _idleFacing = kDirUpRight;
+ }
+ } else if (_idleFacing != kDirBottomRight && _idleFacing != kDirUpRight) {
+ _idleFacing = kDirUpLeft;
+ } else {
+ _idleFacing = kDirUpRight;
+ }
+
+ switch (index) {
+ case 0:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x8A0;
+ else
+ sequenceId = 0x8A1;
+ break;
+ case 1:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x880;
+ else
+ sequenceId = 0x895;
+ break;
+ case 2:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x884;
+ else
+ sequenceId = 0x899;
+ break;
+ //Skip 3
+ case 4:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x881;
+ else
+ sequenceId = 0x896;
+ break;
+ case 5:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x883;
+ else
+ sequenceId = 0x898;
+ break;
+ case 6:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x87E;
+ else
+ sequenceId = 0x893;
+ break;
+ case 7:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x848;
+ else
+ sequenceId = 0x890;
+ break;
+ case 8:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x87D;
+ else
+ sequenceId = 0x892;
+ break;
+ case 9:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x882;
+ else
+ sequenceId = 0x897;
+ break;
+ case 10:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x87C;
+ else
+ sequenceId = 0x891;
+ break;
+ case 11:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x87C;
+ else
+ sequenceId = 0x891;
+ break;
+ case 12:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x87D;
+ else
+ sequenceId = 0x892;
+ break;
+ case 13:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x888;
+ else
+ sequenceId = 0x89D;
+ break;
+ case 14:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x87F;
+ else
+ sequenceId = 0x894;
+ break;
+ case 15:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x87B;
+ else
+ sequenceId = 0x8A3;
+ break;
+ case 16:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x877;
+ else
+ sequenceId = 0x88C;
+ break;
+ //Skip 17
+ case 18:
+ sequenceId = 0x887;
+ break;
+ case 19:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x87A;
+ else
+ sequenceId = 0x88F;
+ break;
+ case 20:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x878;
+ else
+ sequenceId = 0x88D;
+ break;
+ case 21:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x879;
+ else
+ sequenceId = 0x88E;
+ break;
+ case 22:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x88A;
+ else
+ sequenceId = 0x89F;
+ break;
+ case 23:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x889;
+ else
+ sequenceId = 0x89E;
+ break;
+ case 24:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x886;
+ else
+ sequenceId = 0x89B;
+ break;
+ case 25:
+ if (_idleFacing == kDirUpRight)
+ sequenceId = 0x87A;
+ else
+ sequenceId = 0x88F;
+ break;
+ //Skip 26
+ //Skip 27
+ //Skip 28
+ //Skip 29
+ default:
+ _idleFacing = facing;
+ sequenceId = getSequenceId(gskImpossible, 0, 0);
+ break;
+ }
+
+ return sequenceId;
+}
+
+void PlayerGnap::idle() {
+ if (_sequenceDatNum == 1 &&
+ (_sequenceId == 0x7A6 || _sequenceId == 0x7AA ||
+ _sequenceId == 0x832 || _sequenceId == 0x841 ||
+ _sequenceId == 0x842 || _sequenceId == 0x8A2 ||
+ _sequenceId == 0x833 || _sequenceId == 0x834 ||
+ _sequenceId == 0x885 || _sequenceId == 0x7A8 ||
+ _sequenceId == 0x831 || _sequenceId == 0x89A)) {
+ _vm->_gameSys->insertSequence(getSequenceId(gskIdle, 0, 0) | 0x10000, _id,
+ makeRid(_sequenceDatNum, _sequenceId), _id,
+ kSeqSyncExists, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY);
+ _sequenceId = getSequenceId(gskIdle, 0, 0);
+ _sequenceDatNum = 1;
+ }
+}
+
+void PlayerGnap::actionIdle(int sequenceId) {
+ if (_sequenceId != -1 && ridToDatIndex(sequenceId) == _sequenceDatNum && ridToEntryIndex(sequenceId) == _sequenceId) {
+ _vm->_gameSys->insertSequence(getSequenceId(gskIdle, 0, 0) | 0x10000, _id,
+ makeRid(_sequenceDatNum, _sequenceId), _id,
+ kSeqSyncExists, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY);
+ _sequenceId = getSequenceId(gskIdle, 0, 0);
+ _sequenceDatNum = 1;
+ }
+}
+
/************************************************************************************************/
PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {}
@@ -904,7 +1109,7 @@ void PlayerPlat::updateIdleSequence() {
}
} else {
_vm->_timers[0] = _vm->getRandom(75) + 75;
- _vm->platypusMakeRoom();
+ _vm->_plat->makeRoom();
}
} else {
_vm->_timers[0] = 100;
@@ -932,7 +1137,7 @@ void PlayerPlat::updateIdleSequence2() {
}
} else {
_vm->_timers[0] = _vm->getRandom(75) + 75;
- _vm->platypusMakeRoom();
+ _vm->_plat->makeRoom();
}
} else {
_vm->_timers[0] = 100;
diff --git a/engines/gnap/character.h b/engines/gnap/character.h
index c36b0a2295..114b3a3290 100644
--- a/engines/gnap/character.h
+++ b/engines/gnap/character.h
@@ -88,6 +88,11 @@ public:
virtual int getWalkSequenceId(int deltaX, int deltaY);
virtual bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags);
+ void actionIdle(int sequenceId);
+ int getShowSequenceId(int index, int gridX, int gridY);
+ Facing getWalkFacing(int deltaX, int deltaY);
+ int getWalkStopSequenceId(int deltaX, int deltaY);
+ void idle();
void initBrainPulseRndValue();
void kissPlatypus(int callback);
void useDeviceOnPlatypus();
@@ -114,6 +119,8 @@ public:
virtual int getWalkSequenceId(int deltaX, int deltaY);
virtual bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags);
+ void makeRoom();
+
private:
bool findPath1(int gridX, int gridY, int index);
bool findPath2(int gridX, int gridY, int index);
diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp
index 42d5277dc6..e40d50e621 100644
--- a/engines/gnap/gnap.cpp
+++ b/engines/gnap/gnap.cpp
@@ -941,211 +941,6 @@ void GnapEngine::deleteSurface(Graphics::Surface **surface) {
}
}
-int GnapEngine::getGnapShowSequenceId(int index, int gridX, int gridY) {
- int sequenceId;
- Facing facing = _gnap->_idleFacing;
-
- if (gridY > 0 && gridX > 0) {
- if (_gnap->_pos.y > gridY) {
- if (_gnap->_pos.x > gridX)
- _gnap->_idleFacing = kDirUpLeft;
- else
- _gnap->_idleFacing = kDirUpRight;
- } else {
- if (_gnap->_pos.x > gridX)
- _gnap->_idleFacing = kDirUpLeft;
- else
- _gnap->_idleFacing = kDirUpRight;
- }
- } else if (_gnap->_idleFacing != kDirBottomRight && _gnap->_idleFacing != kDirUpRight) {
- _gnap->_idleFacing = kDirUpLeft;
- } else {
- _gnap->_idleFacing = kDirUpRight;
- }
-
- switch (index) {
- case 0:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x8A0;
- else
- sequenceId = 0x8A1;
- break;
- case 1:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x880;
- else
- sequenceId = 0x895;
- break;
- case 2:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x884;
- else
- sequenceId = 0x899;
- break;
- //Skip 3
- case 4:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x881;
- else
- sequenceId = 0x896;
- break;
- case 5:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x883;
- else
- sequenceId = 0x898;
- break;
- case 6:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x87E;
- else
- sequenceId = 0x893;
- break;
- case 7:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x848;
- else
- sequenceId = 0x890;
- break;
- case 8:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x87D;
- else
- sequenceId = 0x892;
- break;
- case 9:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x882;
- else
- sequenceId = 0x897;
- break;
- case 10:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x87C;
- else
- sequenceId = 0x891;
- break;
- case 11:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x87C;
- else
- sequenceId = 0x891;
- break;
- case 12:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x87D;
- else
- sequenceId = 0x892;
- break;
- case 13:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x888;
- else
- sequenceId = 0x89D;
- break;
- case 14:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x87F;
- else
- sequenceId = 0x894;
- break;
- case 15:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x87B;
- else
- sequenceId = 0x8A3;
- break;
- case 16:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x877;
- else
- sequenceId = 0x88C;
- break;
- //Skip 17
- case 18:
- sequenceId = 0x887;
- break;
- case 19:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x87A;
- else
- sequenceId = 0x88F;
- break;
- case 20:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x878;
- else
- sequenceId = 0x88D;
- break;
- case 21:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x879;
- else
- sequenceId = 0x88E;
- break;
- case 22:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x88A;
- else
- sequenceId = 0x89F;
- break;
- case 23:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x889;
- else
- sequenceId = 0x89E;
- break;
- case 24:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x886;
- else
- sequenceId = 0x89B;
- break;
- case 25:
- if (_gnap->_idleFacing == kDirUpRight)
- sequenceId = 0x87A;
- else
- sequenceId = 0x88F;
- break;
- //Skip 26
- //Skip 27
- //Skip 28
- //Skip 29
- default:
- _gnap->_idleFacing = facing;
- sequenceId = _gnap->getSequenceId(gskImpossible, 0, 0);
- break;
- }
- return sequenceId;
-}
-
-void GnapEngine::gnapIdle() {
- if (_gnap->_sequenceId != -1 && _gnap->_sequenceDatNum == 1 &&
- (_gnap->_sequenceId == 0x7A6 || _gnap->_sequenceId == 0x7AA ||
- _gnap->_sequenceId == 0x832 || _gnap->_sequenceId == 0x841 ||
- _gnap->_sequenceId == 0x842 || _gnap->_sequenceId == 0x8A2 ||
- _gnap->_sequenceId == 0x833 || _gnap->_sequenceId == 0x834 ||
- _gnap->_sequenceId == 0x885 || _gnap->_sequenceId == 0x7A8 ||
- _gnap->_sequenceId == 0x831 || _gnap->_sequenceId == 0x89A)) {
- _gameSys->insertSequence(_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, _gnap->_id,
- makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id,
- kSeqSyncExists, 0, 75 * _gnap->_pos.x - _gnap->_gridX, 48 * _gnap->_pos.y - _gnap->_gridY);
- _gnap->_sequenceId = _gnap->getSequenceId(gskIdle, 0, 0);
- _gnap->_sequenceDatNum = 1;
- }
-}
-
-void GnapEngine::gnapActionIdle(int sequenceId) {
- if (_gnap->_sequenceId != -1 && ridToDatIndex(sequenceId) == _gnap->_sequenceDatNum &&
- ridToEntryIndex(sequenceId) == _gnap->_sequenceId) {
- _gameSys->insertSequence(_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, _gnap->_id,
- makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id,
- kSeqSyncExists, 0, 75 * _gnap->_pos.x - _gnap->_gridX, 48 * _gnap->_pos.y - _gnap->_gridY);
- _gnap->_sequenceId = _gnap->getSequenceId(gskIdle, 0, 0);
- _gnap->_sequenceDatNum = 1;
- }
-}
-
void GnapEngine::playGnapImpossible(int gridX, int gridY) {
_gnap->playSequence(_gnap->getSequenceId(gskImpossible, gridX, gridY) | 0x10000);
}
@@ -1183,12 +978,12 @@ void GnapEngine::playGnapIdle(int gridX, int gridY) {
}
void GnapEngine::playGnapShowItem(int itemIndex, int gridLookX, int gridLookY) {
- _gnap->playSequence(getGnapShowSequenceId(itemIndex, gridLookX, gridLookY) | 0x10000);
+ _gnap->playSequence(_gnap->getShowSequenceId(itemIndex, gridLookX, gridLookY) | 0x10000);
}
void GnapEngine::playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY) {
if (_plat->_pos.x == gridX && _plat->_pos.y == gridY)
- platypusMakeRoom();
+ _plat->makeRoom();
_gnap->walkTo(Common::Point(gridX, gridY), -1, -1, 1);
playGnapShowItem(_grabCursorSpriteIndex, gridLookX, gridLookY);
}
diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h
index db9368d98d..15e1753fda 100644
--- a/engines/gnap/gnap.h
+++ b/engines/gnap/gnap.h
@@ -474,17 +474,7 @@ public:
void initSceneGrid(int gridMinX, int gridMinY, int gridMaxX, int gridMaxY);
bool testWalk(int animationIndex, int someStatus, int gridX1, int gridY1, int gridX2, int gridY2);
- // Gnap walking
- int getGnapWalkStopSequenceId(int deltaX, int deltaY);
- Facing getGnapWalkFacing(int deltaX, int deltaY);
-
- // Platypus walking
- void platypusMakeRoom();
-
// Gnap
- int getGnapShowSequenceId(int index, int gridX, int gridY);
- void gnapIdle();
- void gnapActionIdle(int sequenceId);
void playGnapImpossible(int gridX, int gridY);
void playGnapScratchingHead(int gridX, int gridY);
void playGnapMoan1(int gridX, int gridY);
diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp
index d4aed8dbc0..b817b65102 100644
--- a/engines/gnap/grid.cpp
+++ b/engines/gnap/grid.cpp
@@ -38,24 +38,24 @@ void GnapEngine::initSceneGrid(int gridMinX, int gridMinY, int gridMaxX, int gri
_plat->_gridY = 347 - gridMinY;
}
-int GnapEngine::getGnapWalkStopSequenceId(int deltaX, int deltaY) {
- static const int _gnapWalkStopSequenceIds[9] = {
+int PlayerGnap::getWalkStopSequenceId(int deltaX, int deltaY) {
+ static const int gnapWalkStopSequenceIds[9] = {
0x7BC, 0x7BA, 0x7BA,
0x7BC, 0x000, 0x7BA,
0x7BB, 0x7B9, 0x7B9
};
// CHECKME This is a little weird
- return _gnapWalkStopSequenceIds[3 * deltaX + 3 + 1 + deltaY];
+ return gnapWalkStopSequenceIds[3 * deltaX + 3 + 1 + deltaY];
}
-Facing GnapEngine::getGnapWalkFacing(int deltaX, int deltaY) {
- static const Facing _gnapWalkFacings[9] = {
+Facing PlayerGnap::getWalkFacing(int deltaX, int deltaY) {
+ static const Facing gnapWalkFacings[9] = {
kDirUpLeft, kDirBottomLeft, kDirBottomLeft,
kDirUpLeft, kDirNone, kDirBottomLeft,
kDirUpRight, kDirBottomRight, kDirBottomRight
};
// CHECKME This is a little weird
- return _gnapWalkFacings[3 * deltaX + 3 + 1 + deltaY];
+ return gnapWalkFacings[3 * deltaX + 3 + 1 + deltaY];
}
bool GnapEngine::isPointBlocked(Common::Point gridPos) {
@@ -981,14 +981,14 @@ bool PlayerPlat::findPath4(int gridX, int gridY) {
return result;
}
-void GnapEngine::platypusMakeRoom() {
+void PlayerPlat::makeRoom() {
int rndGridX, rndGridY;
do {
- rndGridY = getRandom(_gridMaxY);
- rndGridX = getRandom(_gridMaxX);
- } while (ABS(rndGridX - _plat->_pos.x) > 4 || ABS(rndGridY - _plat->_pos.y) > 3 ||
- isPointBlocked(rndGridX, rndGridY));
- _plat->walkTo(Common::Point(rndGridX, rndGridY), -1, -1, 1);
+ rndGridY = _vm->getRandom(_vm->_gridMaxY);
+ rndGridX = _vm->getRandom(_vm->_gridMaxX);
+ } while (ABS(rndGridX - _pos.x) > 4 || ABS(rndGridY - _pos.y) > 3 ||
+ _vm->isPointBlocked(rndGridX, rndGridY));
+ walkTo(Common::Point(rndGridX, rndGridY), -1, -1, 1);
}
} // End of namespace Gnap
diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp
index c16a1e7f45..d65558474c 100644
--- a/engines/gnap/scenes/group0.cpp
+++ b/engines/gnap/scenes/group0.cpp
@@ -2833,7 +2833,7 @@ void Scene07::run() {
}
} else {
_vm->_timers[0] = _vm->getRandom(75) + 75;
- _vm->platypusMakeRoom();
+ _vm->_plat->makeRoom();
}
} else {
_vm->_timers[0] = 100;
@@ -2995,7 +2995,7 @@ void Scene08::run() {
_vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y);
break;
case GRAB_CURSOR:
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->_gnap->kissPlatypus(8);
break;
case TALK_CURSOR:
@@ -3010,7 +3010,7 @@ void Scene08::run() {
case kHS08ExitBackdoor:
_vm->_isLeavingScene = true;
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->_gnap->walkTo(Common::Point(0, 6), 0, 0x107AF, 1);
_vm->_gnap->_actionStatus = kAS08LeaveScene;
_vm->_plat->walkTo(Common::Point(0, 7), 1, 0x107CF, 1);
@@ -3019,7 +3019,7 @@ void Scene08::run() {
case kHS08ExitCrash:
_vm->_isLeavingScene = true;
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->_gnap->walkTo(Common::Point(3, 9), 0, 0x107AE, 1);
_vm->_gnap->_actionStatus = kAS08LeaveScene;
_vm->_plat->walkTo(Common::Point(4, 9), 1, 0x107C1, 1);
@@ -3032,7 +3032,7 @@ void Scene08::run() {
} else {
switch (_vm->_verbCursor) {
case LOOK_CURSOR:
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 1);
_vm->_gnap->_actionStatus = kAS08LookMan;
_vm->_gnap->_idleFacing = kDirUpRight;
@@ -3042,12 +3042,12 @@ void Scene08::run() {
break;
case TALK_CURSOR:
_vm->_gnap->_idleFacing = kDirUpLeft;
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->_gnap->walkTo(Common::Point(8, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
_vm->_gnap->_actionStatus = kAS08TalkMan;
break;
case PLAT_CURSOR:
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->_gnap->useDeviceOnPlatypus();
_vm->_plat->walkTo(Common::Point(6, 6), 1, 0x107C2, 1);
_vm->_plat->_actionStatus = kAS08PlatWithMan;
@@ -3077,13 +3077,13 @@ void Scene08::run() {
break;
case TALK_CURSOR:
_vm->_gnap->_idleFacing = kDirUpRight;
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->_gnap->walkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
_vm->_gnap->_actionStatus = kAS08TalkDog;
break;
case PLAT_CURSOR:
_vm->setFlag(kGFSceneFlag1);
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->_gnap->useDeviceOnPlatypus();
_vm->_plat->walkTo(Common::Point(3, 7), 1, 0x107C2, 1);
_vm->_plat->_actionStatus = kAS08PlatWithDog;
@@ -3106,7 +3106,7 @@ void Scene08::run() {
if (_currDogSequenceId == 0x135) {
_vm->playGnapScratchingHead(6, 7);
} else {
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->playGnapPullOutDevice(6, 7);
_vm->playGnapUseDevice(0, 0);
_nextDogSequenceId = 0x149;
@@ -3132,7 +3132,7 @@ void Scene08::run() {
if (_currDogSequenceId == 0x135) {
_vm->playGnapScratchingHead(3, 6);
} else {
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->playGnapPullOutDevice(3, 6);
_vm->playGnapUseDevice(0, 0);
_nextDogSequenceId = 0x14A;
@@ -3158,7 +3158,7 @@ void Scene08::run() {
if (_currDogSequenceId == 0x135) {
_vm->playGnapScratchingHead(7, 6);
} else {
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->playGnapPullOutDevice(7, 6);
_vm->playGnapUseDevice(0, 0);
_nextDogSequenceId = 0x14B;
@@ -3174,13 +3174,13 @@ void Scene08::run() {
case kHS08WalkArea1:
case kHS08WalkArea2:
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->_gnap->walkTo(Common::Point(-1, 6), -1, -1, 1);
break;
default:
if (_vm->_mouseClickState._left) {
- _vm->gnapActionIdle(0x14D);
+ _vm->_gnap->actionIdle(0x14D);
_vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1);
_vm->_mouseClickState._left = false;
}
diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp
index 9033763c7e..8a6bff0fcf 100644
--- a/engines/gnap/scenes/group1.cpp
+++ b/engines/gnap/scenes/group1.cpp
@@ -131,7 +131,7 @@ void Scene10::run() {
case kHS10ExitBar:
_vm->_isLeavingScene = true;
- _vm->gnapActionIdle(0x10C);
+ _vm->_gnap->actionIdle(0x10C);
_vm->_gnap->walkTo(Common::Point(0, 7), 0, 0x107AF, 1);
_vm->_gnap->_actionStatus = kAS10LeaveScene;
_vm->_plat->walkTo(Common::Point(0, 7), -1, 0x107CF, 1);
@@ -140,7 +140,7 @@ void Scene10::run() {
case kHS10ExitBackdoor:
_vm->_isLeavingScene = true;
- _vm->gnapActionIdle(0x10C);
+ _vm->_gnap->actionIdle(0x10C);
_vm->_gnap->walkTo(Common::Point(2, 9), 0, 0x107AE, 1);
_vm->_gnap->_actionStatus = kAS10LeaveScene;
_vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C7, 1);
@@ -163,12 +163,12 @@ void Scene10::run() {
break;
case TALK_CURSOR:
_vm->_gnap->_idleFacing = kDirUpRight;
- _vm->gnapActionIdle(0x10C);
+ _vm->_gnap->actionIdle(0x10C);
_vm->_gnap->walkTo(Common::Point(4, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
_vm->_gnap->_actionStatus = kAS10AnnoyCook;
break;
case PLAT_CURSOR:
- _vm->gnapActionIdle(0x10C);
+ _vm->_gnap->actionIdle(0x10C);
_vm->_gnap->useDeviceOnPlatypus();
_vm->_plat->walkTo(Common::Point(4, 6), -1, -1, 1);
_vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1);
@@ -193,7 +193,7 @@ void Scene10::run() {
if (_vm->isFlag(kGFMudTaken))
_vm->playGnapMoan2(-1, -1);
else {
- _vm->gnapActionIdle(0x10C);
+ _vm->_gnap->actionIdle(0x10C);
_vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1);
_vm->_gnap->_actionStatus = kAS10AnnoyCook;
}
@@ -205,7 +205,7 @@ void Scene10::run() {
if (_vm->isFlag(kGFMudTaken))
_vm->playGnapMoan2(-1, -1);
else {
- _vm->gnapActionIdle(0x10C);
+ _vm->_gnap->actionIdle(0x10C);
_vm->_gnap->useDeviceOnPlatypus();
_vm->_plat->walkTo(Common::Point(3, 7), -1, -1, 1);
_vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1);
@@ -225,7 +225,7 @@ void Scene10::run() {
_vm->playGnapScratchingHead(7, 3);
break;
case GRAB_CURSOR:
- _vm->gnapActionIdle(0x10C);
+ _vm->_gnap->actionIdle(0x10C);
_vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1);
_vm->_gnap->_actionStatus = kAS10AnnoyCook;
break;
@@ -238,7 +238,7 @@ void Scene10::run() {
else {
_vm->invAdd(kItemTongs);
_vm->setFlag(kGFMudTaken);
- _vm->gnapActionIdle(0x10C);
+ _vm->_gnap->actionIdle(0x10C);
_vm->_gnap->useDeviceOnPlatypus();
_vm->_plat->walkTo(Common::Point(7, 6), 1, 0x107D2, 1);
_vm->_plat->_actionStatus = kAS10PlatWithBox;
@@ -260,7 +260,7 @@ void Scene10::run() {
_vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 10, 5) | 0x10000);
break;
case GRAB_CURSOR:
- _vm->gnapActionIdle(0x10C);
+ _vm->_gnap->actionIdle(0x10C);
_vm->_gnap->walkTo(Common::Point(9, 6), 0, 0x107BB, 1);
gameSys.insertSequence(0x10E, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0);
_vm->_gnap->_sequenceId = 0x10E;
@@ -282,7 +282,7 @@ void Scene10::run() {
case kHS10WalkArea2:
case kHS10WalkArea3:
case kHS10WalkArea4:
- _vm->gnapActionIdle(0x10C);
+ _vm->_gnap->actionIdle(0x10C);
_vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1);
break;
@@ -295,7 +295,7 @@ void Scene10::run() {
default:
if (_vm->_mouseClickState._left) {
- _vm->gnapActionIdle(0x10C);
+ _vm->_gnap->actionIdle(0x10C);
_vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1);
_vm->_mouseClickState._left = false;
}
@@ -3185,9 +3185,9 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) {
if (_vm->_gnap->_pos.y == _vm->_plat->_pos.y) {
if (nextGridX >= _vm->_gnap->_pos.x) {
if (nextGridX >= _vm->_plat->_pos.x && _vm->_gnap->_pos.x <= _vm->_plat->_pos.x)
- _vm->platypusMakeRoom();
+ _vm->_plat->makeRoom();
} else if (nextGridX <= _vm->_plat->_pos.x && _vm->_gnap->_pos.x >= _vm->_plat->_pos.x) {
- _vm->platypusMakeRoom();
+ _vm->_plat->makeRoom();
}
}
gnapSeqId = _vm->_gnap->_sequenceId;