Set victim as tracer?
Moderator: GZDoom Developers
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
Set victim as tracer?
Based on some musings from here...
Is it possible to craft a flag or property so that a projectile can mark the actor it struck to be its tracer?
Is it possible to craft a flag or property so that a projectile can mark the actor it struck to be its tracer?
- NeuralStunner
-

- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: Set victim as tracer?
Sounds reasonable (and quite useful) to me!
-
Blue Shadow
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: Set victim as tracer?
This may sound moot at this point, but why not use the master field, instead? Projectiles don't have a use of that field currently.
Anyway, I'm in support of this. The ability to make a projectile run a script for the thing it hits* is something I needed recently for my mod. And with this, I may be able to achieve that.
Anyway, I'm in support of this. The ability to make a projectile run a script for the thing it hits* is something I needed recently for my mod. And with this, I may be able to achieve that.
Spoiler: *
Re: Set victim as tracer?
To preempt people that might, A_RadiusGive has the same problems as all the other hacky workarounds for the problem this request would solve. A_SeekerMissile's SMF_LOOK flag, A_Look(Ex) and the various methods of distance-checking all take into account only the center of the actor. Problem is when you're trying to detect what actor was hit by a projectile, it's entirely possible to either not detect large-enough actors (too far from the center), and/or pick out a small-radius target that wasn't even hit.Blue Shadow wrote:Please, don't suggest A_RadiusGive.
I think a flag (so it doesn't risk breaking any possibly-existing behavior) to set the actor hit by a projectile as the projectile's master (because projectiles already have extensive use of target and tracer) is the best option.
- Ryan Cordell
- Posts: 4349
- Joined: Sun Feb 06, 2005 6:39 am
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
- Location: Capital of Explodistan
Re: Set victim as tracer?
I'm not sure I'll actually post this as a patch, because I'm sure there's a better way of going about this - where you could basically set the hit actor as the Master, Tracer or Target of the projectile/puff - without using up more flags.
Devs are free to chime in on this idea.
Devs are free to chime in on this idea.
Spoiler: Patch preview
Re: Set victim as tracer?
Semantically it doesn't really make sense why "master" should point at it, but I dunno if that's a big of a deal since the flag's name would explicitly state this behavior so it's not like it would be unintuitive.Blue Shadow wrote:This may sound moot at this point, but why not use the master field, instead? Projectiles don't have a use of that field currently.
Seems like it should be fine for the OP's purposes since A_GiveInventory and other relevant functions like A_Warp seem to have an actor pointer parameter now.
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
Re: Set victim as tracer?
Any pointer will work, frankly. And since projectiles have traditionally set the Target field to be their owner, semantics were out the window to begin with.
Re: Set victim as tracer?
Indeed. Hell, if we're using a function that needs a target anyway and we have it saved as a tracer, we can just A_RearrangePointers(AAPTR_TRACER, AAPTR_DEFAULT, AAPTR_TARGET), do what we need to do and call A_RearrangePointers again to set it back.Ed the Bat wrote:Any pointer will work, frankly.
- Major Cooke
- Posts: 8215
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
- Contact:
Re: Set victim as tracer?
Not if they're doing something like A_Explode. AEoD relies specifically on tracer actions, and using target will just cause many things to break there. I strongly must encourage using as the OP intended: tracer.
- NeuralStunner
-

- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: Set victim as tracer?
I'm not sure who you're trying to argue with.Major Cooke wrote:Not if they're doing something like A_Explode. AEoD relies specifically on tracer actions, and using target will just cause many things to break there. I strongly must encourage using as the OP intended: tracer.
- Major Cooke
- Posts: 8215
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
- Contact:
Re: Set victim as tracer?
Ed the Bat. Simply put, quite a few projectiles within the mod rely upon hitting something and performing A_SeekerMissile to ensure that the victim and the shooter are consistent (i.e. the stake gun's stakes sticking into the enemy it hits)
- NeuralStunner
-

- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: Set victim as tracer?
I don't believe he was actually advocating use of Target for the function (since he mentioned right after that it already has a special use).
Aside: There might be a niche use in remembering the intended victim of a seeker missile to compare it to the actual victim. It should work to shuffle the Tracer into Master during the missile's lifetime, right? (I don't assume, since there are a handful of "must be a monster" rules surrounding the Master pointer.)
Aside: There might be a niche use in remembering the intended victim of a seeker missile to compare it to the actual victim. It should work to shuffle the Tracer into Master during the missile's lifetime, right? (I don't assume, since there are a handful of "must be a monster" rules surrounding the Master pointer.)
Re: Set victim as tracer?
I really don't think using the master pointer here would be a very good idea since then we lock ourselves the possibility of possibly opening the master/minion relationship in the future. Bastardizing it like this isn't the correct way of doing things IMO. I'd rather add a new "victim" field but if something needs to be bastardized for the job perhaps use the lastenemy field for this?
- NeuralStunner
-

- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: Set victim as tracer?
That could work, but it'd need a pointer "flag" and relevant functions. I think Tracer was chosen because that stuff is already there.
Edit:
I put some options in order from best to worst (as I see them):
Edit:
I put some options in order from best to worst (as I see them):
- A new pointer. ("victim" works.) Open it for access and assignent.
- Use a pointer that projectiles don't normally use. (E.G. lastenemy.) Also needs to be opened up for use.
- Use tracer or master. (Least work involved as far as access, but cuts into future uses for these.)
- Bad Decorate/ACS hacks!
-
Blue Shadow
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: Set victim as tracer?
Yeah, #1 and #2 seem to be the best to go for...
