From 7b063288d65402a2ecbaf2c4dd5bf89d29cfaa66 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 23:36:58 +0100 Subject: [PATCH] HOPKINS: Fix error in PARADISE (field16 vs field10), rename some fields --- engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 4 +--- engines/hopkins/objects.cpp | 31 +++++++++++++++---------------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 71f1c8711cb4..543fe26ac219 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -314,7 +314,7 @@ void Globals::clearAll() { for (int idx = 0; idx < 105; ++idx) { ZONEP[idx]._destX = 0; ZONEP[idx]._destY = 0; - ZONEP[idx].field4 = 0; + ZONEP[idx]._spriteIndex = 0; } essai0 = (int16 *)g_PTRNUL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index b1c7218985b2..6ba269d9d5b4 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -32,7 +32,7 @@ namespace Hopkins { struct ZonePItem { int _destX; int _destY; - int field4; + int _spriteIndex; int field6; int field7; int field8; @@ -45,7 +45,6 @@ struct ZonePItem { int fieldF; int field10; int field12; - int field16; }; struct CarreZoneItem { @@ -105,7 +104,6 @@ struct BobItem { int field20; int field22; int _offsetY; // Unused variable? - byte *field30; bool field34; // Set to true in B_CACHE_OFF() int field36; int _modeFlag; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d94f83842265..39572179fe6a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -490,7 +490,6 @@ void ObjectsManager::BOB_ZERO(int idx) { bob.field20 = 0; bob.field22 = 0; bob._offsetY = 0; - bob.field30 = g_PTRNUL; bob.field34 = false; bob.field36 = 0; bob._modeFlag = 0; @@ -1489,13 +1488,13 @@ void ObjectsManager::GOHOME() { _vm->_globals._oldDirection = -1; if (v54 > 0) { if (_vm->_globals.ZONEP[v54]._destX && _vm->_globals.ZONEP[v54]._destY && _vm->_globals.ZONEP[v54]._destY != 31) { - if (_vm->_globals.ZONEP[v54].field4 == -1) { + if (_vm->_globals.ZONEP[v54]._spriteIndex == -1) { _vm->_globals.ZONEP[v54]._destX = 0; _vm->_globals.ZONEP[v54]._destY = 0; - _vm->_globals.ZONEP[v54].field4 = 0; + _vm->_globals.ZONEP[v54]._spriteIndex = 0; } else { - setSpriteIndex(0, _vm->_globals.ZONEP[v54].field4); - _vm->_globals._actionDirection = _vm->_globals.ZONEP[v54].field4 - 59; + setSpriteIndex(0, _vm->_globals.ZONEP[v54]._spriteIndex); + _vm->_globals._actionDirection = _vm->_globals.ZONEP[v54]._spriteIndex - 59; } } } @@ -1769,13 +1768,13 @@ void ObjectsManager::GOHOME() { if (v49 > 0) { if (_vm->_globals.ZONEP[v49]._destX && _vm->_globals.ZONEP[v49]._destY && _vm->_globals.ZONEP[v49]._destY != 31) { - if ( _vm->_globals.ZONEP[v49].field4 == -1) { + if ( _vm->_globals.ZONEP[v49]._spriteIndex == -1) { _vm->_globals.ZONEP[v49]._destX = 0; _vm->_globals.ZONEP[v49]._destY = 0; - _vm->_globals.ZONEP[v49].field4 = 0; + _vm->_globals.ZONEP[v49]._spriteIndex = 0; } else { - setSpriteIndex(0, _vm->_globals.ZONEP[v49].field4); - _vm->_globals._actionDirection = _vm->_globals.ZONEP[v49].field4 - 59; + setSpriteIndex(0, _vm->_globals.ZONEP[v49]._spriteIndex); + _vm->_globals._actionDirection = _vm->_globals.ZONEP[v49]._spriteIndex - 59; } } } @@ -1911,7 +1910,7 @@ void ObjectsManager::loadZone(const Common::String &file) { for (int i = 1; i <= 100; i++) { _vm->_globals.ZONEP[i]._destX = 0; _vm->_globals.ZONEP[i]._destY = 0; - _vm->_globals.ZONEP[i].field4 = 0; + _vm->_globals.ZONEP[i]._spriteIndex = 0; _vm->_globals.ZONEP[i].field6 = 0; _vm->_globals.ZONEP[i].field7 = 0; _vm->_globals.ZONEP[i].field8 = 0; @@ -1955,7 +1954,7 @@ void ObjectsManager::loadZone(const Common::String &file) { // CHECKME: Shouldn't it be a byte? _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + v4); _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1); - _vm->_globals.ZONEP[i].field4 = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2); + _vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2); v4 += 3; } @@ -2342,7 +2341,7 @@ void ObjectsManager::PARADISE() { _vm->_talkManager.REPONSE2(_vm->_globals._saveData->data[svField2], _vm->_globals._saveData->data[svField1]); } _vm->_eventsManager.changeMouseCursor(4); - if (_zoneNum != -1 && _zoneNum != 0 && !_vm->_globals.ZONEP[_zoneNum].field16) { + if (_zoneNum != -1 && _zoneNum != 0 && !_vm->_globals.ZONEP[_zoneNum].field10) { _zoneNum = -1; _forceZoneFl = true; } @@ -3021,14 +3020,14 @@ int ObjectsManager::MZONE() { !_vm->_globals._bob[v2]._disabledAnimationFl && xp > _vm->_globals._bob[v2]._oldX && xp < _vm->_globals._bob[v2]._oldWidth + _vm->_globals._bob[v2]._oldX && yp > _vm->_globals._bob[v2]._oldY) { if (yp < _vm->_globals._bob[v2]._oldHeight + _vm->_globals._bob[v2]._oldY) { - if (_vm->_globals.ZONEP[v1].field4 == -1) { + if (_vm->_globals.ZONEP[v1]._spriteIndex == -1) { _vm->_globals.ZONEP[v1]._destX = 0; _vm->_globals.ZONEP[v1]._destY = 0; } if (!_vm->_globals.ZONEP[v1]._destX && !_vm->_globals.ZONEP[v1]._destY) { _vm->_globals.ZONEP[v1]._destX = _vm->_globals._bob[v2]._oldWidth + _vm->_globals._bob[v2]._oldX; _vm->_globals.ZONEP[v1]._destY = _vm->_globals._bob[v2]._oldHeight + _vm->_globals._bob[v2]._oldY + 6; - _vm->_globals.ZONEP[v1].field4 = -1; + _vm->_globals.ZONEP[v1]._spriteIndex = -1; } return v1; } @@ -3830,7 +3829,7 @@ void ObjectsManager::INILINK(const Common::String &file) { for (int i = 1; i <= 100; i++) { _vm->_globals.ZONEP[i]._destX = 0; _vm->_globals.ZONEP[i]._destY = 0; - _vm->_globals.ZONEP[i].field4 = 0; + _vm->_globals.ZONEP[i]._spriteIndex = 0; _vm->_globals.ZONEP[i].field6 = 0; _vm->_globals.ZONEP[i].field7 = 0; _vm->_globals.ZONEP[i].field8 = 0; @@ -3864,7 +3863,7 @@ void ObjectsManager::INILINK(const Common::String &file) { for (int i = 1; i <= 100; i++) { _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16(v17 + 2 * v33); _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); - _vm->_globals.ZONEP[i].field4 = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); + _vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); v33 += 3; }