Exemple #1
0
        private static void ReadBlockFormat(RawImage ret, Stream ms)
        {
            ret.ColFormat = RawImage.Format.Format_ARGB;

            uint w = ret.Width;
            uint h = ret.Height;

            uint bw = (w + 3) / 4;
            uint bh = (h + 3) / 4;

            for (uint by = 0; by < bh; by++)
            {
                for (uint bx = 0; bx < bw; bx++)
                {
                    var block = new ColorBlock();

                    // Read color block.
                    ReadBlock(block, ms);

                    // Write color block.
                    for (uint y = 0; y < Math.Min(4, h - 4 * by); y++)
                    {
                        for (uint x = 0; x < Math.Min(4, w - 4 * bx); x++)
                        {
                            ret.Data[(4 * by + y) * ret.Width + (4 * bx + x)] = block.Color(x, y);
                        }
                    }
                }
            }
        }
Exemple #2
0
            public override void Item(Item item)
            {
                base.Item(item);
                if (item != null)
                {
                    bg.Texture(TextureCache.CreateSolid(item.IsEquipped(Dungeon.Hero) ? _equipped : _normal));
                    if (item.cursed && item.cursedKnown)
                    {
                        bg.RA = +0.2f;
                        bg.Ga = -0.1f;
                    }
                    else if (!item.Identified)
                    {
                        bg.RA = 0.1f;
                        bg.Ba = 0.1f;
                    }

                    if (item.Name == null)
                    {
                        Enable(false);
                    }
                    else
                    {
                        Enable(_owner.mode == Mode.FOR_SALE && (item.Price() > 0) &&
                               (!item.IsEquipped(Dungeon.Hero) || !item.cursed) ||
                               _owner.mode == Mode.UPGRADEABLE && item.Upgradable ||
                               _owner.mode == Mode.UNIDENTIFED && !item.Identified ||
                               _owner.mode == Mode.QUICKSLOT && (item.DefaultAction != null) ||
                               _owner.mode == Mode.WEAPON && (item is MeleeWeapon || item is Boomerang) ||
                               _owner.mode == Mode.ARMOR && (item is Armor) ||
                               _owner.mode == Mode.WAND && (item is Wand) ||
                               _owner.mode == Mode.SEED && (item is Plant.Seed) || _owner.mode == Mode.ALL);
                    }
                }
                else
                {
                    bg.Color(_normal);
                }
            }