Zero line action type bug with WorldLinePreActivated event

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
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Zero line action type bug with WorldLinePreActivated event

Post by Apeirogon »

Download this
https://github.com/MekBoss/test_ground
Load it with Gzdoom, type in console "map test_ground" then "warp 260 1160 32". Turn to the left until you see plasma rifle on the stand. Shot in it with a pistol. Plasma rifle copy should spawn in front of you. Pick it, select and shoot in plasma rifle again from plasma rifle. Nothing will happen.

What happens here is that every time line between player and plasma rifle is hit by something, overridden "pre line activation" event read stored in line predefined UDMF string and use it to spawn %string% actor at specific map point. Problem is that line have activation special type equal to zero.
And hitscan attacks here (I did not write down exact line)
https://github.com/coelckers/gzdoom/blo ... .cpp#L2101
did not checks for line special type and blindly executes specials.
While projectiles here
https://github.com/coelckers/gzdoom/blo ... .cpp#L2101
in the first line of a function checks is there are any special on the line, and if no jump to the of a function.
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: Zero line action type bug with WorldLinePreActivated eve

Post by Graf Zahl »

I changed P_TestActivateLine to reject any line with a 0-special to ensure consistency.. The real problem is that what you did here is not correct, a line with a zero special cannot be activated and should never trigger this event, if you need this, you have to do it differently. This event is *NOT* for faking a trigger where none exists, it is for doing some checks of your own before allowing the trigger to happen.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: Zero line action type bug with WorldLinePreActivated eve

Post by Apeirogon »

Graf Zahl wrote:if you need this, you have to do it differently
I did that because there are no way of calling zscript function after line activation, without using ACS. Plus, I can store some data in UDMF line fields and read it from zscript, so I dont need tons of
if(line X activated) {}
if(line Y activated) {}
if(line Z activated) {}
...
in ACS, even if I ever use it again.

I can simulate "line X was activated" and catch it in "world line activated" event by using some huge number for line activation type, like 99999999. But its not robust solution, in long term perspective.
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: Zero line action type bug with WorldLinePreActivated eve

Post by Graf Zahl »

If you just need a dummy trigger, there's several options to achieve that. For example, using the SetGlobalFogParameter special with a negative type is absolutely guaranteed to never do anything and has virtually no overhead at all when being triggered.
Post Reply

Return to “Closed Bugs [GZDoom]”