equal
deleted
inserted
replaced
52 |
52 |
53 procedure initModule; |
53 procedure initModule; |
54 procedure freeModule; |
54 procedure freeModule; |
55 |
55 |
56 procedure FillTargets; |
56 procedure FillTargets; |
|
57 procedure AddBonus(x, y: LongInt; r: Longword; s: LongInt); inline; |
57 procedure FillBonuses(isAfterAttack: boolean); |
58 procedure FillBonuses(isAfterAttack: boolean); |
58 procedure AwareOfExplosion(x, y, r: LongInt); inline; |
59 procedure AwareOfExplosion(x, y, r: LongInt); inline; |
59 |
60 |
60 function RatePlace(Gear: PGear): LongInt; |
61 function RatePlace(Gear: PGear): LongInt; |
61 function TestColl(x, y, r: LongInt): boolean; inline; |
62 function TestColl(x, y, r: LongInt): boolean; inline; |
76 Targets: TTargets; |
77 Targets: TTargets; |
77 |
78 |
78 bonuses: record |
79 bonuses: record |
79 Count: Longword; |
80 Count: Longword; |
80 ar: array[0..Pred(MAXBONUS)] of TBonus; |
81 ar: array[0..Pred(MAXBONUS)] of TBonus; |
|
82 end; |
|
83 |
|
84 walkbonuses: record |
|
85 Count: Longword; |
|
86 ar: array[0..Pred(MAXBONUS div 4)] of TBonus; // don't use too many |
81 end; |
87 end; |
82 |
88 |
83 implementation |
89 implementation |
84 uses uCollisions, uVariables, uUtils, uDebug, uLandTexture; |
90 uses uCollisions, uVariables, uUtils, uDebug, uLandTexture; |
85 |
91 |
138 bonuses.ar[bonuses.Count].Score:= s; |
144 bonuses.ar[bonuses.Count].Score:= s; |
139 inc(bonuses.Count); |
145 inc(bonuses.Count); |
140 end; |
146 end; |
141 end; |
147 end; |
142 |
148 |
|
149 procedure AddWalkBonus(x, y: LongInt; r: Longword; s: LongInt); inline; |
|
150 begin |
|
151 if(walkbonuses.Count < MAXBONUS div 4) then |
|
152 begin |
|
153 walkbonuses.ar[walkbonuses.Count].x:= x; |
|
154 walkbonuses.ar[walkbonuses.Count].y:= y; |
|
155 walkbonuses.ar[walkbonuses.Count].Radius:= r; |
|
156 walkbonuses.ar[walkbonuses.Count].Score:= s; |
|
157 inc(walkbonuses.Count); |
|
158 end; |
|
159 end; |
|
160 |
143 procedure FillBonuses(isAfterAttack: boolean); |
161 procedure FillBonuses(isAfterAttack: boolean); |
144 var Gear: PGear; |
162 var Gear: PGear; |
145 MyClan: PClan; |
163 MyClan: PClan; |
|
164 i: Longint; |
146 begin |
165 begin |
147 bonuses.Count:= 0; |
166 bonuses.Count:= 0; |
148 MyClan:= ThinkingHH^.Hedgehog^.Team^.Clan; |
167 MyClan:= ThinkingHH^.Hedgehog^.Team^.Clan; |
149 Gear:= GearsList; |
168 Gear:= GearsList; |
150 while Gear <> nil do |
169 while Gear <> nil do |
188 Gear:= Gear^.NextGear |
207 Gear:= Gear^.NextGear |
189 end; |
208 end; |
190 if isAfterAttack and (KnownExplosion.Radius > 0) then |
209 if isAfterAttack and (KnownExplosion.Radius > 0) then |
191 with KnownExplosion do |
210 with KnownExplosion do |
192 AddBonus(X, Y, Radius + 10, -Radius); |
211 AddBonus(X, Y, Radius + 10, -Radius); |
|
212 if isAfterAttack then |
|
213 for i:= 0 to Pred(walkbonuses.Count) do |
|
214 with walkbonuses.ar[i] do |
|
215 AddBonus(X, Y, Radius, Score); |
|
216 walkbonuses.Count:= 0 |
193 end; |
217 end; |
194 |
218 |
195 procedure AwareOfExplosion(x, y, r: LongInt); inline; |
219 procedure AwareOfExplosion(x, y, r: LongInt); inline; |
196 begin |
220 begin |
197 KnownExplosion.X:= x; |
221 KnownExplosion.X:= x; |
640 end; |
664 end; |
641 until false |
665 until false |
642 end; |
666 end; |
643 |
667 |
644 function HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean; |
668 function HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean; |
645 var pX, pY: LongInt; |
669 var pX, pY, tY: LongInt; |
646 begin |
670 begin |
647 HHGo:= false; |
671 HHGo:= false; |
648 AltGear^:= Gear^; |
672 AltGear^:= Gear^; |
649 |
673 |
650 GoInfo.Ticks:= 0; |
674 GoInfo.Ticks:= 0; |
651 GoInfo.FallPix:= 0; |
675 GoInfo.FallPix:= 0; |
652 GoInfo.JumpType:= jmpNone; |
676 GoInfo.JumpType:= jmpNone; |
653 |
677 tY:= hwRound(Gear^.Y); |
654 repeat |
678 repeat |
655 pX:= hwRound(Gear^.X); |
679 pX:= hwRound(Gear^.X); |
656 pY:= hwRound(Gear^.Y); |
680 pY:= hwRound(Gear^.Y); |
657 if pY + cHHRadius >= cWaterLine then |
681 if pY + cHHRadius >= cWaterLine then |
658 exit(false); |
682 begin |
|
683 if AltGear^.Hedgehog^.BotLevel < 4 then |
|
684 AddWalkBonus(pX, tY, 250, -40); |
|
685 exit(false) |
|
686 end; |
659 |
687 |
660 // hog is falling |
688 // hog is falling |
661 if (Gear^.State and gstMoving) <> 0 then |
689 if (Gear^.State and gstMoving) <> 0 then |
662 begin |
690 begin |
663 inc(GoInfo.Ticks); |
691 inc(GoInfo.Ticks); |
665 if Gear^.dY > _0_4 then |
693 if Gear^.dY > _0_4 then |
666 begin |
694 begin |
667 Goinfo.FallPix:= 0; |
695 Goinfo.FallPix:= 0; |
668 // try ljump instead of fall with damage |
696 // try ljump instead of fall with damage |
669 HHJump(AltGear, jmpLJump, GoInfo); |
697 HHJump(AltGear, jmpLJump, GoInfo); |
|
698 if AltGear^.Hedgehog^.BotLevel < 4 then |
|
699 AddWalkBonus(pX, tY, 175, -20); |
670 exit(false) |
700 exit(false) |
671 end; |
701 end; |
672 Gear^.Y:= Gear^.Y + Gear^.dY; |
702 Gear^.Y:= Gear^.Y + Gear^.dY; |
673 if hwRound(Gear^.Y) > pY then |
703 if hwRound(Gear^.Y) > pY then |
674 inc(GoInfo.FallPix); |
704 inc(GoInfo.FallPix); |