hedgewars/uGears.pas
branchflibqtfrontend
changeset 8363 0b4ac686fc44
parent 8351 f895be37b607
child 8425 4f226963faef
equal deleted inserted replaced
8306:50fe80adbfcb 8363:0b4ac686fc44
    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
       
   196     begin
       
   197     ScriptCall('onNewTurn');
       
   198 {$IFDEF SDL13}
       
   199     uTouch.NewTurnBeginning();
       
   200 {$ENDIF}
       
   201     end;
       
   202 
   192 PrvInactive:= AllInactive;
   203 PrvInactive:= AllInactive;
   193 AllInactive:= true;
   204 AllInactive:= true;
   194 
   205 
   195 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
   206 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
   196     StepSoundChannel:= LoopSound(sndSteps)
   207     StepSoundChannel:= LoopSound(sndSteps)
   381 
   392 
   382                 ParseCommand('/nextturn', true);
   393                 ParseCommand('/nextturn', true);
   383                 SwitchHedgehog;
   394                 SwitchHedgehog;
   384 
   395 
   385                 AfterSwitchHedgehog;
   396                 AfterSwitchHedgehog;
   386                 bBetweenTurns:= false
   397                 bBetweenTurns:= false;
       
   398                 NewTurnTick:= GameTicks + 1
   387                 end;
   399                 end;
   388             step:= Low(step)
   400             step:= Low(step)
   389             end;
   401             end;
   390     end
   402     end
   391 else if ((GameFlags and gfInfAttack) <> 0) then
   403 else if ((GameFlags and gfInfAttack) <> 0) then
   468 
   480 
   469     if (not CurrentTeam^.ExtDriven) or CurrentTeam^.hasGone then
   481     if (not CurrentTeam^.ExtDriven) or CurrentTeam^.hasGone then
   470         inc(hiTicks) // we do not recieve a message for this
   482         inc(hiTicks) // we do not recieve a message for this
   471     end;
   483     end;
   472 AddRandomness(CheckSum);
   484 AddRandomness(CheckSum);
   473 ScriptCall('onGameTick');
       
   474 if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
       
   475 
   485 
   476 inc(GameTicks)
   486 inc(GameTicks)
   477 end;
   487 end;
   478 
   488 
   479 //Purpose, to reset all transient attributes toggled by a utility and clean up various gears and effects at end of turn
   489 //Purpose, to reset all transient attributes toggled by a utility and clean up various gears and effects at end of turn
  1394     delay2:= 0;
  1404     delay2:= 0;
  1395     step:= stDelay;
  1405     step:= stDelay;
  1396     upd:= 0;
  1406     upd:= 0;
  1397 
  1407 
  1398     //SDMusic:= 'hell.ogg';
  1408     //SDMusic:= 'hell.ogg';
       
  1409     NewTurnTick:= $FFFFFFFF;
  1399 end;
  1410 end;
  1400 
  1411 
  1401 procedure freeModule;
  1412 procedure freeModule;
  1402 begin
  1413 begin
  1403     FreeGearsList();
  1414     FreeGearsList();