MORTEVIELLE: Convert f3/f8 dialog, alert dialog, and ques dialogs into classes

This commit is contained in:
Paul Gilbert 2012-02-13 20:51:36 +11:00 committed by Strangerke
parent a764471c4c
commit d738576f1c
16 changed files with 328 additions and 378 deletions

View file

@ -27,7 +27,7 @@
#include "common/scummsys.h"
#include "mortevielle/actions.h"
#include "mortevielle/alert.h"
#include "mortevielle/dialogs.h"
#include "mortevielle/level15.h"
#include "mortevielle/menu.h"
#include "mortevielle/mor.h"
@ -35,7 +35,6 @@
#include "mortevielle/mortevielle.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/ques.h"
#include "mortevielle/parole2.h"
#include "mortevielle/taffich.h"
#include "mortevielle/var_mor.h"
@ -529,12 +528,12 @@ void tmettre() {
repon(2, 165);
maivid();
parole(6, -9, 1);
quel = do_alert(g_vm->getString(S_YES_NO), 1);
quel = Alert::show(g_vm->getString(S_YES_NO), 1);
if (quel == 1) {
deline(582, st, tay);
i = do_alert(delig, 1);
i = Alert::show(delig, 1);
tesok = false;
entre = ques();
entre = Ques::show();
hide_mouse();
hirs();
dessine_rouleau();
@ -559,7 +558,7 @@ void tmettre() {
aniof(1, 2);
aniof(1, 1);
deline(577, st, tay);
i = do_alert(delig, 1);
i = Alert::show(delig, 1);
aniof(2, 1);
crep = 166;
}
@ -611,7 +610,7 @@ void ttourner() {
if ((s.mlieu == 13) && (s.ibag == 159) && (s.iboul == 141)) {
repon(2, 167);
parole(7, 9, 1);
quel = do_alert(g_vm->getString(S_YES_NO), 1);
quel = Alert::show(g_vm->getString(S_YES_NO), 1);
if (quel == 1)
g_vm->_endGame = true;
else crep = 168;
@ -620,7 +619,7 @@ void ttourner() {
repon(2, 175);
clsf3();
parole(6, -9, 1);
quel = do_alert(g_vm->getString(S_YES_NO), 1);
quel = Alert::show(g_vm->getString(S_YES_NO), 1);
if (quel == 1) {
s.mlieu = 16;
affrep();
@ -700,7 +699,7 @@ void tfrapper() {
if (!syn)
ecr3(g_vm->getString(S_HIT));
if (s.mlieu == 15) {
l = do_alert(g_vm->getString(S_BEFORE_USE_DEP_MENU), 1);
l = Alert::show(g_vm->getString(S_BEFORE_USE_DEP_MENU), 1);
return;
}
if (s.mlieu < 25) {
@ -930,7 +929,7 @@ void tdormir() {
h = h + 1;
if (h > 23) h = 0;
tinke();
quel = do_alert(g_vm->getString(S_YES_NO), 1);
quel = Alert::show(g_vm->getString(S_YES_NO), 1);
anyone = false;
} while (!(quel == 1));
crep = 998;
@ -992,7 +991,7 @@ void tattendre() {
return;
}
repon(2, 102);
quel = do_alert(g_vm->getString(S_YES_NO), 1);
quel = Alert::show(g_vm->getString(S_YES_NO), 1);
} while (!(quel == 2));
crep = 998;
if (! anyone) tinke();
@ -1259,7 +1258,7 @@ void MortevielleEngine::loseGame() {
heu = 10;
jou = 0;
repon(2, 180);
quel = do_alert(g_vm->getString(S_YES_NO), 1);
quel = Alert::show(g_vm->getString(S_YES_NO), 1);
_quitGame = (quel != 1);
}

View file

@ -26,113 +26,29 @@
*/
#include "common/str.h"
#include "mortevielle/alert.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"
namespace Mortevielle {
int do_alert(Common::String str_, int n);
static const int nligne = 7;
const int nligne = 7;
const int coord[3][4] = {
/*
static const int coord[3][4] = {
{0, 0, 0, 0},
{0, 150, 72, 103},
{0, 143, 107, 183}
};
*/
static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs) {
int i, k;
bool v;
//val(s[2], nbc, i);
nbc = atoi(s.c_str() + 1);
i = 0;
c = "";
nbl = 0;
i = 5;
k = 0;
v = true;
col = 0;
while (s[i] != ']') {
c = c + s[i];
if ((s[i] == '|') || (s[i + 1] == ']')) {
if (k > col) col = k;
k = 0;
nbl = nbl + 1;
} else if (s[i] != ' ') v = false;
i = i + 1;
k = k + 1;
}
if (v) {
c = "";
col = 20;
} else {
c = c + ']';
col = col + 6;
}
i = i + 1;
cs = copy(s, i, 30);
if (res == 2) col = col * 6;
else col = col * 10;
}
static void posit(int ji, int &coldep, int &esp) {
g_vm->_screenSurface.putxy(coldep + (40 + esp) *pred(int, ji), 98);
}
static void fait_boite(int lidep, int nli, int tx) {
int x, y, xx, yy;
if (tx > 640) tx = 640;
x = 320 - ((uint)tx >> 1);
y = pred(int, lidep) << 3;
xx = x + tx;
yy = y + (nli << 3);
g_vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy));
g_vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4));
g_vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2));
}
static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::String *str, int &esp) {
int i, l, x;
char ch;
i = 1;
x = coldep;
for (l = 1; l <= nbcase; l ++) {
str[l] = "";
do {
i = i + 1;
ch = c[i];
str[l] = str[l] + ch;
} while (!(c[i + 1] == ']'));
i = i + 2;
while (str[l].size() < 3) str[l] = str[l] + ' ';
g_vm->_screenSurface.putxy(x, 98);
Common::String tmp(" ");
tmp += str[l];
tmp += " ";
g_vm->_screenSurface.writeg(tmp, 0);
x = x + esp + 40;
}
}
int do_alert(Common::String str_, int n) {
int Alert::show(const Common::String &msg, int n) {
int coldep, esp, i, nbcase, quoi, ix;
Common::String st, chaine;
int limit[3][3];
@ -153,7 +69,7 @@ int do_alert(Common::String str_, int n) {
dumi = get_ch(); // input >> kbd >> dumi;
g_vm->setMouseClick(false);
decod(str_, nbcase, nblig, nbcol, chaine, cas);
decod(msg, nbcase, nblig, nbcol, chaine, cas);
sauvecr(50, succ(int, nligne) << 4);
i = 0;
@ -213,14 +129,14 @@ int do_alert(Common::String str_, int n) {
if (ix != quoi) {
hide_mouse();
if (quoi != 0) {
posit(quoi, coldep, esp);
setPosition(quoi, coldep, esp);
Common::String tmp(" ");
tmp += s[quoi];
tmp += " ";
g_vm->_screenSurface.writeg(tmp, 0);
}
posit(ix, coldep, esp);
setPosition(ix, coldep, esp);
Common::String tmp2 = " ";
tmp2 += s[ix];
@ -234,7 +150,7 @@ int do_alert(Common::String str_, int n) {
}
if ((quoi != 0) && ! newaff) {
hide_mouse();
posit(quoi, coldep, esp);
setPosition(quoi, coldep, esp);
Common::String tmp3(" ");
tmp3 += s[quoi];
@ -251,7 +167,7 @@ int do_alert(Common::String str_, int n) {
hide_mouse();
if (! test3) {
quoi = n;
posit(n, coldep, esp);
setPosition(n, coldep, esp);
Common::String tmp4(" ");
tmp4 += s[n];
tmp4 += " ";
@ -267,4 +183,265 @@ int do_alert(Common::String str_, int n) {
return do_alert_result;
}
void Alert::decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs) {
int i, k;
bool v;
//val(s[2], nbc, i);
nbc = atoi(s.c_str() + 1);
i = 0;
c = "";
nbl = 0;
i = 5;
k = 0;
v = true;
col = 0;
while (s[i] != ']') {
c = c + s[i];
if ((s[i] == '|') || (s[i + 1] == ']')) {
if (k > col) col = k;
k = 0;
nbl = nbl + 1;
} else if (s[i] != ' ') v = false;
i = i + 1;
k = k + 1;
}
if (v) {
c = "";
col = 20;
} else {
c = c + ']';
col = col + 6;
}
i = i + 1;
cs = copy(s, i, 30);
if (res == 2) col = col * 6;
else col = col * 10;
}
void Alert::setPosition(int ji, int coldep, int esp) {
g_vm->_screenSurface.putxy(coldep + (40 + esp) *pred(int, ji), 98);
}
void Alert::fait_boite(int lidep, int nli, int tx) {
int x, y, xx, yy;
if (tx > 640) tx = 640;
x = 320 - ((uint)tx >> 1);
y = pred(int, lidep) << 3;
xx = x + tx;
yy = y + (nli << 3);
g_vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy));
g_vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4));
g_vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2));
}
void Alert::fait_choix(Common::String c, int coldep, int nbcase, Common::String *str, int esp) {
int i, l, x;
char ch;
i = 1;
x = coldep;
for (l = 1; l <= nbcase; l ++) {
str[l] = "";
do {
i = i + 1;
ch = c[i];
str[l] = str[l] + ch;
} while (!(c[i + 1] == ']'));
i = i + 2;
while (str[l].size() < 3) str[l] = str[l] + ' ';
g_vm->_screenSurface.putxy(x, 98);
Common::String tmp(" ");
tmp += str[l];
tmp += " ";
g_vm->_screenSurface.writeg(tmp, 0);
x = x + esp + 40;
}
}
/*------------------------------------------------------------------------*/
bool Ques::show() {
const int ta[11] = {0, 511, 516, 524, 531, 545, 552, 559, 563, 570, 576};
const int ok[11] = {0, 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 };
bool q, func, test;
int i, j, k, y, memk;
int tay , tmax;
int rep, prem, der;
char st[1410];
char key;
rectangle coor[max_rect];
Common::String chaines[15];
int compte;
bool ques_result;
test = false;
i = 0;
compte = 0;
do {
hide_mouse();
hirs();
show_mouse();
i = i + 1;
deline(ta[i], st, tay);
if (res == 1) y = 29;
else y = 23;
g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, y));
afftex(st, 20, 15, 100, 2, 0);
if (i != 10) {
prem = ta[i] + 1;
der = ta[i + 1] - 1;
} else {
prem = 503;
der = 510;
}
y = 35;
tmax = 0;
memk = 1;
for (j = prem; j <= der; j ++) {
deline(j, st, tay);
if (tay > tmax) tmax = tay;
afftex(st, 100, y, 100, 1, 0);
chaines[memk] = delig;
memk = memk + 1;
y = y + 8;
}
for (j = 1; j <= succ(int, der - prem); j ++) {
{
rectangle &with = coor[j];
with.x1 = 45 * res;
with.x2 = (tmax * 3 + 55) * res;
with.y1 = 27 + j * 8;
with.y2 = 34 + j * 8;
with.etat = true;
}
while ((int)chaines[j].size() < tmax) {
chaines[j] = chaines[j] + ' ';
}
}
coor[j + 1].etat = false;
if (res == 1) rep = 10;
else rep = 6;
g_vm->_screenSurface.drawBox(80, 33, 40 + tmax * rep, (der - prem) * 8 + 16, 15);
rep = 0;
j = 0;
memk = 0;
do {
g_vm->setMouseClick(false);
tesok = false;
mov_mouse(func, key);
CHECK_QUIT0;
k = 1;
while (coor[k].etat && ! dans_rect(coor[k])) k = k + 1;
if (coor[k].etat) {
if ((memk != 0) && (memk != k)) {
for (j = 1; j <= tmax; j ++) st[j] = chaines[memk][j];
st[1 + tmax] = '$';
afftex(st, 100, 27 + memk * 8, 100, 1, 0);
}
if (memk != k) {
for (j = 1; j <= tmax; j ++) st[j] = chaines[k][j];
st[1 + tmax] = '$';
afftex(st, 100, 27 + k * 8, 100, 1, 1);
memk = k;
}
} else if (memk != 0) {
for (j = 1; j <= tmax; j ++) st[j] = chaines[memk][j];
st[1 + tmax] = '$';
afftex(st, 100, 27 + memk * 8, 100, 1, 0);
memk = 0;
}
} while (!((memk != 0) && g_vm->getMouseClick()));
if (memk == ok[i]) compte = compte + 1;
else {
if (i == 5) i = i + 1;
if ((i == 7) || (i == 8)) i = 10;
}
if (i == 10) q = /*testprot*/ true;
} while (!(i == 10));
ques_result = (compte == 10) && q;
return ques_result;
}
/*------------------------------------------------------------------------*/
/**
* Draw the F3/F8 dialog
*/
void f3f8::draw() {
Common::String f3 = g_vm->getString(S_F3);
Common::String f8 = g_vm->getString(S_F8);
// Write the F3 and F8 text strings
g_vm->_screenSurface.putxy(3, 44);
g_vm->_screenSurface.writeg(f3, 5);
g_vm->_screenSurface._textPos.y = 51;
g_vm->_screenSurface.writeg(f8, 5);
// Get the width of the written text strings
int f3Width = g_vm->_screenSurface.getStringWidth(f3);
int f8Width = g_vm->_screenSurface.getStringWidth(f8);
// Write out the bounding box
g_vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 16, 7);
}
void f3f8::divers(int np, bool b) {
teskbd();
do {
parole(np, 0, 0);
atf3f8(key);
CHECK_QUIT;
if (newgd != gd) {
gd = newgd;
hirs();
aff50(b);
}
} while (!(key == 66));
}
void f3f8::atf3f8(int &key) {
do {
key = testou();
CHECK_QUIT;
} while (!((key == 61) || (key == 66)));
}
void f3f8::aff50(bool c) {
caff = 50;
maff = 0;
taffich();
dessine(ades, 63, 12);
if (c)
ani50();
else
repon(2, c_paroles + 142);
// Draw the f3/f8 dialog
draw();
}
void f3f8::ani50() {
crep = animof(1, 1);
pictout(adani, crep, 63, 12);
crep = animof(2, 1);
pictout(adani, crep, 63, 12);
f2_all = (res == 1);
repon(2, c_paroles + 143);
}
} // End of namespace Mortevielle

