public Globals(MpqFile file) { var stream = file.Open(); this.Header = new Header(stream); stream.Position += 8; this.ServerData = stream.ReadSerializedData <GlobalServerData>(); stream.Position += 4; this.I0 = stream.ReadValueS32(); //32 stream.Position += 12; this.StartLocationNames = new Dictionary <int, FileFormats.StartLocationName>(); foreach (var startLocation in stream.ReadSerializedData <StartLocationName>()) { StartLocationNames.Add(startLocation.I0, startLocation); } this.F0 = stream.ReadValueF32(); //56 this.F1 = stream.ReadValueF32(); //60 this.F2 = stream.ReadValueF32(); //64 this.F3 = stream.ReadValueF32(); //68 Colors = new RGBAColor[400]; //72 for (int i = 0; i < 400; i++) { Colors[i] = new RGBAColor(stream); } this.I1 = stream.ReadValueS32(); this.I2 = stream.ReadValueS32(); this.F4 = stream.ReadValueF32(); this.F5 = stream.ReadValueF32(); this.I3 = stream.ReadValueS32(); this.F6 = stream.ReadValueF32(); this.F7 = stream.ReadValueF32(); this.F8 = stream.ReadValueF32(); this.F9 = stream.ReadValueF32(); this.F10 = stream.ReadValueF32(); this.I4 = stream.ReadValueS32(); this.I6 = new int[4]; for (int i = 0; i < 4; i++) { this.I6[i] = stream.ReadValueS32(); } stream.Position += 4; this.BannerParams = new BannerParams(stream); this.I5 = stream.ReadValueS32(); this.I7 = stream.ReadValueS32(); this.I8 = stream.ReadValueS32(); this.I9 = stream.ReadValueS32(); this.F11 = stream.ReadValueF32(); this.F12 = stream.ReadValueF32(); this.F13 = stream.ReadValueF32(); this.F14 = stream.ReadValueF32(); this.F15 = stream.ReadValueF32(); this.F16 = stream.ReadValueF32(); this.F17 = stream.ReadValueF32(); this.F18 = stream.ReadValueF32(); stream.Close(); }
public Globals(MpqFile file) { var stream = file.Open(); this.Header = new Header(stream); this.TuningParams = new DifficultyTuningParams[4]; for (int i = 0; i < 4; i++) { this.TuningParams[i] = new DifficultyTuningParams(stream); } this.F0 = stream.ReadValueF32(); //140 this.F1 = stream.ReadValueF32(); //144 this.F2 = stream.ReadValueF32(); //148 this.I0 = stream.ReadValueS32(); //152 stream.Position += 12; this.ActorGroup = new Dictionary <int, FileFormats.ActorGroup>(); foreach (var group in stream.ReadSerializedData <ActorGroup>()) //166 { this.ActorGroup.Add(group.UHash, group); } this.I1 = stream.ReadValueS32(); //176 stream.Position += 12; this.StartLocationNames = new Dictionary <int, FileFormats.StartLocationName>(); foreach (var startLocation in stream.ReadSerializedData <StartLocationName>()) //168 { StartLocationNames.Add(startLocation.I0, startLocation); } stream.Position += 8; this.ScriptGlobalVars = stream.ReadSerializedData <GlobalScriptVariable>(); //208 this.F3 = stream.ReadValueF32(); //216 this.F4 = stream.ReadValueF32(); //220 this.F5 = stream.ReadValueF32(); //224 this.F6 = stream.ReadValueF32(); //228 this.F7 = stream.ReadValueF32(); //232 this.F33 = stream.ReadValueF32(); //236 this.F34 = stream.ReadValueF32(); //240 Colors = new RGBAColor[400]; //244 for (int i = 0; i < 400; i++) { Colors[i] = new RGBAColor(stream); } this.I2 = stream.ReadValueS32(); //1844 this.I3 = stream.ReadValueS32(); //1848 this.I4 = stream.ReadValueS32(); //1852 this.I5 = stream.ReadValueS32(); //1856 this.F8 = stream.ReadValueF32(); //1860 this.F9 = stream.ReadValueF32(); //1864 this.I6 = stream.ReadValueS32(); //1868 this.F10 = stream.ReadValueF32(); //1872 this.F11 = stream.ReadValueF32(); //1876 this.F12 = stream.ReadValueF32(); //1880 this.F13 = stream.ReadValueF32(); //1884 this.F14 = stream.ReadValueF32(); //1888 this.F15 = stream.ReadValueF32(); //1892 this.F16 = stream.ReadValueF32(); //1896 this.I7 = stream.ReadValueS32(); //1900 this.I8 = stream.ReadValueS32(); //1904 this.F17 = stream.ReadValueF32(); //1908 this.F18 = stream.ReadValueF32(); //1912 this.F19 = stream.ReadValueF32(); //1916 this.F20 = stream.ReadValueF32(); //1920 this.F21 = stream.ReadValueF32(); //1924 this.I9 = stream.ReadValueS32(); //1928 this.I10 = new int[4]; //1932 for (int i = 0; i < 4; i++) { this.I10[i] = stream.ReadValueS32(); } stream.Position += 4; this.BannerParams = new BannerParams(stream); //1952 this.I11 = stream.ReadValueS32(); //2184 this.I12 = stream.ReadValueS32(); //2188 this.I13 = stream.ReadValueS32(); //2192 this.I14 = stream.ReadValueS32(); //2196 this.I15 = stream.ReadValueS32(); //2200 this.F22 = stream.ReadValueF32(); //2204 this.F23 = stream.ReadValueF32(); //2208 this.F24 = stream.ReadValueF32(); //2212 this.F25 = stream.ReadValueF32(); //2216 this.F26 = stream.ReadValueF32(); //2220 this.F27 = stream.ReadValueF32(); //2224 this.F28 = stream.ReadValueF32(); //2228 this.F29 = stream.ReadValueF32(); //2232 this.F30 = stream.ReadValueF32(); //2236 this.F31 = stream.ReadValueF32(); //2240 this.F32 = stream.ReadValueF32(); //2244 stream.Close(); }