Merge branch 'scanbuild' into windows

This commit is contained in:
Yamagi Burmeister 2012-06-14 12:18:15 +02:00
commit 341014eda0
28 changed files with 198 additions and 195 deletions

View file

@ -167,11 +167,11 @@ ai_stand(edict_t *self, float dist)
if (self->monsterinfo.idle_time) if (self->monsterinfo.idle_time)
{ {
self->monsterinfo.idle(self); self->monsterinfo.idle(self);
self->monsterinfo.idle_time = level.time + 15 + randk() * 15; self->monsterinfo.idle_time = level.time + 15 + random() * 15;
} }
else else
{ {
self->monsterinfo.idle_time = level.time + randk() * 15; self->monsterinfo.idle_time = level.time + random() * 15;
} }
} }
} }
@ -200,11 +200,11 @@ ai_walk(edict_t *self, float dist)
if (self->monsterinfo.idle_time) if (self->monsterinfo.idle_time)
{ {
self->monsterinfo.search(self); self->monsterinfo.search(self);
self->monsterinfo.idle_time = level.time + 15 + randk() * 15; self->monsterinfo.idle_time = level.time + 15 + random() * 15;
} }
else else
{ {
self->monsterinfo.idle_time = level.time + randk() * 15; self->monsterinfo.idle_time = level.time + random() * 15;
} }
} }
} }
@ -829,16 +829,16 @@ M_CheckAttack(edict_t *self)
chance *= 2; chance *= 2;
} }
if (randk() < chance) if (random() < chance)
{ {
self->monsterinfo.attack_state = AS_MISSILE; self->monsterinfo.attack_state = AS_MISSILE;
self->monsterinfo.attack_finished = level.time + 2 * randk(); self->monsterinfo.attack_finished = level.time + 2 * random();
return true; return true;
} }
if (self->flags & FL_FLY) if (self->flags & FL_FLY)
{ {
if (randk() < 0.3) if (random() < 0.3)
{ {
self->monsterinfo.attack_state = AS_SLIDING; self->monsterinfo.attack_state = AS_SLIDING;
} }

View file

@ -2547,7 +2547,7 @@ func_timer_think(edict_t *self)
} }
G_UseTargets(self, self->activator); G_UseTargets(self, self->activator);
self->nextthink = level.time + self->wait + crandk() * self->random; self->nextthink = level.time + self->wait + crandom() * self->random;
} }
void void
@ -2603,7 +2603,7 @@ SP_func_timer(edict_t *self)
if (self->spawnflags & 1) if (self->spawnflags & 1)
{ {
self->nextthink = level.time + 1.0 + st.pausetime + self->delay + self->nextthink = level.time + 1.0 + st.pausetime + self->delay +
self->wait + crandk() * self->random; self->wait + crandom() * self->random;
self->activator = self; self->activator = self;
} }

View file

