diff options
author | Travis Howell | 2005-04-01 09:55:17 +0000 |
---|---|---|
committer | Travis Howell | 2005-04-01 09:55:17 +0000 |
commit | 879de392d1d1932d9e341ba2fb376444f759755d (patch) | |
tree | c7bf2b8372346ea68d1d58e86adf7cfaca26aad7 /scumm/object.cpp | |
parent | b4ecd9f56ec9c3488f95f1b8ec5955748e51093b (diff) | |
download | scummvm-rg350-879de392d1d1932d9e341ba2fb376444f759755d.tar.gz scummvm-rg350-879de392d1d1932d9e341ba2fb376444f759755d.tar.bz2 scummvm-rg350-879de392d1d1932d9e341ba2fb376444f759755d.zip |
A random object state is possible in scumm7 too.
svn-id: r17324
Diffstat (limited to 'scumm/object.cpp')
-rw-r--r-- | scumm/object.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp index 28a4f86955..a1e3555702 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -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); } |