hedgewars/uGears.pas
changeset 8349 a1dbe148f10f
parent 8204 9a6030d96273
child 8351 f895be37b607
equal deleted inserted replaced
8348:c039ac6f33e0 8349:a1dbe148f10f
    76     step: (stDelay, stChDmg, stSweep, stTurnReact,
    76     step: (stDelay, stChDmg, stSweep, stTurnReact,
    77     stAfterDelay, stChWin, stWater, stChWin2, stHealth,
    77     stAfterDelay, stChWin, stWater, stChWin2, stHealth,
    78     stSpawn, stNTurn);
    78     stSpawn, stNTurn);
    79     upd: Longword;
    79     upd: Longword;
    80     snowLeft,snowRight: LongInt;
    80     snowLeft,snowRight: LongInt;
       
    81     NewTurnTick: LongWord;
    81     //SDMusic: shortstring;
    82     //SDMusic: shortstring;
    82 
    83 
    83 // For better maintainability the step handlers of gears are stored in
    84 // For better maintainability the step handlers of gears are stored in
    84 // separate files.
    85 // separate files.
    85 // Note: step handlers of gears that are hedgehogs are in a different file
    86 // Note: step handlers of gears that are hedgehogs are in a different file
   187 procedure ProcessGears;
   188 procedure ProcessGears;
   188 var t: PGear;
   189 var t: PGear;
   189     i, AliveCount: LongInt;
   190     i, AliveCount: LongInt;
   190     s: shortstring;
   191     s: shortstring;
   191 begin
   192 begin
       
   193 ScriptCall('onGameTick');
       
   194 if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
       
   195 if GameTicks = NewTurnTick then ScriptCall('onNewTurn');
       
   196 
   192 PrvInactive:= AllInactive;
   197 PrvInactive:= AllInactive;
   193 AllInactive:= true;
   198 AllInactive:= true;
   194 
   199 
   195 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
   200 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
   196     StepSoundChannel:= LoopSound(sndSteps)
   201     StepSoundChannel:= LoopSound(sndSteps)
   381 
   386 
   382                 ParseCommand('/nextturn', true);
   387                 ParseCommand('/nextturn', true);
   383                 SwitchHedgehog;
   388                 SwitchHedgehog;
   384 
   389 
   385                 AfterSwitchHedgehog;
   390                 AfterSwitchHedgehog;
   386                 bBetweenTurns:= false
   391                 bBetweenTurns:= false;
       
   392                 NewTurnTick:= GameTicks + 1
   387                 end;
   393                 end;
   388             step:= Low(step)
   394             step:= Low(step)
   389             end;
   395             end;
   390     end
   396     end
   391 else if ((GameFlags and gfInfAttack) <> 0) then
   397 else if ((GameFlags and gfInfAttack) <> 0) then
   468 
   474 
   469     if (not CurrentTeam^.ExtDriven) or CurrentTeam^.hasGone then
   475     if (not CurrentTeam^.ExtDriven) or CurrentTeam^.hasGone then
   470         inc(hiTicks) // we do not recieve a message for this
   476         inc(hiTicks) // we do not recieve a message for this
   471     end;
   477     end;
   472 AddRandomness(CheckSum);
   478 AddRandomness(CheckSum);
   473 ScriptCall('onGameTick');
       
   474 if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
       
   475 
   479 
   476 inc(GameTicks)
   480 inc(GameTicks)
   477 end;
   481 end;
   478 
   482 
   479 //Purpose, to reset all transient attributes toggled by a utility and clean up various gears and effects at end of turn
   483 //Purpose, to reset all transient attributes toggled by a utility and clean up various gears and effects at end of turn
  1394     delay2:= 0;
  1398     delay2:= 0;
  1395     step:= stDelay;
  1399     step:= stDelay;
  1396     upd:= 0;
  1400     upd:= 0;
  1397 
  1401 
  1398     //SDMusic:= 'hell.ogg';
  1402     //SDMusic:= 'hell.ogg';
       
  1403     NewTurnTick:= $FFFFFFFF;
  1399 end;
  1404 end;
  1400 
  1405 
  1401 procedure freeModule;
  1406 procedure freeModule;
  1402 begin
  1407 begin
  1403     FreeGearsList();
  1408     FreeGearsList();