90 procedure AfterAttack; forward; |
90 procedure AfterAttack; forward; |
91 procedure FindPlace(Gear: PGear; withFall: boolean; Left, Right: LongInt); forward; |
91 procedure FindPlace(Gear: PGear; withFall: boolean; Left, Right: LongInt); forward; |
92 procedure HedgehogStep(Gear: PGear); forward; |
92 procedure HedgehogStep(Gear: PGear); forward; |
93 procedure HedgehogChAngle(Gear: PGear); forward; |
93 procedure HedgehogChAngle(Gear: PGear); forward; |
94 procedure ShotgunShot(Gear: PGear); forward; |
94 procedure ShotgunShot(Gear: PGear); forward; |
|
95 procedure AddDamageTag(X, Y, Damage: LongWord; Gear: PGear); forward; |
95 |
96 |
96 {$INCLUDE GSHandlers.inc} |
97 {$INCLUDE GSHandlers.inc} |
97 {$INCLUDE HHHandlers.inc} |
98 {$INCLUDE HHHandlers.inc} |
98 |
99 |
99 const doStepHandlers: array[TGearType] of TGearStepProcedure = ( |
100 const doStepHandlers: array[TGearType] of TGearStepProcedure = ( |
279 end; |
281 end; |
280 gtBlowTorch: begin |
282 gtBlowTorch: begin |
281 Result^.Radius:= cHHRadius + cBlowTorchC; |
283 Result^.Radius:= cHHRadius + cBlowTorchC; |
282 Result^.Timer:= 7500; |
284 Result^.Timer:= 7500; |
283 end; |
285 end; |
|
286 gtSmallDamage: begin |
|
287 Result^.Timer:= 1100; |
|
288 Result^.Z:= 2000; |
|
289 end; |
284 end; |
290 end; |
285 InsertGearToList(Result); |
291 InsertGearToList(Result); |
286 AddGear:= Result |
292 AddGear:= Result |
287 end; |
293 end; |
288 |
294 |
289 procedure DeleteGear(Gear: PGear); |
295 procedure DeleteGear(Gear: PGear); |
290 var team: PTeam; |
296 var team: PTeam; |
291 t: Longword; |
297 t: Longword; |
292 begin |
298 begin |
293 DeleteCI(Gear); |
299 DeleteCI(Gear); |
294 if Gear^.Surf <> nil then SDL_FreeSurface(Gear^.Surf); |
300 if Gear^.Surf <> nil then |
|
301 begin |
|
302 SDL_FreeSurface(Gear^.Surf); |
|
303 Gear^.Surf:= nil |
|
304 end; |
295 if Gear^.Kind = gtHedgehog then |
305 if Gear^.Kind = gtHedgehog then |
296 if CurAmmoGear <> nil then |
306 if CurAmmoGear <> nil then |
297 begin |
307 begin |
298 Gear^.Message:= gm_Destroy; |
308 Gear^.Message:= gm_Destroy; |
299 CurAmmoGear^.Message:= gm_Destroy; |
309 CurAmmoGear^.Message:= gm_Destroy; |
331 if Gear^.Damage <> 0 then |
341 if Gear^.Damage <> 0 then |
332 begin |
342 begin |
333 CheckNoDamage:= false; |
343 CheckNoDamage:= false; |
334 inc(StepDamage, Gear^.Damage); |
344 inc(StepDamage, Gear^.Damage); |
335 if Gear^.Health < Gear^.Damage then Gear^.Health:= 0 |
345 if Gear^.Health < Gear^.Damage then Gear^.Health:= 0 |
336 else dec(Gear^.Health, Gear^.Damage); |
346 else dec(Gear^.Health, Gear^.Damage); |
337 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) - cHHRadius - 12 - PHedgehog(Gear^.Hedgehog)^.HealthTag^.h, |
347 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) - cHHRadius - 12, |
338 gtHealthTag, Gear^.Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
348 gtHealthTag, Gear^.Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
339 RenderHealth(PHedgehog(Gear^.Hedgehog)^); |
349 RenderHealth(PHedgehog(Gear^.Hedgehog)^); |
340 RecountTeamHealth(PHedgehog(Gear^.Hedgehog)^.Team); |
350 RecountTeamHealth(PHedgehog(Gear^.Hedgehog)^.Team); |
341 |
351 |
342 Gear^.Damage:= 0 |
352 Gear^.Damage:= 0 |
343 end; |
353 end; |
344 Gear:= Gear^.NextGear |
354 Gear:= Gear^.NextGear |
345 end; |
355 end; |
|
356 end; |
|
357 |
|
358 procedure AddDamageTag(X, Y, Damage: LongWord; Gear: PGear); |
|
359 begin |
|
360 AddGear(X, Y, gtSmallDamage, Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
346 end; |
361 end; |
347 |
362 |
348 procedure ProcessGears; |
363 procedure ProcessGears; |
349 const delay: LongInt = cInactDelay; |
364 const delay: LongInt = cInactDelay; |
350 step: (stDelay, stChDmg, stChWin, stSpawn, stNTurn) = stDelay; |
365 step: (stDelay, stChDmg, stChWin, stSpawn, stNTurn) = stDelay; |
530 case Gear^.Kind of |
545 case Gear^.Kind of |
531 gtCloud: DrawSprite(sprCloud , hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State, Surface); |
546 gtCloud: DrawSprite(sprCloud , hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State, Surface); |
532 gtAmmo_Bomb: DrawSprite(sprBomb , hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, hwRound(Gear^.DirAngle), Surface); |
547 gtAmmo_Bomb: DrawSprite(sprBomb , hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, hwRound(Gear^.DirAngle), Surface); |
533 gtHedgehog: DrawHH(Gear, Surface); |
548 gtHedgehog: DrawHH(Gear, Surface); |
534 gtAmmo_Grenade: DrawSprite(sprGrenade , hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, DxDy2Angle32(Gear^.dY, Gear^.dX), Surface); |
549 gtAmmo_Grenade: DrawSprite(sprGrenade , hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, DxDy2Angle32(Gear^.dY, Gear^.dX), Surface); |
535 gtHealthTag: if Gear^.Surf <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Surf, Surface); |
550 gtHealthTag, |
|
551 gtSmallDamage: if Gear^.Surf <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Surf, Surface); |
536 gtGrave: DrawSpriteFromRect(PHedgehog(Gear^.Hedgehog)^.Team^.GraveRect, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, Surface); |
552 gtGrave: DrawSpriteFromRect(PHedgehog(Gear^.Hedgehog)^.Team^.GraveRect, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, Surface); |
537 gtUFO: DrawSprite(sprUFO, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4, Surface); |
553 gtUFO: DrawSprite(sprUFO, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4, Surface); |
538 gtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State, Surface); |
554 gtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State, Surface); |
539 gtRope: begin |
555 gtRope: begin |
540 roplen:= 0; |
556 roplen:= 0; |
628 else dmgRadius:= Radius; |
644 else dmgRadius:= Radius; |
629 Gear:= GearsList; |
645 Gear:= GearsList; |
630 while Gear <> nil do |
646 while Gear <> nil do |
631 begin |
647 begin |
632 dmg:= dmgRadius - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))); |
648 dmg:= dmgRadius - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))); |
633 if dmg > 0 then |
649 if (dmg > 0) and |
|
650 ((Gear^.State and gstNoDamage) = 0) then |
634 begin |
651 begin |
635 dmg:= dmg div 2; |
652 dmg:= dmg div 2; |
636 case Gear^.Kind of |
653 case Gear^.Kind of |
637 gtHedgehog, |
654 gtHedgehog, |
638 gtMine, |
655 gtMine, |
639 gtCase, |
656 gtCase, |
640 gtFlame: begin |
657 gtFlame: begin |
641 {$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
658 {$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
642 if (Mask and EXPLNoDamage) = 0 then inc(Gear^.Damage, dmg); |
659 if (Mask and EXPLNoDamage) = 0 then |
|
660 begin |
|
661 inc(Gear^.Damage, dmg); |
|
662 if Gear^.Kind = gtHedgehog then |
|
663 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, Gear) |
|
664 end; |
643 if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
665 if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
644 begin |
666 begin |
645 DeleteCI(Gear); |
667 DeleteCI(Gear); |
646 Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - int2hwFloat(X)); |
668 Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - int2hwFloat(X)); |
647 Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y)); |
669 Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y)); |
663 end; |
685 end; |
664 |
686 |
665 procedure ShotgunShot(Gear: PGear); |
687 procedure ShotgunShot(Gear: PGear); |
666 var t: PGear; |
688 var t: PGear; |
667 dmg: integer; |
689 dmg: integer; |
|
690 hh: PHedgehog; |
668 begin |
691 begin |
669 Gear^.Radius:= cShotgunRadius; |
692 Gear^.Radius:= cShotgunRadius; |
|
693 hh:= Gear^.Hedgehog; |
670 t:= GearsList; |
694 t:= GearsList; |
671 while t <> nil do |
695 while t <> nil do |
672 begin |
696 begin |
673 dmg:= min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25); |
697 dmg:= min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25); |
674 if dmg >= 0 then |
698 if dmg >= 0 then |
675 case t^.Kind of |
699 case t^.Kind of |
676 gtHedgehog, |
700 gtHedgehog, |
677 gtMine, |
701 gtMine, |
678 gtCase: begin |
702 gtCase: begin |
679 inc(t^.Damage, dmg); |
703 inc(t^.Damage, dmg); |
|
704 if t^.Kind = gtHedgehog then |
|
705 begin |
|
706 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, Gear); |
|
707 inc(hh^.DamageGiven, dmg) |
|
708 end; |
680 DeleteCI(t); |
709 DeleteCI(t); |
681 t^.dX:= t^.dX + SignAs(Gear^.dX * dmg * _0_01 + cHHKick, t^.X - Gear^.X); |
710 t^.dX:= t^.dX + SignAs(Gear^.dX * dmg * _0_01 + cHHKick, t^.X - Gear^.X); |
682 t^.dY:= t^.dY + Gear^.dY * dmg * _0_01; |
711 t^.dY:= t^.dY + Gear^.dY * dmg * _0_01; |
683 t^.State:= t^.State or gstMoving; |
712 t^.State:= t^.State or gstMoving; |
684 t^.Active:= true; |
713 t^.Active:= true; |
709 case t^.ar[i]^.Kind of |
738 case t^.ar[i]^.Kind of |
710 gtHedgehog, |
739 gtHedgehog, |
711 gtMine, |
740 gtMine, |
712 gtCase: begin |
741 gtCase: begin |
713 inc(t^.ar[i]^.Damage, Damage); |
742 inc(t^.ar[i]^.Damage, Damage); |
714 inc(hh^.DamageGiven, Damage); |
743 if t^.ar[i]^.Kind = gtHedgehog then |
|
744 begin |
|
745 AddDamageTag(hwRound(t^.ar[i]^.X), hwRound(t^.ar[i]^.Y), Damage, t^.ar[i]); |
|
746 inc(hh^.DamageGiven, Damage) |
|
747 end; |
715 t^.ar[i]^.dX:= Ammo^.dX * Power * _0_01; |
748 t^.ar[i]^.dX:= Ammo^.dX * Power * _0_01; |
716 t^.ar[i]^.dY:= Ammo^.dY * Power * _0_01; |
749 t^.ar[i]^.dY:= Ammo^.dY * Power * _0_01; |
717 t^.ar[i]^.Active:= true; |
750 t^.ar[i]^.Active:= true; |
718 t^.ar[i]^.State:= t^.ar[i]^.State or gstMoving; |
751 t^.ar[i]^.State:= t^.ar[i]^.State or gstMoving; |
719 DeleteCI(t^.ar[i]); |
752 DeleteCI(t^.ar[i]); |