aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2012-02-24 09:15:41 +0100
committerStrangerke2012-04-06 08:21:52 +0200
commitaeb901571356181d85f8d92515379a076d142e31 (patch)
treeedd47a6a8840f97a794c78010978adea4b74433d
parent529b678885f4fb63bb8630bafca53183a0f6b4fa (diff)
downloadscummvm-rg350-aeb901571356181d85f8d92515379a076d142e31.tar.gz
scummvm-rg350-aeb901571356181d85f8d92515379a076d142e31.tar.bz2
scummvm-rg350-aeb901571356181d85f8d92515379a076d142e31.zip
MORTEVIELLE: Fix questions display when entering hidden passage
-rw-r--r--engines/mortevielle/dialogs.cpp56
-rw-r--r--engines/mortevielle/mor2.cpp7
-rw-r--r--engines/mortevielle/mor2.h1
-rw-r--r--engines/mortevielle/outtext.cpp12
-rw-r--r--engines/mortevielle/outtext.h2
5 files changed, 38 insertions, 40 deletions
diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp
index beac0a595e..50cfc7bc9c 100644
--- a/engines/mortevielle/dialogs.cpp
+++ b/engines/mortevielle/dialogs.cpp
@@ -291,12 +291,13 @@ bool Ques::show() {
bool q, func, test;
int i, j, k, y, memk;
- int tay , tmax;
+ int curLength, maxLength;
int rep, prem, der;
char st[1410];
char key;
rectangle coor[max_rect];
- Common::String chaines[15];
+ Common::String choiceArray[15];
+ Common::String currChoice;
int compte;
@@ -310,7 +311,7 @@ bool Ques::show() {
hirs();
showMouse();
++i;
- deline(ta[i], st, tay);
+ deline(ta[i], st, curLength);
if (res == 1)
y = 29;
else
@@ -325,14 +326,14 @@ bool Ques::show() {
der = 510;
}
y = 35;
- tmax = 0;
+ maxLength = 0;
memk = 1;
for (j = prem; j <= der; ++j) {
- deline(j, st, tay);
- if (tay > tmax)
- tmax = tay;
+ deline(j, st, curLength);
+ if (curLength > maxLength)
+ maxLength = curLength;
afftex(st, 100, y, 100, 1, 0);
- chaines[memk] = delig;
+ choiceArray[memk] = delig;
++memk;
y += 8;
}
@@ -340,13 +341,13 @@ bool Ques::show() {
rectangle &with = coor[j];
with.x1 = 45 * res;
- with.x2 = (tmax * 3 + 55) * res;
+ with.x2 = (maxLength * 3 + 55) * res;
with.y1 = 27 + j * 8;
with.y2 = 34 + j * 8;
with.enabled = true;
- while ((int)chaines[j].size() < tmax) {
- chaines[j] += ' ';
+ while ((int)choiceArray[j].size() < maxLength) {
+ choiceArray[j] += ' ';
}
}
coor[j + 1].enabled = false;
@@ -354,7 +355,7 @@ bool Ques::show() {
rep = 10;
else
rep = 6;
- g_vm->_screenSurface.drawBox(80, 33, 40 + tmax * rep, (der - prem) * 8 + 16, 15);
+ g_vm->_screenSurface.drawBox(80, 33, 40 + maxLength * rep, (der - prem) * 8 + 16, 15);
rep = 0;
j = 0;
memk = 0;
@@ -365,29 +366,32 @@ bool Ques::show() {
CHECK_QUIT0;
k = 1;
- while (coor[k].enabled && ! dans_rect(coor[k])) k = k + 1;
+ while (coor[k].enabled && ! dans_rect(coor[k]))
+ ++k;
if (coor[k].enabled) {
if ((memk != 0) && (memk != k)) {
-// for (j = 1; j <= tmax; ++j)
-// st[j] = chaines[memk][j];
- strncpy(st, chaines[memk].c_str(), tmax);
-//
- st[1 + tmax] = '$';
+ st[0] = ' ';
+// for (j = 0; j <= maxLength; ++j)
+// st[j + 1] = choiceArray[memk][j];
+ strncpy(st + 1, choiceArray[memk].c_str(), maxLength);
+ st[1 + maxLength] = '$';
afftex(st, 100, 27 + memk * 8, 100, 1, 0);
}
if (memk != k) {
-// for (j = 1; j <= tmax; ++j)
-// st[j] = chaines[k][j];
- strncpy(st, chaines[k].c_str(), tmax);
- st[1 + tmax] = '$';
+ st[0] = ' ';
+// for (j = 0; j <= maxLength; ++j)
+// st[j + 1] = choiceArray[k][j];
+ strncpy(st + 1, choiceArray[k].c_str(), maxLength);
+ st[1 + maxLength] = '$';
afftex(st, 100, 27 + k * 8, 100, 1, 1);
memk = k;
}
} else if (memk != 0) {
-// for (j = 1; j <= tmax; ++j)
-// st[j] = chaines[memk][j];
- strncpy(st, chaines[memk].c_str(), tmax);
- st[1 + tmax] = '$';
+ st[0] = ' ';
+// for (j = 0; j <= maxLength; ++j)
+// st[j + 1] = choiceArray[memk][j];
+ strncpy(st + 1, choiceArray[memk].c_str(), maxLength);
+ st[1 + maxLength] = '$';
afftex(st, 100, 27 + memk * 8, 100, 1, 0);
memk = 0;
}
diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp
index 9a06668ec8..6ef32945c7 100644
--- a/engines/mortevielle/mor2.cpp
+++ b/engines/mortevielle/mor2.cpp
@@ -280,13 +280,6 @@ void tlu(int af, int ob) {
crep = 998;
}
-void delin(int n) {
- char s[1410];
- int t;
-
- deline(n, s, t);
-}
-
void affrep() {
caff = s.mlieu;
crep = s.mlieu;
diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h
index 1d66548ffa..2c95f1e29d 100644
--- a/engines/mortevielle/mor2.h
+++ b/engines/mortevielle/mor2.h
@@ -38,7 +38,6 @@ extern void tkey1(bool d);
extern void tmlieu(int mli);
/* NIVEAU 7 */
extern void tlu(int af, int ob);
-extern void delin(int n);
extern void affrep();
extern void mfouen();
/* NIVEAU 6 */
diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp
index 95ccc3baef..ceac79aacd 100644
--- a/engines/mortevielle/outtext.cpp
+++ b/engines/mortevielle/outtext.cpp
@@ -126,7 +126,7 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) {
/**
* Decode and extract the line with the given Id
*/
-void deline(int num, char *l , int &tl) {
+void deline(int num, char *line , int &length) {
if (num < 0) {
warning("deline: num < 0! Skipping");
return;
@@ -137,20 +137,22 @@ void deline(int num, char *l , int &tl) {
int ts = t_rec[num].indis;
byte ps = t_rec[num].point;
int i = ts;
- tl = 1;
+ length = 1;
int j = 1;
+ // Initialize properly first string character
+ line[0] = ' ';
byte k = ps;
bool endFl = false;
char let;
do {
cinq_huit(let, i, k, endFl);
- l[j] = let;
+ line[j] = let;
if (j < 254)
delig += let;
++j;
} while (!endFl);
- tl = j - 1;
- if (tl < 255)
+ length = j - 1;
+ if (length < 255)
// Remove trailing '$'
delig.deleteLastChar();
}
diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h
index 470479a81b..32d3c4c7ec 100644
--- a/engines/mortevielle/outtext.h
+++ b/engines/mortevielle/outtext.h
@@ -34,7 +34,7 @@ namespace Mortevielle {
extern Common::String delig;
-extern void deline(int num , char *l , int &tl);
+extern void deline(int num , char *line , int &length);
extern void afftex(char *ch, int x, int y, int dx, int dy, int typ);
} // End of namespace Mortevielle