From f8769966f161a2be413eeef01517d96005f61c84 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 13 Jul 2019 17:48:12 +0200 Subject: HDB: Fix getRandomNumber usage --- engines/hdb/window.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/hdb/window.cpp b/engines/hdb/window.cpp index cf6b79b88f..8df868ec37 100644 --- a/engines/hdb/window.cpp +++ b/engines/hdb/window.cpp @@ -1043,7 +1043,7 @@ void Window::drawDeliveries() { if (!_dlvsInfo.go2) { _dlvsInfo.go2 = true; _dlvsInfo.delay2 = g_hdb->getTimeSlice() + 500; - g_hdb->_sound->playSound(crazySounds[g_hdb->_rnd->getRandomNumber(kNumCrazy)]); + g_hdb->_sound->playSound(crazySounds[g_hdb->_rnd->getRandomNumber(kNumCrazy - 1)]); } } } @@ -1057,7 +1057,7 @@ void Window::drawDeliveries() { if (!_dlvsInfo.go3) { _dlvsInfo.go3 = true; _dlvsInfo.delay3 = g_hdb->getTimeSlice() + 500; - g_hdb->_sound->playSound(crazySounds[g_hdb->_rnd->getRandomNumber(kNumCrazy)]); + g_hdb->_sound->playSound(crazySounds[g_hdb->_rnd->getRandomNumber(kNumCrazy - 1)]); } } } @@ -1071,7 +1071,7 @@ void Window::drawDeliveries() { g_hdb->_gfx->drawText("to "); g_hdb->_gfx->drawText(d->destTextName); - g_hdb->_sound->playSound(crazySounds[g_hdb->_rnd->getRandomNumber(kNumCrazy)]); + g_hdb->_sound->playSound(crazySounds[g_hdb->_rnd->getRandomNumber(kNumCrazy - 1)]); _dlvsInfo.animate = false; } } @@ -1180,8 +1180,8 @@ void Window::drawPanicZone() { // Move PANIC ZONE to screen center case PANICZONE_START: - xx = g_hdb->_rnd->getRandomNumber(10) - 5; - yy = g_hdb->_rnd->getRandomNumber(10) - 5; + xx = g_hdb->_rnd->getRandomNumber(9) - 5; + yy = g_hdb->_rnd->getRandomNumber(9) - 5; _pzInfo.x1 += _pzInfo.xv; _pzInfo.y1++; _pzInfo.x2 += _pzInfo.yv; @@ -1195,8 +1195,8 @@ void Window::drawPanicZone() { break; case PANICZONE_TITLESTOP: - xx = g_hdb->_rnd->getRandomNumber(10) - 5; - yy = g_hdb->_rnd->getRandomNumber(10) - 5; + xx = g_hdb->_rnd->getRandomNumber(9) - 5; + yy = g_hdb->_rnd->getRandomNumber(9) - 5; _pzInfo.gfxPanic->drawMasked(_pzInfo.x1 + xx, _pzInfo.y1 + yy); _pzInfo.gfxZone->drawMasked(_pzInfo.x2 + yy, _pzInfo.y2 + xx); _pzInfo.timer--; @@ -1206,8 +1206,8 @@ void Window::drawPanicZone() { break; case PANICZONE_BLASTOFF: - xx = g_hdb->_rnd->getRandomNumber(10) - 5; - yy = g_hdb->_rnd->getRandomNumber(10) - 5; + xx = g_hdb->_rnd->getRandomNumber(9) - 5; + yy = g_hdb->_rnd->getRandomNumber(9) - 5; _pzInfo.y1 -= 10; _pzInfo.y2 += 10; _pzInfo.gfxPanic->drawMasked(_pzInfo.x1 + xx, _pzInfo.y1 + yy); -- cgit v1.2.3