From 78eb9a04b2a648f869ee1e94d3155dc414c4612c Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sun, 1 May 2022 19:47:05 -0700 Subject: [PATCH] WEAPON_MP5: Randomize between the three firing animations the _right_ way --- src/shared/pmove.qc | 2 +- src/shared/w_mp5.qc | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/shared/pmove.qc b/src/shared/pmove.qc index 9d2250c..79d6872 100644 --- a/src/shared/pmove.qc +++ b/src/shared/pmove.qc @@ -30,7 +30,7 @@ player::Physics_Jump(void) } else { /* Half-Life: Longjump module */ if (flags & FL_CROUCHING && g_items & 0x00008000i) { - makevectors(v_angle); + makevectors([0, v_angle[1], 0]); velocity = v_forward * 512; velocity[2] += 100; } diff --git a/src/shared/w_mp5.qc b/src/shared/w_mp5.qc index d94248a..4c417d2 100644 --- a/src/shared/w_mp5.qc +++ b/src/shared/w_mp5.qc @@ -171,13 +171,17 @@ w_mp5_primary(player pl) pl.mp5_mag--; /* Actual firing */ - int r = (float)input_sequence % 3; - if (r == 0) { + int r = floor(pseudorandom() * 3.0f); + switch (r) { + case 1: Weapons_ViewAnimation(pl, MP5_FIRE1); - } else if (r = 2) { + break; + case 2: Weapons_ViewAnimation(pl, MP5_FIRE2); - } else { + break; + default: Weapons_ViewAnimation(pl, MP5_FIRE3); + break; } Weapons_ViewPunchAngle(pl, [-2,0,0]);