diff options
author | Paul Gilbert | 2012-10-24 20:37:42 +1100 |
---|---|---|
committer | Paul Gilbert | 2012-10-24 20:37:42 +1100 |
commit | 39bc683a18837ab60f456d3e9711d966bc417567 (patch) | |
tree | 1fc172532f4d663cb6a3af76a5de96035523f5b1 /engines/hopkins | |
parent | 603fdbc46243ee9b7e630ffca579968fe80c4a5e (diff) | |
download | scummvm-rg350-39bc683a18837ab60f456d3e9711d966bc417567.tar.gz scummvm-rg350-39bc683a18837ab60f456d3e9711d966bc417567.tar.bz2 scummvm-rg350-39bc683a18837ab60f456d3e9711d966bc417567.zip |
HOPKINS: Merged inventory dialog and OptionsDialog class into a DialogsManager class
Diffstat (limited to 'engines/hopkins')
-rw-r--r-- | engines/hopkins/dialogs.cpp | 576 | ||||
-rw-r--r-- | engines/hopkins/dialogs.h | 25 | ||||
-rw-r--r-- | engines/hopkins/globals.cpp | 6 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 1 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 1 | ||||
-rw-r--r-- | engines/hopkins/hopkins.h | 2 | ||||
-rw-r--r-- | engines/hopkins/menu.cpp | 2 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 560 | ||||
-rw-r--r-- | engines/hopkins/objects.h | 11 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 6 |
10 files changed, 605 insertions, 585 deletions
diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index f4855ff798..a77c919c8f 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -22,6 +22,7 @@ #include "common/scummsys.h" #include "common/events.h" +#include "common/file.h" #include "common/util.h" #include "hopkins/dialogs.h" #include "hopkins/events.h" @@ -33,229 +34,504 @@ namespace Hopkins { -void OptionsDialog::show(HopkinsEngine *vm) { +DialogsManager::DialogsManager() { + DESACTIVE_INVENT = false; + INVENTFLAG = false; + AFFINVEN = false; + VIRE_INVENT = false; + inventairex = inventairey = 0; + inventairel = inventaireh = 0; + Winventaire = NULL; + inventaire2 = g_PTRNUL; +} + +DialogsManager::~DialogsManager() { + _vm->_globals.dos_free2(Winventaire); +} + +void DialogsManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + +void DialogsManager::showOptionsDialog() { bool doneFlag; doneFlag = false; - vm->_eventsManager.CHANGE_MOUSE(0); - vm->_eventsManager.VBL(); - if (vm->_globals.FR == 1) - vm->_fileManager.CONSTRUIT_SYSTEM("OPTIFR.SPR"); - if (!vm->_globals.FR) - vm->_fileManager.CONSTRUIT_SYSTEM("OPTIAN.SPR"); - if (vm->_globals.FR == 2) - vm->_fileManager.CONSTRUIT_SYSTEM("OPTIES.SPR"); + _vm->_eventsManager.CHANGE_MOUSE(0); + _vm->_eventsManager.VBL(); + if (_vm->_globals.FR == 1) + _vm->_fileManager.CONSTRUIT_SYSTEM("OPTIFR.SPR"); + if (!_vm->_globals.FR) + _vm->_fileManager.CONSTRUIT_SYSTEM("OPTIAN.SPR"); + if (_vm->_globals.FR == 2) + _vm->_fileManager.CONSTRUIT_SYSTEM("OPTIES.SPR"); - vm->_globals.OPTION_SPR = vm->_fileManager.CHARGE_FICHIER(vm->_globals.NFICHIER); - vm->_globals.OPTION_FLAG = true; + _vm->_globals.OPTION_SPR = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.OPTION_FLAG = true; do { - if (vm->_eventsManager.BMOUSE()) { - Common::Point mousePos(vm->_eventsManager.XMOUSE(), vm->_eventsManager.YMOUSE()); - mousePos.x = vm->_eventsManager.XMOUSE(); - mousePos.y = vm->_eventsManager.YMOUSE(); + if (_vm->_eventsManager.BMOUSE()) { + Common::Point mousePos(_vm->_eventsManager.XMOUSE(), _vm->_eventsManager.YMOUSE()); + mousePos.x = _vm->_eventsManager.XMOUSE(); + mousePos.y = _vm->_eventsManager.YMOUSE(); - if (!vm->_soundManager.MUSICOFF) { - if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { - ++vm->_soundManager.MUSICVOL; - vm->_soundManager.OLD_MUSICVOL = vm->_soundManager.MUSICVOL; + if (!_vm->_soundManager.MUSICOFF) { + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { + ++_vm->_soundManager.MUSICVOL; + _vm->_soundManager.OLD_MUSICVOL = _vm->_soundManager.MUSICVOL; - if (vm->_soundManager.MUSICVOL <= 12) - vm->_soundManager.PLAY_SOUND("bruit2.wav"); + if (_vm->_soundManager.MUSICVOL <= 12) + _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else - vm->_soundManager.MUSICVOL = 12; - vm->_soundManager.MODSetMusicVolume(vm->_soundManager.MUSICVOL); + _vm->_soundManager.MUSICVOL = 12; + _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); } - if (!vm->_soundManager.MUSICOFF && mousePos.x >= vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { - --vm->_soundManager.MUSICVOL; - if (vm->_soundManager.MUSICVOL >= 0) - vm->_soundManager.PLAY_SOUND("bruit2.wav"); + if (!_vm->_soundManager.MUSICOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { + --_vm->_soundManager.MUSICVOL; + if (_vm->_soundManager.MUSICVOL >= 0) + _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else - vm->_soundManager.MUSICVOL = 0; + _vm->_soundManager.MUSICVOL = 0; - vm->_soundManager.OLD_MUSICVOL = vm->_soundManager.MUSICVOL; - vm->_soundManager.MODSetMusicVolume(vm->_soundManager.MUSICVOL); + _vm->_soundManager.OLD_MUSICVOL = _vm->_soundManager.MUSICVOL; + _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); } } - if (!vm->_soundManager.SOUNDOFF) { - if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 140 && mousePos.x <= vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 165) { - ++vm->_soundManager.SOUNDVOL; - if (vm->_soundManager.SOUNDVOL <= 16) - vm->_soundManager.PLAY_SOUND("bruit2.wav"); + if (!_vm->_soundManager.SOUNDOFF) { + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 165) { + ++_vm->_soundManager.SOUNDVOL; + if (_vm->_soundManager.SOUNDVOL <= 16) + _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else - vm->_soundManager.SOUNDVOL = 16; - vm->_soundManager.OLD_SOUNDVOL = vm->_soundManager.SOUNDVOL; - vm->_soundManager.MODSetSampleVolume(); + _vm->_soundManager.SOUNDVOL = 16; + _vm->_soundManager.OLD_SOUNDVOL = _vm->_soundManager.SOUNDVOL; + _vm->_soundManager.MODSetSampleVolume(); } - if (!vm->_soundManager.SOUNDOFF && mousePos.x >= vm->_graphicsManager.ofscroll + 331 && mousePos.y > 140 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 165) { - --vm->_soundManager.SOUNDVOL; - if (vm->_soundManager.SOUNDVOL >= 0) - vm->_soundManager.PLAY_SOUND("bruit2.wav"); + if (!_vm->_soundManager.SOUNDOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 165) { + --_vm->_soundManager.SOUNDVOL; + if (_vm->_soundManager.SOUNDVOL >= 0) + _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else - vm->_soundManager.SOUNDVOL = 0; - vm->_soundManager.OLD_SOUNDVOL = vm->_soundManager.SOUNDVOL; - vm->_soundManager.MODSetSampleVolume(); + _vm->_soundManager.SOUNDVOL = 0; + _vm->_soundManager.OLD_SOUNDVOL = _vm->_soundManager.SOUNDVOL; + _vm->_soundManager.MODSetSampleVolume(); } } - if (!vm->_soundManager.VOICEOFF) { - if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 167 && mousePos.x <= vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 192) { - ++vm->_soundManager.VOICEVOL; + if (!_vm->_soundManager.VOICEOFF) { + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 192) { + ++_vm->_soundManager.VOICEVOL; - if (vm->_soundManager.VOICEVOL <= 16) - vm->_soundManager.PLAY_SOUND("bruit2.wav"); + if (_vm->_soundManager.VOICEVOL <= 16) + _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else - vm->_soundManager.VOICEVOL = 16; - vm->_soundManager.OLD_VOICEVOL = vm->_soundManager.VOICEVOL; - vm->_soundManager.MODSetVoiceVolume(); + _vm->_soundManager.VOICEVOL = 16; + _vm->_soundManager.OLD_VOICEVOL = _vm->_soundManager.VOICEVOL; + _vm->_soundManager.MODSetVoiceVolume(); } - if (!vm->_soundManager.VOICEOFF && mousePos.x >= vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { - --vm->_soundManager.VOICEVOL; - if (vm->_soundManager.VOICEVOL >= 0) - vm->_soundManager.PLAY_SOUND("bruit2.wav"); + if (!_vm->_soundManager.VOICEOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { + --_vm->_soundManager.VOICEVOL; + if (_vm->_soundManager.VOICEVOL >= 0) + _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else - vm->_soundManager.VOICEVOL = 0; - vm->_soundManager.OLD_VOICEVOL = vm->_soundManager.VOICEVOL; - vm->_soundManager.MODSetVoiceVolume(); + _vm->_soundManager.VOICEVOL = 0; + _vm->_soundManager.OLD_VOICEVOL = _vm->_soundManager.VOICEVOL; + _vm->_soundManager.MODSetVoiceVolume(); } } - if (mousePos.x >= vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 194 && mousePos.x <= vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 219) - vm->_soundManager.TEXTOFF = vm->_soundManager.TEXTOFF != 1; - - if (mousePos.x >= vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 167 && mousePos.x <= vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 192) - vm->_soundManager.VOICEOFF = vm->_soundManager.VOICEOFF != 1; - if (mousePos.x >= vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 113 && mousePos.x <= vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 138) { - if (vm->_soundManager.MUSICOFF == 1) { - vm->_soundManager.MUSICOFF = 0; - vm->_soundManager.MODSetMusicVolume(vm->_soundManager.MUSICVOL); + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { + if (mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 219) + _vm->_soundManager.TEXTOFF = _vm->_soundManager.TEXTOFF != 1; + + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { + if (mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 192) + _vm->_soundManager.VOICEOFF = _vm->_soundManager.VOICEOFF != 1; + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { + if (mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 138) { + if (_vm->_soundManager.MUSICOFF == 1) { + _vm->_soundManager.MUSICOFF = 0; + _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); } else { - vm->_soundManager.MUSICOFF = 1; - vm->_soundManager.MODSetMusicVolume(0); + _vm->_soundManager.MUSICOFF = 1; + _vm->_soundManager.MODSetMusicVolume(0); } } - if (mousePos.x >= vm->_graphicsManager.ofscroll + 431 && mousePos.y > 140 && mousePos.x <= vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 165) - vm->_soundManager.SOUNDOFF = vm->_soundManager.SOUNDOFF != 1; + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 165) + _vm->_soundManager.SOUNDOFF = _vm->_soundManager.SOUNDOFF != 1; } } } - if (mousePos.x >= vm->_graphicsManager.ofscroll + 175 && mousePos.y > 285 && mousePos.x <= vm->_graphicsManager.ofscroll + 281 && mousePos.y <= 310) { - vm->_globals.SORTIE = 300; + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 175 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager.ofscroll + 281 && mousePos.y <= 310) { + _vm->_globals.SORTIE = 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.ofscroll + 355 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager.ofscroll + 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) { - switch (vm->_graphicsManager.SPEED_SCROLL) { + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 219) { + switch (_vm->_graphicsManager.SPEED_SCROLL) { case 1: - vm->_graphicsManager.SPEED_SCROLL = 2; + _vm->_graphicsManager.SPEED_SCROLL = 2; break; case 2: - vm->_graphicsManager.SPEED_SCROLL = 4; + _vm->_graphicsManager.SPEED_SCROLL = 4; break; case 4: - vm->_graphicsManager.SPEED_SCROLL = 8; + _vm->_graphicsManager.SPEED_SCROLL = 8; break; case 8: - vm->_graphicsManager.SPEED_SCROLL = 16; + _vm->_graphicsManager.SPEED_SCROLL = 16; break; case 16: - vm->_graphicsManager.SPEED_SCROLL = 32; + _vm->_graphicsManager.SPEED_SCROLL = 32; break; case 32: - vm->_graphicsManager.SPEED_SCROLL = 48; + _vm->_graphicsManager.SPEED_SCROLL = 48; break; case 48: - vm->_graphicsManager.SPEED_SCROLL = 64; + _vm->_graphicsManager.SPEED_SCROLL = 64; break; case 64: - vm->_graphicsManager.SPEED_SCROLL = 128; + _vm->_graphicsManager.SPEED_SCROLL = 128; break; case 128: - vm->_graphicsManager.SPEED_SCROLL = 160; + _vm->_graphicsManager.SPEED_SCROLL = 160; break; case 160: - vm->_graphicsManager.SPEED_SCROLL = 320; + _vm->_graphicsManager.SPEED_SCROLL = 320; break; case 320: - vm->_graphicsManager.SPEED_SCROLL = 1; + _vm->_graphicsManager.SPEED_SCROLL = 1; break; } } - if (mousePos.x >= vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273) - vm->_globals.vitesse = 2; - 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) > 0xD3u) + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= _vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273) + _vm->_globals.vitesse = 2; + 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) > 0xD3u) doneFlag = true; } - if (!vm->_graphicsManager.MANU_SCROLL) - vm->_globals.opt_scrtype = 2; - if (vm->_graphicsManager.MANU_SCROLL == 1) - vm->_globals.opt_scrtype = 1; - if (vm->_globals.vitesse == 1) - vm->_globals.opt_vitesse = 6; - if (vm->_globals.vitesse == 2) - vm->_globals.opt_vitesse = 5; - if (vm->_globals.vitesse == 3) - vm->_globals.opt_vitesse = 4; - - vm->_globals.opt_txt = !vm->_soundManager.TEXTOFF ? 7 : 8; - vm->_globals.opt_voice = !vm->_soundManager.VOICEOFF ? 7 : 8; - vm->_globals.opt_sound = !vm->_soundManager.SOUNDOFF ? 7 : 8; - vm->_globals.opt_music = !vm->_soundManager.MUSICOFF ? 7 : 8; + if (!_vm->_graphicsManager.MANU_SCROLL) + _vm->_globals.opt_scrtype = 2; + if (_vm->_graphicsManager.MANU_SCROLL == 1) + _vm->_globals.opt_scrtype = 1; + if (_vm->_globals.vitesse == 1) + _vm->_globals.opt_vitesse = 6; + if (_vm->_globals.vitesse == 2) + _vm->_globals.opt_vitesse = 5; + if (_vm->_globals.vitesse == 3) + _vm->_globals.opt_vitesse = 4; + + _vm->_globals.opt_txt = !_vm->_soundManager.TEXTOFF ? 7 : 8; + _vm->_globals.opt_voice = !_vm->_soundManager.VOICEOFF ? 7 : 8; + _vm->_globals.opt_sound = !_vm->_soundManager.SOUNDOFF ? 7 : 8; + _vm->_globals.opt_music = !_vm->_soundManager.MUSICOFF ? 7 : 8; - if (vm->_globals.SVGA == 1) - vm->_globals.opt_anm = 10; - if (vm->_globals.SVGA == 2) - vm->_globals.opt_anm = 9; - if (vm->_globals.SVGA == 3) - vm->_globals.opt_anm = 11; - if (vm->_graphicsManager.SPEED_SCROLL == 1) - vm->_globals.opt_scrspeed = 12; - if (vm->_graphicsManager.SPEED_SCROLL == 2) - vm->_globals.opt_scrspeed = 13; - if (vm->_graphicsManager.SPEED_SCROLL == 4) - vm->_globals.opt_scrspeed = 14; - if (vm->_graphicsManager.SPEED_SCROLL == 8) - vm->_globals.opt_scrspeed = 15; - if (vm->_graphicsManager.SPEED_SCROLL == 16) - vm->_globals.opt_scrspeed = 16; - if (vm->_graphicsManager.SPEED_SCROLL == 32) - vm->_globals.opt_scrspeed = 17; - if (vm->_graphicsManager.SPEED_SCROLL == 48) - vm->_globals.opt_scrspeed = 18; - if (vm->_graphicsManager.SPEED_SCROLL == 64) - vm->_globals.opt_scrspeed = 19; - if (vm->_graphicsManager.SPEED_SCROLL == 128) - vm->_globals.opt_scrspeed = 20; - if (vm->_graphicsManager.SPEED_SCROLL == 160) - vm->_globals.opt_scrspeed = 21; - if (vm->_graphicsManager.SPEED_SCROLL == 320) - vm->_globals.opt_scrspeed = 22; - if (vm->_graphicsManager.SPEED_SCROLL == 640) - vm->_globals.opt_scrspeed = 23; - - vm->_eventsManager.VBL(); + if (_vm->_globals.SVGA == 1) + _vm->_globals.opt_anm = 10; + if (_vm->_globals.SVGA == 2) + _vm->_globals.opt_anm = 9; + if (_vm->_globals.SVGA == 3) + _vm->_globals.opt_anm = 11; + if (_vm->_graphicsManager.SPEED_SCROLL == 1) + _vm->_globals.opt_scrspeed = 12; + if (_vm->_graphicsManager.SPEED_SCROLL == 2) + _vm->_globals.opt_scrspeed = 13; + if (_vm->_graphicsManager.SPEED_SCROLL == 4) + _vm->_globals.opt_scrspeed = 14; + if (_vm->_graphicsManager.SPEED_SCROLL == 8) + _vm->_globals.opt_scrspeed = 15; + if (_vm->_graphicsManager.SPEED_SCROLL == 16) + _vm->_globals.opt_scrspeed = 16; + if (_vm->_graphicsManager.SPEED_SCROLL == 32) + _vm->_globals.opt_scrspeed = 17; + if (_vm->_graphicsManager.SPEED_SCROLL == 48) + _vm->_globals.opt_scrspeed = 18; + if (_vm->_graphicsManager.SPEED_SCROLL == 64) + _vm->_globals.opt_scrspeed = 19; + if (_vm->_graphicsManager.SPEED_SCROLL == 128) + _vm->_globals.opt_scrspeed = 20; + if (_vm->_graphicsManager.SPEED_SCROLL == 160) + _vm->_globals.opt_scrspeed = 21; + if (_vm->_graphicsManager.SPEED_SCROLL == 320) + _vm->_globals.opt_scrspeed = 22; + if (_vm->_graphicsManager.SPEED_SCROLL == 640) + _vm->_globals.opt_scrspeed = 23; + + _vm->_eventsManager.VBL(); } while (!doneFlag); - vm->_graphicsManager.SCOPY(vm->_graphicsManager.VESA_SCREEN, vm->_graphicsManager.ofscroll + 164, - 107, 335, 215, vm->_graphicsManager.VESA_BUFFER, 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.VESA_SCREEN, _vm->_graphicsManager.ofscroll + 164, + 107, 335, 215, _vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll + 164, 107); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_graphicsManager.ofscroll + 164, 107, + _vm->_graphicsManager.ofscroll + 498, 320); + + _vm->_globals.OPTION_SPR = _vm->_globals.dos_free2(_vm->_globals.OPTION_SPR); + _vm->_globals.OPTION_FLAG = false; +} + +void DialogsManager::showInventory() { + int v1; + size_t filesize; + int v4; + int v5; + int v6; + byte *v7; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + Common::File f; - vm->_globals.OPTION_SPR = vm->_globals.dos_free2(vm->_globals.OPTION_SPR); - vm->_globals.OPTION_FLAG = false; + v13 = 0; + if (!VIRE_INVENT && !AFFINVEN && !_vm->_globals.DESACTIVE_INVENT) { + _vm->_graphicsManager.no_scroll = 1; + _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; + _vm->_objectsManager.FLAG_VISIBLE = 0; + v1 = 0; + do { + INVENT_ANIM(); + _vm->_eventsManager.XMOUSE(); + _vm->_eventsManager.YMOUSE(); + _vm->_eventsManager.VBL(); + ++v1; + } while (v1 <= 1); + _vm->_dialogsManager.Winventaire = g_PTRNUL; + +LABEL_7: + _vm->_eventsManager.souris_bb = 0; + _vm->_eventsManager.souris_b = 0; + _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + + switch (_vm->_globals.FR) { + case 0: + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTAN.SPR"); + break; + case 1: + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTFR.SPR"); + break; + case 2: + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTES.SPR"); + break; + } + + if (!f.open(_vm->_globals.NFICHIER)) + error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); + + filesize = f.size(); + _vm->_dialogsManager.Winventaire = _vm->_globals.dos_malloc2(filesize); + _vm->_fileManager.bload_it(f, _vm->_dialogsManager.Winventaire, filesize); + f.close(); + + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENT2.SPR"); + inventaire2 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + v19 = _vm->_graphicsManager.ofscroll + 152; + v18 = _vm->_objectsManager.Get_Largeur(_vm->_dialogsManager.Winventaire, 0); + v17 = _vm->_objectsManager.Get_Hauteur(_vm->_dialogsManager.Winventaire, 0); + inventairex = v19; + inventairey = 114; + inventairel = v18; + inventaireh = v17; + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, + v19 + 300, 414, 0, 0, 0, 0); + v15 = 0; + v4 = 0; + v14 = 1; + do { + v16 = 0; + v5 = 1; + do { + ++v4; + v6 = _vm->_globals.INVENTAIRE[v4]; + if (v6 && v4 <= 29) { + v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, + v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); + _vm->_globals.dos_free2(v7); + } + v16 += 54; + ++v5; + } while (v5 <= 6); + v15 += 38; + ++v14; + } while (v14 <= 5); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, inventairex, inventairey, inventairel, inventaireh); + _vm->_eventsManager.souris_bb = 0; + v20 = 0; + + // Main loop to select an inventory item + while (!_vm->shouldQuit()) { + // Turn on drawing the inventory dialog in the event manager + AFFINVEN = true; + + v8 = _vm->_eventsManager.XMOUSE(); + v9 = _vm->_eventsManager.YMOUSE(); + v12 = _vm->_eventsManager.BMOUSE(); + v10 = v13; + v11 = _vm->_linesManager.ZONE_OBJET(v8, v9); + v13 = v11; + if (v11 != v10) + _vm->_objectsManager.PARAMCADRE(v11); + if (_vm->_eventsManager.btsouris != 16) { + if ((uint16)(_vm->_eventsManager.btsouris - 1) > 1u) { + if (_vm->_eventsManager.btsouris != 3) { + if (v12 == 2) { + _vm->_objectsManager.OBJETPLUS(v13); + if (_vm->_eventsManager.btsouris != 23) + _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); + } + } + } + } + if (v12 == 1) { + if (_vm->_eventsManager.btsouris == 1 || _vm->_eventsManager.btsouris == 16 || !_vm->_eventsManager.btsouris || (uint16)(_vm->_eventsManager.btsouris - 2) <= 1u) + break; + v9 = v13; + _vm->_objectsManager.VALID_OBJET(_vm->_globals.INVENTAIRE[v13]); + if (_vm->_eventsManager.btsouris == 8) + v20 = 1; + if (v20 != 1) { + _vm->_scriptManager.TRAVAILOBJET = 1; + _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; + _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals.INVENTAIRE[v13]; + _vm->_globals.SAUVEGARDE->data[svField9] = _vm->_eventsManager.btsouris; + _vm->_objectsManager.OPTI_OBJET(); + _vm->_scriptManager.TRAVAILOBJET = 0; + + if (_vm->_soundManager.VOICEOFF == 1) { + do + _vm->_eventsManager.VBL(); + while (!_vm->_globals.SORTIE && _vm->_eventsManager.BMOUSE() != 1); + _vm->_fontManager.TEXTE_OFF(9); + } + if (_vm->_globals.SORTIE) { + if (_vm->_globals.SORTIE == 2) + v20 = 1; + _vm->_globals.SORTIE = 0; + if (v20 != 1) { + inventaire2 = _vm->_globals.dos_free2(inventaire2); + if (g_PTRNUL != _vm->_dialogsManager.Winventaire) + _vm->_dialogsManager.Winventaire = _vm->_globals.dos_free2(_vm->_dialogsManager.Winventaire); + goto LABEL_7; + } + } else if (v20 != 1) { + AFFINVEN = true; + } + } + } + if (VIRE_INVENT == 1) + v20 = 1; + if (v20 == 1) + break; + _vm->_eventsManager.VBL(); + if ((uint16)(_vm->_globals.ECRAN - 35) <= 5u) + _vm->_objectsManager.SPECIAL_JEU(); + } + _vm->_fontManager.TEXTE_OFF(9); + if (AFFINVEN) { + AFFINVEN = false; + v9 = 114; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v19, 114, v18, v17, _vm->_graphicsManager.VESA_BUFFER, v19, 114); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); + _vm->_objectsManager.BOBTOUS = 1; + } + if (_vm->_dialogsManager.Winventaire != g_PTRNUL) + _vm->_dialogsManager.Winventaire = _vm->_globals.dos_free2(_vm->_dialogsManager.Winventaire); + inventaire2 = _vm->_globals.dos_free2(inventaire2); + + if (_vm->_eventsManager.btsouris == 1) + showOptionsDialog(); + if (_vm->_eventsManager.btsouris == 3) + _vm->_menuManager.CHARGE_PARTIE(); + if (_vm->_eventsManager.btsouris == 2) + _vm->_menuManager.SAUVE_PARTIE(); + _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_objectsManager.old_cady = 0; + _vm->_objectsManager.cady = 0; + _vm->_objectsManager.old_cadx = 0; + _vm->_objectsManager.cadx = 0; + _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_graphicsManager.no_scroll = 0; + } +} + +void DialogsManager::INVENT_ANIM() { + int v0; + int v1; + + if (!DESACTIVE_INVENT) { + if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager.FLAG_VISIBLE) { + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, + _vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.I_old_x, 27); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); + --_vm->_objectsManager.FLAG_VISIBLE_EFFACE; + } + + if (_vm->_objectsManager.FLAG_VISIBLE) { + if (_vm->_objectsManager.I_old_x <= 1) + _vm->_objectsManager.I_old_x = 2; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, + _vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.I_old_x, 27); + + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); + v0 = _vm->_graphicsManager.ofscroll + 2; + v1 = _vm->_graphicsManager.ofscroll + 2; + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.ICONE, v1 + 300, 327, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); + _vm->_objectsManager.I_old_x = v0; + } + + if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { + if (_vm->_globals.SAUVEGARDE->data[svField353] == 1) + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + if (_vm->_globals.SAUVEGARDE->data[svField355] == 1) + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + _vm->_graphicsManager.Ajoute_Segment_Vesa(566, 25, 594, 60); + } + if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + } + + if (_vm->_globals.SAUVEGARDE->data[svField354] == 1) { + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + } + } +} + +void DialogsManager::TEST_INVENT() { + if (_vm->_globals.PLAN_FLAG) + _vm->_eventsManager.KEY_INVENT = 0; + if (_vm->_eventsManager.KEY_INVENT == 1) { + if (!INVENTFLAG) { + _vm->_eventsManager.KEY_INVENT = 0; + INVENTFLAG = 1; + _vm->_dialogsManager.showInventory(); + INVENTFLAG = 0; + _vm->_eventsManager.KEY_INVENT = 0; + } + } } } // End of namespace Hopkins diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h index caaa9f5575..ddec3fb4a1 100644 --- a/engines/hopkins/dialogs.h +++ b/engines/hopkins/dialogs.h @@ -32,11 +32,30 @@ namespace Hopkins { class HopkinsEngine; /** - * Class for showing the options dialog + * Class for manging game dialogs */ -class OptionsDialog { +class DialogsManager { +private: + HopkinsEngine *_vm; public: - static void show(HopkinsEngine *vm); + bool DESACTIVE_INVENT; + bool INVENTFLAG; + bool AFFINVEN; + bool VIRE_INVENT; + int inventairex, inventairey; + int inventairel, inventaireh; + byte *Winventaire; + byte *inventaire2; +public: + DialogsManager(); + ~DialogsManager(); + void setParent(HopkinsEngine *vm); + + void showOptionsDialog(); + void showInventory(); + + void INVENT_ANIM(); + void TEST_INVENT(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 1123b7eb34..0ae9d1f6be 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -186,7 +186,6 @@ Globals::Globals() { ICONE = NULL; BUF_ZONE = NULL; CACHE_BANQUE[6] = NULL; - Winventaire = NULL; texte_tmp = NULL; SPRITE_ECRAN = NULL; SAUVEGARDE = NULL; @@ -253,7 +252,6 @@ Globals::~Globals() { free(ICONE); dos_free2(BUF_ZONE); dos_free2(CACHE_BANQUE[6]); - dos_free2(Winventaire); dos_free2(texte_tmp); dos_free2(SPRITE_ECRAN); dos_free2((byte *)SAUVEGARDE); @@ -328,8 +326,8 @@ void Globals::clearAll() { NUM_FICHIER_OBJ = 0; Bufferdecor = g_PTRNUL; Bufferobjet = g_PTRNUL; - Winventaire = g_PTRNUL; - inventaire2 = g_PTRNUL; + _vm->_dialogsManager.Winventaire = g_PTRNUL; + _vm->_dialogsManager.inventaire2 = g_PTRNUL; COUCOU = g_PTRNUL; SPRITE_ECRAN = g_PTRNUL; SAUVEGARDE = (Sauvegarde *)g_PTRNUL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 193807d0d4..15c44f74d7 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -358,7 +358,6 @@ public: byte *TETE; byte *ICONE; byte *BUF_ZONE; - byte *Winventaire; byte *texte_tmp; int texte_long; int TEXTE_FORMATE; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index dc2cc4969c..08f4b9f874 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -40,6 +40,7 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe g_vm = this; _debugger.setParent(this); _animationManager.setParent(this); + _dialogsManager.setParent(this); _eventsManager.setParent(this); _fileManager.setParent(this); _fontManager.setParent(this); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 3564e1f4fe..0b6818d8cd 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -33,6 +33,7 @@ #include "graphics/surface.h" #include "hopkins/anim.h" #include "hopkins/debugger.h" +#include "hopkins/dialogs.h" #include "hopkins/events.h" #include "hopkins/files.h" #include "hopkins/font.h" @@ -97,6 +98,7 @@ protected: public: Debugger _debugger; AnimationManager _animationManager; + DialogsManager _dialogsManager; EventsManager _eventsManager; FontManager _fontManager; Globals _globals; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 100b77c388..8b3010fc02 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -207,7 +207,7 @@ int MenuManager::MENU() { _vm->_eventsManager.delay(200); // Show the options dialog - OptionsDialog::show(_vm); + _vm->_dialogsManager.showOptionsDialog(); } if (menuIndex == INTRODUCTION) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, 13); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 9ddb4f3693..c94544f5ae 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -39,16 +39,12 @@ ObjectsManager::ObjectsManager() { } PRIORITY = 0; - inventairex = inventairey = 0; - inventairel = inventaireh = 0; old_cadx = old_cady = old_cadi = 0; cadx = cady = cadi = 0; SL_X = SL_Y = 0; I_old_x = I_old_y = 0; g_old_x = g_old_y = 0; FLAG_VISIBLE_EFFACE = 0; - Winventaire = NULL; - inventaire2 = g_PTRNUL; SL_SPR = g_PTRNUL; SL_SPR2 = g_PTRNUL; sprite_ptr = g_PTRNUL; @@ -57,11 +53,8 @@ ObjectsManager::ObjectsManager() { SL_FLAG = false; SL_MODE = false; FLAG_VISIBLE = false; - DESACTIVE_INVENT = false; DESACTIVE_CURSOR = 0; BOBTOUS = false; - INVENTFLAG = false; - AFFINVEN = false; my_anim = 0; GOACTION = 0; NUMZONE = 0; @@ -82,7 +75,6 @@ ObjectsManager::ObjectsManager() { A_DEPA = 0; MAX_DEPA = 0; MAX_DEPA1 = 0; - VIRE_INVENT = 0; CH_TETE = 0; T_RECTIF = 0; DESACTIVE = 0; @@ -491,13 +483,13 @@ void ObjectsManager::AFF_SPRITES() { } _vm->_globals.NBTRI = 0; - if (_vm->_objectsManager.AFFINVEN) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, inventairex, inventairey, inventairel, inventaireh); + if (_vm->_dialogsManager.AFFINVEN) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, _vm->_dialogsManager.inventairex, _vm->_dialogsManager.inventairey, _vm->_dialogsManager.inventairel, _vm->_dialogsManager.inventaireh); if (old_cadx && old_cady) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, inventaire2, old_cadx + 300, old_cady + 300, old_cadi + 1); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.inventaire2, old_cadx + 300, old_cady + 300, old_cadi + 1); if (cadx && cady) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, inventaire2, cadx + 300, cady + 300, cadi); - _vm->_graphicsManager.Ajoute_Segment_Vesa(inventairex, inventairey, inventairex + inventairel, inventairey + inventaireh); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.inventaire2, cadx + 300, cady + 300, cadi); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_dialogsManager.inventairex, _vm->_dialogsManager.inventairey, _vm->_dialogsManager.inventairex + _vm->_dialogsManager.inventairel, _vm->_dialogsManager.inventairey + _vm->_dialogsManager.inventaireh); } if (SL_FLAG == 1) { @@ -570,7 +562,7 @@ void ObjectsManager::AFF_SPRITES() { } } - INVENT_ANIM(); + _vm->_dialogsManager.INVENT_ANIM(); } void ObjectsManager::INIT_BOB() { @@ -1025,52 +1017,6 @@ void ObjectsManager::VERIFCACHE() { } while (v8 <= 19); } -void ObjectsManager::INVENT_ANIM() { - int v0; - int v1; - - if (!DESACTIVE_INVENT) { - if (FLAG_VISIBLE_EFFACE && !FLAG_VISIBLE) { - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, I_old_x, 27, 48, 38, - _vm->_graphicsManager.VESA_BUFFER, I_old_x, 27); - _vm->_graphicsManager.Ajoute_Segment_Vesa(I_old_x, 27, I_old_x + 48, 65); - --FLAG_VISIBLE_EFFACE; - } - - if (FLAG_VISIBLE) { - if (I_old_x <= 1) - I_old_x = 2; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, I_old_x, 27, 48, 38, - _vm->_graphicsManager.VESA_BUFFER, I_old_x, 27); - - _vm->_graphicsManager.Ajoute_Segment_Vesa(I_old_x, 27, I_old_x + 48, 65); - v0 = _vm->_graphicsManager.ofscroll + 2; - v1 = _vm->_graphicsManager.ofscroll + 2; - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.ICONE, v1 + 300, 327, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); - I_old_x = v0; - } - - if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { - if (_vm->_globals.SAUVEGARDE->data[svField353] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - if (_vm->_globals.SAUVEGARDE->data[svField355] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); - _vm->_graphicsManager.Ajoute_Segment_Vesa(566, 25, 594, 60); - } - if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); - } - - if (_vm->_globals.SAUVEGARDE->data[svField354] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); - } - } -} - void ObjectsManager::DEF_SPRITE(int idx) { int v2; int v3; @@ -1990,24 +1936,24 @@ LABEL_241: v3 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v4 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v5 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v5 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v5 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v5 = -Sprite[0].fieldC; v3 = _vm->_graphicsManager.Reel_Reduc(v3, v5); - v6 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v6 = -_vm->_objectsManager.Sprite[0].fieldC; + v6 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v6 = -Sprite[0].fieldC; v4 = _vm->_graphicsManager.Reel_Reduc(v4, v6); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v7 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v7 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v7 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v7 = -Sprite[0].fieldC; v3 = _vm->_graphicsManager.Reel_Zoom(v3, v7); - v8 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v8 = -_vm->_objectsManager.Sprite[0].fieldC; + v8 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v8 = -Sprite[0].fieldC; v4 = _vm->_graphicsManager.Reel_Zoom(v4, v8); } v0 = v3 + g_old_x; @@ -2028,24 +1974,24 @@ LABEL_23: } else { v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v11 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v11 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v11 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v11 = -Sprite[0].fieldC; v9 = _vm->_graphicsManager.Reel_Reduc(v9, v11); - v12 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v12 = -_vm->_objectsManager.Sprite[0].fieldC; + v12 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v12 = -Sprite[0].fieldC; v10 = _vm->_graphicsManager.Reel_Reduc(v10, v12); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v13 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v13 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v13 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v13 = -Sprite[0].fieldC; v9 = _vm->_graphicsManager.Reel_Zoom(v9, v13); - v14 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v14 = -_vm->_objectsManager.Sprite[0].fieldC; + v14 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v14 = -Sprite[0].fieldC; v10 = _vm->_graphicsManager.Reel_Zoom(v10, v14); } v0 = g_old_x - v9; @@ -2068,16 +2014,16 @@ LABEL_43: if (v15 < 0) v15 = -v15; v16 = v15; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v17 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v17 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v17 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v17 = -Sprite[0].fieldC; v16 = _vm->_graphicsManager.Reel_Reduc(v16, v17); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v18 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v18 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v18 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v18 = -Sprite[0].fieldC; v16 = _vm->_graphicsManager.Reel_Zoom(v16, v18); } v0 = g_old_x; @@ -2100,16 +2046,16 @@ LABEL_60: if (v19 < 0) v19 = -v19; v20 = v19; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v21 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v21 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v21 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v21 = -Sprite[0].fieldC; v20 = _vm->_graphicsManager.Reel_Reduc(v20, v21); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v22 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v22 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v22 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v22 = -Sprite[0].fieldC; v20 = _vm->_graphicsManager.Reel_Zoom(v20, v22); } v0 = g_old_x; @@ -2130,24 +2076,24 @@ LABEL_77: } else { v23 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v24 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v25 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v25 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v25 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v25 = -Sprite[0].fieldC; v23 = _vm->_graphicsManager.Reel_Reduc(v23, v25); - v26 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v26 = -_vm->_objectsManager.Sprite[0].fieldC; + v26 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v26 = -Sprite[0].fieldC; v24 = _vm->_graphicsManager.Reel_Reduc(v24, v26); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v27 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v27 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v27 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v27 = -Sprite[0].fieldC; v23 = _vm->_graphicsManager.Reel_Zoom(v23, v27); - v28 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v28 = -_vm->_objectsManager.Sprite[0].fieldC; + v28 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v28 = -Sprite[0].fieldC; v24 = _vm->_graphicsManager.Reel_Zoom(v24, v28); } v0 = v23 + g_old_x; @@ -2168,24 +2114,24 @@ LABEL_96: } else { v29 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v30 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v31 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v31 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v31 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v31 = -Sprite[0].fieldC; v29 = _vm->_graphicsManager.Reel_Reduc(v29, v31); - v32 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v32 = -_vm->_objectsManager.Sprite[0].fieldC; + v32 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v32 = -Sprite[0].fieldC; v30 = _vm->_graphicsManager.Reel_Reduc(v30, v32); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v33 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v33 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v33 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v33 = -Sprite[0].fieldC; v29 = _vm->_graphicsManager.Reel_Zoom(v29, v33); - v34 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v34 = -_vm->_objectsManager.Sprite[0].fieldC; + v34 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v34 = -Sprite[0].fieldC; v30 = _vm->_graphicsManager.Reel_Zoom(v30, v34); } v0 = g_old_x - v29; @@ -2206,24 +2152,24 @@ LABEL_115: } else { v35 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v36 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v37 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v37 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v37 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v37 = -Sprite[0].fieldC; v35 = _vm->_graphicsManager.Reel_Reduc(v35, v37); - v38 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v38 = -_vm->_objectsManager.Sprite[0].fieldC; + v38 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v38 = -Sprite[0].fieldC; v36 = _vm->_graphicsManager.Reel_Reduc(v36, v38); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v39 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v39 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v39 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v39 = -Sprite[0].fieldC; v35 = _vm->_graphicsManager.Reel_Zoom(v35, v39); - v40 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v40 = -_vm->_objectsManager.Sprite[0].fieldC; + v40 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v40 = -Sprite[0].fieldC; v36 = _vm->_graphicsManager.Reel_Zoom(v36, v40); } v0 = v35 + g_old_x; @@ -2244,24 +2190,24 @@ LABEL_134: } else { v41 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v42 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v43 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v43 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v43 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v43 = -Sprite[0].fieldC; v41 = _vm->_graphicsManager.Reel_Reduc(v41, v43); - v44 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v44 = -_vm->_objectsManager.Sprite[0].fieldC; + v44 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v44 = -Sprite[0].fieldC; v42 = _vm->_graphicsManager.Reel_Reduc(v42, v44); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v45 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v45 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v45 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v45 = -Sprite[0].fieldC; v41 = _vm->_graphicsManager.Reel_Zoom(v41, v45); - v46 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v46 = -_vm->_objectsManager.Sprite[0].fieldC; + v46 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v46 = -Sprite[0].fieldC; v42 = _vm->_graphicsManager.Reel_Zoom(v42, v46); } v0 = g_old_x - v41; @@ -2465,7 +2411,7 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { _vm->_linesManager.RESET_OBSTACLE(); _vm->_linesManager.TOTAL_LIGNES = 0; - _vm->_objectsManager.DERLIGNE = 0; + DERLIGNE = 0; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); v4 = 0; @@ -2599,7 +2545,7 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { while (v15 <= 100); _vm->_globals.dos_free2(ptr); - _vm->_objectsManager.CARRE_ZONE(); + CARRE_ZONE(); } // Square Zone @@ -2680,7 +2626,7 @@ void ObjectsManager::PLAN_BETA() { int v5; v1 = 0; - INVENTFLAG = false; + _vm->_dialogsManager.INVENTFLAG = false; _vm->_eventsManager.KEY_INVENT = 0; _vm->_globals.Max_Propre = 1; _vm->_globals.Max_Ligne_Long = 1; @@ -2819,14 +2765,14 @@ void ObjectsManager::BTGAUCHE() { destX = _vm->_eventsManager.XMOUSE(); destY = _vm->_eventsManager.YMOUSE(); - if (!INVENTFLAG && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) { + if (!_vm->_dialogsManager.INVENTFLAG && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) { v1 = _vm->_eventsManager.btsouris; - INVENTFLAG = 1; - INVENT(); - INVENTFLAG = 0; + _vm->_dialogsManager.INVENTFLAG = 1; + _vm->_dialogsManager.showInventory(); + _vm->_dialogsManager.INVENTFLAG = 0; _vm->_eventsManager.KEY_INVENT = 0; if (!_vm->_globals.SORTIE) { - INVENTFLAG = 0; + _vm->_dialogsManager.INVENTFLAG = 0; _vm->_eventsManager.btsouris = v1; } return; @@ -3157,216 +3103,6 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); } -void ObjectsManager::TEST_INVENT() { - if (_vm->_globals.PLAN_FLAG) - _vm->_eventsManager.KEY_INVENT = 0; - if (_vm->_eventsManager.KEY_INVENT == 1) { - if (!INVENTFLAG) { - _vm->_eventsManager.KEY_INVENT = 0; - INVENTFLAG = 1; - INVENT(); - INVENTFLAG = 0; - _vm->_eventsManager.KEY_INVENT = 0; - } - } -} - -void ObjectsManager::INVENT() { - int v1; - size_t filesize; - int v4; - int v5; - int v6; - byte *v7; - int v8; - int v9; - int v10; - int v11; - int v12; - int v13; - int v14; - int v15; - int v16; - int v17; - int v18; - int v19; - int v20; - Common::File f; - - v13 = 0; - if (VIRE_INVENT != 1 && !AFFINVEN && _vm->_globals.DESACTIVE_INVENT != 1) { - _vm->_graphicsManager.no_scroll = 1; - FLAG_VISIBLE_EFFACE = 4; - FLAG_VISIBLE = 0; - v1 = 0; - do { - INVENT_ANIM(); - _vm->_eventsManager.XMOUSE(); - _vm->_eventsManager.YMOUSE(); - _vm->_eventsManager.VBL(); - ++v1; - } while (v1 <= 1); - _vm->_globals.Winventaire = g_PTRNUL; - -LABEL_7: - _vm->_eventsManager.souris_bb = 0; - _vm->_eventsManager.souris_b = 0; - _vm->_globals.DESACTIVE_INVENT = 1; - _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - - switch (_vm->_globals.FR) { - case 0: - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTAN.SPR"); - break; - case 1: - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTFR.SPR"); - break; - case 2: - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTES.SPR"); - break; - } - - if (!f.open(_vm->_globals.NFICHIER)) - error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); - - filesize = f.size(); - _vm->_globals.Winventaire = _vm->_globals.dos_malloc2(filesize); - _vm->_fileManager.bload_it(f, _vm->_globals.Winventaire, filesize); - f.close(); - - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENT2.SPR"); - inventaire2 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - v19 = _vm->_graphicsManager.ofscroll + 152; - v18 = Get_Largeur(_vm->_globals.Winventaire, 0); - v17 = Get_Hauteur(_vm->_globals.Winventaire, 0); - inventairex = v19; - inventairey = 114; - inventairel = v18; - inventaireh = v17; - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, - v19 + 300, 414, 0, 0, 0, 0); - v15 = 0; - v4 = 0; - v14 = 1; - do { - v16 = 0; - v5 = 1; - do { - ++v4; - v6 = _vm->_globals.INVENTAIRE[v4]; - if (v6 && v4 <= 29) { - v7 = CAPTURE_OBJET(v6, 0); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, - v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); - _vm->_globals.dos_free2(v7); - } - v16 += 54; - ++v5; - } while (v5 <= 6); - v15 += 38; - ++v14; - } while (v14 <= 5); - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, inventairex, inventairey, inventairel, inventaireh); - _vm->_eventsManager.souris_bb = 0; - v20 = 0; - - // Main loop to select an inventory item - while (!_vm->shouldQuit()) { - // Turn on drawing the inventory dialog in the event manager - AFFINVEN = true; - - v8 = _vm->_eventsManager.XMOUSE(); - v9 = _vm->_eventsManager.YMOUSE(); - v12 = _vm->_eventsManager.BMOUSE(); - v10 = v13; - v11 = _vm->_linesManager.ZONE_OBJET(v8, v9); - v13 = v11; - if (v11 != v10) - PARAMCADRE(v11); - if (_vm->_eventsManager.btsouris != 16) { - if ((uint16)(_vm->_eventsManager.btsouris - 1) > 1u) { - if (_vm->_eventsManager.btsouris != 3) { - if (v12 == 2) { - OBJETPLUS(v13); - if (_vm->_eventsManager.btsouris != 23) - _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); - } - } - } - } - if (v12 == 1) { - if (_vm->_eventsManager.btsouris == 1 || _vm->_eventsManager.btsouris == 16 || !_vm->_eventsManager.btsouris || (uint16)(_vm->_eventsManager.btsouris - 2) <= 1u) - break; - v9 = v13; - VALID_OBJET(_vm->_globals.INVENTAIRE[v13]); - if (_vm->_eventsManager.btsouris == 8) - v20 = 1; - if (v20 != 1) { - _vm->_scriptManager.TRAVAILOBJET = 1; - _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; - _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals.INVENTAIRE[v13]; - _vm->_globals.SAUVEGARDE->data[svField9] = _vm->_eventsManager.btsouris; - OPTI_OBJET(); - _vm->_scriptManager.TRAVAILOBJET = 0; - - if (_vm->_soundManager.VOICEOFF == 1) { - do - _vm->_eventsManager.VBL(); - while (!_vm->_globals.SORTIE && _vm->_eventsManager.BMOUSE() != 1); - _vm->_fontManager.TEXTE_OFF(9); - } - if (_vm->_globals.SORTIE) { - if (_vm->_globals.SORTIE == 2) - v20 = 1; - _vm->_globals.SORTIE = 0; - if (v20 != 1) { - inventaire2 = _vm->_globals.dos_free2(inventaire2); - if (g_PTRNUL != _vm->_globals.Winventaire) - _vm->_globals.Winventaire = _vm->_globals.dos_free2(_vm->_globals.Winventaire); - goto LABEL_7; - } - } else if (v20 != 1) { - AFFINVEN = true; - } - } - } - if (VIRE_INVENT == 1) - v20 = 1; - if (v20 == 1) - break; - _vm->_eventsManager.VBL(); - if ((uint16)(_vm->_globals.ECRAN - 35) <= 5u) - SPECIAL_JEU(); - } - _vm->_fontManager.TEXTE_OFF(9); - if (AFFINVEN) { - AFFINVEN = false; - v9 = 114; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v19, 114, v18, v17, _vm->_graphicsManager.VESA_BUFFER, v19, 114); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); - BOBTOUS = 1; - } - if (_vm->_globals.Winventaire != g_PTRNUL) - _vm->_globals.Winventaire = _vm->_globals.dos_free2(_vm->_globals.Winventaire); - inventaire2 = _vm->_globals.dos_free2(inventaire2); - - if (_vm->_eventsManager.btsouris == 1) - OptionsDialog::show(_vm); - if (_vm->_eventsManager.btsouris == 3) - _vm->_menuManager.CHARGE_PARTIE();//v9); - if (_vm->_eventsManager.btsouris == 2) - _vm->_menuManager.SAUVE_PARTIE();//v9); - _vm->_eventsManager.btsouris = 4; - _vm->_eventsManager.CHANGE_MOUSE(4); - old_cady = 0; - cady = 0; - old_cadx = 0; - cadx = 0; - _vm->_globals.DESACTIVE_INVENT = 0; - _vm->_graphicsManager.no_scroll = 0; - } -} - // Change Face/Head void ObjectsManager::CHANGE_TETE(int a1, int a2) { int v2; @@ -5229,10 +4965,10 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_globals.BOBZONE_FLAG[21] = 1; _vm->_globals.BOBZONE_FLAG[22] = 1; _vm->_globals.BOBZONE_FLAG[23] = 1; - _vm->_objectsManager.VERBE_ON(20, 5); - _vm->_objectsManager.VERBE_ON(21, 5); - _vm->_objectsManager.VERBE_ON(22, 5); - _vm->_objectsManager.VERBE_ON(23, 5); + VERBE_ON(20, 5); + VERBE_ON(21, 5); + VERBE_ON(22, 5); + VERBE_ON(23, 5); _vm->_globals.ZONEP[20].field12 = 30; _vm->_globals.ZONEP[21].field12 = 30; _vm->_globals.ZONEP[22].field12 = 30; @@ -5246,7 +4982,7 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { } if (_vm->_globals.ECRAN == 93) { if (!_vm->_globals.SAUVEGARDE->data[svField333]) - _vm->_objectsManager.BOBANIM_ON(8); + BOBANIM_ON(8); } if (_vm->_globals.ECRAN == 18 && _vm->_globals.OLD_ECRAN == 17) { _vm->_eventsManager.souris_n = 4; @@ -5792,24 +5528,24 @@ void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) if (v7) { if (v7 == 1) { if (a6 == 1 && BOBPOSI(1) == 26) { - VIRE_INVENT = 1; + _vm->_dialogsManager.VIRE_INVENT = true; _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_globals.SAUVEGARDE->data[v6] = 4; } if (a6 == 2 && BOBPOSI(2) == 26) { - VIRE_INVENT = 1; + _vm->_dialogsManager.VIRE_INVENT = true; _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_globals.SAUVEGARDE->data[v6] = 4; } if (a6 == 3 && BOBPOSI(3) == 27) { - VIRE_INVENT = 1; + _vm->_dialogsManager.VIRE_INVENT = true; _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_globals.SAUVEGARDE->data[v6] = 4; } if (a6 == 4 && BOBPOSI(4) == 27) { - VIRE_INVENT = 1; + _vm->_dialogsManager.VIRE_INVENT = true; _vm->_soundManager.PLAY_SAMPLE2(1); - VIRE_INVENT = 1; + _vm->_dialogsManager.VIRE_INVENT = true; _vm->_globals.SAUVEGARDE->data[v6] = 4; } } @@ -5865,9 +5601,9 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s int v9; v5 = 0; - INVENTFLAG = 0; + _vm->_dialogsManager.INVENTFLAG = 0; _vm->_eventsManager.KEY_INVENT = 0; - VIRE_INVENT = 0; + _vm->_dialogsManager.VIRE_INVENT = false; _vm->_graphicsManager.ofscroll = 0; _vm->_globals.PLAN_FLAG = 0; _vm->_globals.iRegul = 1; @@ -5936,7 +5672,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s } if (v9 == 2) BTDROITE(); - TEST_INVENT(); + _vm->_dialogsManager.TEST_INVENT(); VERIFZONE(); if (GOACTION == 1) PARADISE(); @@ -5962,12 +5698,12 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & bool breakFlag; int xp, yp; - INVENTFLAG = 0; + _vm->_dialogsManager.INVENTFLAG = 0; _vm->_eventsManager.KEY_INVENT = 0; - _vm->_objectsManager.verbe = 4; + verbe = 4; _vm->_globals.MAX_COMPTE = 6; _vm->_graphicsManager.ofscroll = 0; - VIRE_INVENT = 0; + _vm->_dialogsManager.VIRE_INVENT = false; _vm->_globals.PLAN_FLAG = 0; _vm->_graphicsManager.NOFADE = 0; _vm->_globals.NOMARCHE = 0; @@ -5980,7 +5716,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & if (!s1.empty()) _vm->_graphicsManager.LOAD_IMAGE(s1); if (!s2.empty()) - _vm->_objectsManager.INILINK(s2); + INILINK(s2); if (!s3.empty()) { _vm->_animationManager.CHARGE_ANIM(s3); _vm->_graphicsManager.VISU_ALL(); @@ -6019,23 +5755,23 @@ LABEL_70: } _vm->_globals.HOPKINS_DATA(); if (!_vm->_globals.PERSO_TYPE) - SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 34, 190); + SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 34, 190); if (_vm->_globals.PERSO_TYPE == 1) - SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 28, 155); + SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 28, 155); if (_vm->_globals.PERSO_TYPE == 2) - SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 20, 127); - _vm->_eventsManager.souris_xy(_vm->_objectsManager.PERX, _vm->_objectsManager.PERY); + SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 20, 127); + _vm->_eventsManager.souris_xy(PERX, PERY); if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) _vm->_graphicsManager.SCROLL = (int16)XSPR(0) - 320; - _vm->_objectsManager.VERIFTAILLE(); + VERIFTAILLE(); SPRITE_ON(0); _vm->_globals.CACHE_ON(); _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_objectsManager.VERIFTAILLE(); + VERIFTAILLE(); SPECIAL_INI(s2); _vm->_eventsManager.souris_n = 4; - g_old_x = _vm->_objectsManager.PERX; - g_old_y = _vm->_objectsManager.PERY; + g_old_x = PERX; + g_old_y = PERY; _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.BPP_NOAFF = 1; @@ -6059,14 +5795,14 @@ LABEL_70: mouseButtons = _vm->_eventsManager.BMOUSE(); if (mouseButtons) { if (mouseButtons == 1) { - if (_vm->_objectsManager.verbe == 16 && _vm->_eventsManager.btsouris == 16) { + if (verbe == 16 && _vm->_eventsManager.btsouris == 16) { xp = _vm->_eventsManager.XMOUSE(); yp = _vm->_eventsManager.YMOUSE(); if (xCheck == xp) { if (yCheck == yp) { _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_objectsManager.PARADISE(); + PARADISE(); if (_vm->_globals.SORTIE) breakFlag = true; } @@ -6074,18 +5810,18 @@ LABEL_70: xCheck = xp; yCheck = yp; } - _vm->_objectsManager.BTGAUCHE(); + BTGAUCHE(); } else if (mouseButtons == 2) { - _vm->_objectsManager.BTDROITE(); + BTDROITE(); } } if (!_vm->_globals.SORTIE) { - TEST_INVENT(); - _vm->_objectsManager.VERIFZONE(); + _vm->_dialogsManager.TEST_INVENT(); + VERIFZONE(); if (_vm->_globals.chemin == (int16 *)g_PTRNUL - || (_vm->_objectsManager.GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { - if (_vm->_objectsManager.GOACTION == 1) - _vm->_objectsManager.PARADISE(); + || (GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { + if (GOACTION == 1) + PARADISE(); } SPECIAL_JEU(); _vm->_eventsManager.VBL(); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index abc0e97d8d..331245215d 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -64,16 +64,12 @@ private: public: SpriteItem Sprite[6]; int PRIORITY; - int inventairex, inventairey; - int inventairel, inventaireh; int old_cadx, old_cady, old_cadi; int cadx, cady, cadi; int SL_X, SL_Y; int I_old_x, I_old_y; int g_old_x, g_old_y; int FLAG_VISIBLE_EFFACE; - byte *Winventaire; - byte *inventaire2; byte *SL_SPR; byte *SL_SPR2; byte *sprite_ptr; @@ -82,11 +78,8 @@ public: bool SL_FLAG; int SL_MODE; bool FLAG_VISIBLE; - bool DESACTIVE_INVENT; int DESACTIVE_CURSOR; bool BOBTOUS; - bool INVENTFLAG; - bool AFFINVEN; int my_anim; int GOACTION; int NUMZONE; @@ -107,7 +100,6 @@ public: int A_DEPA; int MAX_DEPA; int MAX_DEPA1; - int VIRE_INVENT; int CH_TETE; int T_RECTIF; int DESACTIVE; @@ -160,7 +152,6 @@ public: void CALCUL_BOB(int idx); void VERIFCACHE(); - void INVENT_ANIM(); void DEF_SPRITE(int idx); void DEF_CACHE(int idx); void CALCUL_SPRITE(int idx); @@ -199,8 +190,6 @@ public: void PARADISE(); void CLEAR_ECRAN(); - void TEST_INVENT(); - void INVENT(); void CHANGE_TETE(int a1, int a2); void VERIFTAILLE(); void PACOURS_PROPRE(int16 *a1); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 5a6031d203..b010afd6eb 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -189,8 +189,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { v9 = 0; _vm->_objectsManager.DESACTIVE_CURSOR = 1; STATI = 1; - v7 = _vm->_objectsManager.DESACTIVE_INVENT; - _vm->_objectsManager.DESACTIVE_INVENT = 1; + v7 = _vm->_dialogsManager.DESACTIVE_INVENT; + _vm->_dialogsManager.DESACTIVE_INVENT = 1; BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(filename, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; if (BUFFERPERSO == g_PTRNUL) { @@ -255,7 +255,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); _vm->_objectsManager.DESACTIVE_CURSOR = 0; - _vm->_objectsManager.DESACTIVE_INVENT = v7; + _vm->_dialogsManager.DESACTIVE_INVENT = v7; STATI = 0; } |