From 9d2c537beb5135ecd8e007b227da5139e74a9515 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 May 2016 10:27:22 +0200 Subject: GNAP: Some more refactoring in Character, some renaming --- engines/gnap/character.cpp | 20 ++++++++ engines/gnap/character.h | 3 ++ engines/gnap/gnap.h | 14 +++--- engines/gnap/grid.cpp | 112 +++++++++++++++++++-------------------------- 4 files changed, 75 insertions(+), 74 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 4356862756..9503bfdd39 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -598,6 +598,16 @@ void PlayerGnap::initPos(int gridX, int gridY, Facing facing) { kSeqScale, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); } +int PlayerGnap::getWalkSequenceId(int deltaX, int deltaY) { + static const int walkSequenceIds[9] = { + 0x7B2, 0x000, 0x7B4, + 0x7AD, 0x000, 0x7AE, + 0x7B1, 0x000, 0x7B3 + }; + // CHECKME This is a little weird + return walkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; +} + /************************************************************************************************/ PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {} @@ -711,4 +721,14 @@ void PlayerPlat::initPos(int gridX, int gridY, Facing facing) { kSeqScale, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); } +int PlayerPlat::getWalkSequenceId(int deltaX, int deltaY) { + static const int walkSequenceIds[9] = { + 0x7C5, 0x000, 0x7C8, + 0x7C4, 0x000, 0x7C7, + 0x7C3, 0x000, 0x7C6 + }; + // CHECKME This is a little weird + return walkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; +} + } // End of namespace Gnap diff --git a/engines/gnap/character.h b/engines/gnap/character.h index 39643972bb..ddfc7190e6 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -46,6 +46,7 @@ public: virtual void updateIdleSequence() = 0; virtual void updateIdleSequence2() = 0; virtual void initPos(int gridX, int gridY, Facing facing) = 0; + virtual int getWalkSequenceId(int deltaX, int deltaY) = 0; Common::Point _pos; Facing _idleFacing; @@ -68,6 +69,7 @@ public: virtual void playSequence(int sequenceId); virtual void updateIdleSequence(); virtual void updateIdleSequence2(); + virtual int getWalkSequenceId(int deltaX, int deltaY); void initBrainPulseRndValue(); void kissPlatypus(int callback); @@ -86,6 +88,7 @@ public: virtual void playSequence(int sequenceId); virtual void updateIdleSequence(); virtual void updateIdleSequence2(); + virtual int getWalkSequenceId(int deltaX, int deltaY); }; } // End of namespace Gnap diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 4cab40529e..d54d4d91f7 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -487,13 +487,12 @@ public: int _gnapWalkDestX, _gnapWalkDestY; int _gnapWalkDeltaX, _gnapWalkDeltaY, _gnapWalkDirX, _gnapWalkDirY, _gnapWalkDirXIncr, _gnapWalkDirYIncr; - int getGnapWalkSequenceId(int deltaX, int deltaY); int getGnapWalkStopSequenceId(int deltaX, int deltaY); Facing getGnapWalkFacing(int deltaX, int deltaY); - bool gridSub41F08B(int gridX, int gridY); - bool gridSub41F5FC(int gridX, int gridY, int index); - bool gridSub41FAD5(int gridX, int gridY, int index); + bool gnapFindPath1(int gridX, int gridY, int index); + bool gnapFindPath2(int gridX, int gridY, int index); bool gnapFindPath3(int gridX, int gridY); + bool gnapFindPath4(int gridX, int gridY); bool gnapWalkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags); bool gnapWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags); void gnapWalkStep(); @@ -504,11 +503,10 @@ public: int _platWalkDestX, _platWalkDestY; int _platWalkDeltaX, _platWalkDeltaY, _platWalkDirX, _platWalkDirY, _platWalkDirXIncr, _platWalkDirYIncr; - int getPlatypusWalkSequenceId(int deltaX, int deltaY); - bool gridSub423750(int gridX, int gridY); - bool gridSub423CC1(int gridX, int gridY, int index); - bool gridSub42419A(int gridX, int gridY, int index); + bool platFindPath1(int gridX, int gridY, int index); + bool platFindPath2(int gridX, int gridY, int index); bool platFindPath3(int gridX, int gridY); + bool platFindPath4(int gridX, int gridY); bool platypusWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags); void platypusWalkStep(); void platypusMakeRoom(); diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 5c9b3ddee1..271f3494ee 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -38,16 +38,6 @@ void GnapEngine::initSceneGrid(int gridMinX, int gridMinY, int gridMaxX, int gri _plat->_gridY = 347 - gridMinY; } -int GnapEngine::getGnapWalkSequenceId(int deltaX, int deltaY) { - static const int _gnapWalkSequenceIds[9] = { - 0x7B2, 0x000, 0x7B4, - 0x7AD, 0x000, 0x7AE, - 0x7B1, 0x000, 0x7B3 - }; - // CHECKME This is a little weird - return _gnapWalkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; -} - int GnapEngine::getGnapWalkStopSequenceId(int deltaX, int deltaY) { static const int _gnapWalkStopSequenceIds[9] = { 0x7BC, 0x7BA, 0x7BA, @@ -90,7 +80,7 @@ bool GnapEngine::isPointBlocked(int gridX, int gridY) { } -bool GnapEngine::gridSub41F08B(int gridX, int gridY) { +bool GnapEngine::gnapFindPath4(int gridX, int gridY) { bool result = false; _gnapWalkNodesCount = 0; @@ -186,7 +176,7 @@ bool GnapEngine::gridSub41F08B(int gridX, int gridY) { return result; } -bool GnapEngine::gridSub41F5FC(int gridX, int gridY, int index) { +bool GnapEngine::gnapFindPath1(int gridX, int gridY, int index) { _gnapWalkNodesCount = index; _gnapWalkDirXIncr = 0; _gnapWalkDirYIncr = 0; @@ -264,7 +254,7 @@ bool GnapEngine::gridSub41F5FC(int gridX, int gridY, int index) { return true; } -bool GnapEngine::gridSub41FAD5(int gridX, int gridY, int index) { +bool GnapEngine::gnapFindPath2(int gridX, int gridY, int index) { _gnapWalkNodesCount = index; _gnapWalkDirXIncr = 0; _gnapWalkDirYIncr = 0; @@ -371,7 +361,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { bool done = false; while (!done && gridIncr < _gridMaxX) { - if (!isPointBlocked(gridX + gridIncr, gridY) && gridSub41F5FC(gridX + gridIncr, gridY, gridIncr)) { + if (!isPointBlocked(gridX + gridIncr, gridY) && gnapFindPath1(gridX + gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX + i; _gnapWalkNodes[i]._gridY1 = gridY; @@ -381,7 +371,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY) && gridSub41F5FC(gridX - gridIncr, gridY, gridIncr)) { + if (!isPointBlocked(gridX - gridIncr, gridY) && gnapFindPath1(gridX - gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX - i; _gnapWalkNodes[i]._gridY1 = gridY; @@ -391,7 +381,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX, gridY + gridIncr) && gridSub41F5FC(gridX, gridY + gridIncr, gridIncr)) { + if (!isPointBlocked(gridX, gridY + gridIncr) && gnapFindPath1(gridX, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX; _gnapWalkNodes[i]._gridY1 = gridY + i; @@ -401,7 +391,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX, gridY - gridIncr) && gridSub41F5FC(gridX, gridY - gridIncr, gridIncr)) { + if (!isPointBlocked(gridX, gridY - gridIncr) && gnapFindPath1(gridX, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX; _gnapWalkNodes[i]._gridY1 = gridY - i; @@ -411,7 +401,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gridSub41F5FC(gridX + gridIncr, gridY + gridIncr, gridIncr)) { + if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gnapFindPath1(gridX + gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX + i; _gnapWalkNodes[i]._gridY1 = gridY + i; @@ -421,7 +411,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gridSub41F5FC(gridX - gridIncr, gridY + gridIncr, gridIncr)) { + if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gnapFindPath1(gridX - gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX - i; _gnapWalkNodes[i]._gridY1 = gridY + i; @@ -431,7 +421,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gridSub41F5FC(gridX + gridIncr, gridY - gridIncr, gridIncr)) { + if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gnapFindPath1(gridX + gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX + i; _gnapWalkNodes[i]._gridY1 = gridY - i; @@ -441,7 +431,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gridSub41F5FC(gridX - gridIncr, gridY - gridIncr, gridIncr)) { + if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gnapFindPath1(gridX - gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX - i; _gnapWalkNodes[i]._gridY1 = gridY - i; @@ -451,7 +441,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY) && gridSub41FAD5(gridX + gridIncr, gridY, gridIncr)) { + if (!isPointBlocked(gridX + gridIncr, gridY) && gnapFindPath2(gridX + gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX + i; _gnapWalkNodes[i]._gridY1 = gridY; @@ -461,7 +451,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY) && gridSub41FAD5(gridX - gridIncr, gridY, gridIncr)) { + if (!isPointBlocked(gridX - gridIncr, gridY) && gnapFindPath2(gridX - gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX - i; _gnapWalkNodes[i]._gridY1 = gridY; @@ -471,7 +461,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX, gridY + gridIncr) && gridSub41FAD5(gridX, gridY + gridIncr, gridIncr)) { + if (!isPointBlocked(gridX, gridY + gridIncr) && gnapFindPath2(gridX, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX; _gnapWalkNodes[i]._gridY1 = gridY + i; @@ -481,7 +471,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX, gridY - gridIncr) && gridSub41FAD5(gridX, gridY - gridIncr, gridIncr)) { + if (!isPointBlocked(gridX, gridY - gridIncr) && gnapFindPath2(gridX, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX; _gnapWalkNodes[i]._gridY1 = gridY - i; @@ -491,7 +481,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gridSub41FAD5(gridX + gridIncr, gridY + gridIncr, gridIncr)) { + if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gnapFindPath2(gridX + gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX + i; _gnapWalkNodes[i]._gridY1 = gridY + i; @@ -501,7 +491,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gridSub41FAD5(gridX - gridIncr, gridY + gridIncr, gridIncr)) { + if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gnapFindPath2(gridX - gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX - i; _gnapWalkNodes[i]._gridY1 = gridY + i; @@ -511,7 +501,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gridSub41FAD5(gridX + gridIncr, gridY - gridIncr, gridIncr)) { + if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gnapFindPath2(gridX + gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX + i; _gnapWalkNodes[i]._gridY1 = gridY - i; @@ -521,7 +511,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gridSub41FAD5(gridX - gridIncr, gridY - gridIncr, gridIncr)) { + if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gnapFindPath2(gridX - gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX - i; _gnapWalkNodes[i]._gridY1 = gridY - i; @@ -561,16 +551,16 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen platypusMakeRoom(); // TODO: Simplify the cascade of Ifs - if (gridSub41F5FC(_gnap->_pos.x, _gnap->_pos.y, 0)) + if (gnapFindPath1(_gnap->_pos.x, _gnap->_pos.y, 0)) done = true; - if (!done && gridSub41FAD5(_gnap->_pos.x, _gnap->_pos.y, 0)) + if (!done && gnapFindPath2(_gnap->_pos.x, _gnap->_pos.y, 0)) done = true; if (!done && gnapFindPath3(_gnap->_pos.x, _gnap->_pos.y)) done = true; - if (!done && gridSub41F08B(_gnap->_pos.x, _gnap->_pos.y)) + if (!done && gnapFindPath4(_gnap->_pos.x, _gnap->_pos.y)) done = true; gnapIdle(); @@ -616,7 +606,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen _gnapWalkNodes[index]._id -= 10; else _gnapWalkNodes[index]._id += 10; - int newSequenceId = getGnapWalkSequenceId(_gnapWalkNodes[index]._deltaX, _gnapWalkNodes[index]._deltaY); + int newSequenceId = _gnap->getWalkSequenceId(_gnapWalkNodes[index]._deltaX, _gnapWalkNodes[index]._deltaY); _gameSys->insertSequence(makeRid(datNum, newSequenceId), _gnapWalkNodes[index]._id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnap->_gridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnap->_gridY); @@ -741,17 +731,7 @@ void GnapEngine::gnapWalkStep() { //////////////////////////////////////////////////////////////////////////////// -int GnapEngine::getPlatypusWalkSequenceId(int deltaX, int deltaY) { - static const int _platypusWalkSequenceIds[9] = { - 0x7C5, 0x000, 0x7C8, - 0x7C4, 0x000, 0x7C7, - 0x7C3, 0x000, 0x7C6 - }; - // CHECKME This is a little weird - return _platypusWalkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; -} - -bool GnapEngine::gridSub423750(int gridX, int gridY) { +bool GnapEngine::platFindPath4(int gridX, int gridY) { bool result = false; _platWalkNodesCount = 0; @@ -847,7 +827,7 @@ bool GnapEngine::gridSub423750(int gridX, int gridY) { return result; } -bool GnapEngine::gridSub423CC1(int gridX, int gridY, int index) { +bool GnapEngine::platFindPath1(int gridX, int gridY, int index) { _platWalkNodesCount = index; _platWalkDirXIncr = 0; _platWalkDirYIncr = 0; @@ -925,7 +905,7 @@ bool GnapEngine::gridSub423CC1(int gridX, int gridY, int index) { return true; } -bool GnapEngine::gridSub42419A(int gridX, int gridY, int index) { +bool GnapEngine::platFindPath2(int gridX, int gridY, int index) { _platWalkNodesCount = index; _platWalkDirXIncr = 0; _platWalkDirYIncr = 0; @@ -1032,7 +1012,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { bool done = false; while (!done && gridIncr < _gridMaxX) { - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y) && gridSub423CC1(_plat->_pos.x + gridIncr, _plat->_pos.y, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y) && platFindPath1(_plat->_pos.x + gridIncr, _plat->_pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; _platWalkNodes[i]._gridY1 = _plat->_pos.y; @@ -1042,7 +1022,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y) && gridSub423CC1(_plat->_pos.x - gridIncr, _plat->_pos.y, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y) && platFindPath1(_plat->_pos.x - gridIncr, _plat->_pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; _platWalkNodes[i]._gridY1 = _plat->_pos.y; @@ -1052,7 +1032,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + gridIncr) && gridSub423CC1(_plat->_pos.x, _plat->_pos.y + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + gridIncr) && platFindPath1(_plat->_pos.x, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x; _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; @@ -1062,7 +1042,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - gridIncr) && gridSub423CC1(_plat->_pos.x, _plat->_pos.y - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - gridIncr) && platFindPath1(_plat->_pos.x, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x; _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; @@ -1072,7 +1052,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr) && gridSub423CC1(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr) && platFindPath1(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; @@ -1082,7 +1062,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr) && gridSub423CC1(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr) && platFindPath1(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; @@ -1092,7 +1072,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr) && gridSub423CC1(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr) && platFindPath1(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; @@ -1102,7 +1082,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr) && gridSub423CC1(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr) && platFindPath1(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; @@ -1112,7 +1092,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y) && gridSub42419A(_plat->_pos.x + gridIncr, _plat->_pos.y, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y) && platFindPath2(_plat->_pos.x + gridIncr, _plat->_pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; _platWalkNodes[i]._gridY1 = _plat->_pos.y; @@ -1122,7 +1102,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y) && gridSub42419A(_plat->_pos.x - gridIncr, _plat->_pos.y, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y) && platFindPath2(_plat->_pos.x - gridIncr, _plat->_pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; _platWalkNodes[i]._gridY1 = _plat->_pos.y; @@ -1132,7 +1112,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + gridIncr) && gridSub42419A(_plat->_pos.x, _plat->_pos.y + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + gridIncr) && platFindPath2(_plat->_pos.x, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x; _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; @@ -1142,7 +1122,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - gridIncr) && gridSub42419A(_plat->_pos.x, _plat->_pos.y - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - gridIncr) && platFindPath2(_plat->_pos.x, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x; _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; @@ -1152,7 +1132,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr) && gridSub42419A(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr) && platFindPath2(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; @@ -1162,7 +1142,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr) && gridSub42419A(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr) && platFindPath2(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; @@ -1172,7 +1152,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr) && gridSub42419A(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr) && platFindPath2(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; @@ -1182,7 +1162,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr) && gridSub42419A(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr) && platFindPath2(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; @@ -1217,17 +1197,17 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se if (animationIndex >= 0 && _gnap->_pos == Common::Point(_platWalkDestX, _platWalkDestY)) gnapWalkStep(); - if (gridSub423CC1(_plat->_pos.x, _plat->_pos.y, 0)) + if (platFindPath1(_plat->_pos.x, _plat->_pos.y, 0)) done = true; - if (!done && gridSub42419A(_plat->_pos.x, _plat->_pos.y, 0)) + if (!done && platFindPath2(_plat->_pos.x, _plat->_pos.y, 0)) done = true; if (!done && platFindPath3(_plat->_pos.x, _plat->_pos.y)) done = true; if (!done) - gridSub423750(_plat->_pos.x, _plat->_pos.y); + platFindPath4(_plat->_pos.x, _plat->_pos.y); int platSequenceId = _plat->_sequenceId; int platId = _plat->_id; @@ -1268,7 +1248,7 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _platWalkNodes[index]._id -= 10; else _platWalkNodes[index]._id += 10; - int newSequenceId = getPlatypusWalkSequenceId(_platWalkNodes[index]._deltaX, _platWalkNodes[index]._deltaY); + int newSequenceId = _plat->getWalkSequenceId(_platWalkNodes[index]._deltaX, _platWalkNodes[index]._deltaY); _gameSys->insertSequence(makeRid(datNum, newSequenceId), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _plat->_gridX, 48 * _platWalkNodes[index]._gridY1 - _plat->_gridY); -- cgit v1.2.3