text
stringlengths
0
451
UpdateWormPosition();
bool OnGround = (CheckSolidFooting() & CSF_FLOORMASK);
double WormLastZ = RecordedPos[0].Z;
if (Vel.XY != (0, 0))
{
Vector2 bounce = GetWallBounceDir();
if (bounce != (0, 0))
{
Vel.XY = bounce * Speed * 2.0;
Angle = VectorAngle(Vel.X, Vel.Y);
}
}
double MoveZ = Vel.Z;
if (OnGround == true)
{
MoveZ = Pos.Z - WormLastZ;
}
Pitch = -VectorAngle(Vel.XY.Length(), MoveZ);
UpdateWormPosition();
// Handle segment movement
Actor MoveToward = self;
for (uint i = 0; i < NUMWORMSEGS; i++)
{
let Seg = SnapActor(SegList[i]);
if (Seg == null || Seg.Health <= 0)
{
continue;
}
SegTick(Seg, MoveToward, i);
MoveToward = Seg;
}
// Handle firing
if (AtkTimer <= 0)
{
if (AtkSeg >= 0 && AtkSeg < NUMWORMSEGS)
{
let Seg = SnapMonster(SegList[AtkSeg]);
if (Seg != null && Seg.Health > 0)
{
Seg.target = self.target;
Seg.SetState(Seg.MissileState);
Seg.A_SnapMonsterProjectile(
"WormMissile",
(0, 0, 8),
Seg.Angle + 90.0, 0.0,
SMP_DONTAIM|SMP_ABSOLUTEANGLE
);
Seg.A_SnapMonsterProjectile(
"WormMissile",
(0, 0, 8),
Seg.Angle - 90.0, 0.0,
SMP_DONTAIM|SMP_ABSOLUTEANGLE
);
}
}
if (AtkSeg <= 0)
{
AtkSeg = NUMWORMSEGS-1;
AtkTimer = WORMFIREWAIT;
}
else
{
AtkSeg = max(0, AtkSeg-1);
AtkTimer = WORMFIREFREQ;
}
}
// Handle jumping
if (JumpTimer <= 0 && bVeryRude == true)
{
if (ShortHop == true)
{
Vel.Z = WORMJUMPSHORTSPEED;
}
else
{
Vel.Z = WORMJUMPSPEED;
}
ShortHop = !ShortHop;
JumpTimer = WORMJUMPFREQ;
}
uint SegCount = 0;
for (int i = NUMWORMSEGS-1; i >= -1; i--)
{