MantisBT - Zandronum
View Issue Details
0002880Zandronum[All Projects] Bugpublic2016-10-11 06:272016-10-12 23:39
unknownna 
 
normalfeaturealways
closedwon't fix 
2.1 
 
0002880: cl_noammoswitch switches to empty weapons if Weapon.AmmoUse is 0 or when AltFire state is present
I was testing some mods and got confused wondering why the client was able to switch over to weapons without any ammo despite having cl_noammoswitch set to false. I investigated the issue further and narrowed it down to cl_noammoswitch not working if the weapons have Weapon.AmmoUse1/2 set to 0 or if the weapons have an AltFire state present in the DECORATE code.

It's been this way since forever. It's also broken in Skulltag 98d.
1. zandronum -iwad doom2.wad -file pwo_ammotype_02.wad +map map01 +cl_noammoswitch 0
2. Fire the chaingun, using up the ammo.
3. Notice how you can still cycle between your empty weapons despite not having any ammo.
Actor Pistol_02 : Pistol
{
    Weapon.SlotNumber 2
    Weapon.AmmoUse1 0
    Weapon.AmmoUse2 0
    Weapon.AmmoType1 "Clip"
    Weapon.AmmoType2 "Clip"
    Tag "Pistol Weapon.AmmoUse1/2 0"
}

Actor Chaingun_02 : Chaingun
{
    Weapon.SlotNumber 4
    Tag "Chaingun AltFire State Present"
    States
{
    AltFire:
        CHGG A 4 A_GiveInventory ("Clip", 1)
        Goto Ready
    }
}
No tags attached.
? pwo_ammotype_02.wad (1,362) 2016-10-11 06:27
/tracker/file_download.php?file_id=1932&type=bug
png Screenshot.png (125,897) 2016-10-11 06:27
/tracker/file_download.php?file_id=1933&type=bug
png
Issue History
2016-10-11 06:27unknownnaNew Issue
2016-10-11 06:27unknownnaFile Added: pwo_ammotype_02.wad
2016-10-11 06:27unknownnaFile Added: Screenshot.png
2016-10-11 07:29Edward-sanNote Added: 0015892
2016-10-11 07:29Edward-sanAssigned To => Edward-san
2016-10-11 07:29Edward-sanStatusnew => feedback
2016-10-11 07:34unknownnaNote Added: 0015893
2016-10-11 07:34unknownnaStatusfeedback => assigned
2016-10-11 07:42unknownnaNote Edited: 0015893bug_revision_view_page.php?bugnote_id=15893#r9669
2016-10-11 07:47unknownnaNote Edited: 0015893bug_revision_view_page.php?bugnote_id=15893#r9670
2016-10-11 08:34Edward-sanAssigned ToEdward-san =>
2016-10-11 08:34Edward-sanStatusassigned => new
2016-10-11 18:56unknownnaNote Added: 0015899
2016-10-11 18:58unknownnaStatusnew => acknowledged
2016-10-11 18:58unknownnaResolutionopen => waiting for zdoom
2016-10-12 23:39unknownnaNote Added: 0015938
2016-10-12 23:39unknownnaStatusacknowledged => closed
2016-10-12 23:39unknownnaResolutionwaiting for zdoom => won't fix

Notes
(0015892)
Edward-san   
2016-10-11 07:29   
Does changing sv_dontcheckammo on/off change the behavior?
(0015893)
unknownna   
2016-10-11 07:34   
(edited on: 2016-10-11 07:47)
I just tried it and it doesn't seem to change anything. I can still select both empty weapons. I also tested ZDoom 2.8.1 and you can also select both weapons there, so it might be a bug/side-effect inherited from the ZDoom behavior.

Although Weapon.AmmoUse 0 is technically like having infinite ammo, many mods don't seem to actually fire the weapon in the fire state unless the player has another ammo item present in the inventory.

(0015899)
unknownna   
2016-10-11 18:56   
I went ahead and made a bug report over at the ZDoom forums.

Can select/cycle certain weapons with empty ammo
(0015938)
unknownna   
2016-10-12 23:39   
It's apparently not a bug, as the engine assumes that Weapon.AmmUse1/2 is 0 by default unless you explicitly define "Weapon.AmmoUse1/2 1". And since "Weapon.AmmoUse1/2 0" is like having infinite ammo, it naturally allows you to select the weapon.

Unfortunately this seems to be a case of popular mods working around the system with their custom reloading, allowing them to bypass any "empty" status.