示例#1
0
        public override void LoadFromRules()
        {
            base.LoadFromArtEssential();

            TransLucency = Art.ReadBool("Translucent") ? 50 : Art.ReadInt("Translucency", 0);

            Props.HasShadow = Art.ReadBool("Shadow", Defaults.GetShadowAssumption(CollectionType.Animation));

            Props.FrameDecider = FrameDeciders.LoopFrameDecider(
                Art.ReadInt("LoopStart"),
                Art.ReadInt("LoopEnd", 1));

            Flat = Art.ReadBool("DrawFlat", Defaults.GetFlatnessAssumption(OwnerCollection.Type)) ||
                   Art.ReadBool("Flat");
        }
示例#2
0
        public virtual void LoadFromRulesFull()
        {
            if (Art.ReadString("Remapable") != string.Empty)
            {
                // does NOT work in RA2
                if (OwnerCollection.Engine <= EngineType.Firestorm)
                {
                    IsRemapable = Art.ReadBool("Remapable");
                }
            }

            // Used palet can be overriden
            bool noUseTileLandType = Rules.ReadString("NoUseTileLandType") != "";

            if (noUseTileLandType)
            {
                Props.PaletteType  = PaletteType.Iso;
                Props.LightingType = LightingType.Full;
            }
            if (Art.ReadBool("TerrainPalette"))
            {
                Props.PaletteType = PaletteType.Iso;
                IsRemapable       = false;
            }
            else if (Art.ReadBool("AnimPalette"))
            {
                Props.PaletteType  = PaletteType.Anim;
                Props.LightingType = LightingType.None;
                IsRemapable        = false;
            }
            else if (Art.ReadString("Palette") != string.Empty)
            {
                Props.PaletteType       = PaletteType.Custom;
                Props.CustomPaletteName = Art.ReadString("Palette");
            }

            if (Rules.ReadString("AlphaImage") != "")
            {
                string alphaImageFile = Rules.ReadString("AlphaImage") + ".shp";
                if (VFS.Exists(alphaImageFile))
                {
                    var ad = new AlphaDrawable(VFS.Open <ShpFile>(alphaImageFile));
                    ad.OwnerCollection = OwnerCollection;
                    SubDrawables.Add(ad);
                }
            }

            Props.HasShadow = Art.ReadBool("Shadow", Defaults.GetShadowAssumption(OwnerCollection.Type));
            Flat            = Rules.ReadBool("DrawFlat", Defaults.GetFlatnessAssumption(OwnerCollection.Type)) ||
                              Rules.ReadBool("Flat");

            if (Rules.ReadBool("Wall"))
            {
                IsWall         = true;
                Flat           = false;
                IsBuildingPart = true;
                // RA2 walls appear a bit higher
                if (OwnerCollection.Engine >= EngineType.RedAlert2)
                {
                    Props.Offset.Offset(0, 3);                     // seems walls are located 3 pixels lower
                }
                Props.PaletteType  = PaletteType.Unit;
                Props.LightingType = LightingType.Ambient;
                Props.FrameDecider = FrameDeciders.OverlayValueFrameDecider;
            }
            if (Rules.ReadBool("Gate"))
            {
                IsGate             = true;
                Flat               = false;
                IsBuildingPart     = true;
                Props.PaletteType  = PaletteType.Unit;
                Props.FrameDecider = FrameDeciders.NullFrameDecider;
            }

            if (Rules.ReadBool("IsVeins"))
            {
                Props.LightingType = LightingType.None;
                Props.PaletteType  = PaletteType.Unit;
                IsVeins            = true;
                Flat           = true;
                Props.Offset.Y = -1;                 // why is this needed???
            }
            if (Rules.ReadBool("IsVeinholeMonster"))
            {
                Props.Offset.Y     = -49;             // why is this needed???
                Props.LightingType = LightingType.None;
                Props.PaletteType  = PaletteType.Unit;
                IsVeinHoleMonster  = true;
            }

            if (Rules.ReadString("Land") == "Rock")
            {
                Props.Offset.Y += TileHeight / 2;
                //mainProps.ZBufferAdjust += Drawable.TileHeight / 2;
            }
            else if (Rules.ReadString("Land") == "Road")
            {
                Props.Offset.Y += TileHeight / 2;
                // drawable.Foundation = new Size(3, 1); // ensures bridges are drawn a bit lower than where they're stored
            }
            else if (Rules.ReadString("Land") == "Railroad")
            {
                if (OwnerCollection.Engine <= EngineType.Firestorm)
                {
                    Props.Offset.Y = 11;
                }
                else
                {
                    Props.Offset.Y = 14;
                }
                Props.LightingType = LightingType.Full;
                Props.PaletteType  = PaletteType.Iso;
                // Foundation = new Size(2, 2); // hack to get these later in the drawing order
            }
            if (Rules.ReadBool("SpawnsTiberium"))
            {
                // For example on TIBTRE / Ore Poles
                Props.Offset.Y     = -1;
                Props.LightingType = LightingType.None;                 // todo: verify it's not NONE
                Props.PaletteType  = PaletteType.Unit;
            }
            if (Rules.HasKey("JumpjetHeight"))
            {
                Props.Offset.Offset(0, (int)(-Rules.ReadInt("JumpjetHeight") / 256.0 * TileHeight));
            }
            StartWalkFrame  = Rules.ReadInt("StartWalkFrame");
            StartStandFrame = Rules.ReadInt("StartStandFrame", StartWalkFrame);
            Props.Offset.Offset(Art.ReadInt("XDrawOffset"), Art.ReadInt("YDrawOffset"));
        }