Exemplo n.º 1
0
        public static TextureDictionary Stack(this List <TextureDictionary> dictionaries)
        {
            var stacked = new TextureDictionary();

            foreach (var dictionary in dictionaries)
            {
                foreach (var texture in dictionary.Values)
                {
                    if (stacked.ContainsKey(texture.Name))
                    {
                        stacked[texture.Name] = texture;
                    }
                    else
                    {
                        stacked.Add(texture.Name, texture);
                    }
                }

                foreach (var translucent in dictionary.Translucents)
                {
                    if (!stacked.Translucents.Contains(translucent))
                    {
                        stacked.Translucents.Add(translucent);
                    }
                }
            }

            return(stacked);
        }
Exemplo n.º 2
0
        public virtual void UpdateTextures(TextureDictionary textures)
        {
            foreach (MapObject mo in MapObjects)
            {
                mo.UpdateTextures(textures);
            }

            SortTranslucents();
        }
Exemplo n.º 3
0
        public QuakeMapObject(Block block, DefinitionDictionary definitions, TextureDictionary textures) :
            base(block, definitions, textures)
        {
            QuakeBlock quakeBlock;

            if (block is QuakeBlock)
            {
                quakeBlock = block as QuakeBlock;
            }
            else
            {
                throw new ArgumentException("Provided Block isn't actually a QuakeBlock!");
            }

            KeyVals = new Dictionary <string, Option>(quakeBlock.KeyVals);

            if (definitions.ContainsKey(KeyVals["classname"].Value))
            {
                Definition = definitions[KeyVals["classname"].Value];
            }
            else
            {
                Definition = new Definition();
            }

            Saveability = Definition.Saveability;

            TextureCollection = textures;

            foreach (Block child in quakeBlock.Children)
            {
                if (child.KeyVals.Count > 0)
                {
                    Children.Add(new QuakeMapObject(child, definitions, textures));
                }
                else
                {
                    ExtractRenderables(child);
                }
            }

            ExtractRenderables(quakeBlock);

            UpdateBounds();

            Position = Aabb.Center;

            if (KeyVals.ContainsKey("origin"))
            {
                Position = KeyVals["origin"].Value.ToVector3();
            }
            else if (Definition.ClassName == "worldspawn")
            {
                Position = new Vector3(0, 0, 0);
            }
        }
Exemplo n.º 4
0
        public Map(Stream stream, DefinitionDictionary definitions, TextureDictionary textures)
        {
            if (stream is FileStream f)
            {
                AbsolutePath = f.Name;
            }

            Definitions = definitions;

            _textures = textures;
        }
Exemplo n.º 5
0
        virtual public void UpdateTextures(TextureDictionary textures)
        {
            foreach (var child in Children)
            {
                child.UpdateTextures(textures);
            }

            foreach (var renderable in Renderables)
            {
                renderable.UpdateTextures(textures);
            }
        }
Exemplo n.º 6
0
 public Map(Map map)
 {
     Raw                  = map.Raw;
     Aabb                 = new Aabb(map.Aabb);
     AbsolutePath         = map.AbsolutePath;
     OpenDelimiter        = map.OpenDelimiter;
     CloseDelimiter       = map.CloseDelimiter;
     Definitions          = new DefinitionDictionary(map.Definitions);
     MapObjects           = new List <MapObject>(map.MapObjects);
     InitializedInBackEnd = false;
     _textures            = new TextureDictionary(map.Textures);
 }
Exemplo n.º 7
0
 public MapObject(MapObject mo)
 {
     Aabb              = new Aabb(mo.Aabb);
     Children          = new List <MapObject>(mo.Children);
     Color             = new Color4(mo.Color.R, mo.Color.G, mo.Color.B, mo.Color.A);
     Definition        = new Definition(mo.Definition);
     KeyVals           = new Dictionary <string, Option>(mo.KeyVals);
     Position          = new Vector3(mo.Position);
     Renderables       = new List <Renderable>(mo.Renderables);
     Saveability       = mo.Saveability;
     TextureCollection = new TextureDictionary(mo.TextureCollection);
     Translucent       = mo.Translucent;
     UserData          = mo.UserData;
 }
Exemplo n.º 8
0
        public static TextureDictionary LoadTextureDictionary(string fileName, Palette palette)
        {
            TextureDictionary textures;

            bool isWad2 = Path.GetExtension(fileName).ToLower() == ".wad";

            if (isWad2)
            {
                textures = new Wad2(fileName, palette);
            }
            else
            {
                textures = new TextureDictionary();
            }

            return(textures);
        }
Exemplo n.º 9
0
 public MapObject(Block block, DefinitionDictionary definitions, TextureDictionary textures) : this()
 {
 }
Exemplo n.º 10
0
 public TextureDictionary(TextureDictionary collection) : base(collection)
 {
 }