/// <summary> /// Reads paths from GM file. /// </summary> private GMList<GMPath> ReadPaths() { // Get version. int version = ReadInt(); // Check version. if (version != 420 && version !=800) throw new Exception("Unsupported Pre-Path object version."); // Create a new list of paths. GMList<GMPath> paths = new GMList<GMPath>(); // Amount of path indexes. int num = ReadInt(); // Iterate through paths. for (int i = 0; i < num; i++) { // If version is 8.0, start inflate. if (version == 800) Decompress(); // If the path at index does not exists, continue. if (ReadBool() == false) { paths.LastId++; EndDecompress(); continue; } // Create a new path object. GMPath path = new GMPath(); // Set path id. path.Id = i; // Read path data. path.Name = ReadString(); // If version is 8.0, get last changed. if (version == 800) path.LastChanged = ReadDouble(); // Get version. int version2 = ReadInt(); // Check version. if (version2 != 420 && version2 != 530) throw new Exception("Unsupported Path object version."); // Check version. if (version2 > 420) { // Read path data. path.Smooth = ReadBool(); path.Closed = ReadBool(); path.Precision = ReadInt(); path.RoomId = ReadInt(); path.SnapX = ReadInt(); path.SnapY = ReadInt(); } else { // Read path data. path.Smooth = ReadBool(); path.ActionAtTheEnd = (ActionAtTheEnd)ReadInt(); ReadBytes(4); } // Number of path points. path.Points = new GMPoint[ReadInt()]; // Iterate through path points. for (int j = 0; j < path.Points.Length; j++) { // Create a new point. GMPoint point = new GMPoint(); // Read point data. point.X = ReadDouble(); point.Y = ReadDouble(); point.Speed = ReadDouble(); // Set point. path.Points[j] = point; } // End object inflate. EndDecompress(); // Add path. paths.Add(path); } // Return paths. return paths; }