hedgewars/GSHandlers.inc
changeset 7272 71df899c4163
parent 7270 93e92e82d5c8
child 7276 e570bc0df33c
equal deleted inserted replaced
7270:93e92e82d5c8 7272:71df899c4163
  3163 begin
  3163 begin
  3164     AllInactive := false;
  3164     AllInactive := false;
  3165 
  3165 
  3166     HHGear := Gear^.Hedgehog^.Gear;
  3166     HHGear := Gear^.Hedgehog^.Gear;
  3167     HHGear^.Message := HHGear^.Message and (not gmAttack);
  3167     HHGear^.Message := HHGear^.Message and (not gmAttack);
  3168     DeleteCI(HHGear);
  3168     Gear^.CollisionMask:= $FF7F;
  3169     Gear^.IntersectGear:= nil;
       
  3170 
  3169 
  3171     FollowGear := Gear;
  3170     FollowGear := Gear;
  3172 
  3171 
  3173     Gear^.doStep := @doStepCakeFall
  3172     Gear^.doStep := @doStepCakeFall
  3174 end;
  3173 end;
  4024 
  4023 
  4025     if Gear^.Timer < 10000 then
  4024     if Gear^.Timer < 10000 then
  4026         gear^.RenderTimer := true;
  4025         gear^.RenderTimer := true;
  4027 
  4026 
  4028     // abort if there is no other portal connected to this one
  4027     // abort if there is no other portal connected to this one
  4029     if (Gear^.IntersectGear = nil) then
  4028     if (Gear^.LinkedGear = nil) then
  4030         exit;
  4029         exit;
  4031     if ((Gear^.IntersectGear^.Tag and 1) = 0) then // or if it's still moving;
  4030     if ((Gear^.LinkedGear^.Tag and 1) = 0) then // or if it's still moving;
  4032         exit;
  4031         exit;
  4033 
  4032 
  4034     conPortal := Gear^.IntersectGear;
  4033     conPortal := Gear^.LinkedGear;
  4035 
  4034 
  4036     // check all gears for stuff to port through
  4035     // check all gears for stuff to port through
  4037     iterator := nil;
  4036     iterator := nil;
  4038     while true do
  4037     while true do
  4039     begin
  4038     begin
  4412 
  4411 
  4413         Gear^.DirAngle := DxDy2Angle(-Gear^.dY,Gear^.dX);
  4412         Gear^.DirAngle := DxDy2Angle(-Gear^.dY,Gear^.dX);
  4414         if not Gear^.dX.isNegative then
  4413         if not Gear^.dX.isNegative then
  4415             Gear^.DirAngle := 180-Gear^.DirAngle;
  4414             Gear^.DirAngle := 180-Gear^.DirAngle;
  4416 
  4415 
  4417         if ((Gear^.IntersectGear = nil)
  4416         if ((Gear^.LinkedGear = nil)
  4418         or (hwRound(Distance(Gear^.X - Gear^.IntersectGear^.X,Gear^.Y-Gear^.IntersectGear^.Y)) >=Gear^.Radius*2)) then
  4417         or (hwRound(Distance(Gear^.X - Gear^.LinkedGear^.X,Gear^.Y-Gear^.LinkedGear^.Y)) >=Gear^.Radius*2)) then
  4419             begin
  4418             begin
  4420             loadNewPortalBall(Gear, false);
  4419             loadNewPortalBall(Gear, false);
  4421             inc(Gear^.Tag);
  4420             inc(Gear^.Tag);
  4422             Gear^.doStep := @doStepPortal;
  4421             Gear^.doStep := @doStepPortal;
  4423         end
  4422         end
  4455     // to the scaler)
  4454     // to the scaler)
  4456     s := (_2 * s + (newPortal^.dX * CurrentHedgehog^.Gear^.dX + newPortal^.dY * CurrentHedgehog^.Gear^.dY ) / s) / s;
  4455     s := (_2 * s + (newPortal^.dX * CurrentHedgehog^.Gear^.dX + newPortal^.dY * CurrentHedgehog^.Gear^.dY ) / s) / s;
  4457     newPortal^.dX := newPortal^.dX * s;
  4456     newPortal^.dX := newPortal^.dX * s;
  4458     newPortal^.dY := newPortal^.dY * s;
  4457     newPortal^.dY := newPortal^.dY * s;
  4459 
  4458 
  4460     newPortal^.IntersectGear := nil;
  4459     newPortal^.LinkedGear := nil;
  4461 
  4460 
  4462     if CurrentHedgehog <> nil then
  4461     if CurrentHedgehog <> nil then
  4463         with CurrentHedgehog^ do
  4462         with CurrentHedgehog^ do
  4464             begin
  4463             begin
  4465             CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^);
  4464             CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^);
  4484                             iterator^.Timer:= 0;
  4483                             iterator^.Timer:= 0;
  4485                             end
  4484                             end
  4486                         else
  4485                         else
  4487                             begin
  4486                             begin
  4488                             // link portals with each other
  4487                             // link portals with each other
  4489                             newPortal^.IntersectGear := iterator;
  4488                             newPortal^.LinkedGear := iterator;
  4490                             iterator^.IntersectGear := newPortal;
  4489                             iterator^.LinkedGear := newPortal;
  4491                             iterator^.Health := newPortal^.Health;
  4490                             iterator^.Health := newPortal^.Health;
  4492                             end;
  4491                             end;
  4493                         end;
  4492                         end;
  4494                 iterator^.PortalCounter:= 0;
  4493                 iterator^.PortalCounter:= 0;
  4495                 iterator := iterator^.NextGear
  4494                 iterator := iterator^.NextGear
  4938             //tmp^.State:= tmp^.State or gstFlatened;
  4937             //tmp^.State:= tmp^.State or gstFlatened;
  4939             if not tmp^.Invulnerable then
  4938             if not tmp^.Invulnerable then
  4940                 ApplyDamage(tmp, CurrentHedgehog, tmp^.Health div 3, dsUnknown);
  4939                 ApplyDamage(tmp, CurrentHedgehog, tmp^.Health div 3, dsUnknown);
  4941             //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
  4940             //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
  4942             tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
  4941             tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
  4943             tmp2^.IntersectGear:= tmp;
  4942             tmp2^.LinkedGear:= tmp;
  4944             SetAllToActive
  4943             SetAllToActive
  4945             end
  4944             end
  4946         else
  4945         else
  4947             begin
  4946             begin
  4948             end
  4947             end
  4957 var 
  4956 var 
  4958     i, j, ei: LongInt;
  4957     i, j, ei: LongInt;
  4959     HitGear: PGear;
  4958     HitGear: PGear;
  4960 begin
  4959 begin
  4961     AllInactive := false;
  4960     AllInactive := false;
  4962     HitGear := Gear^.IntersectGear;
  4961     HitGear := Gear^.LinkedGear;
  4963     dec(Gear^.Timer);
  4962     dec(Gear^.Timer);
  4964     if (HitGear = nil) or (Gear^.Timer = 0) or ((Gear^.Message and gmDestroy) <> 0) then
  4963     if (HitGear = nil) or (Gear^.Timer = 0) or ((Gear^.Message and gmDestroy) <> 0) then
  4965         begin
  4964         begin
  4966         DeleteGear(Gear);
  4965         DeleteGear(Gear);
  4967         exit
  4966         exit