diff --git a/OpenRa.FileFormats/FileSystem.cs b/OpenRa.FileFormats/FileSystem.cs index a260c802a1..648bdac9aa 100644 --- a/OpenRa.FileFormats/FileSystem.cs +++ b/OpenRa.FileFormats/FileSystem.cs @@ -73,5 +73,20 @@ namespace OpenRa.FileFormats throw new FileNotFoundException( string.Format( "File not found: {0}", filename ), filename ); } + + public static bool Exists(string filename) + { + foreach (var folder in mountedFolders) + { + var s = folder.GetContent(filename); + if (s != null) + { + s.Dispose(); + return true; + } + } + + return false; + } } } diff --git a/OpenRa.Game/Actor.cs b/OpenRa.Game/Actor.cs index e126a580af..83b1ece4c6 100755 --- a/OpenRa.Game/Actor.cs +++ b/OpenRa.Game/Actor.cs @@ -71,6 +71,9 @@ namespace OpenRa.Game { get { + if (Info != null && Info.SelectionSize != null) + return new float2(Info.SelectionSize[0], Info.SelectionSize[1]); + var firstSprite = Render().FirstOrDefault(); if (firstSprite.Sprite == null) return float2.Zero; return firstSprite.Sprite.size; @@ -107,6 +110,8 @@ namespace OpenRa.Game { var size = SelectedSize; var loc = CenterLocation - 0.5f * size; + if (Info != null && Info.SelectionSize != null && Info.SelectionSize.Length > 2) + loc += new float2(Info.SelectionSize[2], Info.SelectionSize[3]); if (useAltitude) { diff --git a/OpenRa.Game/GameRules/UnitInfo.cs b/OpenRa.Game/GameRules/UnitInfo.cs index eb7e0d1ad2..8401ae04ef 100755 --- a/OpenRa.Game/GameRules/UnitInfo.cs +++ b/OpenRa.Game/GameRules/UnitInfo.cs @@ -54,6 +54,7 @@ namespace OpenRa.Game.GameRules public readonly string LongDesc = null; public readonly int OrePips = 0; public readonly string Icon = null; + public readonly int[] SelectionSize = null; public UnitInfo(string name) { Name = name; } } diff --git a/units.ini b/units.ini index 09d63fe001..2f63abcc4a 100644 --- a/units.ini +++ b/units.ini @@ -544,54 +544,64 @@ MEDI Description=Attack Dog BuiltAt=KENN Voice=DogVoice -Traits=Unit, Mobile, RenderInfantry, Infantry, AutoTarget +Traits=Unit, Mobile, RenderInfantry ;; AttackBase, SquishByTank, AutoTarget, dog?? LongDesc=Anti-infantry unit. Not fooled by the \nSpy's disguise.\n Strong vs Infantry\n Weak vs Vehicles +SelectionSize=12,17,-1,-4 [E1] Description=Rifle Infantry Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget LongDesc=General-purpose infantry. Strong vs Infantry\n Weak vs Vehicles +SelectionSize=12,17,0,-9 [E2] Description=Grenadier Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget FireDelay=15 PrimaryOffset=0,0,0,-13 LongDesc=Infantry armed with grenades. \n Strong vs Buildings, Infantry\n Weak vs Vehicles +SelectionSize=12,17,0,-9 [E3] Description=Rocket Soldier Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget PrimaryOffset=0,0,0,-13 LongDesc=Anti-tank/Anti-aircraft infantry.\n Strong vs Tanks, Aircraft\n Weak vs Infantry +SelectionSize=12,17,0,-9 [E4] Description=Flamethrower Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget FireDelay=8 PrimaryOffset=0,0,0,-7 LongDesc=Advanced Anti-infantry unit.\n Strong vs Infantry, Buildings\n Weak vs Vehicles +SelectionSize=12,17,0,-9 [E6] Description=Engineer Traits=Unit, Mobile, EngineerCapture, RenderInfantry, TakeCover, SquishByTank Voice=EngineerVoice LongDesc=Infiltrates and captures enemy structures.\n Strong vs Nothing\n Weak vs Everything +SelectionSize=12,17,0,-9 [SPY] Description=Spy Voice=SpyVoice Traits=Unit, Mobile, RenderInfantry, TakeCover, SquishByTank LongDesc=Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised +SelectionSize=12,17,0,-9 [THF] Description=Thief Voice=ThiefVoice Traits=Unit, Mobile, RenderInfantry, TakeCover, SquishByTank LongDesc=Infiltrates enemy refineries & \nsilos, and steals money stored there.\n Unarmed +SelectionSize=12,17,0,-9 [E7] Description=Tanya Voice=TanyaVoice Traits=Unit, Mobile, RenderInfantry, C4Demolition, AttackBase, TakeCover, SquishByTank, AutoTarget LongDesc=Elite commando infantry, armed with \ndual pistols and C4.\n Strong vs Infantry, Buildings\n Weak vs Vehicles\n Special Ability: Destroy Building with C4 +SelectionSize=12,17,0,-9 [MEDI] Description=Medic Voice=MedicVoice Traits=Unit, Mobile, RenderInfantry, AutoHeal, AttackBase, TakeCover, SquishByTank LongDesc=Heals nearby infantry.\n Strong vs Nothing\n Weak vs Everything +SelectionSize=12,17,0,-9