public void Delete() { if (lastselectedSprite != null) { for (int i = scene.ow.worldOffset; i < 64 + scene.ow.worldOffset; i++) { int gs = scene.ow.gameState; scene.ow.allsprites[gs].Remove(lastselectedSprite); } lastselectedSprite = null; if (scene.lowEndMode) { int x = scene.ow.allmaps[scene.selectedMap].parent % 8; int y = scene.ow.allmaps[scene.selectedMap].parent / 8; if (!scene.ow.allmaps[scene.ow.allmaps[scene.selectedMap].parent].largeMap) { scene.Invalidate(new Rectangle(x * 512, y * 512, 512, 512)); } else { scene.Invalidate(new Rectangle(x * 512, y * 512, 1024, 1024)); } } else { scene.Invalidate(new Rectangle(scene.owForm.splitContainer1.Panel2.HorizontalScroll.Value, scene.owForm.splitContainer1.Panel2.VerticalScroll.Value, scene.owForm.splitContainer1.Panel2.Width, scene.owForm.splitContainer1.Panel2.Height)); } //scene.Invalidate(); } }
public void Cut() { Clipboard.Clear(); RoomPotSaveEditor id = lastselectedItem.Copy(); Clipboard.SetData("owitem", id); Delete(); scene.Invalidate(new Rectangle(scene.mainForm.panel5.HorizontalScroll.Value, scene.mainForm.panel5.VerticalScroll.Value, scene.mainForm.panel5.Width, scene.mainForm.panel5.Height)); }
public ExitOW AddExit(bool clipboard = false) { int found = -1; for (int i = 0; i < scene.ow.allexits.Length; i++) { if (scene.ow.allexits[i].deleted) { byte mid = scene.ow.allmaps[scene.mapHover + scene.ow.worldOffset].parent; if (mid == 255) { mid = (byte)(scene.mapHover + scene.ow.worldOffset); } scene.ow.allexits[i].deleted = false; scene.ow.allexits[i].mapId = mid; scene.ow.allexits[i].playerX = (ushort)((mxRightclick / 16) * 16); scene.ow.allexits[i].playerY = (ushort)((myRightclick / 16) * 16); if (clipboard) { ExitOW data = (ExitOW)Clipboard.GetData("owexit"); if (data != null) { scene.ow.allexits[i].cameraX = data.cameraX; scene.ow.allexits[i].cameraY = data.cameraY; scene.ow.allexits[i].xScroll = data.xScroll; scene.ow.allexits[i].yScroll = data.yScroll; scene.ow.allexits[i].unk1 = data.unk1; scene.ow.allexits[i].unk2 = data.unk2; scene.ow.allexits[i].roomId = data.roomId; scene.ow.allexits[i].doorType1 = data.doorType1; scene.ow.allexits[i].doorType2 = data.doorType2; scene.ow.allexits[i].doorXEditor = data.doorXEditor; scene.ow.allexits[i].doorYEditor = data.doorYEditor; } } scene.ow.allexits[i].updateMapStuff(mid, scene.ow); found = i; scene.Invalidate(new Rectangle(scene.mainForm.panel5.HorizontalScroll.Value, scene.mainForm.panel5.VerticalScroll.Value, scene.mainForm.panel5.Width, scene.mainForm.panel5.Height)); break; } } if (found == -1) { MessageBox.Show("No space available for new exits, delete one first"); return(null); } return(scene.ow.allexits[found]); }
public void OnMouseDown(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { int mapy = (scene.exitmode.lastselectedExit.mapId / 8); int mapx = scene.exitmode.lastselectedExit.mapId - (mapy * 8); int mouse_tile_x_down = ((e.X / 16)) - (mapx * 32); int mouse_tile_y_down = ((e.Y / 16)) - (mapy * 32); scene.exitmode.lastselectedExit.doorXEditor = (byte)mouse_tile_x_down; scene.exitmode.lastselectedExit.doorYEditor = (byte)mouse_tile_y_down; scene.Invalidate(new Rectangle(scene.mainForm.panel5.HorizontalScroll.Value, scene.mainForm.panel5.VerticalScroll.Value, scene.mainForm.panel5.Width, scene.mainForm.panel5.Height)); scene.exitmode.exitProperty_Click(null, null); } }
public void Cut() { Clipboard.Clear(); int sd = lastselectedSprite.id; Clipboard.SetData("owsprite", sd); Delete(); scene.Invalidate(new Rectangle(scene.mainForm.panel5.HorizontalScroll.Value, scene.mainForm.panel5.VerticalScroll.Value, scene.mainForm.panel5.Width, scene.mainForm.panel5.Height)); }
public void onMouseDown(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { for (int i = 0; i < 0x11; i++) { TransportOW en = scene.ow.allWhirlpools[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) { selectedTransport = en; lastselectedTransport = 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 Paste() { selectedEntrance = AddEntrance(true); if (selectedEntrance != null) { lastselectedEntrance = selectedEntrance; scene.mouse_down = true; scene.Invalidate(new Rectangle(scene.mainForm.panel5.HorizontalScroll.Value, scene.mainForm.panel5.VerticalScroll.Value, scene.mainForm.panel5.Width, scene.mainForm.panel5.Height)); } }
public void OnMouseMove(MouseEventArgs e) { if (scene.initialized) { scene.mouseX_Real = e.X; scene.mouseY_Real = e.Y; int mouseTileX = e.X / 16; int mouseTileY = e.Y / 16; int mapX = (mouseTileX / 32); int mapY = (mouseTileY / 32); scene.mapHover = mapX + (mapY * 8) + scene.ow.worldOffset; if (scene.lastTileHoverX != mouseTileX || scene.lastTileHoverY != mouseTileY) { if (scene.mouse_down) { if (e.Button == MouseButtons.Left) { int tileX = (e.X / 16); int tileY = (e.Y / 16); if (tileX < 0) { tileX = 0; } if (tileY < 0) { tileY = 0; } if (tileX > 255) { tileX = 255; } if (tileY > 255) { tileY = 255; } int superX = (tileX / 32); int superY = (tileY / 32); int mapId = (superY * 8) + superX; scene.globalmouseTileDownX = tileX; scene.globalmouseTileDownY = tileY; if (scene.selectedTile.Length >= 1) { ushort[] undotiles = new ushort[scene.selectedTile.Length]; int y = 0; int x = 0; for (int i = 0; i < scene.selectedTile.Length; i++) { superX = ((tileX + x) / 32); superY = ((tileY + y) / 32); mapId = (superY * 8) + superX + scene.ow.worldOffset; if (scene.globalmouseTileDownX + x < 255 && scene.globalmouseTileDownY + y < 255) { undotiles[i] = scene.ow.allmaps[mapId].tilesUsed[scene.globalmouseTileDownX + x, scene.globalmouseTileDownY + y]; scene.ow.allmaps[mapId].tilesUsed[scene.globalmouseTileDownX + x, scene.globalmouseTileDownY + y] = scene.selectedTile[i]; scene.ow.allmaps[mapId].CopyTile8bpp16(((tileX + x) * 16) - (superX * 512), ((tileY + y) * 16) - (superY * 512), scene.selectedTile[i], scene.ow.allmaps[mapId].gfxPtr, scene.ow.allmaps[mapId].blockset16); } x++; if (x >= scene.selectedTileSizeX) { y++; x = 0; } } undoList.Add(new TileUndo(scene.globalmouseTileDownX, scene.globalmouseTileDownY, scene.selectedTileSizeX, undotiles, (ushort[])scene.selectedTile.Clone(), ref scene.ow.allmaps[mapId].tilesUsed)); redoList.Clear(); //this.Invalidate(new Rectangle((globalmouseTileDownX * 16), globalmouseTileDownY * 16, selectedTileSizeX * 16, y * 16)); /* } * else * { * ow.allmaps[mapId].tilesUsed[globalmouseTileDownX, globalmouseTileDownY] = selectedTile[0]; * ow.allmaps[mapId].CopyTile8bpp16(((tileX) * 16) - (superX * 512), ((tileY) * 16) - (superY * 512), selectedTile[0], ow.allmaps[mapId].gfxPtr, ow.allmaps[mapId].blockset16); * this.Invalidate(new Rectangle(e.X - 16, e.Y - 16, 32, 32)); * }*/ } } } //Refresh the tile preview if (scene.selectedTile.Length >= 1) { int sX = (mouseTileX / 32); int sY = (mouseTileY / 32); int y = 0; int x = 0; int mapId = 0 + scene.ow.worldOffset; for (int i = 0; i < scene.selectedTile.Length; i++) { if (scene.globalmouseTileDownX + x < 255 && scene.globalmouseTileDownY + y < 255) { sX = ((mouseTileX + x) / 32); sY = ((mouseTileY + y) / 32); mapId = (sY * 8) + sX + scene.ow.worldOffset; if (mapId > 63 + scene.ow.worldOffset) { break; } scene.ow.allmaps[mapId].CopyTile8bpp16(x * 16, y * 16, scene.selectedTile[i], scene.temptilesgfxPtr, scene.ow.allmaps[mapId].blockset16); } x++; if (x >= scene.selectedTileSizeX) { y++; x = 0; } } if (mapId > 63 + scene.ow.worldOffset) { return; } scene.tilesgfxBitmap.Palette = scene.ow.allmaps[mapId].gfxBitmap.Palette; scene.Invalidate(new Rectangle(scene.mainForm.panel5.HorizontalScroll.Value, scene.mainForm.panel5.VerticalScroll.Value, scene.mainForm.panel5.Width, scene.mainForm.panel5.Height)); //this.Refresh(); //this.Invalidate(new Rectangle((mouseTileX * 16)-16, (mouseTileY * 16)-16, (selectedTileSizeX * 16)+32, (y * 16)+32)); } /*if (selecting) * { * this.Invalidate(new Rectangle((globalmouseTileDownX * 16), (globalmouseTileDownY * 16), (mouseTileX * 16) - (globalmouseTileDownX * 16) + 48, (mouseTileY * 16) - (globalmouseTileDownY * 16) + 48)); * }*/ scene.lastTileHoverX = mouseTileX; scene.lastTileHoverY = mouseTileY; /* int tileX = (e.X / 16); * int tileY = (e.Y / 16); * int superX = (tileX / 32); * int superY = (tileY / 32); * int mapId = (superY * 8) + superX; * ow.allmapsTiles[tileX, tileY] = selectedTile[0]; * ow.allmaps[mapId].CopyTile8bpp16(((e.X / 16)*16)-(superX*512), ((e.Y / 16)*16) - (superY * 512), selectedTile[0], ow.allmaps[mapId].gfxPtr, ow.allmaps[mapId].blockset16); * this.Invalidate(new Rectangle(e.X-16, e.Y-16, 48, 48)); * //this.Refresh();*/ } } }
private void gfxTextbox_TextChanged(object sender, EventArgs e) { if (propertiesChangedFromForm == false) { byte result = 0; OverworldMap mapParent = scene.ow.allmaps[scene.ow.allmaps[scene.selectedMap].parent]; if (scene.ow.allmaps[scene.selectedMap].parent == 255) { mapParent = scene.ow.allmaps[scene.selectedMap]; } if (byte.TryParse(paletteTextbox.Text, NumberStyles.HexNumber, null, out result)) { mapParent.palette = result; } if (byte.TryParse(gfxTextbox.Text, NumberStyles.HexNumber, null, out result)) { mapParent.gfx = result; } if (byte.TryParse(sprgfxTextbox.Text, NumberStyles.HexNumber, null, out result)) { if (mapParent.index >= 64) { mapParent.sprgfx[0] = result; } else { scene.ow.allmaps[mapParent.index].sprgfx[scene.ow.gameState] = result; } } if (byte.TryParse(sprpaletteTextbox.Text, NumberStyles.HexNumber, null, out result)) { if (mapParent.index >= 64) { mapParent.sprpalette[0] = result; } else { mapParent.sprpalette[scene.ow.gameState] = result; } } if (mapParent.largeMap) { scene.ow.allmaps[mapParent.index + 1].gfx = mapParent.gfx; scene.ow.allmaps[mapParent.index + 1].sprgfx = mapParent.sprgfx; scene.ow.allmaps[mapParent.index + 1].palette = mapParent.palette; scene.ow.allmaps[mapParent.index + 1].sprpalette = mapParent.sprpalette; scene.ow.allmaps[mapParent.index + 8].gfx = mapParent.gfx; scene.ow.allmaps[mapParent.index + 8].sprgfx = mapParent.sprgfx; scene.ow.allmaps[mapParent.index + 8].palette = mapParent.palette; scene.ow.allmaps[mapParent.index + 8].sprpalette = mapParent.sprpalette; scene.ow.allmaps[mapParent.index + 9].gfx = mapParent.gfx; scene.ow.allmaps[mapParent.index + 9].sprgfx = mapParent.sprgfx; scene.ow.allmaps[mapParent.index + 9].palette = mapParent.palette; scene.ow.allmaps[mapParent.index + 9].sprpalette = mapParent.sprpalette; mapParent.BuildMap(); scene.ow.allmaps[mapParent.index + 1].BuildMap(); scene.ow.allmaps[mapParent.index + 8].BuildMap(); scene.ow.allmaps[mapParent.index + 9].BuildMap(); } else { mapParent.BuildMap(); } //scene.updateMapGfx(); scene.Invalidate(); //scene.Refresh(); } }