aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2013-07-20 10:17:36 +0200
committerStrangerke2013-07-20 18:59:38 +0200
commitfadedd2eacf15110dd9f461d9e475374bb9e8a31 (patch)
tree431dfdc6dba052d958ca63bb37fc144d8659b4d2
parenta8c40e3c03dbfe70f96def059caf4f58c2f611e8 (diff)
downloadscummvm-rg350-fadedd2eacf15110dd9f461d9e475374bb9e8a31.tar.gz
scummvm-rg350-fadedd2eacf15110dd9f461d9e475374bb9e8a31.tar.bz2
scummvm-rg350-fadedd2eacf15110dd9f461d9e475374bb9e8a31.zip
MORTEVIELLE: Little refactoring of decryptNextChar()
-rw-r--r--engines/mortevielle/mortevielle.h2
-rw-r--r--engines/mortevielle/utils.cpp17
2 files changed, 14 insertions, 5 deletions
diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h
index eb245c60ec..e941a866fc 100644
--- a/engines/mortevielle/mortevielle.h
+++ b/engines/mortevielle/mortevielle.h
@@ -432,7 +432,7 @@ private:
void putInHand(int &objId);
void prepareDisplayText();
- void cinq_huit(char &c, int &idx, byte &pt, bool &the_end);
+ bool decryptNextChar(char &c, int &idx, byte &pt);
void copcha();
void adzon();
void phaz(int &rand, int &p, int cf);
diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp
index 28f3e4f629..994376b1dc 100644
--- a/engines/mortevielle/utils.cpp
+++ b/engines/mortevielle/utils.cpp
@@ -1846,7 +1846,15 @@ const byte cryptoArr31De[32]= {
const byte *cryptoArrDefault, *cryptoArr30, *cryptoArr31;
uint16 ctrlChar;
-void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) {
+/**
+ * Decrypt the next character
+ * @param c OUT, next decrypted char
+ * @param idx IN/OUT, current buffer index
+ * @param pt IN/OUT, current encryption point
+ * @return a boolean specifying if a stop character has been encountered
+ * @remarks Originally called 'cinq_huit'
+ */
+bool MortevielleEngine::decryptNextChar(char &c, int &idx, byte &pt) {
uint16 oct, ocd;
/* 5-8 */
@@ -1864,7 +1872,7 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) {
if (oct == ctrlChar) {
c = '$';
- the_end = true;
+ return true;
} else if (oct == 30 || oct == 31) {
ocd = _dialogIndexArray[idx];
ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt);
@@ -1884,12 +1892,13 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) {
c = chr(cryptoArr31[ocd]);
if (c == '\0') {
- the_end = true;
c = '#';
+ return true;
}
} else {
c = chr(cryptoArrDefault[oct]);
}
+ return false;
}
/**
@@ -1910,7 +1919,7 @@ Common::String MortevielleEngine::getString(int num) {
bool endFl = false;
char let;
do {
- cinq_huit(let, hint, point, endFl);
+ endFl = decryptNextChar(let, hint, point);
wrkStr += let;
++length;
} while (!endFl);