aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/lol.cpp26
-rw-r--r--engines/kyra/lol.h1
-rw-r--r--engines/kyra/scene_lol.cpp6
-rw-r--r--engines/kyra/sprites_lol.cpp2
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);
}