Correctly implement some projectile damages. Readjust damages to adapt to this change.

Add 3D explosion blast and knockback functions. Migrate pretty much everything to it.
Add "Classic Enhanced Shock Rifle" option, disables altfire and splash damage on beams.
Screen shakes for explosions now correctly fall off with distance.
Some minor refactoring/fixes.
This commit is contained in:
Marisa the Magician 2018-08-17 20:30:32 +02:00
commit 3267c89487
12 changed files with 103 additions and 45 deletions

View file

@ -925,4 +925,25 @@ Class UTMainHandler : StaticEventHandler
let hnd = UTMainHandler(StaticEventHandler.Find("UTMainHandler"));
hnd.flashes.push(qf);
}
// Doom's explosions aren't fully 3D
static void DoBlast( Actor Source, double ExplosionRadius, double MomentumTransfer )
{
BlockThingsIterator bi = BlockThingsIterator.Create(Source,ExplosionRadius);
while ( bi.Next() )
{
Actor a = bi.Thing;
if ( !a || !a.bSHOOTABLE || !Source.CheckSight(a,0xf) || (a == Source) )
continue;
Vector3 midpoint = a.Vec3Offset(0,0,a.height*0.5);
a.vel += Level.Vec3Diff(Source.pos,midpoint).unit()*(MomentumTransfer/(Thinker.TICRATE*a.mass));
}
}
// Same for this
static void DoKnockback( Actor Victim, Vector3 HitDirection, double MomentumTransfer )
{
if ( !Victim ) return;
Victim.vel += HitDirection*(MomentumTransfer/(Thinker.TICRATE*Victim.Mass));
}
}