aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTravis Howell2005-03-11 03:21:43 +0000
committerTravis Howell2005-03-11 03:21:43 +0000
commit06a8268792ee88f1514e6e77ce3eb7af0f00a1b9 (patch)
tree90137a8b0f2607cf1b5620b078cbbe0f647f1bac /scumm
parentd6b8386241738a4c487aabe33932508ef327994e (diff)
downloadscummvm-rg350-06a8268792ee88f1514e6e77ce3eb7af0f00a1b9.tar.gz
scummvm-rg350-06a8268792ee88f1514e6e77ce3eb7af0f00a1b9.tar.bz2
scummvm-rg350-06a8268792ee88f1514e6e77ce3eb7af0f00a1b9.zip
Check for negative value
svn-id: r17070
Diffstat (limited to 'scumm')
-rw-r--r--scumm/sprite_he.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp
index 5410762edf..07d74dc530 100644
--- a/scumm/sprite_he.cpp
+++ b/scumm/sprite_he.cpp
@@ -85,8 +85,7 @@ int ScummEngine_v90he::findSpriteWithClassOf(int x_pos, int y_pos, int spriteGro
if (spi->field_80) {
int16 x1, x2, y1, y2;
- state = getWizImageStates(spi->field_80);
- state /= spi->cur_img_state;
+ state = spi->cur_img_state / getWizImageStates(spi->field_80);
x = x_pos - spi->pos.x;
y = y_pos - spi->pos.y;
@@ -450,8 +449,8 @@ void ScummEngine_v90he::spriteInfoSet_resState(int spriteId, int state) {
if (_spriteTable[spriteId].res_id) {
int res_wiz_states = _spriteTable[spriteId].res_wiz_states - 1;
- if (state > res_wiz_states)
- state = res_wiz_states;
+ state = MAX(0, state);
+ state = MIN(state, res_wiz_states);
if (_spriteTable[spriteId].res_state != state) {
_spriteTable[spriteId].res_state = state;