hedgewars/uGears.pas
changeset 614 0e04504bc140
parent 604 2f1165467a66
child 621 8bdbc240f50f
equal deleted inserted replaced
613:e8cf72d0e0f7 614:0e04504bc140
   371 if cAltDamage then
   371 if cAltDamage then
   372    AddGear(X, Y, gtSmallDamage, Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
   372    AddGear(X, Y, gtSmallDamage, Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
   373 end;
   373 end;
   374 
   374 
   375 procedure ProcessGears;
   375 procedure ProcessGears;
   376 const delay: LongInt = cInactDelay;
   376 const delay: LongWord = 0;
   377       step: (stDelay, stChDmg, stChWin, stSpawn, stNTurn) = stDelay;
   377       step: (stDelay, stChDmg, stChWin, stSpawn, stNTurn) = stDelay;
   378 var Gear, t: PGear;
   378 var Gear, t: PGear;
   379 begin
   379 begin
   380 AllInactive:= true;
   380 AllInactive:= true;
   381 t:= GearsList;
   381 t:= GearsList;
   387       end;
   387       end;
   388 
   388 
   389 if AllInactive then
   389 if AllInactive then
   390    case step of
   390    case step of
   391         stDelay: begin
   391         stDelay: begin
   392                  dec(delay);
       
   393                  if delay = 0 then
   392                  if delay = 0 then
   394                     begin
       
   395                     inc(step);
       
   396                     delay:= cInactDelay
   393                     delay:= cInactDelay
   397                     end
   394                  else
       
   395                     dec(delay);
       
   396 
       
   397                  if delay = 0 then
       
   398                     inc(step)
   398                  end;
   399                  end;
   399         stChDmg: if CheckNoDamage then inc(step) else step:= stDelay;
   400         stChDmg: if CheckNoDamage then inc(step) else step:= stDelay;
   400         stChWin: if not CheckForWin then inc(step) else step:= stDelay;
   401         stChWin: if not CheckForWin then inc(step) else step:= stDelay;
   401         stSpawn: begin
   402         stSpawn: begin
   402                  if not isInMultiShoot then SpawnBoxOfSmth;
   403                  if not isInMultiShoot then SpawnBoxOfSmth;
   894 
   895 
   895 procedure SpawnBoxOfSmth;
   896 procedure SpawnBoxOfSmth;
   896 var t: LongInt;
   897 var t: LongInt;
   897     i: TAmmoType;
   898     i: TAmmoType;
   898 begin
   899 begin
   899 if (CountGears(gtCase) >= 5) or (getrandom(cCaseFactor) <> 0) then exit;
   900 if (cCaseFactor = 0) or
       
   901    (CountGears(gtCase) >= 5) or
       
   902    (getrandom(cCaseFactor) <> 0) then exit;
   900 FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0);
   903 FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0);
   901 case getrandom(2) of
   904 case getrandom(2) of
   902      0: begin
   905      0: begin
   903         FollowGear^.Health:= 25;
   906         FollowGear^.Health:= 25;
   904         FollowGear^.Pos:= posCaseHealth
   907         FollowGear^.Pos:= posCaseHealth