aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/intern.h2
-rw-r--r--scumm/script_v100he.cpp2
-rw-r--r--scumm/script_v90he.cpp2
-rw-r--r--scumm/sprite_he.cpp22
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) {