aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-07-13 17:04:55 +0200
committerEugene Sandulenko2019-09-03 17:17:19 +0200
commitac50b10549479c980bf9f0bfceb9dd5b0a2fb5c3 (patch)
tree82a6696ddb86467e3adae71f7b2d8737b13265c3
parent74d0c5daed408c6ee709dffd62e921abcbb3a15f (diff)
downloadscummvm-rg350-ac50b10549479c980bf9f0bfceb9dd5b0a2fb5c3.tar.gz
scummvm-rg350-ac50b10549479c980bf9f0bfceb9dd5b0a2fb5c3.tar.bz2
scummvm-rg350-ac50b10549479c980bf9f0bfceb9dd5b0a2fb5c3.zip
HDB: Fix getRandomNumber() usage in menu.cpp
-rw-r--r--engines/hdb/menu.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp
index 2c524fc21f..53ffcdab96 100644
--- a/engines/hdb/menu.cpp
+++ b/engines/hdb/menu.cpp
@@ -227,9 +227,9 @@ void Menu::startMenu() {
if (!_fStars[0].y) {
for (i = 0; i < kMaxStars; i++) {
_fStars[i].y = -30;
- _fStars[i].x = g_hdb->_rnd->getRandomNumber(kScreenWidth);
- _fStars[i].speed = g_hdb->_rnd->getRandomNumber(5) + 1;
- _fStars[i].anim = g_hdb->_rnd->getRandomNumber(3);
+ _fStars[i].x = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1);
+ _fStars[i].speed = g_hdb->_rnd->getRandomNumber(4) + 1;
+ _fStars[i].anim = g_hdb->_rnd->getRandomNumber(2);
_fStars[i].delay = 5;
}
}
@@ -240,10 +240,10 @@ void Menu::startMenu() {
if (!_nebulaY) {
g_hdb->_gfx->setup3DStars(); // setup the star info
- _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount);
- _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth) + 10;
+ _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount - 1);
+ _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1) + 10;
_nebulaY = -20;
- _nebulaYVel = g_hdb->_rnd->getRandomNumber(10) + 2;
+ _nebulaYVel = g_hdb->_rnd->getRandomNumber(9) + 2;
}
_optionsScrollX = kMenuX;
@@ -788,10 +788,10 @@ void Menu::drawTitle() {
_nebulaGfx[_nebulaWhich]->draw(_nebulaX, _nebulaY);
_nebulaY += _nebulaYVel;
if (_nebulaY > kScreenHeight + (kScreenHeight / 2)) {
- _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount);
- _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth) + 10;
+ _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount - 1);
+ _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1) + 10;
_nebulaY = -11 * 8;
- _nebulaYVel = g_hdb->_rnd->getRandomNumber(4) + 1;
+ _nebulaYVel = g_hdb->_rnd->getRandomNumber(3) + 1;
if (_nebulaWhich > 4) // galaxy?
_nebulaYVel = 1;
}
@@ -892,10 +892,10 @@ void Menu::drawTitle() {
_rocketEx = 0; // exhaust toggle
g_hdb->_gfx->setup3DStars(); // setup the star info
- _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount);
- _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth) + 10;
+ _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount - 1);
+ _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1) + 10;
_nebulaY = -11 * 8;
- _nebulaYVel = g_hdb->_rnd->getRandomNumber(10) + 2;
+ _nebulaYVel = g_hdb->_rnd->getRandomNumber(9) + 2;
if (_nebulaWhich > 4) // galaxy?
_nebulaYVel = 1;
}
@@ -1265,10 +1265,10 @@ void Menu::drawNebula() {
_nebulaY += _nebulaYVel;
if (_nebulaY > kScreenHeight + (kScreenHeight / 2)) {
- _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount);
- _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth) + 10;
+ _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount - 1);
+ _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1) + 10;
_nebulaY = -11 * 8;
- _nebulaYVel = g_hdb->_rnd->getRandomNumber(4) + 1;
+ _nebulaYVel = g_hdb->_rnd->getRandomNumber(3) + 1;
if (_nebulaWhich > 4) // galaxy?
_nebulaYVel = 1;
}
@@ -1281,8 +1281,8 @@ void Menu::drawNebula() {
for (i = 0; i < kMaxStars; i++) {
_fStars[i].y += _fStars[i].speed;
if (_fStars[i].y > kScreenHeight) {
- _fStars[i].y = (g_hdb->_rnd->getRandomNumber(30) + 30) * -1;
- _fStars[i].speed = g_hdb->_rnd->getRandomNumber(5) + 1;
+ _fStars[i].y = (g_hdb->_rnd->getRandomNumber(29) + 30) * -1;
+ _fStars[i].speed = g_hdb->_rnd->getRandomNumber(4) + 1;
}
if (_fStars[i].delay-- < 1) {
_fStars[i].delay = 5;