Bullet Tracer Spawning

Moderator: GZDoom Developers

User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

I designed that FireBulletMissile just so I could reduce code redundancy inside of A_FireBullets. It's not supposed to be called by A_CustomMissile because of the two different spawn functions used.
User avatar
DBThanatos
Posts: 3101
Joined: Fri Apr 14, 2006 3:17 pm
Location: in "the darkness that lurks in our mind"
Contact:

Re: Bullet Tracer Spawning

Post by DBThanatos »

Well, this would be incredibly useful. Fake tracers look bad because you cant put the tracer to go precisely where the puff spawned if the weapon has ANY spread. This is very noticeable in any type of zoom, even if not a big one.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

Not to mention you'd have to call A_CheckSight just to kill off the tracer properly, too. A_CheckLOF cannot return the distance from something it hits unfortunately...
User avatar
StrikerMan780
Posts: 485
Joined: Tue Nov 29, 2005 2:15 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Bullet Tracer Spawning

Post by StrikerMan780 »

I actually made clever, and quite clean tracer code a while back, no ACS required. Just A_Warp and some switching of pointers. Works with weapons that have spread. However, a native implementation would be nice, since there's two downsides to my simple implementation: Offsets don't consider floor clipping, nor crouching. It also doesn't adjust if different player classes have different shooting heights. However, if you don't need to worry about that last one, it's fine in most cases.

If anyone wants to know how I did it, let me know and I'll post examples later. (Currently very busy).
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

Puffs no longer require +ALWAYSPUFF. Also cleaned up the code quite a bit in A_FireBullets and A_CustomBulletAttack.

@StrikerMan780: This is meant to replace that kind of stuff indeed.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Bullet Tracer Spawning

Post by Xaser »

Finally got a chance to sit down play around with this, and I noticed a couple of issues:
  • thingdef_codeptr.cpp line 1652: "bangle" and "bslope" should be "angle" and "slope"
  • thingdef_codeptr.cpp line 1932: "bangle" and "bslope" should be "angle" and "slope"
  • p_map.cpp line 4099: should use single &, not double &&
Here's a quick test wad showcasing the oddities that result. There's a Chaingun and Rocket Launcher replacement in slots 4 and 5 (summon "ChaingunTest" and "WeirdGun", respectively"). Both weapons' primary fires exhibit aim issues (point at an enemy or the sky), and the chaingun's secondary fire deals no damage since the double && accidentally sets the NOINTERACT flag on the real puff.

I fixed the 3 issues in my local environment, and after that, the test wad (and the rest of my mucking about) all works as expected.

Nothing else seems awry, and the feature's fun to play with, so "whoop!" there. :P
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

Ah, keen eyes Xaser. Thanks!

And fixed.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Bullet Tracer Spawning

Post by Xaser »

Since I hadn't actually responded yet: code seems good to me after the latest commit, FWIW.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

Is this still waiting by any chance?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Bullet Tracer Spawning

Post by Graf Zahl »

No, but the last change was just before I left for vacation. Will have to review this a bit before merging.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Bullet Tracer Spawning

Post by Graf Zahl »

I think this is mostly ok, but there's one problem:

This code

Code: Select all

			if (!puff)
			{
				temp = true;
				puff = P_LineAttack(self, bangle, range, bslope, 0, NAME_Hitscan, pufftype, laflags | LAF_NOINTERACT);
			}
which appears to be exclusively for the bullet tracer parts is called unconditionally. This needs to be changed. P_LineAttack is a very expensive call that should be avoided if not needed.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

So back to the old requirement of +ALWAYSPUFF then?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Bullet Tracer Spawning

Post by Graf Zahl »

No. But you call that stuff even when you do not need it. Do it inside a check for spawning a projectile.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

Okay, that's done now. The P_LineAttack will only spawn if both a projectile name is supplied and the missile actually spawns.

Anything else?
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

Post Reply

Return to “Closed Feature Suggestions [GZDoom]”