View file

@ -32,8 +32,29 @@
namespace Mortevielle {
extern int do_alert(Common::String str_, int n);
extern int do_alert(Common::String str_, int n);
class Alert {
private:
static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs);
static void setPosition(int ji, int coldep, int esp);
static void fait_boite(int lidep, int nli, int tx);
static void fait_choix(Common::String c, int coldep, int nbcase, Common::String *str, int esp);
public:
static int show(const Common::String &s, int n);
};
class Ques {
public:
static bool show();
};
class f3f8 {
public:
static void draw();
static void divers(int np, bool b);
static void atf3f8(int &key);
static void aff50(bool c);
static void ani50();
};
} // End of namespace Mortevielle
#endif

View file

@ -2,9 +2,9 @@ MODULE := engines/mortevielle
MODULE_OBJS := \
actions.o \
alert.o \
asm.o \
detection.o \
dialogs.o \
graphics.o \
keyboard.o \
level15.o \
@ -18,7 +18,6 @@ MODULE_OBJS := \
parole.o \
parole2.o \
prog.o \
ques.o \
saveload.o \
sound.o \
taffich.o \

View file

@ -29,7 +29,7 @@
#include "common/str.h"
#include "common/system.h"
#include "common/textconsole.h"
#include "mortevielle/alert.h"
#include "mortevielle/dialogs.h"
#include "mortevielle/graphics.h"
#include "mortevielle/level15.h"
#include "mortevielle/menu.h"
@ -47,7 +47,7 @@ const int ioresult = 0;
void testfi() {
if (ioresult != 0) {
caff = do_alert(err_mess, 1);
caff = Alert::show(err_mess, 1);
g_vm->quitGame();
}
}
@ -403,24 +403,6 @@ void repon(int f, int m) {
}
}
void f3f8() {
Common::String f3 = g_vm->getString(S_F3);
Common::String f8 = g_vm->getString(S_F8);
// Write the F3 and F8 text strings
g_vm->_screenSurface.putxy(3, 44);
g_vm->_screenSurface.writeg(f3, 5);
g_vm->_screenSurface._textPos.y = 51;
g_vm->_screenSurface.writeg(f8, 5);
// Get the width of the written text strings
int f3Width = g_vm->_screenSurface.getStringWidth(f3);
int f8Width = g_vm->_screenSurface.getStringWidth(f8);
// Write out the bounding box
g_vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 16, 7);
}
void t5(int cx) {
/* debug('t5'); */
if (cx == 10) blo = false;

View file

@ -62,7 +62,6 @@ extern void okpas();
extern void modobj(int m);
extern void modobj2(int m, bool t1, bool t2);
extern void repon(int f, int m);
extern void f3f8();
extern void t5(int cx);
extern void affper(int per);
extern void choix(int min, int max, int &per);

View file

@ -26,7 +26,7 @@
*/
#include "mortevielle/mor2.h"
#include "mortevielle/alert.h"
#include "mortevielle/dialogs.h"
#include "mortevielle/keyboard.h"
#include "mortevielle/menu.h"
#include "mortevielle/mor.h"
@ -280,13 +280,6 @@ void mfouen()
g_vm->_menu.menut(soulever, g_vm->getString(S_RAISE));
}
void atf3f8(int &key) {
do {
key = testou();
CHECK_QUIT;
} while (!((key == 61) || (key == 66)));
}
/* NIVEAU 6 */
void tperd() {
@ -394,12 +387,12 @@ void sparl(float adr, float rep) {
hide_mouse();
deline(repint + c_paroles, st, tay);
afftex(st, 230, 4, 65, 24, 5);
f3f8();
f3f8::draw();
key = 0;
do {
parole(repint, haut[caff - 69], 0);
atf3f8(key);
f3f8::atf3f8(key);
CHECK_QUIT;
} while (!(key == 66));
hirs();
@ -631,7 +624,7 @@ void tfleche() {
tinke();
} while (!(qust || rect || anyone));
if (qust && (touch == '\103')) dummy = do_alert(stpou, 1);
if (qust && (touch == '\103')) dummy = Alert::show(stpou, 1);
} while (!((touch == '\73') || ((touch == '\104') && (x != 0) && (y != 0)) ||
(anyone) || (rect)));
if (touch == '\73') iesc = true;
@ -767,7 +760,7 @@ void st13(int ob) {
void aldepl() {
int dummy;
dummy = do_alert(g_vm->getString(S_USE_DEP_MENU), 1);
dummy = Alert::show(g_vm->getString(S_USE_DEP_MENU), 1);
}
} // End of namespace Mortevielle

View file

@ -41,7 +41,6 @@ extern void tlu(int af, int ob);
extern void delin(int n);
extern void affrep();
extern void mfouen();
extern void atf3f8(int &key);
/* NIVEAU 6 */
extern void tperd();
extern void tsort();

View file

@ -30,7 +30,7 @@
#include "graphics/pixelformat.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/actions.h"
#include "mortevielle/alert.h"
#include "mortevielle/dialogs.h"
#include "mortevielle/asm.h"
#include "mortevielle/keyboard.h"
#include "mortevielle/level15.h"
@ -467,13 +467,13 @@ Common::Error MortevielleEngine::run() {
* Show the game introduction
*/
void MortevielleEngine::showIntroduction() {
aff50(false);
f3f8::aff50(false);
mlec = 0;
divers(142, false);
f3f8::divers(142, false);
CHECK_QUIT;
ani50();
divers(143, true);
f3f8::ani50();
f3f8::divers(143, true);
CHECK_QUIT;
// TODO: Once music is implemented, only use the below delay if music is turned off
@ -482,21 +482,6 @@ void MortevielleEngine::showIntroduction() {
music();
}
void MortevielleEngine::divers(int np, bool b) {
teskbd();
do {
parole(np, 0, 0);
atf3f8(key);
CHECK_QUIT;
if (newgd != gd) {
gd = newgd;
hirs();
aff50(b);
}
} while (!(key == 66));
}
/**
* Main game loop. Handles potentially playing the game multiple times, such as if the player
* loses, and chooses to start playing the game again.
@ -583,7 +568,7 @@ void MortevielleEngine::handleAction() {
if (choisi && (msg[3] == charge))
g_vm->_savegameManager.loadGame((msg[4] & 7) - 1);
if (inkey == '\103') { /* F9 */
temps = do_alert(stpou, 1);
temps = Alert::show(stpou, 1);
return;
} else if (inkey == '\77') {
if ((mnumo != no_choice) && ((msg[3] == action) || (msg[3] == saction))) {

View file

@ -93,7 +93,6 @@ private:
void mainGame();
void playGame();
void handleAction();
void divers(int np, bool b);
public:
ScreenSurface _screenSurface;
PaletteManager _paletteManager;

View file

@ -26,7 +26,7 @@
*/
#include "common/file.h"
#include "mortevielle/alert.h"
#include "mortevielle/dialogs.h"
#include "mortevielle/keyboard.h"
#include "mortevielle/level15.h"
#include "mortevielle/menu.h"
@ -52,25 +52,6 @@ void dem2() {
// Deprecated under ScummVM
}
void ani50() {
crep = animof(1, 1);
pictout(adani, crep, 63, 12);
crep = animof(2, 1);
pictout(adani, crep, 63, 12);
f2_all = (res == 1);
repon(2, c_paroles + 143);
}
void aff50(bool c) {
caff = 50;
maff = 0;
taffich();
dessine(ades, 63, 12);
if (c) ani50();
else repon(2, c_paroles + 142);
f3f8();
}
void charpal() {
Common::File f; // tabdb records
Common::File ft; // tfxx

View file

@ -31,9 +31,7 @@
namespace Mortevielle {
extern void dem2();
extern void ani50();
//extern void apzuul();
extern void aff50(bool c);
extern void charpal();
extern void chartex();
extern void dialpre();

View file

@ -26,7 +26,7 @@
*/
#include "mortevielle/actions.h"
#include "mortevielle/alert.h"
#include "mortevielle/dialogs.h"
#include "mortevielle/menu.h"
#include "mortevielle/mor.h"
#include "mortevielle/mor2.h"

View file

@ -1,144 +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/str.h"
#include "mortevielle/level15.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/ques.h"
namespace Mortevielle {
bool ques() {
const int ta[11] = {0, 511, 516, 524, 531, 545, 552, 559, 563, 570, 576};
const int ok[11] = {0, 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 };
bool q, func, test;
int i, j, k, y, memk;
int tay , tmax;
int rep, prem, der;
char st[1410];
char key;
rectangle coor[max_rect];
Common::String chaines[15];
int compte;
bool ques_result;
test = false;
i = 0;
compte = 0;
do {
hide_mouse();
hirs();
show_mouse();
i = i + 1;
deline(ta[i], st, tay);
if (res == 1) y = 29;
else y = 23;
g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, y));
afftex(st, 20, 15, 100, 2, 0);
if (i != 10) {
prem = ta[i] + 1;
der = ta[i + 1] - 1;
} else {
prem = 503;
der = 510;
}
y = 35;
tmax = 0;
memk = 1;
for (j = prem; j <= der; j ++) {
deline(j, st, tay);
if (tay > tmax) tmax = tay;
afftex(st, 100, y, 100, 1, 0);
chaines[memk] = delig;
memk = memk + 1;
y = y + 8;
}
for (j = 1; j <= succ(int, der - prem); j ++) {
{
rectangle &with = coor[j];
with.x1 = 45 * res;
with.x2 = (tmax * 3 + 55) * res;
with.y1 = 27 + j * 8;
with.y2 = 34 + j * 8;
with.etat = true;
}
while ((int)chaines[j].size() < tmax) {
chaines[j] = chaines[j] + ' ';
}
}
coor[j + 1].etat = false;
if (res == 1) rep = 10;
else rep = 6;
g_vm->_screenSurface.drawBox(80, 33, 40 + tmax * rep, (der - prem) * 8 + 16, 15);
rep = 0;
j = 0;
memk = 0;
do {
g_vm->setMouseClick(false);
tesok = false;
mov_mouse(func, key);
CHECK_QUIT0;
k = 1;
while (coor[k].etat && ! dans_rect(coor[k])) k = k + 1;
if (coor[k].etat) {
if ((memk != 0) && (memk != k)) {
for (j = 1; j <= tmax; j ++) st[j] = chaines[memk][j];
st[1 + tmax] = '$';
afftex(st, 100, 27 + memk * 8, 100, 1, 0);
}
if (memk != k) {
for (j = 1; j <= tmax; j ++) st[j] = chaines[k][j];
st[1 + tmax] = '$';
afftex(st, 100, 27 + k * 8, 100, 1, 1);
memk = k;
}
} else if (memk != 0) {
for (j = 1; j <= tmax; j ++) st[j] = chaines[memk][j];
st[1 + tmax] = '$';
afftex(st, 100, 27 + memk * 8, 100, 1, 0);
memk = 0;
}
} while (!((memk != 0) && g_vm->getMouseClick()));
if (memk == ok[i]) compte = compte + 1;
else {
if (i == 5) i = i + 1;
if ((i == 7) || (i == 8)) i = 10;
}
if (i == 10) q = /*testprot*/ true;
} while (!(i == 10));
ques_result = (compte == 10) && q;
return ques_result;
}
} // End of namespace Mortevielle

View file

@ -1,38 +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_QUES_H
#define MORTEVIELLE_QUES_H
#include "common/str.h"
namespace Mortevielle {
extern bool ques();
} // End of namespace Mortevielle
#endif

View file

@ -27,7 +27,7 @@
#include "common/file.h"
#include "common/system.h"
#include "mortevielle/alert.h"
#include "mortevielle/dialogs.h"
#include "mortevielle/mor.h"
#include "mortevielle/mor2.h"
#include "mortevielle/mortevielle.h"