public void exitProperty_Click(object sender, EventArgs e) { exitPropForm.SetExit(lastselectedExit); DialogResult dr = exitPropForm.ShowDialog(); if (dr == DialogResult.OK) { int index = Array.IndexOf(scene.ow.allexits, lastselectedExit); scene.ow.allexits[index] = exitPropForm.editingExit; lastselectedExit = scene.ow.allexits[index]; scene.selectedMode = ObjectMode.Exits; scene.Invalidate(new Rectangle(scene.mainForm.panel5.HorizontalScroll.Value, scene.mainForm.panel5.VerticalScroll.Value, scene.mainForm.panel5.Width, scene.mainForm.panel5.Height)); } else if (dr == DialogResult.Yes) { scene.selectedMode = ObjectMode.OWDoor; if (lastselectedExit.doorType1 != 0) //wooden door { scene.selectedTile = new ushort[2]; scene.selectedTileSizeX = 2; scene.selectedTile[0] = 1865; scene.selectedTile[1] = 1866; } else if ((lastselectedExit.doorType2 & 0x8000) != 0) //castle door { scene.selectedTile = new ushort[4]; scene.selectedTileSizeX = 2; scene.selectedTile[0] = 3510; scene.selectedTile[1] = 3511; scene.selectedTile[2] = 3512; scene.selectedTile[3] = 3513; } else if ((lastselectedExit.doorType2 & 0x7FFF) != 0) //sanc door { scene.selectedTile = new ushort[2]; scene.selectedTileSizeX = 2; scene.selectedTile[0] = 3502; scene.selectedTile[1] = 3503; } } else { scene.selectedMode = ObjectMode.Exits; } selectedExit = null; scene.mouse_down = false; }
public void onMouseDown(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { for (int i = 0; i < 78; i++) { ExitOW en = scene.ow.allexits[i]; if (en.mapId >= scene.ow.worldOffset && en.mapId < 64 + scene.ow.worldOffset) { if (e.X >= en.playerX && e.X < en.playerX + 16 && e.Y >= en.playerY && e.Y < en.playerY + 16) { if (scene.mouse_down == false) { selectedExit = en; lastselectedExit = en; scene.Invalidate(new Rectangle(scene.mainForm.panel5.HorizontalScroll.Value, scene.mainForm.panel5.VerticalScroll.Value, scene.mainForm.panel5.Width, scene.mainForm.panel5.Height)); scene.mouse_down = true; } } } } } }
public void Draw(Graphics g) { int transparency = 200; if (scene.lowEndMode) { for (int i = 0; i < 78; i++) { g.CompositingMode = CompositingMode.SourceOver; ExitOW ex = scene.ow.allexits[i]; if (ex.mapId != scene.ow.allmaps[scene.selectedMap].parent) { continue; } if (ex.mapId < 64 + scene.ow.worldOffset && ex.mapId >= scene.ow.worldOffset) { Brush bgrBrush = new SolidBrush(Color.FromArgb((int)transparency, 222, 222, 222)); Pen contourPen = new Pen(Color.FromArgb((int)transparency, 0, 0, 0)); Brush fontBrush = Brushes.Black; if (selectedExit == null) { if (lastselectedExit == ex) { g.CompositingMode = CompositingMode.SourceOver; bgrBrush = new SolidBrush(Color.FromArgb((int)transparency, 160, 160, 160)); g.FillRectangle(bgrBrush, new Rectangle(ex.playerX, ex.playerY, 16, 16)); g.DrawRectangle(contourPen, new Rectangle(ex.playerX, ex.playerY, 16, 16)); scene.drawText(g, ex.playerX + 4, ex.playerY + 4, i.ToString("X2")); int sy = ex.mapId / 8; int sx = ex.mapId - (sy * 8); g.DrawRectangle(Pens.LightPink, new Rectangle(ex.xScroll, ex.yScroll, 256, 224)); g.DrawLine(Pens.Blue, ex.cameraX - 8, ex.cameraY, ex.cameraX + 8, ex.cameraY); g.DrawLine(Pens.Blue, ex.cameraX, ex.cameraY - 8, ex.cameraX, ex.cameraY + 8); g.CompositingMode = CompositingMode.SourceCopy; continue; } g.FillRectangle(bgrBrush, new Rectangle(ex.playerX, ex.playerY, 16, 16)); g.DrawRectangle(contourPen, new Rectangle(ex.playerX, ex.playerY, 16, 16)); scene.drawText(g, ex.playerX + 4, ex.playerY + 4, i.ToString("X2")); } else { if (selectedExit == ex) { g.CompositingMode = CompositingMode.SourceOver; //g.DrawImage(jsonData.linkGfx, ex.playerX, ex.playerY, new Rectangle(16, 0, 16, 16), GraphicsUnit.Pixel); //g.DrawImage(jsonData.linkGfx, ex.playerX, ex.playerY + 8, new Rectangle(48, 16, 16, 16), GraphicsUnit.Pixel); g.CompositingMode = CompositingMode.SourceOver; bgrBrush = new SolidBrush(Color.FromArgb((int)transparency, 160, 160, 160)); g.FillRectangle(bgrBrush, new Rectangle(ex.playerX, ex.playerY, 16, 16)); g.DrawRectangle(contourPen, new Rectangle(ex.playerX, ex.playerY, 16, 16)); scene.drawText(g, ex.playerX + 4, ex.playerY + 4, i.ToString("X2")); g.CompositingMode = CompositingMode.SourceCopy; int sy = ex.mapId / 8; int sx = ex.mapId - (sy * 8); g.DrawRectangle(Pens.LightPink, new Rectangle(ex.xScroll, ex.yScroll, 256, 224)); g.DrawLine(Pens.Blue, ex.cameraX - 8, ex.cameraY, ex.cameraX + 8, ex.cameraY); g.DrawLine(Pens.Blue, ex.cameraX, ex.cameraY - 8, ex.cameraX, ex.cameraY + 8); } else { g.FillRectangle(bgrBrush, new Rectangle(ex.playerX, ex.playerY, 16, 16)); g.DrawRectangle(contourPen, new Rectangle(ex.playerX, ex.playerY, 16, 16)); scene.drawText(g, ex.playerX + 4, ex.playerY + 4, i.ToString("X2")); } } } } g.CompositingMode = CompositingMode.SourceCopy; } else { for (int i = 0; i < 78; i++) { g.CompositingMode = CompositingMode.SourceOver; ExitOW ex = scene.ow.allexits[i]; if (ex.mapId < 64 + scene.ow.worldOffset && ex.mapId >= scene.ow.worldOffset) { Brush bgrBrush = new SolidBrush(Color.FromArgb((int)transparency, 222, 222, 222)); Pen contourPen = new Pen(Color.FromArgb((int)transparency, 0, 0, 0)); Brush fontBrush = Brushes.Black; if (selectedExit == null) { if (lastselectedExit == ex) { g.CompositingMode = CompositingMode.SourceOver; bgrBrush = new SolidBrush(Color.FromArgb((int)transparency, 160, 160, 160)); g.FillRectangle(bgrBrush, new Rectangle(ex.playerX, ex.playerY, 16, 16)); g.DrawRectangle(contourPen, new Rectangle(ex.playerX, ex.playerY, 16, 16)); scene.drawText(g, ex.playerX + 4, ex.playerY + 4, i.ToString("X2")); int sy = ex.mapId / 8; int sx = ex.mapId - (sy * 8); g.DrawRectangle(Pens.LightPink, new Rectangle(ex.xScroll, ex.yScroll, 256, 224)); g.DrawLine(Pens.Blue, ex.cameraX - 8, ex.cameraY, ex.cameraX + 8, ex.cameraY); g.DrawLine(Pens.Blue, ex.cameraX, ex.cameraY - 8, ex.cameraX, ex.cameraY + 8); g.CompositingMode = CompositingMode.SourceCopy; continue; } g.FillRectangle(bgrBrush, new Rectangle(ex.playerX, ex.playerY, 16, 16)); g.DrawRectangle(contourPen, new Rectangle(ex.playerX, ex.playerY, 16, 16)); scene.drawText(g, ex.playerX + 4, ex.playerY + 4, i.ToString("X2")); } else { if (selectedExit == ex) { g.CompositingMode = CompositingMode.SourceOver; //g.DrawImage(jsonData.linkGfx, ex.playerX, ex.playerY, new Rectangle(16, 0, 16, 16), GraphicsUnit.Pixel); //g.DrawImage(jsonData.linkGfx, ex.playerX, ex.playerY + 8, new Rectangle(48, 16, 16, 16), GraphicsUnit.Pixel); g.CompositingMode = CompositingMode.SourceOver; bgrBrush = new SolidBrush(Color.FromArgb((int)transparency, 160, 160, 160)); g.FillRectangle(bgrBrush, new Rectangle(ex.playerX, ex.playerY, 16, 16)); g.DrawRectangle(contourPen, new Rectangle(ex.playerX, ex.playerY, 16, 16)); scene.drawText(g, ex.playerX + 4, ex.playerY + 4, i.ToString("X2")); g.CompositingMode = CompositingMode.SourceCopy; int sy = ex.mapId / 8; int sx = ex.mapId - (sy * 8); g.DrawRectangle(Pens.LightPink, new Rectangle(ex.xScroll, ex.yScroll, 256, 224)); g.DrawLine(Pens.Blue, ex.cameraX - 8, ex.cameraY, ex.cameraX + 8, ex.cameraY); g.DrawLine(Pens.Blue, ex.cameraX, ex.cameraY - 8, ex.cameraX, ex.cameraY + 8); } else { g.FillRectangle(bgrBrush, new Rectangle(ex.playerX, ex.playerY, 16, 16)); g.DrawRectangle(contourPen, new Rectangle(ex.playerX, ex.playerY, 16, 16)); scene.drawText(g, ex.playerX + 4, ex.playerY + 4, i.ToString("X2")); } } } } g.CompositingMode = CompositingMode.SourceCopy; } }
public void Paste() { selectedExit = AddExit(true); lastselectedExit = selectedExit; scene.mouse_down = true; }