HOPKINS: Move some zone code to LinesManager

This commit is contained in:
Strangerke 2013-02-12 23:48:03 +01:00
parent 9223719f2a
commit 2b865f6fe2
9 changed files with 335 additions and 325 deletions

View File

@ -68,8 +68,6 @@ Globals::Globals() {
// Initialise array properties
for (int i = 0; i < 6; ++i)
CACHE_BANQUE[i] = g_PTRNUL;
for (int i = 0; i < 106; ++i)
Common::fill((byte *)&ZONEP[i], (byte *)&ZONEP[i] + sizeof(ZonePItem), 0);
for (int i = 0; i < 35; ++i)
Common::fill((byte *)&Bqe_Anim[i], (byte *)&Bqe_Anim[i] + sizeof(BqeAnimItem), 0);
for (int i = 0; i < 8; ++i)
@ -87,10 +85,6 @@ Globals::Globals() {
for (int i = 0; i < 25; ++i)
Common::fill((byte *)&Cache[i], (byte *)&Cache[i] + sizeof(CacheItem), 0);
for (int i = 0; i < 105; ++i) {
BOBZONE[i] = 0;
BOBZONE_FLAG[i] = false;
}
for (int i = 0; i < 500; ++i)
_spriteSize[i] = 0;
for (int i = 0; i < 70; ++i)
@ -269,12 +263,6 @@ void Globals::clearAll() {
_saveData = (Sauvegarde *)g_PTRNUL;
_vm->_objectsManager._curObjectIndex = 0;
for (int idx = 0; idx < 105; ++idx) {
ZONEP[idx]._destX = 0;
ZONEP[idx]._destY = 0;
ZONEP[idx]._spriteIndex = 0;
}
_vm->_linesManager.clearAll();
_vm->_objectsManager.clearAll();

View File

@ -29,23 +29,6 @@
namespace Hopkins {
struct ZonePItem {
int _destX;
int _destY;
int _spriteIndex;
int field6;
int field7;
int field8;
int field9;
int fieldA;
int fieldB;
int fieldC;
int fieldD;
int fieldE;
int fieldF;
bool _enabledFl;
int field12;
};
struct BqeAnimItem {
byte *_data;
@ -317,10 +300,7 @@ public:
byte *SPRITE_ECRAN;
byte *PERSO;
int PERSO_TYPE;
int BOBZONE[105];
bool BOBZONE_FLAG[105];
bool NOT_VERIF;
ZonePItem ZONEP[106];
ObjetWItem ObjetW[300];
int NUM_FICHIER_OBJ;
byte *ADR_FICHIER_OBJ;

View File

@ -2723,13 +2723,13 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in
_objectsManager.INILINK("ocean");
if (!exit1)
_objectsManager.disableZone(1);
_linesManager.disableZone(1);
if (!exit2)
_objectsManager.disableZone(2);
_linesManager.disableZone(2);
if (!exit3)
_objectsManager.disableZone(3);
_linesManager.disableZone(3);
if (!exit4)
_objectsManager.disableZone(4);
_linesManager.disableZone(4);
if (!_globals._oceanDirection)
_globals._oceanDirection = defaultDirection;
@ -2775,7 +2775,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in
int mouseButton = _eventsManager.getMouseButton();
if (mouseButton && mouseButton == 1)
BTOCEAN();
_objectsManager.checkZone();
_linesManager.checkZone();
OCEAN_HOME();
_eventsManager.VBL();
if (_globals._exitId || g_system->getEventManager()->shouldQuit())

View File

@ -33,16 +33,26 @@ LinesManager::LinesManager() {
Common::fill((byte *)&_zoneLine[i], (byte *)&_zoneLine[i] + sizeof(LigneZoneItem), 0);
Common::fill((byte *)&Ligne[i], (byte *)&Ligne[i] + sizeof(LigneItem), 0);
}
for (int i = 0; i < 4000; ++i) {
for (int i = 0; i < 4000; ++i)
Common::fill((byte *)&_smoothRoute[i], (byte *)&_smoothRoute[i] + sizeof(SmoothItem), 0);
}
for (int i = 0; i < 32002; ++i)
super_parcours[i] = 0;
for (int i = 0; i < 101; ++i) {
Common::fill((byte *)&_segment[i], (byte *)&_segment[i] + sizeof(SegmentItem), 0);
Common::fill((byte *)&_squareZone[i], (byte *)&_squareZone[i] + sizeof(SquareZoneItem), 0);
}
for (int i = 0; i < 105; ++i) {
BOBZONE[i] = 0;
BOBZONE_FLAG[i] = false;
}
for (int i = 0; i < 106; ++i)
Common::fill((byte *)&ZONEP[i], (byte *)&ZONEP[i] + sizeof(ZonePItem), 0);
_linesNumb = 0;
NV_LIGNEDEP = 0;
NV_LIGNEOFS = 0;
@ -160,8 +170,8 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ
int16 *zoneData;
if (a2 == a3 && a3 == a4 && a3 == a5) {
_vm->_globals.BOBZONE_FLAG[bobZoneIdx] = true;
_vm->_globals.BOBZONE[bobZoneIdx] = a3;
BOBZONE_FLAG[bobZoneIdx] = true;
BOBZONE[bobZoneIdx] = a3;
} else {
assert (idx <= MAX_LINES);
_zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx]._zoneData);
@ -2965,19 +2975,19 @@ int LinesManager::MZONE() {
int yp = _vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y;
if ((_vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y) > 19) {
for (int bobZoneId = 0; bobZoneId <= 48; bobZoneId++) {
int bobId = _vm->_globals.BOBZONE[bobZoneId];
if (bobId && _vm->_globals.BOBZONE_FLAG[bobZoneId] && _vm->_objectsManager._bob[bobId].field0 && _vm->_objectsManager._bob[bobId]._frameIndex != 250 &&
int bobId = BOBZONE[bobZoneId];
if (bobId && BOBZONE_FLAG[bobZoneId] && _vm->_objectsManager._bob[bobId].field0 && _vm->_objectsManager._bob[bobId]._frameIndex != 250 &&
!_vm->_objectsManager._bob[bobId]._disabledAnimationFl && xp > _vm->_objectsManager._bob[bobId]._oldX &&
xp < _vm->_objectsManager._bob[bobId]._oldWidth + _vm->_objectsManager._bob[bobId]._oldX && yp > _vm->_objectsManager._bob[bobId]._oldY) {
if (yp < _vm->_objectsManager._bob[bobId]._oldHeight + _vm->_objectsManager._bob[bobId]._oldY) {
if (_vm->_globals.ZONEP[bobZoneId]._spriteIndex == -1) {
_vm->_globals.ZONEP[bobZoneId]._destX = 0;
_vm->_globals.ZONEP[bobZoneId]._destY = 0;
if (ZONEP[bobZoneId]._spriteIndex == -1) {
ZONEP[bobZoneId]._destX = 0;
ZONEP[bobZoneId]._destY = 0;
}
if (!_vm->_globals.ZONEP[bobZoneId]._destX && !_vm->_globals.ZONEP[bobZoneId]._destY) {
_vm->_globals.ZONEP[bobZoneId]._destX = _vm->_objectsManager._bob[bobId]._oldWidth + _vm->_objectsManager._bob[bobId]._oldX;
_vm->_globals.ZONEP[bobZoneId]._destY = _vm->_objectsManager._bob[bobId]._oldHeight + _vm->_objectsManager._bob[bobId]._oldY + 6;
_vm->_globals.ZONEP[bobZoneId]._spriteIndex = -1;
if (!ZONEP[bobZoneId]._destX && !ZONEP[bobZoneId]._destY) {
ZONEP[bobZoneId]._destX = _vm->_objectsManager._bob[bobId]._oldWidth + _vm->_objectsManager._bob[bobId]._oldX;
ZONEP[bobZoneId]._destY = _vm->_objectsManager._bob[bobId]._oldHeight + _vm->_objectsManager._bob[bobId]._oldY + 6;
ZONEP[bobZoneId]._spriteIndex = -1;
}
return bobZoneId;
}
@ -2985,7 +2995,7 @@ int LinesManager::MZONE() {
}
_currentSegmentId = 0;
for (int squareZoneId = 0; squareZoneId <= 99; squareZoneId++) {
if (_vm->_globals.ZONEP[squareZoneId]._enabledFl && _squareZone[squareZoneId]._enabledFl == 1
if (ZONEP[squareZoneId]._enabledFl && _squareZone[squareZoneId]._enabledFl == 1
&& _squareZone[squareZoneId]._left <= xp && _squareZone[squareZoneId]._right >= xp
&& _squareZone[squareZoneId]._top <= yp && _squareZone[squareZoneId]._bottom >= yp) {
if (_squareZone[squareZoneId]._squareZoneFl)
@ -3003,7 +3013,7 @@ int LinesManager::MZONE() {
int colRes1 = 0;
for (int yCurrent = yp; yCurrent >= 0; --yCurrent) {
colRes1 = colision(xp, yCurrent);
if (colRes1 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl)
if (colRes1 != -1 && ZONEP[colRes1]._enabledFl)
break;
}
@ -3013,7 +3023,7 @@ int LinesManager::MZONE() {
int colRes2 = 0;
for (int j = yp; j < _vm->_graphicsManager._maxY; ++j) {
colRes2 = colision(xp, j);
if (colRes2 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl)
if (colRes2 != -1 && ZONEP[colRes1]._enabledFl)
break;
}
@ -3023,7 +3033,7 @@ int LinesManager::MZONE() {
int colRes3 = 0;
for (int k = xp; k >= 0; --k) {
colRes3 = colision(k, yp);
if (colRes3 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl)
if (colRes3 != -1 && ZONEP[colRes1]._enabledFl)
break;
}
if (colRes3 == -1)
@ -3032,7 +3042,7 @@ int LinesManager::MZONE() {
int colRes4 = 0;
for (int xCurrent = xp; _vm->_graphicsManager._maxX > xCurrent; ++xCurrent) {
colRes4 = colision(xCurrent, yp);
if (colRes4 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl)
if (colRes4 != -1 && ZONEP[colRes1]._enabledFl)
break;
}
if (colRes1 == colRes2 && colRes1 == colRes3 && colRes1 == colRes4)
@ -3145,6 +3155,12 @@ void LinesManager::CARRE_ZONE() {
}
void LinesManager::clearAll() {
for (int idx = 0; idx < 105; ++idx) {
_vm->_linesManager.ZONEP[idx]._destX = 0;
_vm->_linesManager.ZONEP[idx]._destY = 0;
_vm->_linesManager.ZONEP[idx]._spriteIndex = 0;
}
_vm->_linesManager.essai0 = (int16 *)g_PTRNUL;
_vm->_linesManager.essai1 = (int16 *)g_PTRNUL;
_vm->_linesManager.essai2 = (int16 *)g_PTRNUL;
@ -3217,4 +3233,110 @@ void LinesManager::resetLastLine() {
void LinesManager::resetLinesNumb() {
_linesNumb = 0;
}
void LinesManager::enableZone(int idx) {
if (BOBZONE[idx]) {
BOBZONE_FLAG[idx] = true;
} else {
ZONEP[idx]._enabledFl = true;
}
}
void LinesManager::disableZone(int idx) {
if (BOBZONE[idx]) {
BOBZONE_FLAG[idx] = false;
} else {
ZONEP[idx]._enabledFl = false;
}
}
void LinesManager::checkZone() {
int mouseX = _vm->_eventsManager.getMouseX();
int mouseY = _vm->_eventsManager.getMouseY();
int oldMouseY = mouseY;
if (_vm->_globals._cityMapEnabledFl
|| _vm->_eventsManager._startPos.x >= mouseX
|| (mouseY = _vm->_graphicsManager._scrollOffset + 54, mouseX >= mouseY)
|| (mouseY = oldMouseY - 1, mouseY < 0 || mouseY > 59)) {
if (_vm->_objectsManager._visibleFl)
_vm->_objectsManager._eraseVisibleCounter = 4;
_vm->_objectsManager._visibleFl = false;
} else {
_vm->_objectsManager._visibleFl = true;
}
if (_vm->_objectsManager._forceZoneFl) {
_vm->_globals.compteur_71 = 100;
_vm->_globals._oldMouseZoneId = -1;
_vm->_globals._oldMouseX = -200;
_vm->_globals._oldMouseY = -220;
_vm->_objectsManager._forceZoneFl = false;
}
_vm->_globals.compteur_71++;
if (_vm->_globals.compteur_71 <= 1)
return;
if (_vm->_globals.NOMARCHE || (_vm->_linesManager._route == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) {
_vm->_globals.compteur_71 = 0;
int zoneId;
if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) {
zoneId = _vm->_linesManager.MZONE();
} else {
zoneId = _vm->_globals._oldMouseZoneId;
}
if (_vm->_globals._oldMouseZoneId != zoneId) {
_vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100);
_vm->_eventsManager._mouseCursorId = 4;
_vm->_eventsManager.changeMouseCursor(4);
if (_vm->_globals._forceHideText) {
_vm->_fontManager.hideText(5);
_vm->_globals._forceHideText = false;
return;
}
}
if (zoneId != -1) {
if (ZONEP[zoneId].field6 || ZONEP[zoneId].field7 ||
ZONEP[zoneId].field8 || ZONEP[zoneId].field9 ||
ZONEP[zoneId].fieldA || ZONEP[zoneId].fieldB ||
ZONEP[zoneId].fieldC || ZONEP[zoneId].fieldD ||
ZONEP[zoneId].fieldE || ZONEP[zoneId].fieldF) {
if (_vm->_globals._oldMouseZoneId != zoneId) {
_vm->_fontManager.initTextBuffers(5, ZONEP[zoneId].field12, _vm->_globals.FICH_ZONE, 0, 430, 0, 0, 252);
_vm->_fontManager.showText(5);
_vm->_globals._forceHideText = true;
}
_vm->_globals._hotspotTextColor += 25;
if (_vm->_globals._hotspotTextColor > 100)
_vm->_globals._hotspotTextColor = 0;
_vm->_graphicsManager.SETCOLOR4(251, _vm->_globals._hotspotTextColor, _vm->_globals._hotspotTextColor,
_vm->_globals._hotspotTextColor);
if (_vm->_eventsManager._mouseCursorId == 4) {
if (ZONEP[zoneId].field6 == 2) {
_vm->_eventsManager.changeMouseCursor(16);
_vm->_eventsManager._mouseCursorId = 16;
_vm->_objectsManager.setVerb(16);
}
}
} else {
_vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100);
_vm->_eventsManager._mouseCursorId = 4;
_vm->_eventsManager.changeMouseCursor(4);
}
}
_vm->_objectsManager._zoneNum = zoneId;
_vm->_globals._oldMouseX = mouseX;
_vm->_globals._oldMouseY = oldMouseY;
_vm->_globals._oldMouseZoneId = zoneId;
if (_vm->_globals.NOMARCHE && (_vm->_eventsManager._mouseCursorId == 4)) {
if (zoneId != -1 && zoneId != 0)
_vm->_objectsManager.handleRightButton();
}
if ((_vm->_globals._cityMapEnabledFl && zoneId == -1) || !zoneId) {
_vm->_objectsManager.setVerb(0);
_vm->_eventsManager._mouseCursorId = 0;
_vm->_eventsManager.changeMouseCursor(0);
}
}
}
} // End of namespace Hopkins

View File

@ -65,6 +65,24 @@ struct SquareZoneItem {
bool _squareZoneFl;
};
struct ZonePItem {
int _destX;
int _destY;
int _spriteIndex;
int field6;
int field7;
int field8;
int field9;
int fieldA;
int fieldB;
int fieldC;
int fieldD;
int fieldE;
int fieldF;
bool _enabledFl;
int field12;
};
class LinesManager {
private:
HopkinsEngine *_vm;
@ -112,6 +130,10 @@ public:
int16 *_route;
int16 *essai2;
int BOBZONE[105];
bool BOBZONE_FLAG[105];
ZonePItem ZONEP[106];
LinesManager();
~LinesManager();
void setParent(HopkinsEngine *vm);
@ -128,6 +150,9 @@ public:
void resetLines();
void resetLinesNumb();
void resetLastLine();
void enableZone(int idx);
void disableZone(int idx);
void checkZone();
int MZONE();
void CARRE_ZONE();

View File

@ -34,9 +34,9 @@
namespace Hopkins {
ObjectsManager::ObjectsManager() {
for (int i = 0; i < 6; ++i) {
for (int i = 0; i < 6; ++i)
Common::fill((byte *)&_sprite[i], (byte *)&_sprite[i] + sizeof(SpriteItem), 0);
}
for (int i = 0; i < 36; ++i)
Common::fill((byte *)&_bob[i], (byte *)&_bob[i] + sizeof(BobItem), 0);
@ -1264,95 +1264,6 @@ void ObjectsManager::setFlipSprite(int idx, bool flipFl) {
_sprite[idx]._flipFl = flipFl;
}
void ObjectsManager::checkZone() {
int mouseX = _vm->_eventsManager.getMouseX();
int mouseY = _vm->_eventsManager.getMouseY();
int oldMouseY = mouseY;
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)
_eraseVisibleCounter = 4;
_visibleFl = false;
} else {
_visibleFl = true;
}
if (_forceZoneFl) {
_vm->_globals.compteur_71 = 100;
_vm->_globals._oldMouseZoneId = -1;
_vm->_globals._oldMouseX = -200;
_vm->_globals._oldMouseY = -220;
_forceZoneFl = false;
}
_vm->_globals.compteur_71++;
if (_vm->_globals.compteur_71 <= 1)
return;
if (_vm->_globals.NOMARCHE || (_vm->_linesManager._route == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) {
_vm->_globals.compteur_71 = 0;
int zoneId;
if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) {
zoneId = _vm->_linesManager.MZONE();
} else {
zoneId = _vm->_globals._oldMouseZoneId;
}
if (_vm->_globals._oldMouseZoneId != zoneId) {
_vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100);
_vm->_eventsManager._mouseCursorId = 4;
_vm->_eventsManager.changeMouseCursor(4);
if (_vm->_globals._forceHideText) {
_vm->_fontManager.hideText(5);
_vm->_globals._forceHideText = false;
return;
}
}
if (zoneId != -1) {
if (_vm->_globals.ZONEP[zoneId].field6 || _vm->_globals.ZONEP[zoneId].field7 ||
_vm->_globals.ZONEP[zoneId].field8 || _vm->_globals.ZONEP[zoneId].field9 ||
_vm->_globals.ZONEP[zoneId].fieldA || _vm->_globals.ZONEP[zoneId].fieldB ||
_vm->_globals.ZONEP[zoneId].fieldC || _vm->_globals.ZONEP[zoneId].fieldD ||
_vm->_globals.ZONEP[zoneId].fieldE || _vm->_globals.ZONEP[zoneId].fieldF) {
if (_vm->_globals._oldMouseZoneId != zoneId) {
_vm->_fontManager.initTextBuffers(5, _vm->_globals.ZONEP[zoneId].field12, _vm->_globals.FICH_ZONE, 0, 430, 0, 0, 252);
_vm->_fontManager.showText(5);
_vm->_globals._forceHideText = true;
}
_vm->_globals._hotspotTextColor += 25;
if (_vm->_globals._hotspotTextColor > 100)
_vm->_globals._hotspotTextColor = 0;
_vm->_graphicsManager.SETCOLOR4(251, _vm->_globals._hotspotTextColor, _vm->_globals._hotspotTextColor,
_vm->_globals._hotspotTextColor);
if (_vm->_eventsManager._mouseCursorId == 4) {
if (_vm->_globals.ZONEP[zoneId].field6 == 2) {
_vm->_eventsManager.changeMouseCursor(16);
_vm->_eventsManager._mouseCursorId = 16;
_verb = 16;
}
}
} else {
_vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100);
_vm->_eventsManager._mouseCursorId = 4;
_vm->_eventsManager.changeMouseCursor(4);
}
}
_zoneNum = zoneId;
_vm->_globals._oldMouseX = mouseX;
_vm->_globals._oldMouseY = oldMouseY;
_vm->_globals._oldMouseZoneId = zoneId;
if (_vm->_globals.NOMARCHE && (_vm->_eventsManager._mouseCursorId == 4)) {
if (zoneId != -1 && zoneId != 0)
handleRightButton();
}
if ((_vm->_globals._cityMapEnabledFl && zoneId == -1) || !zoneId) {
_verb = 0;
_vm->_eventsManager._mouseCursorId = 0;
_vm->_eventsManager.changeMouseCursor(0);
}
}
}
void ObjectsManager::GOHOME() {
int v0 = 0;
int v58 = 0;
@ -1399,14 +1310,14 @@ void ObjectsManager::GOHOME() {
_vm->_linesManager._route = (int16 *)g_PTRNUL;
_vm->_globals._oldDirection = -1;
if (zoneId > 0) {
if (_vm->_globals.ZONEP[zoneId]._destX && _vm->_globals.ZONEP[zoneId]._destY && _vm->_globals.ZONEP[zoneId]._destY != 31) {
if (_vm->_globals.ZONEP[zoneId]._spriteIndex == -1) {
_vm->_globals.ZONEP[zoneId]._destX = 0;
_vm->_globals.ZONEP[zoneId]._destY = 0;
_vm->_globals.ZONEP[zoneId]._spriteIndex = 0;
if (_vm->_linesManager.ZONEP[zoneId]._destX && _vm->_linesManager.ZONEP[zoneId]._destY && _vm->_linesManager.ZONEP[zoneId]._destY != 31) {
if (_vm->_linesManager.ZONEP[zoneId]._spriteIndex == -1) {
_vm->_linesManager.ZONEP[zoneId]._destX = 0;
_vm->_linesManager.ZONEP[zoneId]._destY = 0;
_vm->_linesManager.ZONEP[zoneId]._spriteIndex = 0;
} else {
setSpriteIndex(0, _vm->_globals.ZONEP[zoneId]._spriteIndex);
_vm->_globals._actionDirection = _vm->_globals.ZONEP[zoneId]._spriteIndex - 59;
setSpriteIndex(0, _vm->_linesManager.ZONEP[zoneId]._spriteIndex);
_vm->_globals._actionDirection = _vm->_linesManager.ZONEP[zoneId]._spriteIndex - 59;
}
}
}
@ -1621,14 +1532,14 @@ void ObjectsManager::GOHOME() {
_oldCharacterPosY = getSpriteY(0);
if (zoneId > 0) {
if (_vm->_globals.ZONEP[zoneId]._destX && _vm->_globals.ZONEP[zoneId]._destY && _vm->_globals.ZONEP[zoneId]._destY != 31) {
if ( _vm->_globals.ZONEP[zoneId]._spriteIndex == -1) {
_vm->_globals.ZONEP[zoneId]._destX = 0;
_vm->_globals.ZONEP[zoneId]._destY = 0;
_vm->_globals.ZONEP[zoneId]._spriteIndex = 0;
if (_vm->_linesManager.ZONEP[zoneId]._destX && _vm->_linesManager.ZONEP[zoneId]._destY && _vm->_linesManager.ZONEP[zoneId]._destY != 31) {
if ( _vm->_linesManager.ZONEP[zoneId]._spriteIndex == -1) {
_vm->_linesManager.ZONEP[zoneId]._destX = 0;
_vm->_linesManager.ZONEP[zoneId]._destY = 0;
_vm->_linesManager.ZONEP[zoneId]._spriteIndex = 0;
} else {
setSpriteIndex(0, _vm->_globals.ZONEP[zoneId]._spriteIndex);
_vm->_globals._actionDirection = _vm->_globals.ZONEP[zoneId]._spriteIndex - 59;
setSpriteIndex(0, _vm->_linesManager.ZONEP[zoneId]._spriteIndex);
_vm->_globals._actionDirection = _vm->_linesManager.ZONEP[zoneId]._spriteIndex - 59;
}
}
}
@ -1726,21 +1637,21 @@ void ObjectsManager::GOHOME2() {
*/
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]._spriteIndex = 0;
_vm->_globals.ZONEP[i].field6 = 0;
_vm->_globals.ZONEP[i].field7 = 0;
_vm->_globals.ZONEP[i].field8 = 0;
_vm->_globals.ZONEP[i].field9 = 0;
_vm->_globals.ZONEP[i].fieldA = 0;
_vm->_globals.ZONEP[i].fieldB = 0;
_vm->_globals.ZONEP[i].fieldC = 0;
_vm->_globals.ZONEP[i].fieldD = 0;
_vm->_globals.ZONEP[i].fieldE = 0;
_vm->_globals.ZONEP[i].fieldF = 0;
_vm->_globals.ZONEP[i].field12 = 0;
_vm->_globals.ZONEP[i]._enabledFl = false;
_vm->_linesManager.ZONEP[i]._destX = 0;
_vm->_linesManager.ZONEP[i]._destY = 0;
_vm->_linesManager.ZONEP[i]._spriteIndex = 0;
_vm->_linesManager.ZONEP[i].field6 = 0;
_vm->_linesManager.ZONEP[i].field7 = 0;
_vm->_linesManager.ZONEP[i].field8 = 0;
_vm->_linesManager.ZONEP[i].field9 = 0;
_vm->_linesManager.ZONEP[i].fieldA = 0;
_vm->_linesManager.ZONEP[i].fieldB = 0;
_vm->_linesManager.ZONEP[i].fieldC = 0;
_vm->_linesManager.ZONEP[i].fieldD = 0;
_vm->_linesManager.ZONEP[i].fieldE = 0;
_vm->_linesManager.ZONEP[i].fieldF = 0;
_vm->_linesManager.ZONEP[i].field12 = 0;
_vm->_linesManager.ZONEP[i]._enabledFl = false;
}
Common::File f;
@ -1761,38 +1672,38 @@ void ObjectsManager::loadZone(const Common::String &file) {
READ_LE_UINT16((uint16 *)ptr + bufId + 3),
READ_LE_UINT16((uint16 *)ptr + bufId + 4),
bobZoneIdx);
_vm->_globals.ZONEP[bobZoneIdx]._enabledFl = true;
_vm->_linesManager.ZONEP[bobZoneIdx]._enabledFl = true;
}
bufId += 5;
++zoneLineIdx;
} while (bobZoneIdx != -1);
for (int i = 1; i <= 100; i++) {
_vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + bufId);
_vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 1);
_vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 2);
_vm->_linesManager.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + bufId);
_vm->_linesManager.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 1);
_vm->_linesManager.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 2);
bufId += 3;
}
byte *v9 = (ptr + 10 * zoneLineIdx + 606);
bufId = 0;
for (int i = 1; i <= 100; i++) {
_vm->_globals.ZONEP[i].field6 = v9[bufId];
_vm->_globals.ZONEP[i].field7 = v9[bufId + 1];
_vm->_globals.ZONEP[i].field8 = v9[bufId + 2];
_vm->_globals.ZONEP[i].field9 = v9[bufId + 3];
_vm->_globals.ZONEP[i].fieldA = v9[bufId + 4];
_vm->_globals.ZONEP[i].fieldB = v9[bufId + 5];
_vm->_globals.ZONEP[i].fieldC = v9[bufId + 6];
_vm->_globals.ZONEP[i].fieldD = v9[bufId + 7];
_vm->_globals.ZONEP[i].fieldE = v9[bufId + 8];
_vm->_globals.ZONEP[i].fieldF = v9[bufId + 9];
_vm->_linesManager.ZONEP[i].field6 = v9[bufId];
_vm->_linesManager.ZONEP[i].field7 = v9[bufId + 1];
_vm->_linesManager.ZONEP[i].field8 = v9[bufId + 2];
_vm->_linesManager.ZONEP[i].field9 = v9[bufId + 3];
_vm->_linesManager.ZONEP[i].fieldA = v9[bufId + 4];
_vm->_linesManager.ZONEP[i].fieldB = v9[bufId + 5];
_vm->_linesManager.ZONEP[i].fieldC = v9[bufId + 6];
_vm->_linesManager.ZONEP[i].fieldD = v9[bufId + 7];
_vm->_linesManager.ZONEP[i].fieldE = v9[bufId + 8];
_vm->_linesManager.ZONEP[i].fieldF = v9[bufId + 9];
bufId += 10;
}
v9 += 1010;
for (int i = 0; i < 100; i++)
_vm->_globals.ZONEP[i + 1].field12 = READ_LE_UINT16(v9 + 2 * i);
_vm->_linesManager.ZONEP[i + 1].field12 = READ_LE_UINT16(v9 + 2 * i);
_vm->_globals.freeMemory(ptr);
_vm->_linesManager.CARRE_ZONE();
@ -1872,7 +1783,7 @@ void ObjectsManager::handleCityMap() {
handleLeftButton();
}
checkZone();
_vm->_linesManager.checkZone();
GOHOME2();
if (_vm->_linesManager._route == (int16 *)g_PTRNUL && _vm->_globals.GOACTION)
@ -1940,7 +1851,7 @@ void ObjectsManager::handleLeftButton() {
}
}
if (_vm->_globals._cityMapEnabledFl && _vm->_globals.GOACTION) {
checkZone();
_vm->_linesManager.checkZone();
if (_zoneNum <= 0)
return;
int routeIdx = 0;
@ -1956,7 +1867,7 @@ void ObjectsManager::handleLeftButton() {
}
if (_vm->_globals.GOACTION) {
checkZone();
_vm->_linesManager.checkZone();
_vm->_globals.GOACTION = false;
_vm->_globals._saveData->_data[svField1] = 0;
_vm->_globals._saveData->_data[svField2] = 0;
@ -1965,9 +1876,9 @@ void ObjectsManager::handleLeftButton() {
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) {
destX = _vm->_globals.ZONEP[_zoneNum]._destX;
destY = _vm->_globals.ZONEP[_zoneNum]._destY;
if (_vm->_linesManager.ZONEP[_zoneNum]._destX && _vm->_linesManager.ZONEP[_zoneNum]._destY && _vm->_linesManager.ZONEP[_zoneNum]._destY != 31) {
destX = _vm->_linesManager.ZONEP[_zoneNum]._destX;
destY = _vm->_linesManager.ZONEP[_zoneNum]._destY;
}
}
_vm->_globals.GOACTION = false;
@ -2092,7 +2003,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]._enabledFl) {
if (_zoneNum != -1 && _zoneNum != 0 && !_vm->_linesManager.ZONEP[_zoneNum]._enabledFl) {
_zoneNum = -1;
_forceZoneFl = true;
}
@ -2140,8 +2051,8 @@ void ObjectsManager::clearScreen() {
_vm->_globals.resetCache();
for (int i = 0; i <= 48; i++) {
_vm->_globals.BOBZONE[i] = 0;
_vm->_globals.BOBZONE_FLAG[i] = false;
_vm->_linesManager.BOBZONE[i] = 0;
_vm->_linesManager.BOBZONE_FLAG[i] = false;
}
_vm->_eventsManager._mouseCursorId = 4;
_verb = 4;
@ -2309,139 +2220,139 @@ void ObjectsManager::nextVerbIcon() {
if (_vm->_eventsManager._mouseCursorId == 5 || _vm->_eventsManager._mouseCursorId == 6) {
_vm->_eventsManager._mouseCursorId = 6;
if (_vm->_globals.ZONEP[_zoneNum].field6 == 1)
if (_vm->_linesManager.ZONEP[_zoneNum].field6 == 1)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 7) {
if (_vm->_globals.ZONEP[_zoneNum].field7 == 1)
if (_vm->_linesManager.ZONEP[_zoneNum].field7 == 1)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 8) {
if (_vm->_globals.ZONEP[_zoneNum].field8 == 1)
if (_vm->_linesManager.ZONEP[_zoneNum].field8 == 1)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 9) {
if (_vm->_globals.ZONEP[_zoneNum].field9 == 1)
if (_vm->_linesManager.ZONEP[_zoneNum].field9 == 1)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 10) {
if (_vm->_globals.ZONEP[_zoneNum].fieldA == 1)
if (_vm->_linesManager.ZONEP[_zoneNum].fieldA == 1)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 11) {
if (_vm->_globals.ZONEP[_zoneNum].fieldB == 1)
if (_vm->_linesManager.ZONEP[_zoneNum].fieldB == 1)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 12) {
if (_vm->_globals.ZONEP[_zoneNum].fieldC == 1)
if (_vm->_linesManager.ZONEP[_zoneNum].fieldC == 1)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 13) {
if (_vm->_globals.ZONEP[_zoneNum].fieldD == 1)
if (_vm->_linesManager.ZONEP[_zoneNum].fieldD == 1)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 14) {
if (_vm->_globals.ZONEP[_zoneNum].fieldE == 1)
if (_vm->_linesManager.ZONEP[_zoneNum].fieldE == 1)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 15) {
if (_vm->_globals.ZONEP[_zoneNum].fieldF == 1)
if (_vm->_linesManager.ZONEP[_zoneNum].fieldF == 1)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 16) {
if (_vm->_globals.ZONEP[_zoneNum].field6 == 2)
if (_vm->_linesManager.ZONEP[_zoneNum].field6 == 2)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 17) {
if (_vm->_globals.ZONEP[_zoneNum].field9 == 2)
if (_vm->_linesManager.ZONEP[_zoneNum].field9 == 2)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 18) {
if (_vm->_globals.ZONEP[_zoneNum].fieldA == 2)
if (_vm->_linesManager.ZONEP[_zoneNum].fieldA == 2)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 19) {
if (_vm->_globals.ZONEP[_zoneNum].fieldB == 2)
if (_vm->_linesManager.ZONEP[_zoneNum].fieldB == 2)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 20) {
if (_vm->_globals.ZONEP[_zoneNum].fieldC == 2)
if (_vm->_linesManager.ZONEP[_zoneNum].fieldC == 2)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 21) {
if (_vm->_globals.ZONEP[_zoneNum].fieldF == 2)
if (_vm->_linesManager.ZONEP[_zoneNum].fieldF == 2)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 22) {
if (_vm->_globals.ZONEP[_zoneNum].fieldD == 2)
if (_vm->_linesManager.ZONEP[_zoneNum].fieldD == 2)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 23) {
if (_vm->_globals.ZONEP[_zoneNum].field8 == 2)
if (_vm->_linesManager.ZONEP[_zoneNum].field8 == 2)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 24) {
if (_vm->_globals.ZONEP[_zoneNum].field9 == 3)
if (_vm->_linesManager.ZONEP[_zoneNum].field9 == 3)
return;
++_vm->_eventsManager._mouseCursorId;
}
if (_vm->_eventsManager._mouseCursorId == 25) {
if (_vm->_globals.ZONEP[_zoneNum].fieldE == 2)
if (_vm->_linesManager.ZONEP[_zoneNum].fieldE == 2)
return;
}
_vm->_eventsManager._mouseCursorId = 4;
@ -2744,14 +2655,14 @@ void ObjectsManager::handleSpecialGames() {
setBobAnimDataIdx(5, 0);
setBobAnimation(6);
_vm->_globals._saveData->_data[svField261] = 2;
disableZone(15);
_vm->_linesManager.disableZone(15);
_vm->_soundManager.playSound("SOUND75.WAV");
}
if (_vm->_globals._saveData->_data[svField261] == 2 && getBobAnimDataIdx(6) == 6) {
stopBobAnimation(6);
setBobAnimDataIdx(6, 0);
setBobAnimation(7);
enableZone(14);
_vm->_linesManager.enableZone(14);
_vm->_globals._saveData->_data[svField261] = 3;
}
_vm->_globals._disableInventFl = false;
@ -3051,22 +2962,6 @@ void ObjectsManager::ACTION_GAUCHE(int idx) {
}
}
void ObjectsManager::enableZone(int idx) {
if (_vm->_globals.BOBZONE[idx]) {
_vm->_globals.BOBZONE_FLAG[idx] = true;
} else {
_vm->_globals.ZONEP[idx]._enabledFl = true;
}
}
void ObjectsManager::disableZone(int idx) {
if (_vm->_globals.BOBZONE[idx]) {
_vm->_globals.BOBZONE_FLAG[idx] = false;
} else {
_vm->_globals.ZONEP[idx]._enabledFl = false;
}
}
void ObjectsManager::OPTI_ONE(int idx, int animIdx, int destPosi, int animAction) {
// Set Hopkins animation and position
if (animAction != 3) {
@ -3226,20 +3121,20 @@ void ObjectsManager::INILINK(const Common::String &file) {
byte *curDataPtr = &ptr[idx + 4];
int curDataIdx = 0;
for (int i = 1; i <= 100; i++) {
_vm->_globals.ZONEP[i]._destX = 0;
_vm->_globals.ZONEP[i]._destY = 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;
_vm->_globals.ZONEP[i].field9 = 0;
_vm->_globals.ZONEP[i].fieldA = 0;
_vm->_globals.ZONEP[i].fieldB = 0;
_vm->_globals.ZONEP[i].fieldC = 0;
_vm->_globals.ZONEP[i].fieldD = 0;
_vm->_globals.ZONEP[i].fieldE = 0;
_vm->_globals.ZONEP[i].fieldF = 0;
_vm->_globals.ZONEP[i].field12 = 0;
_vm->_linesManager.ZONEP[i]._destX = 0;
_vm->_linesManager.ZONEP[i]._destY = 0;
_vm->_linesManager.ZONEP[i]._spriteIndex = 0;
_vm->_linesManager.ZONEP[i].field6 = 0;
_vm->_linesManager.ZONEP[i].field7 = 0;
_vm->_linesManager.ZONEP[i].field8 = 0;
_vm->_linesManager.ZONEP[i].field9 = 0;
_vm->_linesManager.ZONEP[i].fieldA = 0;
_vm->_linesManager.ZONEP[i].fieldB = 0;
_vm->_linesManager.ZONEP[i].fieldC = 0;
_vm->_linesManager.ZONEP[i].fieldD = 0;
_vm->_linesManager.ZONEP[i].fieldE = 0;
_vm->_linesManager.ZONEP[i].fieldF = 0;
_vm->_linesManager.ZONEP[i].field12 = 0;
}
int curLineIdx = 0;
@ -3254,35 +3149,35 @@ void ObjectsManager::INILINK(const Common::String &file) {
(int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 6),
(int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 8),
v28);
_vm->_globals.ZONEP[v28]._enabledFl = true;
_vm->_linesManager.ZONEP[v28]._enabledFl = true;
}
curDataIdx += 5;
++curLineIdx;
} while (v28 != -1);
for (int i = 1; i <= 100; i++) {
_vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx);
_vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 2);
_vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 4);
_vm->_linesManager.ZONEP[i]._destX = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx);
_vm->_linesManager.ZONEP[i]._destY = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 2);
_vm->_linesManager.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 4);
curDataIdx += 3;
}
byte *v22 = ptr + idx + (10 * curLineIdx + 606) + 4;
for (int i = 1; i <= 100; i++) {
int j = (i - 1) * 10;
_vm->_globals.ZONEP[i].field6 = v22[j];
_vm->_globals.ZONEP[i].field7 = v22[j + 1];
_vm->_globals.ZONEP[i].field8 = v22[j + 2];
_vm->_globals.ZONEP[i].field9 = v22[j + 3];
_vm->_globals.ZONEP[i].fieldA = v22[j + 4];
_vm->_globals.ZONEP[i].fieldB = v22[j + 5];
_vm->_globals.ZONEP[i].fieldC = v22[j + 6];
_vm->_globals.ZONEP[i].fieldD = v22[j + 7];
_vm->_globals.ZONEP[i].fieldE = v22[j + 8];
_vm->_globals.ZONEP[i].fieldF = v22[j + 9];
_vm->_linesManager.ZONEP[i].field6 = v22[j];
_vm->_linesManager.ZONEP[i].field7 = v22[j + 1];
_vm->_linesManager.ZONEP[i].field8 = v22[j + 2];
_vm->_linesManager.ZONEP[i].field9 = v22[j + 3];
_vm->_linesManager.ZONEP[i].fieldA = v22[j + 4];
_vm->_linesManager.ZONEP[i].fieldB = v22[j + 5];
_vm->_linesManager.ZONEP[i].fieldC = v22[j + 6];
_vm->_linesManager.ZONEP[i].fieldD = v22[j + 7];
_vm->_linesManager.ZONEP[i].fieldE = v22[j + 8];
_vm->_linesManager.ZONEP[i].fieldF = v22[j + 9];
}
int dep = 1010;
for (int i = 1; i <= 100; i++) {
_vm->_globals.ZONEP[i].field12 = (int16)READ_LE_UINT16(v22 + dep);
_vm->_linesManager.ZONEP[i].field12 = (int16)READ_LE_UINT16(v22 + dep);
dep += 2;
}
_vm->_linesManager.CARRE_ZONE();
@ -3355,22 +3250,22 @@ void ObjectsManager::SPECIAL_INI() {
case 39:
case 40:
case 41:
_vm->_globals.BOBZONE[20] = 1;
_vm->_globals.BOBZONE[21] = 2;
_vm->_globals.BOBZONE[22] = 3;
_vm->_globals.BOBZONE[23] = 4;
_vm->_globals.BOBZONE_FLAG[20] = true;
_vm->_globals.BOBZONE_FLAG[21] = true;
_vm->_globals.BOBZONE_FLAG[22] = true;
_vm->_globals.BOBZONE_FLAG[23] = true;
_vm->_linesManager.BOBZONE[20] = 1;
_vm->_linesManager.BOBZONE[21] = 2;
_vm->_linesManager.BOBZONE[22] = 3;
_vm->_linesManager.BOBZONE[23] = 4;
_vm->_linesManager.BOBZONE_FLAG[20] = true;
_vm->_linesManager.BOBZONE_FLAG[21] = true;
_vm->_linesManager.BOBZONE_FLAG[22] = true;
_vm->_linesManager.BOBZONE_FLAG[23] = true;
enableVerb(20, 5);
enableVerb(21, 5);
enableVerb(22, 5);
enableVerb(23, 5);
_vm->_globals.ZONEP[20].field12 = 30;
_vm->_globals.ZONEP[21].field12 = 30;
_vm->_globals.ZONEP[22].field12 = 30;
_vm->_globals.ZONEP[23].field12 = 30;
_vm->_linesManager.ZONEP[20].field12 = 30;
_vm->_linesManager.ZONEP[21].field12 = 30;
_vm->_linesManager.ZONEP[22].field12 = 30;
_vm->_linesManager.ZONEP[23].field12 = 30;
for (int i = 200; i <= 214; i++) {
if (_vm->_globals._saveData->_data[i] != 2)
_vm->_globals._saveData->_data[i] = 0;
@ -3428,42 +3323,42 @@ void ObjectsManager::disableVerb(int idx, int a2) {
switch (a2) {
case 6:
case 16:
_vm->_globals.ZONEP[idx].field6 = 0;
_vm->_linesManager.ZONEP[idx].field6 = 0;
break;
case 7:
_vm->_globals.ZONEP[idx].field7 = 0;
_vm->_linesManager.ZONEP[idx].field7 = 0;
break;
case 5:
case 8:
_vm->_globals.ZONEP[idx].field8 = 0;
_vm->_linesManager.ZONEP[idx].field8 = 0;
break;
case 9:
case 17:
case 24:
_vm->_globals.ZONEP[idx].field9 = 0;
_vm->_linesManager.ZONEP[idx].field9 = 0;
break;
case 10:
case 18:
_vm->_globals.ZONEP[idx].fieldA = 0;
_vm->_linesManager.ZONEP[idx].fieldA = 0;
break;
case 11:
case 19:
_vm->_globals.ZONEP[idx].fieldB = 0;
_vm->_linesManager.ZONEP[idx].fieldB = 0;
break;
case 12:
case 20:
_vm->_globals.ZONEP[idx].fieldC = 0;
_vm->_linesManager.ZONEP[idx].fieldC = 0;
break;
case 13:
case 22:
_vm->_globals.ZONEP[idx].fieldD = 0;
_vm->_linesManager.ZONEP[idx].fieldD = 0;
case 14:
case 21:
case 25:
_vm->_globals.ZONEP[idx].fieldE = 0;
_vm->_linesManager.ZONEP[idx].fieldE = 0;
break;
case 15:
_vm->_globals.ZONEP[idx].fieldF = 0;
_vm->_linesManager.ZONEP[idx].fieldF = 0;
break;
}
_changeVerbFl = true;
@ -3472,64 +3367,64 @@ void ObjectsManager::disableVerb(int idx, int a2) {
void ObjectsManager::enableVerb(int idx, int a2) {
switch (a2) {
case 5:
_vm->_globals.ZONEP[idx].field8 = 2;
_vm->_linesManager.ZONEP[idx].field8 = 2;
break;
case 6:
_vm->_globals.ZONEP[idx].field6 = 1;
_vm->_linesManager.ZONEP[idx].field6 = 1;
break;
case 7:
_vm->_globals.ZONEP[idx].field7 = 1;
_vm->_linesManager.ZONEP[idx].field7 = 1;
break;
case 8:
_vm->_globals.ZONEP[idx].field8 = 1;
_vm->_linesManager.ZONEP[idx].field8 = 1;
break;
case 9:
_vm->_globals.ZONEP[idx].field9 = 1;
_vm->_linesManager.ZONEP[idx].field9 = 1;
break;
case 10:
_vm->_globals.ZONEP[idx].fieldA = 1;
_vm->_linesManager.ZONEP[idx].fieldA = 1;
break;
case 11:
_vm->_globals.ZONEP[idx].fieldB = 1;
_vm->_linesManager.ZONEP[idx].fieldB = 1;
break;
case 12:
_vm->_globals.ZONEP[idx].fieldC = 1;
_vm->_linesManager.ZONEP[idx].fieldC = 1;
break;
case 13:
_vm->_globals.ZONEP[idx].fieldD = 1;
_vm->_linesManager.ZONEP[idx].fieldD = 1;
break;
case 14:
_vm->_globals.ZONEP[idx].fieldD = 1;
_vm->_linesManager.ZONEP[idx].fieldD = 1;
break;
case 15:
_vm->_globals.ZONEP[idx].fieldE = 1;
_vm->_linesManager.ZONEP[idx].fieldE = 1;
break;
case 16:
_vm->_globals.ZONEP[idx].field6 = 2;
_vm->_linesManager.ZONEP[idx].field6 = 2;
break;
case 17:
_vm->_globals.ZONEP[idx].field9 = 2;
_vm->_linesManager.ZONEP[idx].field9 = 2;
break;
case 18:
_vm->_globals.ZONEP[idx].fieldA = 2;
_vm->_linesManager.ZONEP[idx].fieldA = 2;
break;
case 19:
_vm->_globals.ZONEP[idx].fieldB = 2;
_vm->_linesManager.ZONEP[idx].fieldB = 2;
break;
case 20:
_vm->_globals.ZONEP[idx].fieldC = 2;
_vm->_linesManager.ZONEP[idx].fieldC = 2;
break;
case 21:
_vm->_globals.ZONEP[idx].fieldE = 2;
_vm->_linesManager.ZONEP[idx].fieldE = 2;
break;
case 22:
_vm->_globals.ZONEP[idx].fieldD = 2;
_vm->_linesManager.ZONEP[idx].fieldD = 2;
break;
case 24:
_vm->_globals.ZONEP[idx].field9 = 3;
_vm->_linesManager.ZONEP[idx].field9 = 3;
break;
case 25:
_vm->_globals.ZONEP[idx].fieldE = 2;
_vm->_linesManager.ZONEP[idx].fieldE = 2;
break;
}
}
@ -3824,7 +3719,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo
} else if (mouseButton == 2)
handleRightButton();
_vm->_dialogsManager.testDialogOpening();
checkZone();
_vm->_linesManager.checkZone();
if (_vm->_globals.GOACTION)
PARADISE();
if (!_vm->_globals._exitId)
@ -3962,7 +3857,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm
}
if (!_vm->_globals._exitId) {
_vm->_dialogsManager.testDialogOpening();
checkZone();
_vm->_linesManager.checkZone();
if (_vm->_linesManager._route == (int16 *)g_PTRNUL
|| (GOHOME(), _vm->_linesManager._route == (int16 *)g_PTRNUL)) {
if (_vm->_globals.GOACTION)
@ -3994,4 +3889,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm
_vm->_globals.iRegul = 0;
}
void ObjectsManager::setVerb(int id) {
_verb = id;
}
} // End of namespace Hopkins

View File

@ -200,10 +200,6 @@ public:
void changeObject(int objIndex);
void removeObject(int objIndex);
void checkZone();
void enableZone(int idx);
void disableZone(int idx);
void resetBob(int idx);
void setBobAnimDataIdx(int idx, int animIdx);
void setBobAnimation(int idx);
@ -219,6 +215,7 @@ public:
void handleLeftButton();
void handleRightButton();
void setOffsetXY(byte *data, int idx, int xp, int yp, bool isSize);
void setVerb(int id);
void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile,
const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen);

View File

@ -477,11 +477,11 @@ int ScriptManager::handleOpcode(byte *dataP) {
opcodeType = 2;
break;
case MKTAG24('Z', 'O', 'N'):
_vm->_objectsManager.enableZone((int16)READ_LE_UINT16(dataP + 5));
_vm->_linesManager.enableZone((int16)READ_LE_UINT16(dataP + 5));
opcodeType = 1;
break;
case MKTAG24('Z', 'O', 'F'):
_vm->_objectsManager.disableZone((int16)READ_LE_UINT16(dataP + 5));
_vm->_linesManager.disableZone((int16)READ_LE_UINT16(dataP + 5));
opcodeType = 1;
break;
case MKTAG24('E', 'X', 'I'):
@ -2229,7 +2229,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 245:
_vm->_soundManager.playSound("SOUND89.WAV");
_vm->_objectsManager.OPTI_ONE(5, 0, 6, 0);
_vm->_globals.ZONEP[4]._destX = 276;
_vm->_linesManager.ZONEP[4]._destX = 276;
_vm->_objectsManager.enableVerb(4, 19);
_vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 285, 379, 0);
_vm->_globals._saveData->_data[svField399] = 1;
@ -2390,7 +2390,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
opcodeType = 1;
break;
case MKTAG24('Z', 'C', 'H'):
_vm->_globals.ZONEP[(int16)READ_LE_UINT16(dataP + 5)].field12 = (int16)READ_LE_UINT16(dataP + 7);
_vm->_linesManager.ZONEP[(int16)READ_LE_UINT16(dataP + 5)].field12 = (int16)READ_LE_UINT16(dataP + 7);
opcodeType = 1;
break;
case MKTAG24('J', 'U', 'M'):

View File

@ -905,8 +905,8 @@ void TalkManager::REPONSE2(int zone, int verb) {
break;
}
_vm->_globals._saveData->_data[indx] = 2;
_vm->_objectsManager.disableZone(22);
_vm->_objectsManager.disableZone(23);
_vm->_linesManager.disableZone(22);
_vm->_linesManager.disableZone(23);
} else if (zone == 20 || zone == 21) {
_vm->_objectsManager.setFlipSprite(0, true);
_vm->_objectsManager.setSpriteIndex(0, 62);
@ -952,8 +952,8 @@ void TalkManager::REPONSE2(int zone, int verb) {
break;
}
_vm->_globals._saveData->_data[indx] = 2;
_vm->_objectsManager.disableZone(21);
_vm->_objectsManager.disableZone(20);
_vm->_linesManager.disableZone(21);
_vm->_linesManager.disableZone(20);
}
}
@ -967,7 +967,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) {
_vm->_globals.resetCache();
for (int i = 0; i <= 44; i++)
_vm->_globals.BOBZONE[i] = 0;
_vm->_linesManager.BOBZONE[i] = 0;
_vm->_objectsManager._zoneNum = -1;
_vm->_eventsManager._mouseCursorId = 4;
@ -1028,7 +1028,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) {
else if (mouseButton == 2)
_vm->_objectsManager.handleRightButton();
_vm->_objectsManager.checkZone();
_vm->_linesManager.checkZone();
if (_vm->_globals.GOACTION)
_vm->_objectsManager.PARADISE();
_vm->_eventsManager.VBL();
@ -1045,7 +1045,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) {
_vm->_linesManager.resetLines();
_vm->_globals.resetCache();
for (int i = 0; i <= 44; i++)
_vm->_globals.BOBZONE[i] = 0;
_vm->_linesManager.BOBZONE[i] = 0;
_vm->_globals.freeMemory(_vm->_globals._answerBuffer);
_vm->_globals._answerBuffer = oldAnswerBufferPtr;