36 var xx, yy: real; |
36 var xx, yy: real; |
37 begin |
37 begin |
38 with Gear^, |
38 with Gear^, |
39 CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do |
39 CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do |
40 begin |
40 begin |
41 {$IFDEF DEBUGFILE}AddFileLog('Attack: Gear.State = '+inttostr(State)+' CurAmmoGear = '+inttostr(longword(CurAmmoGear)));{$ENDIF} |
41 {$IFDEF DEBUGFILE}AddFileLog('Attack: Gear.State = '+inttostr(State));{$ENDIF} |
42 if CurAmmoGear <> nil then |
42 |
43 begin |
|
44 Message:= Message and not gm_Attack; |
|
45 if not CurrentTeam.ExtDriven then SendIPC('a') |
|
46 end; |
|
47 if (((State and (gstHHDriven or gstAttacking)) = (gstHHDriven or gstAttacking))and |
43 if (((State and (gstHHDriven or gstAttacking)) = (gstHHDriven or gstAttacking))and |
48 ((State and (gstAttacked or gstMoving or gstHHChooseTarget)) = 0)and |
44 ((State and (gstAttacked or gstMoving or gstHHChooseTarget)) = 0)and |
49 (((State and gstFalling ) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInFall) <> 0))and |
45 (((State and gstFalling ) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInFall) <> 0))and |
50 (((State and gstHHJumping) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInJump) <> 0)))and |
46 (((State and gstHHJumping) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInJump) <> 0))) then |
51 (CurAmmoGear = nil) then |
|
52 begin |
47 begin |
53 if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then |
48 if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then |
54 begin |
49 begin |
55 StopTPUSound; |
50 StopTPUSound; |
56 PlaySound(sndThrowRelease); |
51 PlaySound(sndThrowRelease); |
68 end; |
63 end; |
69 amPickHammer: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y) + cHHRadius, gtPickHammer, 0); |
64 amPickHammer: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y) + cHHRadius, gtPickHammer, 0); |
70 amSkip: TurnTimeLeft:= 0; |
65 amSkip: TurnTimeLeft:= 0; |
71 amRope: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y), gtRope, 0, xx, yy); |
66 amRope: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y), gtRope, 0, xx, yy); |
72 amMine: AddGear(round(X) + Sign(dX) * 7, round(Y), gtMine, 0, Sign(dX) * 0.02, 0, 3000); |
67 amMine: AddGear(round(X) + Sign(dX) * 7, round(Y), gtMine, 0, Sign(dX) * 0.02, 0, 3000); |
73 amDEagle: begin |
68 amDEagle: AddGear(round(X), round(Y), gtDEagleShot, 0, xx * 0.5, yy * 0.5); |
74 FollowGear:= AddGear(round(X), round(Y), gtDEagleShot, 0, xx * 0.5, yy * 0.5); |
|
75 end; |
|
76 amDynamite: AddGear(round(X) + Sign(dX) * 7, round(Y), gtDynamite, 0, Sign(dX) * 0.035, 0, 5000); |
69 amDynamite: AddGear(round(X) + Sign(dX) * 7, round(Y), gtDynamite, 0, Sign(dX) * 0.035, 0, 5000); |
77 amBaseballBat: AddGear(round(X) + Sign(dX) * 10, round(Y), gtShover, 0, xx * 0.5, yy * 0.5).Radius:= 15 |
70 amBaseballBat: AddGear(round(X) + Sign(dX) * 10, round(Y), gtShover, 0, xx * 0.5, yy * 0.5).Radius:= 20; |
|
71 amFirePunch: CurAmmoGear:= AddGear(round(X) + Sign(dX) * 10, round(Y), gtFirePunch, 0); |
78 end; |
72 end; |
79 Power:= 0; |
73 Power:= 0; |
80 if CurAmmoGear <> nil then |
74 if CurAmmoGear <> nil then |
81 begin |
75 begin |
82 Gear.Message:= Gear.Message or gm_Attack; |
76 Message:= Message or gm_Attack; |
83 CurAmmoGear.Message:= Gear.Message; |
77 CurAmmoGear.Message:= Message |
84 exit |
78 end else begin |
85 end else |
79 if not CurrentTeam.ExtDriven then SendIPC('a'); |
86 begin |
80 AfterAttack |
87 Message:= Message and not gm_Attack; |
81 end |
88 if not CurrentTeam.ExtDriven then SendIPC('a') |
|
89 end; |
|
90 AfterAttack |
|
91 end |
82 end |
92 end |
83 end |
93 end; |
84 end; |
94 |
85 |
95 procedure AfterAttack; |
86 procedure AfterAttack; |
198 end; |
189 end; |
199 Gear.Message:= Gear.Message and not (gm_LJump or gm_HJump); |
190 Gear.Message:= Gear.Message and not (gm_LJump or gm_HJump); |
200 if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then Gear.dX:= 0.0000001 * Sign(Gear.dX); |
191 if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then Gear.dX:= 0.0000001 * Sign(Gear.dX); |
201 Gear.X:= Gear.X + Gear.dX; |
192 Gear.X:= Gear.X + Gear.dX; |
202 Gear.dY:= Gear.dY + cGravity; |
193 Gear.dY:= Gear.dY + cGravity; |
203 if (Gear.dY < 0)and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0; |
194 if (Gear.dY < 0)and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0; |
204 Gear.Y:= Gear.Y + Gear.dY; |
195 Gear.Y:= Gear.Y + Gear.dY; |
205 if (Gear.dY >= 0)and TestCollisionYwithGear(Gear, 1) then |
196 if (Gear.dY >= 0)and TestCollisionYwithGear(Gear, 1) then |
206 begin |
197 begin |
207 CheckHHDamage(Gear); |
198 CheckHHDamage(Gear); |
208 if ((abs(Gear.dX) + abs(Gear.dY)) < 0.55) |
199 if ((abs(Gear.dX) + abs(Gear.dY)) < 0.55) |
271 or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1; |
262 or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1; |
272 if not (TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) |
263 if not (TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) |
273 or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1; |
264 or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1; |
274 end; |
265 end; |
275 if not TestCollisionXwithGear(Gear, Sign(Gear.dX)) then Gear.X:= Gear.X + Gear.dX; |
266 if not TestCollisionXwithGear(Gear, Sign(Gear.dX)) then Gear.X:= Gear.X + Gear.dX; |
|
267 Gear.dX:= 0.0000001 * Sign(Gear.dX); |
276 SetAllHHToActive; |
268 SetAllHHToActive; |
277 |
269 |
278 if not TestCollisionYwithGear(Gear, 1) then |
270 if not TestCollisionYwithGear(Gear, 1) then |
279 begin |
271 begin |
280 Gear.Y:= Gear.Y + 1; |
272 Gear.Y:= Gear.Y + 1; |
361 begin |
353 begin |
362 Gear.X:= Gear.X + Gear.dX; |
354 Gear.X:= Gear.X + Gear.dX; |
363 Gear.Y:= Gear.Y + Gear.dY; |
355 Gear.Y:= Gear.Y + Gear.dY; |
364 if (Gear.dY > 0) and not TestCollisionYwithGear(Gear, 1) and TestCollisionYwithXYShift(Gear, 0, 1, 1) then |
356 if (Gear.dY > 0) and not TestCollisionYwithGear(Gear, 1) and TestCollisionYwithXYShift(Gear, 0, 1, 1) then |
365 begin |
357 begin |
|
358 CheckHHDamage(Gear); |
366 Gear.dY:= 0; |
359 Gear.dY:= 0; |
367 Gear.Y:= Gear.Y + 1 |
360 Gear.Y:= Gear.Y + 1 |
368 end; |
361 end; |
369 end else |
362 end else |
370 if Gear.Health = 0 then |
363 if Gear.Health = 0 then |