mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-27 05:32:45 +00:00
Add WIP findSpriteWithClassOf() function
svn-id: r16914
This commit is contained in:
parent
7298987bba
commit
2e60c4fbd3
@ -875,7 +875,7 @@ protected:
|
||||
uint8 getWizPixelColor(int restype, int resnum, int state, int x, int y, int flags);
|
||||
int computeWizHistogram(int resnum, int state, int x, int y, int w, int h);
|
||||
|
||||
int spriteInfoGet_case15(int a, int b, int c, int d, int num, int *args);
|
||||
int findSpriteWithClassOf(int x, int y, int spriteGroup, int d, int num, int *args);
|
||||
int spriteInfoGet_classFlags(int spriteId, int num);
|
||||
int spriteInfoGet_classFlagsAnd(int spriteId, int num, int *args);
|
||||
int spriteInfoGet_flags_13(int spriteId);
|
||||
|
@ -2425,7 +2425,7 @@ void ScummEngine_v100he::o100_getSpriteInfo() {
|
||||
d = pop();
|
||||
e = pop();
|
||||
f = pop();
|
||||
push(spriteInfoGet_case15(f, e, d, c, flags, args));
|
||||
push(findSpriteWithClassOf(f, e, d, c, flags, args));
|
||||
break;
|
||||
case 38:
|
||||
spriteId = pop();
|
||||
|
@ -829,18 +829,18 @@ void ScummEngine_v90he::o90_getSpriteInfo() {
|
||||
d = pop();
|
||||
e = pop();
|
||||
f = pop();
|
||||
push(spriteInfoGet_case15(f, e, d, c, flags, args));
|
||||
push(findSpriteWithClassOf(f, e, d, c, flags, args));
|
||||
} else if (_heversion == 98) {
|
||||
pop();
|
||||
pop();
|
||||
pop();
|
||||
pop();
|
||||
push(0);
|
||||
c = pop();
|
||||
d = pop();
|
||||
e = pop();
|
||||
f = pop();
|
||||
push(findSpriteWithClassOf(f, e, d, c, 0, 0));
|
||||
} else {
|
||||
pop();
|
||||
pop();
|
||||
pop();
|
||||
push(0);
|
||||
d = pop();
|
||||
e = pop();
|
||||
f = pop();
|
||||
push(findSpriteWithClassOf(f, e, d, 0, 0, 0));
|
||||
}
|
||||
break;
|
||||
case 22:
|
||||
|
@ -39,8 +39,86 @@ void ScummEngine_v90he::allocateArrays() {
|
||||
//
|
||||
// spriteInfoGet functions
|
||||
//
|
||||
int ScummEngine_v90he::spriteInfoGet_case15(int a, int b, int c, int d, int num, int *args) {
|
||||
// TODO
|
||||
int ScummEngine_v90he::findSpriteWithClassOf(int x, int y, int spriteGroup, int d, int num, int *args) {
|
||||
int classId;
|
||||
debug(1, "findSprite: x %d, y %d, spriteGroup %d, d %d, num %d\n", x, y, spriteGroup, d, num);
|
||||
|
||||
for (int i = 0; i < _numSpritesToProcess; ++i) {
|
||||
SpriteInfo *spi = _activeSpritesTable[i];
|
||||
if (!spi->field_4C)
|
||||
continue;
|
||||
|
||||
if (spriteGroup && spi->group_num != spi->field_4C)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < num; j++) {
|
||||
classId = args[j] & 0x7F;
|
||||
checkRange(32, 1, classId, "class %d out of range in statement");
|
||||
if (!(spi->class_flags & (1 << classId)))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (d != 0) {
|
||||
if (spi->bbox.left > spi->bbox.right)
|
||||
continue;
|
||||
if (spi->bbox.top > spi->bbox.bottom)
|
||||
continue;
|
||||
if (spi->bbox.left > x)
|
||||
continue;
|
||||
if (spi->bbox.top > y)
|
||||
continue;
|
||||
if (spi->bbox.right < x)
|
||||
continue;
|
||||
if (spi->bbox.bottom < y)
|
||||
continue;
|
||||
return i;
|
||||
} else {
|
||||
int state;
|
||||
int resId = spi->field_4C;
|
||||
|
||||
if (spi->field_80) {
|
||||
int16 x1, x2, y1, y2;
|
||||
|
||||
state = getWizImageStates(spi->field_80);
|
||||
state /= spi->field_48;
|
||||
|
||||
x -= spi->field_34;
|
||||
y -= spi->field_38;
|
||||
|
||||
loadImgSpot(spi->field_4C, state, x1, y1);
|
||||
loadImgSpot(spi->field_80, state, x2, y2);
|
||||
|
||||
x += (x2 - x1);
|
||||
y += (y2 - y1);
|
||||
} else {
|
||||
if (spi->bbox.left > spi->bbox.right)
|
||||
continue;
|
||||
if (spi->bbox.top > spi->bbox.bottom)
|
||||
continue;
|
||||
if (spi->bbox.left > x)
|
||||
continue;
|
||||
if (spi->bbox.top > y)
|
||||
continue;
|
||||
if (spi->bbox.right < x)
|
||||
continue;
|
||||
if (spi->bbox.bottom < y)
|
||||
continue;
|
||||
|
||||
x -= spi->field_34;
|
||||
y -= spi->field_38;
|
||||
state = spi->field_48;
|
||||
}
|
||||
|
||||
if ((spi->flags & kSFZoomed) || (spi->flags & kSFRotated)) {
|
||||
// TODO
|
||||
|
||||
}
|
||||
|
||||
if(isWizPixelNonTransparent(rtImage, resId, state, x, y, spi->imgFlags));
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user