From e57ff454f22cbb8de1415d5034f0468f7200286c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 6 Mar 2009 22:58:34 +0000 Subject: [PATCH] - Added Hirogen2's patch for unlimited ammo CVAR. SVN r1464 (trunk) --- docs/rh-log.txt | 5 ++++- src/c_cmds.cpp | 1 + src/d_main.cpp | 2 ++ src/g_shared/a_pickups.cpp | 5 +++-- src/g_shared/a_weapons.cpp | 5 +++-- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index a2dd16e97..909e0bca0 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ -March 4, 2009 +March 6, 2009 (Changes by Graf Zahl) +- Added Hirogen2's patch for unlimited ammo CVAR. + +March 4, 2009 - Fixed: You couldn't easily play with the compatibility options menu during the title screen, because the demo loop reset the server cvars after each attempt to play a demo, even though the demos never actually played. The diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 550d681a8..6e5a32471 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -73,6 +73,7 @@ extern FILE *Logfile; extern bool insave; CVAR (Bool, sv_cheats, false, CVAR_SERVERINFO | CVAR_LATCH) +CVAR (Bool, sv_unlimited_pickup, false, CVAR_ARCHIVE | CVAR_SERVERINFO) CCMD (toggleconsole) { diff --git a/src/d_main.cpp b/src/d_main.cpp index 372510e0e..fc8fc10b3 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -143,6 +143,7 @@ EXTERN_CVAR (Bool, invertmouse) EXTERN_CVAR (Bool, lookstrafe) EXTERN_CVAR (Int, screenblocks) EXTERN_CVAR (Bool, sv_cheats) +EXTERN_CVAR (Bool, sv_unlimited_pickup) extern gameinfo_t SharewareGameInfo; extern gameinfo_t RegisteredGameInfo; @@ -2369,6 +2370,7 @@ void D_DoomMain (void) if (Args->CheckParm ("-nomonsters")) flags |= DF_NO_MONSTERS; if (Args->CheckParm ("-respawn")) flags |= DF_MONSTERS_RESPAWN; if (Args->CheckParm ("-fast")) flags |= DF_FAST_MONSTERS; + if (Args->CheckParm("-ulp")) sv_unlimited_pickup = true; devparm = !!Args->CheckParm ("-devparm"); diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index c23799806..34a4a716f 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -67,13 +67,14 @@ const PClass *AAmmo::GetParentAmmo () const // AAmmo :: HandlePickup // //=========================================================================== +EXTERN_CVAR(Bool, sv_unlimited_pickup) bool AAmmo::HandlePickup (AInventory *item) { if (GetClass() == item->GetClass() || (item->IsKindOf (RUNTIME_CLASS(AAmmo)) && static_cast(item)->GetParentAmmo() == GetClass())) { - if (Amount < MaxAmount) + if (Amount < MaxAmount || sv_unlimited_pickup) { int receiving = item->Amount; @@ -84,7 +85,7 @@ bool AAmmo::HandlePickup (AInventory *item) int oldamount = Amount; Amount += receiving; - if (Amount > MaxAmount) + if (Amount > MaxAmount && !sv_unlimited_pickup) { Amount = MaxAmount; } diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index a125cc555..7ab477b62 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -326,10 +326,11 @@ AAmmo *AWeapon::AddAmmo (AActor *other, const PClass *ammotype, int amount) // Give the owner some more ammo he already has. // //=========================================================================== +EXTERN_CVAR(Bool, sv_unlimited_pickup) bool AWeapon::AddExistingAmmo (AAmmo *ammo, int amount) { - if (ammo != NULL && ammo->Amount < ammo->MaxAmount) + if (ammo != NULL && (ammo->Amount < ammo->MaxAmount || sv_unlimited_pickup)) { // extra ammo in baby mode and nightmare mode if (!(ItemFlags&IF_IGNORESKILL)) @@ -337,7 +338,7 @@ bool AWeapon::AddExistingAmmo (AAmmo *ammo, int amount) amount = FixedMul(amount, G_SkillProperty(SKILLP_AmmoFactor)); } ammo->Amount += amount; - if (ammo->Amount > ammo->MaxAmount) + if (ammo->Amount > ammo->MaxAmount && !sv_unlimited_pickup) { ammo->Amount = ammo->MaxAmount; }