diff --git a/src/d_main.cpp b/src/d_main.cpp index 3b4341b28..1fecffab9 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -458,6 +458,7 @@ CVAR (Flag, sv_disallowspying, dmflags2, DF2_DISALLOW_SPYING); CVAR (Flag, sv_chasecam, dmflags2, DF2_CHASECAM); CVAR (Flag, sv_disallowsuicide, dmflags2, DF2_NOSUICIDE); CVAR (Flag, sv_noautoaim, dmflags2, DF2_NOAUTOAIM); +CVAR (Flag, sv_dontcheckammo, dmflags2, DF2_DONTCHECKAMMO); //========================================================================== // diff --git a/src/doomdef.h b/src/doomdef.h index 061e2b2c4..87216ae6b 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -292,6 +292,7 @@ enum DF2_CHASECAM = 1 << 21, // Players can use the chasecam cheat. DF2_NOSUICIDE = 1 << 22, // Players are allowed to suicide. DF2_NOAUTOAIM = 1 << 23, // Players cannot use autoaim. + DF2_DONTCHECKAMMO = 1 << 24, // Don't Check ammo when switching weapons. }; // [RH] Compatibility flags. diff --git a/src/g_game.cpp b/src/g_game.cpp index e9a4d4f1e..fc4a21772 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -288,7 +288,8 @@ CCMD (slot) if (slot < NUM_WEAPON_SLOTS) { - SendItemUse = players[consoleplayer].weapons.Slots[slot].PickWeapon (&players[consoleplayer]); + SendItemUse = players[consoleplayer].weapons.Slots[slot].PickWeapon (&players[consoleplayer], + !(dmflags2 & DF2_DONTCHECKAMMO)); } } } diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index b402fcf59..3afcbf5b7 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -21,7 +21,7 @@ public: bool AddWeapon (const char *type); bool AddWeapon (const PClass *type); void AddWeaponList (const char *list, bool clear); - AWeapon *PickWeapon (player_t *player); + AWeapon *PickWeapon (player_t *player, bool checkammo = false); int Size () const { return (int)Weapons.Size(); } int LocateWeapon (const PClass *type); diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index e02391640..e2aaab1c4 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -753,7 +753,7 @@ int FWeaponSlot::LocateWeapon(const PClass *type) // //=========================================================================== -AWeapon *FWeaponSlot::PickWeapon(player_t *player) +AWeapon *FWeaponSlot::PickWeapon(player_t *player, bool checkammo) { int i, j; @@ -777,9 +777,12 @@ AWeapon *FWeaponSlot::PickWeapon(player_t *player) { AWeapon *weap = static_cast (player->mo->FindInventory(Weapons[j].Type)); - if (weap != NULL && weap->IsKindOf(RUNTIME_CLASS(AWeapon)) && weap->CheckAmmo(AWeapon::EitherFire, false)) + if (weap != NULL && weap->IsKindOf(RUNTIME_CLASS(AWeapon))) { - return weap; + if (!checkammo || weap->CheckAmmo(AWeapon::EitherFire, false)) + { + return weap; + } } } } @@ -789,9 +792,12 @@ AWeapon *FWeaponSlot::PickWeapon(player_t *player) { AWeapon *weap = static_cast (player->mo->FindInventory(Weapons[i].Type)); - if (weap != NULL && weap->IsKindOf(RUNTIME_CLASS(AWeapon)) && weap->CheckAmmo(AWeapon::EitherFire, false)) + if (weap != NULL && weap->IsKindOf(RUNTIME_CLASS(AWeapon))) { - return weap; + if (!checkammo || weap->CheckAmmo(AWeapon::EitherFire, false)) + { + return weap; + } } } return player->ReadyWeapon; diff --git a/src/m_options.cpp b/src/m_options.cpp index db09257aa..7fcd0bdcf 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -1047,6 +1047,7 @@ static menuitem_t DMFlagsItems[] = { { bitflag, "Automap allies", {&dmflags2}, {1}, {0}, {0}, {(value_t *)DF2_NO_AUTOMAP_ALLIES} }, { bitflag, "Allow spying", {&dmflags2}, {1}, {0}, {0}, {(value_t *)DF2_DISALLOW_SPYING} }, { bitflag, "Chasecam cheat", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_CHASECAM} }, + { bitflag, "Check ammo for weapon switch", {&dmflags2}, {1}, {0}, {0}, {(value_t *)DF2_DONTCHECKAMMO} }, { redtext, " ", {NULL}, {0}, {0}, {0}, {NULL} }, { whitetext,"Deathmatch Settings", {NULL}, {0}, {0}, {0}, {NULL} },