MORTEVIELLE: More compilation fixes

This commit is contained in:
Paul Gilbert 2011-12-31 18:21:02 +11:00 committed by Strangerke
parent 4dd8bce651
commit ab089af889
19 changed files with 148 additions and 71 deletions

View File

@ -33,6 +33,7 @@
#include "mortevielle/mor2.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/ques.h"
#include "mortevielle/parole2.h"
#include "mortevielle/var_mor.h"
@ -43,7 +44,8 @@ const char stouinon[] = "[2][ ][OUI][NON]";
/* overlay */
void taller() {
int mx, cx, cy;
//int mx, cx, cy;
int cx;
if ((s.mlieu == 26) && (msg[4] == depl[6])) {
s.mlieu = 15;
@ -132,7 +134,8 @@ L2:
}
/* overlay */ void tprendre() {
int cx, cy, cz;
//int cx, cy, cz;
int cx;
if (caff > 99) {
cx = caff;
@ -273,7 +276,7 @@ L2:
}
/* overlay */ void tlire() {
int iaff;
// int iaff;
if (caff > 99) st4(caff);
else {

View File

@ -29,6 +29,7 @@
#include "mortevielle/alert.h"
#include "mortevielle/level15.h"
#include "mortevielle/mouse.h"
#include "mortevielle/sprint.h"
namespace Mortevielle {
@ -48,7 +49,10 @@ static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String
int i, k;
bool v;
val(s[2], nbc, i);
//val(s[2], nbc, i);
sscanf(s.c_str() + 1, "%d", nbc);
i = 0;
c = "";
nbl = 0;
i = 5;
@ -102,7 +106,7 @@ 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) {
static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::String[3] &str, int &esp) {
int i, l, x;
char ch;

View File

@ -32,5 +32,6 @@ namespace Mortevielle {
extern void boite(int x, int y, int dx, int dy, int coul);
} // End of namespace Mortevielle
#endif

View File

@ -29,7 +29,10 @@
#include "common/system.h"
#include "common/savefile.h"
#include "common/serializer.h"
#include "mortevielle/alert.h"
#include "mortevielle/ovd1.h"
#include "mortevielle/disk.h"
#include "mortevielle/mouse.h"
#include "mortevielle/var_mor.h"
namespace Mortevielle {

View File

@ -27,8 +27,8 @@
#include "common/file.h"
#include "mortevielle/level15.h"
#include "mortevielle/var_mor.h"
#include "mortevielle/mouse.h"
#include "mortevielle/var_mor.h"
namespace Mortevielle {

View File

@ -31,6 +31,7 @@
#include "mortevielle/level15.h"
#include "mortevielle/menu.h"
#include "mortevielle/mouse.h"
#include "mortevielle/sprint.h"
#include "mortevielle/var_mor.h"
namespace Mortevielle {
@ -82,22 +83,22 @@ namespace Mortevielle {
switch (h) {
case invent : {
if (l > 6) {
inv[l][1] = '<';
inv[l][22] = '>';
} else inv[l][1] = '*';
inv[l].setChar('<', 1);
inv[l].setChar('>', 22);
} else inv[l].setChar('*', 1);
}
break;
case depla :
dep[l][1] = '*';
dep[l].setChar('*', 1);
break;
case action :
act[l][1] = '*';
act[l].setChar('*', 1);
break;
case saction :
self_[l][1] = '*';
self_[l].setChar('*', 1);
break;
case discut :
dis[l][1] = '*';
dis[l].setChar('*', 1);
break;
}
}
@ -110,30 +111,30 @@ namespace Mortevielle {
l = lo(no);
switch (h) {
case invent : {
inv[l][1] = ' ';
inv[l][22] = ' ';
inv[l].setChar(' ', 1);
inv[l].setChar(' ', 22);
}
break;
case depla :
dep[l][1] = ' ';
dep[l].setChar(' ', 1);
break;
case action :
act[l][1] = ' ';
act[l].setChar(' ', 1);
break;
case saction : {
self_[l][1] = ' ';
self_[l][1] = ' ';
self_[l].setChar(' ', 1);
self_[l].setChar(' ', 1);
}
break;
case discut :
dis[l][1] = ' ';
dis[l].setChar(' ', 1);
break;
}
}
void menu_aff() {
int ind_tabl, k, col;
char c;
// char c;
int pt, x, y, color, msk,
num_letr;
@ -237,7 +238,7 @@ void util(int x, int y) {
else ix = 3;
xmx = dxcar * ix * res + xmn + 2;
if ((x > xmn) && (x < xmx) && (y < ymx) && (y > 15)) {
ix = pred(int, (uint)y >> 3) + (msg3 << 8);
ix = pred(int, ((uint)y >> 3)) + (msg3 << 8);
if (ix != msg4) {
invers(1);
msg4 = ix;
@ -318,7 +319,8 @@ void erase_menu() {
}
void mdn() {
int x, y, c, a, ix;
//int x, y, c, a, ix;
int x, y, ix;
bool tes;
/* debug('mdn'); */

View File

@ -36,6 +36,7 @@
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/parole2.h"
#include "mortevielle/sprint.h"
#include "mortevielle/var_mor.h"
namespace Mortevielle {
@ -43,6 +44,8 @@ namespace Mortevielle {
/* Niveau 14 suite */
const char m1[] = "quelqu'un entre, parait tonn mais ne dit rien";
// For ScummVM, we need to do check for file errors where we do the file access
const int ioresult = 0;
void testfi() {
if (ioresult != 0) {
@ -225,8 +228,8 @@ void ecr2(Common::String str_) {
else tab = 6;
putxy(8, 177);
tlig = 59 + pred(int, res) * 36;
if (str_.size() < tlig) writeg(str_, 5);
else if (str_.size() < (tlig << 1)) {
if ((int)str_.size() < tlig) writeg(str_, 5);
else if ((int)str_.size() < (tlig << 1)) {
putxy(8, 176);
writeg(copy(str_, 1, pred(int, tlig)), 5);
putxy(8, 182);
@ -237,7 +240,7 @@ void ecr2(Common::String str_) {
putxy(8, 176);
writeg(copy(str_, 1, pred(int, tlig)), 5);
putxy(8, 182);
writeg(copy(str_, tlig, pred(int, tlig << 1)), 5);
writeg(copy(str_, tlig, pred(int, (tlig << 1))), 5);
putxy(8, 190);
writeg(copy(str_, tlig << 1, tlig * 3), 5);
}

View File

@ -28,22 +28,21 @@
#include "mortevielle/mor2.h"
#include "mortevielle/alert.h"
#include "mortevielle/boite.h"
#include "mortevielle/var_mor.h"
#include "mortevielle/keyboard.h"
#include "mortevielle/menu.h"
#include "mortevielle/mor.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/parole2.h"
#include "mortevielle/taffich.h"
#include "mortevielle/var_mor.h"
namespace Mortevielle {
const array<1, 11, int> men
= {{
const int men[12] = { 0,
scacher, attacher, defoncer, dormir,
entrer, fermer, frapper, manger,
mettre, ouvrir, sortir
}
};
void tinke() {
@ -377,8 +376,7 @@ void modinv() {
}
void sparl(float adr, float rep) {
const array<1, 8, int> haut
= {{0, 1, -3, 6, -2, 2, 7, -1}};
const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 };
int key, ad, tay, repint;
char st[1410];

View File

@ -25,8 +25,6 @@
* Copyright (c) 1988-1989 Lankhor
*/
#include "ptoc.h"
#include "mortevielle/mort.h"
#include "mortevielle/var_mor.h" /* les variables */
#include "mortevielle/keyboard.h" /* la gestion du clavier */

View File

@ -27,6 +27,7 @@
#include "mortevielle/outtext.h"
#include "mortevielle/level15.h"
#include "mortevielle/sprint.h"
#include "mortevielle/var_mor.h"
#include "common/str.h"
@ -59,14 +60,15 @@ const byte tab31[32]= {
};
void deline(int num , char *l , int &tl);
typedef unsigned char uchar;
static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end) {
const unsigned char rap[32] = {
',', ':', '@', '!', '?', '-', '\207',
'\240', '\205', '\203', '\202', '\212', '\210', '/',
'\213', '\214', '\242', '\047', '\223', '"', '\227',
'\226', '0', '1', '2', '3', '4', '5',
'6', '7', '8', '9'
const uchar rap[32] = {
(uchar)',', (uchar)':', (uchar)'@', (uchar)'!', (uchar)'?', (uchar)'-', (uchar)'\207',
(uchar)'\240', (uchar)'\205', (uchar)'\203', (uchar)'\202', (uchar)'\212', (uchar)'\210', (uchar)'/',
(uchar)'\213', (uchar)'\214', (uchar)'\242', (uchar)'\047', (uchar)'\223', (uchar)'"', (uchar)'\227',
(uchar)'\226', (uchar)'0', (uchar)'1', (uchar)'2', (uchar)'3', (uchar)'4', (uchar)'5',
(uchar)'6', (uchar)'7', (uchar)'8', (uchar)'9'
};
int oct, ocd;

View File

@ -26,11 +26,19 @@
*/
#include "common/file.h"
#include "mortevielle/alert.h"
#include "mortevielle/level15.h"
#include "mortevielle/mor.h"
#include "mortevielle/outtext.h"
#include "mortevielle/ovd1.h"
#include "mortevielle/traffich.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 dem2() {
/* Deprecated check for disk 2
@ -142,7 +150,7 @@ void ani50() {
reset(ft);
if (ioresult != 0) {
caff = do_alert(err_mess, 1);
exit(0);
mortevielle_exit(0);
}
ft >> l;
close(ft);
@ -176,24 +184,27 @@ void ani50() {
/* overlay */ void chartex() {
int i;
Common::File fibyte;
Common::File f;
char s[1410];
/* debug('o3 chartex'); */
i = 0;
if (!fibyte.open("TXX.INP"))
error("missing file - TXX.INP");
if (!f.open("TXX.INP"))
error("Missing file - TXX.INP");
fibyte.read(&t_mot, 125);
f.read(&t_mot, 125);
f.close();
close(fibyte);
assign(sauv_t, "TXX.NTP");
reset(sauv_t);
if (!f.open("TXX.NTP"))
error("Missing file - TXX.NTP");
do {
sauv_t >> t_rec[i];
t_rec[i].indis = f.readSint16LE();
t_rec[i].point = f.readByte();
i = i + 1;
} while (!(eof(sauv_t)));
close(sauv_t);
} while (!f.eos());
f.close();
deline(578, s, i);
al_mess = delig;
deline(579, s, i);
@ -265,7 +276,7 @@ void ani50() {
do {
input >> kbd >> ch;
} while ((ch != 'C') && (ch != 'S'));
int_m = (upcase(ch) == 'S');
int_m = (toupper(ch) == 'S');
}
/* overlay */ void init_lieu() {

View File

@ -26,6 +26,7 @@
*/
#include "mortevielle/parole2.h"
#include "mortevielle/parole.h"
#include "mortevielle/var_mor.h"
namespace Mortevielle {

View File

@ -26,10 +26,12 @@
*/
#include "mortevielle/actions.h"
#include "mortevielle/alert.h"
#include "mortevielle/menu.h"
#include "mortevielle/mor.h"
#include "mortevielle/mor2.h"
#include "mortevielle/prog.h"
#include "mortevielle/traffich.h"
#include "mortevielle/var_mor.h"
#include "mortevielle/mouse.h"

View File

@ -25,10 +25,12 @@
* Copyright (c) 1988-1989 Lankhor
*/
#include "common/str.h"
#include "mortevielle/boite.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/ques.h"
#include "common/str.h"
#include "mortevielle/sprint.h"
namespace Mortevielle {

View File

@ -26,6 +26,7 @@
*/
#include "common/str.h"
#include "common/textconsole.h"
#include "mortevielle/mouse.h"
#include "mortevielle/sprint.h"
#include "mortevielle/var_mor.h"
@ -87,4 +88,9 @@ void writeg(Common::String l, int c)
show_mouse();
}
void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt) {
warning("TODO: box method not yet implemented");
}
} // End of namespace Mortevielle

View File

@ -35,6 +35,7 @@ namespace Mortevielle {
extern void fill_box(int x, int y, int dx);
extern void clear_box(int x, int y, int dx);
extern void writeg(Common::String l, int c);
extern void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt);
} // End of namespace Mortevielle
#endif

View File

@ -27,6 +27,7 @@
#include "common/file.h"
#include "common/str.h"
#include "mortevielle/mor.h"
#include "mortevielle/mouse.h"
#include "mortevielle/taffich.h"
#include "mortevielle/var_mor.h"
@ -98,14 +99,9 @@ void charani(Common::String nom, float passe, int long_) {
}
void taffich() {
const array<136, 140, byte> tran1
= {{ 121, 121, 138, 139, 120 }};
const array<153, 161, byte> tran2
= {{
150, 150, 152, 152, 100,
110, 159, 100, 100
}
};
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 i, m, a, b, cx, handle,
npal;
float lgt, lhandle;
@ -116,9 +112,9 @@ void taffich() {
a = caff;
if ((a >= 153) && (a <= 161))
a = tran2[a];
a = tran2[a - 153];
else if ((a >= 136) && (a <= 140))
a = tran1[a];
a = tran1[a - 136];
b = a;
if (maff == a) return;
if (a == 16) {

View File

@ -25,8 +25,10 @@
* Copyright (c) 1988-1989 Lankhor
*/
#include "mortevielle/var_mor.h"
#include "common/str.h"
#include "common/textconsole.h"
#include "mortevielle/sprint.h"
#include "mortevielle/var_mor.h"
namespace Mortevielle {
@ -248,11 +250,13 @@ void hirs() {
break;
case ams : {
hires;
inline_((float)(0xb8) / 6 / 0 / /* => mov ax,6 */
0xcd / 0x10); /* => int 16 */
/*
inline_((float)(0xb8) / 6 / 0 / // => mov ax,6
0xcd / 0x10); // => int 16
port[0x3d9] = 15;
port[0x3df] = 0;
port[0x3dd] = 15;
*/
res = 2;
}
break;
@ -295,6 +299,9 @@ void hirs() {
}
/* procedure affput(Chx,Gd,x,y,coul,char:int); external 'c:\mc\divaf.com'; */
void affput(int Chx, int Gd, int x, int y, int coul, int char_) {
warning("TODO: Implement affput");
}
void affcar(int gd, int x, int y, int coul, int chr) {
if (res == 1) affput(1, gd, ((uint)x >> 1), y, coul, chr);
@ -305,4 +312,27 @@ void putpix(int gd, int x, int y, int coul) {
affput(0, gd, x, y, coul, 0);
}
/**
* Returns a substring of the given string
* @param s Source string
* @param idx Starting index (1 based)
* @param size Number of characters to return
*/
Common::String copy(const Common::String &s, int idx, size_t size) {
// Copy the substring into a temporary buffer
char *tmp = new char[size + 1];
strncpy(tmp, s.c_str() + idx - 1, size);
tmp[size] = '\0';
Common::String result(tmp);
delete tmp;
return result;
}
/*---------------------------------------------------------------------------*/
/*------------------------------ STUBS ------------------------------*/
/*---------------------------------------------------------------------------*/
int port[0xfff];
} // End of namespace Mortevielle

View File

@ -51,12 +51,9 @@ namespace Mortevielle {
#define chr(v) ((char) v)
#define lo(v) (v & 0xff)
#define hi(v) ((v >> 8) & 0xff)
#define swap(v) (((lo(v)) << 8) | ((hi(v)) >> 8))
#define odd(v) ((v % 2) == 1)
// TODO: Replace the following with proper implementations
#define mortevielle_exit(ret) error("Exit the game")
#define clrscr {}
/*---------------------------------------------------------------------------*/
/*------------------------- CONSTANTS ----------------------------------*/
/*---------------------------------------------------------------------------*/
@ -393,6 +390,23 @@ extern pattern tpt[15];
void hirs();
void affcar(int gd, int x, int y, int coul, int chr);
void putpix(int gd, int x, int y, int coul);
Common::String copy(const Common::String &s, int idx, size_t size);
void Val(const Common::String &s, int &V, int Code);
void affput(int Chx, int Gd, int x, int y, int coul, int char_);
/*---------------------------------------------------------------------------*/
/*------------------------------ STUBS ------------------------------*/
/*---------------------------------------------------------------------------*/
// TODO: Replace the following with proper implementations, or refactor out the code using them
extern int port[0xfff];
#define hires {}
#define mortevielle_exit(ret) error("Exit the game")
// Text screen functions not relevant for ScummVM
#define clrscr {}
#define gotoxy(x,y) {}
} // End of namespace Mortevielle