hedgewars/uGears.pas
changeset 762 5ecf042f6113
parent 755 edf26e9554ac
child 764 7513452b1d51
equal deleted inserted replaced
761:63ae90011a52 762:5ecf042f6113
    44              Message : Longword;
    44              Message : Longword;
    45              Hedgehog: pointer;
    45              Hedgehog: pointer;
    46              Health, Damage: LongInt;
    46              Health, Damage: LongInt;
    47              CollisionIndex: LongInt;
    47              CollisionIndex: LongInt;
    48              Tag: LongInt;
    48              Tag: LongInt;
    49              Surf: PSDL_Surface;
    49              Tex: PTexture;
    50              Z: Longword;
    50              Z: Longword;
    51              IntersectGear: PGear;
    51              IntersectGear: PGear;
    52              TriggerId: Longword;
    52              TriggerId: Longword;
    53              end;
    53              end;
    54 
    54 
   305 procedure DeleteGear(Gear: PGear);
   305 procedure DeleteGear(Gear: PGear);
   306 var team: PTeam;
   306 var team: PTeam;
   307     t: Longword;
   307     t: Longword;
   308 begin
   308 begin
   309 DeleteCI(Gear);
   309 DeleteCI(Gear);
   310 if Gear^.Surf <> nil then
   310 
       
   311 if Gear^.Tex <> nil then
   311    begin
   312    begin
   312    SDL_FreeSurface(Gear^.Surf);
   313    FreeTexture(Gear^.Tex);
   313    Gear^.Surf:= nil
   314    Gear^.Tex:= nil
   314    end;
   315    end;
       
   316 
   315 if Gear^.Kind = gtHedgehog then
   317 if Gear^.Kind = gtHedgehog then
   316    if CurAmmoGear <> nil then
   318    if CurAmmoGear <> nil then
   317       begin
   319       begin
   318       Gear^.Message:= gm_Destroy;
   320       Gear^.Message:= gm_Destroy;
   319       CurAmmoGear^.Message:= gm_Destroy;
   321       CurAmmoGear^.Message:= gm_Destroy;
   467      if (Gear^.State{ and not gstAnimation}) = 0 then
   469      if (Gear^.State{ and not gstAnimation}) = 0 then
   468         begin
   470         begin
   469         t:= hwRound(Gear^.Y) - cHHRadius - 10 + WorldDy;
   471         t:= hwRound(Gear^.Y) - cHHRadius - 10 + WorldDy;
   470         if (cTagsMask and 1) <> 0 then
   472         if (cTagsMask and 1) <> 0 then
   471            begin
   473            begin
   472            dec(t, HealthTag^.h + 2);
   474            dec(t, HealthTagTex^.h + 2);
   473            DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTag, Surface)
   475            DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTagTex)
   474            end;
   476            end;
   475         if (cTagsMask and 2) <> 0 then
   477         if (cTagsMask and 2) <> 0 then
   476            begin
   478            begin
   477            dec(t, NameTag^.h + 2);
   479            dec(t, NameTagTex^.h + 2);
   478            DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTag, Surface)
   480            DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTagTex)
   479            end;
   481            end;
   480         if (cTagsMask and 4) <> 0 then
   482         if (cTagsMask and 4) <> 0 then
   481            begin
   483            begin
   482            dec(t, Team^.NameTag^.h + 2);
   484            dec(t, Team^.NameTagTex^.h + 2);
   483            DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTag, Surface)
   485            DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTagTex)
   484            end
   486            end
   485         end else // Current hedgehog
   487         end else // Current hedgehog
   486       if (Gear^.State and gstHHDriven) <> 0 then
   488       if (Gear^.State and gstHHDriven) <> 0 then
   487         begin
   489         begin
   488         if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then
   490         if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then
   575            gtCloud: DrawSprite(sprCloud   , hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State, Surface);
   577            gtCloud: DrawSprite(sprCloud   , hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State, Surface);
   576        gtAmmo_Bomb: DrawSprite(sprBomb , hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, hwRound(Gear^.DirAngle), Surface);
   578        gtAmmo_Bomb: DrawSprite(sprBomb , hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, hwRound(Gear^.DirAngle), Surface);
   577         gtHedgehog: DrawHH(Gear, Surface);
   579         gtHedgehog: DrawHH(Gear, Surface);
   578     gtAmmo_Grenade: DrawSprite(sprGrenade , hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, DxDy2Angle32(Gear^.dY, Gear^.dX), Surface);
   580     gtAmmo_Grenade: DrawSprite(sprGrenade , hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, DxDy2Angle32(Gear^.dY, Gear^.dX), Surface);
   579        gtHealthTag,
   581        gtHealthTag,
   580      gtSmallDamage: if Gear^.Surf <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Surf, Surface);
   582      gtSmallDamage: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   581            gtGrave: ;//DrawSurfSprite(hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, PHedgehog(Gear^.Hedgehog)^.Team^.GraveSurf, Surface);
   583            gtGrave: ;//DrawSurfSprite(hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, PHedgehog(Gear^.Hedgehog)^.Team^.GraveSurf, Surface);
   582              gtUFO: DrawSprite(sprUFO, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4, Surface);
   584              gtUFO: DrawSprite(sprUFO, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4, Surface);
   583             gtRope: begin
   585             gtRope: begin
   584                     roplen:= 0;
   586                     roplen:= 0;
   585                     if RopePoints.Count > 0 then
   587                     if RopePoints.Count > 0 then