WEAPON_MP5: Randomize between the three firing animations the _right_ way

This commit is contained in:
Marco Cawthorne 2022-05-01 19:47:05 -07:00
parent 82557ee0b0
commit 78eb9a04b2
Signed by: eukara
GPG key ID: C196CD8BA993248A
2 changed files with 9 additions and 5 deletions

View file

@ -30,7 +30,7 @@ player::Physics_Jump(void)
} else { } else {
/* Half-Life: Longjump module */ /* Half-Life: Longjump module */
if (flags & FL_CROUCHING && g_items & 0x00008000i) { if (flags & FL_CROUCHING && g_items & 0x00008000i) {
makevectors(v_angle); makevectors([0, v_angle[1], 0]);
velocity = v_forward * 512; velocity = v_forward * 512;
velocity[2] += 100; velocity[2] += 100;
} }

View file

@ -171,13 +171,17 @@ w_mp5_primary(player pl)
pl.mp5_mag--; pl.mp5_mag--;
/* Actual firing */ /* Actual firing */
int r = (float)input_sequence % 3; int r = floor(pseudorandom() * 3.0f);
if (r == 0) { switch (r) {
case 1:
Weapons_ViewAnimation(pl, MP5_FIRE1); Weapons_ViewAnimation(pl, MP5_FIRE1);
} else if (r = 2) { break;
case 2:
Weapons_ViewAnimation(pl, MP5_FIRE2); Weapons_ViewAnimation(pl, MP5_FIRE2);
} else { break;
default:
Weapons_ViewAnimation(pl, MP5_FIRE3); Weapons_ViewAnimation(pl, MP5_FIRE3);
break;
} }
Weapons_ViewPunchAngle(pl, [-2,0,0]); Weapons_ViewPunchAngle(pl, [-2,0,0]);