hedgewars/uGears.pas
changeset 11469 26068971a4de
parent 11204 3ff617fccc67
child 11477 e425a6eb9da3
equal deleted inserted replaced
11468:2f6f8baa2a97 11469:26068971a4de
   166 procedure ProcessGears;
   166 procedure ProcessGears;
   167 var t: PGear;
   167 var t: PGear;
   168     i, AliveCount: LongInt;
   168     i, AliveCount: LongInt;
   169     s: ansistring;
   169     s: ansistring;
   170     prevtime: LongWord;
   170     prevtime: LongWord;
   171 begin
   171     stirFallers: boolean;
       
   172 begin
       
   173 stirFallers:= false;
   172 prevtime:= TurnTimeLeft;
   174 prevtime:= TurnTimeLeft;
   173 ScriptCall('onGameTick');
   175 ScriptCall('onGameTick');
   174 if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
   176 if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
   175 if GameTicks = NewTurnTick then
   177 if GameTicks = NewTurnTick then
   176     begin
   178     begin
   197 t:= GearsList;
   199 t:= GearsList;
   198 while t <> nil do
   200 while t <> nil do
   199     begin
   201     begin
   200     curHandledGear:= t;
   202     curHandledGear:= t;
   201     t:= curHandledGear^.NextGear;
   203     t:= curHandledGear^.NextGear;
       
   204     if (GameTicks and $1FFF = 0) and (curHandledGear^.Kind = gtCase) and (curHandledGear^.Pos <> posCaseHealth) then
       
   205         stirFallers := true; 
   202 
   206 
   203     if curHandledGear^.Message and gmDelete <> 0 then
   207     if curHandledGear^.Message and gmDelete <> 0 then
   204         DeleteGear(curHandledGear)
   208         DeleteGear(curHandledGear)
   205     else
   209     else
   206         begin
   210         begin
   222             // might be useful later
   226             // might be useful later
   223             //ScriptCall('onGearStep', Gear^.uid);
   227             //ScriptCall('onGearStep', Gear^.uid);
   224             end
   228             end
   225         end
   229         end
   226     end;
   230     end;
       
   231 if stirFallers then
       
   232     begin
       
   233     t := GearsList;
       
   234     while t <> nil do
       
   235         begin
       
   236         if t^.Kind = gtGenericFaller then
       
   237             begin
       
   238             t^.Active:= true;
       
   239             t^.X:=  int2hwFloat(GetRandom(rightX-leftX)+leftX);
       
   240             t^.Y:=  int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY);
       
   241             t^.dX:= _90-(GetRandomf*_360);
       
   242             t^.dY:= _90-(GetRandomf*_360)
       
   243             end;
       
   244         t := t^.NextGear
       
   245         end
       
   246     end;
       
   247 
   227 curHandledGear:= nil;
   248 curHandledGear:= nil;
   228 
   249 
   229 if AllInactive then
   250 if AllInactive then
   230 case step of
   251 case step of
   231     stDelay:
   252     stDelay: