diff options
author | Travis Howell | 2005-03-03 04:54:23 +0000 |
---|---|---|
committer | Travis Howell | 2005-03-03 04:54:23 +0000 |
commit | ac493b31db8c3e2181141191d10962c38ce957e8 (patch) | |
tree | 77c437d67a798a2b8a8781d524cc68b37d9e416d | |
parent | 78e3fc94155fa760819f74b038346251a35d3905 (diff) | |
download | scummvm-rg350-ac493b31db8c3e2181141191d10962c38ce957e8.tar.gz scummvm-rg350-ac493b31db8c3e2181141191d10962c38ce957e8.tar.bz2 scummvm-rg350-ac493b31db8c3e2181141191d10962c38ce957e8.zip |
Fix compare string.
svn-id: r16981
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | scumm/script_v7he.cpp | 44 |
2 files changed, 16 insertions, 30 deletions
@@ -267,8 +267,6 @@ SCUMM - Add arrayOps case 127 (For chase/lost/smaller/bb2demo/footdemo). - Add support for array sorting (Used in lost/smaller). - Fix actor glitches in pajama2 - - Fix array issues in Buzzy games (Kirben) - - Fix name check failing in mustard, when comparing strings via o70_compareString() - Fix loadImgSpot asserts, due to spritesProcessWiz loading WizImages with sprite res_id of 0 - Fix cursor transparency in puzzle of pajama2 - Fix sprites graphical glitches diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index ac14ae37c0..6e4654b6e3 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -888,44 +888,32 @@ void ScummEngine_v70he::o70_concatString() { } void ScummEngine_v70he::o70_compareString() { - byte *addr, *addr2; - int i = 0; - - int id = pop(); - int id2 = pop(); - - addr = getStringAddress(id); - if (!addr) - error("o70_compareString: Reference to zeroed array pointer (%d)", id); + int result; - addr2 = getStringAddress(id2); - if (!addr2) - error("o70_compareString: Reference to zeroed array pointer (%d)", id); + int array1 = pop(); + int array2 = pop(); - while(1) { - if (*addr != *addr2) - break; - if (*addr2 == 0) { - push(0); - return; - } + byte *string1 = getStringAddress(array1); + if (!string1) + error("o70_compareString: Reference to zeroed array pointer (%d)", array1); - addr++; - addr2++; + byte *string2 = getStringAddress(array2); + if (!string2) + error("o70_compareString: Reference to zeroed array pointer (%d)", array2); - if (*addr != *addr2) - break; - if (*addr2 == 0) { + while (*string1 == *string2) { + if (*string2 == 0) { push(0); return; } - addr++; - addr2++; + string1++; + string2++; } - push (i); - debug(1,"o70_compareString (%d, %d, %d)", id, id2, i); + result = (*string1 > *string2) ? -1 : 1; + push(result); + debug(1,"o70_compareString (%d, %d, %d)", array1, array2, result); } void ScummEngine_v70he::o70_readINI() { |