hedgewars/GSHandlers.inc
changeset 2023 41d3afaa20c7
parent 2017 7845c77c8d31
child 2024 2985f3bd18b7
equal deleted inserted replaced
2022:9bbf8af42ace 2023:41d3afaa20c7
   449 if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then
   449 if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then
   450 	Gear^.doStep:= @doStepShotIdle
   450 	Gear^.doStep:= @doStepShotIdle
   451 end;
   451 end;
   452 
   452 
   453 ////////////////////////////////////////////////////////////////////////////////
   453 ////////////////////////////////////////////////////////////////////////////////
   454 procedure doStepDEagleShotWork(Gear: PGear);
   454 procedure doStepBulletWork(Gear: PGear);
   455 var i, x, y: LongWord;
   455 var i, x, y: LongWord;
   456     oX, oY: hwFloat;
   456     oX, oY: hwFloat;
   457 begin
   457 begin
   458 AllInactive:= false;
   458 AllInactive:= false;
   459 inc(Gear^.Timer);
   459 inc(Gear^.Timer);
   465   Gear^.Y:= Gear^.Y + Gear^.dY;
   465   Gear^.Y:= Gear^.Y + Gear^.dY;
   466   x:= hwRound(Gear^.X);
   466   x:= hwRound(Gear^.X);
   467   y:= hwRound(Gear^.Y);
   467   y:= hwRound(Gear^.Y);
   468   if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0)
   468   if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0)
   469      and (Land[y, x] <> 0) then inc(Gear^.Damage);
   469      and (Land[y, x] <> 0) then inc(Gear^.Damage);
   470   if Gear^.Damage > 5 then AmmoShove(Gear, 7, 20);
   470   if Gear^.Damage > 5 then
       
   471       if Gear^.Ammo^.AmmoType = amDEagle then
       
   472           AmmoShove(Gear, 7, 20)
       
   473       else
       
   474           AmmoShove(Gear, Gear^.Timer*2, 20);
   471   dec(i)
   475   dec(i)
   472 until (i = 0) or (Gear^.Damage > Gear^.Health);
   476 until (i = 0) or (Gear^.Damage > Gear^.Health);
   473 if Gear^.Damage > 0 then
   477 if Gear^.Damage > 0 then
   474    begin
   478    begin
   475    DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82 - i, 1);
   479    DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82 - i, 1);
   484 end;
   488 end;
   485 
   489 
   486 procedure doStepDEagleShot(Gear: PGear);
   490 procedure doStepDEagleShot(Gear: PGear);
   487 begin
   491 begin
   488 PlaySound(sndGun, false, nil);
   492 PlaySound(sndGun, false, nil);
   489 Gear^.doStep:= @doStepDEagleShotWork
   493 Gear^.doStep:= @doStepBulletWork
       
   494 end;
       
   495 
       
   496 procedure doStepSniperRifleShot(Gear: PGear);
       
   497 begin
       
   498 if not cLaserSighting then // game doesn't have default laser sight. turn it on and give them a chance to aim
       
   499     begin
       
   500     cLaserSighting:= true;
       
   501     cArtillery:= true;
       
   502 	DeleteGear(Gear);
       
   503 	AfterAttack;
       
   504     dec(CurrentHedgehog^.AttacksNum);
       
   505     exit 
       
   506     end;
       
   507 
       
   508 if (PHedgehog(Gear^.Hedgehog)^.Gear^.Message and gm_Attack) <> 0 then
       
   509     begin
       
   510 	Gear^.State:= Gear^.State or gstAnimation;
       
   511     PlaySound(sndGun, false, nil);
       
   512     Gear^.doStep:= @doStepBulletWork
       
   513     end
   490 end;
   514 end;
   491 
   515 
   492 ////////////////////////////////////////////////////////////////////////////////
   516 ////////////////////////////////////////////////////////////////////////////////
   493 procedure doStepActionTimer(Gear: PGear);
   517 procedure doStepActionTimer(Gear: PGear);
   494 begin
   518 begin