mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-09-22 11:31:57 -04:00
Use SDL_rand/SDL_randf (#203)
This commit is contained in:
parent
341d06f997
commit
364844d6d0
@ -453,7 +453,7 @@ MxS32 Act2Actor::VTable0xa0()
|
||||
assert(!m_grec);
|
||||
|
||||
CurrentWorld();
|
||||
MxU16 randomVal = rand() / (RAND_MAX / 2) + 1;
|
||||
MxU16 randomVal = 1 + SDL_rand(2);
|
||||
|
||||
if (m_unk0x48 == 8 && m_unk0x1d != 8) {
|
||||
newLocation = 8;
|
||||
|
@ -413,7 +413,7 @@ MxResult Act3Cop::FUN_10040360()
|
||||
}
|
||||
|
||||
if (grec == NULL) {
|
||||
MxS32 random = rand() % (MxS32) sizeOfArray(g_copDest);
|
||||
MxS32 random = SDL_rand(sizeOfArray(g_copDest));
|
||||
Vector3 localf8(g_copDest[random].m_unk0x08);
|
||||
Vector3 local108(g_copDest[random].m_unk0x14);
|
||||
|
||||
|
@ -477,7 +477,7 @@ void Ambulance::ActivateSceneActions()
|
||||
else if (m_unk0x16c != 0 && m_unk0x16e != 0) {
|
||||
IsleScript::Script objectId;
|
||||
|
||||
switch (rand() % 2) {
|
||||
switch (SDL_rand(2)) {
|
||||
case 0:
|
||||
objectId = IsleScript::c_ham076cl_PlayWav;
|
||||
break;
|
||||
@ -495,7 +495,7 @@ void Ambulance::ActivateSceneActions()
|
||||
else {
|
||||
IsleScript::Script objectId;
|
||||
|
||||
switch (rand() % 2) {
|
||||
switch (SDL_rand(2)) {
|
||||
case 0:
|
||||
objectId = IsleScript::c_ham075cl_PlayWav;
|
||||
break;
|
||||
@ -522,7 +522,7 @@ MxResult Ambulance::Tickle()
|
||||
else if (m_lastAction == IsleScript::c_noneIsle) {
|
||||
IsleScript::Script objectId;
|
||||
|
||||
switch ((rand() % 12) + 1) {
|
||||
switch (1 + SDL_rand(12)) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_ham034ra_PlayWav;
|
||||
break;
|
||||
|
@ -215,17 +215,16 @@ RadioState::RadioState()
|
||||
{
|
||||
srand(Timer()->GetTime());
|
||||
|
||||
MxS32 random = rand();
|
||||
m_unk0x2c = random % 3;
|
||||
m_unk0x2c = SDL_rand(3);
|
||||
|
||||
m_unk0x08[0] = Playlist((MxU32*) g_unk0x100f3218, sizeOfArray(g_unk0x100f3218), Playlist::e_loop);
|
||||
m_unk0x08[0].m_nextIndex = (rand() % sizeOfArray(g_unk0x100f3218));
|
||||
m_unk0x08[0].m_nextIndex = SDL_rand(sizeOfArray(g_unk0x100f3218));
|
||||
|
||||
m_unk0x08[1] = Playlist((MxU32*) g_unk0x100f3230, sizeOfArray(g_unk0x100f3230), Playlist::e_loop);
|
||||
m_unk0x08[1].m_nextIndex = (rand() % sizeOfArray(g_unk0x100f3230));
|
||||
m_unk0x08[1].m_nextIndex = SDL_rand(sizeOfArray(g_unk0x100f3230));
|
||||
|
||||
m_unk0x08[2] = Playlist((MxU32*) g_unk0x100f3268, sizeOfArray(g_unk0x100f3268), Playlist::e_loop);
|
||||
m_unk0x08[2].m_nextIndex = (rand() % sizeOfArray(g_unk0x100f3268));
|
||||
m_unk0x08[2].m_nextIndex = SDL_rand(sizeOfArray(g_unk0x100f3268));
|
||||
|
||||
m_active = FALSE;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ MxLong TowTrack::HandleEndAction(MxEndActionNotificationParam& p_param)
|
||||
m_actorId = LegoActor::c_laura;
|
||||
}
|
||||
|
||||
switch ((rand() % ((m_actorId != 4 ? 4 : 3))) + 1) {
|
||||
switch (1 + SDL_rand(m_actorId != 4 ? 4 : 3)) {
|
||||
case 1:
|
||||
PlayFinalAnimation(IsleScript::c_wrt074sl_RunAnim);
|
||||
break;
|
||||
@ -353,7 +353,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
objectId = IsleScript::c_wns034na_PlayWav;
|
||||
break;
|
||||
case c_mama:
|
||||
switch ((rand() % 2) + 1) {
|
||||
switch (1 + SDL_rand(2)) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_wns037na_PlayWav;
|
||||
break;
|
||||
@ -363,7 +363,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
}
|
||||
break;
|
||||
case c_papa:
|
||||
switch ((rand() % 2) + 1) {
|
||||
switch (1 + SDL_rand(2)) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_wns041na_PlayWav;
|
||||
break;
|
||||
@ -373,7 +373,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
}
|
||||
break;
|
||||
case c_nick:
|
||||
switch ((rand() % 2) + 1) {
|
||||
switch (1 + SDL_rand(2)) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_wns039na_PlayWav;
|
||||
break;
|
||||
@ -383,7 +383,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
}
|
||||
break;
|
||||
case c_laura:
|
||||
switch ((rand() % 2) + 1) {
|
||||
switch (1 + SDL_rand(2)) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_wns043na_PlayWav;
|
||||
break;
|
||||
|
@ -1502,7 +1502,7 @@ void LegoCarBuild::FUN_10025720(undefined4 p_param)
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
switch (rand() % 3) {
|
||||
switch (SDL_rand(3)) {
|
||||
case 0:
|
||||
m_unk0x10a = CopterScript::c_ips004d2_RunAnim;
|
||||
StopActionIn0x344();
|
||||
|
@ -28,8 +28,7 @@
|
||||
#include "realtime/realtime.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
#include <SDL3/SDL_filesystem.h>
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <stdio.h>
|
||||
#include <vec.h>
|
||||
|
||||
@ -1201,7 +1200,7 @@ void LegoAnimationManager::CameraTriggerFire(LegoPathActor* p_actor, MxBool, MxU
|
||||
return;
|
||||
}
|
||||
|
||||
if (location->m_unk0x5c && location->m_frequency < rand() % 100) {
|
||||
if (location->m_unk0x5c && location->m_frequency < SDL_rand(100)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1562,7 +1561,7 @@ MxResult LegoAnimationManager::Tickle()
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
m_unk0x410 = (rand() * 10000 / RAND_MAX) + 5000;
|
||||
m_unk0x410 = SDL_rand(10000) + 5000;
|
||||
m_unk0x408 = time;
|
||||
|
||||
if (time - m_unk0x404 > 10000) {
|
||||
@ -1900,7 +1899,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
|
||||
}
|
||||
|
||||
if (i != m_numAllowedExtras) {
|
||||
MxU8 und = rand() % 2 != 0 ? 1 : 2;
|
||||
MxU8 und = SDL_rand(2) != 0 ? 1 : 2;
|
||||
MxBool bool1, bool2;
|
||||
|
||||
switch (g_unk0x100f7504 % 4) {
|
||||
@ -1957,7 +1956,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
|
||||
active = TRUE;
|
||||
}
|
||||
else {
|
||||
active = rand() % 100 < 50;
|
||||
active = SDL_rand(100) < 50;
|
||||
}
|
||||
|
||||
tryNextCharacter:
|
||||
@ -2002,7 +2001,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
|
||||
MxS32 vehicleId = g_characters[m_lastExtraCharacterId].m_vehicleId;
|
||||
if (vehicleId >= 0) {
|
||||
g_vehicles[vehicleId].m_unk0x04 =
|
||||
rand() % 100 < g_characters[m_lastExtraCharacterId].m_unk0x15;
|
||||
SDL_rand(100) < g_characters[m_lastExtraCharacterId].m_unk0x15;
|
||||
}
|
||||
|
||||
if (FUN_10063b90(
|
||||
@ -2020,10 +2019,10 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
|
||||
|
||||
float speed;
|
||||
if (m_extras[i].m_unk0x14) {
|
||||
speed = ((float) (rand() * 1.5) / RAND_MAX) + 0.9;
|
||||
speed = 0.9f + 1.5f * SDL_randf();
|
||||
}
|
||||
else {
|
||||
speed = ((float) (rand() * 1.4) / RAND_MAX) + 0.6;
|
||||
speed = 0.6f + 1.4f * SDL_randf();
|
||||
}
|
||||
|
||||
actor->SetWorldSpeed(speed);
|
||||
@ -2159,7 +2158,7 @@ MxBool LegoAnimationManager::FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_p
|
||||
if (!local24) {
|
||||
MxU8 unk0x0c;
|
||||
|
||||
switch (rand() % 3) {
|
||||
switch (SDL_rand(3)) {
|
||||
case 0:
|
||||
unk0x0c = 1;
|
||||
break;
|
||||
@ -2426,10 +2425,10 @@ void LegoAnimationManager::FUN_10063d10()
|
||||
|
||||
if (speed < 0.0f) {
|
||||
if (m_extras[i].m_unk0x14) {
|
||||
speed = ((float) (rand() * 1.5) / RAND_MAX) + 0.9;
|
||||
speed = 0.9f + 1.5f * SDL_randf();
|
||||
}
|
||||
else {
|
||||
speed = ((float) (rand() * 1.4) / RAND_MAX) + 0.6;
|
||||
speed = 0.6f + 1.4f * SDL_randf();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2513,7 +2512,7 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoOrie
|
||||
MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool p_bool1, MxBool p_bool2)
|
||||
{
|
||||
MxU32 local2c = 12;
|
||||
float destScale = ((rand() * 0.5) / RAND_MAX) + 0.25;
|
||||
float destScale = 0.25f + 0.5f * SDL_randf();
|
||||
LegoPathActor* actor = UserActor();
|
||||
|
||||
if (actor == NULL) {
|
||||
@ -2668,7 +2667,7 @@ MxResult LegoAnimationManager::FUN_10064380(
|
||||
}
|
||||
|
||||
if (actor != NULL) {
|
||||
MxU8 unk0x0c = rand() % 2 != 0 ? 1 : 2;
|
||||
MxU8 unk0x0c = SDL_rand(2) != 0 ? 1 : 2;
|
||||
actor->SetUnknown0x0c(unk0x0c);
|
||||
actor->SetWorldSpeed(0.0f);
|
||||
|
||||
@ -2724,7 +2723,7 @@ MxResult LegoAnimationManager::FUN_10064670(Vector3* p_position)
|
||||
}
|
||||
|
||||
if (success) {
|
||||
return FUN_10064380("brickstr", "EDG02_95", 1, 0.5f, 3, 0.5f, rand() % 3 + 14, -1, rand() % 3, -1, 0.5f);
|
||||
return FUN_10064380("brickstr", "EDG02_95", 1, 0.5f, 3, 0.5f, SDL_rand(3) + 14, -1, SDL_rand(3), -1, 0.5f);
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
@ -2749,11 +2748,11 @@ MxResult LegoAnimationManager::FUN_10064740(Vector3* p_position)
|
||||
|
||||
if (success) {
|
||||
if (GameState()->GetActorId() != LegoActor::c_mama) {
|
||||
FUN_10064380("mama", "USR00_47", 1, 0.43f, 3, 0.84f, rand() % 3 + 13, -1, rand() % 3, -1, 0.7f);
|
||||
FUN_10064380("mama", "USR00_47", 1, 0.43f, 3, 0.84f, SDL_rand(3) + 13, -1, SDL_rand(3), -1, 0.7f);
|
||||
}
|
||||
|
||||
if (GameState()->GetActorId() != LegoActor::c_papa) {
|
||||
FUN_10064380("papa", "USR00_193", 3, 0.55f, 1, 0.4f, rand() % 3 + 13, -1, rand() % 3, -1, 0.9f);
|
||||
FUN_10064380("papa", "USR00_193", 3, 0.55f, 1, 0.4f, SDL_rand(3) + 13, -1, SDL_rand(3), -1, 0.9f);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
@ -30,7 +30,7 @@ MxU32 LegoState::Playlist::Next()
|
||||
break;
|
||||
|
||||
case e_random:
|
||||
m_nextIndex = rand() % m_length;
|
||||
m_nextIndex = SDL_rand(m_length);
|
||||
objectId = m_objectIds[m_nextIndex];
|
||||
break;
|
||||
|
||||
|
@ -191,7 +191,7 @@ void MxTransitionManager::DissolveTransition()
|
||||
|
||||
// ...then shuffle the list (to ensure that we hit each column once)
|
||||
for (i = 0; i < 640; i++) {
|
||||
MxS32 swap = rand() % 640;
|
||||
MxS32 swap = SDL_rand(640);
|
||||
MxU16 t = m_columnOrder[i];
|
||||
m_columnOrder[i] = m_columnOrder[swap];
|
||||
m_columnOrder[swap] = t;
|
||||
@ -199,7 +199,7 @@ void MxTransitionManager::DissolveTransition()
|
||||
|
||||
// For each scanline, pick a random X offset
|
||||
for (i = 0; i < 480; i++) {
|
||||
m_randomShift[i] = rand() % 640;
|
||||
m_randomShift[i] = SDL_rand(640);
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ void MxTransitionManager::MosaicTransition()
|
||||
}
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
MxS32 swap = rand() % 64;
|
||||
MxS32 swap = SDL_rand(64);
|
||||
MxU16 t = m_columnOrder[i];
|
||||
m_columnOrder[i] = m_columnOrder[swap];
|
||||
m_columnOrder[swap] = t;
|
||||
@ -284,7 +284,7 @@ void MxTransitionManager::MosaicTransition()
|
||||
|
||||
// The same is true here. We only need 48 rows.
|
||||
for (i = 0; i < 48; i++) {
|
||||
m_randomShift[i] = rand() % 64;
|
||||
m_randomShift[i] = SDL_rand(64);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ void LegoExtraActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2)
|
||||
break;
|
||||
default:
|
||||
p_und1 = TRUE;
|
||||
p_und2 = rand() % p_und2 + 1;
|
||||
p_und2 = 1 + SDL_rand(p_und2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "mxutilities.h"
|
||||
#include "mxvariabletable.h"
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <mxdebug.h>
|
||||
#include <vec.h>
|
||||
|
||||
@ -723,7 +724,7 @@ void LegoPathActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2)
|
||||
case c_nick:
|
||||
case c_brickster:
|
||||
p_und1 = TRUE;
|
||||
p_und2 = rand() % p_und2 + 1;
|
||||
p_und2 = SDL_rand(p_und2) + 1;
|
||||
break;
|
||||
case c_laura:
|
||||
p_und1 = FALSE;
|
||||
|
@ -128,7 +128,7 @@ void CarRace::ReadyWorld()
|
||||
AnimationManager()->Resume();
|
||||
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
||||
|
||||
m_unk0x144 = g_unk0x100d5d10[rand() & 7];
|
||||
m_unk0x144 = g_unk0x100d5d10[SDL_rand(8)];
|
||||
|
||||
AnimationManager()
|
||||
->FUN_10060dc0(m_unk0x144, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, TRUE, FALSE, TRUE);
|
||||
@ -221,24 +221,24 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
|
||||
if (m_unk0xfc < m_unk0xf8 && m_unk0x100 < m_unk0xf8) {
|
||||
position = 3;
|
||||
m_unk0x148 = g_unk0x100d5d40[rand() % 3];
|
||||
m_unk0x14c = g_unk0x100d5d60[rand() % 3];
|
||||
m_unk0x148 = g_unk0x100d5d40[SDL_rand(3)];
|
||||
m_unk0x14c = g_unk0x100d5d60[SDL_rand(3)];
|
||||
}
|
||||
else if (m_unk0xfc < m_unk0xf8 || m_unk0x100 < m_unk0xf8) {
|
||||
position = 2;
|
||||
if (m_unk0xfc == g_unk0x100f0c7c) {
|
||||
m_unk0x148 = g_unk0x100d5d30[rand() % 4];
|
||||
m_unk0x14c = g_unk0x100d5d60[rand() % 3];
|
||||
m_unk0x148 = g_unk0x100d5d30[SDL_rand(4)];
|
||||
m_unk0x14c = g_unk0x100d5d60[SDL_rand(3)];
|
||||
}
|
||||
else {
|
||||
m_unk0x148 = g_unk0x100d5d50[rand() % 3];
|
||||
m_unk0x14c = g_unk0x100d5d40[rand() % 3];
|
||||
m_unk0x148 = g_unk0x100d5d50[SDL_rand(3)];
|
||||
m_unk0x14c = g_unk0x100d5d40[SDL_rand(3)];
|
||||
}
|
||||
}
|
||||
else {
|
||||
position = 1;
|
||||
m_unk0x148 = g_unk0x100d5d30[rand() % 4];
|
||||
m_unk0x14c = g_unk0x100d5d50[rand() % 3];
|
||||
m_unk0x148 = g_unk0x100d5d30[SDL_rand(4)];
|
||||
m_unk0x14c = g_unk0x100d5d50[SDL_rand(3)];
|
||||
}
|
||||
|
||||
InputManager()->DisableInputProcessing();
|
||||
|
@ -218,10 +218,10 @@ void LegoRaceCar::InitSoundIndices()
|
||||
{
|
||||
// Note the (likely unintentional) order of operations: `%` is executed before `/`,
|
||||
// so the division is performed at runtime.
|
||||
g_playerHitStudsSoundsIndex = rand() % sizeof(g_playerHitStudsSounds) / sizeof(g_playerHitStudsSounds[0]);
|
||||
g_studsHitPlayerSoundsIndex = rand() % sizeof(g_studsHitPlayerSounds) / sizeof(g_studsHitPlayerSounds[0]);
|
||||
g_playerHitRhodaSoundsIndex = rand() % sizeof(g_playerHitRhodaSounds) / sizeof(g_playerHitRhodaSounds[0]);
|
||||
g_rhodaHitPlayerSoundsIndex = rand() % sizeof(g_rhodaHitPlayerSounds) / sizeof(g_rhodaHitPlayerSounds[0]);
|
||||
g_playerHitStudsSoundsIndex = SDL_rand(sizeOfArray(g_playerHitStudsSounds));
|
||||
g_studsHitPlayerSoundsIndex = SDL_rand(sizeOfArray(g_studsHitPlayerSounds));
|
||||
g_playerHitRhodaSoundsIndex = SDL_rand(sizeOfArray(g_playerHitRhodaSounds));
|
||||
g_rhodaHitPlayerSoundsIndex = SDL_rand(sizeOfArray(g_rhodaHitPlayerSounds));
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10012e60
|
||||
@ -573,8 +573,8 @@ MxResult LegoRaceCar::VTable0x9c()
|
||||
void LegoJetski::InitSoundIndices()
|
||||
{
|
||||
// See note in LegoRaceCar::InitSoundIndices
|
||||
g_hitSnapSoundsIndex = rand() % sizeof(g_hitSnapSounds) / sizeof(g_hitSnapSounds[0]);
|
||||
g_hitValerieSoundsIndex = rand() % sizeof(g_hitValerieSounds) / sizeof(g_hitValerieSounds[0]);
|
||||
g_hitSnapSoundsIndex = SDL_rand(sizeOfArray(g_hitSnapSounds));
|
||||
g_hitValerieSoundsIndex = SDL_rand(sizeOfArray(g_hitValerieSounds));
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100136a0
|
||||
|
@ -670,7 +670,7 @@ void Act3::ReadyWorld()
|
||||
AnimationManager()->FUN_1005f6d0(FALSE);
|
||||
VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 125.0f);
|
||||
|
||||
m_unk0x426c = g_unk0x100d95e8[rand() % 3];
|
||||
m_unk0x426c = g_unk0x100d95e8[SDL_rand(3)];
|
||||
AnimationManager()
|
||||
->FUN_10060dc0(m_unk0x426c, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, TRUE, FALSE, FALSE, FALSE);
|
||||
|
||||
|
@ -374,7 +374,7 @@ MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||
break;
|
||||
case IsleScript::c_Observe_Plane_Ctl:
|
||||
if (!m_act1state->m_planeActive) {
|
||||
switch (rand() % 3) {
|
||||
switch (SDL_rand(3)) {
|
||||
case 0:
|
||||
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_nic002pr_RunAnim, NULL);
|
||||
break;
|
||||
@ -562,7 +562,7 @@ void Isle::Enable(MxBool p_enable)
|
||||
MxS32 locations[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||
|
||||
for (MxU32 i = 0; i < 5; i++) {
|
||||
MxS32 r = rand() % 5;
|
||||
MxS32 r = SDL_rand(5);
|
||||
|
||||
for (MxU32 j = 0; j < sizeOfArray(locations); j++) {
|
||||
if (locations[j] != 0 && r-- == 0) {
|
||||
|
@ -173,7 +173,7 @@ MxResult LegoAct2::Tickle()
|
||||
case 1:
|
||||
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
|
||||
|
||||
switch (rand() % 3) {
|
||||
switch (SDL_rand(3)) {
|
||||
case 0:
|
||||
g_unk0x100f4474 = Act2mainScript::c_tns002br_RunAnim;
|
||||
break;
|
||||
@ -816,7 +816,7 @@ void LegoAct2::SpawnBricks()
|
||||
// Unused but present in BETA
|
||||
LegoEntity* entity;
|
||||
|
||||
if ((MxS16) (rand() % 2) == 1) {
|
||||
if (SDL_rand(2) == 1) {
|
||||
m_firstBrick = 0;
|
||||
location = infobridge;
|
||||
MxTrace("infobridge\n");
|
||||
@ -840,7 +840,7 @@ void LegoAct2::SpawnBricks()
|
||||
roi = brick->GetROI();
|
||||
local2world = roi->GetLocal2World();
|
||||
|
||||
if ((MxS16) (rand() % 2) == 1) {
|
||||
if (SDL_rand(2) == 1) {
|
||||
m_secondBrick = 2;
|
||||
location = store;
|
||||
MxTrace("store\n");
|
||||
@ -864,7 +864,7 @@ void LegoAct2::SpawnBricks()
|
||||
roi = brick->GetROI();
|
||||
local2world = roi->GetLocal2World();
|
||||
|
||||
if ((MxS16) (rand() % 2) == 1) {
|
||||
if (SDL_rand(2) == 1) {
|
||||
m_thirdBrick = 4;
|
||||
location = h3;
|
||||
MxTrace("h3\n");
|
||||
@ -888,8 +888,8 @@ void LegoAct2::SpawnBricks()
|
||||
roi = brick->GetROI();
|
||||
local2world = roi->GetLocal2World();
|
||||
|
||||
if ((MxS16) (rand() % 2) == 1) {
|
||||
if ((MxS16) (rand() % 2) == 1) {
|
||||
if (SDL_rand(2) == 1) {
|
||||
if (SDL_rand(2) == 1) {
|
||||
m_fourthBrick = 6;
|
||||
location = posta;
|
||||
MxTrace("po.sta.\n");
|
||||
@ -901,7 +901,7 @@ void LegoAct2::SpawnBricks()
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((MxS16) (rand() % 2) == 1) {
|
||||
if (SDL_rand(2) == 1) {
|
||||
m_fourthBrick = 8;
|
||||
location = jail;
|
||||
MxTrace("jail\n");
|
||||
@ -946,7 +946,7 @@ MxResult LegoAct2::BadEnding()
|
||||
// FUNCTION: BETA10 0x10013fd3
|
||||
void LegoAct2::FUN_10051fa0(MxS32 p_param1)
|
||||
{
|
||||
MxU8 randN = rand() / (RAND_MAX / 3);
|
||||
MxU8 randN = SDL_rand(3);
|
||||
randN++;
|
||||
|
||||
switch (p_param1) {
|
||||
|
@ -198,7 +198,7 @@ MxBool Police::Escape()
|
||||
PoliceState::PoliceState()
|
||||
{
|
||||
m_unk0x0c = 0;
|
||||
m_policeScript = (rand() % 2 == 0) ? PoliceScript::c_nps002la_RunAnim : PoliceScript::c_nps001ni_RunAnim;
|
||||
m_policeScript = (SDL_rand(2) == 0) ? PoliceScript::c_nps002la_RunAnim : PoliceScript::c_nps001ni_RunAnim;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005e990
|
||||
|
@ -114,7 +114,7 @@ void MxDSSelectAction::Deserialize(MxU8*& p_source, MxS16 p_flags)
|
||||
MxS16 value = atoi(&m_unk0x9c.GetData()[strlen("RANDOM_")]);
|
||||
|
||||
srand(Timer()->GetTime());
|
||||
MxS32 random = rand() % value;
|
||||
MxS32 random = SDL_rand(value);
|
||||
string = SDL_itoa((MxS16) random, buffer, 10);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user