Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit e821315

Browse files
authored
Merge pull request #183 from cortex-command-community/random-fix
Fix random calls
2 parents 2c788f2 + 1cebf13 commit e821315

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

Entities/MOSRotating.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ void MOSRotating::GibThis(Vector impactImpulse, float internalBlast, MovableObje
977977
gibVel.SetXY(velMin + RandomNum(0.0F, velRange), 0);
978978
else
979979
gibVel.SetMagnitude(velMin + RandomNum(0.0F, velRange));
980-
gibVel.RadRotate(impactImpulse.GetAbsRadAngle() + RandomNum(0.0F, spread));
980+
gibVel.RadRotate(impactImpulse.GetAbsRadAngle() + spread * RandomNormalNum());
981981
// Don't! the offset was already rotated!
982982
// gibVel = RotateOffset(gibVel);
983983
// Distribute any impact implse out over all the gibs

Entities/PEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ namespace RTE {
473473
pParticle->SetPos(m_Pos + RotateOffset(m_EmissionOffset));
474474
// TODO: Optimize making the random angles!")
475475
emitVel.SetXY(velMin + RandomNum(0.0F, velRange), 0);
476-
emitVel.RadRotate(m_EmitAngle.GetRadAngle() + RandomNum(0.0F, spread));
476+
emitVel.RadRotate(m_EmitAngle.GetRadAngle() + spread * RandomNormalNum());
477477
emitVel = RotateOffset(emitVel);
478478
pParticle->SetVel(parentVel + emitVel);
479479

Managers/SceneMan.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,13 +1258,15 @@ bool SceneMan::TryPenetrate(const int posX,
12581258
new Atom(Vector(), spawnMat, 0, spawnColor, 2),
12591259
0);
12601260
*/
1261-
float tempMax = velocity.m_X * sprayScale;
1262-
float tempMin = tempMax / 2.0F;
1261+
float tempMaxX = velocity.m_X * sprayScale;
1262+
float tempMinX = tempMaxX / 2.0F;
1263+
float tempMaxY = velocity.m_Y * sprayScale;
1264+
float tempMinY = tempMaxY / 2.0F;
12631265
MOPixel *pixelMO = new MOPixel(spawnColor,
12641266
spawnMat->GetPixelDensity(),
12651267
Vector(posX, posY),
1266-
Vector(-RandomNum(tempMin, tempMax),
1267-
-RandomNum(tempMin, tempMax)),
1268+
Vector(-RandomNum(tempMinX, tempMaxX),
1269+
-RandomNum(tempMinY, tempMaxY)),
12681270
// -(impulse * (sprayScale * RandomNum() / spawnMat.density)),
12691271
new Atom(Vector(), spawnMat->GetIndex(), 0, spawnColor, 2),
12701272
0);

0 commit comments

Comments
 (0)