aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2013-02-05 00:12:42 +0100
committerStrangerke2013-02-05 00:12:42 +0100
commit19427ff1769617fc379268f1abceccdf272d2aef (patch)
tree66ee2c44794ddaa61a591ff13fe85944c1b1db0c
parent555c0ad320d177126fa0b202efad190f2ca0b662 (diff)
downloadscummvm-rg350-19427ff1769617fc379268f1abceccdf272d2aef.tar.gz
scummvm-rg350-19427ff1769617fc379268f1abceccdf272d2aef.tar.bz2
scummvm-rg350-19427ff1769617fc379268f1abceccdf272d2aef.zip
HOPKINS: Some refactoring in ObjectsManager
-rw-r--r--engines/hopkins/dialogs.cpp89
-rw-r--r--engines/hopkins/globals.cpp2
-rw-r--r--engines/hopkins/globals.h6
-rw-r--r--engines/hopkins/graphics.cpp2
-rw-r--r--engines/hopkins/hopkins.cpp14
-rw-r--r--engines/hopkins/objects.cpp140
-rw-r--r--engines/hopkins/objects.h21
-rw-r--r--engines/hopkins/talk.cpp6
8 files changed, 143 insertions, 137 deletions
diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp
index 01ed89637d..0dd697d05a 100644
--- a/engines/hopkins/dialogs.cpp
+++ b/engines/hopkins/dialogs.cpp
@@ -68,7 +68,7 @@ void DialogsManager::showOptionsDialog() {
filename = "OPTIES.SPR";
}
- _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(filename);
+ _vm->_globals._optionDialogSpr = _vm->_fileManager.loadFile(filename);
_vm->_globals._optionDialogFl = true;
bool doneFlag = false;
@@ -233,7 +233,8 @@ void DialogsManager::showOptionsDialog() {
//if (mousePos.x >= _vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= _vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273)
// _vm->_globals._speed = 2;
- if (mousePos.x < _vm->_graphicsManager._scrollOffset + 165 || mousePos.x > _vm->_graphicsManager._scrollOffset + 496 || (uint)(mousePos.y - 107) > 211)
+ if ( mousePos.x < _vm->_graphicsManager._scrollOffset + 165 || mousePos.x > _vm->_graphicsManager._scrollOffset + 496
+ || mousePos.y < 107 || mousePos.y > 318)
doneFlag = true;
}
@@ -256,30 +257,44 @@ void DialogsManager::showOptionsDialog() {
_vm->_globals._menuDisplayType = 9;
- if (_vm->_graphicsManager._scrollSpeed == 1)
+ switch (_vm->_graphicsManager._scrollSpeed) {
+ case 1:
_vm->_globals._menuScrollSpeed = 12;
- else if (_vm->_graphicsManager._scrollSpeed == 2)
+ break;
+ case 2:
_vm->_globals._menuScrollSpeed = 13;
- else if (_vm->_graphicsManager._scrollSpeed == 4)
+ break;
+ case 4:
_vm->_globals._menuScrollSpeed = 14;
- else if (_vm->_graphicsManager._scrollSpeed == 8)
+ break;
+ case 8:
_vm->_globals._menuScrollSpeed = 15;
- else if (_vm->_graphicsManager._scrollSpeed == 16)
+ break;
+ case 16:
_vm->_globals._menuScrollSpeed = 16;
- else if (_vm->_graphicsManager._scrollSpeed == 32)
+ break;
+ case 32:
_vm->_globals._menuScrollSpeed = 17;
- else if (_vm->_graphicsManager._scrollSpeed == 48)
+ break;
+ case 48:
_vm->_globals._menuScrollSpeed = 18;
- else if (_vm->_graphicsManager._scrollSpeed == 64)
+ break;
+ case 64:
_vm->_globals._menuScrollSpeed = 19;
- else if (_vm->_graphicsManager._scrollSpeed == 128)
+ break;
+ case 128:
_vm->_globals._menuScrollSpeed = 20;
- else if (_vm->_graphicsManager._scrollSpeed == 160)
+ break;
+ case 160:
_vm->_globals._menuScrollSpeed = 21;
- else if (_vm->_graphicsManager._scrollSpeed == 320)
+ break;
+ case 320:
_vm->_globals._menuScrollSpeed = 22;
- else if (_vm->_graphicsManager._scrollSpeed == 640)
+ break;
+ case 640:
_vm->_globals._menuScrollSpeed = 23;
+ break;
+ }
_vm->_eventsManager.VBL();
} while (!doneFlag);
@@ -289,7 +304,7 @@ void DialogsManager::showOptionsDialog() {
_vm->_graphicsManager.addVesaSegment(_vm->_graphicsManager._scrollOffset + 164, 107,
_vm->_graphicsManager._scrollOffset + 498, 320);
- _vm->_globals.OPTION_SPR = _vm->_globals.freeMemory(_vm->_globals.OPTION_SPR);
+ _vm->_globals._optionDialogSpr = _vm->_globals.freeMemory(_vm->_globals._optionDialogSpr);
_vm->_globals._optionDialogFl = false;
}
@@ -298,7 +313,7 @@ void DialogsManager::showInventory() {
return;
_vm->_graphicsManager._scrollStatus = 1;
- _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4;
+ _vm->_objectsManager._eraseVisibleCounter = 4;
_vm->_objectsManager._visibleFl = false;
for (int i = 0; i <= 1; i++) {
inventAnim();
@@ -319,15 +334,15 @@ LABEL_7:
filename = "INVENT.SPR";
else {
switch (_vm->_globals._language) {
- case LANG_EN:
- filename = "INVENTAN.SPR";
- break;
- case LANG_FR:
- filename = "INVENTFR.SPR";
- break;
- case LANG_SP:
- filename = "INVENTES.SPR";
- break;
+ case LANG_EN:
+ filename = "INVENTAN.SPR";
+ break;
+ case LANG_FR:
+ filename = "INVENTFR.SPR";
+ break;
+ case LANG_SP:
+ filename = "INVENTES.SPR";
+ break;
}
}
@@ -461,24 +476,24 @@ void DialogsManager::inventAnim() {
if (_vm->_globals._disableInventFl)
return;
- if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager._visibleFl) {
- _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38,
- _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27);
- _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65);
- --_vm->_objectsManager.FLAG_VISIBLE_EFFACE;
+ if (_vm->_objectsManager._eraseVisibleCounter && !_vm->_objectsManager._visibleFl) {
+ _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager._oldInventoryPosX, 27, 48, 38,
+ _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._oldInventoryPosX, 27);
+ _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager._oldInventoryPosX, 27, _vm->_objectsManager._oldInventoryPosX + 48, 65);
+ --_vm->_objectsManager._eraseVisibleCounter;
}
if (_vm->_objectsManager._visibleFl) {
- if (_vm->_objectsManager.I_old_x <= 1)
- _vm->_objectsManager.I_old_x = 2;
- _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38,
- _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27);
+ if (_vm->_objectsManager._oldInventoryPosX <= 1)
+ _vm->_objectsManager._oldInventoryPosX = 2;
+ _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager._oldInventoryPosX, 27, 48, 38,
+ _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._oldInventoryPosX, 27);
- _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65);
+ _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager._oldInventoryPosX, 27, _vm->_objectsManager._oldInventoryPosX + 48, 65);
int newOffset = _vm->_graphicsManager._scrollOffset + 2;
_vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.ICONE, newOffset + 300, 327, 0);
_vm->_graphicsManager.addVesaSegment(newOffset, 27, newOffset + 45, 62);
- _vm->_objectsManager.I_old_x = newOffset;
+ _vm->_objectsManager._oldInventoryPosX = newOffset;
}
if (_vm->_globals._saveData->_data[svField357] == 1) {
@@ -504,7 +519,7 @@ void DialogsManager::inventAnim() {
* Test dialog opening
*/
void DialogsManager::testDialogOpening() {
- if (_vm->_globals.PLAN_FLAG)
+ if (_vm->_globals._cityMapEnabledFl)
_vm->_eventsManager._gameKey = KEY_NONE;
if ((_vm->_eventsManager._gameKey == KEY_NONE) || _inventFl)
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp
index d912f4f227..2c2cfac80e 100644
--- a/engines/hopkins/globals.cpp
+++ b/engines/hopkins/globals.cpp
@@ -173,7 +173,7 @@ Globals::Globals() {
ADR_FICHIER_OBJ = NULL;
_font = NULL;
PERSO = NULL;
- OPTION_SPR = NULL;
+ _optionDialogSpr = NULL;
// Reset flags
_censorshipFl = false;
diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h
index c29b9789ff..4cc2f245be 100644
--- a/engines/hopkins/globals.h
+++ b/engines/hopkins/globals.h
@@ -74,7 +74,7 @@ struct BobItem {
int _xp;
int _yp;
int _frameIndex;
- int field10; // BOBPOSI ?
+ int _animDataIdx;
int field12;
int field14;
bool _disabledAnimationFl;
@@ -339,7 +339,7 @@ public:
bool _disableInventFl;
bool NOMARCHE;
int NBBLOC;
- byte *OPTION_SPR;
+ byte *_optionDialogSpr;
bool _optionDialogFl;
int _menuDisplayType;
int _menuSpeed;
@@ -353,7 +353,7 @@ public:
bool NOT_VERIF;
bool _cacheFl;
bool _introSpeechOffFl;
- bool PLAN_FLAG;
+ bool _cityMapEnabledFl;
bool GOACTION;
int Compteur;
int _actionDirection;
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
index 6318bd1ca8..63bcbf20c8 100644
--- a/engines/hopkins/graphics.cpp
+++ b/engines/hopkins/graphics.cpp
@@ -1060,7 +1060,7 @@ void GraphicsManager::FIN_VISU() {
for (int idx = 1; idx <= 20; ++idx) {
if (_vm->_globals.Bqe_Anim[idx]._enabledFl)
- _vm->_objectsManager.BOB_ZERO(idx);
+ _vm->_objectsManager.resetBob(idx);
}
for (int idx = 1; idx <= 29; ++idx) {
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index dcff7f2615..46fa3814a6 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -68,14 +68,14 @@ Common::String HopkinsEngine::generateSaveName(int slot) {
* Returns true if it is currently okay to restore a game
*/
bool HopkinsEngine::canLoadGameStateCurrently() {
- return !_globals._exitId && !_globals.PLAN_FLAG && _eventsManager._mouseFl;
+ return !_globals._exitId && !_globals._cityMapEnabledFl && _eventsManager._mouseFl;
}
/**
* Returns true if it is currently okay to save the game
*/
bool HopkinsEngine::canSaveGameStateCurrently() {
- return !_globals._exitId && !_globals.PLAN_FLAG && _eventsManager._mouseFl;
+ return !_globals._exitId && !_globals._cityMapEnabledFl && _eventsManager._mouseFl;
}
/**
@@ -234,7 +234,7 @@ bool HopkinsEngine::runWin95Demo() {
case 4:
_globals._disableInventFl = true;
- _objectsManager.PLAN_BETA();
+ _objectsManager.handleCityMap();
_globals._disableInventFl = false;
break;
@@ -542,7 +542,7 @@ bool HopkinsEngine::runLinuxDemo() {
case 4:
_globals._disableInventFl = true;
- _objectsManager.PLAN_BETA();
+ _objectsManager.handleCityMap();
_globals._disableInventFl = false;
break;
@@ -887,7 +887,7 @@ bool HopkinsEngine::runFull() {
case 4:
_globals._disableInventFl = true;
- _objectsManager.PLAN_BETA();
+ _objectsManager.handleCityMap();
_globals._disableInventFl = false;
break;
@@ -2097,7 +2097,7 @@ void HopkinsEngine::playEnding() {
_dialogsManager._removeInventFl = true;
_globals._disableInventFl = true;
_graphicsManager._scrollOffset = 0;
- _globals.PLAN_FLAG = false;
+ _globals._cityMapEnabledFl = false;
_globals.iRegul = 1;
_soundManager.WSOUND(26);
_linesManager._route = (int16 *)g_PTRNUL;
@@ -2723,7 +2723,7 @@ void HopkinsEngine::OCEAN_HOME() {
}
void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, int16 defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) {
- _globals.PLAN_FLAG = false;
+ _globals._cityMapEnabledFl = false;
_graphicsManager._noFadingFl = false;
_globals.NOMARCHE = false;
_globals._exitId = 0;
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index 3453c2b408..1804458e06 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -44,9 +44,9 @@ ObjectsManager::ObjectsManager() {
_borderPos = Common::Point(0, 0);
_borderSpriteIndex = 0;
_saveLoadX = _saveLoadY = 0;
- I_old_x = I_old_y = 0;
+ _oldInventoryPosX = _oldInventoryPosY = 0;
g_old_x = g_old_y = 0;
- FLAG_VISIBLE_EFFACE = 0;
+ _eraseVisibleCounter = 0;
_saveLoadSprite = g_PTRNUL;
_saveLoadSprite2 = g_PTRNUL;
_spritePtr = g_PTRNUL;
@@ -55,7 +55,6 @@ ObjectsManager::ObjectsManager() {
_saveLoadFl = false;
_visibleFl = false;
BOBTOUS = false;
- my_anim = 0;
_zoneNum = 0;
_forceZoneFl = false;
_changeVerbFl = false;
@@ -345,7 +344,7 @@ void ObjectsManager::displaySprite() {
int idx = arr[sortIdx];
switch (_vm->_globals._sortedDisplay[idx]._sortMode) {
case SORT_BOB:
- DEF_BOB(_vm->_globals._sortedDisplay[idx]._index);
+ setBobInfo(_vm->_globals._sortedDisplay[idx]._index);
break;
case SORT_SPRITE:
DEF_SPRITE(_vm->_globals._sortedDisplay[idx]._index);
@@ -362,7 +361,7 @@ void ObjectsManager::displaySprite() {
for (int idx = 1; idx < (_vm->_globals._sortedDisplayCount + 1); ++idx) {
switch (_vm->_globals._sortedDisplay[idx]._sortMode) {
case SORT_BOB:
- DEF_BOB(_vm->_globals._sortedDisplay[idx]._index);
+ setBobInfo(_vm->_globals._sortedDisplay[idx]._index);
break;
case SORT_SPRITE:
DEF_SPRITE(_vm->_globals._sortedDisplay[idx]._index);
@@ -404,21 +403,21 @@ void ObjectsManager::displaySprite() {
// If the Options dialog is activated, draw the elements
if (_vm->_globals._optionDialogFl) {
- _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR,
+ _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr,
_vm->_eventsManager._startPos.x + 464, 407, 0);
- _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR,
+ _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr,
_vm->_eventsManager._startPos.x + 657, 556, _vm->_globals._menuSpeed);
- _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR,
+ _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr,
_vm->_eventsManager._startPos.x + 731, 495, _vm->_globals._menuTextOff);
- _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR,
+ _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr,
_vm->_eventsManager._startPos.x + 731, 468, _vm->_globals._menuVoiceOff);
- _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR,
+ _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr,
_vm->_eventsManager._startPos.x + 731, 441, _vm->_globals._menuSoundOff);
- _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR,
+ _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr,
_vm->_eventsManager._startPos.x + 731, 414, _vm->_globals._menuMusicOff);
- _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR,
+ _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr,
_vm->_eventsManager._startPos.x + 600, 522, _vm->_globals._menuDisplayType);
- _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR,
+ _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr,
_vm->_eventsManager._startPos.x + 611, 502, _vm->_globals._menuScrollSpeed);
_vm->_graphicsManager.addVesaSegment(_vm->_eventsManager._startPos.x + 164, 107, _vm->_eventsManager._startPos.x + 498, 320);
}
@@ -464,12 +463,12 @@ void ObjectsManager::displaySprite() {
_vm->_dialogsManager.inventAnim();
}
-void ObjectsManager::INIT_BOB() {
+void ObjectsManager::initBob() {
for (int idx = 0; idx < 35; ++idx)
- BOB_ZERO(idx);
+ resetBob(idx);
}
-void ObjectsManager::BOB_ZERO(int idx) {
+void ObjectsManager::resetBob(int idx) {
BobItem &bob = _vm->_globals._bob[idx];
ListeItem &item = _vm->_globals.Liste2[idx];
@@ -478,7 +477,7 @@ void ObjectsManager::BOB_ZERO(int idx) {
bob._xp = 0;
bob._yp = 0;
bob._frameIndex = 0;
- bob.field10 = false;
+ bob._animDataIdx = 0;
bob.field12 = 0;
bob.field14 = 0;
bob._disabledAnimationFl = false;
@@ -500,7 +499,7 @@ void ObjectsManager::BOB_ZERO(int idx) {
item._height = 0;
}
-void ObjectsManager::DEF_BOB(int idx) {
+void ObjectsManager::setBobInfo(int idx) {
if (!_vm->_globals._bob[idx]._activeFl)
return;
@@ -556,7 +555,7 @@ void ObjectsManager::BOB_VISU(int idx) {
if (_vm->_globals._bob[idx].field0)
return;
- BOB_ZERO(idx);
+ resetBob(idx);
const byte *data = _vm->_globals.Bqe_Anim[idx]._data;
int bankIdx = (int16)READ_LE_UINT16(data);
@@ -853,17 +852,17 @@ void ObjectsManager::computeSprite(int idx) {
}
}
- int v15 = _sprite[idx]._spritePos.x - deltaX;
- int v16 = _sprite[idx]._spritePos.y - deltaY;
- _sprite[idx]._destX = v15;
- _sprite[idx]._destY = v16;
+ int newPosX = _sprite[idx]._spritePos.x - deltaX;
+ int newPosY = _sprite[idx]._spritePos.y - deltaY;
+ _sprite[idx]._destX = newPosX;
+ _sprite[idx]._destY = newPosY;
_sprite[idx].field2A = true;
_sprite[idx]._zoomPct = zoomPercent;
_sprite[idx]._reducePct = reducePercent;
_vm->_globals.Liste[idx]._visibleFl = true;
- _vm->_globals.Liste[idx]._posX = v15;
- _vm->_globals.Liste[idx]._posY = v16;
+ _vm->_globals.Liste[idx]._posX = newPosX;
+ _vm->_globals.Liste[idx]._posY = newPosY;
int width = getWidth(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex);
int height = getHeight(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex);
@@ -924,20 +923,20 @@ void ObjectsManager::displayBobAnim() {
continue;
}
- byte *v20 = _vm->_globals._bob[idx]._animData + 20;
- int v24 = _vm->_globals._bob[idx].field10;
- _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v20 + 2 * v24);
+ byte *dataPtr = _vm->_globals._bob[idx]._animData + 20;
+ int dataIdx = _vm->_globals._bob[idx]._animDataIdx;
+ _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx);
if (_vm->_globals._lockedAnims[idx]._enableFl)
_vm->_globals._bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX;
if ( PERSO_ON && idx > 20 )
_vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x;
- _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2);
- _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4);
- _vm->_globals._bob[idx]._zoomFactor = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6);
- _vm->_globals._bob[idx]._frameIndex = v20[2 * v24 + 8];
- _vm->_globals._bob[idx]._flipFl = (v20[2 * v24 + 9] != 0);
- _vm->_globals._bob[idx].field10 += 5;
+ _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 2);
+ _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 4);
+ _vm->_globals._bob[idx]._zoomFactor = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 6);
+ _vm->_globals._bob[idx]._frameIndex = dataPtr[2 * dataIdx + 8];
+ _vm->_globals._bob[idx]._flipFl = (dataPtr[2 * dataIdx + 9] != 0);
+ _vm->_globals._bob[idx]._animDataIdx += 5;
int v5 = _vm->_globals._bob[idx].field12;
if (v5 > 0) {
@@ -958,7 +957,7 @@ void ObjectsManager::displayBobAnim() {
if (_vm->_globals._bob[idx].field20 != -1 && _vm->_globals._bob[idx].field20 <= 0) {
_vm->_globals._bob[idx].field0 = 11;
} else {
- _vm->_globals._bob[idx].field10 = 0;
+ _vm->_globals._bob[idx]._animDataIdx = 0;
byte *v21 = _vm->_globals._bob[idx]._animData + 20;
_vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v21);
@@ -972,7 +971,7 @@ void ObjectsManager::displayBobAnim() {
_vm->_globals._bob[idx]._zoomFactor = (int16)READ_LE_UINT16(v21 + 6);
_vm->_globals._bob[idx]._frameIndex = v21[8];
_vm->_globals._bob[idx]._flipFl = (v21[9] != 0);
- _vm->_globals._bob[idx].field10 += 5;
+ _vm->_globals._bob[idx]._animDataIdx += 5;
int v10 = _vm->_globals._bob[idx].field12;
if (v10 > 0) {
@@ -1254,12 +1253,12 @@ void ObjectsManager::checkZone() {
int mouseX = _vm->_eventsManager.getMouseX();
int mouseY = _vm->_eventsManager.getMouseY();
int oldMouseY = mouseY;
- if (_vm->_globals.PLAN_FLAG
+ if (_vm->_globals._cityMapEnabledFl
|| _vm->_eventsManager._startPos.x >= mouseX
|| (mouseY = _vm->_graphicsManager._scrollOffset + 54, mouseX >= mouseY)
|| (mouseY = oldMouseY - 1, mouseY < 0 || mouseY > 59)) {
if (_visibleFl)
- FLAG_VISIBLE_EFFACE = 4;
+ _eraseVisibleCounter = 4;
_visibleFl = false;
} else {
_visibleFl = true;
@@ -1331,7 +1330,7 @@ void ObjectsManager::checkZone() {
if (zoneId != -1 && zoneId != 0)
handleRightButton();
}
- if ((_vm->_globals.PLAN_FLAG && zoneId == -1) || !zoneId) {
+ if ((_vm->_globals._cityMapEnabledFl && zoneId == -1) || !zoneId) {
_verb = 0;
_vm->_eventsManager._mouseCursorId = 0;
_vm->_eventsManager.changeMouseCursor(0);
@@ -1692,9 +1691,6 @@ void ObjectsManager::GOHOME2() {
else if (_vm->_globals._lastDirection == 7)
setSpriteIndex(0, 7);
- if (my_anim++ > 1)
- my_anim = 0;
-
return;
}
}
@@ -1708,7 +1704,6 @@ void ObjectsManager::GOHOME2() {
setSpriteIndex(0, 3);
_vm->_linesManager._route = (int16 *)g_PTRNUL;
- my_anim = 0;
}
/**
@@ -1788,12 +1783,12 @@ void ObjectsManager::loadZone(const Common::String &file) {
_vm->_linesManager.CARRE_ZONE();
}
-void ObjectsManager::PLAN_BETA() {
+void ObjectsManager::handleCityMap() {
_vm->_dialogsManager._inventFl = false;
_vm->_eventsManager._gameKey = KEY_NONE;
_vm->_linesManager.setMaxLineIdx(1);
_vm->_globals._characterMaxPosY = 440;
- _vm->_globals.PLAN_FLAG = true;
+ _vm->_globals._cityMapEnabledFl = true;
_vm->_graphicsManager._noFadingFl = false;
_vm->_globals.NOMARCHE = false;
_spritePtr = g_PTRNUL;
@@ -1821,7 +1816,6 @@ void ObjectsManager::PLAN_BETA() {
}
addStaticSprite(_spritePtr, Common::Point(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY), 0, 1, 0, false, 5, 5);
_vm->_eventsManager.setMouseXY(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY);
- my_anim = 0;
_vm->_eventsManager.mouseOn();
_vm->_graphicsManager.scrollScreen(getSpriteX(0) - 320);
_vm->_graphicsManager._scrollOffset = getSpriteX(0) - 320;
@@ -1883,7 +1877,7 @@ void ObjectsManager::PLAN_BETA() {
removeSprite(0);
_spritePtr = _vm->_globals.freeMemory(_spritePtr);
clearScreen();
- _vm->_globals.PLAN_FLAG = false;
+ _vm->_globals._cityMapEnabledFl = false;
}
/**
@@ -1894,7 +1888,7 @@ void ObjectsManager::handleLeftButton() {
int destX = _vm->_eventsManager.getMouseX();
int destY = _vm->_eventsManager.getMouseY();
- if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG &&
+ if (!_vm->_dialogsManager._inventFl && !_vm->_globals._cityMapEnabledFl &&
destX > _vm->_graphicsManager._scrollOffset - 30 && destX < _vm->_graphicsManager._scrollOffset + 50 &&
destY > -30 && destY < 50) {
int oldMouseCursor = _vm->_eventsManager._mouseCursorId;
@@ -1908,29 +1902,29 @@ void ObjectsManager::handleLeftButton() {
}
return;
}
- if (_vm->_globals._saveData->_data[svField354] == 1 && !_vm->_globals.PLAN_FLAG
+ if (_vm->_globals._saveData->_data[svField354] == 1 && !_vm->_globals._cityMapEnabledFl
&& destX >= 533 && destX <= 559 && destY >= 26 && destY <= 59) {
changeCharacterHead(CHARACTER_HOPKINS_CLONE, CHARACTER_HOPKINS);
return;
}
- if (_vm->_globals._saveData->_data[svField356] == 1 && !_vm->_globals.PLAN_FLAG
+ if (_vm->_globals._saveData->_data[svField356] == 1 && !_vm->_globals._cityMapEnabledFl
&& destX >= 533 && destX <= 559 && destY >= 26 && destY <= 48) {
changeCharacterHead(CHARACTER_SAMANTHA, CHARACTER_HOPKINS);
return;
}
if (_vm->_globals._saveData->_data[svField357] == 1) {
- if (_vm->_globals._saveData->_data[svField353] == 1 && !_vm->_globals.PLAN_FLAG
+ if (_vm->_globals._saveData->_data[svField353] == 1 && !_vm->_globals._cityMapEnabledFl
&& destX >= 533 && destX <= 559 && destY >= 26 && destY <= 59) {
changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_HOPKINS_CLONE);
return;
}
- if (_vm->_globals._saveData->_data[svField355] == 1 && !_vm->_globals.PLAN_FLAG
+ if (_vm->_globals._saveData->_data[svField355] == 1 && !_vm->_globals._cityMapEnabledFl
&& destX >= 567 && destX <= 593 && destY >= 26 && destY <= 59) {
changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_SAMANTHA);
return;
}
}
- if (_vm->_globals.PLAN_FLAG && _vm->_globals.GOACTION) {
+ if (_vm->_globals._cityMapEnabledFl && _vm->_globals.GOACTION) {
checkZone();
if (_zoneNum <= 0)
return;
@@ -1953,7 +1947,7 @@ void ObjectsManager::handleLeftButton() {
_vm->_globals._saveData->_data[svField2] = 0;
}
- if (_vm->_globals.PLAN_FLAG && (_vm->_eventsManager._mouseCursorId != 4 || _zoneNum <= 0))
+ if (_vm->_globals._cityMapEnabledFl && (_vm->_eventsManager._mouseCursorId != 4 || _zoneNum <= 0))
return;
if (_zoneNum != -1 && _zoneNum != 0) {
if (_vm->_globals.ZONEP[_zoneNum]._destX && _vm->_globals.ZONEP[_zoneNum]._destY && _vm->_globals.ZONEP[_zoneNum]._destY != 31) {
@@ -1989,7 +1983,7 @@ void ObjectsManager::handleLeftButton() {
goto LABEL_65;
}
if (!_vm->_globals.NOMARCHE) {
- if (!_vm->_globals.PLAN_FLAG) {
+ if (!_vm->_globals._cityMapEnabledFl) {
_vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY);
if (_vm->_linesManager._route != (int16 *)g_PTRNUL)
_vm->_linesManager.PACOURS_PROPRE(_vm->_linesManager._route);
@@ -2003,7 +1997,7 @@ LABEL_63:
_vm->_linesManager._route = oldRoute;
}
LABEL_65:
- if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG)
+ if (!_vm->_globals.NOMARCHE && _vm->_globals._cityMapEnabledFl)
_vm->_linesManager._route = _vm->_linesManager.cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY);
}
if (_zoneNum != -1 && _zoneNum != 0) {
@@ -2012,7 +2006,7 @@ LABEL_65:
else
_vm->_globals._saveData->_data[svField1] = _vm->_eventsManager._mouseCursorId;
- if (_vm->_globals.PLAN_FLAG)
+ if (_vm->_globals._cityMapEnabledFl)
_vm->_globals._saveData->_data[svField1] = 6;
_vm->_globals._saveData->_data[svField2] = _zoneNum;
_vm->_globals._saveData->_data[svField3] = _curObjectIndex;
@@ -2106,7 +2100,7 @@ void ObjectsManager::PARADISE() {
_vm->_globals._saveData->_data[svField1] = 0;
_vm->_globals._saveData->_data[svField2] = 0;
}
- if (_vm->_globals.PLAN_FLAG) {
+ if (_vm->_globals._cityMapEnabledFl) {
_vm->_eventsManager._mouseCursorId = 0;
_vm->_eventsManager.changeMouseCursor(0);
}
@@ -2153,7 +2147,6 @@ void ObjectsManager::clearScreen() {
_changeVerbFl = false;
_vm->_linesManager._route = (int16 *)g_PTRNUL;
_vm->_globals._oldDirection = -1;
- my_anim = 1;
_vm->_graphicsManager.RESET_SEGMENT_VESA();
}
@@ -3059,14 +3052,13 @@ void ObjectsManager::disableZone(int idx) {
} else {
_vm->_globals.ZONEP[idx]._enabledFl = false;
}
-
}
-void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int animAction) {
+void ObjectsManager::OPTI_ONE(int idx, int animIdx, int destPosi, int animAction) {
// Set Hopkins animation and position
if (animAction != 3) {
setBobAnimation(idx);
- SET_BOBPOSI(idx, fromPosi);
+ SET_BOBPOSI(idx, animIdx);
}
// Make Hopkins walk to the expected place
@@ -3085,7 +3077,7 @@ void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int animActio
}
int ObjectsManager::BOBPOSI(int idx) {
- return _vm->_globals._bob[idx].field10 / 5;
+ return _vm->_globals._bob[idx]._animDataIdx / 5;
}
/**
@@ -3096,7 +3088,7 @@ void ObjectsManager::setBobAnimation(int idx) {
return;
_vm->_globals._bob[idx]._disabledAnimationFl = false;
- _vm->_globals._bob[idx].field10 = 5;
+ _vm->_globals._bob[idx]._animDataIdx = 5;
_vm->_globals._bob[idx]._frameIndex = 250;
_vm->_globals._bob[idx].field12 = 0;
_vm->_globals._bob[idx].field14 = 0;
@@ -3109,8 +3101,8 @@ void ObjectsManager::stopBobAnimation(int idx) {
_vm->_globals._bob[idx]._disabledAnimationFl = true;
}
-void ObjectsManager::SET_BOBPOSI(int idx, int a2) {
- _vm->_globals._bob[idx].field10 = 5 * a2;
+void ObjectsManager::SET_BOBPOSI(int idx, int animIdx) {
+ _vm->_globals._bob[idx]._animDataIdx = 5 * animIdx;
_vm->_globals._bob[idx].field12 = 0;
_vm->_globals._bob[idx].field14 = 0;
}
@@ -3403,7 +3395,7 @@ void ObjectsManager::SPECIAL_INI() {
}
}
-void ObjectsManager::OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, int a6) {
+void ObjectsManager::OPTI_BOBON(int idx1, int idx2, int idx3, int anim1Idx, int anim2Idx, int anim3Idx) {
if (idx1 != -1)
setBobAnimation(idx1);
if (idx2 != -1)
@@ -3411,20 +3403,20 @@ void ObjectsManager::OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, in
if (idx3 != -1)
setBobAnimation(idx3);
if (idx1 != -1)
- SET_BOBPOSI(idx1, a4);
+ SET_BOBPOSI(idx1, anim1Idx);
if (idx2 != -1)
- SET_BOBPOSI(idx2, a5);
+ SET_BOBPOSI(idx2, anim2Idx);
if (idx3 != -1)
- SET_BOBPOSI(idx3, a6);
+ SET_BOBPOSI(idx3, anim3Idx);
}
-void ObjectsManager::SCI_OPTI_ONE(int idx, int a2, int a3, int a4) {
+void ObjectsManager::SCI_OPTI_ONE(int idx, int animIdx, int a3, int a4) {
_vm->_eventsManager._curMouseButton = 0;
_vm->_eventsManager._mouseButton = 0;
if (a4 != 3) {
setBobAnimation(idx);
- SET_BOBPOSI(idx, a2);
+ SET_BOBPOSI(idx, animIdx);
}
do {
@@ -3786,7 +3778,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo
_vm->_eventsManager._gameKey = KEY_NONE;
_vm->_dialogsManager._removeInventFl = false;
_vm->_graphicsManager._scrollOffset = 0;
- _vm->_globals.PLAN_FLAG = false;
+ _vm->_globals._cityMapEnabledFl = false;
_vm->_globals.iRegul = 1;
_vm->_soundManager.WSOUND(v);
_vm->_linesManager._route = (int16 *)g_PTRNUL;
@@ -3876,7 +3868,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm
_verb = 4;
_vm->_graphicsManager._scrollOffset = 0;
_vm->_dialogsManager._removeInventFl = false;
- _vm->_globals.PLAN_FLAG = false;
+ _vm->_globals._cityMapEnabledFl = false;
_vm->_graphicsManager._noFadingFl = false;
_vm->_globals.NOMARCHE = false;
_vm->_globals._exitId = 0;
diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h
index 5f6633d82b..5e2f0c043d 100644
--- a/engines/hopkins/objects.h
+++ b/engines/hopkins/objects.h
@@ -64,9 +64,9 @@ public:
Common::Point _borderPos;
int _borderSpriteIndex;
int _saveLoadX, _saveLoadY;
- int I_old_x, I_old_y;
+ int _oldInventoryPosX, _oldInventoryPosY;
int g_old_x, g_old_y;
- int FLAG_VISIBLE_EFFACE;
+ int _eraseVisibleCounter;
byte *_saveLoadSprite;
byte *_saveLoadSprite2;
byte *_spritePtr;
@@ -75,7 +75,6 @@ public:
bool _saveLoadFl;
bool _visibleFl;
bool BOBTOUS;
- int my_anim;
int _zoneNum;
bool _forceZoneFl;
bool _changeVerbFl;
@@ -113,9 +112,9 @@ public:
void capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex);
void addObject(int objIndex);
- void INIT_BOB();
- void BOB_ZERO(int idx);
- void DEF_BOB(int idx);
+ void initBob();
+ void resetBob(int idx);
+ void setBobInfo(int idx);
void BOB_VISU(int idx);
void BOB_OFF(int idx);
void BOB_OFFSET(int idx, int offset);
@@ -146,7 +145,7 @@ public:
void GOHOME();
void GOHOME2();
void loadZone(const Common::String &file);
- void PLAN_BETA();
+ void handleCityMap();
void handleLeftButton();
void PARADISE();
void clearScreen();
@@ -178,19 +177,19 @@ public:
void enableZone(int idx);
void disableZone(int idx);
- void OPTI_ONE(int idx, int fromPosi, int destPosi, int animAction);
+ void OPTI_ONE(int idx, int animIdx, int destPosi, int animAction);
int BOBPOSI(int idx);
void setBobAnimation(int idx);
void stopBobAnimation(int idx);
- void SET_BOBPOSI(int idx, int a2);
+ void SET_BOBPOSI(int idx, int animIdx);
int getBobPosX(int idx);
int getBobPosY(int idx);
int getBobFrameIndex(int idx);
void INILINK(const Common::String &file);
void SPECIAL_INI();
- void OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, int a6);
- void SCI_OPTI_ONE(int idx, int a2, int a3, int a4);
+ void OPTI_BOBON(int idx1, int idx2, int idx3, int anim1Idx, int anim2Idx, int anim3Idx);
+ void SCI_OPTI_ONE(int idx, int animIdx, int a3, int a4);
void disableVerb(int idx, int a2);
void enableVerb(int idx, int a2);
diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp
index d655b95822..1bea537f3c 100644
--- a/engines/hopkins/talk.cpp
+++ b/engines/hopkins/talk.cpp
@@ -482,7 +482,7 @@ void TalkManager::dialogTalk() {
for (int idx = 26; idx <= 30; ++idx) {
if (_vm->_globals.Bqe_Anim[idx]._enabledFl)
- _vm->_objectsManager.BOB_ZERO(idx);
+ _vm->_objectsManager.resetBob(idx);
}
}
@@ -497,7 +497,7 @@ void TalkManager::dialogEndTalk() {
for (int idx = 21; idx <= 25; ++idx) {
if (_vm->_globals.Bqe_Anim[idx]._enabledFl)
- _vm->_objectsManager.BOB_ZERO(idx);
+ _vm->_objectsManager.resetBob(idx);
}
}
@@ -608,7 +608,7 @@ void TalkManager::BOB_VISU_PARLE(int idx) {
_vm->_objectsManager._priorityFl = true;
if (!_vm->_globals._bob[idx].field0) {
- _vm->_objectsManager.BOB_ZERO(idx);
+ _vm->_objectsManager.resetBob(idx);
v5 = _vm->_globals.Bqe_Anim[idx]._data;
v4 = (int16)READ_LE_UINT16(v5 + 2);
if (!v4)