From 12ce981d646ffa5ad9388143b9109080194f05c2 Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Sat, 2 Jun 2012 12:30:20 +0200 Subject: [PATCH] Convert random() to randk() and crandom() to crandk() --- src/game/g_ai.c | 14 +-- src/game/g_func.c | 4 +- src/game/g_misc.c | 130 ++++++++++++------------- src/game/g_monster.c | 6 +- src/game/g_target.c | 4 +- src/game/g_turret.c | 2 +- src/game/g_weapon.c | 20 ++-- src/game/header/local.h | 3 - src/game/monster/berserker/berserker.c | 4 +- src/game/monster/boss2/boss2.c | 12 +-- src/game/monster/boss3/boss31.c | 22 ++--- src/game/monster/boss3/boss32.c | 16 +-- src/game/monster/brain/brain.c | 8 +- src/game/monster/chick/chick.c | 12 +-- src/game/monster/float/float.c | 6 +- src/game/monster/flyer/flyer.c | 2 +- src/game/monster/gladiator/gladiator.c | 2 +- src/game/monster/gunner/gunner.c | 10 +- src/game/monster/hover/hover.c | 8 +- src/game/monster/infantry/infantry.c | 2 +- src/game/monster/insane/insane.c | 14 +-- src/game/monster/medic/medic.c | 6 +- src/game/monster/mutant/mutant.c | 12 +-- src/game/monster/parasite/parasite.c | 4 +- src/game/monster/soldier/soldier.c | 32 +++--- src/game/monster/supertank/supertank.c | 8 +- src/game/monster/tank/tank.c | 8 +- src/game/player/weapon.c | 22 ++--- 28 files changed, 195 insertions(+), 198 deletions(-) diff --git a/src/game/g_ai.c b/src/game/g_ai.c index 8ff38e58..50a391c1 100644 --- a/src/game/g_ai.c +++ b/src/game/g_ai.c @@ -167,11 +167,11 @@ ai_stand(edict_t *self, float dist) if (self->monsterinfo.idle_time) { self->monsterinfo.idle(self); - self->monsterinfo.idle_time = level.time + 15 + random() * 15; + self->monsterinfo.idle_time = level.time + 15 + randk() * 15; } else { - self->monsterinfo.idle_time = level.time + random() * 15; + self->monsterinfo.idle_time = level.time + randk() * 15; } } } @@ -200,11 +200,11 @@ ai_walk(edict_t *self, float dist) if (self->monsterinfo.idle_time) { self->monsterinfo.search(self); - self->monsterinfo.idle_time = level.time + 15 + random() * 15; + self->monsterinfo.idle_time = level.time + 15 + randk() * 15; } else { - self->monsterinfo.idle_time = level.time + random() * 15; + self->monsterinfo.idle_time = level.time + randk() * 15; } } } @@ -829,16 +829,16 @@ M_CheckAttack(edict_t *self) chance *= 2; } - if (random() < chance) + if (randk() < chance) { self->monsterinfo.attack_state = AS_MISSILE; - self->monsterinfo.attack_finished = level.time + 2 * random(); + self->monsterinfo.attack_finished = level.time + 2 * randk(); return true; } if (self->flags & FL_FLY) { - if (random() < 0.3) + if (randk() < 0.3) { self->monsterinfo.attack_state = AS_SLIDING; } diff --git a/src/game/g_func.c b/src/game/g_func.c index a8e27a2c..8fc8c88f 100644 --- a/src/game/g_func.c +++ b/src/game/g_func.c @@ -2547,7 +2547,7 @@ func_timer_think(edict_t *self) } G_UseTargets(self, self->activator); - self->nextthink = level.time + self->wait + crandom() * self->random; + self->nextthink = level.time + self->wait + crandk() * self->random; } void @@ -2603,7 +2603,7 @@ SP_func_timer(edict_t *self) if (self->spawnflags & 1) { self->nextthink = level.time + 1.0 + st.pausetime + self->delay + - self->wait + crandom() * self->random; + self->wait + crandk() * self->random; self->activator = self; } diff --git a/src/game/g_misc.c b/src/game/g_misc.c index cc13ba37..82ae844b 100644 --- a/src/game/g_misc.c +++ b/src/game/g_misc.c @@ -65,9 +65,9 @@ SP_func_areaportal(edict_t *ent) void VelocityForDamage(int damage, vec3_t v) { - v[0] = 100.0 * crandom(); - v[1] = 100.0 * crandom(); - v[2] = 200.0 + 100.0 * random(); + v[0] = 100.0 * crandk(); + v[1] = 100.0 * crandk(); + v[2] = 200.0 + 100.0 * randk(); if (damage < 50) { @@ -131,7 +131,7 @@ gib_think(edict_t *self) if (self->s.frame == 10) { self->think = G_FreeEdict; - self->nextthink = level.time + 8 + random() * 10; + self->nextthink = level.time + 8 + randk() * 10; } } @@ -213,9 +213,9 @@ ThrowGib(edict_t *self, char *gibname, int damage, int type) VectorScale(self->size, 0.5, size); VectorAdd(self->absmin, size, origin); - gib->s.origin[0] = origin[0] + crandom() * size[0]; - gib->s.origin[1] = origin[1] + crandom() * size[1]; - gib->s.origin[2] = origin[2] + crandom() * size[2]; + gib->s.origin[0] = origin[0] + crandk() * size[0]; + gib->s.origin[1] = origin[1] + crandk() * size[1]; + gib->s.origin[2] = origin[2] + crandk() * size[2]; gi.setmodel(gib, gibname); gib->solid = SOLID_NOT; @@ -239,12 +239,12 @@ ThrowGib(edict_t *self, char *gibname, int damage, int type) VelocityForDamage(damage, vd); VectorMA(self->velocity, vscale, vd, gib->velocity); ClipGibVelocity(gib); - gib->avelocity[0] = random() * 600; - gib->avelocity[1] = random() * 600; - gib->avelocity[2] = random() * 600; + gib->avelocity[0] = randk() * 600; + gib->avelocity[1] = randk() * 600; + gib->avelocity[2] = randk() * 600; gib->think = G_FreeEdict; - gib->nextthink = level.time + 10 + random() * 10; + gib->nextthink = level.time + 10 + randk() * 10; gi.linkentity(gib); } @@ -293,10 +293,10 @@ ThrowHead(edict_t *self, char *gibname, int damage, int type) VectorMA(self->velocity, vscale, vd, self->velocity); ClipGibVelocity(self); - self->avelocity[YAW] = crandom() * 600; + self->avelocity[YAW] = crandk() * 600; self->think = G_FreeEdict; - self->nextthink = level.time + 10 + random() * 10; + self->nextthink = level.time + 10 + randk() * 10; gi.linkentity(self); } @@ -394,17 +394,17 @@ ThrowDebris(edict_t *self, char *modelname, float speed, vec3_t origin) chunk = G_Spawn(); VectorCopy(origin, chunk->s.origin); gi.setmodel(chunk, modelname); - v[0] = 100 * crandom(); - v[1] = 100 * crandom(); - v[2] = 100 + 100 * crandom(); + v[0] = 100 * crandk(); + v[1] = 100 * crandk(); + v[2] = 100 + 100 * crandk(); VectorMA(self->velocity, speed, v, chunk->velocity); chunk->movetype = MOVETYPE_BOUNCE; chunk->solid = SOLID_NOT; - chunk->avelocity[0] = random() * 600; - chunk->avelocity[1] = random() * 600; - chunk->avelocity[2] = random() * 600; + chunk->avelocity[0] = randk() * 600; + chunk->avelocity[1] = randk() * 600; + chunk->avelocity[2] = randk() * 600; chunk->think = G_FreeEdict; - chunk->nextthink = level.time + 5 + random() * 5; + chunk->nextthink = level.time + 5 + randk() * 5; chunk->s.frame = 0; chunk->flags = 0; chunk->classname = "debris"; @@ -1076,9 +1076,9 @@ func_explosive_explode(edict_t *self, edict_t *inflictor, edict_t *attacker, while (count--) { - chunkorigin[0] = origin[0] + crandom() * size[0]; - chunkorigin[1] = origin[1] + crandom() * size[1]; - chunkorigin[2] = origin[2] + crandom() * size[2]; + chunkorigin[0] = origin[0] + crandk() * size[0]; + chunkorigin[1] = origin[1] + crandk() * size[1]; + chunkorigin[2] = origin[2] + crandk() * size[2]; ThrowDebris(self, "models/objects/debris1/tris.md2", 1, chunkorigin); } } @@ -1093,9 +1093,9 @@ func_explosive_explode(edict_t *self, edict_t *inflictor, edict_t *attacker, while (count--) { - chunkorigin[0] = origin[0] + crandom() * size[0]; - chunkorigin[1] = origin[1] + crandom() * size[1]; - chunkorigin[2] = origin[2] + crandom() * size[2]; + chunkorigin[0] = origin[0] + crandk() * size[0]; + chunkorigin[1] = origin[1] + crandk() * size[1]; + chunkorigin[2] = origin[2] + crandk() * size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", 2, chunkorigin); } @@ -1237,13 +1237,13 @@ barrel_explode(edict_t *self) /* a few big chunks */ spd = 1.5 * (float)self->dmg / 200.0; - org[0] = self->s.origin[0] + crandom() * self->size[0]; - org[1] = self->s.origin[1] + crandom() * self->size[1]; - org[2] = self->s.origin[2] + crandom() * self->size[2]; + org[0] = self->s.origin[0] + crandk() * self->size[0]; + org[1] = self->s.origin[1] + crandk() * self->size[1]; + org[2] = self->s.origin[2] + crandk() * self->size[2]; ThrowDebris(self, "models/objects/debris1/tris.md2", spd, org); - org[0] = self->s.origin[0] + crandom() * self->size[0]; - org[1] = self->s.origin[1] + crandom() * self->size[1]; - org[2] = self->s.origin[2] + crandom() * self->size[2]; + org[0] = self->s.origin[0] + crandk() * self->size[0]; + org[1] = self->s.origin[1] + crandk() * self->size[1]; + org[2] = self->s.origin[2] + crandk() * self->size[2]; ThrowDebris(self, "models/objects/debris1/tris.md2", spd, org); /* bottom corners */ @@ -1263,37 +1263,37 @@ barrel_explode(edict_t *self) /* a bunch of little chunks */ spd = 2 * self->dmg / 200; - org[0] = self->s.origin[0] + crandom() * self->size[0]; - org[1] = self->s.origin[1] + crandom() * self->size[1]; - org[2] = self->s.origin[2] + crandom() * self->size[2]; + org[0] = self->s.origin[0] + crandk() * self->size[0]; + org[1] = self->s.origin[1] + crandk() * self->size[1]; + org[2] = self->s.origin[2] + crandk() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self->s.origin[0] + crandom() * self->size[0]; - org[1] = self->s.origin[1] + crandom() * self->size[1]; - org[2] = self->s.origin[2] + crandom() * self->size[2]; + org[0] = self->s.origin[0] + crandk() * self->size[0]; + org[1] = self->s.origin[1] + crandk() * self->size[1]; + org[2] = self->s.origin[2] + crandk() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self->s.origin[0] + crandom() * self->size[0]; - org[1] = self->s.origin[1] + crandom() * self->size[1]; - org[2] = self->s.origin[2] + crandom() * self->size[2]; + org[0] = self->s.origin[0] + crandk() * self->size[0]; + org[1] = self->s.origin[1] + crandk() * self->size[1]; + org[2] = self->s.origin[2] + crandk() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self->s.origin[0] + crandom() * self->size[0]; - org[1] = self->s.origin[1] + crandom() * self->size[1]; - org[2] = self->s.origin[2] + crandom() * self->size[2]; + org[0] = self->s.origin[0] + crandk() * self->size[0]; + org[1] = self->s.origin[1] + crandk() * self->size[1]; + org[2] = self->s.origin[2] + crandk() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self->s.origin[0] + crandom() * self->size[0]; - org[1] = self->s.origin[1] + crandom() * self->size[1]; - org[2] = self->s.origin[2] + crandom() * self->size[2]; + org[0] = self->s.origin[0] + crandk() * self->size[0]; + org[1] = self->s.origin[1] + crandk() * self->size[1]; + org[2] = self->s.origin[2] + crandk() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self->s.origin[0] + crandom() * self->size[0]; - org[1] = self->s.origin[1] + crandom() * self->size[1]; - org[2] = self->s.origin[2] + crandom() * self->size[2]; + org[0] = self->s.origin[0] + crandk() * self->size[0]; + org[1] = self->s.origin[1] + crandk() * self->size[1]; + org[2] = self->s.origin[2] + crandk() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self->s.origin[0] + crandom() * self->size[0]; - org[1] = self->s.origin[1] + crandom() * self->size[1]; - org[2] = self->s.origin[2] + crandom() * self->size[2]; + org[0] = self->s.origin[0] + crandk() * self->size[0]; + org[1] = self->s.origin[1] + crandk() * self->size[1]; + org[2] = self->s.origin[2] + crandk() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self->s.origin[0] + crandom() * self->size[0]; - org[1] = self->s.origin[1] + crandom() * self->size[1]; - org[2] = self->s.origin[2] + crandom() * self->size[2]; + org[0] = self->s.origin[0] + crandk() * self->size[0]; + org[1] = self->s.origin[1] + crandk() * self->size[1]; + org[2] = self->s.origin[2] + crandk() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); VectorCopy(save, self->s.origin); @@ -2134,9 +2134,9 @@ SP_misc_gib_arm(edict_t *ent) ent->movetype = MOVETYPE_TOSS; ent->svflags |= SVF_MONSTER; ent->deadflag = DEAD_DEAD; - ent->avelocity[0] = random() * 200; - ent->avelocity[1] = random() * 200; - ent->avelocity[2] = random() * 200; + ent->avelocity[0] = randk() * 200; + ent->avelocity[1] = randk() * 200; + ent->avelocity[2] = randk() * 200; ent->think = G_FreeEdict; ent->nextthink = level.time + 30; gi.linkentity(ent); @@ -2162,9 +2162,9 @@ SP_misc_gib_leg(edict_t *ent) ent->movetype = MOVETYPE_TOSS; ent->svflags |= SVF_MONSTER; ent->deadflag = DEAD_DEAD; - ent->avelocity[0] = random() * 200; - ent->avelocity[1] = random() * 200; - ent->avelocity[2] = random() * 200; + ent->avelocity[0] = randk() * 200; + ent->avelocity[1] = randk() * 200; + ent->avelocity[2] = randk() * 200; ent->think = G_FreeEdict; ent->nextthink = level.time + 30; gi.linkentity(ent); @@ -2190,9 +2190,9 @@ SP_misc_gib_head(edict_t *ent) ent->movetype = MOVETYPE_TOSS; ent->svflags |= SVF_MONSTER; ent->deadflag = DEAD_DEAD; - ent->avelocity[0] = random() * 200; - ent->avelocity[1] = random() * 200; - ent->avelocity[2] = random() * 200; + ent->avelocity[0] = randk() * 200; + ent->avelocity[1] = randk() * 200; + ent->avelocity[2] = randk() * 200; ent->think = G_FreeEdict; ent->nextthink = level.time + 30; gi.linkentity(ent); diff --git a/src/game/g_monster.c b/src/game/g_monster.c index 5661f4a9..160c0e13 100644 --- a/src/game/g_monster.c +++ b/src/game/g_monster.c @@ -199,13 +199,13 @@ M_FlyCheck(edict_t *self) return; } - if (random() > 0.5) + if (randk() > 0.5) { return; } self->think = M_FliesOn; - self->nextthink = level.time + 5 + 10 * random(); + self->nextthink = level.time + 5 + 10 * randk(); } void @@ -415,7 +415,7 @@ M_WorldEffects(edict_t *ent) { if (ent->watertype & CONTENTS_LAVA) { - if (random() <= 0.5) + if (randk() <= 0.5) { gi.sound(ent, CHAN_BODY, gi.soundindex( "player/lava1.wav"), 1, ATTN_NORM, 0); diff --git a/src/game/g_target.c b/src/game/g_target.c index d481a204..50c27c18 100644 --- a/src/game/g_target.c +++ b/src/game/g_target.c @@ -1174,8 +1174,8 @@ target_earthquake_think(edict_t *self) } e->groundentity = NULL; - e->velocity[0] += crandom() * 150; - e->velocity[1] += crandom() * 150; + e->velocity[0] += crandk() * 150; + e->velocity[1] += crandk() * 150; e->velocity[2] = self->speed * (100.0 / e->mass); } diff --git a/src/game/g_turret.c b/src/game/g_turret.c index 620d2e90..a0abc080 100644 --- a/src/game/g_turret.c +++ b/src/game/g_turret.c @@ -133,7 +133,7 @@ turret_breach_fire(edict_t *self) VectorMA(start, self->move_origin[1], r, start); VectorMA(start, self->move_origin[2], u, start); - damage = 100 + random() * 50; + damage = 100 + randk() * 50; speed = 550 + 50 * skill->value; fire_rocket(self->teammaster->owner, start, f, damage, speed, 150, damage); gi.positioned_sound(start, self, CHAN_WEAPON, diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 35dd61cd..dad7af03 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -47,7 +47,7 @@ check_dodge(edict_t *self, vec3_t start, vec3_t dir, int speed) /* easy mode only ducks one quarter the time */ if (skill->value == 0) { - if (random() > 0.25) + if (randk() > 0.25) { return; } @@ -196,8 +196,8 @@ fire_lead(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, vectoangles(aimdir, dir); AngleVectors(dir, forward, right, up); - r = crandom() * hspread; - u = crandom() * vspread; + r = crandk() * hspread; + u = crandk() * vspread; VectorMA(start, 8192, forward, end); VectorMA(end, r, right, end); VectorMA(end, u, up, end); @@ -260,8 +260,8 @@ fire_lead(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, VectorSubtract(end, start, dir); vectoangles(dir, dir); AngleVectors(dir, forward, right, up); - r = crandom() * hspread * 2; - u = crandom() * vspread * 2; + r = crandk() * hspread * 2; + u = crandk() * vspread * 2; VectorMA(water_start, 8192, forward, end); VectorMA(end, r, right, end); VectorMA(end, u, up, end); @@ -611,7 +611,7 @@ Grenade_Touch(edict_t *ent, edict_t *other, cplane_t *plane /* unused */, csurfa { if (ent->spawnflags & 1) { - if (random() > 0.5) + if (randk() > 0.5) { gi.sound(ent, CHAN_VOICE, gi.soundindex( "weapons/hgrenb1a.wav"), 1, ATTN_NORM, 0); @@ -654,8 +654,8 @@ fire_grenade(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, grenade = G_Spawn(); VectorCopy(start, grenade->s.origin); VectorScale(aimdir, speed, grenade->velocity); - VectorMA(grenade->velocity, 200 + crandom() * 10.0, up, grenade->velocity); - VectorMA(grenade->velocity, crandom() * 10.0, right, grenade->velocity); + VectorMA(grenade->velocity, 200 + crandk() * 10.0, up, grenade->velocity); + VectorMA(grenade->velocity, crandk() * 10.0, right, grenade->velocity); VectorSet(grenade->avelocity, 300, 300, 300); grenade->movetype = MOVETYPE_BOUNCE; grenade->clipmask = MASK_SHOT; @@ -694,8 +694,8 @@ fire_grenade2(edict_t *self, vec3_t start, vec3_t aimdir, int damage, grenade = G_Spawn(); VectorCopy(start, grenade->s.origin); VectorScale(aimdir, speed, grenade->velocity); - VectorMA(grenade->velocity, 200 + crandom() * 10.0, up, grenade->velocity); - VectorMA(grenade->velocity, crandom() * 10.0, right, grenade->velocity); + VectorMA(grenade->velocity, 200 + crandk() * 10.0, up, grenade->velocity); + VectorMA(grenade->velocity, crandk() * 10.0, right, grenade->velocity); VectorSet(grenade->avelocity, 300, 300, 300); grenade->movetype = MOVETYPE_BOUNCE; grenade->clipmask = MASK_SHOT; diff --git a/src/game/header/local.h b/src/game/header/local.h index fb5e83f0..53b5be2b 100644 --- a/src/game/header/local.h +++ b/src/game/header/local.h @@ -487,9 +487,6 @@ extern edict_t *g_edicts; #define LLOFS(x) (size_t)&(((level_locals_t *)NULL)->x) #define CLOFS(x) (size_t)&(((gclient_t *)NULL)->x) -#define random() ((randk() & 0x7fff) / ((float)0x7fff)) -#define crandom() (2.0 * (random() - 0.5)) - extern cvar_t *maxentities; extern cvar_t *deathmatch; extern cvar_t *coop; diff --git a/src/game/monster/berserker/berserker.c b/src/game/monster/berserker/berserker.c index 836dcf2f..ae238c60 100644 --- a/src/game/monster/berserker/berserker.c +++ b/src/game/monster/berserker/berserker.c @@ -128,7 +128,7 @@ berserk_fidget(edict_t *self) return; } - if (random() > 0.15) + if (randk() > 0.15) { return; } @@ -407,7 +407,7 @@ berserk_pain(edict_t *self, edict_t *other /* unused */, return; /* no pain anims in nightmare */ } - if ((damage < 20) || (random() < 0.5)) + if ((damage < 20) || (randk() < 0.5)) { self->monsterinfo.currentmove = &berserk_move_pain1; } diff --git a/src/game/monster/boss2/boss2.c b/src/game/monster/boss2/boss2.c index 20783208..6414fb0a 100644 --- a/src/game/monster/boss2/boss2.c +++ b/src/game/monster/boss2/boss2.c @@ -45,7 +45,7 @@ boss2_search(edict_t *self) return; } - if (random() < 0.5) + if (randk() < 0.5) { gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NONE, 0); } @@ -549,7 +549,7 @@ boss2_attack(edict_t *self) } else { - if (random() <= 0.6) + if (randk() <= 0.6) { self->monsterinfo.currentmove = &boss2_move_attack_pre_mg; } @@ -581,7 +581,7 @@ boss2_reattack_mg(edict_t *self) if (infront(self, self->enemy)) { - if (random() <= 0.7) + if (randk() <= 0.7) { self->monsterinfo.currentmove = &boss2_move_attack_mg; } @@ -759,16 +759,16 @@ Boss2_CheckAttack(edict_t *self) return false; } - if (random() < chance) + if (randk() < chance) { self->monsterinfo.attack_state = AS_MISSILE; - self->monsterinfo.attack_finished = level.time + 2 * random(); + self->monsterinfo.attack_finished = level.time + 2 * randk(); return true; } if (self->flags & FL_FLY) { - if (random() < 0.3) + if (randk() < 0.3) { self->monsterinfo.attack_state = AS_SLIDING; } diff --git a/src/game/monster/boss3/boss31.c b/src/game/monster/boss3/boss31.c index f53103ab..3bd14534 100644 --- a/src/game/monster/boss3/boss31.c +++ b/src/game/monster/boss3/boss31.c @@ -58,7 +58,7 @@ jorg_search(edict_t *self) return; } - r = random(); + r = randk(); if (r <= 0.3) { @@ -524,7 +524,7 @@ jorg_reattack1(edict_t *self) if (visible(self, self->enemy)) { - if (random() < 0.9) + if (randk() < 0.9) { self->monsterinfo.currentmove = &jorg_move_attack1; } @@ -577,7 +577,7 @@ jorg_pain(edict_t *self, edict_t *other /* unused */, pain frames if he takes little damage */ if (damage <= 40) { - if (random() <= 0.6) + if (randk() <= 0.6) { return; } @@ -587,7 +587,7 @@ jorg_pain(edict_t *self, edict_t *other /* unused */, lessen the chance of him going into pain */ if ((self->s.frame >= FRAME_attak101) && (self->s.frame <= FRAME_attak108)) { - if (random() <= 0.005) + if (randk() <= 0.005) { return; } @@ -595,7 +595,7 @@ jorg_pain(edict_t *self, edict_t *other /* unused */, if ((self->s.frame >= FRAME_attak109) && (self->s.frame <= FRAME_attak114)) { - if (random() <= 0.00005) + if (randk() <= 0.00005) { return; } @@ -603,7 +603,7 @@ jorg_pain(edict_t *self, edict_t *other /* unused */, if ((self->s.frame >= FRAME_attak201) && (self->s.frame <= FRAME_attak208)) { - if (random() <= 0.005) + if (randk() <= 0.005) { return; } @@ -628,7 +628,7 @@ jorg_pain(edict_t *self, edict_t *other /* unused */, } else { - if (random() <= 0.3) + if (randk() <= 0.3) { gi.sound(self, CHAN_VOICE, sound_pain3, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &jorg_move_pain3; @@ -731,7 +731,7 @@ jorg_attack(edict_t *self) return; } - if (random() <= 0.75) + if (randk() <= 0.75) { gi.sound(self, CHAN_VOICE, sound_attack1, 1, ATTN_NORM, 0); self->s.sound = gi.soundindex("boss3/w_loop.wav"); @@ -861,16 +861,16 @@ Jorg_CheckAttack(edict_t *self) return false; } - if (random() < chance) + if (randk() < chance) { self->monsterinfo.attack_state = AS_MISSILE; - self->monsterinfo.attack_finished = level.time + 2 * random(); + self->monsterinfo.attack_finished = level.time + 2 * randk(); return true; } if (self->flags & FL_FLY) { - if (random() < 0.3) + if (randk() < 0.3) { self->monsterinfo.attack_state = AS_SLIDING; } diff --git a/src/game/monster/boss3/boss32.c b/src/game/monster/boss3/boss32.c index 24dae207..5297b3c3 100644 --- a/src/game/monster/boss3/boss32.c +++ b/src/game/monster/boss3/boss32.c @@ -62,7 +62,7 @@ makron_taunt(edict_t *self) return; } - r = random(); + r = randk(); if (r <= 0.3) { @@ -741,7 +741,7 @@ makron_pain(edict_t *self, edict_t *other /* unused */, /* Lessen the chance of him going into his pain frames */ if (damage <= 25) { - if (random() < 0.2) + if (randk() < 0.2) { return; } @@ -768,13 +768,13 @@ makron_pain(edict_t *self, edict_t *other /* unused */, { if (damage <= 150) { - if (random() <= 0.45) + if (randk() <= 0.45) { gi.sound(self, CHAN_VOICE, sound_pain6, 1, ATTN_NONE, 0); self->monsterinfo.currentmove = &makron_move_pain6; } else - if (random() <= 0.35) + if (randk() <= 0.35) { gi.sound(self, CHAN_VOICE, sound_pain6, 1, ATTN_NONE, 0); self->monsterinfo.currentmove = &makron_move_pain6; @@ -804,7 +804,7 @@ makron_attack(edict_t *self) return; } - r = random(); + r = randk(); if (r <= 0.3) { @@ -1026,16 +1026,16 @@ Makron_CheckAttack(edict_t *self) return false; } - if (random() < chance) + if (randk() < chance) { self->monsterinfo.attack_state = AS_MISSILE; - self->monsterinfo.attack_finished = level.time + 2 * random(); + self->monsterinfo.attack_finished = level.time + 2 * randk(); return true; } if (self->flags & FL_FLY) { - if (random() < 0.3) + if (randk() < 0.3) { self->monsterinfo.attack_state = AS_SLIDING; } diff --git a/src/game/monster/brain/brain.c b/src/game/monster/brain/brain.c index ee7ab5b5..91393e6d 100644 --- a/src/game/monster/brain/brain.c +++ b/src/game/monster/brain/brain.c @@ -375,7 +375,7 @@ brain_dodge(edict_t *self, edict_t *attacker, float eta) return; } - if (random() > 0.25) + if (randk() > 0.25) { return; } @@ -607,7 +607,7 @@ brain_melee(edict_t *self) return; } - if (random() <= 0.5) + if (randk() <= 0.5) { self->monsterinfo.currentmove = &brain_move_attack1; } @@ -687,7 +687,7 @@ brain_pain(edict_t *self, edict_t *other /* unused */, return; /* no pain anims in nightmare */ } - r = random(); + r = randk(); if (r < 0.33) { @@ -769,7 +769,7 @@ brain_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* u self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; - if (random() <= 0.5) + if (randk() <= 0.5) { self->monsterinfo.currentmove = &brain_move_death1; } diff --git a/src/game/monster/chick/chick.c b/src/game/monster/chick/chick.c index d951ec3a..65c43215 100644 --- a/src/game/monster/chick/chick.c +++ b/src/game/monster/chick/chick.c @@ -59,7 +59,7 @@ ChickMoan(edict_t *self) return; } - if (random() < 0.5) + if (randk() < 0.5) { gi.sound(self, CHAN_VOICE, sound_idle1, 1, ATTN_IDLE, 0); } @@ -123,7 +123,7 @@ chick_fidget(edict_t *self) return; } - if (random() <= 0.3) + if (randk() <= 0.3) { self->monsterinfo.currentmove = &chick_move_fidget; } @@ -367,7 +367,7 @@ chick_pain(edict_t *self, edict_t *other /* unused */, self->pain_debounce_time = level.time + 3; - r = random(); + r = randk(); if (r < 0.33) { @@ -610,7 +610,7 @@ chick_dodge(edict_t *self, edict_t *attacker, float eta /* unused */) return; } - if (random() > 0.25) + if (randk() > 0.25) { return; } @@ -763,7 +763,7 @@ chick_rerocket(edict_t *self) { if (visible(self, self->enemy)) { - if (random() <= 0.6) + if (randk() <= 0.6) { self->monsterinfo.currentmove = &chick_move_attack1; return; @@ -833,7 +833,7 @@ chick_reslash(edict_t *self) { if (range(self, self->enemy) == RANGE_MELEE) { - if (random() <= 0.9) + if (randk() <= 0.9) { self->monsterinfo.currentmove = &chick_move_slash; return; diff --git a/src/game/monster/float/float.c b/src/game/monster/float/float.c index 1cb651a7..c4a0d9bb 100644 --- a/src/game/monster/float/float.c +++ b/src/game/monster/float/float.c @@ -232,7 +232,7 @@ floater_stand(edict_t *self) return; } - if (random() <= 0.5) + if (randk() <= 0.5) { self->monsterinfo.currentmove = &floater_move_stand1; } @@ -689,7 +689,7 @@ floater_melee(edict_t *self) return; } - if (random() < 0.5) + if (randk() < 0.5) { self->monsterinfo.currentmove = &floater_move_attack3; } @@ -822,7 +822,7 @@ SP_monster_floater(edict_t *self) gi.linkentity(self); - if (random() <= 0.5) + if (randk() <= 0.5) { self->monsterinfo.currentmove = &floater_move_stand1; } diff --git a/src/game/monster/flyer/flyer.c b/src/game/monster/flyer/flyer.c index d2637324..b9dac4a1 100644 --- a/src/game/monster/flyer/flyer.c +++ b/src/game/monster/flyer/flyer.c @@ -734,7 +734,7 @@ flyer_check_melee(edict_t *self) if (range(self, self->enemy) == RANGE_MELEE) { - if (random() <= 0.8) + if (randk() <= 0.8) { self->monsterinfo.currentmove = &flyer_move_loop_melee; } diff --git a/src/game/monster/gladiator/gladiator.c b/src/game/monster/gladiator/gladiator.c index 2ba1819f..ecd26fde 100644 --- a/src/game/monster/gladiator/gladiator.c +++ b/src/game/monster/gladiator/gladiator.c @@ -381,7 +381,7 @@ gladiator_pain(edict_t *self, edict_t *other /* unused */, self->pain_debounce_time = level.time + 3; - if (random() < 0.5) + if (randk() < 0.5) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); } diff --git a/src/game/monster/gunner/gunner.c b/src/game/monster/gunner/gunner.c index 3c63e507..ed74f207 100644 --- a/src/game/monster/gunner/gunner.c +++ b/src/game/monster/gunner/gunner.c @@ -153,7 +153,7 @@ gunner_fidget(edict_t *self) return; } - if (random() <= 0.05) + if (randk() <= 0.05) { self->monsterinfo.currentmove = &gunner_move_fidget; } @@ -531,7 +531,7 @@ gunner_duck_down(edict_t *self) if (skill->value >= 2) { - if (random() > 0.5) + if (randk() > 0.5) { GunnerGrenade(self); } @@ -602,7 +602,7 @@ gunner_dodge(edict_t *self, edict_t *attacker, float eta /* unused */) return; } - if (random() > 0.25) + if (randk() > 0.25) { return; } @@ -798,7 +798,7 @@ gunner_attack(edict_t *self) } else { - if (random() <= 0.5) + if (randk() <= 0.5) { self->monsterinfo.currentmove = &gunner_move_attack_grenade; } @@ -832,7 +832,7 @@ gunner_refire_chain(edict_t *self) { if (visible(self, self->enemy)) { - if (random() <= 0.5) + if (randk() <= 0.5) { self->monsterinfo.currentmove = &gunner_move_fire_chain; return; diff --git a/src/game/monster/hover/hover.c b/src/game/monster/hover/hover.c index 0f1097c5..dfd85836 100644 --- a/src/game/monster/hover/hover.c +++ b/src/game/monster/hover/hover.c @@ -52,7 +52,7 @@ void hover_search(edict_t *self) { - if (random() < 0.5) + if (randk() < 0.5) { gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NORM, 0); } @@ -534,7 +534,7 @@ hover_reattack(edict_t *self) { if (visible(self, self->enemy)) { - if (random() <= 0.6) + if (randk() <= 0.6) { self->monsterinfo.currentmove = &hover_move_attack1; return; @@ -669,7 +669,7 @@ hover_pain(edict_t *self, edict_t *other /* unused */, if (damage <= 25) { - if (random() < 0.5) + if (randk() < 0.5) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &hover_move_pain3; @@ -769,7 +769,7 @@ hover_die(edict_t *self, edict_t *inflictor /* unused */, } /* regular death */ - if (random() < 0.5) + if (randk() < 0.5) { gi.sound(self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0); } diff --git a/src/game/monster/infantry/infantry.c b/src/game/monster/infantry/infantry.c index 43bfdac4..b34f5f45 100644 --- a/src/game/monster/infantry/infantry.c +++ b/src/game/monster/infantry/infantry.c @@ -628,7 +628,7 @@ infantry_dodge(edict_t *self, edict_t *attacker, float eta /* unused */) return; } - if (random() > 0.25) + if (randk() > 0.25) { return; } diff --git a/src/game/monster/insane/insane.c b/src/game/monster/insane/insane.c index 3008ec80..99f33ff6 100644 --- a/src/game/monster/insane/insane.c +++ b/src/game/monster/insane/insane.c @@ -567,7 +567,7 @@ insane_cross(edict_t *self) return; } - if (random() < 0.8) + if (randk() < 0.8) { self->monsterinfo.currentmove = &insane_move_cross; } @@ -599,7 +599,7 @@ insane_walk(edict_t *self) self->monsterinfo.currentmove = &insane_move_crawl; } else - if (random() <= 0.5) + if (randk() <= 0.5) { self->monsterinfo.currentmove = &insane_move_walk_normal; } @@ -632,7 +632,7 @@ insane_run(edict_t *self) } else - if (random() <= 0.5) /* Else, mix it up */ + if (randk() <= 0.5) /* Else, mix it up */ { self->monsterinfo.currentmove = &insane_move_run_normal; } @@ -731,9 +731,9 @@ insane_checkdown(edict_t *self) return; } - if (random() < 0.3) + if (randk() < 0.3) { - if (random() < 0.5) + if (randk() < 0.5) { self->monsterinfo.currentmove = &insane_move_uptodown; } @@ -758,7 +758,7 @@ insane_checkup(edict_t *self) return; } - if (random() < 0.5) + if (randk() < 0.5) { self->monsterinfo.currentmove = &insane_move_downtoup; } @@ -783,7 +783,7 @@ insane_stand(edict_t *self) self->monsterinfo.currentmove = &insane_move_down; } else - if (random() < 0.5) + if (randk() < 0.5) { self->monsterinfo.currentmove = &insane_move_stand_normal; } diff --git a/src/game/monster/medic/medic.c b/src/game/monster/medic/medic.c index ab370aa4..af5338ed 100644 --- a/src/game/monster/medic/medic.c +++ b/src/game/monster/medic/medic.c @@ -435,7 +435,7 @@ medic_pain(edict_t *self, edict_t *other /* unused */, return; /* no pain anims in nightmare */ } - if (random() < 0.5) + if (randk() < 0.5) { self->monsterinfo.currentmove = &medic_move_pain1; gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); @@ -681,7 +681,7 @@ mmove_t medic_move_duck = void medic_dodge(edict_t *self, edict_t *attacker, float eta) { - if (random() > 0.25) + if (randk() > 0.25) { return; } @@ -731,7 +731,7 @@ medic_continue(edict_t *self) if (visible(self, self->enemy)) { - if (random() <= 0.95) + if (randk() <= 0.95) { self->monsterinfo.currentmove = &medic_move_attackHyperBlaster; } diff --git a/src/game/monster/mutant/mutant.c b/src/game/monster/mutant/mutant.c index 1887aa9c..bdc69297 100644 --- a/src/game/monster/mutant/mutant.c +++ b/src/game/monster/mutant/mutant.c @@ -180,7 +180,7 @@ mutant_idle_loop(edict_t *self) return; } - if (random() < 0.75) + if (randk() < 0.75) { self->monsterinfo.nextframe = FRAME_stand155; } @@ -377,7 +377,7 @@ mutant_check_refire(edict_t *self) } if (((skill->value == 3) && - (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + (randk() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attack09; } @@ -438,7 +438,7 @@ mutant_jump_touch(edict_t *self, edict_t *other, VectorCopy(self->velocity, normal); VectorNormalize(normal); VectorMA(self->s.origin, self->maxs[0], normal, point); - damage = 40 + 10 * random(); + damage = 40 + 10 * randk(); T_Damage(other, self, self, self->velocity, point, normal, damage, damage, 0, MOD_UNKNOWN); } @@ -584,7 +584,7 @@ mutant_check_jump(edict_t *self) if (distance > 100) { - if (random() < 0.9) + if (randk() < 0.9) { return false; } @@ -699,7 +699,7 @@ mutant_pain(edict_t *self, edict_t *other /* unused */, return; /* no pain anims in nightmare */ } - r = random(); + r = randk(); if (r < 0.33) { @@ -820,7 +820,7 @@ mutant_die(edict_t *self, edict_t *inflictor /* unused */, self->takedamage = DAMAGE_YES; self->s.skinnum = 1; - if (random() < 0.5) + if (randk() < 0.5) { self->monsterinfo.currentmove = &mutant_move_death1; } diff --git a/src/game/monster/parasite/parasite.c b/src/game/monster/parasite/parasite.c index dcf93e3d..9246b8f1 100644 --- a/src/game/monster/parasite/parasite.c +++ b/src/game/monster/parasite/parasite.c @@ -195,7 +195,7 @@ parasite_refidget(edict_t *self) return; } - if (random() <= 0.8) + if (randk() <= 0.8) { self->monsterinfo.currentmove = ¶site_move_fidget; } @@ -457,7 +457,7 @@ parasite_pain(edict_t *self, edict_t *other /* unused */, return; /* no pain anims in nightmare */ } - if (random() < 0.5) + if (randk() < 0.5) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); } diff --git a/src/game/monster/soldier/soldier.c b/src/game/monster/soldier/soldier.c index a32adba3..f94afcee 100644 --- a/src/game/monster/soldier/soldier.c +++ b/src/game/monster/soldier/soldier.c @@ -48,7 +48,7 @@ soldier_idle(edict_t *self) return; } - if (random() > 0.8) + if (randk() > 0.8) { gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } @@ -179,7 +179,7 @@ soldier_stand(edict_t *self) } if ((self->monsterinfo.currentmove == &soldier_move_stand3) || - (random() < 0.8)) + (randk() < 0.8)) { self->monsterinfo.currentmove = &soldier_move_stand1; } @@ -197,7 +197,7 @@ soldier_walk1_random(edict_t *self) return; } - if (random() > 0.1) + if (randk() > 0.1) { self->monsterinfo.nextframe = FRAME_walk101; } @@ -276,7 +276,7 @@ soldier_walk(edict_t *self) return; } - if (random() < 0.5) + if (randk() < 0.5) { self->monsterinfo.currentmove = &soldier_move_walk1; } @@ -493,7 +493,7 @@ soldier_pain(edict_t *self, edict_t *other /* unused */, return; /* no pain anims in nightmare */ } - r = random(); + r = randk(); if (r < 0.33) { @@ -590,8 +590,8 @@ soldier_fire(edict_t *self, int flash_number) vectoangles(aim, dir); AngleVectors(dir, forward, right, up); - r = crandom() * 1000; - u = crandom() * 500; + r = crandk() * 1000; + u = crandk() * 500; VectorMA(start, 8192, forward, end); VectorMA(end, r, right, end); VectorMA(end, u, up, end); @@ -663,7 +663,7 @@ soldier_attack1_refire1(edict_t *self) } if (((skill->value == 3) && - (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + (randk() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak102; } @@ -692,7 +692,7 @@ soldier_attack1_refire2(edict_t *self) } if (((skill->value == 3) && - (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + (randk() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak102; } @@ -752,7 +752,7 @@ soldier_attack2_refire1(edict_t *self) } if (((skill->value == 3) && - (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + (randk() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak204; } @@ -781,7 +781,7 @@ soldier_attack2_refire2(edict_t *self) } if (((skill->value == 3) && - (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + (randk() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak204; } @@ -997,7 +997,7 @@ soldier_attack(edict_t *self) if (self->s.skinnum < 4) { - if (random() < 0.5) + if (randk() < 0.5) { self->monsterinfo.currentmove = &soldier_move_attack1; } @@ -1020,7 +1020,7 @@ soldier_sight(edict_t *self, edict_t *other /* unused */) return; } - if (random() < 0.5) + if (randk() < 0.5) { gi.sound(self, CHAN_VOICE, sound_sight1, 1, ATTN_NORM, 0); } @@ -1031,7 +1031,7 @@ soldier_sight(edict_t *self, edict_t *other /* unused */) if ((skill->value > 0) && (range(self, self->enemy) >= RANGE_MID)) { - if (random() > 0.5) + if (randk() > 0.5) { self->monsterinfo.currentmove = &soldier_move_attack6; } @@ -1082,7 +1082,7 @@ soldier_dodge(edict_t *self, edict_t *attacker, float eta) return; } - r = random(); + r = randk(); if (r > 0.25) { @@ -1101,7 +1101,7 @@ soldier_dodge(edict_t *self, edict_t *attacker, float eta) } self->monsterinfo.pausetime = level.time + eta + 0.3; - r = random(); + r = randk(); if (skill->value == 1) { diff --git a/src/game/monster/supertank/supertank.c b/src/game/monster/supertank/supertank.c index ae495ece..674531ae 100644 --- a/src/game/monster/supertank/supertank.c +++ b/src/game/monster/supertank/supertank.c @@ -59,7 +59,7 @@ supertank_search(edict_t *self) return; } - if (random() < 0.5) + if (randk() < 0.5) { gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NORM, 0); } @@ -566,7 +566,7 @@ supertank_reattack1(edict_t *self) if (visible(self, self->enemy)) { - if (random() < 0.9) + if (randk() < 0.9) { self->monsterinfo.currentmove = &supertank_move_attack1; } @@ -603,7 +603,7 @@ supertank_pain(edict_t *self, edict_t *other /* unused */, /* Lessen the chance of him going into his pain frames */ if (damage <= 25) { - if (random() < 0.2) + if (randk() < 0.2) { return; } @@ -741,7 +741,7 @@ supertank_attack(edict_t *self) else { /* fire rockets more often at distance */ - if (random() < 0.3) + if (randk() < 0.3) { self->monsterinfo.currentmove = &supertank_move_attack1; } diff --git a/src/game/monster/tank/tank.c b/src/game/monster/tank/tank.c index 68134000..df2203df 100644 --- a/src/game/monster/tank/tank.c +++ b/src/game/monster/tank/tank.c @@ -396,7 +396,7 @@ tank_pain(edict_t *self, edict_t *other /* other */, if (damage <= 30) { - if (random() > 0.2) + if (randk() > 0.2) { return; } @@ -649,7 +649,7 @@ tank_reattack_blaster(edict_t *self) { if (self->enemy->health > 0) { - if (random() <= 0.6) + if (randk() <= 0.6) { self->monsterinfo.currentmove = &tank_move_reattack_blast; return; @@ -867,7 +867,7 @@ tank_refire_rocket(edict_t *self) { if (visible(self, self->enemy)) { - if (random() <= 0.4) + if (randk() <= 0.4) { self->monsterinfo.currentmove = &tank_move_attack_fire_rocket; @@ -913,7 +913,7 @@ tank_attack(edict_t *self) VectorSubtract(self->enemy->s.origin, self->s.origin, vec); range = VectorLength(vec); - r = random(); + r = randk(); if (range <= 125) { diff --git a/src/game/player/weapon.c b/src/game/player/weapon.c index 42f7a6fd..c102cc61 100644 --- a/src/game/player/weapon.c +++ b/src/game/player/weapon.c @@ -907,7 +907,7 @@ Weapon_RocketLauncher_Fire(edict_t *ent) return; } - damage = 100 + (int)(random() * 20.0); + damage = 100 + (int)(randk() * 20.0); radius_damage = 120; damage_radius = 120; @@ -1210,11 +1210,11 @@ Machinegun_Fire(edict_t *ent) for (i = 1; i < 3; i++) { - ent->client->kick_origin[i] = crandom() * 0.35; - ent->client->kick_angles[i] = crandom() * 0.7; + ent->client->kick_origin[i] = crandk() * 0.35; + ent->client->kick_angles[i] = crandk() * 0.7; } - ent->client->kick_origin[0] = crandom() * 0.35; + ent->client->kick_origin[0] = crandk() * 0.35; ent->client->kick_angles[0] = ent->client->machinegun_shots * -1.5; /* raise the gun as it is firing */ @@ -1252,12 +1252,12 @@ Machinegun_Fire(edict_t *ent) if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) { - ent->s.frame = FRAME_crattak1 - (int)(random() + 0.25); + ent->s.frame = FRAME_crattak1 - (int)(randk() + 0.25); ent->client->anim_end = FRAME_crattak9; } else { - ent->s.frame = FRAME_attack1 - (int)(random() + 0.25); + ent->s.frame = FRAME_attack1 - (int)(randk() + 0.25); ent->client->anim_end = FRAME_attack8; } } @@ -1397,16 +1397,16 @@ Chaingun_Fire(edict_t *ent) for (i = 0; i < 3; i++) { - ent->client->kick_origin[i] = crandom() * 0.35; - ent->client->kick_angles[i] = crandom() * 0.7; + ent->client->kick_origin[i] = crandk() * 0.35; + ent->client->kick_angles[i] = crandk() * 0.7; } for (i = 0; i < shots; i++) { /* get start / end positions */ AngleVectors(ent->client->v_angle, forward, right, up); - r = 7 + crandom() * 4; - u = crandom() * 4; + r = 7 + crandk() * 4; + u = crandk() * 4; VectorSet(offset, 0, r, u + ent->viewheight - 8); P_ProjectSource(ent->client, ent->s.origin, offset, forward, right, start); @@ -1731,7 +1731,7 @@ weapon_bfg_fire(edict_t *ent) /* make a big pitch kick with an inverse fall */ ent->client->v_dmg_pitch = -40; - ent->client->v_dmg_roll = crandom() * 8; + ent->client->v_dmg_roll = crandk() * 8; ent->client->v_dmg_time = level.time + DAMAGE_TIME; VectorSet(offset, 8, 8, ent->viewheight - 8);