/// <summary> /// Store changed tile info to the map. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnApplyTileChanges_Click(object sender, EventArgs e) { if (!isLoading) { TileMapUI.ApplyTileChanges(curTileX, curTileY, this); } }
private void PicMap_MouseClick(object sender, MouseEventArgs e) { int x = (int)((e.Location.X) / numMapZoom.Value); int y = (int)((e.Location.Y) / numMapZoom.Value); // MessageBox.Show(x + "," +(64- y)); TileMapUI.LoadInfoForTileXY(this, x, 63 - y); }
public static void LoadTileMap(int blockno, main MAIN) { //MAIN.TreeTiles.Nodes.Clear(); MAIN.tilemap = new TileMap(); if (MAIN.uwblocks[blockno].DataLen < 0x7c06) { return; } MAIN.tilemap.InitTileMap(MAIN.uwblocks[blockno].Data, 0, blockno, MAIN.uwblocks[blockno].Address); if (main.curgame == 1) { MAIN.tilemap.BuildTextureMap(MAIN.uwblocks[blockno + 18].Data, ref MAIN.tilemap.ceilingtexture); } else { MAIN.tilemap.BuildTextureMap(MAIN.uwblocks[blockno + 80].Data, ref MAIN.tilemap.ceilingtexture); } //Temporarily output to treeview for testing. // MAIN.txtMap.Text = ""; //for (int x = 0; x <= 63; x++) //{ // TreeNode xnode = MAIN.TreeTiles.Nodes.Add("X=" + x); // for (int y = 0; y <= 63; y++) // { // TreeNode ynode = xnode.Nodes.Add("Y=" + y); // ynode.Tag = x + "," + y; // //MAIN.txtMap.Text += MAIN.tilemap.Tiles[x, y].tileType; // } // //MAIN.txtMap.Text += "\n"; //} MAIN.worldObjects = new objects(); MAIN.worldObjects.InitWorldObjectList(MAIN.uwblocks[blockno].Data, 64 * 64 * 4, MAIN.uwblocks[blockno].Address); MAIN.TreeWorldObjects.Nodes.Clear(); for (int i = 0; i <= MAIN.worldObjects.objList.GetUpperBound(0); i++) { TreeNode newnode = MAIN.TreeWorldObjects.Nodes.Add(i + ". " + objects.ObjectName(MAIN.worldObjects.objList[i].item_id, main.curgame)); newnode.Tag = i; } MAIN.TreeWorldByTile.Nodes.Clear(); for (int x = 0; x <= 63; x++) { for (int y = 0; y <= 63; y++) { if (MAIN.tilemap.Tiles[x, y].indexObjectList != 0) { TreeNode xynode = MAIN.TreeWorldByTile.Nodes.Add(x + "," + y); TileMapUI.PopulateWorldNode(xynode, MAIN.tilemap.Tiles[x, y].indexObjectList, MAIN.worldObjects.objList); } } } MAIN.PicMap.Image = ArtUI.UWMap(MAIN.tilemap, MAIN.tex); MAIN.PicMap.Height = 64 * (int)MAIN.numMapZoom.Value; MAIN.PicMap.Width = 64 * (int)MAIN.numMapZoom.Value; }
/// <summary> /// Handles selection of an object by tile. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TreeWorldByTile_AfterSelect(object sender, TreeViewEventArgs e) { TreeNode node = TreeWorldByTile.SelectedNode; int index; if (node.Tag == null) { return; } if (int.TryParse(node.Tag.ToString(), out index)) { if (index > 0) { TileMapUI.PopulateWorldObjects(index, this); } } }
/// <summary> /// Controls selection of a lev.ark block and view its content. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TreeUWBlocks_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node.Tag == null) { return; } int blockno = int.Parse(e.Node.Tag.ToString()); GrdLevArkRaw.Rows.Clear(); switch (uwblocks[blockno].ContentType) { case Util.ContentTypes.TileMap: TileMapUI.LoadTileMap(blockno, this); FillRawDataForLevArk(blockno); //no raw data loaded for tilemap due to slow loading speed break; default: FillRawDataForLevArk(blockno); //no raw data loaded for tilemap due to slow loading speed break; } }