aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe
diff options
context:
space:
mode:
authorColin Snover2017-11-14 11:34:39 -0600
committerEugene Sandulenko2017-11-18 22:35:12 +0100
commita25246bebe860aa7057e4c8901234c9d5f52b814 (patch)
treea2268a65fd5115734c3adc60e130032af6e43725 /engines/fullpipe
parenta49b6648c83145acc6ca576865af08ce63665b1f (diff)
downloadscummvm-rg350-a25246bebe860aa7057e4c8901234c9d5f52b814.tar.gz
scummvm-rg350-a25246bebe860aa7057e4c8901234c9d5f52b814.tar.bz2
scummvm-rg350-a25246bebe860aa7057e4c8901234c9d5f52b814.zip
FULLPIPE: Remove unnecessary extra allocation for RNG
Diffstat (limited to 'engines/fullpipe')
-rw-r--r--engines/fullpipe/behavior.cpp6
-rw-r--r--engines/fullpipe/floaters.cpp10
-rw-r--r--engines/fullpipe/fullpipe.cpp7
-rw-r--r--engines/fullpipe/fullpipe.h2
-rw-r--r--engines/fullpipe/scenes/scene02.cpp8
-rw-r--r--engines/fullpipe/scenes/scene04.cpp8
-rw-r--r--engines/fullpipe/scenes/scene05.cpp8
-rw-r--r--engines/fullpipe/scenes/scene06.cpp2
-rw-r--r--engines/fullpipe/scenes/scene12.cpp6
-rw-r--r--engines/fullpipe/scenes/scene15.cpp2
-rw-r--r--engines/fullpipe/scenes/scene17.cpp6
-rw-r--r--engines/fullpipe/scenes/scene18and19.cpp2
-rw-r--r--engines/fullpipe/scenes/scene20.cpp10
-rw-r--r--engines/fullpipe/scenes/scene25.cpp16
-rw-r--r--engines/fullpipe/scenes/scene27.cpp4
-rw-r--r--engines/fullpipe/scenes/scene28.cpp6
-rw-r--r--engines/fullpipe/scenes/scene29.cpp4
-rw-r--r--engines/fullpipe/scenes/scene34.cpp4
-rw-r--r--engines/fullpipe/scenes/scene35.cpp8
-rw-r--r--engines/fullpipe/scenes/scene38.cpp28
20 files changed, 74 insertions, 73 deletions
diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp
index 8c0bf9198c..61327c21c1 100644
--- a/engines/fullpipe/behavior.cpp
+++ b/engines/fullpipe/behavior.cpp
@@ -139,7 +139,7 @@ void BehaviorManager::updateBehavior(BehaviorInfo *behaviorInfo, BehaviorAnim *e
mq->sendNextCommand();
bhi->_flags &= 0xFFFFFFFD;
- } else if (behaviorInfo->_counter >= bhi->_delay && bhi->_percent && g_fp->_rnd->getRandomNumber(32767) <= entry->_behaviorMoves[i]->_percent) {
+ } else if (behaviorInfo->_counter >= bhi->_delay && bhi->_percent && g_fp->_rnd.getRandomNumber(32767) <= entry->_behaviorMoves[i]->_percent) {
MessageQueue *mq = new MessageQueue(bhi->_messageQueue, 0, 1);
mq->sendNextCommand();
@@ -156,7 +156,7 @@ void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, B
MessageQueue *mq = 0;
if (bhe->_flags & 1) {
- uint rnd = g_fp->_rnd->getRandomNumber(32767);
+ uint rnd = g_fp->_rnd.getRandomNumber(32767);
uint runPercent = 0;
for (int i = 0; i < bhe->_movesCount; i++) {
if (!(bhe->_behaviorMoves[i]->_flags & 1) && bhe->_behaviorMoves[i]->_percent) {
@@ -171,7 +171,7 @@ void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, B
for (int i = 0; i < bhe->_movesCount; i++) {
if (!(bhe->_behaviorMoves[i]->_flags & 1) && delay >= bhe->_behaviorMoves[i]->_delay) {
if (bhe->_behaviorMoves[i]->_percent) {
- if (g_fp->_rnd->getRandomNumber(32767) <= bhe->_behaviorMoves[i]->_percent) {
+ if (g_fp->_rnd.getRandomNumber(32767) <= bhe->_behaviorMoves[i]->_percent) {
mq = new MessageQueue(bhe->_behaviorMoves[i]->_messageQueue, 0, 1);
break;
}
diff --git a/engines/fullpipe/floaters.cpp b/engines/fullpipe/floaters.cpp
index aaeefb2c74..01afa240cc 100644
--- a/engines/fullpipe/floaters.cpp
+++ b/engines/fullpipe/floaters.cpp
@@ -111,7 +111,7 @@ void Floaters::genFlies(Scene *sc, int x, int y, int priority, int flags) {
else
nummoves = ani->_movement->_dynamicPhases.size();
- ani->_movement->setDynamicPhaseIndex(g_fp->_rnd->getRandomNumber(nummoves - 1));
+ ani->_movement->setDynamicPhaseIndex(g_fp->_rnd.getRandomNumber(nummoves - 1));
FloaterArray2 *arr2 = new FloaterArray2;
@@ -165,7 +165,7 @@ void Floaters::update() {
if (_array2[i]->val4 == _array2[i]->val2 && _array2[i]->val5 == _array2[i]->val3) {
_array2[i]->val9 = 0.0;
- _array2[i]->val13 = g_fp->_rnd->getRandomNumber(200) + 20;
+ _array2[i]->val13 = g_fp->_rnd.getRandomNumber(200) + 20;
if (_array2[i]->fflags & 1) {
g_fp->_currentScene->deleteStaticANIObject(_array2[i]->ani);
@@ -190,7 +190,7 @@ void Floaters::update() {
_array2[i]->val3 = _array2[i]->val7;
} else {
if (_array2[i]->fflags & 2) {
- int idx1 = g_fp->_rnd->getRandomNumber(_array1.size() - 1);
+ int idx1 = g_fp->_rnd.getRandomNumber(_array1.size() - 1);
_array2[i]->val2 = _array1[idx1]->val1;
_array2[i]->val3 = _array1[idx1]->val2;
@@ -202,8 +202,8 @@ void Floaters::update() {
_hRgn->getBBox(&rect);
- int x2 = rect.left + g_fp->_rnd->getRandomNumber(rect.right - rect.left);
- int y2 = rect.top + g_fp->_rnd->getRandomNumber(rect.bottom - rect.top);
+ int x2 = rect.left + g_fp->_rnd.getRandomNumber(rect.right - rect.left);
+ int y2 = rect.top + g_fp->_rnd.getRandomNumber(rect.bottom - rect.top);
if (_hRgn->pointInRegion(x2, y2)) {
int dx = _array2[i]->val2 - x2;
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 122b68511c..4bcdac7561 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -48,7 +48,10 @@ namespace Fullpipe {
FullpipeEngine *g_fp = 0;
Vars *g_vars = 0;
-FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
+FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) :
+ Engine(syst),
+ _gameDescription(gameDesc),
+ _rnd("fullpipe") {
DebugMan.addDebugChannel(kDebugPathfinding, "path", "Pathfinding");
DebugMan.addDebugChannel(kDebugDrawing, "drawing", "Drawing");
DebugMan.addDebugChannel(kDebugLoading, "loading", "Scene loading");
@@ -69,7 +72,6 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_sfxVolume = ConfMan.getInt("sfx_volume") * 39 - 10000;
_musicVolume = ConfMan.getInt("music_volume");
- _rnd = new Common::RandomSource("fullpipe");
_console = 0;
_gameProjectVersion = 0;
@@ -203,7 +205,6 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
}
FullpipeEngine::~FullpipeEngine() {
- delete _rnd;
delete _console;
delete _globalMessageQueueList;
delete _soundStream1;
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index d5aa730e07..ddcb5ad637 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -115,7 +115,7 @@ public:
bool isDemo();
Common::Language getLanguage() const;
- Common::RandomSource *_rnd;
+ Common::RandomSource _rnd;
Common::KeyCode _keyState;
uint16 _buttonState;
diff --git a/engines/fullpipe/scenes/scene02.cpp b/engines/fullpipe/scenes/scene02.cpp
index fd542d580d..e2350a958a 100644
--- a/engines/fullpipe/scenes/scene02.cpp
+++ b/engines/fullpipe/scenes/scene02.cpp
@@ -56,7 +56,7 @@ void scene02_initScene(Scene *sc) {
g_vars->scene02_boxOpen = false;
} else {
g_vars->scene02_boxOpen = true;
- g_vars->scene02_boxDelay = 100 * g_fp->_rnd->getRandomNumber(32767) + 150;
+ g_vars->scene02_boxDelay = 100 * g_fp->_rnd.getRandomNumber(32767) + 150;
}
g_fp->_floaters->init(g_fp->_gameLoader->_gameVar->getSubVarByName("SC_2"));
@@ -116,13 +116,13 @@ int sceneHandler02(ExCommand *ex) {
if (g_fp->_floaters->_array2[0]->val5 == -50) {
g_fp->_floaters->stopAll();
g_vars->scene02_boxOpen = false;
- g_vars->scene02_boxDelay = 100 * g_fp->_rnd->getRandomNumber(32767) + 150;
+ g_vars->scene02_boxDelay = 100 * g_fp->_rnd.getRandomNumber(32767) + 150;
} else {
g_fp->_floaters->_array2[0]->val3 = -50;
}
} else {
- g_fp->_floaters->genFlies(g_fp->_currentScene, g_fp->_rnd->getRandomNumber(700) + 100, -50, 0, 0);
- g_vars->scene02_boxDelay = 500 * g_fp->_rnd->getRandomNumber(32767) + 1000;
+ g_fp->_floaters->genFlies(g_fp->_currentScene, g_fp->_rnd.getRandomNumber(700) + 100, -50, 0, 0);
+ g_vars->scene02_boxDelay = 500 * g_fp->_rnd.getRandomNumber(32767) + 1000;
}
}
diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp
index 228fc77aae..b78d66d54c 100644
--- a/engines/fullpipe/scenes/scene04.cpp
+++ b/engines/fullpipe/scenes/scene04.cpp
@@ -56,7 +56,7 @@ void scene04_speakerCallback(int *phase) {
if (scene04_speakerPhases[g_vars->scene04_speakerPhase + 6 * g_vars->scene04_speakerVariant] < 0) {
g_vars->scene04_speakerPhase = 0;
- g_vars->scene04_speakerVariant = g_fp->_rnd->getRandomNumber(2);
+ g_vars->scene04_speakerVariant = g_fp->_rnd.getRandomNumber(2);
}
} else {
++g_vars->scene04_speakerPhase;
@@ -709,9 +709,9 @@ MessageQueue *sceneHandler04_kozFly6(StaticANIObject *ani) {
mkQueue.ani = ani;
mkQueue.staticsId2 = ST_KZW_SIT;
- mkQueue.x1 = 397 - 4 * g_fp->_rnd->getRandomNumber(1);
+ mkQueue.x1 = 397 - 4 * g_fp->_rnd.getRandomNumber(1);
mkQueue.field_1C = ani->_priority;
- mkQueue.y1 = g_vars->scene04_bottle->_oy - 4 * g_fp->_rnd->getRandomNumber(1) + 109;
+ mkQueue.y1 = g_vars->scene04_bottle->_oy - 4 * g_fp->_rnd.getRandomNumber(1) + 109;
mkQueue.field_10 = 1;
mkQueue.flags = 78;
mkQueue.movementId = MV_KZW_JUMPROTATE;
@@ -1253,7 +1253,7 @@ void sceneHandler04_bigBallWalkIn() {
&& (!ball || !(ball->_flags & 4))
&& g_vars->scene04_ladder->collisionDetection(g_fp->_aniMan) > 3) {
- if (!g_fp->_rnd->getRandomNumber(49)) {
+ if (!g_fp->_rnd.getRandomNumber(49)) {
if (g_vars->scene04_bigBallFromLeft)
chainQueue(QU_BALL_WALKR, 0);
else
diff --git a/engines/fullpipe/scenes/scene05.cpp b/engines/fullpipe/scenes/scene05.cpp
index b8ecdc4934..35fd24eb99 100644
--- a/engines/fullpipe/scenes/scene05.cpp
+++ b/engines/fullpipe/scenes/scene05.cpp
@@ -151,12 +151,12 @@ void sceneHandler05_genFlies() {
if (g_vars->scene05_floatersTicker <= 1000)
return;
- if (g_fp->_rnd->getRandomNumber(1)) {
- int numFlies = g_fp->_rnd->getRandomNumber(3) + 1;
+ if (g_fp->_rnd.getRandomNumber(1)) {
+ int numFlies = g_fp->_rnd.getRandomNumber(3) + 1;
for (int i = 0; i < numFlies; i++) {
- int x = g_fp->_rnd->getRandomNumber(55) + 538;
- int y = g_fp->_rnd->getRandomNumber(60) + i * 30 + 520;
+ int x = g_fp->_rnd.getRandomNumber(55) + 538;
+ int y = g_fp->_rnd.getRandomNumber(60) + i * 30 + 520;
g_fp->_floaters->genFlies(g_fp->_currentScene, x, y, 5, 1);
g_fp->_floaters->_array2.back()->val2 = 585;
diff --git a/engines/fullpipe/scenes/scene06.cpp b/engines/fullpipe/scenes/scene06.cpp
index 4e003c6954..f434848c05 100644
--- a/engines/fullpipe/scenes/scene06.cpp
+++ b/engines/fullpipe/scenes/scene06.cpp
@@ -382,7 +382,7 @@ void sceneHandler06_throwBall() {
}
void sceneHandler06_eggieWalk() {
- if (15 - g_vars->scene06_numBallsGiven >= 4 && !g_fp->_rnd->getRandomNumber(9)) {
+ if (15 - g_vars->scene06_numBallsGiven >= 4 && !g_fp->_rnd.getRandomNumber(9)) {
StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_EGGIE, -1);
if (!ani || !(ani->_flags & 4)) {
diff --git a/engines/fullpipe/scenes/scene12.cpp b/engines/fullpipe/scenes/scene12.cpp
index f63bb9a9fd..23bab31912 100644
--- a/engines/fullpipe/scenes/scene12.cpp
+++ b/engines/fullpipe/scenes/scene12.cpp
@@ -42,15 +42,15 @@ void scene12_initScene(Scene *sc) {
g_vars->scene12_fly = g_fp->getObjectState(sO_Fly_12);
if (g_vars->scene12_fly)
- g_vars->scene12_flyCountdown = g_fp->_rnd->getRandomNumber(600) + 600;
+ g_vars->scene12_flyCountdown = g_fp->_rnd.getRandomNumber(600) + 600;
- g_fp->setObjectState(sO_Fly_12, g_fp->_rnd->getRandomNumber(1));
+ g_fp->setObjectState(sO_Fly_12, g_fp->_rnd.getRandomNumber(1));
}
void sceneHandler12_updateFloaters() {
g_fp->_floaters->genFlies(g_fp->_currentScene, 397, -50, 100, 6);
- g_fp->_floaters->_array2[0]->countdown = g_fp->_rnd->getRandomNumber(6) + 4;
+ g_fp->_floaters->_array2[0]->countdown = g_fp->_rnd.getRandomNumber(6) + 4;
g_fp->_floaters->_array2[0]->val6 = 397;
g_fp->_floaters->_array2[0]->val7 = -50;
}
diff --git a/engines/fullpipe/scenes/scene15.cpp b/engines/fullpipe/scenes/scene15.cpp
index 436a04376d..cb4ae39806 100644
--- a/engines/fullpipe/scenes/scene15.cpp
+++ b/engines/fullpipe/scenes/scene15.cpp
@@ -128,7 +128,7 @@ int sceneHandler15(ExCommand *cmd) {
break;
case MSG_SC15_ASSDRYG:
- if (g_fp->_rnd->getRandomNumber(1))
+ if (g_fp->_rnd.getRandomNumber(1))
g_fp->playSound(SND_15_011, 0);
else
g_fp->playSound(SND_15_006, 0);
diff --git a/engines/fullpipe/scenes/scene17.cpp b/engines/fullpipe/scenes/scene17.cpp
index 3ea35b7024..a830a8f985 100644
--- a/engines/fullpipe/scenes/scene17.cpp
+++ b/engines/fullpipe/scenes/scene17.cpp
@@ -62,9 +62,9 @@ void scene17_restoreState() {
g_vars->scene17_flyState = g_fp->getObjectState(sO_Fly_17);
if (g_vars->scene17_flyState <= 0 ) {
- g_vars->scene17_flyCountdown = g_fp->_rnd->getRandomNumber(600) + 600;
+ g_vars->scene17_flyCountdown = g_fp->_rnd.getRandomNumber(600) + 600;
- g_vars->scene17_flyState = g_fp->_rnd->getRandomNumber(4) + 1;
+ g_vars->scene17_flyState = g_fp->_rnd.getRandomNumber(4) + 1;
}
g_fp->setObjectState(sO_Fly_17, g_vars->scene17_flyState - 1);
@@ -157,7 +157,7 @@ void sceneHandler17_moonshineFill() {
void sceneHandler17_updateFlies() {
g_fp->_floaters->genFlies(g_fp->_currentScene, 239, -50, 20, 4);
- g_fp->_floaters->_array2[0]->countdown = g_fp->_rnd->getRandomNumber(5) + 6;
+ g_fp->_floaters->_array2[0]->countdown = g_fp->_rnd.getRandomNumber(5) + 6;
g_fp->_floaters->_array2[0]->val6 = 239;
g_fp->_floaters->_array2[0]->val7 = -50;
}
diff --git a/engines/fullpipe/scenes/scene18and19.cpp b/engines/fullpipe/scenes/scene18and19.cpp
index eb338ead88..7e26632cee 100644
--- a/engines/fullpipe/scenes/scene18and19.cpp
+++ b/engines/fullpipe/scenes/scene18and19.cpp
@@ -181,7 +181,7 @@ void scene18_setupSwingers(StaticANIObject *ani, Scene *sc) {
else
ani->startAnim(MV_KSL_SWING, 0, -1);
- ani->_movement->setDynamicPhaseIndex(g_fp->_rnd->getRandomNumber(17));
+ ani->_movement->setDynamicPhaseIndex(g_fp->_rnd.getRandomNumber(17));
g_vars->scene18_swingers.push_back(swinger);
}
diff --git a/engines/fullpipe/scenes/scene20.cpp b/engines/fullpipe/scenes/scene20.cpp
index ab3e474070..9085f02325 100644
--- a/engines/fullpipe/scenes/scene20.cpp
+++ b/engines/fullpipe/scenes/scene20.cpp
@@ -84,13 +84,13 @@ void scene20_initScene(Scene *sc) {
g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_20"));
for (int i = 0; i < 3; i++) {
- g_fp->_floaters->genFlies(sc, g_fp->_rnd->getRandomNumber(101) + 70, g_fp->_rnd->getRandomNumber(51) + 175, 100, 0);
- g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val13 = g_fp->_rnd->getRandomNumber(9);
+ g_fp->_floaters->genFlies(sc, g_fp->_rnd.getRandomNumber(101) + 70, g_fp->_rnd.getRandomNumber(51) + 175, 100, 0);
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val13 = g_fp->_rnd.getRandomNumber(9);
}
g_fp->_currentScene = oldsc;
- g_vars->scene20_fliesCountdown = g_fp->_rnd->getRandomNumber(200) + 400;
+ g_vars->scene20_fliesCountdown = g_fp->_rnd.getRandomNumber(200) + 400;
}
void sceneHandler20_updateFlies() {
@@ -101,7 +101,7 @@ void sceneHandler20_updateFlies() {
g_fp->_floaters->_array2[sz - 1]->val2 = 250;
g_fp->_floaters->_array2[sz - 1]->val3 = 200;
} else {
- int idx = g_fp->_rnd->getRandomNumber(sz);
+ int idx = g_fp->_rnd.getRandomNumber(sz);
g_fp->_floaters->_array2[idx]->countdown = 0;
g_fp->_floaters->_array2[idx]->fflags |= 4u;
@@ -112,7 +112,7 @@ void sceneHandler20_updateFlies() {
g_fp->_floaters->_array2[idx]->ani->_priority = 200;
}
- g_vars->scene20_fliesCountdown = g_fp->_rnd->getRandomNumber(200) + 400;
+ g_vars->scene20_fliesCountdown = g_fp->_rnd.getRandomNumber(200) + 400;
}
int sceneHandler20(ExCommand *cmd) {
diff --git a/engines/fullpipe/scenes/scene25.cpp b/engines/fullpipe/scenes/scene25.cpp
index 8323e3d705..248049f757 100644
--- a/engines/fullpipe/scenes/scene25.cpp
+++ b/engines/fullpipe/scenes/scene25.cpp
@@ -229,29 +229,29 @@ void sceneHandler25_toLadder() {
}
void sceneHandler25_animateBearders() {
- if (g_fp->_rnd->getRandomNumber(32767) < 218) {
+ if (g_fp->_rnd.getRandomNumber(32767) < 218) {
MessageQueue *mq;
mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED), 0, 1);
mq->setParamInt(-1, g_vars->scene25_bearders[0]->_odelay);
- mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
+ mq->getExCommandByIndex(0)->_x = g_fp->_rnd.getRandomNumber(650) + 100;
mq->chain(0);
g_vars->scene25_beardersCounter = 0;
- if (g_fp->_rnd->getRandomNumber(32767) < 0x1FFF) {
+ if (g_fp->_rnd.getRandomNumber(32767) < 0x1FFF) {
mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED2), 0, 1);
mq->setParamInt(-1, g_vars->scene25_bearders[1]->_odelay);
- mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
+ mq->getExCommandByIndex(0)->_x = g_fp->_rnd.getRandomNumber(650) + 100;
mq->chain(0);
- if (g_fp->_rnd->getRandomNumber(32767) < 8191) {
+ if (g_fp->_rnd.getRandomNumber(32767) < 8191) {
mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED3), 0, 1);
mq->setParamInt(-1, g_vars->scene25_bearders[2]->_odelay);
- mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
+ mq->getExCommandByIndex(0)->_x = g_fp->_rnd.getRandomNumber(650) + 100;
mq->chain(0);
}
}
@@ -259,7 +259,7 @@ void sceneHandler25_animateBearders() {
}
void sceneHandler25_sneeze() {
- if (g_fp->_rnd->getRandomNumber(32767) % 10) {
+ if (g_fp->_rnd.getRandomNumber(32767) % 10) {
if (g_fp->_aniMan->_statics->_staticsId == ST_MAN25_ONBOARD) {
g_fp->_aniMan->startAnim(MV_MAN25_ONBOARD, 0, -1);
} else if (g_fp->_aniMan->_statics->_staticsId == (ST_MAN25_ONBOARD|0x4000)) {
@@ -570,7 +570,7 @@ int sceneHandler25(ExCommand *cmd) {
break;
case MSG_BRD_TURN:
- switch (g_fp->_rnd->getRandomNumber(3)) {
+ switch (g_fp->_rnd.getRandomNumber(3)) {
case 0:
g_fp->playSound(SND_25_025, 0);
break;
diff --git a/engines/fullpipe/scenes/scene27.cpp b/engines/fullpipe/scenes/scene27.cpp
index aaf7fab852..7a9a25d563 100644
--- a/engines/fullpipe/scenes/scene27.cpp
+++ b/engines/fullpipe/scenes/scene27.cpp
@@ -335,7 +335,7 @@ void sceneHandler27_knockBats(int bat1n, int bat2n) {
debugC(2, kDebugSceneLogic, "scene27: knockBats(%d, %d)", bat1n, bat2n);
if (bat1->power != 0.0) {
- double rndF = (double)g_fp->_rnd->getRandomNumber(32767) * 0.03 / 32767.0 - 0.015
+ double rndF = (double)g_fp->_rnd.getRandomNumber(32767) * 0.03 / 32767.0 - 0.015
+ atan2(bat2->currY - bat1->currY, bat2->currX - bat1->currX);
double pow1x = cos(bat1->angle - rndF) * ((bat2->currX - bat1->currX) >= 0 ? bat1->power : -bat1->power);
@@ -349,7 +349,7 @@ void sceneHandler27_knockBats(int bat1n, int bat2n) {
debugC(3, kDebugSceneLogic, "scene27: knockBats: bat1 to: powerCos: %f powerSin: %f", bat1->powerCos, bat1->powerSin);
- double rndF2 = (double)g_fp->_rnd->getRandomNumber(32767) * 0.03 / 32767.0 - 0.015
+ double rndF2 = (double)g_fp->_rnd.getRandomNumber(32767) * 0.03 / 32767.0 - 0.015
+ atan2(bat1->currY - bat2->currY, bat1->currX - bat2->currX);
double pow2x = cos(bat2->angle - rndF2) * ((bat1->currX - bat2->currX) >= 0 ? bat2->power : -bat2->power);
double pow2y = sin(bat2->angle - rndF2) * ((bat1->currY - bat2->currY) >= 0 ? bat2->power : -bat2->power);
diff --git a/engines/fullpipe/scenes/scene28.cpp b/engines/fullpipe/scenes/scene28.cpp
index 275c78802f..7cf683ac97 100644
--- a/engines/fullpipe/scenes/scene28.cpp
+++ b/engines/fullpipe/scenes/scene28.cpp
@@ -86,7 +86,7 @@ void sceneHandler28_makeFaces(ExCommand *cmd) {
for (int i = 0; i < 5; i++) {
int pos;
- while (frames[pos = g_fp->_rnd->getRandomNumber(4)] == 0)
+ while (frames[pos = g_fp->_rnd.getRandomNumber(4)] == 0)
;
mq->getExCommandByIndex(i)->_messageNum = frames[pos];
@@ -173,12 +173,12 @@ void sceneHandler28_turnOn2() {
g_fp->_floaters->genFlies(g_fp->_currentScene, 1013, 329, 60, 4);
g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val13 = 30;
- g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = g_fp->_rnd->getRandomNumber(12) + 12;
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = g_fp->_rnd.getRandomNumber(12) + 12;
g_fp->_floaters->genFlies(g_fp->_currentScene, 1074, 311, 60, 4);
g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val13 = 30;
- g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = g_fp->_rnd->getRandomNumber(12) + 12;
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = g_fp->_rnd.getRandomNumber(12) + 12;
}
g_vars->scene28_fliesArePresent = false;
diff --git a/engines/fullpipe/scenes/scene29.cpp b/engines/fullpipe/scenes/scene29.cpp
index 862b6916d9..62af4385ff 100644
--- a/engines/fullpipe/scenes/scene29.cpp
+++ b/engines/fullpipe/scenes/scene29.cpp
@@ -569,7 +569,7 @@ void sceneHandler29_manRideBack() {
void sceneHandler29_shoot() {
if (g_vars->scene29_arcadeIsOn && g_vars->scene29_manX < 1310) {
- if (g_fp->_rnd->getRandomNumber(32767) <= 16383|| g_vars->scene29_shooter1->_movement || g_vars->scene29_shooter1->_statics->_staticsId != ST_STR1_RIGHT) {
+ if (g_fp->_rnd.getRandomNumber(32767) <= 16383|| g_vars->scene29_shooter1->_movement || g_vars->scene29_shooter1->_statics->_staticsId != ST_STR1_RIGHT) {
if (!g_vars->scene29_shooter2->_movement && g_vars->scene29_shooter2->_statics->_staticsId == ST_STR2_RIGHT) {
if (g_vars->scene29_shooter2->_flags & 4) {
g_vars->scene29_shooter2->startAnim(MV_STR2_SHOOT, 0, -1);
@@ -637,7 +637,7 @@ void sceneHandler29_animBearded() {
if (g_vars->scene29_arcadeIsOn && g_vars->scene29_bearders[i]->wbcounter > 30) {
int newx;
- if (g_fp->_rnd->getRandomNumber(1))
+ if (g_fp->_rnd.getRandomNumber(1))
goto dostuff;
if (g_vars->scene29_manX <= 700) {
diff --git a/engines/fullpipe/scenes/scene34.cpp b/engines/fullpipe/scenes/scene34.cpp
index 69f3cd5293..040d023bb9 100644
--- a/engines/fullpipe/scenes/scene34.cpp
+++ b/engines/fullpipe/scenes/scene34.cpp
@@ -87,7 +87,7 @@ void scene34_initScene(Scene *sc) {
g_vars->scene34_dudeClimbed = false;
g_vars->scene34_dudeOnBoard = false;
g_vars->scene34_dudeOnCactus = false;
- g_vars->scene34_fliesCountdown = g_fp->_rnd->getRandomNumber(500) + 500;
+ g_vars->scene34_fliesCountdown = g_fp->_rnd.getRandomNumber(500) + 500;
g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_34"));
@@ -164,7 +164,7 @@ void sceneHandler34_genFlies() {
g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val6 = 1072;
g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val7 = -50;
- g_vars->scene34_fliesCountdown = g_fp->_rnd->getRandomNumber(500) + 500;
+ g_vars->scene34_fliesCountdown = g_fp->_rnd.getRandomNumber(500) + 500;
}
void sceneHandler34_fromCactus(ExCommand *cmd) {
diff --git a/engines/fullpipe/scenes/scene35.cpp b/engines/fullpipe/scenes/scene35.cpp
index e8b08b2614..ed2ab46caa 100644
--- a/engines/fullpipe/scenes/scene35.cpp
+++ b/engines/fullpipe/scenes/scene35.cpp
@@ -123,10 +123,10 @@ void sceneHandler35_genFlies() {
StaticANIObject *fly = g_fp->_currentScene->getStaticANIObject1ById(ANI_FLY, -1);
int xoff = 0;
- if ((!fly || !(fly->_flags & 4)) && !(g_fp->_rnd->getRandomNumber(32767) % 30)) {
+ if ((!fly || !(fly->_flags & 4)) && !(g_fp->_rnd.getRandomNumber(32767) % 30)) {
int x, y;
- if (g_fp->_rnd->getRandomNumber(1)) {
+ if (g_fp->_rnd.getRandomNumber(1)) {
x = 600;
y = 0;
} else {
@@ -134,10 +134,10 @@ void sceneHandler35_genFlies() {
y = 600;
}
- int numFlies = g_fp->_rnd->getRandomNumber(3) + 1;
+ int numFlies = g_fp->_rnd.getRandomNumber(3) + 1;
while (numFlies--) {
- g_fp->_floaters->genFlies(g_fp->_currentScene, g_fp->_rnd->getRandomNumber(55) + 1057, g_fp->_rnd->getRandomNumber(60) + x + xoff, 4, 1);
+ g_fp->_floaters->genFlies(g_fp->_currentScene, g_fp->_rnd.getRandomNumber(55) + 1057, g_fp->_rnd.getRandomNumber(60) + x + xoff, 4, 1);
xoff += 40;
diff --git a/engines/fullpipe/scenes/scene38.cpp b/engines/fullpipe/scenes/scene38.cpp
index 2bdae1ce66..3bcbabe452 100644
--- a/engines/fullpipe/scenes/scene38.cpp
+++ b/engines/fullpipe/scenes/scene38.cpp
@@ -101,7 +101,7 @@ void sceneHandler38_propose() {
if (!g_vars->scene38_tally->_movement) {
if (g_vars->scene38_tally->_flags & 4) {
if (!(g_vars->scene38_tally->_flags & 2) && g_vars->scene38_tallyCounter > 0
- && g_fp->_rnd->getRandomNumber(32767) < 32767) {
+ && g_fp->_rnd.getRandomNumber(32767) < 32767) {
chainQueue(QU_DLD_DENY, 0);
g_vars->scene38_tallyCounter = 0;
}
@@ -112,7 +112,7 @@ void sceneHandler38_propose() {
void sceneHandler38_point() {
if ((!g_vars->scene38_boss->_movement && ((g_vars->scene38_boss->_flags & 4) || !(g_vars->scene38_boss->_flags & 2)))
&& g_vars->scene38_bossCounter > 0
- && g_fp->_rnd->getRandomNumber(32767) < 32767) {
+ && g_fp->_rnd.getRandomNumber(32767) < 32767) {
if (g_vars->scene38_boss->_statics->_staticsId == ST_GLV_HAMMER) {
chainQueue(QU_GLV_TOSMALL, 0);
g_vars->scene38_bossCounter = 0;
@@ -130,7 +130,7 @@ void sceneHandler38_hammerKick() {
if (g_vars->scene38_shorty->_flags & 4) {
if (!(g_vars->scene38_shorty->_flags & 2) && g_vars->scene38_shortyCounter > 1
&& g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_LEFT2
- && g_fp->_rnd->getRandomNumber(32767) < 3276) {
+ && g_fp->_rnd.getRandomNumber(32767) < 3276) {
chainQueue(QU_MLS_TURNR, 0);
g_vars->scene38_shortyCounter = 0;
}
@@ -150,7 +150,7 @@ void sceneHandler38_drink() {
if (g_vars->scene38_shorty->_flags & 4) {
if (!(g_vars->scene38_shorty->_flags & 2) && g_vars->scene38_shortyCounter > 0
&& g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_LEFT2
- && g_fp->_rnd->getRandomNumber(32767) < 3276) {
+ && g_fp->_rnd.getRandomNumber(32767) < 3276) {
chainQueue(QU_MLS_TURNR, 0);
g_vars->scene38_shortyCounter = 0;
}
@@ -189,9 +189,9 @@ void sceneHandler38_animateAlcoholics() {
} else {
int bossAnim = 0;
- if (g_fp->_rnd->getRandomNumber(32767) >= 1310 || g_vars->scene38_boss->_statics->_staticsId != ST_GLV_HAMMER) {
- if (g_fp->_rnd->getRandomNumber(32767) >= 1310) {
- if (g_fp->_rnd->getRandomNumber(32767) < 1310) {
+ if (g_fp->_rnd.getRandomNumber(32767) >= 1310 || g_vars->scene38_boss->_statics->_staticsId != ST_GLV_HAMMER) {
+ if (g_fp->_rnd.getRandomNumber(32767) >= 1310) {
+ if (g_fp->_rnd.getRandomNumber(32767) < 1310) {
if (bossSt == ST_GLV_HAMMER)
bossAnim = QU_GLV_DRINK;
else if (bossSt == ST_GLV_NOHAMMER)
@@ -237,10 +237,10 @@ void sceneHandler38_animateAlcoholics() {
if (g_vars->scene38_tallyCounter >= 50) {
int tallyAnim = 0;
- if (g_fp->_rnd->getRandomNumber(32767) >= 1310) {
- if (g_fp->_rnd->getRandomNumber(32767) >= 1310) {
- if (g_fp->_rnd->getRandomNumber(32767) >= 1310) {
- if (g_fp->_rnd->getRandomNumber(32767) < 1310)
+ if (g_fp->_rnd.getRandomNumber(32767) >= 1310) {
+ if (g_fp->_rnd.getRandomNumber(32767) >= 1310) {
+ if (g_fp->_rnd.getRandomNumber(32767) >= 1310) {
+ if (g_fp->_rnd.getRandomNumber(32767) < 1310)
tallyAnim = QU_DLD_ICK;
} else {
tallyAnim = QU_DLD_GLOT;
@@ -285,9 +285,9 @@ void sceneHandler38_animateAlcoholics() {
int shortyAnim = 0;
- if (g_fp->_rnd->getRandomNumber(32767) >= 1310) {
- if (g_fp->_rnd->getRandomNumber(32767) >= 1310 || g_vars->scene38_shorty->_statics->_staticsId != ST_MLS_LEFT2) {
- if (g_vars->scene38_boss->_statics->_staticsId != ST_GLV_SLEEP2 && g_vars->scene38_bossCounter > 30 && g_fp->_rnd->getRandomNumber(32767) < 0x3FFF && g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_LEFT2)
+ if (g_fp->_rnd.getRandomNumber(32767) >= 1310) {
+ if (g_fp->_rnd.getRandomNumber(32767) >= 1310 || g_vars->scene38_shorty->_statics->_staticsId != ST_MLS_LEFT2) {
+ if (g_vars->scene38_boss->_statics->_staticsId != ST_GLV_SLEEP2 && g_vars->scene38_bossCounter > 30 && g_fp->_rnd.getRandomNumber(32767) < 0x3FFF && g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_LEFT2)
shortyAnim = QU_MLS_HAND;
} else {
shortyAnim = QU_MLS_BLINK;