diff options
Diffstat (limited to 'engines/bladerunner/mouse.cpp')
-rw-r--r-- | engines/bladerunner/mouse.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/engines/bladerunner/mouse.cpp b/engines/bladerunner/mouse.cpp index 7639e305dc..093c73fcff 100644 --- a/engines/bladerunner/mouse.cpp +++ b/engines/bladerunner/mouse.cpp @@ -166,7 +166,29 @@ void Mouse::getXY(int *x, int *y) const { *y = _y; } -void Mouse::setRandomY() { +void Mouse::setMouseJitterUp() { + switch (_vm->_settings->getDifficulty()) { + case 0: + _randomCountdownX = 2; + _randomX = _vm->_rnd.getRandomNumberRng(0, 6) - 3; + _randomY = _vm->_rnd.getRandomNumberRng(0, 10) - 20; + break; + + case 1: + _randomCountdownX = 3; + _randomX = _vm->_rnd.getRandomNumberRng(0, 8) - 4; + _randomY = _vm->_rnd.getRandomNumberRng(0, 10) - 25; + break; + + case 2: + _randomCountdownX = 4; + _randomX = _vm->_rnd.getRandomNumberRng(0, 10) - 5; + _randomY = _vm->_rnd.getRandomNumberRng(0, 10) - 30; + break; + } +} + +void Mouse::setMouseJitterDown() { switch (_vm->_settings->getDifficulty()) { case 0: _randomCountdownY = 2; @@ -190,6 +212,9 @@ void Mouse::setRandomY() { void Mouse::disable() { ++_disabledCounter; + + _randomCountdownX = 0; + _randomCountdownY = 0; } void Mouse::enable() { @@ -204,9 +229,24 @@ bool Mouse::isDisabled() const { void Mouse::draw(Graphics::Surface &surface, int x, int y) { if (_disabledCounter) { + _randomCountdownX = 0; + _randomCountdownY = 0; return; } + if (_randomCountdownX > 0) { + _randomCountdownX--; + x += _randomX; + y += _randomY; + + if (!_randomCountdownX) + setMouseJitterDown(); + } else if (_randomCountdownY > 0){ + _randomCountdownY--; + x += _randomX; + y += _randomY; + } + _x = CLIP(x, 0, surface.w - 1); _y = CLIP(y, 0, surface.h - 1); |