MORTEVIELLE: Some more renaming. Move globals to the MortevielleEngine class

This commit is contained in:
Strangerke 2012-03-07 23:44:12 +01:00
parent 6217fa5e3e
commit 09c157b3b3
12 changed files with 132 additions and 121 deletions

View File

@ -1138,8 +1138,8 @@ void fctEnter() {
g_s._teauto[8] = '*';
} else {
int z = 0;
if (!g_blo)
t11(g_ment, z);
if (!g_vm->g_blo)
z = t11(g_ment);
if (z != 0) {
if ((g_ment == 3) || (g_ment == 7))
g_crep = 179;
@ -1297,8 +1297,8 @@ void fctWait() {
do {
++g_jh;
tinke();
if (!g_blo)
t11(g_s._currPlace, quel);
if (!g_vm->g_blo)
quel = t11(g_s._currPlace);
if ((g_ipers != 0) && (g_mpers == 0)) {
g_crep = 998;
if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR))

View File

@ -25,6 +25,7 @@
* Copyright (c) 1988-1989 Lankhor
*/
#include "mortevielle/mortevielle.h"
#include "mortevielle/keyboard.h"
#include "mortevielle/var_mor.h"
#include "mortevielle/asm.h"
@ -42,7 +43,7 @@ int testou() {
switch (ch) {
case '\23' :
g_soundOff = !g_soundOff;
g_vm->_soundOff = !g_vm->_soundOff;
break;
case '\26' :
if ((g_c_zzz == 1) || (g_c_zzz == 2)) {

View File

@ -385,33 +385,33 @@ void repon(int f, int m) {
void t5(int cx) {
if (cx == 10)
g_blo = false;
g_vm->g_blo = false;
if (cx != 1) {
g_bh1 = false;
g_bf1 = false;
g_vm->_roomPresenceLuc = false;
g_vm->_roomPresenceIda = false;
}
if (cx != 2)
g_bh2 = false;
g_vm->_purpleRoomPresenceLeo = false;
if (cx != 4) {
g_bh4 = false;
g_bf4 = false;
g_vm->_roomPresenceGuy = false;
g_vm->_roomPresenceEva = false;
}
if (cx != 5)
g_bh5 = false;
g_vm->_roomPresenceMax = false;
if (cx != 6)
g_bh6 = false;
g_vm->_roomPresenceBob = false;
if (cx != 8)
g_bh8 = false;
g_vm->_roomPresencePat = false;
if (cx != 3)
g_bt3 = false;
g_vm->_toiletsPresenceBobMax = false;
if (cx != 7)
g_bt7 = false;
g_vm->_bathRoomPresenceBobMax = false;
if (cx != 9)
g_bh9 = false;
g_vm->_room9PresenceLeo = false;
}
/**
@ -831,18 +831,18 @@ int getPresenceStatsChapel(int &hour) {
* Engine function - Check who is in the Green Room
* @remarks Originally called 'quelq1'
*/
void setPresenceGreenRoom(int l) {
int per = getRandomNumber(1, 2);
if (l == 1) {
if (per == 1)
g_bh1 = true;
void setPresenceGreenRoom(int roomId) {
int rand = getRandomNumber(1, 2);
if (roomId == GREEN_ROOM) {
if (rand == 1)
g_vm->_roomPresenceLuc = true;
else
g_bf1 = true;
} else if (l == 4) {
if (per == 1)
g_bh4 = true;
g_vm->_roomPresenceIda = true;
} else if (roomId == DARKBLUE_ROOM) {
if (rand == 1)
g_vm->_roomPresenceGuy = true;
else
g_bf4 = true;
g_vm->_roomPresenceEva = true;
}
g_ipers = 10;
@ -854,9 +854,9 @@ void setPresenceGreenRoom(int l) {
*/
void setPresencePurpleRoom() {
if (g_li == 2)
g_bh2 = true;
g_vm->_purpleRoomPresenceLeo = true;
else
g_bh9 = true;
g_vm->_room9PresenceLeo = true;
g_ipers = 10;
}
@ -866,7 +866,7 @@ void setPresencePurpleRoom() {
* @remarks Originally called 'quelq5'
*/
void setPresenceBlueRoom() {
g_bh5 = true;
g_vm->_roomPresenceMax = true;
g_ipers = 10;
}
@ -876,9 +876,9 @@ void setPresenceBlueRoom() {
*/
void setPresenceRedRoom(int l) {
if (l == 6)
g_bh6 = true;
g_vm->_roomPresenceBob = true;
else if (l == 8)
g_bh8 = true;
g_vm->_roomPresencePat = true;
g_ipers = 10;
}
@ -962,14 +962,14 @@ int setPresenceLanding() {
int rand = 0;
do {
rand = getRandomNumber(1, 8);
test = (((rand == 1) && (g_bh2 || g_bh9)) ||
((rand == 2) && g_bh8) ||
((rand == 3) && g_bh4) ||
((rand == 4) && g_bf4) ||
((rand == 5) && g_bh6) ||
((rand == 6) && g_bh1) ||
((rand == 7) && g_bf1) ||
((rand == 8) && g_bh5));
test = (((rand == 1) && (g_vm->_purpleRoomPresenceLeo || g_vm->_room9PresenceLeo)) ||
((rand == 2) && g_vm->_roomPresencePat) ||
((rand == 3) && g_vm->_roomPresenceGuy) ||
((rand == 4) && g_vm->_roomPresenceEva) ||
((rand == 5) && g_vm->_roomPresenceBob) ||
((rand == 6) && g_vm->_roomPresenceLuc) ||
((rand == 7) && g_vm->_roomPresenceIda) ||
((rand == 8) && g_vm->_roomPresenceMax));
} while (test);
int retVal = convertCharacterIndexToBitIndex(rand);
@ -1024,31 +1024,33 @@ void getKnockAnswer() {
}
}
void nouvp(int l, int &p) {
p = 0;
int nouvp(int l) {
int bitIndex = 0;
if (l == 1) {
if (g_bh1)
p = 4;
if (g_bf1)
p = 2;
} else if (((l == 2) && (g_bh2)) || ((l == 9) && (g_bh9)))
p = 128;
if (g_vm->_roomPresenceLuc)
bitIndex = 4; // LUC
if (g_vm->_roomPresenceIda)
bitIndex = 2; // IDA
} else if (((l == 2) && (g_vm->_purpleRoomPresenceLeo)) || ((l == 9) && (g_vm->_room9PresenceLeo)))
bitIndex = 128; // LEO
else if (l == 4) {
if (g_bh4)
p = 32;
if (g_bf4)
p = 16;
} else if ((l == 5) && (g_bh5))
p = 1;
else if ((l == 6) && (g_bh6))
p = 8;
else if ((l == 8) && (g_bh8))
p = 64;
else if (((l == 3) && (g_bt3)) || ((l == 7) && (g_bt7)))
p = 9;
if (g_vm->_roomPresenceGuy)
bitIndex = 32; // GUY
if (g_vm->_roomPresenceEva)
bitIndex = 16; // EVA
} else if ((l == 5) && (g_vm->_roomPresenceMax))
bitIndex = 1; // MAX
else if ((l == 6) && (g_vm->_roomPresenceBob))
bitIndex = 8; // BOB
else if ((l == 8) && (g_vm->_roomPresencePat))
bitIndex = 64; // PAT
else if (((l == 3) && (g_vm->_toiletsPresenceBobMax)) || ((l == 7) && (g_vm->_bathRoomPresenceBobMax)))
bitIndex = 9; // BOB + MAX
if (p != 9)
showPeoplePresent(p);
if (bitIndex != 9)
showPeoplePresent(bitIndex);
return bitIndex;
}
/**
@ -1084,19 +1086,19 @@ void ecfren(int &p, int &rand, int cf, int l) {
displayAloneText();
p = -500;
rand = 0;
if (((l == 1) && (!g_bh1) && (!g_bf1)) || ((l == 4) && (!g_bh4) && (!g_bf4)))
if (((l == 1) && (!g_vm->_roomPresenceLuc) && (!g_vm->_roomPresenceIda)) || ((l == 4) && (!g_vm->_roomPresenceGuy) && (!g_vm->_roomPresenceEva)))
p = getPresenceStatsGreenRoom();
if ((l == 2) && (!g_bh2) && (!g_bh9))
if ((l == 2) && (!g_vm->_purpleRoomPresenceLeo) && (!g_vm->_room9PresenceLeo))
p = getPresenceStatsPurpleRoom();
if (((l == 3) && (!g_bt3)) || ((l == 7) && (!g_bt7)))
if (((l == 3) && (!g_vm->_toiletsPresenceBobMax)) || ((l == 7) && (!g_vm->_bathRoomPresenceBobMax)))
p = getPresenceStatsToilets();
if ((l == 5) && (!g_bh5))
if ((l == 5) && (!g_vm->_roomPresenceMax))
p = getPresenceStatsBlueRoom();
if (((l == 6) && (!g_bh6)) || ((l == 8) && (!g_bh8)))
if (((l == 6) && (!g_vm->_roomPresenceBob)) || ((l == 8) && (!g_vm->_roomPresencePat)))
p = getPresenceStatsRedRoom();
if ((l == 9) && (!g_bh9) && (!g_bh2))
if ((l == 9) && (!g_vm->_room9PresenceLeo) && (!g_vm->_purpleRoomPresenceLeo))
p = 10;
if (((l == 2) && (g_bh9)) || ((l == 9) && (g_bh2)))
if (((l == 2) && (g_vm->_room9PresenceLeo)) || ((l == 9) && (g_vm->_purpleRoomPresenceLeo)))
p = -400;
if (p != -500) {
p += cf;
@ -1109,29 +1111,29 @@ void becfren(int l) {
int rand = getRandomNumber(1, 2);
if (l == 1) {
if (rand == 1)
g_bh1 = true;
g_vm->_roomPresenceLuc = true;
else
g_bf1 = true;
g_vm->_roomPresenceIda = true;
} else { // l == 4
if (rand == 1)
g_bh4 = true;
g_vm->_roomPresenceGuy = true;
else
g_bf4 = true;
g_vm->_roomPresenceEva = true;
}
} else if (l == 2)
g_bh2 = true;
g_vm->_purpleRoomPresenceLeo = true;
else if (l == 3)
g_bt3 = true;
g_vm->_toiletsPresenceBobMax = true;
else if (l == 5)
g_bh5 = true;
g_vm->_roomPresenceMax = true;
else if (l == 6)
g_bh6 = true;
g_vm->_roomPresenceBob = true;
else if (l == 7)
g_bt7 = true;
g_vm->_bathRoomPresenceBobMax = true;
else if (l == 8)
g_bh8 = true;
g_vm->_roomPresencePat = true;
else if (l == 9)
g_bh9 = true;
g_vm->_room9PresenceLeo = true;
}
/* NIVEAU 10 */
@ -1199,13 +1201,13 @@ void dprog() {
g_li = 21;
g_jh = 0;
if (!g_s._ipre)
g_blo = true;
g_vm->g_blo = true;
g_t = kTime1;
g_mh = readclock();
}
void pl1(int cf) {
if (((g_li == 1) && (!g_bh1) && (!g_bf1)) || ((g_li == 4) && (!g_bh4) && (!g_bf4))) {
if (((g_li == 1) && (!g_vm->_roomPresenceLuc) && (!g_vm->_roomPresenceIda)) || ((g_li == 4) && (!g_vm->_roomPresenceGuy) && (!g_vm->_roomPresenceEva))) {
int p = getPresenceStatsGreenRoom();
int rand;
phaz(rand, p, cf);
@ -1218,7 +1220,7 @@ void pl1(int cf) {
}
void pl2(int cf) {
if (!g_bh2) {
if (!g_vm->_purpleRoomPresenceLeo) {
int p = getPresenceStatsPurpleRoom();
int rand;
phaz(rand, p, cf);
@ -1231,7 +1233,7 @@ void pl2(int cf) {
}
void pl5(int cf) {
if (!g_bh5) {
if (!g_vm->_roomPresenceMax) {
int p = getPresenceStatsBlueRoom();
int rand;
@ -1245,7 +1247,7 @@ void pl5(int cf) {
}
void pl6(int cf) {
if (((g_li == 6) && (!g_bh6)) || ((g_li == 8) && (!g_bh8))) {
if (((g_li == 6) && (!g_vm->_roomPresenceBob)) || ((g_li == 8) && (!g_vm->_roomPresencePat))) {
int p = getPresenceStatsRedRoom();
int rand;
@ -1259,7 +1261,7 @@ void pl6(int cf) {
}
void pl9(int cf) {
if (!g_bh9) {
if (!g_vm->_room9PresenceLeo) {
cf = -10;
int p, rand;
phaz(rand, p, cf);
@ -1337,7 +1339,8 @@ void pl20(int cf) {
setPresenceChapel(h);
}
void t11(int l11, int &a) {
int t11(int l11) {
int retVal = 0;
int p, rand;
ecfren(p, rand, g_s._faithScore, l11);
@ -1346,13 +1349,13 @@ void t11(int l11, int &a) {
if (p != -500) {
if (rand > p) {
displayAloneText();
a = 0;
retVal = 0;
} else {
becfren(g_li);
nouvp(g_li, a);
retVal = nouvp(g_li);
}
} else
nouvp(g_li, a);
retVal = nouvp(g_li);
}
if (l11 > 9) {
@ -1376,7 +1379,7 @@ void t11(int l11, int &a) {
rand = getRandomNumber(1, 100);
if (rand > p) {
displayAloneText();
a = 0;
retVal = 0;
} else {
if (l11 == 10)
p = setPresenceDiningRoom(h);
@ -1388,10 +1391,12 @@ void t11(int l11, int &a) {
p = setPresenceLanding();
else if (l11 == 20)
p = setPresenceChapel(h);
a = p;
retVal = p;
}
}
}
return retVal;
}
void cavegre() {

View File

@ -80,7 +80,7 @@ extern int getPresenceStatsKitchen();
extern int getPresenceStatsAttic();
extern int getPresenceStatsLanding();
extern int getPresenceStatsChapel(int &hour);
extern void setPresenceGreenRoom(int l);
extern void setPresenceGreenRoom(int roomId);
extern void setPresencePurpleRoom();
extern void setPresenceBlueRoom();
extern void setPresenceRedRoom(int l);
@ -90,7 +90,7 @@ extern int setPresenceKitchen();
extern int setPresenceLanding();
extern int setPresenceChapel(int hour);
extern void getKnockAnswer();
extern void nouvp(int l, int &p);
extern int nouvp(int l);
extern int convertBitIndexToCharacterIndex(int bitIndex);
extern void ecfren(int &p, int &rand, int cf, int l);
extern void becfren(int l);
@ -110,7 +110,7 @@ extern void pl12(int cf);
extern void pl13(int cf);
extern void pl15(int cf);
extern void pl20(int cf);
extern void t11(int l11, int &a);
extern int t11(int l11);
extern void cavegre();
extern void writetp(Common::String s, int t);
extern void aniof(int ouf, int num);

View File

@ -96,7 +96,7 @@ void tinke() {
if (y_s < 12)
return;
if (!g_blo) {
if (!g_vm->g_blo) {
if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7)))
g_t = kTime2;
else
@ -182,7 +182,7 @@ void tinke() {
}
g_hfb = readclock();
if ((g_brt) && ((g_hfb - g_hdb) > 17)) {
nouvp(g_li, cx);
cx = nouvp(g_li);
g_brt = false;
g_hdb = 0;
if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM))
@ -301,9 +301,9 @@ void tperd() {
g_iouv = 0;
g_mchai = 0;
unsetSearchMenu();
if (!g_blo) {
if (!g_vm->g_blo) {
int cx;
t11(21, cx);
cx = t11(21);
}
g_vm->_loseGame = true;
@ -514,8 +514,8 @@ void t1sama() { //Entering manor
g_s._currPlace = OWN_ROOM;
affrep();
t5(10);
if (!g_blo)
t11(0, minute);
if (!g_vm->g_blo)
minute = t11(0);
g_ipers = 0;
g_mpers = 0;
g_s._ipre = true;

View File

@ -154,7 +154,7 @@ Common::ErrorCode MortevielleEngine::initialise() {
initMouse();
init_lieu();
g_soundOff = false;
g_vm->_soundOff = false;
g_largestClearScreen = false;
teskbd();

View File

@ -88,6 +88,8 @@ private:
bool _inMainGameLoop; // Flag when the main game loop is active
Common::StringArray _engineStrings;
Common::StringArray _gameStrings;
Common::ErrorCode initialise();
Common::ErrorCode loadMortDat();
void readStaticStrings(Common::File &f, int dataSize, DataType dataType);
@ -100,6 +102,21 @@ private:
void playGame();
void handleAction();
public:
bool g_blo;
bool _roomPresenceLuc;
bool _roomPresenceIda;
bool _purpleRoomPresenceLeo;
bool _roomPresenceGuy;
bool _roomPresenceEva;
bool _roomPresenceMax;
bool _roomPresenceBob;
bool _roomPresencePat;
bool _toiletsPresenceBobMax;
bool _bathRoomPresenceBobMax;
bool _room9PresenceLeo;
bool _soundOff;
ScreenSurface _screenSurface;
PaletteManager _paletteManager;
GfxSurface _backgroundSurface;

View File

@ -417,7 +417,7 @@ void moveMouse(bool &funct, char &key) {
cy = 8;
break;
case '\23':
g_soundOff = !g_soundOff;
g_vm->_soundOff = !g_vm->_soundOff;
return;
break;
case '\26':

View File

@ -161,7 +161,7 @@ void music() {
bool fin;
/* debug('o3 music'); */
if (g_soundOff)
if (g_vm->_soundOff)
return;
g_rech_cfiec = true;

View File

@ -87,7 +87,7 @@ void startSpeech(int rep, int ht, int typ) {
int savph[501];
int tempo;
if (g_soundOff)
if (g_vm->_soundOff)
return;
g_num_ph = rep;

View File

@ -27,6 +27,7 @@
#include "common/file.h"
#include "common/str.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/level15.h"
#include "mortevielle/mor.h"
#include "mortevielle/mouse.h"
@ -251,8 +252,8 @@ void taffich() {
if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) {
if ((a == 13) || (a == 14))
displayAloneText();
else if (!g_blo)
t11(g_s._currPlace, cx);
else if (!g_vm->g_blo)
cx = t11(g_s._currPlace);
g_mpers = 0;
}
}

View File

@ -223,20 +223,7 @@ enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCU
/*------------------------------ VARIABLES ------------------------------*/
/*---------------------------------------------------------------------------*/
extern bool g_blo,
g_bh1,
g_bf1,
g_bh2,
g_bh4,
g_bf4,
g_bh5,
g_bh6,
g_bh8,
g_bt3,
g_bt7,
g_bh9,
g_soundOff,
extern bool
g_main1,
g_choisi,
g_test0,