From 52166834d5e84c6a20e1782489d6ae0623ae5aaa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Oct 2012 00:55:25 +1000 Subject: HOPKINS: Implemented lots more of the remaining stubbed methods --- engines/hopkins/anim.cpp | 444 +++++++++++++++++++++++++++- engines/hopkins/anim.h | 2 +- engines/hopkins/globals.h | 5 + engines/hopkins/graphics.cpp | 4 + engines/hopkins/graphics.h | 1 + engines/hopkins/hopkins.cpp | 64 ++--- engines/hopkins/hopkins.h | 5 - engines/hopkins/menu.cpp | 197 +++++++++++++ engines/hopkins/menu.h | 3 + engines/hopkins/objects.cpp | 672 +++++++++++++++++++++++++++++++++++++------ engines/hopkins/objects.h | 9 + 11 files changed, 1266 insertions(+), 140 deletions(-) (limited to 'engines') diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 7733358a6f..97a0aad250 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -100,15 +100,15 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui if (_vm->_graphicsManager.Winbpp == 2) { if (doneFlag) - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(screenP, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (doneFlag) - _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(screenP, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); @@ -169,7 +169,7 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui #endif _vm->_eventsManager.CONTROLE_MES(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager._vm->_soundManager.VERIF_SOUND(); } while (_vm->_eventsManager.lItCounter < rate2 && !_vm->shouldQuit()); } @@ -194,7 +194,7 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager._vm->_soundManager.VERIF_SOUND(); } } while (!doneFlag && !_vm->shouldQuit()); @@ -224,11 +224,11 @@ REDRAW_ANIM: #endif _vm->_eventsManager.CONTROLE_MES(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager._vm->_soundManager.VERIF_SOUND(); } while (_vm->_eventsManager.lItCounter < rate3 && !_vm->shouldQuit()); _vm->_eventsManager.lItCounter = 0; - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager._vm->_soundManager.VERIF_SOUND(); break; } @@ -285,8 +285,432 @@ FINISH: _vm->_graphicsManager.NOLOCK = false; } -void AnimationManager::PLAY_ANM2(const Common::String &filename, int a2, int a3, int a4) { - warning("TODO: PLAY_ANM2"); +void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4) { + byte *v4; + int v5; + int v6; + int v8; + byte *ptr; + byte *ptra; + int v11; + byte *v12; + byte *v13; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + char v21; + size_t nbytes; + byte buf[6]; + char v25; + Common::File f; + + v8 = 0; + while (1) { + v17 = 0; + v16 = 0; + v19 = 0; + v18 = 0; + v20 = 1; + memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + if (_vm->_graphicsManager.nbrligne == 1280) + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + if (!_vm->_graphicsManager.nbrligne) + _vm->_graphicsManager.ofscroll = 0; + v12 = _vm->_graphicsManager.VESA_SCREEN; + v13 = _vm->_globals.dos_malloc2(0x14u); + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANM, filename); + + if (!f.open(_vm->_globals.NFICHIER)) + error("Error opening file - %s"); + + f.read(&buf, 6); + f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(&buf, 4); + nbytes = f.readUint32LE(); + v21 = f.readUint32LE(); + v20 = f.readUint16LE(); + v19 = f.readUint16LE(); + v18 = f.readUint16LE(); + v17 = f.readUint16LE(); + v16 = f.readUint16LE(); + + f.read(v12, nbytes); + + _vm->_graphicsManager.Cls_Pal(); + v11 = _vm->_graphicsManager.SCROLL; + _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); + _vm->_graphicsManager.SCROLL_ECRAN(0); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.max_x = SCREEN_WIDTH; + if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { + v8 = 1; + ptr = _vm->_globals.dos_malloc2(0x4B000u); + memcpy(ptr, v12, 0x4B000u); + } + if (_vm->_animationManager.NO_SEQ) { + if (v8 == 1) + memcpy(ptr, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + } else { + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (v8) + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(v12, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (v8) + _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(v12, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + } + _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager.ESC_KEY = 0; + _vm->_soundManager.LOAD_ANM_SOUND(); + if (_vm->_globals.iRegul != 1) + break; + while (1) { + if (_vm->_eventsManager.ESC_KEY == 1) + goto LABEL_114; + if (REDRAW_ANIM() == 1) + break; + _vm->_eventsManager.CONTROLE_MES(); + if (_vm->_eventsManager.lItCounter >= a2) + goto LABEL_48; + } + if (_vm->_graphicsManager.NOLOCK == 1) + goto LABEL_114; + if (v8 == 1) + ptr = _vm->_globals.dos_free2(ptr); + _vm->_globals.dos_free2(v13); + f.close(); + + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); + v4 = &_vm->_graphicsManager.Palette[769]; + _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.SCROLL = v11; + _vm->_graphicsManager.SCROLL_ECRAN(v11); + if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + _vm->_graphicsManager.SCANLINE(0x500u); + _vm->_graphicsManager.max_x = 1280; + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else { + _vm->_eventsManager.souris_max(); + _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); + _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) +LABEL_111: + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } +LABEL_112: + _vm->_graphicsManager.DD_Unlock(); + _vm->_eventsManager.VBL(); + _vm->_graphicsManager.FADE_INS(); + } +LABEL_48: + _vm->_eventsManager.lItCounter = 0; + v5 = 0; + v15 = 0; + while (1) { + ++v15; + _vm->_soundManager.PLAY_ANM_SOUND(v15); + memset(&buf, 0, 6u); + memset(v13, 0, 0x13u); + + if (f.read(v13, 0x10) != 0x10) + v5 = -1; + + v25 = 0; + if (strncmp((const char *)v13, "IMAGE=", 6)) + v5 = -1; + + if (v5) + goto LABEL_88; + f.read(v12, READ_LE_UINT32(v13 + 2)); + if (_vm->_globals.iRegul == 1) + break; +LABEL_77: + _vm->_eventsManager.lItCounter = 0; + _vm->_graphicsManager.DD_Lock(); + if (v8) { + if (*v12 != -4) { + _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptr); + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else if (*v12 != -4) { + if (_vm->_graphicsManager.Winbpp == 1) + _vm->_graphicsManager.Copy_Video_Vbe3(v12); + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.Copy_Video_Vbe16(v12); + } + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.VERIF_SOUND(); +LABEL_88: + if (v5 == -1) { + if (_vm->_globals.iRegul == 1) { + while (_vm->_eventsManager.ESC_KEY != 1) { + if (REDRAW_ANIM() == 1) { + if (_vm->_graphicsManager.NOLOCK == 1) + goto LABEL_114; + if (v8 == 1) + ptr = _vm->_globals.dos_free2(ptr); + _vm->_globals.dos_free2(v13); + f.close(); + + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); + v4 = &_vm->_graphicsManager.Palette[769]; + _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.SCROLL = v11; + _vm->_graphicsManager.SCROLL_ECRAN(v11); + if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + _vm->_graphicsManager.SCANLINE(0x500u); + _vm->_graphicsManager.max_x = 1280; + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else { + _vm->_eventsManager.souris_max(); + _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); + _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + goto LABEL_111; + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } + goto LABEL_112; + } + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + if (_vm->_eventsManager.lItCounter >= a4) + goto LABEL_114; + } + } + goto LABEL_114; + } + } + while (_vm->_eventsManager.ESC_KEY != 1) { + if (REDRAW_ANIM() == 1) { + if (_vm->_graphicsManager.NOLOCK == 1) + break; + if (v8 == 1) + ptr = _vm->_globals.dos_free2(ptr); + _vm->_globals.dos_free2(v13); + f.close(); + + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); + v4 = &_vm->_graphicsManager.Palette[769]; + _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.SCROLL = v11; + _vm->_graphicsManager.SCROLL_ECRAN(v11); + if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + _vm->_graphicsManager.SCANLINE(0x500u); + _vm->_graphicsManager.max_x = 1280; + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else { + _vm->_eventsManager.souris_max(); + _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); + _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + goto LABEL_111; + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } + goto LABEL_112; + } + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + if (_vm->_eventsManager.lItCounter >= a3) + goto LABEL_77; + } +LABEL_114: + _vm->_graphicsManager.NOLOCK = 0; + f.close(); + + if (_vm->_graphicsManager.FADE_LINUX == 2 && !v8) { + ptra = _vm->_globals.dos_malloc2(0x4B000u); + + f.seek(0); + f.read(&buf, 6); + f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(&buf, 4u); + nbytes = f.readUint32LE(); + v21 = f.readUint32LE(); + v20 = f.readUint16LE(); + v19 = f.readUint16LE(); + v18 = f.readUint16LE(); + v17 = f.readUint16LE(); + v16 = f.readUint16LE(); + f.read(v12, nbytes); + memcpy(ptra, v12, 0x4B000u); + + v6 = 0; + do { + memset(&buf, 0, 6u); + memset(v13, 0, 0x13u); + if (f.read(v13, 16) != 16) + v6 = -1; + if (strncmp((const char *)v13, "IMAGE=", 7)) + v6 = -1; + + if (!v6) { + f.read(v12, READ_LE_UINT32(v13 + 8)); + if (*v12 != -4) + _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptra); + } + } while (v6 != -1); + _vm->_graphicsManager.FADE_OUTW_LINUX(ptra); + ptr = _vm->_globals.dos_free2(ptra); + } + if (v8 == 1) { + if (_vm->_graphicsManager.FADE_LINUX == 2) + _vm->_graphicsManager.FADE_OUTW_LINUX(ptr); + _vm->_globals.dos_free2(ptr); + } + _vm->_graphicsManager.FADE_LINUX = 0; + _vm->_globals.dos_free2(v13); + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); + _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.SCROLL = v11; + _vm->_graphicsManager.SCROLL_ECRAN(v11); + if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + _vm->_graphicsManager.SCANLINE(0x500u); + _vm->_graphicsManager.max_x = 1280; + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else { + _vm->_eventsManager.souris_max(); + _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); + _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.FADE_INS(); + _vm->_graphicsManager.DD_VBL(); } bool AnimationManager::REDRAW_ANIM() { diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 60eb71b940..1c4ecb296a 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -44,7 +44,7 @@ public: void setParent(HopkinsEngine *vm) { _vm = vm; } void PLAY_ANM(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3); - void PLAY_ANM2(const Common::String &filename, int a2, int a3, int a4); + void PLAY_ANM2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4); bool REDRAW_ANIM(); void CHARGE_ANIM(const Common::String &animName); void CLEAR_ANIM(); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 3c81d6af19..61392e36fe 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -247,6 +247,9 @@ enum SauvegardeOffset { , svField231 , svField261 , svField270 + , svField300 + , svField318 + , svField320 , svField333 , svField338 , svField339 @@ -423,8 +426,10 @@ public: int Compteur; int ACTION_SENS; int SegmentEnCours; + int STOP_BUG; bool NO_OFFSET; + int MAX_COMPTE; int force_to_data_0; int oldzone_46; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 787400ae52..e4a5c1100d 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2407,4 +2407,8 @@ void GraphicsManager::SHOW_PALETTE() { setpal_vga256(Palette); } +void GraphicsManager::videkey() { + // Empty in original +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index dc6ad04fba..0622e3678f 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -178,6 +178,7 @@ public: void OPTI_INI(const Common::String &file, int a2); void NB_SCREEN(); void SHOW_PALETTE(); + void videkey(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 5d01582b26..a29253571f 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -148,7 +148,7 @@ LABEL_13: _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; - PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); } if (GLOBALS.SORTIE != 3) @@ -191,7 +191,7 @@ LABEL_13: _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; GLOBALS.NOSPRECRAN = 1; - PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); } if (GLOBALS.SORTIE != 4) @@ -211,9 +211,9 @@ LABEL_13: byte v1 = *((byte *)GLOBALS.SAUVEGARDE + 80); if (v1) { if (v1 == 1) - PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); } else { - PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); } GLOBALS.NOSPRECRAN = 0; @@ -226,7 +226,7 @@ LABEL_13: _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; - PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); } if (GLOBALS.SORTIE != 6) @@ -235,15 +235,15 @@ LABEL_13: _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 460; - PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); } if (GLOBALS.SORTIE != 7) break; if (*((byte *)GLOBALS.SAUVEGARDE + 220)) - PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else - PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); } if (GLOBALS.SORTIE == 9) { @@ -254,11 +254,11 @@ LABEL_13: if (!*((byte *)GLOBALS.SAUVEGARDE + 225)) goto LABEL_109; - PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); } else { if (GLOBALS.SORTIE == 10) { GLOBALS.NOSPRECRAN = 1; - PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); goto LABEL_124; } @@ -268,7 +268,7 @@ LABEL_13: _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; - PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); goto LABEL_124; } @@ -280,7 +280,7 @@ LABEL_13: _globals.Max_Perso_Y = 450; if (*((byte *)GLOBALS.SAUVEGARDE + 225)) { GLOBALS.NOSPRECRAN = 1; - PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { LABEL_109: BOOM(); @@ -291,19 +291,19 @@ LABEL_109: _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); break; case 14: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; default: if (GLOBALS.SORTIE == 15) { GLOBALS.NOSPRECRAN = 1; - PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); goto LABEL_124; } if (GLOBALS.SORTIE == 16) { @@ -314,9 +314,9 @@ LABEL_109: byte v2 = *((byte *)GLOBALS.SAUVEGARDE + 113); if (v2 == 1) { - PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); } else if (!v2) { - PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); } } else { if (GLOBALS.SORTIE == 17) @@ -328,11 +328,11 @@ LABEL_109: _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; - PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); } else { if (GLOBALS.SORTIE == 33) { GLOBALS.NOSPRECRAN = 1; - PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); goto LABEL_124; } @@ -341,7 +341,7 @@ LABEL_109: _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; - PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); } else { if (GLOBALS.SORTIE == 27) PASS(); @@ -364,13 +364,13 @@ LABEL_109: PASS(); if (GLOBALS.SORTIE == 111) { GLOBALS.NOSPRECRAN = 1; - PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); goto LABEL_124; } if (GLOBALS.SORTIE == 112) { GLOBALS.NOSPRECRAN = 1; - PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); LABEL_124: GLOBALS.NOSPRECRAN = 0; } else if (GLOBALS.SORTIE == 113) { @@ -379,7 +379,7 @@ LABEL_124: *((byte *)GLOBALS.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 113; *((byte *)GLOBALS.SAUVEGARDE + 5) = 113; - COMPUT_HOPKINS(1); + _menuManager.COMPUT_HOPKINS(1); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); @@ -396,7 +396,7 @@ LABEL_124: *((byte *)GLOBALS.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 114; *((byte *)GLOBALS.SAUVEGARDE + 5) = 114; - COMPUT_HOPKINS(2); + _menuManager.COMPUT_HOPKINS(2); goto LABEL_128; } if (GLOBALS.SORTIE == 115) { @@ -405,7 +405,7 @@ LABEL_124: *((byte *)GLOBALS.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 115; *((byte *)GLOBALS.SAUVEGARDE + 5) = 115; - COMPUT_HOPKINS(3); + _menuManager.COMPUT_HOPKINS(3); LABEL_128: _graphicsManager.DD_Lock(); @@ -910,16 +910,6 @@ void HopkinsEngine::BOOM() { _globals.SORTIE = 151; } -void HopkinsEngine::PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, - const Common::String &s4, int v) { - warning("TODO: PERSONAGE2"); -} - -void HopkinsEngine::PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, - const Common::String &s4, int v) { - warning("TODO: PERSONAGE2"); -} - void HopkinsEngine::REST_SYSTEM() { quitGame(); _eventsManager.CONTROLE_MES(); @@ -958,8 +948,4 @@ void HopkinsEngine::PUBQUIT() { _graphicsManager.FADE_OUTW(); } -void HopkinsEngine::COMPUT_HOPKINS(int a1) { - warning("TODO: COMPUT_HOPKINS"); -} - } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 9453966ff7..0b1f97fb9c 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -83,12 +83,7 @@ private: void PASS(); void REST_SYSTEM(); - void PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, - const Common::String &s4, int v); - void PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, - const Common::String &s4, int v); void PUBQUIT(); - void COMPUT_HOPKINS(int a1); void ENDEMO(); void BOOM(); protected: diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 3fa7c55290..f692d4ee42 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -240,4 +240,201 @@ void MenuManager::SAUVE_PARTIE() { warning("SAUVE_PARTIE"); } +void MenuManager::COMPUT_HOPKINS(int idx) { + // This is a text mode display? + warning("TODO: COMPUT_HOPKINS"); + /* + int v2; + char *v3; + int v4; + char v5; + char *v6; + int v7; + char v8; + char *v9; + int v10; + char v11; + int v12; + Common::String s; + Common::String s2; + + _vm->_eventsManager.ESC_KEY = 0; + v2 = 0; + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + setvideomode(); + settextcolor(4); + _vm->_graphicsManager.videkey(); + settextposition(2, 4); + if (idx == 1) + outtext((const char *)&MenuText[10]); + if (idx == 2) + outtext((const char *)&MenuText[0xDE]); + if (idx == 3) + outtext((const char *)&MenuText[0x1B2]); + settextcolor(1); + if (idx == 3) { + settextposition(10, 8); + outtext((const char *)&MenuText[0x286]); + } + settextposition(12, 28); + outtext((const char *)&MenuText[0x35A]); + settextposition(14, 35); + v3 = &s; + memset(&s, 0, 8u); + TXT4(280, 224, 8); + s = Sup_string; + if (idx == 1) { + s2 = "HOPKINS"; + v4 = 8; + v5 = 1; + do { + if (!v4) + break; + v5 = *v3++ == *s2++; + --v4; + } while (v5); + if (v5) + v2 = 1; + } + if (idx == 2) { + v6 = &s; + s2 = "328MHZA"; + v7 = 8; + v8 = 1; + do { + if (!v7) + break; + v8 = *v6++ == *s2++; + --v7; + } while (v8); + if (v8) + v2 = 1; + } + if (idx == 3) { + v9 = &s; + s2 = "ALLFREE"; + v10 = 8; + v11 = 1; + do { + if (!v10) + break; + v11 = *v9++ == *s2++; + --v10; + } while (v11); + if (v11) + v2 = 1; + } + if (v2) { + while (1) { + ESC_KEY = 0; + _vm->_graphicsManager.videkey(); + clearscreen(); + settextcolor(4); + settextposition(2, 4); + if (idx == 1) + outtext((const char *)&MenuText[10]); + if (idx == 2) + outtext((const char *)&MenuText[0xDE]); + if (idx == 3) + outtext((const char *)&MenuText[0x1B2]); + settextcolor(15); + settextposition(8, 25); + settextcolor(15); + outtext2((const char *)&MenuText[0x502]); + settextposition(20, 25); + outtext2((const char *)&MenuText[0x5D6]); + if (idx == 1) { + settextposition(10, 25); + outtext2((const char *)&MenuText[0x6AA]); + settextposition(12, 25); + outtext2((const char *)&MenuText[0x77E]); + settextposition(14, 25); + outtext2((const char *)&MenuText[0x852]); + settextposition(16, 25); + outtext2((const char *)&MenuText[0x926]); + } + if (idx == 2) { + _vm->_graphicsManager.videkey(); + settextposition(10, 25); + outtext2((const char *)&MenuText[0x95A]); + settextposition(12, 25); + outtext2((const char *)&MenuText[0xACE]); + settextposition(14, 25); + outtext2((const char *)&MenuText[0xBA2]); + settextposition(16, 25); + outtext2((const char *)&MenuText[0xC76]); + settextposition(18, 25); + outtext2((const char *)&MenuText[0xD4A]); + } + do { + v12 = (unsigned __int8)keywin(v2, s2); + v2 = 0; + if ((uint16)(v12 - 48) <= 8u) + v2 = 1; + } while (v2 != 1); + if (v12 == 48) + break; + if (v12 == 49) { + GAMES(s2); + } else if (idx == 1) { + _vm->_graphicsManager.videkey(); + clearscreen(); + settextcolor(4); + settextposition(2, 4); + outtext((const char *)&MenuText[10]); + settextcolor(15); + if (v12 == 50) + LIT_TEXTE(1); + if (v12 == 51) + LIT_TEXTE(2); + if (v12 == 52) + LIT_TEXTE(3); + if (v12 == 53) + LIT_TEXTE(4); + } else if (idx == 2) { + clearscreen(); + settextcolor(4); + settextposition(2, 4); + outtext((const char *)&MenuText[0xDE]); + settextcolor(15); + if (v12 == 50) + LIT_TEXTE(6); + if (v12 == 51) + LIT_TEXTE(7); + if (v12 == 52) + LIT_TEXTE(8); + if (v12 == 53) + LIT_TEXTE(9); + if (v12 == 54) { + LIT_TEXTE(10); + _vm->_globals.SAUVEGARDE->data[svField270] = 4; + } + } + } + _vm->_graphicsManager.DD_Lock(); + Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + RESTORE_POLICE(); + } else { + settextcolor(4); + settextposition(16, 25); + outtext((const char *)&MenuText[0x42E]); + _vm->_eventsManager.VBL(); + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x4AFFFu); + _vm->_graphicsManager.DD_Lock(); + Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + RESTORE_POLICE(); + _vm->_eventsManager.MOUSE_OFF(); + } + if (idx == 1) + _vm->_globals.SORTIE = 13; + if ((uint16)(idx - 2) <= 1u) + _vm->_globals.SORTIE = 14; + return _vm->_graphicsManager.RESET_SEGMENT_VESA(); + */ +} + } // End of namespace Hopkins diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h index 1aca03663e..c8a1a4eec0 100644 --- a/engines/hopkins/menu.h +++ b/engines/hopkins/menu.h @@ -34,12 +34,15 @@ class HopkinsEngine; class MenuManager { private: HopkinsEngine *_vm; + + byte MenuTxt[10600]; public: void setParent(HopkinsEngine *vm); int MENU(); void CHARGE_PARTIE(); void SAUVE_PARTIE(); + void COMPUT_HOPKINS(int a1); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 2c0a8d10a6..25d4cde43a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -46,7 +46,7 @@ ObjectsManager::ObjectsManager() { inventaire2 = PTRNUL; SL_SPR = PTRNUL; SL_SPR2 = PTRNUL; - _vm->_objectsManager.PERSO_ON = false; + PERSO_ON = false; SL_FLAG = false; FLAG_VISIBLE = false; DESACTIVE_INVENT = false; @@ -331,7 +331,7 @@ void ObjectsManager::AFF_SPRITES() { ++v30; } while (v30 <= 10); - if (!_vm->_objectsManager.PERSO_ON) { + if (!PERSO_ON) { v31 = 0; do { v5 = v31; @@ -362,7 +362,7 @@ void ObjectsManager::AFF_SPRITES() { AFF_BOB_ANIM(); AFF_VBOB(); - if (!_vm->_objectsManager.PERSO_ON) { + if (!PERSO_ON) { v32 = 0; do { _vm->_globals.Liste[v32].field0 = 0; @@ -1276,7 +1276,7 @@ void ObjectsManager::AFF_BOB_ANIM() { int idx = 0; do { ++idx; - if (idx <= 20 && _vm->_objectsManager.PERSO_ON == 1) { + if (idx <= 20 && PERSO_ON == 1) { _vm->_globals.Bob[idx].field1C = 0; continue; } @@ -1305,7 +1305,7 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals.Bob[idx].field8 = READ_LE_UINT16(v20 + 2 * v24); if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; - if ( _vm->_objectsManager.PERSO_ON == 1 && idx > 20 ) + if ( PERSO_ON == 1 && idx > 20 ) _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v20 + 2 * v24 + 2); @@ -1346,7 +1346,7 @@ LABEL_38: if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; - if (_vm->_objectsManager.PERSO_ON == 1 && idx > 20) + if (PERSO_ON == 1 && idx > 20) _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v21 + 2); @@ -1370,7 +1370,7 @@ LABEL_38: } } while (idx != 35); - if (!_vm->_objectsManager.PERSO_ON && BOBTOUS == 1) { + if (!PERSO_ON && BOBTOUS == 1) { v26 = 0; do { v13 = v26; @@ -1385,7 +1385,7 @@ LABEL_38: do { ++v27; - if (v27 > 20 || _vm->_objectsManager.PERSO_ON != 1) { + if (v27 > 20 || PERSO_ON != 1) { if (_vm->_globals.Bob[v27].field0 == 10) { if (_vm->_globals.Bob[v27].field1C == 1) { v14 = _vm->_globals.Bob[v27].field1E; @@ -1800,7 +1800,7 @@ LABEL_54: _vm->_eventsManager.CHANGE_MOUSE(4); } } - _vm->_objectsManager.NUMZONE = v4; + NUMZONE = v4; _vm->_globals.old_x_69 = v0; _vm->_globals.old_y_70 = v2; _vm->_globals.old_zone_68 = v4; @@ -2104,7 +2104,7 @@ void ObjectsManager::BTGAUCHE() { if (GOACTION != 1) goto LABEL_38; VERIFZONE(); - if (_vm->_objectsManager.NUMZONE <= 0) + if (NUMZONE <= 0) return; v2 = 0; v3 = _vm->_globals.essai2; @@ -2126,10 +2126,10 @@ void ObjectsManager::BTGAUCHE() { _vm->_globals.SAUVEGARDE->data[svField2] = 0; } LABEL_38: - if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || _vm->_objectsManager.NUMZONE <= 0)) + if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || NUMZONE <= 0)) return; - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) { - v6 = _vm->_objectsManager.NUMZONE; + if ((uint16)(NUMZONE + 1) > 1u) { + v6 = NUMZONE; v7 = _vm->_globals.ZONEP[v6].field0; if (v7) { v8 = _vm->_globals.ZONEP[v6].field2; @@ -2144,7 +2144,7 @@ LABEL_38: GOACTION = 0; v9 = _vm->_globals.chemin; _vm->_globals.chemin = PTRNUL; - if (_vm->_globals.FORET && ((uint16)(_vm->_objectsManager.NUMZONE - 20) <= 1u || (uint16)(_vm->_objectsManager.NUMZONE - 22) <= 1u)) { + if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { if (YSPR(0) <= 374 || YSPR(0) > 410) { v10 = XSPR(0); v11 = YSPR(0); @@ -2196,24 +2196,24 @@ LABEL_65: _vm->_globals.chemin = PARC_VOITURE(v18, v17, v19, v0); } } - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) { + if ((uint16)(NUMZONE + 1) > 1u) { // TODO: Reformat the weird if statement generated by the decompiler if (_vm->_eventsManager.btsouris == 23 || (_vm->_globals.SAUVEGARDE->data[svField1] = _vm->_eventsManager.btsouris, _vm->_eventsManager.btsouris == 23)) _vm->_globals.SAUVEGARDE->data[svField1] = 5; if (_vm->_globals.PLAN_FLAG == 1) _vm->_globals.SAUVEGARDE->data[svField1] = 6; - _vm->_globals.SAUVEGARDE->data[svField2] = _vm->_objectsManager.NUMZONE; + _vm->_globals.SAUVEGARDE->data[svField2] = NUMZONE; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; GOACTION = 1; } _vm->_fontManager.TEXTE_OFF(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); ARRET_PERSO_FLAG = 0; - if (_vm->_eventsManager.btsouris == 21 && _vm->_globals.BOBZONE[_vm->_objectsManager.NUMZONE]) { + if (_vm->_eventsManager.btsouris == 21 && _vm->_globals.BOBZONE[NUMZONE]) { ARRET_PERSO_FLAG = 1; - ARRET_PERSO_NUM = _vm->_globals.BOBZONE[_vm->_objectsManager.NUMZONE]; + ARRET_PERSO_NUM = _vm->_globals.BOBZONE[NUMZONE]; } - if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField13] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && _vm->_objectsManager.NUMZONE == 12 + if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField13] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 && _vm->_eventsManager.btsouris == 23) { _vm->_globals.chemin = PTRNUL; XSPR(0); @@ -2235,7 +2235,7 @@ void ObjectsManager::PARADISE() { result = _vm->_globals.SAUVEGARDE->data[svField1]; if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.TEXTE_OFF(5); - if (_vm->_globals.FORET != 1 || ((uint16)(_vm->_objectsManager.NUMZONE - 20) > 1u && (uint16)(_vm->_objectsManager.NUMZONE - 22) > 1u)) { + if (_vm->_globals.FORET != 1 || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager.start_x >= XSPR(0) - 320) @@ -2299,11 +2299,11 @@ LABEL_64: _vm->_talkManager.REPONSE2(_vm->_globals.SAUVEGARDE->data[svField2], _vm->_globals.SAUVEGARDE->data[svField1]); } _vm->_eventsManager.CHANGE_MOUSE(4); - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field16) { - _vm->_objectsManager.NUMZONE = -1; + if ((uint16)(NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[NUMZONE].field16) { + NUMZONE = -1; FORCEZONE = 1; } - if (_vm->_objectsManager.NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (uint16)(_vm->_objectsManager.NUMZONE + 1) <= 1u) { + if (NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (uint16)(NUMZONE + 1) <= 1u) { _vm->_eventsManager.btsouris = 4; CHANGEVERBE = 0; } else { @@ -2317,7 +2317,7 @@ LABEL_64: } if (_vm->_eventsManager.btsouris != 23) _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); - _vm->_objectsManager.NUMZONE = 0; + NUMZONE = 0; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; } @@ -2327,8 +2327,8 @@ LABEL_64: } if (_vm->_globals.NOMARCHE == 1) { if (_vm->_eventsManager.btsouris == 4) { - result = _vm->_objectsManager.NUMZONE + 1; - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) + result = NUMZONE + 1; + if ((uint16)(NUMZONE + 1) > 1u) BTDROITE(); } } @@ -2358,7 +2358,7 @@ void ObjectsManager::CLEAR_ECRAN() { } while (v1 <= 48); _vm->_eventsManager.btsouris = 4; verbe = 4; - _vm->_objectsManager.NUMZONE = 0; + NUMZONE = 0; Vold_taille = 0; SPEED_FLAG = 0; SPEED_PTR = PTRNUL; @@ -2394,6 +2394,20 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); } +void ObjectsManager::TEST_INVENT() { + if (_vm->_globals.PLAN_FLAG) + KEY_INVENT = 0; + if (KEY_INVENT == 1) { + if (!INVENTFLAG) { + KEY_INVENT = 0; + INVENTFLAG = 1; + INVENT(); + INVENTFLAG = 0; + KEY_INVENT = 0; + } + } +} + void ObjectsManager::INVENT() { int v1; size_t filesize; @@ -3240,7 +3254,7 @@ void ObjectsManager::VERBEPLUS() { do { _vm->_eventsManager.btsouris = 4; LABEL_24: - if (_vm->_globals.NOMARCHE != 1 || (v = _vm->_objectsManager.NUMZONE + 1, (uint16)(_vm->_objectsManager.NUMZONE + 1) <= 1u)) { + if (_vm->_globals.NOMARCHE != 1 || (v = NUMZONE + 1, (uint16)(NUMZONE + 1) <= 1u)) { if (_vm->_eventsManager.btsouris == 4) return; } else { @@ -3250,146 +3264,146 @@ LABEL_28: ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 6) { LABEL_29: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field6 == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field6 == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 7) { LABEL_31: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field7 == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field7 == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 8) { LABEL_33: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field8 == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field8 == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 9) { LABEL_35: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field9 == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field9 == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 10) { LABEL_37: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldA == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldA == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 11) { LABEL_39: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldB == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldB == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 12) { LABEL_41: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldC == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldC == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 13) { LABEL_43: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldD == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldD == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 14) { LABEL_45: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldE == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldE == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 15) { LABEL_47: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldF == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldF == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 16) { LABEL_49: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field6 == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field6 == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 17) { LABEL_51: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field9 == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field9 == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 18) { LABEL_53: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldA == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldA == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 19) { LABEL_55: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldB == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldB == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 20) { LABEL_57: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldC == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldC == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 21) { LABEL_59: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldF == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldF == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 22) { LABEL_61: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldD == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldD == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 23) { LABEL_63: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field8 == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field8 == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 24) { LABEL_65: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field9 == 3) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field9 == 3) return; } v = _vm->_eventsManager.btsouris + 1; _vm->_eventsManager.btsouris = v; } while (v != 25); LABEL_67: - v = 5 * _vm->_objectsManager.NUMZONE; - } while (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldE != 2); + v = 5 * NUMZONE; + } while (_vm->_globals.ZONEP[NUMZONE].fieldE != 2); } void ObjectsManager::BTDROITE() { - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) { + if ((uint16)(NUMZONE + 1) > 1u) { VERBEPLUS(); if (_vm->_eventsManager.btsouris != 23) _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); @@ -3773,7 +3787,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); _vm->_soundManager.SPECIAL_SOUND = 198; - _vm->_objectsManager.PERSO_ON = 1; + PERSO_ON = 1; _vm->_animationManager.NO_SEQ = 1; _vm->_animationManager.CLS_ANM = 0; _vm->_animationManager.PLAY_ANM("otage.ANM", 1, 24, 500); @@ -3784,7 +3798,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_globals.NECESSAIRE = 0; FileManager::CONSTRUIT_LINUX("TEMP1.SCR"); FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); - _vm->_objectsManager.PERSO_ON = 0; + PERSO_ON = 0; memcpy(_vm->_graphicsManager.Palette, v1, 0x301u); _vm->_graphicsManager.SHOW_PALETTE(); _vm->_globals.dos_free2(v1); @@ -4694,7 +4708,7 @@ LABEL_1141: v13 = YSPR(0); v14 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); - _vm->_objectsManager.NUMZONE = -1; + NUMZONE = -1; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -5316,7 +5330,7 @@ LABEL_1141: v38 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.NUMZONE = 0; + NUMZONE = 0; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -5341,7 +5355,7 @@ LABEL_1141: v39 = YSPR(0); v40 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); - _vm->_objectsManager.NUMZONE = 0; + NUMZONE = 0; _vm->_globals.NOT_VERIF = 1; do { GOHOME(); @@ -5919,14 +5933,14 @@ LABEL_1141: if (v76 == 246) { SPRITE_OFF(0); OPTI_ONE(6, 0, 15, 0); - _vm->_objectsManager.PERSO_ON = 1; + PERSO_ON = 1; _vm->_graphicsManager.NB_SCREEN(); _vm->_animationManager.NO_SEQ = 1; _vm->_soundManager.PLAY_SEQ2("TUNNEL.SEQ", 1, 18, 20); _vm->_animationManager.NO_SEQ = 0; _vm->_graphicsManager.NOFADE = 1; _vm->_graphicsManager.FADE_OUTW(); - _vm->_objectsManager.PERSO_ON = 0; + PERSO_ON = 0; _vm->_globals.SORTIE = 100; } if (v76 == 55) { @@ -5953,7 +5967,7 @@ LABEL_1141: v56 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.NUMZONE = -1; + NUMZONE = -1; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -5974,7 +5988,7 @@ LABEL_1141: v58 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.NUMZONE = -1; + NUMZONE = -1; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -6609,13 +6623,122 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.dos_free2(ptr); } +void ObjectsManager::SPECIAL_INI(const Common::String &a1) { + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; + + if (_vm->_globals.ECRAN == 73 && !_vm->_globals.SAUVEGARDE->data[svField318]) { + _vm->_globals.CACHE_SUB(0); + _vm->_globals.CACHE_SUB(1); + } + if ((uint16)(_vm->_globals.ECRAN - 35) <= 6u) { + _vm->_globals.BOBZONE[20] = 1; + _vm->_globals.BOBZONE[21] = 2; + _vm->_globals.BOBZONE[22] = 3; + _vm->_globals.BOBZONE[23] = 4; + _vm->_globals.BOBZONE_FLAG[20] = 1; + _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); + _vm->_globals.ZONEP[20].field12 = 30; + _vm->_globals.ZONEP[21].field12 = 30; + _vm->_globals.ZONEP[22].field12 = 30; + _vm->_globals.ZONEP[23].field12 = 30; + v2 = 200; + do { + if (_vm->_globals.SAUVEGARDE->data[v2] != 2) + _vm->_globals.SAUVEGARDE->data[v2] = 0; + ++v2; + } while (v2 <= 214); + } + if (_vm->_globals.ECRAN == 93) { + if (!_vm->_globals.SAUVEGARDE->data[svField333]) + _vm->_objectsManager.BOBANIM_ON(8); + } + if (_vm->_globals.ECRAN == 18 && _vm->_globals.OLD_ECRAN == 17) { + _vm->_eventsManager.souris_n = 4; + _vm->_globals.BPP_NOAFF = 1; + v3 = 0; + do { + _vm->_eventsManager.VBL(); + ++v3; + } while (v3 <= 4); + _vm->_globals.BPP_NOAFF = 0; + _vm->_graphicsManager.FADE_INW(); + _vm->_globals.iRegul = 1; + _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("MAGE1.pe2"); + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.DESACTIVE_INVENT = 0; + } + if (_vm->_globals.ECRAN == 17 && _vm->_globals.OLD_ECRAN == 20) { + _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_globals.BPP_NOAFF = 1; + v4 = 0; + do { + _vm->_eventsManager.VBL(); + ++v4; + } while (v4 <= 4); + _vm->_globals.BPP_NOAFF = 0; + _vm->_graphicsManager.FADE_INW(); + SPRITE_ON(0); + v5 = 0; + do { + _vm->_eventsManager.VBL(); + ++v5; + } while (v5 <= 4); + VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); + _vm->_fontManager.TEXTE_OFF(9); + if (!_vm->_soundManager.TEXTOFF) { + _vm->_fontManager.DOS_TEXT(9, 383, _vm->_globals.FICH_TEXTE, 220, 72, 20, 25, 6, 36, 253); + if (!_vm->_soundManager.TEXTOFF) + _vm->_fontManager.TEXTE_ON(9); + } + if (!_vm->_soundManager.VOICEOFF) + _vm->_soundManager.VOICE_MIX(383, 4); + _vm->_globals.SAUVEGARDE->data[svField270] = 1; + _vm->_globals.SAUVEGARDE->data[svField300] = 1; + _vm->_globals.SAUVEGARDE->data[svField320] = 1; + if (_vm->_soundManager.VOICEOFF == 1) { + v6 = 0; + do { + _vm->_eventsManager.VBL(); + ++v6; + } while (v6 <= 199); + } + _vm->_fontManager.TEXTE_OFF(9); + VBOB_OFF(5); + v7 = 0; + do { + _vm->_eventsManager.VBL(); + ++v7; + } while (v7 <= 3); + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.DESACTIVE_INVENT = 0; + } +} + void ObjectsManager::OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { if (a1 != -1) - _vm->_objectsManager.BOBANIM_ON(a1); + BOBANIM_ON(a1); if (a2 != -1) - _vm->_objectsManager.BOBANIM_ON(a2); + BOBANIM_ON(a2); if (a3 != -1) - _vm->_objectsManager.BOBANIM_ON(a3); + BOBANIM_ON(a3); if (!a7) { if (a1 != -1) SET_BOBPOSI(a1, a4); @@ -6631,7 +6754,7 @@ void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { _vm->_eventsManager.souris_b = 0; if (a4 != 3) { - _vm->_objectsManager.BOBANIM_ON(a1); + BOBANIM_ON(a1); SET_BOBPOSI(a1, a2); } @@ -6641,7 +6764,7 @@ void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { break; } while (a3 != BOBPOSI(a1)); if (!a4) - _vm->_objectsManager.BOBANIM_OFF(a1); + BOBANIM_OFF(a1); } int ObjectsManager::Control_Goto(const byte *dataP) { @@ -7116,11 +7239,129 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in } void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6) { - warning("TODO: SPACTION"); + int v6; + signed __int16 v7; + char v8; + __int32 v9; + signed __int16 v10; + __int32 v11; + __int16 v13; + char v14; + __int16 v15; + Common::String v16; + + v15 = 0; + v6 = 0; + v13 = 0; + v16 = " "; + v14 = a5; + if (_vm->_globals.vitesse == 2) + v14 = a5 / 2; + if (_vm->_globals.vitesse == 3) + v14 = a5 / 3; + S_old_spr = Sprite[0].spriteData; + S_old_ani = Sprite[0].field10; + S_old_ret = Sprite[0].fieldE; + Sprite[0].field12 += a3; + Sprite[0].field14 += a4; + Sprite[0].fieldE = a6; + do { + do { + v7 = 0; + v8 = a2[v15]; + if (v8 == ',') { + v9 = atoi(v16.c_str()); + v13 = v9; + v6 = 0; + v16 = " "; + v7 = 1; + } else { + v9 = v6; + v16.setChar(v8, v6); + v6 = v6 + 1; + } + ++v15; + } while (v7 != 1); + if (v13 != -1) { + Sprite[0].spriteData = a1; + Sprite[0].field10 = v13; + } + v10 = 0; + v9 = v14; + if (v14 > 0) { + do { + v11 = v9; + _vm->_eventsManager.VBL(); + ++v10; + v9 = v11; + } while (v10 < v11); + } + } while (v13 != -1); } void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5) { - warning("TODO: SPACTION1"); + int v5; + int v6; + char v7; + int v8; + int v9; + int v10; + int v12; + int v13; + int v14; + Common::String v15; + int v16; + + v14 = 0; + v5 = 0; + v12 = 0; + v15 = " "; + v13 = a5; + if (_vm->_globals.vitesse == 2) + v13 = a5 / 2; + if (_vm->_globals.vitesse == 3) + v13 = a5 / 3; + while (1) { + v6 = 0; + v7 = a2[v14]; + if (v7 == 44) { + v8 = atoi(v15.c_str()); + v12 = v8; + v5 = 0; + v15 = " "; + v6 = 1; + } else { + v8 = v5; + v15.setChar(v7, v5); + v5 = v5 + 1; + } + ++v14; + if (v6 == 1) { + if (v12 == -1) { + Sprite[0].spriteData = S_old_spr; + Sprite[0].field10 = S_old_ani; + Sprite[0].field12 -= a3; + Sprite[0].field14 -= a4; + Sprite[0].fieldE = S_old_ret; + } else { + Sprite[0].spriteData = a1; + Sprite[0].field10 = v12; + } + + v9 = 0; + v16 = v13; + if (v13 > 0) { + do { + v10 = v8; + _vm->_eventsManager.VBL(); + ++v9; + v16 = v10; + } while (v9 < v10); + } + if (v12 == -1) + break; + } + } } void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) { @@ -7226,5 +7467,266 @@ void ObjectsManager::BLOQUE_ANIMX(int idx, int a2) { _vm->_globals.BL_ANIM[idx].v2 = a2; } +void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v) { + int v5; + int v6; + int v7; + int v8; + int v9; + + v5 = 0; + INVENTFLAG = 0; + KEY_INVENT = 0; + VIRE_INVENT = 0; + _vm->_graphicsManager.ofscroll = 0; + _vm->_globals.PLAN_FLAG = 0; + _vm->_globals.iRegul = 1; + _vm->_soundManager.WSOUND(v); + _vm->_globals.chemin = PTRNUL; + _vm->_globals.NOMARCHE = 1; + _vm->_globals.SORTIE = 0; + _vm->_globals.AFFLI = 0; + _vm->_globals.AFFIVBL = 0; + if (!s1.empty()) + _vm->_graphicsManager.LOAD_IMAGE(s1); + if (!s2.empty()) + INILINK(s2); + if (!s3.empty()) + _vm->_animationManager.CHARGE_ANIM(s3); + _vm->_graphicsManager.VISU_ALL(); + if (!s4.empty()) { + if (!_vm->_globals.NOSPRECRAN) + _vm->_graphicsManager.INI_ECRAN(s4); + if (!s4.empty() && _vm->_globals.NOSPRECRAN == 1) + _vm->_graphicsManager.INI_ECRAN2(s4); + } + _vm->_eventsManager.MOUSE_ON(); + if (_vm->_globals.ECRAN == 61) { + SPRITE(_vm->_globals.PERSO, 330, 418, 0, 60, 0, 0, 34, 190); + SPRITE_ON(0); + _vm->_globals.chemin = PTRNUL; + VERIFTAILLE(); + } + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_globals.BPP_NOAFF = 1; + v6 = 0; + do { + _vm->_eventsManager.VBL(); + ++v6; + } while (v6 <= 4); + _vm->_globals.BPP_NOAFF = 0; + _vm->_graphicsManager.FADE_INW(); + if (_vm->_globals.ECRAN == 61) { + _vm->_soundManager.PLAY_SEQ(0, "OUVRE.SEQ", 10, 4, 10); + BOBANIM_OFF(3); + _vm->_globals.NOT_VERIF = 1; + g_old_x = XSPR(0); + g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = PTRNUL; + v7 = YSPR(0); + v8 = XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v8, v7, 330, 345); + _vm->_globals.NOT_VERIF = 1; + do { + GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != PTRNUL); + SETANISPR(0, 64); + } + do { + v9 = _vm->_eventsManager.BMOUSE(); + if (v9 == 1) { + BTGAUCHE(); + v9 = 1; + } + if (v9 == 2) + BTDROITE(); + TEST_INVENT(); + VERIFZONE(); + if (GOACTION == 1) + PARADISE(); + if (!_vm->_globals.SORTIE) { + _vm->_eventsManager.VBL(); + if (!_vm->_globals.SORTIE) + continue; + } + v5 = 1; + } while (v5 != 1); + _vm->_graphicsManager.FADE_OUTW(); + if (!s3.empty()) + _vm->_graphicsManager.FIN_VISU(); + if (_vm->_globals.ECRAN == 61) + SPRITE_OFF(0); + CLEAR_ECRAN(); + _vm->_globals.iRegul = 0; +} + +void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v) { + Common::String v5; + int v6; + int v7; + int v8; + int v10; + int v11; + int v12; + int v13; + int xp, yp; + + v5 = s2; + INVENTFLAG = 0; + KEY_INVENT = 0; + _vm->_objectsManager.verbe = 4; + _vm->_globals.MAX_COMPTE = 6; + _vm->_graphicsManager.ofscroll = 0; + VIRE_INVENT = 0; + v11 = 0; + v12 = 0; + _vm->_globals.PLAN_FLAG = 0; + _vm->_graphicsManager.NOFADE = 0; + _vm->_globals.NOMARCHE = 0; + _vm->_globals.SORTIE = 0; + _vm->_globals.AFFLI = 0; + _vm->_globals.AFFIVBL = 0; + _vm->_globals.NOT_VERIF = 1; + _vm->_soundManager.WSOUND(v); + _vm->_globals.iRegul = 1; + if (!s1.empty()) + _vm->_graphicsManager.LOAD_IMAGE(s1); + if (!s2.empty()) + _vm->_objectsManager.INILINK(s2); + if (!s3.empty()) { + _vm->_animationManager.CHARGE_ANIM(s3); + _vm->_graphicsManager.VISU_ALL(); + } + if (!s4.empty()) { + if (!_vm->_globals.NOSPRECRAN) + _vm->_graphicsManager.INI_ECRAN(s4); + if (!s4.empty() && _vm->_globals.NOSPRECRAN == 1) + _vm->_graphicsManager.INI_ECRAN2(s4); + } + _vm->_eventsManager.MOUSE_ON(); + _vm->_eventsManager.btsouris = 4; + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + if (!_vm->_globals.PERSO_TYPE) + goto LABEL_70; + if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { + FileManager::CONSTRUIT_SYSTEM("PERSO.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 0; + } + if (!_vm->_globals.PERSO_TYPE) { +LABEL_70: + if (_vm->_globals.SAUVEGARDE->data[svField122] == 1) { + FileManager::CONSTRUIT_SYSTEM("HOPFEM.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 1; + } + } + if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals.SAUVEGARDE->data[svField356] == 1) { + FileManager::CONSTRUIT_SYSTEM("PSAMAN.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 2; + } + _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); + if (_vm->_globals.PERSO_TYPE == 1) + SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.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); + if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) + _vm->_graphicsManager.SCROLL = (signed __int16)XSPR(0) - 320; + _vm->_objectsManager.VERIFTAILLE(); + SPRITE_ON(0); + _vm->_globals.CACHE_ON(); + _vm->_globals.chemin = PTRNUL; + _vm->_objectsManager.VERIFTAILLE(); + SPECIAL_INI(s2); + _vm->_eventsManager.souris_n = 4; + g_old_x = _vm->_objectsManager.PERX; + g_old_y = _vm->_objectsManager.PERY; + g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.BPP_NOAFF = 1; + v6 = 0; + do { + _vm->_eventsManager.VBL(); + ++v6; + } while (v6 <= 4); + _vm->_globals.BPP_NOAFF = 0; + _vm->_globals.iRegul = 1; + if (!_vm->_graphicsManager.NOFADE) + _vm->_graphicsManager.FADE_INW(); + _vm->_graphicsManager.NOFADE = 0; + _vm->_eventsManager.CHANGE_MOUSE(4); + v13 = 0; + do { + v7 = _vm->_eventsManager.BMOUSE(); + v8 = v7; + if (v7) { + if (v7 == 1) { + if (_vm->_objectsManager.verbe == 16 && _vm->_eventsManager.btsouris == 16) { + xp = _vm->_eventsManager.XMOUSE(); + yp = _vm->_eventsManager.YMOUSE(); + v10 = yp; + if (v12 == xp) { + if (v11 == yp) { + _vm->_globals.chemin = PTRNUL; + _vm->_objectsManager.PARADISE(); + if (_vm->_globals.SORTIE) + v13 = 1; + } + } + v12 = xp; + v11 = v10; + } + _vm->_objectsManager.BTGAUCHE(); + } + if (v8 == 2) + _vm->_objectsManager.BTDROITE(); + } + if (!_vm->_globals.SORTIE) { + TEST_INVENT(); + _vm->_objectsManager.VERIFZONE(); + if (_vm->_globals.chemin == PTRNUL || (_vm->_objectsManager.GOHOME(), _vm->_globals.chemin == PTRNUL)) { + if (_vm->_objectsManager.GOACTION == 1) + _vm->_objectsManager.PARADISE(); + } + SPECIAL_JEU(); + _vm->_eventsManager.VBL(); + if (!_vm->_globals.SORTIE) + continue; + } + v13 = 1; + } while (v13 != 1); + if (_vm->_globals.SORTIE != 8 || _vm->_globals.ECRAN != 5 || _vm->_globals.HELICO != 1) { + if (!_vm->_graphicsManager.NOFADE) + _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.NOFADE = 0; + SPRITE_OFF(0); + _vm->_globals.AFFLI = 0; + if (DEUXPERSO == 1) { + SPRITE_OFF(1); + DEUXPERSO = 0; + } + if (!s3.empty()) + _vm->_graphicsManager.FIN_VISU(); + CLEAR_ECRAN(); + } else { + _vm->_globals.HELICO = 0; + } + _vm->_globals.iRegul = 0; +} } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 56e78c5bd0..944f9b3380 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -75,6 +75,7 @@ public: byte *SL_SPR; byte *SL_SPR2; byte *sprite_ptr; + const byte *S_old_spr; bool PERSO_ON; bool SL_FLAG; bool FLAG_VISIBLE; @@ -121,6 +122,8 @@ public: int OBSSEUL; int NVVERBE; int NVZONE; + int S_old_ani; + int S_old_ret; public: ObjectsManager(); void setParent(HopkinsEngine *vm); @@ -195,6 +198,7 @@ public: void PARADISE(); void CLEAR_ECRAN(); + void TEST_INVENT(); void INVENT(); void CHANGE_TETE(int a1, int a2); void VERIFTAILLE(); @@ -232,6 +236,7 @@ public: int BOBA(int idx); void INILINK(const Common::String &file); + void SPECIAL_INI(const Common::String &a1); void OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7); void SCI_OPTI_ONE(int a1, int a2, int a3, int a4); int Control_Goto(const byte *dataP); @@ -247,6 +252,10 @@ public: void SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5); void TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6); void BLOQUE_ANIMX(int idx, int a2); + void PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v); + void PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v); }; } // End of namespace Hopkins -- cgit v1.2.3