A_CountDownArg doesn't seem to working

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
D2JK
Posts: 545
Joined: Sat Aug 30, 2014 8:21 am

A_CountDownArg doesn't seem to working

Post by D2JK »

Code: Select all

ACTOR NewZombieMan : ZombieMan replaces ZombieMan
 {
  Args 4
  States
  {
	See:
     POSS AABBCCDD 1 A_Wander
	  TNT1 A 0 A_CountDownArg(0)
     Loop
  }
 }
The zombieman will not die after a few moments.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_CountDownArg doesn't seem to working

Post by Graf Zahl »

Hm... Some bad refactoring made the first arg inaccessible. Fixed.
D2JK
Posts: 545
Joined: Sat Aug 30, 2014 8:21 am

Re: A_CountDownArg doesn't seem to working

Post by D2JK »

This is still not working correctly it seems; now the zombieman of this example dies very quickly (as soon as he reaches the A_CountDownArg call).
User avatar
Fishytza
Posts: 793
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: They/Them
Contact:

Re: A_CountDownArg doesn't seem to working

Post by Fishytza »

Checking the code of A_CountDownArg, I can see why it's acting strangely.

The reason the zombieman 'dies' quickly is because of the redundant else block. Why is that even there??

Code: Select all

		if (!self->args[argnum]--)
		{
			....
		}
		else //<- I'm talking about this
		{
			self->SetState(state);
		}
However, it's not just that. It looks like the 'state' parameter is completely ignored for actors that are both non-missile & non-shootable when the specified arg reaches 0 when that's exactly the moment the specified state should be set.

Code: Select all

      if (!self->args[argnum]--)
		{
			if (self->flags & MF_MISSILE)
			{
				P_ExplodeMissile(self, NULL, NULL);
			}
			else if (self->flags & MF_SHOOTABLE)
			{
				P_DamageMobj(self, NULL, NULL, self->health, NAME_None, DMG_FORCED);
			}
			else //Not a missile and isn't shootable
			{
				self->SetState(self->FindState(NAME_Death)); //'state' parameter is ignored
			}
		}
Lastly, if you look at A_CountDownArg from 2.7.1, you'll see the transition to the PARAM_ACTION_PROLOGUE version was slightly botched.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_CountDownArg doesn't seem to working

Post by Graf Zahl »

I restored the old version. No idea what that change was supposed to accomplish but it definitely broke it rather badly.
User avatar
Fishytza
Posts: 793
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: They/Them
Contact:

Re: A_CountDownArg doesn't seem to working

Post by Fishytza »

Graf, I don't know how important it is, but I noticed many action functions in scripting either end with 'return 0;' or
'return numret;'. And before your change I noticed A_CountDownArg was of the 'return 0;' type.

What I'm saying is, I think this

Code: Select all

    if (cnt<0 || cnt >= 5) return;
should be

Code: Select all

    if (cnt<0 || cnt >= 5) return 0;
And a additional 'return 0;' is needed at the end.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_CountDownArg doesn't seem to working

Post by Graf Zahl »

Right. I forgot about that...
Post Reply

Return to “Closed Bugs [GZDoom]”