hedgewars/GSHandlers.inc
changeset 4279 b697a26ed538
parent 4277 d699d23a6e1d
child 4281 e033cf015b2c
child 4282 46c3c5cf89e4
equal deleted inserted replaced
4277:d699d23a6e1d 4279:b697a26ed538
   703 ////////////////////////////////////////////////////////////////////////////////
   703 ////////////////////////////////////////////////////////////////////////////////
   704 procedure doStepBulletWork(Gear: PGear);
   704 procedure doStepBulletWork(Gear: PGear);
   705 var 
   705 var 
   706     i, x, y: LongWord;
   706     i, x, y: LongWord;
   707     oX, oY: hwFloat;
   707     oX, oY: hwFloat;
       
   708     trail: PVisualGear;
   708 begin
   709 begin
   709     AllInactive := false;
   710     AllInactive := false;
   710     inc(Gear^.Timer);
   711     inc(Gear^.Timer);
   711     i := 80;
   712     i := 80;
   712     oX := Gear^.X;
   713     oX := Gear^.X;
   749     begin
   750     begin
   750         if (Gear^.Kind = gtSniperRifleShot) and ((GameFlags and gfLaserSight) = 0) then
   751         if (Gear^.Kind = gtSniperRifleShot) and ((GameFlags and gfLaserSight) = 0) then
   751             cLaserSighting := false;
   752             cLaserSighting := false;
   752         if (Ammoz[Gear^.AmmoType].Ammo.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and
   753         if (Ammoz[Gear^.AmmoType].Ammo.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and
   753            ((GameFlags and gfArtillery) = 0) then cArtillery := false;
   754            ((GameFlags and gfArtillery) = 0) then cArtillery := false;
       
   755         
       
   756         // Bullet trail
       
   757         trail := AddVisualGear(
       
   758             hwround(CurrentHedgehog^.Gear^.X) + GetLaunchX(CurrentHedgehog^.CurAmmoType, hwSign(CurrentHedgehog^.Gear^.dX), CurrentHedgehog^.Gear^.Angle), 
       
   759             hwround(CurrentHedgehog^.Gear^.Y) + GetLaunchY(CurrentHedgehog^.CurAmmoType, CurrentHedgehog^.Gear^.Angle),
       
   760             vgtLineTrail
       
   761         );
       
   762         if trail <> nil then
       
   763         begin
       
   764             trail^.dX := Gear^.X.QWordValue / _1.QWordValue;
       
   765             trail^.dY := Gear^.Y.QWordValue / _1.QWordValue;
       
   766             
       
   767             // reached edge of land. assume infinite beam. Extend it way out past camera
       
   768             if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) 
       
   769                 or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then
       
   770             begin
       
   771                 trail^.dX := trail^.dX + (CurrentHedgehog^.Gear^.dX * LAND_WIDTH).QWordValue / _1.QWordValue;
       
   772                 trail^.dY := trail^.dY + (CurrentHedgehog^.Gear^.dY * LAND_WIDTH).QWordValue / _1.QWordValue;
       
   773             end;
       
   774             
       
   775             trail^.Timer := 200;
       
   776         end;
       
   777         
   754         Gear^.doStep := @doStepShotIdle
   778         Gear^.doStep := @doStepShotIdle
   755     end;
   779     end;
   756 end;
   780 end;
   757 
   781 
   758 procedure doStepDEagleShot(Gear: PGear);
   782 procedure doStepDEagleShot(Gear: PGear);