diff options
Diffstat (limited to 'engines/bladerunner/ui/ui_check_box.cpp')
-rw-r--r-- | engines/bladerunner/ui/ui_check_box.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/engines/bladerunner/ui/ui_check_box.cpp b/engines/bladerunner/ui/ui_check_box.cpp index 76cecd227c..38fb86c679 100644 --- a/engines/bladerunner/ui/ui_check_box.cpp +++ b/engines/bladerunner/ui/ui_check_box.cpp @@ -44,9 +44,9 @@ UICheckBox::UICheckBox(BladeRunnerEngine *vm, UIComponentCallback *valueChangedC _style = style; if (isChecked) { - _frame = 5; + _frame = 5u; } else { - _frame = 0; + _frame = 0u; } _timeLast = _vm->_time->currentSystem(); @@ -57,39 +57,41 @@ UICheckBox::UICheckBox(BladeRunnerEngine *vm, UIComponentCallback *valueChangedC void UICheckBox::draw(Graphics::Surface &surface) { if (_rect.right > _rect.left && _rect.bottom > _rect.top) { - int shapeId; + uint32 shapeId; - uint timeNow = _vm->_time->currentSystem(); - if (timeNow - _timeLast > 67) { - int frameDelta = (timeNow - _timeLast) / 67u; + uint32 timeNow = _vm->_time->currentSystem(); + // unsigned difference is intentional + if (timeNow - _timeLast > 67u) { + // unsigned difference is intentional + uint32 frameDelta = (timeNow - _timeLast) / 67u; _timeLast = timeNow; if (_isChecked) { - _frame = MIN(_frame + frameDelta, 5); + _frame = MIN<uint32>(_frame + frameDelta, 5u); } else { - _frame = MAX(_frame - frameDelta, 0); + _frame = (_frame < frameDelta) ? 0 : MAX<uint32>(_frame - frameDelta, 0u); } } if (_style) { if (_frame || (_hasFocus && !_isPressed && _isEnabled)) { - if (_frame != 5 || (_hasFocus && !_isPressed && _isEnabled)) { - shapeId = _frame + 54; + if (_frame != 5u || (_hasFocus && !_isPressed && _isEnabled)) { + shapeId = _frame + 54u; } else { - shapeId = 53; + shapeId = 53u; } } else { - shapeId = 52; + shapeId = 52u; } } else { if (_frame || (_hasFocus && !_isPressed && _isEnabled)) { - if (_frame != 5 || (_hasFocus && !_isPressed && _isEnabled)) { - shapeId = _frame + 62; + if (_frame != 5u || (_hasFocus && !_isPressed && _isEnabled)) { + shapeId = _frame + 62u; } else { - shapeId = 61; + shapeId = 61u; } } else { - shapeId = 60; + shapeId = 60u; } } |