public VehicleAttachment(DocumentParser doc)
        {
            string s = doc.ReadNextLine();

            switch (s)
            {
                case "DynamicsWheels":
                    this.attachmentType = AttachmentType.DynamicsWheels;
                    break;

                case "ComplicatedWheels":
                    this.attachmentType = AttachmentType.ComplicatedWheels;
                    this.wheels = new VehicleAttachmentComplicatedWheels();

                    while (!doc.NextLineIsASection())
                    {
                        var cw = doc.ReadStringArray(2);

                        switch (cw[0])
                        {
                            case "fl_wheel_folder_name":
                                this.wheels.FLWheel = cw[1];
                                break;

                            case "fr_wheel_folder_name":
                                this.wheels.FRWheel = cw[1];
                                break;

                            case "rl_wheel_folder_name":
                                this.wheels.RLWheel = cw[1];
                                break;

                            case "rr_wheel_folder_name":
                                this.wheels.RRWheel = cw[1];
                                break;

                            case "wheel_folder_name":
                                this.wheels.FLWheel = cw[1];
                                this.wheels.FRWheel = cw[1];
                                this.wheels.RLWheel = cw[1];
                                this.wheels.RRWheel = cw[1];
                                break;

                            default:
                                throw new NotImplementedException("Unknown ComplicatedWheels parameter: " + cw[0]);
                        }
                    }
                    break;

                case "DynamicsFmodEngine":
                    this.attachmentType = AttachmentType.DynamicsFmodEngine;
                    this.engine = new VehicleAttachmentFModEngine();

                    while (!doc.NextLineIsASection())
                    {
                        var dfe = doc.ReadStringArray(2);

                        switch (dfe[0])
                        {
                            case "engine":
                                this.engine.Engine = dfe[1];
                                break;

                            case "rpmsmooth":
                                this.engine.RPMSmooth = Single.Parse(dfe[1], ToxicRagers.Culture);
                                break;

                            case "onloadsmooth":
                                this.engine.OnLoadSmooth = Single.Parse(dfe[1], ToxicRagers.Culture);
                                break;

                            case "offloadsmooth":
                                this.engine.OffLoadSmooth = Single.Parse(dfe[1], ToxicRagers.Culture);
                                break;

                            case "max_revs":
                                this.engine.MaxRevs = int.Parse(dfe[1]);
                                break;

                            case "min_revs":
                                this.engine.MinRevs = int.Parse(dfe[1]);
                                break;

                            default:
                                throw new NotImplementedException("Unknown DynamicsFmodEngine parameter: " + dfe[0]);
                        }
                    }
                    break;

                case "Horn":
                    this.attachmentType = AttachmentType.Horn;

                    var h = doc.ReadStringArray(2);
                    this.horn = h[1];
                    break;

                case "ExhaustParticles":
                    this.attachmentType = AttachmentType.ExhaustParticles;
                    this.exhaust = new VehicleAttachmentExhaust();

                    while (!doc.NextLineIsASection())
                    {
                        var ep = doc.ReadStringArray(2);

                        switch (ep[0])
                        {
                            case "vfx":
                                this.exhaust.VFX = ep[1];
                                break;

                            case "underwater_vfx":
                                this.exhaust.UnderwaterVFX = ep[1];
                                break;

                            case "anchor":
                                this.exhaust.Anchor = ep[1];
                                break;

                            default:
                                throw new NotImplementedException("Unknown ExhaustParticle parameter: " + ep[0]);
                        }
                    }
                    break;

                case "ReverseLightSound":
                    this.attachmentType = AttachmentType.ReverseLightSound;

                    var rl = doc.ReadStringArray(2);
                    this.reverseLightSound = rl[1];
                    break;

                case "ContinuousSound":
                    this.attachmentType = AttachmentType.ContinuousSound;

                    while (!doc.NextLineIsASection())
                    {
                        var cs = doc.ReadStringArray(2);

                        switch (cs[0])
                        {
                            case "sound":
                                this.continuousSound = cs[1];
                                break;

                            case "lump":
                                this.continuousSoundLump = cs[1];
                                break;

                            default:
                                throw new NotImplementedException("Unknown ContinuousSound parameter: " + cs[0]);
                        }
                    }
                    break;

                default:
                    throw new NotImplementedException("Unknown AttachmentType: " + s);
            }
        }
        public VehicleWheelMap(DocumentParser doc)
        {
            this.name = doc.ReadNextLine();
            this.wheels = new VehicleAttachmentComplicatedWheels();

            while (!doc.NextLineIsASection() && !doc.EOF())
            {
                var wm = doc.ReadStringArray(2);

                switch (wm[0])
                {
                    case "localise":
                        this.localName = wm[1];
                        break;

                    case "fl_wheel_folder_name":
                        this.wheels.FLWheel = wm[1];
                        break;

                    case "fr_wheel_folder_name":
                        this.wheels.FRWheel = wm[1];
                        break;

                    case "rl_wheel_folder_name":
                        this.wheels.RLWheel = wm[1];
                        break;

                    case "rr_wheel_folder_name":
                        this.wheels.RRWheel = wm[1];
                        break;

                    case "wheel_folder_name":
                        this.wheels.FLWheel = wm[1];
                        this.wheels.FRWheel = wm[1];
                        this.wheels.RLWheel = wm[1];
                        this.wheels.RRWheel = wm[1];
                        break;

                    default:
                        throw new NotImplementedException("Unknown WheelMap parameter: " + wm[0]);
                }
            }
        }
