MORTEVIELLE: Rename F3F8 functions, rename everything related to Graphical Device

This commit is contained in:
Strangerke 2012-02-21 22:14:22 +01:00
parent 20e61b40d0
commit 77f9e706e5
15 changed files with 71 additions and 48 deletions

View File

@ -40,6 +40,10 @@ namespace Mortevielle {
static const int nligne = 7; static const int nligne = 7;
/**
* Alert function - Show
* @remarks Originally called 'do_alert'
*/
int Alert::show(const Common::String &msg, int n) { int Alert::show(const Common::String &msg, int n) {
int coldep, esp, i, caseNumb, quoi, ix; int coldep, esp, i, caseNumb, quoi, ix;
Common::String st, chaine; Common::String st, chaine;
@ -182,6 +186,10 @@ int Alert::show(const Common::String &msg, int n) {
return do_alert_result; return do_alert_result;
} }
/**
* Alert function - Decode Alert Details
* @remarks Originally called 'decod'
*/
void Alert::decodeAlertDetails(Common::String s, int &nbc, int &lineNumb, int &col, Common::String &c, Common::String &cs) { void Alert::decodeAlertDetails(Common::String s, int &nbc, int &lineNumb, int &col, Common::String &c, Common::String &cs) {
int i, k; int i, k;
bool v; bool v;
@ -244,7 +252,6 @@ void Alert::drawAlertBox(int lidep, int nli, int tx) {
g_vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); g_vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2));
} }
/** /**
* Alert function - Set Button Text * Alert function - Set Button Text
* @remarks Originally called 'fait_choix' * @remarks Originally called 'fait_choix'
@ -425,34 +432,43 @@ void f3f8::draw() {
g_vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 16, 7); g_vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 16, 7);
} }
void f3f8::divers(int np, bool b) { /**
* Alert function - Loop until F8 is pressed, update
* Graphical Device if modified
* @remarks Originally called 'diver'
*/
void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) {
teskbd(); teskbd();
do { do {
parole(np, 0, 0); parole(SpeechNum, 0, 0);
atf3f8(key); waitForF3F8(key);
CHECK_QUIT; CHECK_QUIT;
if (newgd != gd) { if (_newGraphicalDevice != _currGraphicalDevice) {
gd = newgd; _currGraphicalDevice = _newGraphicalDevice;
hirs(); hirs();
aff50(b); aff50(drawAni50Fl);
} }
} while (!(key == 66)); } while (!(key == 66)); // keycode for F8
} }
void f3f8::atf3f8(int &key) { /**
* Alert function - Loop until F3 or F8 is pressed
* @remarks Originally called 'atf3f8'
*/
void f3f8::waitForF3F8(int &key) {
do { do {
key = testou(); key = testou();
CHECK_QUIT; CHECK_QUIT;
} while (!((key == 61) || (key == 66))); } while (!((key == 61) || (key == 66)));
} }
void f3f8::aff50(bool c) { void f3f8::aff50(bool drawAni50Fl) {
caff = 50; caff = 50;
_maff = 0; _maff = 0;
taffich(); taffich();
dessine(ades, 63, 12); dessine(ades, 63, 12);
if (c) if (drawAni50Fl)
ani50(); ani50();
else else
repon(2, c_paroles + 142); repon(2, c_paroles + 142);

View File

@ -50,9 +50,9 @@ public:
class f3f8 { class f3f8 {
public: public:
static void draw(); static void draw();
static void divers(int np, bool b); static void checkForF8(int SpeechNum, bool drawAni50Fl);
static void atf3f8(int &key); static void waitForF3F8(int &key);
static void aff50(bool c); static void aff50(bool drawAni50Fl);
static void ani50(); static void ani50();
}; };

View File

@ -56,6 +56,8 @@ int testou() {
if (keypressed()) if (keypressed())
ch = get_ch(); ch = get_ch();
break; break;
default:
break;
} }
return ord(ch); return ord(ch);

View File

@ -68,7 +68,7 @@ void outbloc(int n, pattern p, t_nhom pal) {
void writepal(int n) { void writepal(int n) {
t_nhom pal; t_nhom pal;
switch (gd) { switch (_currGraphicalDevice) {
case tan: case tan:
case ega: case ega:
case ams: case ams:
@ -96,7 +96,7 @@ void pictout(int seg, int dep, int x, int y) {
GfxSurface surface; GfxSurface surface;
surface.decode(&mem[seg * 16 + dep]); surface.decode(&mem[seg * 16 + dep]);
if (gd == her) { if (_currGraphicalDevice == her) {
mem[0x7000 * 16 + 2] = 0; mem[0x7000 * 16 + 2] = 0;
mem[0x7000 * 16 + 32] = 15; mem[0x7000 * 16 + 32] = 15;
} }
@ -109,13 +109,13 @@ void pictout(int seg, int dep, int x, int y) {
void sauvecr(int y, int dy) { void sauvecr(int y, int dy) {
hideMouse(); hideMouse();
s_sauv(gd, y, dy); s_sauv(_currGraphicalDevice, y, dy);
showMouse(); showMouse();
} }
void charecr(int y, int dy) { void charecr(int y, int dy) {
hideMouse(); hideMouse();
s_char(gd, y, dy); s_char(_currGraphicalDevice, y, dy);
showMouse(); showMouse();
} }

View File

@ -152,7 +152,7 @@ void Menu::menu_aff() {
g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10));
col = 28 * res; col = 28 * res;
if (gd == cga) if (_currGraphicalDevice == cga)
color = 1; color = 1;
else else
color = 9; color = 9;

View File

@ -113,7 +113,7 @@ void dessine(int ad, int x, int y) {
void dessine_rouleau() { void dessine_rouleau() {
writepal(89); writepal(89);
if (gd == her) { if (_currGraphicalDevice == her) {
mem[0x7000 * 16 + 14] = 15; mem[0x7000 * 16 + 14] = 15;
} }
hideMouse(); hideMouse();
@ -266,7 +266,7 @@ void clsf10() {
void stop() { void stop() {
hirs(); hirs();
gd = ams; _currGraphicalDevice = ams;
hirs(); hirs();
g_vm->quitGame(); g_vm->quitGame();
} }
@ -274,7 +274,7 @@ void stop() {
void paint_rect(int x, int y, int dx, int dy) { void paint_rect(int x, int y, int dx, int dy) {
int co; int co;
if (gd == cga) if (_currGraphicalDevice == cga)
co = 3; co = 3;
else else
co = 11; co = 11;
@ -634,9 +634,10 @@ void drawClock() {
paint_rect(570, 118, 20, 10); paint_rect(570, 118, 20, 10);
paint_rect(578, 114, 6, 18); paint_rect(578, 114, 6, 18);
if ((gd == cga) || (gd == her)) if ((_currGraphicalDevice == cga) || (_currGraphicalDevice == her))
co = 0; co = 0;
else co = 1; else
co = 1;
if (_minute == 0) if (_minute == 0)
g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co); g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co);

View File

@ -200,9 +200,9 @@ void fenat(char ans) {
int coul; int coul;
hideMouse(); hideMouse();
if (gd == cga) if (_currGraphicalDevice == cga)
coul = 2; coul = 2;
else if (gd == her) else if (_currGraphicalDevice == her)
coul = 1; coul = 1;
else else
coul = 12; coul = 12;
@ -425,7 +425,7 @@ void sparl(float adr, float rep) {
key = 0; key = 0;
do { do {
parole(repint, haut[caff - 69], 0); parole(repint, haut[caff - 69], 0);
f3f8::atf3f8(key); f3f8::waitForF3F8(key);
CHECK_QUIT; CHECK_QUIT;
} while (!(key == 66)); } while (!(key == 66));
hirs(); hirs();

View File

@ -120,7 +120,7 @@ Common::ErrorCode MortevielleEngine::initialise() {
_screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
// Set the screen mode // Set the screen mode
gd = ega; _currGraphicalDevice = ega;
res = 2; res = 2;
// Load the mort.dat resource // Load the mort.dat resource
@ -134,8 +134,8 @@ Common::ErrorCode MortevielleEngine::initialise() {
// Setup the mouse cursor // Setup the mouse cursor
initMouse(); initMouse();
gd = ega; _currGraphicalDevice = ega;
newgd = gd; _newGraphicalDevice = _currGraphicalDevice;
zuul = false; zuul = false;
tesok = false; tesok = false;
chartex(); chartex();
@ -153,10 +153,10 @@ Common::ErrorCode MortevielleEngine::initialise() {
teskbd(); teskbd();
dialpre(); dialpre();
newgd = gd; _newGraphicalDevice = _currGraphicalDevice;
teskbd(); teskbd();
if (newgd != gd) if (_newGraphicalDevice != _currGraphicalDevice)
gd = newgd; _currGraphicalDevice = _newGraphicalDevice;
hirs(); hirs();
ades = 0x7000; ades = 0x7000;
@ -469,11 +469,11 @@ Common::Error MortevielleEngine::run() {
void MortevielleEngine::showIntroduction() { void MortevielleEngine::showIntroduction() {
f3f8::aff50(false); f3f8::aff50(false);
mlec = 0; mlec = 0;
f3f8::divers(142, false); f3f8::checkForF8(142, false);
CHECK_QUIT; CHECK_QUIT;
f3f8::ani50(); f3f8::ani50();
f3f8::divers(143, true); f3f8::checkForF8(143, true);
CHECK_QUIT; CHECK_QUIT;
// TODO: Once music is implemented, only use the below delay if music is turned off // TODO: Once music is implemented, only use the below delay if music is turned off
@ -558,7 +558,7 @@ void MortevielleEngine::handleAction() {
g_vm->_menu.eraseMenu(); g_vm->_menu.eraseMenu();
imen = false; imen = false;
if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) {
change_gd((uint)pred(int, ord(inkey)) >> 1); changeGraphicalDevice((uint)pred(int, ord(inkey)) >> 1);
return; return;
} }
if (choisi && (msg[3] == sauve)) { if (choisi && (msg[3] == sauve)) {

View File

@ -89,7 +89,7 @@ void hideMouse() {
if (mouse_shwn == 0) { if (mouse_shwn == 0) {
imp = odd(y_s); imp = odd(y_s);
j = p_o_s; j = p_o_s;
switch (gd) { switch (_currGraphicalDevice) {
case cga: case cga:
k = 0; k = 0;
j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2);
@ -180,7 +180,7 @@ void showMouse() {
j = p_o_s; j = p_o_s;
imp = odd(y_s); imp = odd(y_s);
i = x_s & 7; i = x_s & 7;
switch (gd) { switch (_currGraphicalDevice) {
case cga: case cga:
k = 0; k = 0;
j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2);

View File

@ -239,8 +239,8 @@ void suite() {
caff = 51; caff = 51;
taffich(); taffich();
teskbd(); teskbd();
if (newgd != gd) if (_newGraphicalDevice != _currGraphicalDevice)
gd = newgd; _currGraphicalDevice = _newGraphicalDevice;
hirs(); hirs();
dessine(ades, 0, 0); dessine(ades, 0, 0);

View File

@ -38,9 +38,13 @@
namespace Mortevielle { namespace Mortevielle {
void change_gd(int ngd) { /**
* Engine function - Change Graphical Device
* @remarks Originally called 'change_gd'
*/
void changeGraphicalDevice(int newDevice) {
hideMouse(); hideMouse();
gd = ngd; _currGraphicalDevice = newDevice;
hirs(); hirs();
initMouse(); initMouse();
showMouse(); showMouse();

View File

@ -30,7 +30,7 @@
namespace Mortevielle { namespace Mortevielle {
extern void change_gd(int ngd); extern void changeGraphicalDevice(int newDevice);
/* NIVEAU 3 */ /* NIVEAU 3 */
/* procedure PROGRAMME */ /* procedure PROGRAMME */

View File

@ -208,7 +208,7 @@ void taffich() {
npal = a + 37; npal = a + 37;
} }
chardes(filename, lgt, handle); chardes(filename, lgt, handle);
if (gd == her) { if (_currGraphicalDevice == her) {
for (i = 0; i <= 15; ++i) { for (i = 0; i <= 15; ++i) {
palh = READ_LE_UINT16(&mem[0x7000 * 16 + (succ(int, i) << 1)]); palh = READ_LE_UINT16(&mem[0x7000 * 16 + (succ(int, i) << 1)]);
alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15);

View File

@ -124,7 +124,7 @@ int x,
jh, jh,
mh, mh,
cs, cs,
gd, /* Gd = graph device */ _currGraphicalDevice,
hdb, hdb,
hfb, hfb,
_hour, _hour,
@ -147,7 +147,7 @@ int x,
msg3, msg3,
msg4, msg4,
mlec, mlec,
newgd, _newGraphicalDevice,
c_zzz, c_zzz,
mchai, mchai,
menup, menup,

View File

@ -273,7 +273,7 @@ extern int x,
jh, jh,
mh, mh,
cs, cs,
gd, /* Gd = graph device */ _currGraphicalDevice,
hdb, hdb,
hfb, hfb,
_hour, _hour,
@ -296,7 +296,7 @@ extern int x,
msg3, msg3,
msg4, msg4,
mlec, mlec,
newgd, _newGraphicalDevice,
c_zzz, c_zzz,
mchai, mchai,
menup, menup,