hedgewars/uGears.pas
changeset 515 270f10276d2e
parent 511 2b5b9e00419d
child 520 e83dfb7ffead
equal deleted inserted replaced
514:fb8ba88a83c3 515:270f10276d2e
   346 
   346 
   347 procedure ProcessGears;
   347 procedure ProcessGears;
   348 const delay: LongInt = cInactDelay;
   348 const delay: LongInt = cInactDelay;
   349       step: (stDelay, stChDmg, stChWin, stSpawn, stNTurn) = stDelay;
   349       step: (stDelay, stChDmg, stChWin, stSpawn, stNTurn) = stDelay;
   350 var Gear, t: PGear;
   350 var Gear, t: PGear;
   351 {$IFDEF COUNTTICKS}
   351 begin
   352     tickcntA, tickcntB: LongWord;
       
   353 const cntSecTicks: LongWord = 0;
       
   354 {$ENDIF}
       
   355 begin
       
   356 {$IFDEF COUNTTICKS}
       
   357 asm
       
   358         push    eax
       
   359         push    edx
       
   360         rdtsc
       
   361         mov     tickcntA, eax
       
   362         mov     tickcntB, edx
       
   363         pop     edx
       
   364         pop     eax
       
   365 end;
       
   366 {$ENDIF}
       
   367 AllInactive:= true;
   352 AllInactive:= true;
   368 t:= GearsList;
   353 t:= GearsList;
   369 while t<>nil do
   354 while t<>nil do
   370       begin
   355       begin
   371       Gear:= t;
   356       Gear:= t;
   406    if CurrentTeam <> nil then
   391    if CurrentTeam <> nil then
   407       if CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil then
   392       if CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil then
   408          if ((CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.State and gstAttacking) = 0)
   393          if ((CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.State and gstAttacking) = 0)
   409             and not isInMultiShoot then dec(TurnTimeLeft);
   394             and not isInMultiShoot then dec(TurnTimeLeft);
   410 
   395 
   411 inc(GameTicks);
   396 inc(GameTicks)
   412 {$IFDEF COUNTTICKS}
       
   413 asm
       
   414         push    eax
       
   415         push    edx
       
   416         rdtsc
       
   417         sub     eax, [tickcntA]
       
   418         sbb     edx, [tickcntB]
       
   419         add     [cntSecTicks], eax
       
   420         pop     edx
       
   421         pop     eax
       
   422 end;
       
   423 if (GameTicks and 1023) = 0 then
       
   424    begin
       
   425    cntTicks:= cntSecTicks shr 10;
       
   426    {$IFDEF DEBUGFILE}
       
   427    AddFileLog('<' + inttostr(cntTicks) + '>x1024 ticks');
       
   428    {$ENDIF}
       
   429    cntSecTicks:= 0
       
   430    end;
       
   431 {$ENDIF}
       
   432 end;
   397 end;
   433 
   398 
   434 procedure SetAllToActive;
   399 procedure SetAllToActive;
   435 var t: PGear;
   400 var t: PGear;
   436 begin
   401 begin