mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-31 05:10:33 +00:00
Convert rand(), crand() and frand() to randk(), crandk() and frandk()
This commit is contained in:
parent
99520d1331
commit
35e5bbb48b
34 changed files with 272 additions and 273 deletions
|
@ -66,10 +66,10 @@ void CL_AddMuzzleFlash (void) {
|
|||
VectorMA (dl->origin, 16, rv, dl->origin);
|
||||
|
||||
if (silenced)
|
||||
dl->radius = 100.0f + (rand()&31);
|
||||
dl->radius = 100.0f + (randk()&31);
|
||||
|
||||
else
|
||||
dl->radius = 200.0f + (rand()&31);
|
||||
dl->radius = 200.0f + (randk()&31);
|
||||
|
||||
dl->minlight = 32;
|
||||
dl->die = cl.time;
|
||||
|
@ -103,7 +103,7 @@ void CL_AddMuzzleFlash (void) {
|
|||
dl->color[0] = 1;
|
||||
dl->color[1] = 1;
|
||||
dl->color[2] = 0;
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (randk() % 5) + 1);
|
||||
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
|
||||
break;
|
||||
case MZ_SHOTGUN:
|
||||
|
@ -120,35 +120,35 @@ void CL_AddMuzzleFlash (void) {
|
|||
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/sshotf1b.wav"), volume, ATTN_NORM, 0);
|
||||
break;
|
||||
case MZ_CHAINGUN1:
|
||||
dl->radius = 200.0f + (rand()&31);
|
||||
dl->radius = 200.0f + (randk()&31);
|
||||
dl->color[0] = 1;
|
||||
dl->color[1] = 0.25;
|
||||
dl->color[2] = 0;
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (randk() % 5) + 1);
|
||||
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
|
||||
break;
|
||||
case MZ_CHAINGUN2:
|
||||
dl->radius = 225.0f + (rand()&31);
|
||||
dl->radius = 225.0f + (randk()&31);
|
||||
dl->color[0] = 1;
|
||||
dl->color[1] = 0.5;
|
||||
dl->color[2] = 0;
|
||||
dl->die = cl.time + 0.1; /* long delay */
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (randk() % 5) + 1);
|
||||
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (randk() % 5) + 1);
|
||||
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.05);
|
||||
break;
|
||||
case MZ_CHAINGUN3:
|
||||
dl->radius = 250.0f + (rand()&31);
|
||||
dl->radius = 250.0f + (randk()&31);
|
||||
dl->color[0] = 1;
|
||||
dl->color[1] = 1;
|
||||
dl->color[2] = 0;
|
||||
dl->die = cl.time + 0.1; /* long delay */
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (randk() % 5) + 1);
|
||||
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (randk() % 5) + 1);
|
||||
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.033f);
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
||||
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (randk() % 5) + 1);
|
||||
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.066f);
|
||||
break;
|
||||
case MZ_RAILGUN:
|
||||
|
@ -298,7 +298,7 @@ void CL_AddMuzzleFlash2 (void) {
|
|||
|
||||
dl = CL_AllocDlight (ent);
|
||||
VectorCopy (origin, dl->origin);
|
||||
dl->radius = 200.0f + (rand()&31);
|
||||
dl->radius = 200.0f + (randk()&31);
|
||||
dl->minlight = 32;
|
||||
dl->die = cl.time;
|
||||
|
||||
|
@ -481,7 +481,7 @@ void CL_AddMuzzleFlash2 (void) {
|
|||
dl->color[2] = 0;
|
||||
CL_ParticleEffect (origin, vec3_origin, 0, 40);
|
||||
CL_SmokeAndFlash(origin);
|
||||
Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + (char) (rand() % 5));
|
||||
Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + (char) (randk() % 5));
|
||||
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound(soundname), 1, ATTN_NORM, 0);
|
||||
break;
|
||||
|
||||
|
@ -681,7 +681,7 @@ void CL_AddMuzzleFlash2 (void) {
|
|||
case MZ2_WIDOW2_BEAM_SWEEP_9:
|
||||
case MZ2_WIDOW2_BEAM_SWEEP_10:
|
||||
case MZ2_WIDOW2_BEAM_SWEEP_11:
|
||||
dl->radius = 300.0f + (rand()&100);
|
||||
dl->radius = 300.0f + (randk()&100);
|
||||
dl->color[0] = 1;
|
||||
dl->color[1] = 1;
|
||||
dl->color[2] = 0;
|
||||
|
@ -709,12 +709,12 @@ void CL_TeleporterParticles (entity_state_t *ent) {
|
|||
p->color = 0xdb;
|
||||
|
||||
for (j=0 ; j<2 ; j++) {
|
||||
p->org[j] = ent->origin[j] - 16 + (rand()&31);
|
||||
p->vel[j] = crand()*14;
|
||||
p->org[j] = ent->origin[j] - 16 + (randk()&31);
|
||||
p->vel[j] = crandk()*14;
|
||||
}
|
||||
|
||||
p->org[2] = ent->origin[2] - 8 + (rand()&7);
|
||||
p->vel[2] = 80 + (rand()&7);
|
||||
p->org[2] = ent->origin[2] - 8 + (randk()&7);
|
||||
p->vel[2] = 80 + (randk()&7);
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY;
|
||||
|
@ -742,26 +742,26 @@ void CL_LogoutEffect (vec3_t org, int type) {
|
|||
p->time = time;
|
||||
|
||||
if (type == MZ_LOGIN)
|
||||
p->color = 0xd0 + (rand()&7);
|
||||
p->color = 0xd0 + (randk()&7);
|
||||
|
||||
else if (type == MZ_LOGOUT)
|
||||
p->color = 0x40 + (rand()&7);
|
||||
p->color = 0x40 + (randk()&7);
|
||||
|
||||
else
|
||||
p->color = 0xe0 + (rand()&7);
|
||||
p->color = 0xe0 + (randk()&7);
|
||||
|
||||
p->org[0] = org[0] - 16 + frand()*32;
|
||||
p->org[1] = org[1] - 16 + frand()*32;
|
||||
p->org[2] = org[2] - 24 + frand()*56;
|
||||
p->org[0] = org[0] - 16 + frandk()*32;
|
||||
p->org[1] = org[1] - 16 + frandk()*32;
|
||||
p->org[2] = org[2] - 24 + frandk()*56;
|
||||
|
||||
for (j=0 ; j<3 ; j++)
|
||||
p->vel[j] = crand()*20;
|
||||
p->vel[j] = crandk()*20;
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -1.0 / (1.0 + frand()*0.3);
|
||||
p->alphavel = -1.0 / (1.0 + frandk()*0.3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -781,19 +781,19 @@ void CL_ItemRespawnParticles (vec3_t org) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = 0xd4 + (rand()&3);
|
||||
p->org[0] = org[0] + crand()*8;
|
||||
p->org[1] = org[1] + crand()*8;
|
||||
p->org[2] = org[2] + crand()*8;
|
||||
p->color = 0xd4 + (randk()&3);
|
||||
p->org[0] = org[0] + crandk()*8;
|
||||
p->org[1] = org[1] + crandk()*8;
|
||||
p->org[2] = org[2] + crandk()*8;
|
||||
|
||||
for (j=0 ; j<3 ; j++)
|
||||
p->vel[j] = crand()*8;
|
||||
p->vel[j] = crandk()*8;
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY*0.2;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -1.0f / (1.0f + frand()*0.3f);
|
||||
p->alphavel = -1.0f / (1.0f + frandk()*0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -813,18 +813,18 @@ void CL_ExplosionParticles (vec3_t org) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = 0xe0 + (rand()&7);
|
||||
p->color = 0xe0 + (randk()&7);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = org[j] + ((rand()%32)-16);
|
||||
p->vel[j] = (rand()%384)-192;
|
||||
p->org[j] = org[j] + ((randk()%32)-16);
|
||||
p->vel[j] = (randk()%384)-192;
|
||||
}
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -0.8f / (0.5f + frand()*0.3f);
|
||||
p->alphavel = -0.8f / (0.5f + frandk()*0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -846,24 +846,24 @@ void CL_BigTeleportParticles (vec3_t org) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = colortable[rand()&3];
|
||||
p->color = colortable[randk()&3];
|
||||
|
||||
angle = M_PI*2*(rand()&1023)/1023.0f;
|
||||
dist = (float)(rand()&31);
|
||||
angle = M_PI*2*(randk()&1023)/1023.0f;
|
||||
dist = (float)(randk()&31);
|
||||
p->org[0] = org[0] + (float)cos(angle)*dist;
|
||||
p->vel[0] = (float)cos(angle)*(70+(rand()&63));
|
||||
p->vel[0] = (float)cos(angle)*(70+(randk()&63));
|
||||
p->accel[0] = -(float)cos(angle)*100;
|
||||
|
||||
p->org[1] = org[1] + (float)sin(angle)*dist;
|
||||
p->vel[1] = (float)sin(angle)*(70+(rand()&63));
|
||||
p->vel[1] = (float)sin(angle)*(70+(randk()&63));
|
||||
p->accel[1] = -(float)sin(angle)*100;
|
||||
|
||||
p->org[2] = org[2] + 8 + (rand()%90);
|
||||
p->vel[2] = -100 + (rand()&31);
|
||||
p->org[2] = org[2] + 8 + (randk()%90);
|
||||
p->vel[2] = -100 + (randk()&31);
|
||||
p->accel[2] = PARTICLE_GRAVITY*4;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -0.3f / (0.5f + frand()*0.3f);
|
||||
p->alphavel = -0.3f / (0.5f + frandk()*0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -890,19 +890,19 @@ void CL_BlasterParticles (vec3_t org, vec3_t dir) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = 0xe0 + (rand()&7);
|
||||
d = rand()&15;
|
||||
p->color = 0xe0 + (randk()&7);
|
||||
d = randk()&15;
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = org[j] + ((rand()&7)-4) + d*dir[j];
|
||||
p->vel[j] = dir[j] * 30 + crand()*40;
|
||||
p->org[j] = org[j] + ((randk()&7)-4) + d*dir[j];
|
||||
p->vel[j] = dir[j] * 30 + crandk()*40;
|
||||
}
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -1.0f / (0.5f + frand()*0.3f);
|
||||
p->alphavel = -1.0f / (0.5f + frandk()*0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -938,12 +938,12 @@ void CL_BlasterTrail (vec3_t start, vec3_t end) {
|
|||
p->time = time;
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (0.3f+frand()*0.2f);
|
||||
p->alphavel = -1.0f / (0.3f+frandk()*0.2f);
|
||||
p->color = 0xe0;
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand();
|
||||
p->vel[j] = crand()*5;
|
||||
p->org[j] = move[j] + crandk();
|
||||
p->vel[j] = crandk()*5;
|
||||
p->accel[j] = 0;
|
||||
}
|
||||
|
||||
|
@ -983,12 +983,12 @@ void CL_QuadTrail (vec3_t start, vec3_t end) {
|
|||
p->time = time;
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (0.8f+frand()*0.2f);
|
||||
p->alphavel = -1.0f / (0.8f+frandk()*0.2f);
|
||||
p->color = 115;
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand()*16;
|
||||
p->vel[j] = crand()*5;
|
||||
p->org[j] = move[j] + crandk()*16;
|
||||
p->vel[j] = crandk()*5;
|
||||
p->accel[j] = 0;
|
||||
}
|
||||
|
||||
|
@ -1028,12 +1028,12 @@ void CL_FlagTrail (vec3_t start, vec3_t end, int color) {
|
|||
p->time = time;
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (0.8f+frand()*0.2f);
|
||||
p->alphavel = -1.0f / (0.8f+frandk()*0.2f);
|
||||
p->color = color;
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand()*16;
|
||||
p->vel[j] = crand()*5;
|
||||
p->org[j] = move[j] + crandk()*16;
|
||||
p->vel[j] = crandk()*5;
|
||||
p->accel[j] = 0;
|
||||
}
|
||||
|
||||
|
@ -1080,7 +1080,7 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags) {
|
|||
return;
|
||||
|
||||
/* drop less particles as it flies */
|
||||
if ((rand()&1023) < old->trailcount) {
|
||||
if ((randk()&1023) < old->trailcount) {
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
|
@ -1091,12 +1091,12 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags) {
|
|||
|
||||
if (flags & EF_GIB) {
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1+frand()*0.4f);
|
||||
p->color = 0xe8 + (rand()&7);
|
||||
p->alphavel = -1.0f / (1+frandk()*0.4f);
|
||||
p->color = 0xe8 + (randk()&7);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand()*orgscale;
|
||||
p->vel[j] = crand()*velscale;
|
||||
p->org[j] = move[j] + crandk()*orgscale;
|
||||
p->vel[j] = crandk()*velscale;
|
||||
p->accel[j] = 0;
|
||||
}
|
||||
|
||||
|
@ -1104,12 +1104,12 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags) {
|
|||
|
||||
} else if (flags & EF_GREENGIB) {
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1+frand()*0.4f);
|
||||
p->color = 0xdb + (rand()&7);
|
||||
p->alphavel = -1.0f / (1+frandk()*0.4f);
|
||||
p->color = 0xdb + (randk()&7);
|
||||
|
||||
for (j=0; j< 3; j++) {
|
||||
p->org[j] = move[j] + crand()*orgscale;
|
||||
p->vel[j] = crand()*velscale;
|
||||
p->org[j] = move[j] + crandk()*orgscale;
|
||||
p->vel[j] = crandk()*velscale;
|
||||
p->accel[j] = 0;
|
||||
}
|
||||
|
||||
|
@ -1117,12 +1117,12 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags) {
|
|||
|
||||
} else {
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1+frand()*0.2f);
|
||||
p->color = 4 + (rand()&7);
|
||||
p->alphavel = -1.0f / (1+frandk()*0.2f);
|
||||
p->color = 4 + (randk()&7);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand()*orgscale;
|
||||
p->vel[j] = crand()*velscale;
|
||||
p->org[j] = move[j] + crandk()*orgscale;
|
||||
p->vel[j] = crandk()*velscale;
|
||||
}
|
||||
|
||||
p->accel[2] = 20;
|
||||
|
@ -1180,7 +1180,7 @@ void CL_RocketTrail (vec3_t start, vec3_t end, centity_t *old) {
|
|||
if (!free_particles)
|
||||
return;
|
||||
|
||||
if ( (rand()&7) == 0) {
|
||||
if ( (randk()&7) == 0) {
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
|
@ -1190,12 +1190,12 @@ void CL_RocketTrail (vec3_t start, vec3_t end, centity_t *old) {
|
|||
p->time = time;
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1+frand()*0.2f);
|
||||
p->color = 0xdc + (rand()&3);
|
||||
p->alphavel = -1.0f / (1+frandk()*0.2f);
|
||||
p->color = 0xdc + (randk()&3);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand()*5;
|
||||
p->vel[j] = crand()*20;
|
||||
p->org[j] = move[j] + crandk()*5;
|
||||
p->vel[j] = crandk()*20;
|
||||
}
|
||||
|
||||
p->accel[2] = -PARTICLE_GRAVITY;
|
||||
|
@ -1246,8 +1246,8 @@ void CL_RailTrail (vec3_t start, vec3_t end) {
|
|||
VectorMA (dir, s, up, dir);
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1+frand()*0.2f);
|
||||
p->color = clr + (rand()&7);
|
||||
p->alphavel = -1.0f / (1+frandk()*0.2f);
|
||||
p->color = clr + (randk()&7);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + dir[j]*3;
|
||||
|
@ -1276,12 +1276,12 @@ void CL_RailTrail (vec3_t start, vec3_t end) {
|
|||
VectorClear (p->accel);
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (0.6f+frand()*0.2f);
|
||||
p->color = 0x0 + (rand()&15);
|
||||
p->alphavel = -1.0f / (0.6f+frandk()*0.2f);
|
||||
p->color = 0x0 + (randk()&15);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand()*3;
|
||||
p->vel[j] = crand()*3;
|
||||
p->org[j] = move[j] + crandk()*3;
|
||||
p->vel[j] = crandk()*3;
|
||||
p->accel[j] = 0;
|
||||
}
|
||||
|
||||
|
@ -1321,8 +1321,8 @@ void CL_IonripperTrail (vec3_t start, vec3_t ent) {
|
|||
|
||||
p->time = time;
|
||||
p->alpha = 0.5;
|
||||
p->alphavel = -1.0f / (0.3f + frand() * 0.2f);
|
||||
p->color = 0xe4 + (rand()&3);
|
||||
p->alphavel = -1.0f / (0.3f + frandk() * 0.2f);
|
||||
p->color = 0xe4 + (randk()&3);
|
||||
|
||||
for (j=0; j<3; j++) {
|
||||
p->org[j] = move[j];
|
||||
|
@ -1375,12 +1375,12 @@ void CL_BubbleTrail (vec3_t start, vec3_t end) {
|
|||
p->time = time;
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1+frand()*0.2f);
|
||||
p->color = 4 + (rand()&7);
|
||||
p->alphavel = -1.0f / (1+frandk()*0.2f);
|
||||
p->color = 4 + (randk()&7);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand()*2;
|
||||
p->vel[j] = crand()*5;
|
||||
p->org[j] = move[j] + crandk()*2;
|
||||
p->vel[j] = crandk()*5;
|
||||
}
|
||||
|
||||
p->vel[2] += 6;
|
||||
|
@ -1406,7 +1406,7 @@ void CL_FlyParticles (vec3_t origin, int count) {
|
|||
|
||||
if (!avelocities[0][0]) {
|
||||
for (i=0 ; i<NUMVERTEXNORMALS*3 ; i++)
|
||||
avelocities[0][i] = (rand()&255) * 0.01f;
|
||||
avelocities[0][i] = (randk()&255) * 0.01f;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1495,7 +1495,7 @@ void CL_BfgParticles (entity_t *ent) {
|
|||
|
||||
if (!avelocities[0][0]) {
|
||||
for (i=0 ; i<NUMVERTEXNORMALS*3 ; i++)
|
||||
avelocities[0][i] = (rand()&255) * 0.01f;
|
||||
avelocities[0][i] = (randk()&255) * 0.01f;
|
||||
}
|
||||
|
||||
ltime = time / 1000.0;
|
||||
|
@ -1578,12 +1578,12 @@ void CL_TrapParticles (entity_t *ent) {
|
|||
p->time = time;
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (0.3f+frand()*0.2f);
|
||||
p->alphavel = -1.0f / (0.3f+frandk()*0.2f);
|
||||
p->color = 0xe0;
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand();
|
||||
p->vel[j] = crand()*15;
|
||||
p->org[j] = move[j] + crandk();
|
||||
p->vel[j] = crandk()*15;
|
||||
p->accel[j] = 0;
|
||||
}
|
||||
|
||||
|
@ -1614,20 +1614,20 @@ void CL_TrapParticles (entity_t *ent) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = 0xe0 + (rand()&3);
|
||||
p->color = 0xe0 + (randk()&3);
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (0.3f + (rand()&7) * 0.02f);
|
||||
p->alphavel = -1.0f / (0.3f + (randk()&7) * 0.02f);
|
||||
|
||||
p->org[0] = org[0] + i + ((rand()&23) * crand());
|
||||
p->org[1] = org[1] + j + ((rand()&23) * crand());
|
||||
p->org[2] = org[2] + k + ((rand()&23) * crand());
|
||||
p->org[0] = org[0] + i + ((randk()&23) * crandk());
|
||||
p->org[1] = org[1] + j + ((randk()&23) * crandk());
|
||||
p->org[2] = org[2] + k + ((randk()&23) * crandk());
|
||||
|
||||
dir[0] = j * 8.0f;
|
||||
dir[1] = i * 8.0f;
|
||||
dir[2] = k * 8.0f;
|
||||
|
||||
VectorNormalize (dir);
|
||||
vel = (float)(50 + (rand()&63));
|
||||
vel = (float)(50 + (randk()&63));
|
||||
VectorScale (dir, vel, p->vel);
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
|
@ -1652,18 +1652,18 @@ void CL_BFGExplosionParticles (vec3_t org) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = 0xd0 + (rand()&7);
|
||||
p->color = 0xd0 + (randk()&7);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = org[j] + ((rand()%32)-16);
|
||||
p->vel[j] = (rand()%384)-192;
|
||||
p->org[j] = org[j] + ((randk()%32)-16);
|
||||
p->vel[j] = (randk()%384)-192;
|
||||
}
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -0.8f / (0.5f + frand()*0.3f);
|
||||
p->alphavel = -0.8f / (0.5f + frandk()*0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1687,20 +1687,20 @@ void CL_TeleportParticles (vec3_t org) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = 7 + (rand()&7);
|
||||
p->color = 7 + (randk()&7);
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (0.3f + (rand()&7) * 0.02f);
|
||||
p->alphavel = -1.0f / (0.3f + (randk()&7) * 0.02f);
|
||||
|
||||
p->org[0] = org[0] + i + (rand()&3);
|
||||
p->org[1] = org[1] + j + (rand()&3);
|
||||
p->org[2] = org[2] + k + (rand()&3);
|
||||
p->org[0] = org[0] + i + (randk()&3);
|
||||
p->org[1] = org[1] + j + (randk()&3);
|
||||
p->org[2] = org[2] + k + (randk()&3);
|
||||
|
||||
dir[0] = j*8.0f;
|
||||
dir[1] = i*8.0f;
|
||||
dir[2] = k*8.0f;
|
||||
|
||||
VectorNormalize (dir);
|
||||
vel = (float)(50 + (rand()&63));
|
||||
vel = (float)(50 + (randk()&63));
|
||||
VectorScale (dir, vel, p->vel);
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
|
@ -1727,7 +1727,7 @@ void CL_EntityEvent (entity_state_t *ent) {
|
|||
case EV_FOOTSTEP:
|
||||
|
||||
if (cl_footsteps->value)
|
||||
S_StartSound (NULL, ent->number, CHAN_BODY, cl_sfx_footsteps[rand()&3], 1, ATTN_NORM, 0);
|
||||
S_StartSound (NULL, ent->number, CHAN_BODY, cl_sfx_footsteps[randk()&3], 1, ATTN_NORM, 0);
|
||||
|
||||
break;
|
||||
case EV_FALLSHORT:
|
||||
|
@ -1815,7 +1815,7 @@ void CL_DebugTrail (vec3_t start, vec3_t end) {
|
|||
VectorClear (p->vel);
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -0.1f;
|
||||
p->color = 0x74 + (rand()&7);
|
||||
p->color = 0x74 + (randk()&7);
|
||||
VectorCopy (move, p->org);
|
||||
VectorAdd (move, vec, move);
|
||||
}
|
||||
|
@ -1852,15 +1852,15 @@ void CL_SmokeTrail (vec3_t start, vec3_t end, int colorStart, int colorRun, int
|
|||
p->time = time;
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1+frand()*0.5f);
|
||||
p->color = colorStart + (float)(rand() % colorRun);
|
||||
p->alphavel = -1.0f / (1+frandk()*0.5f);
|
||||
p->color = colorStart + (float)(randk() % colorRun);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand()*3;
|
||||
p->org[j] = move[j] + crandk()*3;
|
||||
p->accel[j] = 0;
|
||||
}
|
||||
|
||||
p->vel[2] = 20 + crand()*5;
|
||||
p->vel[2] = 20 + crandk()*5;
|
||||
|
||||
VectorAdd (move, vec, move);
|
||||
}
|
||||
|
@ -1888,7 +1888,7 @@ void CL_ForceWall (vec3_t start, vec3_t end, int color8) {
|
|||
if (!free_particles)
|
||||
return;
|
||||
|
||||
if (frand() > 0.3) {
|
||||
if (frandk() > 0.3) {
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
|
@ -1898,17 +1898,17 @@ void CL_ForceWall (vec3_t start, vec3_t end, int color8) {
|
|||
p->time = time;
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (3.0+frand()*0.5f);
|
||||
p->alphavel = -1.0f / (3.0+frandk()*0.5f);
|
||||
p->color = color8;
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand()*3;
|
||||
p->org[j] = move[j] + crandk()*3;
|
||||
p->accel[j] = 0;
|
||||
}
|
||||
|
||||
p->vel[0] = 0;
|
||||
p->vel[1] = 0;
|
||||
p->vel[2] = -40 - (crand()*10);
|
||||
p->vel[2] = -40 - (crandk()*10);
|
||||
}
|
||||
|
||||
VectorAdd (move, vec, move);
|
||||
|
@ -1947,12 +1947,12 @@ void CL_BubbleTrail2 (vec3_t start, vec3_t end, int dist) {
|
|||
p->time = time;
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1+frand()*0.1f);
|
||||
p->color = 4 + (rand()&7);
|
||||
p->alphavel = -1.0f / (1+frandk()*0.1f);
|
||||
p->color = 4 + (randk()&7);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand()*2;
|
||||
p->vel[j] = crand()*10;
|
||||
p->org[j] = move[j] + crandk()*2;
|
||||
p->vel[j] = crandk()*10;
|
||||
}
|
||||
|
||||
p->org[2] -= 4;
|
||||
|
@ -2035,7 +2035,7 @@ void CL_Heatbeam (vec3_t start, vec3_t forward) {
|
|||
|
||||
p->alpha = 0.5;
|
||||
p->alphavel = -1000.0;
|
||||
p->color = 223 - (rand()&7);
|
||||
p->color = 223 - (randk()&7);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + dir[j]*3;
|
||||
|
@ -2069,23 +2069,23 @@ void CL_ParticleSteamEffect (vec3_t org, vec3_t dir, int color, int count, int m
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = color + (rand()&7);
|
||||
p->color = color + (randk()&7);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = org[j] + magnitude*0.1f*crand();
|
||||
p->org[j] = org[j] + magnitude*0.1f*crandk();
|
||||
}
|
||||
|
||||
VectorScale (dir, magnitude, p->vel);
|
||||
d = crand()*magnitude/3;
|
||||
d = crandk()*magnitude/3;
|
||||
VectorMA (p->vel, d, r, p->vel);
|
||||
d = crand()*magnitude/3;
|
||||
d = crandk()*magnitude/3;
|
||||
VectorMA (p->vel, d, u, p->vel);
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY/2;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -1.0f / (0.5f + frand()*0.3f);
|
||||
p->alphavel = -1.0f / (0.5f + frandk()*0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2109,23 +2109,23 @@ void CL_ParticleSteamEffect2 (cl_sustain_t *self) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = cl.time;
|
||||
p->color = self->color + (rand()&7);
|
||||
p->color = self->color + (randk()&7);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = self->org[j] + self->magnitude*0.1*crand();
|
||||
p->org[j] = self->org[j] + self->magnitude*0.1*crandk();
|
||||
}
|
||||
|
||||
VectorScale (dir, self->magnitude, p->vel);
|
||||
d = crand()*self->magnitude/3;
|
||||
d = crandk()*self->magnitude/3;
|
||||
VectorMA (p->vel, d, r, p->vel);
|
||||
d = crand()*self->magnitude/3;
|
||||
d = crandk()*self->magnitude/3;
|
||||
VectorMA (p->vel, d, u, p->vel);
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY/2;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -1.0 / (0.5 + frand()*0.3);
|
||||
p->alphavel = -1.0 / (0.5 + frandk()*0.3);
|
||||
}
|
||||
|
||||
self->nextthink += self->thinkinterval;
|
||||
|
@ -2208,9 +2208,9 @@ void CL_Tracker_Shell(vec3_t origin) {
|
|||
p->alpha = 1.0;
|
||||
p->alphavel = INSTANT_PARTICLE;
|
||||
p->color = 0;
|
||||
dir[0] = crand();
|
||||
dir[1] = crand();
|
||||
dir[2] = crand();
|
||||
dir[0] = crandk();
|
||||
dir[1] = crandk();
|
||||
dir[2] = crandk();
|
||||
VectorNormalize(dir);
|
||||
|
||||
VectorMA(origin, 40, dir, p->org);
|
||||
|
@ -2240,9 +2240,9 @@ void CL_MonsterPlasma_Shell(vec3_t origin) {
|
|||
p->alpha = 1.0;
|
||||
p->alphavel = INSTANT_PARTICLE;
|
||||
p->color = 0xe0;
|
||||
dir[0] = crand();
|
||||
dir[1] = crand();
|
||||
dir[2] = crand();
|
||||
dir[0] = crandk();
|
||||
dir[1] = crandk();
|
||||
dir[2] = crandk();
|
||||
VectorNormalize(dir);
|
||||
|
||||
VectorMA(origin, 10, dir, p->org);
|
||||
|
@ -2274,10 +2274,10 @@ void CL_Widowbeamout (cl_sustain_t *self) {
|
|||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = INSTANT_PARTICLE;
|
||||
p->color = colortable[rand()&3];
|
||||
dir[0] = crand();
|
||||
dir[1] = crand();
|
||||
dir[2] = crand();
|
||||
p->color = colortable[randk()&3];
|
||||
dir[0] = crandk();
|
||||
dir[1] = crandk();
|
||||
dir[2] = crandk();
|
||||
VectorNormalize(dir);
|
||||
|
||||
VectorMA(self->org, (45.0 * ratio), dir, p->org);
|
||||
|
@ -2309,10 +2309,10 @@ void CL_Nukeblast (cl_sustain_t *self) {
|
|||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = INSTANT_PARTICLE;
|
||||
p->color = colortable[rand()&3];
|
||||
dir[0] = crand();
|
||||
dir[1] = crand();
|
||||
dir[2] = crand();
|
||||
p->color = colortable[randk()&3];
|
||||
dir[0] = crandk();
|
||||
dir[1] = crandk();
|
||||
dir[2] = crandk();
|
||||
VectorNormalize(dir);
|
||||
|
||||
VectorMA(self->org, (200.0 * ratio), dir, p->org);
|
||||
|
@ -2338,10 +2338,10 @@ void CL_WidowSplash (vec3_t org) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = colortable[rand()&3];
|
||||
dir[0] = crand();
|
||||
dir[1] = crand();
|
||||
dir[2] = crand();
|
||||
p->color = colortable[randk()&3];
|
||||
dir[0] = crandk();
|
||||
dir[1] = crandk();
|
||||
dir[2] = crandk();
|
||||
VectorNormalize(dir);
|
||||
VectorMA(org, 45.0, dir, p->org);
|
||||
VectorMA(vec3_origin, 40.0, dir, p->vel);
|
||||
|
@ -2349,7 +2349,7 @@ void CL_WidowSplash (vec3_t org) {
|
|||
p->accel[0] = p->accel[1] = 0;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -0.8f / (0.5f + frand()*0.3f);
|
||||
p->alphavel = -0.8f / (0.5f + frandk()*0.3f);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2377,9 +2377,9 @@ void CL_Tracker_Explode(vec3_t origin) {
|
|||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0;
|
||||
p->color = 0;
|
||||
dir[0] = crand();
|
||||
dir[1] = crand();
|
||||
dir[2] = crand();
|
||||
dir[0] = crandk();
|
||||
dir[1] = crandk();
|
||||
dir[2] = crandk();
|
||||
VectorNormalize(dir);
|
||||
VectorScale(dir, -1, backdir);
|
||||
|
||||
|
@ -2422,12 +2422,12 @@ void CL_TagTrail (vec3_t start, vec3_t end, int color) {
|
|||
p->time = time;
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (0.8f+frand()*0.2f);
|
||||
p->alphavel = -1.0f / (0.8f+frandk()*0.2f);
|
||||
p->color = color;
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand()*16;
|
||||
p->vel[j] = crand()*5;
|
||||
p->org[j] = move[j] + crandk()*16;
|
||||
p->vel[j] = crandk()*5;
|
||||
p->accel[j] = 0;
|
||||
}
|
||||
|
||||
|
@ -2453,18 +2453,18 @@ void CL_ColorExplosionParticles (vec3_t org, int color, int run) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = color + (rand() % run);
|
||||
p->color = color + (randk() % run);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = org[j] + ((rand()%32)-16);
|
||||
p->vel[j] = (rand()%256)-128;
|
||||
p->org[j] = org[j] + ((randk()%32)-16);
|
||||
p->vel[j] = (randk()%256)-128;
|
||||
}
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -0.4f / (0.6f + frand()*0.2f);
|
||||
p->alphavel = -0.4f / (0.6f + frandk()*0.2f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2492,22 +2492,22 @@ void CL_ParticleSmokeEffect (vec3_t org, vec3_t dir, int color, int count, int m
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = color + (rand()&7);
|
||||
p->color = color + (randk()&7);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = org[j] + magnitude*0.1f*crand();
|
||||
p->org[j] = org[j] + magnitude*0.1f*crandk();
|
||||
}
|
||||
|
||||
VectorScale (dir, magnitude, p->vel);
|
||||
d = crand()*magnitude/3;
|
||||
d = crandk()*magnitude/3;
|
||||
VectorMA (p->vel, d, r, p->vel);
|
||||
d = crand()*magnitude/3;
|
||||
d = crandk()*magnitude/3;
|
||||
VectorMA (p->vel, d, u, p->vel);
|
||||
|
||||
p->accel[0] = p->accel[1] = p->accel[2] = 0;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -1.0f / (0.5f + frand()*0.3f);
|
||||
p->alphavel = -1.0f / (0.5f + frandk()*0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2535,19 +2535,19 @@ void CL_BlasterParticles2 (vec3_t org, vec3_t dir, unsigned int color) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = color + (rand()&7);
|
||||
d = (float)(rand()&15);
|
||||
p->color = color + (randk()&7);
|
||||
d = (float)(randk()&15);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = org[j] + ((rand()&7)-4) + d*dir[j];
|
||||
p->vel[j] = dir[j] * 30 + crand()*40;
|
||||
p->org[j] = org[j] + ((randk()&7)-4) + d*dir[j];
|
||||
p->vel[j] = dir[j] * 30 + crandk()*40;
|
||||
}
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -1.0f / (0.5f + frand()*0.3f);
|
||||
p->alphavel = -1.0f / (0.5f + frandk()*0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2587,11 +2587,11 @@ void CL_BlasterTrail2 (vec3_t start, vec3_t end) {
|
|||
p->time = time;
|
||||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (float)(0.3f+frand()*0.2f);
|
||||
p->alphavel = -1.0f / (float)(0.3f+frandk()*0.2f);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = move[j] + crand();
|
||||
p->vel[j] = crand()*5;
|
||||
p->org[j] = move[j] + crandk();
|
||||
p->vel[j] = crandk()*5;
|
||||
p->accel[j] = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ void CL_AddPacketEntities (frame_t *frame) {
|
|||
if ( renderfx & RF_BEAM ) {
|
||||
/* the four beam colors are encoded in 32 bits of skinnum (hack) */
|
||||
ent.alpha = 0.30f;
|
||||
ent.skinnum = (s1->skinnum >> ((rand() % 4)*8)) & 0xff;
|
||||
ent.skinnum = (s1->skinnum >> ((randk() % 4)*8)) & 0xff;
|
||||
ent.model = NULL;
|
||||
|
||||
} else {
|
||||
|
@ -451,7 +451,7 @@ void CL_AddPacketEntities (frame_t *frame) {
|
|||
} else if (effects & EF_TRAP) {
|
||||
ent.origin[2] += 32;
|
||||
CL_TrapParticles (&ent);
|
||||
i = (rand()%100) + 100;
|
||||
i = (randk()%100) + 100;
|
||||
V_AddLight (ent.origin, i, 1, 0.8f, 0.1f);
|
||||
|
||||
} else if (effects & EF_FLAG1) {
|
||||
|
|
|
@ -57,19 +57,19 @@ void CL_ParticleEffect (vec3_t org, vec3_t dir, int color, int count) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = cl.time;
|
||||
p->color = color + (rand()&7);
|
||||
d = rand()&31;
|
||||
p->color = color + (randk()&7);
|
||||
d = randk()&31;
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = org[j] + ((rand()&7)-4) + d*dir[j];
|
||||
p->vel[j] = crand()*20;
|
||||
p->org[j] = org[j] + ((randk()&7)-4) + d*dir[j];
|
||||
p->vel[j] = crandk()*20;
|
||||
}
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY+0.2f;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -1.0 / (0.5 + frand()*0.3);
|
||||
p->alphavel = -1.0 / (0.5 + frandk()*0.3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,20 +90,20 @@ void CL_ParticleEffect2 (vec3_t org, vec3_t dir, int color, int count) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = color + (rand()&7);
|
||||
p->color = color + (randk()&7);
|
||||
|
||||
d = rand()&7;
|
||||
d = randk()&7;
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = org[j] + ((rand()&7)-4) + d*dir[j];
|
||||
p->vel[j] = crand()*20;
|
||||
p->org[j] = org[j] + ((randk()&7)-4) + d*dir[j];
|
||||
p->vel[j] = crandk()*20;
|
||||
}
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -1.0f / (0.5f + frand()*0.3f);
|
||||
p->alphavel = -1.0f / (0.5f + frandk()*0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,18 +126,18 @@ void CL_ParticleEffect3 (vec3_t org, vec3_t dir, int color, int count) {
|
|||
p->time = time;
|
||||
p->color = color;
|
||||
|
||||
d = rand()&7;
|
||||
d = randk()&7;
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = org[j] + ((rand()&7)-4) + d*dir[j];
|
||||
p->vel[j] = crand()*20;
|
||||
p->org[j] = org[j] + ((randk()&7)-4) + d*dir[j];
|
||||
p->vel[j] = crandk()*20;
|
||||
}
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = PARTICLE_GRAVITY;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -1.0f / (0.5f + frand()*0.3f);
|
||||
p->alphavel = -1.0f / (0.5f + frandk()*0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,22 +221,22 @@ void CL_GenericParticleEffect (vec3_t org, vec3_t dir, int color, int count, int
|
|||
p->time = time;
|
||||
|
||||
if (numcolors > 1)
|
||||
p->color = color + (rand() & numcolors);
|
||||
p->color = color + (randk() & numcolors);
|
||||
|
||||
else
|
||||
p->color = color;
|
||||
|
||||
d = (float)(rand() & dirspread);
|
||||
d = (float)(randk() & dirspread);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = org[j] + ((rand()&7)-4) + d*dir[j];
|
||||
p->vel[j] = crand()*20;
|
||||
p->org[j] = org[j] + ((randk()&7)-4) + d*dir[j];
|
||||
p->vel[j] = crandk()*20;
|
||||
}
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
p->accel[2] = -PARTICLE_GRAVITY;
|
||||
p->alpha = 1.0;
|
||||
|
||||
p->alphavel = -1.0f / (0.5f + frand()*alphavel);
|
||||
p->alphavel = -1.0f / (0.5f + frandk()*alphavel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -434,7 +434,7 @@ void CL_ParseLaser (int colors) {
|
|||
VectorCopy (start, l->ent.origin);
|
||||
VectorCopy (end, l->ent.oldorigin);
|
||||
l->ent.alpha = 0.30f;
|
||||
l->ent.skinnum = (colors >> ((rand() % 4)*8)) & 0xff;
|
||||
l->ent.skinnum = (colors >> ((randk() % 4)*8)) & 0xff;
|
||||
l->ent.model = NULL;
|
||||
l->ent.frame = 4;
|
||||
l->endtime = cl.time + 100;
|
||||
|
@ -592,7 +592,7 @@ void CL_ParseTEnt (void) {
|
|||
if (type != TE_SPARKS) {
|
||||
CL_SmokeAndFlash(pos);
|
||||
/* impact sound */
|
||||
cnt = rand()&15;
|
||||
cnt = randk()&15;
|
||||
|
||||
if (cnt == 1)
|
||||
S_StartSound (pos, 0, 0, cl_sfx_ric1, 1, ATTN_NORM, 0);
|
||||
|
@ -642,7 +642,7 @@ void CL_ParseTEnt (void) {
|
|||
CL_ParticleEffect (pos, dir, color, cnt);
|
||||
|
||||
if (r == SPLASH_SPARKS) {
|
||||
r = rand() & 3;
|
||||
r = randk() & 3;
|
||||
|
||||
if (r == 0)
|
||||
S_StartSound (pos, 0, 0, cl_sfx_spark5, 1, ATTN_STATIC, 0);
|
||||
|
@ -725,7 +725,7 @@ void CL_ParseTEnt (void) {
|
|||
ex->ent.model = cl_mod_explo4;
|
||||
ex->frames = 19;
|
||||
ex->baseframe = 30;
|
||||
ex->ent.angles[1] = (float)(rand() % 360);
|
||||
ex->ent.angles[1] = (float)(randk() % 360);
|
||||
EXPLOSION_PARTICLES (pos);
|
||||
|
||||
if (type == TE_GRENADE_EXPLOSION_WATER)
|
||||
|
@ -747,10 +747,10 @@ void CL_ParseTEnt (void) {
|
|||
ex->lightcolor[0] = 1.0;
|
||||
ex->lightcolor[1] = 0.5;
|
||||
ex->lightcolor[2] = 0.5;
|
||||
ex->ent.angles[1] = (float)(rand() % 360);
|
||||
ex->ent.angles[1] = (float)(randk() % 360);
|
||||
ex->ent.model = cl_mod_explo4;
|
||||
|
||||
if (frand() < 0.5)
|
||||
if (frandk() < 0.5)
|
||||
ex->baseframe = 15;
|
||||
|
||||
ex->frames = 15;
|
||||
|
@ -773,7 +773,7 @@ void CL_ParseTEnt (void) {
|
|||
ex->lightcolor[0] = 1.0;
|
||||
ex->lightcolor[1] = 0.5;
|
||||
ex->lightcolor[2] = 0.5;
|
||||
ex->ent.angles[1] = (float)(rand() % 360);
|
||||
ex->ent.angles[1] = (float)(randk() % 360);
|
||||
|
||||
if (type != TE_EXPLOSION1_BIG)
|
||||
ex->ent.model = cl_mod_explo4;
|
||||
|
@ -781,7 +781,7 @@ void CL_ParseTEnt (void) {
|
|||
else
|
||||
ex->ent.model = cl_mod_explo4_big;
|
||||
|
||||
if (frand() < 0.5)
|
||||
if (frandk() < 0.5)
|
||||
ex->baseframe = 15;
|
||||
|
||||
ex->frames = 15;
|
||||
|
@ -856,7 +856,7 @@ void CL_ParseTEnt (void) {
|
|||
ex->type = ex_flash;
|
||||
ex->ent.flags = RF_BEAM;
|
||||
ex->start = cl.frame.servertime - 0.1f;
|
||||
ex->light = 100 + (float)(rand()%75);
|
||||
ex->light = 100 + (float)(randk()%75);
|
||||
ex->lightcolor[0] = 1.0f;
|
||||
ex->lightcolor[1] = 1.0f;
|
||||
ex->lightcolor[2] = 0.3f;
|
||||
|
@ -956,10 +956,10 @@ void CL_ParseTEnt (void) {
|
|||
ex->lightcolor[0] = 1.0;
|
||||
ex->lightcolor[1] = 0.5;
|
||||
ex->lightcolor[2] = 0.5;
|
||||
ex->ent.angles[1] = rand() % 360;
|
||||
ex->ent.angles[1] = randk() % 360;
|
||||
ex->ent.model = cl_mod_explo4;
|
||||
|
||||
if (frand() < 0.5)
|
||||
if (frandk() < 0.5)
|
||||
ex->baseframe = 15;
|
||||
|
||||
ex->frames = 15;
|
||||
|
@ -1158,7 +1158,7 @@ void CL_AddBeams (void) {
|
|||
ent.flags = RF_FULLBRIGHT;
|
||||
ent.angles[0] = pitch;
|
||||
ent.angles[1] = yaw;
|
||||
ent.angles[2] = (float)(rand()%360);
|
||||
ent.angles[2] = (float)(randk()%360);
|
||||
V_AddEntity (&ent);
|
||||
return;
|
||||
}
|
||||
|
@ -1171,12 +1171,12 @@ void CL_AddBeams (void) {
|
|||
ent.flags = RF_FULLBRIGHT;
|
||||
ent.angles[0] = -pitch;
|
||||
ent.angles[1] = yaw + 180.0f;
|
||||
ent.angles[2] = (float)(rand()%360);
|
||||
ent.angles[2] = (float)(randk()%360);
|
||||
|
||||
} else {
|
||||
ent.angles[0] = pitch;
|
||||
ent.angles[1] = yaw;
|
||||
ent.angles[2] = (float)(rand()%360);
|
||||
ent.angles[2] = (float)(randk()%360);
|
||||
}
|
||||
|
||||
V_AddEntity (&ent);
|
||||
|
@ -1377,7 +1377,7 @@ void CL_AddPlayerBeams (void) {
|
|||
ent.flags = RF_FULLBRIGHT;
|
||||
ent.angles[0] = pitch;
|
||||
ent.angles[1] = yaw;
|
||||
ent.angles[2] = (float)(rand()%360);
|
||||
ent.angles[2] = (float)(randk()%360);
|
||||
V_AddEntity (&ent);
|
||||
return;
|
||||
}
|
||||
|
@ -1397,12 +1397,12 @@ void CL_AddPlayerBeams (void) {
|
|||
ent.flags = RF_FULLBRIGHT;
|
||||
ent.angles[0] = -pitch;
|
||||
ent.angles[1] = yaw + 180.0f;
|
||||
ent.angles[2] = (float)(rand()%360);
|
||||
ent.angles[2] = (float)(randk()%360);
|
||||
|
||||
} else {
|
||||
ent.angles[0] = pitch;
|
||||
ent.angles[1] = yaw;
|
||||
ent.angles[2] = (float)(rand()%360);
|
||||
ent.angles[2] = (float)(randk()%360);
|
||||
}
|
||||
|
||||
V_AddEntity (&ent);
|
||||
|
|
|
@ -133,7 +133,6 @@ OGG_Init ( void )
|
|||
/* Initialize variables. */
|
||||
if ( ogg_first_init )
|
||||
{
|
||||
srand( time( NULL ) );
|
||||
ogg_buffer = NULL;
|
||||
ogg_curfile = -1;
|
||||
ogg_info = NULL;
|
||||
|
@ -559,7 +558,7 @@ OGG_Sequence ( void )
|
|||
|
||||
else if ( strcmp( ogg_sequence->string, "random" ) == 0 )
|
||||
{
|
||||
OGG_Open( ABS, rand() % ogg_numfiles );
|
||||
OGG_Open( ABS, randk() % ogg_numfiles );
|
||||
}
|
||||
|
||||
else if ( strcmp( ogg_sequence->string, "loop" ) == 0 )
|
||||
|
@ -694,7 +693,7 @@ OGG_ParseCmd ( char *arg )
|
|||
OGG_Open( ABS, n );
|
||||
break;
|
||||
case '?':
|
||||
OGG_Open( ABS, rand() % ogg_numfiles );
|
||||
OGG_Open( ABS, randk() % ogg_numfiles );
|
||||
break;
|
||||
case '>':
|
||||
|
||||
|
|
|
@ -766,7 +766,7 @@ M_CheckAttack(edict_t *self)
|
|||
if (enemy_range == RANGE_MELEE)
|
||||
{
|
||||
/* don't always melee in easy mode */
|
||||
if ((skill->value == 0) && (rand() & 3))
|
||||
if ((skill->value == 0) && (randk() & 3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ DoRespawn(edict_t *ent)
|
|||
{
|
||||
}
|
||||
|
||||
choice = rand() % count;
|
||||
choice = randk() % count;
|
||||
|
||||
for (count = 0, ent = master; count < choice; ent = ent->chain, count++)
|
||||
{
|
||||
|
@ -1301,13 +1301,13 @@ Drop_Item(edict_t *ent, gitem_t *item)
|
|||
dropped->s.effects = item->world_model_flags;
|
||||
dropped->s.renderfx = RF_GLOW;
|
||||
|
||||
if (rand() > 0.5)
|
||||
if (randk() > 0.5)
|
||||
{
|
||||
dropped->s.angles[1] += rand()*45;
|
||||
dropped->s.angles[1] += randk()*45;
|
||||
}
|
||||
else
|
||||
{
|
||||
dropped->s.angles[1] -= rand()*45;
|
||||
dropped->s.angles[1] -= randk()*45;
|
||||
}
|
||||
|
||||
VectorSet (dropped->mins, -16, -16, -16);
|
||||
|
|
|
@ -312,7 +312,7 @@ ThrowClientHead(edict_t *self, int damage)
|
|||
return;
|
||||
}
|
||||
|
||||
if (rand() & 1)
|
||||
if (randk() & 1)
|
||||
{
|
||||
gibname = "models/objects/gibs/head2/tris.md2";
|
||||
self->s.skinnum = 1; /* second skin is player */
|
||||
|
@ -1681,7 +1681,7 @@ SP_misc_banner(edict_t *ent)
|
|||
ent->movetype = MOVETYPE_NONE;
|
||||
ent->solid = SOLID_NOT;
|
||||
ent->s.modelindex = gi.modelindex("models/objects/banner/tris.md2");
|
||||
ent->s.frame = rand() % 16;
|
||||
ent->s.frame = randk() % 16;
|
||||
gi.linkentity(ent);
|
||||
|
||||
ent->think = misc_banner_think;
|
||||
|
|
|
@ -816,7 +816,7 @@ monster_start(edict_t *self)
|
|||
if (self->monsterinfo.currentmove)
|
||||
{
|
||||
self->s.frame = self->monsterinfo.currentmove->firstframe +
|
||||
(rand() % (self->monsterinfo.currentmove->lastframe -
|
||||
(randk() % (self->monsterinfo.currentmove->lastframe -
|
||||
self->monsterinfo.currentmove->firstframe + 1));
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ G_PickTarget(char *targetname)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return choice[rand() % num_choices];
|
||||
return choice[randk() % num_choices];
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -779,7 +779,7 @@ rocket_touch(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
|
|||
if ((surf) && !(surf->flags &
|
||||
(SURF_WARP | SURF_TRANS33 | SURF_TRANS66 | SURF_FLOWING)))
|
||||
{
|
||||
n = rand() % 5;
|
||||
n = randk() % 5;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
|
|
|
@ -487,7 +487,7 @@ 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() ((rand() & 0x7fff) / ((float)0x7fff))
|
||||
#define random() ((randk() & 0x7fff) / ((float)0x7fff))
|
||||
#define crandom() (2.0 * (random() - 0.5))
|
||||
|
||||
extern cvar_t *maxentities;
|
||||
|
|
|
@ -215,7 +215,7 @@ berserk_attack_spike(edict_t *self)
|
|||
return;
|
||||
}
|
||||
|
||||
fire_hit(self, aim, (15 + (rand() % 6)), 400); /* Faster attack -- upwards and backwards */
|
||||
fire_hit(self, aim, (15 + (randk() % 6)), 400); /* Faster attack -- upwards and backwards */
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -259,7 +259,7 @@ berserk_attack_club(edict_t *self)
|
|||
}
|
||||
|
||||
VectorSet(aim, MELEE_DISTANCE, self->mins[0], -4);
|
||||
fire_hit(self, aim, (5 + (rand() % 6)), 400); /* Slower attack */
|
||||
fire_hit(self, aim, (5 + (randk() % 6)), 400); /* Slower attack */
|
||||
}
|
||||
|
||||
mframe_t berserk_frames_attack_club[] = {
|
||||
|
@ -325,7 +325,7 @@ berserk_melee(edict_t *self)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((rand() % 2) == 0)
|
||||
if ((randk() % 2) == 0)
|
||||
{
|
||||
self->monsterinfo.currentmove = &berserk_move_attack_spike;
|
||||
}
|
||||
|
|
|
@ -457,7 +457,7 @@ brain_hit_right(edict_t *self)
|
|||
|
||||
VectorSet(aim, MELEE_DISTANCE, self->maxs[0], 8);
|
||||
|
||||
if (fire_hit(self, aim, (15 + (rand() % 5)), 40))
|
||||
if (fire_hit(self, aim, (15 + (randk() % 5)), 40))
|
||||
{
|
||||
gi.sound(self, CHAN_WEAPON, sound_melee3, 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ brain_hit_left(edict_t *self)
|
|||
|
||||
VectorSet(aim, MELEE_DISTANCE, self->mins[0], 8);
|
||||
|
||||
if (fire_hit(self, aim, (15 + (rand() % 5)), 40))
|
||||
if (fire_hit(self, aim, (15 + (randk() % 5)), 40))
|
||||
{
|
||||
gi.sound(self, CHAN_WEAPON, sound_melee3, 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ brain_tentacle_attack(edict_t *self)
|
|||
|
||||
VectorSet(aim, MELEE_DISTANCE, 0, 8);
|
||||
|
||||
if (fire_hit(self, aim, (10 + (rand() % 5)), -600) && (skill->value > 0))
|
||||
if (fire_hit(self, aim, (10 + (randk() % 5)), -600) && (skill->value > 0))
|
||||
{
|
||||
self->spawnflags |= 65536;
|
||||
}
|
||||
|
|
|
@ -518,7 +518,7 @@ chick_die(edict_t *self, edict_t *inflictor /* unused */,
|
|||
self->deadflag = DEAD_DEAD;
|
||||
self->takedamage = DAMAGE_YES;
|
||||
|
||||
n = rand() % 2;
|
||||
n = randk() % 2;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
|
@ -635,7 +635,7 @@ ChickSlash(edict_t *self)
|
|||
|
||||
VectorSet(aim, MELEE_DISTANCE, self->mins[0], 10);
|
||||
gi.sound(self, CHAN_WEAPON, sound_melee_swing, 1, ATTN_NORM, 0);
|
||||
fire_hit(self, aim, (10 + (rand() % 6)), 100);
|
||||
fire_hit(self, aim, (10 + (randk() % 6)), 100);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -339,7 +339,7 @@ flipper_pain(edict_t *self, edict_t *other /* unused */,
|
|||
return; /* no pain anims in nightmare */
|
||||
}
|
||||
|
||||
n = (rand() + 1) % 2;
|
||||
n = (randk() + 1) % 2;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
|
|
|
@ -633,7 +633,7 @@ floater_wham(edict_t *self)
|
|||
static vec3_t aim = {MELEE_DISTANCE, 0, 0};
|
||||
|
||||
gi.sound(self, CHAN_WEAPON, sound_attack3, 1, ATTN_NORM, 0);
|
||||
fire_hit(self, aim, 5 + rand() % 6, -50);
|
||||
fire_hit(self, aim, 5 + randk() % 6, -50);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -666,7 +666,7 @@ floater_zap(edict_t *self)
|
|||
gi.multicast(origin, MULTICAST_PVS);
|
||||
|
||||
T_Damage(self->enemy, self, self, dir, self->enemy->s.origin,
|
||||
vec3_origin, 5 + rand() % 6, -10, DAMAGE_ENERGY,
|
||||
vec3_origin, 5 + randk() % 6, -10, DAMAGE_ENERGY,
|
||||
MOD_UNKNOWN);
|
||||
}
|
||||
|
||||
|
@ -727,7 +727,7 @@ floater_pain(edict_t *self, edict_t *other /* unused */,
|
|||
return; /* no pain anims in nightmare */
|
||||
}
|
||||
|
||||
n = (rand() + 1) % 3;
|
||||
n = (randk() + 1) % 3;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
|
|
|
@ -777,7 +777,7 @@ flyer_pain(edict_t *self, edict_t *other /* unused */,
|
|||
return; /* no pain anims in nightmare */
|
||||
}
|
||||
|
||||
n = rand() % 3;
|
||||
n = randk() % 3;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
|
|
|
@ -200,7 +200,7 @@ GaldiatorMelee(edict_t *self)
|
|||
|
||||
VectorSet(aim, MELEE_DISTANCE, self->mins[0], -4);
|
||||
|
||||
if (fire_hit(self, aim, (20 + (rand() % 5)), 300))
|
||||
if (fire_hit(self, aim, (20 + (randk() % 5)), 300))
|
||||
{
|
||||
gi.sound(self, CHAN_AUTO, sound_cleaver_hit, 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
|
|
@ -398,7 +398,7 @@ gunner_pain(edict_t *self, edict_t *other /* unused */,
|
|||
|
||||
self->pain_debounce_time = level.time + 3;
|
||||
|
||||
if (rand() & 1)
|
||||
if (randk() & 1)
|
||||
{
|
||||
gi.sound(self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ infantry_pain(edict_t *self, edict_t *other /* unused */,
|
|||
return; /* no pain anims in nightmare */
|
||||
}
|
||||
|
||||
n = rand() % 2;
|
||||
n = randk() % 2;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
|
@ -533,7 +533,7 @@ infantry_die(edict_t *self, edict_t *inflictor /* unused */,
|
|||
self->deadflag = DEAD_DEAD;
|
||||
self->takedamage = DAMAGE_YES;
|
||||
|
||||
n = rand() % 3;
|
||||
n = randk() % 3;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
|
@ -652,7 +652,7 @@ infantry_cock_gun(edict_t *self)
|
|||
}
|
||||
|
||||
gi.sound(self, CHAN_WEAPON, sound_weapon_cock, 1, ATTN_NORM, 0);
|
||||
n = (rand() & 15) + 3 + 7;
|
||||
n = (randk() & 15) + 3 + 7;
|
||||
self->monsterinfo.pausetime = level.time + n * FRAMETIME;
|
||||
}
|
||||
|
||||
|
@ -725,7 +725,7 @@ infantry_smack(edict_t *self)
|
|||
|
||||
VectorSet(aim, MELEE_DISTANCE, 0, 0);
|
||||
|
||||
if (fire_hit(self, aim, (5 + (rand() % 5)), 50))
|
||||
if (fire_hit(self, aim, (5 + (randk() % 5)), 50))
|
||||
{
|
||||
gi.sound(self, CHAN_WEAPON, sound_punch_hit, 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ insane_scream(edict_t *self)
|
|||
return;
|
||||
}
|
||||
|
||||
gi.sound(self, CHAN_VOICE, sound_scream[rand() % 8], 1, ATTN_IDLE, 0);
|
||||
gi.sound(self, CHAN_VOICE, sound_scream[randk() % 8], 1, ATTN_IDLE, 0);
|
||||
}
|
||||
|
||||
void insane_stand(edict_t *self);
|
||||
|
@ -660,7 +660,7 @@ insane_pain(edict_t *self, edict_t *other /* unused */,
|
|||
|
||||
self->pain_debounce_time = level.time + 3;
|
||||
|
||||
r = 1 + (rand() & 1);
|
||||
r = 1 + (randk() & 1);
|
||||
|
||||
if (self->health < 25)
|
||||
{
|
||||
|
@ -857,7 +857,7 @@ insane_die(edict_t *self, edict_t *inflictor /* unused */,
|
|||
}
|
||||
|
||||
gi.sound(self, CHAN_VOICE, gi.soundindex(va("player/male/death%i.wav",
|
||||
(rand() % 4) + 1)), 1, ATTN_IDLE, 0);
|
||||
(randk() % 4) + 1)), 1, ATTN_IDLE, 0);
|
||||
|
||||
self->deadflag = DEAD_DEAD;
|
||||
self->takedamage = DAMAGE_YES;
|
||||
|
@ -955,6 +955,6 @@ SP_misc_insane(edict_t *self)
|
|||
else
|
||||
{
|
||||
walkmonster_start(self);
|
||||
self->s.skinnum = rand() % 3;
|
||||
self->s.skinnum = randk() % 3;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -556,7 +556,7 @@ SV_NewChaseDir(edict_t *actor, edict_t *enemy, float dist)
|
|||
}
|
||||
|
||||
/* try other directions */
|
||||
if (((rand() & 3) & 1) || (abs(deltay) > abs(deltax)))
|
||||
if (((randk() & 3) & 1) || (abs(deltay) > abs(deltax)))
|
||||
{
|
||||
tdir = d[1];
|
||||
d[1] = d[2];
|
||||
|
@ -581,7 +581,7 @@ SV_NewChaseDir(edict_t *actor, edict_t *enemy, float dist)
|
|||
return;
|
||||
}
|
||||
|
||||
if (rand() & 1) /* randomly determine direction of search */
|
||||
if (randk() & 1) /* randomly determine direction of search */
|
||||
{
|
||||
for (tdir = 0; tdir <= 315; tdir += 45)
|
||||
{
|
||||
|
@ -668,7 +668,7 @@ M_MoveToGoal(edict_t *ent, float dist)
|
|||
}
|
||||
|
||||
/* bump around... */
|
||||
if (((rand() & 3) == 1) || !SV_StepDirection(ent, ent->ideal_yaw, dist))
|
||||
if (((randk() & 3) == 1) || !SV_StepDirection(ent, ent->ideal_yaw, dist))
|
||||
{
|
||||
if (ent->inuse)
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ mutant_step(edict_t *self)
|
|||
return;
|
||||
}
|
||||
|
||||
n = (rand() + 1) % 3;
|
||||
n = (randk() + 1) % 3;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ mutant_hit_left(edict_t *self)
|
|||
|
||||
VectorSet(aim, MELEE_DISTANCE, self->mins[0], 8);
|
||||
|
||||
if (fire_hit(self, aim, (10 + (rand() % 5)), 100))
|
||||
if (fire_hit(self, aim, (10 + (randk() % 5)), 100))
|
||||
{
|
||||
gi.sound(self, CHAN_WEAPON, sound_hit, 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ mutant_hit_right(edict_t *self)
|
|||
|
||||
VectorSet(aim, MELEE_DISTANCE, self->maxs[0], 8);
|
||||
|
||||
if (fire_hit(self, aim, (10 + (rand() % 5)), 100))
|
||||
if (fire_hit(self, aim, (10 + (randk() % 5)), 100))
|
||||
{
|
||||
gi.sound(self, CHAN_WEAPON, sound_hit2, 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
|
|
@ -614,7 +614,7 @@ soldier_fire(edict_t *self, int flash_number)
|
|||
{
|
||||
if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME))
|
||||
{
|
||||
self->monsterinfo.pausetime = level.time + (3 + rand() % 8) * FRAMETIME;
|
||||
self->monsterinfo.pausetime = level.time + (3 + randk() % 8) * FRAMETIME;
|
||||
}
|
||||
|
||||
monster_fire_bullet(self, start, aim, 2, 4,
|
||||
|
@ -1514,7 +1514,7 @@ soldier_die(edict_t *self, edict_t *inflictor /* unused */,
|
|||
return;
|
||||
}
|
||||
|
||||
n = rand() % 5;
|
||||
n = randk() % 5;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
|
|
|
@ -781,7 +781,7 @@ BossExplode(edict_t *self)
|
|||
|
||||
self->think = BossExplode;
|
||||
VectorCopy(self->s.origin, org);
|
||||
org[2] += 24 + (rand() & 15);
|
||||
org[2] += 24 + (randk() & 15);
|
||||
|
||||
switch (self->count++)
|
||||
{
|
||||
|
|
|
@ -959,7 +959,7 @@ player_die(edict_t *self, edict_t *inflictor, edict_t *attacker,
|
|||
}
|
||||
|
||||
gi.sound(self, CHAN_VOICE, gi.soundindex(va("*death%i.wav",
|
||||
(rand() % 4) + 1)), 1, ATTN_NORM, 0);
|
||||
(randk() % 4) + 1)), 1, ATTN_NORM, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1174,7 +1174,7 @@ SelectRandomDeathmatchSpawnPoint(void)
|
|||
}
|
||||
}
|
||||
|
||||
selection = rand() % count;
|
||||
selection = randk() % count;
|
||||
|
||||
spot = NULL;
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ BeginIntermission(edict_t *targ)
|
|||
else
|
||||
{
|
||||
/* chose one of four spots */
|
||||
i = rand() & 3;
|
||||
i = randk() & 3;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
|
|
|
@ -153,7 +153,7 @@ P_DamageFeedback(edict_t *player)
|
|||
!(player->flags & FL_GODMODE) &&
|
||||
(client->invincible_framenum <= level.framenum))
|
||||
{
|
||||
r = 1 + (rand() & 1);
|
||||
r = 1 + (randk() & 1);
|
||||
player->pain_debounce_time = level.time + 0.7;
|
||||
|
||||
if (player->health < 25)
|
||||
|
@ -875,7 +875,7 @@ P_WorldEffects(void)
|
|||
gi.sound(current_player, CHAN_VOICE,
|
||||
gi.soundindex("player/drown1.wav"), 1, ATTN_NORM, 0);
|
||||
}
|
||||
else if (rand() & 1)
|
||||
else if (randk() & 1)
|
||||
{
|
||||
gi.sound(current_player, CHAN_VOICE,
|
||||
gi.soundindex("*gurp1.wav"), 1, ATTN_NORM, 0);
|
||||
|
@ -910,7 +910,7 @@ P_WorldEffects(void)
|
|||
(current_player->pain_debounce_time <= level.time) &&
|
||||
(current_client->invincible_framenum < level.framenum))
|
||||
{
|
||||
if (rand() & 1)
|
||||
if (randk() & 1)
|
||||
{
|
||||
gi.sound(current_player, CHAN_VOICE,
|
||||
gi.soundindex("player/burn1.wav"), 1, ATTN_NORM, 0);
|
||||
|
|
|
@ -586,7 +586,7 @@ Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST,
|
|||
{
|
||||
if (ent->client->ps.gunframe == pause_frames[n])
|
||||
{
|
||||
if (rand() & 15)
|
||||
if (randk() & 15)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ Weapon_Grenade(edict_t *ent)
|
|||
(ent->client->ps.gunframe == 39) ||
|
||||
(ent->client->ps.gunframe == 48))
|
||||
{
|
||||
if (rand() & 15)
|
||||
if (randk() & 15)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ CDAudio_RandomPlay ( void )
|
|||
{
|
||||
do
|
||||
{
|
||||
f = ( (float) rand() ) / ( (float) RAND_MAX + 1.0 );
|
||||
f = ( (float) randk() ) / ( (float) RAND_MAX + 1.0 );
|
||||
track = (int) ( cd_id->numtracks * f );
|
||||
}
|
||||
while ( !track_bools [ track ] );
|
||||
|
|
|
@ -132,7 +132,7 @@ SVC_GetChallenge ( void )
|
|||
if ( i == MAX_CHALLENGES )
|
||||
{
|
||||
/* overwrite the oldest */
|
||||
svs.challenges [ oldest ].challenge = rand() & 0x7fff;
|
||||
svs.challenges [ oldest ].challenge = randk() & 0x7fff;
|
||||
svs.challenges [ oldest ].adr = net_from;
|
||||
svs.challenges [ oldest ].time = curtime;
|
||||
i = oldest;
|
||||
|
|
|
@ -370,7 +370,7 @@ SV_InitGame ( void )
|
|||
Cvar_FullSet( "maxclients", "1", CVAR_SERVERINFO | CVAR_LATCH );
|
||||
}
|
||||
|
||||
svs.spawncount = rand();
|
||||
svs.spawncount = randk();
|
||||
svs.clients = Z_Malloc( sizeof ( client_t ) * maxclients->value );
|
||||
svs.num_client_entities = maxclients->value * UPDATE_BACKUP * 64;
|
||||
svs.client_entities = Z_Malloc( sizeof ( entity_state_t ) * svs.num_client_entities );
|
||||
|
|
|
@ -391,7 +391,7 @@ SV_Frame ( int msec )
|
|||
svs.realtime += msec;
|
||||
|
||||
/* keep the random time dependent */
|
||||
rand();
|
||||
randk();
|
||||
|
||||
/* check timeouts */
|
||||
SV_CheckTimeouts();
|
||||
|
|
Loading…
Reference in a new issue