Ejemplo n.º 1
0
        // Draw the background and return it as blitimage.
        public BlitImage RenderBackground(int index)
        {
            if (index >= 0 && index < Backgrounds.Count)
            {
                BackgroundTiles tiles = ((Background)Backgrounds [index]).MyBackgroundTiles;
                if (tiles != null)
                {
                    byte [] b = tiles.Render(ActiveTileSet);
                    return(new BlitImage(b, 256));
                }
            }
            var image = new BlitImage(256, 256);

            image.Black();
            return(image);
        }
Ejemplo n.º 2
0
        // Renders a screen from the active room.
        public bool RenderScreen(BlitImage screenImage, int x, int y)
        {
            int  rowMin        = y * 16;
            int  colMin        = x * 16;
            bool HasLayer2     = ActiveLevelData?.HasLayer2 ?? false;
            bool HasBackground = ActiveBackground?.MyBackgroundTiles != null;

            screenImage.Black();

            if (BackgroundVisible)
            {
                if (BackgroundImage != null)
                {
                    RenderSceenBackground(screenImage);
                }
                else if (HasLayer2)
                {
                    RenderSceenLayer2(screenImage, rowMin, colMin);
                }
            }
            if (ForegroundVisible)
            {
                RenderSceenLayer1(screenImage, rowMin, colMin);
            }
            if (PlmsVisible)
            {
                RenderScreenPlms(screenImage, rowMin, colMin);
            }
            if (EnemiesVisible)
            {
                RenderScreenEnemies(screenImage, rowMin, colMin);
            }
            if (BtsVisible)
            {
                RenderScreenBts(screenImage, rowMin, colMin);
            }
            if (ScrollsVisible)
            {
                RenderRoomScroll(screenImage, x, y);
                RenderScrollModification(screenImage, x, y);
            }
            return(true);
        }
Ejemplo n.º 3
0
        // Render map tile sheet.
        public BlitImage RenderMapTileSheet(int paletteRow)
        {
            if (paletteRow < 0 || paletteRow >= 8)
            {
                paletteRow = 0;
            }
            BlitImage MapTileSheet = new BlitImage(128, 128);

            MapTileSheet.Black();
            int offset = 256 * paletteRow;

            for (int y = 0; y < 16; y++)
            {
                for (int x = 0; x < 16; x++)
                {
                    MapTileSheet.Blit(MapTiles [offset + 16 * y + x], 8 * x, 8 * y, false, false);
                }
            }
            return(MapTileSheet);
        }
Ejemplo n.º 4
0
//----------------------------------------------------------------------------------------


        // Renders a screen from a room.
        public void RenderScreen(int areaIndex, int roomIndex, BlitImage screenImage,
                                 int x, int y)
        {
            if (areaIndex >= 0 && areaIndex < AreaCount &&
                roomIndex >= 0 && roomIndex < Rooms [areaIndex].Count)
            {
                ActiveItems a = new ActiveItems(this);
                ActiveRoom      = (Room)Rooms [areaIndex] [roomIndex];
                ActiveRoomState = ActiveRoom.RoomStates.Last();
                LoadRoomTiles(ActiveRoomState.TileSet);
                LoadBackground();
                RenderScreen(screenImage, x, y);
                ActiveRoom      = a.ActiveRoom;
                ActiveRoomState = a.ActiveRoomState;
                LoadRoomTiles(ActiveRoomState.TileSet);
                LoadBackground();
            }
            else
            {
                screenImage.Black();
            }
        }
Ejemplo n.º 5
0
        // Render Area map.
        public BlitImage RenderAreaMap()
        {
            BlitImage image = new BlitImage(512, 256);

            image.Black();
            AreaMap map;

            if (AreaIndex != IndexNone)
            {
                map = (AreaMap)AreaMaps [AreaIndex];
                for (int y = 0; y < 32; y++)
                {
                    for (int x = 0; x < 64; x++)
                    {
                        int  index     = 64 * y + x;
                        int  tileIndex = 256 * map.GetPalette(index) + map.GetTile(index);
                        bool hFlip     = map.GetHFlip(index);
                        bool vFlip     = map.GetVFlip(index);
                        image.Blit(MapTiles [tileIndex], 8 * x, 8 * y, hFlip, vFlip);
                    }
                }
            }
            return(image);
        }