Check class of object number, not loop.

Cleanup.

svn-id: r17272
This commit is contained in:
Travis Howell 2005-03-28 11:38:04 +00:00
parent 2f2ca8ac21
commit 22affb0382
5 changed files with 11 additions and 28 deletions

View File

@ -912,8 +912,7 @@ protected:
void copyHEPaletteColor(int palSlot, uint8 dstColor, uint8 srcColor);
int findSpriteWithClassOf(int x, int y, int spriteGroupId, int d, int num, int *args);
int spriteInfoGet_classFlags(int spriteId, int num);
int spriteInfoGet_classFlagsAnd(int spriteId, int num, int *args);
int spriteInfoGet_classFlags(int spriteId, int num, int *args);
int spriteInfoGet_flags_13(int spriteId);
int spriteInfoGet_flagYFlipped(int spriteId);
int spriteInfoGet_flagXFlipped(int spriteId);

View File

@ -2537,10 +2537,7 @@ void ScummEngine_v100he::o100_getSpriteInfo() {
flags = getStackList(args, ARRAYSIZE(args));
spriteId = pop();
if (spriteId) {
if (flags)
push(spriteInfoGet_classFlagsAnd(spriteId, flags, args));
else
push(spriteInfoGet_classFlags(spriteId, -1));
push(spriteInfoGet_classFlags(spriteId, flags, args));
} else {
push(0);
}

View File

@ -683,7 +683,7 @@ int ScummEngine_v72he::findObject(int x, int y, int num, int *args) {
// Check object class
cls = args[0];
b = getClass(i, cls);
b = getClass(_objs[i].obj_nr, cls);
if ((cls & 0x80 && b) || (!(cls & 0x80) && !b))
return result;
}

View File

@ -958,10 +958,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() {
flags = getStackList(args, ARRAYSIZE(args));
spriteId = pop();
if (spriteId) {
if (flags)
push(spriteInfoGet_classFlagsAnd(spriteId, flags, args));
else
push(spriteInfoGet_classFlags(spriteId, -1));
push(spriteInfoGet_classFlags(spriteId, flags, args));
} else {
push(0);
}
@ -1715,7 +1712,7 @@ void ScummEngine_v90he::o90_findAllObjectsWithClassOf() {
tmp = num;
while (--tmp >= 0) {
cls = args[tmp];
b = getClass(i, cls);
b = getClass(_objs[i].obj_nr, cls);
if ((cls & 0x80 && !b) || (!(cls & 0x80) && b))
cond = 0;
}
@ -1723,6 +1720,7 @@ void ScummEngine_v90he::o90_findAllObjectsWithClassOf() {
if (cond)
writeArray(0, 0, j++, _objs[i].obj_nr);
}
writeArray(0, 0, 0, j);
push(readVar(0));

View File

@ -140,23 +140,12 @@ int ScummEngine_v90he::findSpriteWithClassOf(int x_pos, int y_pos, int spriteGro
return 0;
}
int ScummEngine_v90he::spriteInfoGet_classFlags(int spriteId, int classId) {
int ScummEngine_v90he::spriteInfoGet_classFlags(int spriteId, int num, int *args) {
checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d");
if (classId == -1)
return _spriteTable[spriteId].class_flags;
checkRange(32, 1, classId, "class %d out of range in statement");
return ((_spriteTable[spriteId].class_flags & (1 << classId)) != 0) ? 1 : 0;
}
int ScummEngine_v90he::spriteInfoGet_classFlagsAnd(int spriteId, int num, int *args) {
int code, classId;
checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d");
if (!num)
return 1;
if (num == 0)
return _spriteTable[spriteId].class_flags;
for (int i = 0; i < num; i++) {
code = classId = args[i];
@ -647,9 +636,9 @@ void ScummEngine_v90he::spriteInfoSet_setClassFlag(int spriteId, int classId, in
checkRange(32, 1, classId, "class %d out of range in statement");
if (toggle) {
_spriteTable[spriteId].class_flags |= (1 << (classId));
_spriteTable[spriteId].class_flags |= (1 << classId);
} else {
_spriteTable[spriteId].class_flags &= ~(1 << (classId));
_spriteTable[spriteId].class_flags &= ~(1 << classId);
}
}