From a5627f30db565baaf4c0d93f6aeb426e7dcb4b67 Mon Sep 17 00:00:00 2001 From: chrisf Date: Tue, 10 Jul 2007 03:16:09 +0000 Subject: [PATCH] git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1146 993157c7-ee19-0410-b2c4-bb4e9862e678 --- OpenRa.Game/MainWindow.cs | 42 ++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/OpenRa.Game/MainWindow.cs b/OpenRa.Game/MainWindow.cs index 695c5440c0..c913a1cce2 100644 --- a/OpenRa.Game/MainWindow.cs +++ b/OpenRa.Game/MainWindow.cs @@ -207,6 +207,8 @@ namespace OpenRa.Game return ok ? enumerator.Current : default(T); } + int n = 1; + void Frame() { Clock.StartFrame(); @@ -221,7 +223,8 @@ namespace OpenRa.Game effect.SetValue(scroll, scrollPos); - foreach (KeyValuePair batch in drawBatches) + KeyValuePair batch = Nth(drawBatches, n); + //foreach (KeyValuePair batch in drawBatches) { effect.SetTexture(texture, batch.Key.texture); effect.Commit(); @@ -249,33 +252,26 @@ namespace OpenRa.Game if (e.KeyCode == Keys.C) Clock.Reset(); + + if (e.KeyCode == Keys.A) + n++; + + if (e.KeyCode == Keys.Z) + if (--n < 0) + n = 0; } TileSet LoadTileSet(Map currentMap) { - switch (currentMap.Theater.ToLowerInvariant()) - { - case "temperate": - pal = new Palette(File.OpenRead("../../../temperat.pal")); - TileMix = new Package("../../../temperat.mix"); - TileSuffix = ".tem"; - break; - case "snow": - pal = new Palette(File.OpenRead("../../../snow.pal")); - TileMix = new Package("../../../snow.mix"); - TileSuffix = ".sno"; - break; - case "interior": - pal = new Palette(File.OpenRead("../../../interior.pal")); - TileMix = new Package("../../../interior.mix"); - TileSuffix = ".int"; - break; - default: - throw new NotImplementedException(); - } + string theaterName = currentMap.Theater; + if (theaterName.Length > 8) + theaterName = theaterName.Substring(0, 8); + + pal = new Palette(File.OpenRead("../../../" + theaterName + ".pal")); + TileMix = new Package("../../../" + theaterName + ".mix"); + TileSuffix = "." + theaterName.Substring(0, 3); + return new TileSet(TileMix, TileSuffix, pal); } - - } }