Example #1
0
 public bool CompatibleWith(TilesetSize other)
 {
     if (this.tile.Width == other.tile.Width)
         return this.tile.Height == other.tile.Height;
     else
         return false;
 }
Example #2
0
 public ConfigInfos(string config, TilesetSize finalSize, ConfigInfos defaultInfos)
 {
     this.extractSize(config, defaultInfos.size);
     this.extraPatchInfos(config, finalSize);
     if (this.infos.Count != 0)
         return;
     this.infos = defaultInfos.infos;
 }
Example #3
0
 public ConfigPatchInfo(string command, int srcX, int srcY, int Width, int Height, int dstX, int dstY, TilesetSize srcSize, TilesetSize dstSize)
 {
     if (srcX < 0 || srcX + Width > srcSize.tileset.Width || (srcY < 0 || srcY + Height > srcSize.tileset.Height) || (dstX < 0 || dstX + Width > dstSize.tileset.Width || (dstY < 0 || dstY + Height > dstSize.tileset.Height)))
         throw new Exception();
     this.command = command.ToLower();
     this.srcArea = new Rectangle(srcX * srcSize.tile.Width, srcY * srcSize.tile.Height, Width * srcSize.tile.Width, Height * srcSize.tile.Height);
     this.dstArea = new Rectangle(dstX * dstSize.tile.Width, dstY * dstSize.tile.Height, Width * dstSize.tile.Width, Height * dstSize.tile.Height);
 }
Example #4
0
 public static ConfigInfos getDefaultInfos(TilesetSize finalSize)
 {
     if (ConfigInfos.ConfigDefaultInfos == null)
         ConfigInfos.ConfigDefaultInfos = new ConfigInfos(new List<ConfigPatchInfo>()
     {
       new ConfigPatchInfo("filter", 0, 0, 16, 16, 0, 0, finalSize, finalSize)
     }, finalSize);
     return ConfigInfos.ConfigDefaultInfos;
 }
Example #5
0
 public static ConfigInfos getWallInfos(TilesetSize finalSize)
 {
     if (ConfigInfos.ConfigWallInfos == null)
         ConfigInfos.ConfigWallInfos = new ConfigInfos(new List<ConfigPatchInfo>()
     {
       new ConfigPatchInfo("filter", 7, 11, 8, 2, 7, 11, finalSize, finalSize),
       new ConfigPatchInfo("filter", 3, 13, 4, 1, 3, 13, finalSize, finalSize)
     }, finalSize);
     return ConfigInfos.ConfigWallInfos;
 }
Example #6
0
 public TilesetPatch(string config, Bitmap bitmap, Bitmap filter, TilesetSize finalSize, ConfigInfos defaultConfigInfos)
 {
     ConfigInfos configInfos = new ConfigInfos(config, finalSize, defaultConfigInfos);
     this.chunklist = new List<TilesetPatchChunk>();
     foreach (ConfigPatchInfo configPatchInfo in (IEnumerable<ConfigPatchInfo>)configInfos.infos) {
         try {
             this.chunklist.Add(new TilesetPatchChunk(configPatchInfo, bitmap, filter));
         } catch {
         }
     }
 }
Example #7
0
 public static ConfigInfos getRoughWallInfos(TilesetSize finalSize)
 {
     if (ConfigInfos.ConfigRoughWallInfos == null)
         ConfigInfos.ConfigRoughWallInfos = new ConfigInfos(new List<ConfigPatchInfo>()
     {
       new ConfigPatchInfo("ground", 3, 8, 4, 1, 3, 8, finalSize, finalSize),
       new ConfigPatchInfo("ground", 8, 8, 4, 1, 8, 8, finalSize, finalSize),
       new ConfigPatchInfo("ground", 12, 9, 2, 1, 12, 9, finalSize, finalSize),
       new ConfigPatchInfo("ground", 9, 10, 4, 1, 9, 10, finalSize, finalSize)
     }, finalSize);
     return ConfigInfos.ConfigRoughWallInfos;
 }
Example #8
0
 public TilesetSize(string text, TilesetSize baseTilesetSize)
 {
     if (text != null) {
         Match match = TilesetSize.regexDimEntry.Match(text);
         if (match.Success && match.Groups.Count >= 3) {
             CaptureCollection captures = match.Groups[2].Captures;
             if (captures.Count == 4) {
                 try {
                     this.tileset = new Size(Convert.ToInt32(captures[0].Value), Convert.ToInt32(captures[1].Value));
                     this.tile = new Size(Convert.ToInt32(captures[2].Value), Convert.ToInt32(captures[3].Value));
                     this.bitmap = new Size(this.tile.Width * this.tileset.Width, this.tile.Height * this.tileset.Height);
                     return;
                 } catch {
                 }
             }
         }
     }
     this.tileset = new Size(baseTilesetSize.tile.Width, baseTilesetSize.tile.Height);
     this.tile = new Size(baseTilesetSize.tile.Width, baseTilesetSize.tile.Height);
     this.bitmap = new Size(this.tile.Width * this.tileset.Width, this.tile.Height * this.tileset.Height);
 }
