MORTEVIELLE: Move some more globals, get rid of some others

This commit is contained in:
Strangerke 2012-03-10 08:21:09 +01:00
parent 78b3939168
commit 6073019083
18 changed files with 71 additions and 85 deletions

View File

@ -430,8 +430,8 @@ void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) {
waitForF3F8(g_key);
CHECK_QUIT;
if (g_newGraphicalDevice != g_currGraphicalDevice) {
g_currGraphicalDevice = g_newGraphicalDevice;
if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice) {
g_vm->_currGraphicalDevice = g_vm->_newGraphicalDevice;
hirs();
aff50(drawAni50Fl);
}

View File

@ -46,9 +46,9 @@ int testou() {
g_vm->_soundOff = !g_vm->_soundOff;
break;
case '\26' :
if ((g_c_zzz == 1) || (g_c_zzz == 2)) {
if ((g_vm->_c_zzz == 1) || (g_vm->_c_zzz == 2)) {
zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
++g_c_zzz;
++g_vm->_c_zzz;
return 61;
}

View File

@ -71,7 +71,7 @@ void outbloc(int n, pattern p, nhom *pal) {
}
void writepal(int n) {
switch (g_currGraphicalDevice) {
switch (g_vm->_currGraphicalDevice) {
case MODE_TANDY:
case MODE_EGA:
case MODE_AMSTRAD1512:
@ -104,7 +104,7 @@ void pictout(int seg, int dep, int x, int y) {
GfxSurface surface;
surface.decode(&g_mem[seg * 16 + dep]);
if (g_currGraphicalDevice == MODE_HERCULES) {
if (g_vm->_currGraphicalDevice == MODE_HERCULES) {
g_mem[0x7000 * 16 + 2] = 0;
g_mem[0x7000 * 16 + 32] = 15;
}
@ -117,13 +117,13 @@ void pictout(int seg, int dep, int x, int y) {
void sauvecr(int y, int dy) {
hideMouse();
s_sauv(g_currGraphicalDevice, y, dy);
s_sauv(g_vm->_currGraphicalDevice, y, dy);
showMouse();
}
void charecr(int y, int dy) {
hideMouse();
s_char(g_currGraphicalDevice, y, dy);
s_char(g_vm->_currGraphicalDevice, y, dy);
showMouse();
}

View File

@ -151,7 +151,7 @@ void Menu::displayMenu() {
g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10));
col = 28 * g_res;
if (g_currGraphicalDevice == MODE_CGA)
if (g_vm->_currGraphicalDevice == MODE_CGA)
color = 1;
else
color = 9;

View File

@ -114,7 +114,7 @@ void dessine(int ad, int x, int y) {
void dessine_rouleau() {
writepal(89);
if (g_currGraphicalDevice == MODE_HERCULES) {
if (g_vm->_currGraphicalDevice == MODE_HERCULES) {
g_mem[0x7000 * 16 + 14] = 15;
}
hideMouse();
@ -122,9 +122,12 @@ void dessine_rouleau() {
showMouse();
}
void text_color(int c) {
g_color_txt = c;
/**
* Set Text Color
* @remarks Originally called 'text_color'
*/
void setTextColor(int c) {
g_vm->_textColor = c;
}
/* NIVEAU 13 */
@ -140,7 +143,7 @@ void text1(int x, int y, int nb, int m) {
Common::String tmpStr = deline(m);
if ((y == 182) && ((int) tmpStr.size() * co > nb * 6))
y = 176;
displayStr(tmpStr, x, y, nb, 20, g_color_txt);
displayStr(tmpStr, x, y, nb, 20, g_vm->_textColor);
}
void initouv() {
@ -178,7 +181,7 @@ void clearScreenType2() {
}
void ecrf2() {
text_color(5);
setTextColor(5);
}
void ecr2(Common::String str_) {
@ -219,12 +222,12 @@ void ecr3(Common::String text) {
}
void ecrf6() {
text_color(5);
setTextColor(5);
g_vm->_screenSurface.drawBox(62, 33, 363, 80, 15);
}
void ecrf7() {
text_color(4);
setTextColor(4);
}
void clsf10() {
@ -258,7 +261,7 @@ void clsf10() {
void stop() {
hirs();
g_currGraphicalDevice = MODE_AMSTRAD1512;
g_vm->_currGraphicalDevice = MODE_AMSTRAD1512;
hirs();
g_vm->quitGame();
}
@ -266,7 +269,7 @@ void stop() {
void paint_rect(int x, int y, int dx, int dy) {
int co;
if (g_currGraphicalDevice == MODE_CGA)
if (g_vm->_currGraphicalDevice == MODE_CGA)
co = 3;
else
co = 11;
@ -656,7 +659,7 @@ void drawClock() {
paint_rect(570, 118, 20, 10);
paint_rect(578, 114, 6, 18);
if ((g_currGraphicalDevice == MODE_CGA) || (g_currGraphicalDevice == MODE_HERCULES))
if ((g_vm->_currGraphicalDevice == MODE_CGA) || (g_vm->_currGraphicalDevice == MODE_HERCULES))
co = 0;
else
co = 1;

View File

@ -38,7 +38,7 @@ extern int readclock();
extern void modif(int &nu);
extern void dessine(int ad, int x, int y);
extern void dessine_rouleau();
extern void text_color(int c);
extern void setTextColor(int c);
/* NIVEAU 13 */
extern void text1(int x, int y, int nb, int m);
extern void initouv();

View File

@ -194,9 +194,9 @@ void fenat(char ans) {
int coul;
hideMouse();
if (g_currGraphicalDevice == MODE_CGA)
if (g_vm->_currGraphicalDevice == MODE_CGA)
coul = 2;
else if (g_currGraphicalDevice == MODE_HERCULES)
else if (g_vm->_currGraphicalDevice == MODE_HERCULES)
coul = 1;
else
coul = 12;

View File

@ -85,6 +85,13 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g
_okdes = false;
_anyone = false;
_brt = false;
_textColor = 0;
_currGraphicalDevice = -1;
_newGraphicalDevice = -1;
_c_zzz = -1;
}
MortevielleEngine::~MortevielleEngine() {
@ -148,7 +155,7 @@ Common::ErrorCode MortevielleEngine::initialise() {
_screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
// Set the screen mode
g_currGraphicalDevice = MODE_EGA;
g_vm->_currGraphicalDevice = MODE_EGA;
g_res = 2;
_txxFileFl = false;
@ -169,13 +176,13 @@ Common::ErrorCode MortevielleEngine::initialise() {
// Setup the mouse cursor
initMouse();
g_currGraphicalDevice = MODE_EGA;
g_newGraphicalDevice = g_currGraphicalDevice;
g_vm->_currGraphicalDevice = MODE_EGA;
g_vm->_newGraphicalDevice = g_vm->_currGraphicalDevice;
charpal();
loadCFIPH();
loadCFIEC();
zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
g_c_zzz = 1;
g_vm->_c_zzz = 1;
init_nbrepm();
initMouse();
@ -185,10 +192,10 @@ Common::ErrorCode MortevielleEngine::initialise() {
teskbd();
dialpre();
g_newGraphicalDevice = g_currGraphicalDevice;
g_vm->_newGraphicalDevice = g_vm->_currGraphicalDevice;
teskbd();
if (g_newGraphicalDevice != g_currGraphicalDevice)
g_currGraphicalDevice = g_newGraphicalDevice;
if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice)
g_vm->_currGraphicalDevice = g_vm->_newGraphicalDevice;
hirs();
g_ades = 0x7000;
@ -528,7 +535,7 @@ void MortevielleEngine::mainGame() {
if (_reloadCFIEC)
loadCFIEC();
for (g_crep = 1; g_crep <= g_c_zzz; ++g_crep)
for (g_crep = 1; g_crep <= g_vm->_c_zzz; ++g_crep)
zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
loadBRUIT5();

View File

@ -129,6 +129,12 @@ public:
bool _anyone;
bool _brt;
int _textColor;
int _currGraphicalDevice;
int _newGraphicalDevice;
int _c_zzz;
int ptr_word;
ScreenSurface _screenSurface;
PaletteManager _paletteManager;

View File

@ -86,7 +86,7 @@ void hideMouse() {
if (mouse_shwn == 0) {
bool imp = odd(y_s);
int j = p_o_s;
switch (g_currGraphicalDevice) {
switch (g_vm->_currGraphicalDevice) {
case MODE_CGA: {
int k = 0;
j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2);
@ -182,7 +182,7 @@ void showMouse() {
int j = p_o_s;
bool imp = odd(y_s);
int i = x_s & 7;
switch (g_currGraphicalDevice) {
switch (g_vm->_currGraphicalDevice) {
case MODE_CGA:
k = 0;
j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2);

View File

@ -159,16 +159,12 @@ void init_lieu() {
void music() {
Common::File fic;
int k;
bool fin;
/* debug('o3 music'); */
if (g_vm->_soundOff)
return;
g_vm->_reloadCFIEC = true;
Common::File fic;
if (!fic.open("mort.img"))
error("Missing file - mort.img");
@ -180,8 +176,8 @@ void music() {
g_addfix = (float)((kTempoMusic - g_addv[1])) / 256;
cctable(g_tbi);
fin = false;
k = 0;
bool fin = false;
int k = 0;
do {
fin = keypressed();
g_vm->_soundManager.musyc(g_tbi, 9958, kTempoMusic);
@ -234,8 +230,8 @@ void suite() {
g_caff = 51;
taffich();
teskbd();
if (g_newGraphicalDevice != g_currGraphicalDevice)
g_currGraphicalDevice = g_newGraphicalDevice;
if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice)
g_vm->_currGraphicalDevice = g_vm->_newGraphicalDevice;
hirs();
dessine(g_ades, 0, 0);

View File

@ -44,10 +44,10 @@ void spfrac(int wor) {
g_c3._acc = ((uint)wor >> 9) & 7;
}
void charg_car() {
void charg_car(int &currWordNumb) {
int wor, int_;
wor = swap(READ_LE_UINT16(&g_mem[adword + g_ptr_word]));
wor = swap(READ_LE_UINT16(&g_mem[adword + currWordNumb]));
int_ = wor & 0x3f;
if ((int_ >= 0) && (int_ <= 13)) {
@ -82,7 +82,7 @@ void charg_car() {
}
spfrac(wor);
g_ptr_word += 2;
currWordNumb += 2;
}

View File

@ -34,7 +34,7 @@
namespace Mortevielle {
extern void spfrac(int wor);
extern void charg_car();
extern void charg_car(int &currWordNumb);
extern void entroct(byte o);
extern void veracf(byte b);
extern void cctable(tablint &t);

View File

@ -54,27 +54,22 @@ void init_chariot() {
void trait_ph() {
const int deca[3] = {300, 30, 40};
g_ptr_tcph = g_num_ph - 1;
g_ledeb = swap(g_t_cph[g_ptr_tcph]) + deca[g_typlec];
g_lefin = swap(g_t_cph[g_ptr_tcph + 1]) + deca[g_typlec];
g_nb_word = g_lefin - g_ledeb;
g_ptr_tcph = (uint)g_ledeb >> 1;
g_ptr_word = 0;
do {
WRITE_LE_UINT16(&g_mem[adword + g_ptr_word], g_t_cph[g_ptr_tcph]);
g_ptr_word += 2;
++g_ptr_tcph;
} while (g_ptr_tcph < (int)((uint)g_lefin >> 1));
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;
g_ptr_word = 0;
int currWord = 0;
init_chariot();
do {
rot_chariot();
charg_car();
charg_car(currWord);
trait_car();
} while (g_ptr_word < g_nb_word);
} while (currWord < wordCount);
rot_chariot();
trait_car();

View File

@ -45,7 +45,7 @@ namespace Mortevielle {
*/
void changeGraphicalDevice(int newDevice) {
hideMouse();
g_currGraphicalDevice = newDevice;
g_vm->_currGraphicalDevice = newDevice;
hirs();
initMouse();
showMouse();

View File

@ -212,7 +212,7 @@ void taffich() {
npal = a + 37;
}
chardes(filename, lgt, handle);
if (g_currGraphicalDevice == MODE_HERCULES) {
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);

View File

@ -78,9 +78,6 @@ const byte g_rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0};
/*------------------------------ VARIABLES ------------------------------*/
/*---------------------------------------------------------------------------*/
bool g_rech_cfiec;
int g_x,
g_y,
g_t,
@ -91,7 +88,6 @@ int g_x,
g_jh,
g_mh,
g_cs,
g_currGraphicalDevice,
g_hdb,
g_hfb,
g_hour,
@ -113,13 +109,9 @@ int g_x,
g_msg3,
g_msg4,
g_mlec,
g_newGraphicalDevice,
g_c_zzz,
g_mchai,
g_menup,
g_ipers,
g_ledeb,
g_lefin,
g_mpers,
g_mnumo,
g_xprec,
@ -129,12 +121,8 @@ int g_x,
g_typlec,
g_num_ph,
g_numpal,
g_nb_word,
g_ptr_oct,
g_k_tempo,
g_ptr_tcph,
g_ptr_word,
g_color_txt;
g_k_tempo;
int g_t_cph[6401];
byte g_tabdon[4001];

View File

@ -233,7 +233,6 @@ extern int g_x,
g_jh,
g_mh,
g_cs,
g_currGraphicalDevice,
g_hdb,
g_hfb,
g_hour,
@ -255,13 +254,9 @@ extern int g_x,
g_msg3,
g_msg4,
g_mlec,
g_newGraphicalDevice,
g_c_zzz,
g_mchai,
g_menup,
g_ipers,
g_ledeb,
g_lefin,
g_mpers,
g_mnumo,
g_xprec,
@ -271,12 +266,8 @@ extern int g_x,
g_typlec,
g_num_ph,
g_numpal,
g_nb_word,
g_ptr_oct,
g_k_tempo,
g_ptr_tcph,
g_ptr_word,
g_color_txt;
g_k_tempo;
extern int g_t_cph[6401];
extern byte g_tabdon[4001];