diff options
author | Johannes Schickel | 2009-06-18 21:47:10 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-06-18 21:47:10 +0000 |
commit | 2e27c7b49246c1e0dc1d2d2fe8f767dcad15f2cb (patch) | |
tree | d4a0096ce65fa1a2870f21d9a1d8ee41495ea162 /engines | |
parent | 4562fe248a1ded2d64e43800ec4e8fcb43e95d3a (diff) | |
download | scummvm-rg350-2e27c7b49246c1e0dc1d2d2fe8f767dcad15f2cb.tar.gz scummvm-rg350-2e27c7b49246c1e0dc1d2d2fe8f767dcad15f2cb.tar.bz2 scummvm-rg350-2e27c7b49246c1e0dc1d2d2fe8f767dcad15f2cb.zip |
Replaced "getRandomNumberSpecial" be RandomSource usage. (This is needed for proper event recording, also the probability for generated numbers is actually nearly the same)
svn-id: r41646
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/lol.cpp | 26 | ||||
-rw-r--r-- | engines/kyra/lol.h | 1 | ||||
-rw-r--r-- | engines/kyra/scene_lol.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/sprites_lol.cpp | 2 |
4 files changed, 4 insertions, 31 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 107091a479..20ca169cb5 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -1797,32 +1797,6 @@ void LoLEngine::delay(uint32 millis, bool doUpdate, bool) { } } -uint8 LoLEngine::getRandomNumberSpecial() { - uint8 a = _rndSpecial & 0xff; - uint8 b = (_rndSpecial >> 8) & 0xff; - uint8 c = (_rndSpecial >> 16) & 0xff; - - a >>= 1; - - uint as = a & 1; - uint bs = (b >> 7) ? 0 : 1; - uint cs = c >> 7; - - a >>= 1; - c = (c << 1) | as; - b = (b << 1) | cs; - - a -= ((_rndSpecial & 0xff) - bs); - as = a & 1; - a >>= 1; - - a = ((_rndSpecial & 0xff) >> 1) | (as << 7); - - _rndSpecial = (_rndSpecial & 0xff000000) | (c << 16) | (b << 8) | a; - - return a ^ b; -} - void LoLEngine::updateEnvironmentalSfx(int soundId) { snd_processEnvironmentalSoundEffect(soundId, _currentBlock); } diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index f814219e30..f2a6727289 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -1303,7 +1303,6 @@ private: // misc void delay(uint32 millis, bool doUpdate = false, bool isMainLoop = false); - uint8 getRandomNumberSpecial(); uint8 _compassBroken; uint8 _drainMagic; diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 370940c4e4..8cb28840d5 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -604,7 +604,7 @@ void LoLEngine::updateCompass() { if (_compassStep) _compassStep -= (((ABS(_compassStep) >> 4) + 2) * dir); - int16 d = _compassBroken ? ((int8)getRandomNumberSpecial() - _compassDirection) : (_currentDirection << 6) - _compassDirection; + int16 d = _compassBroken ? (int8(_rnd.getRandomNumber(255)) - _compassDirection) : (_currentDirection << 6) - _compassDirection; if (d <= -128) d += 256; if (d >= 128) @@ -1261,8 +1261,8 @@ void LoLEngine::shakeScene(int duration, int width, int height, int restore) { while (endTime > _system->getMillis()) { uint32 delayTimer = _system->getMillis() + 2 * _tickLength; - int s1 = width ? (getRandomNumberSpecial() % (width << 1)) - width : 0; - int s2 = height ? (getRandomNumberSpecial() % (height << 1)) - height : 0; + int s1 = width ? (_rnd.getRandomNumber(255) % (width << 1)) - width : 0; + int s2 = height ? (_rnd.getRandomNumber(255) % (height << 1)) - height : 0; int x1, y1, x2, y2, w, h; if (s1 >= 0) { diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp index 732a8bb2ca..593d905b87 100644 --- a/engines/kyra/sprites_lol.cpp +++ b/engines/kyra/sprites_lol.cpp @@ -1092,7 +1092,7 @@ void LoLEngine::updateMonster(MonsterInPlay *monster) { setMonsterMode(monster, 7); if ((monster->mode != 11) && (monster->mode != 14)) { - if (!(getRandomNumberSpecial() & 3)) { + if (!(_rnd.getRandomNumber(255) & 3)) { monster->shiftStep = (++monster->shiftStep) & 0x0f; checkSceneUpdateNeed(monster->block); } |