WEAPON_GLOCK18: Play idle animations when idle.

This commit is contained in:
Marco Cawthorne 2022-04-24 15:59:32 -07:00
parent 8f52f8a2ec
commit 51f4420c1e
Signed by: eukara
GPG key ID: C196CD8BA993248A

View file

@ -189,7 +189,7 @@ w_glock18_primary(player pl)
#endif
pl.gflags |= GF_SEMI_TOGGLED;
pl.w_idle_next = pl.w_attack_next;
pl.w_idle_next = pl.w_attack_next + 1.0f;
}
void
@ -212,7 +212,7 @@ w_glock18_secondary(player pl)
#endif
pl.w_attack_next = 0.5f;
pl.w_idle_next = pl.w_attack_next;
pl.w_idle_next = pl.w_attack_next + 1.0f;
}
void
@ -242,13 +242,12 @@ w_glock18_reload(player pl)
#endif
pl.w_attack_next = 2.1f;
pl.w_idle_next = pl.w_attack_next;
pl.w_idle_next = pl.w_attack_next + 1.0f;
}
void
w_glock18_release(player pl)
{
w_cstrike_weaponrelease();
/* auto-reload if need be */
@ -257,6 +256,26 @@ w_glock18_release(player pl)
Weapons_Reload(pl);
return;
}
if (pl.w_idle_next)
return;
int r = floor(pseudorandom() * 3);
switch (r) {
case 0:
Weapons_ViewAnimation(pl, GLOCK_IDLE1);
pl.w_idle_next = 2.8125f;
break;
case 1:
Weapons_ViewAnimation(pl, GLOCK_IDLE2);
pl.w_idle_next = 2.25f;
break;
case 2:
Weapons_ViewAnimation(pl, GLOCK_IDLE3);
pl.w_idle_next = 2.5f;
break;
}
}
float