A bug regarding HITTARGET, HITMASTER and HITTRACER?

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
Fishytza
Posts: 793
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: They/Them
Contact:

A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by Fishytza »

According to Major Cooke's git log:
HITTARGET, HITMASTER, and HITTRACER.
A missile that dies hitting an actor will set this impacted actor as the new target/master/tracer, depending on specifications.
And according to the commentary in actor.h:
MF7_HITTARGET = 0x00004000, // The actor the projectile dies on is set to target, provided it's targetable anyway.
MF7_HITMASTER = 0x00008000, // Same as HITTARGET, except it's master instead of target.
MF7_HITTRACER = 0x00010000, // Same as HITTARGET, but for tracer.
The way I understand it, these flags are supposed to be used on missiles, correct? However, when I look at the code it seems that it's the victim's flags which are checked rather than the missile's.

This is what it looks like right now:

Code: Select all

		if (target->flags7 & MF7_HITTARGET)	mo->target = target;
		if (target->flags7 & MF7_HITMASTER)	mo->master = target;
		if (target->flags7 & MF7_HITTRACER)	mo->tracer = target;
But shouldn't it check mo's (the missile's) flags, like so?

Code: Select all

		if (mo->flags7 & MF7_HITTARGET)	mo->target = target;
		if (mo->flags7 & MF7_HITMASTER)	mo->master = target;
		if (mo->flags7 & MF7_HITTRACER)	mo->tracer = target;
D2JK
Posts: 545
Joined: Sat Aug 30, 2014 8:21 am

Re: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by D2JK »

I can't get it to work either, trying to test the flag(s) with a code like this:
Spoiler:
User avatar
Major Cooke
Posts: 8211
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: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by Major Cooke »

D2JK
Posts: 545
Joined: Sat Aug 30, 2014 8:21 am

Re: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by D2JK »

It works now, thank you for another useful addition!

Though I wish it worked for puffs too, but hey.
User avatar
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: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by NeuralStunner »

D2JK wrote:Though I wish it worked for puffs too, but hey.
Agreed, and I don't imagine it would be any harder to do. The puff-spawning code already "knows" about victims.
User avatar
Ghastly
... in rememberance ...
Posts: 6109
Joined: Fri Jul 06, 2007 2:34 pm

Re: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by Ghastly »

NeuralStunner wrote:
D2JK wrote:Though I wish it worked for puffs too, but hey.
Agreed, and I don't imagine it would be any harder to do. The puff-spawning code already "knows" about victims.
Rail attacks are surprisingly easy to add that to as well.
User avatar
Major Cooke
Posts: 8211
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: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by Major Cooke »

I'll look into it. I just dont like working with the bullet code because it's confusing. Hard to tell sometimes if it's thepuff or puffDefaults on whom should get these things.
User avatar
Major Cooke
Posts: 8211
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: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by Major Cooke »

Added.
User avatar
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: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by NeuralStunner »

One last thought: What about integrating these behaviors with bouncing? I have a situation in which I'd like to make a missile react to certain enemies when it tries to bounce off them.
User avatar
Major Cooke
Posts: 8211
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: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by Major Cooke »

Done. Though next time, please do make a feature suggestions thread instead of asking in a bug report. :P
User avatar
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: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by NeuralStunner »

I was primarily seeking your opinion on the idea, first. A formal suggestion might've needed to be along the lines of separate flags for bouncing behaviors. If you're okay with throwing it in now then that's fine, too. :P
User avatar
Major Cooke
Posts: 8211
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: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by Major Cooke »

NeuralStunner wrote:A formal suggestion might've needed to be along the lines of separate flags-SNIP-
No it doesn't. It can be super simple and it'd still fit the thread unless mods say otherwise. Pin the blame on me if they do, 'cause it's truthfully me who said it. :P You must not have seen some of my other suggestions back before I got into this coding.

Throw in what?
User avatar
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: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by NeuralStunner »

Major Cooke wrote:Throw in what?
Your most recent addition. It seems it's been merged, so apparently the devs are cool with it.
User avatar
AFADoomer
Posts: 1342
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by AFADoomer »

Sorry to bump this, but has anyone had any luck getting this to work on puffs spawned by rail or standard bullet attacks?

This doesn't work, even thought the graphical part of the puff spawns:

Code: Select all

Actor WeaponHit
{
	+NOBLOCKMAP
	+NOGRAVITY
	+ALWAYSPUFF
	+PUFFONACTORS
	+HITTARGET
	States
	{
		Spawn:
			TNT1 A 0
		XDeath:
			UNKN A 35 A_GiveInventory("Disintegration", 1, AAPTR_TARGET)
			Stop
	}
}
I've tried all of the Master/Tracer/Target variants, and assigned the puff to both rail and bullet attacks, with no luck. The UNKNA0 sprite shows up, but nothing is given. Using the same technique on a true projectile works fine.

EDIT:
For P_LineAttack, lines 769-771 of p_map.cpp have:

Code: Select all

if (puffDefaults->flags7 && MF7_HITTARGET) puff->target = trace.Actor;
if (puffDefaults->flags7 && MF7_HITMASTER) puff->master = trace.Actor;
if (puffDefaults->flags7 && MF7_HITTRACER) puff->tracer = trace.Actor;
Too many '&'s!

EDIT2:
For P_RailAttack, Line 4214:

Code: Select all

P_SpawnPuff(source, puffclass, x, y, z, (source->angle + angleoffset) - ANG90, 1, puffflags);
This spawns the puff, but doesn't assign that puff as 'thepuff', so I think that's why the actor pointers don't get assigned to that spawned puff.

Though I'm also not quite sure what line 4182 is trying to do:

Code: Select all

if (puffclass != NULL) thepuff = Spawn(puffclass, source->x, source->y, source->z, ALLOW_REPLACE);
Is it supposed to spawn a puff at the rail origin?
User avatar
Major Cooke
Posts: 8211
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: A bug regarding HITTARGET, HITMASTER and HITTRACER?

Post by Major Cooke »

Please submit new bug reports next time. It's not ideal for developers or contributors to fix bugs in a section that's CLOSED.

Anyway, I'll fix this.
Post Reply

Return to “Closed Bugs [GZDoom]”