diff options
author | Strangerke | 2013-01-01 13:53:07 +0100 |
---|---|---|
committer | Strangerke | 2013-01-01 13:53:07 +0100 |
commit | cb363aafd5ed1d912e5b211e06c823307fb00489 (patch) | |
tree | b44cbe4db11b103764517a3bfa0107982a7435e8 | |
parent | a8bc62fc0fb2ea5df8c08175c232af05ed898e38 (diff) | |
download | scummvm-rg350-cb363aafd5ed1d912e5b211e06c823307fb00489.tar.gz scummvm-rg350-cb363aafd5ed1d912e5b211e06c823307fb00489.tar.bz2 scummvm-rg350-cb363aafd5ed1d912e5b211e06c823307fb00489.zip |
HOPKINS: Refactoring in ObjectsManager, renaming
-rw-r--r-- | engines/hopkins/anim.cpp | 8 | ||||
-rw-r--r-- | engines/hopkins/dialogs.cpp | 86 | ||||
-rw-r--r-- | engines/hopkins/events.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/globals.cpp | 2 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 2 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/graphics.h | 2 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 50 | ||||
-rw-r--r-- | engines/hopkins/lines.cpp | 18 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 413 | ||||
-rw-r--r-- | engines/hopkins/objects.h | 12 | ||||
-rw-r--r-- | engines/hopkins/script.cpp | 2 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 4 |
13 files changed, 296 insertions, 311 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index ad967087f3..8b9945a429 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -241,7 +241,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) - _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager._scrollOffset = 0; v12 = _vm->_graphicsManager._vesaScreen; v13 = _vm->_globals.allocMemory(20); @@ -604,9 +604,9 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { int x2 = (int16)READ_LE_UINT16(v13 + 4); int y2 = (int16)READ_LE_UINT16(v13 + 6); - _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0); + _vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0); if (_vm->_globals.Bank[idx]._fileHeader == 2) - _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx]._data, objIdx, x2, y2, 1); + _vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x2, y2, 1); } _vm->_globals.freeMemory(v19); @@ -735,7 +735,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) - _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager._scrollOffset = 0; } v9 = _vm->_graphicsManager._vesaScreen; v10 = _vm->_globals.allocMemory(22); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 0e1be64b8f..6f734f589d 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -76,7 +76,7 @@ void DialogsManager::showOptionsDialog() { mousePos.y = _vm->_eventsManager.getMouseY(); if (!_vm->_soundManager._musicOffFl) { - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 327 && mousePos.y <= 138) { // Change the music volume ++_vm->_soundManager._musicVolume; @@ -89,7 +89,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - if (!_vm->_soundManager._musicOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { + if (!_vm->_soundManager._musicOffFl && mousePos.x >= _vm->_graphicsManager._scrollOffset + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 138) { --_vm->_soundManager._musicVolume; if (_vm->_soundManager._musicVolume >= 0) _vm->_soundManager.playSound("bruit2.wav"); @@ -102,7 +102,7 @@ void DialogsManager::showOptionsDialog() { } } if (!_vm->_soundManager._soundOffFl) { - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 165) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 327 && mousePos.y <= 165) { ++_vm->_soundManager._soundVolume; if (_vm->_soundManager._soundVolume <= 16) _vm->_soundManager.playSound("bruit2.wav"); @@ -113,7 +113,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - if (!_vm->_soundManager._soundOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 165) { + if (!_vm->_soundManager._soundOffFl && mousePos.x >= _vm->_graphicsManager._scrollOffset + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 165) { --_vm->_soundManager._soundVolume; if (_vm->_soundManager._soundVolume >= 0) _vm->_soundManager.playSound("bruit2.wav"); @@ -126,7 +126,7 @@ void DialogsManager::showOptionsDialog() { } if (!_vm->_soundManager._voiceOffFl) { - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 192) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 327 && mousePos.y <= 192) { ++_vm->_soundManager._voiceVolume; if (_vm->_soundManager._voiceVolume <= 16) @@ -138,7 +138,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - if (!_vm->_soundManager._voiceOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { + if (!_vm->_soundManager._voiceOffFl && mousePos.x >= _vm->_graphicsManager._scrollOffset + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 192) { --_vm->_soundManager._voiceVolume; if (_vm->_soundManager._voiceVolume >= 0) _vm->_soundManager.playSound("bruit2.wav"); @@ -150,18 +150,18 @@ void DialogsManager::showOptionsDialog() { } } - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 219) + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 431) { + if (mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 219) _vm->_soundManager._textOffFl = !_vm->_soundManager._textOffFl; - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 192) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 431) { + if (mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 192) { _vm->_soundManager._voiceOffFl = !_vm->_soundManager._voiceOffFl; _vm->_soundManager.updateScummVMSoundSettings(); } - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 138) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 431) { + if (mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 138) { if (_vm->_soundManager._musicOffFl) { _vm->_soundManager._musicOffFl = false; _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); @@ -173,7 +173,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 165) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 431 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 165) { _vm->_soundManager._soundOffFl = !_vm->_soundManager._soundOffFl; _vm->_soundManager.updateScummVMSoundSettings(); @@ -182,13 +182,13 @@ void DialogsManager::showOptionsDialog() { } } - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 175 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager.ofscroll + 281 && mousePos.y <= 310) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 175 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 281 && mousePos.y <= 310) { _vm->_globals._exitId = 300; doneFlag = true; } - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 355 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager.ofscroll + 490 && mousePos.y <= 310) + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 355 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 490 && mousePos.y <= 310) doneFlag = true; - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 219) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 219) { switch (_vm->_graphicsManager._scrollSpeed) { case 1: _vm->_graphicsManager._scrollSpeed = 2; @@ -232,7 +232,7 @@ void DialogsManager::showOptionsDialog() { //if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 221 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 246) // _vm->_globals.SVGA = 2; - if (mousePos.x < _vm->_graphicsManager.ofscroll + 165 || mousePos.x > _vm->_graphicsManager.ofscroll + 496 || (uint)(mousePos.y - 107) > 211) + if (mousePos.x < _vm->_graphicsManager._scrollOffset + 165 || mousePos.x > _vm->_graphicsManager._scrollOffset + 496 || (uint)(mousePos.y - 107) > 211) doneFlag = true; } @@ -288,10 +288,10 @@ void DialogsManager::showOptionsDialog() { _vm->_eventsManager.VBL(); } while (!doneFlag); - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_graphicsManager.ofscroll + 164, - 107, 335, 215, _vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.ofscroll + 164, 107); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_graphicsManager.ofscroll + 164, 107, - _vm->_graphicsManager.ofscroll + 498, 320); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_graphicsManager._scrollOffset + 164, + 107, 335, 215, _vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._scrollOffset + 164, 107); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_graphicsManager._scrollOffset + 164, 107, + _vm->_graphicsManager._scrollOffset + 498, 320); _vm->_globals.OPTION_SPR = _vm->_globals.freeMemory(_vm->_globals.OPTION_SPR); _vm->_globals._optionDialogFl = false; @@ -342,7 +342,7 @@ LABEL_7: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENT2.SPR"); _inventBuf2 = _vm->_fileManager.loadFile(_vm->_globals._curFilename); - int v19 = _inventX = _vm->_graphicsManager.ofscroll + 152; + int v19 = _inventX = _vm->_graphicsManager._scrollOffset + 152; _inventY = 114; int v18 = _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); int v17 = _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); @@ -378,25 +378,21 @@ LABEL_7: int mousePosX = _vm->_eventsManager.getMouseX(); int mousePosY = _vm->_eventsManager.getMouseY(); - int v12 = _vm->_eventsManager.getMouseButton(); + int mouseButton = _vm->_eventsManager.getMouseButton(); int v10 = v13; int v11 = _vm->_linesManager.ZONE_OBJET(mousePosX, mousePosY); v13 = v11; if (v11 != v10) _vm->_objectsManager.initBorder(v11); - if (_vm->_eventsManager._mouseCursorId != 16) { - if ((uint16)(_vm->_eventsManager._mouseCursorId - 1) > 1u) { - if (_vm->_eventsManager._mouseCursorId != 3) { - if (v12 == 2) { - _vm->_objectsManager.OBJETPLUS(v13); - if (_vm->_eventsManager._mouseCursorId != 23) - _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); - } - } + if (_vm->_eventsManager._mouseCursorId != 1 && _vm->_eventsManager._mouseCursorId != 2 && _vm->_eventsManager._mouseCursorId != 3 && _vm->_eventsManager._mouseCursorId != 16) { + if (mouseButton == 2) { + _vm->_objectsManager.OBJETPLUS(v13); + if (_vm->_eventsManager._mouseCursorId != 23) + _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); } } - if (v12 == 1) { - if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId || (uint16)(_vm->_eventsManager._mouseCursorId - 2) <= 1u) + if (mouseButton == 1) { + if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 2 || _vm->_eventsManager._mouseCursorId == 3 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId) break; _vm->_objectsManager.VALID_OBJET(_vm->_globals._inventory[v13]); if (_vm->_eventsManager._mouseCursorId == 8) @@ -434,8 +430,8 @@ LABEL_7: if (v20) break; _vm->_eventsManager.VBL(); - if ((uint16)(_vm->_globals._screenId - 35) <= 5u) - _vm->_objectsManager.SPECIAL_JEU(); + if (_vm->_globals._screenId >= 35 && _vm->_globals._screenId <= 40) + _vm->_objectsManager.handleSpecialGames(); } _vm->_fontManager.hideText(9); if (_inventDisplayedFl) { @@ -484,8 +480,8 @@ void DialogsManager::inventAnim() { _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); - int v0 = _vm->_graphicsManager.ofscroll + 2; - int v1 = _vm->_graphicsManager.ofscroll + 2; + int v0 = _vm->_graphicsManager._scrollOffset + 2; + int v1 = _vm->_graphicsManager._scrollOffset + 2; _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.ICONE, v1 + 300, 327, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); _vm->_objectsManager.I_old_x = v0; @@ -698,26 +694,26 @@ int DialogsManager::searchSavegames() { int xp = _vm->_eventsManager.getMouseX(); int yp = _vm->_eventsManager.getMouseY(); - _vm->_graphicsManager.ofscroll = _vm->_eventsManager._startPos.x; + _vm->_graphicsManager._scrollOffset = _vm->_eventsManager._startPos.x; if ((uint16)(yp - 112) <= 86) { if (xp > _vm->_eventsManager._startPos.x + 189 && xp < _vm->_eventsManager._startPos.x + 318) slotNumber = 1; - if ((uint16)(yp - 112) <= 86 && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) + if ((uint16)(yp - 112) <= 86 && xp > _vm->_graphicsManager._scrollOffset + 322 && xp < _vm->_graphicsManager._scrollOffset + 452) slotNumber = 2; } if ((uint16)(yp - 203) <= 86) { - if (xp > _vm->_graphicsManager.ofscroll + 189 && xp < _vm->_graphicsManager.ofscroll + 318) + if (xp > _vm->_graphicsManager._scrollOffset + 189 && xp < _vm->_graphicsManager._scrollOffset + 318) slotNumber = 3; - if ((uint16)(yp - 203) <= 86 && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) + if ((uint16)(yp - 203) <= 86 && xp > _vm->_graphicsManager._scrollOffset + 322 && xp < _vm->_graphicsManager._scrollOffset + 452) slotNumber = 4; } if ((uint16)(yp - 294) <= 86) { - if (xp > _vm->_graphicsManager.ofscroll + 189 && xp < _vm->_graphicsManager.ofscroll + 318) + if (xp > _vm->_graphicsManager._scrollOffset + 189 && xp < _vm->_graphicsManager._scrollOffset + 318) slotNumber = 5; - if ((uint16)(yp - 294) <= 86 && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) + if ((uint16)(yp - 294) <= 86 && xp > _vm->_graphicsManager._scrollOffset + 322 && xp < _vm->_graphicsManager._scrollOffset + 452) slotNumber = 6; } - if ((uint16)(yp - 388) <= 16 && xp > _vm->_graphicsManager.ofscroll + 273 && xp < _vm->_graphicsManager.ofscroll + 355) + if ((uint16)(yp - 388) <= 16 && xp > _vm->_graphicsManager._scrollOffset + 273 && xp < _vm->_graphicsManager._scrollOffset + 355) slotNumber = 7; switch (slotNumber) { diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index cac6b83a20..1f85e3eeda 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -447,12 +447,12 @@ LABEL_65: _vm->_globals.NBBLOC = 0; _startPos.x = _vm->_graphicsManager.SCROLL; - _vm->_graphicsManager.ofscroll = _vm->_graphicsManager.SCROLL; + _vm->_graphicsManager._scrollOffset = _vm->_graphicsManager.SCROLL; _vm->_graphicsManager.SCROLL = _vm->_graphicsManager.SCROLL; } _vm->_graphicsManager.OLD_SCROLL = _vm->_graphicsManager.SCROLL; _startPos.x = _vm->_graphicsManager.SCROLL; - _vm->_graphicsManager.ofscroll = _vm->_graphicsManager.SCROLL; + _vm->_graphicsManager._scrollOffset = _vm->_graphicsManager.SCROLL; } _curMouseButton = _mouseButton; _mouseButton = 0; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 41f5ce355c..cef2f9686d 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -149,7 +149,7 @@ Globals::Globals() { PERSO = 0; _screenId = 0; NOSPRECRAN = false; - OLD_ECRAN = 0; + _prevScreenId = 0; Max_Propre_Gen = 0; Max_Ligne_Long = 0; Max_Perso_Y = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index f0c1af22dc..86524ea3e8 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -402,7 +402,7 @@ public: int PLANI; bool NOSPRECRAN; int _screenId; - int OLD_ECRAN; + int _prevScreenId; int fmusic; int Max_Propre; int Max_Propre_Gen; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 8264b6ba70..b7cbd55694 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -41,7 +41,7 @@ GraphicsManager::GraphicsManager() { PAL_PIXELS = NULL; _lineNbr = 0; _videoPtr = NULL; - ofscroll = 0; + _scrollOffset = 0; SCROLL = 0; PCX_L = PCX_H = 0; DOUBLE_ECRAN = false; @@ -249,7 +249,7 @@ void GraphicsManager::initColorTable(int minIndex, int maxIndex, byte *palette) void GraphicsManager::scrollScreen(int amount) { int result = CLIP(amount, 0, SCREEN_WIDTH); _vm->_eventsManager._startPos.x = result; - ofscroll = result; + _scrollOffset = result; SCROLL = result; } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 40bbd67cb5..6215e16cc3 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -67,7 +67,7 @@ public: Graphics::Surface *_videoPtr; byte *_vesaScreen; byte *_vesaBuffer; - int ofscroll; + int _scrollOffset; int SCROLL; byte HEADER_PCX[128]; int PCX_L, PCX_H; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index dbd97bc657..827b548bf0 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -386,7 +386,7 @@ bool HopkinsEngine::runWin95Demo() { case 113: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 113; _globals._saveData->data[svField5] = _globals._screenId; @@ -395,7 +395,7 @@ bool HopkinsEngine::runWin95Demo() { break; case 114: - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 114; _globals._saveData->data[svField5] = _globals._screenId; @@ -406,7 +406,7 @@ bool HopkinsEngine::runWin95Demo() { case 115: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 115; _globals._saveData->data[svField5] = _globals._screenId; @@ -740,7 +740,7 @@ bool HopkinsEngine::runLinuxDemo() { case 113: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 113; _globals._saveData->data[svField5] = 113; @@ -758,7 +758,7 @@ bool HopkinsEngine::runLinuxDemo() { case 114: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 114; _globals._saveData->data[svField5] = 114; @@ -770,7 +770,7 @@ bool HopkinsEngine::runLinuxDemo() { case 115: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 115; _globals._saveData->data[svField5] = 115; @@ -1612,7 +1612,7 @@ bool HopkinsEngine::runOS2Full() { case 113: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[6] = _globals._screenId; _globals._screenId = 113; _globals._saveData->data[5] = 113; @@ -1622,7 +1622,7 @@ bool HopkinsEngine::runOS2Full() { case 114: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[6] = _globals._screenId; _globals._screenId = 114; _globals._saveData->data[5] = 114; @@ -1632,7 +1632,7 @@ bool HopkinsEngine::runOS2Full() { case 115: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[6] = _globals._screenId; _globals._screenId = 115; _globals._saveData->data[5] = 115; @@ -2503,7 +2503,7 @@ bool HopkinsEngine::runBeOSFull() { case 113: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 113; _globals._saveData->data[svField5] = 113; @@ -2513,7 +2513,7 @@ bool HopkinsEngine::runBeOSFull() { case 114: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 114; _globals._saveData->data[svField5] = 114; @@ -2523,7 +2523,7 @@ bool HopkinsEngine::runBeOSFull() { case 115: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 115; _globals._saveData->data[svField5] = 115; @@ -3383,9 +3383,9 @@ bool HopkinsEngine::runWin95full() { break; case 113: - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._screenId = 113; - _globals._saveData->data[svField6] = _globals.OLD_ECRAN; + _globals._saveData->data[svField6] = _globals._prevScreenId; _globals._saveData->data[svField5] = _globals._screenId; _globals._exitId = 0; _computerManager.showComputer(COMPUTER_HOPKINS); @@ -3394,18 +3394,18 @@ bool HopkinsEngine::runWin95full() { case 114: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._screenId = 114; - _globals._saveData->data[svField6] = _globals.OLD_ECRAN; + _globals._saveData->data[svField6] = _globals._prevScreenId; _globals._saveData->data[svField5] = _globals._screenId; _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.setModeVesa(); break; case 115: - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._screenId = 115; - _globals._saveData->data[svField6] = _globals.OLD_ECRAN; + _globals._saveData->data[svField6] = _globals._prevScreenId; _globals._saveData->data[svField5] = _globals._screenId; _globals._exitId = 0; _computerManager.showComputer(COMPUTER_PUBLIC); @@ -4262,7 +4262,7 @@ bool HopkinsEngine::runLinuxFull() { case 113: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 113; _globals._saveData->data[svField5] = 113; @@ -4279,7 +4279,7 @@ bool HopkinsEngine::runLinuxFull() { case 114: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 114; _globals._saveData->data[svField5] = 114; @@ -4291,7 +4291,7 @@ bool HopkinsEngine::runLinuxFull() { case 115: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 115; _globals._saveData->data[svField5] = 115; @@ -4481,7 +4481,7 @@ void HopkinsEngine::playIntro() { _soundManager.WSOUND(11); _graphicsManager.loadImage("intro1"); _graphicsManager.scrollScreen(0); - _graphicsManager.ofscroll = 0; + _graphicsManager._scrollOffset = 0; _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -4527,7 +4527,7 @@ void HopkinsEngine::playIntro() { _soundManager.WSOUND(23); _objectsManager.stopBobAnimation(3); _objectsManager.stopBobAnimation(5); - _graphicsManager.ofscroll = 0; + _graphicsManager._scrollOffset = 0; _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -4575,7 +4575,7 @@ void HopkinsEngine::playIntro() { _objectsManager.stopBobAnimation(3); _objectsManager.stopBobAnimation(5); _objectsManager.stopBobAnimation(1); - _graphicsManager.ofscroll = 0; + _graphicsManager._scrollOffset = 0; _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -4967,7 +4967,7 @@ void HopkinsEngine::playEnding() { _globals.PERSO = _globals.freeMemory(_globals.PERSO); _dialogsManager._removeInventFl = true; _globals._disableInventFl = true; - _graphicsManager.ofscroll = 0; + _graphicsManager._scrollOffset = 0; _globals.PLAN_FLAG = false; _globals.iRegul = 1; _soundManager.WSOUND(26); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 29657d9505..fb15142dc1 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -72,11 +72,11 @@ int LinesManager::ZONE_OBJET(int posX, int posY) { v2 = OPTI_ZONE(posX, 19, false); if ((uint)(posY - 268) <= 37) v2 = OPTI_ZONE(posX, 25, true); - if ((uint)(posY - 268) <= 20 && posX >= _vm->_graphicsManager.ofscroll + 424 && posX <= _vm->_graphicsManager.ofscroll + 478) + if ((uint)(posY - 268) <= 20 && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) v2 = 30; - if ((uint)(posY - 290) <= 16 && posX >= _vm->_graphicsManager.ofscroll + 424 && posX <= _vm->_graphicsManager.ofscroll + 478) + if ((uint)(posY - 290) <= 16 && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) v2 = 31; - if (posX < _vm->_graphicsManager.ofscroll + 152 || posX > _vm->_graphicsManager.ofscroll + 484) + if (posX < _vm->_graphicsManager._scrollOffset + 152 || posX > _vm->_graphicsManager._scrollOffset + 484) v2 = 32; if ((uint)(posY - 114) > 192) v2 = 32; @@ -85,30 +85,30 @@ int LinesManager::ZONE_OBJET(int posX, int posY) { int LinesManager::OPTI_ZONE(int posX, int minZoneNum, bool lastRow) { int result = minZoneNum; - if (posX >= _vm->_graphicsManager.ofscroll + 158 && posX <= _vm->_graphicsManager.ofscroll + 208) + if (posX >= _vm->_graphicsManager._scrollOffset + 158 && posX <= _vm->_graphicsManager._scrollOffset + 208) return result; - if (posX >= _vm->_graphicsManager.ofscroll + 208 && posX <= _vm->_graphicsManager.ofscroll + 266) { + if (posX >= _vm->_graphicsManager._scrollOffset + 208 && posX <= _vm->_graphicsManager._scrollOffset + 266) { result += 1; return result; } - if (posX >= _vm->_graphicsManager.ofscroll + 266 && posX <= _vm->_graphicsManager.ofscroll + 320) { + if (posX >= _vm->_graphicsManager._scrollOffset + 266 && posX <= _vm->_graphicsManager._scrollOffset + 320) { result += 2; return result; } - if (posX >= _vm->_graphicsManager.ofscroll + 320 && posX <= _vm->_graphicsManager.ofscroll + 370) { + if (posX >= _vm->_graphicsManager._scrollOffset + 320 && posX <= _vm->_graphicsManager._scrollOffset + 370) { result += 3; return result; } - if (posX >= _vm->_graphicsManager.ofscroll + 370 && posX <= _vm->_graphicsManager.ofscroll + 424) { + if (posX >= _vm->_graphicsManager._scrollOffset + 370 && posX <= _vm->_graphicsManager._scrollOffset + 424) { result += 4; return result; } - if (!lastRow && posX >= _vm->_graphicsManager.ofscroll + 424 && posX <= _vm->_graphicsManager.ofscroll + 478) { + if (!lastRow && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) { result += 5; return result; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index b9034ee246..8c01f53364 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -182,7 +182,7 @@ void ObjectsManager::removeObject(int objIndex) { /** * Set Offset XY */ -void ObjectsManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize) { +void ObjectsManager::setOffsetXY(byte *data, int idx, int xp, int yp, bool isSize) { byte *startP = data + 3; for (int i = idx; i; --i) startP += READ_LE_UINT32(startP) + 16; @@ -1491,7 +1491,7 @@ void ObjectsManager::checkZone() { v2 = v1; if (_vm->_globals.PLAN_FLAG || _vm->_eventsManager._startPos.x >= v0 - || (v1 = _vm->_graphicsManager.ofscroll + 54, v0 >= v1) + || (v1 = _vm->_graphicsManager._scrollOffset + 54, v0 >= v1) || (v1 = v2 - 1, (uint16)(v2 - 1) > 59)) { if (_visibleFl) FLAG_VISIBLE_EFFACE = 4; @@ -2381,7 +2381,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_eventsManager.mouseOn(); v3 = getSpriteX(0); _vm->_graphicsManager.scrollScreen(v3 - 320); - _vm->_graphicsManager.ofscroll = getSpriteX(0) - 320; + _vm->_graphicsManager._scrollOffset = getSpriteX(0) - 320; SPRITE_ON(0); _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -2474,7 +2474,7 @@ void ObjectsManager::handleLeftButton() { destX = _vm->_eventsManager.getMouseX(); destY = _vm->_eventsManager.getMouseY(); - if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 78) { + if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager._scrollOffset - 30 && destX < _vm->_graphicsManager._scrollOffset + 50 && (uint16)(destY + 29) <= 78) { v1 = _vm->_eventsManager._mouseCursorId; _vm->_dialogsManager._inventFl = true; _vm->_dialogsManager.showInventory(); @@ -3699,17 +3699,17 @@ void ObjectsManager::initBorder(int a1) { if ((uint16)(a1 - 25) <= 4u) _borderPos.y = 272; if (a1 == 1 || a1 == 7 || a1 == 13 || a1 == 19 || a1 == 25) - _borderPos.x = _vm->_graphicsManager.ofscroll + 158; + _borderPos.x = _vm->_graphicsManager._scrollOffset + 158; if (a1 == 2 || a1 == 8 || a1 == 14 || a1 == 20 || a1 == 26) - _borderPos.x = _vm->_graphicsManager.ofscroll + 212; + _borderPos.x = _vm->_graphicsManager._scrollOffset + 212; if (a1 == 3 || a1 == 9 || a1 == 15 || a1 == 21 || a1 == 27) - _borderPos.x = _vm->_graphicsManager.ofscroll + 266; + _borderPos.x = _vm->_graphicsManager._scrollOffset + 266; if (a1 == 4 || a1 == 10 || a1 == 16 || a1 == 22 || a1 == 28) - _borderPos.x = _vm->_graphicsManager.ofscroll + 320; + _borderPos.x = _vm->_graphicsManager._scrollOffset + 320; if (a1 == 5 || a1 == 11 || a1 == 17 || a1 == 23 || a1 == 29) - _borderPos.x = _vm->_graphicsManager.ofscroll + 374; + _borderPos.x = _vm->_graphicsManager._scrollOffset + 374; if (a1 == 6 || a1 == 12 || a1 == 18 || a1 == 24 || (uint16)(a1 - 30) <= 1u) - _borderPos.x = _vm->_graphicsManager.ofscroll + 428; + _borderPos.x = _vm->_graphicsManager._scrollOffset + 428; if ((uint16)(a1 - 1) <= 28) _borderSpriteIndex = 0; if ((uint16)(a1 - 30) <= 1) @@ -3874,99 +3874,111 @@ void ObjectsManager::OPTI_OBJET() { _vm->_globals.freeMemory(data); } -void ObjectsManager::SPECIAL_JEU() { - byte *v1; +void ObjectsManager::handleSpecialGames() { + byte *oldPalette; byte *v2; byte *v3; - if ((uint16)(_vm->_globals._screenId - 35) <= 6u) { - if (_vm->_globals.OLD_ECRAN == 16 && _vm->_globals._screenId == 35) - TEST_FORET(35, 500, 555, 100, 440, 1); - if (_vm->_globals.OLD_ECRAN == 36 && _vm->_globals._screenId == 35) - TEST_FORET(35, 6, 84, 100, 440, 4); - if (_vm->_globals.OLD_ECRAN == 35 && _vm->_globals._screenId == 36) - TEST_FORET(36, 551, 633, 100, 440, 2); - if (_vm->_globals.OLD_ECRAN == 37 && _vm->_globals._screenId == 36) - TEST_FORET(36, 6, 84, 100, 440, 4); - if (_vm->_globals.OLD_ECRAN == 36 && _vm->_globals._screenId == 37) - TEST_FORET(37, 551, 633, 100, 440, 1); - if (_vm->_globals.OLD_ECRAN == 38 && _vm->_globals._screenId == 37) - TEST_FORET(37, 392, 529, 100, 440, 2); - if (_vm->_globals.OLD_ECRAN == 37 && _vm->_globals._screenId == 38) - TEST_FORET(38, 133, 252, 100, 440, 4); - if (_vm->_globals.OLD_ECRAN == 39 && _vm->_globals._screenId == 38) - TEST_FORET(38, 6, 84, 100, 440, 3); - if (_vm->_globals.OLD_ECRAN == 38 && _vm->_globals._screenId == 39) - TEST_FORET(39, 551, 633, 100, 440, 2); - if (_vm->_globals.OLD_ECRAN == 40 && _vm->_globals._screenId == 39) - TEST_FORET(39, 6, 84, 100, 440, 3); - if (_vm->_globals.OLD_ECRAN == 39 && _vm->_globals._screenId == 40) - TEST_FORET(40, 133, 252, 100, 440, 4); - if (_vm->_globals.OLD_ECRAN == 41 && _vm->_globals._screenId == 40) - TEST_FORET(40, 392, 529, 100, 440, 2); - if (_vm->_globals.OLD_ECRAN == 40 && _vm->_globals._screenId == 41) - TEST_FORET(41, 551, 633, 100, 440, 1); - if (_vm->_globals.OLD_ECRAN == 17 && _vm->_globals._screenId == 41) - TEST_FORET(41, 6, 84, 100, 440, 3); - } - if (_vm->_globals._screenId == 5) { - if (getSpriteY(0) <= 399) { - if (!_vm->_globals._saveData->data[svField173]) { - _vm->_globals._saveData->data[svField173] = 1; - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); - _vm->_globals.NOPARLE = false; - if (!_vm->_globals._censorshipFl) { - v1 = _vm->_globals.allocMemory(1000); - memcpy(v1, _vm->_graphicsManager._palette, 769); - - _vm->_saveLoadManager.saveFile("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 307200); - - if (!_vm->_graphicsManager._lineNbr) - _vm->_graphicsManager.ofscroll = 0; - _vm->_graphicsManager.NB_SCREEN(); - _vm->_soundManager.SPECIAL_SOUND = 198; - PERSO_ON = true; - _vm->_animationManager.NO_SEQ = true; - _vm->_animationManager._clearAnimationFl = false; - _vm->_animationManager.playAnim("otage.ANM", 1, 24, 500); - _vm->_animationManager.NO_SEQ = false; - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_globals.NECESSAIRE = true; - _vm->_graphicsManager.NB_SCREEN(); - _vm->_globals.NECESSAIRE = false; - - _vm->_saveLoadManager.load("TEMP1.SCR", _vm->_graphicsManager._vesaScreen); - g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); - - PERSO_ON = false; - memcpy(_vm->_graphicsManager._palette, v1, 769); - _vm->_graphicsManager.SHOW_PALETTE(); - _vm->_globals.freeMemory(v1); - _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - _vm->_graphicsManager.unlockScreen(); - v2 = _vm->_graphicsManager._vesaBuffer; - v3 = _vm->_graphicsManager._vesaScreen; - memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); - v3 = v3 + 614396; - v2 = v2 + 614396; - *v2 = *v3; - v2 = v2 + 2; - *v2 = v3[2]; - - _vm->_graphicsManager.no_scroll = 0; - _vm->_graphicsManager.DD_VBL(); - } - } - } - } - if (_vm->_globals._screenId == 20) - _vm->_globals._saveData->data[svField132] = getSpriteX(0) > 65 - && getSpriteX(0) <= 124 - && getSpriteY(0) > 372 - && getSpriteY(0) <= 398; - if (_vm->_globals._screenId == 57) { + switch (_vm->_globals._screenId) { + case 5: + if ((getSpriteY(0) > 399) || _vm->_globals._saveData->data[svField173]) + break; + + _vm->_globals._saveData->data[svField173] = 1; + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); + _vm->_globals.NOPARLE = false; + + if (_vm->_globals._censorshipFl) + break; + + oldPalette = _vm->_globals.allocMemory(1000); + memcpy(oldPalette, _vm->_graphicsManager._palette, 769); + + _vm->_saveLoadManager.saveFile("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 307200); + + if (!_vm->_graphicsManager._lineNbr) + _vm->_graphicsManager._scrollOffset = 0; + _vm->_graphicsManager.NB_SCREEN(); + _vm->_soundManager.SPECIAL_SOUND = 198; + PERSO_ON = true; + _vm->_animationManager.NO_SEQ = true; + _vm->_animationManager._clearAnimationFl = false; + _vm->_animationManager.playAnim("otage.ANM", 1, 24, 500); + _vm->_animationManager.NO_SEQ = false; + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_globals.NECESSAIRE = true; + _vm->_graphicsManager.NB_SCREEN(); + _vm->_globals.NECESSAIRE = false; + + _vm->_saveLoadManager.load("TEMP1.SCR", _vm->_graphicsManager._vesaScreen); + g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); + + PERSO_ON = false; + memcpy(_vm->_graphicsManager._palette, oldPalette, 769); + _vm->_graphicsManager.SHOW_PALETTE(); + _vm->_globals.freeMemory(oldPalette); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.unlockScreen(); + v2 = _vm->_graphicsManager._vesaBuffer; + v3 = _vm->_graphicsManager._vesaScreen; + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); + v3 = v3 + 614396; + v2 = v2 + 614396; + *v2 = *v3; + v2 = v2 + 2; + *v2 = v3[2]; + + _vm->_graphicsManager.no_scroll = 0; + _vm->_graphicsManager.DD_VBL(); + break; + case 20: + _vm->_globals._saveData->data[svField132] = (getSpriteX(0) > 65 && getSpriteX(0) <= 124 && getSpriteY(0) > 372 && getSpriteY(0) <= 398) ? 1 : 0; + break; + case 35: + if (_vm->_globals._prevScreenId == 16) + handleForest(35, 500, 555, 100, 440, 1); + else if (_vm->_globals._prevScreenId == 36) + handleForest(35, 6, 84, 100, 440, 4); + break; + case 36: + if (_vm->_globals._prevScreenId == 35) + handleForest(36, 551, 633, 100, 440, 2); + else if (_vm->_globals._prevScreenId == 37) + handleForest(36, 6, 84, 100, 440, 4); + break; + case 37: + if (_vm->_globals._prevScreenId == 36) + handleForest(37, 551, 633, 100, 440, 1); + else if (_vm->_globals._prevScreenId == 38) + handleForest(37, 392, 529, 100, 440, 2); + break; + case 38: + if (_vm->_globals._prevScreenId == 37) + handleForest(38, 133, 252, 100, 440, 4); + else if (_vm->_globals._prevScreenId == 39) + handleForest(38, 6, 84, 100, 440, 3); + break; + case 39: + if (_vm->_globals._prevScreenId == 38) + handleForest(39, 551, 633, 100, 440, 2); + else if (_vm->_globals._prevScreenId == 40) + handleForest(39, 6, 84, 100, 440, 3); + break; + case 40: + if (_vm->_globals._prevScreenId == 39) + handleForest(40, 133, 252, 100, 440, 4); + else if (_vm->_globals._prevScreenId == 41) + handleForest(40, 392, 529, 100, 440, 2); + break; + case 41: + if (_vm->_globals._prevScreenId == 40) + handleForest(41, 551, 633, 100, 440, 1); + else if (_vm->_globals._prevScreenId == 17) + handleForest(41, 6, 84, 100, 440, 3); + break; + case 57: _vm->_globals._disableInventFl = true; if (_vm->_globals._saveData->data[svField261] == 1 && BOBPOSI(5) == 37) { stopBobAnimation(5); @@ -3984,8 +3996,11 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_globals._saveData->data[svField261] = 3; } _vm->_globals._disableInventFl = false; - } - if (_vm->_globals._screenId == 93 && !_vm->_globals._saveData->data[svField333]) { + break; + case 93: + if (_vm->_globals._saveData->data[svField333]) + break; + _vm->_globals._disableInventFl = true; do _vm->_eventsManager.VBL(); @@ -3995,27 +4010,23 @@ void ObjectsManager::SPECIAL_JEU() { stopBobAnimation(8); _vm->_globals._saveData->data[svField333] = 1; _vm->_globals._disableInventFl = false; + break; } } void ObjectsManager::BOB_VIVANT(int idx) { - int v1; - int v2; - int v3; - int v4; + int startPos = 10 * idx; + if (!READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos + 4)) + return; - v1 = 10 * idx; - v2 = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + v1); - v3 = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + v1 + 2); - v4 = _vm->_talkManager._characterAnim[v1 + 8]; - if ((int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + v1 + 4)) { - if (!_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, - _vm->_graphicsManager.ofscroll + v2, v3, - _vm->_talkManager._characterAnim[v1 + 8]); - if (_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, v2, v3, v4); - } + int xp = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos); + int yp = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos + 2); + int spriteIndex = _vm->_talkManager._characterAnim[startPos + 8]; + + if (!_vm->_globals.NO_OFFSET) + _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, _vm->_graphicsManager._scrollOffset + xp, yp, spriteIndex); + else + _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, xp, yp, spriteIndex); } void ObjectsManager::VBOB(byte *src, int idx, int xp, int yp, int frameIndex) { @@ -4520,7 +4531,7 @@ void ObjectsManager::INILINK(const Common::String &file) { void ObjectsManager::SPECIAL_INI() { switch (_vm->_globals._screenId) { case 17: - if (_vm->_globals.OLD_ECRAN == 20) { + if (_vm->_globals._prevScreenId == 20) { _vm->_globals._disableInventFl = true; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -4560,7 +4571,7 @@ void ObjectsManager::SPECIAL_INI() { break; case 18: - if (_vm->_globals.OLD_ECRAN == 17) { + if (_vm->_globals._prevScreenId == 17) { _vm->_eventsManager._mouseSpriteId = 4; _vm->_globals.BPP_NOAFF = true; for (int i = 0; i <= 4; i++) @@ -4836,85 +4847,67 @@ int ObjectsManager::colision(int xp, int yp) { return -1; } -void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6) { - int v6; - int v7; - char v8; - int v9; - int v13; - const byte *v14; - char v15; - int v16; +void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, int a6) { + bool tokenCompleteFl; + char curChar; int spriteIndex; - int v18; - Common::String v19; - v18 = 0; - v6 = 0; - v13 = 0; - v15 = a5; - v19 = " "; + int strPos = 0; + int idx = 0; + Common::String tmpStr = ""; + int realSpeed = speed; if (_vm->_globals._speed == 2) - v15 = a5 / 2; + realSpeed = speed / 2; else if (_vm->_globals._speed == 3) - v15 = a5 / 3; - v14 = _sprite[0]._spriteData; + realSpeed = speed / 3; + const byte *oldSpriteData = _sprite[0]._spriteData; spriteIndex = _sprite[0]._spriteIndex; - v16 = _sprite[0].fieldE; + int oldFieldE = _sprite[0].fieldE; _sprite[0].field12 += a3; _sprite[0].field14 += a4; _sprite[0].fieldE = a6; for (;;) { - v7 = 0; - v8 = a2[v18]; - if (v8 == ',') { - v9 = atoi(v19.c_str()); - v13 = v9; - v6 = 0; - v19 = " "; - v7 = 1; + tokenCompleteFl = false; + curChar = a2[strPos]; + if (curChar == ',') { + idx = atoi(tmpStr.c_str()); + tmpStr = ""; + tokenCompleteFl = true; } else { - v9 = v6; - v19 += v8; - v6 = v6 + 1; + tmpStr += curChar; } - ++v18; - if (v7 == 1) { - if (v13 == -1) { - _sprite[0]._spriteData = v14; + ++strPos; + + if (tokenCompleteFl) { + if (idx == -1) { + _sprite[0]._spriteData = oldSpriteData; _sprite[0]._spriteIndex = spriteIndex; _sprite[0].field12 -= a3; _sprite[0].field14 -= a4; - _sprite[0].fieldE = v16; + _sprite[0].fieldE = oldFieldE; } else { _sprite[0]._spriteData = spriteData; - _sprite[0]._spriteIndex = v13; + _sprite[0]._spriteIndex = idx; } - for (int v10 = 0; v10 < v15; v10++) + for (int v10 = 0; v10 < realSpeed; v10++) _vm->_eventsManager.VBL(); - if (v13 == -1) + if (idx == -1) break; } } } -void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int a5, int a6) { - int v6; - char v8; - int v9; - int spriteIndex; - char v14; - Common::String v16; +void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int speed, int a6) { + int spriteIndex = 0; + Common::String tmpStr = ""; - v6 = 0; - spriteIndex = 0; - v16 = " "; - v14 = a5; + int realSpeed = speed; if (_vm->_globals._speed == 2) - v14 = a5 / 2; + realSpeed = speed / 2; else if (_vm->_globals._speed == 3) - v14 = a5 / 3; + realSpeed = speed / 3; + S_old_spr = _sprite[0]._spriteData; S_old_ani = _sprite[0]._spriteIndex; S_old_ret = _sprite[0].fieldE; @@ -4923,65 +4916,61 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int _sprite[0].fieldE = a6; uint strPos = 0; + char nextChar; do { - bool loopCond = false; + bool completeTokenFl = false; do { - v8 = animationSeq[strPos]; + nextChar = animationSeq[strPos]; if ((animationSeq[strPos] == ',') || (strPos == animationSeq.size() - 1)) { // Safeguard: if the sequence doesn't end with a coma, simulate it's present. if (animationSeq[strPos] != ',') - v16.setChar(v8, v6); - v9 = atoi(v16.c_str()); - spriteIndex = v9; - v6 = 0; - v16 = " "; - loopCond = true; + tmpStr += nextChar; + spriteIndex = atoi(tmpStr.c_str()); + tmpStr = ""; + completeTokenFl = true; } else { - v9 = v6; - v16.setChar(v8, v6); - v6 = v6 + 1; + tmpStr += nextChar; } ++strPos; - } while (!loopCond); + } while (!completeTokenFl); + if (spriteIndex != -1) { _sprite[0]._spriteData = a1; _sprite[0]._spriteIndex = spriteIndex; } - for (int v10 = 0; v10 < v14; v10++) + for (int i = 0; i < realSpeed; i++) _vm->_eventsManager.VBL(); } while (spriteIndex != -1); } -void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int a5) { - int v6; - char v7; - - int v14 = 0; - int v5 = 0; - int spriteIndex = 0; - Common::String tmpStr = " "; - int v13; +void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int speed) { + Common::String tmpStr = ""; + int realSpeed; if (_vm->_globals._speed == 2) - v13 = a5 / 2; + realSpeed = speed / 2; else if (_vm->_globals._speed == 3) - v13 = a5 / 3; + realSpeed = speed / 3; else - v13 = a5; + realSpeed = speed; + + int idx = 0; + int spriteIndex = 0; + bool completeTokenFl; + char nextChar; for (;;) { - v6 = 0; - v7 = animString[v14]; - if (v7 == ',') { + completeTokenFl = false; + nextChar = animString[idx]; + if (nextChar == ',') { spriteIndex = atoi(tmpStr.c_str()); - v5 = 0; - tmpStr = " "; - v6 = 1; + tmpStr = ""; + completeTokenFl = true; } else { - tmpStr.setChar(v7, v5); - v5++; + tmpStr += nextChar; } - ++v14; - if (v6 == 1) { + ++idx; + + if (completeTokenFl) { if (spriteIndex == -1) { _sprite[0]._spriteData = S_old_spr; _sprite[0]._spriteIndex = S_old_ani; @@ -4993,7 +4982,7 @@ void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animStrin _sprite[0]._spriteIndex = spriteIndex; } - for (int v9 = 0; v9 < v13; v9++) + for (int i = 0; i < realSpeed; i++) _vm->_eventsManager.VBL(); if (spriteIndex == -1) @@ -5002,7 +4991,7 @@ void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animStrin } } -void ObjectsManager::TEST_FORET(int screenId, int minX, int maxX, int minY, int maxY, int idx) { +void ObjectsManager::handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx) { int savegameIdx = screenId; if (_vm->_globals._screenId != screenId) return; @@ -5103,7 +5092,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; _vm->_dialogsManager._removeInventFl = false; - _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager._scrollOffset = 0; _vm->_globals.PLAN_FLAG = false; _vm->_globals.iRegul = 1; _vm->_soundManager.WSOUND(v); @@ -5201,7 +5190,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_eventsManager._gameKey = KEY_NONE; _verb = 4; _vm->_globals.MAX_COMPTE = 6; - _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager._scrollOffset = 0; _vm->_dialogsManager._removeInventFl = false; _vm->_globals.PLAN_FLAG = false; _vm->_graphicsManager._noFadingFl = false; @@ -5323,7 +5312,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (_vm->_globals.GOACTION) PARADISE(); } - SPECIAL_JEU(); + handleSpecialGames(); _vm->_eventsManager.VBL(); if (!_vm->_globals._exitId) continue; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index a0b15a38ee..7394bb6cac 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -132,7 +132,7 @@ public: void DEL_FICHIER_OBJ(); byte *loadSprite(const Common::String &file); - void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); + void setOffsetXY(byte *data, int idx, int xp, int yp, bool isSize); int getOffsetX(const byte *spriteData, int spriteIndex, bool isSize); int getOffsetY(const byte *spriteData, int spriteIndex, bool isSize); void displaySprite(); @@ -202,7 +202,7 @@ public: void OBJETPLUS(int a1); void VALID_OBJET(int a1); void OPTI_OBJET(); - void SPECIAL_JEU(); + void handleSpecialGames(); void BOB_VIVANT(int a1); void VBOB(byte *src, int idx, int xp, int yp, int frameIndex); void VBOB_OFF(int idx); @@ -234,10 +234,10 @@ public: int CALC_PROPRE(int idx); int colision(int xp, int yp); - void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6); - void SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int a5, int a6); - void SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int a5); - void TEST_FORET(int screenId, int minX, int maxX, int minY, int maxY, int idx); + void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, int a6); + void SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int speed, int a6); + void SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int speed); + void handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx); void lockAnimX(int idx, int a2); /** diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 43b65d006e..7ec1804bd8 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -263,7 +263,7 @@ LABEL_1141: int v8 = *(dataP + 7); int v9 = *(dataP + 8); _vm->_objectsManager.RECALL = 0; - _vm->_globals.OLD_ECRAN = _vm->_globals._screenId; + _vm->_globals._prevScreenId = _vm->_globals._screenId; _vm->_globals._saveData->data[svField6] = _vm->_globals._screenId; _vm->_globals._screenId = v7; _vm->_globals._saveData->data[svField5] = v7; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 626bbef4f2..dee18f050d 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -100,7 +100,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) - _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager._scrollOffset = 0; _vm->_graphicsManager.NB_SCREEN(); _vm->_objectsManager.PERSO_ON = true; searchCharacterPalette(_paletteBufferIdx, false); @@ -1137,7 +1137,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) - _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager._scrollOffset = 0; _vm->_graphicsManager.NB_SCREEN(); _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; _vm->_graphicsManager.NB_SCREEN(); |