aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-03-24 23:44:39 +0100
committerStrangerke2013-03-24 23:44:39 +0100
commit165681b142b5b315616d6bf9a45160cbcf034ee6 (patch)
treebf3ca3667913eeaacbfd22a1ad74e041f668db0f /engines
parentac338c3517d85156e83884164d378c3bf76851e5 (diff)
downloadscummvm-rg350-165681b142b5b315616d6bf9a45160cbcf034ee6.tar.gz
scummvm-rg350-165681b142b5b315616d6bf9a45160cbcf034ee6.tar.bz2
scummvm-rg350-165681b142b5b315616d6bf9a45160cbcf034ee6.zip
HOPKINS: Move more variables and functions out of Globals
Diffstat (limited to 'engines')
-rw-r--r--engines/hopkins/globals.cpp92
-rw-r--r--engines/hopkins/globals.h17
-rw-r--r--engines/hopkins/hopkins.cpp4
-rw-r--r--engines/hopkins/lines.cpp21
-rw-r--r--engines/hopkins/lines.h5
-rw-r--r--engines/hopkins/objects.cpp131
-rw-r--r--engines/hopkins/objects.h18
-rw-r--r--engines/hopkins/script.cpp28
-rw-r--r--engines/hopkins/talk.cpp4
9 files changed, 160 insertions, 160 deletions
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp
index a495a809e7..639586eeb4 100644
--- a/engines/hopkins/globals.cpp
+++ b/engines/hopkins/globals.cpp
@@ -82,9 +82,6 @@ Globals::Globals(HopkinsEngine *vm) {
Common::fill((byte *)&VBob[i], (byte *)&VBob[i] + sizeof(VBobItem), 0);
for (int i = 0; i < 300; ++i)
Common::fill((byte *)&_objectAuthIcons[i], (byte *)&_objectAuthIcons[i] + sizeof(ObjectAuthIcon), 0);
- for (int i = 0; i < 25; ++i)
- Common::fill((byte *)&_hidingItem[i], (byte *)&_hidingItem[i] + sizeof(HidingItem), 0);
-
for (int i = 0; i < 500; ++i)
_spriteSize[i] = 0;
for (int i = 0; i < 70; ++i)
@@ -129,8 +126,6 @@ Globals::Globals(HopkinsEngine *vm) {
_oceanDirection = DIR_NONE;
// Initialize pointers
- for (int i = 0; i < 6; ++i)
- _hidingItemData[i] = g_PTRNUL;
_levelSpriteBuf = NULL;
_saveData = NULL;
_answerBuffer = g_PTRNUL;
@@ -143,21 +138,11 @@ Globals::Globals(HopkinsEngine *vm) {
_disableInventFl = false;
_freezeCharacterFl = false;
_optionDialogFl = false;
- _hidingActiveFl = false;
_introSpeechOffFl = false;
_baseMapColor = 50;
-
- // Reset indexed variables
- _oldRouteFromX = 0;
- _oldRouteFromY = 0;
- _oldRouteDestX = 0;
- _oldRouteDestY = 0;
- _oldZoneNum = 0;
}
Globals::~Globals() {
- for (int idx = 0; idx < 6; ++idx)
- _hidingItemData[idx] = freeMemory(_hidingItemData[idx]);
freeMemory(_levelSpriteBuf);
freeMemory((byte *)_saveData);
freeMemory(_answerBuffer);
@@ -206,9 +191,6 @@ void Globals::setConfig() {
}
void Globals::clearAll() {
- for (int idx = 0; idx < 6; ++idx)
- _hidingItemData[idx] = g_PTRNUL;
-
initAnimBqe();
_vm->_fontManager->clearAll();
@@ -319,83 +301,9 @@ byte *Globals::freeMemory(byte *p) {
return g_PTRNUL;
}
-// Reset Hiding Items
-void Globals::resetHidingItems() {
-
- for (int idx = 1; idx <= 5; ++idx) {
- _hidingItemData[idx] = freeMemory(_hidingItemData[idx]);
- }
-
- for (int idx = 0; idx <= 20; ++idx) {
- HidingItem *hid = &_hidingItem[idx];
- hid->_spriteData = g_PTRNUL;
- hid->_x = 0;
- hid->_y = 0;
- hid->_spriteIndex = 0;
- hid->_useCount = 0;
- hid->_width = 0;
- hid->_height = 0;
- hid->_resetUseCount = false;
- hid->_yOffset = 0;
- }
-
- _hidingActiveFl = false;
-}
-
-void Globals::enableHiding() {
- _hidingActiveFl = true;
-}
-
-void Globals::disableHiding() {
- _hidingActiveFl = false;
-}
-
void Globals::B_CACHE_OFF(int idx) {
assert(idx < 36);
_vm->_objectsManager->_bob[idx].field34 = true;
}
-void Globals::resetHidingUseCount(int idx) {
- _hidingItem[idx]._useCount = 0;
-}
-
-void Globals::setHidingUseCount(int idx) {
- _hidingItem[idx]._useCount = 1;
-}
-
-// 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);
-
- Common::File f;
- if (!f.exists(filename))
- return;
-
- byte *spriteData = _vm->_fileManager->loadFile(filename);
- _hidingItemData[1] = spriteData;
- int curBufIdx = 60;
- for (int i = 0; i <= 21; i++) {
- _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]._yOffset = READ_LE_INT16((uint16 *)ptr + curBufIdx + 4);
- if (spriteData == g_PTRNUL) {
- _hidingItem[i]._useCount = 0;
- } else {
- _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 ( !_hidingItem[i]._x && !_hidingItem[i]._y && !_hidingItem[i]._spriteIndex)
- _hidingItem[i]._useCount = 0;
- curBufIdx += 5;
- }
- enableHiding();
- freeMemory(ptr);
-}
-
} // End of namespace Hopkins
diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h
index c1725d5c0c..6e54605d49 100644
--- a/engines/hopkins/globals.h
+++ b/engines/hopkins/globals.h
@@ -176,7 +176,8 @@ enum SauvegardeOffset {
, svField401 = 401
};
-// TODO: Sauvegrade1 fields should really be mapped into data array
+// As Script engine directly access savegame fields,
+// refactoring it in separated fields properly named is impossible
struct Savegame {
byte _data[2050];
CharacterLocation _cloneHopkins;
@@ -230,7 +231,6 @@ public:
bool _linuxEndDemoFl;
bool _censorshipFl;
bool _introSpeechOffFl;
- bool _hidingActiveFl;
int _exitId;
Directions _oceanDirection;
int _actionDirection;
@@ -266,17 +266,10 @@ public:
byte *_optionDialogSpr;
bool _optionDialogFl;
- int _oldRouteFromX;
- int _oldRouteFromY;
- int _oldRouteDestX;
- int _oldRouteDestY;
- int _oldZoneNum;
bool _actionMoveTo;
bool _freezeCharacterFl;
bool _checkDistanceFl;
- byte *_hidingItemData[6];
- HidingItem _hidingItem[25];
BqeAnimItem _animBqe[35];
ObjectAuthIcon _objectAuthIcons[300];
int _curObjectFileNum;
@@ -300,12 +293,6 @@ public:
void loadObjects();
void clearAll();
void loadCharacterData();
- 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);
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index 69c09aa8df..d0aafc9289 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -2043,7 +2043,7 @@ void HopkinsEngine::playUnderwaterBaseCutscene() {
_eventsManager->refreshScreenAndEvents();
_graphicsManager->fadeInLong();
- _globals->enableHiding();
+ _objectsManager->enableHiding();
do
_eventsManager->refreshScreenAndEvents();
@@ -2051,7 +2051,7 @@ void HopkinsEngine::playUnderwaterBaseCutscene() {
_graphicsManager->fadeOutLong();
_graphicsManager->endDisplayBob();
- _globals->resetHidingItems();
+ _objectsManager->resetHidingItems();
_globals->_disableInventFl = false;
_globals->_exitId = 93;
_globals->iRegul = 0;
diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index 33a2c79433..e0f0d844a4 100644
--- a/engines/hopkins/lines.cpp
+++ b/engines/hopkins/lines.cpp
@@ -80,6 +80,11 @@ LinesManager::LinesManager(HopkinsEngine *vm) {
_oldMouseZoneId = 0;
_oldMouseX = 0;
_oldMouseY = 0;
+ _oldRouteFromX = 0;
+ _oldRouteFromY = 0;
+ _oldRouteDestX = 0;
+ _oldRouteDestY = 0;
+ _oldZoneNum = 0;
}
LinesManager::~LinesManager() {
@@ -1084,22 +1089,22 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) {
if (destY <= 24)
clipDestY = 25;
if (!_vm->_globals->_checkDistanceFl) {
- if (abs(fromX - _vm->_globals->_oldRouteFromX) <= 4 && abs(fromY - _vm->_globals->_oldRouteFromY) <= 4 &&
- abs(_vm->_globals->_oldRouteDestX - destX) <= 4 && abs(_vm->_globals->_oldRouteDestY - clipDestY) <= 4)
+ if (abs(fromX - _oldRouteFromX) <= 4 && abs(fromY - _oldRouteFromY) <= 4 &&
+ abs(_oldRouteDestX - destX) <= 4 && abs(_oldRouteDestY - clipDestY) <= 4)
return (RouteItem *)g_PTRNUL;
if (abs(fromX - destX) <= 4 && abs(fromY - clipDestY) <= 4)
return (RouteItem *)g_PTRNUL;
- if (_vm->_globals->_oldZoneNum > 0 && _vm->_objectsManager->_zoneNum > 0 && _vm->_globals->_oldZoneNum == _vm->_objectsManager->_zoneNum)
+ if (_oldZoneNum > 0 && _vm->_objectsManager->_zoneNum > 0 && _oldZoneNum == _vm->_objectsManager->_zoneNum)
return (RouteItem *)g_PTRNUL;
}
_vm->_globals->_checkDistanceFl = false;
- _vm->_globals->_oldZoneNum = _vm->_objectsManager->_zoneNum;
- _vm->_globals->_oldRouteFromX = fromX;
- _vm->_globals->_oldRouteDestX = destX;
- _vm->_globals->_oldRouteFromY = fromY;
- _vm->_globals->_oldRouteDestY = clipDestY;
+ _oldZoneNum = _vm->_objectsManager->_zoneNum;
+ _oldRouteFromX = fromX;
+ _oldRouteDestX = destX;
+ _oldRouteFromY = fromY;
+ _oldRouteDestY = clipDestY;
_pathFindingMaxDepth = 0;
int routeIdx = 0;
if (destX <= 19)
diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h
index 3a4d61555e..8a5cb7ae2a 100644
--- a/engines/hopkins/lines.h
+++ b/engines/hopkins/lines.h
@@ -124,6 +124,11 @@ private:
int _newPosX;
int _newPosY;
int _oldMouseX, _oldMouseY;
+ int _oldRouteFromX;
+ int _oldRouteFromY;
+ int _oldRouteDestX;
+ int _oldRouteDestY;
+ int _oldZoneNum;
byte *_largeBuf;
RouteItem *_testRoute0;
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index cd8cc1bcf3..f8161aed7d 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -52,6 +52,12 @@ ObjectsManager::ObjectsManager(HopkinsEngine *vm) {
for (int i = 0; i < 51; ++i)
Common::fill((byte *)&_sortedDisplay[i], (byte *)&_sortedDisplay[i] + sizeof(SortItem), 0);
+ for (int i = 0; i < 25; ++i)
+ Common::fill((byte *)&_hidingItem[i], (byte *)&_hidingItem[i] + sizeof(HidingItem), 0);
+
+ for (int i = 0; i < 6; ++i)
+ _hidingItemData[i] = g_PTRNUL;
+
_helicopterFl = false;
_priorityFl = false;
_oldBorderPos = Common::Point(0, 0);
@@ -97,12 +103,16 @@ ObjectsManager::ObjectsManager(HopkinsEngine *vm) {
_oldDirection = DIR_NONE;
_oldDirectionSpriteIdx = 59;
_objectWidth = _objectHeight = 0;
+ _hidingActiveFl = false;
}
ObjectsManager::~ObjectsManager() {
_vm->_globals->freeMemory(_forestSprite);
_vm->_globals->freeMemory(_gestureBuf);
_vm->_globals->freeMemory(_headSprites);
+
+ for (int idx = 0; idx < 6; ++idx)
+ _hidingItemData[idx] = _vm->_globals->freeMemory(_hidingItemData[idx]);
}
void ObjectsManager::clearAll() {
@@ -110,6 +120,31 @@ void ObjectsManager::clearAll() {
_forestSprite = _vm->_globals->freeMemory(_forestSprite);
_curGestureFile = 0;
_gestureBuf = _vm->_globals->freeMemory(_gestureBuf);
+
+ for (int idx = 0; idx < 6; ++idx)
+ _hidingItemData[idx] = _vm->_globals->freeMemory(_hidingItemData[idx]);
+}
+
+// Reset Hiding Items
+void ObjectsManager::resetHidingItems() {
+ for (int idx = 1; idx <= 5; ++idx) {
+ _hidingItemData[idx] = _vm->_globals->freeMemory(_hidingItemData[idx]);
+ }
+
+ for (int idx = 0; idx <= 20; ++idx) {
+ HidingItem *hid = &_hidingItem[idx];
+ hid->_spriteData = g_PTRNUL;
+ hid->_x = 0;
+ hid->_y = 0;
+ hid->_spriteIndex = 0;
+ hid->_useCount = 0;
+ hid->_width = 0;
+ hid->_height = 0;
+ hid->_resetUseCount = false;
+ hid->_yOffset = 0;
+ }
+
+ _hidingActiveFl = false;
}
/**
@@ -360,7 +395,7 @@ void ObjectsManager::displaySprite() {
}
}
- if (_vm->_globals->_hidingActiveFl)
+ if (_hidingActiveFl)
checkHidingItem();
}
@@ -633,7 +668,7 @@ void ObjectsManager::setBobOffset(int idx, int offset) {
}
void ObjectsManager::SCBOB(int idx) {
- HidingItem *hid = &_vm->_globals->_hidingItem[idx];
+ HidingItem *hid = &_hidingItem[idx];
if (hid->_useCount == 0)
return;
@@ -740,7 +775,7 @@ void ObjectsManager::CALCUL_BOB(int idx) {
void ObjectsManager::checkHidingItem() {
for (int hidingItemIdx = 0; hidingItemIdx <= 19; hidingItemIdx++) {
- HidingItem *hid = &_vm->_globals->_hidingItem[hidingItemIdx];
+ HidingItem *hid = &_hidingItem[hidingItemIdx];
if (hid->_useCount == 0)
continue;
@@ -820,9 +855,9 @@ void ObjectsManager::DEF_SPRITE(int idx) {
}
void ObjectsManager::displayHiding(int idx) {
- HidingItem *hid = &_vm->_globals->_hidingItem[idx];
+ HidingItem *hid = &_hidingItem[idx];
- _vm->_graphicsManager->Sprite_Vesa(_vm->_graphicsManager->_vesaBuffer, _vm->_globals->_hidingItemData[1],
+ _vm->_graphicsManager->Sprite_Vesa(_vm->_graphicsManager->_vesaBuffer, _hidingItemData[1],
hid->_x + 300, hid->_y + 300, hid->_spriteIndex);
_vm->_graphicsManager->addDirtyRect(hid->_x, hid->_y, hid->_x + hid->_width, hid->_y + hid->_height);
}
@@ -1737,7 +1772,7 @@ void ObjectsManager::handleCityMap() {
_vm->_globals->iRegul = 1;
_vm->_graphicsManager->loadImage("PLAN");
_vm->_linesManager->loadLines("PLAN.OB2");
- _vm->_globals->loadHidingItems("PLAN.CA2");
+ loadHidingItems("PLAN.CA2");
loadZone("PLAN.ZO2");
_spritePtr = _vm->_fileManager->loadFile("VOITURE.SPR");
_vm->_animationManager->loadAnim("PLAN");
@@ -1747,7 +1782,7 @@ void ObjectsManager::handleCityMap() {
_vm->_globals->B_CACHE_OFF(i);
_vm->_globals->B_CACHE_OFF(19);
_vm->_globals->B_CACHE_OFF(20);
- _vm->_globals->enableHiding();
+ enableHiding();
if (!_mapCarPosX && !_mapCarPosY) {
_mapCarPosX = 900;
@@ -2060,7 +2095,7 @@ void ObjectsManager::clearScreen() {
_vm->_animationManager->clearAnim();
_vm->_linesManager->clearAllZones();
_vm->_linesManager->resetLines();
- _vm->_globals->resetHidingItems();
+ resetHidingItems();
for (int i = 0; i <= 48; i++) {
_vm->_linesManager->BOBZONE[i] = 0;
@@ -3064,34 +3099,34 @@ 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->resetHidingItems();
+ resetHidingItems();
Common::String filename2 = Common::String((const char *)ptr + 1000);
if (!filename2.empty()) {
- _vm->_globals->_hidingItemData[1] = _vm->_fileManager->searchCat(filename2, RES_SLI);
+ _hidingItemData[1] = _vm->_fileManager->searchCat(filename2, RES_SLI);
- if (_vm->_globals->_hidingItemData[1] || _vm->_globals->_hidingItemData[1] == g_PTRNUL) {
- _vm->_globals->_hidingItemData[1] = _vm->_fileManager->loadFile(filename2);
+ if (_hidingItemData[1] || _hidingItemData[1] == g_PTRNUL) {
+ _hidingItemData[1] = _vm->_fileManager->loadFile(filename2);
} else {
- _vm->_globals->_hidingItemData[1] = _vm->_fileManager->loadFile("RES_SLI.RES");
+ _hidingItemData[1] = _vm->_fileManager->loadFile("RES_SLI.RES");
}
int curDataCacheId = 60;
byte *curDataPtr = ptr + 1000;
for (int hidingIdx = 0; hidingIdx <= 21; hidingIdx++) {
- HidingItem *hid = &_vm->_globals->_hidingItem[hidingIdx];
+ HidingItem *hid = &_hidingItem[hidingIdx];
int curSpriteId = READ_LE_INT16(curDataPtr + 2 * curDataCacheId);
hid->_spriteIndex = curSpriteId;
hid->_x = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 2);
hid->_y = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 4);
hid->_yOffset = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 8);
- if (!_vm->_globals->_hidingItemData[1]) {
+ if (!_hidingItemData[1]) {
hid->_useCount = 0;
} else {
- hid->_spriteData = _vm->_globals->_hidingItemData[1];
- hid->_width = getWidth(_vm->_globals->_hidingItemData[1], curSpriteId);
- hid->_height = getHeight(_vm->_globals->_hidingItemData[1], curSpriteId);
+ hid->_spriteData = _hidingItemData[1];
+ hid->_width = getWidth(_hidingItemData[1], curSpriteId);
+ hid->_height = getHeight(_hidingItemData[1], curSpriteId);
hid->_useCount = 1;
}
if (!hid->_x && !hid->_y && !hid->_spriteIndex)
@@ -3099,7 +3134,7 @@ void ObjectsManager::loadLinkFile(const Common::String &file) {
curDataCacheId += 5;
}
- _vm->_globals->enableHiding();
+ enableHiding();
}
}
@@ -3290,8 +3325,8 @@ void ObjectsManager::sceneSpecialIni() {
case 73:
if (!_vm->_globals->_saveData->_data[svSecondElevatorAvailableFl]) {
- _vm->_globals->resetHidingUseCount(0);
- _vm->_globals->resetHidingUseCount(1);
+ resetHidingUseCount(0);
+ resetHidingUseCount(1);
}
break;
@@ -3817,7 +3852,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm
_vm->_graphicsManager->_scrollPosX = (int16)getSpriteX(0) - 320;
computeAndSetSpriteSize();
animateSprite(0);
- _vm->_globals->enableHiding();
+ enableHiding();
_vm->_linesManager->_route = (RouteItem *)g_PTRNUL;
computeAndSetSpriteSize();
sceneSpecialIni();
@@ -3899,4 +3934,56 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm
void ObjectsManager::setVerb(int id) {
_verb = id;
}
+
+void ObjectsManager::resetHidingUseCount(int idx) {
+ _hidingItem[idx]._useCount = 0;
+}
+
+void ObjectsManager::setHidingUseCount(int idx) {
+ _hidingItem[idx]._useCount = 1;
+}
+
+// Load Hiding Items
+void ObjectsManager::loadHidingItems(const Common::String &file) {
+ resetHidingItems();
+ byte *ptr = _vm->_fileManager->loadFile(file);
+ Common::String filename = Common::String((const char *)ptr);
+
+ Common::File f;
+ if (!f.exists(filename))
+ return;
+
+ byte *spriteData = _vm->_fileManager->loadFile(filename);
+ _hidingItemData[1] = spriteData;
+ int curBufIdx = 60;
+ for (int i = 0; i <= 21; i++) {
+ _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]._yOffset = READ_LE_INT16((uint16 *)ptr + curBufIdx + 4);
+ if (spriteData == g_PTRNUL) {
+ _hidingItem[i]._useCount = 0;
+ } else {
+ _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 ( !_hidingItem[i]._x && !_hidingItem[i]._y && !_hidingItem[i]._spriteIndex)
+ _hidingItem[i]._useCount = 0;
+ curBufIdx += 5;
+ }
+ enableHiding();
+ _vm->_globals->freeMemory(ptr);
+}
+
+void ObjectsManager::enableHiding() {
+ _hidingActiveFl = true;
+}
+
+void ObjectsManager::disableHiding() {
+ _hidingActiveFl = false;
+}
+
} // End of namespace Hopkins
diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h
index f43b09f78b..ed8b202c32 100644
--- a/engines/hopkins/objects.h
+++ b/engines/hopkins/objects.h
@@ -108,6 +108,9 @@ private:
int _homeRateCounter;
int _sortedDisplayCount;
SortItem _sortedDisplay[51];
+ byte *_hidingItemData[6];
+ HidingItem _hidingItem[25];
+ bool _hidingActiveFl;
void sprite_alone(const byte *objectData, byte *sprite, int objIndex);
void removeObjectDataBuf();
@@ -236,8 +239,18 @@ public:
void doActionDiagRight(int idx);
void doActionDiagLeft(int idx);
byte *loadObjectFromFile(int objIndex, bool mode);
+ void resetHidingItems();
+ void resetHidingUseCount(int idx);
+ void setHidingUseCount(int idx);
+ void loadHidingItems(const Common::String &file);
+ void enableHiding();
+ void disableHiding();
void resetHomeRateCounter() { _homeRateCounter = 0; }
+ void resetOldFrameIndex() { _oldFrameIndex = -1; }
+ void resetOldDirection() { _oldDirection = DIR_NONE; }
+ int getObjectWidth() { return _objectWidth; }
+ int getObjectHeight() { return _objectHeight; }
void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile,
const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen);
@@ -254,11 +267,6 @@ public:
void OPTI_BOBON(int idx1, int idx2, int idx3, int anim1Idx, int anim2Idx, int anim3Idx);
void SPACTION1(byte *spriteData, const Common::String &animString, int speed);
void PARADISE();
-
- void resetOldFrameIndex() { _oldFrameIndex = -1; }
- void resetOldDirection() { _oldDirection = DIR_NONE; }
- int getObjectWidth() { return _objectWidth; }
- int getObjectHeight() { return _objectHeight; }
};
} // End of namespace Hopkins
diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp
index 50a0a90d5c..dbb6edb479 100644
--- a/engines/hopkins/script.cpp
+++ b/engines/hopkins/script.cpp
@@ -544,7 +544,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_eventsManager->_mouseButton = _vm->_eventsManager->_curMouseButton;
_vm->_globals->_disableInventFl = true;
_vm->_graphicsManager->fadeOutLong();
- _vm->_globals->disableHiding();
+ _vm->_objectsManager->disableHiding();
_vm->_objectsManager->removeSprite(0);
_vm->_fontManager->hideText(5);
_vm->_fontManager->hideText(9);
@@ -840,7 +840,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case 49: {
- _vm->_globals->disableHiding();
+ _vm->_objectsManager->disableHiding();
_vm->_objectsManager->removeSprite(0);
_vm->_objectsManager->OPTI_BOBON(9, 10, -1, 0, 0, 0);
@@ -888,7 +888,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_objectsManager->animateSprite(0);
_vm->_objectsManager->stopBobAnimation(9);
}
- _vm->_globals->enableHiding();
+ _vm->_objectsManager->enableHiding();
break;
}
@@ -899,7 +899,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 51: {
_vm->_graphicsManager->fadeOutLong();
- _vm->_globals->disableHiding();
+ _vm->_objectsManager->disableHiding();
_vm->_objectsManager->removeSprite(0);
_vm->_fontManager->hideText(5);
_vm->_fontManager->hideText(9);
@@ -1949,9 +1949,9 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_objectsManager->OBSSEUL = true;
_vm->_objectsManager->loadLinkFile("IM73a");
_vm->_objectsManager->OBSSEUL = false;
- _vm->_globals->enableHiding();
- _vm->_globals->setHidingUseCount(0);
- _vm->_globals->setHidingUseCount(1);
+ _vm->_objectsManager->enableHiding();
+ _vm->_objectsManager->setHidingUseCount(0);
+ _vm->_objectsManager->setHidingUseCount(1);
_vm->_graphicsManager->SETCOLOR4(252, 100, 100, 100);
_vm->_graphicsManager->SETCOLOR4(253, 100, 100, 100);
_vm->_graphicsManager->SETCOLOR4(251, 100, 100, 100);
@@ -1960,7 +1960,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 211:
_vm->_objectsManager->removeSprite(0);
- _vm->_globals->disableHiding();
+ _vm->_objectsManager->disableHiding();
_vm->_soundManager->_specialSoundNum = 211;
_vm->_animationManager->playSequence("SECRET2.SEQ", 1, 12, 100, false, true);
_vm->_soundManager->_specialSoundNum = 0;
@@ -2003,7 +2003,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_objectsManager->OBSSEUL = true;
_vm->_objectsManager->loadLinkFile("IM93a");
_vm->_objectsManager->OBSSEUL = false;
- _vm->_globals->enableHiding();
+ _vm->_objectsManager->enableHiding();
_vm->_globals->_checkDistanceFl = true;
_vm->_objectsManager->_oldCharacterPosX = _vm->_objectsManager->getSpriteX(0);
_vm->_objectsManager->resetOldDirection();
@@ -2040,12 +2040,12 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_objectsManager->OBSSEUL = true;
_vm->_objectsManager->loadLinkFile("IM93c");
_vm->_objectsManager->OBSSEUL = false;
- _vm->_globals->enableHiding();
+ _vm->_objectsManager->enableHiding();
break;
}
case 231:
- _vm->_globals->disableHiding();
+ _vm->_objectsManager->disableHiding();
_vm->_objectsManager->removeSprite(0);
_vm->_objectsManager->setBobAnimation(12);
do {
@@ -2065,11 +2065,11 @@ int ScriptManager::handleOpcode(byte *dataP) {
} while (_vm->_objectsManager->getBobAnimDataIdx(12) != 12);
_vm->_objectsManager->animateSprite(0);
_vm->_objectsManager->stopBobAnimation(12);
- _vm->_globals->enableHiding();
+ _vm->_objectsManager->enableHiding();
break;
case 233: {
- _vm->_globals->disableHiding();
+ _vm->_objectsManager->disableHiding();
_vm->_objectsManager->removeSprite(0);
_vm->_objectsManager->setBobAnimation(11);
bool playFl = false;
@@ -2082,7 +2082,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
playFl = true;
} while (_vm->_objectsManager->getBobAnimDataIdx(11) != 13);
_vm->_objectsManager->stopBobAnimation(11);
- _vm->_globals->enableHiding();
+ _vm->_objectsManager->enableHiding();
_vm->_objectsManager->setBobAnimation(13);
do {
if (_vm->shouldQuit())
diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp
index 562d96d75d..2c1281f59d 100644
--- a/engines/hopkins/talk.cpp
+++ b/engines/hopkins/talk.cpp
@@ -967,7 +967,7 @@ void TalkManager::animateObject(const Common::String &filename) {
_vm->_graphicsManager->_scrollStatus = 1;
_vm->_linesManager->clearAllZones();
_vm->_linesManager->resetLines();
- _vm->_globals->resetHidingItems();
+ _vm->_objectsManager->resetHidingItems();
for (int i = 0; i <= 44; i++)
_vm->_linesManager->BOBZONE[i] = 0;
@@ -1046,7 +1046,7 @@ void TalkManager::animateObject(const Common::String &filename) {
_vm->_graphicsManager->NB_SCREEN(false);
_vm->_linesManager->clearAllZones();
_vm->_linesManager->resetLines();
- _vm->_globals->resetHidingItems();
+ _vm->_objectsManager->resetHidingItems();
for (int i = 0; i <= 44; i++)
_vm->_linesManager->BOBZONE[i] = 0;