[Added] Unlimited ammo collection

Moderator: Developers

Unlimited ammo collection

Postby Hirogen2 » Fri Mar 06, 2009 3:47 pm

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
Hirogen2
 
Joined: 19 Jul 2003
Location: Central Germany

Re: Unlimited ammo collection

Postby Graf Zahl » Fri Mar 06, 2009 4:25 pm

I can't merge this patch. Apparently its format is incompatible with TortoiseSVN.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Unlimited ammo collection

Postby Agent ME » Fri Mar 06, 2009 4:33 pm

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 40 times
User avatar
Agent ME
Title Not Found
 
Joined: 22 Mar 2004
Location: California, USA

Re: Unlimited ammo collection

Postby Hirogen2 » Fri Mar 06, 2009 4:57 pm

I do not see anything “wrong” with the patch. Though made by git, it conforms to unidiff.
Code: Select allExpand view
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?
User avatar
Hirogen2
 
Joined: 19 Jul 2003
Location: Central Germany

Re: Unlimited ammo collection

Postby Gez » Fri Mar 06, 2009 5:21 pm

Try this instead. I think it should work.

Code: Select allExpand view
--- 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;
          }
Gez
 
 
 
Joined: 06 Jul 2007

Re: Unlimited ammo collection

Postby Graf Zahl » Fri Mar 06, 2009 5:29 pm

Please post it as attachment. I don't trust patches in code tags.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Unlimited ammo collection

Postby Agent ME » Fri Mar 06, 2009 5:49 pm

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
Agent ME
Title Not Found
 
Joined: 22 Mar 2004
Location: California, USA

Re: Unlimited ammo collection

Postby randi » Sat Mar 07, 2009 7:27 pm

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
randi
Site Admin
 
Joined: 09 Jul 2003

Re: Unlimited ammo collection

Postby Hirogen2 » Fri May 15, 2009 1:03 pm

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
Hirogen2
 
Joined: 19 Jul 2003
Location: Central Germany

Re: Unlimited ammo collection

Postby HotWax » Fri May 15, 2009 2:34 pm

I disagree. This feature is clearly a cheat / debug tool and shouldn't be saved as a player option.
User avatar
HotWax
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Re: Unlimited ammo collection

Postby Hirogen2 » Fri May 15, 2009 4:04 pm

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.
User avatar
Hirogen2
 
Joined: 19 Jul 2003
Location: Central Germany


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: Kaminsky and 0 guests