diff options
author | Strangerke | 2013-03-06 08:28:18 +0100 |
---|---|---|
committer | Strangerke | 2013-03-06 08:28:18 +0100 |
commit | 389f75b3dd40683c1902c42f45f7d57295d36bf8 (patch) | |
tree | 6ac2b7548ff48680b63ad12df0d9ef4c5cf03050 /engines/hopkins/lines.cpp | |
parent | 3e17373cfab461282c21801ef65081bd6fcb1c6a (diff) | |
download | scummvm-rg350-389f75b3dd40683c1902c42f45f7d57295d36bf8.tar.gz scummvm-rg350-389f75b3dd40683c1902c42f45f7d57295d36bf8.tar.bz2 scummvm-rg350-389f75b3dd40683c1902c42f45f7d57295d36bf8.zip |
HOPKINS: Some more renaming in LinesManager
Diffstat (limited to 'engines/hopkins/lines.cpp')
-rw-r--r-- | engines/hopkins/lines.cpp | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 44f4d81098..6df9aa1e2f 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -85,8 +85,8 @@ LinesManager::LinesManager() { _maxLineIdx = 0; _pathFindingMaxDepth = 0; _testRoute0 = NULL; - testRoute1 = NULL; - testRoute2 = NULL; + _testRoute1 = NULL; + _testRoute2 = NULL; _lineBuf = (int16 *)g_PTRNUL; _route = (RouteItem *)g_PTRNUL; _currentSegmentId = 0; @@ -1511,7 +1511,7 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { return &_bestRoute[0]; } -void LinesManager::useRoute0(int idx, int curRouteIdx) { +void LinesManager::_useRoute0(int idx, int curRouteIdx) { if (idx) { int i = 0; do { @@ -1527,8 +1527,8 @@ void LinesManager::useRoute1(int idx, int curRouteIdx) { int i = 0; do { assert(curRouteIdx <= 8000); - _bestRoute[curRouteIdx++] = testRoute1[i++]; - } while (testRoute1[i].isValid()); + _bestRoute[curRouteIdx++] = _testRoute1[i++]; + } while (_testRoute1[i].isValid()); } _bestRoute[curRouteIdx].invalidate(); } @@ -1538,8 +1538,8 @@ void LinesManager::useRoute2(int idx, int curRouteIdx) { int i = 0; do { assert(curRouteIdx <= 8000); - _bestRoute[curRouteIdx++] = testRoute2[i++]; - } while (testRoute2[i].isValid()); + _bestRoute[curRouteIdx++] = _testRoute2[i++]; + } while (_testRoute2[i].isValid()); } _bestRoute[curRouteIdx].invalidate(); } @@ -1642,7 +1642,7 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int v109 = curY; if (destX >= curX - 2 && destX <= curX + 2 && destY >= curY - 2 && destY <= curY + 2) { _testRoute0[idxRoute0].invalidate(); - useRoute0(idxRoute0, curRouteIdx); + _useRoute0(idxRoute0, curRouteIdx); return 1; } distX = abs(curX - destX); @@ -1708,7 +1708,7 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int v108 = v20; if (v108 <= 10) { _testRoute0[idxRoute0].invalidate(); - useRoute0(idxRoute0, curRouteIdx); + _useRoute0(idxRoute0, curRouteIdx); return 1; } v21 = v108 - 1; @@ -1788,7 +1788,7 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int v23 = 0; if (v108 + 1 <= 0) { _testRoute0[idxRoute0].invalidate(); - useRoute0(idxRoute0, curRouteIdx); + _useRoute0(idxRoute0, curRouteIdx); return 1; } while (!checkCollisionLine(v104, v103, &v143, &v142, 0, _linesNumb)) { @@ -1801,7 +1801,7 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int ++v23; if (v23 >= v108 + 1) { _testRoute0[idxRoute0].invalidate(); - useRoute0(idxRoute0, curRouteIdx); + _useRoute0(idxRoute0, curRouteIdx); return 1; } } @@ -1809,7 +1809,7 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int break; v24 = GENIAL(v142, v143, v104, v103, destX, destY, idxRoute0, _testRoute0); if (v24 == -1) { - useRoute0(idxRoute0, curRouteIdx); + _useRoute0(idxRoute0, curRouteIdx); return 1; } idxRoute0 = v24; @@ -1830,7 +1830,7 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int while (true) { if (destX >= v33 - 2 && destX <= v33 + 2 && destY >= v92 - 2 && destY <= v92 + 2) { - testRoute1[idxRoute1].invalidate(); + _testRoute1[idxRoute1].invalidate(); useRoute1(idxRoute1, curRouteIdx); return 1; } @@ -1842,20 +1842,20 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int } if (v33 < destX) - testRoute1[idxRoute1++].set(v33++, v92, DIR_RIGHT); + _testRoute1[idxRoute1++].set(v33++, v92, DIR_RIGHT); else - testRoute1[idxRoute1++].set(v33--, v92, DIR_LEFT); + _testRoute1[idxRoute1++].set(v33--, v92, DIR_LEFT); } if (v33 != destX) break; - int v43 = v92; - while (v43 != destY) { - if (checkCollisionLine(destX, v43, &v141, &v140, 0, _linesNumb)) { + int curPosY = v92; + while (curPosY != destY) { + if (checkCollisionLine(destX, curPosY, &v141, &v140, 0, _linesNumb)) { if (v140 <= _lastLine) break; - int v44 = GENIAL(v140, v141, destX, v43, destX, destY, idxRoute1, testRoute1); + int v44 = GENIAL(v140, v141, destX, curPosY, destX, destY, idxRoute1, _testRoute1); if (v44 == -1) { useRoute1(idxRoute1, curRouteIdx); return 1; @@ -1865,13 +1865,13 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int break; } - if (v43 < destY) - testRoute1[idxRoute1++].set(destX, v43++, DIR_DOWN); + if (curPosY < destY) + _testRoute1[idxRoute1++].set(destX, curPosY++, DIR_DOWN); else - testRoute1[idxRoute1++].set(destX, v43--, DIR_UP); + _testRoute1[idxRoute1++].set(destX, curPosY--, DIR_UP); } - if (v43 == destY) { - testRoute1[idxRoute1].invalidate(); + if (curPosY == destY) { + _testRoute1[idxRoute1].invalidate(); useRoute1(idxRoute1, curRouteIdx); return 1; } @@ -1884,15 +1884,15 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int break; } - testRoute1[idxRoute1].invalidate(); + _testRoute1[idxRoute1].invalidate(); idxRoute1 = 0; v54 = v98; v93 = v97; while (true) { - int v61; + int curPosX; v114 = v54; if (destX >= v54 - 2 && destX <= v54 + 2 && destY >= v93 - 2 && destY <= v93 + 2) { - testRoute2[idxRoute1].invalidate(); + _testRoute2[idxRoute1].invalidate(); useRoute2(idxRoute1, curRouteIdx); return 1; } @@ -1906,37 +1906,37 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int } if (v55 < destY) - testRoute2[idxRoute1++].set(v114, v55++, DIR_DOWN); + _testRoute2[idxRoute1++].set(v114, v55++, DIR_DOWN); else - testRoute2[idxRoute1++].set(v114, v55--, DIR_UP); + _testRoute2[idxRoute1++].set(v114, v55--, DIR_UP); } if (v55 != destY) break; - v61 = v114; - while (v61 != destX) { - if (checkCollisionLine(v61, destY, &collDataIdx, &collLineIdx, 0, _linesNumb)) { + curPosX = v114; + while (curPosX != destX) { + if (checkCollisionLine(curPosX, destY, &collDataIdx, &collLineIdx, 0, _linesNumb)) { if (collLineIdx <= _lastLine) break; - int v62 = GENIAL(collLineIdx, collDataIdx, v61, destY, destX, destY, idxRoute1, testRoute2); - if (v62 == -1) { + int tmpRouteIdx = GENIAL(collLineIdx, collDataIdx, curPosX, destY, destX, destY, idxRoute1, _testRoute2); + if (tmpRouteIdx == -1) { useRoute2(idxRoute1, curRouteIdx); return 1; } - idxRoute1 = v62; + idxRoute1 = tmpRouteIdx; if (_newPosX != -1 && _newPosY != -1) break; } - if (v61 < destX) - testRoute2[idxRoute1++].set(v61++, destY, DIR_RIGHT); + if (curPosX < destX) + _testRoute2[idxRoute1++].set(curPosX++, destY, DIR_RIGHT); else - testRoute2[idxRoute1++].set(v61--, destY, DIR_LEFT); + _testRoute2[idxRoute1++].set(curPosX--, destY, DIR_LEFT); } - if (v61 == destX) { + if (curPosX == destX) { collLineIdx = -1; - testRoute2[idxRoute1].invalidate(); + _testRoute2[idxRoute1].invalidate(); useRoute2(idxRoute1, curRouteIdx); return 1; } @@ -1950,7 +1950,7 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int break; } - testRoute2[idxRoute1].invalidate(); + _testRoute2[idxRoute1].invalidate(); if (!v136) { if (endLineIdx > foundLineIdx) { @@ -1965,25 +1965,25 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int _newRouteIdx = curRouteIdx; return 2; } - if (testRoute1[0]._x != -1 && foundLineIdx < v140 && collLineIdx <= v140 && v142 <= v140 && endLineIdx >= v140) { + if (_testRoute1[0]._x != -1 && foundLineIdx < v140 && collLineIdx <= v140 && v142 <= v140 && endLineIdx >= v140) { _newLineIdx = v140; _newLineDataIdx = v141; int i = 0; do { assert(curRouteIdx <= 8000); - _bestRoute[curRouteIdx++] = testRoute1[i++]; - } while (testRoute1[i].isValid()); + _bestRoute[curRouteIdx++] = _testRoute1[i++]; + } while (_testRoute1[i].isValid()); _newRouteIdx = curRouteIdx; return 2; } - if (testRoute2[0]._x != -1 && foundLineIdx < collLineIdx && v140 < collLineIdx && v142 < collLineIdx && endLineIdx >= collLineIdx) { + if (_testRoute2[0]._x != -1 && foundLineIdx < collLineIdx && v140 < collLineIdx && v142 < collLineIdx && endLineIdx >= collLineIdx) { _newLineIdx = collLineIdx; _newLineDataIdx = collDataIdx; int i = 0; do { assert(curRouteIdx <= 8000); - _bestRoute[curRouteIdx++] = testRoute2[i++]; - } while (testRoute2[i].isValid()); + _bestRoute[curRouteIdx++] = _testRoute2[i++]; + } while (_testRoute2[i].isValid()); _newRouteIdx = curRouteIdx; return 2; } @@ -1995,30 +1995,30 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int v142 = 1300; if (collLineIdx == -1) v142 = 1300; - if (testRoute1[0]._x != -1 && v140 < foundLineIdx && collLineIdx >= v140 && v142 >= v140 && endLineIdx <= v140) { + if (_testRoute1[0]._x != -1 && v140 < foundLineIdx && collLineIdx >= v140 && v142 >= v140 && endLineIdx <= v140) { _newLineIdx = v140; _newLineDataIdx = v141; int i = 0; do { assert(curRouteIdx <= 8000); - _bestRoute[curRouteIdx++] = testRoute1[i++]; - } while (testRoute1[i].isValid()); + _bestRoute[curRouteIdx++] = _testRoute1[i++]; + } while (_testRoute1[i].isValid()); _newRouteIdx = curRouteIdx; return 2; } - if (testRoute2[0]._x != -1 && foundLineIdx > collLineIdx && v140 >= collLineIdx && v142 >= collLineIdx && endLineIdx <= collLineIdx) { + if (_testRoute2[0]._x != -1 && foundLineIdx > collLineIdx && v140 >= collLineIdx && v142 >= collLineIdx && endLineIdx <= collLineIdx) { _newLineIdx = collLineIdx; _newLineDataIdx = collDataIdx; int i = 0; do { assert(curRouteIdx <= 8000); - _bestRoute[curRouteIdx++] = testRoute2[i++]; - } while (testRoute2[i].isValid()); + _bestRoute[curRouteIdx++] = _testRoute2[i++]; + } while (_testRoute2[i].isValid()); _newRouteIdx = curRouteIdx; return 2; } // CHECKME: Checking essai0[0]._X might make more sense here? - if (testRoute1[0]._x != -1 && foundLineIdx > v142 && v140 >= v142 && collLineIdx >= v142 && endLineIdx <= v142) { + if (_testRoute1[0]._x != -1 && foundLineIdx > v142 && v140 >= v142 && collLineIdx >= v142 && endLineIdx <= v142) { _newLineIdx = v142; _newLineDataIdx = v143; int i = 0; @@ -2139,9 +2139,9 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { int v27 = 0; int v28; for (;;) { - v28 = testRoute2[v27]._x; - int v29 = testRoute2[v27]._y; - Directions v66 = testRoute2[v27]._dir; + v28 = _testRoute2[v27]._x; + int v29 = _testRoute2[v27]._y; + Directions v66 = _testRoute2[v27]._dir; v27++; if (checkCollisionLine(v28, v29, &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine)) @@ -2788,8 +2788,8 @@ void LinesManager::clearAll() { } _testRoute0 = (RouteItem *)g_PTRNUL; - testRoute1 = (RouteItem *)g_PTRNUL; - testRoute2 = (RouteItem *)g_PTRNUL; + _testRoute1 = (RouteItem *)g_PTRNUL; + _testRoute2 = (RouteItem *)g_PTRNUL; _lineBuf = (int16 *)g_PTRNUL; _route = (RouteItem *)g_PTRNUL; @@ -2810,14 +2810,14 @@ void LinesManager::clearAll() { // FIXME: Delete these somewhere _vm->_linesManager._testRoute0 = new RouteItem[8334]; - _vm->_linesManager.testRoute1 = new RouteItem[8334]; - _vm->_linesManager.testRoute2 = new RouteItem[8334]; + _vm->_linesManager._testRoute1 = new RouteItem[8334]; + _vm->_linesManager._testRoute2 = new RouteItem[8334]; if (!_vm->_linesManager._testRoute0) _vm->_linesManager._testRoute0 = (RouteItem*)g_PTRNUL; - if (!_vm->_linesManager.testRoute1) - _vm->_linesManager.testRoute1 = (RouteItem*)g_PTRNUL; - if (!_vm->_linesManager.testRoute2) - _vm->_linesManager.testRoute2 = (RouteItem*)g_PTRNUL; + if (!_vm->_linesManager._testRoute1) + _vm->_linesManager._testRoute1 = (RouteItem*)g_PTRNUL; + if (!_vm->_linesManager._testRoute2) + _vm->_linesManager._testRoute2 = (RouteItem*)g_PTRNUL; _largeBuf = _vm->_globals.allocMemory(10000); _vm->_linesManager._lineBuf = (int16 *)(_largeBuf); |