mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-20 00:41:12 +00:00
A random object state is possible in scumm7 too.
svn-id: r17324
This commit is contained in:
parent
b4ecd9f56e
commit
879de392d1
@ -183,10 +183,13 @@ int ScummEngine::getObjectImageCount(int object) {
|
||||
if (!imhd)
|
||||
return 0;
|
||||
|
||||
if (_version == 8)
|
||||
if (_version == 8) {
|
||||
return (READ_LE_UINT32(&imhd->v8.image_count));
|
||||
else
|
||||
} else if (_version == 7) {
|
||||
return(READ_LE_UINT16(&imhd->v7.image_count));
|
||||
} else {
|
||||
return (READ_LE_UINT16(&imhd->old.image_count));
|
||||
}
|
||||
}
|
||||
|
||||
int ScummEngine::whereIsObject(int object) const {
|
||||
@ -1373,12 +1376,27 @@ void ScummEngine::setObjectState(int obj, int state, int x, int y) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (x != -1) {
|
||||
if (x != -1 && x != 0x7FFFFFFF) {
|
||||
_objs[i].x_pos = x * 8;
|
||||
_objs[i].y_pos = y * 8;
|
||||
}
|
||||
|
||||
addObjectToDrawQue(i);
|
||||
if (_version >= 7) {
|
||||
int imagecount;
|
||||
if (state == 0xFF) {
|
||||
state = getState(obj);
|
||||
imagecount = getObjectImageCount(obj);
|
||||
|
||||
if (state < imagecount)
|
||||
state++;
|
||||
else
|
||||
state = 1;
|
||||
}
|
||||
|
||||
if (state == 0xFE)
|
||||
state = _rnd.getRandomNumber(getObjectImageCount(obj));
|
||||
}
|
||||
putState(obj, state);
|
||||
}
|
||||
|
||||
|
@ -1501,35 +1501,7 @@ void ScummEngine_v8::o8_drawObject() {
|
||||
int y = pop();
|
||||
int x = pop();
|
||||
int obj = pop();
|
||||
int objnum = getObjectIndex(obj);
|
||||
int imagecount;
|
||||
ObjectData *od;
|
||||
|
||||
if (objnum == -1)
|
||||
return;
|
||||
|
||||
od = &_objs[objnum];
|
||||
if (x != 0x7FFFFFFF) {
|
||||
od->x_pos = x;
|
||||
od->y_pos = y;
|
||||
}
|
||||
|
||||
addObjectToDrawQue(objnum);
|
||||
|
||||
if (state == 0xFF) {
|
||||
state = getState(obj);
|
||||
imagecount = getObjectImageCount(obj);
|
||||
|
||||
if (state < imagecount)
|
||||
state++;
|
||||
else
|
||||
state = 1;
|
||||
}
|
||||
|
||||
if (state == 0xFE)
|
||||
state = _rnd.getRandomNumber(getObjectImageCount(obj));
|
||||
|
||||
putState(obj, state);
|
||||
setObjectState(obj, state, x, y);
|
||||
}
|
||||
|
||||
} // End of namespace Scumm
|
||||
|
Loading…
Reference in New Issue
Block a user