Пример #1
0
        public void Save(string path)
        {
            using (DocumentWriter dw = new DocumentWriter(path))
            {
                dw.CommentIndent          = 28;
                dw.CommentIndentCharacter = ' ';

                dw.WriteLine($"VERSION {Version}");

                dw.WriteLine();

                dw.WriteLine("// Sub member: Master-crush data");
                dw.WriteLine($"{XMins.Count}", "Number of 'X mins' entries.");
                foreach (float xmin in XMins)
                {
                    dw.WriteLine($"{xmin:F6}", "X mins");
                }
                dw.WriteLine($"{XMaxs.Count}", "Number of 'X maxs' entries.");
                foreach (float xmax in XMaxs)
                {
                    dw.WriteLine($"{xmax:F6}", "X maxs");
                }
                dw.WriteLine($"{YMins.Count}", "Number of 'Y mins' entries.");
                foreach (float ymin in YMins)
                {
                    dw.WriteLine($"{ymin:F6}", "Y mins");
                }
                dw.WriteLine($"{YMaxs.Count}", "Number of 'Y maxs' entries.");
                foreach (float ymax in YMaxs)
                {
                    dw.WriteLine($"{ymax:F6}", "Y maxs");
                }
                dw.WriteLine($"{ZMins.Count}", "Number of 'Z mins' entries.");
                foreach (float zmin in ZMins)
                {
                    dw.WriteLine($"{zmin:F6}", "Z mins");
                }
                dw.WriteLine($"{ZMaxs.Count}", "Number of 'Z maxs' entries.");
                foreach (float zmax in ZMaxs)
                {
                    dw.WriteLine($"{zmax:F6}", "Z maxs");
                }
                dw.WriteLine($"{BendabilityFactor:F6}", "Bendability factor");
                dw.WriteLine($"{BendPointZMin:F6}", "Bend point Z min");
                dw.WriteLine($"{BendPointZMax:F6}", "Bend point Z max");
                dw.WriteLine($"{SnappabilityFactor:F6}", "Snappability factor");
                dw.WriteLine($"{YSplitPosition}", "Y split position");
                dw.WriteLine($"{DriverPosition.X:F6},{DriverPosition.Y:F6},{DriverPosition.Z:F6}", "Driver position");
                dw.WriteLine($"{CrushEntries.Count}", "Number of 'Crush data' entries.");

                for (int i = 0; i < CrushEntries.Count; i++)
                {
                    CrushData crush = CrushEntries[i];

                    dw.WriteLine($"// Crush data entry #{i}");
                    dw.WriteLine($"{crush.Actor}", "Actor");
                    dw.WriteLine($"{crush.Softness}", "Softness");
                    dw.WriteLine($"{crush.Type}", "Crush type");

                    switch (crush.Type)
                    {
                    case CrushData.CrushType.detach:
                        dw.WriteLine($"{crush.EaseOfDetach}", "Ease of detachment");
                        dw.WriteLine($"{crush.DetachmentType}", "Type");
                        dw.WriteLine($"{crush.CrushShape}", "shape");
                        break;

                    case CrushData.CrushType.flap:
                        for (int j = 0; j < crush.HingePoints.Count; j++)
                        {
                            int point = crush.HingePoints[j];

                            dw.WriteLine($"{point}", $"Hinge point {j}");
                        }
                        dw.WriteLine($"{(crush.KevOFlap ? 1 : 0)}", "Kev-o-flap?");
                        dw.WriteLine($"{crush.EaseOfFlap}", "Ease of flap");
                        dw.WriteLine($"{crush.CrushShape}", "shape");
                        break;
                    }

                    if (crush.CrushShape == CrushData.BoxShape.poly)
                    {
                        dw.WriteLine($"{crush.ShapePoints.Count}");
                        foreach (int point in crush.ShapePoints)
                        {
                            dw.WriteLine($"{point}");
                        }
                    }

                    dw.WriteLine($"{crush.SmashEntries.Count}", "Number of 'Smash data' entries.");

                    foreach (SmashData smash in crush.SmashEntries)
                    {
                        dw.WriteLine($"{smash.Trigger}", "name of material");
                        dw.WriteLine($"{smash.IntactMaterial}", "pixelmap to use when intact");
                        dw.WriteLine($"{smash.Levels.Count}", "Number of levels");

                        int j = 1;

                        foreach (SmashDataTextureLevel textureLevel in smash.Levels)
                        {
                            dw.WriteLine($"{textureLevel.TriggerThreshold}", "trigger threshold (default if zero)");
                            dw.WriteLine($"{textureLevel.Flags}", "flags");
                            dw.IncreaseIndent();
                            textureLevel.Connotations.Write(dw);
                            dw.DecreaseIndent();
                            dw.WriteLine($"{textureLevel.Pixelmaps.Count}", "Number of pixelmaps");
                            foreach (string pixelmap in textureLevel.Pixelmaps)
                            {
                                dw.WriteLine($"{pixelmap}", $"pixelmap to use when smashed level {j}");
                            }

                            j++;
                        }
                    }
                }
            }
        }
