hedgewars/uGearsHandlersMess.pas
changeset 15033 20c80919d97d
parent 14998 fd29c23ff95e
child 15043 01bb1d7ca14f
equal deleted inserted replaced
15028:9a8c678df7d9 15033:20c80919d97d
  2399     Gear^.Damage := 0;
  2399     Gear^.Damage := 0;
  2400     if Gear^.Health <= 0 then
  2400     if Gear^.Health <= 0 then
  2401         doStepCase(Gear)
  2401         doStepCase(Gear)
  2402     else
  2402     else
  2403         // health texture (FlightTime = health when the last texture was generated)
  2403         // health texture (FlightTime = health when the last texture was generated)
  2404         if Gear^.Health <> Gear^.FlightTime then
  2404         if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then
  2405             begin
  2405             begin
  2406             Gear^.FlightTime:= Gear^.Health;
  2406             Gear^.FlightTime:= Gear^.Health;
  2407             FreeAndNilTexture(Gear^.Tex);
  2407             FreeAndNilTexture(Gear^.Tex);
  2408             Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16);
  2408             Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16);
  2409             end;
  2409             end;
  2477                 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite);
  2477                 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite);
  2478 
  2478 
  2479         dec(Gear^.Health, Gear^.Damage);
  2479         dec(Gear^.Health, Gear^.Damage);
  2480         Gear^.Damage := 0;
  2480         Gear^.Damage := 0;
  2481         // health texture (FlightTime = health when the last texture was generated)
  2481         // health texture (FlightTime = health when the last texture was generated)
  2482         if Gear^.Health <> Gear^.FlightTime then
  2482         if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then
  2483             begin
  2483             begin
  2484             Gear^.FlightTime:= Gear^.Health;
  2484             Gear^.FlightTime:= Gear^.Health;
  2485             FreeAndNilTexture(Gear^.Tex);
  2485             FreeAndNilTexture(Gear^.Tex);
  2486             Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16);
  2486             Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16);
  2487             end;
  2487             end;
  2505                 // Always show health (default)
  2505                 // Always show health (default)
  2506                 else
  2506                 else
  2507                     i:= 1;
  2507                     i:= 1;
  2508                 if i = 1 then
  2508                 if i = 1 then
  2509                     begin
  2509                     begin
  2510                     if Gear^.Health <> Gear^.FlightTime then
  2510                     if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then
  2511                         begin
  2511                         begin
  2512                         Gear^.FlightTime:= Gear^.Health;
  2512                         Gear^.FlightTime:= Gear^.Health;
  2513                         FreeAndNilTexture(Gear^.Tex);
  2513                         FreeAndNilTexture(Gear^.Tex);
  2514                         Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16)
  2514                         Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16)
  2515                         end
  2515                         end
  2516                     end
  2516                     end
  2517                 else
  2517                 else
  2518                     begin
  2518                     begin
  2519                     if Gear^.FlightTime <> $ffffffff then
  2519                     if (Gear^.FlightTime <> $ffffffff) or (Gear^.Tex = nil) then
  2520                         begin
  2520                         begin
  2521                         Gear^.FlightTime:= $ffffffff;
  2521                         Gear^.FlightTime:= $ffffffff;
  2522                         FreeAndNilTexture(Gear^.Tex);
  2522                         FreeAndNilTexture(Gear^.Tex);
  2523                         Gear^.Tex := RenderStringTex(trmsg[sidUnknownGearValue], $ff80ff80, fnt16)
  2523                         Gear^.Tex := RenderStringTex(trmsg[sidUnknownGearValue], $ff80ff80, fnt16)
  2524                         end
  2524                         end