aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2013-01-10 21:25:21 +0100
committerStrangerke2013-01-10 21:25:21 +0100
commit271087850f7da414ee6daf259e0b7d41e196a66c (patch)
treeb176a4d1746dcef1a43eb398d6ca240e1e74758d
parent66cc7d099e3787b50a45d289652e9f258a2a805d (diff)
downloadscummvm-rg350-271087850f7da414ee6daf259e0b7d41e196a66c.tar.gz
scummvm-rg350-271087850f7da414ee6daf259e0b7d41e196a66c.tar.bz2
scummvm-rg350-271087850f7da414ee6daf259e0b7d41e196a66c.zip
HOPKINS: Refactor CHARGE_OBSTACLE
-rw-r--r--engines/hopkins/objects.cpp36
1 files changed, 12 insertions, 24 deletions
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index 2f83df0ad0..d78990431e 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -2049,33 +2049,21 @@ void ObjectsManager::GOHOME2() {
// Load Obstacle
void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) {
- int16 v1;
- byte *ptr;
- int16 v4;
- int16 v5;
-
_vm->_linesManager.RESET_OBSTACLE();
_vm->_linesManager._linesNumb = 0;
_lastLine = 0;
- ptr = _vm->_fileManager.loadFile(file);
- v4 = 0;
- v5 = 0;
- do {
- v1 = (int16)READ_LE_UINT16((uint16 *)ptr + v4);
- if (v1 != -1) {
- _vm->_linesManager.AJOUTE_LIGNE(
- v5,
- v1,
- (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1),
- (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2),
- (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 3),
- (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 4),
- 1);
- ++_vm->_linesManager._linesNumb;
- }
- v4 += 5;
- ++v5;
- } while (v1 != -1);
+ byte *ptr = _vm->_fileManager.loadFile(file);
+ for (int idx = 0; (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)) != -1; idx++) {
+ _vm->_linesManager.AJOUTE_LIGNE(
+ idx,
+ (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)),
+ (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);
+ ++_vm->_linesManager._linesNumb;
+ }
_vm->_linesManager.initRoute();
_vm->_globals.freeMemory(ptr);
}