diff options
author | Max Horn | 2002-12-28 01:57:19 +0000 |
---|---|---|
committer | Max Horn | 2002-12-28 01:57:19 +0000 |
commit | ae5b30df3d67644f341a30997de5192fed8bcbdc (patch) | |
tree | db63a860f15229ec901e9b6d0bedaaf9f6f2435f /scumm/string.cpp | |
parent | 319facc9c3a54bff3adab663e32f37bddb07c9e9 (diff) | |
download | scummvm-rg350-ae5b30df3d67644f341a30997de5192fed8bcbdc.tar.gz scummvm-rg350-ae5b30df3d67644f341a30997de5192fed8bcbdc.tar.bz2 scummvm-rg350-ae5b30df3d67644f341a30997de5192fed8bcbdc.zip |
get rid of getStringLen and use the more powerful resStrLen instead; moved resStrLen from common/ to scumm/, where it belongs; enhanced resStrLen to suport V8; fixed translateText to support embeded vars (in strings I mean) - it may still not be fully correct but at least is better now; rewrote o6_arrayOps to parallel the V8 version - needs testing
svn-id: r6215
Diffstat (limited to 'scumm/string.cpp')
-rw-r--r-- | scumm/string.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/scumm/string.cpp b/scumm/string.cpp index 2964960445..75b31e8ffd 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -494,7 +494,7 @@ void Scumm::drawString(int a) } for (i = 0; (chr = buf[i++]) != 0;) { - if (chr == 254 || chr == 255) { + if (chr == 0xFE || chr == 0xFF) { chr = buf[i++]; switch (chr) { case 9: @@ -650,6 +650,11 @@ byte *Scumm::addMessageToStack(byte *msg) *_msgPtrToAdd++ = chr; *_msgPtrToAdd++ = ptr[num++]; *_msgPtrToAdd++ = ptr[num++]; + if (_features & GF_AFTER_V8) { + // FIXME - is this right?!? + *_msgPtrToAdd++ = ptr[num++]; + *_msgPtrToAdd++ = ptr[num++]; + } break; default: debug(2, "addMessageToStack(): string escape sequence %d unknown", chr); @@ -808,11 +813,11 @@ void Scumm::translateText(byte *text, byte *trans_buff) { // skip translation if flag 'h' exist if (*(buf + pos) == 'h') { pos += 3; - char *pointer = strchr((char*)text + 1, '/'); + byte *pointer = (byte *)strchr((char*)text + 1, '/'); if (pointer != NULL) - strcpy((char *)trans_buff, pointer + 1); + memcpy(trans_buff, pointer + 1, resStrLen(pointer + 1) + 1); else - strcpy((char *)trans_buff, ""); + trans_buff[0] = '\0'; return; } @@ -868,14 +873,14 @@ void Scumm::translateText(byte *text, byte *trans_buff) { } if (text[0] == '/') { - char *pointer = strchr((char*)text + 1, '/'); + byte *pointer = (byte *)strchr((char*)text + 1, '/'); if (pointer != NULL) - strcpy((char *)trans_buff, pointer + 1); + memcpy(trans_buff, pointer + 1, resStrLen(pointer + 1) + 1); else - strcpy((char *)trans_buff, ""); - + trans_buff[0] = '\0'; return; } - strcpy((char *)trans_buff, (char *)text); + + memcpy(trans_buff, text, resStrLen(text) + 1); } |