21 |
21 |
22 interface |
22 interface |
23 uses uFloat, uTypes, SDLh; |
23 uses uFloat, uTypes, SDLh; |
24 |
24 |
25 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
25 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
26 procedure DeleteGear(Gear: PGear); |
26 procedure DeleteGear(Gear: PGear); inline; |
|
27 procedure DeleteGearStage(Gear: PGear; cleanup: boolean); |
27 procedure InsertGearToList(Gear: PGear); |
28 procedure InsertGearToList(Gear: PGear); |
28 procedure RemoveGearFromList(Gear: PGear); |
29 procedure RemoveGearFromList(Gear: PGear); |
29 |
30 |
30 var curHandledGear: PGear; |
31 var curHandledGear: PGear; |
31 |
32 |
658 CurAmmoGear^.Message:= gmDestroy; |
664 CurAmmoGear^.Message:= gmDestroy; |
659 exit |
665 exit |
660 end |
666 end |
661 else*) |
667 else*) |
662 begin |
668 begin |
663 if ((CurrentHedgehog = nil) or (Gear <> CurrentHedgehog^.Gear)) or (CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtKamikaze) then |
669 team:= Gear^.Hedgehog^.Team; |
664 Gear^.Hedgehog^.Team^.Clan^.Flawless:= false; |
670 if not cleanup then |
665 if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then |
|
666 begin |
671 begin |
667 t:= max(Gear^.Damage, Gear^.Health); |
672 if ((CurrentHedgehog = nil) or (Gear <> CurrentHedgehog^.Gear)) or (CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtKamikaze) then |
668 Gear^.Damage:= t; |
673 Gear^.Hedgehog^.Team^.Clan^.Flawless:= false; |
669 if (((not SuddenDeathDmg) and (WaterOpacity < $FF)) or (SuddenDeathDmg and (SDWaterOpacity < $FF))) then |
674 if not CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then |
670 spawnHealthTagForHH(Gear, t); |
675 begin |
|
676 t:= max(Gear^.Damage, Gear^.Health); |
|
677 Gear^.Damage:= t; |
|
678 if (((not SuddenDeathDmg) and (WaterOpacity < $FF)) or (SuddenDeathDmg and (SDWaterOpacity < $FF))) then |
|
679 spawnHealthTagForHH(Gear, t); |
|
680 end; |
|
681 |
|
682 // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog |
|
683 // same stand for CheckHHDamage |
|
684 if (Gear^.LastDamage <> nil) and (CurrentHedgehog <> nil) then |
|
685 uStats.HedgehogDamaged(Gear, Gear^.LastDamage, 0, true) |
|
686 else if CurrentHedgehog <> nil then |
|
687 uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true); |
|
688 |
|
689 inc(KilledHHs); |
|
690 RecountTeamHealth(team); |
|
691 if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Effects[heResurrectable] <> 0) and |
|
692 //(Gear^.Hedgehog^.Effects[heResurrectable] = 0) then |
|
693 (Gear^.Hedgehog^.Team^.Clan <> CurrentHedgehog^.Team^.Clan) then |
|
694 with CurrentHedgehog^ do |
|
695 begin |
|
696 inc(Team^.stats.AIKills); |
|
697 FreeAndNilTexture(Team^.AIKillsTex); |
|
698 Team^.AIKillsTex := RenderStringTex(ansistring(inttostr(Team^.stats.AIKills)), Team^.Clan^.Color, fnt16); |
|
699 end |
671 end; |
700 end; |
672 |
701 |
673 team:= Gear^.Hedgehog^.Team; |
|
674 if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear = Gear) then |
702 if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear = Gear) then |
675 begin |
703 begin |
676 AttackBar:= 0; |
704 AttackBar:= 0; |
677 FreeActionsList; // to avoid ThinkThread on drawned gear |
705 FreeActionsList; // to avoid ThinkThread on drawned gear |
678 if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) |
706 if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) |
693 begin |
721 begin |
694 team^.Clan^.Teams[i]^.hasGone:= true; |
722 team^.Clan^.Teams[i]^.hasGone:= true; |
695 TeamGoneEffect(team^.Clan^.Teams[i]^) |
723 TeamGoneEffect(team^.Clan^.Teams[i]^) |
696 end |
724 end |
697 end; |
725 end; |
698 |
|
699 // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog |
|
700 // same stand for CheckHHDamage |
|
701 if (Gear^.LastDamage <> nil) and (CurrentHedgehog <> nil) then |
|
702 uStats.HedgehogDamaged(Gear, Gear^.LastDamage, 0, true) |
|
703 else if CurrentHedgehog <> nil then |
|
704 uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true); |
|
705 |
|
706 inc(KilledHHs); |
|
707 RecountTeamHealth(team); |
|
708 if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Effects[heResurrectable] <> 0) and |
|
709 //(Gear^.Hedgehog^.Effects[heResurrectable] = 0) then |
|
710 (Gear^.Hedgehog^.Team^.Clan <> CurrentHedgehog^.Team^.Clan) then |
|
711 with CurrentHedgehog^ do |
|
712 begin |
|
713 inc(Team^.stats.AIKills); |
|
714 FreeAndNilTexture(Team^.AIKillsTex); |
|
715 Team^.AIKillsTex := RenderStringTex(ansistring(inttostr(Team^.stats.AIKills)), Team^.Clan^.Color, fnt16); |
|
716 end |
|
717 end; |
726 end; |
718 with Gear^ do |
727 with Gear^ do |
719 begin |
728 begin |
720 AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind)); |
729 AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind)); |
721 AddRandomness(X.round xor X.frac xor dX.round xor dX.frac xor Y.round xor Y.frac xor dY.round xor dY.frac) |
730 AddRandomness(X.round xor X.frac xor dX.round xor dX.frac xor Y.round xor Y.frac xor dY.round xor dY.frac) |