614 or (xx > LAND_WIDTH + 512) or (xx < -512) then |
614 or (xx > LAND_WIDTH + 512) or (xx < -512) then |
615 move:=true |
615 move:=true |
616 // Solid pixel encountered |
616 // Solid pixel encountered |
617 else if ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then |
617 else if ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then |
618 begin |
618 begin |
619 lf:= Land[yy, xx] and (lfObject or lfBasic); |
619 lf:= Land[yy, xx] and (lfObject or lfBasic or lfIndestructible); |
620 // If there's room below keep falling |
620 // If there's room below keep falling |
621 if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (Land[yy-1, xx] = 0) then |
621 if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (Land[yy-1, xx] = 0) then |
622 begin |
622 begin |
623 X:= X - cWindSpeed * 1600 - dX; |
623 X:= X - cWindSpeed * 1600 - dX; |
624 end |
624 end |
5437 *) |
5437 *) |
5438 procedure doStepIceGun(Gear: PGear); |
5438 procedure doStepIceGun(Gear: PGear); |
5439 var |
5439 var |
5440 HHGear, iter: PGear; |
5440 HHGear, iter: PGear; |
5441 ndX, ndY: hwFloat; |
5441 ndX, ndY: hwFloat; |
5442 t, gX, gY: LongInt; |
5442 i, t, gX, gY: LongInt; |
|
5443 hogs: TPGearArray; |
5443 begin |
5444 begin |
5444 HHGear := Gear^.Hedgehog^.Gear; |
5445 HHGear := Gear^.Hedgehog^.Gear; |
5445 if (Gear^.Health = 0) or (HHGear = nil) or (HHGear^.Damage <> 0) then |
5446 if (Gear^.Health = 0) or (HHGear = nil) or (HHGear^.Damage <> 0) then |
5446 begin |
5447 begin |
5447 DeleteGear(Gear); |
5448 DeleteGear(Gear); |
5463 with Gear^ do |
5464 with Gear^ do |
5464 begin |
5465 begin |
5465 HedgehogChAngle(HHGear); |
5466 HedgehogChAngle(HHGear); |
5466 ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _4; |
5467 ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _4; |
5467 ndY:= -AngleCos(HHGear^.Angle) * _4; |
5468 ndY:= -AngleCos(HHGear^.Angle) * _4; |
5468 if (ndX <> dX) or (ndY <> dY) then |
5469 if (ndX <> dX) or (ndY <> dY) or |
|
5470 ((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and |
|
5471 (Target.Y and LAND_HEIGHT_MASK = 0) and ((Land[Target.Y, Target.X] = 0))) then |
5469 begin |
5472 begin |
5470 dX:= ndX; |
5473 dX:= ndX; |
5471 dY:= ndY; |
5474 dY:= ndY; |
5472 Pos:= 0; |
5475 Pos:= 0; |
5473 Target.X:= NoPointX; |
5476 Target.X:= NoPointX; |
5474 LastDamage:= nil; |
5477 LastDamage:= nil; |
5475 X:= HHGear^.X; |
5478 X:= HHGear^.X; |
5476 Y:= HHGear^.Y; |
5479 Y:= HHGear^.Y; |
5477 // unfreeze all semifrozen hogs |
5480 (* unfreeze all semifrozen hogs - make this generic hog cleanup |
5478 iter := GearsList; |
5481 iter := GearsList; |
5479 while iter <> nil do |
5482 while iter <> nil do |
5480 begin |
5483 begin |
5481 if (iter^.Kind = gtHedgehog) and |
5484 if (iter^.Kind = gtHedgehog) and |
5482 (iter^.Hedgehog^.Effects[heFrozen] < 0) then |
5485 (iter^.Hedgehog^.Effects[heFrozen] < 0) then |
5483 iter^.Hedgehog^.Effects[heFrozen]:= 0; |
5486 iter^.Hedgehog^.Effects[heFrozen]:= 0; |
5484 iter:= iter^.NextGear |
5487 iter:= iter^.NextGear |
5485 end |
5488 end *) |
5486 end |
5489 end |
5487 else |
5490 else |
5488 begin |
5491 begin |
5489 X:= X + dX; |
5492 X:= X + dX; |
5490 Y:= Y + dY; |
5493 Y:= Y + dY; |
5496 if (abs(gX-Target.X) < 2) and (abs(gY-Target.Y) < 2) then |
5499 if (abs(gX-Target.X) < 2) and (abs(gY-Target.Y) < 2) then |
5497 begin |
5500 begin |
5498 X:= HHGear^.X; |
5501 X:= HHGear^.X; |
5499 Y:= HHGear^.Y |
5502 Y:= HHGear^.Y |
5500 end; |
5503 end; |
|
5504 // freeze nearby hogs |
|
5505 if GameTicks mod 10 = 0 then dec(Gear^.Health); |
|
5506 hogs := GearsNear(Gear^.X, Gear^.Y, gtHedgehog, Gear^.Radius); |
|
5507 if Length(hogs) > 0 then |
|
5508 for i:= 0 to Length(hogs) - 1 do |
|
5509 if hogs[i] <> HHGear then |
|
5510 begin |
|
5511 //if Gear^.Hedgehog^.Effects[heFrozen]:= 0; |
|
5512 end; |
5501 inc(Pos) |
5513 inc(Pos) |
5502 end |
5514 end |
5503 else if (gY > cWaterLine) or |
5515 else if (t > 400) and ((gY > cWaterLine) or |
5504 (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0)) |
5516 (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0)) |
5505 and ((Land[gY, gX] and $FF00 and not lfIce <> 0) or |
5517 and (Land[gY, gX] <> 0))) then |
5506 ((Land[gY, gX] and $00FF <> 0) and (t > 400)))) then |
|
5507 begin |
5518 begin |
5508 Target.X:= gX; |
5519 Target.X:= gX; |
5509 Target.Y:= gY; |
5520 Target.Y:= gY; |
5510 if (gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0) then |
|
5511 begin |
|
5512 LandPixels[gY, gX]:= $FFFFFFFF; // just testing |
|
5513 UpdateLandTexture(gX, 1, gY, 1); |
|
5514 if Land[gY, gX] and $00FF <> 0 then // locate and tag hogs |
|
5515 begin |
|
5516 //GearsNear(X, Y, gtHedgehog, Radius); |
|
5517 end |
|
5518 end; |
|
5519 X:= HHGear^.X; |
5521 X:= HHGear^.X; |
5520 Y:= HHGear^.Y |
5522 Y:= HHGear^.Y |
5521 end; |
5523 end; |
5522 if (gX > LAND_WIDTH*2) or |
5524 if (gX > LAND_WIDTH*2) or |
5523 (gX < -LAND_WIDTH) or |
5525 (gX < -LAND_WIDTH) or |
5524 (gY < -LAND_HEIGHT) or |
5526 (gY < -LAND_HEIGHT) or |
5525 (gY > LAND_HEIGHT+512) or |
5527 (gY > LAND_HEIGHT+512) then |
5526 (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0)) |
|
5527 and (Land[gy, gX] > $FF)) then |
|
5528 begin |
5528 begin |
5529 X:= HHGear^.X; |
5529 X:= HHGear^.X; |
5530 Y:= HHGear^.Y |
5530 Y:= HHGear^.Y |
5531 end |
5531 end |
5532 end |
5532 end |