hedgewars/uGearsHandlersMess.pas
changeset 15381 c117e17b90bc
parent 15354 c4d68ab7aecb
child 15492 e1467bced64d
child 15937 1becf4a0e907
equal deleted inserted replaced
15380:b5e0a39856fd 15381:c117e17b90bc
  2420     Gear^.Damage := 0;
  2420     Gear^.Damage := 0;
  2421     if Gear^.Health <= 0 then
  2421     if Gear^.Health <= 0 then
  2422         doStepCase(Gear)
  2422         doStepCase(Gear)
  2423     else
  2423     else
  2424         // health texture (FlightTime = health when the last texture was generated)
  2424         // health texture (FlightTime = health when the last texture was generated)
  2425         if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then
  2425         if (not cOnlyStats) and ((Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil)) then
  2426             begin
  2426             begin
  2427             Gear^.FlightTime:= Gear^.Health;
  2427             Gear^.FlightTime:= Gear^.Health;
  2428             FreeAndNilTexture(Gear^.Tex);
  2428             FreeAndNilTexture(Gear^.Tex);
  2429             Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16);
  2429             Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16);
  2430             end;
  2430             end;
  2498                 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite);
  2498                 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite);
  2499 
  2499 
  2500         dec(Gear^.Health, Gear^.Damage);
  2500         dec(Gear^.Health, Gear^.Damage);
  2501         Gear^.Damage := 0;
  2501         Gear^.Damage := 0;
  2502         // health texture (FlightTime = health when the last texture was generated)
  2502         // health texture (FlightTime = health when the last texture was generated)
  2503         if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then
  2503         if (not cOnlyStats) and ((Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil)) then
  2504             begin
  2504             begin
  2505             Gear^.FlightTime:= Gear^.Health;
  2505             Gear^.FlightTime:= Gear^.Health;
  2506             FreeAndNilTexture(Gear^.Tex);
  2506             FreeAndNilTexture(Gear^.Tex);
  2507             Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16);
  2507             Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16);
  2508             end;
  2508             end;
  2521                 else if (Gear^.Karma = 1) then
  2521                 else if (Gear^.Karma = 1) then
  2522                     if (GameType in [gmtDemo, gmtRecord]) then
  2522                     if (GameType in [gmtDemo, gmtRecord]) then
  2523                         i:= 1
  2523                         i:= 1
  2524                     else
  2524                     else
  2525                         i:= 0
  2525                         i:= 0
       
  2526 				else if cOnlyStats then
       
  2527 					i:= 0
  2526                 // Always show health (default)
  2528                 // Always show health (default)
  2527                 else
  2529                 else
  2528                     i:= 1;
  2530                     i:= 1;
  2529                 if i = 1 then
  2531                 if i = 1 then
  2530                     begin
  2532                     begin
  2531                     if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then
  2533                     if (not cOnlyStats) and ((Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil)) then
  2532                         begin
  2534                         begin
  2533                         Gear^.FlightTime:= Gear^.Health;
  2535                         Gear^.FlightTime:= Gear^.Health;
  2534                         FreeAndNilTexture(Gear^.Tex);
  2536                         FreeAndNilTexture(Gear^.Tex);
  2535                         Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16)
  2537                         Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16)
  2536                         end
  2538                         end
  2537                     end
  2539                     end
  2538                 else
  2540                 else
  2539                     begin
  2541                     begin
  2540                     if (Gear^.FlightTime <> $ffffffff) or (Gear^.Tex = nil) then
  2542                     if (not cOnlyStats) and ((Gear^.FlightTime <> $ffffffff) or (Gear^.Tex = nil)) then
  2541                         begin
  2543                         begin
  2542                         Gear^.FlightTime:= $ffffffff;
  2544                         Gear^.FlightTime:= $ffffffff;
  2543                         FreeAndNilTexture(Gear^.Tex);
  2545                         FreeAndNilTexture(Gear^.Tex);
  2544                         Gear^.Tex := RenderStringTex(trmsg[sidUnknownGearValue], $ff80ff80, fnt16)
  2546                         Gear^.Tex := RenderStringTex(trmsg[sidUnknownGearValue], $ff80ff80, fnt16)
  2545                         end
  2547                         end
  4613     if (Gear^.Health < 0) and (Gear^.Health <> JETPACK_FUEL_INFINITE) then
  4615     if (Gear^.Health < 0) and (Gear^.Health <> JETPACK_FUEL_INFINITE) then
  4614         Gear^.Health := 0;
  4616         Gear^.Health := 0;
  4615 
  4617 
  4616     i:= Gear^.Health div 20;
  4618     i:= Gear^.Health div 20;
  4617 
  4619 
  4618     if (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then
  4620     if (not cOnlyStats) and (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then
  4619         begin
  4621         begin
  4620         Gear^.Damage:= i;
  4622         Gear^.Damage:= i;
  4621         FreeAndNilTexture(Gear^.Tex);
  4623         FreeAndNilTexture(Gear^.Tex);
  4622         if Gear^.Health <> JETPACK_FUEL_INFINITE then
  4624         if Gear^.Health <> JETPACK_FUEL_INFINITE then
  4623             Gear^.Tex := RenderStringTex(FormatA(trmsg[sidFuel], ansistring(inttostr(i))), cWhiteColor, fntSmall)
  4625             Gear^.Tex := RenderStringTex(FormatA(trmsg[sidFuel], ansistring(inttostr(i))), cWhiteColor, fntSmall)
  5885         AfterAttack
  5887         AfterAttack
  5886         end
  5888         end
  5887     else
  5889     else
  5888         begin
  5890         begin
  5889         i:= Gear^.Health div 5;
  5891         i:= Gear^.Health div 5;
  5890         if (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then
  5892         if (not cOnlyStats) and (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then
  5891             begin
  5893             begin
  5892             Gear^.Damage:= i;
  5894             Gear^.Damage:= i;
  5893             FreeAndNilTexture(Gear^.Tex);
  5895             FreeAndNilTexture(Gear^.Tex);
  5894             Gear^.Tex := RenderStringTex(FormatA(trmsg[sidFuel], ansistring(inttostr(i))),
  5896             Gear^.Tex := RenderStringTex(FormatA(trmsg[sidFuel], ansistring(inttostr(i))),
  5895                          cWhiteColor, fntSmall)
  5897                          cWhiteColor, fntSmall)
  5976         AfterAttack
  5978         AfterAttack
  5977         end
  5979         end
  5978     else
  5980     else
  5979         begin
  5981         begin
  5980         i:= Gear^.Health div 10;
  5982         i:= Gear^.Health div 10;
  5981         if (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then
  5983         if (not cOnlyStats) and (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then
  5982             begin
  5984             begin
  5983             Gear^.Damage:= i;
  5985             Gear^.Damage:= i;
  5984             FreeAndNilTexture(Gear^.Tex);
  5986             FreeAndNilTexture(Gear^.Tex);
  5985             Gear^.Tex := RenderStringTex(FormatA(trmsg[sidFuel], ansistring(inttostr(i))),
  5987             Gear^.Tex := RenderStringTex(FormatA(trmsg[sidFuel], ansistring(inttostr(i))),
  5986                          cWhiteColor, fntSmall)
  5988                          cWhiteColor, fntSmall)
  6495 procedure updateFuel(Gear: PGear);
  6497 procedure updateFuel(Gear: PGear);
  6496 var
  6498 var
  6497   t:LongInt;
  6499   t:LongInt;
  6498 begin
  6500 begin
  6499     t:= Gear^.Health div 10;
  6501     t:= Gear^.Health div 10;
  6500     if (t <> Gear^.Damage) and ((GameTicks and $3F) = 0) then
  6502     if (not cOnlyStats) and (t <> Gear^.Damage) and ((GameTicks and $3F) = 0) then
  6501     begin
  6503     begin
  6502     Gear^.Damage:= t;
  6504     Gear^.Damage:= t;
  6503     FreeAndNilTexture(Gear^.Tex);
  6505     FreeAndNilTexture(Gear^.Tex);
  6504     Gear^.Tex := RenderStringTex(FormatA(trmsg[sidFuel], ansistring(inttostr(t))),
  6506     Gear^.Tex := RenderStringTex(FormatA(trmsg[sidFuel], ansistring(inttostr(t))),
  6505               cWhiteColor, fntSmall)
  6507               cWhiteColor, fntSmall)