@ -65,9 +65,9 @@ SP_func_areaportal(edict_t *ent)
void void
VelocityForDamage(int damage, vec3_t v) VelocityForDamage(int damage, vec3_t v)
{ {
v[0] = 100.0 * crandk(); v[0] = 100.0 * crandom();
v[1] = 100.0 * crandk(); v[1] = 100.0 * crandom();
v[2] = 200.0 + 100.0 * randk(); v[2] = 200.0 + 100.0 * random();
if (damage < 50) if (damage < 50)
{ {
@ -131,7 +131,7 @@ gib_think(edict_t *self)
if (self->s.frame == 10) if (self->s.frame == 10)
{ {
self->think = G_FreeEdict; self->think = G_FreeEdict;
self->nextthink = level.time + 8 + randk() * 10; self->nextthink = level.time + 8 + random() * 10;
} }
} }
@ -213,9 +213,9 @@ ThrowGib(edict_t *self, char *gibname, int damage, int type)
VectorScale(self->size, 0.5, size); VectorScale(self->size, 0.5, size);
VectorAdd(self->absmin, size, origin); VectorAdd(self->absmin, size, origin);
gib->s.origin[0] = origin[0] + crandk() * size[0]; gib->s.origin[0] = origin[0] + crandom() * size[0];
gib->s.origin[1] = origin[1] + crandk() * size[1]; gib->s.origin[1] = origin[1] + crandom() * size[1];
gib->s.origin[2] = origin[2] + crandk() * size[2]; gib->s.origin[2] = origin[2] + crandom() * size[2];
gi.setmodel(gib, gibname); gi.setmodel(gib, gibname);
gib->solid = SOLID_NOT; gib->solid = SOLID_NOT;
@ -239,12 +239,12 @@ ThrowGib(edict_t *self, char *gibname, int damage, int type)
VelocityForDamage(damage, vd); VelocityForDamage(damage, vd);
VectorMA(self->velocity, vscale, vd, gib->velocity); VectorMA(self->velocity, vscale, vd, gib->velocity);
ClipGibVelocity(gib); ClipGibVelocity(gib);
gib->avelocity[0] = randk() * 600; gib->avelocity[0] = random() * 600;
gib->avelocity[1] = randk() * 600; gib->avelocity[1] = random() * 600;
gib->avelocity[2] = randk() * 600; gib->avelocity[2] = random() * 600;
gib->think = G_FreeEdict; gib->think = G_FreeEdict;
gib->nextthink = level.time + 10 + randk() * 10; gib->nextthink = level.time + 10 + random() * 10;
gi.linkentity(gib); gi.linkentity(gib);
} }
@ -293,10 +293,10 @@ ThrowHead(edict_t *self, char *gibname, int damage, int type)
VectorMA(self->velocity, vscale, vd, self->velocity); VectorMA(self->velocity, vscale, vd, self->velocity);
ClipGibVelocity(self); ClipGibVelocity(self);
self->avelocity[YAW] = crandk() * 600; self->avelocity[YAW] = crandom() * 600;
self->think = G_FreeEdict; self->think = G_FreeEdict;
self->nextthink = level.time + 10 + randk() * 10; self->nextthink = level.time + 10 + random() * 10;
gi.linkentity(self); gi.linkentity(self);
} }
@ -394,17 +394,17 @@ ThrowDebris(edict_t *self, char *modelname, float speed, vec3_t origin)
chunk = G_Spawn(); chunk = G_Spawn();
VectorCopy(origin, chunk->s.origin); VectorCopy(origin, chunk->s.origin);
gi.setmodel(chunk, modelname); gi.setmodel(chunk, modelname);
v[0] = 100 * crandk(); v[0] = 100 * crandom();
v[1] = 100 * crandk(); v[1] = 100 * crandom();
v[2] = 100 + 100 * crandk(); v[2] = 100 + 100 * crandom();
VectorMA(self->velocity, speed, v, chunk->velocity); VectorMA(self->velocity, speed, v, chunk->velocity);
chunk->movetype = MOVETYPE_BOUNCE; chunk->movetype = MOVETYPE_BOUNCE;
chunk->solid = SOLID_NOT; chunk->solid = SOLID_NOT;
chunk->avelocity[0] = randk() * 600; chunk->avelocity[0] = random() * 600;
chunk->avelocity[1] = randk() * 600; chunk->avelocity[1] = random() * 600;
chunk->avelocity[2] = randk() * 600; chunk->avelocity[2] = random() * 600;
chunk->think = G_FreeEdict; chunk->think = G_FreeEdict;
chunk->nextthink = level.time + 5 + randk() * 5; chunk->nextthink = level.time + 5 + random() * 5;
chunk->s.frame = 0; chunk->s.frame = 0;
chunk->flags = 0; chunk->flags = 0;
chunk->classname = "debris"; chunk->classname = "debris";
@ -1076,9 +1076,9 @@ func_explosive_explode(edict_t *self, edict_t *inflictor, edict_t *attacker,
while (count--) while (count--)
{ {
chunkorigin[0] = origin[0] + crandk() * size[0]; chunkorigin[0] = origin[0] + crandom() * size[0];
chunkorigin[1] = origin[1] + crandk() * size[1]; chunkorigin[1] = origin[1] + crandom() * size[1];
chunkorigin[2] = origin[2] + crandk() * size[2]; chunkorigin[2] = origin[2] + crandom() * size[2];
ThrowDebris(self, "models/objects/debris1/tris.md2", 1, chunkorigin); 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--) while (count--)
{ {
chunkorigin[0] = origin[0] + crandk() * size[0]; chunkorigin[0] = origin[0] + crandom() * size[0];
chunkorigin[1] = origin[1] + crandk() * size[1]; chunkorigin[1] = origin[1] + crandom() * size[1];
chunkorigin[2] = origin[2] + crandk() * size[2]; chunkorigin[2] = origin[2] + crandom() * size[2];
ThrowDebris(self, "models/objects/debris2/tris.md2", 2, chunkorigin); ThrowDebris(self, "models/objects/debris2/tris.md2", 2, chunkorigin);
} }
@ -1237,13 +1237,13 @@ barrel_explode(edict_t *self)
/* a few big chunks */ /* a few big chunks */
spd = 1.5 * (float)self->dmg / 200.0; spd = 1.5 * (float)self->dmg / 200.0;
org[0] = self->s.origin[0] + crandk() * self->size[0]; org[0] = self->s.origin[0] + crandom() * self->size[0];
org[1] = self->s.origin[1] + crandk() * self->size[1]; org[1] = self->s.origin[1] + crandom() * self->size[1];
org[2] = self->s.origin[2] + crandk() * self->size[2]; org[2] = self->s.origin[2] + crandom() * self->size[2];
ThrowDebris(self, "models/objects/debris1/tris.md2", spd, org); ThrowDebris(self, "models/objects/debris1/tris.md2", spd, org);
org[0] = self->s.origin[0] + crandk() * self->size[0]; org[0] = self->s.origin[0] + crandom() * self->size[0];
org[1] = self->s.origin[1] + crandk() * self->size[1]; org[1] = self->s.origin[1] + crandom() * self->size[1];
org[2] = self->s.origin[2] + crandk() * self->size[2]; org[2] = self->s.origin[2] + crandom() * self->size[2];
ThrowDebris(self, "models/objects/debris1/tris.md2", spd, org); ThrowDebris(self, "models/objects/debris1/tris.md2", spd, org);
/* bottom corners */ /* bottom corners */
@ -1263,37 +1263,37 @@ barrel_explode(edict_t *self)
/* a bunch of little chunks */ /* a bunch of little chunks */
spd = 2 * self->dmg / 200; spd = 2 * self->dmg / 200;
org[0] = self->s.origin[0] + crandk() * self->size[0]; org[0] = self->s.origin[0] + crandom() * self->size[0];
org[1] = self->s.origin[1] + crandk() * self->size[1]; org[1] = self->s.origin[1] + crandom() * self->size[1];
org[2] = self->s.origin[2] + crandk() * self->size[2]; org[2] = self->s.origin[2] + crandom() * self->size[2];
ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org);
org[0] = self->s.origin[0] + crandk() * self->size[0]; org[0] = self->s.origin[0] + crandom() * self->size[0];
org[1] = self->s.origin[1] + crandk() * self->size[1]; org[1] = self->s.origin[1] + crandom() * self->size[1];
org[2] = self->s.origin[2] + crandk() * self->size[2]; org[2] = self->s.origin[2] + crandom() * self->size[2];
ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org);
org[0] = self->s.origin[0] + crandk() * self->size[0]; org[0] = self->s.origin[0] + crandom() * self->size[0];
org[1] = self->s.origin[1] + crandk() * self->size[1]; org[1] = self->s.origin[1] + crandom() * self->size[1];
org[2] = self->s.origin[2] + crandk() * self->size[2]; org[2] = self->s.origin[2] + crandom() * self->size[2];
ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org);
org[0] = self->s.origin[0] + crandk() * self->size[0]; org[0] = self->s.origin[0] + crandom() * self->size[0];
org[1] = self->s.origin[1] + crandk() * self->size[1]; org[1] = self->s.origin[1] + crandom() * self->size[1];
org[2] = self->s.origin[2] + crandk() * self->size[2]; org[2] = self->s.origin[2] + crandom() * self->size[2];
ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org);
org[0] = self->s.origin[0] + crandk() * self->size[0]; org[0] = self->s.origin[0] + crandom() * self->size[0];
org[1] = self->s.origin[1] + crandk() * self->size[1]; org[1] = self->s.origin[1] + crandom() * self->size[1];
org[2] = self->s.origin[2] + crandk() * self->size[2]; org[2] = self->s.origin[2] + crandom() * self->size[2];
ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org);
org[0] = self->s.origin[0] + crandk() * self->size[0]; org[0] = self->s.origin[0] + crandom() * self->size[0];
org[1] = self->s.origin[1] + crandk() * self->size[1]; org[1] = self->s.origin[1] + crandom() * self->size[1];
org[2] = self->s.origin[2] + crandk() * self->size[2]; org[2] = self->s.origin[2] + crandom() * self->size[2];
ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org);
org[0] = self->s.origin[0] + crandk() * self->size[0]; org[0] = self->s.origin[0] + crandom() * self->size[0];
org[1] = self->s.origin[1] + crandk() * self->size[1]; org[1] = self->s.origin[1] + crandom() * self->size[1];
org[2] = self->s.origin[2] + crandk() * self->size[2]; org[2] = self->s.origin[2] + crandom() * self->size[2];
ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org);
org[0] = self->s.origin[0] + crandk() * self->size[0]; org[0] = self->s.origin[0] + crandom() * self->size[0];
org[1] = self->s.origin[1] + crandk() * self->size[1]; org[1] = self->s.origin[1] + crandom() * self->size[1];
org[2] = self->s.origin[2] + crandk() * self->size[2]; org[2] = self->s.origin[2] + crandom() * self->size[2];
ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org);
VectorCopy(save, self->s.origin); VectorCopy(save, self->s.origin);
@ -2134,9 +2134,9 @@ SP_misc_gib_arm(edict_t *ent)
ent->movetype = MOVETYPE_TOSS; ent->movetype = MOVETYPE_TOSS;
ent->svflags |= SVF_MONSTER; ent->svflags |= SVF_MONSTER;
ent->deadflag = DEAD_DEAD; ent->deadflag = DEAD_DEAD;
ent->avelocity[0] = randk() * 200; ent->avelocity[0] = random() * 200;
ent->avelocity[1] = randk() * 200; ent->avelocity[1] = random() * 200;
ent->avelocity[2] = randk() * 200; ent->avelocity[2] = random() * 200;
ent->think = G_FreeEdict; ent->think = G_FreeEdict;
ent->nextthink = level.time + 30; ent->nextthink = level.time + 30;
gi.linkentity(ent); gi.linkentity(ent);
@ -2162,9 +2162,9 @@ SP_misc_gib_leg(edict_t *ent)
ent->movetype = MOVETYPE_TOSS; ent->movetype = MOVETYPE_TOSS;
ent->svflags |= SVF_MONSTER; ent->svflags |= SVF_MONSTER;
ent->deadflag = DEAD_DEAD; ent->deadflag = DEAD_DEAD;
ent->avelocity[0] = randk() * 200; ent->avelocity[0] = random() * 200;
ent->avelocity[1] = randk() * 200; ent->avelocity[1] = random() * 200;
ent->avelocity[2] = randk() * 200; ent->avelocity[2] = random() * 200;
ent->think = G_FreeEdict; ent->think = G_FreeEdict;
ent->nextthink = level.time + 30; ent->nextthink = level.time + 30;
gi.linkentity(ent); gi.linkentity(ent);
@ -2190,9 +2190,9 @@ SP_misc_gib_head(edict_t *ent)
ent->movetype = MOVETYPE_TOSS; ent->movetype = MOVETYPE_TOSS;
ent->svflags |= SVF_MONSTER; ent->svflags |= SVF_MONSTER;
ent->deadflag = DEAD_DEAD; ent->deadflag = DEAD_DEAD;
ent->avelocity[0] = randk() * 200; ent->avelocity[0] = random() * 200;
ent->avelocity[1] = randk() * 200; ent->avelocity[1] = random() * 200;
ent->avelocity[2] = randk() * 200; ent->avelocity[2] = random() * 200;
ent->think = G_FreeEdict; ent->think = G_FreeEdict;
ent->nextthink = level.time + 30; ent->nextthink = level.time + 30;
gi.linkentity(ent); gi.linkentity(ent);

