[Fixed] Hitscan & throwback
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.
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.
-
LilWhiteMouse
- Posts: 2270
- Joined: Tue Jul 15, 2003 7:00 pm
- Location: Maine, US
Hitscan & throwback
I've noticed with hitscan weapons that low mass enemies have a tendancy to fly torwards you when they die. I don't remember this in Doom or older versions of ZDoom.
-
Biff
- Posts: 1061
- Joined: Wed Jul 16, 2003 5:29 pm
- Location: Monrovia, CA, USA
-
LilWhiteMouse
- Posts: 2270
- Joined: Tue Jul 15, 2003 7:00 pm
- Location: Maine, US
-
Ultraviolet
- Posts: 1152
- Joined: Tue Jul 15, 2003 9:08 pm
- Location: PROJECT DETAILS CLASSIFIED.
-
randi
- Site Admin
- Posts: 7749
- Joined: Wed Jul 09, 2003 10:30 pm
From the source code:
Code: Select all
// make fall forwards sometimes
if ((damage < 40) && (damage > target->health)
&& (target->z - inflictor->z > 64*FRACUNIT)
&& (pr_damagemobj()&1))-
Hirogen2
- Posts: 2033
- Joined: Sat Jul 19, 2003 6:15 am
- Operating System Version (Optional): Tumbleweed x64
- Graphics Processor: Intel with Vulkan/Metal Support
- Location: Central Germany
-
Chris
- Posts: 2999
- Joined: Thu Jul 17, 2003 12:07 am
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
-
LilWhiteMouse
- Posts: 2270
- Joined: Tue Jul 15, 2003 7:00 pm
- Location: Maine, US
-
Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Ok, here it goes:
if ((damage < 40)
Do this only if the damage inflicted is less than 40 health points.
(can't say from a picture but it seems in your case it was the case)
&& (damage > target->health)
.. and higher than the victim's health
(as in: he will be killed for sure - like your Zombie)
&& (target->z - inflictor->z > 64*FRACUNIT)
The one who shot the poor guy is standing at least 64 units below the victim
(your crate would do that!)
&& (pr_damagemobj()&1))
a little randomness so it doesn't happen always.
If all the stuff above applies the following happens
(ang is the angle of thrust being applied to the victim)
{
ang += ANG180;
thrust *= 4;
}
Just reverse the angle (push the guy forward instead of backward) and multiply the thrust force by 4 so a minor push backward is turned into a bigger push forward.
if ((damage < 40)
Do this only if the damage inflicted is less than 40 health points.
(can't say from a picture but it seems in your case it was the case)
&& (damage > target->health)
.. and higher than the victim's health
(as in: he will be killed for sure - like your Zombie)
&& (target->z - inflictor->z > 64*FRACUNIT)
The one who shot the poor guy is standing at least 64 units below the victim
(your crate would do that!)
&& (pr_damagemobj()&1))
a little randomness so it doesn't happen always.
If all the stuff above applies the following happens
(ang is the angle of thrust being applied to the victim)
{
ang += ANG180;
thrust *= 4;
}
Just reverse the angle (push the guy forward instead of backward) and multiply the thrust force by 4 so a minor push backward is turned into a bigger push forward.
-
Kappes Buur
-

- Posts: 4208
- Joined: Thu Jul 17, 2003 12:19 am
- Graphics Processor: nVidia (Legacy GZDoom)
- Location: British Columbia, Canada
-
Cyb
- Posts: 912
- Joined: Tue Jul 15, 2003 5:12 pm
-
Bio Hazard
- Posts: 4019
- Joined: Fri Aug 15, 2003 8:15 pm
- Location: ferret ~/C/ZDL $
-
Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
-
IntergalacticWalrus
- Posts: 31
- Joined: Mon Sep 01, 2003 2:02 pm
- Location: E2M2, among the many UAC boxes
Re: Hitscan & throwback
I can't see why you never noticed this in the original Doom, it happened all the time. Especially in the first episode of Doom, where there are lots of places where zombies and imps are standing on top of high edges, and killing them with bullets cause them to fall down. That's perfectly normal, it gives the game a more cinematic effect, I guess.LilWhiteMouse wrote:I've noticed with hitscan weapons that low mass enemies have a tendancy to fly torwards you when they die. I don't remember this in Doom or older versions of ZDoom.
-
HotWax
- Posts: 10002
- Joined: Fri Jul 18, 2003 6:18 pm
- Location: Idaho Falls, ID
I don't think the problem is that an enemy on a ledge will sometimes fall forward and thus off the ledge; that would seem to be a natural enough occurance that would happen in reality. The problem is that, apparently to ensure the victim does indeed reach and fall off the ledge, they multiply the force by a factor of 4. This might be okay for a light nudge, but if you blast someone at close range with an SSG, multiplying the already high force by 4 is going to make them move insanely fast. Even if you left the direction alone, that would look wrong. Reversing it makes matters much worse. Hitting someone full in the face with an SSG should NOT cause them to fly in YOUR direction at 50 MPH. That's just silly.
Perhaps an upper limit could be applied to the force, either as an additional condition:
if ((damage < 40) && (blah blah blah) && (force < xyz) . . .
where xyz is some abitrary amount of force. This way if you smack the crap out of someone, there's no way that the engine will decide it's a good time to make them fall FORWARD, which seems pretty logical...
or, you could apply the limit after the other calculations...
{
ang += ANG180;
if ((thrust *= 4) > xyz) thrust = xyz;
}
which would simply ensure that the corpse doesn't come flying at you like a bat out of hell.
Perhaps an upper limit could be applied to the force, either as an additional condition:
if ((damage < 40) && (blah blah blah) && (force < xyz) . . .
where xyz is some abitrary amount of force. This way if you smack the crap out of someone, there's no way that the engine will decide it's a good time to make them fall FORWARD, which seems pretty logical...
or, you could apply the limit after the other calculations...
{
ang += ANG180;
if ((thrust *= 4) > xyz) thrust = xyz;
}
which would simply ensure that the corpse doesn't come flying at you like a bat out of hell.
