routed invuln & chrono powers

This commit is contained in:
Chris Forbes
2010-01-09 08:52:15 +13:00
parent c59595d9db
commit c67f686ad7
8 changed files with 51 additions and 351 deletions

View File

@@ -78,7 +78,9 @@ namespace OpenRa.Game
specialBinSprites = new [] specialBinSprites = new []
{ {
new Sprite(chromeTexture, new Rectangle(0, 0, 32, 192), TextureChannel.Alpha), new Sprite(chromeTexture, new Rectangle(0, 0, 32, 51), TextureChannel.Alpha),
new Sprite(chromeTexture, new Rectangle(0, 51, 32, 51 /*144*/), TextureChannel.Alpha),
new Sprite(chromeTexture, new Rectangle(0, 192-39, 32, 39 ), TextureChannel.Alpha),
}; };
moneyBinSprite = new Sprite(chromeTexture, new Rectangle(512 - 320, 0, 320, 32), TextureChannel.Alpha); moneyBinSprite = new Sprite(chromeTexture, new Rectangle(512 - 320, 0, 320, 32), TextureChannel.Alpha);
tooltipSprite = new Sprite(chromeTexture, new Rectangle(0, 288, 272, 136), TextureChannel.Alpha); tooltipSprite = new Sprite(chromeTexture, new Rectangle(0, 288, 272, 136), TextureChannel.Alpha);
@@ -324,32 +326,6 @@ namespace OpenRa.Game
void DrawButtons() void DrawButtons()
{ {
// Chronoshift
Rectangle chronoshiftRect = new Rectangle(6, 14, repairButton.Image.bounds.Width, repairButton.Image.bounds.Height);
var chronoshiftDrawPos = Game.viewport.Location + new float2(chronoshiftRect.Location);
var hasChronosphere = Game.world.Actors.Any(a => a.Owner == Game.LocalPlayer && a.traits.Contains<Chronosphere>());
if (!hasChronosphere)
repairButton.ReplaceAnim("disabled");
else
AddButton(chronoshiftRect, isLmb => HandleChronosphereButton());
shpRenderer.DrawSprite(repairButton.Image, chronoshiftDrawPos, PaletteType.Chrome);
// Iron Curtain
Rectangle curtainRect = new Rectangle(6, 14+50, repairButton.Image.bounds.Width, repairButton.Image.bounds.Height);
var curtainDrawPos = Game.viewport.Location + new float2(curtainRect.Location);
var hasCurtain = Game.world.Actors.Any(a => a.Owner == Game.LocalPlayer && a.traits.Contains<IronCurtain>());
if (!hasCurtain)
repairButton.ReplaceAnim("disabled");
else
AddButton(curtainRect, isLmb => HandleIronCurtainButton());
shpRenderer.DrawSprite(repairButton.Image, curtainDrawPos, PaletteType.Chrome);
// Repair // Repair
Rectangle repairRect = new Rectangle(Game.viewport.Width - 120, 5, repairButton.Image.bounds.Width, repairButton.Image.bounds.Height); Rectangle repairRect = new Rectangle(Game.viewport.Width - 120, 5, repairButton.Image.bounds.Width, repairButton.Image.bounds.Height);
var repairDrawPos = Game.viewport.Location + new float2(repairRect.Location); var repairDrawPos = Game.viewport.Location + new float2(repairRect.Location);
@@ -438,19 +414,7 @@ namespace OpenRa.Game
shpRenderer.Flush(); shpRenderer.Flush();
} }
} }
void HandleChronosphereButton()
{
if (Game.controller.ToggleInputMode<ChronosphereSelectOrderGenerator>())
Sound.Play("slcttgt1.aud");
}
void HandleIronCurtainButton()
{
if (Game.controller.ToggleInputMode<IronCurtainOrderGenerator>())
Sound.Play("slcttgt1.aud");
}
void DrawChat() void DrawChat()
{ {
var chatpos = new int2(400, Game.viewport.Height - 20); var chatpos = new int2(400, Game.viewport.Height - 20);
@@ -711,8 +675,18 @@ namespace OpenRa.Game
void DrawSupportPowers() void DrawSupportPowers()
{ {
var numPowers = Game.LocalPlayer.SupportPowers.Values
.Where(a => a.IsAvailable).Count();
if (numPowers == 0) return;
rgbaRenderer.DrawSprite(specialBinSprites[0], new float2(0,14), PaletteType.Chrome); rgbaRenderer.DrawSprite(specialBinSprites[0], new float2(0,14), PaletteType.Chrome);
for (var i = 1; i < numPowers; i++)
rgbaRenderer.DrawSprite(specialBinSprites[1], new float2(0, 14 + i * 51), PaletteType.Chrome);
rgbaRenderer.DrawSprite(specialBinSprites[2], new float2(0, 14 + numPowers * 51), PaletteType.Chrome);
rgbaRenderer.Flush(); rgbaRenderer.Flush();
var y = 24; var y = 24;
string tooltipItem = null; string tooltipItem = null;
@@ -744,7 +718,6 @@ namespace OpenRa.Game
AddButton(rect, HandleSupportPower( sp.Value )); AddButton(rect, HandleSupportPower( sp.Value ));
} }
if (rect.Contains(lastMousePos.ToPoint())) if (rect.Contains(lastMousePos.ToPoint()))
{ {
tooltipItem = sp.Key; tooltipItem = sp.Key;

View File

@@ -1,169 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Class Name="OpenRa.Game.Game">
<Position X="9.5" Y="9.25" Width="2.25" />
<Members>
<Method Name="FindUnits" Hidden="true" />
<Field Name="lastTime" Hidden="true" />
<Method Name="LoadMapActors" Hidden="true" />
<Field Name="localPlayerIndex" Hidden="true" />
<Field Name="oreFrequency" Hidden="true" />
<Field Name="oreTicks" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>AAaAkDQAABJAAQEEBEECEgAQQUBAAAAAIYAKBCAAwiA=</HashCode>
<FileName>Game.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="world" />
<Field Name="viewport" />
<Field Name="controller" />
<Field Name="PathFinder" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Controller">
<Position X="6.5" Y="10.75" Width="1.75" />
<Members>
<Method Name="ApplyOrders" Hidden="true" />
<Method Name="CombineSelection" Hidden="true" />
<Field Name="controlGroups" Hidden="true" />
<Method Name="CursorForOrderString" Hidden="true" />
<Field Name="dragEnd" Hidden="true" />
<Field Name="dragStart" Hidden="true" />
<Field Name="GetModifierKeys" Hidden="true" />
<Field Name="recentOrders" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>AAACAACoAAAAAAAAAAQDEgQAABAAABAAAAAAKAACCAA=</HashCode>
<FileName>Controller.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="orderGenerator" />
</ShowAsAssociation>
<Lollipop Position="0.2" />
</Class>
<Class Name="OpenRa.Game.Graphics.Viewport">
<Position X="13.5" Y="10.25" Width="1.75" />
<Members>
<Field Name="cursorFrame" Hidden="true" />
<Field Name="cursorRenderer" Hidden="true" />
<Field Name="dragRegion" Hidden="true" />
<Field Name="mousePos" Hidden="true" />
<Field Name="renderer" Hidden="true" />
<Field Name="screenSize" Hidden="true" />
<Field Name="scrollPosition" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>AAIAAAAABAAACABCAAYAEEAAAABAAAAAAAAgAEEIwBE=</HashCode>
<FileName>Graphics\Viewport.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.World">
<Position X="4.75" Y="17.25" Width="2" />
<Members>
<Field Name="actors" Hidden="true" />
<Field Name="effects" Hidden="true" />
<Field Name="frameEndActions" Hidden="true" />
<Field Name="nextAID" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>AAIAACABAAABgAAAAYQABAAEAAAAAAAAAAAAAAAAQBA=</HashCode>
<FileName>World.cs</FileName>
</TypeIdentifier>
<ShowAsCollectionAssociation>
<Property Name="Actors" />
</ShowAsCollectionAssociation>
</Class>
<Class Name="OpenRa.Game.Actor">
<Position X="9.5" Y="16.75" Width="1.75" />
<Members>
<Field Name="currentActivity" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>AgEACACAAAAAAAAAAQIAEIAkAQQAAAAAABAgAEAAQgA=</HashCode>
<FileName>Actor.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="Owner" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.GameRules.UnitInfo" Collapsed="true">
<Position X="11" Y="1.75" Width="1.5" />
<TypeIdentifier>
<HashCode>ACIAAAKAAJAgwiAAgAAAgFQAJAhQAHAAGCACAADIRAA=</HashCode>
<FileName>GameRules\UnitInfo.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.Player">
<Position X="11.75" Y="16.75" Width="2.25" />
<Members>
<Field Name="displayCashDeltaPerFrame" Hidden="true" />
<Method Name="GiveAdvice" Hidden="true" />
<Method Name="UpdatePower" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>QEEEAAQAAAIAQQAACAMAACCAAAAAAA0gCAEAAQABQAA=</HashCode>
<FileName>Player.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.GameRules.MobileInfo" Collapsed="true">
<Position X="9.75" Y="3.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAQAAAAAAAAAAAABAQAAAAAAAAAAAAAAAAg=</HashCode>
<FileName>GameRules\UnitInfo.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.GameRules.BuildingInfo" Collapsed="true">
<Position X="13.25" Y="3.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAJQAAAIAAAAgAAACAAAABIAAAICAAABAAAAQAAAAgA=</HashCode>
<FileName>GameRules\UnitInfo.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.GameRules.InfantryInfo" Collapsed="true">
<Position X="8.75" Y="4.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAEEAAAAABIAAAAAAAAAAAAAAAACAAAQA=</HashCode>
<FileName>GameRules\UnitInfo.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.GameRules.VehicleInfo" Collapsed="true">
<Position X="11" Y="4.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAEAAAAAAAAAAAAAEAAAAAAAAAAAAAAA=</HashCode>
<FileName>GameRules\UnitInfo.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.GameRules.ActorInfo" Collapsed="true">
<Position X="11" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>GameRules\ActorInfo.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.PathFinder">
<Position X="9.25" Y="6.25" Width="1.75" />
<Members>
<Method Name="AvoidUnitsNear" Hidden="true" />
<Method Name="CheckSanePath" Hidden="true" />
<Method Name="CheckSanePath2" Hidden="true" />
<Method Name="FindBidiPath" Hidden="true" />
<Method Name="IsBlocked" Hidden="true" />
<Method Name="MakeBidiPath" Hidden="true" />
<Method Name="MakePath" Hidden="true" />
<Field Name="passableCost" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAgAACAAAICAAgAEoAAMAAAAAAAAgA=</HashCode>
<FileName>PathFinder.cs</FileName>
</TypeIdentifier>
</Class>
<Interface Name="OpenRa.Game.IOrderGenerator">
<Position X="3.5" Y="12" Width="1.5" />
<TypeIdentifier>
<HashCode>AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAQAA=</HashCode>
<FileName>IOrderGenerator.cs</FileName>
</TypeIdentifier>
</Interface>
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>

View File

@@ -1,131 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Class Name="OpenRa.Game.Graphics.Animation">
<Position X="15.75" Y="9" Width="1.5" />
<TypeIdentifier>
<HashCode>AAQCgACAAAAAAAAAAAAAAAAAAAAEABAEgAAAAQQIQAA=</HashCode>
<FileName>Graphics\Animation.cs</FileName>
</TypeIdentifier>
<ShowAsCollectionAssociation>
<Property Name="Images" />
</ShowAsCollectionAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.Viewport">
<Position X="4.25" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAQAABAAAgAAAAIYAAEAAAABCAAAAAABgAAAAgAE=</HashCode>
<FileName>Graphics\Viewport.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="renderer" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.HardwarePalette">
<Position X="9.75" Y="10" Width="1.5" />
<TypeIdentifier>
<HashCode>AAQAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAQAAAAA=</HashCode>
<FileName>Graphics\HardwarePalette.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.Graphics.Region" Collapsed="true">
<Position X="18.25" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AIQAAAAAAAAAggAABAIAIAQCAAAAAGAAAAAAAAAQAAA=</HashCode>
<FileName>Graphics\Region.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.Graphics.Renderer">
<Position X="4.25" Y="5.75" Width="1.5" />
<TypeIdentifier>
<HashCode>QACAEAAGAAAAAgMAAAAAAAAAAAAAAAAAAAAAAEAAAAA=</HashCode>
<FileName>Graphics\Renderer.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.Graphics.Sheet">
<Position X="9.75" Y="6" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAACAgAAACAgAAAAIAAAAAgAAAAIAAAAggAA=</HashCode>
<FileName>Graphics\Sheet.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="renderer" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.SheetBuilder">
<Position X="1.25" Y="6" Width="1.5" />
<TypeIdentifier>
<HashCode>AQIACAAAAAAAIQAAAAAAAAAAgAAAAIAAAEAAAAACgAA=</HashCode>
<FileName>Graphics\SheetBuilder.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="renderer" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.Sprite">
<Position X="12.75" Y="6.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAQAAIAAAAIAAAAAAAAAAAAABAAACAAAEAgA=</HashCode>
<FileName>Graphics\Sprite.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="sheet" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.SpriteRenderer">
<Position X="6.75" Y="5.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAQQAAAAECAAAAAAAAAAAAAABAQABAAAAAAAACIwAQ=</HashCode>
<FileName>Graphics\SpriteRenderer.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="currentSheet" />
<Field Name="renderer" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.SpriteSheetBuilder">
<Position X="12.75" Y="3.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAACAAAA=</HashCode>
<FileName>Graphics\SpriteSheetBuilder.cs</FileName>
</TypeIdentifier>
<ShowAsCollectionAssociation>
<Field Name="sprites" />
</ShowAsCollectionAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.TerrainRenderer">
<Position X="7" Y="2.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AACQEAAAAAAAAgAAAAAACAAAABgAAAAAAAAAAAAAgAA=</HashCode>
<FileName>Graphics\TerrainRenderer.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="renderer" />
<Field Name="terrainSheet" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.UnitSheetBuilder">
<Position X="15.75" Y="6" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAgAAAAAAAAAAAAAAAAQAAAAAAAQAAAACAAAA=</HashCode>
<FileName>Graphics\UnitSheetBuilder.cs</FileName>
</TypeIdentifier>
<ShowAsCollectionAssociation>
<Field Name="sprites" />
</ShowAsCollectionAssociation>
</Class>
<Struct Name="OpenRa.Game.Graphics.Vertex" Collapsed="true">
<Position X="18.25" Y="1.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAgAAACAAFJgAQAAAAA=</HashCode>
<FileName>Graphics\Vertex.cs</FileName>
</TypeIdentifier>
</Struct>
<Enum Name="OpenRa.Game.Graphics.TextureChannel" Collapsed="true">
<Position X="18.25" Y="3" Width="1.5" />
<TypeIdentifier>
<HashCode>AAACAAAAAAAAAgAAAAAAAAAAAAAAABAAAAAAABAAAAA=</HashCode>
<FileName>Graphics\Sprite.cs</FileName>
</TypeIdentifier>
</Enum>
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>

View File

@@ -122,7 +122,9 @@
<Compile Include="Smudge.cs" /> <Compile Include="Smudge.cs" />
<Compile Include="Sound.cs" /> <Compile Include="Sound.cs" />
<Compile Include="SupportPower.cs" /> <Compile Include="SupportPower.cs" />
<Compile Include="SupportPowers\Chronoshift.cs" />
<Compile Include="SupportPowers\GpsSatellite.cs" /> <Compile Include="SupportPowers\GpsSatellite.cs" />
<Compile Include="SupportPowers\IronCurtain.cs" />
<Compile Include="SupportPowers\ISupportPowerImpl.cs" /> <Compile Include="SupportPowers\ISupportPowerImpl.cs" />
<Compile Include="SupportPowers\NullPower.cs" /> <Compile Include="SupportPowers\NullPower.cs" />
<Compile Include="Support\Stopwatch.cs" /> <Compile Include="Support\Stopwatch.cs" />
@@ -308,10 +310,6 @@
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Game Code.cd" />
<None Include="Graphics\Graphics.cd" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -0,0 +1,15 @@
using OpenRa.Game.Orders;
namespace OpenRa.Game.SupportPowers
{
class Chronoshift : ISupportPowerImpl
{
public void Activate(SupportPower p)
{
// todo: someone has to call SupportPower.FinishActivate when we're done!
if (Game.controller.ToggleInputMode<ChronosphereSelectOrderGenerator>())
Sound.Play("slcttgt1.aud");
}
}
}

View File

@@ -0,0 +1,15 @@
using OpenRa.Game.Orders;
namespace OpenRa.Game.SupportPowers
{
class IronCurtain : ISupportPowerImpl
{
public void Activate(SupportPower p)
{
// todo: someone has to call SupportPower.FinishActivate when we're done!
if (Game.controller.ToggleInputMode<IronCurtainOrderGenerator>())
Sound.Play("slcttgt1.aud");
}
}
}

View File

@@ -1,12 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using OpenRa.FileFormats;
using System.Xml; using System.Xml;
using System.Drawing; using OpenRa.FileFormats;
using System.Drawing.Imaging;
using System.IO;
namespace SequenceEditor namespace SequenceEditor
{ {

View File

@@ -861,7 +861,7 @@ LongDesc=Temporarily teleports a vehicle across \nthe map.
Prerequisite=PDOX Prerequisite=PDOX
Image=warpicon Image=warpicon
TechLevel=12 TechLevel=12
Impl=NullPower Impl=Chronoshift
[SpyPlanePower] ; free with first AFLD [SpyPlanePower] ; free with first AFLD
ChargeTime=3 ChargeTime=3
@@ -899,4 +899,4 @@ LongDesc=Makes a single unit invulnerable for a \nshort time.
Image=infxicon Image=infxicon
Prerequisite=IRON Prerequisite=IRON
TechLevel=12 TechLevel=12
Impl=NullPower Impl=IronCurtain