Example #1
0
        public void Set(int index, int x, int y, byte floorSubImage, byte ceilingSubImage, byte wallSubImage, int frame)
        {
            bool isAnimated = Floors.IsAnimated(floorSubImage) || Floors.IsAnimated(ceilingSubImage) || Walls.IsAnimated(wallSubImage);

            if (isAnimated)
            {
                AnimatedTiles.Add(index);
            }
            else
            {
                AnimatedTiles.Remove(index);
            }

            unsafe
            {
                fixed(Tile *tile = &Tiles[index])
                {
                    tile->TilePosition = new Vector2(x, y);
                    tile->Floor        = (byte)Floors.GetSubImageAtTime(floorSubImage, frame);
                    tile->Ceiling      = (byte)Floors.GetSubImageAtTime(ceilingSubImage, frame);
                    tile->Wall         = (byte)Walls.GetSubImageAtTime(wallSubImage, frame);
                    tile->Flags        = 0; // TileFlags.UsePalette;
                    var subImage = Walls.GetSubImageDetails(tile->Wall);

                    tile->WallSize = subImage.TexSize;
                }
            }
        }