Fix spriteInfoGet_classFlags*.

svn-id: r16882
This commit is contained in:
Eugene Sandulenko 2005-02-23 12:26:17 +00:00
parent 1b7e174f88
commit 5ae4dde2fb
4 changed files with 13 additions and 15 deletions

View File

@ -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);

View File

@ -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 {

View File

@ -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 {

View File

@ -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) {