private void FindDoors()
        {
            for (int y = 0; y < 32; y++)
            {
                for (int x = 0; x < 32; x++)
                {
                    LevelIndex level = map.GetLevel(x, y);
                    if (level != LevelIndex.None)
                    {
                        int screenIndex = rom.GetScreenIndex(x, y);
                        if (screenIndex < rom[level].Screens.Count)
                        {
                            Screen screen = rom.GetLevel(level).Screens[screenIndex];

                            if (screen.RightDoor != null && (screen.RightDoor.Type == DoorType.Missile || screen.RightDoor.Type == DoorType.TenMissile))
                            {
                                TreeNode n = new TreeNode("(" + x.ToString("x") + ", " + y.ToString("x") + ")", 10, 10);
                                n.Tag = new datTag(new Point(x, y), 10);
                                DoorNode.Nodes.Add(n);

                                checkedItemCount++;
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        private void DrawScreen(int gameX, int gameY, int mapx, int mapY)
        {
            // Get currentLevelIndex and screen
            LevelIndex level        = levelMap.GetLevel(gameX, gameY);
            bool       invalidLevel = false;

            if (level == LevelIndex.None ||
                (levelFilter != LevelIndex.None && level != levelFilter))
            {
                return;
                ////if(!fillEmptySpots) return;

                ////if(levelFilter != LevelIndex.None)
                ////    level = levelFilter;
                ////else
                ////    level = GuessLevel(gameX, gameY);

                ////if(level == LevelIndex.Tourian)
                ////    level = LevelIndex.Kraid;

                ////invalidLevel = true;
            }

            Level levelData   = rom.GetLevel(level);
            int   screenIndex = rom.GetScreenIndex(gameX, gameY);

            if (screenIndex == 0xFF || invalidLevel)  // Blank screen
            {
                screenIndex = GetBlankScreenIndex(level);
            }



            Screen screen = levelData.Screens[screenIndex];

            // Load data into renderer
            renderer.Level         = levelData;
            renderer.SelectedEnemy = -1;

            // Apply paletteIndex
            //screen.ApplyLevelPalette(screenBitmap); // Sprites
            //renderer.ApplyPalette(screenBitmap, levelMap.GetAltPal(gameX, gameY)); // Backgrounds
            ScreenEditor.ApplyPalette(levelMap.GetAltPal(gameX, gameY), levelData, screenBitmap, HighlightEffect.Invert);

            // Render Screen
            renderer.DefaultPalette = screen.ColorAttributeTable;
            renderer.Clear();
            renderer.SelectedDoor = -1;
            renderer.DrawScreen(screenIndex);
            IList <EnemyInstance> enemies = hideEnemies ? null : screen.Enemies;

            renderer.Render(b, screenBitmap, enemies, screen.Doors, showPhysics);

            Rectangle source = new Rectangle(0, 0, ScreenWidth, ScreenHeight);
            Rectangle dest   = new Rectangle(
                mapx * ScreenWidth / scale, mapY * ScreenHeight / scale,
                ScreenWidth / scale, ScreenHeight / scale);

            gMap.DrawImage(screenBitmap, dest, source, GraphicsUnit.Pixel);
        }
示例#3
0
        void OnLayoutRendered(object sender, EventArgs e)
        {
            if (!useScreenImages)
            {
                return;
            }

            Rectangle src = new Rectangle(0, 0, 256, 240);

            LayoutIndex index = renderer.RenderedLayout;

            for (int x = 0; x < 32; x++)
            {
                for (int y = 0; y < 32; y++)
                {
                    if (GetLevel(x, y) == index.Level && rom.GetScreenIndex(x, y) == index.ScreenIndex && GetAltPal(x, y) == index.AltPalette)
                    {
                        Rectangle dest = new Rectangle(x * mapTileWidth, y * mapTileHeight, mapTileWidth, mapTileHeight);
                        _gMapImage.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
                        _gMapImage.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.Half;

                        _gMapImage.DrawImage(renderer.RenderedImage, dest, src, GraphicsUnit.Pixel);
                        if (PerformingInitialRender)
                        {
                            if ((index.ScreenIndex % 5) == 0 || index.ScreenIndex == rom.GetLevel(index.Level).Screens.Count - 1)
                            {
                                Invalidate();
                            }
                        }
                        else
                        {
                            Invalidate();
                        }
                    }
                }
            }
        }
示例#4
0
 public SetScreenIndex PreviousLayout()
 {
     return(new SetScreenIndex(queue, editor.MapLocation, (rom.GetScreenIndex(editor.MapLocation.X, editor.MapLocation.Y) + CurrentLevel.Screens.Count - 1) % CurrentLevel.Screens.Count));
 }