public void InitOpen(DungeonMain mainForm) { overworld = new Overworld(); scene = new SceneOW(this, overworld, mainForm); scene.Location = new Point(0, 0); scene.Size = new Size(4096, 4096); splitContainer1.Panel2.Controls.Clear(); splitContainer1.Panel2.Controls.Add(scene); this.mainForm = mainForm; scene.CreateScene(); scene.initialized = true; scene.Refresh(); penModeButton.Tag = ObjectMode.Tile; fillModeButton.Tag = ObjectMode.Tile; entranceModeButton.Tag = ObjectMode.Entrances; exitModeButton.Tag = ObjectMode.Exits; itemModeButton.Tag = ObjectMode.Itemmode; spriteModeButton.Tag = ObjectMode.Spritemode; transportModeButton.Tag = ObjectMode.Flute; overlayButton.Tag = ObjectMode.Overlay; gravestoneButton.Tag = ObjectMode.Gravestone; stateCombobox.SelectedIndex = 1; scratchPicturebox.Image = scratchPadBitmap; //setTilesGfx(); bool fromFile = false; byte[] file = new byte[(225 * 16) * 2]; if (File.Exists("ScratchPad.dat")) { using (FileStream fs = new FileStream("ScratchPad.dat", FileMode.Open, FileAccess.Read)) { fs.Read(file, 0, (int)fs.Length); fs.Close(); fromFile = true; } } int t = 0; for (ushort x = 0; x < 225; x++) { for (ushort y = 0; y < 16; y++) { if (fromFile) { scratchPadTiles[y, x] = (ushort)((file[t] << 8) + file[t + 1]); } else { scratchPadTiles[y, x] = (ushort)0; } t += 2; } } GFX.editort16Bitmap.Palette = scene.ow.allmaps[scene.selectedMap].gfxBitmap.Palette; updateTiles(); pictureBox1.Refresh(); }
public void OnMouseUp(MouseEventArgs e) { if (scene.mouse_down) { int tileX = (e.X / 16); int tileY = (e.Y / 16); int superX = (tileX / 32); int superY = (tileY / 32); int mapId = (superY * 8) + superX + scene.ow.worldOffset; if (e.Button == MouseButtons.Right) { if (tileX == scene.globalmouseTileDownX && tileY == scene.globalmouseTileDownY) { scene.selectedTile = new ushort[1] { scene.ow.allmaps[mapId].tilesUsed[scene.globalmouseTileDownX, scene.globalmouseTileDownY] }; scene.selectedTileSizeX = 1; } else { bool reverseX = false; bool reverseY = false; int sizeX = (tileX - scene.globalmouseTileDownX) + 1; int sizeY = (tileY - scene.globalmouseTileDownY) + 1; if (tileX < scene.globalmouseTileDownX) { sizeX = (scene.globalmouseTileDownX - tileX) + 1; reverseX = true; } if (tileY < scene.globalmouseTileDownY) { sizeY = (scene.globalmouseTileDownY - tileY) + 1; reverseY = true; } scene.selectedTileSizeX = sizeX; scene.selectedTile = new ushort[(sizeX) * (sizeY)]; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int pX = scene.globalmouseTileDownX; int pY = scene.globalmouseTileDownY; if (reverseX) { pX = tileX; } if (reverseY) { pY = tileY; } scene.selectedTile[x + (y * sizeX)] = scene.ow.allmaps[mapId].tilesUsed[(pX) + x, (pY) + y]; } } } } } scene.selecting = false; scene.mouse_down = false; scene.Refresh(); scene.mainForm.pictureboxOWTiles.Refresh(); scene.mainForm.pictureGroupTiles.Refresh(); }
private void spButton_Click(object sender, EventArgs e) { scene.selectedMap = 128; scene.ow.worldOffset = 128; scene.Refresh(); }