diff options
author | Eugene Sandulenko | 2005-02-23 12:26:17 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2005-02-23 12:26:17 +0000 |
commit | 5ae4dde2fb905b797e7ad0b775f994e3c9627f96 (patch) | |
tree | 5eb352abfe032c5873c1b529c045cb0ce7fcce69 | |
parent | 1b7e174f884a953c5a123b6824166b08c706b79b (diff) | |
download | scummvm-rg350-5ae4dde2fb905b797e7ad0b775f994e3c9627f96.tar.gz scummvm-rg350-5ae4dde2fb905b797e7ad0b775f994e3c9627f96.tar.bz2 scummvm-rg350-5ae4dde2fb905b797e7ad0b775f994e3c9627f96.zip |
Fix spriteInfoGet_classFlags*.
svn-id: r16882
-rw-r--r-- | scumm/intern.h | 2 | ||||
-rw-r--r-- | scumm/script_v100he.cpp | 2 | ||||
-rw-r--r-- | scumm/script_v90he.cpp | 2 | ||||
-rw-r--r-- | scumm/sprite_he.cpp | 22 |
4 files changed, 13 insertions, 15 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 91188edd6e..5ccfca28d4 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -877,7 +877,7 @@ protected: int spriteInfoGet_case15(int a, int b, int c, int d, int num, int *args); int spriteInfoGet_classFlags(int spriteId, int num); - int spriteInfoGet_classFlags2(int spriteId, int num, int *args); + int spriteInfoGet_classFlagsAnd(int spriteId, int num, int *args); int spriteInfoGet_flags_1(int spriteId); int spriteInfoGet_flags_2(int spriteId); int spriteInfoGet_flags_3(int spriteId); diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp index d9173c484a..51e1527edb 100644 --- a/scumm/script_v100he.cpp +++ b/scumm/script_v100he.cpp @@ -2384,7 +2384,7 @@ void ScummEngine_v100he::o100_getSpriteInfo() { spriteId = pop(); if (spriteId) { if (flags) - push(spriteInfoGet_classFlags2(spriteId, flags, args)); + push(spriteInfoGet_classFlagsAnd(spriteId, flags, args)); else push(spriteInfoGet_classFlags(spriteId, -1)); } else { diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index ccddd49210..68f7dc0f06 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -918,7 +918,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() { spriteId = pop(); if (spriteId) { if (flags) - push(spriteInfoGet_classFlags2(spriteId, flags, args)); + push(spriteInfoGet_classFlagsAnd(spriteId, flags, args)); else push(spriteInfoGet_classFlags(spriteId, -1)); } else { diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp index 584b43862b..d17e2701bb 100644 --- a/scumm/sprite_he.cpp +++ b/scumm/sprite_he.cpp @@ -51,24 +51,22 @@ int ScummEngine_v90he::spriteInfoGet_classFlags(int spriteId, int classId) { return _spriteTable[spriteId].class_flags; checkRange(32, 1, classId, "class %d out of range in statement"); - return ((_spriteTable[spriteId].class_flags & classId) != 0) ? 1 : 0; + return ((_spriteTable[spriteId].class_flags & (1 << classId)) != 0) ? 1 : 0; } -int ScummEngine_v90he::spriteInfoGet_classFlags2(int spriteId, int num, int *args) { - int cls; - bool b, cond = true; - +int ScummEngine_v90he::spriteInfoGet_classFlagsAnd(int spriteId, int num, int *args) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); - while (--num >= 0) { - cls = args[num]; - checkRange(32, 1, cls, "class %d out of range in statement"); - b = ((_spriteTable[spriteId].class_flags & cls) != 0) ? 1 : 0; - if ((cls & 0x80 && !b) || (!(cls & 0x80) && b)) - cond = 0; + if (!num) + return 1; + + for (int i = 0; i < num; i++) { + checkRange(32, 1, args[i], "class %d out of range in statement"); + if (!(_spriteTable[spriteId].class_flags & (1 << args[i]))) + return 0; } - return cond; + return 1; } int ScummEngine_v90he::spriteInfoGet_flags_1(int spriteId) { |