diff options
author | Travis Howell | 2005-03-09 06:28:46 +0000 |
---|---|---|
committer | Travis Howell | 2005-03-09 06:28:46 +0000 |
commit | 185ed9d2bc04250b1fbed4da315978ddde06c550 (patch) | |
tree | 48ad27b864e64ab3793bf9f0e498b01d55a83f54 /scumm/sprite_he.cpp | |
parent | ebcf64df5619121684a021b6b53900968d097471 (diff) | |
download | scummvm-rg350-185ed9d2bc04250b1fbed4da315978ddde06c550.tar.gz scummvm-rg350-185ed9d2bc04250b1fbed4da315978ddde06c550.tar.bz2 scummvm-rg350-185ed9d2bc04250b1fbed4da315978ddde06c550.zip |
A few more safety checks
svn-id: r17045
Diffstat (limited to 'scumm/sprite_he.cpp')
-rw-r--r-- | scumm/sprite_he.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp index 8182c7343d..67b25375c4 100644 --- a/scumm/sprite_he.cpp +++ b/scumm/sprite_he.cpp @@ -866,10 +866,11 @@ void ScummEngine_v90he::spriteGroupSet_tx_ty(int spriteGroupId, int value1, int void ScummEngine_v90he::spriteGroupSet_inc_tx_ty(int spriteGroupId, int value1, int value2) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); - _spriteGroups[spriteGroupId].tx += value1; - _spriteGroups[spriteGroupId].ty += value2; - - redrawSpriteGroup(spriteGroupId); + if (value1 || value2) { + _spriteGroups[spriteGroupId].tx += value1; + _spriteGroups[spriteGroupId].ty += value2; + redrawSpriteGroup(spriteGroupId); + } } void ScummEngine_v90he::spriteGroupSet_field_20(int spriteGroupId, int value) { @@ -904,6 +905,9 @@ void ScummEngine_v90he::spriteGroupSet_scale_x_ratio_mul(int spriteGroupId, int void ScummEngine_v90he::spriteGroupSet_scale_x_ratio_div(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + if (value == 0) + error("spriteGroupSet_scale_x_ratio_div: Divisor must not be 0"); + if (_spriteGroups[spriteGroupId].scale_x_ratio_div != value) { _spriteGroups[spriteGroupId].scale_x_ratio_div = value; _spriteGroups[spriteGroupId].scale_x = _spriteGroups[spriteGroupId].scale_x_ratio_mul / _spriteGroups[spriteGroupId].scale_x_ratio_div; @@ -928,6 +932,9 @@ void ScummEngine_v90he::spriteGroupSet_scale_y_ratio_mul(int spriteGroupId, int void ScummEngine_v90he::spriteGroupSet_scale_y_ratio_div(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + if (value == 0) + error("spriteGroupSet_scale_y_ratio_div: Divisor must not be 0"); + if (_spriteGroups[spriteGroupId].scale_y_ratio_div != value) { _spriteGroups[spriteGroupId].scale_y_ratio_div = value; _spriteGroups[spriteGroupId].scale_y = _spriteGroups[spriteGroupId].scale_y_ratio_mul / _spriteGroups[spriteGroupId].scale_y_ratio_div; @@ -941,7 +948,6 @@ void ScummEngine_v90he::spriteGroupSet_flagNeedRedrawAnd(int spriteGroupId) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); _spriteGroups[spriteGroupId].flags &= ~(kSGFNeedRedraw); - redrawSpriteGroup(spriteGroupId); } |