aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle
diff options
context:
space:
mode:
authorStrangerke2012-03-10 08:21:09 +0100
committerStrangerke2012-04-06 08:23:05 +0200
commit60730190832def71a6f36eec5f86ade96a705709 (patch)
tree1aa30ec8651732bb5c96d807aa2e428df0a29687 /engines/mortevielle
parent78b3939168a3b77e7087c2844fe10e94a6402d74 (diff)
downloadscummvm-rg350-60730190832def71a6f36eec5f86ade96a705709.tar.gz
scummvm-rg350-60730190832def71a6f36eec5f86ade96a705709.tar.bz2
scummvm-rg350-60730190832def71a6f36eec5f86ade96a705709.zip
MORTEVIELLE: Move some more globals, get rid of some others
Diffstat (limited to 'engines/mortevielle')
-rw-r--r--engines/mortevielle/dialogs.cpp4
-rw-r--r--engines/mortevielle/keyboard.cpp4
-rw-r--r--engines/mortevielle/level15.cpp8
-rw-r--r--engines/mortevielle/menu.cpp2
-rw-r--r--engines/mortevielle/mor.cpp25
-rw-r--r--engines/mortevielle/mor.h2
-rw-r--r--engines/mortevielle/mor2.cpp4
-rw-r--r--engines/mortevielle/mortevielle.cpp23
-rw-r--r--engines/mortevielle/mortevielle.h6
-rw-r--r--engines/mortevielle/mouse.cpp4
-rw-r--r--engines/mortevielle/ovd1.cpp14
-rw-r--r--engines/mortevielle/parole.cpp6
-rw-r--r--engines/mortevielle/parole.h2
-rw-r--r--engines/mortevielle/parole2.cpp23
-rw-r--r--engines/mortevielle/prog.cpp2
-rw-r--r--engines/mortevielle/taffich.cpp2
-rw-r--r--engines/mortevielle/var_mor.cpp14
-rw-r--r--engines/mortevielle/var_mor.h11
18 files changed, 71 insertions, 85 deletions
diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp
index c4b476c73e..754e0141c3 100644
--- a/engines/mortevielle/dialogs.cpp
+++ b/engines/mortevielle/dialogs.cpp
@@ -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);
}
diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp
index f28e309f66..faf47192a7 100644
--- a/engines/mortevielle/keyboard.cpp
+++ b/engines/mortevielle/keyboard.cpp
@@ -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;
}
diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp
index 444a810b0e..17f4943d75 100644
--- a/engines/mortevielle/level15.cpp
+++ b/engines/mortevielle/level15.cpp
@@ -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();
}
diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp
index 9a0bcec2de..22bf269b56 100644
--- a/engines/mortevielle/menu.cpp
+++ b/engines/mortevielle/menu.cpp
@@ -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;
diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp
index e3bc5243f9..c8b5b7e39a 100644
--- a/engines/mortevielle/mor.cpp
+++ b/engines/mortevielle/mor.cpp
@@ -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;
diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h
index 59555fb511..67c7bdd9a8 100644
--- a/engines/mortevielle/mor.h
+++ b/engines/mortevielle/mor.h
@@ -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();
diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp
index e6abc8e915..380959e3c3 100644
--- a/engines/mortevielle/mor2.cpp
+++ b/engines/mortevielle/mor2.cpp
@@ -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;
diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp
index 01ef472084..0e65ca2fdb 100644
--- a/engines/mortevielle/mortevielle.cpp
+++ b/engines/mortevielle/mortevielle.cpp
@@ -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();
diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h
index 5a8c0f911a..0d1f5670ca 100644
--- a/engines/mortevielle/mortevielle.h
+++ b/engines/mortevielle/mortevielle.h
@@ -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;
diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp
index 8ae863523d..1240fa4165 100644
--- a/engines/mortevielle/mouse.cpp
+++ b/engines/mortevielle/mouse.cpp
@@ -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);
diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp
index 374a5f75df..14b3e3eba8 100644
--- a/engines/mortevielle/ovd1.cpp
+++ b/engines/mortevielle/ovd1.cpp
@@ -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);
diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp
index 8974b45977..b2266dc8ff 100644
--- a/engines/mortevielle/parole.cpp
+++ b/engines/mortevielle/parole.cpp
@@ -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;
}
diff --git a/engines/mortevielle/parole.h b/engines/mortevielle/parole.h
index 4168187a24..46d55abab0 100644
--- a/engines/mortevielle/parole.h
+++ b/engines/mortevielle/parole.h
@@ -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);
diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp
index e08cbeb475..950f2940bc 100644
--- a/engines/mortevielle/parole2.cpp
+++ b/engines/mortevielle/parole2.cpp
@@ -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();
diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp
index 95e8c011d7..b56aba64e8 100644
--- a/engines/mortevielle/prog.cpp
+++ b/engines/mortevielle/prog.cpp
@@ -45,7 +45,7 @@ namespace Mortevielle {
*/
void changeGraphicalDevice(int newDevice) {
hideMouse();
- g_currGraphicalDevice = newDevice;
+ g_vm->_currGraphicalDevice = newDevice;
hirs();
initMouse();
showMouse();
diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp
index 5bb172f527..a65cecd8a8 100644
--- a/engines/mortevielle/taffich.cpp
+++ b/engines/mortevielle/taffich.cpp
@@ -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);
diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp
index 14f440fff8..62f983458f 100644
--- a/engines/mortevielle/var_mor.cpp
+++ b/engines/mortevielle/var_mor.cpp
@@ -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];
diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h
index cf7d6084e1..50c73974d8 100644
--- a/engines/mortevielle/var_mor.h
+++ b/engines/mortevielle/var_mor.h
@@ -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];