Show more health-related icons in top right corner
authorWuzzy <Wuzzy2@mail.ru>
Thu, 16 May 2019 06:41:56 +0200
changeset 14972 9939134b566d
parent 14971 5a9d203f7c82
child 14973 b4f83570c514
Show more health-related icons in top right corner
hedgewars/uTypes.pas
hedgewars/uVariables.pas
hedgewars/uWorld.pas
share/hedgewars/Data/Graphics/HaloHUD.png
share/hedgewars/Data/Graphics/InvulnHUD.png
share/hedgewars/Data/Graphics/KarmaHUD.png
share/hedgewars/Data/Graphics/MedicHUD.png
share/hedgewars/Data/Graphics/MedicPoisonHUD.png
--- a/hedgewars/uTypes.pas	Thu May 16 04:02:09 2019 +0200
+++ b/hedgewars/uTypes.pas	Thu May 16 06:41:56 2019 +0200
@@ -93,7 +93,8 @@
             sprCustom5, sprCustom6, sprCustom7, sprCustom8, sprFrozenAirMine, sprAirMine, sprHandAirMine,
             sprFlakeL, sprSDFlakeL, sprCloudL, sprSDCloudL, sprCreeper, sprHandCreeper, sprMinigun,
             sprSliderInverted, sprFingerBack, sprFingerBackInv, sprTargetPBack, sprTargetPBackInv,
-            sprHealthHud, sprHealthPoisonHud, sprVampHud
+            sprHealthHud, sprHealthPoisonHud, sprVampHud, sprKarmaHud, sprMedicHud, sprMedicPoisonHud,
+            sprHaloHud, sprInvulnHUD
             );
 
     // Gears that interact with other Gears and/or Land
--- a/hedgewars/uVariables.pas	Thu May 16 04:02:09 2019 +0200
+++ b/hedgewars/uVariables.pas	Thu May 16 06:41:56 2019 +0200
@@ -829,7 +829,17 @@
             (FileName:    'HealthPoisonHUD'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
             Width:  18; Height: 18; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHealthPoisonHud
             (FileName:    'VampHUD'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  24; Height: 18; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true)// sprVampHUD
+            Width:  24; Height: 18; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprVampHUD
+            (FileName:    'KarmaHUD'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width:  18; Height: 18; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprKarmaHUD
+            (FileName:    'MedicHUD'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width:  18; Height: 18; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMedicHud
+            (FileName:    'MedicPoisonHUD'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width:  18; Height: 18; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMedicPoisonHud
+            (FileName:    'HaloHUD'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width:  22; Height: 11; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHaloHUD
+            (FileName:    'InvulnHUD'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width:  18; Height: 18; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true)// sprInvulnHUD
             );
 
 
--- a/hedgewars/uWorld.pas	Thu May 16 04:02:09 2019 +0200
+++ b/hedgewars/uWorld.pas	Thu May 16 06:41:56 2019 +0200
@@ -1591,20 +1591,51 @@
         (CurrentHedgehog^.HealthTagTex <> nil) and
         ((CurrentHedgehog^.Gear^.State and gstHHDriven) <> 0) then
     begin
-    t:= 10;
+    t:= 11;
     i:= t;
 {$IFDEF USE_TOUCH_INTERFACE}
     i:= t + pauseButton.frame.y + pauseButton.frame.h;
 {$ENDIF}
     DrawTexture(cScreenWidth div 2 - CurrentHedgehog^.HealthTagTex^.w - 16, i, CurrentHedgehog^.HealthTagTex);
-    if (CurrentHedgehog^.Effects[hePoisoned] > 0) then
-        DrawSprite(sprHealthPoisonHud, (cScreenWidth div 2 - CurrentHedgehog^.HealthTagTex^.w - 36), i, 0)
-    else
-        DrawSprite(sprHealthHud, (cScreenWidth div 2 - CurrentHedgehog^.HealthTagTex^.w - 36), i, 0);
-    if cVampiric then
-        DrawSprite(sprVampHud, (cScreenWidth div 2 - CurrentHedgehog^.HealthTagTex^.w - 62), i, 0);
     inc(t, CurrentHedgehog^.HealthTagTex^.h);
     cDemoClockFPSOffsetY:= t;
+
+    t:= SpritesData[sprHealthHud].Width + 18;
+    // Main health icon. Appearance depends on game mode and poisoning state
+    if ((GameFlags and gfResetHealth) = 0) then
+        if (CurrentHedgehog^.Effects[hePoisoned] <> 0) then
+            DrawSprite(sprHealthPoisonHud, (cScreenWidth div 2 - CurrentHedgehog^.HealthTagTex^.w - t), i, 0)
+        else
+            DrawSprite(sprHealthHud, (cScreenWidth div 2 - CurrentHedgehog^.HealthTagTex^.w - t), i, 0)
+    else
+        if (CurrentHedgehog^.Effects[hePoisoned] <> 0) then
+            DrawSprite(sprMedicPoisonHud, (cScreenWidth div 2 - CurrentHedgehog^.HealthTagTex^.w - t), i, 0)
+        else
+            DrawSprite(sprMedicHud, (cScreenWidth div 2 - CurrentHedgehog^.HealthTagTex^.w - t), i, 0);
+    // Put halo above health icon for resurrectable hog
+    if (CurrentHedgehog^.Effects[heResurrectable] <> 0) then
+        DrawSprite(sprHaloHud, (cScreenWidth div 2 - CurrentHedgehog^.HealthTagTex^.w - t - 2), i - SpritesData[sprHaloHud].Height + 1, 0);
+
+    // Additional health-related states
+    inc(t, 2);
+    // Invulnerable
+    if (CurrentHedgehog^.Effects[heInvulnerable] <> 0) then
+        begin
+        inc(t, SpritesData[sprInvulnHud].Width + 2);
+        DrawSprite(sprInvulnHud, (cScreenWidth div 2 - CurrentHedgehog^.HealthTagTex^.w - t), i, 0)
+        end
+    // Karma
+    else if ((GameFlags and gfKarma) <> 0) then
+        begin
+        inc(t, SpritesData[sprKarmaHud].Width + 2);
+        DrawSprite(sprKarmaHud, (cScreenWidth div 2 - CurrentHedgehog^.HealthTagTex^.w - t), i, 0)
+        end;
+    // Vampirism
+    if cVampiric then
+        begin
+        inc(t, SpritesData[sprVampHud].Width + 2);
+        DrawSprite(sprVampHud, (cScreenWidth div 2 - CurrentHedgehog^.HealthTagTex^.w - t), i, 0);
+        end;
     end
 else
     cDemoClockFPSOffsetY:= 0;
Binary file share/hedgewars/Data/Graphics/HaloHUD.png has changed
Binary file share/hedgewars/Data/Graphics/InvulnHUD.png has changed
Binary file share/hedgewars/Data/Graphics/KarmaHUD.png has changed
Binary file share/hedgewars/Data/Graphics/MedicHUD.png has changed
Binary file share/hedgewars/Data/Graphics/MedicPoisonHUD.png has changed