Bullet Tracer Spawning
Moderator: GZDoom Developers
-
- Posts: 8111
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Bullet Tracer Spawning
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.
-
- Posts: 3101
- Joined: Fri Apr 14, 2006 3:17 pm
- Location: in "the darkness that lurks in our mind"
Re: Bullet Tracer Spawning
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.
-
- Posts: 8111
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Bullet Tracer Spawning
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...
-
- Posts: 483
- Joined: Tue Nov 29, 2005 2:15 pm
- Graphics Processor: nVidia with Vulkan support
Re: Bullet Tracer Spawning
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).
If anyone wants to know how I did it, let me know and I'll post examples later. (Currently very busy).
-
- Posts: 8111
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Bullet Tracer Spawning
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.
@StrikerMan780: This is meant to replace that kind of stuff indeed.
-
-
- Posts: 10772
- Joined: Sun Jul 20, 2003 12:15 pm
Re: Bullet Tracer Spawning
Finally got a chance to sit down play around with this, and I noticed a couple of issues:
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.
- 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 &&
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.

-
- Posts: 8111
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Bullet Tracer Spawning
Ah, keen eyes Xaser. Thanks!
And fixed.
And fixed.
-
-
- Posts: 10772
- Joined: Sun Jul 20, 2003 12:15 pm
Re: Bullet Tracer Spawning
Since I hadn't actually responded yet: code seems good to me after the latest commit, FWIW.
-
- Posts: 8111
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Bullet Tracer Spawning
Is this still waiting by any chance?
-
- Lead GZDoom+Raze Developer
- Posts: 48666
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Bullet Tracer Spawning
No, but the last change was just before I left for vacation. Will have to review this a bit before merging.
-
- Lead GZDoom+Raze Developer
- Posts: 48666
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Bullet Tracer Spawning
I think this is mostly ok, but there's one problem:
This code
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.
This code
Code: Select all
if (!puff)
{
temp = true;
puff = P_LineAttack(self, bangle, range, bslope, 0, NAME_Hitscan, pufftype, laflags | LAF_NOINTERACT);
}
-
- Posts: 8111
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Bullet Tracer Spawning
So back to the old requirement of +ALWAYSPUFF then?
-
- Lead GZDoom+Raze Developer
- Posts: 48666
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Bullet Tracer Spawning
No. But you call that stuff even when you do not need it. Do it inside a check for spawning a projectile.
-
- Posts: 8111
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Bullet Tracer Spawning
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?
Anything else?
-
- Posts: 8111
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team