From 816f34ef235646dc320e81a87560f54a62f57ae7 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Wed, 22 Apr 2020 05:57:39 +0200 Subject: [PATCH] Half-Life: Move animation/punchangle code for WEAPON_MP5 into the shared code-path for better prediction. --- src/shared/valve/w_mp5.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/shared/valve/w_mp5.c b/src/shared/valve/w_mp5.c index bbc82738..3438088b 100644 --- a/src/shared/valve/w_mp5.c +++ b/src/shared/valve/w_mp5.c @@ -144,18 +144,9 @@ w_mp5_primary(void) } #endif - /* Actual firing */ #ifdef CLIENT - if (random() < 0.5) { - Weapons_ViewAnimation(MP5_FIRE1); - } else { - Weapons_ViewAnimation(MP5_FIRE2); - } - - pl.a_ammo1--; View_SetMuzzleflash(MUZZLE_RIFLE); - int r = (float)input_sequence % 4; - Weapons_ViewPunchAngle([r-2,0,0]); + pl.a_ammo1--; #else /* singleplayer is more accurate */ if (cvar("sv_playerslots") == 1) { @@ -169,6 +160,16 @@ w_mp5_primary(void) pl.mp5_mag--; #endif + /* Actual firing */ + int r = (float)input_sequence % 2; + if (r) { + Weapons_ViewAnimation(MP5_FIRE1); + } else { + Weapons_ViewAnimation(MP5_FIRE2); + } + + Weapons_ViewPunchAngle([-2,0,0]); + pl.w_attack_next = 0.1f; pl.w_idle_next = 10.0f; }