From b976447d67f0a556b8e185a1efbc0fb4461a7c64 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 26 Feb 2010 20:43:17 +1300 Subject: [PATCH 01/12] fixed #75 missiles fly forever --- OpenRa.Game/Effects/Missile.cs | 20 +++++++----- OpenRa.Game/GameRules/ProjectileInfo.cs | 10 ++---- mods/cnc/weapons.ini | 5 +-- mods/ra/rules.ini | 41 +++---------------------- 4 files changed, 21 insertions(+), 55 deletions(-) diff --git a/OpenRa.Game/Effects/Missile.cs b/OpenRa.Game/Effects/Missile.cs index 5bdfadb662..5ec6ee70cc 100755 --- a/OpenRa.Game/Effects/Missile.cs +++ b/OpenRa.Game/Effects/Missile.cs @@ -81,13 +81,7 @@ namespace OpenRa.Effects var dist = Target.CenterLocation - Pos; if (dist.LengthSquared < MissileCloseEnough * MissileCloseEnough || Target.IsDead) - { - world.AddFrameEndTask(w => w.Remove(this)); - - if (t > Projectile.Arm * 40) /* don't blow up in our launcher's face! */ - Combat.DoImpact(Pos.ToInt2(), Pos.ToInt2(), Weapon, Projectile, Warhead, FiredBy); - return; - } + Explode(world); var speed = Scale * Weapon.Speed * ((targetAltitude > 0 && Weapon.TurboBoost) ? 1.5f : 1f); @@ -99,7 +93,17 @@ namespace OpenRa.Effects world.AddFrameEndTask(w => w.Add( new Smoke(w, (Pos - 1.5f * move - new int2( 0, Altitude )).ToInt2(), Projectile.Trail))); - // todo: running out of fuel + if (Projectile.RangeLimit != 0 && t > Projectile.RangeLimit * 40) + Explode(world); + } + + void Explode(World world) + { + world.AddFrameEndTask(w => w.Remove(this)); + + if (t > Projectile.Arm * 40) /* don't blow up in our launcher's face! */ + Combat.DoImpact(Pos.ToInt2(), Pos.ToInt2(), Weapon, Projectile, Warhead, FiredBy); + return; } public IEnumerable Render() diff --git a/OpenRa.Game/GameRules/ProjectileInfo.cs b/OpenRa.Game/GameRules/ProjectileInfo.cs index 216743648b..860dbc91b7 100644 --- a/OpenRa.Game/GameRules/ProjectileInfo.cs +++ b/OpenRa.Game/GameRules/ProjectileInfo.cs @@ -25,25 +25,21 @@ namespace OpenRa.GameRules public readonly bool AA = false; public readonly bool AG = true; public readonly bool ASW = false; - public readonly string Trail = null; public readonly bool Arcing = false; public readonly int Arm = 0; public readonly bool Degenerates = false; - public readonly bool Dropping = false; - public readonly int Frames = 1; - public readonly bool Gigundo = false; public readonly bool High = false; public readonly string Image = null; public readonly bool Inaccurate = false; - public readonly bool Inviso = false; public readonly bool Parachuted = false; public readonly bool Proximity = false; public readonly int ROT = 0; - public readonly bool Ranged = false; public readonly bool Rotates = false; public readonly bool Shadow = true; - public readonly bool Translucent = false; public readonly bool UnderWater = false; public readonly int RangeLimit = 0; + + // OpenRA-specific: + public readonly string Trail = null; } } diff --git a/mods/cnc/weapons.ini b/mods/cnc/weapons.ini index 199cab513d..b5787dd133 100644 --- a/mods/cnc/weapons.ini +++ b/mods/cnc/weapons.ini @@ -74,8 +74,6 @@ HeatSeeker Cannon [Invisible] -Inviso=yes -Image=none [HeatSeeker] Arm=2 @@ -83,13 +81,12 @@ High=yes Shadow=no Proximity=yes Trail=smokey -Ranged=yes Inaccurate=yes AA=yes Image=DRAGON ROT=5 Rotates=yes -Translucent=yes +RangeLimit=6 [Cannon] Image=120MM diff --git a/mods/ra/rules.ini b/mods/ra/rules.ini index b83df75c06..9c2eaf4b16 100644 --- a/mods/ra/rules.ini +++ b/mods/ra/rules.ini @@ -456,35 +456,27 @@ Report=MISSILE1 ; AA = Can this weapon fire upon flying aircraft (def=no)? ; AG = Can this weapon fire upon ground objects (def=yes)? ; ASW = Is this an Anti-Submarine-Warfare projectile (def=no)? -; Animates = Does it animate [this means smoke puffs] (def=no)? ; Arcing = Does it have a ballistic trajectory (def=no)? ; Arm = arming delay (def=0) ; Degenerates = Does the bullet strength weaken as it travels (def=no)? -; Dropping = Does it fall from a starting height (def=no)? -; Frames = number of image frames for animation purposes (def=1) -; Gigundo = Is the projectile larger than normal (def=no)? ; High = Can it fly over walls (def=no)? ; Image = image to use during flight ; Inaccurate = Is it inherently inaccurate (def=no)? -; Inviso = Is the projectile invisible as it travels (def=no)? ; Parachuted = Equipped with a parachute for dropping from plane (def=no)? ; Proximity = Does it blow up when near its target (def=no)? ; ROT = Rate Of Turn [non zero implies homing] (def=0) -; Ranged = Can it run out of fuel (def=no)? ; Rotates = Does the projectile have rotation specific imagery (def=no)? ; Shadow = If High, does this bullet need to have a shadow drawn? (def = yes) -; Translucent = Are translucent colors used in artwork (def=no)? ; UnderWater = Does the projectile travel under water? +; Trail = image to use for smoke puffs etc (def=null) +; RangeLimit = maximum flight time (def=0=unlimited) ; invisible flight to target [Invisible] -Inviso=yes -Image=none ; special case for dog [LeapDog] Image=DOGBULLT -Translucent=yes Rotates=yes Proximity=yes ROT=20 @@ -495,8 +487,6 @@ Image=120MM ; anti aircraft artillery projectile [Ack] -Image=none -Inviso=yes AA=true AG=false @@ -514,7 +504,6 @@ High=yes Shadow=no Proximity=yes Trail=smokey -Ranged=yes Inaccurate=yes Image=V2 Rotates=yes @@ -526,13 +515,12 @@ High=yes Shadow=no Proximity=yes Trail=smokey -Ranged=yes Inaccurate=yes AA=yes Image=DRAGON ROT=5 Rotates=yes -Translucent=yes +RangeLimit=5 ; small missile with deadly accuracy [LaserGuided] @@ -541,12 +529,11 @@ High=yes Shadow=no Proximity=yes Trail=smokey -Ranged=yes AA=yes Image=DRAGON ROT=20 Rotates=yes -Translucent=yes +RangeLimit=5 ; anti aircraft missile [AAMissile] @@ -555,13 +542,12 @@ High=yes Shadow=no Proximity=yes Trail=smokey -Ranged=yes AA=yes AG=no Image=MISSILE ROT=20 Rotates=yes -Translucent=yes +RangeLimit=5 ; lobbed tumbling grenade [Lobbed] @@ -569,8 +555,6 @@ High=yes Arcing=yes Inaccurate=yes Image=BOMB -Frames=8 -Translucent=yes ; Depth charge catapult [Catapult] @@ -578,20 +562,15 @@ High=yes Arcing=yes Inaccurate=yes Image=BOMB -Frames=8 ASW=yes AG=no -Translucent=yes ; dropped from plane tumbling object [Bomblet] Arm=24 RangeLimit=24 High=yes -Dropping=yes Image=BOMBLET -Frames=6 -Translucent=yes ; arcing ballistic projectile [Ballistic] @@ -605,37 +584,27 @@ Image=120MM Arm=24 RangeLimit=24 High=yes -Dropping=yes -Parachuted=yes ;Image=PARABOMB ; Allied free radar (GPS satellite) [GPSSatellite] -Gigundo=yes High=yes Image=SPUTNIK -Frames=4 ; Nuclear missile, flying up [NukeUp] -Gigundo=yes High=yes Image=ATOMICUP -Frames=4 ; Nuclear missile, flying down [NukeDown] -Gigundo=yes High=yes Image=ATOMICDN -Frames=4 ; wizard's fireball [Fireball] Trail=fb2 Image=FB1 -Frames=8 - ; ******* Warhead Characteristics ******* ; This is what gives the "rock, paper, scissors" character to the game. From e0ecebf2041eb4702cd20c84e8fdf62b698a53a0 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 26 Feb 2010 21:05:35 +1300 Subject: [PATCH 02/12] IChromeButton support & RA rules change for it --- OpenRa.Game/Chrome.cs | 50 +++++--------------- OpenRa.Game/OpenRa.Game.csproj | 1 + OpenRa.Game/Traits/Chrome/PowerDownButton.cs | 47 ++++++++++++++++++ OpenRa.Game/Traits/TraitsInterfaces.cs | 8 ++++ mods/ra/rules.yaml | 4 +- 5 files changed, 70 insertions(+), 40 deletions(-) create mode 100644 OpenRa.Game/Traits/Chrome/PowerDownButton.cs diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index 0de8adb4da..3cd9c7f175 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -685,50 +685,22 @@ namespace OpenRa rgbaRenderer.Flush(); } + const int chromeButtonGap = 2; + void DrawButtons( World world ) { - int2 buttonOrigin = new int2(Game.viewport.Width - 320, 2); - // Repair - Rectangle repairRect = new Rectangle(buttonOrigin.X, buttonOrigin.Y, repairButton.Image.bounds.Width, repairButton.Image.bounds.Height); - var repairDrawPos = new float2(repairRect.Location); - - var hasFact = world.Queries.OwnedBy[world.LocalPlayer].WithTrait().Any(); - - if (Game.Settings.RepairRequiresConyard && !hasFact) - repairButton.ReplaceAnim("disabled"); - else - { - repairButton.ReplaceAnim(Game.controller.orderGenerator is RepairOrderGenerator ? "pressed" : "normal"); - AddButton(repairRect, isLmb => Game.controller.ToggleInputMode()); - } - shpRenderer.DrawSprite(repairButton.Image, repairDrawPos, "chrome"); + var origin = new int2(Game.viewport.Width - 200, 2); - // Sell - Rectangle sellRect = new Rectangle(buttonOrigin.X+40, buttonOrigin.Y, - sellButton.Image.bounds.Width, sellButton.Image.bounds.Height); - - var sellDrawPos = new float2(sellRect.Location); - - sellButton.ReplaceAnim(Game.controller.orderGenerator is SellOrderGenerator ? "pressed" : "normal"); - - AddButton(sellRect, isLmb => Game.controller.ToggleInputMode()); - shpRenderer.DrawSprite(sellButton.Image, sellDrawPos, "chrome"); - shpRenderer.Flush(); - - if (Game.Settings.PowerDownBuildings) + foreach (var cb in world.WorldActor.traits.WithInterface()) { - // Power Down - Rectangle pwrdownRect = new Rectangle(buttonOrigin.X+80, buttonOrigin.Y, - pwrdownButton.Image.bounds.Width, pwrdownButton.Image.bounds.Height); - - var pwrdownDrawPos = new float2(pwrdownRect.Location); - - pwrdownButton.ReplaceAnim(Game.controller.orderGenerator is PowerDownOrderGenerator ? "pressed" : "normal"); - - AddButton(pwrdownRect, isLmb => Game.controller.ToggleInputMode()); - shpRenderer.DrawSprite(pwrdownButton.Image, pwrdownDrawPos, "chrome"); + var button = cb; + var anim = new Animation(cb.Image); + anim.Play(cb.Enabled ? cb.Pressed ? "pressed" : "normal" : "disabled"); + origin.X -= (int)anim.Image.size.X + chromeButtonGap; + shpRenderer.DrawSprite(anim.Image, origin, "chrome"); + AddButton(new RectangleF(origin.X, origin.Y, anim.Image.size.X, anim.Image.size.Y), + _ => { if (button.Enabled) button.OnClick(); }); } - shpRenderer.Flush(); //Options Rectangle optionsRect = new Rectangle(0,0, optionsButton.Image.bounds.Width, diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 1e887ff951..384a786273 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -108,6 +108,7 @@ + diff --git a/OpenRa.Game/Traits/Chrome/PowerDownButton.cs b/OpenRa.Game/Traits/Chrome/PowerDownButton.cs new file mode 100644 index 0000000000..c8fafdf6bd --- /dev/null +++ b/OpenRa.Game/Traits/Chrome/PowerDownButton.cs @@ -0,0 +1,47 @@ +using System; +using System.Linq; +using OpenRa.Orders; + +namespace OpenRa.Traits +{ + class PowerDownButtonInfo : StatelessTraitInfo { } + + class PowerDownButton : IChromeButton + { + public string Image { get { return "repair"; } } // todo: art + public bool Enabled { get { return true; } } + public bool Pressed { get { return Game.controller.orderGenerator is PowerDownOrderGenerator; } } + public void OnClick() { Game.controller.ToggleInputMode(); } + } + + class SellButtonInfo : StatelessTraitInfo { } + + class SellButton : IChromeButton + { + public string Image { get { return "sell"; } } + public bool Enabled { get { return true; } } + public bool Pressed { get { return Game.controller.orderGenerator is SellOrderGenerator; } } + public void OnClick() { Game.controller.ToggleInputMode(); } + } + + class RepairButtonInfo : StatelessTraitInfo { } + + class RepairButton : IChromeButton + { + public string Image { get { return "repair"; } } // todo: art + public bool Enabled + { + get + { + if (!Game.Settings.RepairRequiresConyard) + return true; + + return Game.world.Queries.OwnedBy[Game.world.LocalPlayer] + .WithTrait().Any(); + } + } + + public bool Pressed { get { return Game.controller.orderGenerator is RepairOrderGenerator; } } + public void OnClick() { Game.controller.ToggleInputMode(); } + } +} diff --git a/OpenRa.Game/Traits/TraitsInterfaces.cs b/OpenRa.Game/Traits/TraitsInterfaces.cs index 97600f814b..5c7f8302ea 100644 --- a/OpenRa.Game/Traits/TraitsInterfaces.cs +++ b/OpenRa.Game/Traits/TraitsInterfaces.cs @@ -132,4 +132,12 @@ namespace OpenRa.Traits IActivity Tick(Actor self); void Cancel(Actor self); } + + public interface IChromeButton + { + string Image { get; } + bool Enabled { get; } + bool Pressed { get; } + void OnClick(); + } } diff --git a/mods/ra/rules.yaml b/mods/ra/rules.yaml index 4beb750fb0..be513ffc77 100644 --- a/mods/ra/rules.yaml +++ b/mods/ra/rules.yaml @@ -188,7 +188,9 @@ World: Country@7: Name: Spain Race: allies - + SellButton: + RepairButton: + PowerDownButton: MGG: GeneratesGap: From 9f8e9c8c643357d201e0f07af73dcbfb8d93b18c Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 26 Feb 2010 21:06:25 +1300 Subject: [PATCH 03/12] cnc support for IChromeButton --- mods/cnc/system.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/cnc/system.yaml b/mods/cnc/system.yaml index 53d5cc1747..a7173d60bd 100644 --- a/mods/cnc/system.yaml +++ b/mods/cnc/system.yaml @@ -117,4 +117,6 @@ World: Race: gdi Country@nod: Name: Nod - Race: nod \ No newline at end of file + Race: nod + SellButton: + RepairButton: \ No newline at end of file From 20c144518cccaa023265f0e2f62c1964d9f79aae Mon Sep 17 00:00:00 2001 From: pchote Date: Fri, 26 Feb 2010 21:14:19 +1300 Subject: [PATCH 04/12] Add a basic wall definition --- mods/ra/rules.yaml | 19 +++++++++++++++++++ mods/ra/sequences.xml | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/mods/ra/rules.yaml b/mods/ra/rules.yaml index 4beb750fb0..81a0e3fe26 100644 --- a/mods/ra/rules.yaml +++ b/mods/ra/rules.yaml @@ -2494,3 +2494,22 @@ MEDI: TakeCover: -AutoTarget: +BRIK: + Inherits: ^Building + Buildable: + TechLevel: 8 + Prerequisites: fact + Owner: soviet + Cost: 100 + Description: Concrete Wall + LongDesc: Its a wall. + Building: + Power: 0 + Footprint: x + Dimensions: 1,1 + Capturable: false + Bib: no + HP: 1 + Armor: none + Crewed: no + Sight: 0 diff --git a/mods/ra/sequences.xml b/mods/ra/sequences.xml index b0775785fa..aaa14c95ec 100644 --- a/mods/ra/sequences.xml +++ b/mods/ra/sequences.xml @@ -859,4 +859,9 @@ + + + + + \ No newline at end of file From 237b74a0fa74fffe7df3226b5a42b49395cd70d3 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 26 Feb 2010 22:28:51 +1300 Subject: [PATCH 05/12] rewrote remap code to use yaml descriptions rather than my insane binary format --- OpenRa.FileFormats/FieldLoader.cs | 2 +- OpenRa.FileFormats/PlayerColorRemap.cs | 31 ++++++++++--------------- mods/ra/blue.rem | 17 +++++++++++++- mods/ra/gold.rem | 17 +++++++++++++- mods/ra/gray.rem | 17 +++++++++++++- mods/ra/green.rem | 17 +++++++++++++- mods/ra/orange.rem | Bin 48 -> 299 bytes mods/ra/red.rem | Bin 48 -> 269 bytes mods/ra/salmon.rem | Bin 48 -> 295 bytes mods/ra/teal.rem | Bin 48 -> 303 bytes 10 files changed, 77 insertions(+), 24 deletions(-) diff --git a/OpenRa.FileFormats/FieldLoader.cs b/OpenRa.FileFormats/FieldLoader.cs index cbce5dcd0f..4c7288be0b 100644 --- a/OpenRa.FileFormats/FieldLoader.cs +++ b/OpenRa.FileFormats/FieldLoader.cs @@ -48,7 +48,7 @@ namespace OpenRa.FileFormats } } - static object GetValue( Type fieldType, string x ) + public static object GetValue( Type fieldType, string x ) { if (x != null) x = x.Trim(); if( fieldType == typeof( int ) ) diff --git a/OpenRa.FileFormats/PlayerColorRemap.cs b/OpenRa.FileFormats/PlayerColorRemap.cs index c14ec5a37a..12c2f394e0 100644 --- a/OpenRa.FileFormats/PlayerColorRemap.cs +++ b/OpenRa.FileFormats/PlayerColorRemap.cs @@ -21,37 +21,30 @@ using System.Collections.Generic; using System.Drawing; using System.IO; +using System.Linq; namespace OpenRa.FileFormats { public class PlayerColorRemap : IPaletteRemap { - int offset; - List remapColors = new List(); + Dictionary remapColors; public PlayerColorRemap(Stream s) { - using (BinaryReader reader = new BinaryReader(s)) - { - for (int i = 0; i < 16; i++) - { - byte r = reader.ReadByte(); - byte g = reader.ReadByte(); - byte b = reader.ReadByte(); - - remapColors.Add(Color.FromArgb(r, g, b)); - } - } - - offset = 80; + var yaml = MiniYaml.FromStream(s); + remapColors = yaml.ToDictionary( + y => int.Parse(y.Key), + y => ArrayToColor((int[])FieldLoader.GetValue( + typeof(int[]), y.Value.Value.Trim()))); } + static Color ArrayToColor(int[] x) { return Color.FromArgb(x[0], x[1], x[2], x[3]); } + public Color GetRemappedColor(Color original, int index) { - if (index < offset || index >= offset + remapColors.Count) - return original; - - return remapColors[index - offset]; + Color c; + return remapColors.TryGetValue(index, out c) + ? c : original; } } } diff --git a/mods/ra/blue.rem b/mods/ra/blue.rem index 9589fb20cb..ac740c8490 100644 --- a/mods/ra/blue.rem +++ b/mods/ra/blue.rem @@ -1 +1,16 @@ -궾ޡʍ}iuYiDU8H}0@u(8m ,a,U D4 \ No newline at end of file +80: 255,226,230,246 +81: 255,206,210,234 +82: 255,182,190,222 +83: 255,161,170,202 +84: 255,141,149,186 +85: 255,125,133,174 +86: 255,105,117,161 +87: 255,89,105,149 +88: 255,68,85,137 +89: 255,56,72,125 +90: 255,48,64,117 +91: 255,40,56,109 +92: 255,32,44,97 +93: 255,24,44,85 +94: 255,12,32,68 +95: 255,8,20,52 diff --git a/mods/ra/gold.rem b/mods/ra/gold.rem index e35abd6942..ca5f7a2926 100644 --- a/mods/ra/gold.rem +++ b/mods/ra/gold.rem @@ -1 +1,16 @@ -yq־iƲaYULu@q8me8YU,UL$HD 844,(  \ No newline at end of file +80: 255,246,214,121 +81: 255,230,202,113 +82: 255,214,190,105 +83: 255,198,178,97 +84: 255,182,165,89 +85: 255,170,153,85 +86: 255,145,137,76 +87: 255,145,117,64 +88: 255,133,113,56 +89: 255,109,101,56 +90: 255,89,85,44 +91: 255,85,76,36 +92: 255,72,68,32 +93: 255,56,52,28 +94: 255,52,44,20 +95: 255,40,32,8 diff --git a/mods/ra/gray.rem b/mods/ra/gray.rem index e397db43d6..41f751f5ef 100644 --- a/mods/ra/gray.rem +++ b/mods/ra/gray.rem @@ -1 +1,16 @@ -κ}qqeqYP]H@P<4P<4<,(<,(,, \ No newline at end of file +80: 255,238,238,238 +81: 255,238,226,218 +82: 255,222,206,198 +83: 255,206,186,178 +84: 255,186,165,153 +85: 255,165,145,133 +86: 255,149,125,113 +87: 255,133,113,101 +88: 255,113,89,80 +89: 255,93,72,64 +90: 255,80,60,52 +91: 255,80,60,52 +92: 255,60,44,40 +93: 255,60,44,40 +94: 255,44,28,24 +95: 255,44,28,24 diff --git a/mods/ra/green.rem b/mods/ra/green.rem index b66e9436e3..c0a88595aa 100644 --- a/mods/ra/green.rem +++ b/mods/ra/green.rem @@ -1 +1,16 @@ -慲}umyei]YuLLe<5F({;!5RC(*ZZ~2&_@=i@q9S{kP2=~+=F_+ zaFCKHgOYF+UXA**e0hkYY4)>r13`Eh~Gw#6!5J-qi?!Pb#_>2RRhgK{@-Y3_Z=5b4MUqgS91sSlBHW;7> z3LuS%x%0H+dDCH1a zkg=Ucm4hA0v5V8Ox0Q;*CRR910 diff --git a/mods/ra/teal.rem b/mods/ra/teal.rem index 8aef28df1a79992a2e393321d2f5362e12b5564f..a624123618f105a46099f55fbcf4775e1a6b78d2 100644 GIT binary patch literal 303 zcmZwCF%APU2n4|Xr29i2u!R8wCjWm})-p;`oJ2L+HD- Date: Fri, 26 Feb 2010 23:16:55 +1300 Subject: [PATCH 06/12] added working remaps for cnc; killed the colors i don't have remaps for --- mods/cnc/blue.rem | 16 ++++++++++++++++ mods/cnc/orange.rem | 16 ++++++++++++++++ mods/cnc/red.rem | 16 ++++++++++++++++ mods/cnc/system.yaml | 26 ++++---------------------- mods/cnc/teal.rem | 16 ++++++++++++++++ 5 files changed, 68 insertions(+), 22 deletions(-) create mode 100644 mods/cnc/blue.rem create mode 100644 mods/cnc/orange.rem create mode 100644 mods/cnc/red.rem create mode 100644 mods/cnc/teal.rem diff --git a/mods/cnc/blue.rem b/mods/cnc/blue.rem new file mode 100644 index 0000000000..122f8c362e --- /dev/null +++ b/mods/cnc/blue.rem @@ -0,0 +1,16 @@ +176: 255,216,252,252 +177: 255,220,220,228 +178: 255,192,192,208 +179: 255,164,164,188 +180: 255,100,100,124 +181: 255,72,72,92 +182: 255,44,44,60 +183: 255,0,0,0 +184: 255,192,192,208 +185: 255,164,164,188 +186: 255,132,132,156 +187: 255,100,100,124 +188: 255,72,72,92 +189: 255,56,72,76 +190: 255,52,52,52 +191: 255,36,44,52 diff --git a/mods/cnc/orange.rem b/mods/cnc/orange.rem new file mode 100644 index 0000000000..1fb252b8f2 --- /dev/null +++ b/mods/cnc/orange.rem @@ -0,0 +1,16 @@ +176: 255,236,172,72 +177: 255,228,148,48 +178: 255,212,120,16 +179: 255,196,96,0 +180: 255,164,56,0 +181: 255,136,24,0 +182: 255,96,8,0 +183: 255,16,0,0 +184: 255,212,120,16 +185: 255,196,96,0 +186: 255,180,72,0 +187: 255,164,56,0 +188: 255,152,40,0 +189: 255,136,24,0 +190: 255,112,8,0 +191: 255,16,0,0 diff --git a/mods/cnc/red.rem b/mods/cnc/red.rem new file mode 100644 index 0000000000..42b9f3efea --- /dev/null +++ b/mods/cnc/red.rem @@ -0,0 +1,16 @@ +176: 255,244,0,0 +177: 255,220,20,8 +178: 255,196,40,20 +179: 255,172,52,28 +180: 255,120,48,36 +181: 255,96,8,0 +182: 255,56,32,20 +183: 255,16,0,0 +184: 255,196,40,20 +185: 255,172,52,28 +186: 255,152,48,36 +187: 255,120,48,36 +188: 255,112,24,0 +189: 255,88,44,28 +190: 255,56,32,20 +191: 255,56,32,20 diff --git a/mods/cnc/system.yaml b/mods/cnc/system.yaml index a7173d60bd..65cbc9b3d5 100644 --- a/mods/cnc/system.yaml +++ b/mods/cnc/system.yaml @@ -41,44 +41,26 @@ World: Name: player1 DisplayName: Blue BasePalette: player -# Remap: blue.rem + Remap: blue.rem DisplayColor: 56, 72, 125 PlayerColorPalette@player2: Name: player2 DisplayName: Red BasePalette: player -# Remap: red.rem + Remap: red.rem DisplayColor: 238, 0, 0 PlayerColorPalette@player3: Name: player3 DisplayName: Orange BasePalette: player -# Remap: orange.rem + Remap: orange.rem DisplayColor: 198,97,0 PlayerColorPalette@player4: Name: player4 DisplayName: Teal BasePalette: player -# Remap: teal.rem + Remap: teal.rem DisplayColor: 28,109,97 - PlayerColorPalette@player5: - Name: player5 - DisplayName: Salmon - BasePalette: player -# Remap: salmon.rem - DisplayColor: 153,76,53 - PlayerColorPalette@player6: - Name: player6 - DisplayName: Green - BasePalette: player -# Remap: green.rem - DisplayColor: 76,101,60 -# PlayerColorPalette@player7: -# Name: player7 -# DisplayName: Gray -# BasePalette: player -# Remap: gray.rem -# DisplayColor: 133,113,101 PaletteFromFile@chrome: Name: chrome Filename: temperat.pal diff --git a/mods/cnc/teal.rem b/mods/cnc/teal.rem new file mode 100644 index 0000000000..2b51f07c01 --- /dev/null +++ b/mods/cnc/teal.rem @@ -0,0 +1,16 @@ +176: 255,0,168,168 +177: 255,116,148,156 +178: 255,100,128,136 +179: 255,0,112,112 +180: 255,4,92,100 +181: 255,20,52,72 +182: 255,4,4,8 +183: 255,0,0,0 +184: 255,100,128,136 +185: 255,0,112,112 +186: 255,4,92,100 +187: 255,8,76,92 +188: 255,16,60,80 +189: 255,20,52,72 +190: 255,36,44,52 +191: 255,4,4,8 From 5cac032345ccce1b2728987310a26ecfad31d36d Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 26 Feb 2010 23:41:31 +1300 Subject: [PATCH 07/12] enabled more palette space; now there's ONE constant to change, too. --- OpenRa.Game/Graphics/HardwarePalette.cs | 4 ++-- OpenRa.Game/Graphics/Util.cs | 14 +------------- OpenRa.Game/PathSearch.cs | 14 +++++++++++++- mods/ra/rules.yaml | 24 ++++++++++++------------ shaders/chrome-shp.fx | 4 +--- shaders/world-shp.fx | 4 +--- 6 files changed, 30 insertions(+), 34 deletions(-) diff --git a/OpenRa.Game/Graphics/HardwarePalette.cs b/OpenRa.Game/Graphics/HardwarePalette.cs index eafc17b0c8..3317828581 100644 --- a/OpenRa.Game/Graphics/HardwarePalette.cs +++ b/OpenRa.Game/Graphics/HardwarePalette.cs @@ -28,7 +28,7 @@ namespace OpenRa.Graphics { class HardwarePalette : Sheet { - const int maxEntries = 16; + public const int MaxPalettes = 64; int allocated = 0; // We need to store the Palettes themselves for the remap palettes to work @@ -36,7 +36,7 @@ namespace OpenRa.Graphics static Dictionary palettes; static Dictionary indices; public HardwarePalette(Renderer renderer, Map map) - : base(renderer,new Size(256, maxEntries)) + : base(renderer,new Size(256, MaxPalettes)) { palettes = new Dictionary(); indices = new Dictionary(); diff --git a/OpenRa.Game/Graphics/Util.cs b/OpenRa.Game/Graphics/Util.cs index e8ee19c127..74c340e33a 100644 --- a/OpenRa.Game/Graphics/Util.cs +++ b/OpenRa.Game/Graphics/Util.cs @@ -52,23 +52,11 @@ namespace OpenRa.Graphics return result; } - public static readonly int2[] directions = - new int2[] { - new int2( -1, -1 ), - new int2( -1, 0 ), - new int2( -1, 1 ), - new int2( 0, -1 ), - new int2( 0, 1 ), - new int2( 1, -1 ), - new int2( 1, 0 ), - new int2( 1, 1 ), - }; - static float[] channelSelect = { 0.75f, 0.25f, -0.25f, -0.75f }; public static void FastCreateQuad(Vertex[] vertices, ushort[] indices, float2 o, Sprite r, int palette, int nv, int ni, float2 size) { - float2 attrib = new float2(palette / 16.0f, channelSelect[(int)r.channel]); + var attrib = new float2(palette / (float)HardwarePalette.MaxPalettes, channelSelect[(int)r.channel]); vertices[nv] = new Vertex(o, r.FastMapTextureCoords(0), attrib); diff --git a/OpenRa.Game/PathSearch.cs b/OpenRa.Game/PathSearch.cs index 3a0d8b95f9..7ddb1cfbae 100755 --- a/OpenRa.Game/PathSearch.cs +++ b/OpenRa.Game/PathSearch.cs @@ -67,7 +67,7 @@ namespace OpenRa if (thisCost == float.PositiveInfinity) return p.Location; - foreach( int2 d in Graphics.Util.directions ) + foreach( int2 d in directions ) { int2 newHere = p.Location + d; @@ -113,6 +113,18 @@ namespace OpenRa return p.Location; } + static readonly int2[] directions = + { + new int2( -1, -1 ), + new int2( -1, 0 ), + new int2( -1, 1 ), + new int2( 0, -1 ), + new int2( 0, 1 ), + new int2( 1, -1 ), + new int2( 1, 0 ), + new int2( 1, 1 ), + }; + public void AddInitialCell( World world, int2 location ) { if (!world.Map.IsInMap(location.X, location.Y)) diff --git a/mods/ra/rules.yaml b/mods/ra/rules.yaml index be513ffc77..542854bcb9 100644 --- a/mods/ra/rules.yaml +++ b/mods/ra/rules.yaml @@ -113,18 +113,18 @@ World: BasePalette: terrain Remap: salmon.rem DisplayColor: 153,76,53 -# PlayerColorPalette@player6: -# Name: player6 -# DisplayName: Green -# BasePalette: terrain -# Remap: green.rem -# DisplayColor: 76,101,60 -# PlayerColorPalette@player7: -# Name: player7 -# DisplayName: Gray -# BasePalette: terrain -# Remap: gray.rem -# DisplayColor: 133,113,101 + PlayerColorPalette@player6: + Name: player6 + DisplayName: Green + BasePalette: terrain + Remap: green.rem + DisplayColor: 76,101,60 + PlayerColorPalette@player7: + Name: player7 + DisplayName: Gray + BasePalette: terrain + Remap: gray.rem + DisplayColor: 133,113,101 PaletteFromFile@chrome: Name: chrome Filename: temperat.pal diff --git a/shaders/chrome-shp.fx b/shaders/chrome-shp.fx index d695ac4047..99d5cdb6b0 100644 --- a/shaders/chrome-shp.fx +++ b/shaders/chrome-shp.fx @@ -47,12 +47,10 @@ VertexOut Simple_vp(VertexIn v) { return o; } -const float2 texelOffset = float2( 0, 1.0f/32.0f ); - float4 Palette_fp(VertexOut f) : COLOR0 { float4 x = tex2D(DiffuseTexture, f.Tex0.xy); float2 p = float2( dot(x, f.ChannelMask), f.Tex0.z ); - return tex2D(Palette, p + texelOffset); + return tex2D(Palette, p); } technique low_quality { diff --git a/shaders/world-shp.fx b/shaders/world-shp.fx index f59685bcfb..14d67decfb 100644 --- a/shaders/world-shp.fx +++ b/shaders/world-shp.fx @@ -47,12 +47,10 @@ VertexOut Simple_vp(VertexIn v) { return o; } -const float2 texelOffset = float2( 0, 1.0f/32.0f ); - float4 Palette_fp(VertexOut f) : COLOR0 { float4 x = tex2D(DiffuseTexture, f.Tex0.xy); float2 p = float2( dot(x, f.ChannelMask), f.Tex0.z ); - return tex2D(Palette, p + texelOffset); + return tex2D(Palette, p); } technique low_quality { From 9652434a3e875ff4642fce30c43c36c0bced0048 Mon Sep 17 00:00:00 2001 From: pchote Date: Sat, 27 Feb 2010 01:38:00 +1300 Subject: [PATCH 08/12] Make walls work --- .../Traits/Render/RenderBuildingWall.cs | 89 +++++++++++++++++++ OpenRa.Game/OpenRa.Game.csproj | 4 +- OpenRa.Game/Traits/Wall.cs | 32 +++++++ mods/ra/rules.yaml | 7 +- mods/ra/sequences.xml | 4 +- 5 files changed, 130 insertions(+), 6 deletions(-) create mode 100644 OpenRA.Game/Traits/Render/RenderBuildingWall.cs create mode 100644 OpenRa.Game/Traits/Wall.cs diff --git a/OpenRA.Game/Traits/Render/RenderBuildingWall.cs b/OpenRA.Game/Traits/Render/RenderBuildingWall.cs new file mode 100644 index 0000000000..856e1452b1 --- /dev/null +++ b/OpenRA.Game/Traits/Render/RenderBuildingWall.cs @@ -0,0 +1,89 @@ +#region Copyright & License Information +/* + * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. + * This file is part of OpenRA. + * + * OpenRA is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenRA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenRA. If not, see . + */ +#endregion + +using System.Linq; + +namespace OpenRa.Traits +{ + class RenderBuildingWallInfo : RenderBuildingInfo + { + public override object Create(Actor self) { return new RenderBuildingWall(self); } + } + + class RenderBuildingWall : RenderBuilding + { + string seqName; + Actor self; + + public RenderBuildingWall(Actor self) + : base(self) + { + seqName = "idle"; + this.self = self; + } + + public override void Damaged(Actor self, AttackInfo e) + { + if (!e.DamageStateChanged) return; + + switch (e.DamageState) + { + case DamageState.Normal: + seqName = "idle"; + break; + case DamageState.Half: + seqName = "damaged-idle"; + Sound.Play("kaboom1.aud"); + break; + } + } + + public override void Tick(Actor self) + { + base.Tick(self); + + // TODO: This only needs updating when a wall is built or destroyed + int index = NearbyWalls( self.Location ); + + anim.PlayFetchIndex(seqName, () => index); + + } + bool IsWall( int x, int y) + { + return self.World.Queries.WithTrait().Any(a => (a.Actor.Info.Name == self.Info.Name && a.Actor.Location.X == x && a.Actor.Location.Y == y)); + } + + int NearbyWalls( int2 xy ) + { + int ret = 0; + + if( IsWall( xy.X, xy.Y - 1 ) ) + ret |= 1; + if( IsWall( xy.X + 1, xy.Y ) ) + ret |= 2; + if( IsWall( xy.X, xy.Y + 1 ) ) + ret |= 4; + if( IsWall( xy.X - 1, xy.Y ) ) + ret |= 8; + return ret; + } + + } +} diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 1e887ff951..892f8ab787 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -1,4 +1,4 @@ - + Debug @@ -263,6 +263,8 @@ + + diff --git a/OpenRa.Game/Traits/Wall.cs b/OpenRa.Game/Traits/Wall.cs new file mode 100644 index 0000000000..ec94fb0700 --- /dev/null +++ b/OpenRa.Game/Traits/Wall.cs @@ -0,0 +1,32 @@ +#region Copyright & License Information +/* + * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. + * This file is part of OpenRA. + * + * OpenRA is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenRA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenRA. If not, see . + */ +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using OpenRa.Effects; +using OpenRa.GameRules; +using OpenRa.Traits.Activities; + +namespace OpenRa.Traits +{ + public class WallInfo : StatelessTraitInfo {} + public class Wall {} +} diff --git a/mods/ra/rules.yaml b/mods/ra/rules.yaml index 81a0e3fe26..b1ea843c2f 100644 --- a/mods/ra/rules.yaml +++ b/mods/ra/rules.yaml @@ -2499,17 +2499,18 @@ BRIK: Buildable: TechLevel: 8 Prerequisites: fact - Owner: soviet + Owner: allies,soviet Cost: 100 Description: Concrete Wall LongDesc: Its a wall. Building: Power: 0 - Footprint: x - Dimensions: 1,1 Capturable: false Bib: no HP: 1 Armor: none Crewed: no Sight: 0 + Wall: + RenderBuildingWall: + -RenderBuilding: \ No newline at end of file diff --git a/mods/ra/sequences.xml b/mods/ra/sequences.xml index aaa14c95ec..ec16b56ff1 100644 --- a/mods/ra/sequences.xml +++ b/mods/ra/sequences.xml @@ -860,8 +860,8 @@ - - + + \ No newline at end of file From 6ab0fa8c1409ca6dede7fe9d5d23e5135f3f60e7 Mon Sep 17 00:00:00 2001 From: pchote Date: Sat, 27 Feb 2010 01:55:11 +1300 Subject: [PATCH 09/12] Add rules for the other walls --- mods/ra/defaults.yaml | 12 +++++++++ mods/ra/rules.yaml | 59 ++++++++++++++++++++++++++++++++++--------- mods/ra/sequences.xml | 37 +++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 12 deletions(-) diff --git a/mods/ra/defaults.yaml b/mods/ra/defaults.yaml index eaba4444d7..e4c7380350 100644 --- a/mods/ra/defaults.yaml +++ b/mods/ra/defaults.yaml @@ -45,3 +45,15 @@ Footprint: x RenderBuilding: +^Wall: + Category: Building + Building: + Dimensions: 1,1 + Footprint: x + Capturable: false + Bib: no + Crewed: no + Sight: 0 + Wall: + RenderBuildingWall: + diff --git a/mods/ra/rules.yaml b/mods/ra/rules.yaml index b1ea843c2f..d941c0f86f 100644 --- a/mods/ra/rules.yaml +++ b/mods/ra/rules.yaml @@ -2494,23 +2494,58 @@ MEDI: TakeCover: -AutoTarget: +SBAG: + Inherits: ^Wall + Buildable: + TechLevel: 2 + Prerequisites: fact + Owner: soviet + Cost: 25 + Description: Sandbag Wall + LongDesc: Stops infantry and blocks enemy fire.\n Can be crushed by tanks. + Building: + HP: 100 + Armor: none + BRIK: - Inherits: ^Building + Inherits: ^Wall Buildable: TechLevel: 8 Prerequisites: fact - Owner: allies,soviet + Owner: soviet Cost: 100 Description: Concrete Wall - LongDesc: Its a wall. + LongDesc: Stop units from passing and block enemy fire. Building: - Power: 0 - Capturable: false - Bib: no - HP: 1 + HP: 100 + Armor: none + +FENC: + Inherits: ^Wall + Buildable: + TechLevel: 2 + Prerequisites: fact + Owner: soviet + Cost: 25 + Description: Wire Fence + LongDesc: Stops infantry and blocks enemy fire.\n Can be crushed by tanks. + Building: + HP: 100 + Armor: none +CYCL: + Inherits: ^Wall + Building: + HP: 100 + Armor: none + +BARB: + Inherits: ^Wall + Building: + HP: 100 + Armor: none + +WOOD: + Inherits: ^Wall + Building: + HP: 100 Armor: none - Crewed: no - Sight: 0 - Wall: - RenderBuildingWall: - -RenderBuilding: \ No newline at end of file diff --git a/mods/ra/sequences.xml b/mods/ra/sequences.xml index ec16b56ff1..3f844a2c42 100644 --- a/mods/ra/sequences.xml +++ b/mods/ra/sequences.xml @@ -862,6 +862,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From bb9002aa61296f34d570a6c6ab6341c37e616942 Mon Sep 17 00:00:00 2001 From: pchote Date: Sat, 27 Feb 2010 02:04:03 +1300 Subject: [PATCH 10/12] Fix "blue sandbag" bug --- mods/ra/defaults.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ra/defaults.yaml b/mods/ra/defaults.yaml index e4c7380350..47876c35f4 100644 --- a/mods/ra/defaults.yaml +++ b/mods/ra/defaults.yaml @@ -56,4 +56,5 @@ Sight: 0 Wall: RenderBuildingWall: + Palette: terrain From 605ae8d4d504048b05b7a9bbc42377a10714038e Mon Sep 17 00:00:00 2001 From: pchote Date: Sat, 27 Feb 2010 02:53:13 +1300 Subject: [PATCH 11/12] Support multiple-damage states for walls (WTF Westwood: there are walls with 2, 3, and 4 damage states 0_o) --- .../Traits/Render/RenderBuildingWall.cs | 16 ++++++++- OpenRa.Game/Actor.cs | 18 +++++++--- OpenRa.Game/Traits/TraitsInterfaces.cs | 4 +-- mods/ra/defaults.yaml | 2 ++ mods/ra/rules.yaml | 34 +++++++++++-------- mods/ra/sequences.xml | 15 ++------ 6 files changed, 55 insertions(+), 34 deletions(-) diff --git a/OpenRA.Game/Traits/Render/RenderBuildingWall.cs b/OpenRA.Game/Traits/Render/RenderBuildingWall.cs index 856e1452b1..6dd2daa1e1 100644 --- a/OpenRA.Game/Traits/Render/RenderBuildingWall.cs +++ b/OpenRA.Game/Traits/Render/RenderBuildingWall.cs @@ -24,12 +24,14 @@ namespace OpenRa.Traits { class RenderBuildingWallInfo : RenderBuildingInfo { + public readonly int DamageStates = 2; public override object Create(Actor self) { return new RenderBuildingWall(self); } } class RenderBuildingWall : RenderBuilding { string seqName; + int damageStates; Actor self; public RenderBuildingWall(Actor self) @@ -37,8 +39,9 @@ namespace OpenRa.Traits { seqName = "idle"; this.self = self; + this.damageStates = self.Info.Traits.Get().DamageStates; } - + public override void Damaged(Actor self, AttackInfo e) { if (!e.DamageStateChanged) return; @@ -48,10 +51,21 @@ namespace OpenRa.Traits case DamageState.Normal: seqName = "idle"; break; + case DamageState.ThreeQuarter: + if (damageStates >= 4) + seqName = "minor-damaged-idle"; + break; case DamageState.Half: seqName = "damaged-idle"; Sound.Play("kaboom1.aud"); break; + case DamageState.Quarter: + if (damageStates >= 3) + { + seqName = "critical-idle"; + Sound.Play("kaboom1.aud"); + } + break; } } diff --git a/OpenRa.Game/Actor.cs b/OpenRa.Game/Actor.cs index 6dcd9e5f6d..e287229e80 100755 --- a/OpenRa.Game/Actor.cs +++ b/OpenRa.Game/Actor.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -144,9 +144,19 @@ namespace OpenRa public DamageState GetDamageState() { - if (Health <= 0) return DamageState.Dead; - var halfStrength = this.GetMaxHP() * Rules.General.ConditionYellow; - return Health < halfStrength ? DamageState.Half : DamageState.Normal; + if (Health <= 0) + return DamageState.Dead; + + if (Health < this.GetMaxHP() * Rules.General.ConditionRed) + return DamageState.Quarter; + + if (Health < this.GetMaxHP() * Rules.General.ConditionYellow) + return DamageState.Half; + + if (Health < this.GetMaxHP() * 0.75) + return DamageState.ThreeQuarter; + + return DamageState.Normal; } public void InflictDamage(Actor attacker, int damage, WarheadInfo warhead) diff --git a/OpenRa.Game/Traits/TraitsInterfaces.cs b/OpenRa.Game/Traits/TraitsInterfaces.cs index 97600f814b..b2660d2bc0 100644 --- a/OpenRa.Game/Traits/TraitsInterfaces.cs +++ b/OpenRa.Game/Traits/TraitsInterfaces.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -27,7 +27,7 @@ using OpenRa.Traits.Activities; namespace OpenRa.Traits { - public enum DamageState { Normal, Half, Dead }; + public enum DamageState { Normal, ThreeQuarter, Half, Quarter, Dead }; // depends on the order of pips in WorldRenderer.cs! public enum PipType { Transparent, Green, Yellow, Red, Gray }; diff --git a/mods/ra/defaults.yaml b/mods/ra/defaults.yaml index 47876c35f4..0c587dcd7f 100644 --- a/mods/ra/defaults.yaml +++ b/mods/ra/defaults.yaml @@ -55,6 +55,8 @@ Crewed: no Sight: 0 Wall: + Selectable: RenderBuildingWall: Palette: terrain + DamageStates: 2 diff --git a/mods/ra/rules.yaml b/mods/ra/rules.yaml index d941c0f86f..9a6e21d4f4 100644 --- a/mods/ra/rules.yaml +++ b/mods/ra/rules.yaml @@ -2499,7 +2499,7 @@ SBAG: Buildable: TechLevel: 2 Prerequisites: fact - Owner: soviet + Owner: allies Cost: 25 Description: Sandbag Wall LongDesc: Stops infantry and blocks enemy fire.\n Can be crushed by tanks. @@ -2507,19 +2507,6 @@ SBAG: HP: 100 Armor: none -BRIK: - Inherits: ^Wall - Buildable: - TechLevel: 8 - Prerequisites: fact - Owner: soviet - Cost: 100 - Description: Concrete Wall - LongDesc: Stop units from passing and block enemy fire. - Building: - HP: 100 - Armor: none - FENC: Inherits: ^Wall Buildable: @@ -2532,12 +2519,29 @@ FENC: Building: HP: 100 Armor: none + +BRIK: + Inherits: ^Wall + Buildable: + TechLevel: 8 + Prerequisites: fact + Owner: allies,soviet + Cost: 100 + Description: Concrete Wall + LongDesc: Stop units from passing and block enemy fire. + Building: + HP: 100 + Armor: none + RenderBuildingWall: + DamageStates: 4 + CYCL: Inherits: ^Wall Building: HP: 100 Armor: none - + RenderBuildingWall: + DamageStates: 3 BARB: Inherits: ^Wall Building: diff --git a/mods/ra/sequences.xml b/mods/ra/sequences.xml index 3f844a2c42..ca9069b1f1 100644 --- a/mods/ra/sequences.xml +++ b/mods/ra/sequences.xml @@ -861,44 +861,35 @@ - - + + - - - - - - + - - - - \ No newline at end of file From b77eb43ff6cd538913e7308c854544674abb2037 Mon Sep 17 00:00:00 2001 From: pchote Date: Sat, 27 Feb 2010 03:18:19 +1300 Subject: [PATCH 12/12] Support for buildings without make animations --- OpenRa.Game/Traits/Activities/Sell.cs | 4 ++-- OpenRa.Game/Traits/Render/RenderBuilding.cs | 11 +++++++---- mods/ra/defaults.yaml | 1 + mods/ra/sequences.xml | 6 ------ 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/OpenRa.Game/Traits/Activities/Sell.cs b/OpenRa.Game/Traits/Activities/Sell.cs index f4286273ba..0c74d5cd07 100644 --- a/OpenRa.Game/Traits/Activities/Sell.cs +++ b/OpenRa.Game/Traits/Activities/Sell.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -48,7 +48,7 @@ namespace OpenRa.Traits.Activities { if( !started ) { - framesRemaining = self.traits.Get().anim.GetSequence( "make" ).Length; + framesRemaining = (self.Info.Traits.Get().HasMakeAnimation) ? self.traits.Get().anim.GetSequence( "make" ).Length : 0; foreach( var ns in self.traits.WithInterface() ) ns.Selling( self ); diff --git a/OpenRa.Game/Traits/Render/RenderBuilding.cs b/OpenRa.Game/Traits/Render/RenderBuilding.cs index 32610e9744..cf6adf91ca 100644 --- a/OpenRa.Game/Traits/Render/RenderBuilding.cs +++ b/OpenRa.Game/Traits/Render/RenderBuilding.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -25,6 +25,7 @@ namespace OpenRa.Traits { public class RenderBuildingInfo : RenderSimpleInfo { + public readonly bool HasMakeAnimation = true; public override object Create(Actor self) { return new RenderBuilding(self);} } @@ -39,8 +40,8 @@ namespace OpenRa.Traits public RenderBuilding(Actor self, Func baseFacing) : base(self, baseFacing) - { - if( Game.skipMakeAnims ) + { + if( Game.skipMakeAnims || !self.Info.Traits.Get().HasMakeAnimation ) Complete( self ); else anim.PlayThen( "make", () => self.World.AddFrameEndTask( _ => Complete( self ) ) ); @@ -124,7 +125,9 @@ namespace OpenRa.Traits public void Selling( Actor self ) { - anim.PlayBackwardsThen( "make", null ); + if( !Game.skipMakeAnims && self.Info.Traits.Get().HasMakeAnimation ) + anim.PlayBackwardsThen( "make", null ); + Sound.PlayToPlayer(self.Owner, "cashturn.aud"); } diff --git a/mods/ra/defaults.yaml b/mods/ra/defaults.yaml index 0c587dcd7f..41d8b23895 100644 --- a/mods/ra/defaults.yaml +++ b/mods/ra/defaults.yaml @@ -57,6 +57,7 @@ Wall: Selectable: RenderBuildingWall: + HasMakeAnimation: false Palette: terrain DamageStates: 2 diff --git a/mods/ra/sequences.xml b/mods/ra/sequences.xml index ca9069b1f1..bfb1ceb239 100644 --- a/mods/ra/sequences.xml +++ b/mods/ra/sequences.xml @@ -864,32 +864,26 @@ - - - - - - \ No newline at end of file