Example #9
0
 public TilesetSize(int tilesetWidth, int tilesetHeight, TilesetSize baseTilesetSize)
 {
     this.tileset = new Size(tilesetWidth, tilesetHeight);
     this.tile = new Size(baseTilesetSize.tile.Width, baseTilesetSize.tile.Height);
     this.bitmap = new Size(this.tile.Width * this.tileset.Width, this.tile.Height * this.tileset.Height);
 }
Example #10
0
 public void extraPatchInfos(string config, TilesetSize finalSize)
 {
     List<ConfigPatchInfo> list = new List<ConfigPatchInfo>();
     if (config != null) {
         try {
             MatchCollection matchCollection = ConfigInfos.regexTileEntry.Matches(config);
             for (int index = 0; index < matchCollection.Count; ++index) {
                 Match match = matchCollection[index];
                 if (match.Success && match.Groups.Count >= 3) {
                     CaptureCollection captures = match.Groups[2].Captures;
                     if (captures.Count >= 3) {
                         if (captures.Count == 3) {
                             try {
                                 list.Add(new ConfigPatchInfo(captures[0].Value.ToLower(), Convert.ToInt32(captures[1].Value), Convert.ToInt32(captures[2].Value), 1, 1, Convert.ToInt32(captures[1].Value), Convert.ToInt32(captures[2].Value), this.size, finalSize));
                             } catch {
                             }
                         } else if (captures.Count == 5) {
                             try {
                                 list.Add(new ConfigPatchInfo(captures[0].Value.ToLower(), Convert.ToInt32(captures[1].Value), Convert.ToInt32(captures[2].Value), Convert.ToInt32(captures[3].Value), Convert.ToInt32(captures[4].Value), Convert.ToInt32(captures[1].Value), Convert.ToInt32(captures[2].Value), this.size, finalSize));
                             } catch {
                             }
                         } else if (captures.Count == 6) {
                             if (!(captures[3].Value.ToLower() != "to")) {
                                 try {
                                     list.Add(new ConfigPatchInfo(captures[0].Value.ToLower(), Convert.ToInt32(captures[1].Value), Convert.ToInt32(captures[2].Value), 1, 1, Convert.ToInt32(captures[4].Value), Convert.ToInt32(captures[5].Value), this.size, finalSize));
                                 } catch {
                                 }
                             }
                         } else if (captures.Count == 8) {
                             if (!(captures[5].Value.ToLower() != "to")) {
                                 try {
                                     list.Add(new ConfigPatchInfo(captures[0].Value.ToLower(), Convert.ToInt32(captures[1].Value), Convert.ToInt32(captures[2].Value), Convert.ToInt32(captures[3].Value), Convert.ToInt32(captures[4].Value), Convert.ToInt32(captures[6].Value), Convert.ToInt32(captures[7].Value), this.size, finalSize));
                                 } catch {
                                 }
                             }
                         }
                     }
                 }
             }
         } catch {
         }
     }
     this.infos = (ICollection<ConfigPatchInfo>)list.AsReadOnly();
 }
Example #11
0
 public ConfigInfos(string config, TilesetSize finalSize)
 {
     this.extractSize(config, finalSize);
     this.extraPatchInfos(config, finalSize);
 }
Example #12
0
 public ConfigInfos(List<ConfigPatchInfo> infos, TilesetSize finalSize)
 {
     this.size = new TilesetSize(finalSize);
     this.infos = (ICollection<ConfigPatchInfo>)infos.AsReadOnly();
 }
Example #13
0
 private void extractSize(string config, TilesetSize defaultSize)
 {
     if (config != null) {
         Match match = ConfigInfos.regexDimEntry.Match(config);
         if (match.Success && match.Groups.Count >= 3) {
             CaptureCollection captures = match.Groups[2].Captures;
             try {
                 if (captures.Count == 2) {
                     this.size = new TilesetSize(Convert.ToInt32(captures[0].Value), Convert.ToInt32(captures[1].Value), defaultSize);
                     return;
                 } else if (captures.Count == 4) {
                     this.size = new TilesetSize(Convert.ToInt32(captures[0].Value), Convert.ToInt32(captures[1].Value), Convert.ToInt32(captures[2].Value), Convert.ToInt32(captures[3].Value));
                     return;
                 }
             } catch {
             }
         }
     }
     this.size = new TilesetSize(defaultSize);
 }