From 79dd91803338380c62a6a1aa2ba3dd0690e565be Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Mar 2012 09:46:51 +0100 Subject: MORTEVIELLE: regroup several files --- engines/mortevielle/actions.cpp | 5 +- engines/mortevielle/dialogs.cpp | 4 +- engines/mortevielle/level15.cpp | 166 ------- engines/mortevielle/level15.h | 47 -- engines/mortevielle/menu.cpp | 2 +- engines/mortevielle/module.mk | 6 +- engines/mortevielle/mor.cpp | 916 +++++++++++++++++++++++++++++++++++- engines/mortevielle/mor.h | 62 ++- engines/mortevielle/mor2.cpp | 821 -------------------------------- engines/mortevielle/mor2.h | 87 ---- engines/mortevielle/mortevielle.cpp | 5 +- engines/mortevielle/outtext.cpp | 226 ++++++++- engines/mortevielle/outtext.h | 5 + engines/mortevielle/ovd1.cpp | 7 +- engines/mortevielle/parole.cpp | 454 ------------------ engines/mortevielle/parole.h | 48 -- engines/mortevielle/parole2.cpp | 124 ----- engines/mortevielle/parole2.h | 40 -- engines/mortevielle/prog.cpp | 2 - engines/mortevielle/saveload.cpp | 1 - engines/mortevielle/speech.cpp | 543 +++++++++++++++++++++ engines/mortevielle/speech.h | 53 +++ engines/mortevielle/taffich.cpp | 261 ---------- engines/mortevielle/taffich.h | 41 -- 24 files changed, 1799 insertions(+), 2127 deletions(-) delete mode 100644 engines/mortevielle/level15.cpp delete mode 100644 engines/mortevielle/level15.h delete mode 100644 engines/mortevielle/mor2.cpp delete mode 100644 engines/mortevielle/mor2.h delete mode 100644 engines/mortevielle/parole.cpp delete mode 100644 engines/mortevielle/parole.h delete mode 100644 engines/mortevielle/parole2.cpp delete mode 100644 engines/mortevielle/parole2.h create mode 100644 engines/mortevielle/speech.cpp create mode 100644 engines/mortevielle/speech.h delete mode 100644 engines/mortevielle/taffich.cpp delete mode 100644 engines/mortevielle/taffich.h (limited to 'engines/mortevielle') diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 6733d24117..5f511fc7ee 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -28,15 +28,12 @@ #include "common/scummsys.h" #include "mortevielle/actions.h" #include "mortevielle/dialogs.h" -#include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" -#include "mortevielle/mor2.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/parole2.h" -#include "mortevielle/taffich.h" +#include "mortevielle/speech.h" #include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 754e0141c3..b37e0a53c5 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -28,13 +28,11 @@ #include "common/str.h" #include "mortevielle/dialogs.h" #include "mortevielle/keyboard.h" -#include "mortevielle/level15.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mor.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/parole2.h" -#include "mortevielle/taffich.h" +#include "mortevielle/speech.h" namespace Mortevielle { diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp deleted file mode 100644 index 17f4943d75..0000000000 --- a/engines/mortevielle/level15.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/system.h" -#include "common/file.h" -#include "mortevielle/graphics.h" -#include "mortevielle/level15.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/mouse.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -/* NIVEAU 15 */ -void copcha() { - int i = acha; - do { - g_tabdon[i] = g_tabdon[i + 390]; - ++i; - } while (i != acha + 390); -} - -/** - * Engine function : Is mouse in a given rect? - * @remarks Originally called 'dans_rect' - */ -bool isMouseIn(rectangle r) { - int x, y, c; - - getMousePos(x, y, c); - if ((x > r._x1) && (x < r._x2) && (y > r._y1) && (y < r._y2)) - return true; - - return false; -} - -void outbloc(int n, pattern p, nhom *pal) { - int ad = n * 404 + 0xd700; - - WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad], p._tax); - WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad + 2], p._tay); - ad += 4; - for (int i = 1; i <= p._tax; ++i) { - for (int j = 1; j <= p._tay; ++j) - g_mem[(0x6000 * 16) + ad + (j - 1) * p._tax + i - 1] = pal[n]._hom[p._des[i][j]]; - } -} - -void writepal(int n) { - switch (g_vm->_currGraphicalDevice) { - case MODE_TANDY: - case MODE_EGA: - case MODE_AMSTRAD1512: - for (int i = 1; i <= 16; ++i) { - g_mem[(0x7000 * 16) + (2 * i)] = g_tabpal[n][i].x; - g_mem[(0x7000 * 16) + (2 * i) + 1] = g_tabpal[n][i].y; - } - break; - case MODE_CGA: { - warning("TODO: If this code is needed, resolve the incompatible types"); - nhom pal[16]; - for (int i = 0; i < 16; ++i) { - pal[i] = g_palcga[n]._a[i]; - } -// nhom pal[16] = palcga[n]._a; - if (n < 89) - palette(g_palcga[n]._p); - - for (int i = 0; i <= 15; ++i) - outbloc(i, g_tpt[pal[i]._id], pal); - } - break; - default: - break; - } -} - - -void pictout(int seg, int dep, int x, int y) { - GfxSurface surface; - surface.decode(&g_mem[seg * 16 + dep]); - - if (g_vm->_currGraphicalDevice == MODE_HERCULES) { - g_mem[0x7000 * 16 + 2] = 0; - g_mem[0x7000 * 16 + 32] = 15; - } - - if ((g_caff != 51) && (READ_LE_UINT16(&g_mem[0x7000 * 16 + 0x4138]) > 0x100)) - WRITE_LE_UINT16(&g_mem[0x7000 * 16 + 0x4138], 0x100); - - g_vm->_screenSurface.drawPicture(surface, x, y); -} - -void sauvecr(int y, int dy) { - hideMouse(); - s_sauv(g_vm->_currGraphicalDevice, y, dy); - showMouse(); -} - -void charecr(int y, int dy) { - hideMouse(); - s_char(g_vm->_currGraphicalDevice, y, dy); - showMouse(); -} - -void adzon() { - Common::File f; - - if (!f.open("don.mor")) - error("Missing file - don.mor"); - - f.read(g_tabdon, 7 * 256); - f.close(); - - if (!f.open("bmor.mor")) - error("Missing file - bmor.mor"); - - f.read(&g_tabdon[fleche], 1 * 1916); - f.close(); - - if (!f.open("dec.mor")) - error("Missing file - dec.mor"); - - f.read(&g_mem[0x73a2 * 16 + 0], 1 * 1664); - f.close(); -} - -/** - * Returns the offset within the compressed image data resource of the desired image - */ -int animof(int ouf, int num) { - int nani = g_mem[adani * 16 + 1]; - int aux = num; - if (ouf != 1) - aux += nani; - - int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&g_mem[adani * 16 + (aux << 1)]); - - return animof_result; -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/level15.h b/engines/mortevielle/level15.h deleted file mode 100644 index 2d7c0d47ae..0000000000 --- a/engines/mortevielle/level15.h +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_LEVEL15_H -#define MORTEVIELLE_LEVEL15_H - -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -/* NIVEAU 15 */ -extern void copcha(); -extern bool isMouseIn(rectangle r); -extern void outbloc(int n, pattern p, nhom *pal); -extern void writepal(int n); -extern void pictout(int seg, int dep, int x, int y); -extern void sauvecr(int y, int dy); -extern void charecr(int y, int dy); -extern void adzon(); -extern int animof(int ouf, int num); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 22bf269b56..6604b1bee5 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -28,8 +28,8 @@ #include "common/scummsys.h" #include "common/str.h" #include "common/textconsole.h" -#include "mortevielle/level15.h" #include "mortevielle/menu.h" +#include "mortevielle/mor.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 16f56bc5b0..103a4fcd4e 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -7,20 +7,16 @@ MODULE_OBJS := \ dialogs.o \ graphics.o \ keyboard.o \ - level15.o \ menu.o \ mor.o \ - mor2.o \ mortevielle.o \ mouse.o \ outtext.o \ ovd1.o \ - parole.o \ - parole2.o \ prog.o \ saveload.o \ sound.o \ - taffich.o \ + speech.o \ var_mor.o # This module can be built as a plugin diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index c8b5b7e39a..7c92d9aab0 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -26,31 +26,150 @@ */ #include "common/endian.h" +#include "common/file.h" #include "common/str.h" #include "common/system.h" #include "common/textconsole.h" #include "mortevielle/dialogs.h" #include "mortevielle/graphics.h" -#include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/parole2.h" +#include "mortevielle/speech.h" #include "mortevielle/var_mor.h" +#include "mortevielle/keyboard.h" + namespace Mortevielle { -// For ScummVM, we need to do check for file errors where we do the file access -const int ioresult = 0; +/* NIVEAU 15 */ +void copcha() { + int i = acha; + do { + g_tabdon[i] = g_tabdon[i + 390]; + ++i; + } while (i != acha + 390); +} + +/** + * Engine function : Is mouse in a given rect? + * @remarks Originally called 'dans_rect' + */ +bool isMouseIn(rectangle r) { + int x, y, c; + + getMousePos(x, y, c); + if ((x > r._x1) && (x < r._x2) && (y > r._y1) && (y < r._y2)) + return true; + + return false; +} + +void outbloc(int n, pattern p, nhom *pal) { + int ad = n * 404 + 0xd700; + + WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad], p._tax); + WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad + 2], p._tay); + ad += 4; + for (int i = 1; i <= p._tax; ++i) { + for (int j = 1; j <= p._tay; ++j) + g_mem[(0x6000 * 16) + ad + (j - 1) * p._tax + i - 1] = pal[n]._hom[p._des[i][j]]; + } +} + +void writepal(int n) { + switch (g_vm->_currGraphicalDevice) { + case MODE_TANDY: + case MODE_EGA: + case MODE_AMSTRAD1512: + for (int i = 1; i <= 16; ++i) { + g_mem[(0x7000 * 16) + (2 * i)] = g_tabpal[n][i].x; + g_mem[(0x7000 * 16) + (2 * i) + 1] = g_tabpal[n][i].y; + } + break; + case MODE_CGA: { + warning("TODO: If this code is needed, resolve the incompatible types"); + nhom pal[16]; + for (int i = 0; i < 16; ++i) { + pal[i] = g_palcga[n]._a[i]; + } +// nhom pal[16] = palcga[n]._a; + if (n < 89) + palette(g_palcga[n]._p); + + for (int i = 0; i <= 15; ++i) + outbloc(i, g_tpt[pal[i]._id], pal); + } + break; + default: + break; + } +} + -void testfi() { - if (ioresult != 0) { - // Theoritical message - warning("IO Error"); - g_vm->quitGame(); +void pictout(int seg, int dep, int x, int y) { + GfxSurface surface; + surface.decode(&g_mem[seg * 16 + dep]); + + if (g_vm->_currGraphicalDevice == MODE_HERCULES) { + g_mem[0x7000 * 16 + 2] = 0; + g_mem[0x7000 * 16 + 32] = 15; } + + if ((g_caff != 51) && (READ_LE_UINT16(&g_mem[0x7000 * 16 + 0x4138]) > 0x100)) + WRITE_LE_UINT16(&g_mem[0x7000 * 16 + 0x4138], 0x100); + + g_vm->_screenSurface.drawPicture(surface, x, y); +} + +void sauvecr(int y, int dy) { + hideMouse(); + s_sauv(g_vm->_currGraphicalDevice, y, dy); + showMouse(); +} + +void charecr(int y, int dy) { + hideMouse(); + s_char(g_vm->_currGraphicalDevice, y, dy); + showMouse(); +} + +void adzon() { + Common::File f; + + if (!f.open("don.mor")) + error("Missing file - don.mor"); + + f.read(g_tabdon, 7 * 256); + f.close(); + + if (!f.open("bmor.mor")) + error("Missing file - bmor.mor"); + + f.read(&g_tabdon[fleche], 1 * 1916); + f.close(); + + if (!f.open("dec.mor")) + error("Missing file - dec.mor"); + + f.read(&g_mem[0x73a2 * 16 + 0], 1 * 1664); + f.close(); +} + +/** + * Returns the offset within the compressed image data resource of the desired image + */ +int animof(int ouf, int num) { + int nani = g_mem[adani * 16 + 1]; + int aux = num; + if (ouf != 1) + aux += nani; + + int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&g_mem[adani * 16 + (aux << 1)]); + + return animof_result; } /** @@ -1527,4 +1646,783 @@ void dessin(int ad) { } } +void tinke() { + Common::String d1 = g_vm->getEngineString(S_SHOULD_HAVE_NOTICED); + Common::String d2 = g_vm->getEngineString(S_NUMBER_OF_HINTS); + const char d3 = '['; + const char d4 = ']'; + const char d5 = '1'; + Common::String d6 = g_vm->getEngineString(S_OK); + int cx, cf, day, hour, minute; + Common::String stpo; + + g_vm->_anyone = false; + updateHour(day, hour, minute); + if (day != g_day) { + g_day = day; + cx = 0; + do { + ++cx; + if (g_nbrepm[cx] != 0) + --g_nbrepm[cx]; + g_nbrep[cx] = 0; + } while (cx != 8); + } + if ((hour > g_hour) || ((hour == 0) && (g_hour == 23))) { + g_hour = hour; + g_minute = 0; + drawClock(); + cf = 0; + for (cx = 1; cx <= 10; ++cx) { + if (g_s._pourc[cx] == '*') + ++cf; + } + + if (cf == 10) + stpo = "10"; + else + stpo = chr(cf + 48); + + g_hintPctMessage = Common::String(d3); + g_hintPctMessage += d5; + g_hintPctMessage += d4; + g_hintPctMessage += d3; + g_hintPctMessage += d1; + g_hintPctMessage += stpo; + g_hintPctMessage += '0'; + g_hintPctMessage += d2; + g_hintPctMessage += d4; + g_hintPctMessage += d3; + g_hintPctMessage += d6; + g_hintPctMessage += d4; + } + if (minute > g_minute) { + g_minute = 30; + drawClock(); + } + if (y_s < 12) + return; + + if (!g_vm->_blo) { + if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) + g_t = kTime2; + else + g_t = kTime1; + cf = g_s._faithScore; + if ((cf > 33) && (cf < 66)) + g_t -= (g_t / 3); + + if (cf > 65) + g_t -= ((g_t / 3) * 2); + + int nh = readclock(); + if ((nh - g_mh) > g_t) { + bool activeMenu = g_vm->_menu._menuActive; + g_vm->_menu.eraseMenu(); + g_jh += ((nh - g_mh) / g_t); + g_mh = nh; + switch (g_li) { + case 1: + case 4 : + pl1(cf); + break; + case 2 : + pl2(cf); + break; + case 5 : + pl5(cf); + break; + case 6: + case 8 : + pl6(cf); + break; + case 9 : + pl9(cf); + break; + case 10 : + pl10(cf); + break; + case 11 : + pl11(cf); + break; + case 12 : + pl12(cf); + break; + case 13: + case 14 : + pl13(cf); + break; + case 15: + case 26 : + pl15(cf); + break; + case 20 : + pl20(cf); + break; + } + if ((g_mpers != 0) && (g_ipers != 10)) + g_mpers = g_ipers; + + if ((g_mpers == 0) && (g_ipers > 0)) { + if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) { + cavegre(); + } else if (g_ipers == 10) { + g_ipers = 0; + if (!g_vm->_brt) { + g_vm->_brt = true; + g_hdb = readclock(); + if (getRandomNumber(1, 5) < 5) { + clsf3(); + ecrf2(); + ecr3(g_vm->getEngineString(S_HEAR_NOISE)); + int rand = (getRandomNumber(0, 4)) - 2; + startSpeech(1, rand, 1); + clsf3(); + } + } + } + } + + if (activeMenu) + g_vm->_menu.drawMenu(); + } + } + g_hfb = readclock(); + if ((g_vm->_brt) && ((g_hfb - g_hdb) > 17)) { + cx = nouvp(g_li); + g_vm->_brt = false; + g_hdb = 0; + if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) + g_vm->_anyone = true; + } +} + +void fenat(char ans) { + int coul; + + hideMouse(); + if (g_vm->_currGraphicalDevice == MODE_CGA) + coul = 2; + else if (g_vm->_currGraphicalDevice == MODE_HERCULES) + coul = 1; + else + coul = 12; + + g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); + g_vm->_screenSurface.drawBox(300, 191, 16, 8, 15); + showMouse(); +} + + +/* NIVEAU 8 */ +void afdes(int ad) { + taffich(); + dessin(ad); + g_vm->_okdes = false; +} + +void tkey1(bool d) { + bool quest; + int x, y, c; + + hideMouse(); + fenat('K'); + + // Wait for release from any key or mouse button + while (keypressed()) + g_key = testou(); + do { + getMousePos(x, y, c); + keypressed(); + } while (c != 0); + + // Event loop + do { + if (d) + tinke(); + quest = keypressed(); + getMousePos(x, y, c); + CHECK_QUIT; + } while (!(quest || (c != 0) || (d && g_vm->_anyone))); + if (quest) + testou(); + g_vm->setMouseClick(false); + showMouse(); +} + +void tmlieu(int roomId) { + Common::String nomp; + + if (roomId == 26) + roomId = 15; + + int i = 1; + while ((i < 8) && (g_v_lieu[i][roomId] != 0)) { + nomp = deline(g_v_lieu[i][roomId] + kMenuPlaceStringIndex); + while (nomp.size() < 20) + nomp += ' '; + g_vm->_menu.setText(g_vm->_menu._moveMenu[i], nomp); + ++i; + } + nomp = "* "; + for (int cx = 7; cx >= i; --cx) + g_vm->_menu.setText(g_vm->_menu._moveMenu[cx], nomp); +} + + +/* NIVEAU 7 */ +void tlu(int af, int ob) { + g_caff = 32; + afdes(0); + repon(6, ob + 4000); + repon(2, 999); + tkey1(true); + g_caff = af; + g_msg[3] = OPCODE_NONE; + g_crep = 998; +} + +void affrep() { + g_caff = g_s._currPlace; + g_crep = g_s._currPlace; +} + +/** + * Engine function - Switch action menu from "Search" mode back to normal mode + * @remarks Originally called 'mfouen' + */ +void unsetSearchMenu() { + tmlieu(g_s._currPlace); + for (int cx = 1; cx <= 11; ++cx) + g_vm->_menu.enableMenuItem(_actionMenu[cx]); + + g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); + g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); +} + +/* NIVEAU 6 */ + +void tperd() { + initouv(); + g_ment = 0; + g_iouv = 0; + g_mchai = 0; + unsetSearchMenu(); + if (!g_vm->_blo) + t11(21); + + g_vm->_loseGame = true; + clsf1(); + g_vm->_screenSurface.drawBox(60, 35, 400, 50, 15); + repon(9, g_crep); + clearScreenType2(); + clsf3(); + g_vm->_col = false; + g_vm->_syn = false; + g_vm->_okdes = false; +} + +void tsort() { + + if ((g_iouv > 0) && (g_s._currPlace != 0)) { + if (g_s._faithScore < 50) + g_s._faithScore += 2; + else + g_s._faithScore += (g_s._faithScore / 10); + } + + for (int cx = 1; cx <= 7; ++cx) + g_touv[cx] = chr(0); + g_ment = 0; + g_iouv = 0; + g_mchai = 0; + debloc(g_s._currPlace); +} + +void st4(int ob) { + g_crep = 997; + + switch (ob) { + case 114 : + g_crep = 109; + break; + case 110 : + g_crep = 107; + break; + case 158 : + g_crep = 113; + break; + case 152: + case 153: + case 154: + case 155: + case 156: + case 150: + case 100: + case 157: + case 160: + case 161 : + tlu(g_caff, ob); + break; + default: + break; + } +} + +void cherjer(int ob, bool &d) { + int cx; + + d = false; + for (cx = 1; cx <= 6; ++cx) + d = (d || (ord(g_s._sjer[cx]) == ob)); + + if (g_s._selectedObjectId == ob) + d = true; +} + +void st1sama() { + g_s._currPlace = DINING_ROOM; + affrep(); +} + +void modinv() { + int r; + Common::String nomp; + + int cy = 0; + for (int cx = 1; cx <= 6; ++cx) + if (g_s._sjer[cx] != chr(0)) { + ++cy; + r = (ord(g_s._sjer[cx]) + 400); + nomp = deline(r - 501 + kInventoryStringIndex); + g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp); + g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[cx]); + } + if (cy < 6) + for (int cx = cy + 1; cx <= 6; ++cx) { + g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cx], " "); + g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[cx]); + } +} + +void sparl(float adr, float rep) { + const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; + int key, repint; + + repint = abs((int)rep); + hideMouse(); + Common::String tmpStr = deline(repint + kDialogStringIndex); + displayStr(tmpStr, 230, 4, 65, 24, 5); + f3f8::draw(); + + key = 0; + do { + startSpeech(repint, haut[g_caff - 69], 0); + f3f8::waitForF3F8(key); + CHECK_QUIT; + } while (key != 66); + hirs(); + showMouse(); +} + +/** + * Engine function - End of Search: reset globals + * @remarks Originally called 'finfouill' + */ +void endSearch() { + g_vm->_heroSearching = false; + g_vm->_obpart = false; + g_cs = 0; + g_is = 0; + unsetSearchMenu(); +} + +/** + * Engine function - Switch action menu to "Search" mode + * @remarks Originally called 'mfoudi' + */ +void setSearchMenu() { + for (int cx = 1; cx <= 7; ++cx) + g_vm->_menu.disableMenuItem(g_vm->_menu._moveMenu[cx]); + + for (int cx = 1; cx <= 11; ++cx) + g_vm->_menu.disableMenuItem(_actionMenu[cx]); + + g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); + g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); +} + +void mennor() { + g_vm->_menu.menuUp(g_msg[3]); +} + +void premtet() { + dessine(g_ades, 10, 80); + g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15); +} + +/* NIVEAU 5 */ +void ajchai() { + int cy = acha + ((g_mchai - 1) * 10) - 1; + int cx = 0; + do { + ++cx; + } while ((cx <= 9) && (g_tabdon[cy + cx] != 0)); + + if (g_tabdon[cy + cx] == 0) + g_tabdon[cy + cx] = g_s._selectedObjectId; + else + g_crep = 192; +} + +void ajjer(int ob) { + int cx = 0; + do { + ++cx; + } while ((cx <= 5) && (ord(g_s._sjer[cx]) != 0)); + + if (ord(g_s._sjer[cx]) == 0) { + g_s._sjer[(cx)] = chr(ob); + modinv(); + } else + g_crep = 139; +} + +void t1sama() { //Entering manor + int day, hour, minute; + + updateHour(day, hour, minute); + if ((hour < 5) && (g_s._currPlace > 18)) { + bool d; + cherjer(137, d); + if (!d) { //You don't have the keys, and it's late + g_crep = 1511; + tperd(); + } else + st1sama(); + } else if (!g_s._ipre) { //Is it your first time? + g_ipers = 255; + showPeoplePresent(g_ipers); + g_caff = 77; + afdes(0); + g_vm->_screenSurface.drawBox(223, 47, 155, 91, 15); + repon(2, 33); + tkey1(false); + mennor(); + hideMouse(); + hirs(); + premtet(); + sparl(0, 140); + dessine_rouleau(); + drawClock(); + showMouse(); + g_s._currPlace = OWN_ROOM; + affrep(); + t5(10); + if (!g_vm->_blo) + minute = t11(0); + g_ipers = 0; + g_mpers = 0; + g_s._ipre = true; + } else + st1sama(); +} + +void t1vier() { + g_s._currPlace = SECRET_PASSAGE; + affrep(); +} + +void t1neig() { + ++g_inei; + if (g_inei > 2) { + g_crep = 1506; + tperd(); + } else { + g_vm->_okdes = true; + g_s._currPlace = MOUNTAIN; + affrep(); + } +} + +void t1deva() { + g_inei = 0; + g_s._currPlace = MANOR_FRONT; + affrep(); +} + +void t1derr() { + g_s._currPlace = MANOR_BACK; + affrep(); +} + +void t1deau() { + g_crep = 1503; + tperd(); +} + +void tctrm() { + repon(2, (3000 + g_ctrm)); + g_ctrm = 0; +} + + +void quelquun() { + if (g_vm->_menu._menuDisplayed) + g_vm->_menu.eraseMenu(); + + endSearch(); + g_crep = 997; +L1: + if (!g_vm->_hiddenHero) { + if (g_crep == 997) + g_crep = 138; + repon(2, g_crep); + if (g_crep == 138) + startSpeech(5, 2, 1); + else + startSpeech(4, 4, 1); + + if (g_iouv == 0) + g_s._faithScore += 2; + else if (g_s._faithScore < 50) + g_s._faithScore += 4; + else + g_s._faithScore += 3 * (g_s._faithScore / 10); + tsort(); + tmlieu(15); + int cx = convertBitIndexToCharacterIndex(g_ipers); + g_caff = 69 + cx; + g_crep = g_caff; + g_msg[3] = MENU_DISCUSS; + g_msg[4] = g_vm->_menu._discussMenu[cx]; + g_vm->_syn = true; + g_vm->_col = true; + } else { + if (getRandomNumber(1, 3) == 2) { + g_vm->_hiddenHero = false; + g_crep = 137; + goto L1; + } else { + repon(2, 136); + int rand = (getRandomNumber(0, 4)) - 2; + startSpeech(3, rand, 1); + clearScreenType2(); + displayAloneText(); + debloc(21); + affrep(); + } + } + if (g_vm->_menu._menuDisplayed) + g_vm->_menu.drawMenu(); +} + +void tsuiv() { + int tbcl; + int cl; + + int cy = acha + ((g_mchai - 1) * 10) - 1; + int cx = 0; + do { + ++cx; + ++g_cs; + cl = cy + g_cs; + tbcl = g_tabdon[cl]; + } while ((tbcl == 0) && (g_cs <= 9)); + + if ((tbcl != 0) && (g_cs < 11)) { + ++g_is; + g_caff = tbcl; + g_crep = g_caff + 400; + if (g_ipers != 0) + g_s._faithScore += 2; + } else { + affrep(); + endSearch(); + if (cx > 9) + g_crep = 131; + } +} + +void tfleche() { + bool qust; + char touch; + + if (g_num == 9999) + return; + + fenat(chr(152)); + bool inRect = false; + do { + touch = '\0'; + + do { + moveMouse(qust, touch); + CHECK_QUIT; + + if (g_vm->getMouseClick()) + inRect = (x_s < 256 * g_res) && (y_s < 176) && (y_s > 12); + tinke(); + } while (!(qust || inRect || g_vm->_anyone)); + + if (qust && (touch == '\103')) + Alert::show(g_hintPctMessage, 1); + } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (g_vm->_anyone) || (inRect))); + + if (touch == '\73') + g_vm->_keyPressedEsc = true; + + if (inRect) { + g_x = x_s; + g_y = y_s; + } +} + +void tcoord(int sx) { + int sy, ix, iy; + int ib; + + + g_num = 0; + g_crep = 999; + int a = 0; + int atdon = amzon + 3; + int cy = 0; + while (cy < g_caff) { + a += g_tabdon[atdon]; + atdon += 4; + ++cy; + } + + if (g_tabdon[atdon] == 0) { + g_crep = 997; + return; + } + + a += fleche; + int cb = 0; + for (cy = 0; cy <= (sx - 2); ++cy) { + ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)]; + cb += (ib * 4) + 2; + } + ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)]; + if (ib == 0) { + g_crep = 997; + return; + } + + cy = 1; + do { + cb += 2; + sx = g_tabdon[a + cb] * g_res; + sy = g_tabdon[(a + cb + 1)]; + cb += 2; + ix = g_tabdon[a + cb] * g_res; + iy = g_tabdon[(a + cb + 1)]; + ++cy; + } while (!(((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) || (cy > ib))); + + if ((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) { + g_num = cy - 1; + return; + } + + g_crep = 997; +} + + +void st7(int ob) { + switch (ob) { + case 116: + case 144: + g_crep = 104; + break; + case 126: + case 111: + g_crep = 108; + break; + case 132: + g_crep = 111; + break; + case 142: + g_crep = 112; + break; + default: + g_crep = 183; + st4(ob); + } +} + +void treg(int ob) { + int mdes = g_caff; + g_caff = ob; + + if (((g_caff > 29) && (g_caff < 33)) || (g_caff == 144) || (g_caff == 147) || (g_caff == 149) || (g_msg[4] == OPCODE_SLOOK)) { + afdes(0); + if ((g_caff > 29) && (g_caff < 33)) + repon(2, g_caff); + else + repon(2, g_caff + 400); + tkey1(true); + g_caff = mdes; + g_msg[3] = 0; + g_crep = 998; + } else { + g_vm->_obpart = true; + g_crep = g_caff + 400; + setSearchMenu(); + } +} + +void avpoing(int &ob) { + g_crep = 999; + if (g_s._selectedObjectId != 0) + ajjer(g_s._selectedObjectId); + + if (g_crep != 139) { + modobj(ob + 400); + g_s._selectedObjectId = ob; + ob = 0; + } +} + +void rechai(int &ch) { + int tmpPlace = g_s._currPlace; + + if (g_s._currPlace == CRYPT) + tmpPlace = CELLAR; + ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1]; +} + +void t23coul(int &l) { + bool d; + + cherjer(143, d); + l = 14; + if (!d) { + g_crep = 1512; + tperd(); + } +} + +void maivid() { + g_s._selectedObjectId = 0; + modobj(500); +} + +void st13(int ob) { + if ((ob == 114) || (ob == 116) || (ob == 126) || (ob == 132) || + (ob == 111) || (ob == 106) || (ob == 102) || (ob == 100) || + (ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) || + (ob == 156) || (ob == 157) || (ob == 144) || (ob == 158) || + (ob == 150) || (ob == 152)) + g_crep = 999; + else + g_crep = 105; +} + +void aldepl() { + Alert::show(g_vm->getEngineString(S_USE_DEP_MENU), 1); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 67c7bdd9a8..73f6df22b7 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -29,11 +29,21 @@ #define MORTEVIELLE_MOR_H #include "common/str.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { +/* NIVEAU 15 */ +extern void copcha(); +extern bool isMouseIn(rectangle r); +extern void outbloc(int n, pattern p, nhom *pal); +extern void writepal(int n); +extern void pictout(int seg, int dep, int x, int y); +extern void sauvecr(int y, int dy); +extern void charecr(int y, int dy); +extern void adzon(); +extern int animof(int ouf, int num); /* Niveau 14 suite */ -extern void testfi(); extern int readclock(); extern void modif(int &nu); extern void dessine(int ad, int x, int y); @@ -118,5 +128,55 @@ extern void musique(int so); /* NIVEAU 9 */ extern void dessin(int ad); +static const int _actionMenu[12] = { OPCODE_NONE, + OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, + OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, + OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE +}; + +extern void tinke(); +extern void fenat(char ans); +/* NIVEAU 8 */ +extern void afdes(int ad); +extern void tkey1(bool d); +extern void tmlieu(int roomId); +/* NIVEAU 7 */ +extern void tlu(int af, int ob); +extern void affrep(); +extern void unsetSearchMenu(); +/* NIVEAU 6 */ +extern void tperd(); +extern void tsort(); +extern void st4(int ob); +extern void cherjer(int ob, bool &d); +extern void st1sama(); +extern void modinv(); +extern void sparl(float adr, float rep); +extern void endSearch(); +extern void setSearchMenu(); +extern void mennor(); +extern void premtet(); +/* NIVEAU 5 */ +extern void ajchai(); +extern void ajjer(int ob); +extern void t1sama(); +extern void t1vier(); +extern void t1neig(); +extern void t1deva(); +extern void t1derr(); +extern void t1deau(); +extern void tctrm(); +extern void quelquun(); +extern void tsuiv(); +extern void tfleche(); +extern void tcoord(int sx); +extern void st7(int ob); +extern void treg(int ob); +extern void avpoing(int &ob); +extern void rechai(int &ch); +extern void t23coul(int &l); +extern void maivid(); +extern void st13(int ob); +extern void aldepl(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp deleted file mode 100644 index 380959e3c3..0000000000 --- a/engines/mortevielle/mor2.cpp +++ /dev/null @@ -1,821 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "mortevielle/mor2.h" -#include "mortevielle/dialogs.h" -#include "mortevielle/keyboard.h" -#include "mortevielle/menu.h" -#include "mortevielle/mor.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/mouse.h" -#include "mortevielle/outtext.h" -#include "mortevielle/parole2.h" -#include "mortevielle/taffich.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -void tinke() { - Common::String d1 = g_vm->getEngineString(S_SHOULD_HAVE_NOTICED); - Common::String d2 = g_vm->getEngineString(S_NUMBER_OF_HINTS); - const char d3 = '['; - const char d4 = ']'; - const char d5 = '1'; - Common::String d6 = g_vm->getEngineString(S_OK); - int cx, cf, day, hour, minute; - Common::String stpo; - - g_vm->_anyone = false; - updateHour(day, hour, minute); - if (day != g_day) { - g_day = day; - cx = 0; - do { - ++cx; - if (g_nbrepm[cx] != 0) - --g_nbrepm[cx]; - g_nbrep[cx] = 0; - } while (cx != 8); - } - if ((hour > g_hour) || ((hour == 0) && (g_hour == 23))) { - g_hour = hour; - g_minute = 0; - drawClock(); - cf = 0; - for (cx = 1; cx <= 10; ++cx) { - if (g_s._pourc[cx] == '*') - ++cf; - } - - if (cf == 10) - stpo = "10"; - else - stpo = chr(cf + 48); - - g_hintPctMessage = Common::String(d3); - g_hintPctMessage += d5; - g_hintPctMessage += d4; - g_hintPctMessage += d3; - g_hintPctMessage += d1; - g_hintPctMessage += stpo; - g_hintPctMessage += '0'; - g_hintPctMessage += d2; - g_hintPctMessage += d4; - g_hintPctMessage += d3; - g_hintPctMessage += d6; - g_hintPctMessage += d4; - } - if (minute > g_minute) { - g_minute = 30; - drawClock(); - } - if (y_s < 12) - return; - - if (!g_vm->_blo) { - if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) - g_t = kTime2; - else - g_t = kTime1; - cf = g_s._faithScore; - if ((cf > 33) && (cf < 66)) - g_t -= (g_t / 3); - - if (cf > 65) - g_t -= ((g_t / 3) * 2); - - int nh = readclock(); - if ((nh - g_mh) > g_t) { - bool activeMenu = g_vm->_menu._menuActive; - g_vm->_menu.eraseMenu(); - g_jh += ((nh - g_mh) / g_t); - g_mh = nh; - switch (g_li) { - case 1: - case 4 : - pl1(cf); - break; - case 2 : - pl2(cf); - break; - case 5 : - pl5(cf); - break; - case 6: - case 8 : - pl6(cf); - break; - case 9 : - pl9(cf); - break; - case 10 : - pl10(cf); - break; - case 11 : - pl11(cf); - break; - case 12 : - pl12(cf); - break; - case 13: - case 14 : - pl13(cf); - break; - case 15: - case 26 : - pl15(cf); - break; - case 20 : - pl20(cf); - break; - } - if ((g_mpers != 0) && (g_ipers != 10)) - g_mpers = g_ipers; - - if ((g_mpers == 0) && (g_ipers > 0)) { - if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) { - cavegre(); - } else if (g_ipers == 10) { - g_ipers = 0; - if (!g_vm->_brt) { - g_vm->_brt = true; - g_hdb = readclock(); - if (getRandomNumber(1, 5) < 5) { - clsf3(); - ecrf2(); - ecr3(g_vm->getEngineString(S_HEAR_NOISE)); - int rand = (getRandomNumber(0, 4)) - 2; - startSpeech(1, rand, 1); - clsf3(); - } - } - } - } - - if (activeMenu) - g_vm->_menu.drawMenu(); - } - } - g_hfb = readclock(); - if ((g_vm->_brt) && ((g_hfb - g_hdb) > 17)) { - cx = nouvp(g_li); - g_vm->_brt = false; - g_hdb = 0; - if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) - g_vm->_anyone = true; - } -} - -void fenat(char ans) { - int coul; - - hideMouse(); - if (g_vm->_currGraphicalDevice == MODE_CGA) - coul = 2; - else if (g_vm->_currGraphicalDevice == MODE_HERCULES) - coul = 1; - else - coul = 12; - - g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); - g_vm->_screenSurface.drawBox(300, 191, 16, 8, 15); - showMouse(); -} - - -/* NIVEAU 8 */ -void afdes(int ad) { - taffich(); - dessin(ad); - g_vm->_okdes = false; -} - -void tkey1(bool d) { - bool quest; - int x, y, c; - - hideMouse(); - fenat('K'); - - // Wait for release from any key or mouse button - while (keypressed()) - g_key = testou(); - do { - getMousePos(x, y, c); - keypressed(); - } while (c != 0); - - // Event loop - do { - if (d) - tinke(); - quest = keypressed(); - getMousePos(x, y, c); - CHECK_QUIT; - } while (!(quest || (c != 0) || (d && g_vm->_anyone))); - if (quest) - testou(); - g_vm->setMouseClick(false); - showMouse(); -} - -void tmlieu(int roomId) { - Common::String nomp; - - if (roomId == 26) - roomId = 15; - - int i = 1; - while ((i < 8) && (g_v_lieu[i][roomId] != 0)) { - nomp = deline(g_v_lieu[i][roomId] + kMenuPlaceStringIndex); - while (nomp.size() < 20) - nomp += ' '; - g_vm->_menu.setText(g_vm->_menu._moveMenu[i], nomp); - ++i; - } - nomp = "* "; - for (int cx = 7; cx >= i; --cx) - g_vm->_menu.setText(g_vm->_menu._moveMenu[cx], nomp); -} - - -/* NIVEAU 7 */ -void tlu(int af, int ob) { - g_caff = 32; - afdes(0); - repon(6, ob + 4000); - repon(2, 999); - tkey1(true); - g_caff = af; - g_msg[3] = OPCODE_NONE; - g_crep = 998; -} - -void affrep() { - g_caff = g_s._currPlace; - g_crep = g_s._currPlace; -} - -/** - * Engine function - Switch action menu from "Search" mode back to normal mode - * @remarks Originally called 'mfouen' - */ -void unsetSearchMenu() { - tmlieu(g_s._currPlace); - for (int cx = 1; cx <= 11; ++cx) - g_vm->_menu.enableMenuItem(_actionMenu[cx]); - - g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); - g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); -} - -/* NIVEAU 6 */ - -void tperd() { - initouv(); - g_ment = 0; - g_iouv = 0; - g_mchai = 0; - unsetSearchMenu(); - if (!g_vm->_blo) - t11(21); - - g_vm->_loseGame = true; - clsf1(); - g_vm->_screenSurface.drawBox(60, 35, 400, 50, 15); - repon(9, g_crep); - clearScreenType2(); - clsf3(); - g_vm->_col = false; - g_vm->_syn = false; - g_vm->_okdes = false; -} - -void tsort() { - - if ((g_iouv > 0) && (g_s._currPlace != 0)) { - if (g_s._faithScore < 50) - g_s._faithScore += 2; - else - g_s._faithScore += (g_s._faithScore / 10); - } - - for (int cx = 1; cx <= 7; ++cx) - g_touv[cx] = chr(0); - g_ment = 0; - g_iouv = 0; - g_mchai = 0; - debloc(g_s._currPlace); -} - -void st4(int ob) { - g_crep = 997; - - switch (ob) { - case 114 : - g_crep = 109; - break; - case 110 : - g_crep = 107; - break; - case 158 : - g_crep = 113; - break; - case 152: - case 153: - case 154: - case 155: - case 156: - case 150: - case 100: - case 157: - case 160: - case 161 : - tlu(g_caff, ob); - break; - default: - break; - } -} - -void cherjer(int ob, bool &d) { - int cx; - - d = false; - for (cx = 1; cx <= 6; ++cx) - d = (d || (ord(g_s._sjer[cx]) == ob)); - - if (g_s._selectedObjectId == ob) - d = true; -} - -void st1sama() { - g_s._currPlace = DINING_ROOM; - affrep(); -} - -void modinv() { - int r; - Common::String nomp; - - int cy = 0; - for (int cx = 1; cx <= 6; ++cx) - if (g_s._sjer[cx] != chr(0)) { - ++cy; - r = (ord(g_s._sjer[cx]) + 400); - nomp = deline(r - 501 + kInventoryStringIndex); - g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp); - g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[cx]); - } - if (cy < 6) - for (int cx = cy + 1; cx <= 6; ++cx) { - g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cx], " "); - g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[cx]); - } -} - -void sparl(float adr, float rep) { - const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; - int key, repint; - - repint = abs((int)rep); - hideMouse(); - Common::String tmpStr = deline(repint + kDialogStringIndex); - displayStr(tmpStr, 230, 4, 65, 24, 5); - f3f8::draw(); - - key = 0; - do { - startSpeech(repint, haut[g_caff - 69], 0); - f3f8::waitForF3F8(key); - CHECK_QUIT; - } while (key != 66); - hirs(); - showMouse(); -} - -/** - * Engine function - End of Search: reset globals - * @remarks Originally called 'finfouill' - */ -void endSearch() { - g_vm->_heroSearching = false; - g_vm->_obpart = false; - g_cs = 0; - g_is = 0; - unsetSearchMenu(); -} - -/** - * Engine function - Switch action menu to "Search" mode - * @remarks Originally called 'mfoudi' - */ -void setSearchMenu() { - for (int cx = 1; cx <= 7; ++cx) - g_vm->_menu.disableMenuItem(g_vm->_menu._moveMenu[cx]); - - for (int cx = 1; cx <= 11; ++cx) - g_vm->_menu.disableMenuItem(_actionMenu[cx]); - - g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); - g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); -} - -void mennor() { - g_vm->_menu.menuUp(g_msg[3]); -} - -void premtet() { - dessine(g_ades, 10, 80); - g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15); -} - -/* NIVEAU 5 */ -void ajchai() { - int cy = acha + ((g_mchai - 1) * 10) - 1; - int cx = 0; - do { - ++cx; - } while ((cx <= 9) && (g_tabdon[cy + cx] != 0)); - - if (g_tabdon[cy + cx] == 0) - g_tabdon[cy + cx] = g_s._selectedObjectId; - else - g_crep = 192; -} - -void ajjer(int ob) { - int cx = 0; - do { - ++cx; - } while ((cx <= 5) && (ord(g_s._sjer[cx]) != 0)); - - if (ord(g_s._sjer[cx]) == 0) { - g_s._sjer[(cx)] = chr(ob); - modinv(); - } else - g_crep = 139; -} - -void t1sama() { //Entering manor - int day, hour, minute; - - updateHour(day, hour, minute); - if ((hour < 5) && (g_s._currPlace > 18)) { - bool d; - cherjer(137, d); - if (!d) { //You don't have the keys, and it's late - g_crep = 1511; - tperd(); - } else - st1sama(); - } else if (!g_s._ipre) { //Is it your first time? - g_ipers = 255; - showPeoplePresent(g_ipers); - g_caff = 77; - afdes(0); - g_vm->_screenSurface.drawBox(223, 47, 155, 91, 15); - repon(2, 33); - tkey1(false); - mennor(); - hideMouse(); - hirs(); - premtet(); - sparl(0, 140); - dessine_rouleau(); - drawClock(); - showMouse(); - g_s._currPlace = OWN_ROOM; - affrep(); - t5(10); - if (!g_vm->_blo) - minute = t11(0); - g_ipers = 0; - g_mpers = 0; - g_s._ipre = true; - } else - st1sama(); -} - -void t1vier() { - g_s._currPlace = SECRET_PASSAGE; - affrep(); -} - -void t1neig() { - ++g_inei; - if (g_inei > 2) { - g_crep = 1506; - tperd(); - } else { - g_vm->_okdes = true; - g_s._currPlace = MOUNTAIN; - affrep(); - } -} - -void t1deva() { - g_inei = 0; - g_s._currPlace = MANOR_FRONT; - affrep(); -} - -void t1derr() { - g_s._currPlace = MANOR_BACK; - affrep(); -} - -void t1deau() { - g_crep = 1503; - tperd(); -} - -void tctrm() { - repon(2, (3000 + g_ctrm)); - g_ctrm = 0; -} - - -void quelquun() { - if (g_vm->_menu._menuDisplayed) - g_vm->_menu.eraseMenu(); - - endSearch(); - g_crep = 997; -L1: - if (!g_vm->_hiddenHero) { - if (g_crep == 997) - g_crep = 138; - repon(2, g_crep); - if (g_crep == 138) - startSpeech(5, 2, 1); - else - startSpeech(4, 4, 1); - - if (g_iouv == 0) - g_s._faithScore += 2; - else if (g_s._faithScore < 50) - g_s._faithScore += 4; - else - g_s._faithScore += 3 * (g_s._faithScore / 10); - tsort(); - tmlieu(15); - int cx = convertBitIndexToCharacterIndex(g_ipers); - g_caff = 69 + cx; - g_crep = g_caff; - g_msg[3] = MENU_DISCUSS; - g_msg[4] = g_vm->_menu._discussMenu[cx]; - g_vm->_syn = true; - g_vm->_col = true; - } else { - if (getRandomNumber(1, 3) == 2) { - g_vm->_hiddenHero = false; - g_crep = 137; - goto L1; - } else { - repon(2, 136); - int rand = (getRandomNumber(0, 4)) - 2; - startSpeech(3, rand, 1); - clearScreenType2(); - displayAloneText(); - debloc(21); - affrep(); - } - } - if (g_vm->_menu._menuDisplayed) - g_vm->_menu.drawMenu(); -} - -void tsuiv() { - int tbcl; - int cl; - - int cy = acha + ((g_mchai - 1) * 10) - 1; - int cx = 0; - do { - ++cx; - ++g_cs; - cl = cy + g_cs; - tbcl = g_tabdon[cl]; - } while ((tbcl == 0) && (g_cs <= 9)); - - if ((tbcl != 0) && (g_cs < 11)) { - ++g_is; - g_caff = tbcl; - g_crep = g_caff + 400; - if (g_ipers != 0) - g_s._faithScore += 2; - } else { - affrep(); - endSearch(); - if (cx > 9) - g_crep = 131; - } -} - -void tfleche() { - bool qust; - char touch; - - if (g_num == 9999) - return; - - fenat(chr(152)); - bool inRect = false; - do { - touch = '\0'; - - do { - moveMouse(qust, touch); - CHECK_QUIT; - - if (g_vm->getMouseClick()) - inRect = (x_s < 256 * g_res) && (y_s < 176) && (y_s > 12); - tinke(); - } while (!(qust || inRect || g_vm->_anyone)); - - if (qust && (touch == '\103')) - Alert::show(g_hintPctMessage, 1); - } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (g_vm->_anyone) || (inRect))); - - if (touch == '\73') - g_vm->_keyPressedEsc = true; - - if (inRect) { - g_x = x_s; - g_y = y_s; - } -} - -void tcoord(int sx) { - int sy, ix, iy; - int ib; - - - g_num = 0; - g_crep = 999; - int a = 0; - int atdon = amzon + 3; - int cy = 0; - while (cy < g_caff) { - a += g_tabdon[atdon]; - atdon += 4; - ++cy; - } - - if (g_tabdon[atdon] == 0) { - g_crep = 997; - return; - } - - a += fleche; - int cb = 0; - for (cy = 0; cy <= (sx - 2); ++cy) { - ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)]; - cb += (ib * 4) + 2; - } - ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)]; - if (ib == 0) { - g_crep = 997; - return; - } - - cy = 1; - do { - cb += 2; - sx = g_tabdon[a + cb] * g_res; - sy = g_tabdon[(a + cb + 1)]; - cb += 2; - ix = g_tabdon[a + cb] * g_res; - iy = g_tabdon[(a + cb + 1)]; - ++cy; - } while (!(((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) || (cy > ib))); - - if ((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) { - g_num = cy - 1; - return; - } - - g_crep = 997; -} - - -void st7(int ob) { - switch (ob) { - case 116: - case 144: - g_crep = 104; - break; - case 126: - case 111: - g_crep = 108; - break; - case 132: - g_crep = 111; - break; - case 142: - g_crep = 112; - break; - default: - g_crep = 183; - st4(ob); - } -} - -void treg(int ob) { - int mdes = g_caff; - g_caff = ob; - - if (((g_caff > 29) && (g_caff < 33)) || (g_caff == 144) || (g_caff == 147) || (g_caff == 149) || (g_msg[4] == OPCODE_SLOOK)) { - afdes(0); - if ((g_caff > 29) && (g_caff < 33)) - repon(2, g_caff); - else - repon(2, g_caff + 400); - tkey1(true); - g_caff = mdes; - g_msg[3] = 0; - g_crep = 998; - } else { - g_vm->_obpart = true; - g_crep = g_caff + 400; - setSearchMenu(); - } -} - -void avpoing(int &ob) { - g_crep = 999; - if (g_s._selectedObjectId != 0) - ajjer(g_s._selectedObjectId); - - if (g_crep != 139) { - modobj(ob + 400); - g_s._selectedObjectId = ob; - ob = 0; - } -} - -void rechai(int &ch) { - int tmpPlace = g_s._currPlace; - - if (g_s._currPlace == CRYPT) - tmpPlace = CELLAR; - ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1]; -} - -void t23coul(int &l) { - bool d; - - cherjer(143, d); - l = 14; - if (!d) { - g_crep = 1512; - tperd(); - } -} - -void maivid() { - g_s._selectedObjectId = 0; - modobj(500); -} - -void st13(int ob) { - if ((ob == 114) || (ob == 116) || (ob == 126) || (ob == 132) || - (ob == 111) || (ob == 106) || (ob == 102) || (ob == 100) || - (ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) || - (ob == 156) || (ob == 157) || (ob == 144) || (ob == 158) || - (ob == 150) || (ob == 152)) - g_crep = 999; - else - g_crep = 105; -} - -void aldepl() { - Alert::show(g_vm->getEngineString(S_USE_DEP_MENU), 1); -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h deleted file mode 100644 index 910791303f..0000000000 --- a/engines/mortevielle/mor2.h +++ /dev/null @@ -1,87 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_MOR2_H -#define MORTEVIELLE_MOR2_H - -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -static const int _actionMenu[12] = { OPCODE_NONE, - OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, - OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, - OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE -}; - -extern void tinke(); -extern void fenat(char ans); -/* NIVEAU 8 */ -extern void afdes(int ad); -extern void tkey1(bool d); -extern void tmlieu(int roomId); -/* NIVEAU 7 */ -extern void tlu(int af, int ob); -extern void affrep(); -extern void unsetSearchMenu(); -/* NIVEAU 6 */ -extern void tperd(); -extern void tsort(); -extern void st4(int ob); -extern void cherjer(int ob, bool &d); -extern void st1sama(); -extern void modinv(); -extern void sparl(float adr, float rep); -extern void endSearch(); -extern void setSearchMenu(); -extern void mennor(); -extern void premtet(); -/* NIVEAU 5 */ -extern void ajchai(); -extern void ajjer(int ob); -extern void t1sama(); -extern void t1vier(); -extern void t1neig(); -extern void t1deva(); -extern void t1derr(); -extern void t1deau(); -extern void tctrm(); -extern void quelquun(); -extern void tsuiv(); -extern void tfleche(); -extern void tcoord(int sx); -extern void st7(int ob); -extern void treg(int ob); -extern void avpoing(int &ob); -extern void rechai(int &ch); -extern void t23coul(int &l); -extern void maivid(); -extern void st13(int ob); -extern void aldepl(); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 0e65ca2fdb..509301349d 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -33,17 +33,14 @@ #include "mortevielle/dialogs.h" #include "mortevielle/asm.h" #include "mortevielle/keyboard.h" -#include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" -#include "mortevielle/mor2.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" -#include "mortevielle/parole2.h" #include "mortevielle/prog.h" #include "mortevielle/saveload.h" -#include "mortevielle/taffich.h" +#include "mortevielle/outtext.h" #include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index d8e2309a4c..9d7c38d864 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -25,12 +25,14 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/file.h" +#include "common/str.h" +#include "mortevielle/mor.h" +#include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/graphics.h" -#include "mortevielle/level15.h" #include "mortevielle/mortevielle.h" #include "mortevielle/var_mor.h" -#include "common/str.h" namespace Mortevielle { @@ -239,4 +241,224 @@ void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) } } +void chardes(Common::String filename, int32 skipSize, int length) { + Common::File f; + if (!f.open(filename)) + error("Missing file %s", filename.c_str()); + + int skipBlock = 0; + while (skipSize > 127) { + ++skipBlock; + skipSize -= 128; + } + if (skipBlock != 0) + f.seek(skipBlock * 0x80); + + int remainingSkipSize = abs(skipSize); + int totalLength = length + remainingSkipSize; + int memIndx = 0x6000 * 16; + while (totalLength > 0) { + f.read(&g_mem[memIndx], 128); + totalLength -= 128; + memIndx += 128; + } + f.close(); + + for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) + g_mem[0x7000 * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; +} + +void charani(Common::String filename, int32 skipSize, int length) { + Common::File f; + if (!f.open(filename)) + error("Missing file - %s", filename.c_str()); + + int skipBlock = 0; + while (skipSize > 127) { + skipSize = skipSize - 128; + ++skipBlock; + } + if (skipBlock != 0) + f.seek(skipBlock * 0x80); + + int remainingSkipSize = abs(skipSize); + int fullLength = length + remainingSkipSize; + int memIndx = 0x6000 * 16; + while (fullLength > 0) { + f.read(&g_mem[memIndx], 128); + fullLength -= 128; + memIndx += 128; + } + f.close(); + + for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) + g_mem[0x7314 * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; +} + +void taffich() { + byte tran1[] = { 121, 121, 138, 139, 120 }; + byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; + + int cx, handle, npal; + int32 lgt; + int alllum[16]; + + + int a = g_caff; + if ((a >= 153) && (a <= 161)) + a = tran2[a - 153]; + else if ((a >= 136) && (a <= 140)) + a = tran1[a - 136]; + int b = a; + if (g_maff == a) + return; + + switch (a) { + case 16: + g_s._pourc[9] = '*'; + g_s._teauto[42] = '*'; + break; + case 20: + g_s._teauto[39] = '*'; + if (g_s._teauto[36] == '*') { + g_s._pourc[3] = '*'; + g_s._teauto[38] = '*'; + } + break; + case 24: + g_s._teauto[37] = '*'; + break; + case 30: + g_s._teauto[9] = '*'; + break; + case 31: + g_s._pourc[4] = '*'; + g_s._teauto[35] = '*'; + break; + case 118: + g_s._teauto[41] = '*'; + break; + case 143: + g_s._pourc[1] = '*'; + break; + case 150: + g_s._teauto[34] = '*'; + break; + case 151: + g_s._pourc[2] = '*'; + break; + default: + break; + } + + g_vm->_okdes = true; + hideMouse(); + lgt = 0; + Common::String filename; + + if ((a != 50) && (a != 51)) { + int m = a + 2000; + if ((m > 2001) && (m < 2010)) + m = 2001; + if (m == 2011) + m = 2010; + if (a == 32) + m = 2034; + if ((a == 17) && (g_maff == 14)) + m = 2018; + + if (a > 99) { + if ((g_is == 1) || (g_is == 0)) + m = 2031; + else + m = 2032; + } + + if (((a > 69) && (a < 80)) || (a == 30) || (a == 31) || (a == 144) || (a == 147) || (a == 149)) + m = 2030; + + if (((a < 27) && (((g_maff > 69) && (!g_s._ipre)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) + m = 2033; + + g_maff = a; + if (a == 159) + a = 86; + else if (a > 140) + a = a - 67; + else if (a > 137) + a = a - 66; + else if (a > 99) + a = a - 64; + else if (a > 69) + a = a - 42; + else if (a > 29) + a = a - 5; + else if (a == 26) + a = 24; + else if (a > 18) + a = a - 1; + npal = a; + + for (cx = 0; cx <= (a - 1); ++cx) + lgt = lgt + g_l[cx]; + handle = g_l[a]; + + filename = "DXX.mor"; + } else { + filename = "DZZ.mor"; + handle = g_l[87]; + if (a == 51) { + lgt = handle; + handle = g_l[88]; + } + g_maff = a; + npal = a + 37; + } + chardes(filename, lgt, handle); + if (g_vm->_currGraphicalDevice == MODE_HERCULES) { + for (int i = 0; i <= 15; ++i) { + int palh = READ_LE_UINT16(&g_mem[(0x7000 * 16) + ((i + 1) << 1)]); + alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); + } + for (int i = 0; i <= 15; ++i) { + int k = 0; + for (int j = 0; j <= 15; ++j) + if (alllum[j] > alllum[k]) + k = j; + g_mem[(0x7000 * 16) + 2 + (k << 1)] = g_rang[i]; + alllum[k] = -1; + } + } + g_numpal = npal; + writepal(npal); + + if ((b < 15) || (b == 16) || (b == 17) || (b == 24) || (b == 26) || (b == 50)) { + lgt = 0; + if ((b < 15) || (b == 16) || (b == 17) || (b == 24) || (b == 26)) { + if (b == 26) + b = 18; + else if (b == 24) + b = 17; + else if (b > 15) + --b; + for (cx = 0; cx <= (b - 1); ++cx) + lgt += g_l[cx + 89]; + handle = g_l[b + 89]; + filename = "AXX.mor"; + } else if (b == 50) { + filename = "AZZ.mor"; + handle = 1260; + } + charani(filename, lgt, handle); + } + showMouse(); + if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { + if ((a == 13) || (a == 14)) + displayAloneText(); + else if (!g_vm->_blo) + cx = t11(g_s._currPlace); + g_mpers = 0; + } +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 55e0ec5aab..03523d7086 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -28,6 +28,7 @@ #ifndef MORTEVIELLE_OUTTEXT_H #define MORTEVIELLE_OUTTEXT_H +#include "common/str.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -35,5 +36,9 @@ namespace Mortevielle { extern Common::String deline(int num); extern void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); +extern void chardes(Common::String filename, int32 passe, int long_); +extern void charani(Common::String filename, int32 skipSize, int length); +extern void taffich(); + } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 14b3e3eba8..53da43402e 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -28,23 +28,18 @@ #include "common/file.h" #include "mortevielle/dialogs.h" #include "mortevielle/keyboard.h" -#include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" -#include "mortevielle/parole.h" +#include "mortevielle/speech.h" #include "mortevielle/sound.h" -#include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" namespace Mortevielle { -// For ScummVM, we need to do check for file errors where we do the file access -const int ioresult = 0; - void charpal() { Common::File f; // tabdb records Common::File ft; // tfxx diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp deleted file mode 100644 index b2266dc8ff..0000000000 --- a/engines/mortevielle/parole.cpp +++ /dev/null @@ -1,454 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/file.h" -#include "mortevielle/parole.h" -#include "mortevielle/sound.h" -#include "mortevielle/mortevielle.h" - -namespace Mortevielle { - -void spfrac(int wor) { - g_c3._rep = (uint)wor >> 12; - if ((g_typlec == 0) && (g_c3._code != 9)) - if (((g_c3._code > 4) && (g_c3._val != 20) && (g_c3._rep != 3) && (g_c3._rep != 6) && (g_c3._rep != 9)) || - ((g_c3._code < 5) && ((g_c3._val != 19) && (g_c3._val != 22) && (g_c3._rep != 4) && (g_c3._rep != 9)))) { - ++g_c3._rep; - } - - g_c3._freq = ((uint)wor >> 6) & 7; - g_c3._acc = ((uint)wor >> 9) & 7; -} - -void charg_car(int &currWordNumb) { - int wor, int_; - - wor = swap(READ_LE_UINT16(&g_mem[adword + currWordNumb])); - int_ = wor & 0x3f; - - if ((int_ >= 0) && (int_ <= 13)) { - g_c3._val = int_; - g_c3._code = 5; - } else if ((int_ >= 14) && (int_ <= 21)) { - g_c3._val = int_; - g_c3._code = 6; - } else if ((int_ >= 22) && (int_ <= 47)) { - int_ = int_ - 22; - g_c3._val = int_; - g_c3._code = g_typcon[int_]; - } else if ((int_ >= 48) && (int_ <= 56)) { - g_c3._val = int_ - 22; - g_c3._code = 4; - } else { - switch (int_) { - case 60: - g_c3._val = 32; /* " " */ - g_c3._code = 9; - break; - case 61: - g_c3._val = 46; /* "." */ - g_c3._code = 9; - break; - case 62: - g_c3._val = 35; /* "#" */ - g_c3._code = 9; - default: - break; - } - } - - spfrac(wor); - currWordNumb += 2; -} - - -void entroct(byte o) { - g_mem[adtroct * 16 + g_ptr_oct] = o; - ++g_ptr_oct; -} - -void veracf(byte b) { - ; -} - -void cctable(tablint &t) { - float tb[257]; - - tb[0] = 0; - for (int k = 0; k <= 255; ++k) { - tb[k + 1] = g_addfix + tb[k]; - t[255 - k] = abs((int)tb[k] + 1); - } -} - -void regenbruit() { - int i = offsetb3 + 8590; - int j = 0; - do { - g_t_cph[j] = READ_LE_UINT16(&g_mem[adbruit3 + i]); - i += 2; - ++j; - } while (i < offsetb3 + 8790); -} - -void charge_son() { - Common::File f; - - if (!f.open("sonmus.mor")) - error("Missing file - sonmus.mor"); - - f.read(&g_mem[0x7414 * 16 + 0], 273); - - g_vm->_soundManager.decodeMusic(&g_mem[0x7414 * 16], &g_mem[adson * 16], 273); - f.close(); -} - -void charge_phbruit() { - Common::File f; - - if (!f.open("phbrui.mor")) - error("Missing file - phbrui.mor"); - - for (int i = 1; i <= 3; ++i) - g_t_cph[i] = f.readSint16LE(); - - f.close(); -} - -void charge_bruit() { - Common::File f; - int i; - - if (!f.open("bruits")) //Translation: "noise" - error("Missing file - bruits"); - - f.read(&g_mem[adbruit * 16 + 0], 250); - for (i = 0; i <= 19013; ++i) - g_mem[adbruit * 16 + 32000 + i] = g_mem[adbruit5 + i]; - f.read(&g_mem[adbruit1 * 16 + offsetb1], 149); - - f.close(); -} - -void trait_car() { - byte d3; - int d2, i; - - switch (g_c2._code) { - case 9: - if (g_c2._val != ord('#')) - for (i = 0; i <= g_c2._rep; ++i) - entroct(g_c2._val); - break; - case 5: - case 6: - if (g_c2._code == 6) - d3 = g_tabdph[(g_c2._val - 14) << 1]; - else - d3 = null; - if (g_c1._code >= 5) { - veracf(g_c2._acc); - if (g_c1._code == 9) { - entroct(4); - if (d3 == null) - entroct(g_c2._val); - else - entroct(d3); - entroct(22); - } - } - - switch (g_c2._rep) { - case 0: - entroct(0); - entroct(g_c2._val); - if (d3 == null) - if (g_c3._code == 9) - entroct(2); - else - entroct(4); - else if (g_c3._code == 9) - entroct(0); - else - entroct(1); - break; - case 4: - case 5: - case 6: - if (g_c2._rep != 4) { - i = g_c2._rep - 5; - do { - --i; - entroct(0); - if (d3 == null) - entroct(g_c2._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - if (d3 == null) { - entroct(4); - entroct(g_c2._val); - entroct(0); - } else { - entroct(0); - entroct(g_c2._val); - entroct(3); - } - break; - case 7: - case 8: - case 9: - if (g_c2._rep != 7) { - i = g_c2._rep - 8; - do { - --i; - entroct(0); - if (d3 == null) - entroct(g_c2._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - if (d3 == null) { - entroct(0); - entroct(g_c2._val); - entroct(2); - } else { - entroct(0); - entroct(g_c2._val); - entroct(0); - } - break; - case 1: - case 2: - case 3: - if (g_c2._rep != 1) { - i = g_c2._rep - 2; - do { - --i; - entroct(0); - if (d3 == null) - entroct(g_c2._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - entroct(0); - entroct(g_c2._val); - if (g_c3._code == 9) - entroct(0); - else - entroct(1); - break; - default: - break; - } // switch c2.rep - break; - - case 2: - case 3: - d3 = g_c2._code + 5; // 7 ou 8 => Corresponding vowel - if (g_c1._code > 4) { - veracf(g_c2._acc); - if (g_c1._code == 9) { - entroct(4); - entroct(d3); - entroct(22); - } - } - i = g_c2._rep; - assert(i >= 0); - if (i != 0) { - do { - --i; - entroct(0); - entroct(d3); - entroct(3); - } while (i > 0); - } - veracf(g_c3._acc); - if (g_c3._code == 6) { - entroct(4); - entroct(g_tabdph[(g_c3._val - 14) << 1]); - entroct(g_c2._val); - } else { - entroct(4); - if (g_c3._val == 4) - entroct(3); - else - entroct(g_c3._val); - entroct(g_c2._val); - } - break; - case 0: - case 1: - veracf(g_c2._acc); - switch (g_c3._code) { - case 2: - d2 = 7; - break; - case 3: - d2 = 8; - break; - case 6: - d2 = g_tabdph[(g_c3._val - 14) << 1]; - break; - case 5: - d2 = g_c3._val; - break; - default: - d2 = 10; - break; - } // switch c3._code - d2 = (d2 * 26) + g_c2._val; - if (g_tnocon[d2] == 0) - d3 = 2; - else - d3 = 6; - if (g_c2._rep >= 5) { - g_c2._rep = g_c2._rep - 5; - d3 = 8 - d3; // Swap 2 and 6 - } - if (g_c2._code == 0) { - i = g_c2._rep; - if (i != 0) { - do { - --i; - entroct(d3); - entroct(g_c2._val); - entroct(3); - } while (i > 0); - } - entroct(d3); - entroct(g_c2._val); - entroct(4); - } else { - entroct(d3); - entroct(g_c2._val); - entroct(3); - i = g_c2._rep; - if (i != 0) { - do { - --i; - entroct(d3); - entroct(g_c2._val); - entroct(4); - } while (i > 0); - } - } - if (g_c3._code == 9) { - entroct(d3); - entroct(g_c2._val); - entroct(5); - } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) { - veracf(g_c3._acc); - switch (g_c3._code) { - case 3: - d2 = 8; - break; - case 6: - d2 = g_tabdph[(g_c3._val - 14) << 1]; - break; - case 5: - d2 = g_c3._val; - break; - default: - d2 = 7; - break; - } // switch c3._code - if (d2 == 4) - d2 = 3; - - if (g_intcon[g_c2._val] != 0) - ++g_c2._val; - - if ((g_c2._val == 17) || (g_c2._val == 18)) - g_c2._val = 16; - - entroct(4); - entroct(d2); - entroct(g_c2._val); - } - - break; - case 4: - veracf(g_c2._acc); - i = g_c2._rep; - if (i != 0) { - do { - --i; - entroct(2); - entroct(g_c2._val); - entroct(3); - } while (i > 0); - } - entroct(2); - entroct(g_c2._val); - entroct(4); - if (g_c3._code == 9) { - entroct(2); - entroct(g_c2._val); - entroct(5); - } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) { - veracf(g_c3._acc); - switch (g_c3._code) { - case 3: - d2 = 8; - break; - case 6: - d2 = g_tabdph[(g_c3._val - 14) << 1]; - break; - case 5: - d2 = g_c3._val; - break; - default: - d2 = 7; - break; - } // switch c3._code - - if (d2 == 4) - d2 = 3; - - if (g_intcon[g_c2._val] != 0) - ++g_c2._val; - - entroct(4); - entroct(d2); - entroct(g_tabdbc[((g_c2._val - 26) << 1) + 1]); - } - - break; - default: - break; - } // switch c2.code -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/parole.h b/engines/mortevielle/parole.h deleted file mode 100644 index 46d55abab0..0000000000 --- a/engines/mortevielle/parole.h +++ /dev/null @@ -1,48 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_PAROLE_H -#define MORTEVIELLE_PAROLE_H - -#include "common/scummsys.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -extern void spfrac(int wor); -extern void charg_car(int &currWordNumb); -extern void entroct(byte o); -extern void veracf(byte b); -extern void cctable(tablint &t); -extern void regenbruit(); -extern void charge_son(); -extern void charge_phbruit(); -extern void charge_bruit(); -extern void trait_car(); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp deleted file mode 100644 index 950f2940bc..0000000000 --- a/engines/mortevielle/parole2.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/endian.h" -#include "mortevielle/level15.h" -#include "mortevielle/parole2.h" -#include "mortevielle/parole.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/sound.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -void rot_chariot() { - g_c1 = g_c2; - g_c2 = g_c3; - g_c3._val = 32; - g_c3._code = 9; -} - -void init_chariot() { - g_c3._rep = 0; - g_c3._freq = 0; - g_c3._acc = 0; - rot_chariot(); - rot_chariot(); -} - - -void trait_ph() { - const int deca[3] = {300, 30, 40}; - - int ptr_tcph = g_num_ph - 1; - int startPos = swap(g_t_cph[ptr_tcph]) + deca[g_typlec]; - int endPos = swap(g_t_cph[ptr_tcph + 1]) + deca[g_typlec]; - int wordCount = endPos - startPos; - for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) - WRITE_LE_UINT16(&g_mem[adword + currWord], g_t_cph[i]); - - g_ptr_oct = 0; - int currWord = 0; - init_chariot(); - - do { - rot_chariot(); - charg_car(currWord); - trait_car(); - } while (currWord < wordCount); - - rot_chariot(); - trait_car(); - entroct(ord('#')); -} - - - -void startSpeech(int rep, int ht, int typ) { - int savph[501]; - int tempo; - - if (g_vm->_soundOff) - return; - - g_num_ph = rep; - g_haut = ht; - g_typlec = typ; - if (g_typlec != 0) { - for (int i = 0; i <= 500; ++i) - savph[i] = g_t_cph[i]; - tempo = kTempoNoise; - } else if (g_haut > 5) - tempo = kTempoF; - else - tempo = kTempoM; - g_addfix = (float)((tempo - g_addv[0])) / 256; - cctable(g_tbi); - switch (typ) { - case 1: - charge_bruit(); - /*if zuul then zzuul(adbruit,0,1095);*/ - regenbruit(); - break; - case 2: - charge_son(); - charge_phbruit(); - break; - default: - break; - } - trait_ph(); - g_vm->_soundManager.litph(g_tbi, typ, tempo); - if (g_typlec != 0) - for (int i = 0; i <= 500; ++i) { - g_t_cph[i] = savph[i]; - g_mlec = g_typlec; - } - writepal(g_numpal); -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/parole2.h b/engines/mortevielle/parole2.h deleted file mode 100644 index 3fab74d02f..0000000000 --- a/engines/mortevielle/parole2.h +++ /dev/null @@ -1,40 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_PAROLE2_H -#define MORTEVIELLE_PAROLE2_H - -namespace Mortevielle { - -extern void rot_chariot(); -extern void init_chariot(); -extern void trait_ph(); -extern void startSpeech(int rep, int ht, int typ); - -} // End of namespace Mortevielle - -#endif diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index b56aba64e8..a6ccfcb143 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -29,10 +29,8 @@ #include "mortevielle/dialogs.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" -#include "mortevielle/mor2.h" #include "mortevielle/mortevielle.h" #include "mortevielle/prog.h" -#include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 0efafe7fba..2c2af49a5f 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -29,7 +29,6 @@ #include "common/system.h" #include "mortevielle/dialogs.h" #include "mortevielle/mor.h" -#include "mortevielle/mor2.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/ovd1.h" diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp new file mode 100644 index 0000000000..2ad5c0514f --- /dev/null +++ b/engines/mortevielle/speech.cpp @@ -0,0 +1,543 @@ +/* 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. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#include "common/endian.h" +#include "common/file.h" +#include "mortevielle/speech.h" +#include "mortevielle/sound.h" +#include "mortevielle/mortevielle.h" +#include "mortevielle/mor.h" +#include "mortevielle/var_mor.h" + +namespace Mortevielle { + +void spfrac(int wor) { + g_c3._rep = (uint)wor >> 12; + if ((g_typlec == 0) && (g_c3._code != 9)) + if (((g_c3._code > 4) && (g_c3._val != 20) && (g_c3._rep != 3) && (g_c3._rep != 6) && (g_c3._rep != 9)) || + ((g_c3._code < 5) && ((g_c3._val != 19) && (g_c3._val != 22) && (g_c3._rep != 4) && (g_c3._rep != 9)))) { + ++g_c3._rep; + } + + g_c3._freq = ((uint)wor >> 6) & 7; + g_c3._acc = ((uint)wor >> 9) & 7; +} + +void charg_car(int &currWordNumb) { + int wor, int_; + + wor = swap(READ_LE_UINT16(&g_mem[adword + currWordNumb])); + int_ = wor & 0x3f; + + if ((int_ >= 0) && (int_ <= 13)) { + g_c3._val = int_; + g_c3._code = 5; + } else if ((int_ >= 14) && (int_ <= 21)) { + g_c3._val = int_; + g_c3._code = 6; + } else if ((int_ >= 22) && (int_ <= 47)) { + int_ = int_ - 22; + g_c3._val = int_; + g_c3._code = g_typcon[int_]; + } else if ((int_ >= 48) && (int_ <= 56)) { + g_c3._val = int_ - 22; + g_c3._code = 4; + } else { + switch (int_) { + case 60: + g_c3._val = 32; /* " " */ + g_c3._code = 9; + break; + case 61: + g_c3._val = 46; /* "." */ + g_c3._code = 9; + break; + case 62: + g_c3._val = 35; /* "#" */ + g_c3._code = 9; + default: + break; + } + } + + spfrac(wor); + currWordNumb += 2; +} + + +void entroct(byte o) { + g_mem[adtroct * 16 + g_ptr_oct] = o; + ++g_ptr_oct; +} + +void veracf(byte b) { + ; +} + +void cctable(tablint &t) { + float tb[257]; + + tb[0] = 0; + for (int k = 0; k <= 255; ++k) { + tb[k + 1] = g_addfix + tb[k]; + t[255 - k] = abs((int)tb[k] + 1); + } +} + +void regenbruit() { + int i = offsetb3 + 8590; + int j = 0; + do { + g_t_cph[j] = READ_LE_UINT16(&g_mem[adbruit3 + i]); + i += 2; + ++j; + } while (i < offsetb3 + 8790); +} + +void charge_son() { + Common::File f; + + if (!f.open("sonmus.mor")) + error("Missing file - sonmus.mor"); + + f.read(&g_mem[0x7414 * 16 + 0], 273); + + g_vm->_soundManager.decodeMusic(&g_mem[0x7414 * 16], &g_mem[adson * 16], 273); + f.close(); +} + +void charge_phbruit() { + Common::File f; + + if (!f.open("phbrui.mor")) + error("Missing file - phbrui.mor"); + + for (int i = 1; i <= 3; ++i) + g_t_cph[i] = f.readSint16LE(); + + f.close(); +} + +void charge_bruit() { + Common::File f; + int i; + + if (!f.open("bruits")) //Translation: "noise" + error("Missing file - bruits"); + + f.read(&g_mem[adbruit * 16 + 0], 250); + for (i = 0; i <= 19013; ++i) + g_mem[adbruit * 16 + 32000 + i] = g_mem[adbruit5 + i]; + f.read(&g_mem[adbruit1 * 16 + offsetb1], 149); + + f.close(); +} + +void trait_car() { + byte d3; + int d2, i; + + switch (g_c2._code) { + case 9: + if (g_c2._val != ord('#')) + for (i = 0; i <= g_c2._rep; ++i) + entroct(g_c2._val); + break; + case 5: + case 6: + if (g_c2._code == 6) + d3 = g_tabdph[(g_c2._val - 14) << 1]; + else + d3 = null; + if (g_c1._code >= 5) { + veracf(g_c2._acc); + if (g_c1._code == 9) { + entroct(4); + if (d3 == null) + entroct(g_c2._val); + else + entroct(d3); + entroct(22); + } + } + + switch (g_c2._rep) { + case 0: + entroct(0); + entroct(g_c2._val); + if (d3 == null) + if (g_c3._code == 9) + entroct(2); + else + entroct(4); + else if (g_c3._code == 9) + entroct(0); + else + entroct(1); + break; + case 4: + case 5: + case 6: + if (g_c2._rep != 4) { + i = g_c2._rep - 5; + do { + --i; + entroct(0); + if (d3 == null) + entroct(g_c2._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + if (d3 == null) { + entroct(4); + entroct(g_c2._val); + entroct(0); + } else { + entroct(0); + entroct(g_c2._val); + entroct(3); + } + break; + case 7: + case 8: + case 9: + if (g_c2._rep != 7) { + i = g_c2._rep - 8; + do { + --i; + entroct(0); + if (d3 == null) + entroct(g_c2._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + if (d3 == null) { + entroct(0); + entroct(g_c2._val); + entroct(2); + } else { + entroct(0); + entroct(g_c2._val); + entroct(0); + } + break; + case 1: + case 2: + case 3: + if (g_c2._rep != 1) { + i = g_c2._rep - 2; + do { + --i; + entroct(0); + if (d3 == null) + entroct(g_c2._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + entroct(0); + entroct(g_c2._val); + if (g_c3._code == 9) + entroct(0); + else + entroct(1); + break; + default: + break; + } // switch c2.rep + break; + + case 2: + case 3: + d3 = g_c2._code + 5; // 7 ou 8 => Corresponding vowel + if (g_c1._code > 4) { + veracf(g_c2._acc); + if (g_c1._code == 9) { + entroct(4); + entroct(d3); + entroct(22); + } + } + i = g_c2._rep; + assert(i >= 0); + if (i != 0) { + do { + --i; + entroct(0); + entroct(d3); + entroct(3); + } while (i > 0); + } + veracf(g_c3._acc); + if (g_c3._code == 6) { + entroct(4); + entroct(g_tabdph[(g_c3._val - 14) << 1]); + entroct(g_c2._val); + } else { + entroct(4); + if (g_c3._val == 4) + entroct(3); + else + entroct(g_c3._val); + entroct(g_c2._val); + } + break; + case 0: + case 1: + veracf(g_c2._acc); + switch (g_c3._code) { + case 2: + d2 = 7; + break; + case 3: + d2 = 8; + break; + case 6: + d2 = g_tabdph[(g_c3._val - 14) << 1]; + break; + case 5: + d2 = g_c3._val; + break; + default: + d2 = 10; + break; + } // switch c3._code + d2 = (d2 * 26) + g_c2._val; + if (g_tnocon[d2] == 0) + d3 = 2; + else + d3 = 6; + if (g_c2._rep >= 5) { + g_c2._rep = g_c2._rep - 5; + d3 = 8 - d3; // Swap 2 and 6 + } + if (g_c2._code == 0) { + i = g_c2._rep; + if (i != 0) { + do { + --i; + entroct(d3); + entroct(g_c2._val); + entroct(3); + } while (i > 0); + } + entroct(d3); + entroct(g_c2._val); + entroct(4); + } else { + entroct(d3); + entroct(g_c2._val); + entroct(3); + i = g_c2._rep; + if (i != 0) { + do { + --i; + entroct(d3); + entroct(g_c2._val); + entroct(4); + } while (i > 0); + } + } + if (g_c3._code == 9) { + entroct(d3); + entroct(g_c2._val); + entroct(5); + } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) { + veracf(g_c3._acc); + switch (g_c3._code) { + case 3: + d2 = 8; + break; + case 6: + d2 = g_tabdph[(g_c3._val - 14) << 1]; + break; + case 5: + d2 = g_c3._val; + break; + default: + d2 = 7; + break; + } // switch c3._code + if (d2 == 4) + d2 = 3; + + if (g_intcon[g_c2._val] != 0) + ++g_c2._val; + + if ((g_c2._val == 17) || (g_c2._val == 18)) + g_c2._val = 16; + + entroct(4); + entroct(d2); + entroct(g_c2._val); + } + + break; + case 4: + veracf(g_c2._acc); + i = g_c2._rep; + if (i != 0) { + do { + --i; + entroct(2); + entroct(g_c2._val); + entroct(3); + } while (i > 0); + } + entroct(2); + entroct(g_c2._val); + entroct(4); + if (g_c3._code == 9) { + entroct(2); + entroct(g_c2._val); + entroct(5); + } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) { + veracf(g_c3._acc); + switch (g_c3._code) { + case 3: + d2 = 8; + break; + case 6: + d2 = g_tabdph[(g_c3._val - 14) << 1]; + break; + case 5: + d2 = g_c3._val; + break; + default: + d2 = 7; + break; + } // switch c3._code + + if (d2 == 4) + d2 = 3; + + if (g_intcon[g_c2._val] != 0) + ++g_c2._val; + + entroct(4); + entroct(d2); + entroct(g_tabdbc[((g_c2._val - 26) << 1) + 1]); + } + + break; + default: + break; + } // switch c2.code +} + +void rot_chariot() { + g_c1 = g_c2; + g_c2 = g_c3; + g_c3._val = 32; + g_c3._code = 9; +} + +void init_chariot() { + g_c3._rep = 0; + g_c3._freq = 0; + g_c3._acc = 0; + rot_chariot(); + rot_chariot(); +} + + +void trait_ph() { + const int deca[3] = {300, 30, 40}; + + int ptr_tcph = g_num_ph - 1; + int startPos = swap(g_t_cph[ptr_tcph]) + deca[g_typlec]; + int endPos = swap(g_t_cph[ptr_tcph + 1]) + deca[g_typlec]; + int wordCount = endPos - startPos; + for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) + WRITE_LE_UINT16(&g_mem[adword + currWord], g_t_cph[i]); + + g_ptr_oct = 0; + int currWord = 0; + init_chariot(); + + do { + rot_chariot(); + charg_car(currWord); + trait_car(); + } while (currWord < wordCount); + + rot_chariot(); + trait_car(); + entroct(ord('#')); +} + + + +void startSpeech(int rep, int ht, int typ) { + int savph[501]; + int tempo; + + if (g_vm->_soundOff) + return; + + g_num_ph = rep; + g_haut = ht; + g_typlec = typ; + if (g_typlec != 0) { + for (int i = 0; i <= 500; ++i) + savph[i] = g_t_cph[i]; + tempo = kTempoNoise; + } else if (g_haut > 5) + tempo = kTempoF; + else + tempo = kTempoM; + g_addfix = (float)((tempo - g_addv[0])) / 256; + cctable(g_tbi); + switch (typ) { + case 1: + charge_bruit(); + /*if zuul then zzuul(adbruit,0,1095);*/ + regenbruit(); + break; + case 2: + charge_son(); + charge_phbruit(); + break; + default: + break; + } + trait_ph(); + g_vm->_soundManager.litph(g_tbi, typ, tempo); + if (g_typlec != 0) + for (int i = 0; i <= 500; ++i) { + g_t_cph[i] = savph[i]; + g_mlec = g_typlec; + } + writepal(g_numpal); +} + +} // End of namespace Mortevielle diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h new file mode 100644 index 0000000000..0e249b8e00 --- /dev/null +++ b/engines/mortevielle/speech.h @@ -0,0 +1,53 @@ +/* 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. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_PAROLE_H +#define MORTEVIELLE_PAROLE_H + +#include "common/scummsys.h" +#include "mortevielle/var_mor.h" + +namespace Mortevielle { + +extern void spfrac(int wor); +extern void charg_car(int &currWordNumb); +extern void entroct(byte o); +extern void veracf(byte b); +extern void cctable(tablint &t); +extern void regenbruit(); +extern void charge_son(); +extern void charge_phbruit(); +extern void charge_bruit(); +extern void trait_car(); + +extern void rot_chariot(); +extern void init_chariot(); +extern void trait_ph(); +extern void startSpeech(int rep, int ht, int typ); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp deleted file mode 100644 index a65cecd8a8..0000000000 --- a/engines/mortevielle/taffich.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/file.h" -#include "common/str.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/level15.h" -#include "mortevielle/mor.h" -#include "mortevielle/mouse.h" -#include "mortevielle/taffich.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -void chardes(Common::String filename, int32 skipSize, int length) { - Common::File f; - if (!f.open(filename)) - error("Missing file %s", filename.c_str()); - - int skipBlock = 0; - while (skipSize > 127) { - ++skipBlock; - skipSize -= 128; - } - if (skipBlock != 0) - f.seek(skipBlock * 0x80); - - int remainingSkipSize = abs(skipSize); - int totalLength = length + remainingSkipSize; - int memIndx = 0x6000 * 16; - while (totalLength > 0) { - f.read(&g_mem[memIndx], 128); - testfi(); - totalLength -= 128; - memIndx += 128; - } - f.close(); - - for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - g_mem[0x7000 * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; -} - -void charani(Common::String filename, int32 skipSize, int length) { - Common::File f; - if (!f.open(filename)) - error("Missing file - %s", filename.c_str()); - - int skipBlock = 0; - while (skipSize > 127) { - skipSize = skipSize - 128; - ++skipBlock; - } - if (skipBlock != 0) - f.seek(skipBlock * 0x80); - - int remainingSkipSize = abs(skipSize); - int fullLength = length + remainingSkipSize; - int memIndx = 0x6000 * 16; - while (fullLength > 0) { - f.read(&g_mem[memIndx], 128); - testfi(); - fullLength -= 128; - memIndx += 128; - } - f.close(); - - for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - g_mem[0x7314 * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; -} - -void taffich() { - byte tran1[] = { 121, 121, 138, 139, 120 }; // array<136, 140, byte> - byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; // array<153, 161, byte> - - int cx, handle, npal; - int32 lgt; - int alllum[16]; - - - int a = g_caff; - if ((a >= 153) && (a <= 161)) - a = tran2[a - 153]; - else if ((a >= 136) && (a <= 140)) - a = tran1[a - 136]; - int b = a; - if (g_maff == a) - return; - - switch (a) { - case 16: - g_s._pourc[9] = '*'; - g_s._teauto[42] = '*'; - break; - case 20: - g_s._teauto[39] = '*'; - if (g_s._teauto[36] == '*') { - g_s._pourc[3] = '*'; - g_s._teauto[38] = '*'; - } - break; - case 24: - g_s._teauto[37] = '*'; - break; - case 30: - g_s._teauto[9] = '*'; - break; - case 31: - g_s._pourc[4] = '*'; - g_s._teauto[35] = '*'; - break; - case 118: - g_s._teauto[41] = '*'; - break; - case 143: - g_s._pourc[1] = '*'; - break; - case 150: - g_s._teauto[34] = '*'; - break; - case 151: - g_s._pourc[2] = '*'; - break; - default: - break; - } - - g_vm->_okdes = true; - hideMouse(); - lgt = 0; - Common::String filename; - - if ((a != 50) && (a != 51)) { - int m = a + 2000; - if ((m > 2001) && (m < 2010)) - m = 2001; - if (m == 2011) - m = 2010; - if (a == 32) - m = 2034; - if ((a == 17) && (g_maff == 14)) - m = 2018; - - if (a > 99) { - if ((g_is == 1) || (g_is == 0)) - m = 2031; - else - m = 2032; - } - - if (((a > 69) && (a < 80)) || (a == 30) || (a == 31) || (a == 144) || (a == 147) || (a == 149)) - m = 2030; - - if (((a < 27) && (((g_maff > 69) && (!g_s._ipre)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) - m = 2033; - - g_maff = a; - if (a == 159) - a = 86; - else if (a > 140) - a = a - 67; - else if (a > 137) - a = a - 66; - else if (a > 99) - a = a - 64; - else if (a > 69) - a = a - 42; - else if (a > 29) - a = a - 5; - else if (a == 26) - a = 24; - else if (a > 18) - a = a - 1; - npal = a; - - for (cx = 0; cx <= (a - 1); ++cx) - lgt = lgt + g_l[cx]; - handle = g_l[a]; - - filename = "DXX.mor"; - } else { - filename = "DZZ.mor"; - handle = g_l[87]; - if (a == 51) { - lgt = handle; - handle = g_l[88]; - } - g_maff = a; - npal = a + 37; - } - chardes(filename, lgt, handle); - if (g_vm->_currGraphicalDevice == MODE_HERCULES) { - for (int i = 0; i <= 15; ++i) { - int palh = READ_LE_UINT16(&g_mem[(0x7000 * 16) + ((i + 1) << 1)]); - alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); - } - for (int i = 0; i <= 15; ++i) { - int k = 0; - for (int j = 0; j <= 15; ++j) - if (alllum[j] > alllum[k]) - k = j; - g_mem[(0x7000 * 16) + 2 + (k << 1)] = g_rang[i]; - alllum[k] = -1; - } - } - g_numpal = npal; - writepal(npal); - - if ((b < 15) || (b == 16) || (b == 17) || (b == 24) || (b == 26) || (b == 50)) { - lgt = 0; - if ((b < 15) || (b == 16) || (b == 17) || (b == 24) || (b == 26)) { - if (b == 26) - b = 18; - else if (b == 24) - b = 17; - else if (b > 15) - --b; - for (cx = 0; cx <= (b - 1); ++cx) - lgt += g_l[cx + 89]; - handle = g_l[b + 89]; - filename = "AXX.mor"; - } else if (b == 50) { - filename = "AZZ.mor"; - handle = 1260; - } - charani(filename, lgt, handle); - } - showMouse(); - if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { - if ((a == 13) || (a == 14)) - displayAloneText(); - else if (!g_vm->_blo) - cx = t11(g_s._currPlace); - g_mpers = 0; - } -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/taffich.h b/engines/mortevielle/taffich.h deleted file mode 100644 index 4bb5e77de1..0000000000 --- a/engines/mortevielle/taffich.h +++ /dev/null @@ -1,41 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_TAFFICH_H -#define MORTEVIELLE_TAFFICH_H - -#include "common/str.h" - -namespace Mortevielle { - -extern void chardes(Common::String filename, int32 passe, int long_); -extern void charani(Common::String filename, int32 skipSize, int length); -extern void taffich(); - -} // End of namespace Mortevielle - -#endif -- cgit v1.2.3