diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index 7aacabe1f6..e3c2ee72a6 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -710,6 +710,10 @@ namespace OpenRa.Game chromeRenderer.DrawSprite(specialBinSprite, new float2(0,14), PaletteType.Chrome); chromeRenderer.Flush(); var y = 24; + + string tooltipItem = null; + int2 tooltipPos = int2.Zero; + foreach (var sp in Game.LocalPlayer.SupportPowers) { var image = spsprites[sp.Key]; @@ -733,11 +737,50 @@ namespace OpenRa.Game PaletteType.Chrome); } + var rect = new Rectangle(5, y, 64, 48); + if (rect.Contains(lastMousePos.ToPoint())) + { + tooltipItem = sp.Key; + tooltipPos = drawPos.ToInt2() + new int2(72, 0) - Game.viewport.Location.ToInt2(); + } + y += 51; } } buildPaletteRenderer.Flush(); + + if (tooltipItem != null) + DrawSupportPowerTooltip(tooltipItem, tooltipPos); + } + + string FormatTime(int ticks) + { + var seconds = ticks / 25; + var minutes = seconds / 60; + + return "{0}:{1}".F(minutes, seconds % 60); + } + + void DrawSupportPowerTooltip(string sp, int2 pos) + { + chromeRenderer.DrawSprite(tooltipSprite, pos, PaletteType.Chrome); + chromeRenderer.Flush(); + + var info = Rules.SupportPowerInfo[sp]; + + pos += new int2(5, 5); + + renderer.DrawText2(info.Description, pos, Color.White); + + var timer = "Charge Time: {0}".F(FormatTime(Game.LocalPlayer.SupportPowers[sp].RemainingTime)); + DrawRightAligned(timer, pos + new int2((int)tooltipSprite.size.X - 10, 0), Color.White); + + if (info.LongDesc != null) + { + pos += new int2(0, 25); + renderer.DrawText(info.LongDesc.Replace("\\n", "\n"), pos, Color.White); + } } } } diff --git a/OpenRa.Game/SupportPower.cs b/OpenRa.Game/SupportPower.cs index 2a6ff5ba56..1d4f6e548f 100644 --- a/OpenRa.Game/SupportPower.cs +++ b/OpenRa.Game/SupportPower.cs @@ -44,5 +44,9 @@ namespace OpenRa.Game if (RemainingTime > 0) --RemainingTime; } } + + public void Activate() + { + } } } diff --git a/units.ini b/units.ini index fac05d0bd8..b3eca27c1d 100644 --- a/units.ini +++ b/units.ini @@ -826,7 +826,7 @@ InvulnerabilityPower [ParadropPower] ; comes free with first AFLD ChargeTime=7 Description=Paratroopers -LongDesc=A Badger drops a squad of Riflemen anywhere on the map +LongDesc=A Badger drops a squad of Riflemen \nanywhere on the map Prerequisite=AFLD TechLevel=5 Image=pinficon @@ -844,7 +844,7 @@ GivenAuto=no [SonarPulsePower] ; picked up in a crate, or by spy -> spen/syrd ChargeTime=10 Description=Sonar Pulse -LongDesc=Reveals all submarines on the map for a short time. +LongDesc=Reveals all submarines on the map for a \nshort time. OneShot=yes Powered=no Image=sonricon @@ -854,7 +854,7 @@ GivenAuto=no [ChronoshiftPower] ; free with Chronosphere... sortof the point. ChargeTime=7 Description=Chronoshift -LongDesc=Temporarily teleports a vehicle across the map. +LongDesc=Temporarily teleports a vehicle across \nthe map. Prerequisite=PDOX Image=warpicon TechLevel=12 @@ -887,7 +887,7 @@ TechLevel=12 [InvulnerabilityPower] ; the point of IRON ChargeTime=11 Description=Invulnerability -LongDesc=Makes a single unit invulnerable for a short time. +LongDesc=Makes a single unit invulnerable for a \nshort time. Image=infxicon Prerequisite=IRON TechLevel=12 \ No newline at end of file