From 9d1d5a09c4a1fb2ca827755e197ea7726eaa39ab Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 15:22:57 +0100 Subject: HOPKINS: Move two more variables to _linesManager, set private some variables --- engines/hopkins/globals.cpp | 6 ++---- engines/hopkins/globals.h | 3 --- engines/hopkins/lines.cpp | 20 +++++++++++--------- engines/hopkins/lines.h | 18 +++++++++++------- engines/hopkins/objects.cpp | 1 - 5 files changed, 24 insertions(+), 24 deletions(-) (limited to 'engines') diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index f3988f2bdf..52ccfafc4a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -151,7 +151,6 @@ Globals::Globals() { _actionDirection = 0; _actionDirection = 0; SegmentEnCours = 0; - pathFindingDepth = 0; Credit_bx = -1; Credit_bx1 = -1; @@ -180,7 +179,6 @@ Globals::Globals() { _forestSprite = NULL; _answerBuffer = g_PTRNUL; _route = (int16 *)g_PTRNUL; - BufLig = (int16 *)g_PTRNUL; ADR_FICHIER_OBJ = NULL; police = NULL; PERSO = NULL; @@ -309,7 +307,7 @@ void Globals::clearAll() { _vm->_linesManager.essai0 = (int16 *)g_PTRNUL; _vm->_linesManager.essai1 = (int16 *)g_PTRNUL; _vm->_linesManager.essai2 = (int16 *)g_PTRNUL; - BufLig = (int16 *)g_PTRNUL; + _vm->_linesManager.BufLig = (int16 *)g_PTRNUL; _route = (int16 *)g_PTRNUL; for (int idx = 0; idx < MAX_LINES; ++idx) { @@ -337,7 +335,7 @@ void Globals::clearAll() { _vm->_linesManager.essai0 = (int16 *)BUFFERTAPE; _vm->_linesManager.essai1 = (int16 *)(BUFFERTAPE + 25000); _vm->_linesManager.essai2 = (int16 *)(BUFFERTAPE + 50000); - BufLig = (int16 *)(BUFFERTAPE + 75000); + _vm->_linesManager.BufLig = (int16 *)(BUFFERTAPE + 75000); _boxWidth = 240; _vm->_eventsManager._objectBuf = allocMemory(2500); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 58a45c153e..316ed54fe0 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -335,7 +335,6 @@ public: bool _forestFl; byte *_answerBuffer; int16 *_route; - int16 *BufLig; byte *ADR_FICHIER_OBJ; byte *PERSO; int _objectWidth, _objectHeight; @@ -372,8 +371,6 @@ public: int SegmentEnCours; int couleur_40; - int pathFindingDepth; - int _hotspotTextColor; int oldzone_46; int old_x1_65; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 2b0dd0ed0d..4a4ad44804 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -48,9 +48,11 @@ LinesManager::LinesManager() { _smoothMoveDirection = 0; _lastLine = 0; _maxLineIdx = 0; + _pathFindingMaxDepth = 0; essai0 = NULL; essai1 = NULL; essai2 = NULL; + BufLig = (int16 *)g_PTRNUL; } void LinesManager::setParent(HopkinsEngine *vm) { @@ -900,8 +902,8 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9) { int result = a7; int v80 = -1; - ++_vm->_globals.pathFindingDepth; - if (_vm->_globals.pathFindingDepth > 10) { + ++_pathFindingMaxDepth; + if (_pathFindingMaxDepth > 10) { warning("PathFinding - Max depth reached"); route[a7] = -1; route[a7 + 1] = -1; @@ -987,11 +989,11 @@ LABEL_17: if (v85 > 800) v85 = 800; - Common::fill(&_vm->_globals.BufLig[0], &_vm->_globals.BufLig[1000], 0); + Common::fill(&BufLig[0], &BufLig[1000], 0); int bugLigIdx = 0; for (int v88 = 0; v88 < v85 + 1; v88++) { - _vm->_globals.BufLig[bugLigIdx] = v82; - _vm->_globals.BufLig[bugLigIdx + 1] = v81; + BufLig[bugLigIdx] = v82; + BufLig[bugLigIdx + 1] = v81; v21 += v84; v22 += v83; v82 = v21 / 1000; @@ -1003,11 +1005,11 @@ LABEL_17: int v78 = 0; int v79 = 0; for (int v89 = v85 + 1; v89 > 0; v89--) { - if (checkCollisionLine(_vm->_globals.BufLig[bugLigIdx], _vm->_globals.BufLig[bugLigIdx + 1], &foundDataIdx, &foundLineIdx, v92, v91) && _lastLine < foundLineIdx) { + if (checkCollisionLine(BufLig[bugLigIdx], BufLig[bugLigIdx + 1], &foundDataIdx, &foundLineIdx, v92, v91) && _lastLine < foundLineIdx) { v80 = foundLineIdx; v77 = foundDataIdx; - v78 = _vm->_globals.BufLig[bugLigIdx]; - v79 = _vm->_globals.BufLig[bugLigIdx + 1]; + v78 = BufLig[bugLigIdx]; + v79 = BufLig[bugLigIdx + 1]; break; } bugLigIdx -= 2; @@ -1240,7 +1242,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { _vm->_globals.old_x2_67 = destX; _vm->_globals.old_y1_66 = fromY; _vm->_globals.old_y2_68 = clipDestY; - _vm->_globals.pathFindingDepth = 0; + _pathFindingMaxDepth = 0; int v112 = 0; if (destX <= 19) clipDestX = 20; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index d31c34df59..3806a98f41 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -53,24 +53,28 @@ struct SmoothItem { class LinesManager { private: HopkinsEngine *_vm; -public: - LigneZoneItem _zoneLine[401]; - LigneItem Ligne[400]; + + int _pathFindingMaxDepth; SmoothItem _smoothRoute[4000]; - int _linesNumb; int NV_LIGNEDEP; int NV_LIGNEOFS; int NV_POSI; int NVPX; int NVPY; int _smoothMoveDirection; - int _lastLine; - int _maxLineIdx; int16 super_parcours[32002]; + +public: + LigneZoneItem _zoneLine[401]; + LigneItem Ligne[400]; int16 *essai0; int16 *essai1; int16 *essai2; -public: + int _maxLineIdx; + int _linesNumb; + int _lastLine; + int16 *BufLig; + LinesManager(); void setParent(HopkinsEngine *vm); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 0633320700..af9d33edb3 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1762,7 +1762,6 @@ void ObjectsManager::loadZone(const Common::String &file) { } while (bobZoneIdx != -1); for (int i = 1; i <= 100; i++) { - // CHECKME: Shouldn't it be a byte? _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + bufId); _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 1); _vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 2); -- cgit v1.2.3