hedgewars/GSHandlers.inc
changeset 4313 0690067bc5ff
parent 4301 4866cc130b8d
child 4315 7d0c90cf9936
equal deleted inserted replaced
4309:a69c73c5d173 4313:0690067bc5ff
  2075     doStepParachuteWork(Gear)
  2075     doStepParachuteWork(Gear)
  2076 end;
  2076 end;
  2077 
  2077 
  2078 ////////////////////////////////////////////////////////////////////////////////
  2078 ////////////////////////////////////////////////////////////////////////////////
  2079 procedure doStepAirAttackWork(Gear: PGear);
  2079 procedure doStepAirAttackWork(Gear: PGear);
  2080 var 
  2080 //var 
  2081     i: Longint;
  2081 //    i: Longint;
  2082 begin
  2082 begin
  2083     AllInactive := false;
  2083     AllInactive := false;
  2084     Gear^.X := Gear^.X + cAirPlaneSpeed * Gear^.Tag;
  2084     Gear^.X := Gear^.X + cAirPlaneSpeed * Gear^.Tag;
  2085 
  2085 
  2086     if (Gear^.Health > 0)and(not (Gear^.X < Gear^.dX))and(Gear^.X < Gear^.dX + cAirPlaneSpeed) then
  2086     if (Gear^.Health > 0)and(not (Gear^.X < Gear^.dX))and(Gear^.X < Gear^.dX + cAirPlaneSpeed) then
  2089         case Gear^.State of 
  2089         case Gear^.State of 
  2090             0: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed *
  2090             0: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed *
  2091                              Gear^.Tag, _0, 0);
  2091                              Gear^.Tag, _0, 0);
  2092             1: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine,    0, cBombsSpeed *
  2092             1: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine,    0, cBombsSpeed *
  2093                              Gear^.Tag, _0, 0);
  2093                              Gear^.Tag, _0, 0);
  2094             2: for i:= -19 to 19 do
  2094             2: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtNapalmBomb, 0, cBombsSpeed *
  2095                    FollowGear := AddGear(hwRound(Gear^.X) + i div 3, hwRound(Gear^.Y), gtFlame, 0,
  2095                              Gear^.Tag, _0, 0);
  2096                                  _0_001 * i, _0, 0);
  2096             //2: for i:= -19 to 19 do
       
  2097             //       FollowGear := AddGear(hwRound(Gear^.X) + i div 3, hwRound(Gear^.Y), gtFlame, 0,
       
  2098             //                     _0_001 * i, _0, 0);
  2097             3: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtDrill, gsttmpFlag, cBombsSpeed *
  2099             3: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtDrill, gsttmpFlag, cBombsSpeed *
  2098                              Gear^.Tag, _0, 0);
  2100                              Gear^.Tag, _0, 0);
  2099             //4: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtWaterMelon, 0, cBombsSpeed *
  2101             //4: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtWaterMelon, 0, cBombsSpeed *
  2100             //                 Gear^.Tag, _0, 5000);
  2102             //                 Gear^.Tag, _0, 5000);
  2101         end;
  2103         end;
  2124     end;
  2126     end;
  2125 
  2127 
  2126     Gear^.Y := int2hwFloat(topY-300);
  2128     Gear^.Y := int2hwFloat(topY-300);
  2127     Gear^.dX := int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15);
  2129     Gear^.dX := int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15);
  2128 
  2130 
  2129     if (int2hwFloat(TargetPoint.Y) - Gear^.Y > _0) and (Gear^.State <> 2) then
  2131     if (int2hwFloat(TargetPoint.Y) - Gear^.Y > _0) then //and (Gear^.State <> 2) then
  2130         Gear^.dX := Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(TargetPoint.Y) - Gear^.Y) * 2 /
  2132         Gear^.dX := Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(TargetPoint.Y) - Gear^.Y) * 2 /
  2131                     cGravity) * Gear^.Tag;
  2133                     cGravity) * Gear^.Tag;
  2132 
  2134 
  2133     Gear^.Health := 6;
  2135     Gear^.Health := 6;
  2134     Gear^.doStep := @doStepAirAttackWork;
  2136     Gear^.doStep := @doStepAirAttackWork;
  4360         Gear^.doStep := @doStepIdle;
  4362         Gear^.doStep := @doStepIdle;
  4361         end
  4363         end
  4362 end;
  4364 end;
  4363 
  4365 
  4364 ////////////////////////////////////////////////////////////////////////////////
  4366 ////////////////////////////////////////////////////////////////////////////////
  4365 
  4367 procedure doStepNapalmBomb(Gear: PGear);
       
  4368 var
       
  4369     i, gX, gY: LongInt;
       
  4370     dX, dY: hwFloat;
       
  4371 begin
       
  4372     AllInactive := false;
       
  4373     doStepFallingGear(Gear);
       
  4374     if (Gear^.Timer > 0) and ((Gear^.State and gstCollision) <> 0) then
       
  4375     begin
       
  4376         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, EXPLAutoSound);
       
  4377         gX := hwRound(Gear^.X);
       
  4378         gY := hwRound(Gear^.Y); 
       
  4379         for i:= 0 to 10 do
       
  4380         begin
       
  4381             dX := AngleCos(i * 2) * ((_0_1*(i div 5))) * (GetRandom + _1);
       
  4382             dY := AngleSin(i * 8) * _0_5 * (GetRandom + _1);
       
  4383             AddGear(gX, gY, gtFlame, 0, dX, dY, 0);
       
  4384             AddGear(gX, gY, gtFlame, 0, dX, -dY, 0);
       
  4385             AddGear(gX, gY, gtFlame, 0, -dX, dY, 0);
       
  4386             AddGear(gX, gY, gtFlame, 0, -dX, -dY, 0);
       
  4387         end;
       
  4388         DeleteGear(Gear);
       
  4389         exit
       
  4390     end;
       
  4391     if (Gear^.Timer = 0) then
       
  4392     begin
       
  4393         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, EXPLAutoSound);
       
  4394         for i:= -19 to 19 do
       
  4395            FollowGear := AddGear(hwRound(Gear^.X) + i div 3, hwRound(Gear^.Y), gtFlame, 0, _0_001 * i, _0, 0);
       
  4396         DeleteGear(Gear);
       
  4397         exit
       
  4398     end;
       
  4399     if (GameTicks and $3F) = 0 then
       
  4400         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
       
  4401     dec(Gear^.Timer)
       
  4402 end;
       
  4403 
       
  4404 ////////////////////////////////////////////////////////////////////////////////
       
  4405