diff options
author | Travis Howell | 2005-04-09 15:07:44 +0000 |
---|---|---|
committer | Travis Howell | 2005-04-09 15:07:44 +0000 |
commit | b12942a8e78c4cc58b9a57514762ac1837a4cd58 (patch) | |
tree | 2812a0e8bb0389783a94467151f0560cefe6e35a /scumm/script_v72he.cpp | |
parent | 3aba4997f4132846072a4fa395218c8723be165e (diff) | |
download | scummvm-rg350-b12942a8e78c4cc58b9a57514762ac1837a4cd58.tar.gz scummvm-rg350-b12942a8e78c4cc58b9a57514762ac1837a4cd58.tar.bz2 scummvm-rg350-b12942a8e78c4cc58b9a57514762ac1837a4cd58.zip |
Correct stack list order.
chase/lost/smaller use correct level numbers now.
svn-id: r17480
Diffstat (limited to 'scumm/script_v72he.cpp')
-rw-r--r-- | scumm/script_v72he.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 244b61ff56..d1e91d8dd2 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -539,13 +539,17 @@ void ScummEngine_v72he::copyScriptString(byte *dst) { void ScummEngine_v72he::decodeScriptString(byte *dst, bool scriptString) { const byte *src; int args[31]; - int num = 0, len, val; + int num, len, val; byte chr, string[256]; + memset(args, 0, sizeof(args)); memset(string, 0, sizeof(string)); - val = getStackList(args, ARRAYSIZE(args)); - args[val] = pop(); + // Get stack list, plus one + num = pop(); + for (int i = num; i >= 0; i--) + args[i] = pop(); + // Get string if (scriptString) { addMessageToStack(_scriptPointer, string, sizeof(string)); len = resStrLen(_scriptPointer); @@ -555,34 +559,38 @@ void ScummEngine_v72he::decodeScriptString(byte *dst, bool scriptString) { len = resStrLen(string) + 1; } + // Decode string + num = 0; + val = 0; while (len--) { chr = string[num++]; if (chr == '%') { chr = string[num++]; switch(chr) { case 'b': - // FIXME TODO - //dst += sprintf((char *)dst, "%b", args[val--]); + dst += sprintf((char *)dst, "%b", args[val++]); break; case 'c': - *dst++ = args[val--]; + *dst++ = args[val++]; break; case 'd': - dst += sprintf((char *)dst, "%d", args[val--]); + dst += sprintf((char *)dst, "%d", args[val++]); break; case 's': - src = getStringAddress(args[val--]); + src = getStringAddress(args[val++]); if (src) { while (*src != 0) *dst++ = *src++; } break; case 'x': - dst += sprintf((char *)dst, "%x", args[val--]); + dst += sprintf((char *)dst, "%x", args[val++]); break; default: error("decodeScriptString: Unknown type %d", chr); } + + continue; } *dst++ = chr; |