diff options
author | Strangerke | 2013-02-06 08:02:18 +0100 |
---|---|---|
committer | Strangerke | 2013-02-06 08:02:18 +0100 |
commit | 205fdaaa0c8a3592018035ab4f25153e30d0b4d0 (patch) | |
tree | adbbf19c21e993c8f8e42526ebc5ed120954ba84 /engines/hopkins | |
parent | 46ef222ccd9f6650a85c32e67061c8817259f4bd (diff) | |
download | scummvm-rg350-205fdaaa0c8a3592018035ab4f25153e30d0b4d0.tar.gz scummvm-rg350-205fdaaa0c8a3592018035ab4f25153e30d0b4d0.tar.bz2 scummvm-rg350-205fdaaa0c8a3592018035ab4f25153e30d0b4d0.zip |
HOPKINS: Remove a useless variable in LinesManager, some renaming
Diffstat (limited to 'engines/hopkins')
-rw-r--r-- | engines/hopkins/lines.cpp | 88 | ||||
-rw-r--r-- | engines/hopkins/lines.h | 3 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 49 |
3 files changed, 51 insertions, 89 deletions
diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 5b6631c77f..ad82bb264e 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -84,8 +84,7 @@ void LinesManager::loadLines(const Common::String &file) { (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 1), (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 2), (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 3), - (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 4), - 1); + (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 4)); } initRoute(); _vm->_globals.freeMemory(ptr); @@ -207,61 +206,38 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ /** * Add Line */ -void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int a7) { - int v7; - int v8; - int v9; - byte *v10; - int v11; - int v12; - int v13; - int v24; - int v25; - int16 *v27; - int v30; - int v31; - int16 *v32; - int v33; - int v34; - int v35; - int v36; - int v37; - int v38; - int v39; - int v40; - +void LinesManager::addLine(int idx, int direction, int a3, int a4, int a5, int a6) { assert (idx <= MAX_LINES); if (_linesNumb < idx) _linesNumb = idx; Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData); - v7 = abs(a3 - a5); - v8 = v7 + 1; - v9 = abs(a4 - a6); - v34 = v9 + 1; - v33 = v9 + 1; + int v7 = abs(a3 - a5); + int v8 = v7 + 1; + int v9 = abs(a4 - a6); + int v34 = v9 + 1; + int v33 = v9 + 1; if (v8 > v34) v34 = v8; - v10 = _vm->_globals.allocMemory(4 * v34 + 8); + byte *v10 = _vm->_globals.allocMemory(4 * v34 + 8); assert (v10 != g_PTRNUL); Common::fill(v10, v10 + 4 * v34 + 8, 0); Ligne[idx]._lineData = (int16 *)v10; - v32 = Ligne[idx]._lineData; - v36 = 1000 * v8; - v39 = 1000 * v8 / (v34 - 1); - v37 = 1000 * v33 / (v34 - 1); + int16 *v32 = Ligne[idx]._lineData; + int v36 = 1000 * v8; + int v39 = 1000 * v8 / (v34 - 1); + int v37 = 1000 * v33 / (v34 - 1); if (a5 < a3) v39 = -v39; if (a6 < a4) v37 = -v37; - v11 = (int)v39 / 1000; - v12 = (int)v37 / 1000; - v13 = (int)v37 / 1000; - if (!((int)v39 / 1000)) { + int v11 = (int)v39 / 1000; + int v12 = (int)v37 / 1000; + if (!v11) { if (v12 == -1) { Ligne[idx].field6 = 1; Ligne[idx].field8 = 5; @@ -276,25 +252,25 @@ void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int Ligne[idx].field6 = 2; Ligne[idx].field8 = 6; } - if (!v13) { + if (!v12) { Ligne[idx].field6 = 3; Ligne[idx].field8 = 7; } - if (v13 == 1) { + if (v12 == 1) { Ligne[idx].field6 = 4; Ligne[idx].field8 = 8; } } if (v11 == -1) { - if (v13 == 1) { + if (v12 == 1) { Ligne[idx].field6 = 6; Ligne[idx].field8 = 2; } - if (!v13) { + if (!v12) { Ligne[idx].field6 = 7; Ligne[idx].field8 = 3; } - if (v13 == -1) { + if (v12 == -1) { Ligne[idx].field6 = 8; Ligne[idx].field8 = 4; } @@ -318,17 +294,17 @@ void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int Ligne[idx].field6 = 8; Ligne[idx].field8 = 4; } - v40 = v36 / v34; - v38 = 1000 * v33 / v34; + int v40 = v36 / v34; + int v38 = 1000 * v33 / v34; if (a5 < a3) v40 = -v40; if (a6 < a4) v38 = -v38; - v24 = 1000 * a3; - v25 = 1000 * a4; - v31 = 1000 * a3 / 1000; - v30 = 1000 * a4 / 1000; - v35 = v34 - 1; + int v24 = 1000 * a3; + int v25 = 1000 * a4; + int v31 = 1000 * a3 / 1000; + int v30 = 1000 * a4 / 1000; + int v35 = v34 - 1; for (int v26 = 0; v26 < v35; v26++) { v32[0] = v31; v32[1] = v30; @@ -342,13 +318,12 @@ void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int v32[0] = a5; v32[1] = a6; - v27 = v32 + 2; - v27[0] = -1; - v27[1] = -1; + v32 += 2; + v32[0] = -1; + v32[1] = -1; Ligne[idx]._lineDataEndIdx = v35 + 1; - Ligne[idx].field2 = a7; - Ligne[idx]._direction = a2; + Ligne[idx]._direction = direction; ++_linesNumb; } @@ -3158,7 +3133,6 @@ void LinesManager::clearAll() { for (int idx = 0; idx < MAX_LINES; ++idx) { _vm->_linesManager.Ligne[idx]._lineDataEndIdx = 0; - _vm->_linesManager.Ligne[idx].field2 = 0; _vm->_linesManager.Ligne[idx]._direction = 0; _vm->_linesManager.Ligne[idx].field6 = 0; _vm->_linesManager.Ligne[idx].field8 = 0; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 69efd922d1..066c8aeaa7 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -38,7 +38,6 @@ struct LigneZoneItem { struct LigneItem { int _lineDataEndIdx; - int field2; // Useless variable int _direction; int field6; int field8; @@ -124,7 +123,7 @@ public: int16 *cityMapCarRoute(int x1, int y1, int x2, int y2); void clearAllZones(); void resetLines(); - void addLine(int idx, int a2, int a3, int a4, int a5, int a6, int a7); + void addLine(int idx, int direction, int a3, int a4, int a5, int a6); void initRoute(); int MZONE(); void CARRE_ZONE(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 83062023e3..e9db707e98 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3121,16 +3121,7 @@ int ObjectsManager::getBobFrameIndex(int idx) { } void ObjectsManager::INILINK(const Common::String &file) { - int v8; - int v9; - int v10; - byte *v22; - int16 v27; - int16 v28; - int v36; - byte *v37; Common::File f; - Common::String filename = file + ".LNK"; byte *ptr = _vm->_fileManager.searchCat(filename, 3); size_t nbytes = _vm->_globals._catalogSize; @@ -3161,31 +3152,28 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile("RES_SLI.RES"); } - v36 = 60; - v37 = ptr + 1000; + int curDataCacheId = 60; + byte *curDataPtr = ptr + 1000; for (int cacheIdx = 0; cacheIdx <= 21; cacheIdx++) { - v8 = (int16)READ_LE_UINT16(v37 + 2 * v36); - v9 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 2); - v10 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 4); - - _vm->_globals.Cache[cacheIdx].field14 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 8); - _vm->_globals.Cache[cacheIdx]._spriteIndex = v8; - _vm->_globals.Cache[cacheIdx]._x = v9; - _vm->_globals.Cache[cacheIdx]._y = v10; + int curSpriteId = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId); + _vm->_globals.Cache[cacheIdx]._spriteIndex = curSpriteId; + _vm->_globals.Cache[cacheIdx]._x = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId + 2); + _vm->_globals.Cache[cacheIdx]._y = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId + 4); + _vm->_globals.Cache[cacheIdx].field14 = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId + 8); if (!_vm->_globals.CACHE_BANQUE[1]) { _vm->_globals.Cache[cacheIdx]._useCount = 0; } else { _vm->_globals.Cache[cacheIdx]._spriteData = _vm->_globals.CACHE_BANQUE[1]; - _vm->_globals.Cache[cacheIdx]._width = getWidth(_vm->_globals.CACHE_BANQUE[1], v8); - _vm->_globals.Cache[cacheIdx]._height = getHeight(_vm->_globals.CACHE_BANQUE[1], v8); + _vm->_globals.Cache[cacheIdx]._width = getWidth(_vm->_globals.CACHE_BANQUE[1], curSpriteId); + _vm->_globals.Cache[cacheIdx]._height = getHeight(_vm->_globals.CACHE_BANQUE[1], curSpriteId); _vm->_globals.Cache[cacheIdx]._useCount = 1; } if (!_vm->_globals.Cache[cacheIdx]._x && !_vm->_globals.Cache[cacheIdx]._y && !_vm->_globals.Cache[cacheIdx]._spriteIndex) _vm->_globals.Cache[cacheIdx]._useCount = 0; - v36 += 5; + curDataCacheId += 5; } _vm->_globals.CACHE_ON(); } @@ -3198,21 +3186,21 @@ void ObjectsManager::INILINK(const Common::String &file) { int lineDataIdx = 0; int curLineIdx = 0; _vm->_linesManager.resetLinesNumb(); + int curDirection; do { - v27 = (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx); - if (v27 != -1) { + curDirection = (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx); + if (curDirection != -1) { _vm->_linesManager.addLine( curLineIdx, - v27, + curDirection, (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 2), (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 4), (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 6), - (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 8), - 1); + (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 8)); } lineDataIdx += 5; ++curLineIdx; - } while (v27 != -1); + } while (curDirection != -1); _vm->_linesManager.initRoute(); } } @@ -3240,6 +3228,7 @@ void ObjectsManager::INILINK(const Common::String &file) { } int curLineIdx = 0; + int v28; do { v28 = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx); if (v28 != -1) { @@ -3262,7 +3251,7 @@ void ObjectsManager::INILINK(const Common::String &file) { curDataIdx += 3; } - v22 = ptr + idx + (10 * curLineIdx + 606) + 4; + byte *v22 = ptr + idx + (10 * curLineIdx + 606) + 4; for (int i = 1; i <= 100; i++) { int j = (i - 1) * 10; _vm->_globals.ZONEP[i].field6 = v22[j]; @@ -3531,7 +3520,6 @@ void ObjectsManager::enableVerb(int idx, int a2) { } void ObjectsManager::ACTION(const byte *spriteData, const Common::String &actionStr, int a3, int a4, int speed, bool flipFl) { - int idx = 0; Common::String tmpStr = ""; int realSpeed = speed; if (_vm->_globals._speed == 2) @@ -3545,6 +3533,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &action _sprite[0].field14 += a4; _sprite[0]._flipFl = flipFl; + int idx = 0; for (int strPos = 0; ; strPos++) { bool tokenCompleteFl = false; char curChar = actionStr[strPos]; |