From 0770c0022c27818fe1532f2c53d7275c34d1f0d8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 21 Dec 2018 12:32:36 +0100 Subject: [PATCH] - cleaned up use of the random function in script files. Many uses of random() & value have been turned into random(0, value). This is not only more efficient, it also ensures better random distribution because the parameter-less variant only returns values between 0 and 255. --- wadsrc/static/zscript/actor.txt | 2 +- wadsrc/static/zscript/actor_attacks.txt | 2 +- wadsrc/static/zscript/actor_interaction.txt | 4 ++-- wadsrc/static/zscript/doom/doomweapons.txt | 2 +- wadsrc/static/zscript/doom/scriptedmarine.txt | 2 +- wadsrc/static/zscript/doom/weaponbfg.txt | 4 ++-- wadsrc/static/zscript/doom/weaponplasma.txt | 2 +- wadsrc/static/zscript/heretic/chicken.txt | 6 ++--- wadsrc/static/zscript/heretic/hereticmisc.txt | 2 +- wadsrc/static/zscript/heretic/ironlich.txt | 2 +- .../static/zscript/heretic/weaponblaster.txt | 4 ++-- .../zscript/heretic/weapongauntlets.txt | 4 ++-- wadsrc/static/zscript/heretic/weaponmace.txt | 6 ++--- .../static/zscript/heretic/weaponskullrod.txt | 4 ++-- wadsrc/static/zscript/heretic/weaponwand.txt | 2 +- wadsrc/static/zscript/hexen/baseweapons.txt | 4 ++-- wadsrc/static/zscript/hexen/bats.txt | 4 ++-- wadsrc/static/zscript/hexen/bishop.txt | 4 ++-- wadsrc/static/zscript/hexen/clericflame.txt | 4 ++-- wadsrc/static/zscript/hexen/clericholy.txt | 16 +++++++------- wadsrc/static/zscript/hexen/clericmace.txt | 2 +- wadsrc/static/zscript/hexen/clericstaff.txt | 2 +- wadsrc/static/zscript/hexen/fighteraxe.txt | 4 ++-- wadsrc/static/zscript/hexen/fighterfist.txt | 2 +- wadsrc/static/zscript/hexen/fighterhammer.txt | 2 +- .../static/zscript/hexen/fighterquietus.txt | 2 +- wadsrc/static/zscript/hexen/flechette.txt | 10 ++++----- wadsrc/static/zscript/hexen/fog.txt | 4 ++-- wadsrc/static/zscript/hexen/healingradius.txt | 4 ++-- wadsrc/static/zscript/hexen/heresiarch.txt | 12 +++++----- .../static/zscript/hexen/hexenspecialdecs.txt | 22 +++++++++---------- wadsrc/static/zscript/hexen/iceguy.txt | 2 +- wadsrc/static/zscript/hexen/korax.txt | 10 ++++----- wadsrc/static/zscript/hexen/magecone.txt | 2 +- wadsrc/static/zscript/inventory/powerups.txt | 2 +- wadsrc/static/zscript/raven/minotaur.txt | 6 ++--- wadsrc/static/zscript/shared/ice.txt | 8 +++---- wadsrc/static/zscript/strife/entityboss.txt | 2 +- wadsrc/static/zscript/strife/programmer.txt | 2 +- wadsrc/static/zscript/strife/reaver.txt | 4 ++-- wadsrc/static/zscript/strife/spectral.txt | 22 +++++++++---------- wadsrc/static/zscript/strife/stalker.txt | 2 +- .../static/zscript/strife/strifefunctions.txt | 10 ++++----- wadsrc/static/zscript/strife/strifestuff.txt | 2 +- wadsrc/static/zscript/strife/templar.txt | 2 +- .../static/zscript/strife/thingstoblowup.txt | 13 ++++++----- .../static/zscript/strife/weaponassault.txt | 2 +- wadsrc/static/zscript/strife/weapondagger.txt | 2 +- wadsrc/static/zscript/strife/weaponflamer.txt | 2 +- .../static/zscript/strife/weapongrenade.txt | 2 +- 50 files changed, 122 insertions(+), 121 deletions(-) diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 31f855258..a63f51bcd 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -691,7 +691,7 @@ class Actor : Thinker native { return false; } - movecount = random[TryWalk]() & 15; + movecount = random[TryWalk](0, 15); return true; } diff --git a/wadsrc/static/zscript/actor_attacks.txt b/wadsrc/static/zscript/actor_attacks.txt index 16d136df5..0c9c41785 100644 --- a/wadsrc/static/zscript/actor_attacks.txt +++ b/wadsrc/static/zscript/actor_attacks.txt @@ -495,7 +495,7 @@ extend class Actor bo.PlaySpawnSound(self); if (xyvel != 0) bo.Speed = xyvel; - bo.Angle = Angle + (((random[grenade]()&7) - 4) * (360./256.)); + bo.Angle = Angle + (random[grenade](-4, 3) * (360./256.)); let pitch = -self.Pitch; let angle = bo.Angle; diff --git a/wadsrc/static/zscript/actor_interaction.txt b/wadsrc/static/zscript/actor_interaction.txt index 51c48deac..3dd1726d8 100644 --- a/wadsrc/static/zscript/actor_interaction.txt +++ b/wadsrc/static/zscript/actor_interaction.txt @@ -47,7 +47,7 @@ extend class Actor // make fall forwards sometimes if ((damage < 40) && (damage > health) && (pos.Z - origin.pos.Z > 64) - && (random[Kickback]() & 1) + && random[Kickback](0, 1) // [RH] But only if not too fast and not flying && thrust < 10 && !bNoGravity @@ -76,4 +76,4 @@ extend class Actor } -} \ No newline at end of file +} diff --git a/wadsrc/static/zscript/doom/doomweapons.txt b/wadsrc/static/zscript/doom/doomweapons.txt index f3a40c22a..4d3586e05 100644 --- a/wadsrc/static/zscript/doom/doomweapons.txt +++ b/wadsrc/static/zscript/doom/doomweapons.txt @@ -37,7 +37,7 @@ extend class StateProvider State flash = weap.FindState('Flash'); if (flash != null) { - player.SetSafeFlash(weap, flash, random[FireRail]()&1); + player.SetSafeFlash(weap, flash, random[FireRail](0, 1)); } } diff --git a/wadsrc/static/zscript/doom/scriptedmarine.txt b/wadsrc/static/zscript/doom/scriptedmarine.txt index 51277ebd4..8832bd1b9 100644 --- a/wadsrc/static/zscript/doom/scriptedmarine.txt +++ b/wadsrc/static/zscript/doom/scriptedmarine.txt @@ -475,7 +475,7 @@ class ScriptedMarine : Actor double pitch = AimLineAttack (angle, MISSILERANGE); for (int i = 0; i < 20; ++i) { - int damage = 5*(random[SMarineFireSSG]()%3+1); + int damage = 5*(random[SMarineFireSSG](1, 3)); double ang = angle + Random2[SMarineFireSSG]() * (11.25 / 256); LineAttack (ang, MISSILERANGE, pitch + Random2[SMarineFireSSG]() * (7.097 / 256), damage, 'Hitscan', "BulletPuff"); diff --git a/wadsrc/static/zscript/doom/weaponbfg.txt b/wadsrc/static/zscript/doom/weaponbfg.txt index 9da326313..98e1a4096 100644 --- a/wadsrc/static/zscript/doom/weaponbfg.txt +++ b/wadsrc/static/zscript/doom/weaponbfg.txt @@ -120,8 +120,8 @@ extend class StateProvider double SavedPlayerPitch = pitch; for (int i = 0; i < 2; i++) // Spawn two plasma balls in sequence { - angle += ((random[OldBFG]() & 127) - 64) * (90./768); - pitch += ((random[OldBFG]() & 127) - 64) * (90./640); + angle += random[OldBFG](-64, 63) * (90./768); + pitch += random[OldBFG](-64, 63) * (90./640); SpawnPlayerMissile (i == 0? (class)("PlasmaBall1") : (class)("PlasmaBall2")); // Restore saved values angle = SavedPlayerAngle; diff --git a/wadsrc/static/zscript/doom/weaponplasma.txt b/wadsrc/static/zscript/doom/weaponplasma.txt index b66092b82..dd711484c 100644 --- a/wadsrc/static/zscript/doom/weaponplasma.txt +++ b/wadsrc/static/zscript/doom/weaponplasma.txt @@ -139,7 +139,7 @@ extend class StateProvider State flash = weap.FindState('Flash'); if (flash != null) { - player.SetSafeFlash(weap, flash, random[FirePlasma]()&1); + player.SetSafeFlash(weap, flash, random[FirePlasma](0, 1)); } } diff --git a/wadsrc/static/zscript/heretic/chicken.txt b/wadsrc/static/zscript/heretic/chicken.txt index 38b76894e..eb9085513 100644 --- a/wadsrc/static/zscript/heretic/chicken.txt +++ b/wadsrc/static/zscript/heretic/chicken.txt @@ -331,7 +331,7 @@ extend class Actor } else { // Death - count = 5 + (random[Feathers]()&3); + count = 5 + (random[Feathers](0, 3)); } for (int i = 0; i < count; i++) { @@ -342,9 +342,9 @@ extend class Actor mo.Vel.X = Random2[Feathers]() / 256.; mo.Vel.Y = Random2[Feathers]() / 256.; mo.Vel.Z = 1. + random[Feathers]() / 128.; - mo.SetState (mo.SpawnState + (random[Feathers]()&7)); + mo.SetState (mo.SpawnState + (random[Feathers](0, 7))); } } } -} \ No newline at end of file +} diff --git a/wadsrc/static/zscript/heretic/hereticmisc.txt b/wadsrc/static/zscript/heretic/hereticmisc.txt index fde9ec582..d05fa0c29 100644 --- a/wadsrc/static/zscript/heretic/hereticmisc.txt +++ b/wadsrc/static/zscript/heretic/hereticmisc.txt @@ -283,7 +283,7 @@ class Volcano : Actor void A_VolcanoSet () { - tics = 105 + (random[VolcanoSet]() & 127); + tics = random[VolcanoSet](105, 232); } //---------------------------------------------------------------------------- diff --git a/wadsrc/static/zscript/heretic/ironlich.txt b/wadsrc/static/zscript/heretic/ironlich.txt index cf64a6aec..052e9119e 100644 --- a/wadsrc/static/zscript/heretic/ironlich.txt +++ b/wadsrc/static/zscript/heretic/ironlich.txt @@ -345,7 +345,7 @@ class Whirlwind : Actor } if ((threshold -= 3) < 0) { - threshold = 58 + (random[WhirlwindSeek]() & 31); + threshold = random[WhirlwindSeek](58, 89); A_PlaySound("ironlich/attack3", CHAN_BODY); } if (tracer && tracer.bShadow) diff --git a/wadsrc/static/zscript/heretic/weaponblaster.txt b/wadsrc/static/zscript/heretic/weaponblaster.txt index 7a5d60981..a3d2c3208 100644 --- a/wadsrc/static/zscript/heretic/weaponblaster.txt +++ b/wadsrc/static/zscript/heretic/weaponblaster.txt @@ -132,7 +132,7 @@ class BlasterFX1 : FastProjectile { if (target is "Ironlich") { // Less damage to Ironlich bosses - damage = random[BlasterFX]() & 1; + damage = random[BlasterFX](0, 1); if (!damage) { return -1; @@ -224,7 +224,7 @@ class Ripper : Actor { if (target is "Ironlich") { // Less damage to Ironlich bosses - damage = random[Ripper]() & 1; + damage = random[Ripper](0, 1); if (!damage) { return -1; diff --git a/wadsrc/static/zscript/heretic/weapongauntlets.txt b/wadsrc/static/zscript/heretic/weapongauntlets.txt index f80fe3b32..cf6487f57 100644 --- a/wadsrc/static/zscript/heretic/weapongauntlets.txt +++ b/wadsrc/static/zscript/heretic/weapongauntlets.txt @@ -67,8 +67,8 @@ class Gauntlets : Weapon if (!weapon.DepleteAmmo (weapon.bAltFire)) return; - player.GetPSprite(PSP_WEAPON).x = ((random[GauntletAtk]() & 3) - 2); - player.GetPSprite(PSP_WEAPON).y = WEAPONTOP + (random[GauntletAtk]() & 3); + player.GetPSprite(PSP_WEAPON).x = ((random[GauntletAtk](0, 3)) - 2); + player.GetPSprite(PSP_WEAPON).y = WEAPONTOP + (random[GauntletAtk](0, 3)); } double ang = angle; if (power) diff --git a/wadsrc/static/zscript/heretic/weaponmace.txt b/wadsrc/static/zscript/heretic/weaponmace.txt index 3ef747e0f..d1e474830 100644 --- a/wadsrc/static/zscript/heretic/weaponmace.txt +++ b/wadsrc/static/zscript/heretic/weaponmace.txt @@ -74,9 +74,9 @@ class Mace : HereticWeapon } else { - player.GetPSprite(PSP_WEAPON).x = ((random[MaceAtk]() & 3) - 2); - player.GetPSprite(PSP_WEAPON).y = WEAPONTOP + (random[MaceAtk]() & 3); - Actor ball = SpawnPlayerMissile("MaceFX1", angle + (((random[MaceAtk]() & 7) - 4) * (360. / 256))); + player.GetPSprite(PSP_WEAPON).x = random[MaceAtk](-2, 1); + player.GetPSprite(PSP_WEAPON).y = WEAPONTOP + random[MaceAtk](0, 3); + Actor ball = SpawnPlayerMissile("MaceFX1", angle + (random[MaceAtk](-4, 3) * (360. / 256))); if (ball) { ball.special1 = 16; // tics till dropoff diff --git a/wadsrc/static/zscript/heretic/weaponskullrod.txt b/wadsrc/static/zscript/heretic/weaponskullrod.txt index c0ad6e561..449d694e4 100644 --- a/wadsrc/static/zscript/heretic/weaponskullrod.txt +++ b/wadsrc/static/zscript/heretic/weaponskullrod.txt @@ -327,8 +327,8 @@ class HornRodFX2 : Actor { // Fudge rain frequency return; } - double xo = ((Random[SkullRodStorm]() & 127) - 64); - double yo = ((Random[SkullRodStorm]() & 127) - 64); + double xo = Random[SkullRodStorm](-64, 63); + double yo = Random[SkullRodStorm](-64, 63); Vector3 spawnpos = Vec2OffsetZ(xo, yo, pos.z); Actor mo = Spawn("RainPillar", spawnpos, ALLOW_REPLACE); if (!mo) return; diff --git a/wadsrc/static/zscript/heretic/weaponwand.txt b/wadsrc/static/zscript/heretic/weaponwand.txt index aa08f5c66..8bc4458a6 100644 --- a/wadsrc/static/zscript/heretic/weaponwand.txt +++ b/wadsrc/static/zscript/heretic/weaponwand.txt @@ -59,7 +59,7 @@ class GoldWand : HereticWeapon return; } double pitch = BulletSlope(); - int damage = 7 + (random[FireGoldWand]() & 7); + int damage = random[FireGoldWand](7, 14); double ang = angle; if (player.refire) { diff --git a/wadsrc/static/zscript/hexen/baseweapons.txt b/wadsrc/static/zscript/hexen/baseweapons.txt index e0394996a..9258793cf 100644 --- a/wadsrc/static/zscript/hexen/baseweapons.txt +++ b/wadsrc/static/zscript/hexen/baseweapons.txt @@ -73,8 +73,8 @@ extend class Actor { piece.Vel = self.Vel + AngleToVector(i * 120., 1); piece.bDropped = true; - j = (j == 0) ? (random[PieceDrop]() & 1) + 1 : 3-j; + j = (j == 0) ? random[PieceDrop](1, 2) : 3-j; } } } -} \ No newline at end of file +} diff --git a/wadsrc/static/zscript/hexen/bats.txt b/wadsrc/static/zscript/hexen/bats.txt index aaefaaeb7..e153865c5 100644 --- a/wadsrc/static/zscript/hexen/bats.txt +++ b/wadsrc/static/zscript/hexen/bats.txt @@ -51,12 +51,12 @@ class BatSpawner : SwitchableDecoration int delta = args[1]; if (delta == 0) delta = 1; - double ang = Angle + (((random[BatSpawn]() % delta) - (delta >> 1)) * (360 / 256.)); + double ang = Angle + ((random[BatSpawn](0, delta-1) - (delta >> 1)) * (360 / 256.)); Actor mo = SpawnMissileAngle ("Bat", ang, 0); if (mo) { - mo.args[0] = random[BatSpawn]() & 63; // floatbob index + mo.args[0] = random[BatSpawn](0, 63); // floatbob index mo.args[4] = args[4]; // turn degrees mo.special2 = args[3] << 3; // Set lifetime mo.target = self; diff --git a/wadsrc/static/zscript/hexen/bishop.txt b/wadsrc/static/zscript/hexen/bishop.txt index 63b0168b5..6e85468e2 100644 --- a/wadsrc/static/zscript/hexen/bishop.txt +++ b/wadsrc/static/zscript/hexen/bishop.txt @@ -96,7 +96,7 @@ class Bishop : Actor targ.TraceBleed (newdam > 0 ? newdam : damage, self); return; } - missilecount = (random[BishopAttack]() & 3) + 5; + missilecount = random[BishopAttack](5, 8); } //============================================================================ @@ -145,7 +145,7 @@ class Bishop : Actor void A_BishopDoBlur() { - missilecount = (random[BishopDoBlur]() & 3) + 3; // Random number of blurs + missilecount = random[BishopDoBlur](3, 6); // Random number of blurs if (random[BishopDoBlur]() < 120) { Thrust(11, Angle + 90); diff --git a/wadsrc/static/zscript/hexen/clericflame.txt b/wadsrc/static/zscript/hexen/clericflame.txt index 660abf538..6590dc525 100644 --- a/wadsrc/static/zscript/hexen/clericflame.txt +++ b/wadsrc/static/zscript/hexen/clericflame.txt @@ -305,7 +305,7 @@ class CFlameMissile : FastProjectile mo.VelFromAngle(CircleFlame.FLAMESPEED); mo.specialf1 = mo.Vel.X; mo.specialf2 = mo.Vel.Y; - mo.tics -= random[FlameMissile]()&3; + mo.tics -= random[FlameMissile](0, 3); } an += 180; mo = Spawn("CircleFlame", BlockingMobj.Vec3Angle(dist, an, 5), ALLOW_REPLACE); @@ -316,7 +316,7 @@ class CFlameMissile : FastProjectile mo.VelFromAngle(-CircleFlame.FLAMESPEED); mo.specialf1 = mo.Vel.X; mo.specialf2 = mo.Vel.Y; - mo.tics -= random[FlameMissile]()&3; + mo.tics -= random[FlameMissile](0, 3); } } SetState (SpawnState); diff --git a/wadsrc/static/zscript/hexen/clericholy.txt b/wadsrc/static/zscript/hexen/clericholy.txt index 3846c75d5..f58194ab9 100644 --- a/wadsrc/static/zscript/hexen/clericholy.txt +++ b/wadsrc/static/zscript/hexen/clericholy.txt @@ -228,17 +228,17 @@ class HolyMissile : Actor { // float bob index case 0: - mo.WeaveIndexZ = random[HolyAtk2]() & 7; // upper-left + mo.WeaveIndexZ = random[HolyAtk2](0, 7); // upper-left break; case 1: - mo.WeaveIndexZ = 32 + (random[HolyAtk2]() & 7); // upper-right + mo.WeaveIndexZ = random[HolyAtk2](32, 39); // upper-right break; case 2: - mo.WeaveIndexXY = 32 + (random[HolyAtk2]() & 7); // lower-left + mo.WeaveIndexXY = random[HolyAtk2](32, 39); // lower-left break; case 3: - mo.WeaveIndexXY = 32 + (random[HolyAtk2]() & 7); - mo.WeaveIndexZ = 32 + (random[HolyAtk2]() & 7); + mo.WeaveIndexXY = random[HolyAtk2](32, 39); + mo.WeaveIndexZ = random[HolyAtk2](32, 39); break; } mo.SetZ(pos.z); @@ -497,7 +497,7 @@ class HolySpirit : Actor Vel.Y /= 4; Vel.Z = 0; SetStateLabel ("Death"); - tics -= random[HolySeeker]()&3; + tics -= random[HolySeeker](0, 3); return; } if (tracer) @@ -509,8 +509,8 @@ class HolySpirit : Actor } } - int xyspeed = (random[HolySeeker]() % 5); - int zspeed = (random[HolySeeker]() % 5); + int xyspeed = random[HolySeeker](0, 4); + int zspeed = random[HolySeeker](0, 4); A_Weave(xyspeed, zspeed, 4., 2.); } diff --git a/wadsrc/static/zscript/hexen/clericmace.txt b/wadsrc/static/zscript/hexen/clericmace.txt index adce6431a..7e202571a 100644 --- a/wadsrc/static/zscript/hexen/clericmace.txt +++ b/wadsrc/static/zscript/hexen/clericmace.txt @@ -60,7 +60,7 @@ class CWeapMace : ClericWeapon return; } - int damage = 25+(random[MaceAtk]()&15); + int damage = random[MaceAtk](25, 40); for (int i = 0; i < 16; i++) { for (int j = 1; j >= -1; j -= 2) diff --git a/wadsrc/static/zscript/hexen/clericstaff.txt b/wadsrc/static/zscript/hexen/clericstaff.txt index aa00cd3c9..a2fe1afbc 100644 --- a/wadsrc/static/zscript/hexen/clericstaff.txt +++ b/wadsrc/static/zscript/hexen/clericstaff.txt @@ -67,7 +67,7 @@ class CWeapStaff : ClericWeapon } Weapon weapon = player.ReadyWeapon; - int damage = 20 + (random[StaffCheck]() & 15); + int damage = random[StaffCheck](20, 35); int max = player.mo.GetMaxHealth(); for (int i = 0; i < 3; i++) { diff --git a/wadsrc/static/zscript/hexen/fighteraxe.txt b/wadsrc/static/zscript/hexen/fighteraxe.txt index a89bd7e5b..8217d87e9 100644 --- a/wadsrc/static/zscript/hexen/fighteraxe.txt +++ b/wadsrc/static/zscript/hexen/fighteraxe.txt @@ -224,8 +224,8 @@ class FWeapAxe : FighterWeapon return; } - int damage = 40+(random[AxeAtk]() & 15); - damage += random[AxeAtk]() & 7; + int damage = random[AxeAtk](40, 55); + damage += random[AxeAtk](0, 7); int power = 0; Weapon weapon = player.ReadyWeapon; class pufftype; diff --git a/wadsrc/static/zscript/hexen/fighterfist.txt b/wadsrc/static/zscript/hexen/fighterfist.txt index dd5f02095..7d0e9b94a 100644 --- a/wadsrc/static/zscript/hexen/fighterfist.txt +++ b/wadsrc/static/zscript/hexen/fighterfist.txt @@ -99,7 +99,7 @@ class FWeapFist : FighterWeapon return; } - int damage = 40 + (random[FighterAtk]() & 15); + int damage = random[FighterAtk](40, 55); for (int i = 0; i < 16; i++) { if (TryPunch(angle + i*(45./16), damage, 2) || diff --git a/wadsrc/static/zscript/hexen/fighterhammer.txt b/wadsrc/static/zscript/hexen/fighterhammer.txt index 82f2040d9..1722c6516 100644 --- a/wadsrc/static/zscript/hexen/fighterhammer.txt +++ b/wadsrc/static/zscript/hexen/fighterhammer.txt @@ -65,7 +65,7 @@ class FWeapHammer : FighterWeapon return; } - int damage = 60+(random[HammerAtk]() & 63); + int damage = random[HammerAtk](60, 123); for (int i = 0; i < 16; i++) { for (int j = 1; j >= -1; j -= 2) diff --git a/wadsrc/static/zscript/hexen/fighterquietus.txt b/wadsrc/static/zscript/hexen/fighterquietus.txt index b935f8e11..a555470f1 100644 --- a/wadsrc/static/zscript/hexen/fighterquietus.txt +++ b/wadsrc/static/zscript/hexen/fighterquietus.txt @@ -208,7 +208,7 @@ class FSwordMissile : Actor void A_FSwordFlames() { - for (int i = 1+(random[FSwordFlame]()&3); i; i--) + for (int i = random[FSwordFlame](1, 4); i; i--) { double xo = (random[FSwordFlame]() - 128) / 16.; double yo = (random[FSwordFlame]() - 128) / 16.; diff --git a/wadsrc/static/zscript/hexen/flechette.txt b/wadsrc/static/zscript/hexen/flechette.txt index bc50080c3..2d01b173c 100644 --- a/wadsrc/static/zscript/hexen/flechette.txt +++ b/wadsrc/static/zscript/hexen/flechette.txt @@ -333,7 +333,7 @@ class ArtiPoisonBag3 : ArtiPoisonBag Actor mo = Spawn("ThrowingBomb", Owner.Pos + (0,0,35. - Owner.Floorclip + (Owner.player? Owner.player.crouchoffset : 0)), ALLOW_REPLACE); if (mo) { - mo.angle = Owner.angle + (((random[PoisonBag]() & 7) - 4) * (360./256.)); + mo.angle = Owner.angle + (random[PoisonBag](-4, 3) * (360./256.)); /* Original flight code from Hexen * mo.momz = 4*F.RACUNIT+((player.lookdir)<<(F.RACBITS-4)); @@ -358,7 +358,7 @@ class ArtiPoisonBag3 : ArtiPoisonBag mo.AddZ(mo.Speed * sin(modpitch)); mo.target = Owner; - mo.tics -= random[PoisonBag]()&3; + mo.tics -= random[PoisonBag](0, 3); mo.CheckMissileSpawn(Owner.radius); return true; } @@ -467,7 +467,7 @@ class PoisonCloud : Actor override void BeginPlay () { Vel.X = MinVel; // missile objects must move to impact other objects - special1 = 24+(random[PoisonCloud]() & 7); + special1 = random[PoisonCloud](24, 31); special2 = 0; } @@ -495,7 +495,7 @@ class PoisonCloud : Actor if (dopoison) { - damage = 15 + (random[PoisonCloud]() & 15); + damage = random[PoisonCloud](15, 30); if (mate) { damage = (int)(damage * level.teamdamage); @@ -506,7 +506,7 @@ class PoisonCloud : Actor damage = victim.ApplyDamageFactor(damagetype, damage); if (damage > 0) { - victim.player.PoisonDamage (self, 15 + (random[PoisonCloud]() & 15), false); // Don't play painsound + victim.player.PoisonDamage (self, random[PoisonCloud](15, 30), false); // Don't play painsound // If successful, play the poison sound. if (victim.player.PoisonPlayer (self, self.target, 50)) diff --git a/wadsrc/static/zscript/hexen/fog.txt b/wadsrc/static/zscript/hexen/fog.txt index 276cf2d73..a73d39d13 100644 --- a/wadsrc/static/zscript/hexen/fog.txt +++ b/wadsrc/static/zscript/hexen/fog.txt @@ -59,10 +59,10 @@ class FogSpawner : Actor { int delta = args[1]; if (delta == 0) delta = 1; - mo.angle = angle + (((random[FogSpawn]() % delta) - (delta >> 1)) * (360 / 256.)); + mo.angle = angle + ((random[FogSpawn](0, delta-1) - (delta >> 1)) * (360 / 256.)); mo.target = self; if (args[0] < 1) args[0] = 1; - mo.args[0] = (random[FogSpawn]() % (args[0]))+1; // Random speed + mo.args[0] = random[FogSpawn](1, args[0]); // Random speed mo.args[3] = args[3]; // Set lifetime mo.args[4] = 1; // Set to moving mo.WeaveIndexZ = random[FogSpawn](0, 63); diff --git a/wadsrc/static/zscript/hexen/healingradius.txt b/wadsrc/static/zscript/hexen/healingradius.txt index 95540bd6c..da6cf7959 100644 --- a/wadsrc/static/zscript/hexen/healingradius.txt +++ b/wadsrc/static/zscript/hexen/healingradius.txt @@ -67,7 +67,7 @@ class ArtiHealingRadius : Inventory case 'Mana': { - int amount = 50 + (random[HealRadius]() % 50); + int amount = random[HealRadius](50, 99); if (mo.GiveAmmo ("Mana1", amount) || mo.GiveAmmo ("Mana2", amount)) @@ -79,7 +79,7 @@ class ArtiHealingRadius : Inventory default: //case NAME_Health: - gotsome = mo.GiveBody (50 + (random[HealRadius]() % 50)); + gotsome = mo.GiveBody (random[HealRadius](50, 99)); break; } if (gotsome) diff --git a/wadsrc/static/zscript/hexen/heresiarch.txt b/wadsrc/static/zscript/hexen/heresiarch.txt index f856e7e7e..79ffc92f5 100644 --- a/wadsrc/static/zscript/hexen/heresiarch.txt +++ b/wadsrc/static/zscript/hexen/heresiarch.txt @@ -245,9 +245,9 @@ class Heresiarch : Actor Actor mo = Spawn("SorcSpark1", pos, ALLOW_REPLACE); if (mo) { - double rangle = Angle + (random[Heresiarch]() % 5) * (4096 / 360.); - mo.Vel.X = (random[Heresiarch]() % speed) * cos(rangle); - mo.Vel.Y = (random[Heresiarch]() % speed) * sin(rangle); + double rangle = Angle + random[Heresiarch](0, 4) * (4096 / 360.); + mo.Vel.X = random[Heresiarch](0, speed - 1) * cos(rangle); + mo.Vel.Y = random[Heresiarch](0, speed - 1) * sin(rangle); mo.Vel.Z = 2; } } @@ -529,9 +529,9 @@ class SorcBall : Actor bNoGravity = false; Gravity = 1. / 8; - Vel.X = ((random[Heresiarch]()%10)-5); - Vel.Y = ((random[Heresiarch]()%10)-5); - Vel.Z = (2+(random[Heresiarch]()%3)); + Vel.X = random[Heresiarch](-5, 4); + Vel.Y = random[Heresiarch](-5, 4); + Vel.Z = random[Heresiarch](2, 4); args[4] = Heresiarch.BOUNCE_TIME_UNIT; // Bounce time unit args[3] = 5; // Bounce time in seconds } diff --git a/wadsrc/static/zscript/hexen/hexenspecialdecs.txt b/wadsrc/static/zscript/hexen/hexenspecialdecs.txt index f300dc526..3cc5ae783 100644 --- a/wadsrc/static/zscript/hexen/hexenspecialdecs.txt +++ b/wadsrc/static/zscript/hexen/hexenspecialdecs.txt @@ -117,15 +117,15 @@ class Pottery1 : Actor Actor mo = null; int i; - for(i = (random[Pottery]()&3)+3; i; i--) + for(i = random[Pottery](3, 6); i; i--) { mo = Spawn ("PotteryBit", Pos, ALLOW_REPLACE); if (mo) { - mo.SetState (mo.SpawnState + (random[Pottery]()%5)); + mo.SetState (mo.SpawnState + random[Pottery](0, 4)); mo.Vel.X = random2[Pottery]() / 64.; mo.Vel.Y = random2[Pottery]() / 64.; - mo.Vel.Z = ((random[Pottery]() & 7) + 5) * 0.75; + mo.Vel.Z = random[Pottery](5, 12) * 0.75; } } mo.A_PlaySound ("PotteryExplode", CHAN_BODY); @@ -227,7 +227,7 @@ class PotteryBit : Actor void A_PotteryChooseBit() { static const statelabel bits[] = { "Pottery1", "Pottery2", "Pottery3", "Pottery4", "Pottery5" }; - LoopState = FindState(bits[random[PotteryBit]() % 5]); // Save the state for jumping back to. + LoopState = FindState(bits[random[PotteryBit](0, 4)]); // Save the state for jumping back to. SetState (LoopState); tics = 256 + (random[PotteryBit]() << 1); } @@ -395,15 +395,15 @@ class ZCorpseSitting : Actor { Actor mo; - for (int i = (random[CorpseExplode]() & 3) + 3; i; i--) + for (int i = random[CorpseExplode](3, 6); i; i--) { mo = Spawn ("CorpseBit", Pos, ALLOW_REPLACE); if (mo) { - mo.SetState (mo.SpawnState + (random[CorpseExplode]() % 3)); + mo.SetState (mo.SpawnState + random[CorpseExplode](0, 2)); mo.Vel.X = random2[CorpseExplode]() / 64.; mo.Vel.Y = random2[CorpseExplode]() / 64.; - mo.Vel.Z = ((random[CorpseExplode]() & 7) + 5) * 0.75; + mo.Vel.Z = random[CorpseExplode](5, 12) * 0.75; } } // Spawn a skull @@ -413,7 +413,7 @@ class ZCorpseSitting : Actor mo.SetState (mo.SpawnState + 3); mo.Vel.X = random2[CorpseExplode]() / 64.; mo.Vel.Y = random2[CorpseExplode]() / 64.; - mo.Vel.Z = ((random[CorpseExplode]() & 7) + 5) * 0.75; + mo.Vel.Z = random[CorpseExplode](5, 12) * 0.75; } A_PlaySound (DeathSound, CHAN_BODY); Destroy (); @@ -449,12 +449,12 @@ class LeafSpawner : Actor { static const class leaves[] = { "Leaf1", "Leaf2" }; - for (int i = (random[LeafSpawn]() & 3) + 1; i; i--) + for (int i = random[LeafSpawn](1, 4); i; i--) { double xo = random2[LeafSpawn]() / 4.; double yo = random2[LeafSpawn]() / 4.; double zo = random[LeafSpawn]() / 4.; - Actor mo = Spawn (leaves[random[LeafSpawn]()&1], Vec3Offset(xo, yo, zo), ALLOW_REPLACE); + Actor mo = Spawn (leaves[random[LeafSpawn](0, 1)], Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) { @@ -769,7 +769,7 @@ class ZSuitOfArmor : Actor mo.SetState (mo.SpawnState + i); mo.Vel.X = random2[SoAExplode]() / 64.; mo.Vel.Y = random2[SoAExplode]() / 64.; - mo.Vel.Z = (random[SoAExplode]() & 7) + 5; + mo.Vel.Z = random[SoAExplode](5, 12); } } // Spawn an item? diff --git a/wadsrc/static/zscript/hexen/iceguy.txt b/wadsrc/static/zscript/hexen/iceguy.txt index 4a293b94e..6d32a6b49 100644 --- a/wadsrc/static/zscript/hexen/iceguy.txt +++ b/wadsrc/static/zscript/hexen/iceguy.txt @@ -62,7 +62,7 @@ class IceGuy : Actor double dist = (random[IceGuyLook]() - 128) * radius / 128.; double an = angle + 90; - Actor mo = Spawn(WispTypes[random[IceGuyLook]() & 1], Vec3Angle(dist, an, 60.), ALLOW_REPLACE); + Actor mo = Spawn(WispTypes[random[IceGuyLook](0, 1)], Vec3Angle(dist, an, 60.), ALLOW_REPLACE); if (mo) { mo.Vel = Vel; diff --git a/wadsrc/static/zscript/hexen/korax.txt b/wadsrc/static/zscript/hexen/korax.txt index 316bba1d2..8c711ad8f 100644 --- a/wadsrc/static/zscript/hexen/korax.txt +++ b/wadsrc/static/zscript/hexen/korax.txt @@ -229,7 +229,7 @@ class Korax : Actor spirit.health = KORAX_SPIRIT_LIFETIME; spirit.tracer = self; // Swarm around korax - spirit.WeaveIndexZ = 32 + (random[Kspiritnit]() & 7); // Float bob index + spirit.WeaveIndexZ = random[Kspiritnit](32, 39); // Float bob index spirit.args[0] = 10; // initial turn value spirit.args[1] = 0; // initial look angle @@ -258,7 +258,7 @@ class Korax : Actor { "WraithMissileFire", "DemonMissileFire", "DemonMissileFire", "FireDemonAttack", "CentaurLeaderAttack", "SerpentLeaderAttack" }; - int type = random[KoraxMissile]() % 6; + int type = random[KoraxMissile](0, 5); A_PlaySound("KoraxAttack", CHAN_VOICE); @@ -370,7 +370,7 @@ class Korax : Actor numcommands = 4; } - ACS_Execute(250 + (random[KoraxCommand]()%numcommands), 0); + ACS_Execute(250 + (random[KoraxCommand](0, numcommands)), 0); } } @@ -471,8 +471,8 @@ class KoraxSpirit : Actor { KSpiritSeeker(args[0], args[0] * 2.); } - int xyspeed = (random[KoraxRoam]() % 5); - int zspeed = (random[KoraxRoam]() % 5); + int xyspeed = random[KoraxRoam](0, 4); + int zspeed = random[KoraxRoam](0, 4); A_Weave(xyspeed, zspeed, 4., 2.); if (random[KoraxRoam]() < 50) diff --git a/wadsrc/static/zscript/hexen/magecone.txt b/wadsrc/static/zscript/hexen/magecone.txt index a26ad256c..c28108908 100644 --- a/wadsrc/static/zscript/hexen/magecone.txt +++ b/wadsrc/static/zscript/hexen/magecone.txt @@ -68,7 +68,7 @@ class MWeapFrost : MageWeapon } A_PlaySound ("MageShardsFire", CHAN_WEAPON); - int damage = 90+(random[MageCone]() & 15); + int damage = random[MageCone](90, 105); for (int i = 0; i < 16; i++) { double ang = angle + i*(45./16); diff --git a/wadsrc/static/zscript/inventory/powerups.txt b/wadsrc/static/zscript/inventory/powerups.txt index c1fdb96f5..ab256380e 100644 --- a/wadsrc/static/zscript/inventory/powerups.txt +++ b/wadsrc/static/zscript/inventory/powerups.txt @@ -911,7 +911,7 @@ class PowerTorch : PowerLightAmp } else { - NewTorch = (random[torch]() & 7) + 1; + NewTorch = random[torch](1, 8); NewTorchDelta = (NewTorch == Owner.player.fixedlightlevel) ? 0 : ((NewTorch > player.fixedlightlevel) ? 1 : -1); } diff --git a/wadsrc/static/zscript/raven/minotaur.txt b/wadsrc/static/zscript/raven/minotaur.txt index d53c754c0..35deebdae 100644 --- a/wadsrc/static/zscript/raven/minotaur.txt +++ b/wadsrc/static/zscript/raven/minotaur.txt @@ -409,13 +409,13 @@ class Minotaur : Actor if (random[MinotaurRoam]() < 6) { //Choose new direction - movedir = random[MinotaurRoam]() % 8; + movedir = random[MinotaurRoam](0, 7); FaceMovementDirection (); } if (!MonsterMove()) { // Turn - if (random[MinotaurRoam]() & 1) + if (random[MinotaurRoam](0, 1)) movedir = (movedir + 1) % 8; else movedir = (movedir + 7) % 8; @@ -812,4 +812,4 @@ extend class Actor break; } } -} \ No newline at end of file +} diff --git a/wadsrc/static/zscript/shared/ice.txt b/wadsrc/static/zscript/shared/ice.txt index d26131eb0..e4f8affe8 100644 --- a/wadsrc/static/zscript/shared/ice.txt +++ b/wadsrc/static/zscript/shared/ice.txt @@ -24,7 +24,7 @@ class IceChunk : Actor void A_IceSetTics () { - tics = 70 + (random[IceTics]() & 63); + tics = random[IceTics](70, 133); Name dtype = GetFloorTerrain().DamageMOD; if (dtype == 'Fire') { @@ -134,7 +134,7 @@ extend class Actor // things break up into more shards than smaller things. // An actor with radius 20 and height 64 creates ~40 chunks. int numChunks = max(4, int(radius * Height)/32); - int i = Random[FreezeDeathChunks]() % (numChunks/4); + int i = Random[FreezeDeathChunks](0, numChunks/4 - 1); for (i = max(24, numChunks + i); i >= 0; i--) { double xo = (random[FreezeDeathChunks]() - 128)*radius / 128; @@ -144,7 +144,7 @@ extend class Actor Actor mo = Spawn("IceChunk", Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) { - mo.SetState (mo.SpawnState + (random[FreezeDeathChunks]()%3)); + mo.SetState (mo.SpawnState + random[FreezeDeathChunks](0, 2)); mo.Vel.X = random2[FreezeDeathChunks]() / 128.; mo.Vel.Y = random2[FreezeDeathChunks]() / 128.; mo.Vel.Z = (mo.pos.Z - pos.Z) / Height * 4; @@ -193,4 +193,4 @@ extend class Actor } -} \ No newline at end of file +} diff --git a/wadsrc/static/zscript/strife/entityboss.txt b/wadsrc/static/zscript/strife/entityboss.txt index ff26280c3..6905b36fc 100644 --- a/wadsrc/static/zscript/strife/entityboss.txt +++ b/wadsrc/static/zscript/strife/entityboss.txt @@ -160,7 +160,7 @@ class EntityBoss : SpectralMonster { // Apparent Strife bug: Case 5 was unreachable because they used % 5 instead of % 6. // I've fixed that by making case 1 duplicate it, since case 1 did nothing. - switch (random[Entity]() % 5) + switch (random[Entity](0, 4)) { case 0: A_SpotLightning(); diff --git a/wadsrc/static/zscript/strife/programmer.txt b/wadsrc/static/zscript/strife/programmer.txt index 90cdd5399..a3af76a71 100644 --- a/wadsrc/static/zscript/strife/programmer.txt +++ b/wadsrc/static/zscript/strife/programmer.txt @@ -94,7 +94,7 @@ class Programmer : Actor A_PlaySound("programmer/clank", CHAN_WEAPON); - int damage = ((random[Programmer]() % 10) + 1) * 6; + int damage = random[Programmer](1, 10) * 6; int newdam = target.DamageMobj (self, self, damage, 'Melee'); target.TraceBleed (newdam > 0 ? newdam : damage, self); } diff --git a/wadsrc/static/zscript/strife/reaver.txt b/wadsrc/static/zscript/strife/reaver.txt index 6ebcd47e2..9d127d345 100644 --- a/wadsrc/static/zscript/strife/reaver.txt +++ b/wadsrc/static/zscript/strife/reaver.txt @@ -79,10 +79,10 @@ extend class Actor for (int i = 0; i < 3; ++i) { double ang = bangle + Random2[ReaverAttack]() * (22.5 / 256); - int damage = ((random[ReaverAttack]() & 7) + 1) * 3; + int damage = random[ReaverAttack](1, 8) * 3; LineAttack (ang, MISSILERANGE, pitch, damage, 'Hitscan', "StrifePuff"); } } } -} \ No newline at end of file +} diff --git a/wadsrc/static/zscript/strife/spectral.txt b/wadsrc/static/zscript/strife/spectral.txt index bc7f11f3b..b86c6c55d 100644 --- a/wadsrc/static/zscript/strife/spectral.txt +++ b/wadsrc/static/zscript/strife/spectral.txt @@ -28,13 +28,13 @@ class SpectralMonster : Actor { int t; - t = random[SpectreChunk]() & 15; - foo.Vel.X = (t - (random[SpectreChunk]() & 7)); - - t = random[SpectreChunk]() & 15; - foo.Vel.Y = (t - (random[SpectreChunk]() & 7)); + t = random[SpectreChunk](0, 7); + foo.Vel.X = t - random[SpectreChunk](0, 15); - foo.Vel.Z = (random[SpectreChunk]() & 15); + t = random[SpectreChunk](0, 7); + foo.Vel.Y = t - random[SpectreChunk](0, 15); + + foo.Vel.Z = random[SpectreChunk](0, 15); } } @@ -46,13 +46,13 @@ class SpectralMonster : Actor { int t; - t = random[SpectreChunk]() & 7; - foo.Vel.X = (t - (random[SpectreChunk]() & 15)); + t = random[SpectreChunk](0, 7); + foo.Vel.X = t - random[SpectreChunk](0, 15); - t = random[SpectreChunk]() & 7; - foo.Vel.Y = (t - (random[SpectreChunk]() & 15)); + t = random[SpectreChunk](0, 7); + foo.Vel.Y = t - random[SpectreChunk](0, 15); - foo.Vel.Z = (random[SpectreChunk]() & 7); + foo.Vel.Z = random[SpectreChunk](0, 7); } } diff --git a/wadsrc/static/zscript/strife/stalker.txt b/wadsrc/static/zscript/strife/stalker.txt index f0e69a373..12ab87bc5 100644 --- a/wadsrc/static/zscript/strife/stalker.txt +++ b/wadsrc/static/zscript/strife/stalker.txt @@ -118,7 +118,7 @@ class Stalker : Actor if (CheckMeleeRange ()) { let targ = target; - int damage = (random[Stalker]() & 7) * 2 + 2; + int damage = random[Stalker](1, 8) * 2; int newdam = targ.DamageMobj (self, self, damage, 'Melee'); targ.TraceBleed (newdam > 0 ? newdam : damage, self); diff --git a/wadsrc/static/zscript/strife/strifefunctions.txt b/wadsrc/static/zscript/strife/strifefunctions.txt index df4a3e73f..0757cd16d 100644 --- a/wadsrc/static/zscript/strife/strifefunctions.txt +++ b/wadsrc/static/zscript/strife/strifefunctions.txt @@ -66,9 +66,9 @@ extend class Actor return; } - gib.Angle = random[GibTosser]() * (360 / 256.f); - gib.VelFromAngle(random[GibTosser]() & 15); - gib.Vel.Z = random[GibTosser]() & 15; + gib.Angle = random[GibTosser]() * (360 / 256.); + gib.VelFromAngle(random[GibTosser](0, 15)); + gib.Vel.Z = random[GibTosser](0, 15); } //========================================================================== @@ -83,7 +83,7 @@ extend class Actor A_PlaySound ("monsters/rifle", CHAN_WEAPON); A_FaceTarget (); double pitch = AimLineAttack (angle, MISSILERANGE); - LineAttack (Angle + Random2[ShootGun]() * (11.25 / 256), MISSILERANGE, pitch, 3*(random[ShootGun]() % 5 + 1), 'Hitscan', "StrifePuff"); + LineAttack (Angle + Random2[ShootGun]() * (11.25 / 256), MISSILERANGE, pitch, 3*random[ShootGun](1, 5), 'Hitscan', "StrifePuff"); } //========================================================================== @@ -113,7 +113,7 @@ extend class Actor void A_GetHurt() { bInCombat = true; - if ((random[HurtMe]() % 5) == 0) + if (random[HurtMe](0, 4) == 0) { A_PlaySound (PainSound, CHAN_VOICE); health--; diff --git a/wadsrc/static/zscript/strife/strifestuff.txt b/wadsrc/static/zscript/strife/strifestuff.txt index 33af78e7e..d4af744c2 100644 --- a/wadsrc/static/zscript/strife/strifestuff.txt +++ b/wadsrc/static/zscript/strife/strifestuff.txt @@ -1927,7 +1927,7 @@ class Meat : Actor override void BeginPlay () { // Strife used mod 19, but there are 20 states. Hmm. - SetState (SpawnState + random[GibTosser]() % 20); + SetState (SpawnState + random[GibTosser](0, 19)); } } diff --git a/wadsrc/static/zscript/strife/templar.txt b/wadsrc/static/zscript/strife/templar.txt index 23290011c..3a6822857 100644 --- a/wadsrc/static/zscript/strife/templar.txt +++ b/wadsrc/static/zscript/strife/templar.txt @@ -74,7 +74,7 @@ class Templar : Actor for (int i = 0; i < 10; ++i) { - int damage = (random[Templar]() & 4) * 2; + int damage = random[Templar](1, 4) * 2; double ang = angle + random2[Templar]() * (11.25 / 256); LineAttack (ang, MISSILERANGE+64., pitch + random2[Templar]() * (7.097 / 256), damage, 'Hitscan', "MaulerPuff"); } diff --git a/wadsrc/static/zscript/strife/thingstoblowup.txt b/wadsrc/static/zscript/strife/thingstoblowup.txt index fc4b89f26..8c17f8802 100644 --- a/wadsrc/static/zscript/strife/thingstoblowup.txt +++ b/wadsrc/static/zscript/strife/thingstoblowup.txt @@ -3,8 +3,8 @@ extend class Actor void A_Bang4Cloud() { - double xo = (random[Bang4Cloud]() & 3) * (10. / 64); - double yo = (random[Bang4Cloud]() & 3) * (10. / 64); + double xo = random[Bang4Cloud](0, 3) * (10. / 64); + double yo = random[Bang4Cloud](0, 3) * (10. / 64); Spawn("Bang4Cloud", Vec3Offset(xo, yo, 0.), ALLOW_REPLACE); } @@ -221,10 +221,11 @@ class PowerCrystal : Actor Actor foo = Spawn("Rubble1", Pos, ALLOW_REPLACE); if (foo != NULL) { - int t = random[LightOut]() & 15; - foo.Vel.X = t - (random[LightOut]() & 7); - foo.Vel.Y = random2[LightOut]() & 7; - foo.Vel.Z = 7 + (random[LightOut]() & 3); + int t = random[LightOut](0, 7); + foo.Vel.X = t - random[LightOut](0, 15); + t = random[LightOut](0, 7); + foo.Vel.Y = t - random[LightOut](0, 15); + foo.Vel.Z = random[LightOut](7, 10); } } } diff --git a/wadsrc/static/zscript/strife/weaponassault.txt b/wadsrc/static/zscript/strife/weaponassault.txt index c61951e1a..8d3b8ad2a 100644 --- a/wadsrc/static/zscript/strife/weaponassault.txt +++ b/wadsrc/static/zscript/strife/weaponassault.txt @@ -62,7 +62,7 @@ extend class StateProvider } player.mo.PlayAttacking2 (); - int damage = 4*(random[StrifeGun]() % 3 + 1); + int damage = 4 * random[StrifeGun](1, 3); double ang = angle; if (player.refire) diff --git a/wadsrc/static/zscript/strife/weapondagger.txt b/wadsrc/static/zscript/strife/weapondagger.txt index 2d3ba74f8..2ba14d11c 100644 --- a/wadsrc/static/zscript/strife/weapondagger.txt +++ b/wadsrc/static/zscript/strife/weapondagger.txt @@ -49,7 +49,7 @@ class PunchDagger : StrifeWeapon else { int power = MIN(10, stamina / 10); - damage = (random[JabDagger]() % (power + 8)) * (power + 2); + damage = random[JabDagger](0, power + 7) * (power + 2); if (FindInventory("PowerStrength")) { diff --git a/wadsrc/static/zscript/strife/weaponflamer.txt b/wadsrc/static/zscript/strife/weaponflamer.txt index 1c7a0873a..92be29262 100644 --- a/wadsrc/static/zscript/strife/weaponflamer.txt +++ b/wadsrc/static/zscript/strife/weaponflamer.txt @@ -113,7 +113,7 @@ class FlameMissile : Actor void A_FlameDie () { bNoGravity = true; - Vel.Z = random[FlameDie]() & 3; + Vel.Z = random[FlameDie](0, 3); } } diff --git a/wadsrc/static/zscript/strife/weapongrenade.txt b/wadsrc/static/zscript/strife/weapongrenade.txt index c3f3cf524..dc0958a64 100644 --- a/wadsrc/static/zscript/strife/weapongrenade.txt +++ b/wadsrc/static/zscript/strife/weapongrenade.txt @@ -312,7 +312,7 @@ class PhosphorousFire : Actor drop.Vel.X = Vel.X + random2[PHBurn] (7); drop.Vel.Y = Vel.Y + random2[PHBurn] (7); drop.Vel.Z = Vel.Z - 1; - drop.reactiontime = (random[PHBurn]() & 3) + 2; + drop.reactiontime = random[PHBurn](2, 5); drop.bDropped = true; } }