hedgewars/uGearsList.pas
changeset 7272 71df899c4163
parent 7176 fb4b0c6dfdbd
child 7276 e570bc0df33c
equal deleted inserted replaced
7270:93e92e82d5c8 7272:71df899c4163
    98 gear^.ImpactSound:= sndNone;
    98 gear^.ImpactSound:= sndNone;
    99 gear^.nImpactSounds:= 0;
    99 gear^.nImpactSounds:= 0;
   100 gear^.Density:= _1;
   100 gear^.Density:= _1;
   101 // Define ammo association, if any.
   101 // Define ammo association, if any.
   102 gear^.AmmoType:= GearKindAmmoTypeMap[Kind];
   102 gear^.AmmoType:= GearKindAmmoTypeMap[Kind];
       
   103 gear^.CollisionMask:= $FFFF;
       
   104 
       
   105 if CurrentHedgehog <> nil then gear^.Hedgehog:= CurrentHedgehog;
       
   106 
   103 if Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then
   107 if Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then
   104     gear^.Z:= cHHZ+1
   108     gear^.Z:= cHHZ+1
   105 else gear^.Z:= cUsualZ;
   109 else gear^.Z:= cUsualZ;
   106 
   110 
   107 if CurrentHedgehog <> nil then
       
   108     begin
       
   109     gear^.Hedgehog:= CurrentHedgehog;
       
   110     gear^.IntersectGear:= CurrentHedgehog^.Gear
       
   111     end;
       
   112     
   111     
   113 case Kind of
   112 case Kind of
   114      gtGrenade,
   113      gtGrenade,
   115      gtClusterBomb,
   114      gtClusterBomb,
   116      gtGasBomb: begin
   115      gtGasBomb: begin
   481 Gear^.Tex:= nil;
   480 Gear^.Tex:= nil;
   482 
   481 
   483 // make sure that portals have their link removed before deletion
   482 // make sure that portals have their link removed before deletion
   484 if (Gear^.Kind = gtPortal) then
   483 if (Gear^.Kind = gtPortal) then
   485     begin
   484     begin
   486     if (Gear^.IntersectGear <> nil) then
   485     if (Gear^.LinkedGear <> nil) then
   487         if (Gear^.IntersectGear^.IntersectGear = Gear) then
   486         if (Gear^.LinkedGear^.LinkedGear = Gear) then
   488             Gear^.IntersectGear^.IntersectGear:= nil;
   487             Gear^.LinkedGear^.LinkedGear:= nil;
   489     end
   488     end
   490 else if Gear^.Kind = gtHedgehog then
   489 else if Gear^.Kind = gtHedgehog then
   491     (*
   490     (*
   492     This behaviour dates back to revision 4, and I accidentally encountered it with TARDIS.  I don't think it must apply to any modern weapon, since if it was actually hit, the best the gear could do would be to destroy itself immediately, and you'd still end up with two graves.  I believe it should be removed
   491     This behaviour dates back to revision 4, and I accidentally encountered it with TARDIS.  I don't think it must apply to any modern weapon, since if it was actually hit, the best the gear could do would be to destroy itself immediately, and you'd still end up with two graves.  I believe it should be removed
   493      if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then
   492      if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then