MantisBT - Zandronum
View Issue Details
0001852Zandronum[All Projects] Bugpublic2014-06-21 14:442024-03-11 08:02
Hypnotoad 
Kaminsky 
normalmajoralways
resolvedfixed 
MicrosoftWindowsXP/Vista/7
1.2 
3.13.1 
0001852: Clearinventory() causes faulty armor behaviour
If you put clearinventory() in an enter script in a map, Zandronum will seem to initially have trouble tracking your armor type when you pick up green or blue armor afterwards, causing GetArmorType() to fail (I suspect other things also fail as I've been having trouble with odd armor behaviour in a mod I'm working on, but GetArmorType() failing I can reproduce 100% so far).

I've attached a test wad to demonstrate, see the steps to reproduce section to see how GetArmorType() fails. This error does NOT occur in GZDoom 1.8.2, but does occur in Zandronum 1.3 and 2.0.

This can be annoying if a mod wants to save a player's armor and then restore it at a later time for instance, because it could cause the armor saving to fail at saving the correct type of armor. I believe, though am not yet 100% certain, that this same bug causes the decorate function A_JumpIfArmorType to fail also.
Simply walk over the green or blue armor while being sure not to pick up any armor bonuses, and you'll notice your green or blue armor count wont increase, the count will work once you pick up different armor (e.g. picking up blue armor after first picking up green). On the other hand, if you comment out the clearinventory() from the script, or if you pickup an armorbonus beforehand first, then the count will show correctly as normal.
No tags attached.
? armortest.wad (8,695) 2014-06-21 14:44
/tracker/file_download.php?file_id=1234&type=bug
Issue History
2014-06-21 14:44HypnotoadNew Issue
2014-06-21 14:44HypnotoadFile Added: armortest.wad
2014-06-23 19:21CatastropheNote Added: 0009718
2014-07-05 10:17Torr SamahoProduct Version2.0-beta => 1.3
2014-07-05 10:17Torr SamahoProduct Version1.3 => 1.2
2014-07-06 11:29Edward-sanNote Added: 0009878
2014-07-06 12:57DuskStatusnew => feedback
2014-07-06 15:56HypnotoadNote Added: 0009880
2014-07-06 15:56HypnotoadStatusfeedback => new
2014-10-12 17:20WatermelonAssigned To => Watermelon
2014-10-12 17:20WatermelonStatusnew => assigned
2014-10-16 00:27WatermelonNote Added: 0010606
2014-10-16 00:27WatermelonStatusassigned => needs review
2014-10-16 00:27WatermelonNote Edited: 0010606bug_revision_view_page.php?bugnote_id=10606#r5774
2014-10-16 07:37ZzZomboNote Added: 0010611
2014-10-16 12:24WatermelonNote Added: 0010612
2014-10-16 12:24WatermelonNote Edited: 0010612bug_revision_view_page.php?bugnote_id=10612#r5784
2014-10-19 23:41WatermelonNote Added: 0010638
2014-10-23 16:44WatermelonAssigned ToWatermelon =>
2014-10-23 16:44WatermelonStatusneeds review => confirmed
2017-06-28 19:02HypnotoadNote Added: 0017949
2017-10-14 12:52LeonardNote Added: 0018555
2017-10-14 12:52LeonardAssigned To => Leonard
2017-10-14 12:52LeonardStatusconfirmed => needs review
2017-10-14 12:52LeonardTarget Version => 3.1
2017-11-10 16:36LeonardNote Edited: 0018555bug_revision_view_page.php?bugnote_id=18555#r11325
2018-10-08 21:00IvanNote Added: 0020034
2021-07-23 21:15KaminskyNote Added: 0021634
2021-07-23 21:15KaminskyAssigned ToLeonard => Kaminsky
2021-07-23 21:15KaminskyStatusneeds review => needs testing
2024-03-11 08:02unknownnaNote Added: 0023350
2024-03-11 08:02unknownnaStatusneeds testing => resolved
2024-03-11 08:02unknownnaFixed in Version => 3.1
2024-03-11 08:02unknownnaResolutionopen => fixed

Notes
(0009718)
Catastrophe   
2014-06-23 19:21   
This happens in all out war.
(0009878)
Edward-san   
2014-07-06 11:29   
What about GZDoom 1.5.0 (the current codebase of latest 2.0 beta build)?
(0009880)
Hypnotoad   
2014-07-06 15:56   
It works in that build, could not reproduce the bug in it.
(0010606)
Watermelon   
2014-10-16 00:27   
@Torr

The following NETWORK_InClientMode() causes this to not work.

Quote
// [BB] Don't delete BasicArmor, just clear it. Probably ZDoom should do it like this
            // as well, but to be on the safe side only do this on the client for now.
            else if ( NETWORK_InClientMode() && ( inv->GetClass() == RUNTIME_CLASS(ABasicArmor) ) )
            {
                ABasicArmor *barmor = static_cast<ABasicArmor *> (inv);
                barmor->SavePercent = 0;
                barmor->Amount = 0;
            }


When I comment it out like /* NETWORK_InClientMode() */ it works, but I'm unsure if there's a reason you have that there?

Offline it fails because NETSTATE is single/single with bots.

(0010611)
ZzZombo   
2014-10-16 07:37   
"Probably ZDoom should do it like this as well", I think that's the only reason. The code is originated from ZDoom.
(0010612)
Watermelon   
2014-10-16 12:24   
Quote
"Probably ZDoom should do it like this as well", I think that's the only reason. The code is originated from ZDoom.


I don't think you read my post. The problem is it being the wrong net state when being triggered which results in clearing anyways (which didn't originate from ZDoom at all).

(0010638)
Watermelon   
2014-10-19 23:41   
Interesting:

So ZDoom does in fact still actually wipe out ABasicArmor, but picking up GreenArmor appears to return it to the inventory. I can't seem to find where it does this in ZDoom though...

Thus, to keep in line with ZDoom, is it possible to have GreenArmor picks give the player ABasicArmor if the player doesn't have it? That seems to be what ZDoom is doing.
(0017949)
Hypnotoad   
2017-06-28 19:02   
This is still happening in the latest beta.
(0018555)
Leonard   
2017-10-14 12:52   
(edited on: 2017-11-10 16:36)
I pushed some commits for this but I would need some input regarding GZDoom delta (I left comments on the commits).

EDIT: Changed the commits link (I'm no longer going to use my old repository so away it goes).

(0020034)
Ivan   
2018-10-08 21:00   
Happens with 3.1 build released here as well'https://zandronum.com/forum/viewtopic.php?f=55&t=9340 [^]'
(0021634)
Kaminsky   
2021-07-23 21:15   
This should've been fixed in 3.1 with this commit:'https://osdn.net/projects/zandronum/scm/hg/zandronum-stable/commits/55bd7a828820d2691c9768f5dd506c9b538d9b2b [^]'
(0023350)
unknownna   
2024-03-11 08:02   
The example wad works fine in 3.1. The messages update accordingly when you pick up the armors compared to before. Great work.