MORTEVIELLE: Start cleaning taffich.cpp

This commit is contained in:
Strangerke 2012-02-19 11:28:19 +01:00
parent ecda7b6b8f
commit b12f8bf5ad
6 changed files with 109 additions and 84 deletions

View File

@ -422,7 +422,7 @@ void f3f8::atf3f8(int &key) {
void f3f8::aff50(bool c) { void f3f8::aff50(bool c) {
caff = 50; caff = 50;
maff = 0; _maff = 0;
taffich(); taffich();
dessine(ades, 63, 12); dessine(ades, 63, 12);
if (c) if (c)

View File

@ -51,7 +51,7 @@ void change_gd(int ngd) {
else person(); else person();
clsf2(); clsf2();
clsf3(); clsf3();
maff = 68; _maff = 68;
afdes(0); afdes(0);
repon(2, crep); repon(2, crep);
g_vm->_menu.menu_aff(); g_vm->_menu.menu_aff();
@ -83,7 +83,7 @@ void MortevielleEngine::gameLoaded() {
g[2] = 'A'; g[2] = 'A';
cache = false; cache = false;
brt = false; brt = false;
maff = 68; _maff = 68;
g[5] = 'E'; g[5] = 'E';
mnumo = 0; mnumo = 0;
prebru = 0; prebru = 0;

View File

@ -35,69 +35,63 @@
namespace Mortevielle { namespace Mortevielle {
void chardes(Common::String nom, int32 passe, int long_) { void chardes(Common::String filename, int32 skipSize, int length) {
int i, p, l;
// byte b;
Common::File f; Common::File f;
if (!f.open(filename))
/* debug('chardes'); */ error("Missing file %s", filename.c_str());
if (!f.open(nom))
error("Missing file %s", nom.c_str());
testfi(); testfi();
p = 0; int skipBlock = 0;
while (passe > 127) { while (skipSize > 127) {
p = p + 1; ++skipBlock;
passe = passe - 128; skipSize -= 128;
} }
if (p != 0) if (skipBlock != 0)
f.seek(p * 0x80); f.seek(skipBlock * 0x80);
p = abs(passe);
l = long_ + p; int remainingSkipSize = abs(skipSize);
i = 0; int totalLength = length + remainingSkipSize;
while (l > 0) { int memIndx = 0x6000 * 16;
f.read(&mem[0x6000 * 16 + i], 128); while (totalLength > 0) {
f.read(&mem[memIndx], 128);
testfi(); testfi();
l = l - 128; totalLength -= 128;
i = i + 128; memIndx += 128;
} }
f.close(); f.close();
for (i = p; i <= long_ + p; i ++) for (int i = remainingSkipSize; i <= length + remainingSkipSize; i ++)
mem[0x7000 * 16 + i - p] = mem[0x6000 * 16 + i]; mem[0x7000 * 16 + i - remainingSkipSize] = mem[0x6000 * 16 + i];
/*$i+*/
} }
void charani(Common::String nom, int32 passe, int long_) { void charani(Common::String filename, int32 skipSize, int length) {
int i, p, l;
// byte b;
Common::File f; Common::File f;
/* debug('charani'); */ if (!f.open(filename))
if (!f.open(nom)) error("Missing file - %s", filename.c_str());
error("Missing file - %s", nom.c_str());
testfi(); testfi();
p = 0; int skipBlock = 0;
while (passe > 127) { while (skipSize > 127) {
passe = passe - 128; skipSize = skipSize - 128;
p = p + 1; ++skipBlock;
} }
if (p != 0) if (skipBlock != 0)
f.seek(p * 0x80); f.seek(skipBlock * 0x80);
p = abs(passe); int remainingSkipSize = abs(skipSize);
l = long_ + p; int fullLength = length + remainingSkipSize;
i = 0; int memIndx = 0x6000 * 16;
while (l > 0) { while (fullLength > 0) {
f.read(&mem[0x6000 * 16 + i], 128); f.read(&mem[memIndx], 128);
testfi(); testfi();
l = l - 128; fullLength -= 128;
i = i + 128; memIndx += 128;
} }
f.close(); f.close();
for (i = p; i <= long_ + p; i ++) mem[0x7314 * 16 + i - p] = mem[0x6000 * 16 + i]; for (int i = remainingSkipSize; i <= length + remainingSkipSize; i ++)
mem[0x7314 * 16 + i - remainingSkipSize] = mem[0x6000 * 16 + i];
} }
void taffich() { void taffich() {
@ -107,7 +101,6 @@ void taffich() {
int i, m, a, b, cx, handle, int i, m, a, b, cx, handle,
npal; npal;
int32 lgt; int32 lgt;
Common::String nom;
int palh, k, j; int palh, k, j;
int alllum[16]; int alllum[16];
@ -118,69 +111,101 @@ void taffich() {
else if ((a >= 136) && (a <= 140)) else if ((a >= 136) && (a <= 140))
a = tran1[a - 136]; a = tran1[a - 136];
b = a; b = a;
if (maff == a) return; if (_maff == a)
if (a == 16) { return;
switch (a) {
case 16:
s.pourc[9] = '*'; s.pourc[9] = '*';
s.teauto[42] = '*'; s.teauto[42] = '*';
} break;
if (a == 20) { case 20:
s.teauto[39] = '*'; s.teauto[39] = '*';
if (s.teauto[36] == '*') { if (s.teauto[36] == '*') {
s.pourc[3] = '*'; s.pourc[3] = '*';
s.teauto[38] = '*'; s.teauto[38] = '*';
} }
} break;
if (a == 24) s.teauto[37] = '*'; case 24:
if (a == 30) s.teauto[9] = '*'; s.teauto[37] = '*';
if (a == 31) { break;
case 30:
s.teauto[9] = '*';
break;
case 31:
s.pourc[4] = '*'; s.pourc[4] = '*';
s.teauto[35] = '*'; s.teauto[35] = '*';
break;
case 118:
s.teauto[41] = '*';
break;
case 143:
s.pourc[1] = '*';
break;
case 150:
s.teauto[34] = '*';
break;
case 151:
s.pourc[2] = '*';
break;
default:
break;
} }
if (a == 118) s.teauto[41] = '*';
if (a == 143) s.pourc[1] = '*';
if (a == 150) s.teauto[34] = '*';
if (a == 151) s.pourc[2] = '*';
okdes = true; okdes = true;
hide_mouse(); hide_mouse();
lgt = 0; lgt = 0;
Common::String filename;
if ((a != 50) && (a != 51)) { if ((a != 50) && (a != 51)) {
m = a + 2000; m = a + 2000;
if ((m > 2001) && (m < 2010)) m = 2001; if ((m > 2001) && (m < 2010)) m = 2001;
if (m == 2011) m = 2010; if (m == 2011) m = 2010;
if (a == 32) m = 2034; if (a == 32) m = 2034;
if ((a == 17) && (maff == 14)) m = 2018; if ((a == 17) && (_maff == 14)) m = 2018;
if (a > 99) if (a > 99)
if ((is == 1) || (is == 0)) m = 2031; if ((is == 1) || (is == 0)) m = 2031;
else m = 2032; else m = 2032;
if (((a > 69) && (a < 80)) || (a == 30) || (a == 31) || (a == 144) if (((a > 69) && (a < 80)) || (a == 30) || (a == 31) || (a == 144)
|| (a == 147) || (a == 149)) m = 2030; || (a == 147) || (a == 149)) m = 2030;
if (((a < 27) && (((maff > 69) && (! s.ipre)) || (maff > 99))) if (((a < 27) && (((_maff > 69) && (! s.ipre)) || (_maff > 99)))
|| ((maff > 29) && (maff < 33))) m = 2033; || ((_maff > 29) && (_maff < 33))) m = 2033;
messint(m); messint(m);
maff = a; _maff = a;
if (a == 159) a = 86; if (a == 159)
else if (a > 140) a = a - 67; a = 86;
else if (a > 137) a = a - 66; else if (a > 140)
else if (a > 99) a = a - 64; a = a - 67;
else if (a > 69) a = a - 42; else if (a > 137)
else if (a > 29) a = a - 5; a = a - 66;
else if (a == 26) a = 24; else if (a > 99)
else if (a > 18) a = a - 1; a = a - 64;
else if (a > 69)
a = a - 42;
else if (a > 29)
a = a - 5;
else if (a == 26)
a = 24;
else if (a > 18)
a = a - 1;
npal = a; npal = a;
for (cx = 0; cx <= (a - 1); cx ++) lgt = lgt + l[cx];
for (cx = 0; cx <= (a - 1); cx ++)
lgt = lgt + l[cx];
handle = l[a]; handle = l[a];
nom = "DXX.mor";
filename = "DXX.mor";
} else { } else {
nom = "DZZ.mor"; filename = "DZZ.mor";
handle = l[87]; handle = l[87];
if (a == 51) { if (a == 51) {
lgt = handle; lgt = handle;
handle = l[88]; handle = l[88];
} }
maff = a; _maff = a;
npal = a + 37; npal = a + 37;
} }
chardes(nom, lgt, handle); chardes(filename, lgt, handle);
if (gd == her) { if (gd == 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)]);
@ -204,15 +229,15 @@ void taffich() {
else if (b > 15) b = b - 1; else if (b > 15) b = b - 1;
for (cx = 0; cx <= (b - 1); cx ++) lgt = lgt + l[cx + 89]; for (cx = 0; cx <= (b - 1); cx ++) lgt = lgt + l[cx + 89];
handle = l[b + 89]; handle = l[b + 89];
nom = "AXX.mor"; filename = "AXX.mor";
} else if (b == 50) { } else if (b == 50) {
nom = "AZZ.mor"; filename = "AZZ.mor";
handle = 1260; handle = 1260;
} }
charani(nom, lgt, handle); charani(filename, lgt, handle);
} }
show_mouse(); show_mouse();
if ((a < 27) && ((maff < 27) || (s.mlieu == 15)) && (msg[4] != entrer)) { if ((a < 27) && ((_maff < 27) || (s.mlieu == 15)) && (msg[4] != entrer)) {
if ((a == 13) || (a == 14)) person(); if ((a == 13) || (a == 14)) person();
else if (! blo) t11(s.mlieu, cx); else if (! blo) t11(s.mlieu, cx);
mpers = 0; mpers = 0;

View File

@ -32,8 +32,8 @@
namespace Mortevielle { namespace Mortevielle {
extern void chardes(Common::String nom, int32 passe, int long_); extern void chardes(Common::String filename, int32 passe, int long_);
extern void charani(Common::String nom, int32 passe, int long_); extern void charani(Common::String filename, int32 skipSize, int length);
extern void taffich(); extern void taffich();
} // End of namespace Mortevielle } // End of namespace Mortevielle

View File

@ -137,7 +137,7 @@ int x,
ment, ment,
haut, haut,
caff, caff,
maff, _maff,
crep, crep,
ades, ades,
iouv, iouv,

View File

@ -302,7 +302,7 @@ extern int x,
ment, ment,
haut, haut,
caff, caff,
maff, _maff,
crep, crep,
ades, ades,
iouv, iouv,