Пример #2
0
        public void Save(string path)
        {
            using (DocumentWriter dw = new DocumentWriter(path))
            {
                dw.WriteLine($"VERSION {Version}");
                dw.WriteLine("//	Version 1 :		New crush data");
                if (Version > 1)
                {
                    dw.WriteLine("//		2 :		New windscreen spec");
                }
                dw.WriteLine($"{(FemaleDriver ? "GIRL" : "")}");
                dw.WriteLine($"{Name}", "Name of car");

                dw.WriteLine();

                dw.WriteLine($"{SoftnessFactor}", "softness_factor");

                dw.WriteLine();

                dw.WriteLine("START OF DRIVABLE STUFF");
                dw.WriteLine();
                dw.WriteLine($"{DriversHeadOffset.X},{DriversHeadOffset.Y},{DriversHeadOffset.Z}", "Offset of driver's head in 3D space");
                dw.WriteLine($"{DriversHeadTurnAngles.X},{DriversHeadTurnAngles.Y}", "Angles to turn to make head go left and right");
                dw.WriteLine($"{MirrorCamera.X},{MirrorCamera.Y},{MirrorCamera.Z},{MirrorCamera.W}", "Offset of 'mirror camera' in 3D space, viewing angle of mirror");
                dw.WriteLine($"{string.Join(",", PratcamBorders)}", "Pratcam border names (left, top, right, bottom)");
                dw.WriteLine();
                dw.WriteLine("END OF DRIVABLE STUFF");

                dw.WriteLine();

                dw.WriteLine($"{string.Join(",",EngineNoises)}", "Engine noise (normal, enclosed space, underwater)");

                dw.WriteLine();

                dw.WriteLine($"{(Stealworthy ? "stealworthy" : "")}", "Can be stolen");

                dw.WriteLine();

                foreach (ImpactSpec impactSpec in new List <ImpactSpec> {
                    ImpactTop, ImpactBottom, ImpactLeft, ImpactRight, ImpactFront, ImpactBack
                })
                {
                    dw.WriteLine($"// Damage info for {impactSpec.Description} impacts");
                    dw.WriteLine($"{impactSpec.Clauses.Count}", "Number of clauses");
                    dw.IncreaseIndent();
                    foreach (ImpactSpecClause clause in impactSpec.Clauses)
                    {
                        dw.WriteLine($"{clause.Clause}", "Condition");
                        dw.WriteLine($"{clause.Systems.Count}", "Systems count");

                        dw.IncreaseIndent();
                        foreach (ImpactSpecClauseSystem system in clause.Systems)
                        {
                            dw.WriteLine($"{system.Part},{system.Damage:F1}", "Damage");
                        }
                        dw.DecreaseIndent();
                    }
                    dw.DecreaseIndent();
                }

                dw.WriteLine();

                dw.WriteLine($"{string.Join(",", GridImages)}", "Grid image (opponent, frank, annie)");

                dw.WriteLine();

                dw.WriteLine($"{ExtraLevelsOfDetail.Count}", "Number of extra levels of detail");
                foreach (int extraLevelOfDetail in ExtraLevelsOfDetail)
                {
                    dw.WriteLine($"{extraLevelOfDetail}", "min_dist_squared");
                }

                dw.WriteLine();

                dw.WriteLine($"{WAM}", "crush data file (will be incorporated into this file)");

                dw.WriteLine();

                dw.WriteLine($"{ReflectiveScreenMaterial}", "Name of reflective screen material (or none if non-reflective)");
                dw.WriteLine($"{TransparencyOfWindscreen}", "Percentage transparency of windscreen");

                dw.WriteLine();

                dw.WriteLine($"{SteerableWheels.Count}", "Number of steerable wheels");
                foreach (int steerableWheel in SteerableWheels)
                {
                    dw.WriteLine($"{steerableWheel}", "GroovyFunkRef of nth steerable wheel");
                }

                dw.WriteLine();

                dw.WriteLine($"{string.Join(",", LeftFrontSuspension)}", "Left-front suspension parts GroovyFunkRef");
                dw.WriteLine($"{string.Join(",", RightFrontSuspension)}", "Right-front suspension parts GroovyFunkRef");
                dw.WriteLine($"{string.Join(",", LeftRearSuspension)}", "Left-rear suspension parts GroovyFunkRef");
                dw.WriteLine($"{string.Join(",", RightRearSuspension)}", "Right-rear suspension parts GroovyFunkRef");

                dw.WriteLine();

                dw.WriteLine($"{string.Join(",", DrivenWheels)}", "Driven wheels GroovyFunkRefs (for spinning) - MUST BE 4 ITEMS");
                dw.WriteLine($"{string.Join(",", NonDrivenWheels)}", "Non-driven wheels GroovyFunkRefs (for spinning) - MUST BE 4 ITEMS");

                dw.WriteLine();

                dw.WriteLine($"{DrivenWheelDiameter}", "Driven wheels diameter");
                dw.WriteLine($"{NonDrivenWheelDiameter}", "Non-driven wheels diameter");

                dw.WriteLine();
                dw.WriteLine("START OF FUNK");
                dw.WriteLine();

                for (int i = 0; i < Funks.Count; i++)
                {
                    Funk funk = Funks[i];

                    dw.WriteLine($"{funk.Material}");
                    dw.WriteLine($"{funk.Mode}");
                    dw.WriteLine($"{funk.MatrixModType}");
                    if (funk.MatrixModType != FunkMatrixMode.None)
                    {
                        dw.WriteLine($"{funk.MatrixModMode}");
                    }

                    switch (funk.MatrixModType)
                    {
                    case FunkMatrixMode.roll:
                        dw.WriteLine($"{funk.RollPeriods.X},{funk.RollPeriods.Y}");
                        break;

                    case FunkMatrixMode.slither:
                        dw.WriteLine($"{funk.SlitherSpeed.X},{funk.SlitherSpeed.Y}");
                        dw.WriteLine($"{funk.SlitherAmount.X},{funk.SlitherAmount.Y}");
                        break;

                    case FunkMatrixMode.spin:
                        dw.WriteLine($"{funk.SpinPeriod}");
                        break;
                    }

                    dw.WriteLine($"{funk.LightingMode}");
                    dw.WriteLine($"{funk.AnimationType}");

                    switch (funk.AnimationType)
                    {
                    case FunkAnimationType.frames:
                        dw.WriteLine($"{funk.Framerate}");
                        dw.WriteLine($"{funk.FrameMode}");

                        switch (funk.FrameMode)
                        {
                        case FrameType.texturebits:
                            dw.WriteLine($"{funk.TextureBitMode}");
                            break;

                        case FrameType.continuous:
                            dw.WriteLine($"{funk.FrameSpeed}");
                            break;
                        }

                        dw.WriteLine($"{funk.Frames.Count}");
                        foreach (string frame in funk.Frames)
                        {
                            dw.WriteLine($"{frame}");
                        }
                        break;
                    }

                    if (i + 1 != Funks.Count)
                    {
                        dw.WriteLine();
                        dw.WriteLine("NEXT FUNK");
                        dw.WriteLine();
                    }
                }

                dw.WriteLine();
                dw.WriteLine("END OF FUNK");
                dw.WriteLine();

                dw.WriteLine();
                dw.WriteLine("START OF GROOVE");
                dw.WriteLine();

                for (int i = 0; i < Grooves.Count; i++)
                {
                    Groove groove = Grooves[i];

                    dw.WriteLine($"{groove.Part}");
                    dw.WriteLine($"{groove.LollipopMode}");
                    dw.WriteLine($"{groove.Mode}");
                    dw.WriteLine($"{groove.PathType}");
                    if (groove.PathType != GroovePathNames.None)
                    {
                        dw.WriteLine($"{groove.PathMode}");
                    }

                    switch (groove.PathType)
                    {
                    case GroovePathNames.straight:
                        dw.WriteLine($"{groove.PathCentre.X},{groove.PathCentre.Y},{groove.PathCentre.Z}");
                        dw.WriteLine($"{groove.PathPeriod}");
                        dw.WriteLine($"{groove.PathDelta.X},{groove.PathDelta.Y},{groove.PathDelta.Z}");
                        break;
                    }

                    dw.WriteLine($"{groove.AnimationType}");
                    if (groove.AnimationType != GrooveAnimation.None)
                    {
                        dw.WriteLine($"{groove.AnimationMode}");
                    }

                    switch (groove.AnimationType)
                    {
                    case GrooveAnimation.rock:
                        dw.WriteLine($"{groove.AnimationPeriod}");
                        dw.WriteLine($"{groove.AnimationCentre.X},{groove.AnimationCentre.Y},{groove.AnimationCentre.Z}");
                        dw.WriteLine($"{groove.AnimationAxis}");
                        dw.WriteLine($"{groove.RockMaxAngle}");
                        break;

                    case GrooveAnimation.shear:
                        dw.WriteLine($"{groove.ShearPeriod.X},{groove.ShearPeriod.Y},{groove.ShearPeriod.Z}");
                        dw.WriteLine($"{groove.AnimationCentre.X},{groove.AnimationCentre.Y},{groove.AnimationCentre.Z}");
                        dw.WriteLine($"{groove.ShearMagnitude.X},{groove.ShearMagnitude.Y},{groove.ShearMagnitude.Z}");
                        break;

                    case GrooveAnimation.spin:
                        dw.WriteLine($"{groove.AnimationPeriod}");
                        dw.WriteLine($"{groove.AnimationCentre.X},{groove.AnimationCentre.Y},{groove.AnimationCentre.Z}");
                        dw.WriteLine($"{groove.AnimationAxis}");
                        break;
                    }

                    if (i + 1 != Grooves.Count)
                    {
                        dw.WriteLine();
                        dw.WriteLine("NEXT GROOVE");
                        dw.WriteLine();
                    }
                }

                dw.WriteLine();
                dw.WriteLine("END OF GROOVE");
                dw.WriteLine();

                dw.WriteLine("// END OF CRUSH DATA");

                dw.WriteLine();
                dw.WriteLine("START OF MECHANICS STUFF version 1");
                dw.WriteLine();

                dw.WriteLine($"{MinimumTurningCircle:F6}", "Minimum turning circle.");
                dw.WriteLine($"{BrakeMultiplier:F6}", "Brake multiplier.");
                dw.WriteLine($"{BrakingStrengthMultiplier:F6}", "Braking strength multiplier.");
                dw.WriteLine($"{NumberOfGears}", "Number of gears.");
                dw.WriteLine($"{TopGearRedlineSpeed:F4}", "Speed at red line in highest gear.");
                dw.WriteLine($"{TopGearAcceleration:F6}", "Acceleration in highest gear (m/s^2) i.e. engine strength.");

                dw.WriteLine();

                dw.WriteLine("// Sub member: Root part");
                dw.WriteLine($"{RootPartType}", "Type");
                dw.WriteLine($"{RootPartIdentifier}", "Identifier");
                dw.WriteLine($"{RootPartActor}", "Actor");
                dw.WriteLine("// Sub member: Joint data");
                dw.WriteLine($"{SubPartType}", "Type");
                dw.WriteLine($"{CentreOfMass.X:F6},{CentreOfMass.Y:F6},{CentreOfMass.Z:F6}", "Centre of mass");
                dw.WriteLine($"{Mass}", "Mass");
                dw.WriteLine($"{AngularMomentumProportions.X:F6},{AngularMomentumProportions.Y:F6},{AngularMomentumProportions.Z:F6}", "Angular momentum proportions");
                dw.WriteLine($"{DownforceToWeightBalanceSpeed:F6}", "Downforce-to-weight balance speed");
                dw.WriteLine($"{Wheels.Count}", "Number of 'Wheels' entries.");

                for (int i = 0; i < Wheels.Count; i++)
                {
                    Wheel wheel = Wheels[i];

                    dw.WriteLine($"// Wheels entry #{i + 1}");
                    dw.WriteLine($"{(int)wheel.Type}", "Type");
                    dw.WriteLine($"{wheel.Identifier}", "Identifier");
                    dw.WriteLine($"{wheel.Actor}", "Actor");
                    dw.WriteLine($"{wheel.Position.X},{wheel.Position.Y},{wheel.Position.Z}", "Position");
                    dw.WriteLine($"{wheel.SteerableFlags}", "Steerable flags");
                    dw.WriteLine($"{wheel.DrivenFlags}", "Driven flags");
                    dw.WriteLine($"{wheel.SuspensionGive:F6}", "Suspension give");
                    dw.WriteLine($"{wheel.DampingFactor:F6}", "Damping factor");
                    dw.WriteLine($"{wheel.SlipFrictionReductionFraction:F6}", "Fractional reduction in friction when slipping");
                    dw.WriteLine($"{wheel.FrictionAngles.X:F6},{wheel.FrictionAngles.Y:F6}", "Friction angles");
                    dw.WriteLine($"{wheel.TractionFractionalMultiplier:F6}", "Traction fractional multiplier");
                    dw.WriteLine($"{wheel.RollingResistance:F6}", "Rolling resistance");
                }

                dw.WriteLine();

                dw.WriteLine($"{BoundingShapes.Count}", "Number of 'Bounding shapes' entries.");

                for (int i = 0; i < BoundingShapes.Count; i++)
                {
                    BoundingShape shape = BoundingShapes[i];

                    dw.WriteLine($"// Bounding shapes entry #{i + 1}");
                    dw.WriteLine($"{shape.Type}", "Type");
                    dw.WriteLine($"{shape.Points.Count}");
                    foreach (Vector3 point in shape.Points)
                    {
                        dw.WriteLine($"{point.X:F2},{point.Y:F2},{point.Z:F2}");
                    }
                }

                dw.WriteLine();
                dw.WriteLine($"{SubParts.Count}", "Number of sub-parts.");
                dw.WriteLine();

                dw.WriteLine();
                dw.WriteLine("END OF MECHANICS STUFF");
                dw.WriteLine();

                dw.WriteLine("// Materials for shrapnel");
                dw.WriteLine($"{Shrapnel.Count}", "number of materials");
                foreach (string shrapnel in Shrapnel)
                {
                    dw.WriteLine($"{shrapnel}");
                }

                dw.WriteLine();

                dw.WriteLine("//damage vertices fire points");
                foreach (int point in FirePoints)
                {
                    dw.WriteLine($"{point}");
                }

                dw.WriteLine();

                dw.WriteLine("// start of keyword stuff");
                foreach (Keyword keyword in Keywords)
                {
                    keyword.Write(dw);
                }

                dw.WriteLine("// End of keyword stuff");
                dw.WriteLine("END");
            }
        }
