Add HE72+ specific version of convertMessageToString(), to reduce filtering and since special codes aren't used.

svn-id: r23814
This commit is contained in:
Travis Howell 2006-09-01 12:04:40 +00:00
parent 1da493ac00
commit 7ca75815aa
4 changed files with 49 additions and 15 deletions

View File

@ -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();

View File

@ -1710,7 +1710,7 @@ load_game:
}
if (_game.heversion >= 80) {
((SoundHE *)_sound)->processSoundCode();
//((SoundHE *)_sound)->processSoundCode();
}
runAllScripts();
checkExecVerbs();

View File

@ -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);

View File

@ -792,6 +792,52 @@ void ScummEngine::drawString(int a, const byte *msg) {
_string[a].xpos = _charset->_str.right + 8; // Indy3: Fixes Grail Diary text positioning
}
int ScummEngine_v72he::convertMessageToString(const byte *msg, byte *dst, int dstSize) {
uint num = 0;
byte chr;
const byte *src;
byte *end;
assert(dst);
end = dst + dstSize;
if (msg == NULL) {
debug(0, "Bad message in convertMessageToString, ignoring");
return 0;
}
src = msg;
num = 0;
while (1) {
chr = src[num++];
if (_game.heversion >= 80 && src[num - 1] == '(' && (src[num] == 'p' || src[num] == 'P')) {
// Filter out the following prefixes in subtitles
// (pickup4)
// (PU1)
// (PU2)
while (src[num++] != ')');
continue;
}
if ((_game.features & GF_HE_LOCALIZED) && chr == '[') {
while (src[num++] != ']');
continue;
}
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;
@ -819,19 +865,6 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize)
while (1) {
chr = src[num++];
if (_game.heversion >= 80 && src[num - 1] == '(' && (src[num] == 'p' || src[num] == 'P')) {
// Filter out the following prefixes in subtitles
// (pickup4)
// (PU1)
// (PU2)
while (src[num++] != ')');
continue;
}
if ((_game.features & GF_HE_LOCALIZED) && chr == '[') {
while (src[num++] != ']');
continue;
}
if (chr == 0)
break;
if (chr == 0xFF) {