# HG changeset patch # User Wuzzy # Date 1554654074 -7200 # Node ID 533ac9774279b3e49cbe2775622812955bcb5ee8 # Parent 2ad6f0555e6137395cfd8075a0481adea9958c11 Add key to display extra gear info tags diff -r 2ad6f0555e61 -r 533ac9774279 QTfrontend/binds.cpp --- a/QTfrontend/binds.cpp Wed Apr 03 13:00:05 2019 +0200 +++ b/QTfrontend/binds.cpp Sun Apr 07 18:21:14 2019 +0200 @@ -70,6 +70,7 @@ {"capture", "c", QT_TRANSLATE_NOOP("binds", "capture"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Take a screenshot:")}, {"+speedup", "s", QT_TRANSLATE_NOOP("binds", "speed up replay"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Demo replay:")}, {"+mission", "m", QT_TRANSLATE_NOOP("binds", "show mission information"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Heads-up display:")}, + {"gearinfo", "o", QT_TRANSLATE_NOOP("binds", "show object information"), NULL, NULL}, //: This refers to the team info bars (name/flag/health) of all teams. These are shown at the bottom center of the screen {"rotmask", "delete", QT_TRANSLATE_NOOP("binds", "toggle team bars"), NULL, NULL}, {"rottags", "home", QT_TRANSLATE_NOOP("binds", "toggle hedgehog tags"), NULL, NULL}, diff -r 2ad6f0555e61 -r 533ac9774279 QTfrontend/binds.h --- a/QTfrontend/binds.h Wed Apr 03 13:00:05 2019 +0200 +++ b/QTfrontend/binds.h Sun Apr 07 18:21:14 2019 +0200 @@ -22,9 +22,9 @@ #include #ifdef VIDEOREC -#define BINDS_NUMBER 52 +#define BINDS_NUMBER 53 #else -#define BINDS_NUMBER 51 +#define BINDS_NUMBER 52 #endif struct BindAction diff -r 2ad6f0555e61 -r 533ac9774279 hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Wed Apr 03 13:00:05 2019 +0200 +++ b/hedgewars/uCommandHandlers.pas Sun Apr 07 18:21:14 2019 +0200 @@ -939,6 +939,12 @@ HideMission(); end; +procedure chGearInfo(var s: shortstring); +begin + s:= s; // avoid compiler hint + isShowGearInfo:= not isShowGearInfo; +end; + procedure initModule; begin //////// Begin top sorted by freq analysis not including chatmsg @@ -1031,6 +1037,7 @@ RegisterVariable('advmapgen',@chAdvancedMapGenMode, false); RegisterVariable('+mission', @chShowMission_p, true); RegisterVariable('-mission', @chShowMission_m, true); + RegisterVariable('gearinfo', @chGearInfo , true ); RegisterVariable('timer_u' , @chTimerU , true ); end; diff -r 2ad6f0555e61 -r 533ac9774279 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Wed Apr 03 13:00:05 2019 +0200 +++ b/hedgewars/uGears.pas Sun Apr 07 18:21:14 2019 +0200 @@ -686,6 +686,7 @@ begin x:= hwRound(Gear^.X) + WorldDx; y:= hwRound(Gear^.Y) + WorldDy; + RenderGearHealth(Gear, x, y); RenderGearTimer(Gear, x, y); if Gear^.Kind = gtHedgehog then RenderHHGuiExtras(Gear, x, y); @@ -1079,6 +1080,7 @@ HealthCrate: begin gear^.Pos := posCaseHealth; + gear^.RenderHealth:= true; // health crate is smaller than the other crates gear^.Radius := cCaseHealthRadius; gear^.Health := content; @@ -1125,6 +1127,7 @@ HealthCrate: begin gear^.Pos := gear^.Pos + posCaseHealth; + gear^.RenderHealth:= true; // health crate is smaller than the other crates gear^.Radius := cCaseHealthRadius; if(FinishedTurnsTotal > -1) then diff -r 2ad6f0555e61 -r 533ac9774279 hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Wed Apr 03 13:00:05 2019 +0200 +++ b/hedgewars/uGearsHandlersMess.pas Sun Apr 07 18:21:14 2019 +0200 @@ -2391,6 +2391,9 @@ AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke) else AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite); + // health texture + FreeAndNilTexture(Gear^.Tex); + Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16); dec(Gear^.Health, Gear^.Damage); Gear^.Damage := 0; if Gear^.Health <= 0 then @@ -2465,9 +2468,19 @@ AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite); dec(Gear^.Health, Gear^.Damage); Gear^.Damage := 0; + // health texture + FreeAndNilTexture(Gear^.Tex); + Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16); end else begin + // health texture for health crate + if (k = gtCase) and ((Gear^.Pos and $02) <> 0) then + begin + FreeAndNilTexture(Gear^.Tex); + if ((Gear^.State and gstFrozen) = 0) then + Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16); + end; if Gear^.Timer = 500 then begin (* Can't make sparkles team coloured without working out what the next team is going to be. This should be solved, really, since it also screws up diff -r 2ad6f0555e61 -r 533ac9774279 hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Wed Apr 03 13:00:05 2019 +0200 +++ b/hedgewars/uGearsList.pas Sun Apr 07 18:21:14 2019 +0200 @@ -487,6 +487,8 @@ end; gtExplosives: begin gear^.AdvBounce:= 1; + if GameType in [gmtDemo, gmtSave, gmtRecord] then + gear^.RenderHealth:= true; gear^.ImpactSound:= sndGrenadeImpact; gear^.nImpactSounds:= 1; gear^.Radius:= 16; diff -r 2ad6f0555e61 -r 533ac9774279 hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Wed Apr 03 13:00:05 2019 +0200 +++ b/hedgewars/uGearsRender.pas Sun Apr 07 18:21:14 2019 +0200 @@ -37,6 +37,7 @@ end; procedure RenderGear(Gear: PGear; x, y: LongInt); procedure RenderGearTimer(Gear: PGear; x, y: LongInt); +procedure RenderGearHealth(Gear: PGear; x, y: LongInt); procedure RenderHHGuiExtras(Gear: PGear; ox, oy: LongInt); procedure DrawHHOrder(); @@ -1648,4 +1649,15 @@ DrawTextureCentered(x + 8, y + 8, Gear^.Tex); end; +procedure RenderGearHealth(Gear: PGear; x, y: LongInt); +begin +if isShowGearInfo and (Gear^.RenderHealth) and (Gear^.Tex <> nil) then + begin + if (Gear^.Kind = gtCase) and ((Gear^.Pos and $02) <> 0) then + DrawTextureCentered(x, y - 38, Gear^.Tex); + if (Gear^.Kind = gtExplosives) then + DrawTextureCentered(x, y - 38, Gear^.Tex); + end; +end; + end. diff -r 2ad6f0555e61 -r 533ac9774279 hedgewars/uGearsUtils.pas --- a/hedgewars/uGearsUtils.pas Wed Apr 03 13:00:05 2019 +0200 +++ b/hedgewars/uGearsUtils.pas Sun Apr 07 18:21:14 2019 +0200 @@ -1591,6 +1591,7 @@ if t