Exemplo n.º 3
0
        public VehicleAttachment(DocumentParser doc)
        {
            string s = doc.ReadNextLine();

            switch (s)
            {
            case "DynamicsWheels":
                Type = AttachmentType.DynamicsWheels;
                break;

            case "ComplicatedWheels":
                Type   = AttachmentType.ComplicatedWheels;
                Wheels = new VehicleAttachmentComplicatedWheels();

                while (!doc.NextLineIsASection())
                {
                    string[] cw = doc.ReadStringArray(2);

                    switch (cw[0])
                    {
                    case "fl_wheel_folder_name":
                        Wheels.FLWheel = cw[1];
                        break;

                    case "fr_wheel_folder_name":
                        Wheels.FRWheel = cw[1];
                        break;

                    case "rl_wheel_folder_name":
                        Wheels.RLWheel = cw[1];
                        break;

                    case "rr_wheel_folder_name":
                        Wheels.RRWheel = cw[1];
                        break;

                    case "wheel_folder_name":
                        Wheels.FLWheel = cw[1];
                        Wheels.FRWheel = cw[1];
                        Wheels.RLWheel = cw[1];
                        Wheels.RRWheel = cw[1];
                        break;

                    default:
                        throw new NotImplementedException("Unknown ComplicatedWheels parameter: " + cw[0]);
                    }
                }
                break;

            case "DynamicsFmodEngine":
                Type       = AttachmentType.DynamicsFmodEngine;
                FModEngine = new VehicleAttachmentFModEngine();

                while (!doc.NextLineIsASection())
                {
                    string[] dfe = doc.ReadStringArray(2);

                    switch (dfe[0])
                    {
                    case "engine":
                        FModEngine.Engine = dfe[1];
                        break;

                    case "rpmsmooth":
                        FModEngine.RPMSmooth = float.Parse(dfe[1], ToxicRagers.Culture);
                        break;

                    case "onloadsmooth":
                        FModEngine.OnLoadSmooth = float.Parse(dfe[1], ToxicRagers.Culture);
                        break;

                    case "offloadsmooth":
                        FModEngine.OffLoadSmooth = float.Parse(dfe[1], ToxicRagers.Culture);
                        break;

                    case "max_revs":
                        FModEngine.MaxRevs = int.Parse(dfe[1]);
                        break;

                    case "min_revs":
                        FModEngine.MinRevs = int.Parse(dfe[1]);
                        break;

                    case "max_speed":
                        FModEngine.MaxSpeed = int.Parse(dfe[1]);
                        break;

                    case "loadmin":
                        FModEngine.LoadMin = float.Parse(dfe[1], ToxicRagers.Culture);
                        break;

                    default:
                        throw new NotImplementedException("Unknown DynamicsFmodEngine parameter: " + dfe[0]);
                    }
                }
                break;

            case "Horn":
                Type = AttachmentType.Horn;

                string[] h = doc.ReadStringArray(2);
                Horn = h[1];
                break;

            case "ExhaustParticles":
                Type    = AttachmentType.ExhaustParticles;
                Exhaust = new VehicleAttachmentExhaust();

                while (!doc.NextLineIsASection())
                {
                    string[] ep = doc.ReadStringArray(2);

                    switch (ep[0])
                    {
                    case "vfx":
                        Exhaust.VFX = ep[1];
                        break;

                    case "underwater_vfx":
                        Exhaust.UnderwaterVFX = ep[1];
                        break;

                    case "anchor":
                        Exhaust.Anchor = ep[1];
                        break;

                    case "multiplier":
                        Exhaust.Multiplier = float.Parse(ep[1], ToxicRagers.Culture);
                        break;

                    case "neutral_multiplier":
                        Exhaust.NeutralMultiplier = float.Parse(ep[1], ToxicRagers.Culture);
                        break;

                    default:
                        throw new NotImplementedException("Unknown ExhaustParticle parameter: " + ep[0]);
                    }
                }
                break;

            case "ReverseLightSound":
                Type = AttachmentType.ReverseLightSound;

                string[] rl = doc.ReadStringArray(2);
                ReverseLightSound = rl[1];
                break;

            case "ContinuousSound":
                Type = AttachmentType.ContinuousSound;

                while (!doc.NextLineIsASection())
                {
                    string[] cs = doc.ReadStringArray(2);

                    switch (cs[0])
                    {
                    case "sound":
                        ContinuousSound = cs[1];
                        break;

                    case "lump":
                        ContinuousSoundLump = cs[1];
                        break;

                    default:
                        throw new NotImplementedException($"Unknown ContinuousSound parameter: {cs[0]}");
                    }
                }
                break;

            default:
                throw new NotImplementedException($"Unknown AttachmentType: {s}");
            }
        }