View file

@ -199,13 +199,13 @@ M_FlyCheck(edict_t *self)
return; return;
} }
if (randk() > 0.5) if (random() > 0.5)
{ {
return; return;
} }
self->think = M_FliesOn; self->think = M_FliesOn;
self->nextthink = level.time + 5 + 10 * randk(); self->nextthink = level.time + 5 + 10 * random();
} }
void void
@ -415,7 +415,7 @@ M_WorldEffects(edict_t *ent)
{ {
if (ent->watertype & CONTENTS_LAVA) if (ent->watertype & CONTENTS_LAVA)
{ {
if (randk() <= 0.5) if (random() <= 0.5)
{ {
gi.sound(ent, CHAN_BODY, gi.soundindex( gi.sound(ent, CHAN_BODY, gi.soundindex(
"player/lava1.wav"), 1, ATTN_NORM, 0); "player/lava1.wav"), 1, ATTN_NORM, 0);

View file

@ -1174,8 +1174,8 @@ target_earthquake_think(edict_t *self)
} }
e->groundentity = NULL; e->groundentity = NULL;
e->velocity[0] += crandk() * 150; e->velocity[0] += crandom() * 150;
e->velocity[1] += crandk() * 150; e->velocity[1] += crandom() * 150;
e->velocity[2] = self->speed * (100.0 / e->mass); e->velocity[2] = self->speed * (100.0 / e->mass);
} }

View file

@ -133,7 +133,7 @@ turret_breach_fire(edict_t *self)
VectorMA(start, self->move_origin[1], r, start); VectorMA(start, self->move_origin[1], r, start);
VectorMA(start, self->move_origin[2], u, start); VectorMA(start, self->move_origin[2], u, start);
damage = 100 + randk() * 50; damage = 100 + random() * 50;
speed = 550 + 50 * skill->value; speed = 550 + 50 * skill->value;
fire_rocket(self->teammaster->owner, start, f, damage, speed, 150, damage); fire_rocket(self->teammaster->owner, start, f, damage, speed, 150, damage);
gi.positioned_sound(start, self, CHAN_WEAPON, gi.positioned_sound(start, self, CHAN_WEAPON,

View file

@ -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 */ /* easy mode only ducks one quarter the time */
if (skill->value == 0) if (skill->value == 0)
{ {
if (randk() > 0.25) if (random() > 0.25)
{ {
return; return;
} }
@ -196,8 +196,8 @@ fire_lead(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick,
vectoangles(aimdir, dir); vectoangles(aimdir, dir);
AngleVectors(dir, forward, right, up); AngleVectors(dir, forward, right, up);
r = crandk() * hspread; r = crandom() * hspread;
u = crandk() * vspread; u = crandom() * vspread;
VectorMA(start, 8192, forward, end); VectorMA(start, 8192, forward, end);
VectorMA(end, r, right, end); VectorMA(end, r, right, end);
VectorMA(end, u, up, 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); VectorSubtract(end, start, dir);
vectoangles(dir, dir); vectoangles(dir, dir);
AngleVectors(dir, forward, right, up); AngleVectors(dir, forward, right, up);
r = crandk() * hspread * 2; r = crandom() * hspread * 2;
u = crandk() * vspread * 2; u = crandom() * vspread * 2;
VectorMA(water_start, 8192, forward, end); VectorMA(water_start, 8192, forward, end);
VectorMA(end, r, right, end); VectorMA(end, r, right, end);
VectorMA(end, u, up, 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 (ent->spawnflags & 1)
{ {
if (randk() > 0.5) if (random() > 0.5)
{ {
gi.sound(ent, CHAN_VOICE, gi.soundindex( gi.sound(ent, CHAN_VOICE, gi.soundindex(
"weapons/hgrenb1a.wav"), 1, ATTN_NORM, 0); "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(); grenade = G_Spawn();
VectorCopy(start, grenade->s.origin); VectorCopy(start, grenade->s.origin);
VectorScale(aimdir, speed, grenade->velocity); VectorScale(aimdir, speed, grenade->velocity);
VectorMA(grenade->velocity, 200 + crandk() * 10.0, up, grenade->velocity); VectorMA(grenade->velocity, 200 + crandom() * 10.0, up, grenade->velocity);
VectorMA(grenade->velocity, crandk() * 10.0, right, grenade->velocity); VectorMA(grenade->velocity, crandom() * 10.0, right, grenade->velocity);
VectorSet(grenade->avelocity, 300, 300, 300); VectorSet(grenade->avelocity, 300, 300, 300);
grenade->movetype = MOVETYPE_BOUNCE; grenade->movetype = MOVETYPE_BOUNCE;
grenade->clipmask = MASK_SHOT; grenade->clipmask = MASK_SHOT;
@ -694,8 +694,8 @@ fire_grenade2(edict_t *self, vec3_t start, vec3_t aimdir, int damage,
grenade = G_Spawn(); grenade = G_Spawn();
VectorCopy(start, grenade->s.origin); VectorCopy(start, grenade->s.origin);
VectorScale(aimdir, speed, grenade->velocity); VectorScale(aimdir, speed, grenade->velocity);
VectorMA(grenade->velocity, 200 + crandk() * 10.0, up, grenade->velocity); VectorMA(grenade->velocity, 200 + crandom() * 10.0, up, grenade->velocity);
VectorMA(grenade->velocity, crandk() * 10.0, right, grenade->velocity); VectorMA(grenade->velocity, crandom() * 10.0, right, grenade->velocity);
VectorSet(grenade->avelocity, 300, 300, 300); VectorSet(grenade->avelocity, 300, 300, 300);
grenade->movetype = MOVETYPE_BOUNCE; grenade->movetype = MOVETYPE_BOUNCE;
grenade->clipmask = MASK_SHOT; grenade->clipmask = MASK_SHOT;

View file

@ -487,6 +487,9 @@ extern edict_t *g_edicts;
#define LLOFS(x) (size_t)&(((level_locals_t *)NULL)->x) #define LLOFS(x) (size_t)&(((level_locals_t *)NULL)->x)
#define CLOFS(x) (size_t)&(((gclient_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 *maxentities;
extern cvar_t *deathmatch; extern cvar_t *deathmatch;
extern cvar_t *coop; extern cvar_t *coop;

View file

@ -128,7 +128,7 @@ berserk_fidget(edict_t *self)
return; return;
} }
if (randk() > 0.15) if (random() > 0.15)
{ {
return; return;
} }
@ -407,7 +407,7 @@ berserk_pain(edict_t *self, edict_t *other /* unused */,
return; /* no pain anims in nightmare */ return; /* no pain anims in nightmare */
} }
if ((damage < 20) || (randk() < 0.5)) if ((damage < 20) || (random() < 0.5))
{ {
self->monsterinfo.currentmove = &berserk_move_pain1; self->monsterinfo.currentmove = &berserk_move_pain1;
} }

View file

@ -45,7 +45,7 @@ boss2_search(edict_t *self)
return; return;
} }
if (randk() < 0.5) if (random() < 0.5)
{ {
gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NONE, 0); gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NONE, 0);
} }
@ -549,7 +549,7 @@ boss2_attack(edict_t *self)
} }
else else
{ {
if (randk() <= 0.6) if (random() <= 0.6)
{ {
self->monsterinfo.currentmove = &boss2_move_attack_pre_mg; self->monsterinfo.currentmove = &boss2_move_attack_pre_mg;
} }
@ -581,7 +581,7 @@ boss2_reattack_mg(edict_t *self)
if (infront(self, self->enemy)) if (infront(self, self->enemy))
{ {
if (randk() <= 0.7) if (random() <= 0.7)
{ {
self->monsterinfo.currentmove = &boss2_move_attack_mg; self->monsterinfo.currentmove = &boss2_move_attack_mg;
} }
@ -759,16 +759,16 @@ Boss2_CheckAttack(edict_t *self)
return false; return false;
} }
if (randk() < chance) if (random() < chance)
{ {
self->monsterinfo.attack_state = AS_MISSILE; self->monsterinfo.attack_state = AS_MISSILE;
self->monsterinfo.attack_finished = level.time + 2 * randk(); self->monsterinfo.attack_finished = level.time + 2 * random();
return true; return true;
} }
if (self->flags & FL_FLY) if (self->flags & FL_FLY)
{ {
if (randk() < 0.3) if (random() < 0.3)
{ {
self->monsterinfo.attack_state = AS_SLIDING; self->monsterinfo.attack_state = AS_SLIDING;
} }

View file

@ -58,7 +58,7 @@ jorg_search(edict_t *self)
return; return;
} }
r = randk(); r = random();
if (r <= 0.3) if (r <= 0.3)
{ {
@ -524,7 +524,7 @@ jorg_reattack1(edict_t *self)
if (visible(self, self->enemy)) if (visible(self, self->enemy))
{ {
if (randk() < 0.9) if (random() < 0.9)
{ {
self->monsterinfo.currentmove = &jorg_move_attack1; 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 */ pain frames if he takes little damage */
if (damage <= 40) if (damage <= 40)
{ {
if (randk() <= 0.6) if (random() <= 0.6)
{ {
return; return;
} }
@ -587,7 +587,7 @@ jorg_pain(edict_t *self, edict_t *other /* unused */,
lessen the chance of him going into pain */ lessen the chance of him going into pain */
if ((self->s.frame >= FRAME_attak101) && (self->s.frame <= FRAME_attak108)) if ((self->s.frame >= FRAME_attak101) && (self->s.frame <= FRAME_attak108))
{ {
if (randk() <= 0.005) if (random() <= 0.005)
{ {
return; 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 ((self->s.frame >= FRAME_attak109) && (self->s.frame <= FRAME_attak114))
{ {
if (randk() <= 0.00005) if (random() <= 0.00005)
{ {
return; 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 ((self->s.frame >= FRAME_attak201) && (self->s.frame <= FRAME_attak208))
{ {
if (randk() <= 0.005) if (random() <= 0.005)
{ {
return; return;
} }
@ -628,7 +628,7 @@ jorg_pain(edict_t *self, edict_t *other /* unused */,
} }
else else
{ {
if (randk() <= 0.3) if (random() <= 0.3)
{ {
gi.sound(self, CHAN_VOICE, sound_pain3, 1, ATTN_NORM, 0); gi.sound(self, CHAN_VOICE, sound_pain3, 1, ATTN_NORM, 0);
self->monsterinfo.currentmove = &jorg_move_pain3; self->monsterinfo.currentmove = &jorg_move_pain3;
@ -731,7 +731,7 @@ jorg_attack(edict_t *self)
return; return;
} }
if (randk() <= 0.75) if (random() <= 0.75)
{ {
gi.sound(self, CHAN_VOICE, sound_attack1, 1, ATTN_NORM, 0); gi.sound(self, CHAN_VOICE, sound_attack1, 1, ATTN_NORM, 0);
self->s.sound = gi.soundindex("boss3/w_loop.wav"); self->s.sound = gi.soundindex("boss3/w_loop.wav");
@ -859,16 +859,16 @@ Jorg_CheckAttack(edict_t *self)
return false; return false;
} }
if (randk() < chance) if (random() < chance)
{ {
self->monsterinfo.attack_state = AS_MISSILE; self->monsterinfo.attack_state = AS_MISSILE;
self->monsterinfo.attack_finished = level.time + 2 * randk(); self->monsterinfo.attack_finished = level.time + 2 * random();
return true; return true;
} }
if (self->flags & FL_FLY) if (self->flags & FL_FLY)
{ {
if (randk() < 0.3) if (random() < 0.3)
{ {
self->monsterinfo.attack_state = AS_SLIDING; self->monsterinfo.attack_state = AS_SLIDING;
} }

View file

@ -62,7 +62,7 @@ makron_taunt(edict_t *self)
return; return;
} }
r = randk(); r = random();
if (r <= 0.3) 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 */ /* Lessen the chance of him going into his pain frames */
if (damage <= 25) if (damage <= 25)
{ {
if (randk() < 0.2) if (random() < 0.2)
{ {
return; return;
} }
@ -768,13 +768,13 @@ makron_pain(edict_t *self, edict_t *other /* unused */,
{ {
if (damage <= 150) if (damage <= 150)
{ {
if (randk() <= 0.45) if (random() <= 0.45)
{ {
gi.sound(self, CHAN_VOICE, sound_pain6, 1, ATTN_NONE, 0); gi.sound(self, CHAN_VOICE, sound_pain6, 1, ATTN_NONE, 0);
self->monsterinfo.currentmove = &makron_move_pain6; self->monsterinfo.currentmove = &makron_move_pain6;
} }
else else
if (randk() <= 0.35) if (random() <= 0.35)
{ {
gi.sound(self, CHAN_VOICE, sound_pain6, 1, ATTN_NONE, 0); gi.sound(self, CHAN_VOICE, sound_pain6, 1, ATTN_NONE, 0);
self->monsterinfo.currentmove = &makron_move_pain6; self->monsterinfo.currentmove = &makron_move_pain6;
@ -804,7 +804,7 @@ makron_attack(edict_t *self)
return; return;
} }
r = randk(); r = random();
if (r <= 0.3) if (r <= 0.3)
{ {
@ -1026,16 +1026,16 @@ Makron_CheckAttack(edict_t *self)
return false; return false;
} }
if (randk() < chance) if (random() < chance)
{ {
self->monsterinfo.attack_state = AS_MISSILE; self->monsterinfo.attack_state = AS_MISSILE;
self->monsterinfo.attack_finished = level.time + 2 * randk(); self->monsterinfo.attack_finished = level.time + 2 * random();
return true; return true;
} }
if (self->flags & FL_FLY) if (self->flags & FL_FLY)
{ {
if (randk() < 0.3) if (random() < 0.3)
{ {
self->monsterinfo.attack_state = AS_SLIDING; self->monsterinfo.attack_state = AS_SLIDING;
} }

View file

@ -375,7 +375,7 @@ brain_dodge(edict_t *self, edict_t *attacker, float eta)
return; return;
} }
if (randk() > 0.25) if (random() > 0.25)
{ {
return; return;
} }
@ -607,7 +607,7 @@ brain_melee(edict_t *self)
return; return;
} }
if (randk() <= 0.5) if (random() <= 0.5)
{ {
self->monsterinfo.currentmove = &brain_move_attack1; 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 */ return; /* no pain anims in nightmare */
} }
r = randk(); r = random();
if (r < 0.33) 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->deadflag = DEAD_DEAD;
self->takedamage = DAMAGE_YES; self->takedamage = DAMAGE_YES;
if (randk() <= 0.5) if (random() <= 0.5)
{ {
self->monsterinfo.currentmove = &brain_move_death1; self->monsterinfo.currentmove = &brain_move_death1;
} }

View file

@ -59,7 +59,7 @@ ChickMoan(edict_t *self)
return; return;
} }
if (randk() < 0.5) if (random() < 0.5)
{ {
gi.sound(self, CHAN_VOICE, sound_idle1, 1, ATTN_IDLE, 0); gi.sound(self, CHAN_VOICE, sound_idle1, 1, ATTN_IDLE, 0);
} }
@ -123,7 +123,7 @@ chick_fidget(edict_t *self)
return; return;
} }
if (randk() <= 0.3) if (random() <= 0.3)
{ {
self->monsterinfo.currentmove = &chick_move_fidget; 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; self->pain_debounce_time = level.time + 3;
r = randk(); r = random();
if (r < 0.33) if (r < 0.33)
{ {
@ -610,7 +610,7 @@ chick_dodge(edict_t *self, edict_t *attacker, float eta /* unused */)
return; return;
} }
if (randk() > 0.25) if (random() > 0.25)
{ {
return; return;
} }
@ -763,7 +763,7 @@ chick_rerocket(edict_t *self)
{ {
if (visible(self, self->enemy)) if (visible(self, self->enemy))
{ {
if (randk() <= 0.6) if (random() <= 0.6)
{ {
self->monsterinfo.currentmove = &chick_move_attack1; self->monsterinfo.currentmove = &chick_move_attack1;
return; return;
@ -833,7 +833,7 @@ chick_reslash(edict_t *self)
{ {
if (range(self, self->enemy) == RANGE_MELEE) if (range(self, self->enemy) == RANGE_MELEE)
{ {
if (randk() <= 0.9) if (random() <= 0.9)
{ {
self->monsterinfo.currentmove = &chick_move_slash; self->monsterinfo.currentmove = &chick_move_slash;
return; return;

View file

@ -232,7 +232,7 @@ floater_stand(edict_t *self)
return; return;
} }
if (randk() <= 0.5) if (random() <= 0.5)
{ {
self->monsterinfo.currentmove = &floater_move_stand1; self->monsterinfo.currentmove = &floater_move_stand1;
} }
@ -689,7 +689,7 @@ floater_melee(edict_t *self)
return; return;
} }
if (randk() < 0.5) if (random() < 0.5)
{ {
self->monsterinfo.currentmove = &floater_move_attack3; self->monsterinfo.currentmove = &floater_move_attack3;
} }
@ -822,7 +822,7 @@ SP_monster_floater(edict_t *self)
gi.linkentity(self); gi.linkentity(self);
if (randk() <= 0.5) if (random() <= 0.5)
{ {
self->monsterinfo.currentmove = &floater_move_stand1; self->monsterinfo.currentmove = &floater_move_stand1;
} }

View file

@ -734,7 +734,7 @@ flyer_check_melee(edict_t *self)
if (range(self, self->enemy) == RANGE_MELEE) if (range(self, self->enemy) == RANGE_MELEE)
{ {
if (randk() <= 0.8) if (random() <= 0.8)
{ {
self->monsterinfo.currentmove = &flyer_move_loop_melee; self->monsterinfo.currentmove = &flyer_move_loop_melee;
} }

View file

@ -381,7 +381,7 @@ gladiator_pain(edict_t *self, edict_t *other /* unused */,
self->pain_debounce_time = level.time + 3; self->pain_debounce_time = level.time + 3;
if (randk() < 0.5) if (random() < 0.5)
{ {
gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
} }

View file

@ -153,7 +153,7 @@ gunner_fidget(edict_t *self)
return; return;
} }
if (randk() <= 0.05) if (random() <= 0.05)
{ {
self->monsterinfo.currentmove = &gunner_move_fidget; self->monsterinfo.currentmove = &gunner_move_fidget;
} }
@ -531,7 +531,7 @@ gunner_duck_down(edict_t *self)
if (skill->value >= 2) if (skill->value >= 2)
{ {
if (randk() > 0.5) if (random() > 0.5)
{ {
GunnerGrenade(self); GunnerGrenade(self);
} }
@ -602,7 +602,7 @@ gunner_dodge(edict_t *self, edict_t *attacker, float eta /* unused */)
return; return;
} }
if (randk() > 0.25) if (random() > 0.25)
{ {
return; return;
} }
@ -798,7 +798,7 @@ gunner_attack(edict_t *self)
} }
else else
{ {
if (randk() <= 0.5) if (random() <= 0.5)
{ {
self->monsterinfo.currentmove = &gunner_move_attack_grenade; self->monsterinfo.currentmove = &gunner_move_attack_grenade;
} }
@ -832,7 +832,7 @@ gunner_refire_chain(edict_t *self)
{ {
if (visible(self, self->enemy)) if (visible(self, self->enemy))
{ {
if (randk() <= 0.5) if (random() <= 0.5)
{ {
self->monsterinfo.currentmove = &gunner_move_fire_chain; self->monsterinfo.currentmove = &gunner_move_fire_chain;
return; return;

View file

@ -52,7 +52,7 @@ void
hover_search(edict_t *self) hover_search(edict_t *self)
{ {
if (randk() < 0.5) if (random() < 0.5)
{ {
gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NORM, 0); 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 (visible(self, self->enemy))
{ {
if (randk() <= 0.6) if (random() <= 0.6)
{ {
self->monsterinfo.currentmove = &hover_move_attack1; self->monsterinfo.currentmove = &hover_move_attack1;
return; return;
@ -669,7 +669,7 @@ hover_pain(edict_t *self, edict_t *other /* unused */,
if (damage <= 25) if (damage <= 25)
{ {
if (randk() < 0.5) if (random() < 0.5)
{ {
gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
self->monsterinfo.currentmove = &hover_move_pain3; self->monsterinfo.currentmove = &hover_move_pain3;
@ -769,7 +769,7 @@ hover_die(edict_t *self, edict_t *inflictor /* unused */,
} }
/* regular death */ /* regular death */
if (randk() < 0.5) if (random() < 0.5)
{ {
gi.sound(self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0); gi.sound(self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0);
} }

View file

@ -628,7 +628,7 @@ infantry_dodge(edict_t *self, edict_t *attacker, float eta /* unused */)
return; return;
} }
if (randk() > 0.25) if (random() > 0.25)
{ {
return; return;
} }

View file

@ -567,7 +567,7 @@ insane_cross(edict_t *self)
return; return;
} }
if (randk() < 0.8) if (random() < 0.8)
{ {
self->monsterinfo.currentmove = &insane_move_cross; self->monsterinfo.currentmove = &insane_move_cross;
} }
@ -599,7 +599,7 @@ insane_walk(edict_t *self)
self->monsterinfo.currentmove = &insane_move_crawl; self->monsterinfo.currentmove = &insane_move_crawl;
} }
else else
if (randk() <= 0.5) if (random() <= 0.5)
{ {
self->monsterinfo.currentmove = &insane_move_walk_normal; self->monsterinfo.currentmove = &insane_move_walk_normal;
} }
@ -632,7 +632,7 @@ insane_run(edict_t *self)
} }
else else
if (randk() <= 0.5) /* Else, mix it up */ if (random() <= 0.5) /* Else, mix it up */
{ {
self->monsterinfo.currentmove = &insane_move_run_normal; self->monsterinfo.currentmove = &insane_move_run_normal;
} }
@ -731,9 +731,9 @@ insane_checkdown(edict_t *self)
return; return;
} }
if (randk() < 0.3) if (random() < 0.3)
{ {
if (randk() < 0.5) if (random() < 0.5)
{ {
self->monsterinfo.currentmove = &insane_move_uptodown; self->monsterinfo.currentmove = &insane_move_uptodown;
} }
@ -758,7 +758,7 @@ insane_checkup(edict_t *self)
return; return;
} }
if (randk() < 0.5) if (random() < 0.5)
{ {
self->monsterinfo.currentmove = &insane_move_downtoup; self->monsterinfo.currentmove = &insane_move_downtoup;
} }
@ -783,7 +783,7 @@ insane_stand(edict_t *self)
self->monsterinfo.currentmove = &insane_move_down; self->monsterinfo.currentmove = &insane_move_down;
} }
else else
if (randk() < 0.5) if (random() < 0.5)
{ {
self->monsterinfo.currentmove = &insane_move_stand_normal; self->monsterinfo.currentmove = &insane_move_stand_normal;
} }

View file

@ -435,7 +435,7 @@ medic_pain(edict_t *self, edict_t *other /* unused */,
return; /* no pain anims in nightmare */ return; /* no pain anims in nightmare */
} }
if (randk() < 0.5) if (random() < 0.5)
{ {
self->monsterinfo.currentmove = &medic_move_pain1; self->monsterinfo.currentmove = &medic_move_pain1;
gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
@ -681,7 +681,7 @@ mmove_t medic_move_duck =
void void
medic_dodge(edict_t *self, edict_t *attacker, float eta) medic_dodge(edict_t *self, edict_t *attacker, float eta)
{ {
if (randk() > 0.25) if (random() > 0.25)
{ {
return; return;
} }
@ -731,7 +731,7 @@ medic_continue(edict_t *self)
if (visible(self, self->enemy)) if (visible(self, self->enemy))
{ {
if (randk() <= 0.95) if (random() <= 0.95)
{ {
self->monsterinfo.currentmove = &medic_move_attackHyperBlaster; self->monsterinfo.currentmove = &medic_move_attackHyperBlaster;
} }

View file

@ -180,7 +180,7 @@ mutant_idle_loop(edict_t *self)
return; return;
} }
if (randk() < 0.75) if (random() < 0.75)
{ {
self->monsterinfo.nextframe = FRAME_stand155; self->monsterinfo.nextframe = FRAME_stand155;
} }
@ -377,7 +377,7 @@ mutant_check_refire(edict_t *self)
} }
if (((skill->value == 3) && if (((skill->value == 3) &&
(randk() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE))
{ {
self->monsterinfo.nextframe = FRAME_attack09; self->monsterinfo.nextframe = FRAME_attack09;
} }
@ -438,7 +438,7 @@ mutant_jump_touch(edict_t *self, edict_t *other,
VectorCopy(self->velocity, normal); VectorCopy(self->velocity, normal);
VectorNormalize(normal); VectorNormalize(normal);
VectorMA(self->s.origin, self->maxs[0], normal, point); VectorMA(self->s.origin, self->maxs[0], normal, point);
damage = 40 + 10 * randk(); damage = 40 + 10 * random();
T_Damage(other, self, self, self->velocity, point, T_Damage(other, self, self, self->velocity, point,
normal, damage, damage, 0, MOD_UNKNOWN); normal, damage, damage, 0, MOD_UNKNOWN);
} }
@ -584,7 +584,7 @@ mutant_check_jump(edict_t *self)
if (distance > 100) if (distance > 100)
{ {
if (randk() < 0.9) if (random() < 0.9)
{ {
return false; return false;
} }
@ -699,7 +699,7 @@ mutant_pain(edict_t *self, edict_t *other /* unused */,
return; /* no pain anims in nightmare */ return; /* no pain anims in nightmare */
} }
r = randk(); r = random();
if (r < 0.33) if (r < 0.33)
{ {
@ -820,7 +820,7 @@ mutant_die(edict_t *self, edict_t *inflictor /* unused */,
self->takedamage = DAMAGE_YES; self->takedamage = DAMAGE_YES;
self->s.skinnum = 1; self->s.skinnum = 1;
if (randk() < 0.5) if (random() < 0.5)
{ {
self->monsterinfo.currentmove = &mutant_move_death1; self->monsterinfo.currentmove = &mutant_move_death1;
} }

View file

@ -195,7 +195,7 @@ parasite_refidget(edict_t *self)
return; return;
} }
if (randk() <= 0.8) if (random() <= 0.8)
{ {
self->monsterinfo.currentmove = &parasite_move_fidget; self->monsterinfo.currentmove = &parasite_move_fidget;
} }
@ -457,7 +457,7 @@ parasite_pain(edict_t *self, edict_t *other /* unused */,
return; /* no pain anims in nightmare */ return; /* no pain anims in nightmare */
} }
if (randk() < 0.5) if (random() < 0.5)
{ {
gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
} }

View file

@ -48,7 +48,7 @@ soldier_idle(edict_t *self)
return; return;
} }
if (randk() > 0.8) if (random() > 0.8)
{ {
gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); 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) || if ((self->monsterinfo.currentmove == &soldier_move_stand3) ||
(randk() < 0.8)) (random() < 0.8))
{ {
self->monsterinfo.currentmove = &soldier_move_stand1; self->monsterinfo.currentmove = &soldier_move_stand1;
} }
@ -197,7 +197,7 @@ soldier_walk1_random(edict_t *self)
return; return;
} }
if (randk() > 0.1) if (random() > 0.1)
{ {
self->monsterinfo.nextframe = FRAME_walk101; self->monsterinfo.nextframe = FRAME_walk101;
} }
@ -276,7 +276,7 @@ soldier_walk(edict_t *self)
return; return;
} }
if (randk() < 0.5) if (random() < 0.5)
{ {
self->monsterinfo.currentmove = &soldier_move_walk1; 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 */ return; /* no pain anims in nightmare */
} }
r = randk(); r = random();
if (r < 0.33) if (r < 0.33)
{ {
@ -590,8 +590,8 @@ soldier_fire(edict_t *self, int flash_number)
vectoangles(aim, dir); vectoangles(aim, dir);
AngleVectors(dir, forward, right, up); AngleVectors(dir, forward, right, up);
r = crandk() * 1000; r = crandom() * 1000;
u = crandk() * 500; u = crandom() * 500;
VectorMA(start, 8192, forward, end); VectorMA(start, 8192, forward, end);
VectorMA(end, r, right, end); VectorMA(end, r, right, end);
VectorMA(end, u, up, end); VectorMA(end, u, up, end);
@ -663,7 +663,7 @@ soldier_attack1_refire1(edict_t *self)
} }
if (((skill->value == 3) && if (((skill->value == 3) &&
(randk() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE))
{ {
self->monsterinfo.nextframe = FRAME_attak102; self->monsterinfo.nextframe = FRAME_attak102;
} }
@ -692,7 +692,7 @@ soldier_attack1_refire2(edict_t *self)
} }
if (((skill->value == 3) && if (((skill->value == 3) &&
(randk() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE))
{ {
self->monsterinfo.nextframe = FRAME_attak102; self->monsterinfo.nextframe = FRAME_attak102;
} }
@ -752,7 +752,7 @@ soldier_attack2_refire1(edict_t *self)
} }
if (((skill->value == 3) && if (((skill->value == 3) &&
(randk() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE))
{ {
self->monsterinfo.nextframe = FRAME_attak204; self->monsterinfo.nextframe = FRAME_attak204;
} }
@ -781,7 +781,7 @@ soldier_attack2_refire2(edict_t *self)
} }
if (((skill->value == 3) && if (((skill->value == 3) &&
(randk() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE))
{ {
self->monsterinfo.nextframe = FRAME_attak204; self->monsterinfo.nextframe = FRAME_attak204;
} }
@ -997,7 +997,7 @@ soldier_attack(edict_t *self)
if (self->s.skinnum < 4) if (self->s.skinnum < 4)
{ {
if (randk() < 0.5) if (random() < 0.5)
{ {
self->monsterinfo.currentmove = &soldier_move_attack1; self->monsterinfo.currentmove = &soldier_move_attack1;
} }
@ -1020,7 +1020,7 @@ soldier_sight(edict_t *self, edict_t *other /* unused */)
return; return;
} }
if (randk() < 0.5) if (random() < 0.5)
{ {
gi.sound(self, CHAN_VOICE, sound_sight1, 1, ATTN_NORM, 0); 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 ((skill->value > 0) && (range(self, self->enemy) >= RANGE_MID))
{ {
if (randk() > 0.5) if (random() > 0.5)
{ {
self->monsterinfo.currentmove = &soldier_move_attack6; self->monsterinfo.currentmove = &soldier_move_attack6;
} }
@ -1082,7 +1082,7 @@ soldier_dodge(edict_t *self, edict_t *attacker, float eta)
return; return;
} }
r = randk(); r = random();
if (r > 0.25) 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; self->monsterinfo.pausetime = level.time + eta + 0.3;
r = randk(); r = random();
if (skill->value == 1) if (skill->value == 1)
{ {

View file

@ -59,7 +59,7 @@ supertank_search(edict_t *self)
return; return;
} }
if (randk() < 0.5) if (random() < 0.5)
{ {
gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NORM, 0); 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 (visible(self, self->enemy))
{ {
if (randk() < 0.9) if (random() < 0.9)
{ {
self->monsterinfo.currentmove = &supertank_move_attack1; 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 */ /* Lessen the chance of him going into his pain frames */
if (damage <= 25) if (damage <= 25)
{ {
if (randk() < 0.2) if (random() < 0.2)
{ {
return; return;
} }
@ -741,7 +741,7 @@ supertank_attack(edict_t *self)
else else
{ {
/* fire rockets more often at distance */ /* fire rockets more often at distance */
if (randk() < 0.3) if (random() < 0.3)
{ {
self->monsterinfo.currentmove = &supertank_move_attack1; self->monsterinfo.currentmove = &supertank_move_attack1;
} }

View file

@ -396,7 +396,7 @@ tank_pain(edict_t *self, edict_t *other /* other */,
if (damage <= 30) if (damage <= 30)
{ {
if (randk() > 0.2) if (random() > 0.2)
{ {
return; return;
} }
@ -649,7 +649,7 @@ tank_reattack_blaster(edict_t *self)
{ {
if (self->enemy->health > 0) if (self->enemy->health > 0)
{ {
if (randk() <= 0.6) if (random() <= 0.6)
{ {
self->monsterinfo.currentmove = &tank_move_reattack_blast; self->monsterinfo.currentmove = &tank_move_reattack_blast;
return; return;
@ -867,7 +867,7 @@ tank_refire_rocket(edict_t *self)
{ {
if (visible(self, self->enemy)) if (visible(self, self->enemy))
{ {
if (randk() <= 0.4) if (random() <= 0.4)
{ {
self->monsterinfo.currentmove = self->monsterinfo.currentmove =
&tank_move_attack_fire_rocket; &tank_move_attack_fire_rocket;
@ -913,7 +913,7 @@ tank_attack(edict_t *self)
VectorSubtract(self->enemy->s.origin, self->s.origin, vec); VectorSubtract(self->enemy->s.origin, self->s.origin, vec);
range = VectorLength(vec); range = VectorLength(vec);
r = randk(); r = random();
if (range <= 125) if (range <= 125)
{ {

View file

@ -907,7 +907,7 @@ Weapon_RocketLauncher_Fire(edict_t *ent)
return; return;
} }
damage = 100 + (int)(randk() * 20.0); damage = 100 + (int)(random() * 20.0);
radius_damage = 120; radius_damage = 120;
damage_radius = 120; damage_radius = 120;
@ -1210,11 +1210,11 @@ Machinegun_Fire(edict_t *ent)
for (i = 1; i < 3; i++) for (i = 1; i < 3; i++)
{ {
ent->client->kick_origin[i] = crandk() * 0.35; ent->client->kick_origin[i] = crandom() * 0.35;
ent->client->kick_angles[i] = crandk() * 0.7; ent->client->kick_angles[i] = crandom() * 0.7;
} }
ent->client->kick_origin[0] = crandk() * 0.35; ent->client->kick_origin[0] = crandom() * 0.35;
ent->client->kick_angles[0] = ent->client->machinegun_shots * -1.5; ent->client->kick_angles[0] = ent->client->machinegun_shots * -1.5;
/* raise the gun as it is firing */ /* 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) if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
{ {
ent->s.frame = FRAME_crattak1 - (int)(randk() + 0.25); ent->s.frame = FRAME_crattak1 - (int)(random() + 0.25);
ent->client->anim_end = FRAME_crattak9; ent->client->anim_end = FRAME_crattak9;
} }
else else
{ {
ent->s.frame = FRAME_attack1 - (int)(randk() + 0.25); ent->s.frame = FRAME_attack1 - (int)(random() + 0.25);
ent->client->anim_end = FRAME_attack8; ent->client->anim_end = FRAME_attack8;
} }
} }
@ -1397,16 +1397,16 @@ Chaingun_Fire(edict_t *ent)
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
ent->client->kick_origin[i] = crandk() * 0.35; ent->client->kick_origin[i] = crandom() * 0.35;
ent->client->kick_angles[i] = crandk() * 0.7; ent->client->kick_angles[i] = crandom() * 0.7;
} }
for (i = 0; i < shots; i++) for (i = 0; i < shots; i++)
{ {
/* get start / end positions */ /* get start / end positions */
AngleVectors(ent->client->v_angle, forward, right, up); AngleVectors(ent->client->v_angle, forward, right, up);
r = 7 + crandk() * 4; r = 7 + crandom() * 4;
u = crandk() * 4; u = crandom() * 4;
VectorSet(offset, 0, r, u + ent->viewheight - 8); VectorSet(offset, 0, r, u + ent->viewheight - 8);
P_ProjectSource(ent->client, ent->s.origin, offset, P_ProjectSource(ent->client, ent->s.origin, offset,
forward, right, start); forward, right, start);
@ -1731,7 +1731,7 @@ weapon_bfg_fire(edict_t *ent)
/* make a big pitch kick with an inverse fall */ /* make a big pitch kick with an inverse fall */
ent->client->v_dmg_pitch = -40; ent->client->v_dmg_pitch = -40;
ent->client->v_dmg_roll = crandk() * 8; ent->client->v_dmg_roll = crandom() * 8;
ent->client->v_dmg_time = level.time + DAMAGE_TIME; ent->client->v_dmg_time = level.time + DAMAGE_TIME;
VectorSet(offset, 8, 8, ent->viewheight - 8); VectorSet(offset, 8, 8, ent->viewheight - 8);