public World(MpqFile file) { var stream = file.Open(); this.Header = new Header(stream); this.Bool0 = (stream.ReadValueS32() != 0); this.Int1 = stream.ReadValueS32(); this.Int2 = stream.ReadValueS32(); this.DRLGParams = stream.ReadSerializedItem <DRLGParams>(); // I'm not sure if we can have a list of drlgparams. (then should be calling it with pointer.Size/120) /raist stream.Position += (2 * 4); this.SceneParams = stream.ReadSerializedItem <SceneParams>(); // I'm not sure if we can have a list of drlgparams. (then should be calling it with pointer.Size/24) /raist stream.Position += (2 * 4); this.MarkerSets = stream.ReadSerializedInts(); stream.Position += (14 * 4); this.Environment = new Environment(stream); stream.Position += 4; LabelRuleSet = new LabelRuleSet(stream); this.Int4 = stream.ReadValueS32(); stream.Position += 4; this.SceneClusterSet = new SceneClusterSet(stream); for (int i = 0; i < SNONavMeshFunctions.Length; i++) { SNONavMeshFunctions[i] = stream.ReadValueS32(); } stream.Position += 4; Float0 = stream.ReadValueF32(); Int5 = stream.ReadValueS32(); SNOScript = stream.ReadValueS32(); Int6 = stream.ReadValueS32(); stream.Close(); }
public World(MpqFile file) { var stream = file.Open(); this.Header = new Header(stream); this.Bool0 = (stream.ReadValueS32() != 0); this.Int1 = stream.ReadValueS32(); this.Int2 = stream.ReadValueS32(); this.DRLGParams = stream.ReadSerializedItem<DRLGParams>(); // I'm not sure if we can have a list of drlgparams. (then should be calling it with pointer.Size/120) /raist stream.Position += (2 * 4); this.SceneParams = stream.ReadSerializedItem<SceneParams>(); // I'm not sure if we can have a list of drlgparams. (then should be calling it with pointer.Size/24) /raist stream.Position += (2 * 4); this.MarkerSets = stream.ReadSerializedInts(); stream.Position += (14 * 4); this.Environment = new Environment(stream); stream.Position += 4; LabelRuleSet = new LabelRuleSet(stream); this.Int4 = stream.ReadValueS32(); stream.Position += 4; this.SceneClusterSet = new SceneClusterSet(stream); for (int i = 0; i < SNONavMeshFunctions.Length; i++) { SNONavMeshFunctions[i] = stream.ReadValueS32(); } stream.Position += 4; Float0 = stream.ReadValueF32(); Int5 = stream.ReadValueS32(); SNOScript = stream.ReadValueS32(); Int6 = stream.ReadValueS32(); stream.Close(); }
/// <summary> /// Processes the commands for generating world /// </summary> /// <param name="drlgParams"></param> /// <param name="worldData"></param> /// <param name="levelIndex"></param> private static void ProcessCommands(DRLGParams drlgParams, Mooege.Common.MPQ.FileFormats.World worldData, int levelIndex) { //Process commands foreach (var command in drlgParams.Commands) { //Adds information about level if (command.CommandType == (int)CommandType.Group) { // command.TagMap //{Mooege.Core.GS.Common.Types.TagMap.TagMap} // _tagMapEntries: Count = 6 // TagMapEntries: Count = 6 // TagMapSize: 0 //command.TagMap.TagMapEntries //Count = 6 // [0]: {851986 = -1} // [1]: {1015841 = 1} // [2]: {851987 = -1} // [3]: {851993 = -1} // [4]: {1015822 = 0} // [5]: {851983 = 19780} //19780 LevelArea A1_trDun_Level01 //hardcode this now until proper tagmap implementation is done foreach (var chunk in worldData.SceneParams.SceneChunks) { if (command.TagMap.ContainsKey(DRLGCommandKeys.Group.Level)) chunk.SceneSpecification.SNOLevelAreas[levelIndex] = command.TagMap[DRLGCommandKeys.Group.Level].Id; } } if (command.CommandType == (int)CommandType.AddExit) { //drlgparam.Commands[6].TagMap.TagMapEntries //[0]: {852000 = -1} Type SNO (2) //[1]: {851984 = 60713} Type SNO (2) [20:16] (snobot) [1] 60713 Worlds trDun_Cain_Intro, //[2]: {1020032 = 1} (0) //[3]: {852050 = 0} //Starting location? ID (7) //[4]: {1015841 = 1} (0) //[5]: {852051 = 172} //Destination Actor Tag (7) //[6]: {1015814 = 0} (0) //[7]: {854612 = -1} Type SNO (2) //[8]: {1015813 = 300} (0) Tiletype (exit) //[9]: {1020416 = 1} (0) //[10]: {854613 = -1} Type SNO (2) //[11]: {1015821 = -1} (0) //find all tiles of TileType //foreach (var tile in worldTiles) //{ //} } } }
public World(MpqFile file) { var stream = file.Open(); Header = new Header(stream); SNO = stream.ReadInt32(); serDRLGParams = new SerializeData(stream); long x = stream.Position; if (serDRLGParams.Size > 0) { Param = new DRLGParams[serDRLGParams.Size / 120]; stream.Position = serDRLGParams.Offset + 16; for (int i = 0; i < serDRLGParams.Size/120; i++) { Param[i] = new DRLGParams(stream); } } stream.Position = x; stream.Position += (5 * 4); // This was 3 ints padding in the struct, was 8 bytes behind though so i changed it - DarkLotus serSceneParams = new SerializeData(stream); x = stream.Position; if (serSceneParams.Size > 0) { stream.Position = serSceneParams.Offset + 16; Scene = new SceneParams(stream); ; } stream.Position = x; stream.Position += (2 * 4); serMarkerSets = new SerializeData(stream); x = stream.Position; if (serMarkerSets.Size > 0) { MarkerSets = new int[serMarkerSets.Size / 4]; stream.Position = serMarkerSets.Offset + 16; for (int i = 0; i < serMarkerSets.Size / 4; i++) { MarkerSets[i] = stream.ReadInt32(); } } stream.Position = x; stream.Position += (14 * 4); Environment = new DataTypes.Environment(stream); stream.Position += 4; LabelRuleSet = new DataTypes.LabelRuleSet(stream); i0 = stream.ReadInt32(); stream.Position += 4; SceneClusterSet5 = new SceneClusterSet(stream); arNavMeshFuncs = new int[4]; for (int i = 0; i < arNavMeshFuncs.Length; i++) { arNavMeshFuncs[i] = stream.ReadInt32(); } stream.Position += 4; f0 = stream.ReadFloat(); i1 = stream.ReadInt32(); snoScript = stream.ReadInt32(); i2 = stream.ReadInt32(); stream.Close(); }