Merge branch 'experimental' into devel

This commit is contained in:
Marisa the Magician 2019-09-11 15:46:30 +02:00
commit 0b4767d7de
9 changed files with 108 additions and 20 deletions

View file

@ -239,8 +239,31 @@ Class FlakChunk : Actor
// chunks in vanilla have a special variation on the standard reflect formula that causes them to bounce differently when hitting a surface head-on
// (0.5 to 0.8 reduction perpendicular to the surface normal, to be specific)
Vector3 HitNormal = -vel.unit();
if ( BlockingFloor ) HitNormal = BlockingFloor.floorplane.Normal;
else if ( BlockingCeiling ) HitNormal = BlockingCeiling.ceilingplane.Normal;
F3DFloor ff;
if ( BlockingFloor )
{
// find closest 3d floor for its normal
for ( int i=0; i<CurSector.Get3DFloorCount(); i++ )
{
if ( !(CurSector.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
ff = CurSector.Get3DFloor(i);
break;
}
if ( ff ) HitNormal = -ff.top.Normal;
else HitNormal = BlockingFloor.floorplane.Normal;
}
else if ( BlockingCeiling )
{
// find closest 3d floor for its normal
for ( int i=0; i<CurSector.Get3DFloorCount(); i++ )
{
if ( !(CurSector.Get3DFloor(i).bottom.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
ff = CurSector.Get3DFloor(i);
break;
}
if ( ff ) HitNormal = -ff.bottom.Normal;
else HitNormal = BlockingCeiling.ceilingplane.Normal;
}
else if ( BlockingLine )
{
HitNormal = (-BlockingLine.delta.y,BlockingLine.delta.x,0).unit();