diff options
author | Paul Gilbert | 2012-09-23 10:59:52 +1000 |
---|---|---|
committer | Paul Gilbert | 2012-09-23 10:59:52 +1000 |
commit | 01bcd87ba43482ef5e773fc6abdf3cb0e918bbe5 (patch) | |
tree | 600c8bb75113502285b473e24ece4d4fd34f3a50 | |
parent | e0c9eeae160d9521b3ece41da8a4edd7e5d19cc9 (diff) | |
download | scummvm-rg350-01bcd87ba43482ef5e773fc6abdf3cb0e918bbe5.tar.gz scummvm-rg350-01bcd87ba43482ef5e773fc6abdf3cb0e918bbe5.tar.bz2 scummvm-rg350-01bcd87ba43482ef5e773fc6abdf3cb0e918bbe5.zip |
HOPKINS: Initial implementation of CHOICE_OPTION and AFF_SPRITES
-rw-r--r-- | engines/hopkins/dialogs.cpp | 271 | ||||
-rw-r--r-- | engines/hopkins/dialogs.h | 44 | ||||
-rw-r--r-- | engines/hopkins/events.cpp | 257 | ||||
-rw-r--r-- | engines/hopkins/events.h | 1 | ||||
-rw-r--r-- | engines/hopkins/font.h | 6 | ||||
-rw-r--r-- | engines/hopkins/globals.cpp | 15 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 30 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 315 | ||||
-rw-r--r-- | engines/hopkins/graphics.h | 6 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 36 | ||||
-rw-r--r-- | engines/hopkins/menu.cpp | 37 | ||||
-rw-r--r-- | engines/hopkins/menu.h | 2 | ||||
-rw-r--r-- | engines/hopkins/module.mk | 1 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 313 | ||||
-rw-r--r-- | engines/hopkins/objects.h | 33 | ||||
-rw-r--r-- | engines/hopkins/sound.cpp | 17 | ||||
-rw-r--r-- | engines/hopkins/sound.h | 14 |
17 files changed, 1099 insertions, 299 deletions
diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp new file mode 100644 index 0000000000..fdcdc48931 --- /dev/null +++ b/engines/hopkins/dialogs.cpp @@ -0,0 +1,271 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is _globals.FRee software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the _globals.FRee Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the _globals.FRee Software + * Foundation, Inc., 51 _globals.FRanklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/scummsys.h" +#include "common/events.h" +#include "common/util.h" +#include "hopkins/dialogs.h" +#include "hopkins/events.h" +#include "hopkins/files.h" +#include "hopkins/globals.h" +#include "hopkins/graphics.h" +#include "hopkins/hopkins.h" +#include "hopkins/sound.h" + +namespace Hopkins { + +void OptionsDialog::show(HopkinsEngine *vm) { + bool doneFlag; + + doneFlag = false; + vm->_eventsManager.CHANGE_MOUSE(0); + vm->_eventsManager.VBL(); + if (vm->_globals.FR == 1) + FileManager::CONSTRUIT_SYSTEM("OPTIFR.SPR"); + if (!vm->_globals.FR) + FileManager::CONSTRUIT_SYSTEM("OPTIAN.SPR"); + if (vm->_globals.FR == 2) + FileManager::CONSTRUIT_SYSTEM("OPTIES.SPR"); + + vm->_globals.OPTION_SPR = 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->_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"); + else + 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"); + else + vm->_soundManager.MUSICVOL = 0; + + 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"); + else + 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"); + else + 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.VOICEVOL <= 16) + vm->_soundManager.PLAY_SOUND("bruit2.wav"); + else + 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"); + else + 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); + } else { + 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 + 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) + doneFlag = 1; + 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; + break; + case 2: + vm->_graphicsManager.SPEED_SCROLL = 4; + break; + case 4: + vm->_graphicsManager.SPEED_SCROLL = 8; + break; + case 8: + vm->_graphicsManager.SPEED_SCROLL = 16; + break; + case 16: + vm->_graphicsManager.SPEED_SCROLL = 32; + break; + case 32: + vm->_graphicsManager.SPEED_SCROLL = 48; + break; + case 48: + vm->_graphicsManager.SPEED_SCROLL = 64; + break; + case 64: + vm->_graphicsManager.SPEED_SCROLL = 128; + break; + case 128: + vm->_graphicsManager.SPEED_SCROLL = 160; + break; + case 160: + vm->_graphicsManager.SPEED_SCROLL = 320; + break; + case 320: + 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 || (unsigned __int16)(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; + if (!vm->_soundManager.TEXTOFF) + vm->_globals.opt_txt = 7; + if (vm->_soundManager.TEXTOFF == 1) + vm->_globals.opt_txt = 8; + if (!vm->_soundManager.VOICEOFF) + vm->_globals.opt_voice = 7; + if (vm->_soundManager.VOICEOFF == 1) + vm->_globals.opt_voice = 8; + if (!vm->_soundManager.SOUNDOFF) + vm->_globals.opt_sound = 7; + if (vm->_soundManager.SOUNDOFF == 1) + vm->_globals.opt_sound = 8; + if (!vm->_soundManager.MUSICOFF) + vm->_globals.opt_music = 7; + if (vm->_soundManager.MUSICOFF == 1) + vm->_globals.opt_music = 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(); + } 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->_globals.OPTION_SPR = vm->_globals.dos_free2(vm->_globals.OPTION_SPR); + vm->_globals.OPTION_FLAG = false; +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h new file mode 100644 index 0000000000..caaa9f5575 --- /dev/null +++ b/engines/hopkins/dialogs.h @@ -0,0 +1,44 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef HOPKINS_DIALOGS_H +#define HOPKINS_DIALOGS_H + +#include "common/scummsys.h" +#include "common/system.h" +#include "common/error.h" + +namespace Hopkins { + +class HopkinsEngine; + +/** + * Class for showing the options dialog + */ +class OptionsDialog { +public: + static void show(HopkinsEngine *vm); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_MENU_H */ diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index f934dcae6f..fc7c12238a 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -216,11 +216,11 @@ void EventsManager::pollEvents() { case Common::EVENT_LBUTTONDOWN: case Common::EVENT_RBUTTONDOWN: - souris_bb = true; + souris_b = true; break; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: - souris_bb = false; + souris_b = false; return; default: @@ -229,4 +229,257 @@ void EventsManager::pollEvents() { } } +void EventsManager::VBL() { + // Bulk of method currently disabled + + // Move any button press status into the active button status state + souris_bb = souris_b; + souris_b = false; + + if (!_vm->_globals.PUBEXIT) + _vm->_objectsManager.AFF_SPRITES(); +/* + int a1 = 0; + signed __int16 v1; + int v2; + int v3; + int v4; + int v5; + int v6; + signed __int16 v7; + int v10; + signed int v11 = 0; + signed int v12 = 0; + int v13 = 0; + unsigned int v14 = 0; + int v15 = 0; + + if (REDRAW) { + DD_Lock(); + if (_vm->_eventsManager.CASSE) { + CopyAsm(VESA_BUFFER); + REDRAW = 0; + } else { + if (_vm->_globals.iRegul == 3) + m_scroll(VESA_BUFFER, ofscroll, 50, SCREEN_WIDTH, 340, 0, 50); + else + m_scroll(VESA_BUFFER, ofscroll, 20, SCREEN_WIDTH, 440, 0, 20); + FileManager::DMESS(); + --REDRAW; + } + DD_Unlock(); + } + + if (_vm->_eventsManager.souris_flag) { + v1 = 20; + if (!_vm->_eventsManager.mouse_linux) + v1 = 10; + v2 = 20; + if (!_vm->_eventsManager.mouse_linux) + v2 = 15; + + v15 = _vm->_eventsManager.souris_x - v1; + a1 = _vm->_eventsManager.souris_y; + v14 = _vm->_eventsManager.souris_sizex; + v13 = _vm->_eventsManager.souris_sizey; + if (_vm->_eventsManager.btsouris == 23) { + v14 = _vm->_globals.OBJL; + v13 = _vm->_globals.OBJH; + goto LABEL_35; + } + + if (_vm->_eventsManager.CASSE) { + if (v15 < min_x) + v15 = min_x; + if (_vm->_eventsManager.souris_y < min_y) + a1 = min_y; + + if (_vm->_eventsManager.souris_sizex + v15 >= max_x) + v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x); + if (a1 + _vm->_eventsManager.souris_sizey < max_y) + goto LABEL_34; + + v3 = a1 + _vm->_eventsManager.souris_sizey - max_y; + } else { + if (v15 < min_x) + v15 = min_x - v1; + v2 = (signed __int16)v2; + if (_vm->_eventsManager.souris_y < min_y - (signed __int16)v2) + a1 = min_y - (signed __int16)v2; + if (_vm->_eventsManager.souris_sizex + v15 >= max_x) + v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x - v1); + if (a1 + _vm->_eventsManager.souris_sizey < v2 + max_y) + goto LABEL_34; + + v3 = v2 + a1 + _vm->_eventsManager.souris_sizey - max_y; + } + + v13 = _vm->_eventsManager.souris_sizey - v3; +LABEL_34: + v12 = v14 + v15; + v11 = a1 + v13; + } +LABEL_35: + + if (!_vm->_globals.PUBEXIT) + AFF_SPRITES(); + if (_vm->_eventsManager.souris_flag != 1) + goto LABEL_54; + if (_vm->_eventsManager.btsouris == 23) + goto LABEL_45; + + if (a1 >= max_y || v15 >= max_x || (signed int)v14 <= 1 || v13 <= 1) { + if (_vm->_eventsManager.btsouris != 23) + goto LABEL_54; + +LABEL_45: + if (a1 < max_y && v15 < max_x) { + if ((signed int)(v14 + v15) > max_x) + v14 -= v14 + v15 - max_x; + if (a1 + v13 > max_y) + v13 -= a1 + v13 - max_y; + + if ((signed int)v14 > 1 && v13 > 1) { + Capture_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + Affiche_Perfect(VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, a1 + 300, 0, 0, 0, 0); + Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); + } + } + goto LABEL_54; + } + + Capture_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + Sprite_Vesa(VESA_BUFFER, _vm->_eventsManager.pointeur_souris, v15 + 300, a1 + 300, _vm->_eventsManager.souris_n); + Ajoute_Segment_Vesa(v15, a1, v12, v11); + +LABEL_54: + _vm->_globals.vitesse = 2; + + do { + for (;;) { + // TODO: Figure out the purpose of this loop waiting on lItCounter.. + // maybe it's for cursor animatoin? + _vm->_eventsManager.delay(10); + + while (_vm->_eventsManager.CASSE || _vm->_globals.iRegul != 1) { + if (_vm->_eventsManager.CASSE != 1) + goto LABEL_63; + + if (_vm->_eventsManager.lItCounter > 1) + goto LABEL_65; + } + + if (_vm->_globals.vitesse != 2) + break; + + if (_vm->_eventsManager.lItCounter > 9) + goto LABEL_65; + } +LABEL_63: + ; + } while (_vm->_globals.iRegul == 3 && _vm->_eventsManager.lItCounter <= 15); + +LABEL_65: + _vm->_globals.vitesse = 2; + _vm->_eventsManager.lItCounter = 0; + + if (DOUBLE_ECRAN != 1 || no_scroll == 1) { + Affiche_Segment_Vesa(); + } else { + if (no_scroll != 2) { + if (_vm->_eventsManager.XMOUSE() > SCROLL + 620) + SCROLL += SPEED_SCROLL; + + if (_vm->_eventsManager.XMOUSE() < SCROLL + 10) + SCROLL -= SPEED_SCROLL; + } + + SCROLL = CLIP(SCROLL, 0, SCREEN_WIDTH); + + if (SDL_ECHELLE) + v4 = Magic_Number(SCROLL); + else + v4 = SCROLL; + + if (OLD_SCROLL == v4) { + Affiche_Segment_Vesa(); + } else { + _vm->_fontManager.TEXTE_OFF(9); + DD_Lock(); + if (SDL_ECHELLE) { + if (Winbpp == 2) { + v5 = Reel_Zoom(20, SDL_ECHELLE); + m_scroll16A(VESA_BUFFER, v4, 20, 640, 440, 0, v5); + } else { + v6 = Reel_Zoom(20, SDL_ECHELLE); + m_scroll2A(VESA_BUFFER, v4, 20, 640, 440, 0, v6); + } + + DD_Unlock(); + dstrect[0].left = Reel_Zoom(0, SDL_ECHELLE); + dstrect[0].top = Reel_Zoom(20, SDL_ECHELLE); + dstrect[0].setWidth(Reel_Zoom(SCREEN_WIDTH, SDL_ECHELLE)); + dstrect[0].setHeight(Reel_Zoom(440, SDL_ECHELLE)); + } else { + if (Winbpp == 2) + m_scroll16(VESA_BUFFER, v4, 20, 640, 440, 0, 20); + else + m_scroll2(VESA_BUFFER, v4, 20, 640, 440, 0, 20); + + DD_Unlock(); + dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40); + } + + if (!_vm->_globals.BPP_NOAFF) { + // TODO: Useful for future dirty rect processing? +// SDL_UpdateRects(LinuxScr, 1, dstrect); + } + if (_vm->_globals.NBBLOC) { + v7 = 1; + v10 = _vm->_globals.NBBLOC + 1; + + do { + if (_vm->_globals.BLOC[v7].field0 == 1) + _vm->_globals.BLOC[v7].field0 = 0; + ++v7; + } while (v10 != v7); + } + + _vm->_globals.NBBLOC = 0; + start_x = v4; + ofscroll = v4; + SCROLL = v4; + } + + OLD_SCROLL = v4; + start_x = v4; + ofscroll = v4; + } + + _vm->_eventsManager.souris_bb = _vm->_eventsManager.souris_b; + _vm->_eventsManager.souris_b = 0; + if (_vm->_eventsManager.souris_flag == 1) { + if (_vm->_eventsManager.btsouris != 23) { + if (a1 < max_y && v15 < max_x && v14 > 1 && v13 > 1) { + Restore_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + Ajoute_Segment_Vesa(v15, a1, v12, v11); + goto LABEL_113; + } + + if (_vm->_eventsManager.btsouris != 23) + goto LABEL_113; + } + + if (a1 < max_y && v15 < max_x && v14 > 1 && v13 > 1) { + Restore_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); + } + } + +LABEL_113: + */ + _vm->_soundManager.VERIF_SOUND(); + return _vm->_eventsManager.CONTROLE_MES(); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index b5c0ade35f..a288228fb7 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -73,6 +73,7 @@ public: void CONTROLE_MES(); void delay(int delay); + void VBL(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 8402de0ba0..fb53401f13 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -51,6 +51,10 @@ struct TxtItem { struct ListeTxtItem { int field0; + int x1; + int y1; + int x2; + int y2; }; @@ -59,7 +63,7 @@ private: HopkinsEngine *_vm; public: TxtItem Txt[12]; - ListeTxtItem ListeTxt[11]; + ListeTxtItem ListeTxt[12]; public: void setParent(HopkinsEngine *vm); void clearAll(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index fd4fa48a66..cd8915cbc9 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -73,6 +73,16 @@ Globals::Globals() { Max_Perso_Y = 0; Max_Propre = 0; NBBLOC = 0; + opt_scrtype = 0; + opt_scrspeed = 0; + opt_vitesse = 0; + opt_sound = 0; + opt_voice = 0; + opt_music = 0; + opt_txt = 0; + opt_anm = 0; + NBTRI = 0; + AFFINVEN = 0; // Initialise pointers ICONE = NULL; @@ -99,8 +109,7 @@ Globals::Globals() { ADR_FICHIER_OBJ = NULL; police = NULL; PERSO = NULL; - - + OPTION_SPR = NULL; // Reset flags MUSICOFF = false; @@ -122,6 +131,8 @@ Globals::Globals() { netscape = false; NOMARCHE = false; NO_VISU = false; + OPTION_FLAG = false; + CACHEFLAG = false; } Globals::~Globals() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index f018b187a2..420df345d8 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -68,6 +68,14 @@ struct BankItem { Common::String filename2; }; +struct ListeItem { + int field0; + int field2; + int field4; + int x2; + int y2; +}; + struct BobItem { int field0; byte *field4; @@ -141,6 +149,13 @@ struct BlocItem { int y2; }; +struct TriItem { + int field0; + int field2; + int field4; + int field6; +}; + class HopkinsEngine; /** @@ -207,6 +222,7 @@ public: VBobItem VBob[35]; ObjetWItem ObjetW[300]; BlocItem BLOC[250]; + ListeItem Liste[7]; byte *Winventaire; byte *texte_tmp; int texte_long; @@ -219,6 +235,7 @@ public: byte *essai2; byte *Bufferobjet; int INVENTAIRE[36]; + TriItem Tri[51]; byte *inventaire2; byte *GESTE; int OBJET_EN_COURS; @@ -261,6 +278,19 @@ public: bool NOMARCHE; int NBBLOC; bool NO_VISU; + byte *OPTION_SPR; + bool OPTION_FLAG; + int opt_anm; + int opt_vitesse; + int opt_scrtype; + int opt_scrspeed; + int opt_sound; + int opt_voice; + int opt_music; + int opt_txt; + int NBTRI; + bool CACHEFLAG; + int AFFINVEN; Globals(); ~Globals(); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b7eb48937c..048d07241f 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1385,8 +1385,8 @@ void GraphicsManager::FIN_VISU() { _vm->_objectsManager.BOB_OFF(idx); } - VBL(); - VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); for (int idx = 1; idx <= 20; ++idx) { if (_vm->_globals.Bqe_Anim[idx].field4 == 1) @@ -1653,10 +1653,6 @@ int GraphicsManager::Asm_Reduc(int v, int percentage) { return v; } -void GraphicsManager::AFF_SPRITES() { - warning("TODO: AFF_SPRITES"); -} - void GraphicsManager::Affiche_Perfect(byte *destSurface, const byte *srcData, int a3, int a4, int a5, int a6, int a7, int a8) { const byte *v8; int i; @@ -2129,252 +2125,6 @@ Aff_Zoom_Larg_Cont1: } } -void GraphicsManager::VBL() { - // Bulk of method currently disabled -/* - int a1 = 0; - signed __int16 v1; - int v2; - int v3; - int v4; - int v5; - int v6; - signed __int16 v7; - int v10; - signed int v11 = 0; - signed int v12 = 0; - int v13 = 0; - unsigned int v14 = 0; - int v15 = 0; - - if (REDRAW) { - DD_Lock(); - if (_vm->_eventsManager.CASSE) { - CopyAsm(VESA_BUFFER); - REDRAW = 0; - } else { - if (_vm->_globals.iRegul == 3) - m_scroll(VESA_BUFFER, ofscroll, 50, SCREEN_WIDTH, 340, 0, 50); - else - m_scroll(VESA_BUFFER, ofscroll, 20, SCREEN_WIDTH, 440, 0, 20); - FileManager::DMESS(); - --REDRAW; - } - DD_Unlock(); - } - - if (_vm->_eventsManager.souris_flag) { - v1 = 20; - if (!_vm->_eventsManager.mouse_linux) - v1 = 10; - v2 = 20; - if (!_vm->_eventsManager.mouse_linux) - v2 = 15; - - v15 = _vm->_eventsManager.souris_x - v1; - a1 = _vm->_eventsManager.souris_y; - v14 = _vm->_eventsManager.souris_sizex; - v13 = _vm->_eventsManager.souris_sizey; - if (_vm->_eventsManager.btsouris == 23) { - v14 = _vm->_globals.OBJL; - v13 = _vm->_globals.OBJH; - goto LABEL_35; - } - - if (_vm->_eventsManager.CASSE) { - if (v15 < min_x) - v15 = min_x; - if (_vm->_eventsManager.souris_y < min_y) - a1 = min_y; - - if (_vm->_eventsManager.souris_sizex + v15 >= max_x) - v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x); - if (a1 + _vm->_eventsManager.souris_sizey < max_y) - goto LABEL_34; - - v3 = a1 + _vm->_eventsManager.souris_sizey - max_y; - } else { - if (v15 < min_x) - v15 = min_x - v1; - v2 = (signed __int16)v2; - if (_vm->_eventsManager.souris_y < min_y - (signed __int16)v2) - a1 = min_y - (signed __int16)v2; - if (_vm->_eventsManager.souris_sizex + v15 >= max_x) - v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x - v1); - if (a1 + _vm->_eventsManager.souris_sizey < v2 + max_y) - goto LABEL_34; - - v3 = v2 + a1 + _vm->_eventsManager.souris_sizey - max_y; - } - - v13 = _vm->_eventsManager.souris_sizey - v3; -LABEL_34: - v12 = v14 + v15; - v11 = a1 + v13; - } -LABEL_35: - - if (!_vm->_globals.PUBEXIT) - AFF_SPRITES(); - if (_vm->_eventsManager.souris_flag != 1) - goto LABEL_54; - if (_vm->_eventsManager.btsouris == 23) - goto LABEL_45; - - if (a1 >= max_y || v15 >= max_x || (signed int)v14 <= 1 || v13 <= 1) { - if (_vm->_eventsManager.btsouris != 23) - goto LABEL_54; - -LABEL_45: - if (a1 < max_y && v15 < max_x) { - if ((signed int)(v14 + v15) > max_x) - v14 -= v14 + v15 - max_x; - if (a1 + v13 > max_y) - v13 -= a1 + v13 - max_y; - - if ((signed int)v14 > 1 && v13 > 1) { - Capture_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - Affiche_Perfect(VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, a1 + 300, 0, 0, 0, 0); - Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); - } - } - goto LABEL_54; - } - - Capture_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - Sprite_Vesa(VESA_BUFFER, _vm->_eventsManager.pointeur_souris, v15 + 300, a1 + 300, _vm->_eventsManager.souris_n); - Ajoute_Segment_Vesa(v15, a1, v12, v11); - -LABEL_54: - _vm->_globals.vitesse = 2; - - do { - for (;;) { - // TODO: Figure out the purpose of this loop waiting on lItCounter.. - // maybe it's for cursor animatoin? - _vm->_eventsManager.delay(10); - - while (_vm->_eventsManager.CASSE || _vm->_globals.iRegul != 1) { - if (_vm->_eventsManager.CASSE != 1) - goto LABEL_63; - - if (_vm->_eventsManager.lItCounter > 1) - goto LABEL_65; - } - - if (_vm->_globals.vitesse != 2) - break; - - if (_vm->_eventsManager.lItCounter > 9) - goto LABEL_65; - } -LABEL_63: - ; - } while (_vm->_globals.iRegul == 3 && _vm->_eventsManager.lItCounter <= 15); - -LABEL_65: - _vm->_globals.vitesse = 2; - _vm->_eventsManager.lItCounter = 0; - - if (DOUBLE_ECRAN != 1 || no_scroll == 1) { - Affiche_Segment_Vesa(); - } else { - if (no_scroll != 2) { - if (_vm->_eventsManager.XMOUSE() > SCROLL + 620) - SCROLL += SPEED_SCROLL; - - if (_vm->_eventsManager.XMOUSE() < SCROLL + 10) - SCROLL -= SPEED_SCROLL; - } - - SCROLL = CLIP(SCROLL, 0, SCREEN_WIDTH); - - if (SDL_ECHELLE) - v4 = Magic_Number(SCROLL); - else - v4 = SCROLL; - - if (OLD_SCROLL == v4) { - Affiche_Segment_Vesa(); - } else { - _vm->_fontManager.TEXTE_OFF(9); - DD_Lock(); - if (SDL_ECHELLE) { - if (Winbpp == 2) { - v5 = Reel_Zoom(20, SDL_ECHELLE); - m_scroll16A(VESA_BUFFER, v4, 20, 640, 440, 0, v5); - } else { - v6 = Reel_Zoom(20, SDL_ECHELLE); - m_scroll2A(VESA_BUFFER, v4, 20, 640, 440, 0, v6); - } - - DD_Unlock(); - dstrect[0].left = Reel_Zoom(0, SDL_ECHELLE); - dstrect[0].top = Reel_Zoom(20, SDL_ECHELLE); - dstrect[0].setWidth(Reel_Zoom(SCREEN_WIDTH, SDL_ECHELLE)); - dstrect[0].setHeight(Reel_Zoom(440, SDL_ECHELLE)); - } else { - if (Winbpp == 2) - m_scroll16(VESA_BUFFER, v4, 20, 640, 440, 0, 20); - else - m_scroll2(VESA_BUFFER, v4, 20, 640, 440, 0, 20); - - DD_Unlock(); - dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40); - } - - if (!_vm->_globals.BPP_NOAFF) { - // TODO: Useful for future dirty rect processing? -// SDL_UpdateRects(LinuxScr, 1, dstrect); - } - if (_vm->_globals.NBBLOC) { - v7 = 1; - v10 = _vm->_globals.NBBLOC + 1; - - do { - if (_vm->_globals.BLOC[v7].field0 == 1) - _vm->_globals.BLOC[v7].field0 = 0; - ++v7; - } while (v10 != v7); - } - - _vm->_globals.NBBLOC = 0; - start_x = v4; - ofscroll = v4; - SCROLL = v4; - } - - OLD_SCROLL = v4; - start_x = v4; - ofscroll = v4; - } - - _vm->_eventsManager.souris_bb = _vm->_eventsManager.souris_b; - _vm->_eventsManager.souris_b = 0; - if (_vm->_eventsManager.souris_flag == 1) { - if (_vm->_eventsManager.btsouris != 23) { - if (a1 < max_y && v15 < max_x && v14 > 1 && v13 > 1) { - Restore_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - Ajoute_Segment_Vesa(v15, a1, v12, v11); - goto LABEL_113; - } - - if (_vm->_eventsManager.btsouris != 23) - goto LABEL_113; - } - - if (a1 < max_y && v15 < max_x && v14 > 1 && v13 > 1) { - Restore_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); - } - } - -LABEL_113: - */ - _vm->_soundManager.VERIF_SOUND(); - return _vm->_eventsManager.CONTROLE_MES(); -} - void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex) { int width, height; @@ -2391,4 +2141,65 @@ void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height); } +void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int x2, int y2, byte *destSurface, int destX, int destY) { + int top; + int width; + int height; + int v11; + int height2; + int top2; + int left; + + left = x1; + top = y1; + width = x2; + height = y2; + + if (x1 < min_x) { + width = x2 - (min_x - x1); + left = min_x; + } + if (y1 < min_y) { + height = y2 - (min_y - y1); + top = min_y; + } + top2 = top; + if (top + height > max_y) + height = max_y - top; + v11 = left + width; + if (v11 > max_x) + width = max_x - left; + + if (width > 0 && height > 0) { + height2 = height; + Copy_Mem(surface, left, top2, width, height, destSurface, destX, destY); + Ajoute_Segment_Vesa(left, top2, left + width, top2 + height2); + } +} + +void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY) { + const byte *srcP; + byte *destP; + int yp; + int yCurrent; + byte *dest2P; + const byte *src2P; + unsigned int pitch; + + srcP = x1 + nbrligne2 * y1 + srcSurface; + destP = destX + nbrligne2 * destY + destSurface; + yp = height; + do { + yCurrent = yp; + memcpy(destP, srcP, 4 * (width >> 2)); + src2P = (srcP + 4 * (width >> 2)); + dest2P = (destP + 4 * (width >> 2)); + pitch = width - 4 * (width >> 2); + memcpy(dest2P, src2P, pitch); + destP = (dest2P + pitch + nbrligne2 - width); + srcP = (src2P + pitch + nbrligne2 - width); + yp = yCurrent - 1; + } while (yCurrent != 1); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 0fc5222408..3a3b4c5e9e 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -156,17 +156,17 @@ public: void FIN_VISU(); void VISU_ALL(); void RESET_SEGMENT_VESA(); - void Ajoute_Segment_Vesa(int a1, int a2, int a3, int a4); + void Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2); int Magic_Number(int v); void Affiche_Segment_Vesa(); void CopyAsm(const byte *surface); void Restore_Mem(byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6); int Reel_Zoom(int v, int percentage); int Reel_Reduc(int v, int percentage); - void AFF_SPRITES(); void Affiche_Perfect(byte *destSurface, const byte *srcData, int a3, int a4, int a5, int a6, int a7, int a8); - void VBL(); void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex); + void SCOPY(const byte *surface, int x1, int y1, int x2, int y2, byte *destSurface, int destX, int destY); + void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 41ca377d5e..61fb368794 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -590,10 +590,10 @@ void HopkinsEngine::INTRORUN() { byte paletteData2[PALETTE_EXT_BLOCK_SIZE]; memset(&paletteData, 0, PALETTE_EXT_BLOCK_SIZE); - _graphicsManager.VBL(); + _eventsManager.VBL(); _eventsManager.souris_flag = 0; _globals.iRegul = 1; - _graphicsManager.VBL(); + _eventsManager.VBL(); _soundManager.WSOUND(16); _animationManager.CLS_ANM = 1; _animationManager.PLAY_ANM("J1.anm", 12, 12, 50); @@ -623,7 +623,7 @@ void HopkinsEngine::INTRORUN() { _globals.BPP_NOAFF = 1; v2 = 0; do { - _graphicsManager.VBL(); + _eventsManager.VBL(); ++v2; } while (v2 <= 4); @@ -646,10 +646,10 @@ void HopkinsEngine::INTRORUN() { v4 = _eventsManager.YMOUSE(); _eventsManager.souris_xy(_eventsManager.souris_x + 4, v4); } - _graphicsManager.VBL(); + _eventsManager.VBL(); } while (v3 != 1 && _graphicsManager.SCROLL != SCREEN_WIDTH); - _graphicsManager.VBL(); + _eventsManager.VBL(); _graphicsManager.no_scroll = 0; } @@ -672,7 +672,7 @@ void HopkinsEngine::INTRORUN() { v5 = 0; do { - _graphicsManager.VBL(); + _eventsManager.VBL(); ++v5; } while (v5 <= 4); @@ -680,12 +680,12 @@ void HopkinsEngine::INTRORUN() { _globals.iRegul = 1; _graphicsManager.FADE_INW(); for (i = 0; i < 200 / _globals.vitesse; ++i) - _graphicsManager.VBL(); + _eventsManager.VBL(); _animationManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(5, 3); _animationManager.BOBANIM_OFF(3); - _graphicsManager.VBL(); + _eventsManager.VBL(); memcpy(&paletteData2, _graphicsManager.Palette, 796); v21 = *(uint16 *)&_graphicsManager.Palette[796]; v22 = _graphicsManager.Palette[798]; @@ -715,7 +715,7 @@ void HopkinsEngine::INTRORUN() { v8 = 0; do { - _graphicsManager.VBL(); + _eventsManager.VBL(); ++v8; } while (v8 <= 3); @@ -727,9 +727,9 @@ void HopkinsEngine::INTRORUN() { while (!_eventsManager.ESC_KEY) { if (v9 == 12) { _animationManager.BOBANIM_ON(3); - _graphicsManager.VBL(); + _eventsManager.VBL(); _soundManager.VOICE_MIX(6, 3); - _graphicsManager.VBL(); + _eventsManager.VBL(); _animationManager.BOBANIM_OFF(3); } @@ -750,7 +750,7 @@ void HopkinsEngine::INTRORUN() { v7 = 2 * v9; do { - _graphicsManager.VBL(); + _eventsManager.VBL(); ++v13; } while (v13 < v7); } @@ -761,7 +761,7 @@ void HopkinsEngine::INTRORUN() { v7 = 20 - v9; do { - _graphicsManager.VBL(); + _eventsManager.VBL(); ++v14; } while (v14 < v7); } @@ -770,17 +770,17 @@ void HopkinsEngine::INTRORUN() { if (v9 > 15) { _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); for (j = 1; j < 100 / _globals.vitesse; ++j) - _graphicsManager.VBL(); + _eventsManager.VBL(); _animationManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(7, 3); _animationManager.BOBANIM_OFF(3); for (k = 1; k < 60 / _globals.vitesse; ++k) - _graphicsManager.VBL(); + _eventsManager.VBL(); _animationManager.BOBANIM_ON(5); for (l = 0; l < 20 / _globals.vitesse; ++l) - _graphicsManager.VBL(); + _eventsManager.VBL(); Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager.VESA_BUFFER); @@ -792,7 +792,7 @@ void HopkinsEngine::INTRORUN() { _animationManager.BOBANIM_OFF(3); } - _graphicsManager.VBL(); + _eventsManager.VBL(); } _graphicsManager.FADE_OUTW(); @@ -870,7 +870,7 @@ void HopkinsEngine::PUBQUIT() { do { xp = _eventsManager.XMOUSE(); yp = _eventsManager.YMOUSE(); - _graphicsManager.VBL(); + _eventsManager.VBL(); if (_eventsManager.BMOUSE() == 1) mouseClicked = true; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index b1b230c82f..2fb40d6046 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -24,6 +24,7 @@ #include "common/events.h" #include "common/util.h" #include "hopkins/menu.h" +#include "hopkins/dialogs.h" #include "hopkins/files.h" #include "hopkins/hopkins.h" #include "hopkins/globals.h" @@ -104,17 +105,17 @@ int MenuManager::MENU() { menuIndex = MENU_NONE; mousePos = Common::Point(_vm->_eventsManager.XMOUSE(), _vm->_eventsManager.YMOUSE()); - if (ABS(mousePos.x - 232) <= 176) { - if (ABS(mousePos.y - 261) <= 23) + if ((uint16)(mousePos.x - 232) <= 176) { + if ((uint16)(mousePos.y - 261) <= 23) menuIndex = PLAY_GAME; - if (ABS(mousePos.y - 293) <= 23) + if ((uint16)(mousePos.y - 293) <= 23) menuIndex = LOAD_GAME; - if (ABS(mousePos.y - 325) <= 22) + if ((uint16)(mousePos.y - 325) <= 22) menuIndex = OPTIONS; - if (ABS(mousePos.y - 356) <= 23) + if ((uint16)(mousePos.y - 356) <= 23) menuIndex = INTRODUCTION; - if (ABS(mousePos.y - 388) <= 23) + if ((uint16)(mousePos.y - 388) <= 23) menuIndex = QUIT; } @@ -167,7 +168,7 @@ int MenuManager::MENU() { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, v9 + 4); _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, v8 + 6); _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, v7 + 8); - _vm->_graphicsManager.VBL(); + _vm->_eventsManager.VBL(); if (_vm->_eventsManager.BMOUSE() == 1 && menuIndex != MENU_NONE) selectionMade = 1; @@ -175,7 +176,7 @@ int MenuManager::MENU() { if (menuIndex == PLAY_GAME) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, 10); - _vm->_graphicsManager.VBL(); + _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); v6 = 1; } @@ -183,7 +184,7 @@ int MenuManager::MENU() { break; _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, 11); - _vm->_graphicsManager.VBL(); + _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); _vm->_globals.SORTIE = -1; @@ -196,18 +197,20 @@ int MenuManager::MENU() { _vm->_globals.SORTIE = 0; } - if (menuIndex != 3) + if (menuIndex != OPTIONS) break; + // Options menu item selected _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, 12); - _vm->_graphicsManager.VBL(); + _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); - - CHOICE_OPTION(); + + // Show the options dialog + OptionsDialog::show(_vm); } if (menuIndex == INTRODUCTION) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, 13); - _vm->_graphicsManager.VBL(); + _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); _vm->INTRORUN(); continue; @@ -215,7 +218,7 @@ int MenuManager::MENU() { if ( menuIndex == QUIT) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, 14); - _vm->_graphicsManager.VBL(); + _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); v6 = -1; } @@ -229,10 +232,6 @@ int MenuManager::MENU() { return v6; } -void MenuManager::CHOICE_OPTION() { - warning("CHOICE_OPTION"); -} - void MenuManager::CHARGE_PARTIE() { warning("CHARGE_PARTIE"); } diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h index 8d3d8d696a..11f232746a 100644 --- a/engines/hopkins/menu.h +++ b/engines/hopkins/menu.h @@ -34,8 +34,6 @@ class HopkinsEngine; class MenuManager { private: HopkinsEngine *_vm; - - void CHOICE_OPTION(); public: void setParent(HopkinsEngine *vm); diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index b924037680..fe84d67ccf 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -3,6 +3,7 @@ MODULE := engines/hopkins MODULE_OBJS := \ anim.o \ detection.o \ + dialogs.o \ events.o \ files.o \ font.o \ diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index fbc131e0f0..ec2bdfe54a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -189,6 +189,279 @@ int ObjectsManager::AJOUTE_OBJET(int objIndex) { return arrIndex; } +void ObjectsManager::AFF_SPRITES() { + int v0; + __int16 v1; + __int16 v2; + __int16 destX; + __int16 destY; + int v5; + __int16 v6; + __int16 v7; + __int16 v8; + __int16 v9; + int v10; + __int16 v11; + uint16 *v12; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + __int16 v20; + __int16 v21; + __int16 v23; + __int16 v24; + __int16 v25; + __int16 v26; + __int16 v27; + __int16 v28; + __int16 v29; + __int16 v30; + __int16 v31; + __int16 v32; + __int16 v33; + signed __int16 v34; + signed __int16 v35; + signed __int16 v36; + __int16 v37; + __int16 v38; + uint16 arr[50]; + + _vm->_globals.NBTRI = 0; + v30 = 0; + do { + v0 = v30; + if (_vm->_fontManager.ListeTxt[v0].field0 && _vm->_fontManager.Txt[v30].field3FC != 2) { + v1 = _vm->_fontManager.ListeTxt[v30].x1; + v28 = v1 - 2; + + if ((int16)(v1 - 2) < _vm->_graphicsManager.min_x) + v28 = _vm->_graphicsManager.min_x; + v2 = _vm->_fontManager.ListeTxt[v30].y1; + v23 = v2 - 2; + + if ((int16)(v2 - 2) < _vm->_graphicsManager.min_y) + v23 = _vm->_graphicsManager.min_y; + destX = v1 - 2; + if (destX < _vm->_graphicsManager.min_x) + destX = _vm->_graphicsManager.min_x; + destY = v2 - 2; + if (destY < _vm->_graphicsManager.min_y) + destY = _vm->_graphicsManager.min_y; + + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v28, v23, + _vm->_fontManager.ListeTxt[v30].x2 + 4, _vm->_fontManager.ListeTxt[destX].y2 + 4, + _vm->_graphicsManager.VESA_BUFFER, + destX, destY); + _vm->_fontManager.ListeTxt[v0].field0 = 0; + } + ++v30; + } while (v30 <= 10); + + if (!PERSO_ON) { + v31 = 0; + do { + v5 = v31; + if (_vm->_globals.Liste[v5].field0) { + v6 = _vm->_globals.Liste[v5].field2; + v29 = v6 - 2; + if ((int16)(v6 - 2) < _vm->_graphicsManager.min_x) + v29 = _vm->_graphicsManager.min_x; + v7 = _vm->_globals.Liste[v31].field4; + v24 = v7 - 2; + if ((int16)(v7 - 2) < _vm->_graphicsManager.min_y) + v24 = _vm->_graphicsManager.min_y; + v8 = v6 - 2; + if (v8 < _vm->_graphicsManager.min_x) + v8 = _vm->_graphicsManager.min_x; + v9 = v7 - 2; + if (v9 < _vm->_graphicsManager.min_y) + v9 = _vm->_graphicsManager.min_y; + + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v29, v24, _vm->_globals.Liste[v31].x2 + 4, + _vm->_globals.Liste[v31].y2 + 4, _vm->_graphicsManager.VESA_BUFFER, v8, v9); + _vm->_globals.Liste[v5].field0 = 0; + } + ++v31; + } while (v31 <= 4); + } + + AFF_BOB_ANIM(); + AFF_VBOB(); + if (!PERSO_ON) { + v32 = 0; + do { + _vm->_globals.Liste[v32].field0 = 0; + v10 = v32; + if (Sprite[v10].field0 == 1) { + CALCUL_SPRITE(v32); + if (Sprite[v10].field2A == 1) + AvantTri(2, v32, Sprite[v10].field32 + Sprite[v10].field2E); + } + ++v32; + } while (v32 <= 4); + + if (_vm->_globals.CACHEFLAG) + VERIFCACHE(); + } + + if (PRIORITY == 1 && _vm->_globals.NBTRI) { + v33 = 1; + do { + arr[v33] = v33; + ++v33; + } while (v33 <= 48); + + v25 = _vm->_globals.NBTRI; + do { + v27 = 0; + v34 = 1; + if (v25 > 1) { + v26 = _vm->_globals.NBTRI; + + do { + v11 = arr[v34]; + v12 = &arr[v34 + 1]; + if (_vm->_globals.Tri[arr[v34]].field4 > _vm->_globals.Tri[*v12].field4) { + arr[v34] = *v12; + *v12 = v11; + ++v27; + } + ++v34; + } while (v34 < v26); + } + } while (v27); + + v35 = 1; + if (_vm->_globals.NBTRI + 1 > 1) { + do { + v13 = arr[v35]; + if (_vm->_globals.Tri[v13].field0 == 1) + DEF_BOB(_vm->_globals.Tri[v13].field2); + if (_vm->_globals.Tri[v13].field0 == 2) + DEF_SPRITE(_vm->_globals.Tri[v13].field2); + if (_vm->_globals.Tri[v13].field0 == 3) + DEF_CACHE(_vm->_globals.Tri[v13].field2); + _vm->_globals.Tri[v13].field0 = 0; + ++v35; + } while (v35 < _vm->_globals.NBTRI + 1); + } + } else { + v36 = 1; + if (_vm->_globals.NBTRI + 1 > 1) { + do { + v14 = v36; + if (_vm->_globals.Tri[v14].field0 == 1) + DEF_BOB(_vm->_globals.Tri[v14].field2); + if (_vm->_globals.Tri[v14].field0 == 2) + DEF_SPRITE(_vm->_globals.Tri[v14].field2); + if (_vm->_globals.Tri[v14].field0 == 3) + DEF_CACHE(_vm->_globals.Tri[v14].field2); + _vm->_globals.Tri[v14].field0 = 0; + ++v36; + } while (v36 < _vm->_globals.NBTRI + 1); + } + } + + v37 = 0; + do { + v15 = v37; + _vm->_globals.Tri[v15].field0 = 0; + _vm->_globals.Tri[v15].field4 = 0; + _vm->_globals.Tri[v15].field2 = 0; + _vm->_globals.Tri[v15].field6 = 0; + ++v37; + } while (v37 <= 49); + + _vm->_globals.NBTRI = 0; + if (_vm->_globals.AFFINVEN == 1) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, Winventaire, inventairex, inventairey, inventairel, inventaireh); + if (old_cadx && old_cady) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, 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); + } + + if (SL_FLAG == 1) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, SL_SPR, _vm->_eventsManager.start_x + 183, 60, 0x112u, 353); + if (SL_X && SL_Y) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, SL_SPR2, SL_X + _vm->_eventsManager.start_x + 300, SL_Y + 300, 0); + + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, _vm->_eventsManager.start_x + 457, 413); + } + + if (_vm->_globals.OPTION_FLAG) { + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 464, 407, 0); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 657, 556, _vm->_globals.opt_vitesse); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 731, 495, _vm->_globals.opt_txt); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 731, 468, _vm->_globals.opt_voice); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 731, 441, _vm->_globals.opt_sound); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 731, 414, _vm->_globals.opt_music); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 600, 522, _vm->_globals.opt_anm); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 611, 502, _vm->_globals.opt_scrspeed); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 164, 107, _vm->_eventsManager.start_x + 498, 320); + } + + v38 = 0; + do { + v16 = v38; + if (_vm->_fontManager.Txt[v16].field0 == 1) { + if ((uint16)(_vm->_fontManager.Txt[v16].field3FC - 2) > 1) + BOITE(v38, + _vm->_fontManager.Txt[v16].fieldC, _vm->_fontManager.Txt[v16].field4, + _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v16].field8, _vm->_fontManager.Txt[v16].fieldA); + else + BOITE( + v38, + _vm->_fontManager.Txt[v16].fieldC, + _vm->_fontManager.Txt[v16].field4, + _vm->_fontManager.Txt[v16].field8, + _vm->_fontManager.Txt[v16].fieldA); + _vm->_fontManager.ListeTxt[v38].field0 = 1; + + v17 = v38; + if ((uint16)(_vm->_fontManager.Txt[v17].field3FC - 2) > 1) + _vm->_fontManager.ListeTxt[v38].x1 = _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v17].field8; + else + _vm->_fontManager.ListeTxt[v38].x1 = _vm->_fontManager.Txt[v17].field8; + + v18 = v38; + v19 = v38; + _vm->_fontManager.ListeTxt[v18].y1 = _vm->_fontManager.Txt[v19].fieldA; + _vm->_fontManager.ListeTxt[v18].x2 = _vm->_fontManager.Txt[v19].field404; + _vm->_fontManager.ListeTxt[v18].y2 = _vm->_fontManager.Txt[v19].field406; + + if (_vm->_fontManager.ListeTxt[v38].x1 < _vm->_graphicsManager.min_x) + _vm->_fontManager.ListeTxt[v38].x1 = _vm->_graphicsManager.min_x - 1; + if (_vm->_fontManager.ListeTxt[v38].y1 < _vm->_graphicsManager.min_y) + _vm->_fontManager.ListeTxt[v38].y1 = _vm->_graphicsManager.min_y - 1; + v20 = _vm->_fontManager.ListeTxt[v38].x1; + if (_vm->_fontManager.ListeTxt[v38].x2 + v20 > _vm->_graphicsManager.max_x) + _vm->_fontManager.ListeTxt[v38].x2 = _vm->_graphicsManager.max_x - v20; + v21 = _vm->_fontManager.ListeTxt[v38].y1; + if (_vm->_fontManager.ListeTxt[v38].y2 + v21 > _vm->_graphicsManager.max_y) + _vm->_fontManager.ListeTxt[v38].y2 = _vm->_graphicsManager.max_y - v21; + if (_vm->_fontManager.ListeTxt[v38].x2 <= 0 || _vm->_fontManager.ListeTxt[v38].y2 <= 0) + _vm->_fontManager.ListeTxt[v18].field0 = 0; + } + ++v38; + } while (v38 <= 10); + + INVENT_ANIM(); +} + void ObjectsManager::INIT_BOB() { for (int idx = 0; idx < 35; ++idx) { BOB_ZERO(idx); @@ -233,6 +506,10 @@ void ObjectsManager::BOB_ZERO(int idx) { item.field8 = 0; } +void ObjectsManager::DEF_BOB(int idx) { + warning("TODO: DEF_BOB"); +} + void ObjectsManager::BOB_VISU(int idx) { int v1; const byte *data; @@ -289,4 +566,40 @@ void ObjectsManager::BOB_OFF(int idx) { _vm->_globals.Bob[idx].field0 = 11; } +void ObjectsManager::VERIFCACHE() { + warning("TODO: VERIFCACHE"); +} + +void ObjectsManager::INVENT_ANIM() { + warning("TODO: INVENT_ANIM"); +} + +void ObjectsManager::DEF_SPRITE(int idx) { + warning("TODO: DEF_SPRITE"); +} + +void ObjectsManager::DEF_CACHE(int a1) { + warning("TODO: DEF_CACHE"); +} + +void ObjectsManager::CALCUL_SPRITE(int idx) { + warning("TODO: CALCUL_SPRITE"); +} + +void ObjectsManager::AvantTri(int a1, int a2, int a3) { + warning("TODO: AvantTri"); +} + +void ObjectsManager::AFF_BOB_ANIM() { + warning("TODO: AFF_BOB_ANIM"); +} + +void ObjectsManager::AFF_VBOB() { + warning("TODO: AFF_VBOB"); +} + +void ObjectsManager::BOITE(int a1, int a2, int a3, int a4, int a5) { + warning("TODO: BOITE"); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index f9017cc63f..1d1a445b63 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -29,13 +29,33 @@ namespace Hopkins { +struct SpriteItem { + int field0; + int field2A; + int field2E; + int field32; +}; + class HopkinsEngine; class ObjectsManager { private: HopkinsEngine *_vm; +public: int PRIORITY; + int inventairex, inventairey; + int inventairel, inventaireh; + int old_cadx, old_cady, old_cadi; + int cadx, cady, cadi; + int SL_X, SL_Y; + byte *Winventaire; + byte *inventaire2; + byte *SL_SPR; + byte *SL_SPR2; + SpriteItem Sprite[6]; + bool PERSO_ON; + bool SL_FLAG; public: ObjectsManager(); void setParent(HopkinsEngine *vm); @@ -50,14 +70,27 @@ public: byte *CHARGE_SPRITE(const Common::String &file); void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); + void AFF_SPRITES(); int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); int AJOUTE_OBJET(int objIndex); void INIT_BOB(); void BOB_ZERO(int idx); + void DEF_BOB(int idx); void BOB_VISU(int idx); void BOB_OFF(int idx); + + void VERIFCACHE(); + void INVENT_ANIM(); + void DEF_SPRITE(int idx); + void DEF_CACHE(int idx); + void CALCUL_SPRITE(int idx); + void AvantTri(int a1, int a2, int a3); + void AFF_BOB_ANIM(); + void AFF_VBOB(); + + void BOITE(int a1, int a2, int a3, int a4, int a5); }; } // End of namespace Hopkins diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index ea19b8fba7..14576da7f1 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -59,4 +59,21 @@ void SoundManager::DEL_SAMPLE(int soundNumber) { warning("TODO: DEL_SAMPLE"); } +void SoundManager::PLAY_SOUND(const Common::String &file) { + warning("TODO: PLAY_SOUND"); +} + +void SoundManager::MODSetSampleVolume() { + warning("TODO MODSetSampleVolume"); +} + +void SoundManager::MODSetVoiceVolume() { + warning("TODO MODSetVoiceVolume"); +} + +void SoundManager::MODSetMusicVolume(int volume) { + warning("TODO MODSetMusicVolume"); +} + + } // End of namespace Hopkins diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 696ac79fa5..c7e142c112 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -35,6 +35,16 @@ public: HopkinsEngine *_vm; int SPECIAL_SOUND; + int SOUNDVOL; + int VOICEVOL; + int MUSICVOL; + int OLD_SOUNDVOL; + int OLD_MUSICVOL; + int OLD_VOICEVOL; + bool SOUNDOFF; + bool MUSICOFF; + bool VOICEOFF; + bool TEXTOFF; public: void setParent(HopkinsEngine *vm); @@ -45,6 +55,10 @@ public: void WSOUND(int soundNumber); void VOICE_MIX(int a1, int a2); void DEL_SAMPLE(int soundNumber); + void PLAY_SOUND(const Common::String &file); + void MODSetSampleVolume(); + void MODSetVoiceVolume(); + void MODSetMusicVolume(int volume); }; } // End of namespace Hopkins |