hedgewars/GSHandlers.inc
changeset 7406 1fe2c821f9bf
parent 7400 09427dbec1d8
child 7408 38d369c59d51
equal deleted inserted replaced
7405:63f56edae4c6 7406:1fe2c821f9bf
  2079 
  2079 
  2080 end;
  2080 end;
  2081 
  2081 
  2082 procedure doStepCase(Gear: PGear);
  2082 procedure doStepCase(Gear: PGear);
  2083 var 
  2083 var 
  2084     i, x, y, rx, ry: LongInt;
  2084     i, x, y: LongInt;
  2085     k: TGearType;
  2085     k: TGearType;
  2086     exBoom: boolean;
  2086     exBoom: boolean;
  2087     dX, dY, rdx, rdy: HWFloat;
  2087     dX, dY: HWFloat;
  2088     hog: PHedgehog;
  2088     hog: PHedgehog;
  2089     sparkles: PVisualGear;
  2089     sparkles: PVisualGear;
       
  2090     gi: PGear;
  2090 begin
  2091 begin
  2091     k := Gear^.Kind;
  2092     k := Gear^.Kind;
  2092     exBoom := false;
  2093     exBoom := false;
  2093 
  2094 
  2094     if (Gear^.Message and gmDestroy) > 0 then
  2095     if (Gear^.Message and gmDestroy) > 0 then
  2119         if Gear^.Health <= 0 then
  2120         if Gear^.Health <= 0 then
  2120             exBoom := true;
  2121             exBoom := true;
  2121         end
  2122         end
  2122     else
  2123     else
  2123         begin 
  2124         begin 
  2124         if (Gear^.Pos <> posCaseHealth) and (GameTicks and $3FF = 0) then
  2125         if (Gear^.Pos <> posCaseHealth) and (GameTicks and $3FF = 0) then // stir it up every second or so
  2125             begin
  2126             begin
  2126             for i:= 0 to GetRandom(3) do
  2127             gi := GearsList;
  2127                 begin
  2128             while gi <> nil do
  2128                 rx:= GetRandom(rightX-leftX)+leftX;
  2129                 begin
  2129                 ry:= GetRandom(LAND_HEIGHT-topY)+topY;
  2130                 if gi^.Kind = gtGenericFaller then
  2130                 rdx:= _90-(GetRandomf*_360);
  2131                     begin
  2131                 rdy:= _90-(GetRandomf*_360);
  2132                     gi^.Active:= true;
  2132                 AddGear(rx, ry, gtGenericFaller, gstInvisible, rdx, rdy, GetRandom(1000)+1000)
  2133                     gi^.X:=  int2hwFloat(GetRandom(rightX-leftX)+leftX);
  2133                 end;
  2134                     gi^.Y:=  int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY);
       
  2135                     gi^.dX:= _90-(GetRandomf*_360);
       
  2136                     gi^.dY:= _90-(GetRandomf*_360)
       
  2137                     end;
       
  2138                 gi := gi^.NextGear
       
  2139                 end
  2134             end;
  2140             end;
  2135 
  2141 
  2136         if Gear^.Timer = 500 then
  2142         if Gear^.Timer = 500 then
  2137             begin
  2143             begin
  2138 (* Can't make sparkles team coloured without working out what the next team is going to be. This should be solved, really, since it also screws up
  2144 (* Can't make sparkles team coloured without working out what the next team is going to be. This should be solved, really, since it also screws up
  5578     end;
  5584     end;
  5579 end;
  5585 end;
  5580 
  5586 
  5581 procedure doStepGenericFaller(Gear: PGear);
  5587 procedure doStepGenericFaller(Gear: PGear);
  5582 begin
  5588 begin
  5583 if Gear^.Timer > 0 then 
  5589 if Gear^.Timer < $FFFFFFFF then
  5584     begin
  5590     if Gear^.Timer > 0 then
  5585     doStepFallingGear(Gear);
  5591         dec(Gear^.Timer)
  5586     dec(Gear^.Timer)
  5592     else
  5587     end
  5593         begin
  5588 else DeleteGear(Gear)
  5594         DeleteGear(Gear);
  5589 end;
  5595         exit
       
  5596         end;
       
  5597     
       
  5598 doStepFallingGear(Gear);
       
  5599 end;