/// <summary> /// The select spawn. /// </summary> /// <param name="tagNumber">The tag number.</param> /// <remarks></remarks> private void selectSpawn(int tagNumber) { // This section makes sure that the type we have selected is checked for viewing int index = checkedListBox1.FindString(bsp.Spawns.Spawn[tagNumber].Type.ToString(), 0); if (checkedListBox1.GetItemCheckState(index) == CheckState.Unchecked) { checkedListBox1.SetItemCheckState(index, CheckState.Checked); } #region TurnSpawnOnOrOff // Find out what section our tagNumber is in int tempi = SelectedSpawn.IndexOf(tagNumber); // If our spawn is already selected, deselect and move it to the last position if (tempi != -1) { SelectedSpawn.RemoveAt(tempi); } if (!bsp.Spawns.Spawn[tagNumber].frozen) { SelectedSpawn.Add(tagNumber); } // Update the global current selected spawn type selectedSpawnType = bsp.Spawns.Spawn[tagNumber].Type; #endregion }
/// <summary> /// The tree view 1_ double click. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> /// <remarks></remarks> private void treeView1_DoubleClick(object sender, EventArgs e) { int tempint = (int)((TreeView)sender).SelectedNode.Tag; if (tempint >= 0) { setCameraPosition( bsp.Spawns.Spawn[tempint].X, bsp.Spawns.Spawn[tempint].Y, bsp.Spawns.Spawn[tempint].Z, false); checkedListBox1.SetItemCheckState( checkedListBox1.FindString(bsp.Spawns.Spawn[tempint].Type.ToString(), 0), CheckState.Checked); #region AutoSelect if (checkBox4.Checked) { #region ClearStatus statusStrip.Items.Clear(); // SelectedSpawn.Clear(); #endregion #region DisplayCameraPosition // Set camera postion string tempstring = toolStripLabel2.Text; string tempstring2 = "Camera Position: X: " + cam.x.ToString().PadRight(10) + " • Y: " + cam.y.ToString().PadRight(10) + " • Z: " + cam.z.ToString().PadRight(10); if (tempstring != tempstring2) { toolStripLabel2.Text = tempstring2; statusStrip.ResumeLayout(); statusStrip.SuspendLayout(); } #endregion #region Turn Spawn On And Move To End Of List int tempi = SelectedSpawn.IndexOf(tempint); if (tempi != -1) { SelectedSpawn.RemoveAt(tempi); } SelectedSpawn.Add(tempint); selectedSpawnType = bsp.Spawns.Spawn[tempint].Type; #endregion updateStatusPosition(); } #endregion Application.DoEvents(); this.Focus(); Application.DoEvents(); } }
/// <summary> /// The bsp viewer_ mouse down. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> /// <remarks></remarks> private void BSPViewer_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Middle) { selectionHeight = 0; selectionWidth = 0; selectionDepth = 0; selectionMulti = true; selectionStart = render.Mark3DCursorPosition(e.X, e.Y, Matrix.Identity); } #region StartCameraRotation (Mouse Right Button) else if (e.Button == MouseButtons.Right) { cam.oldx = e.X; cam.oldy = e.Y; Time = DateTime.Now.TimeOfDay; this.ContextMenuStrip = identContext; } #endregion #region SpawnSelection (Mouse Left Button) else if (e.Button == MouseButtons.Left) { #region DecideUponObjectRotation if ((SelectedSpawn.Count > 0) && (rotationBitMask != 0)) { selectionStart = render.Mark3DCursorPosition(e.X, e.Y, Matrix.Identity); oldx = e.X; oldy = e.Y; itemrotate = true; // return; } #endregion else { #region CheckSpawnsForIntersection for (int x = 0; x < bsp.Spawns.Spawn.Count; x++) { // check bitmask for object visibility if (((int)bsp.Spawns.Spawn[x].Type & visibleSpawnsBitMask) == 0) { continue; } int tempcount = SpawnModel[spawnmodelindex[x]].Display.Chunk.Count; bool useboundingbox = false; #region Make Cameras, DeathZones, Sounds Spawmn Zones And Lights Use BoundingBoxes switch (bsp.Spawns.Spawn[x].Type) { case SpawnInfo.SpawnType.Camera: case SpawnInfo.SpawnType.DeathZone: case SpawnInfo.SpawnType.Light: case SpawnInfo.SpawnType.Sound: case SpawnInfo.SpawnType.SpawnZone: tempcount = 1; useboundingbox = true; break; } #endregion for (int yy = 0; yy < tempcount; yy++) { // check for mesh intersection Mesh tempm; if (!useboundingbox) { tempm = SpawnModel[spawnmodelindex[x]].Display.meshes[yy]; } else { tempm = BoundingBoxModel[x]; } // Check under mouse cursor for object selection/deselection? if (render.MeshPick(e.X, e.Y, tempm, TranslationMatrix[x])) { if (bsp.Spawns.Spawn[x].frozen) { break; } #region TurnSpawnOnOrOff int tempi = SelectedSpawn.IndexOf(x); if (tempi != -1) { SelectedSpawn.RemoveAt(tempi); if (DeselectOne.Checked) { updateStatusPosition(); return; } } else { SelectedSpawn.Add(x); selectedSpawnType = bsp.Spawns.Spawn[x].Type; } #endregion break; } } } } #endregion CycleThroughSpawns } #region statusBarUpdates updateStatusPosition(); #endregion statusBarUpdates #endregion }