From c1122f4333d1988a78c9d9fbe67076dc979d5c83 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 13 Sep 2004 04:16:22 +0000 Subject: Debug code strings should use string num, not var num. Updated work around for loading datafiles. svn-id: r15086 --- scumm/script_v72he.cpp | 23 ++++++++++++----------- scumm/string.cpp | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'scumm') diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 85355c3a8c..fb3b1dc1b6 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -550,23 +550,14 @@ void ScummEngine_v72he::decodeScriptString(byte *dst, bool scriptString) { len = resStrLen(string) + 1; } - // The boot script in some HE games just set data file name - // to a bunch to spaces for some odd reason. - // We work around that. - if (!strcmp((char *)string,"%s.he3")) { - memset(string, 0, sizeof(string)); - sprintf((char *)string, "%s.he3", _gameName.c_str()); - len = resStrLen(string); - } - while (len--) { chr = string[num++]; if (chr == 0x25) { chr = string[num++]; if (chr == 0x64) - dst += snprintf((char *)dst, 5, "%d", args[val++]); + dst += snprintf((char *)dst, 10, "%d", args[val++]); else if (chr == 0x73) - dst += addStringToStack(dst, 1024, args[val++]); + dst += addStringToStack(dst, 512, args[val++]); continue; } *dst++ = chr; @@ -1455,6 +1446,16 @@ void ScummEngine_v72he::o72_openFile() { mode = pop(); copyScriptString(filename); + // The boot script in some HE games doen't set the + // complete data file name. So we work around that. + if (!strcmp((char *)filename,".he3")) { + memset(filename, 0, sizeof(filename)); + sprintf((char *)filename, "%s.he3", _gameName.c_str()); + } else if (!strcmp((char *)filename,".he7")) { + memset(filename, 0, sizeof(filename)); + sprintf((char *)filename, "%s.he7", _gameName.c_str()); + } + debug(1,"File %s", filename); for (r = strlen((char*)filename); r != 0; r--) { diff --git a/scumm/string.cpp b/scumm/string.cpp index 1e1ee80434..782f60796d 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -627,7 +627,7 @@ int ScummEngine::addStringToStack(byte *dst, int dstSize, int var) { return i; } - if (_version == 3 || _version >= 6) + if (_version == 3 || (_version >= 6 && _heversion < 72)) var = readVar(var); if (var) { -- cgit v1.2.3