MORTEVIELLE: regroup several files

This commit is contained in:
Strangerke 2012-03-10 09:46:51 +01:00
parent 6073019083
commit 79dd918033
22 changed files with 1298 additions and 1626 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -26,33 +26,152 @@
*/
#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);
}
void testfi() {
if (ioresult != 0) {
// Theoritical message
warning("IO Error");
g_vm->quitGame();
/**
* 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;
}
/**
* Read the current system time
*/
@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -25,10 +25,13 @@
* Copyright (c) 1988-1989 Lankhor
*/
#include "common/endian.h"
#include "common/file.h"
#include "mortevielle/parole.h"
#include "mortevielle/speech.h"
#include "mortevielle/sound.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/mor.h"
#include "mortevielle/var_mor.h"
namespace Mortevielle {
@ -451,4 +454,90 @@ void trait_car() {
} // 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

View File

@ -44,5 +44,10 @@ 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

View File

@ -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

View File

@ -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