diff --git a/OpenRA.Game/Graphics/Sequence.cs b/OpenRA.Game/Graphics/Sequence.cs index 005c63f2dc..5e6d771448 100644 --- a/OpenRA.Game/Graphics/Sequence.cs +++ b/OpenRA.Game/Graphics/Sequence.cs @@ -30,6 +30,7 @@ namespace OpenRA.Graphics public readonly int ZOffset; public readonly int ShadowStart; public readonly int ShadowZOffset; + public readonly int[] Frames; public Sequence(string unit, string name, MiniYaml info) { @@ -39,7 +40,8 @@ namespace OpenRA.Graphics var offset = float2.Zero; var blendMode = BlendMode.Alpha; - Start = int.Parse(d["Start"].Value); + if (d.ContainsKey("Start")) + Start = int.Parse(d["Start"].Value); if (d.ContainsKey("Offset")) offset = FieldLoader.GetValue("Offset", d["Offset"].Value); @@ -79,7 +81,10 @@ namespace OpenRA.Graphics Tick = 40; if (d.ContainsKey("Transpose")) - transpose = bool.Parse(d["Transpose"].Value); + transpose = bool.Parse(d["Transpose"].Value); + + if (d.ContainsKey("Frames")) + Frames = Array.ConvertAll(d["Frames"].Value.Split(','), int.Parse); if (d.ContainsKey("ShadowStart")) ShadowStart = int.Parse(d["ShadowStart"].Value); @@ -136,9 +141,12 @@ namespace OpenRA.Graphics if (reverseFacings) f = (Facings - f) % Facings; - int i = transpose ? (frame % Length) * Facings + f : + var i = transpose ? (frame % Length) * Facings + f : (f * Stride) + (frame % Length); + if (Frames != null) + return sprites[Frames[i]]; + return sprites[start + i]; } } diff --git a/OpenRA.Mods.D2k/Widgets/Logic/D2kExtractGameFilesLogic.cs b/OpenRA.Mods.D2k/Widgets/Logic/D2kExtractGameFilesLogic.cs index 9fe313a59f..6c18e9e843 100644 --- a/OpenRA.Mods.D2k/Widgets/Logic/D2kExtractGameFilesLogic.cs +++ b/OpenRA.Mods.D2k/Widgets/Logic/D2kExtractGameFilesLogic.cs @@ -128,7 +128,6 @@ namespace OpenRA.Mods.D2k.Widgets.Logic new string[] { "--r8", pathToDataR8, pathToPalette, "2521", "2522", Path.Combine(pathToSHPs, "radara"), "--building" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2523", "2524", Path.Combine(pathToSHPs, "pwra"), "--building" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2525", "2526", Path.Combine(pathToSHPs, "barra"), "--building" }, - new string[] { "--r8", pathToDataR8, pathToPalette, "2527", "2558", Path.Combine(pathToSHPs, "walla"), "--wall" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2559", "2560", Path.Combine(pathToSHPs, "conyarda"), "--building" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2561", "2563", Path.Combine(pathToSHPs, "refa"), "--building" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2564", "2565", Path.Combine(pathToSHPs, "hightecha"), "--building" }, @@ -146,7 +145,6 @@ namespace OpenRA.Mods.D2k.Widgets.Logic new string[] { "--r8", pathToDataR8, pathToPalette, "2681", "2682", Path.Combine(pathToSHPs, "radarh"), "--building" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2683", "2684", Path.Combine(pathToSHPs, "pwrh"), "--building" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2685", "2686", Path.Combine(pathToSHPs, "barrh"), "--building" }, - new string[] { "--r8", pathToDataR8, pathToPalette, "2687", "2718", Path.Combine(pathToSHPs, "wallh"), "--wall" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2719", "2720", Path.Combine(pathToSHPs, "conyardh"), "--building" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2721", "2723", Path.Combine(pathToSHPs, "refh"), "--building" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2724", "2725", Path.Combine(pathToSHPs, "hightechh"), "--building" }, @@ -164,7 +162,6 @@ namespace OpenRA.Mods.D2k.Widgets.Logic new string[] { "--r8", pathToDataR8, pathToPalette, "2841", "2842", Path.Combine(pathToSHPs, "radaro"), "--building" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2843", "2844", Path.Combine(pathToSHPs, "pwro"), "--building" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2845", "2846", Path.Combine(pathToSHPs, "barro"), "--building" }, - new string[] { "--r8", pathToDataR8, pathToPalette, "2847", "2878", Path.Combine(pathToSHPs, "wallo"), "--wall" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2879", "2880", Path.Combine(pathToSHPs, "conyardo"), "--building" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2881", "2883", Path.Combine(pathToSHPs, "refo"), "--building" }, new string[] { "--r8", pathToDataR8, pathToPalette, "2884", "2885", Path.Combine(pathToSHPs, "hightecho"), "--building" }, @@ -452,7 +449,6 @@ namespace OpenRA.Mods.D2k.Widgets.Logic new string[] { "--shp", Path.Combine(pathToSHPs, "radara.png"), "96" }, new string[] { "--shp", Path.Combine(pathToSHPs, "pwra.png"), "64" }, new string[] { "--shp", Path.Combine(pathToSHPs, "barra.png"), "80" }, - new string[] { "--shp", Path.Combine(pathToSHPs, "walla.png"), "32" }, new string[] { "--shp", Path.Combine(pathToSHPs, "conyarda.png"), "96" }, new string[] { "--shp", Path.Combine(pathToSHPs, "refa.png"), "120" }, new string[] { "--shp", Path.Combine(pathToSHPs, "hightecha.png"), "96" }, @@ -469,7 +465,6 @@ namespace OpenRA.Mods.D2k.Widgets.Logic new string[] { "--shp", Path.Combine(pathToSHPs, "heavyh.png"), "96" }, new string[] { "--shp", Path.Combine(pathToSHPs, "radarh.png"), "96" }, new string[] { "--shp", Path.Combine(pathToSHPs, "pwrh.png"), "64" }, - new string[] { "--shp", Path.Combine(pathToSHPs, "wallh.png"), "32" }, new string[] { "--shp", Path.Combine(pathToSHPs, "barrh.png"), "64" }, new string[] { "--shp", Path.Combine(pathToSHPs, "conyardh.png"), "96" }, new string[] { "--shp", Path.Combine(pathToSHPs, "refh.png"), "120" }, @@ -488,7 +483,6 @@ namespace OpenRA.Mods.D2k.Widgets.Logic new string[] { "--shp", Path.Combine(pathToSHPs, "radaro.png"), "96" }, new string[] { "--shp", Path.Combine(pathToSHPs, "pwro.png"), "64" }, new string[] { "--shp", Path.Combine(pathToSHPs, "barro.png"), "64" }, - new string[] { "--shp", Path.Combine(pathToSHPs, "wallo.png"), "32" }, new string[] { "--shp", Path.Combine(pathToSHPs, "conyardo.png"), "96" }, new string[] { "--shp", Path.Combine(pathToSHPs, "refo.png"), "120" }, new string[] { "--shp", Path.Combine(pathToSHPs, "hightecho.png"), "96" }, diff --git a/OpenRA.Utility/Command.cs b/OpenRA.Utility/Command.cs index 9669609ebd..3675d4aa4c 100644 --- a/OpenRA.Utility/Command.cs +++ b/OpenRA.Utility/Command.cs @@ -230,33 +230,6 @@ namespace OpenRA.Utility frame = srcImage[f]; } } - else if (args.Contains("--wall")) - { - // complex resorting to RA/CnC compatible frame order - var d2kBrikFrameOrder = new int[] { 1, 4, 2, 12, 5, 6, 16, 9, 3, 13, 7, 8, 14, 10, 11, 15, 17, 20, 18, 28, 21, 22, 32, 25, 19, 29, 23, 24, 30, 26, 27, 31 }; - foreach (int o in d2kBrikFrameOrder) - { - var f = startFrame - 1 + o; - - frame = srcImage[f]; - - var offsetX = Math.Abs(frame.Offset.X); - var offsetY = frame.FrameSize.Height - Math.Abs(frame.Offset.Y); - Console.WriteLine("calculated OffsetX: {0}", offsetX); - Console.WriteLine("calculated OffsetY: {0}", offsetY); - - var data = bitmap.LockBits(new Rectangle(x + offsetX, 0 + offsetY, frame.Size.Width, frame.Size.Height), ImageLockMode.WriteOnly, - PixelFormat.Format8bppIndexed); - - for (var i = 0; i < frame.Size.Height; i++) - Marshal.Copy(frame.Image, i * frame.Size.Width, - new IntPtr(data.Scan0.ToInt64() + i * data.Stride), frame.Size.Width); - - bitmap.UnlockBits(data); - - x += frame.FrameSize.Width; - } - } else if (args.Contains("--tileset")) { int f = 0; diff --git a/OpenRA.Utility/Program.cs b/OpenRA.Utility/Program.cs index 17660cc513..f5ab0b5ada 100644 --- a/OpenRA.Utility/Program.cs +++ b/OpenRA.Utility/Program.cs @@ -64,7 +64,7 @@ namespace OpenRA.Utility Console.WriteLine(" --extract MOD[,MOD]* FILES [--userdir] Extract files from mod packages to the current (or user) directory"); Console.WriteLine(" --tmp-png MOD[,MOD]* THEATER FILES Extract terrain tiles to PNG"); Console.WriteLine(" --remap SRCMOD:PAL DESTMOD:PAL SRCSHP DESTSHP Remap SHPs to another palette"); - Console.WriteLine(" --r8 R8FILE PALETTE START END FILENAME [--noshadow] [--infrantry] [--vehicle] [--projectile] [--building] [--wall] [--tileset] Convert Dune 2000 DATA.R8 to PNGs choosing start- and endframe as well as type for correct offset to append multiple frames to one PNG named by filename optionally removing the shadow."); + Console.WriteLine(" --r8 R8FILE PALETTE START END FILENAME [--noshadow] [--infrantry] [--vehicle] [--projectile] [--building] [--tileset] Convert Dune 2000 DATA.R8 to PNGs choosing start- and endframe as well as type for correct offset to append multiple frames to one PNG named by filename optionally removing the shadow."); Console.WriteLine(" --transpose SRCSHP DESTSHP START N M [START N M ...] Transpose the N*M block of frames starting at START."); Console.WriteLine(" --docs MOD Generate trait documentation in MarkDown format."); Console.WriteLine(" --map-hash MAPFILE Generate hash of specified oramap file."); diff --git a/mods/d2k/sequences/structures.yaml b/mods/d2k/sequences/structures.yaml index 96f71aea6e..7495679c2f 100644 --- a/mods/d2k/sequences/structures.yaml +++ b/mods/d2k/sequences/structures.yaml @@ -1,16 +1,56 @@ walla: - idle: - Start: 0 + idle: DATA.R8 + Frames: 2527, 2530, 2528, 2538, 2531, 2532, 2542, 2535, 2529, 2539, 2533, 2534, 2540, 2536, 2537, 2541 Length: 16 - scratched-idle: - Start: 0 + Offset: -16,16 + scratched-idle: DATA.R8 + Frames: 2527, 2530, 2528, 2538, 2531, 2532, 2542, 2535, 2529, 2539, 2533, 2534, 2540, 2536, 2537, 2541 Length: 16 - damaged-idle: - Start: 16 + Offset: -16,16 + damaged-idle: DATA.R8 + Frames: 2543, 2546, 2544, 2554, 2547, 2548, 2558, 2551, 2545, 2555, 2549, 2550, 2556, 2552, 2553, 2557 Length: 16 - critical-idle: - Start: 16 + Offset: -16,16 + critical-idle: DATA.R8 + Frames: 2543, 2546, 2544, 2554, 2547, 2548, 2558, 2551, 2545, 2555, 2549, 2550, 2556, 2552, 2553, 2557 Length: 16 + Offset: -16,16 + +wallh: + idle: DATA.R8 + Frames: 2687, 2690, 2688, 2698, 2691, 2692, 2702, 2695, 2689, 2699, 2693, 2694, 2700, 2696, 2697, 2701 + Length: 16 + Offset: -16,16 + scratched-idle: DATA.R8 + Frames: 2687, 2690, 2688, 2698, 2691, 2692, 2702, 2695, 2689, 2699, 2693, 2694, 2700, 2696, 2697, 2701 + Length: 16 + Offset: -16,16 + damaged-idle: DATA.R8 + Frames: 2703, 2706, 2704, 2714, 2707, 2708, 2718, 2711, 2705, 2715, 2709, 2710, 2716, 2712, 2713, 2717 + Length: 16 + Offset: -16,16 + critical-idle: DATA.R8 + Frames: 2703, 2706, 2704, 2714, 2707, 2708, 2718, 2711, 2705, 2715, 2709, 2710, 2716, 2712, 2713, 2717 + Length: 16 + Offset: -16,16 + +wallo: + idle: DATA.R8 + Frames: 2847, 2850, 2848, 2858, 2851, 2852, 2862, 2855, 2849, 2859, 2853, 2854, 2860, 2856, 2857, 2861 + Length: 16 + Offset: -16,16 + scratched-idle: DATA.R8 + Frames: 2847, 2850, 2848, 2858, 2851, 2852, 2862, 2855, 2849, 2859, 2853, 2854, 2860, 2856, 2857, 2861 + Length: 16 + Offset: -16,16 + damaged-idle: DATA.R8 + Frames: 2863, 2866, 2864, 2874, 2867, 2868, 2878, 2871, 2865, 2875, 2869, 2870, 2876, 2872, 2873, 2877 + Length: 16 + Offset: -16,16 + critical-idle: DATA.R8 + Frames: 2863, 2866, 2864, 2874, 2867, 2868, 2878, 2871, 2865, 2875, 2869, 2870, 2876, 2872, 2873, 2877 + Length: 16 + Offset: -16,16 guntowera: idle: