game: replace rand with randk in footsteps

This commit is contained in:
Denis Pauk 2022-08-07 14:47:12 +03:00
parent e1164fc839
commit a1d053bca1
9 changed files with 18 additions and 45 deletions

View file

@ -43,14 +43,11 @@ berserk_footstep(edict_t *self)
if (!g_monsterfootsteps->value)
return;
int i;
i = rand() % (1 + 1 - 0) + 0;
if (i == 0)
if (randk() % 2 == 0)
{
gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0);
}
else if (i == 1)
else
{
gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0);
}

View file

@ -51,14 +51,11 @@ brain_footstep(edict_t *self)
if (!g_monsterfootsteps->value)
return;
int i;
i = rand() % (1 + 1 - 0) + 0;
if (i == 0)
if (randk() % 2 == 0)
{
gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0);
}
else if (i == 1)
else
{
gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0);
}

View file

@ -61,14 +61,11 @@ chick_footstep(edict_t *self)
if (!g_monsterfootsteps->value)
return;
int i;
i = rand() % (1 + 1 - 0) + 0;
if (i == 0)
if (randk() % 2 == 0)
{
gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0);
}
else if (i == 1)
else
{
gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0);
}
@ -542,9 +539,7 @@ chick_die(edict_t *self, edict_t *inflictor /* unused */,
self->deadflag = DEAD_DEAD;
self->takedamage = DAMAGE_YES;
n = randk() % 2;
if (n == 0)
if (randk() % 2 == 0)
{
self->monsterinfo.currentmove = &chick_move_death1;
gi.sound(self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0);

View file

@ -47,14 +47,11 @@ gladiator_footstep(edict_t *self)
if (!g_monsterfootsteps->value)
return;
int i;
i = rand() % (1 + 1 - 0) + 0;
if (i == 0)
if (randk() % 2 == 0)
{
gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0);
}
else if (i == 1)
else
{
gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0);
}

View file

@ -44,14 +44,11 @@ gunner_footstep(edict_t *self)
if (!g_monsterfootsteps->value)
return;
int i;
i = rand() % (1 + 1 - 0) + 0;
if (i == 0)
if (randk() % 2 == 0)
{
gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0);
}
else if (i == 1)
else
{
gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0);
}

View file

@ -51,14 +51,11 @@ infantry_footstep(edict_t *self)
if (!g_monsterfootsteps->value)
return;
int i;
i = rand() % (1 + 1 - 0) + 0;
if (i == 0)
if (randk() % 2 == 0)
{
gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0);
}
else if (i == 1)
else
{
gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0);
}
@ -293,8 +290,6 @@ void
infantry_pain(edict_t *self, edict_t *other /* unused */,
float kick /* unused */, int damage)
{
int n;
if (!self)
{
return;
@ -317,9 +312,7 @@ infantry_pain(edict_t *self, edict_t *other /* unused */,
return; /* no pain anims in nightmare */
}
n = randk() % 2;
if (n == 0)
if (randk() % 2 == 0)
{
self->monsterinfo.currentmove = &infantry_move_pain1;
gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);

View file

@ -46,7 +46,7 @@ insane_footstep(edict_t *self)
return;
int i;
i = rand() % (3 + 1 - 0) + 0;
i = randk() % 4;
if (i == 0)
{

View file

@ -49,14 +49,11 @@ medic_footstep(edict_t *self)
if (!g_monsterfootsteps->value)
return;
int i;
i = rand() % (1 + 1 - 0) + 0;
if (i == 0)
if (randk() % 2 == 0)
{
gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0);
}
else if (i == 1)
else
{
gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0);
}

View file

@ -52,7 +52,7 @@ soldier_footstep(edict_t *self)
return;
int i;
i = rand() % (3 + 1 - 0) + 0;
i = randk() % 4;
if (i == 0)
{