public UnitInfo(Stream file,VarCollection v):this() { StreamReader sr = new StreamReader(file); VarCollection vars = new VarCollection(sr,v); KeyVal line=vars.ReadLine(); if(line==null) return; groundImages = line.Rest; while((line=vars.ReadLine())!=null) { if(line.Keyword=="unit") { string name = line.Rest; line = vars.ReadLine(); if(line.Keyword=="type") { int type = int.Parse(line.Rest); switch(type) { case 0: units[name] = new Type0Descriptor(name,sr,vars); break; case 1: units[name] = new Type1Descriptor(name,sr,vars); break; case 2: units[name] = new Type2Descriptor(name,sr,vars); break; case 3: units[name] = new Type3Descriptor(name,sr,vars); break; case 4: units[name] = new Type4Descriptor(name,sr,vars); break; case 5: units[name] = new Type5Descriptor(name,sr,vars); break; case 6: units[name] = new Type6Descriptor(name,sr,vars); break; case 7: units[name] = new Type7Descriptor(name,sr,vars); break; } } } else { xConsole.AddLine("Unknown keyword parsing unit file(1): "+line.Keyword+"->"+line.Rest); } } sr.Close(); }
public Type0File(Type0Descriptor desc,int numImages,int offset):base(desc) { if(desc!=null) this.offset=desc.YOffset; else this.offset=offset; torso = new BodyPart(new int[]{32,33,34,35,36,37,38,39}); int i=16; legs = new BodyPart(new int[]{i,i+1,i+2,i+3,i+4,i+5,i+6,i+7}, new int[,]{{i+40,i+41,i+42,i+43,i+44,i+45,i+46,i+47}, {i+64,i+65,i+66,i+67,i+68,i+69,i+70,i+7}, {i+88,i+89,i+90,i+91,i+92,i+93,i+94,i+95}, {i+112,i+113,i+114,i+115,i+116,i+117,i+118,i+119}, {i+136,i+137,i+138,i+139,i+140,i+141,i+142,i+143}, {i+160,i+161,i+162,i+163,i+164,i+165,i+166,i+167}, {i+184,i+185,i+186,i+187,i+188,i+189,i+190,i+191}, {i+208,i+209,i+210,i+211,i+212,i+213,i+214,i+215}}); i=0; leftArm = new BodyPart(new int[]{i,i+1,i+2,i+3,i+4,i+5,i+6,i+7}, new int[,]{{i+40,i+41,i+42,i+43,i+44,i+45,i+46,i+47}, {i+64,i+65,i+66,i+67,i+68,i+69,i+70,i+71}, {i+88,i+89,i+90,i+91,i+92,i+93,i+94,i+95}, {i+112,i+113,i+114,i+115,i+116,i+117,i+118,i+119}, {i+136,i+137,i+138,i+139,i+140,i+141,i+142,i+143}, {i+160,i+161,i+162,i+163,i+164,i+165,i+166,i+167}, {i+184,i+185,i+186,i+187,i+188,i+189,i+190,i+191}, {i+208,i+209,i+210,i+211,i+212,i+213,i+214,i+215}}); i=8; rightArm = new BodyPart(new int[]{i,i+1,i+2,i+3,i+4,i+5,i+6,i+7}, new int[,]{{i+40,i+41,i+42,i+43,i+44,i+45,i+46,i+47}, {i+64,i+65,i+66,i+67,i+68,i+69,i+70,i+71}, {i+88,i+89,i+90,i+91,i+92,i+93,i+94,i+95}, {i+112,i+113,i+114,i+115,i+116,i+117,i+118,i+119}, {i+136,i+137,i+138,i+139,i+140,i+141,i+142,i+143}, {i+160,i+161,i+162,i+163,i+164,i+165,i+166,i+167}, {i+184,i+185,i+186,i+187,i+188,i+189,i+190,i+191}, {i+208,i+209,i+210,i+211,i+212,i+213,i+214,i+215}}); rightArmed1 = new BodyPart(new int[]{248,249,250,251,252,253,254,255}); rightArmed2 = new BodyPart(new int[]{240,241,242,243,244,245,246,247}); leftArmed2 = new BodyPart(new int[]{232,233,234,235,236,237,238,239}); deathImages = new int[numImages-256]; for(i=0;i<deathImages.Length;i++) deathImages[i] = 256+i; }
public Type0File(Type0Descriptor desc,int numImages):this(desc,numImages,-5){}
public Type0File(Type0Descriptor desc, int numImages, int offset) : base(desc) { if (desc != null) { this.offset = desc.YOffset; } else { this.offset = offset; } torso = new BodyPart(new int[] { 32, 33, 34, 35, 36, 37, 38, 39 }); int i = 16; legs = new BodyPart(new int[] { i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7 }, new int[, ] { { i + 40, i + 41, i + 42, i + 43, i + 44, i + 45, i + 46, i + 47 }, { i + 64, i + 65, i + 66, i + 67, i + 68, i + 69, i + 70, i + 7 }, { i + 88, i + 89, i + 90, i + 91, i + 92, i + 93, i + 94, i + 95 }, { i + 112, i + 113, i + 114, i + 115, i + 116, i + 117, i + 118, i + 119 }, { i + 136, i + 137, i + 138, i + 139, i + 140, i + 141, i + 142, i + 143 }, { i + 160, i + 161, i + 162, i + 163, i + 164, i + 165, i + 166, i + 167 }, { i + 184, i + 185, i + 186, i + 187, i + 188, i + 189, i + 190, i + 191 }, { i + 208, i + 209, i + 210, i + 211, i + 212, i + 213, i + 214, i + 215 } }); i = 0; leftArm = new BodyPart(new int[] { i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7 }, new int[, ] { { i + 40, i + 41, i + 42, i + 43, i + 44, i + 45, i + 46, i + 47 }, { i + 64, i + 65, i + 66, i + 67, i + 68, i + 69, i + 70, i + 71 }, { i + 88, i + 89, i + 90, i + 91, i + 92, i + 93, i + 94, i + 95 }, { i + 112, i + 113, i + 114, i + 115, i + 116, i + 117, i + 118, i + 119 }, { i + 136, i + 137, i + 138, i + 139, i + 140, i + 141, i + 142, i + 143 }, { i + 160, i + 161, i + 162, i + 163, i + 164, i + 165, i + 166, i + 167 }, { i + 184, i + 185, i + 186, i + 187, i + 188, i + 189, i + 190, i + 191 }, { i + 208, i + 209, i + 210, i + 211, i + 212, i + 213, i + 214, i + 215 } }); i = 8; rightArm = new BodyPart(new int[] { i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7 }, new int[, ] { { i + 40, i + 41, i + 42, i + 43, i + 44, i + 45, i + 46, i + 47 }, { i + 64, i + 65, i + 66, i + 67, i + 68, i + 69, i + 70, i + 71 }, { i + 88, i + 89, i + 90, i + 91, i + 92, i + 93, i + 94, i + 95 }, { i + 112, i + 113, i + 114, i + 115, i + 116, i + 117, i + 118, i + 119 }, { i + 136, i + 137, i + 138, i + 139, i + 140, i + 141, i + 142, i + 143 }, { i + 160, i + 161, i + 162, i + 163, i + 164, i + 165, i + 166, i + 167 }, { i + 184, i + 185, i + 186, i + 187, i + 188, i + 189, i + 190, i + 191 }, { i + 208, i + 209, i + 210, i + 211, i + 212, i + 213, i + 214, i + 215 } }); rightArmed1 = new BodyPart(new int[] { 248, 249, 250, 251, 252, 253, 254, 255 }); rightArmed2 = new BodyPart(new int[] { 240, 241, 242, 243, 244, 245, 246, 247 }); leftArmed2 = new BodyPart(new int[] { 232, 233, 234, 235, 236, 237, 238, 239 }); deathImages = new int[numImages - 256]; for (i = 0; i < deathImages.Length; i++) { deathImages[i] = 256 + i; } }
public Type0File(Type0Descriptor desc, int numImages) : this(desc, numImages, -5) { }
public UnitInfo(Stream file, VarCollection v) : this() { StreamReader sr = new StreamReader(file); VarCollection vars = new VarCollection(sr, v); KeyVal line = vars.ReadLine(); if (line == null) { return; } groundImages = line.Rest; while ((line = vars.ReadLine()) != null) { if (line.Keyword == "unit") { string name = line.Rest; line = vars.ReadLine(); if (line.Keyword == "type") { int type = int.Parse(line.Rest); switch (type) { case 0: units[name] = new Type0Descriptor(name, sr, vars); break; case 1: units[name] = new Type1Descriptor(name, sr, vars); break; case 2: units[name] = new Type2Descriptor(name, sr, vars); break; case 3: units[name] = new Type3Descriptor(name, sr, vars); break; case 4: units[name] = new Type4Descriptor(name, sr, vars); break; case 5: units[name] = new Type5Descriptor(name, sr, vars); break; case 6: units[name] = new Type6Descriptor(name, sr, vars); break; case 7: units[name] = new Type7Descriptor(name, sr, vars); break; } } } else { xConsole.AddLine("Unknown keyword parsing unit file(1): " + line.Keyword + "->" + line.Rest); } } sr.Close(); }