Counter-Strike: Change 9mm max ammo count from 150 to 120. Fix Five-Seven

crash and fix ammo buying logic from not clamping the final value when
over the maximum
This commit is contained in:
Marco Cawthorne 2021-03-01 04:32:05 +01:00
parent b10a075b39
commit efcbd465b2
3 changed files with 9 additions and 3 deletions

View file

@ -149,11 +149,17 @@ Ammo_BuyCaliber(player pl, int cal, int free)
error("Ammo_BuyCaliber: Impossible caliber definition.");
}
if (*ptr_ammo >= cs_ammoinfo[cal].a_max)
if (*ptr_ammo >= cs_ammoinfo[cal].a_max) {
break;
}
*ptr_ammo += cs_ammoinfo[cal].a_size;
/* clamp */
if (*ptr_ammo >= cs_ammoinfo[cal].a_max) {
*ptr_ammo = cs_ammoinfo[cal].a_max;
}
if (!free)
Money_AddMoney(pl, -cs_ammoinfo[cal].price);

View file

@ -188,7 +188,7 @@ w_fiveseven_reload(void)
float
w_fiveseven_aimanim(void)
{
return w_fiveseven_aimanim();
return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_ONEHAND : ANIM_AIM_ONEHAND;
}
void

View file

@ -52,7 +52,7 @@ enum
#define AMMO_MAX_556MM 90
#define AMMO_MAX_556MMBOX 200
#define AMMO_MAX_338MAG 30
#define AMMO_MAX_9MM 150
#define AMMO_MAX_9MM 120
#define AMMO_MAX_BUCKSHOT 32
#define AMMO_MAX_45ACP 100
#define AMMO_MAX_357SIG 52