Esempio n. 1
0
        protected override bool ReadInternal()
        {
            Objects = new List <MapObjectBase>();

            if (base.ReadInternal() == false)
            {
                return(false);
            }

            // @TODO: Test this, take-over from open-ro
            if (FileHeader.Version.Major == 1 && FileHeader.Version.Minor >= 2 && FileHeader.Version.Minor <= 9)
            {
                // supported [1.2 1.9]
            }
            else if (FileHeader.Version.Major == 2 && FileHeader.Version.Minor <= 2)
            {
                // supported [2.0 2.1]
            }
            else
            {
                Debug.WriteLine("[RSW] I don't know how to properly read rsw version {0}, but i'm gonna try...", FileHeader.Version);
            }

            IniFilename = Reader.ReadStringIso(40);
            GndFilename = Reader.ReadStringIso(40);
            // Gat filename sice 1.4
            if (FileHeader.Version.IsCompatible(1, 4))
            {
                GatFilename = Reader.ReadStringIso(40);
            }
            else
            {
                GatFilename = string.Empty;
            }

            ScrFilename = Reader.ReadStringIso(40);

            WaterData  = new WaterData(this);
            LightData  = new LightData(this);
            GroundData = new GroundData(this);

            var objectCount = Reader.ReadInt32();

            for (var i = 0; i < objectCount; i++)
            {
                var objectType = (MapObjectType)Reader.ReadInt32();
                switch (objectType)
                {
                case MapObjectType.Model:
                    var modelObject = new Model(this);
                    Objects.Add(modelObject);
                    break;

                case MapObjectType.Light:
                    var lightObject = new Light(this);
                    Objects.Add(lightObject);
                    break;

                case MapObjectType.Sound:
                    var soundObject = new Sound(this);
                    Objects.Add(soundObject);
                    break;

                case MapObjectType.Effect:
                    var effectObject = new Effect(this);
                    Objects.Add(effectObject);
                    break;

                default:
                    Debug.WriteLine("[RSW] Unknown object with type {0}", objectType);
                    break;
                }
            }

            // @TODO: QuadTree

            return(true);
        }
Esempio n. 2
0
        protected override bool ReadInternal()
        {
            Objects = new List<MapObjectBase>();

            if (base.ReadInternal() == false) {
                return false;
            }

            // @TODO: Test this, take-over from open-ro
            if (FileHeader.Version.Major == 1 && FileHeader.Version.Minor >= 2 && FileHeader.Version.Minor <= 9) {
                // supported [1.2 1.9]
            } else if (FileHeader.Version.Major == 2 && FileHeader.Version.Minor <= 2) {
                // supported [2.0 2.1]
            } else {
                Debug.WriteLine("[RSW] I don't know how to properly read rsw version {0}, but i'm gonna try...", FileHeader.Version);
            }

            IniFilename = Reader.ReadStringIso(40);
            GndFilename = Reader.ReadStringIso(40);
            // Gat filename sice 1.4
            if (FileHeader.Version.IsCompatible(1, 4)) {
                GatFilename = Reader.ReadStringIso(40);
            } else {
                GatFilename = string.Empty;
            }

            ScrFilename = Reader.ReadStringIso(40);

            WaterData = new WaterData(this);
            LightData = new LightData(this);
            GroundData = new GroundData(this);

            var objectCount = Reader.ReadInt32();
            for (var i = 0; i < objectCount; i++) {
                var objectType = (MapObjectType)Reader.ReadInt32();
                switch (objectType) {
                    case MapObjectType.Model:
                        var modelObject = new Model(this);
                        Objects.Add(modelObject);
                        break;

                    case MapObjectType.Light:
                        var lightObject = new Light(this);
                        Objects.Add(lightObject);
                        break;

                    case MapObjectType.Sound:
                        var soundObject = new Sound(this);
                        Objects.Add(soundObject);
                        break;

                    case MapObjectType.Effect:
                        var effectObject = new Effect(this);
                        Objects.Add(effectObject);
                        break;

                    default:
                        Debug.WriteLine("[RSW] Unknown object with type {0}", objectType);
                        break;
                }
            }

            // @TODO: QuadTree

            return true;
        }