Пример #3
0
        public void Save(string path)
        {
            using (DocumentWriter dw = new DocumentWriter(path))
            {
                dw.WriteLine($"VERSION {Version}", Version > 1 ? "V1 expects map checkpoint rectangles" : null);
                if (Version >= 2)
                {
                    dw.WriteLine(null, "V2 and above expect map checkpoint points");
                }
                if (Version >= 3)
                {
                    dw.WriteLine(null, "V3 and above expect splash file stuff at the end");
                }
                if (Version >= 4)
                {
                    dw.WriteLine(null, "V4 and above expect two sets of PIX and MAT and ped substitution entry");
                }
                dw.WriteLine();

                if (Version == 1)
                {
                    dw.WriteLine();
                    dw.WriteLine("//////////// GLOBAL LIGHTING DATA ///////////");
                    dw.WriteLine();
                    dw.WriteLine($"{LightColour.X},{LightColour.Y},{LightColour.Z}", "RGB for main directional light-source");
                    dw.WriteLine($"{DiffuseLight0.X:F1},{DiffuseLight0.Y:F1}", "Ambient/Diffuse light to be used when plaything ambient says 0				}--- Neither of these have smooth lighting effecs applied");
                    dw.WriteLine($"{DiffuseLight1.X:F1},{DiffuseLight1.Y:F1}", "Ambient/Diffuse light to be used when plaything ambient says 1				}");
                    dw.WriteLine($"{DiffuseLightOther.X:F1},{DiffuseLightOther.Y:F1}", "Ambient/Diffuse light to be used when plaything ambient says anything else");
                    dw.WriteLine();
                    dw.WriteLine("/////////////////////////////////////////////");
                    dw.WriteLine();
                }

                dw.WriteLine();

                dw.WriteLine($"{GridPosition.X},{GridPosition.Y},{GridPosition.Z}", "Position of centre of start of grid");
                dw.WriteLine($"{GridRotation}", "Direction that grid faces in");

                dw.WriteLine();
                dw.WriteLine("// Laps, checkpoints etc");
                dw.WriteLine();

                dw.WriteLine($"{Checkpoints.Count}", "# checkpoints");
                for (int i = 0; i < Checkpoints.Count; i++)
                {
                    Checkpoint checkpoint = Checkpoints[i];

                    dw.WriteLine($"// Checkpoint #{i + 1}");
                    dw.WriteLine($"{checkpoint.TimerIncrements.X},{checkpoint.TimerIncrements.Y},{checkpoint.TimerIncrements.Z}", "Timer increment for each skill level (ped mode)");
                    dw.WriteLine($"{checkpoint.Points.Count / 4}", "# quads for this checkpoint");

                    for (int j = 0; j < checkpoint.Points.Count; j++)
                    {
                        Vector3 point = checkpoint.Points[j];

                        dw.WriteLine($"{point.X},{point.Y},{point.Z}", $"Point #{j}");
                    }
                }

                dw.WriteLine();
                dw.WriteLine("// Smashable environment specs");
                dw.WriteLine();

                dw.WriteLine($"{Smashables.Count}", "Number of smash specs");
                dw.WriteLine();

                foreach (SmashData smash in Smashables)
                {
                    dw.WriteLine("// Start of smashable item");
                    dw.WriteLine($"{smash.Flags}", "Flags");
                    dw.WriteLine($"{smash.Trigger}", "Name of trigger material");
                    dw.WriteLine($"{smash.TriggerMode}", "Mode");

                    switch (smash.TriggerMode)
                    {
                    case SmashData.SmashTriggerMode.nochange:
                    case SmashData.SmashTriggerMode.remove:
                        dw.WriteLine($"{smash.RemovalThreshold}", "Removal threshold");
                        dw.IncreaseIndent();
                        smash.Connotations.Write(dw);
                        dw.DecreaseIndent();
                        break;

                    case SmashData.SmashTriggerMode.replacemodel:
                        dw.WriteLine($"{smash.RemovalThreshold}", "Removal threshold");
                        dw.WriteLine();
                        dw.IncreaseIndent();
                        smash.Connotations.Write(dw);
                        dw.DecreaseIndent();
                        dw.WriteLine($"{smash.NewModel}", "new model");
                        dw.WriteLine($"{smash.ChanceOfFire}", "%chance fire");

                        if (smash.ChanceOfFire > 0)
                        {
                            dw.WriteLine($"{smash.NumFires}");
                            dw.WriteLine($"{string.Join(",", smash.SmokeLevel)}");
                        }
                        break;

                    case SmashData.SmashTriggerMode.texturechange:
                        dw.WriteLine($"{smash.IntactMaterial}", "Intact pixelmap");
                        dw.WriteLine($"{smash.Levels.Count}", "Number of levels");

                        int j = 1;

                        foreach (SmashDataTextureLevel textureLevel in smash.Levels)
                        {
                            dw.WriteLine();
                            dw.WriteLine($"{textureLevel.TriggerThreshold}", "Trigger threshold");
                            dw.WriteLine($"{textureLevel.Flags}", "Flags");
                            dw.WriteLine($"{textureLevel.CollisionType}", "Collision type");
                            dw.IncreaseIndent();
                            textureLevel.Connotations.Write(dw);
                            dw.DecreaseIndent();
                            dw.WriteLine();
                            dw.WriteLine($"{textureLevel.Pixelmaps.Count}", "Number of pixelmap");
                            foreach (string pixelmap in textureLevel.Pixelmaps)
                            {
                                dw.WriteLine($"{pixelmap}", $"Pixelmap");
                            }

                            j++;
                        }
                        break;
                    }

                    dw.WriteLine($"{smash.Reserved1}", "reserved 1");
                    dw.WriteLine($"{smash.Reserved2}", "reserved 2");
                    dw.WriteLine($"{smash.Reserved3}", "reserved 3");
                    dw.WriteLine($"{smash.Reserved4}", "reserved 4");
                }

                dw.WriteLine();
                dw.WriteLine("// Ped specs");
                dw.WriteLine();

                dw.WriteLine($"{PedSpecs.Count}");

                foreach (PedSpec pedspec in PedSpecs)
                {
                    dw.WriteLine();
                    dw.WriteLine($"{pedspec.MaterialName}", "Material name");
                    dw.WriteLine($"{pedspec.MovementIndex}", "Movement index");
                    dw.WriteLine($"{pedspec.GroupIndex}", "Group index");
                    dw.WriteLine($"{pedspec.PedsPer100SquareMetres}", "Peds per 100 square metres");
                    dw.WriteLine($"{pedspec.ExclusionMaterials.Count}", "Number of exclusion materials");

                    foreach (PedExclusionMaterial pedExclusionMaterial in pedspec.ExclusionMaterials)
                    {
                        dw.WriteLine($"{pedExclusionMaterial.Flags}", "Exclusion flags (1 = OK when scared)");
                        dw.WriteLine($"{pedExclusionMaterial.Name}", "Exclusion material #1 name");
                    }

                    dw.WriteLine($"{pedspec.ExceptionMaterials.Count}", "Number of exception materials");
                }

                dw.WriteLine();

                dw.WriteLine($"{AdditionalActor}", "Additional actor");

                dw.WriteLine();
                dw.WriteLine("// HORIZON STUFF");
                dw.WriteLine();

                dw.WriteLine($"{SkyPixelmap}", @"Name of sky texture pixelmap (or ""none"")");
                dw.WriteLine($"{HorizontalRepetitions}", "Horizontal repetitions of sky texture");
                dw.WriteLine($"{VerticalSize}", "Vertical size of sky texture (degrees)");
                dw.WriteLine($"{PositionOfHorizon}", "Position of horizon (pixels below top)");
                dw.WriteLine($"{DepthCueMode}", @"Depth cue mode (""none"", ""dark"" or ""fog"")");
                dw.WriteLine($"{FogDarkness.X},{FogDarkness.Y}", "Degree of fog/darkness");
                dw.WriteLine($"{DepthCueColour.X},{DepthCueColour.Y},{DepthCueColour.Z}", "Depth cue colour (red, green, blue )");

                dw.WriteLine();
                dw.WriteLine("// DEFAULT ENGINE NOISE");
                dw.WriteLine();

                dw.WriteLine($"{DefaultEngineNoise}");

                dw.WriteLine();
                dw.WriteLine("// SPECIAL EFFECTS VOLUMES");
                dw.WriteLine();

                dw.WriteLine($"{SpecialVolumes.Count}", "# special effects volumes");

                foreach (SpecialEffectVolume volume in SpecialVolumes)
                {
                    dw.WriteLine();
                    dw.WriteLine($"{volume.Type}");

                    foreach (Vector3 corner in volume.Corners)
                    {
                        dw.WriteLine($"{corner.X:F3}, {corner.Y:F3}, {corner.Z:F3}");
                    }

                    dw.WriteLine($"{volume.GravityMultiplier:F2}", "gravity multiplier");
                    dw.WriteLine($"{volume.ViscosityMultiplier:F2}", "viscosity multiplier");
                    dw.WriteLine($"{volume.CarDamagePerMillisecond:F2}", "Car damage per millisecond");
                    dw.WriteLine($"{volume.PedDamagePerMillisecond:F2}", "Pedestrian damage per millisecond");
                    dw.WriteLine($"{volume.CameraEffectIndex}", "camera effect index");
                    dw.WriteLine($"{volume.SkyColour}", "sky colour");
                    dw.WriteLine($"{volume.WindscreenMaterial}", "Windscreen texture to use");
                    dw.WriteLine($"{volume.EntrySoundID}", "Sound ID of entry noise");
                    dw.WriteLine($"{volume.ExitSoundID}", "Sound ID of exit noise");
                    dw.WriteLine($"{volume.EngineNoiseIndex}", "Engine noise index");
                    dw.WriteLine($"{volume.MaterialIndex}", "material index");

                    if (volume.Type.ToUpper() == "BOX")
                    {
                        dw.WriteLine($"{volume.SoundType}", "Sound type");

                        if (volume.SoundType != SpecialEffectVolume.SpecVolSoundType.NONE)
                        {
                            volume.SoundSpec.Write(dw);
                        }
                    }
                }

                dw.WriteLine();
                dw.WriteLine("// SOUND GENERATORS");
                dw.WriteLine();

                dw.WriteLine($"{SoundGenerators.Count}", "Number of generators");

                dw.WriteLine();
                dw.WriteLine("// REFLECTIVE WINDSCREEN SPECIFICATIONS");
                dw.WriteLine();

                dw.WriteLine($"{MaterialDefault}", "Material to use for default screens");
                dw.WriteLine($"{MaterialDarkness}", "Material to use for default screens during darkness");
                dw.WriteLine($"{MaterialFog}", "Material to use for default screens during fog");

                dw.WriteLine();

                dw.WriteLine("0", "(ignore) # areas with different screens");

                dw.WriteLine();
                dw.WriteLine("// MAP DETAILS");
                dw.WriteLine();

                dw.WriteLine($"{MapPixelmap}", "Map pixelmap name");
                dw.WriteLine();
                dw.WriteLine($"{WorldMapTransform.M11,7:0.###},{WorldMapTransform.M12,11:0.###},{WorldMapTransform.M13,11:0.###}", "World->map transformation matrix");
                dw.WriteLine($"{WorldMapTransform.M21,7:0.###},{WorldMapTransform.M22,11:0.###},{WorldMapTransform.M23,11:0.###}");
                dw.WriteLine($"{WorldMapTransform.M31,7:0.###},{WorldMapTransform.M32,11:0.###},{WorldMapTransform.M33,11:0.###}");
                dw.WriteLine($"{WorldMapTransform.M41,7:0.###},{WorldMapTransform.M42,11:0.###},{WorldMapTransform.M43,11:0.###}");

                dw.WriteLine();
                dw.WriteLine("// ****** START OF FUNK AND GROOVE STUFF ******");
                dw.WriteLine();

                dw.WriteLine();
                dw.WriteLine("START OF FUNK");
                dw.WriteLine();

                for (int i = 0; i < Funks.Count; i++)
                {
                    Funk funk = Funks[i];

                    dw.WriteLine($"{funk.Material}");
                    dw.WriteLine($"{funk.Mode}");
                    dw.WriteLine($"{funk.MatrixModType}");
                    if (funk.MatrixModType != FunkMatrixMode.None)
                    {
                        dw.WriteLine($"{funk.MatrixModMode}");
                    }

                    switch (funk.MatrixModType)
                    {
                    case FunkMatrixMode.roll:
                        dw.WriteLine($"{funk.RollPeriods.X},{funk.RollPeriods.Y}");
                        break;

                    case FunkMatrixMode.slither:
                        dw.WriteLine($"{funk.SlitherSpeed.X},{funk.SlitherSpeed.Y}");
                        dw.WriteLine($"{funk.SlitherAmount.X},{funk.SlitherAmount.Y}");
                        break;

                    case FunkMatrixMode.spin:
                        dw.WriteLine($"{funk.SpinPeriod}");
                        break;
                    }

                    dw.WriteLine($"{funk.LightingMode}");
                    dw.WriteLine($"{funk.AnimationType}");

                    switch (funk.AnimationType)
                    {
                    case FunkAnimationType.frames:
                        dw.WriteLine($"{funk.Framerate}");
                        dw.WriteLine($"{funk.FrameMode}");

                        switch (funk.FrameMode)
                        {
                        case FrameType.texturebits:
                            dw.WriteLine($"{funk.TextureBitMode}");
                            break;

                        case FrameType.continuous:
                            dw.WriteLine($"{funk.FrameSpeed}");
                            break;
                        }

                        dw.WriteLine($"{funk.Frames.Count}");
                        foreach (string frame in funk.Frames)
                        {
                            dw.WriteLine($"{frame}");
                        }
                        break;
                    }

                    if (i + 1 != Funks.Count)
                    {
                        dw.WriteLine();
                        dw.WriteLine("NEXT FUNK");
                        dw.WriteLine();
                    }
                }

                dw.WriteLine();
                dw.WriteLine("END OF FUNK");
                dw.WriteLine();

                dw.WriteLine();
                dw.WriteLine("START OF GROOVE");
                dw.WriteLine();

                for (int i = 0; i < Grooves.Count; i++)
                {
                    Groove groove = Grooves[i];

                    dw.WriteLine($"{groove.Part}", "Actor name of moving part");
                    dw.WriteLine($"{groove.LollipopMode}");
                    dw.WriteLine($"{groove.Mode}");
                    dw.WriteLine($"{groove.PathType}");
                    if (groove.PathType != GroovePathNames.None)
                    {
                        dw.WriteLine($"{groove.PathMode}");
                    }

                    switch (groove.PathType)
                    {
                    case GroovePathNames.straight:
                        dw.WriteLine($"{groove.PathCentre.X},{groove.PathCentre.Y},{groove.PathCentre.Z}");
                        dw.WriteLine($"{groove.PathPeriod}");
                        dw.WriteLine($"{groove.PathDelta.X},{groove.PathDelta.Y},{groove.PathDelta.Z}");
                        break;
                    }

                    dw.WriteLine($"{groove.AnimationType}");
                    if (groove.AnimationType != GrooveAnimation.None)
                    {
                        dw.WriteLine($"{groove.AnimationMode}");
                    }

                    switch (groove.AnimationType)
                    {
                    case GrooveAnimation.rock:
                        dw.WriteLine($"{groove.AnimationPeriod}");
                        dw.WriteLine($"{groove.AnimationCentre.X},{groove.AnimationCentre.Y},{groove.AnimationCentre.Z}");
                        dw.WriteLine($"{groove.AnimationAxis}");
                        dw.WriteLine($"{groove.RockMaxAngle}");
                        break;

                    case GrooveAnimation.shear:
                        dw.WriteLine($"{groove.ShearPeriod.X},{groove.ShearPeriod.Y},{groove.ShearPeriod.Z}");
                        dw.WriteLine($"{groove.AnimationCentre.X},{groove.AnimationCentre.Y},{groove.AnimationCentre.Z}");
                        dw.WriteLine($"{groove.ShearMagnitude.X},{groove.ShearMagnitude.Y},{groove.ShearMagnitude.Z}");
                        break;

                    case GrooveAnimation.spin:
                        dw.WriteLine($"{groove.AnimationPeriod}");
                        dw.WriteLine($"{groove.AnimationCentre.X},{groove.AnimationCentre.Y},{groove.AnimationCentre.Z}");
                        dw.WriteLine($"{groove.AnimationAxis}");
                        break;
                    }

                    if (i + 1 != Grooves.Count)
                    {
                        dw.WriteLine();
                        dw.WriteLine("NEXT GROOVE");
                        dw.WriteLine();
                    }
                }

                dw.WriteLine();
                dw.WriteLine("END OF GROOVE");
                dw.WriteLine();
                dw.WriteLine("START OF OPPONENT PATHS");
                dw.WriteLine();

                dw.WriteLine($"{Nodes.Count}", "Number of path nodes");

                int n = 0;
                foreach (Vector3 node in Nodes)
                {
                    dw.WriteLine($"{node.X,9:F3},{node.Y,9:F3},{node.Z,9:F3}", $"Node #{n}");
                    n++;
                }

                dw.WriteLine();

                dw.WriteLine($"{Paths.Count}", "Number of path sections");

                n = 0;
                foreach (OpponentPathSection pathSection in Paths)
                {
                    dw.WriteLine($"{pathSection.StartNode,4},{pathSection.EndNode,4},{pathSection.Unknown1,4},{pathSection.Unknown2,4},{pathSection.Unknown3,4},{pathSection.Unknown4,4},{pathSection.Width,7:F1},{pathSection.SectionType,5}", $"Section #{n}");
                    n++;
                }

                dw.WriteLine();

                dw.WriteLine($"{CopStartPoints.Count}", "Number of cop start points");

                dw.WriteLine();
                dw.WriteLine("END OF OPPONENT PATHS");
                dw.WriteLine();

                dw.WriteLine();
                dw.WriteLine("START OF DRONE PATHS");
                dw.WriteLine();

                dw.WriteLine($"{DronePathVersion}", "version");
                dw.WriteLine($"{DronePaths.Count}", "n_nodes");

                for (int i = 0; i < DronePaths.Count; i++)
                {
                    DronePathNode node = DronePaths[i];

                    dw.WriteLine();
                    dw.WriteLine($"// {i}:");
                    dw.IncreaseIndent();
                    dw.WriteLine($"{node.Position.X:F3}, {node.Position.Y:F3}, {node.Position.Z:F3}");
                    dw.WriteLine($"{node.DroneName}");
                    dw.WriteLine($"{node.UnknownInt}");
                    dw.WriteLine($"{node.Destinations.Count}");
                    dw.IncreaseIndent();
                    foreach (string destination in node.Destinations)
                    {
                        dw.WriteLine($"{destination}");
                    }
                    dw.DecreaseIndent();
                    dw.DecreaseIndent();
                }

                dw.WriteLine();
                dw.WriteLine("END OF DRONE PATHS");
                dw.WriteLine();

                dw.WriteLine($"{MaterialModifiers.Count}", "number of material modifiers");

                for (int i = 0; i < MaterialModifiers.Count; i++)
                {
                    dw.WriteLine($"// {(i == 0 ? "default material" : $"material '{i - 1}'")}");

                    MaterialModifier materialModifier = MaterialModifiers[i];
                    dw.WriteLine($"{materialModifier.CarWallFriction:0.0##}", "car wall friction");
                    dw.WriteLine($"{materialModifier.TyreRoadFriction:0.0##}", "tyre road friction");
                    dw.WriteLine($"{materialModifier.DownForce:0.0##}", "down force");
                    dw.WriteLine($"{materialModifier.Bumpiness:0.0##}", "bumpiness");
                    dw.WriteLine($"{materialModifier.TyreSoundIndex}", "tyre sound index");
                    dw.WriteLine($"{materialModifier.CrashSoundIndex}", "crash sound index");
                    dw.WriteLine($"{materialModifier.ScrapeNoiseIndex}", "scrape noise index");
                    dw.WriteLine($"{materialModifier.Sparkiness:0.0##}", "sparkiness");
                    dw.WriteLine($"{materialModifier.RoomForExpansion}", "room for expansion");
                    dw.WriteLine($"{materialModifier.SkidmarkMaterial}", "skid mark material");
                }

                dw.WriteLine();
                dw.WriteLine("// Non CarObjects");
                dw.WriteLine($"{Noncars.Count}");
                foreach (string noncar in Noncars)
                {
                    dw.WriteLine($"{noncar}");
                }

                dw.WriteLine();

                dw.WriteLine($"{ShadeTables.Count}", "number of dust shade tables");
                foreach (ShadeTable shade in ShadeTables)
                {
                    dw.WriteLine($"{shade.RGB.X}, {shade.RGB.Y}, {shade.RGB.Z}", "r g b values");
                    dw.WriteLine($"{shade.Strengths.X}, {shade.Strengths.Y}, {shade.Strengths.Z}", @"quarter, half and three quarter ""strength""");
                }

                dw.WriteLine();

                dw.WriteLine($"{NetworkStarts.Count}", "Number of network start points");
                n = 0;
                foreach (NetworkStart start in NetworkStarts)
                {
                    dw.WriteLine();
                    dw.WriteLine($"{start.Position.X:F3}, {start.Position.Y:F3}, {start.Position.Z:F3}", $"{n}");
                    dw.WriteLine($"{start.Rotation}");
                    n++;
                }

                dw.WriteLine();

                dw.WriteLine($"{SplashFiles.Count}", "number of splash files");
                foreach (string splash in SplashFiles)
                {
                    dw.WriteLine($"{splash}", "name of pixelmapfile for splashes");
                }

                dw.WriteLine();

                dw.WriteLine($"{TxtFiles.Count}");
                foreach (string txt in TxtFiles)
                {
                    dw.WriteLine($"{txt}");
                }
            }