Beispiel #1
0
        public MapObjectStatic(int staticTileID, int sortInfluence, Position3D position)
            : base(position)
        {
            ItemID = staticTileID;
            SortTiebreaker = sortInfluence;

            _itemData = Data.TileData.ItemData[ItemID & 0x3FFF];

            // Set threshold.
            int background = (_itemData.Background) ? 0 : 1;
            if (!_itemData.Background)
                SortThreshold++;
            if (!(_itemData.Height == 0))
                SortThreshold++;
            if (_itemData.Surface)
                SortThreshold--;

            // get no draw flag
            if (_itemData.Name == "nodraw" || ItemID <= 0)
                _noDraw = true;

            // set up draw variables
            _draw_texture = Data.Art.GetStaticTexture(ItemID);
            _draw_width = _draw_texture.Width;
            _draw_height = _draw_texture.Height;
            _draw_X = (_draw_width >> 1) - 22;
            _draw_Y = (int)(Z * 4) + _draw_height - 44;
            _draw_hue = Vector2.Zero;
            _pickType = PickTypes.PickStatics;
            _draw_flip = false;
        }
Beispiel #2
0
        public TileData(InstallLocation install)
        {
            string filePath = install.GetPath("tiledata.mul");

            if (!string.IsNullOrEmpty(filePath))
            {
                using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    BinaryReader bin = new BinaryReader(fs);

                    m_LandData = new LandData[0x4000];

                    for (int i = 0; i < 0x4000; ++i)
                    {
                        if ((i & 0x1F) == 0)
                        {
                            bin.ReadInt32(); // header
                        }

                        TileFlag flags = (TileFlag)bin.ReadInt32();
                        bin.ReadInt16(); // skip 2 bytes -- textureID

                        m_LandData[i] = new LandData(ReadNameString(bin), flags);
                    }

                    m_ItemData = new ItemData[0x4000];
                    m_HeightTable = new int[0x4000];

                    for (int i = 0; i < 0x4000; ++i)
                    {
                        if ((i & 0x1F) == 0)
                        {
                            bin.ReadInt32(); // header
                        }

                        TileFlag flags = (TileFlag)bin.ReadInt32();
                        int weight = bin.ReadByte();
                        int quality = bin.ReadByte();
                        bin.ReadInt16();
                        bin.ReadByte();
                        int quantity = bin.ReadByte();
                        int anim = bin.ReadInt16();
                        bin.ReadInt16();
                        bin.ReadByte();
                        int value = bin.ReadByte();
                        int height = bin.ReadByte();

                        m_ItemData[i] = new ItemData(ReadNameString(bin), flags, weight, quality, quantity, value, height, anim);
                        m_HeightTable[i] = height;
                    }
                }
            }
            else
            {
                throw new FileNotFoundException();
            }
        }