34 //////////////////////////////////////////////////////////////////////////////// |
34 //////////////////////////////////////////////////////////////////////////////// |
35 procedure Attack(Gear: PGear); |
35 procedure Attack(Gear: PGear); |
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 PHedgehog(Gear.Hedgehog)^ do |
40 begin |
40 begin |
41 {$IFDEF DEBUGFILE}AddFileLog('Attack: Gear.State = '+inttostr(State));{$ENDIF} |
41 if ((State and gstHHDriven) <> 0)and |
42 |
42 // (((State and gstAttacking) <> 0) or ((Message and gm_Attack) <> 0))and |
43 if (((State and (gstHHDriven or gstAttacking)) = (gstHHDriven or gstAttacking))and |
|
44 ((State and (gstAttacked or gstMoving or gstHHChooseTarget)) = 0)and |
43 ((State and (gstAttacked or gstMoving or gstHHChooseTarget)) = 0)and |
45 (((State and gstFalling ) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInFall) <> 0))and |
44 (((State and gstFalling ) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInFall) <> 0))and |
46 (((State and gstHHJumping) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInJump) <> 0))) then |
45 (((State and gstHHJumping) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInJump) <> 0))and |
|
46 ((TargetPoint.X <> NoPointX) or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_NeedTarget) = 0)) then |
47 begin |
47 begin |
|
48 State:= State or gstAttacking; |
|
49 if Power = cMaxPower then Message:= Message and not gm_Attack |
|
50 else if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Power) = 0 then Message:= Message and not gm_Attack |
|
51 else begin |
|
52 if Power = 0 then |
|
53 begin |
|
54 AttackBar:= CurrentTeam.AttackBar; |
|
55 PlaySound(sndThrowPowerUp) |
|
56 end; |
|
57 inc(Power) |
|
58 end; |
|
59 if ((Message and gm_Attack) <> 0) then exit; |
|
60 |
48 if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then |
61 if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then |
49 begin |
62 begin |
50 StopTPUSound; |
63 StopTPUSound; |
51 PlaySound(sndThrowRelease); |
64 PlaySound(sndThrowRelease); |
52 end; |
65 end; |
74 if CurAmmoGear <> nil then |
87 if CurAmmoGear <> nil then |
75 begin |
88 begin |
76 Message:= Message or gm_Attack; |
89 Message:= Message or gm_Attack; |
77 CurAmmoGear.Message:= Message |
90 CurAmmoGear.Message:= Message |
78 end else begin |
91 end else begin |
79 if not CurrentTeam.ExtDriven then SendIPC('a'); |
92 if not CurrentTeam.ExtDriven and |
|
93 ((Ammo[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0) then SendIPC('a'); |
80 AfterAttack |
94 AfterAttack |
81 end |
95 end |
82 end |
96 end else Message:= Message and not gm_Attack |
83 end |
97 end |
84 end; |
98 end; |
85 |
99 |
86 procedure AfterAttack; |
100 procedure AfterAttack; |
87 begin |
101 begin |
94 else begin |
108 else begin |
95 TurnTimeLeft:= Ammoz[Ammo[CurSlot, CurAmmo].AmmoType].TimeAfterTurn; |
109 TurnTimeLeft:= Ammoz[Ammo[CurSlot, CurAmmo].AmmoType].TimeAfterTurn; |
96 State:= State or gstAttacked; |
110 State:= State or gstAttacked; |
97 OnUsedAmmo(Ammo) |
111 OnUsedAmmo(Ammo) |
98 end; |
112 end; |
99 AttackBar:= 0 |
113 AttackBar:= 0; |
100 end |
114 end |
101 end; |
115 end; |
102 |
116 |
103 //////////////////////////////////////////////////////////////////////////////// |
117 //////////////////////////////////////////////////////////////////////////////// |
104 procedure PickUp(HH, Gear: PGear); |
118 procedure PickUp(HH, Gear: PGear); |
149 begin |
163 begin |
150 CurAmmoGear.Message:= Gear.Message; |
164 CurAmmoGear.Message:= Gear.Message; |
151 exit |
165 exit |
152 end; |
166 end; |
153 |
167 |
154 if (Gear.Message and gm_Attack)<>0 then |
168 if ((Gear.Message and gm_Attack) <> 0) or |
155 if (Gear.State and (gstAttacked or gstHHChooseTarget) = 0) then |
169 ((Gear.State and gstAttacking) <> 0)then Attack(Gear); |
156 with PHedgehog(Gear.Hedgehog)^ do |
|
157 begin |
|
158 Gear.State:= Gear.State or gstAttacking; |
|
159 if Gear.Power = cMaxPower then Gear.Message:= Gear.Message and not gm_Attack |
|
160 else |
|
161 if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Power) = 0 then |
|
162 Gear.Message:= Gear.Message and not gm_Attack |
|
163 else begin |
|
164 if Gear.Power = 0 then |
|
165 begin |
|
166 AttackBar:= CurrentTeam.AttackBar; |
|
167 PlaySound(sndThrowPowerUp) |
|
168 end; |
|
169 inc(Gear.Power) |
|
170 end |
|
171 end |
|
172 else Gear.Message:= Gear.Message and not gm_Attack; |
|
173 |
|
174 if ((Gear.State and gstAttacking) <> 0) and ((Gear.Message and gm_Attack) = 0) then |
|
175 begin |
|
176 Attack(Gear); |
|
177 StepTicks:= cHHStepTicks |
|
178 end; |
|
179 |
170 |
180 if (Gear.State and gstFalling) <> 0 then |
171 if (Gear.State and gstFalling) <> 0 then |
181 begin |
172 begin |
182 // it could be the source to trick: double-backspace jump -> vertical wall |
173 // it could be the source to trick: double-backspace jump -> vertical wall |
183 // collision - > (abs(Gear.dX) < 0.0000002) -> backspace -> even more high jump |
174 // collision - > (abs(Gear.dX) < 0.0000002) -> backspace -> even more high jump |