53 procedure AssignHHCoords; |
53 procedure AssignHHCoords; |
54 function GearByUID(uid : Longword) : PGear; |
54 function GearByUID(uid : Longword) : PGear; |
55 procedure doStepDrowningGear(Gear: PGear); |
55 procedure doStepDrowningGear(Gear: PGear); |
56 |
56 |
57 implementation |
57 implementation |
58 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics, |
58 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics, {$IFDEF SDL13}uTouch,{$ENDIF} |
59 uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uVariables, |
59 uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uVariables, |
60 uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture, |
60 uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture, |
61 uGearsHedgehog, uGearsUtils, uGearsList, uGearsHandlers, uGearsHandlersRope; |
61 uGearsHedgehog, uGearsUtils, uGearsList, uGearsHandlers, uGearsHandlersRope; |
62 |
62 |
63 var skipFlag: boolean; |
63 var skipFlag: boolean; |
75 step: (stDelay, stChDmg, stSweep, stTurnReact, |
75 step: (stDelay, stChDmg, stSweep, stTurnReact, |
76 stAfterDelay, stChWin, stWater, stChWin2, stHealth, |
76 stAfterDelay, stChWin, stWater, stChWin2, stHealth, |
77 stSpawn, stNTurn); |
77 stSpawn, stNTurn); |
78 upd: Longword; |
78 upd: Longword; |
79 snowLeft,snowRight: LongInt; |
79 snowLeft,snowRight: LongInt; |
|
80 NewTurnTick: LongWord; |
80 //SDMusic: shortstring; |
81 //SDMusic: shortstring; |
81 |
82 |
82 // For better maintainability the step handlers of gears are stored in |
83 // For better maintainability the step handlers of gears are stored in |
83 // separate files. |
84 // separate files. |
84 // Note: step handlers of gears that are hedgehogs are in a different file |
85 // Note: step handlers of gears that are hedgehogs are in a different file |
186 procedure ProcessGears; |
187 procedure ProcessGears; |
187 var t: PGear; |
188 var t: PGear; |
188 i, AliveCount: LongInt; |
189 i, AliveCount: LongInt; |
189 s: shortstring; |
190 s: shortstring; |
190 begin |
191 begin |
|
192 ScriptCall('onGameTick'); |
|
193 if GameTicks mod 20 = 0 then ScriptCall('onGameTick20'); |
|
194 if GameTicks = NewTurnTick then |
|
195 begin |
|
196 ScriptCall('onNewTurn'); |
|
197 {$IFDEF SDL13} |
|
198 uTouch.NewTurnBeginning(); |
|
199 {$ENDIF} |
|
200 end; |
|
201 |
191 PrvInactive:= AllInactive; |
202 PrvInactive:= AllInactive; |
192 AllInactive:= true; |
203 AllInactive:= true; |
193 |
204 |
194 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then |
205 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then |
195 StepSoundChannel:= LoopSound(sndSteps) |
206 StepSoundChannel:= LoopSound(sndSteps) |
467 |
479 |
468 if (not CurrentTeam^.ExtDriven) or CurrentTeam^.hasGone then |
480 if (not CurrentTeam^.ExtDriven) or CurrentTeam^.hasGone then |
469 inc(hiTicks) // we do not recieve a message for this |
481 inc(hiTicks) // we do not recieve a message for this |
470 end; |
482 end; |
471 AddRandomness(CheckSum); |
483 AddRandomness(CheckSum); |
472 ScriptCall('onGameTick'); |
|
473 if GameTicks mod 20 = 0 then ScriptCall('onGameTick20'); |
|
474 |
484 |
475 inc(GameTicks) |
485 inc(GameTicks) |
476 end; |
486 end; |
477 |
487 |
478 //Purpose, to reset all transient attributes toggled by a utility and clean up various gears and effects at end of turn |
488 //Purpose, to reset all transient attributes toggled by a utility and clean up various gears and effects at end of turn |