private Bitmap drawOverworldTile() { MinimapLoader minimapLoader = new MinimapLoader(LAGame); byte[,,] graphicsData = minimapLoader.loadMinimapOverworld(); Bitmap bmp = new Bitmap(8, 8); FastPixel fp = new FastPixel(bmp); fp.rgbValues = new byte[8 * 8 * 4]; fp.Lock(); byte i; for (int y = 0; y < 8; y++) { for (int x = 0; x < 8; x++) { byte miniD = (byte)nTile.Value; byte pal = (byte)nPalette.Value; if (miniD == 0x70 || miniD == 0x71 || miniD == 0x72 || miniD == 0x73 || miniD == 0x74 || miniD == 0x75) { i = (byte)(miniD - 0x66); } else { i = (byte)(miniD + 16); } fp.SetPixel(x, y, palette[pal, graphicsData[i, x, y]]); } } fp.Unlock(true); return(bmp); }
private void loadMinimaps() { MinimapLoader minimapLoader = new MinimapLoader(LAGame); TileDrawer tileDrawer = new TileDrawer(); if (LAGame.overworldFlag) { pMinimapO.Image = tileDrawer.drawOverworldMinimapTiles(minimapLoader.loadMinimapOverworld(), minimapLoader.minimapGraphics, minimapLoader.overworldPal, minimapLoader.palette); overworldPalette = minimapLoader.overworldPal; } else { minimapLoader.loadMinimapDData(); pMinimapD.Image = tileDrawer.drawDungeonMinimapTiles(minimapLoader.loadMinimapDungeon(), minimapLoader.minimapGraphics); } minimapData = minimapLoader.minimapGraphics; roomIndexes = minimapLoader.roomIndexes; }
private void drawOverworldItems() { MinimapLoader minimapLoader = new MinimapLoader(LAGame); byte[,,] graphicsData = minimapLoader.loadMinimapOverworld(); Bitmap bmp = new Bitmap(128, 64); FastPixel fp = new FastPixel(bmp); fp.rgbValues = new byte[128 * 64 * 4]; fp.Lock(); int i = 0; for (int y = 1; y < 8; y++) { for (int x = 0; x < 16; x++) { for (int y1 = 0; y1 < 8; y1++) { for (int x1 = 0; x1 < 8; x1++) { if (y == 7 && x < 6) { fp.SetPixel(x1 + (x * 8), y1 + ((y - 1) * 8), palette[(byte)nPalette.Value, graphicsData[x + (y * 16), x1, y1]]); fp.SetPixel(x1 + (x * 8), y1 + (y * 8), palette[(byte)nPalette.Value, graphicsData[x + 10 + ((y - 7) * 16), x1, y1]]); } else { fp.SetPixel(x1 + (x * 8), y1 + ((y - 1) * 8), palette[(byte)nPalette.Value, graphicsData[x + (y * 16), x1, y1]]); } } } i++; } } fp.Unlock(true); gridBoxOverworldTile.Image = bmp; }
private void pMinimapO_MouseDown(object sender, MouseEventArgs e) { MinimapLoader minimapLoader = new MinimapLoader(LAGame); minimapLoader.loadMinimapOverworld(); if (e.Button == MouseButtons.Right) { selectedTile = minimapData[(e.X / 8) + (e.Y / 8) * 16]; selectedPalette = overworldPalette[((e.X / 8) + (e.Y / 8) * 16)]; if (selectedTile > 0x6F) { selectedTile -= 0x8A; } nTile.Value = selectedTile; nPalette.Value = selectedPalette; } else if (e.Button == MouseButtons.Left) { Graphics g = Graphics.FromImage(pMinimapO.Image); g.DrawImage(pTile.Image, new Rectangle(e.X / 8 * 8, e.Y / 8 * 8, 8, 8)); overworldPalette[((e.X / 8) + (e.Y / 8) * 16)] = selectedPalette; LAGame.gbROM.WriteByte((0x81797 + ((e.X / 8) + (e.Y / 8) * 16)), selectedPalette); if (selectedTile > 0x6F) { selectedTile += 0x8A; } minimapData[(e.X / 8) + (e.Y / 8) * 16] = selectedTile; LAGame.gbROM.WriteByte(0x81697 + ((e.X / 8) + (e.Y / 8) * 16), selectedTile); if (selectedTile > 0x6F) { selectedTile -= 0x8A; } } }
private void drawDungeonItems() { MinimapLoader minimapLoader = new MinimapLoader(LAGame); minimapLoader.loadMinimapDData(); byte[,,] graphicsData = minimapLoader.loadMinimapDungeon(); Bitmap bmp = new Bitmap(128, 128); FastPixel fp = new FastPixel(bmp); fp.rgbValues = new byte[128 * 128 * 4]; fp.Lock(); for (int x = 0; x < 4; x++) { for (int y1 = 0; y1 < 8; y1++) { for (int x1 = 0; x1 < 8; x1++) { if (x == 0) { fp.SetPixel(x1 + (x * 8), y1, chestPalette[graphicsData[0, x1, y1]]); } else if (x == 3) { fp.SetPixel(x1 + (x * 8), y1, Color.FromArgb(44, 50, 89)); } else { fp.SetPixel(x1 + (x * 8), y1, bwPalette[graphicsData[x, x1, y1]]); } } } } fp.Unlock(true); pTiles.Image = bmp; }