hedgewars/GSHandlers.inc
changeset 6453 11c578d30bd3
parent 6452 7c6f9b6672dc
child 6468 da1e7fe7cff7
equal deleted inserted replaced
6452:7c6f9b6672dc 6453:11c578d30bd3
  4043         begin
  4043         begin
  4044             if not (((iterator^.X - Gear^.X)*ox + (iterator^.Y - Gear^.Y)*oy).isNegative) then
  4044             if not (((iterator^.X - Gear^.X)*ox + (iterator^.Y - Gear^.Y)*oy).isNegative) then
  4045                 continue;
  4045                 continue;
  4046         end
  4046         end
  4047         else
  4047         else
  4048             if not (Gear^.dX*ox + Gear^.dY*oy).isNegative then
  4048             if not ((Gear^.dX*ox + Gear^.dY*oy).isNegative) then
  4049                 continue;
  4049                 continue;
  4050 
  4050 
  4051         isbullet:= (iterator^.Kind in [gtShotgunShot, gtDEagleShot, gtSniperRifleShot, gtSineGunShot]);
  4051         isbullet:= (iterator^.Kind in [gtShotgunShot, gtDEagleShot, gtSniperRifleShot, gtSineGunShot]);
  4052 
  4052 
  4053         r:= int2hwFloat(iterator^.Radius);
  4053         r:= int2hwFloat(iterator^.Radius);
  4103         // create a normal of the portal vector, but ...
  4103         // create a normal of the portal vector, but ...
  4104         nx := Gear^.dY;
  4104         nx := Gear^.dY;
  4105         ny := Gear^.dX;
  4105         ny := Gear^.dX;
  4106         // ... decide where the top is based on the hog's direction when firing the portal
  4106         // ... decide where the top is based on the hog's direction when firing the portal
  4107         if Gear^.Elasticity.isNegative then
  4107         if Gear^.Elasticity.isNegative then
  4108             nx.isNegative := not nx.isNegative
  4108             nx.isNegative := (not nx.isNegative)
  4109         else
  4109         else
  4110             ny.isNegative := not ny.isNegative;
  4110             ny.isNegative := not ny.isNegative;
  4111 
  4111 
  4112         // calc gear offset in portal normal vector direction
  4112         // calc gear offset in portal normal vector direction
  4113         noffs:= (nx * ox + ny * oy);
  4113         noffs:= (nx * ox + ny * oy);
  4135 
  4135 
  4136         // creating normal vector of connected (exit) portal
  4136         // creating normal vector of connected (exit) portal
  4137         nx := conPortal^.dY;
  4137         nx := conPortal^.dY;
  4138         ny := conPortal^.dX;
  4138         ny := conPortal^.dX;
  4139         if conPortal^.Elasticity.isNegative then
  4139         if conPortal^.Elasticity.isNegative then
  4140             nx.isNegative := not nx.isNegative
  4140             nx.isNegative := (not nx.isNegative)
  4141         else
  4141         else
  4142             ny.isNegative := not ny.isNegative;
  4142             ny.isNegative := not ny.isNegative;
  4143 
  4143 
  4144         // inverse cake's normal movement direction,
  4144         // inverse cake's normal movement direction,
  4145         // as if it just walked through a hole
  4145         // as if it just walked through a hole
  4362     newPortal^.dY := newPortal^.dY * s;
  4362     newPortal^.dY := newPortal^.dY * s;
  4363 
  4363 
  4364     newPortal^.IntersectGear := nil;
  4364     newPortal^.IntersectGear := nil;
  4365 
  4365 
  4366     if CurrentHedgehog <> nil then
  4366     if CurrentHedgehog <> nil then
  4367         With CurrentHedgehog^ do
  4367         with CurrentHedgehog^ do
  4368         begin
  4368         begin
  4369             CurWeapon:= GetAmmoEntry(CurrentHedgehog^);
  4369             CurWeapon:= GetAmmoEntry(CurrentHedgehog^);
  4370             // let's save the HH's dX's direction so we can decide where the "top" of the portal hole
  4370             // let's save the HH's dX's direction so we can decide where the "top" of the portal hole
  4371             newPortal^.Elasticity.isNegative := CurrentHedgehog^.Gear^.dX.isNegative;
  4371             newPortal^.Elasticity.isNegative := CurrentHedgehog^.Gear^.dX.isNegative;
  4372             // when doing a backjump the dx is the opposite of the facing direction
  4372             // when doing a backjump the dx is the opposite of the facing direction