equal
deleted
inserted
replaced
86 end; |
86 end; |
87 end; |
87 end; |
88 |
88 |
89 procedure DeleteGear(Gear: PGear); forward; |
89 procedure DeleteGear(Gear: PGear); forward; |
90 procedure doMakeExplosion(X, Y, Radius: integer; Mask: LongWord); forward; |
90 procedure doMakeExplosion(X, Y, Radius: integer; Mask: LongWord); forward; |
91 function isGearNear(Gear: PGear; Kind: TGearType; rX, rY: integer): boolean; forward; |
91 function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: integer): PGear; forward; |
|
92 procedure SpawnBoxOfSmth; forward; |
92 |
93 |
93 {$INCLUDE GSHandlers.inc} |
94 {$INCLUDE GSHandlers.inc} |
94 {$INCLUDE HHHandlers.inc} |
95 {$INCLUDE HHHandlers.inc} |
95 |
96 |
96 const doStepHandlers: array[TGearType] of TGearStepProcedure = ( |
97 const doStepHandlers: array[TGearType] of TGearStepProcedure = ( |
255 end; |
256 end; |
256 end; |
257 end; |
257 |
258 |
258 procedure ProcessGears; |
259 procedure ProcessGears; |
259 const delay: integer = cInactDelay; |
260 const delay: integer = cInactDelay; |
|
261 step: (stDelay, stChDmg, stSpawn, stNTurn) = stDelay; |
260 var Gear, t: PGear; |
262 var Gear, t: PGear; |
261 {$IFDEF COUNTTICKS} |
263 {$IFDEF COUNTTICKS} |
262 tickcntA, tickcntB: LongWord; |
264 tickcntA, tickcntB: LongWord; |
263 const cntSecTicks: LongWord = 0; |
265 const cntSecTicks: LongWord = 0; |
264 {$ENDIF} |
266 {$ENDIF} |
281 Gear:= t; |
283 Gear:= t; |
282 t:= Gear.NextGear; |
284 t:= Gear.NextGear; |
283 if Gear.Active then Gear.doStep(Gear); |
285 if Gear.Active then Gear.doStep(Gear); |
284 end; |
286 end; |
285 if AllInactive then |
287 if AllInactive then |
286 if (delay > 0)and not isInMultiShoot then |
288 case step of |
287 begin |
289 stDelay: begin |
288 if delay = cInactDelay then SetAllToActive; |
290 dec(delay); |
289 dec(delay) |
291 if delay = 0 then |
290 end |
292 begin |
291 else begin |
293 inc(step); |
292 delay:= cInactDelay; |
294 delay:= cInactDelay |
293 if CheckNoDamage then |
295 end |
294 if isInMultiShoot then isInMultiShoot:= false |
296 end; |
295 else ParseCommand('/nextturn'); |
297 stChDmg: if CheckNoDamage then inc(step) else step:= stDelay; |
296 end; |
298 stSpawn: begin |
|
299 if not isInMultiShoot then SpawnBoxOfSmth; |
|
300 inc(step) |
|
301 end; |
|
302 stNTurn: begin |
|
303 if isInMultiShoot then isInMultiShoot:= false |
|
304 else ParseCommand('/nextturn'); |
|
305 step:= Low(step) |
|
306 end; |
|
307 end; |
|
308 |
297 if TurnTimeLeft > 0 then |
309 if TurnTimeLeft > 0 then |
298 if CurrentTeam <> nil then |
310 if CurrentTeam <> nil then |
299 if CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear <> nil then |
311 if CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear <> nil then |
300 if ((CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear.State and gstAttacking) = 0) |
312 if ((CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear.State and gstAttacking) = 0) |
301 and not isInMultiShoot then dec(TurnTimeLeft); |
313 and not isInMultiShoot then dec(TurnTimeLeft); |
539 end; |
551 end; |
540 Gear:= Gear.NextGear |
552 Gear:= Gear.NextGear |
541 end |
553 end |
542 end; |
554 end; |
543 |
555 |
544 function isGearNear(Gear: PGear; Kind: TGearType; rX, rY: integer): boolean; |
556 function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: integer): PGear; |
545 var t: PGear; |
557 var t: PGear; |
546 begin |
558 begin |
547 t:= GearsList; |
559 t:= GearsList; |
548 rX:= sqr(rX); |
560 rX:= sqr(rX); |
549 rY:= sqr(rY); |
561 rY:= sqr(rY); |
550 while t <> nil do |
562 while t <> nil do |
551 begin |
563 begin |
552 if (t <> Gear) and (t.Kind = Kind) then |
564 if (t <> Gear) and (t.Kind = Kind) then |
553 if sqr(Gear.X - t.X) / rX + sqr(Gear.Y - t.Y) / rY <= 1 then |
565 if sqr(Gear.X - t.X) / rX + sqr(Gear.Y - t.Y) / rY <= 1 then |
554 begin |
566 begin |
555 Result:= true; |
567 Result:= t; |
556 exit |
568 exit |
557 end; |
569 end; |
558 t:= t.NextGear |
570 t:= t.NextGear |
559 end; |
571 end; |
560 Result:= false |
572 Result:= nil |
|
573 end; |
|
574 |
|
575 procedure SpawnBoxOfSmth; |
|
576 begin |
561 end; |
577 end; |
562 |
578 |
563 initialization |
579 initialization |
564 |
580 |
565 finalization |
581 finalization |