hedgewars/GSHandlers.inc
changeset 408 6c3da4907d00
parent 393 db01cc79f278
child 409 4f1841929ccc
equal deleted inserted replaced
407:c7890ba9ed6e 408:6c3da4907d00
  1012       cBombsSpeed   : hwFloat = (isNegative: false; QWordValue:  429496729);
  1012       cBombsSpeed   : hwFloat = (isNegative: false; QWordValue:  429496729);
  1013 
  1013 
  1014 procedure doStepAirAttackWork(Gear: PGear);
  1014 procedure doStepAirAttackWork(Gear: PGear);
  1015 begin
  1015 begin
  1016 AllInactive:= false;
  1016 AllInactive:= false;
  1017 Gear^.X:= Gear^.X + cAirPlaneSpeed;
  1017 Gear^.X:= Gear^.X + Gear^.Tag * cAirPlaneSpeed;
  1018 if (Gear^.Health > 0)and( not (Gear^.X < Gear^.dX))and(Gear^.X < Gear^.dX + cAirPlaneSpeed) then
  1018 if (Gear^.Health > 0)and( not (Gear^.X < Gear^.dX))and(Gear^.X < Gear^.dX + cAirPlaneSpeed) then
  1019    begin
  1019    begin
  1020    dec(Gear^.Health);
  1020    dec(Gear^.Health);
  1021    case Gear^.State of
  1021    case Gear^.State of
  1022         0: AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed, 0, 0);
  1022         0: AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, Gear^.Tag * cBombsSpeed, 0, 0);
  1023         1: AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine, 0, cBombsSpeed, 0, 0);
  1023         1: AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine,    0, Gear^.Tag * cBombsSpeed, 0, 0);
  1024         end;
  1024         end;
  1025    Gear^.dX:= Gear^.dX + cBombsDistance
  1025    Gear^.dX:= Gear^.dX + Gear^.Tag * cBombsDistance
  1026    end;
  1026    end;
  1027 if Gear^.X > 3072 then DeleteGear(Gear)
  1027 if (Gear^.X > 3072) or (Gear^.X < -1024) then DeleteGear(Gear)
  1028 end;
  1028 end;
  1029 
  1029 
  1030 procedure doStepAirAttack(Gear: PGear);
  1030 procedure doStepAirAttack(Gear: PGear);
  1031 var t: LongInt;
  1031 var t: LongInt;
  1032 begin
  1032 begin
  1033 AllInactive:= false;
  1033 AllInactive:= false;
  1034 Gear^.X:= -1024;
  1034 if Gear^.X.QWordValue = 0 then Gear^.Tag:=  1
       
  1035                           else Gear^.Tag:= -1;
       
  1036 Gear^.X:= 1024 - Gear^.Tag * 2048;
  1035 Gear^.Y:= -128;
  1037 Gear^.Y:= -128;
  1036 Gear^.dX:= TargetPoint.X -
  1038 Gear^.dX:= TargetPoint.X -
  1037           cBombsDistance * 5 / 2;
  1039            Gear^.Tag * cBombsDistance * 5 / 2;
  1038 
  1040 
  1039 if TargetPoint.Y - Gear^.Y > 0 then
  1041 if TargetPoint.Y - Gear^.Y > 0 then
  1040    Gear^.dX:= Gear^.dX - cBombsSpeed * hwSqrt(2 * (TargetPoint.Y - Gear^.Y) / cGravity);
  1042    Gear^.dX:= Gear^.dX - Gear^.Tag * cBombsSpeed * hwSqrt(2 * (TargetPoint.Y - Gear^.Y) / cGravity);
  1041 Gear^.Health:= 6;
  1043 Gear^.Health:= 6;
  1042 Gear^.doStep:= @doStepAirAttackWork
  1044 Gear^.doStep:= @doStepAirAttackWork
  1043 end;
  1045 end;
  1044 
  1046 
  1045 ////////////////////////////////////////////////////////////////////////////////
  1047 ////////////////////////////////////////////////////////////////////////////////