Use an enumeration for weapon commands and a function to get the weapon command

This improves clarity for using weapon commands. Also the mask was incorrect for protocol above version 8 (mohaas and mohaab)
This commit is contained in:
smallmodel 2024-12-30 00:55:29 +01:00
parent 2656000ce4
commit 51a2f7d479
No known key found for this signature in database
GPG key ID: A96F163ED4891440
5 changed files with 35 additions and 25 deletions

View file

@ -4807,7 +4807,7 @@ void Player::Think(void)
}
if (!IsDead()) {
m_iClientWeaponCommand = (server_new_buttons & WEAPON_COMMAND_MASK) >> 7;
m_iClientWeaponCommand = G_GetWeaponCommand(server_new_buttons);
switch (m_iClientWeaponCommand) {
case 0:
@ -11713,9 +11713,9 @@ void Player::FireWeapon(int number, firemode_t mode)
return;
}
if ((last_ucmd.buttons & WEAPON_COMMAND_MASK) >> 7) {
if (G_GetWeaponCommand(last_ucmd.buttons)) {
// Added in OPM
// If there is a weapon command (like DROP), then remove don't fire
// If there is a weapon command (like DROP), then just don't fire
// this prevent tricky behaviors, like silent firing
return;
}