216 begin |
216 begin |
217 {$IFDEF DEBUGFILE}AddFileLog('/+attack: Gear.State = '+inttostr(State));{$ENDIF} |
217 {$IFDEF DEBUGFILE}AddFileLog('/+attack: Gear.State = '+inttostr(State));{$ENDIF} |
218 if ((State and gstHHDriven)<>0)and((State and (gstAttacked or gstHHChooseTarget or gstMoving)) = 0) then |
218 if ((State and gstHHDriven)<>0)and((State and (gstAttacked or gstHHChooseTarget or gstMoving)) = 0) then |
219 begin |
219 begin |
220 FollowGear:= CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear; |
220 FollowGear:= CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear; |
|
221 if (State and (gstAttacked or gstHHChooseTarget) = 0)and(CurAmmoGear = nil) then |
|
222 State:= State or gstAttacking; |
221 if not CurrentTeam.ExtDriven then SendIPC('A'); |
223 if not CurrentTeam.ExtDriven then SendIPC('A'); |
222 Message:= Message or gm_Attack |
224 Message:= Message or gm_Attack |
223 end |
225 end |
224 end |
226 end |
225 end; |
227 end; |
226 |
228 |
227 procedure chAttack_m(var s: shortstring); |
229 procedure chAttack_m(var s: shortstring); |
228 var xx, yy: real; |
|
229 begin |
230 begin |
230 if CheckNoTeamOrHH then exit; |
231 if CheckNoTeamOrHH then exit; |
231 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^, |
232 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^, |
232 CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do |
233 CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do |
233 begin |
234 begin |
234 {$IFDEF DEBUGFILE}AddFileLog('/-attack: Gear.State = '+inttostr(State)+' CurAmmoGear = '+inttostr(longword(CurAmmoGear)));{$ENDIF} |
235 {$IFDEF DEBUGFILE}AddFileLog('/-attack: Gear.State = '+inttostr(State)+' CurAmmoGear = '+inttostr(longword(CurAmmoGear)));{$ENDIF} |
235 if CurAmmoGear <> nil then |
236 Message:= Message and not gm_Attack; |
236 begin |
237 if not CurrentTeam.ExtDriven then SendIPC('a') |
237 Message:= Message and not gm_Attack; |
|
238 if not CurrentTeam.ExtDriven then SendIPC('a') |
|
239 end; |
|
240 if (((State and (gstHHDriven or gstAttacking)) = (gstHHDriven or gstAttacking))and |
|
241 ((State and (gstAttacked or gstMoving or gstHHChooseTarget)) = 0)and |
|
242 (((State and gstFalling ) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInFall) <> 0))and |
|
243 (((State and gstHHJumping) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInJump) <> 0)))and |
|
244 (CurAmmoGear = nil) then |
|
245 begin |
|
246 if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then |
|
247 begin |
|
248 StopTPUSound; |
|
249 PlaySound(sndThrowRelease); |
|
250 end; |
|
251 xx:= Sign(dX)*Sin(Angle*pi/cMaxAngle); |
|
252 yy:= -Cos(Angle*pi/cMaxAngle); |
|
253 case Ammo[CurSlot, CurAmmo].AmmoType of |
|
254 amBazooka: FollowGear:= AddGear(round(X), round(Y), gtAmmo_Grenade, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor); |
|
255 amGrenade: FollowGear:= AddGear(round(X), round(Y), gtAmmo_Bomb, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo[CurSlot, CurAmmo].Timer); |
|
256 amUFO: FollowGear:= AddGear(round(X), round(Y), gtUFO, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor); |
|
257 amShotgun: begin |
|
258 PlaySound(sndShotgunReload); |
|
259 FollowGear:= AddGear(round(X + xx*20), round(Y + yy*20), gtShotgunShot, 0, xx * 0.5, 0.5 * yy); |
|
260 end; |
|
261 amSkip: TurnTimeLeft:= 0; |
|
262 amPickHammer: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y) + cHHHalfHeight, gtPickHammer, 0); |
|
263 amRope: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y), gtRope, 0, xx, yy); |
|
264 amMine: AddGear(round(X) + Sign(dX) * 7, round(Y), gtMine, 0, Sign(dX) * 0.01, 0, 3000); |
|
265 end; |
|
266 Power:= 0; |
|
267 if CurAmmoGear <> nil then |
|
268 begin |
|
269 CurAmmoGear.Message:= Gear.Message; |
|
270 exit |
|
271 end else |
|
272 begin |
|
273 Message:= Message and not gm_Attack; |
|
274 if not CurrentTeam.ExtDriven then SendIPC('a') |
|
275 end; |
|
276 AfterAttack |
|
277 end |
|
278 end |
238 end |
279 end; |
239 end; |
280 |
240 |
281 procedure chSwitch(var s: shortstring); |
241 procedure chSwitch(var s: shortstring); |
282 begin |
242 begin |