Ejemplo n.º 1
0
        private void ReadCrushDataSection()
        {
            //3 sections: unused, car model, bonnet model

            for (int i = 0; i < 3; i++)
            {
                CrushSection section = new CrushSection();
                CrushSections.Add(section);

                Debug.WriteLine("CRUSH " + i);
                section.DamageMultiplier = ReadLineAsFloat(false);
                SkipLines(5); //unk1
                int nbrData = ReadLineAsInt();

                for (int m = 0; m < nbrData; m++)
                {
                    CrushData crushData = new CrushData();
                    section.Data.Add(crushData);

                    crushData.RefVertex = ReadLineAsInt();
                    crushData.Box       = new BoundingBox(ReadLineAsVector3(false), ReadLineAsVector3(false));
                    Vector3 v = ReadLineAsVector3(false);
                    crushData.RightScale = v.X;
                    crushData.TopScale   = v.Y;
                    crushData.RearScale  = v.Z;
                    v = ReadLineAsVector3(false);
                    crushData.LeftScale   = v.X;
                    crushData.BottomScale = v.Y;
                    crushData.FrontScale  = v.Z;
                    //crushData.MinScale = ReadLineAsVector3(false);
                    //crushData.MaxScale = ReadLineAsVector3(false);

                    int nbrPoints = ReadLineAsInt();
                    int curVertex = -1; // 0;// crushData.RefVertex;

                    for (int p = 0; p < nbrPoints; p++)
                    {
                        CrushPoint point = new CrushPoint();
                        curVertex               += ReadLineAsInt();
                        point.VertexIndex        = curVertex;
                        point.DistanceFromParent = ReadLineAsFloat(false) / 255f; //values are 0-255 so convert to 0-1
                        crushData.Points.Add(point);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public Vehicle(string filename, IDriver driver)
        {
            Driver = driver;
            Driver.Vehicle = this;

            Config = new VehicleFile(filename);

            if (driver is PlayerDriver)
            {
                if (Config.WindscreenMaterial != "none")
                    Config.Funks.Add(new WindscreenFunk(Config.WindscreenMaterial, this));
            }

            _model = new VehicleModel(Config, false);

            Audio = new VehicleAudio(this);

            Chassis = new VehicleChassis(this);

            CActor actor2 = _model.GetActor(Path.GetFileNameWithoutExtension(_model.ModelName));
            if (actor2 != null)
            {
                _deformableModel = (CDeformableModel)actor2.Model;
                _deformableModel._actor = Chassis.Actor;
                _deformableModel._carFile = Config;
            }

            _crushSection = Config.CrushSections[1];

            CMaterial crashMat = ResourceCache.GetMaterial(Config.CrashMaterialFiles[0]);
            _vehicleBitsEmitter = new ParticleEmitter(new VehicleBitsParticleSystem(crashMat), 3, Vector3.Zero);
            _vehicleBitsEmitter.DumpsPerSecond = 0.7f;

            DamageSmokeEmitter = new ParticleEmitter(new DamageSmokeParticleSystem(Color.Gray), 5, Vector3.Zero);
            DamageSmokeEmitter.Enabled = false;

            _flames = new PixmapBillboard(new Vector2(0.7f, 0.25f), "flames.pix");
            SkidMarkBuffer = new SkidMarkBuffer(this, 150);
        }
Ejemplo n.º 3
0
        private void ReadCrushDataSection()
        {
            //3 sections: unused, car model, bonnet model

            for (int i = 0; i < 3; i++)
            {
                CrushSection section = new CrushSection();
                CrushSections.Add(section);

                Debug.WriteLine("CRUSH " + i);
                section.DamageMultiplier = ReadLineAsFloat(false);
                SkipLines(5); //unk1
                int nbrData = ReadLineAsInt();

                for (int m = 0; m < nbrData; m++)
                {
                    CrushData crushData = new CrushData();
                    section.Data.Add(crushData);

                    crushData.RefVertex = ReadLineAsInt();
                    crushData.Box = new BoundingBox(ReadLineAsVector3(false), ReadLineAsVector3(false));
                    Vector3 v = ReadLineAsVector3(false);
                    crushData.RightScale = v.X;
                    crushData.TopScale = v.Y;
                    crushData.RearScale = v.Z;
                    v = ReadLineAsVector3(false);
                    crushData.LeftScale = v.X;
                    crushData.BottomScale = v.Y;
                    crushData.FrontScale = v.Z;
                    //crushData.MinScale = ReadLineAsVector3(false);
                    //crushData.MaxScale = ReadLineAsVector3(false);

                    int nbrPoints = ReadLineAsInt();
                    int curVertex = -1; // 0;// crushData.RefVertex;

                    for (int p = 0; p < nbrPoints; p++)
                    {
                        CrushPoint point = new CrushPoint();
                        curVertex += ReadLineAsInt();
                        point.VertexIndex = curVertex;
                        point.DistanceFromParent = ReadLineAsFloat(false) / 255f; //values are 0-255 so convert to 0-1
                        crushData.Points.Add(point);
                    }
                }
            }
        }