aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hopkins/globals.cpp100
-rw-r--r--engines/hopkins/globals.h30
-rw-r--r--engines/hopkins/hopkins.cpp4
-rw-r--r--engines/hopkins/objects.cpp124
-rw-r--r--engines/hopkins/objects.h1
-rw-r--r--engines/hopkins/script.cpp28
-rw-r--r--engines/hopkins/talk.cpp5
7 files changed, 143 insertions, 149 deletions
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp
index 4e5ea6a4c2..2497f3281e 100644
--- a/engines/hopkins/globals.cpp
+++ b/engines/hopkins/globals.cpp
@@ -68,8 +68,6 @@ Globals::Globals() {
strcpy((char *)g_PTRNUL, "POINTERNULL");
// Initialize array properties
- for (int i = 0; i < 6; ++i)
- CACHE_BANQUE[i] = g_PTRNUL;
for (int i = 0; i < 35; ++i)
Common::fill((byte *)&_animBqe[i], (byte *)&_animBqe[i] + sizeof(BqeAnimItem), 0);
for (int i = 0; i < 8; ++i)
@@ -85,7 +83,7 @@ Globals::Globals() {
for (int i = 0; i < 300; ++i)
Common::fill((byte *)&ObjetW[i], (byte *)&ObjetW[i] + sizeof(ObjetWItem), 0);
for (int i = 0; i < 25; ++i)
- Common::fill((byte *)&Cache[i], (byte *)&Cache[i] + sizeof(CacheItem), 0);
+ Common::fill((byte *)&_hidingItem[i], (byte *)&_hidingItem[i] + sizeof(HidingItem), 0);
for (int i = 0; i < 500; ++i)
_spriteSize[i] = 0;
@@ -143,9 +141,9 @@ Globals::Globals() {
_oceanDirection = DIR_NONE;
// Initialize pointers
+ for (int i = 0; i < 6; ++i)
+ _hidingItemData[i] = g_PTRNUL;
BUF_ZONE = NULL;
- for (int idx = 0; idx < 6; ++idx)
- CACHE_BANQUE[idx] = NULL;
SPRITE_ECRAN = NULL;
_saveData = NULL;
_inventoryObject = NULL;
@@ -159,7 +157,7 @@ Globals::Globals() {
_disableInventFl = false;
_freezeCharacterFl = false;
_optionDialogFl = false;
- _cacheFl = false;
+ _hidingActiveFl = false;
_introSpeechOffFl = false;
_baseMapColor = 50;
@@ -180,7 +178,7 @@ Globals::Globals() {
Globals::~Globals() {
freeMemory(BUF_ZONE);
for (int idx = 0; idx < 6; ++idx)
- CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]);
+ _hidingItemData[idx] = freeMemory(_hidingItemData[idx]);
freeMemory(SPRITE_ECRAN);
freeMemory((byte *)_saveData);
freeMemory(_inventoryObject);
@@ -188,7 +186,7 @@ Globals::~Globals() {
freeMemory(ADR_FICHIER_OBJ);
freeMemory(PERSO);
- CLEAR_VBOB();
+ clearVBob();
free(g_PTRNUL);
}
@@ -235,15 +233,15 @@ void Globals::setConfig() {
void Globals::clearAll() {
for (int idx = 0; idx < 6; ++idx)
- CACHE_BANQUE[idx] = g_PTRNUL;
+ _hidingItemData[idx] = g_PTRNUL;
- INIT_ANIM();
+ initAnimBqe();
_boxWidth = 0;
_vm->_fontManager.clearAll();
- INIT_VBOB();
+ initVBob();
ADR_FICHIER_OBJ = g_PTRNUL;
NUM_FICHIER_OBJ = 0;
_vm->_eventsManager._objectBuf = g_PTRNUL;
@@ -283,7 +281,7 @@ void Globals::loadCharacterData() {
_oldDirection = DIR_NONE;
}
-void Globals::INIT_ANIM() {
+void Globals::initAnimBqe() {
for (int idx = 0; idx < 35; ++idx) {
_animBqe[idx]._data = g_PTRNUL;
_animBqe[idx]._enabledFl = false;
@@ -297,7 +295,7 @@ void Globals::INIT_ANIM() {
}
}
-void Globals::INIT_VBOB() {
+void Globals::initVBob() {
for (int idx = 0; idx < 30; ++idx) {
VBob[idx].field4 = 0;
VBob[idx]._xp = 0;
@@ -309,7 +307,7 @@ void Globals::INIT_VBOB() {
}
}
-void Globals::CLEAR_VBOB() {
+void Globals::clearVBob() {
for (int idx = 0; idx < 30; ++idx) {
VBob[idx].field4 = 0;
VBob[idx]._xp = 0;
@@ -353,34 +351,34 @@ byte *Globals::freeMemory(byte *p) {
return g_PTRNUL;
}
-// Reset Cache
-void Globals::resetCache() {
+// Reset Hiding Items
+void Globals::resetHidingItems() {
for (int idx = 1; idx <= 5; ++idx) {
- CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]);
+ _hidingItemData[idx] = freeMemory(_hidingItemData[idx]);
}
for (int idx = 0; idx <= 20; ++idx) {
- Cache[idx]._spriteData = g_PTRNUL;
- Cache[idx]._x = 0;
- Cache[idx]._y = 0;
- Cache[idx]._spriteIndex = 0;
- Cache[idx]._useCount = 0;
- Cache[idx]._width = 0;
- Cache[idx]._height = 0;
- Cache[idx].field10 = false;
- Cache[idx].field14 = 0;
+ _hidingItem[idx]._spriteData = g_PTRNUL;
+ _hidingItem[idx]._x = 0;
+ _hidingItem[idx]._y = 0;
+ _hidingItem[idx]._spriteIndex = 0;
+ _hidingItem[idx]._useCount = 0;
+ _hidingItem[idx]._width = 0;
+ _hidingItem[idx]._height = 0;
+ _hidingItem[idx].field10 = false;
+ _hidingItem[idx].field14 = 0;
}
- _cacheFl = false;
+ _hidingActiveFl = false;
}
-void Globals::CACHE_ON() {
- _cacheFl = true;
+void Globals::enableHiding() {
+ _hidingActiveFl = true;
}
-void Globals::CACHE_OFF() {
- _cacheFl = false;
+void Globals::disableHiding() {
+ _hidingActiveFl = false;
}
void Globals::B_CACHE_OFF(int idx) {
@@ -388,17 +386,17 @@ void Globals::B_CACHE_OFF(int idx) {
_vm->_objectsManager._bob[idx].field34 = true;
}
-void Globals::CACHE_SUB(int idx) {
- Cache[idx]._useCount = 0;
+void Globals::resetHidingUseCount(int idx) {
+ _hidingItem[idx]._useCount = 0;
}
-void Globals::CACHE_ADD(int idx) {
- Cache[idx]._useCount = 1;
+void Globals::setHidingUseCount(int idx) {
+ _hidingItem[idx]._useCount = 1;
}
-// Load Cache
-void Globals::loadCache(const Common::String &file) {
- resetCache();
+// Load Hiding Items
+void Globals::loadHidingItems(const Common::String &file) {
+ resetHidingItems();
byte *ptr = _vm->_fileManager.loadFile(file);
Common::String filename = Common::String((const char *)ptr);
@@ -407,27 +405,27 @@ void Globals::loadCache(const Common::String &file) {
return;
byte *spriteData = _vm->_fileManager.loadFile(filename);
- CACHE_BANQUE[1] = spriteData;
+ _hidingItemData[1] = spriteData;
int curBufIdx = 60;
for (int i = 0; i <= 21; i++) {
- Cache[i]._spriteIndex = READ_LE_INT16((uint16 *)ptr + curBufIdx);
- Cache[i]._x = READ_LE_INT16((uint16 *)ptr + curBufIdx + 1);
- Cache[i]._y = READ_LE_INT16((uint16 *)ptr + curBufIdx + 2);
- Cache[i].field14 = READ_LE_INT16((uint16 *)ptr + curBufIdx + 4);
+ _hidingItem[i]._spriteIndex = READ_LE_INT16((uint16 *)ptr + curBufIdx);
+ _hidingItem[i]._x = READ_LE_INT16((uint16 *)ptr + curBufIdx + 1);
+ _hidingItem[i]._y = READ_LE_INT16((uint16 *)ptr + curBufIdx + 2);
+ _hidingItem[i].field14 = READ_LE_INT16((uint16 *)ptr + curBufIdx + 4);
if (spriteData == g_PTRNUL) {
- Cache[i]._useCount = 0;
+ _hidingItem[i]._useCount = 0;
} else {
- Cache[i]._spriteData = spriteData;
- Cache[i]._width = _vm->_objectsManager.getWidth(spriteData, Cache[i]._spriteIndex);
- Cache[i]._height = _vm->_objectsManager.getHeight(spriteData, Cache[i]._spriteIndex);
- Cache[i]._useCount = 1;
+ _hidingItem[i]._spriteData = spriteData;
+ _hidingItem[i]._width = _vm->_objectsManager.getWidth(spriteData, _hidingItem[i]._spriteIndex);
+ _hidingItem[i]._height = _vm->_objectsManager.getHeight(spriteData, _hidingItem[i]._spriteIndex);
+ _hidingItem[i]._useCount = 1;
}
- if ( !Cache[i]._x && !Cache[i]._y && !Cache[i]._spriteIndex)
- Cache[i]._useCount = 0;
+ if ( !_hidingItem[i]._x && !_hidingItem[i]._y && !_hidingItem[i]._spriteIndex)
+ _hidingItem[i]._useCount = 0;
curBufIdx += 5;
}
- CACHE_ON();
+ enableHiding();
freeMemory(ptr);
}
diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h
index 61fb3f880f..700fead351 100644
--- a/engines/hopkins/globals.h
+++ b/engines/hopkins/globals.h
@@ -94,7 +94,7 @@ struct SortItem {
int _priority;
};
-struct CacheItem {
+struct HidingItem {
int _x;
int _spriteIndex;
int _y;
@@ -239,8 +239,8 @@ private:
byte *_inventoryObject;
- void INIT_ANIM();
- void INIT_VBOB();
+ void initAnimBqe();
+ void initVBob();
public:
bool _disableInventFl;
@@ -248,7 +248,7 @@ public:
bool _linuxEndDemoFl;
bool _censorshipFl;
bool _introSpeechOffFl;
- bool _cacheFl;
+ bool _hidingActiveFl;
bool _forceHideText;
int _exitId;
Directions _oceanDirection;
@@ -308,10 +308,12 @@ public:
bool _actionMoveTo;
bool _freezeCharacterFl;
bool _checkDistanceFl;
+ byte *_hidingItemData[6];
+ HidingItem _hidingItem[25];
+ BqeAnimItem _animBqe[35];
int iRegul;
byte *BUF_ZONE;
- BqeAnimItem _animBqe[35];
byte *SPRITE_ECRAN;
byte *PERSO;
ObjetWItem ObjetW[300];
@@ -320,8 +322,6 @@ public:
ListeItem Liste[6];
ListeItem Liste2[35];
BankItem Bank[8];
- byte *CACHE_BANQUE[6];
- CacheItem Cache[25];
VBobItem VBob[30];
int Compteur;
int compteur_71;
@@ -337,15 +337,15 @@ public:
void loadObjects();
void clearAll();
void loadCharacterData();
- void resetCache();
- void loadCache(const Common::String &file);
-
- void CLEAR_VBOB();
- void CACHE_ON();
- void CACHE_OFF();
+ void resetHidingItems();
+ void loadHidingItems(const Common::String &file);
+ void enableHiding();
+ void disableHiding();
+ void resetHidingUseCount(int idx);
+ void setHidingUseCount(int idx);
+
+ void clearVBob();
void B_CACHE_OFF(int idx);
- void CACHE_SUB(int idx);
- void CACHE_ADD(int idx);
};
// Global null pointer
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index 162d49fb20..ccf431422e 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -2028,7 +2028,7 @@ void HopkinsEngine::BASED() {
_eventsManager.VBL();
_graphicsManager.fadeInLong();
- _globals.CACHE_ON();
+ _globals.enableHiding();
do
_eventsManager.VBL();
@@ -2036,7 +2036,7 @@ void HopkinsEngine::BASED() {
_graphicsManager.fadeOutLong();
_graphicsManager.endDisplayBob();
- _globals.resetCache();
+ _globals.resetHidingItems();
_globals._disableInventFl = false;
_globals._exitId = 93;
_globals.iRegul = 0;
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index 41b176c713..66b5135f69 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -346,7 +346,7 @@ void ObjectsManager::displaySprite() {
}
}
- if (_vm->_globals._cacheFl)
+ if (_vm->_globals._hidingActiveFl)
checkCache();
}
@@ -510,7 +510,6 @@ void ObjectsManager::resetBob(int idx) {
bob.field1E = 0;
bob.field20 = 0;
bob.field22 = 0;
- bob._offsetY = 0;
bob.field34 = false;
bob._zoomFactor = 0;
bob._flipFl = false;
@@ -591,7 +590,7 @@ void ObjectsManager::displayBob(int idx) {
int16 v9 = READ_LE_INT16(data + 2);
int16 v8 = READ_LE_INT16(data + 4);
- int16 offsetY = READ_LE_INT16(data + 6);
+ // data[6] isn't used, read skipped
int16 v6 = READ_LE_INT16(data + 8);
if (!v9)
@@ -614,7 +613,6 @@ void ObjectsManager::displayBob(int idx) {
_bob[idx].field1E = v9;
_bob[idx].field20 = v6;
_bob[idx].field22 = v8;
- _bob[idx]._offsetY = offsetY;
}
void ObjectsManager::hideBob(int idx) {
@@ -627,22 +625,22 @@ void ObjectsManager::BOB_OFFSET(int idx, int offset) {
}
void ObjectsManager::SCBOB(int idx) {
- if (_vm->_globals.Cache[idx]._useCount == 0)
+ if (_vm->_globals._hidingItem[idx]._useCount == 0)
return;
for (int i = 0; i <= 20; i++) {
if ((_bob[i].field0) && (!_bob[i]._disabledAnimationFl) && (!_bob[i].field34) && (_bob[i]._frameIndex != 250)) {
int oldRight = _bob[i]._oldX + _bob[i]._oldWidth;
int oldBottom = _bob[i]._oldY + _bob[i]._oldHeight;
- int cachedRight = _vm->_globals.Cache[idx]._width + _vm->_globals.Cache[idx]._x;
-
- if ((oldBottom > _vm->_globals.Cache[idx]._y) && (oldBottom < _vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx]._height + _vm->_globals.Cache[idx]._y)) {
- if ((oldRight >= _vm->_globals.Cache[idx]._x && oldRight <= cachedRight)
- || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x)
- || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x)
- || (_bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x && oldRight <= cachedRight)
- || (_bob[i]._oldWidth <= _vm->_globals.Cache[idx]._x && oldRight >= cachedRight))
- ++_vm->_globals.Cache[idx]._useCount;
+ int cachedRight = _vm->_globals._hidingItem[idx]._width + _vm->_globals._hidingItem[idx]._x;
+
+ if ((oldBottom > _vm->_globals._hidingItem[idx]._y) && (oldBottom < _vm->_globals._hidingItem[idx].field14 +_vm->_globals._hidingItem[idx]._height + _vm->_globals._hidingItem[idx]._y)) {
+ if ((oldRight >= _vm->_globals._hidingItem[idx]._x && oldRight <= cachedRight)
+ || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= _vm->_globals._hidingItem[idx]._x)
+ || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= _vm->_globals._hidingItem[idx]._x)
+ || (_bob[i]._oldWidth >= _vm->_globals._hidingItem[idx]._x && oldRight <= cachedRight)
+ || (_bob[i]._oldWidth <= _vm->_globals._hidingItem[idx]._x && oldRight >= cachedRight))
+ ++_vm->_globals._hidingItem[idx]._useCount;
}
}
}
@@ -733,41 +731,41 @@ void ObjectsManager::CALCUL_BOB(int idx) {
void ObjectsManager::checkCache() {
for (int cacheIdx = 0; cacheIdx <= 19; cacheIdx++) {
- if (_vm->_globals.Cache[cacheIdx]._useCount == 0)
+ if (_vm->_globals._hidingItem[cacheIdx]._useCount == 0)
continue;
- int _oldUseCount = _vm->_globals.Cache[cacheIdx]._useCount;
+ int _oldUseCount = _vm->_globals._hidingItem[cacheIdx]._useCount;
for (int spriteIdx = 0; spriteIdx <= 4; spriteIdx++) {
if (_sprite[spriteIdx]._animationType == 1 && _sprite[spriteIdx]._spriteIndex != 250) {
int right = _sprite[spriteIdx]._width + _sprite[spriteIdx]._destX;
int bottom = _sprite[spriteIdx]._height + _sprite[spriteIdx]._destY;
- int cachedRight = _vm->_globals.Cache[cacheIdx]._width + _vm->_globals.Cache[cacheIdx]._x;
-
- if (bottom > _vm->_globals.Cache[cacheIdx]._y && bottom < (_vm->_globals.Cache[cacheIdx].field14 + _vm->_globals.Cache[cacheIdx]._height + _vm->_globals.Cache[cacheIdx]._y)) {
- if ((right >= _vm->_globals.Cache[cacheIdx]._x && right <= cachedRight)
- || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX)
- || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX)
- || (_vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX && right <= cachedRight)
- || (_vm->_globals.Cache[cacheIdx]._x >= _sprite[spriteIdx]._destX && right >= cachedRight))
- ++_vm->_globals.Cache[cacheIdx]._useCount;
+ int cachedRight = _vm->_globals._hidingItem[cacheIdx]._width + _vm->_globals._hidingItem[cacheIdx]._x;
+
+ if (bottom > _vm->_globals._hidingItem[cacheIdx]._y && bottom < (_vm->_globals._hidingItem[cacheIdx].field14 + _vm->_globals._hidingItem[cacheIdx]._height + _vm->_globals._hidingItem[cacheIdx]._y)) {
+ if ((right >= _vm->_globals._hidingItem[cacheIdx]._x && right <= cachedRight)
+ || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals._hidingItem[cacheIdx]._x <= _sprite[spriteIdx]._destX)
+ || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals._hidingItem[cacheIdx]._x <= _sprite[spriteIdx]._destX)
+ || (_vm->_globals._hidingItem[cacheIdx]._x <= _sprite[spriteIdx]._destX && right <= cachedRight)
+ || (_vm->_globals._hidingItem[cacheIdx]._x >= _sprite[spriteIdx]._destX && right >= cachedRight))
+ ++_vm->_globals._hidingItem[cacheIdx]._useCount;
}
}
}
SCBOB(cacheIdx);
- if (_vm->_globals.Cache[cacheIdx]._useCount == _oldUseCount) {
- if (_vm->_globals.Cache[cacheIdx].field10) {
- _vm->_globals.Cache[cacheIdx].field10 = false;
- _vm->_globals.Cache[cacheIdx]._useCount = 1;
+ if (_vm->_globals._hidingItem[cacheIdx]._useCount == _oldUseCount) {
+ if (_vm->_globals._hidingItem[cacheIdx].field10) {
+ _vm->_globals._hidingItem[cacheIdx].field10 = false;
+ _vm->_globals._hidingItem[cacheIdx]._useCount = 1;
}
} else {
- int priority = _vm->_globals.Cache[cacheIdx].field14 + _vm->_globals.Cache[cacheIdx]._height + _vm->_globals.Cache[cacheIdx]._y;
+ int priority = _vm->_globals._hidingItem[cacheIdx].field14 + _vm->_globals._hidingItem[cacheIdx]._height + _vm->_globals._hidingItem[cacheIdx]._y;
if (priority > 440)
priority = 500;
beforeSort(SORT_CACHE, cacheIdx, priority);
- _vm->_globals.Cache[cacheIdx]._useCount = 1;
- _vm->_globals.Cache[cacheIdx].field10 = true;
+ _vm->_globals._hidingItem[cacheIdx]._useCount = 1;
+ _vm->_globals._hidingItem[cacheIdx].field10 = true;
}
}
}
@@ -811,12 +809,12 @@ void ObjectsManager::DEF_SPRITE(int idx) {
}
void ObjectsManager::displayCache(int idx) {
- _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.CACHE_BANQUE[1],
- _vm->_globals.Cache[idx]._x + 300, _vm->_globals.Cache[idx]._y + 300,
- _vm->_globals.Cache[idx]._spriteIndex);
+ _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._hidingItemData[1],
+ _vm->_globals._hidingItem[idx]._x + 300, _vm->_globals._hidingItem[idx]._y + 300,
+ _vm->_globals._hidingItem[idx]._spriteIndex);
- _vm->_graphicsManager.addVesaSegment(_vm->_globals.Cache[idx]._x, _vm->_globals.Cache[idx]._y,
- _vm->_globals.Cache[idx]._x + _vm->_globals.Cache[idx]._width, _vm->_globals.Cache[idx]._y + _vm->_globals.Cache[idx]._height);
+ _vm->_graphicsManager.addVesaSegment(_vm->_globals._hidingItem[idx]._x, _vm->_globals._hidingItem[idx]._y,
+ _vm->_globals._hidingItem[idx]._x + _vm->_globals._hidingItem[idx]._width, _vm->_globals._hidingItem[idx]._y + _vm->_globals._hidingItem[idx]._height);
}
// Compute Sprite
@@ -1749,7 +1747,7 @@ void ObjectsManager::handleCityMap() {
_vm->_globals.iRegul = 1;
_vm->_graphicsManager.loadImage("PLAN");
_vm->_linesManager.loadLines("PLAN.OB2");
- _vm->_globals.loadCache("PLAN.CA2");
+ _vm->_globals.loadHidingItems("PLAN.CA2");
loadZone("PLAN.ZO2");
_spritePtr = _vm->_fileManager.loadFile("VOITURE.SPR");
_vm->_animationManager.loadAnim("PLAN");
@@ -1759,7 +1757,7 @@ void ObjectsManager::handleCityMap() {
_vm->_globals.B_CACHE_OFF(i);
_vm->_globals.B_CACHE_OFF(19);
_vm->_globals.B_CACHE_OFF(20);
- _vm->_globals.CACHE_ON();
+ _vm->_globals.enableHiding();
if (!_mapCarPosX && !_mapCarPosY) {
_mapCarPosX = 900;
@@ -2066,11 +2064,11 @@ void ObjectsManager::clearScreen() {
_vm->_graphicsManager.endDisplayBob();
_vm->_fontManager.hideText(5);
_vm->_fontManager.hideText(9);
- _vm->_globals.CLEAR_VBOB();
+ _vm->_globals.clearVBob();
_vm->_animationManager.clearAnim();
_vm->_linesManager.clearAllZones();
_vm->_linesManager.resetLines();
- _vm->_globals.resetCache();
+ _vm->_globals.resetHidingItems();
for (int i = 0; i <= 48; i++) {
_vm->_linesManager.BOBZONE[i] = 0;
@@ -3074,42 +3072,42 @@ void ObjectsManager::loadLinkFile(const Common::String &file) {
for (int idx = 0; idx < 500; ++idx)
_vm->_globals._spriteSize[idx] = READ_LE_INT16((uint16 *)ptr + idx);
- _vm->_globals.resetCache();
+ _vm->_globals.resetHidingItems();
Common::String filename2 = Common::String((const char *)ptr + 1000);
if (!filename2.empty()) {
- _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.searchCat(filename2, 8);
+ _vm->_globals._hidingItemData[1] = _vm->_fileManager.searchCat(filename2, 8);
- if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == g_PTRNUL) {
- _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile(filename2);
+ if (_vm->_globals._hidingItemData[1] || _vm->_globals._hidingItemData[1] == g_PTRNUL) {
+ _vm->_globals._hidingItemData[1] = _vm->_fileManager.loadFile(filename2);
} else {
- _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile("RES_SLI.RES");
+ _vm->_globals._hidingItemData[1] = _vm->_fileManager.loadFile("RES_SLI.RES");
}
int curDataCacheId = 60;
byte *curDataPtr = ptr + 1000;
for (int cacheIdx = 0; cacheIdx <= 21; cacheIdx++) {
int curSpriteId = READ_LE_INT16(curDataPtr + 2 * curDataCacheId);
- _vm->_globals.Cache[cacheIdx]._spriteIndex = curSpriteId;
- _vm->_globals.Cache[cacheIdx]._x = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 2);
- _vm->_globals.Cache[cacheIdx]._y = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 4);
- _vm->_globals.Cache[cacheIdx].field14 = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 8);
+ _vm->_globals._hidingItem[cacheIdx]._spriteIndex = curSpriteId;
+ _vm->_globals._hidingItem[cacheIdx]._x = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 2);
+ _vm->_globals._hidingItem[cacheIdx]._y = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 4);
+ _vm->_globals._hidingItem[cacheIdx].field14 = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 8);
- if (!_vm->_globals.CACHE_BANQUE[1]) {
- _vm->_globals.Cache[cacheIdx]._useCount = 0;
+ if (!_vm->_globals._hidingItemData[1]) {
+ _vm->_globals._hidingItem[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], curSpriteId);
- _vm->_globals.Cache[cacheIdx]._height = getHeight(_vm->_globals.CACHE_BANQUE[1], curSpriteId);
- _vm->_globals.Cache[cacheIdx]._useCount = 1;
+ _vm->_globals._hidingItem[cacheIdx]._spriteData = _vm->_globals._hidingItemData[1];
+ _vm->_globals._hidingItem[cacheIdx]._width = getWidth(_vm->_globals._hidingItemData[1], curSpriteId);
+ _vm->_globals._hidingItem[cacheIdx]._height = getHeight(_vm->_globals._hidingItemData[1], curSpriteId);
+ _vm->_globals._hidingItem[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;
+ if (!_vm->_globals._hidingItem[cacheIdx]._x && !_vm->_globals._hidingItem[cacheIdx]._y
+ && !_vm->_globals._hidingItem[cacheIdx]._spriteIndex)
+ _vm->_globals._hidingItem[cacheIdx]._useCount = 0;
curDataCacheId += 5;
}
- _vm->_globals.CACHE_ON();
+ _vm->_globals.enableHiding();
}
}
@@ -3298,8 +3296,8 @@ void ObjectsManager::SPECIAL_INI() {
case 73:
if (!_vm->_globals._saveData->_data[svField318]) {
- _vm->_globals.CACHE_SUB(0);
- _vm->_globals.CACHE_SUB(1);
+ _vm->_globals.resetHidingUseCount(0);
+ _vm->_globals.resetHidingUseCount(1);
}
break;
@@ -3834,7 +3832,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm
_vm->_graphicsManager._scrollPosX = (int16)getSpriteX(0) - 320;
computeAndSetSpriteSize();
animateSprite(0);
- _vm->_globals.CACHE_ON();
+ _vm->_globals.enableHiding();
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
computeAndSetSpriteSize();
SPECIAL_INI();
diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h
index b20d1e2ad7..8ccc345104 100644
--- a/engines/hopkins/objects.h
+++ b/engines/hopkins/objects.h
@@ -66,7 +66,6 @@ struct BobItem {
int field1E;
int field20;
int field22;
- int _offsetY; // Unused variable?
bool field34; // Set to true in B_CACHE_OFF()
int _zoomFactor;
bool _flipFl;
diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp
index 4d6d5d22c7..012033190a 100644
--- a/engines/hopkins/script.cpp
+++ b/engines/hopkins/script.cpp
@@ -539,7 +539,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_eventsManager._mouseButton = _vm->_eventsManager._curMouseButton;
_vm->_globals._disableInventFl = true;
_vm->_graphicsManager.fadeOutLong();
- _vm->_globals.CACHE_OFF();
+ _vm->_globals.disableHiding();
_vm->_objectsManager.removeSprite(0);
_vm->_fontManager.hideText(5);
_vm->_fontManager.hideText(9);
@@ -826,7 +826,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case 49: {
- _vm->_globals.CACHE_OFF();
+ _vm->_globals.disableHiding();
_vm->_objectsManager.removeSprite(0);
_vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0);
int v19 = 12;
@@ -861,7 +861,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_objectsManager.animateSprite(0);
_vm->_objectsManager.stopBobAnimation(9);
}
- _vm->_globals.CACHE_ON();
+ _vm->_globals.enableHiding();
break;
}
@@ -872,7 +872,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 51: {
_vm->_graphicsManager.fadeOutLong();
- _vm->_globals.CACHE_OFF();
+ _vm->_globals.disableHiding();
_vm->_objectsManager.removeSprite(0);
_vm->_fontManager.hideText(5);
_vm->_fontManager.hideText(9);
@@ -1889,10 +1889,10 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_objectsManager.OBSSEUL = true;
_vm->_objectsManager.loadLinkFile("IM73a");
_vm->_objectsManager.OBSSEUL = false;
- _vm->_globals.CACHE_ON();
+ _vm->_globals.enableHiding();
_vm->_animationManager.NO_SEQ = false;
- _vm->_globals.CACHE_ADD(0);
- _vm->_globals.CACHE_ADD(1);
+ _vm->_globals.setHidingUseCount(0);
+ _vm->_globals.setHidingUseCount(1);
_vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100);
_vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100);
_vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100);
@@ -1901,7 +1901,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 211:
_vm->_objectsManager.removeSprite(0);
- _vm->_globals.CACHE_OFF();
+ _vm->_globals.disableHiding();
_vm->_animationManager.NO_SEQ = true;
_vm->_soundManager._specialSoundNum = 211;
_vm->_animationManager.playSequence("SECRET2.SEQ", 1, 12, 100);
@@ -1946,7 +1946,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_objectsManager.OBSSEUL = true;
_vm->_objectsManager.loadLinkFile("IM93a");
_vm->_objectsManager.OBSSEUL = false;
- _vm->_globals.CACHE_ON();
+ _vm->_globals.enableHiding();
_vm->_globals._checkDistanceFl = true;
_vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0);
_vm->_globals._oldDirection = DIR_NONE;
@@ -1983,12 +1983,12 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_objectsManager.OBSSEUL = true;
_vm->_objectsManager.loadLinkFile("IM93c");
_vm->_objectsManager.OBSSEUL = false;
- _vm->_globals.CACHE_ON();
+ _vm->_globals.enableHiding();
break;
}
case 231:
- _vm->_globals.CACHE_OFF();
+ _vm->_globals.disableHiding();
_vm->_objectsManager.removeSprite(0);
_vm->_objectsManager.setBobAnimation(12);
do {
@@ -2008,11 +2008,11 @@ int ScriptManager::handleOpcode(byte *dataP) {
} while (_vm->_objectsManager.getBobAnimDataIdx(12) != 12);
_vm->_objectsManager.animateSprite(0);
_vm->_objectsManager.stopBobAnimation(12);
- _vm->_globals.CACHE_ON();
+ _vm->_globals.enableHiding();
break;
case 233: {
- _vm->_globals.CACHE_OFF();
+ _vm->_globals.disableHiding();
_vm->_objectsManager.removeSprite(0);
_vm->_objectsManager.setBobAnimation(11);
int v46 = 0;
@@ -2025,7 +2025,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
v46 = 1;
} while (_vm->_objectsManager.getBobAnimDataIdx(11) != 13);
_vm->_objectsManager.stopBobAnimation(11);
- _vm->_globals.CACHE_ON();
+ _vm->_globals.enableHiding();
_vm->_objectsManager.setBobAnimation(13);
do {
if (_vm->shouldQuit())
diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp
index e9b292b813..d8e37924fe 100644
--- a/engines/hopkins/talk.cpp
+++ b/engines/hopkins/talk.cpp
@@ -619,7 +619,6 @@ void TalkManager::BOB_VISU_PARLE(int idx) {
_vm->_objectsManager._bob[idx].field1E = v4;
_vm->_objectsManager._bob[idx].field20 = -1;
_vm->_objectsManager._bob[idx].field22 = 0;
- _vm->_objectsManager._bob[idx]._offsetY = 0;
}
}
}
@@ -971,7 +970,7 @@ void TalkManager::animateObject(const Common::String &a2) {
_vm->_graphicsManager._scrollStatus = 1;
_vm->_linesManager.clearAllZones();
_vm->_linesManager.resetLines();
- _vm->_globals.resetCache();
+ _vm->_globals.resetHidingItems();
for (int i = 0; i <= 44; i++)
_vm->_linesManager.BOBZONE[i] = 0;
@@ -1050,7 +1049,7 @@ void TalkManager::animateObject(const Common::String &a2) {
_vm->_graphicsManager.NB_SCREEN(false);
_vm->_linesManager.clearAllZones();
_vm->_linesManager.resetLines();
- _vm->_globals.resetCache();
+ _vm->_globals.resetHidingItems();
for (int i = 0; i <= 44; i++)
_vm->_linesManager.BOBZONE[i] = 0;