Generalized hitnormal functions (where possible).

This commit is contained in:
Mari the Deer 2022-12-18 20:03:36 +01:00
commit b1683dae8e
24 changed files with 206 additions and 785 deletions

View file

@ -215,22 +215,7 @@ Class mkBloodDrop : SWWMNonInteractiveActor
LineTrace(ang,spd,pt,TRF_THRUACTORS|TRF_THRUHITSCAN|TRF_ABSPOSITION,newpos.z,newpos.x,newpos.y,d);
if ( d.HitType != TRACE_HitNone )
{
Vector3 hitnormal = -d.HitDir;
if ( d.HitType == TRACE_HitFloor )
{
if ( d.Hit3DFloor ) hitnormal = -d.Hit3DFloor.top.Normal;
else hitnormal = d.HitSector.floorplane.Normal;
}
else if ( d.HitType == TRACE_HitCeiling )
{
if ( d.Hit3DFloor ) hitnormal = -d.Hit3DFloor.bottom.Normal;
else hitnormal = d.HitSector.ceilingplane.Normal;
}
else if ( d.HitType == TRACE_HitWall )
{
hitnormal = (-d.HitLine.delta.y,d.HitLine.delta.x,0).unit();
if ( !d.LineSide ) hitnormal *= -1;
}
Vector3 hitnormal = SWWMUtility.GetLineTraceHitNormal(d);
newpos = d.HitLocation+hitnormal;
}
else newpos = level.Vec3Offset(newpos,vel);