Backport some changes from development branch:

- Made Kinsie's Test Map changes toggleable (off by default)
 - Corrected physics of various projectiles
 - Replaced textures of health items to something better looking
 - Biosludge now only has a hitbox when stuck to surfaces, to be
   more consistent with vanilla behavior
 - Some code cleanup
This commit is contained in:
Marisa the Magician 2019-01-22 13:34:14 +01:00
commit 5435f06d4e
20 changed files with 222 additions and 285 deletions

View file

@ -198,8 +198,6 @@ Class BioGel : Actor
deadtimer = -1;
l = Spawn("BioLight",pos);
l.target = self;
b = Spawn("BioHitbox",pos);
b.target = self;
rollvel = FRandom[GES](10,30)*RandomPick[GES](-1,1);
pitchvel = FRandom[GES](10,30)*RandomPick[GES](-1,1);
yawvel = FRandom[GES](10,30)*RandomPick[GES](-1,1);
@ -297,72 +295,8 @@ Class BioGel : Actor
SetStateLabel("XDeath");
return;
}
FLineTraceData d;
A_SetSize(0.1,0);
if ( BlockingLine )
{
atline = BlockingLine;
normal = (-BlockingLine.delta.y,BlockingLine.delta.x,0).unit();
atside = 1;
if ( !BlockingLine.sidedef[1] || (CurSector == BlockingLine.frontsector) )
{
atside = 0;
normal *= -1;
}
Vector3 orig = (BlockingLine.v1.p.x,BlockingLine.v1.p.y,0);
Vector3 onwall = pos-(normal dot (pos-orig))*normal;
SetOrigin(onwall+normal*0.5,false);
// attempt to guess line part (upper/mid/lower)
if ( !atline.sidedef[1] ) atpart = 0; // mid
else if ( atline.sidedef[atside?0:1].sector.ceilingplane.ZAtPoint(pos.xy) < pos.z ) atpart = 1; // upper
else if ( atline.sidedef[atside?0:1].sector.floorplane.ZAtPoint(pos.xy) > pos.z ) atpart = -1; // lower
else atpart = 0;
if ( atpart == 1 )
{
if ( atline.flags&Line.ML_DONTPEGTOP ) atz = pos.z-atline.sidedef[atside].sector.GetPlaneTexZ(1);
else atz = pos.z-atline.sidedef[atside?0:1].sector.GetPlaneTexZ(1);
}
else if ( atpart == -1 )
{
if ( atline.flags&Line.ML_DONTPEGBOTTOM ) atz = pos.z-atline.sidedef[atside].sector.GetPlaneTexZ(0);
else atz = pos.z-atline.sidedef[atside?0:1].sector.GetPlaneTexZ(0);
}
else if ( atline.flags&Line.ML_DONTPEGBOTTOM ) atz = pos.z-atline.sidedef[atside].sector.GetPlaneTexZ(0);
else atz = pos.z-atline.sidedef[atside].sector.GetPlaneTexZ(1);
angle = atan2(normal.y,normal.x);
pitch = 0;
roll = 180; // otherwise it slides upwards (UT changes roll like this too)
if ( waterlevel > 0 ) hittype = HIT_FLOOR;
else hittype = HIT_WALL;
}
else if ( pos.z <= floorz+4 )
{
atsector = cursector;
atplane = 0;
normal = cursector.floorplane.Normal;
pitch = asin(-normal.z);
angle = atan2(normal.y,normal.x);
roll = FRandom[GES](0,360);
SetOrigin((pos.x,pos.y,floorz)+normal*0.5,false);
atz = pos.z-cursector.GetPlaneTexZ(0);
hittype = HIT_FLOOR;
}
else if ( pos.z >= ceilingz-8 )
{
atsector = cursector;
atplane = 1;
normal = cursector.ceilingplane.Normal;
pitch = asin(-normal.z);
angle = atan2(normal.y,normal.x);
roll = FRandom[GES](0,360);
SetOrigin((pos.x,pos.y,ceilingz)+normal*0.5,false);
atz = pos.z-cursector.GetPlaneTexZ(1);
if ( waterlevel > 0 ) hittype = HIT_FLOOR;
else if ( normal dot (0,0,-1) > 0.7 )
hittype = HIT_CEILING;
else hittype = HIT_FLOOR;
}
else if ( tracer && tracer.bACTLIKEBRIDGE )
if ( tracer && tracer.bACTLIKEBRIDGE )
{
atbridge = tracer;
onbridge = true;
@ -461,11 +395,76 @@ Class BioGel : Actor
}
}
}
else if ( BlockingFloor )
{
atsector = BlockingFloor;
atplane = 0;
normal = BlockingFloor.floorplane.Normal;
pitch = asin(-normal.z);
angle = atan2(normal.y,normal.x);
roll = FRandom[GES](0,360);
SetOrigin((pos.x,pos.y,floorz)+normal*0.5,false);
atz = pos.z-BlockingFloor.GetPlaneTexZ(0);
hittype = HIT_FLOOR;
}
else if ( BlockingCeiling )
{
atsector = BlockingCeiling;
atplane = 1;
normal = BlockingCeiling.ceilingplane.Normal;
pitch = asin(-normal.z);
angle = atan2(normal.y,normal.x);
roll = FRandom[GES](0,360);
SetOrigin((pos.x,pos.y,ceilingz)+normal*0.5,false);
atz = pos.z-BlockingCeiling.GetPlaneTexZ(1);
if ( waterlevel > 0 ) hittype = HIT_FLOOR;
else if ( normal dot (0,0,-1) > 0.7 )
hittype = HIT_CEILING;
else hittype = HIT_FLOOR;
}
else if ( BlockingLine )
{
atline = BlockingLine;
normal = (-BlockingLine.delta.y,BlockingLine.delta.x,0).unit();
atside = 1;
if ( !BlockingLine.sidedef[1] || (CurSector == BlockingLine.frontsector) )
{
atside = 0;
normal *= -1;
}
Vector3 orig = (BlockingLine.v1.p.x,BlockingLine.v1.p.y,0);
Vector3 onwall = pos-(normal dot (pos-orig))*normal;
SetOrigin(onwall+normal*0.5,false);
// attempt to guess line part (upper/mid/lower)
if ( !atline.sidedef[1] ) atpart = 0; // mid
else if ( atline.sidedef[atside?0:1].sector.ceilingplane.ZAtPoint(pos.xy) < pos.z ) atpart = 1; // upper
else if ( atline.sidedef[atside?0:1].sector.floorplane.ZAtPoint(pos.xy) > pos.z ) atpart = -1; // lower
else atpart = 0;
if ( atpart == 1 )
{
if ( atline.flags&Line.ML_DONTPEGTOP ) atz = pos.z-atline.sidedef[atside].sector.GetPlaneTexZ(1);
else atz = pos.z-atline.sidedef[atside?0:1].sector.GetPlaneTexZ(1);
}
else if ( atpart == -1 )
{
if ( atline.flags&Line.ML_DONTPEGBOTTOM ) atz = pos.z-atline.sidedef[atside].sector.GetPlaneTexZ(0);
else atz = pos.z-atline.sidedef[atside?0:1].sector.GetPlaneTexZ(0);
}
else if ( atline.flags&Line.ML_DONTPEGBOTTOM ) atz = pos.z-atline.sidedef[atside].sector.GetPlaneTexZ(0);
else atz = pos.z-atline.sidedef[atside].sector.GetPlaneTexZ(1);
angle = atan2(normal.y,normal.x);
pitch = 0;
roll = 180; // otherwise it slides upwards (UT changes roll like this too)
if ( waterlevel > 0 ) hittype = HIT_FLOOR;
else hittype = HIT_WALL;
}
else
{
SetStateLabel("XDeath");
return;
}
b = Spawn("BioHitbox",pos);
b.target = self;
A_PlaySound("ges/hit");
A_SprayDecal("BioSplat",-172);
int numpt = Min(100,int(Scale.x*10))+Random[GES](-5,5);