public bool Matches(Linedef l) { if (!Enabled) { return(false); } // Check action; -1 means Any Action if (Action != 0) { if ((Action == -1 && l.Action == 0) || (Action != -1 && l.Action != Action)) { return(false); } } // Check activation; -1 means Any Activation if (Activation != 0) { if (!General.Map.UDMF && (l.Activate != Activation || (Activation == -1 && l.Activate == 0))) { return(false); } } // Check flags if (Flags.Count > 0) { foreach (string s in Flags) { if (!l.IsFlagSet(s)) { return(false); } } } // Check flags, which should be disabled if (RestrictedFlags.Count > 0) { foreach (string s in RestrictedFlags) { if (l.IsFlagSet(s)) { return(false); } } } return(true); }
protected override void OnSelectEnd() { // Item highlighted? if ((highlighted != null) && !highlighted.IsDisposed) { General.Map.UndoRedo.CreateUndo("Toggle \"Shown as 1-sided on automap\" linedef flag"); // Toggle flag highlighted.SetFlag(BuilderPlug.Me.SecretFlag, !highlighted.IsFlagSet(BuilderPlug.Me.SecretFlag)); UpdateValidLinedefs(); } base.OnSelectEnd(); }
private PixelColor DetermineLinedefColor(Linedef ld) { //mxd if (menusform.ShowLocks) { PixelColor lockcolor = new PixelColor(); if (GetLockColor(ld, ref lockcolor)) { return(lockcolor); } } //mxd if (menusform.ShowSecretSectors && (ld.Front != null && secretsectors.Contains(ld.Front.Sector) || ld.Back != null && secretsectors.Contains(ld.Back.Sector))) { return(ColorSecret); } if (ld.IsFlagSet(BuilderPlug.Me.HiddenFlag)) { return(ColorHiddenFlag); } if (ld.Back == null || ld.Front == null || ld.IsFlagSet(BuilderPlug.Me.SecretFlag)) { return(ColorSingleSided); } if (ld.Front.Sector.FloorHeight != ld.Back.Sector.FloorHeight) { return(ColorFloorDiff); } if (ld.Front.Sector.CeilHeight != ld.Back.Sector.CeilHeight) { return(ColorCeilDiff); } if (ld.Front.Sector.CeilHeight == ld.Back.Sector.CeilHeight && ld.Front.Sector.FloorHeight == ld.Back.Sector.FloorHeight) { return(ColorMatchingHeight); } if (menusform.ShowHiddenLines ^ General.Interface.CtrlState) { return(ColorInvisible); } return(new PixelColor(255, 255, 255, 255)); }
private static bool LinedefBlocksSoundEnvironment(Linedef linedef) { if (General.Map.UDMF) { return(linedef.IsFlagSet(SoundEnvironmentMode.ZoneBoundaryFlag)); //mxd. Fancier this way :) } // In Hexen format the line must have action 121 (Line_SetIdentification) and bit 1 of // the second argument set (see http://zdoom.org/wiki/Line_SetIdentification) return(linedef.Action == 121 && (linedef.Args[1] & 1) == 1); //mxd. Fancier this way :) }
private bool LinedefIsValid(Linedef ld) { if (menusform.ShowHiddenLines ^ General.Interface.CtrlState) { return(true); } if (ld.IsFlagSet(BuilderPlug.Me.HiddenFlag)) { return(false); } if (ld.Back == null || ld.Front == null || ld.IsFlagSet(BuilderPlug.Me.SecretFlag)) { return(true); } if (ld.Back != null && ld.Front != null && (ld.Front.Sector.FloorHeight != ld.Back.Sector.FloorHeight || ld.Front.Sector.CeilHeight != ld.Back.Sector.CeilHeight)) { return(true); } return(false); }
public bool IsFlagSet(string flagname) { if (linedef.IsDisposed) { throw new ScriptRuntimeException("Linedef has been disposed, can't IsFlagSet()."); } if (flagname == null) { throw new ScriptRuntimeException("Flag name is nil, can't IsFlagSet() (not enough arguments maybe?)."); } // FIXME warn on no such flag return(linedef.IsFlagSet(flagname)); }
//mxd. If a linedef is highlighted, toggle the sound blocking flag protected override void OnSelectEnd() { if(highlightedline == null) return; // Make undo General.Map.UndoRedo.CreateUndo("Toggle Linedef Sound Blocking"); // Toggle flag highlightedline.SetFlag(BlockSoundFlag, !highlightedline.IsFlagSet(BlockSoundFlag)); // Update ResetSoundPropagation(); General.Interface.RedrawDisplay(); }
//mxd. If a linedef is highlighted, toggle the sound blocking flag, if a sound environment is clicked, select it in the tree view protected override void OnSelectEnd() { if (highlightedline != null) { // Make undo General.Map.UndoRedo.CreateUndo("Toggle Sound Zone Boundary"); // Toggle flag highlightedline.SetFlag(ZoneBoundaryFlag, !highlightedline.IsFlagSet(ZoneBoundaryFlag)); // Update UpdateData(); General.Interface.RedrawDisplay(); } else //mxd { panel.SelectSoundEnvironment(highlightedsoundenvironment); } }
// This shows the info public void ShowInfo(Linedef l, Sidedef highlightside) { string peggedness; // Show/hide stuff depending on format if (!General.Map.FormatInterface.HasActionArgs) { arglbl1.Visible = false; arglbl2.Visible = false; arglbl3.Visible = false; arglbl4.Visible = false; arglbl5.Visible = false; arg1.Visible = false; arg2.Visible = false; arg3.Visible = false; arg4.Visible = false; arg5.Visible = false; infopanel.Width = doomformatwidth; } else { arglbl1.Visible = true; arglbl2.Visible = true; arglbl3.Visible = true; arglbl4.Visible = true; arglbl5.Visible = true; arg1.Visible = true; arg2.Visible = true; arg3.Visible = true; arg4.Visible = true; arg5.Visible = true; infopanel.Width = hexenformatwidth; } //mxd. Hide activation or tag and rearrange labels if (!General.Map.FormatInterface.HasBuiltInActivations && General.Map.FormatInterface.HasNumericLinedefActivations) //Hexen map format? { activation.Visible = true; activationlabel.Text = "Activation:"; activationlabel.Visible = true; taglabel.Visible = false; tag.Visible = false; //set activation foreach (LinedefActivateInfo ai in General.Map.Config.LinedefActivates) { if (l.Activate == ai.Index) { activation.Text = ai.Title; break; } } activation.Enabled = (l.Activate != 0 || l.Action != 0); //mxd activationlabel.Enabled = (l.Activate != 0 || l.Action != 0); //mxd } else { if (General.Map.UDMF) { // Hijack activation labels to show lock numer... activationlabel.Text = "Lock:"; activationlabel.Visible = true; activation.Visible = true; int locknum = l.Fields.GetValue("locknumber", 0); if (locknum != 0) { activationlabel.Enabled = true; activation.Enabled = true; if (General.Map.Config.Enums.ContainsKey("keys")) { foreach (EnumItem item in General.Map.Config.Enums["keys"]) { if (item.GetIntValue() == locknum) { activation.Text = locknum + " - " + item.Title; break; } } } else { activation.Text = locknum.ToString(); } } else { activationlabel.Enabled = false; activation.Enabled = false; activation.Text = "None"; } } else { // Should be Doom map format activationlabel.Visible = false; activation.Visible = false; } taglabel.Visible = true; tag.Visible = true; //mxd. Set tag(s) if (l.Tags.Count > 1) { string[] tags = new string[l.Tags.Count]; for (int i = 0; i < l.Tags.Count; i++) { tags[i] = l.Tags[i].ToString(); } tag.Text = string.Join(", ", tags); tag.Enabled = true; taglabel.Enabled = true; taglabel.Text = "Tags:"; } else { tag.Text = l.Tag + (General.Map.Options.TagLabels.ContainsKey(l.Tag) ? " - " + General.Map.Options.TagLabels[l.Tag] : string.Empty); tag.Enabled = (l.Tag != 0); taglabel.Enabled = (l.Tag != 0); taglabel.Text = "Tag:"; } } // Get line action information LinedefActionInfo act = General.Map.Config.GetLinedefActionInfo(l.Action); // Determine peggedness bool upperunpegged = l.IsFlagSet(General.Map.Config.UpperUnpeggedFlag); bool lowerunpegged = l.IsFlagSet(General.Map.Config.LowerUnpeggedFlag); if (upperunpegged && lowerunpegged) { peggedness = "Upper & Lower"; } else if (upperunpegged) { peggedness = "Upper"; } else if (lowerunpegged) { peggedness = "Lower"; } else { peggedness = "None"; } // Linedef info #if DEBUG infopanel.Text = " Linedef " + l.Index + " (vert. " + l.Start.Index + " - vert. " + l.End.Index + ") "; #else infopanel.Text = " Linedef " + l.Index + " "; #endif action.Text = act.ToString(); length.Text = l.Length.ToString("0.##"); angle.Text = l.AngleDeg + "\u00B0"; unpegged.Text = peggedness; unpegged.Enabled = (peggedness != "None"); //mxd peglabel.Enabled = (peggedness != "None"); //mxd action.Enabled = (act.Index != 0); actionlabel.Enabled = (act.Index != 0); //mxd. ACS script argument names bool isacsscript = (Array.IndexOf(GZGeneral.ACS_SPECIALS, l.Action) != -1); bool isarg0str = (General.Map.UDMF && l.Fields.ContainsKey("arg0str")); string arg0str = isarg0str ? l.Fields.GetValue("arg0str", string.Empty) : string.Empty; ScriptItem scriptitem = null; //mxd. Set default label colors arg1.ForeColor = SystemColors.ControlText; arglbl1.ForeColor = SystemColors.ControlText; // Named script? if (isacsscript && isarg0str && General.Map.NamedScripts.ContainsKey(arg0str.ToLowerInvariant())) { scriptitem = General.Map.NamedScripts[arg0str.ToLowerInvariant()]; } // Script number? else if (isacsscript && General.Map.NumberedScripts.ContainsKey(l.Args[0])) { scriptitem = General.Map.NumberedScripts[l.Args[0]]; arg0str = (scriptitem.HasCustomName ? scriptitem.Name : scriptitem.Index.ToString()); } // Apply script args? Label[] arglabels = { arglbl1, arglbl2, arglbl3, arglbl4, arglbl5 }; Label[] args = { arg1, arg2, arg3, arg4, arg5 }; if (scriptitem != null) { int first; string[] argnames = scriptitem.GetArgumentsDescriptions(l.Action, out first); for (int i = 0; i < first; i++) { arglabels[i].Text = (isarg0str ? act.Args[i].TitleStr : act.Args[i].Title) + ":"; arglabels[i].Enabled = act.Args[i].Used; args[i].Enabled = act.Args[i].Used; } for (int i = first; i < argnames.Length; i++) { if (!string.IsNullOrEmpty(argnames[i])) { arglabels[i].Text = argnames[i] + ":"; arglabels[i].Enabled = true; args[i].Enabled = true; } else { arglabels[i].Text = (isarg0str ? act.Args[i].TitleStr : act.Args[i].Title) + ":"; arglabels[i].Enabled = act.Args[i].Used; args[i].Enabled = act.Args[i].Used; } } } else { for (int i = 0; i < act.Args.Length; i++) { arglabels[i].Text = (isarg0str ? act.Args[i].TitleStr : act.Args[i].Title) + ":"; arglabels[i].Enabled = act.Args[i].Used; args[i].Enabled = act.Args[i].Used; } // Special cases: unknown script name/index if (isacsscript) { arglbl1.Text = "Unknown script " + (isarg0str ? "name" : "number") + ":"; arg1.ForeColor = Color.DarkRed; arglbl1.ForeColor = Color.DarkRed; } } //mxd. Set argument value and label if (isarg0str) { arg1.Text = arg0str; } else { SetArgumentText(act.Args[0], arg1, l.Args[0]); } SetArgumentText(act.Args[1], arg2, l.Args[1]); SetArgumentText(act.Args[2], arg3, l.Args[2]); SetArgumentText(act.Args[3], arg4, l.Args[3]); SetArgumentText(act.Args[4], arg5, l.Args[4]); // Front side available? if (l.Front != null) { //mxd. Extended info shown? bool hasTopFields = false; bool hasMiddleFields = false; bool hasBottomFields = false; //mxd. Highlight this side? bool highlight = (l.Front == highlightside); frontpanel.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText); //mxd // Show sidedef info frontpanel.Visible = true; //mxd frontpanel.Text = " Front Sidedef " + l.Front.Index; //mxd if (General.Map.UDMF) { //light frontoffsetlabel.Text = "Front light:"; SetUDMFLight(l.Front, frontoffsetlabel, frontoffset, highlight); //global offset, sector index frontpanel.Text += ". Offset " + l.Front.OffsetX + ", " + l.Front.OffsetY + ". Sector " + l.Front.Sector.Index + " "; //sidedef top hasTopFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_top", "offsety_top", 0.0, frontTopUDMFOffsetLabel, frontTopUDMFOffset, highlight); hasTopFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_top", "scaley_top", 1.0, frontTopUDMFScaleLabel, frontTopUDMFScale, highlight); //sidedef middle hasMiddleFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_mid", "offsety_mid", 0.0, frontMidUDMFOffsetLabel, frontMidUDMFOffset, highlight); hasMiddleFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_mid", "scaley_mid", 1.0, frontMidUDMFScaleLabel, frontMidUDMFScale, highlight); //sidedef bottom hasBottomFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_bottom", "offsety_bottom", 0.0, frontBottomUDMFOffsetLabel, frontBottomUDMFOffset, highlight); hasBottomFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_bottom", "scaley_bottom", 1.0, frontBottomUDMFScaleLabel, frontBottomUDMFScale, highlight); //visibility frontTopUDMFOffset.Visible = hasTopFields; frontTopUDMFOffsetLabel.Visible = hasTopFields; frontTopUDMFScale.Visible = hasTopFields; frontTopUDMFScaleLabel.Visible = hasTopFields; frontMidUDMFOffset.Visible = hasMiddleFields; frontMidUDMFOffsetLabel.Visible = hasMiddleFields; frontMidUDMFScale.Visible = hasMiddleFields; frontMidUDMFScaleLabel.Visible = hasMiddleFields; frontBottomUDMFOffset.Visible = hasBottomFields; frontBottomUDMFOffsetLabel.Visible = hasBottomFields; frontBottomUDMFScale.Visible = hasBottomFields; frontBottomUDMFScaleLabel.Visible = hasBottomFields; } else { frontoffsetlabel.Text = "Front offset:"; if (l.Front.OffsetX != 0 || l.Front.OffsetY != 0) { frontoffset.Text = l.Front.OffsetX + ", " + l.Front.OffsetY; frontoffsetlabel.Enabled = true; frontoffset.Enabled = true; frontoffset.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText); frontoffsetlabel.ForeColor = frontoffset.ForeColor; } else { frontoffset.Text = "--, --"; frontoffsetlabel.Enabled = false; frontoffset.Enabled = false; } //mxd. Sector index frontpanel.Text += ". Sector " + l.Front.Sector.Index + " "; //visibility frontTopUDMFOffsetLabel.Visible = false; frontTopUDMFScaleLabel.Visible = false; frontMidUDMFOffsetLabel.Visible = false; frontMidUDMFScaleLabel.Visible = false; frontBottomUDMFOffsetLabel.Visible = false; frontBottomUDMFScaleLabel.Visible = false; } //mxd. Set texture names, update panel sizes UpdateTexturePanel(panelFrontTop, l.Front.HighTexture, fronthighname, labelTextureFrontTop, Math.Max(frontTopUDMFOffset.Right, frontTopUDMFScale.Right) + 4, fronthightex, frontTopUDMFOffsetLabel.Left, hasTopFields, l.Front.HighRequired()); UpdateTexturePanel(panelFrontMid, l.Front.MiddleTexture, frontmidname, labelTextureFrontMid, Math.Max(frontMidUDMFOffset.Right, frontMidUDMFScale.Right) + 4, frontmidtex, frontMidUDMFOffsetLabel.Left, hasMiddleFields, l.Front.MiddleRequired()); UpdateTexturePanel(panelFrontLow, l.Front.LowTexture, frontlowname, labelTextureFrontBottom, Math.Max(frontBottomUDMFOffset.Right, frontBottomUDMFScale.Right) + 4, frontlowtex, frontBottomUDMFOffsetLabel.Left, hasBottomFields, l.Front.LowRequired()); //mxd. Resize panel flowLayoutPanelFront.Width = panelFrontLow.Right; frontpanel.Width = flowLayoutPanelFront.Width + flowLayoutPanelFront.Left * 2 - 4; } else { // Show no info if (General.Map.UDMF) //mxd { frontoffsetlabel.Text = "Front light:"; frontoffset.Text = "--"; } else { frontoffsetlabel.Text = "Front offset:"; frontoffset.Text = "--, --"; } frontoffsetlabel.Enabled = false; frontoffset.Enabled = false; fronthightex.BackgroundImage = null; frontmidtex.BackgroundImage = null; frontlowtex.BackgroundImage = null; frontpanel.Visible = false; //mxd } // Back size available? if (l.Back != null) { //mxd. Extended info shown? bool hasTopFields = false; bool hasMiddleFields = false; bool hasBottomFields = false; //mxd. Highlight this side? bool highlight = l.Back == highlightside; backpanel.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText); //mxd // Show sidedef info backpanel.Visible = true; //mxd backpanel.Text = " Back Sidedef " + l.Back.Index; //mxd if (General.Map.UDMF) { //light backoffsetlabel.Text = "Back light:"; SetUDMFLight(l.Back, backoffsetlabel, backoffset, highlight); //global offset, sector index backpanel.Text += ". Offset " + l.Back.OffsetX + ", " + l.Back.OffsetY + ". Sector " + l.Back.Sector.Index + " "; //sidedef top hasTopFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_top", "offsety_top", 0.0, backTopUDMFOffsetLabel, backTopUDMFOffset, highlight); hasTopFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_top", "scaley_top", 1.0, backTopUDMFScaleLabel, backTopUDMFScale, highlight); //sidedef middle hasMiddleFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_mid", "offsety_mid", 0.0, backMidUDMFOffsetLabel, backMidUDMFOffset, highlight); hasMiddleFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_mid", "scaley_mid", 1.0, backMidUDMFScaleLabel, backMidUDMFScale, highlight); //sidedef bottom hasBottomFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_bottom", "offsety_bottom", 0.0, backBottomUDMFOffsetLabel, backBottomUDMFOffset, highlight); hasBottomFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_bottom", "scaley_bottom", 1.0, backBottomUDMFScaleLabel, backBottomUDMFScale, highlight); //visibility backTopUDMFOffset.Visible = hasTopFields; backTopUDMFOffsetLabel.Visible = hasTopFields; backTopUDMFScale.Visible = hasTopFields; backTopUDMFScaleLabel.Visible = hasTopFields; backMidUDMFOffset.Visible = hasMiddleFields; backMidUDMFOffsetLabel.Visible = hasMiddleFields; backMidUDMFScale.Visible = hasMiddleFields; backMidUDMFScaleLabel.Visible = hasMiddleFields; backBottomUDMFOffset.Visible = hasBottomFields; backBottomUDMFOffsetLabel.Visible = hasBottomFields; backBottomUDMFScale.Visible = hasBottomFields; backBottomUDMFScaleLabel.Visible = hasBottomFields; } else { backoffsetlabel.Text = "Back offset:"; if (l.Back.OffsetX != 0 || l.Back.OffsetY != 0) { backoffset.Text = l.Back.OffsetX + ", " + l.Back.OffsetY; backoffsetlabel.Enabled = true; backoffset.Enabled = true; backoffset.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText); backoffsetlabel.ForeColor = backoffset.ForeColor; } else { backoffset.Text = "--, --"; backoffsetlabel.Enabled = false; backoffset.Enabled = false; } // Sector index backpanel.Text += ". Sector " + l.Back.Sector.Index + " "; } //mxd. Set texture names, update panel sizes UpdateTexturePanel(panelBackTop, l.Back.HighTexture, backhighname, labelTextureBackTop, Math.Max(backTopUDMFOffset.Right, backTopUDMFScale.Right) + 4, backhightex, backTopUDMFOffsetLabel.Left, hasTopFields, l.Back.HighRequired()); UpdateTexturePanel(panelBackMid, l.Back.MiddleTexture, backmidname, labelTextureBackMid, Math.Max(backMidUDMFOffset.Right, backMidUDMFScale.Right) + 4, backmidtex, backMidUDMFOffsetLabel.Left, hasMiddleFields, l.Back.MiddleRequired()); UpdateTexturePanel(panelBackLow, l.Back.LowTexture, backlowname, labelTextureBackBottom, Math.Max(backBottomUDMFOffset.Right, backBottomUDMFScale.Right) + 4, backlowtex, backBottomUDMFOffsetLabel.Left, hasBottomFields, l.Back.LowRequired()); //mxd. Resize panel flowLayoutPanelBack.Width = panelBackLow.Right; backpanel.Width = flowLayoutPanelBack.Width + flowLayoutPanelBack.Left * 2 - 4; } else { // Show no info if (General.Map.UDMF) //mxd { backoffsetlabel.Text = "Back light:"; backoffset.Text = "--"; } else { backoffsetlabel.Text = "Back offset:"; backoffset.Text = "--, --"; } backoffsetlabel.Enabled = false; backoffset.Enabled = false; backhightex.BackgroundImage = null; backmidtex.BackgroundImage = null; backlowtex.BackgroundImage = null; backpanel.Visible = false; //mxd } //mxd. Flags and activations flags.Items.Clear(); // Add activations foreach (LinedefActivateInfo ai in General.Map.Config.LinedefActivates) { if (l.Flags.ContainsKey(ai.Key) && l.Flags[ai.Key]) { flags.Items.Add(new ListViewItem(ai.Title) { Checked = true, ForeColor = SystemColors.HotTrack }); } } // And flags foreach (KeyValuePair <string, string> group in General.Map.Config.LinedefFlags) { if (l.Flags.ContainsKey(group.Key) && l.Flags[group.Key]) { flags.Items.Add(new ListViewItem(group.Value) { Checked = true }); } } // And front flags if (l.Front != null) { foreach (KeyValuePair <string, string> group in General.Map.Config.SidedefFlags) { if (l.Front.Flags.ContainsKey(group.Key) && l.Front.Flags[group.Key]) { flags.Items.Add(new ListViewItem("Front: " + group.Value) { Checked = true }); } } } // And back flags if (l.Back != null) { foreach (KeyValuePair <string, string> group in General.Map.Config.SidedefFlags) { if (l.Back.Flags.ContainsKey(group.Key) && l.Back.Flags[group.Key]) { flags.Items.Add(new ListViewItem("Back: " + group.Value) { Checked = true }); } } } //mxd. Flags panel visibility and size flagsPanel.Visible = (flags.Items.Count > 0); if (flags.Items.Count > 0) { Rectangle rect = flags.GetItemRect(0); int itemspercolumn = 1; // Check how many items per column we have... for (int i = 1; i < flags.Items.Count; i++) { if (flags.GetItemRect(i).X != rect.X) { break; } itemspercolumn++; } flags.Width = rect.Width * (int)Math.Ceiling(flags.Items.Count / (float)itemspercolumn); flagsPanel.Width = flags.Width + flags.Left * 2; } // Show the whole thing this.Show(); //this.Update(); // ano - don't think this is needed, and is slow }
// villsa 9/12/11 private void SwitchTextureMask(Linedef l) { int switchflags = 0; int mask = 0; if ((l.SwitchMask & 0x2000) == 0x2000) { switchflags |= 0x2000; } if ((l.SwitchMask & 0x4000) == 0x4000) { switchflags |= 0x4000; } if ((l.SwitchMask & 0x8000) == 0x8000) { switchflags |= 0x8000; } if (l.IsFlagSet("65536")) { switchflags |= 65536; } mask = (switchflags & 0x6000); if (mask == 0) { return; } if (mask == 0x2000) { chkSwitchTextureUpper.Checked = true; if ((switchflags & 0x8000) == 0x8000) { chkSwitchDisplayMiddle.Checked = true; } else { chkSwitchDisplayLower.Checked = true; } } else if (mask == 0x4000) { chkSwitchTextureLower.Checked = true; if ((switchflags & 0x10000) == 0x10000) { chkSwitchDisplayMiddle.Checked = true; } else if ((switchflags & 0x8000) == 0x8000) { chkSwitchDisplayUpper.Checked = true; } } else if (mask == 0x6000) { chkSwitchTextureMiddle.Checked = true; if ((switchflags & 0x8000) == 0x8000) { chkSwitchDisplayUpper.Checked = true; } else { chkSwitchDisplayLower.Checked = true; } } }
// Mouse moves public override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); // Not holding any buttons? if (e.Button == MouseButtons.None) { General.Interface.SetCursor(Cursors.Default); // Find the nearest linedef within highlight range Linedef l = General.Map.Map.NearestLinedef(mousemappos); if (l != null) { // Check on which side of the linedef the mouse is float side = l.SideOfLine(mousemappos); if (side > 0) { // Is there a sidedef here? if (l.Back != null) { // Highlight if not the same if (l.Back.Sector != highlighted) { Highlight(l.Back.Sector); } } else if (highlighted != null) { // Highlight nothing Highlight(null); } } else { // Is there a sidedef here? if (l.Front != null) { // Highlight if not the same if (l.Front.Sector != highlighted) { Highlight(l.Front.Sector); } } else if (highlighted != null) { // Highlight nothing Highlight(null); } } } else if (highlighted != null) { // Highlight nothing Highlight(null); } //mxd. Find the nearest linedef within default highlight range l = General.Map.Map.NearestLinedefRange(mousemappos, 20 / renderer.Scale); //mxd. We are not interested in single-sided lines, unless they have zoneboundary flag... if (l != null && ((l.Front == null || l.Back == null) && !l.IsFlagSet(ZoneBoundaryFlag))) { l = null; } //mxd. Set as highlighted bool redrawrequired = false; if (highlightedline != l) { highlightedline = l; redrawrequired = true; } //mxd. Highlighted environment changed? if (oldhighlightedsoundenvironment != highlightedsoundenvironment) { oldhighlightedsoundenvironment = highlightedsoundenvironment; redrawrequired = true; } //mxd. Find the nearest thing within default highlight range if (highlightedline == null && highlightedsoundenvironment != null) { Thing t = MapSet.NearestThingSquareRange(highlightedsoundenvironment.Things, mousemappos, 10 / renderer.Scale); if (highlightedthing != t) { highlightedthing = t; redrawrequired = true; } } else if (highlightedthing != null) { highlightedthing = null; redrawrequired = true; } //mxd if (redrawrequired) { // Show highlight info if (highlightedline != null && !highlightedline.IsDisposed) { General.Interface.ShowLinedefInfo(highlightedline); } else if (highlighted != null && !highlighted.IsDisposed) { General.Interface.ShowSectorInfo(highlighted); } else { General.Interface.HideInfo(); } // Redraw display General.Interface.RedrawDisplay(); } } }
// This shows the info public void ShowInfo(Linedef l) { TypeHandler th; bool upperunpegged, lowerunpegged; string peggedness; // Show/hide stuff depending on format if (!General.Map.FormatInterface.HasActionArgs) { arglbl1.Visible = false; arglbl2.Visible = false; arglbl3.Visible = false; arglbl4.Visible = false; arglbl5.Visible = false; arg1.Visible = false; arg2.Visible = false; arg3.Visible = false; arg4.Visible = false; arg5.Visible = false; infopanel.Width = doomformatwidth; } else { arglbl1.Visible = true; arglbl2.Visible = true; arglbl3.Visible = true; arglbl4.Visible = true; arglbl5.Visible = true; arg1.Visible = true; arg2.Visible = true; arg3.Visible = true; arg4.Visible = true; arg5.Visible = true; infopanel.Width = hexenformatwidth; } // Move panels frontpanel.Left = infopanel.Left + infopanel.Width + infopanel.Margin.Right + frontpanel.Margin.Left; backpanel.Left = frontpanel.Left + frontpanel.Width + frontpanel.Margin.Right + backpanel.Margin.Left; // Get line action information LinedefActionInfo act = General.Map.Config.GetLinedefActionInfo(l.Action); // Determine peggedness upperunpegged = l.IsFlagSet(General.Map.Config.UpperUnpeggedFlag); lowerunpegged = l.IsFlagSet(General.Map.Config.LowerUnpeggedFlag); if (upperunpegged && lowerunpegged) { peggedness = "Upper & Lower"; } else if (upperunpegged) { peggedness = "Upper"; } else if (lowerunpegged) { peggedness = "Lower"; } else { peggedness = "None"; } // Linedef info infopanel.Text = " Linedef " + l.Index + " "; action.Text = act.ToString(); length.Text = l.Length.ToString("0.##"); angle.Text = l.AngleDeg.ToString() + "\u00B0"; tag.Text = l.Tag.ToString(); unpegged.Text = peggedness; // Arguments arglbl1.Text = act.Args[0].Title + ":"; arglbl2.Text = act.Args[1].Title + ":"; arglbl3.Text = act.Args[2].Title + ":"; arglbl4.Text = act.Args[3].Title + ":"; arglbl5.Text = act.Args[4].Title + ":"; arglbl1.Enabled = act.Args[0].Used; arglbl2.Enabled = act.Args[1].Used; arglbl3.Enabled = act.Args[2].Used; arglbl4.Enabled = act.Args[3].Used; arglbl5.Enabled = act.Args[4].Used; arg1.Enabled = act.Args[0].Used; arg2.Enabled = act.Args[1].Used; arg3.Enabled = act.Args[2].Used; arg4.Enabled = act.Args[3].Used; arg5.Enabled = act.Args[4].Used; th = General.Types.GetArgumentHandler(act.Args[0]); th.SetValue(l.Args[0]); arg1.Text = th.GetStringValue(); th = General.Types.GetArgumentHandler(act.Args[1]); th.SetValue(l.Args[1]); arg2.Text = th.GetStringValue(); th = General.Types.GetArgumentHandler(act.Args[2]); th.SetValue(l.Args[2]); arg3.Text = th.GetStringValue(); th = General.Types.GetArgumentHandler(act.Args[3]); th.SetValue(l.Args[3]); arg4.Text = th.GetStringValue(); th = General.Types.GetArgumentHandler(act.Args[4]); th.SetValue(l.Args[4]); arg5.Text = th.GetStringValue(); // Front side available? if (l.Front != null) { // Show sidedef info frontpanel.Text = " Front Sidedef " + l.Front.Index + " "; frontsector.Text = " Sector " + l.Front.Sector.Index; frontsector.Visible = true; frontoffset.Text = l.Front.OffsetX + ", " + l.Front.OffsetY; fronthighname.Text = l.Front.HighTexture; frontmidname.Text = l.Front.MiddleTexture; frontlowname.Text = l.Front.LowTexture; DisplaySidedefTexture(fronthightex, l.Front.HighTexture, l.Front.HighRequired()); DisplaySidedefTexture(frontmidtex, l.Front.MiddleTexture, l.Front.MiddleRequired()); DisplaySidedefTexture(frontlowtex, l.Front.LowTexture, l.Front.LowRequired()); frontoffsetlabel.Enabled = true; frontoffset.Enabled = true; frontpanel.Enabled = true; } else { // Show no info frontpanel.Text = " Front Sidedef "; frontsector.Text = ""; frontsector.Visible = false; frontoffsetlabel.Enabled = false; frontoffset.Enabled = false; frontpanel.Enabled = false; frontoffset.Text = "--, --"; fronthighname.Text = ""; frontmidname.Text = ""; frontlowname.Text = ""; fronthightex.BackgroundImage = null; frontmidtex.BackgroundImage = null; frontlowtex.BackgroundImage = null; } // Back size available? if (l.Back != null) { // Show sidedef info backpanel.Text = " Back Sidedef " + l.Back.Index + " "; backsector.Text = " Sector " + l.Back.Sector.Index; backsector.Visible = true; backoffset.Text = l.Back.OffsetX + ", " + l.Back.OffsetY; backhighname.Text = l.Back.HighTexture; backmidname.Text = l.Back.MiddleTexture; backlowname.Text = l.Back.LowTexture; DisplaySidedefTexture(backhightex, l.Back.HighTexture, l.Back.HighRequired()); DisplaySidedefTexture(backmidtex, l.Back.MiddleTexture, l.Back.MiddleRequired()); DisplaySidedefTexture(backlowtex, l.Back.LowTexture, l.Back.LowRequired()); backoffsetlabel.Enabled = true; backoffset.Enabled = true; backpanel.Enabled = true; } else { // Show no info backpanel.Text = " Back Sidedef "; backsector.Text = ""; backsector.Visible = false; backoffsetlabel.Enabled = false; backoffset.Enabled = false; backpanel.Enabled = false; backoffset.Text = "--, --"; backhighname.Text = ""; backmidname.Text = ""; backlowname.Text = ""; backhightex.BackgroundImage = null; backmidtex.BackgroundImage = null; backlowtex.BackgroundImage = null; } // Position labels frontsector.Left = frontlowtex.Right - frontsector.Width; backsector.Left = backlowtex.Right - backsector.Width; // Show the whole thing this.Show(); this.Update(); }
// Mouse moves public override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); // Not holding any buttons? if(e.Button == MouseButtons.None) { General.Interface.SetCursor(Cursors.Default); //mxd. Find the nearest linedef within default highlight range Linedef nl = General.Map.Map.NearestLinedefRange(mousemappos, 20 / renderer.Scale); //mxd. We are not interested in single-sided lines (unless they have "blocksound" flag set)... if(nl != null && (nl.Front == null || nl.Back == null) && !nl.IsFlagSet(BlockSoundFlag)) nl = null; //mxd. Set as highlighted bool redrawrequired = (highlightedline != nl); highlightedline = nl; // Find the nearest linedef within highlight range Linedef l = General.Map.Map.NearestLinedef(mousemappos); if(l != null) { // Check on which side of the linedef the mouse is double side = l.SideOfLine(mousemappos); if(side > 0) { // Is there a sidedef here? if(l.Back != null) { // Highlight if not the same if(l.Back.Sector != highlighted) { Highlight(l.Back.Sector); redrawrequired = true; //mxd } } else if(highlighted != null) { // Highlight nothing Highlight(null); redrawrequired = true; //mxd } } else { // Is there a sidedef here? if(l.Front != null) { // Highlight if not the same if(l.Front.Sector != highlighted) { Highlight(l.Front.Sector); redrawrequired = true; //mxd } } else if(highlighted != null) { // Highlight nothing Highlight(null); redrawrequired = true; //mxd } } } else if(highlighted != null) { // Highlight nothing Highlight(null); redrawrequired = true; //mxd } //mxd if(redrawrequired) { // Show highlight info if(highlightedline != null && !highlightedline.IsDisposed) General.Interface.ShowLinedefInfo(highlightedline); else if(highlighted != null && !highlighted.IsDisposed) General.Interface.ShowSectorInfo(highlighted); else General.Interface.HideInfo(); // Redraw display General.Interface.RedrawDisplay(); } } }
// This shows the info public void ShowInfo(Linedef l) { TypeHandler th; bool upperunpegged, lowerunpegged; string peggedness; //double starttime = General.stopwatch.Elapsed.TotalMilliseconds; SuspendLayout(); // Show/hide stuff depending on format if (!General.Map.FormatInterface.HasActionArgs) { if (bUsingArgsAlready || bNeedSetup) { arglbl1.Visible = false; arglbl2.Visible = false; arglbl3.Visible = false; arglbl4.Visible = false; arglbl5.Visible = false; arg1.Visible = false; arg2.Visible = false; arg3.Visible = false; arg4.Visible = false; arg5.Visible = false; tableLayoutPanel1.ColumnStyles[1].Width = 0f; infopanel.Width = doomformatwidth; bUsingArgsAlready = false; } } else { if (!bUsingArgsAlready || bNeedSetup) { arglbl1.Visible = true; arglbl2.Visible = true; arglbl3.Visible = true; arglbl4.Visible = true; arglbl5.Visible = true; arg1.Visible = true; arg2.Visible = true; arg3.Visible = true; arg4.Visible = true; arg5.Visible = true; tableLayoutPanel1.ColumnStyles[1].Width = 37.5f; infopanel.Width = hexenformatwidth; bUsingArgsAlready = true; } } // Move panels frontpanel.Left = infopanel.Left + infopanel.Width + infopanel.Margin.Right + frontpanel.Margin.Left; backpanel.Left = frontpanel.Left + frontpanel.Width + frontpanel.Margin.Right + backpanel.Margin.Left; // Get line action information LinedefActionInfo act = General.Map.Config.GetLinedefActionInfo(l.Action); // Determine peggedness upperunpegged = l.IsFlagSet(General.Map.Config.UpperUnpeggedFlag); lowerunpegged = l.IsFlagSet(General.Map.Config.LowerUnpeggedFlag); if (upperunpegged && lowerunpegged) { peggedness = "Upper/Lower"; } else if (upperunpegged) { peggedness = "Upper"; } else if (lowerunpegged) { peggedness = "Lower"; } else { peggedness = "None"; } // Linedef info sb.Length = 0; sb.Append(" Linedef "); sb.Append(l.Index); sb.Append(" "); infopanel.Text = sb.ToString(); sb.Length = 0; action.Text = act.ToString(); length.Text = l.Length.ToString("0.##"); sb.Append(l.AngleDeg.ToString()); sb.Append("\u00B0"); angle.Text = sb.ToString(); sb.Length = 0; tag.Text = l.Tag.ToString(); unpegged.Text = peggedness; if (bUsingArgsAlready) { // Arguments sb.Append(act.Args[0].Title); sb.Append(':'); arglbl1.Text = sb.ToString(); sb.Length = 0; sb.Append(act.Args[1].Title); sb.Append(':'); arglbl2.Text = sb.ToString(); sb.Length = 0; sb.Append(act.Args[2].Title); sb.Append(':'); arglbl3.Text = sb.ToString(); sb.Length = 0; sb.Append(act.Args[3].Title); sb.Append(':'); arglbl4.Text = sb.ToString(); sb.Length = 0; sb.Append(act.Args[4].Title); sb.Append(':'); arglbl5.Text = sb.ToString(); sb.Length = 0; arglbl1.Enabled = act.Args[0].Used; arglbl2.Enabled = act.Args[1].Used; arglbl3.Enabled = act.Args[2].Used; arglbl4.Enabled = act.Args[3].Used; arglbl5.Enabled = act.Args[4].Used; arg1.Enabled = act.Args[0].Used; arg2.Enabled = act.Args[1].Used; arg3.Enabled = act.Args[2].Used; arg4.Enabled = act.Args[3].Used; arg5.Enabled = act.Args[4].Used; th = General.Types.GetArgumentHandler(act.Args[0]); th.SetValue(l.Args[0]); arg1.Text = th.GetStringValue(); th = General.Types.GetArgumentHandler(act.Args[1]); th.SetValue(l.Args[1]); arg2.Text = th.GetStringValue(); th = General.Types.GetArgumentHandler(act.Args[2]); th.SetValue(l.Args[2]); arg3.Text = th.GetStringValue(); th = General.Types.GetArgumentHandler(act.Args[3]); th.SetValue(l.Args[3]); arg4.Text = th.GetStringValue(); th = General.Types.GetArgumentHandler(act.Args[4]); th.SetValue(l.Args[4]); arg5.Text = th.GetStringValue(); } // Front side available? if (l.Front != null) { // Show sidedef info sb.Append(" Front Sidedef "); sb.Append(l.Front.Index); sb.Append(' '); frontpanel.Text = sb.ToString(); sb.Length = 0; sb.Append(" Sector "); sb.Append(l.Front.Sector.Index); frontsector.Text = sb.ToString(); sb.Length = 0; frontsector.Visible = true; sb.Append(l.Front.OffsetX); sb.Append(", "); sb.Append(l.Front.OffsetY); frontoffset.Text = sb.ToString(); sb.Length = 0; fronthighname.Text = l.Front.HighTexture; frontmidname.Text = l.Front.MiddleTexture; frontlowname.Text = l.Front.LowTexture; DisplaySidedefTexture(fronthightex, l.Front.HighTexture, l.Front.HighRequired()); DisplaySidedefTexture(frontmidtex, l.Front.MiddleTexture, l.Front.MiddleRequired()); DisplaySidedefTexture(frontlowtex, l.Front.LowTexture, l.Front.LowRequired()); frontoffsetlabel.Enabled = true; frontoffset.Enabled = true; frontpanel.Enabled = true; } else { // Show no info frontpanel.Text = " Front Sidedef "; frontsector.Text = ""; frontsector.Visible = false; frontoffsetlabel.Enabled = false; frontoffset.Enabled = false; frontpanel.Enabled = false; frontoffset.Text = "--, --"; fronthighname.Text = ""; frontmidname.Text = ""; frontlowname.Text = ""; fronthightex.BackgroundImage = null; frontmidtex.BackgroundImage = null; frontlowtex.BackgroundImage = null; } // Back size available? if (l.Back != null) { // Show sidedef info sb.Append(" Back Sidedef "); sb.Append(l.Back.Index); sb.Append(' '); backpanel.Text = sb.ToString(); sb.Length = 0; sb.Append(" Sector "); sb.Append(l.Back.Sector.Index); backsector.Text = sb.ToString(); sb.Length = 0; backsector.Visible = true; sb.Append(l.Back.OffsetX); sb.Append(", "); sb.Append(l.Back.OffsetY); backoffset.Text = sb.ToString(); sb.Length = 0; backhighname.Text = l.Back.HighTexture; backmidname.Text = l.Back.MiddleTexture; backlowname.Text = l.Back.LowTexture; DisplaySidedefTexture(backhightex, l.Back.HighTexture, l.Back.HighRequired()); DisplaySidedefTexture(backmidtex, l.Back.MiddleTexture, l.Back.MiddleRequired()); DisplaySidedefTexture(backlowtex, l.Back.LowTexture, l.Back.LowRequired()); backoffsetlabel.Enabled = true; backoffset.Enabled = true; backpanel.Enabled = true; } else { // Show no info backpanel.Text = " Back Sidedef "; backsector.Text = ""; backsector.Visible = false; backoffsetlabel.Enabled = false; backoffset.Enabled = false; backpanel.Enabled = false; backoffset.Text = "--, --"; backhighname.Text = ""; backmidname.Text = ""; backlowname.Text = ""; backhightex.BackgroundImage = null; backmidtex.BackgroundImage = null; backlowtex.BackgroundImage = null; } // Position labels frontsector.Left = frontlowtex.Right - frontsector.Width; backsector.Left = backlowtex.Right - backsector.Width; ResumeLayout(); // Show the whole thing this.Show(); this.Invalidate(); //this.Update(); // ano - don't think this is needed, and is slow bNeedSetup = false; //Logger.WriteLogLine((General.stopwatch.Elapsed.TotalMilliseconds - starttime) + " milliseconds for linedefinfopanel.showinfo"); }