Unlimited ammo collection

Moderator: GZDoom Developers

Post Reply
User avatar
Hirogen2
Posts: 2033
Joined: Sat Jul 19, 2003 6:15 am
Graphics Processor: Intel with Vulkan/Metal Support
Location: Central Germany
Contact:

Unlimited ammo collection

Post by Hirogen2 »

I found this little feature a good aid for testing (single-player) maps on whether their ammo balance is right. Play through, for example, ED4_RFO1 MAP13, attempting to score >90% kills, and you will notice that you have in the excess of 2000 bullets/shells when you are done. Of course it depends on the particular player, but I'm just sayin' that if you play through MAP27, you end the level with moderate amounts of ammo, indicating the balance is good.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Unlimited ammo collection

Post by Graf Zahl »

I can't merge this patch. Apparently its format is incompatible with TortoiseSVN.
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Re: Unlimited ammo collection

Post by Macil »

The diff file doesn't look like it was made by the svn diff tool, and it doesn't seem to be compatible with the diff tool on my linux computer, using an unknown "--git" option. (Obviously the code is human-readable and doesn't seem too hard to do by hand, just a bit trivial.)

@Hirogen: To make an svn diff file, just use the command "svn diff" (and write it to a file, eg "svn diff > mychanges.diff").


EDIT: I added it to my post in the svn diff format.
Attachments
ulp.diff.txt
In correct svn format
(3.19 KiB) Downloaded 113 times
User avatar
Hirogen2
Posts: 2033
Joined: Sat Jul 19, 2003 6:15 am
Graphics Processor: Intel with Vulkan/Metal Support
Location: Central Germany
Contact:

Re: Unlimited ammo collection

Post by Hirogen2 »

I do not see anything “wrong” with the patch. Though made by git, it conforms to unidiff.

Code: Select all

22:55 yaguchi:../zdoom/zdoom-2.3.0 > patch -p1 --dry </dev/shm/ulp.diff.txt 
patching file src/c_cmds.cpp
patching file src/d_main.cpp
Hunk #2 succeeded at 2370 (offset -12 lines).
patching file src/g_shared/a_pickups.cpp
patching file src/g_shared/a_weapons.cpp
Are you suggesting that tortoise cannot handle unidiff?
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: Unlimited ammo collection

Post by Gez »

Try this instead. I think it should work.

Code: Select all

--- src/c_cmds.cpp	(revision 1463)
+++ src/c_cmds.cpp	(working copy)
@@ -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)
 	{

--- src/d_main.cpp	(revision 1463)
+++ src/d_main.cpp	(working copy)
@@ -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;
@@ -2381,6 +2382,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");
 
--- src/g_shared/a_pickups.cpp	(revision 1463)
+++ src/g_shared/a_pickups.cpp	(working copy)
@@ -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<AAmmo*>(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;
 				}

--- src/g_shared/a_weapons.cpp	(revision 1463)
+++ src/g_shared/a_weapons.cpp	(working copy)
@@ -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;
 			}
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Unlimited ammo collection

Post by Graf Zahl »

Please post it as attachment. I don't trust patches in code tags.
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Re: Unlimited ammo collection

Post by Macil »

Hirogen2 wrote:Are you suggesting that tortoise cannot handle unidiff?
It's probably because maybe TortoiseSVN didn't run the diff with the "-p1" option. SVN's diff format doesn't need this.

I posted an attachment of this diff file in svn's format in my previous post. http://forum.zdoom.org/download/file.php?id=6683
User avatar
randi
Site Admin
Posts: 7746
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: Unlimited ammo collection

Post by randi »

Is this something that should really be stored in the config? The fact that you provided a command-line option to turn it on but not one to turn it off suggests it shouldn't be.
User avatar
Hirogen2
Posts: 2033
Joined: Sat Jul 19, 2003 6:15 am
Graphics Processor: Intel with Vulkan/Metal Support
Location: Central Germany
Contact:

Re: Unlimited ammo collection

Post by Hirogen2 »

Should probably remove the command line option then.
Config file.. you would not think about a config file with a flag named "ARCHIVE" (cf. when FArchive being related to savegames).
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: Unlimited ammo collection

Post by HotWax »

I disagree. This feature is clearly a cheat / debug tool and shouldn't be saved as a player option.
User avatar
Hirogen2
Posts: 2033
Joined: Sat Jul 19, 2003 6:15 am
Graphics Processor: Intel with Vulkan/Metal Support
Location: Central Germany
Contact:

Re: Unlimited ammo collection

Post by Hirogen2 »

HotWax wrote:I disagree. This feature is clearly a cheat / debug tool and shouldn't be saved as a player option.
That is what I said, or meant. “CVAR_ARCHIVE” misled, but Graf Zahl was already kind enough to spot this and CVAR_ARCHIVE was soon removed so it does not get stored in zdoom.ini.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”