hedgewars/uGears.pas
changeset 3459 c552aa44108d
parent 3453 d65657c94bb9
child 3460 d957d5f7b58d
equal deleted inserted replaced
3458:11cd56019f00 3459:c552aa44108d
   192     while (tmp <> nil) and (tmp^.Z <= Gear^.Z) do
   192     while (tmp <> nil) and (tmp^.Z <= Gear^.Z) do
   193         begin
   193         begin
   194         ptmp:= tmp;
   194         ptmp:= tmp;
   195         tmp:= tmp^.NextGear
   195         tmp:= tmp^.NextGear
   196         end;
   196         end;
   197 
   197     
   198     if ptmp <> tmp then
   198     if ptmp <> tmp then
   199         begin
   199         begin
   200         Gear^.NextGear:= ptmp^.NextGear;
   200         Gear^.NextGear:= ptmp^.NextGear;
   201         Gear^.PrevGear:= ptmp;
   201         Gear^.PrevGear:= ptmp;
   202         if ptmp^.NextGear <> nil then ptmp^.NextGear^.PrevGear:= Gear;
   202         if ptmp^.NextGear <> nil then ptmp^.NextGear^.PrevGear:= Gear;
   220 end;
   220 end;
   221 
   221 
   222 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
   222 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
   223 var tag: PVisualGear;
   223 var tag: PVisualGear;
   224 begin
   224 begin
   225 tag:= AddVisualGear(hwRound(HHGear^.X), hwRound(HHGear^.Y), vgtHealthTag, dmg);if (tag <> nil) then
   225 tag:= AddVisualGear(hwRound(HHGear^.X), hwRound(HHGear^.Y), vgtHealthTag, dmg);
   226     begin
   226 if (tag <> nil) then
   227     tag^.Hedgehog:= PHedgehog(HHGear^.Hedgehog); // the tag needs the tag to determine the text color
   227     tag^.Hedgehog:= PHedgehog(HHGear^.Hedgehog); // the tag needs the tag to determine the text color
   228     tag^.doStep(tag,1); // do this now because the Gear could already be deleted on next step call
       
   229     tag^.Hedgehog:= nil
       
   230     end;
       
   231 AllInactive:= false;
   228 AllInactive:= false;
   232 HHGear^.Active:= true;
   229 HHGear^.Active:= true;
   233 end;
   230 end;
   234 
   231 
   235 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
   232 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;