예제 #1
0
		/// <summary>
		/// Draws the combos in the editor.
		/// </summary>
		public void Draw() {
            if (patterns == null || tiles == null) return;

			b.Begin(patterns.PatternImage, tiles);

			for(int row = 0; row < 16; row++) {
				for(int combo = 0; combo < 16; combo++ ) {
					int comboIndex = combo + (row + _ScrollPos)* 16;
					b.BlitTile(_Combos[comboIndex].GetByte(0), combo * 2, row * 2, (byte)_PaletteTable);
					b.BlitTile(_Combos[comboIndex].GetByte(1), combo * 2 + 1, row * 2, (byte)_PaletteTable);
					b.BlitTile(_Combos[comboIndex].GetByte(2), combo * 2, row * 2 + 1, (byte)_PaletteTable);
					b.BlitTile(_Combos[comboIndex].GetByte(3), combo * 2 + 1, row * 2 + 1, (byte)_PaletteTable);
				}
			}

			b.End();
			this.BackgroundImage = tiles;

			Invalidate();
		}
            public override void DoWork()
            {
                ColorPalette bitmapPalette = dest.Palette;
                NesPalette   bgPalette     = display._Level.BgPalette;
                NesPalette   spritePalette = display._Level.SpritePalette;

                // Todo: alt pal support
                //if (display..UseAltPalette && (display._Level.LevelIdentifier == LevelIndex.Brinstar || LevelData.LevelIdentifier == LevelIndex.Norfair))
                //    bgPalette = display._Level.BgAltPalette;

                // Load palettes twice
                bgPalette.ApplyTable(bitmapPalette.Entries);
                bgPalette.ApplyTable(bitmapPalette.Entries, 16);
                spritePalette.ApplyTable(bitmapPalette.Entries, 32);
                spritePalette.ApplyTable(bitmapPalette.Entries, 48);
                // Invert second paletteIndex for selections
                ApplyHighlightFilter(bitmapPalette);
                dest.Palette = bitmapPalette;

                bitmapPalette.Entries[NesPalette.HighlightEntry] = SystemColors.Highlight;


                b.Begin(display.Level.Patterns.PatternImage, dest);

                if (showPhysics)
                {
                    display.RenderPhysics(b);
                    display.RederEnemies(b, sprites);
                }
                else
                {
                    for (int x = 0; x < 32; x++)
                    {
                        for (int y = 0; y < 30; y++)
                        {
                            int tile = display.tiles[x, y];
                            b.BlitTile(tile, x, y, display.colors[x, y]);
                        }
                    }


                    display.RederEnemies(b, sprites);
                    if (doors != null)
                    {
                        foreach (DoorInstance d in doors)
                        {
                            byte pal = 9;
                            if (d.Type == DoorType.Missile)
                            {
                                pal = 8;
                            }
                            else if (d.Type == DoorType.TenMissile)
                            {
                                pal = 10;
                            }

                            if (d.Side == DoorSide.Left)
                            {
                                Graphic.SpriteDefinition.LeftDoor.Draw(b, 2, 0xA, pal);
                            }
                            else
                            {
                                Graphic.SpriteDefinition.RightDoor.Draw(b, 0x1D, 0xA, pal);
                            }
                        }
                    }
                }

                if (!showPhysics)
                {
                    ////if (display.gameItem != null)
                    ////    display.gameItem.Draw(b);


                    for (int i = 0; i < display._sprites.Count; i++)
                    {
                        SpriteListItem item = display._sprites[i];
                        item.SpriteDefinition.Draw(b, item.Location.X, item.Location.Y, (byte)(item.PaletteIndex));
                    }
                }

                b.End();
            }
예제 #3
0
 public void Dispose()
 {
     b.End();
 }