Various optimizations and a couple changes:
- Lightweight Tick() for smoke and debris (has some glitches I gotta figure out). - Add option for buckshot to gib (on by default). - Clips are replaced by shells again. - Increased look sensitivity when crouching with Silver Bullet. - Fix 3D floor handling of nonsolids. - Fix combat trackers not updating their position when an actor changes height while stationary (e.g.: crouching players).
This commit is contained in:
parent
bdd1116d6b
commit
431e2d5ddc
19 changed files with 510 additions and 54 deletions
|
|
@ -656,6 +656,7 @@ Mixin Class HellblazerGrenade
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingFloor.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingFloor.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingFloor.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = BlockingFloor.Get3DFloor(i);
|
||||
break;
|
||||
|
|
@ -668,6 +669,7 @@ Mixin Class HellblazerGrenade
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingCeiling.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).bottom.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
ff = BlockingCeiling.Get3DFloor(i);
|
||||
break;
|
||||
|
|
@ -988,6 +990,7 @@ Class HellblazerRavagerArm : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingFloor.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingFloor.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingFloor.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = BlockingFloor.Get3DFloor(i);
|
||||
break;
|
||||
|
|
@ -1000,6 +1003,7 @@ Class HellblazerRavagerArm : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingCeiling.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).bottom.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
ff = BlockingCeiling.Get3DFloor(i);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ Class mkBloodDrop : Actor
|
|||
FCheckPosition tm;
|
||||
// gravitational pull
|
||||
vel.z -= GetGravity();
|
||||
// movement subdivision (these damn things are tiny
|
||||
// movement subdivision (these damn things are tiny)
|
||||
int steps = 8;
|
||||
while ( (abs(vel.x) >= radius*steps) || (abs(vel.y) >= radius*steps) || (abs(vel.z) >= height*steps) )
|
||||
steps++;
|
||||
|
|
@ -211,6 +211,7 @@ Class mkBloodDrop : Actor
|
|||
F3DFloor ff;
|
||||
for ( int i=0; i<FloorSector.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(FloorSector.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(FloorSector.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = FloorSector.Get3DFloor(i);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -975,7 +975,7 @@ Class Wallbuster : SWWMWeapon
|
|||
for ( int i=0; i<t.HitList.Size(); i++ )
|
||||
{
|
||||
int realdmg = dmg?dmg:t.HitList[i].HitDamage;
|
||||
SWWMDamageAccumulator.Accumulate(t.HitList[i].HitActor,realdmg,invoker,self,'shot',!large);
|
||||
SWWMDamageAccumulator.Accumulate(t.HitList[i].HitActor,realdmg,invoker,self,'shot',!large&&!swwm_shotgib);
|
||||
SWWMUtility.DoKnockback(t.HitList[i].HitActor,t.HitList[i].x+(0,0,0.025),mm*FRandom[Wallbuster](0.4,1.2));
|
||||
if ( t.HitList[i].HitActor.bNOBLOOD || t.HitList[i].HitActor.bINVULNERABLE )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ Class PaletteLight : DynamicLight
|
|||
}
|
||||
}
|
||||
|
||||
// Generic particles
|
||||
// Generic smoke, lightweight tick
|
||||
Class SWWMSmoke : Actor
|
||||
{
|
||||
Default
|
||||
|
|
@ -98,39 +98,108 @@ Class SWWMSmoke : Actor
|
|||
+ROLLCENTER;
|
||||
+THRUACTORS;
|
||||
+NOTELEPORT;
|
||||
+CANBOUNCEWATER;
|
||||
-BOUNCEAUTOOFF;
|
||||
BounceType "Hexen";
|
||||
BounceFactor 1.0;
|
||||
WallBounceFactor 1.0;
|
||||
Scale 0.3;
|
||||
+NOINTERACTION;
|
||||
Scale .3;
|
||||
}
|
||||
|
||||
override void PostBeginPlay()
|
||||
{
|
||||
Super.PostBeginPlay();
|
||||
double ang, pt;
|
||||
scale *= FRandom[Puff](0.5,1.5);
|
||||
alpha *= FRandom[Puff](0.5,1.5);
|
||||
scale *= FRandom[Puff](.5,1.5);
|
||||
alpha *= FRandom[Puff](.5,1.5);
|
||||
ang = FRandom[Puff](0,360);
|
||||
pt = FRandom[Puff](-90,90);
|
||||
vel += (cos(pt)*cos(ang),cos(pt)*sin(ang),-sin(pt))*FRandom[Puff](0.2,0.8);
|
||||
vel += (cos(pt)*cos(ang),cos(pt)*sin(ang),-sin(pt))*FRandom[Puff](.2,.8);
|
||||
roll = Frandom[Puff](0,360);
|
||||
scale.x *= RandomPick[Puff](-1,1);
|
||||
scale.y *= RandomPick[Puff](-1,1);
|
||||
}
|
||||
override void Tick()
|
||||
{
|
||||
Super.Tick();
|
||||
prev = pos; // for interpolation
|
||||
if ( isFrozen() ) return;
|
||||
vel *= 0.96;
|
||||
vel.z += 0.01;
|
||||
vel *= .96;
|
||||
vel.z += .01;
|
||||
FCheckPosition tm;
|
||||
// movement subdivision (these damn things are tiny)
|
||||
int steps = 8;
|
||||
while ( (abs(vel.x) >= radius*steps) || (abs(vel.y) >= radius*steps) || (abs(vel.z) >= height*steps) )
|
||||
steps++;
|
||||
bool domove = (vel!=(0,0,0));
|
||||
if ( domove )
|
||||
{
|
||||
Vector3 steppy = vel/steps;
|
||||
int changexy = steppy.X||steppy.Y;
|
||||
bool readjust = false;
|
||||
for ( int i=0; i<steps; i++ )
|
||||
{
|
||||
if ( changexy && !TryMove(Vec2Offset(steppy.x,steppy.y),1,false,tm) )
|
||||
{
|
||||
// hit wall, slide along it
|
||||
if ( BlockingLine )
|
||||
{
|
||||
Vector3 normal = (-BlockingLine.delta.y,BlockingLine.delta.x,0).unit();
|
||||
if ( !SWWMUtility.PointOnLineSide(pos.xy,BlockingLine) )
|
||||
normal *= -1;
|
||||
vel = vel-FRandom[Puff](1.,1.2)*normal*(vel dot normal);
|
||||
}
|
||||
readjust = true;
|
||||
}
|
||||
AddZ(steppy.z);
|
||||
UpdateWaterLevel();
|
||||
if ( pos.z <= floorz )
|
||||
{
|
||||
// landed on floor, slide along it
|
||||
SetZ(floorz);
|
||||
F3DFloor ff;
|
||||
for ( int i=0; i<FloorSector.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(FloorSector.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(FloorSector.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = FloorSector.Get3DFloor(i);
|
||||
break;
|
||||
}
|
||||
Vector3 normal;
|
||||
if ( ff ) normal = -ff.model.ceilingplane.Normal;
|
||||
else normal = FloorSector.floorplane.Normal;
|
||||
vel = vel-FRandom[Puff](1.,1.2)*normal*(vel dot normal);
|
||||
readjust = true;
|
||||
}
|
||||
if ( pos.z+height > ceilingz )
|
||||
{
|
||||
// hit the ceiling, slide along it
|
||||
SetZ(ceilingz-height);
|
||||
F3DFloor ff;
|
||||
for ( int i=0; i<CeilingSector.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(CeilingSector.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(CeilingSector.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
ff = CeilingSector.Get3DFloor(i);
|
||||
break;
|
||||
}
|
||||
Vector3 normal;
|
||||
if ( ff ) normal = -ff.model.floorplane.Normal;
|
||||
else normal = CeilingSector.ceilingplane.Normal;
|
||||
vel = vel-FRandom[Puff](1.,1.2)*normal*(vel dot normal);
|
||||
readjust = true;
|
||||
}
|
||||
CheckPortalTransition();
|
||||
if ( readjust ) break; // movement changed, can't keep stepping
|
||||
}
|
||||
}
|
||||
if ( (waterlevel > 0) && !bAMBUSH )
|
||||
{
|
||||
let b = Spawn("SWWMBubble",pos);
|
||||
b.scale *= abs(scale.x);
|
||||
b.vel = vel;
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
if ( tics > 0 ) tics--;
|
||||
while ( !tics )
|
||||
{
|
||||
if ( !SetState(CurState.NextState) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +211,7 @@ Class SWWMSmoke : Actor
|
|||
}
|
||||
}
|
||||
|
||||
// ultra-lightweight non-interacting smoke, used by fire trails
|
||||
// strictly non-interacting smoke, much lighter tick, used for heavier effects
|
||||
Class SWWMHalfSmoke : Actor
|
||||
{
|
||||
Default
|
||||
|
|
@ -175,6 +244,7 @@ Class SWWMHalfSmoke : Actor
|
|||
}
|
||||
override void Tick()
|
||||
{
|
||||
prev = pos; // for interpolation
|
||||
if ( isFrozen() ) return;
|
||||
vel *= 0.96;
|
||||
vel.z += 0.01;
|
||||
|
|
@ -208,7 +278,6 @@ Class SWWMSmallSmoke : SWWMHalfSmoke
|
|||
{
|
||||
override void PostBeginPlay()
|
||||
{
|
||||
Actor.PostBeginPlay();
|
||||
double ang, pt;
|
||||
scale *= FRandom[Puff](0.1,0.3);
|
||||
alpha *= FRandom[Puff](0.5,1.5);
|
||||
|
|
@ -228,13 +297,13 @@ Class SWWMSmallSmoke : SWWMHalfSmoke
|
|||
}
|
||||
}
|
||||
|
||||
Class SWWMViewSmoke : SWWMSmoke
|
||||
// visual smoke, very strictly non-interacting, updates even when game is frozen
|
||||
Class SWWMViewSmoke : SWWMHalfSmoke
|
||||
{
|
||||
Vector3 ofs, vvel;
|
||||
|
||||
override void PostBeginPlay()
|
||||
{
|
||||
Actor.PostBeginPlay();
|
||||
double ang, pt;
|
||||
scale *= FRandom[Puff](0.1,0.3);
|
||||
alpha *= FRandom[Puff](0.5,1.5);
|
||||
|
|
@ -245,7 +314,7 @@ Class SWWMViewSmoke : SWWMSmoke
|
|||
|
||||
override void Tick()
|
||||
{
|
||||
Actor.Tick();
|
||||
prev = pos; // for interpolation
|
||||
if ( !target || !target.player )
|
||||
{
|
||||
Destroy();
|
||||
|
|
@ -255,12 +324,18 @@ Class SWWMViewSmoke : SWWMSmoke
|
|||
[x, y, z] = swwm_CoordUtil.GetAxes(target.pitch,target.angle,target.roll);
|
||||
Vector3 origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),x*ofs.x+y*ofs.y+z*ofs.z);
|
||||
SetOrigin(origin,true);
|
||||
UpdateWaterLevel();
|
||||
bInvisible = (players[consoleplayer].camera != target);
|
||||
if ( isFrozen() ) return;
|
||||
ofs += vvel;
|
||||
vvel *= 0.96;
|
||||
vvel.z += 0.01;
|
||||
if ( (waterlevel > 0) && !bAMBUSH ) Destroy();
|
||||
if ( tics > 0 ) tics--;
|
||||
while ( !tics )
|
||||
{
|
||||
if ( !SetState(CurState.NextState) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -276,11 +351,12 @@ Class SWWMBubble : Actor
|
|||
+DONTSPLASH;
|
||||
+FORCEXYBILLBOARD;
|
||||
+NOTELEPORT;
|
||||
+THRUACTORS;
|
||||
+NOINTERACTION;
|
||||
Scale 0.5;
|
||||
}
|
||||
override void PostBeginPlay()
|
||||
{
|
||||
Super.PostBeginPlay();
|
||||
double ang, pt;
|
||||
scale *= FRandom[Puff](0.5,1.5);
|
||||
ang = FRandom[Puff](0,360);
|
||||
|
|
@ -291,11 +367,85 @@ Class SWWMBubble : Actor
|
|||
}
|
||||
override void Tick()
|
||||
{
|
||||
Super.Tick();
|
||||
prev = pos;
|
||||
if ( isFrozen() ) return;
|
||||
vel *= 0.96;
|
||||
vel.z += 0.05;
|
||||
FCheckPosition tm;
|
||||
// movement subdivision (these damn things are tiny)
|
||||
int steps = 8;
|
||||
while ( (abs(vel.x) >= radius*steps) || (abs(vel.y) >= radius*steps) || (abs(vel.z) >= height*steps) )
|
||||
steps++;
|
||||
bool domove = (vel!=(0,0,0));
|
||||
if ( domove )
|
||||
{
|
||||
Vector3 steppy = vel/steps;
|
||||
int changexy = steppy.X||steppy.Y;
|
||||
bool readjust = false;
|
||||
for ( int i=0; i<steps; i++ )
|
||||
{
|
||||
if ( changexy && !TryMove(Vec2Offset(steppy.x,steppy.y),1,false,tm) )
|
||||
{
|
||||
// hit wall, slide along it
|
||||
if ( BlockingLine )
|
||||
{
|
||||
Vector3 normal = (-BlockingLine.delta.y,BlockingLine.delta.x,0).unit();;
|
||||
if ( !SWWMUtility.PointOnLineSide(pos.xy,BlockingLine) )
|
||||
normal *= -1;
|
||||
vel = vel-FRandom[Puff](1.,1.2)*normal*(vel dot normal);
|
||||
}
|
||||
readjust = true;
|
||||
}
|
||||
AddZ(steppy.z);
|
||||
UpdateWaterLevel();
|
||||
if ( pos.z <= floorz )
|
||||
{
|
||||
// landed on floor, slide along it
|
||||
SetZ(floorz);
|
||||
F3DFloor ff;
|
||||
for ( int i=0; i<FloorSector.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(FloorSector.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(FloorSector.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = FloorSector.Get3DFloor(i);
|
||||
break;
|
||||
}
|
||||
Vector3 normal;
|
||||
if ( ff ) normal = -ff.model.ceilingplane.Normal;
|
||||
else normal = FloorSector.floorplane.Normal;
|
||||
vel = vel-FRandom[Puff](1.,1.2)*normal*(vel dot normal);
|
||||
readjust = true;
|
||||
}
|
||||
if ( pos.z+height > ceilingz )
|
||||
{
|
||||
// hit the ceiling, slide along it
|
||||
SetZ(ceilingz-height);
|
||||
F3DFloor ff;
|
||||
for ( int i=0; i<CeilingSector.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(CeilingSector.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(CeilingSector.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
ff = CeilingSector.Get3DFloor(i);
|
||||
break;
|
||||
}
|
||||
Vector3 normal;
|
||||
if ( ff ) normal = -ff.model.floorplane.Normal;
|
||||
else normal = CeilingSector.ceilingplane.Normal;
|
||||
vel = vel-FRandom[Puff](1.,1.2)*normal*(vel dot normal);
|
||||
readjust = true;
|
||||
}
|
||||
CheckPortalTransition();
|
||||
if ( readjust ) break; // movement changed, can't keep stepping
|
||||
}
|
||||
}
|
||||
UpdateWaterLevel();
|
||||
if ( (waterlevel <= 0) || !Random[Puff](0,100) ) Destroy();
|
||||
if ( tics > 0 ) tics--;
|
||||
while ( !tics )
|
||||
{
|
||||
if ( !SetState(CurState.NextState) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
States
|
||||
{
|
||||
|
|
@ -307,6 +457,10 @@ Class SWWMBubble : Actor
|
|||
|
||||
Class SWWMSpark : Actor
|
||||
{
|
||||
bool dead;
|
||||
Sector tracksector;
|
||||
int trackplane;
|
||||
|
||||
Default
|
||||
{
|
||||
RenderStyle "Add";
|
||||
|
|
@ -314,25 +468,143 @@ Class SWWMSpark : Actor
|
|||
Height 2;
|
||||
+NOBLOCKMAP;
|
||||
+FORCEXYBILLBOARD;
|
||||
+MISSILE;
|
||||
+DROPOFF;
|
||||
+THRUACTORS;
|
||||
+NOTELEPORT;
|
||||
+DONTSPLASH;
|
||||
BounceType "Doom";
|
||||
BounceFactor 0.4;
|
||||
+NOINTERACTION;
|
||||
Gravity 0.2;
|
||||
Scale 0.05;
|
||||
}
|
||||
override void Tick()
|
||||
{
|
||||
Super.Tick();
|
||||
prev = pos;
|
||||
if ( isFrozen() ) return;
|
||||
if ( dead )
|
||||
{
|
||||
// do nothing but follow floor movement
|
||||
if ( tracksector )
|
||||
{
|
||||
double trackz;
|
||||
if ( trackplane ) trackz = tracksector.ceilingplane.ZAtPoint(pos.xy);
|
||||
else trackz = tracksector.floorplane.ZAtPoint(pos.xy);
|
||||
if ( trackz != pos.z )
|
||||
{
|
||||
SetZ(trackz);
|
||||
UpdateWaterLevel(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vel.z -= GetGravity();
|
||||
FCheckPosition tm;
|
||||
// movement subdivision (these damn things are tiny)
|
||||
int steps = 8;
|
||||
while ( (abs(vel.x) >= radius*steps) || (abs(vel.y) >= radius*steps) || (abs(vel.z) >= height*steps) )
|
||||
steps++;
|
||||
bool domove = (vel!=(0,0,0));
|
||||
if ( domove )
|
||||
{
|
||||
Vector3 steppy = vel/steps;
|
||||
int changexy = steppy.X||steppy.Y;
|
||||
bool readjust = false;
|
||||
for ( int i=0; i<steps; i++ )
|
||||
{
|
||||
if ( changexy && !TryMove(Vec2Offset(steppy.x,steppy.y),1,false,tm) )
|
||||
{
|
||||
// hit wall, bounce on it
|
||||
if ( BlockingLine )
|
||||
{
|
||||
Vector3 normal = (-BlockingLine.delta.y,BlockingLine.delta.x,0).unit();;
|
||||
if ( !SWWMUtility.PointOnLineSide(pos.xy,BlockingLine) )
|
||||
normal *= -1;
|
||||
vel = .4*(vel-2.*normal*(vel dot normal));
|
||||
}
|
||||
readjust = true;
|
||||
}
|
||||
AddZ(steppy.z);
|
||||
UpdateWaterLevel();
|
||||
if ( pos.z <= floorz )
|
||||
{
|
||||
// landed on floor, bounce on it
|
||||
SetZ(floorz);
|
||||
F3DFloor ff;
|
||||
for ( int i=0; i<FloorSector.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(FloorSector.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(FloorSector.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = FloorSector.Get3DFloor(i);
|
||||
break;
|
||||
}
|
||||
Vector3 normal;
|
||||
if ( ff ) normal = -ff.model.ceilingplane.Normal;
|
||||
else normal = FloorSector.floorplane.Normal;
|
||||
vel = .4*(vel-2.*normal*(vel dot normal));
|
||||
readjust = true;
|
||||
}
|
||||
if ( pos.z+height > ceilingz )
|
||||
{
|
||||
// hit the ceiling, bounce on it
|
||||
SetZ(ceilingz-height);
|
||||
F3DFloor ff;
|
||||
for ( int i=0; i<CeilingSector.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(CeilingSector.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(CeilingSector.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
ff = CeilingSector.Get3DFloor(i);
|
||||
break;
|
||||
}
|
||||
Vector3 normal;
|
||||
if ( ff ) normal = -ff.model.floorplane.Normal;
|
||||
else normal = CeilingSector.ceilingplane.Normal;
|
||||
vel = .4*(vel-2.*normal*(vel dot normal));
|
||||
readjust = true;
|
||||
}
|
||||
CheckPortalTransition();
|
||||
if ( readjust ) break; // movement changed, can't keep stepping
|
||||
}
|
||||
}
|
||||
if ( (max(abs(vel.x),max(abs(vel.y),abs(vel.z))) < 1.) && (pos.z <= floorz) )
|
||||
{
|
||||
SetZ(floorz);
|
||||
F3DFloor ff;
|
||||
for ( int i=0; i<FloorSector.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(FloorSector.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(FloorSector.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = FloorSector.Get3DFloor(i);
|
||||
break;
|
||||
}
|
||||
if ( ff )
|
||||
{
|
||||
tracksector = ff.model;
|
||||
trackplane = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
tracksector = FloorSector;
|
||||
trackplane = 0;
|
||||
}
|
||||
vel = (0,0,0);
|
||||
dead = true;
|
||||
SetStateLabel("Death");
|
||||
return;
|
||||
}
|
||||
}
|
||||
UpdateWaterLevel();
|
||||
if ( waterlevel > 0 )
|
||||
{
|
||||
let b = Spawn("SWWMBubble",pos);
|
||||
b.vel = vel;
|
||||
b.scale *= 0.3;
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
if ( tics > 0 ) tics--;
|
||||
while ( !tics )
|
||||
{
|
||||
if ( !SetState(CurState.NextState) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
States
|
||||
|
|
@ -351,15 +623,15 @@ Class SWWMChip : Actor
|
|||
SWWMChip prevchip, nextchip;
|
||||
bool killme;
|
||||
double rollvel;
|
||||
bool dead;
|
||||
Sector tracksector;
|
||||
int trackplane;
|
||||
|
||||
Default
|
||||
{
|
||||
Radius 2;
|
||||
Height 2;
|
||||
+NOBLOCKMAP;
|
||||
+MISSILE;
|
||||
+DROPOFF;
|
||||
+MOVEWITHSECTOR;
|
||||
+THRUACTORS;
|
||||
+NOTELEPORT;
|
||||
+DONTSPLASH;
|
||||
|
|
@ -367,14 +639,12 @@ Class SWWMChip : Actor
|
|||
+ROLLSPRITE;
|
||||
+ROLLCENTER;
|
||||
+FORCEXYBILLBOARD;
|
||||
BounceType "Doom";
|
||||
BounceFactor 0.3;
|
||||
+NOINTERACTION;
|
||||
Gravity 0.35;
|
||||
Scale 0.2;
|
||||
}
|
||||
override void PostBeginPlay()
|
||||
{
|
||||
Super.PostBeginPlay();
|
||||
rollvel = FRandom[Junk](10,30)*RandomPick[Junk](-1,1);
|
||||
frame = Random[Junk](0,5);
|
||||
scale *= Frandom[Junk](0.8,1.2);
|
||||
|
|
@ -387,14 +657,135 @@ Class SWWMChip : Actor
|
|||
}
|
||||
override void Tick()
|
||||
{
|
||||
Super.Tick();
|
||||
prev = pos; // for interpolation
|
||||
if ( isFrozen() ) return;
|
||||
if ( dead )
|
||||
{
|
||||
// do nothing but follow floor movement
|
||||
if ( tracksector )
|
||||
{
|
||||
double trackz;
|
||||
if ( trackplane ) trackz = tracksector.ceilingplane.ZAtPoint(pos.xy);
|
||||
else trackz = tracksector.floorplane.ZAtPoint(pos.xy);
|
||||
if ( trackz != pos.z )
|
||||
{
|
||||
SetZ(trackz);
|
||||
UpdateWaterLevel(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vel.z -= GetGravity();
|
||||
FCheckPosition tm;
|
||||
// movement subdivision (these damn things are tiny)
|
||||
int steps = 8;
|
||||
while ( (abs(vel.x) >= radius*steps) || (abs(vel.y) >= radius*steps) || (abs(vel.z) >= height*steps) )
|
||||
steps++;
|
||||
bool domove = (vel!=(0,0,0));
|
||||
if ( domove )
|
||||
{
|
||||
Vector3 steppy = vel/steps;
|
||||
int changexy = steppy.X||steppy.Y;
|
||||
bool readjust = false;
|
||||
for ( int i=0; i<steps; i++ )
|
||||
{
|
||||
if ( changexy && !TryMove(Vec2Offset(steppy.x,steppy.y),1,false,tm) )
|
||||
{
|
||||
// hit wall, bounce on it
|
||||
if ( BlockingLine )
|
||||
{
|
||||
Vector3 normal = (-BlockingLine.delta.y,BlockingLine.delta.x,0).unit();;
|
||||
if ( !SWWMUtility.PointOnLineSide(pos.xy,BlockingLine) )
|
||||
normal *= -1;
|
||||
vel = .3*(vel-2.*normal*(vel dot normal));
|
||||
}
|
||||
readjust = true;
|
||||
}
|
||||
AddZ(steppy.z);
|
||||
UpdateWaterLevel();
|
||||
if ( pos.z <= floorz )
|
||||
{
|
||||
// landed on floor, bounce on it
|
||||
SetZ(floorz);
|
||||
F3DFloor ff;
|
||||
for ( int i=0; i<FloorSector.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(FloorSector.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = FloorSector.Get3DFloor(i);
|
||||
break;
|
||||
}
|
||||
Vector3 normal;
|
||||
if ( ff ) normal = -ff.model.ceilingplane.Normal;
|
||||
else normal = FloorSector.floorplane.Normal;
|
||||
vel = .3*(vel-2.*normal*(vel dot normal));
|
||||
readjust = true;
|
||||
}
|
||||
if ( pos.z+height > ceilingz )
|
||||
{
|
||||
// hit the ceiling, bounce on it
|
||||
SetZ(ceilingz-height);
|
||||
F3DFloor ff;
|
||||
for ( int i=0; i<CeilingSector.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(CeilingSector.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
ff = CeilingSector.Get3DFloor(i);
|
||||
break;
|
||||
}
|
||||
Vector3 normal;
|
||||
if ( ff ) normal = -ff.model.floorplane.Normal;
|
||||
else normal = CeilingSector.ceilingplane.Normal;
|
||||
vel = .3*(vel-2.*normal*(vel dot normal));
|
||||
readjust = true;
|
||||
}
|
||||
CheckPortalTransition();
|
||||
if ( readjust )
|
||||
{
|
||||
SetStateLabel("Bounce");
|
||||
break; // movement changed, can't keep stepping
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( (max(abs(vel.x),max(abs(vel.y),abs(vel.z))) < 1.) && (pos.z <= floorz) )
|
||||
{
|
||||
SetZ(floorz);
|
||||
F3DFloor ff;
|
||||
for ( int i=0; i<FloorSector.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(FloorSector.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(FloorSector.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = FloorSector.Get3DFloor(i);
|
||||
break;
|
||||
}
|
||||
if ( ff )
|
||||
{
|
||||
tracksector = ff.model;
|
||||
trackplane = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
tracksector = FloorSector;
|
||||
trackplane = 0;
|
||||
}
|
||||
vel = (0,0,0);
|
||||
dead = true;
|
||||
SetStateLabel("Death");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ( killme ) A_FadeOut(.01);
|
||||
if ( waterlevel > 0 )
|
||||
{
|
||||
vel.xy *= .98;
|
||||
vel *= .98;
|
||||
rollvel *= .98;
|
||||
}
|
||||
if ( !CheckNoDelay() || (tics == -1) ) return;
|
||||
if ( tics > 0 ) tics--;
|
||||
while ( !tics )
|
||||
{
|
||||
if ( !SetState(CurState.NextState) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
States
|
||||
{
|
||||
|
|
@ -619,7 +1010,7 @@ Class SmolInvisibleSplasher : InvisibleSplasher
|
|||
{
|
||||
Default
|
||||
{
|
||||
Mass 25;
|
||||
Mass 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -690,7 +1081,7 @@ Class SWWMBulletTrail : LineTracer
|
|||
}
|
||||
}
|
||||
|
||||
// Elastic recoil from DT
|
||||
// Elastic recoil from DT (unused)
|
||||
Enum ESwingMode
|
||||
{
|
||||
SWING_Straight, // constant increment
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ Class EvisceratorChunk : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingFloor.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingFloor.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingFloor.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = BlockingFloor.Get3DFloor(i);
|
||||
break;
|
||||
|
|
@ -164,6 +165,7 @@ Class EvisceratorChunk : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingCeiling.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).bottom.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
ff = BlockingCeiling.Get3DFloor(i);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1235,7 +1235,28 @@ Class SWWMHandler : EventHandler
|
|||
else if ( e.Replacee is 'CWeaponPiece2' ) e.Replacement = 'CandyGun';
|
||||
else if ( e.Replacee is 'MWeaponPiece1' ) e.Replacement = 'Ynykron';
|
||||
else if ( (e.Replacee == 'Clip') || (e.Replacee == 'GoldWandAmmo') || (e.Replacee == 'GoldWandHefty') )
|
||||
e.Replacement = 'SWWMNothing';
|
||||
{
|
||||
switch( Random[Replacement](0,14) )
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
e.Replacement = redpool[Random[Replacement](0,1)];
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
e.Replacement = greenpool[Random[Replacement](0,1)];
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
e.Replacement = purplepool[0];
|
||||
break;
|
||||
default:
|
||||
e.Replacement = 'SWWMNothing';
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( (e.Replacee == 'Shell') || (e.Replacee is 'CrossbowAmmo') )
|
||||
{
|
||||
switch( Random[Replacement](0,13) )
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ Class PusherProjectile : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingFloor.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingFloor.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingFloor.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = BlockingFloor.Get3DFloor(i);
|
||||
break;
|
||||
|
|
@ -194,6 +195,7 @@ Class PusherProjectile : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingCeiling.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).bottom.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
ff = BlockingCeiling.Get3DFloor(i);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1431,6 +1431,7 @@ Class CompanionLamp : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingFloor.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingFloor.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingFloor.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
normal = -BlockingFloor.Get3DFLoor(i).top.Normal;
|
||||
break;
|
||||
|
|
@ -1445,6 +1446,7 @@ Class CompanionLamp : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingCeiling.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).bottom.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
normal = -BlockingCeiling.Get3DFloor(i).bottom.Normal;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -317,6 +317,7 @@ Class DragonBreathArm : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingFloor.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingFloor.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingFloor.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = BlockingFloor.Get3DFloor(i);
|
||||
break;
|
||||
|
|
@ -329,6 +330,7 @@ Class DragonBreathArm : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingCeiling.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).bottom.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
ff = BlockingCeiling.Get3DFloor(i);
|
||||
break;
|
||||
|
|
@ -1123,6 +1125,7 @@ Class FlamingChunk : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingFloor.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingFloor.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingFloor.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = BlockingFloor.Get3DFloor(i);
|
||||
break;
|
||||
|
|
@ -1135,6 +1138,7 @@ Class FlamingChunk : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingCeiling.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).bottom.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
ff = BlockingCeiling.Get3DFloor(i);
|
||||
break;
|
||||
|
|
@ -1428,6 +1432,7 @@ Class TheBall : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingFloor.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingFloor.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingFloor.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = BlockingFloor.Get3DFloor(i);
|
||||
break;
|
||||
|
|
@ -1446,6 +1451,7 @@ Class TheBall : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingCeiling.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).bottom.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
ff = BlockingCeiling.Get3DFloor(i);
|
||||
break;
|
||||
|
|
@ -2056,7 +2062,7 @@ Class Spreadgun : SWWMWeapon
|
|||
for ( int i=0; i<t.HitList.Size(); i++ )
|
||||
{
|
||||
int realdmg = dmg?dmg:t.HitList[i].HitDamage;
|
||||
SWWMDamageAccumulator.Accumulate(t.HitList[i].HitActor,realdmg,invoker,self,'shot',!large);
|
||||
SWWMDamageAccumulator.Accumulate(t.HitList[i].HitActor,realdmg,invoker,self,'shot',!large&&!swwm_shotgib);
|
||||
SWWMUtility.DoKnockback(t.HitList[i].HitActor,t.HitList[i].x+(0,0,0.025),mm*FRandom[Spreadgun](0.4,1.2));
|
||||
if ( t.HitList[i].HitActor.bNOBLOOD || t.HitList[i].HitActor.bINVULNERABLE )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1696,6 +1696,7 @@ Class BiosparkCore : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingFloor.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingFloor.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingFloor.Get3DFloor(i).top.ZAtPoint(pos.xy) ~== floorz) ) continue;
|
||||
ff = BlockingFloor.Get3DFloor(i);
|
||||
break;
|
||||
|
|
@ -1708,6 +1709,7 @@ Class BiosparkCore : Actor
|
|||
// find closest 3d floor for its normal
|
||||
for ( int i=0; i<BlockingCeiling.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(BlockingCeiling.Get3DFloor(i).bottom.ZAtPoint(pos.xy) ~== ceilingz) ) continue;
|
||||
ff = BlockingCeiling.Get3DFloor(i);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -677,7 +677,7 @@ Class SilverBullet : SWWMWeapon
|
|||
{
|
||||
if ( !proneme ) Owner.A_StartSound("silverbullet/crouch",CHAN_WEAPONEXTRA,CHANF_OVERLAP);
|
||||
proneme = true;
|
||||
lookscale = .25;
|
||||
lookscale = .4;
|
||||
return;
|
||||
}
|
||||
if ( proneme ) Owner.A_StartSound("silverbullet/uncrouch",CHAN_WEAPONEXTRA,CHANF_OVERLAP);
|
||||
|
|
|
|||
|
|
@ -848,24 +848,27 @@ Class SWWMCombatTracker : Thinker
|
|||
if ( mytarget && mytarget.bDORMANT )
|
||||
return;
|
||||
// update
|
||||
if ( mytarget && ((mytarget.pos != oldpos) || (mytarget.prev != oldprev)) )
|
||||
if ( !mytarget || (mytarget.Health <= 0) )
|
||||
{
|
||||
// we're done
|
||||
if ( updated > level.maptime ) updated = level.maptime;
|
||||
lasthealth = 0;
|
||||
prevpos = pos; // prevent stuttering
|
||||
intp.Update(lasthealth);
|
||||
if ( level.maptime > updated+35 ) Destroy();
|
||||
return;
|
||||
}
|
||||
// only update height/position while alive
|
||||
bool heightchanged = false;
|
||||
if ( height != mytarget.height ) heightchanged = true;
|
||||
height = mytarget.height;
|
||||
if ( mytarget && (heightchanged || (mytarget.pos != oldpos) || (mytarget.prev != oldprev)) )
|
||||
{
|
||||
oldpos = mytarget.pos;
|
||||
oldprev = mytarget.prev;
|
||||
pos = level.Vec3Offset(mytarget.pos,(0,0,height));
|
||||
prevpos = level.Vec3Offset(mytarget.prev,(0,0,height));
|
||||
}
|
||||
if ( !mytarget || (mytarget.Health <= 0) )
|
||||
{
|
||||
// we're done
|
||||
if ( updated > level.maptime ) updated = level.maptime;
|
||||
lasthealth = 0;
|
||||
intp.Update(lasthealth);
|
||||
if ( level.maptime > updated+35 ) Destroy();
|
||||
return;
|
||||
}
|
||||
// only update height while alive
|
||||
height = mytarget.height;
|
||||
tcnt++;
|
||||
if ( (tcnt == 1) && !mytarget.player )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -224,6 +224,7 @@ Class SWWMUtility
|
|||
F3DFloor ff;
|
||||
for ( int i=0; i<a.FloorSector.Get3DFloorCount(); i++ )
|
||||
{
|
||||
if ( !(a.FloorSector.Get3DFloor(i).flags&F3DFloor.FF_SOLID) ) continue;
|
||||
if ( !(a.FloorSector.Get3DFloor(i).top.ZAtPoint(a.pos.xy) ~== a.floorz) ) continue;
|
||||
ff = a.FloorSector.Get3DFloor(i);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue