diff options
author | Paul Gilbert | 2012-11-17 20:49:07 +1100 |
---|---|---|
committer | Paul Gilbert | 2012-11-17 20:49:07 +1100 |
commit | 0fdea57c544c8c1bd1c816262d9319367334eb83 (patch) | |
tree | b08a07a39f490ca8183e24f42295e1f8890b2eae /engines | |
parent | 8b0ae07969dbdbeb9ad955ab1f23c570ca300167 (diff) | |
download | scummvm-rg350-0fdea57c544c8c1bd1c816262d9319367334eb83.tar.gz scummvm-rg350-0fdea57c544c8c1bd1c816262d9319367334eb83.tar.bz2 scummvm-rg350-0fdea57c544c8c1bd1c816262d9319367334eb83.zip |
HOPKINS: Lots of code implemented for Hopkin's computer
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hopkins/computer.cpp | 1316 | ||||
-rw-r--r-- | engines/hopkins/computer.h | 137 | ||||
-rw-r--r-- | engines/hopkins/events.cpp | 25 | ||||
-rw-r--r-- | engines/hopkins/events.h | 27 | ||||
-rw-r--r-- | engines/hopkins/font.cpp | 66 | ||||
-rw-r--r-- | engines/hopkins/font.h | 5 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 198 | ||||
-rw-r--r-- | engines/hopkins/graphics.h | 6 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 13 | ||||
-rw-r--r-- | engines/hopkins/hopkins.h | 2 | ||||
-rw-r--r-- | engines/hopkins/menu.cpp | 196 | ||||
-rw-r--r-- | engines/hopkins/menu.h | 1 | ||||
-rw-r--r-- | engines/hopkins/module.mk | 1 | ||||
-rw-r--r-- | engines/hopkins/sound.cpp | 27 | ||||
-rw-r--r-- | engines/hopkins/sound.h | 1 |
15 files changed, 1809 insertions, 212 deletions
diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp new file mode 100644 index 0000000000..afeb6ba6b4 --- /dev/null +++ b/engines/hopkins/computer.cpp @@ -0,0 +1,1316 @@ +/* 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. + * + */ + +#include "common/system.h" +#include "common/file.h" +#include "common/textconsole.h" +#include "hopkins/font.h" +#include "hopkins/files.h" +#include "hopkins/globals.h" +#include "hopkins/graphics.h" +#include "hopkins/hopkins.h" +#include "hopkins/objects.h" + +namespace Hopkins { + +ComputerManager::ComputerManager() { + Common::fill(&MenuText[0], &MenuText[10600], '\0'); + Common::fill(&Sup_string[0], &Sup_string[200], '\0'); + CASSESPR = NULL; + FMOUSE = false; + TEXT_COL = 0; + CASSETAB = 0; + NBBRIQUES = 0; + CASSESCORE = 0; + CASSEVIE = 0; + CASSESPEED = 0; + BALLEHORI = 0; + BALLEVERTI = 0; + NB_TABLE = 0; + RAQX = 0; + CASSEP1 = 0; + CASSEP2 = 0; + CASSDER = 0; +} + +void ComputerManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + +void ComputerManager::setvideomode() { + TEXT_MODE(); +} + +void ComputerManager::TEXT_MODE() { + _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + //SET_MODE(SCREEN_WIDTH, SCREEN_HEIGHT); + + _vm->_graphicsManager.nbrligne = SCREEN_WIDTH; + _vm->_fileManager.CONSTRUIT_SYSTEM("STFONT.SPR"); + _vm->_globals.police = _vm->_globals.dos_free2(_vm->_globals.police); + _vm->_globals.police = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.police_l = 8; + _vm->_globals.police_h = 8; + _vm->_graphicsManager.LOAD_IMAGE("WINTEXT"); + _vm->_graphicsManager.FADE_INW(); + Charge_Menu(); + _vm->_eventsManager.souris_flag = false; +} + +void ComputerManager::clearscreen() { + _vm->_graphicsManager.LOAD_IMAGE("WINTEXT"); + _vm->_graphicsManager.FADE_INW(); +} + +void ComputerManager::settextcolor(int col) { + TEXT_COL = col; +} + +void ComputerManager::settextposition(int xp, int yp) { + _textPosition.x = xp; + _textPosition.y = yp; +} + +void ComputerManager::COMPUT_HOPKINS(int mode) { + int v2; + char *v3; + int v4; + char v5; + char *v6; + int v7; + char v8; + char *v9; + int v10; + char v11; + int v12; + char s[12]; + const char *s2; + + _vm->_eventsManager.ESC_KEY = 0; + v2 = 0; + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + setvideomode(); + settextcolor(4); + + _vm->_eventsManager.videkey(); + settextposition(2, 4); + if (mode == 1) + outtext(&MenuText[10]); + if (mode == 2) + outtext(&MenuText[0xDE]); + if (mode == 3) + outtext(&MenuText[0x1B2]); + + settextcolor(1); + if (mode == 3) { + settextposition(10, 8); + outtext(&MenuText[0x286]); + } + settextposition(12, 28); + outtext(&MenuText[0x35A]); + settextposition(14, 35); + + v3 = &s[0]; + memset(s, 0, 8u); + TXT4(280, 224, 8); + + strcpy(s, Sup_string); + + if (mode == 1) { + s2 = "HOPKINS"; + v4 = 8; + v5 = 1; + do { + if (!v4) + break; + v5 = *v3++ == *s2++; + --v4; + } while (v5); + if (v5) + v2 = 1; + } + if (mode == 2) { + v6 = &s[0]; + s2 = "328MHZA"; + v7 = 8; + v8 = 1; + do { + if (!v7) + break; + v8 = *v6++ == *s2++; + --v7; + } while (v8); + if (v8) + v2 = 1; + } + if (mode == 3) { + v9 = &s[0]; + s2 = "ALLFREE"; + v10 = 8; + v11 = 1; + do { + if (!v10) + break; + v11 = *v9++ == *s2++; + --v10; + } while (v11); + if (v11) + v2 = 1; + } + if (v2) { + while (!_vm->shouldQuit()) { + _vm->_eventsManager.ESC_KEY = 0; + _vm->_eventsManager.videkey(); + clearscreen(); + settextcolor(4); + settextposition(2, 4); + if (mode == 1) + outtext(&MenuText[10]); + if (mode == 2) + outtext(&MenuText[0xDE]); + if (mode == 3) + outtext(&MenuText[0x1B2]); + settextcolor(15); + settextposition(8, 25); + settextcolor(15); + outtext2(&MenuText[0x502]); + settextposition(20, 25); + outtext2(&MenuText[0x5D6]); + if (mode == 1) { + settextposition(10, 25); + outtext2(&MenuText[0x6AA]); + settextposition(12, 25); + outtext2(&MenuText[0x77E]); + settextposition(14, 25); + outtext2(&MenuText[0x852]); + settextposition(16, 25); + outtext2(&MenuText[0x926]); + } + if (mode == 2) { + _vm->_eventsManager.videkey(); + settextposition(10, 25); + outtext2(&MenuText[0x95A]); + settextposition(12, 25); + outtext2(&MenuText[0xACE]); + settextposition(14, 25); + outtext2(&MenuText[0xBA2]); + settextposition(16, 25); + outtext2(&MenuText[0xC76]); + settextposition(18, 25); + outtext2(&MenuText[0xD4A]); + } + + do { + v12 = _vm->_eventsManager.keywin(); + if (_vm->shouldQuit()) + return; + + v2 = 0; + if ((uint16)(v12 - 48) <= 8u) + v2 = 1; + } while (v2 != 1); + + if (v12 == 48) + break; + if (v12 == 49) { + GAMES(); + } else if (mode == 1) { + _vm->_eventsManager.videkey(); + clearscreen(); + settextcolor(4); + settextposition(2, 4); + outtext(&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 (mode == 2) { + clearscreen(); + settextcolor(4); + settextposition(2, 4); + outtext(&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(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + RESTORE_POLICE(); + } else { + settextcolor(4); + settextposition(16, 25); + outtext(&MenuText[0x42E]); + _vm->_eventsManager.VBL(); + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x4AFFFu); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + RESTORE_POLICE(); + _vm->_eventsManager.MOUSE_OFF(); + } + if (mode == 1) + _vm->_globals.SORTIE = 13; + if ((uint16)(mode - 2) <= 1u) + _vm->_globals.SORTIE = 14; + + _vm->_graphicsManager.RESET_SEGMENT_VESA(); +} + +void ComputerManager::Charge_Menu() { + +} + +void ComputerManager::TXT4(int xp, int yp, int a3) { + int v3; + bool v4, v12; + char v5; + int v6; + char v7; + int v8; + byte v9; + int textIndex; + char newChar; + Common::String charString; + + v3 = xp; + textIndex = 0; + v4 = v12 = _vm->_eventsManager.souris_flag; + _vm->_eventsManager.souris_flag = false; + + _vm->_fontManager.TEXT_NOW(xp, yp, "_", -4); + do { + v5 = _vm->_eventsManager.keywin(); + if (_vm->shouldQuit()) + return; + + v6 = v5; + v7 = 42; + if (v5 == 45) + v7 = 45; + if (v5 == 48) + v7 = 48; + if (v5 == 49) + v7 = 49; + if (v5 == 50) + v7 = 50; + if (v5 == 51) + v7 = 51; + if (v5 == 52) + v7 = 52; + if (v5 == 53) + v7 = 53; + if (v5 == 54) + v7 = 54; + if (v5 == 55) + v7 = 55; + if (v5 == 56) + v7 = 56; + if (v5 == 57) + v7 = 57; + if (v5 == 65 || v5 == 97) + v7 = 65; + if (v5 == 66 || v5 == 98) + v7 = 66; + if (v5 == 67 || v5 == 99) + v7 = 67; + if (v5 == 68 || v5 == 100) + v7 = 68; + if (v5 == 69 || v5 == 101) + v7 = 69; + if (v5 == 70 || v5 == 102) + v7 = 70; + if (v5 == 71 || v5 == 103) + v7 = 71; + if (v5 == 72 || v5 == 104) + v7 = 72; + if (v5 == 73 || v5 == 105) + v7 = 73; + if (v5 == 74 || v5 == 106) + v7 = 74; + if (v5 == 75 || v5 == 107) + v7 = 75; + if (v5 == 76 || v5 == 108) + v7 = 76; + if (v5 == 77 || v5 == 109) + v7 = 77; + if (v5 == 78 || v5 == 110) + v7 = 78; + if (v5 == 79 || v5 == 111) + v7 = 79; + if (v5 == 80 || v5 == 112) + v7 = 80; + if (v5 == 81 || v5 == 113) + v7 = 81; + if (v5 == 82 || v5 == 114) + v7 = 82; + if (v5 == 83 || v5 == 115) + v7 = 83; + if (v5 == 84 || v5 == 116) + v7 = 84; + if (v5 == 85 || v5 == 117) + v7 = 85; + if (v5 == 86 || v5 == 118) + v7 = 86; + if (v5 == 87 || v5 == 119) + v7 = 87; + if (v5 == 88 || v5 == 120) + v7 = 88; + if (v5 == 89 || v5 == 121) + v7 = 89; + if (v5 == 90 || v5 == 122) + v7 = 90; + if (v5 == 8 && textIndex > 0) { + Sup_string[textIndex--] = 0; + v3 -= _vm->_globals.police_l; + v8 = v3 + 2 * _vm->_globals.police_l; + v9 = v7; + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, v3, yp, 2 * _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, v3, yp); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v3, yp, v8, yp + 12); + _vm->_fontManager.TEXT_NOW(v3, yp, "_", -4); + v7 = v9; + } + if (v7 != '*') { + newChar = v7; + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, v3, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, v3, yp); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v3, yp, _vm->_globals.police_l + v3, yp + 12); + Sup_string[textIndex] = newChar; + + charString = Common::String::format("%c_", newChar); + _vm->_fontManager.TEXT_NOW(v3, yp, charString, -4); + ++textIndex; + v3 += _vm->_globals.police_l; + } + _vm->_eventsManager.VBL(); + v4 = a3; + } while (textIndex != a3 && v6 != 13); + + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, v3, yp, _vm->_globals.police_l, + 12, _vm->_graphicsManager.VESA_BUFFER, v3, yp); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v3, yp, _vm->_globals.police_l + v3, yp + 12); + + _vm->_eventsManager.VBL(); + Sup_string[textIndex] = 0; + _vm->_eventsManager.souris_flag = v12; +} + +void ComputerManager::outtext(const Common::String &msg) { + _vm->_fontManager.TEXT_COMPUT(_textPosition.x, _textPosition.y, msg, TEXT_COL); +} + +void ComputerManager::outtext2(const Common::String &msg) { + _vm->_fontManager.TEXT_NOW(_textPosition.x, _textPosition.y, msg, TEXT_COL); +} + +void ComputerManager::RESTORE_POLICE() { + _vm->_globals.police = _vm->_globals.dos_free2(_vm->_globals.police); + _vm->_fileManager.CONSTRUIT_SYSTEM("FONTE3.SPR"); + _vm->_globals.police = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + + _vm->_globals.police_l = 12; + _vm->_globals.police_h = 21; + _vm->_eventsManager.souris_flag = true; +} + +void ComputerManager::LIT_TEXTE(int a1) { + uint16 v1; + int v2; + uint16 v3; + int v4; + int v5; + int v6; + int v7; + int v8; + uint16 v10; + byte *ptr; + Common::String v12; + Common::String numStr; + int num; + + _vm->_eventsManager.ESC_KEY = false; + + if (_vm->_globals.FR == 0) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "THOPKAN.TXT"); + if (_vm->_globals.FR == 1) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "THOPK.TXT"); + if (_vm->_globals.FR == 2) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "THOPKES.TXT"); + + ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + v1 = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); + v2 = 0; + v3 = 0; + if (v1 > 0u) { + do { + if (*(ptr + v3) == '%') { + numStr = Common::String::format("%c%c", *(ptr + v3 + 1), *(ptr + v3 + 2)); + num = atol(numStr.c_str()); + + if (num == a1) + v2 = 1; + } + if (v2 == 1) + break; + ++v3; + } while (v3 < v1); + } + v4 = v3; + if (v3 > v1 - 1) + error("Error with Hopkins computer file"); + + v10 = v3 + 3; + v5 = 1; + v6 = 5; + v7 = 0; + do { + v4 = *(ptr + v10); + if (v4 == 13) { +// v12[v7] = 0; +// v7 = 0; + v8 = v4; + settextposition(v6, v5); + outtext(v12); + + ++v6; + v5 = 1; + _vm->_eventsManager.VBL(); + v4 = v8; + v12 = ""; + } else if (v4 != '%') { + //v12[v7++] = v4; + v12 += v4; + ++v7; + } + ++v10; + } while (v4 != 37); + + _vm->_eventsManager.videkey(); + _vm->_eventsManager.wingetch(); + _vm->_globals.dos_free2(ptr); +} + +void ComputerManager::GAMES() { + const byte *v1; + int v2; + + v1 = _vm->_objectsManager.Sprite[0].spriteData; + v2 = _vm->_globals.vitesse; + _vm->_globals.vitesse = 1; + _vm->_eventsManager.CHANGE_MOUSE(0); + CASSESPR = g_PTRNUL; + _vm->_eventsManager.CASSE = 1; + _vm->_eventsManager.CASSE_SOURIS_ON(); + CASSETAB = g_PTRNUL; + NBBRIQUES = 0; + CASSESCORE = 0; + CASSEVIE = 5; + CASSESPEED = 1; + BALLEHORI = 0; + BALLEVERTI = 0; + NB_TABLE = 0; + _vm->_graphicsManager.min_y = 0; + _vm->_graphicsManager.max_x = 320; + _vm->_graphicsManager.max_y = 200; + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND37.WAV"); + _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND38.WAV"); + _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND39.WAV"); + _vm->_fileManager.CONSTRUIT_SYSTEM("_vm->_eventsManager.CASSE.SPR"); + CASSESPR = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + CHARGE_SCORE(); + MODE_VGA256(); + NEWTAB(); + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + PLAY_BRIQUE(); + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + CASSESPR = _vm->_globals.LIBERE_FICHIER(CASSESPR); + CASSETAB = _vm->_globals.dos_free2(CASSETAB); + _vm->_objectsManager.Sprite[0].spriteData = v1; + + _vm->_soundManager.DEL_SAMPLE(1); + _vm->_soundManager.DEL_SAMPLE(2); + _vm->_soundManager.DEL_SAMPLE(3); + _vm->_globals.vitesse = v2; + _vm->_eventsManager.CASSE = 0; + _vm->_eventsManager.CASSE_SOURIS_OFF(); + setvideomode(); + settextcolor(15); + clearscreen(); + _vm->_graphicsManager.max_x = 680; + _vm->_graphicsManager.min_y = 0; + _vm->_graphicsManager.max_y = 460; +} + +void ComputerManager::CHARGE_SCORE() { + int v0; + int v1; + char v2; + int v3; + int v4; + char v5; + byte *ptr; + int v8; + + _vm->_fileManager.CONSTRUIT_LINUX("HISCORE.DAT"); + ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + v8 = 0; + do { + v0 = 16 * v8; + v1 = 0; + do { + v2 = *(ptr + v1 + (int)(16 * v8)); + if (!v2) + v2 = 32; + *(&Score[v0] + v1++) = v2; + } while (v1 <= 4); + v3 = v0 + 6; + v4 = 0; + do { + v5 = *(ptr + v4 + v3); + if (!v5) + v5 = 48; + *(&Score[16 * v8 + 6] + v4++) = v5; + } while (v4 <= 8); + *(ptr + v3 + 9) = 0; + ++v8; + } while (v8 <= 5); + + _vm->_globals.dos_free2(ptr); + CASSE_HISCORE = atol((const char *)&Score[86]); +} + +void ComputerManager::MODE_VGA256() { + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.SCANLINE(0x140u); + _vm->_fileManager.DMESS(); +} + +void ComputerManager::NEWTAB() { + Common::String file; + Common::File f; + + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.SPRITE_OFF(1); + ++CASSEVIE; + if (CASSEVIE > 11) + CASSEVIE = 11; + _vm->_graphicsManager.LOAD_IMAGEVGA("CASSEF.PCX"); + AFF_VIE(); + if (g_PTRNUL != CASSETAB) + CASSETAB = _vm->_globals.dos_free2(CASSETAB); + + ++NB_TABLE; + while (!_vm->shouldQuit()) { + file = Common::String::format("TAB%d.TAB", NB_TABLE); + + _vm->_fileManager.CONSTRUIT_SYSTEM(file); + if (f.open(_vm->_globals.NFICHIER)) + break; + + NB_TABLE = 1; + } + f.close(); + + CASSETAB = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + AFF_BRIQUES(); + _vm->_objectsManager.SPRITE(CASSESPR, 150, 192, 0, 13, 0, 0, 0, 0); + _vm->_objectsManager.SPRITE(CASSESPR, 164, 187, 1, 14, 0, 0, 0, 0); + BALLE = Common::Point(164, 187); + RAQX = 150; + _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.SPRITE_ON(1); + _vm->_eventsManager.MOUSE_ON1(); + FMOUSE = true; + _vm->_soundManager.PLAY_SAMPLE(3, 5); +} + +void ComputerManager::AFF_BRIQUES() { + int v0; + int v1; + int v2; + uint16 v3; + byte *v4; + + NBBRIQUES = 0; + CASSESPEED = 1; + v4 = CASSETAB; + v3 = 0; + do { + v0 = *((uint16 *)v4 + v3); + v1 = *((uint16 *)v4 + v3 + 1); + v2 = *((uint16 *)v4 + v3 + 4); + if (v0 != -1) { + if (v2 <= 6) + ++NBBRIQUES; + if (v2 == 3) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 17); + if (v2 == 6) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 18); + if (v2 == 5) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 19); + if (v2 == 4) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 20); + if (v2 == 1) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 21); + if (v2 == 2) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 22); + if (v2 == 31) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 23); + } + v3 += 6; + } while (v0 != -1); + IMPRIMESCORE(); +} + +void ComputerManager::AFF_VIE() { + int v0; + int v1; + int v2; + int v3; + int v4; + + v0 = CASSEVIE - 1; + v1 = 10; + v2 = 0; + do { + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v1, 10, 15); + v1 += 7; + ++v2; + } while (v2 <= 11); + if (v0) { + v3 = 10; + v4 = 0; + if (v0 > 0) { + do { + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v3, 10, 14); + v3 += 7; + ++v4; + } while (v4 < v0); + } + } +} + +void ComputerManager::PLAY_BRIQUE() { + int v1 = 0; + int v; + + while (!_vm->shouldQuit()) { + while (!_vm->shouldQuit()) { + _vm->_eventsManager.MOUSE_OFF(); + BALLE = Common::Point(RAQX + 14, 187); + _vm->_objectsManager.SETYSPR(1, 187); + _vm->_objectsManager.SETXSPR(1, BALLE.x); + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + _vm->_eventsManager.VBL(); + _vm->_graphicsManager.FADE_IN_CASSE(); + do { + RAQX = _vm->_eventsManager.souris_x; + if (_vm->_eventsManager.souris_x <= 4) + RAQX = 5; + if (RAQX > 282) + RAQX = 282; + _vm->_objectsManager.SETXSPR(0, RAQX); + _vm->_objectsManager.SETXSPR(1, RAQX + 14); + _vm->_objectsManager.SETYSPR(1, 187); + _vm->_eventsManager.VBL(); + } while (_vm->_eventsManager.BMOUSE() != 1); + + CASSESPEED = 1; + BALLE = Common::Point(RAQX + 14, 187); + BALLEHORI = RAQX > 135; + BALLEVERTI = 0; + + do { + RAQX = _vm->_eventsManager.souris_x; + if ((int)_vm->_eventsManager.souris_x <= 4) + RAQX = 5; + if (RAQX > 282) + RAQX = 282; + _vm->_objectsManager.SETXSPR(0, RAQX); + v1 = DEP_BALLE(); + _vm->_eventsManager.VBL(); + } while (!_vm->shouldQuit() && !v1); + if (v1 != 1) + break; + _vm->_graphicsManager.FADE_OUT_CASSE(); + --CASSEVIE; + if (CASSEVIE) { + AFF_VIE(); + if (CASSEVIE) + continue; + } + _vm->_eventsManager.MOUSE_ON1(); + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.SPRITE_OFF(1); + if (CASSESCORE > CASSE_HISCORE) + NAME_SCORE(); + v = HIGHT_SCORE(); + if (v != 1) + break; + + NBBRIQUES = 0; + CASSESCORE = 0; + CASSEVIE = 4; + CASSESPEED = 1; + BALLEHORI = 0; + BALLEVERTI = 0; + NB_TABLE = 0; + CHARGE_SCORE(); + NEWTAB(); + } + if (v1 != 2) + return; + _vm->_graphicsManager.FADE_OUT_CASSE(); + NEWTAB(); + } +} + +int ComputerManager::HIGHT_SCORE() { + int v0; + int v1; + int v2; + int v3; + int v4; + int v6; + byte *ptr; + + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + CHARGE_SCORE(); + _vm->_graphicsManager.LOAD_IMAGEVGA("HISCORE.PCX"); + _vm->_fileManager.CONSTRUIT_SYSTEM("ALPHA.SPR"); + ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _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); + v6 = 0; + do { + v0 = 19 * v6; + v0 = v0 + 46; + v1 = 0; + do { + PRINT_HSCORE(ptr, 9 * v1 + 69, v0, *(&Score[16 * v6] + v1)); + ++v1; + } while (v1 <= 5); + v2 = 0; + do { + PRINT_HSCORE(ptr, 9 * v2 + 199, v0, *(&Score[16 * v6 + 6] + v2)); + ++v2; + } while (v2 <= 8); + ++v6; + } while (v6 <= 5); + _vm->_graphicsManager.FADE_IN_CASSE(); + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + v3 = 0; + do { + v4 = _vm->_eventsManager.souris_x + 13; + v0 = _vm->_eventsManager.souris_y; + if (_vm->_eventsManager.BMOUSE() == 1 && (uint16)(v4 - 15) <= 0x21u && (uint16)(v0 - 176) <= 0xDu) + v3 = 1; + if (_vm->_eventsManager.BMOUSE() == 1 + && (uint16)(v4 - 274) <= 0x20u + && (uint16)(v0 - 176) <= 0xDu) + v3 = 2; + _vm->_eventsManager.VBL(); + } while (!v3); + _vm->_eventsManager.MOUSE_OFF(); + _vm->_graphicsManager.FADE_OUT_CASSE(); + _vm->_globals.LIBERE_FICHIER(ptr); + return v3; +} + +void ComputerManager::NAME_SCORE() { + int v0; + int v1; + int v2; + int v3; + int i; + byte *ptr; + char s[16]; + + _vm->_graphicsManager.LOAD_IMAGEVGA("NAME.PCX"); + _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->_fileManager.CONSTRUIT_SYSTEM("ALPHA.SPR"); + ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_graphicsManager.FADE_IN_CASSE(); + v0 = 0; + do { + PRINT_HSCORE(ptr, 9 * v0 + 140, 78, 1); + + v1 = toupper(_vm->_eventsManager.keywin()); + if (v1 <= 47) + v1 = 32; + if (v1 > 90) + v1 = 32; + if ((uint16)(v1 - 58) <= 6u) + v1 = 32; + Score[v0 + 80] = v1; + PRINT_HSCORE(ptr, 9 * v0 + 140, 78, v1); + + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + ++v0; + } while (v0 <= 4); + memset(&Score[86], 32, 9u); + sprintf(s, "%d", CASSESCORE); + v2 = 0; + do + ++v2; + while (s[v2]); + v3 = 8; + for (i = v2; ; Score[v3-- + 86] = s[i]) { + --i; + if (i <= -1) + break; + } + _vm->_graphicsManager.FADE_OUT_CASSE(); + _vm->_globals.dos_free2(ptr); + SAUVE_SCORE(); +} + +void ComputerManager::IMPRIMESCORE() { + __int16 v0; + __int16 v1; + __int16 i; + char s[40]; + + sprintf(s, "%d", CASSESCORE); + v0 = 0; + do + ++v0; + while (s[v0]); + v1 = 0; + for (i = v0; ; IMPSCORE(v1++, (byte)s[i])) { + --i; + if (i <= -1) + break; + } +} + +void ComputerManager::IMPSCORE(int a1, int a2) { + signed __int16 v2; + __int16 v3; + + v2 = 203; + v3 = 3; + if (a1 == 1) + v2 = 193; + if (a1 == 2) + v2 = 183; + if (a1 == 3) + v2 = 170; + if (a1 == 4) + v2 = 160; + if (a1 == 5) + v2 = 150; + if (a1 == 9) + v2 = 137; + if (a2 == 49) + v3 = 4; + if (a2 == 50) + v3 = 5; + if (a2 == 51) + v3 = 6; + if (a2 == 52) + v3 = 7; + if (a2 == 53) + v3 = 8; + if (a2 == 54) + v3 = 9; + if (a2 == 55) + v3 = 10; + if (a2 == 56) + v3 = 11; + if (a2 == 57) + v3 = 12; + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v2 - 3, 11, v3); +} + +void ComputerManager::SAUVE_SCORE() { + int v0; + int v1; + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; + char v8; + int v9; + int v10; + char v11; + int v13; + int v14; + byte *ptr; + int v16[6]; + int v17[6]; + + v0 = 0; + do { + v1 = atol((const char *)(16 * v0 + Score + 6)); + v17[v0] = v1; + if (!v1) + v17[v0] = 5; + ++v0; + } while (v0 <= 5); + v13 = 0; + do { + v2 = 0; + v3 = 0; + do { + v4 = v17[v2]; + if (v4 && v17[0] <= v4 && v17[1] <= v4 && v17[2] <= v4 && v17[3] <= v4 + && v17[4] <= v4 && v17[5] <= v4) + v3 = 1; + if (v3 == 1) { + v16[v13] = v2; + v17[v2] = 0; + } else { + ++v2; + } + } while (v3 != 1); + ++v13; + } while (v13 <= 5); + + ptr = _vm->_globals.dos_malloc2(0x64u); + memset(ptr, 0, 0x63u); + v5 = 0; + do { + v6 = 16 * v5; + v14 = v16[v5]; + v7 = 0; + do { + v8 = *(&Score[16 * v14] + v7); + if (!v8) + v8 = 32; + *(ptr + (16 * v5) + v7++) = v8; + } while (v7 <= 4); + + *(ptr + v6 + 5) = 0; + v9 = v6 + 6; + v10 = 0; + do { + v11 = *(&Score[16 * v14 + 6] + v10); + if (!v11) + v11 = 48; + *(ptr + v9 + v10++) = v11; + } while (v10 <= 8); + *(ptr + v9 + 9) = 0; + ++v5; + } while (v5 <= 5); + + _vm->_fileManager.CONSTRUIT_LINUX("HISCORE.DAT"); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, ptr, 0x64u); + _vm->_globals.dos_free2(ptr); +} + +void ComputerManager::PRINT_HSCORE(byte *objectData, int a2, int a3, int a4) { + char v4; + int v5; + + v4 = a4; + v5 = 36; + if (!a4) + v4 = 32; + if (v4 == 100) + v5 = 0; + if ((byte)(v4 - 48) <= 9u) + v5 = (byte)v4 - 48; + if ((byte)(v4 - 65) <= 0x19u) + v5 = (byte)v4 - 55; + if (v4 == 32) + v5 = 36; + if (v4 == 1) + v5 = 37; + _vm->_graphicsManager.AFFICHE_SPEEDVGA(objectData, a2, a3, v5); +} + +int ComputerManager::DEP_BALLE() { + int v0; + __int16 v1; + int v2; + signed __int16 v4; + + v4 = 0; + //(signed int)(6.0 * (long double)_vm->getRandomNumber( rand() / 2147483648.0) + 1; + // TODO: Figure out random number + v0 = _vm->getRandomNumber(6); + if (CASSESPEED == 1) { + CASSEP1 = 1; + CASSEP2 = 1; + } + if (CASSESPEED == 2) { + CASSEP1 = 1; + CASSEP2 = 2; + } + if (CASSESPEED == 3) { + CASSEP1 = 2; + CASSEP2 = 2; + } + if (CASSESPEED == 4) { + CASSEP1 = 3; + CASSEP2 = 2; + } + v1 = CASSEP1; + if (CASSDER == CASSEP1) + v1 = CASSEP2; + if (BALLEVERTI == 1) + BALLE.y += v1; + if (!BALLEVERTI) + BALLE.y -= v1; + if (BALLEHORI == 1) + BALLE.x += v1; + if (!BALLEHORI) + BALLE.x -= v1; + CASSDER = v1; + if (BALLE.x <= 6) { + _vm->_soundManager.PLAY_SAMPLE(2, 6); + BALLE.x = v0 + 6; + BALLEHORI = BALLEHORI != 1; + } + if (BALLE.x > 307) { + _vm->_soundManager.PLAY_SAMPLE(2, 6); + BALLE.x = 307 - v0; + BALLEHORI = BALLEHORI != 1; + } + if (BALLE.y <= 6) { + _vm->_soundManager.PLAY_SAMPLE(2, 6); + BALLE.y = v0 + 7; + BALLEVERTI = BALLEVERTI != 1; + } + if ((uint16)(BALLE.y - 186) <= 8u) { + _vm->_soundManager.PLAY_SAMPLE(2, 6); + if (BALLE.x > RAQX - 2) { + v2 = BALLE.x + 6; + if (v2 < RAQX + 36) { + BALLEVERTI = 0; + if (v2 <= RAQX + 15) { + BALLEHORI = 0; + if (BALLE.x >= RAQX && v2 <= RAQX + 5) + BALLE.x -= 4; + if (BALLE.x >= RAQX + 5 && BALLE.x + 6 <= RAQX + 10) + BALLE.x -= 2; + } + if (BALLE.x >= RAQX + 19 && BALLE.x + 6 <= RAQX + 36) { + BALLEHORI = 1; + if (BALLE.x >= RAQX + 29) + BALLE.x += 4; + if (BALLE.x >= RAQX + 24 && BALLE.x + 6 <= RAQX + 29) + BALLE.x += 2; + } + } + } + } + if (BALLE.y > 194) + v4 = 1; + VERIFBRIQUES(); + _vm->_objectsManager.SETXSPR(1, BALLE.x); + _vm->_objectsManager.SETYSPR(1, BALLE.y); + if (!NBBRIQUES) + v4 = 2; + return v4; +} + + + +void ComputerManager::VERIFBRIQUES() { + __int16 v0; + __int16 v1; + __int16 v2; + __int16 v3; + signed __int16 v4; + __int16 v5; + __int16 v6; + signed __int16 v7; + uint16 v8; + byte *v9; + __int16 v10; + __int16 v11; + __int16 v12; + __int16 v13; + + v7 = 0; + //v6 = (signed int)(6.0 * (long double)rand() / 2147483648.0) + 1; + // TODO: Check if correct + v6 = _vm->getRandomNumber(6) + 1; + v0 = BALLE.x; + v13 = BALLE.y; + v5 = BALLE.x + 6; + v12 = BALLE.y + 6; + v9 = CASSETAB; + v8 = 0; + do { + v1 = *((uint16 *)v9 + v8); + v11 = *((uint16 *)v9 + v8 + 1); + v2 = *((uint16 *)v9 + v8 + 2); + v10 = *((uint16 *)v9 + v8 + 3); + v3 = *((uint16 *)v9 + v8 + 4); + if (*((uint16 *)v9 + v8 + 5) != 1 || v1 == -1) + goto LABEL_60; + v4 = 0; + if (v13 <= v10 && v12 >= v10) { + if (v0 >= v1 && v5 <= v2) { + v4 = 1; + BALLEVERTI = 1; + } + if (v5 >= v1) { + if (v0 <= v1) { + ++v4; + BALLEVERTI = 1; + BALLEHORI = 0; + if (v3 == 31) + BALLE.x -= v6; + } + } + if (v0 <= v2) { + if (v5 >= v2) { + ++v4; + BALLEVERTI = 1; + BALLEHORI = 1; + if (v3 == 31) + BALLE.x += v6; + } + } + } + if (v12 >= v11) { + if (v13 > v11) + goto LABEL_31; + if (v0 >= v1 && v5 <= v2) { + ++v4; + BALLEVERTI = 0; + } + if (v5 >= v1) { + if (v0 <= v1) { + ++v4; + BALLEVERTI = 0; + BALLEHORI = 0; + if (v3 == 31) + BALLE.x -= 2; + } + } + if (v0 <= v2) { + if (v5 >= v2) { + ++v4; + BALLEVERTI = 0; + BALLEHORI = 1; + if (v3 == 31) + BALLE.x += v6; + } + } + } + if (v13 >= v11) { +LABEL_31: + if (v12 <= v10) { + if (v5 >= v1) { + if (v0 <= v1) { + ++v4; + BALLEHORI = 0; + if (v3 == 31) + BALLE.x -= v6; + } + } + if (v0 <= v2) { + if (v5 >= v2) { + ++v4; + BALLEHORI = 1; + if (v3 == 31) + BALLE.x += v6; + } + } + } + } + if (v4) { + if (v3 == 31) { + _vm->_soundManager.PLAY_SAMPLE(2, 6); + } else { + _vm->_soundManager.PLAY_SAMPLE(1, 5); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v1, v11, 16); + if (v3 == 1) + CASSESCORE += 10; + if (v3 == 2) + CASSESCORE += 5; + if (v3 == 3) { + CASSESCORE += 50; + if (CASSESPEED <= 1) + CASSESPEED = 2; + if (NBBRIQUES <= 19) + CASSESPEED = 3; + } + if (v3 == 4) + CASSESCORE += 20; + if (v3 == 5) { + CASSESCORE += 30; + if (CASSESPEED <= 1) + CASSESPEED = 2; + } + if (v3 == 6) + CASSESCORE += 40; + IMPRIMESCORE(); + --NBBRIQUES; + *((uint16 *)v9 + v8 + 5) = 0; + v7 = 1; + } + } +LABEL_60: + if (v7 == 1) + v1 = -1; + v8 += 6; + } while (v1 != -1); +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h new file mode 100644 index 0000000000..612178dc4a --- /dev/null +++ b/engines/hopkins/computer.h @@ -0,0 +1,137 @@ +/* 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_COMPUTER_H +#define HOPKINS_COMPUTER_H + +#include "common/scummsys.h" +#include "common/rect.h" +#include "common/str.h" + +namespace Hopkins { + +class HopkinsEngine; + +class ComputerManager { +private: + HopkinsEngine *_vm; + char MenuText[10600]; + char Sup_string[200]; + byte Score[96]; + int TEXT_COL; + Common::Point _textPosition; + Common::Point BALLE; + byte *CASSESPR; + byte *CASSETAB; + bool FMOUSE; + int NBBRIQUES; + int CASSESCORE; + int CASSEVIE; + int CASSESPEED; + int BALLEHORI; + int BALLEVERTI; + int NB_TABLE; + int RAQX; + int CASSE_HISCORE; + int CASSEP1; + int CASSEP2; + int CASSDER; + + /** + * Load the menu text + */ + void Charge_Menu(); + + void TXT4(int xp, int yp, int a3); + + /** + * Restores the scene for the FBI headquarters room + */ + void RESTORE_POLICE(); + + /** + * Sets up textual entry mode. Used by the code for Hopkins computer. + */ + void setvideomode(); + + /** + * Sets up textual entry mode. Used by the code for Hopkins computer. + */ + void TEXT_MODE(); + + /** + * Clear the screen + */ + void clearscreen(); + + /** + * Sets the text mode color + */ + void settextcolor(int col); + + /** + * Sets the text position + * @param xp X position + * @param yp Y position + */ + void settextposition(int xp, int yp); + + /** + * Outputs a text string + */ + void outtext(const Common::String &msg); + + /** + * Outputs a text string + */ + void outtext2(const Common::String &msg); + + void GAMES(); + void LIT_TEXTE(int a1); + void CHARGE_SCORE(); + void MODE_VGA256(); + void NEWTAB(); + void AFF_BRIQUES(); + void AFF_VIE(); + void PLAY_BRIQUE(); + int HIGHT_SCORE(); + void NAME_SCORE(); + void IMPSCORE(int a1, int a2); + void SAUVE_SCORE(); + void PRINT_HSCORE(byte *objectData, int a2, int a3, int a4); + void IMPRIMESCORE(); + int DEP_BALLE(); + void VERIFBRIQUES(); +public: + ComputerManager(); + void setParent(HopkinsEngine *vm); + + /** + * Show Hopkin's computer + * @param mode Display mode + */ + void COMPUT_HOPKINS(int mode); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_COMPUTER_H */ diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 81ca05b236..d8c55124a3 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -133,6 +133,10 @@ void EventsManager::MOUSE_ON() { CursorMan.showMouse(true); } +void EventsManager::MOUSE_ON1() { + MOUSE_ON(); +} + // Change Mouse Cursor void EventsManager::CHANGE_MOUSE(int id) { int cursorId = id; @@ -239,6 +243,27 @@ void EventsManager::handleKey(Common::Event &event) { } +int EventsManager::keywin() { + Common::Event event; + + while (!_vm->shouldQuit()) { + _vm->_soundManager.checkSounds(); + checkForNextFrameCounter(); + + // Handle pending events looking for keypress events + while (g_system->getEventManager()->pollEvent(event)) { + if (event.type == Common::EVENT_KEYDOWN) + return event.kbd.ascii; + } + + // Slight delay been checks to avoid maxing CPU usage + g_system->delayMillis(10); + } + + // Game is quitting + return -1; +} + void EventsManager::VBL() { int v1; int v2; diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 158e08c8de..25bd60b510 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -79,12 +79,39 @@ public: int YMOUSE(); int BMOUSE(); void MOUSE_ON(); + void MOUSE_ON1(); void MOUSE_OFF(); void CHANGE_MOUSE(int id); void CONTROLE_MES(); void delay(int delay); void VBL(); + + /** + * Waits for a keypress, ignoring mouse events + * @return Keypress, or -1 if game quit was requested + */ + int keywin(); + + /** + * Unused by engine + */ + void videkey() { } + + /** + * Unused by engine + */ + void CASSE_SOURIS_ON() { } + + /** + * Unused by engine + */ + void CASSE_SOURIS_OFF() { } + + void wingetch() { + // TODO + warning("TODO: wingetch"); + } }; } // End of namespace Hopkins diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 651d0d40f5..2b38bdb900 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -481,17 +481,79 @@ LABEL_57: } } -void FontManager::TEXT_NOW1(int xp, int yp, const Common::String &message, int colour) { +void FontManager::TEXT_NOW(int xp, int yp, const Common::String &message, int col) { + const char *srcP; + char currChar; + int charIndex; + + srcP = message.c_str(); + for (;;) { + currChar = *srcP++; + if (!currChar) + break; + if (currChar >= 32) { + charIndex = currChar - 32; + _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, + xp, yp, currChar - 32, col); + xp += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, charIndex); + } + } + _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, xp, yp + 12); +} + + +void FontManager::TEXT_NOW1(int xp, int yp, const Common::String &message, int col) { for (uint idx = 0; idx < message.size(); ++idx) { char currentChar = message[idx]; if (currentChar > 31) { int characterIndex = currentChar - 32; _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, - xp, yp, characterIndex, colour); + xp, yp, characterIndex, col); xp += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, characterIndex); } } } +void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col) { + const char *srcP; + int v5; + int v6; + byte v7; + char v8; + int v9; + + srcP = msg.c_str(); + v9 = xp; + v8 = col; + do { + v7 = *srcP++; + if (v7 == '&') { + v8 = 2; + v7 = *srcP++; + } + if (v7 == '$') { + v8 = 4; + v7 = *srcP++; + } + if (!v7) + break; + if (v7 >= 32) { + v5 = v7 - 32; + _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, v9, yp, v7 - 32, v8); + v9 += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, v5); + v6 = _vm->_objectsManager.Get_Largeur(_vm->_globals.police, v5); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v9 - v6, yp, v9, yp + 12); + if (_vm->_eventsManager.ESC_KEY) { + _vm->_globals.iRegul = 1; + _vm->_eventsManager.VBL(); + } else { + _vm->_globals.iRegul = 4; + _vm->_eventsManager.VBL(); + _vm->_globals.iRegul = 1; + } + } + } while (v7); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 90201902a6..a2ae88a028 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -80,7 +80,10 @@ public: void OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4); void DOS_TEXT(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int a8, int a9, int a10); void BOITE(int idx, int messageId, const Common::String &filename, int xp, int yp); - void TEXT_NOW1(int xp, int yp, const Common::String &message, int colour); + + void TEXT_NOW(int xp, int yp, const Common::String &message, int col); + void TEXT_NOW1(int xp, int yp, const Common::String &message, int col); + void TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col); }; } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 8af5792389..10d9e996da 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -181,6 +181,29 @@ void GraphicsManager::LOAD_IMAGE(const Common::String &file) { INIT_TABLE(165, 170, Palette); } + +void GraphicsManager::LOAD_IMAGEVGA(const Common::String &file) { + SCANLINE(SCREEN_WIDTH); + DD_Lock(); + Cls_Video(); + DD_Unlock(); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, file); + A_PCX320(VESA_SCREEN, _vm->_globals.NFICHIER, Palette); + memcpy(VESA_BUFFER, VESA_SCREEN, 0xFA00u); + _vm->_eventsManager.souris_max(); + SCANLINE(320); + max_x = 320; + + DD_Lock(); + if (Winbpp == 1) + CopyAsm(VESA_BUFFER); + if (Winbpp == 2) + CopyAsm16(VESA_BUFFER); + DD_Unlock(); + + FADE_IN_CASSE(); +} + // Load Screen void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { bool flag; @@ -365,6 +388,88 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by f.close(); } +void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte *palette) { + size_t filesize; + int v4; + size_t v5; + int v6; + size_t v7; + int v8; + byte v9; + int v10; + int v11; + char v12; + int v15; + int v16; + int32 v17; + byte *ptr; + Common::File f; + + if (!f.open(file)) + error("File not found - %s", file.c_str()); + + filesize = f.size(); + + f.read(surface, 0x80u); + v4 = filesize - 896; + ptr = _vm->_globals.dos_malloc2(0xFE00u); + if (v4 >= 0xFA00) { + v15 = v4 / 0xFA00 + 1; + v17 = 64000 * (v4 / 0xFA00) - v4; + if (((uint32)v17 & 0x80000000u) != 0) + v17 = -v17; + f.read(ptr, 0xFA00u); + v5 = 64000; + } else { + v15 = 1; + v17 = v4; + f.read(ptr, v4); + v5 = v4; + } + v16 = v15 - 1; + v6 = 0; + v7 = 0; + do { + if (v7 == v5) { + v7 = 0; + --v16; + v5 = 64000; + if (!v16) + v5 = v17; + v8 = v6; + f.read(ptr, v5); + v6 = v8; + } + v9 = *(ptr + v7++); + if (v9 > 0xC0u) { + v10 = v9 - 192; + if (v7 == v5) { + v7 = 0; + --v16; + v5 = 64000; + if (v16 == 1) + v5 = v17; + v11 = v6; + f.read(ptr, v5); + v6 = v11; + } + v12 = *(ptr + v7++); + do { + *(surface + v6++) = v12; + --v10; + } while (v10); + } else { + *(surface + v6++) = v9; + } + } while (v6 <= 0xF9FF); + + f.seek(filesize - 768); + f.read(palette, 0x300u); + f.close(); + + _vm->_globals.dos_free2(ptr); +} + // Clear Palette void GraphicsManager::Cls_Pal() { Common::fill(&cmap[0], &cmap[PALETTE_BLOCK_SIZE], 0); @@ -855,9 +960,9 @@ void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surfa } void GraphicsManager::SETCOLOR(int palIndex, int r, int g, int b) { - _vm->_graphicsManager.Palette[palIndex * 3] = 255 * r / 100; - _vm->_graphicsManager.Palette[palIndex * 3 + 1] = 255 * g / 100; - _vm->_graphicsManager.Palette[palIndex * 3 + 2] = 255 * b / 100; + Palette[palIndex * 3] = 255 * r / 100; + Palette[palIndex * 3 + 1] = 255 * g / 100; + Palette[palIndex * 3 + 2] = 255 * b / 100; setpal_vga256(Palette); } @@ -940,6 +1045,30 @@ void GraphicsManager::FADE_INW_LINUX(const byte *surface) { fade_in(Palette, FADESPD, surface); } +void GraphicsManager::FADE_IN_CASSE() { + setpal_vga256(Palette); + if (Winbpp == 2) { + DD_Lock(); + CopyAsm16(VESA_BUFFER); + DD_Unlock(); + } + DD_VBL(); +} + +void GraphicsManager::FADE_OUT_CASSE() { + byte palette[PALETTE_EXT_BLOCK_SIZE]; + + memset(palette, 0, PALETTE_EXT_BLOCK_SIZE); + setpal_vga256(palette); + + if (Winbpp == 2) { + DD_Lock(); + CopyAsm16(VESA_BUFFER); + DD_Unlock(); + } + DD_VBL(); +} + void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) { int rleValue; int destOffset; @@ -1523,6 +1652,22 @@ void GraphicsManager::Affiche_Segment_Vesa() { SDL_NBLOCS = 0; } +void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx) { + int height, width; + + width = _vm->_objectsManager.Get_Largeur(objectData, idx); + height = _vm->_objectsManager.Get_Hauteur(objectData, idx); + if (*objectData == 78) { + Affiche_Perfect(VESA_SCREEN, objectData, xp + 300, yp + 300, idx, 0, 0, 0); + Affiche_Perfect(VESA_BUFFER, objectData, xp + 300, yp + 300, idx, 0, 0, 0); + } else { + Sprite_Vesa(VESA_BUFFER, objectData, xp + 300, yp + 300, idx); + Sprite_Vesa(VESA_SCREEN, objectData, xp + 300, yp + 300, idx); + } + if (!_vm->_globals.NO_VISU) + Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height); +} + void GraphicsManager::CopyAsm(const byte *surface) { const byte *srcP; byte srcByte; @@ -1565,6 +1710,48 @@ void GraphicsManager::CopyAsm(const byte *surface) { } while (yCtr); } +void GraphicsManager::CopyAsm16(const byte *surface) { + const byte *v1; + byte *v2; + int v3; + signed int v4; + byte *v5; + uint16 *v6; + int v; + uint16 *v8; + int v9; + byte *v10; + const byte *v11; + + assert(VideoPtr); + v1 = surface; + v2 = 30 * WinScan + (byte *)VideoPtr->pixels; + v3 = 200; + do { + v11 = v1; + v10 = v2; + v4 = 320; + v9 = v3; + v5 = PAL_PIXELS; + do { + v = 2 * *v1; + v6 = (uint16 *)(v5 + 2 * *v1); + v = *v6; + *v2 = *v6; + *(v2 + 1) = v; + v8 = (uint16 *)(WinScan + v2); + *v8 = v; + *(v8 + 1) = v; + ++v1; + v2 = (byte *)v8 - WinScan + 4; + --v4; + } while (v4); + v1 = v11 + 320; + v2 = WinScan * 2 + v10; + v3 = v9 - 1; + } while (v9 != 1); +} + void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height) { byte *destP; int yNext; @@ -2256,7 +2443,7 @@ void GraphicsManager::NB_SCREEN() { Trans_bloc2(VESA_BUFFER, TABLE_COUL, 307200); if (nbrligne == 1280) Trans_bloc2(VESA_BUFFER, TABLE_COUL, 614400); - _vm->_graphicsManager.DD_Lock(); + DD_Lock(); if (Winbpp == 2) { if (SDL_ECHELLE) m_scroll16A(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -2269,7 +2456,7 @@ void GraphicsManager::NB_SCREEN() { else m_scroll2(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - _vm->_graphicsManager.DD_Unlock(); + DD_Unlock(); destP = VESA_SCREEN; srcP = VESA_BUFFER; @@ -2413,5 +2600,4 @@ void GraphicsManager::Plot_Vline(byte *surface, int xp, int yp, int height, byte } while (yCtr); } - } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index e29ede718e..22b8e9f290 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -116,11 +116,13 @@ public: void DD_UNLOCK() { DD_Unlock(); } void Cls_Video(); void LOAD_IMAGE(const Common::String &file); + void LOAD_IMAGEVGA(const Common::String &file); void INIT_TABLE(int minIndex, int maxIndex, byte *palette); int SCROLL_ECRAN(int amount); void Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold); void Trans_bloc2(byte *surface, byte *col, int size); void A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag); + void A_PCX320(byte *surface, const Common::String &file, byte *palette); void Cls_Pal(); void SCANLINE(int pitch); void m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); @@ -138,6 +140,8 @@ public: void FADE_OUTW(); void FADE_OUTW_LINUX(const byte *surface); void FADE_INW_LINUX(const byte *surface); + void FADE_IN_CASSE(); + void FADE_OUT_CASSE(); void setpal_vga256(const byte *palette); void setpal_vga256_linux(const byte *palette, const byte *surface); void SETCOLOR(int palIndex, int r, int g, int b); @@ -169,7 +173,9 @@ public: void Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2); int Magic_Number(int v); void Affiche_Segment_Vesa(); + void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx); void CopyAsm(const byte *surface); + void CopyAsm16(const byte *surface); void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); int Reel_Zoom(int v, int percentage); int Reel_Reduc(int v, int percentage); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 1ea8f1f5db..d19d074634 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -41,6 +41,7 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe g_vm = this; _debugger.setParent(this); _animationManager.setParent(this); + _computerManager.setParent(this); _dialogsManager.setParent(this); _eventsManager.setParent(this); _fileManager.setParent(this); @@ -443,7 +444,7 @@ LABEL_124: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 113; *((byte *)_globals.SAUVEGARDE + 5) = 113; - _menuManager.COMPUT_HOPKINS(1); + _computerManager.COMPUT_HOPKINS(1); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); @@ -460,7 +461,7 @@ LABEL_124: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 114; *((byte *)_globals.SAUVEGARDE + 5) = 114; - _menuManager.COMPUT_HOPKINS(2); + _computerManager.COMPUT_HOPKINS(2); goto LABEL_128; } if (_globals.SORTIE == 115) { @@ -469,7 +470,7 @@ LABEL_124: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 115; *((byte *)_globals.SAUVEGARDE + 5) = 115; - _menuManager.COMPUT_HOPKINS(3); + _computerManager.COMPUT_HOPKINS(3); LABEL_128: _graphicsManager.DD_Lock(); @@ -1271,7 +1272,7 @@ LABEL_239: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 113; *((byte *)_globals.SAUVEGARDE + 5) = 113; - _menuManager.COMPUT_HOPKINS(1); + _computerManager.COMPUT_HOPKINS(1); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -1287,7 +1288,7 @@ LABEL_239: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 114; *((byte *)_globals.SAUVEGARDE + 5) = 114; - _menuManager.COMPUT_HOPKINS(2); + _computerManager.COMPUT_HOPKINS(2); goto LABEL_243; } switch (_globals.SORTIE) { @@ -1297,7 +1298,7 @@ LABEL_239: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 115; *((byte *)_globals.SAUVEGARDE + 5) = 115; - _menuManager.COMPUT_HOPKINS(3); + _computerManager.COMPUT_HOPKINS(3); LABEL_243: _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 6b210fffed..73e57d336b 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -32,6 +32,7 @@ #include "engines/engine.h" #include "graphics/surface.h" #include "hopkins/anim.h" +#include "hopkins/computer.h" #include "hopkins/debugger.h" #include "hopkins/dialogs.h" #include "hopkins/events.h" @@ -115,6 +116,7 @@ protected: public: Debugger _debugger; AnimationManager _animationManager; + ComputerManager _computerManager; DialogsManager _dialogsManager; EventsManager _eventsManager; FontManager _fontManager; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 56b73c1fa1..b8ec31d67c 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -233,202 +233,6 @@ int MenuManager::MENU() { return result; } -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 = (byte)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 (v12ii == 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 58788fca46..5c174815ff 100644 --- a/engines/hopkins/menu.h +++ b/engines/hopkins/menu.h @@ -40,7 +40,6 @@ public: void setParent(HopkinsEngine *vm); int MENU(); - void COMPUT_HOPKINS(int a1); }; } // End of namespace Hopkins diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index 109104f229..5c1a7dd478 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -2,6 +2,7 @@ MODULE := engines/hopkins MODULE_OBJS := \ anim.o \ + computer.o \ debugger.o \ detection.o \ dialogs.o \ diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 13979c5cd8..519d43b05a 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -575,6 +575,33 @@ void SoundManager::CHARGE_SAMPLE(int wavIndex, const Common::String &file) { } } +void SoundManager::PLAY_SAMPLE(int wavIndex, int voiceMode) { + if (CARD_SB && !SOUNDOFF && SOUND[wavIndex]._active) { + if (SOUND_FLAG) + DEL_NWAV(SOUND_NUM); + if (voiceMode == 5) { + if (VOICE_STAT(1) == 1) + STOP_VOICE(1); + PLAY_SAMPLE_SDL(1, wavIndex); + } + if (voiceMode == 6) { + if (VOICE_STAT(2) == 1) + STOP_VOICE(1); + PLAY_SAMPLE_SDL(2, wavIndex); + } + if (voiceMode == 7) { + if (VOICE_STAT(3) == 1) + STOP_VOICE(1); + PLAY_SAMPLE_SDL(3, wavIndex); + } + if (voiceMode == 8) { + if (VOICE_STAT(1) == 1) + STOP_VOICE(1); + PLAY_SAMPLE_SDL(1, wavIndex); + } + } +} + void SoundManager::PLAY_SAMPLE2(int idx) { if (CARD_SB && !SOUNDOFF && SOUND[idx]._active) { if (SOUND_FLAG) diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 36184715ba..fa0a5419a2 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -157,6 +157,7 @@ public: void MODSetVoiceVolume(); void MODSetMusicVolume(int volume); void CHARGE_SAMPLE(int wavIndex, const Common::String &file); + void PLAY_SAMPLE(int wavIndex, int voiceMode); void PLAY_SAMPLE2(int idx); void PLAY_WAV(int wavIndex); |