aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2006-09-01 12:04:40 +0000
committerTravis Howell2006-09-01 12:04:40 +0000
commit7ca75815aaa7a86327a06006171dfd64584eabac (patch)
treea03386e1b765e5065b7710bd6891e01058c773bf /engines
parent1da493ac006fa77d02700765ade698eb5281fe59 (diff)
downloadscummvm-rg350-7ca75815aaa7a86327a06006171dfd64584eabac.tar.gz
scummvm-rg350-7ca75815aaa7a86327a06006171dfd64584eabac.tar.bz2
scummvm-rg350-7ca75815aaa7a86327a06006171dfd64584eabac.zip
Add HE72+ specific version of convertMessageToString(), to reduce filtering and since special codes aren't used.
svn-id: r23814
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/he/intern_he.h1
-rw-r--r--engines/scumm/scumm.cpp2
-rw-r--r--engines/scumm/scumm.h2
-rw-r--r--engines/scumm/string.cpp53
4 files changed, 46 insertions, 12 deletions
diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h
index dca0c7d19a..0f87af8477 100644
--- a/engines/scumm/he/intern_he.h
+++ b/engines/scumm/he/intern_he.h
@@ -286,6 +286,7 @@ protected:
int getSoundResourceSize(int id);
virtual bool handleNextCharsetCode(Actor *a, int *c);
+ virtual int convertMessageToString(const byte *msg, byte *dst, int dstSize);
/* HE version 72 script opcodes */
void o72_pushDWord();
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index a7add0ef84..c271cf74ed 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -1710,7 +1710,7 @@ load_game:
}
if (_game.heversion >= 80) {
- ((SoundHE *)_sound)->processSoundCode();
+ //((SoundHE *)_sound)->processSoundCode();
}
runAllScripts();
checkExecVerbs();
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 5dad7be022..d60a74f5b6 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1214,7 +1214,7 @@ protected:
void debugMessage(const byte *msg);
void showMessageDialog(const byte *msg);
- int convertMessageToString(const byte *msg, byte *dst, int dstSize);
+ virtual int convertMessageToString(const byte *msg, byte *dst, int dstSize);
int convertIntMessage(byte *dst, int dstSize, int var);
int convertVerbMessage(byte *dst, int dstSize, int var);
int convertNameMessage(byte *dst, int dstSize, int var);
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index 19b51b6147..1a00a7b03d 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -792,13 +792,11 @@ void ScummEngine::drawString(int a, const byte *msg) {
_string[a].xpos = _charset->_str.right + 8; // Indy3: Fixes Grail Diary text positioning
}
-int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) {
+int ScummEngine_v72he::convertMessageToString(const byte *msg, byte *dst, int dstSize) {
uint num = 0;
- uint32 val;
byte chr;
const byte *src;
byte *end;
- byte transBuf[384];
assert(dst);
end = dst + dstSize;
@@ -808,13 +806,7 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize)
return 0;
}
- if (_game.version >= 7) {
- translateText(msg, transBuf);
- src = transBuf;
- } else {
- src = msg;
- }
-
+ src = msg;
num = 0;
while (1) {
@@ -834,6 +826,47 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize)
if (chr == 0)
break;
+
+ *dst++ = chr;
+
+ // Check for a buffer overflow
+ if (dst >= end)
+ error("convertMessageToString: buffer overflow!");
+ }
+ *dst = 0;
+
+ return dstSize - (end - dst);
+}
+
+int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) {
+ uint num = 0;
+ uint32 val;
+ byte chr;
+ const byte *src;
+ byte *end;
+ byte transBuf[384];
+
+ assert(dst);
+ end = dst + dstSize;
+
+ if (msg == NULL) {
+ debug(0, "Bad message in convertMessageToString, ignoring");
+ return 0;
+ }
+
+ if (_game.version >= 7) {
+ translateText(msg, transBuf);
+ src = transBuf;
+ } else {
+ src = msg;
+ }
+
+ num = 0;
+
+ while (1) {
+ chr = src[num++];
+ if (chr == 0)
+ break;
if (chr == 0xFF) {
chr = src[num++];