Added "Automap Mode" plugin by Boris Iwansky.

This commit is contained in:
MaxED 2016-06-16 22:05:17 +00:00
parent 8f446bbcd3
commit 25947e59f7
16 changed files with 620 additions and 14 deletions

View file

@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoundPropagation", "Source\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StairSectorBuilder", "Source\Plugins\StairSectorBuilder\StairSectorBuilder.csproj", "{3F365121-906B-409D-BB1E-37E0A78056C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutomapMode", "Source\Plugins\AutomapMode\AutomapMode.csproj", "{B33F68D5-1335-400C-A1D7-7F5602A030EF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug + Profiler|x86 = Debug + Profiler|x86
@ -119,6 +121,14 @@ Global
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release|x86.ActiveCfg = Release|x86
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release|x86.Build.0 = Release|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Debug + Profiler|x86.ActiveCfg = Debug|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Debug + Profiler|x86.Build.0 = Debug|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Debug|x86.ActiveCfg = Debug|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Debug|x86.Build.0 = Debug|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Release + Profiler|x86.ActiveCfg = Release|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Release + Profiler|x86.Build.0 = Release|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Release|x86.ActiveCfg = Release|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -20,6 +20,15 @@ msbuild "Source\Core\Builder.csproj" /t:Rebuild /p:Configuration=Release /p:Plat
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Builder.exe" GOTO FILEFAIL
ECHO.
ECHO Compiling Automap Mode plugin...
ECHO.
IF EXIST "Build\Plugins\AutomapMode.dll" DEL /F /Q "Build\Plugins\AutomapMode.dll" > NUL
IF EXIST "Source\Plugins\AutomapMode\obj" RD /S /Q "Source\Plugins\AutomapMode\obj"
msbuild "Source\Plugins\AutomapMode\AutomapMode.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\AutomapMode.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Builder Effects plugin...
ECHO.

View file

@ -60,6 +60,15 @@ msbuild "Source\Core\Builder.csproj" /t:Rebuild /p:Configuration=Release /p:Plat
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Builder.exe" GOTO FILEFAIL
ECHO.
ECHO Compiling Automap Mode plugin...
ECHO.
IF EXIST "Build\Plugins\AutomapMode.dll" DEL /F /Q "Build\Plugins\AutomapMode.dll" > NUL
IF EXIST "Source\Plugins\AutomapMode\obj" RD /S /Q "Source\Plugins\AutomapMode\obj"
msbuild "Source\Plugins\AutomapMode\AutomapMode.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\AutomapMode.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Builder Effects plugin...
ECHO.

View file

@ -60,6 +60,15 @@ msbuild "Source\Core\Builder.csproj" /t:Rebuild /p:Configuration=Release /p:Plat
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Builder.exe" GOTO FILEFAIL
ECHO.
ECHO Compiling Automap Mode plugin...
ECHO.
IF EXIST "Build\Plugins\AutomapMode.dll" DEL /F /Q "Build\Plugins\AutomapMode.dll" > NUL
IF EXIST "Source\Plugins\AutomapMode\obj" RD /S /Q "Source\Plugins\AutomapMode\obj"
msbuild "Source\Plugins\AutomapMode\AutomapMode.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\AutomapMode.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Builder Effects plugin...
ECHO.

View file

@ -665,6 +665,9 @@ namespace CodeImp.DoomBuilder.Editing
renderer.Finish();
}
//mxd. We want map center drawn by default
renderer.DrawMapCenter = true;
base.OnEngage();
}

View file

@ -6,7 +6,7 @@ using System.Resources;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GZDoom Builder")]
[assembly: AssemblyDescription("ZDoom, GZDoom and Zandronum map editor")]
[assembly: AssemblyDescription("ZDoom, GZDoom and Zandronum map editor (can be used for Vanilla/Boom mapping too!)")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CodeImp, MaxED")]
[assembly: AssemblyProduct("GZDoom Builder")]
@ -29,5 +29,5 @@ using System.Resources;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.0.2411")]
[assembly: AssemblyVersion("2.3.0.2651")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View file

@ -35,6 +35,7 @@ namespace CodeImp.DoomBuilder.Rendering
float TranslateY { get; }
float Scale { get; }
int VertexSize { get; }
bool DrawMapCenter { get; set; } //mxd
ViewMode ViewMode { get; }
// View methods
@ -58,6 +59,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Drawing methods
void PlotLine(Vector2D start, Vector2D end, PixelColor c);
void PlotLine(Vector2D start, Vector2D end, PixelColor c, float lengthscaler); //mxd
void PlotLinedef(Linedef l, PixelColor c);
void PlotLinedefSet(ICollection<Linedef> linedefs);
void PlotSector(Sector s);

View file

@ -105,6 +105,8 @@ namespace CodeImp.DoomBuilder.Rendering
private float linenormalsize;
private float minlinelength; //mxd. Linedef should be longer than this to be rendered
private float minlinenormallength; //mxd. Linedef direction indicator should be longer than this to be rendered
private bool drawmapcenter = true; //mxd
private bool lastdrawmapcenter = true; //mxd
private float lastgridscale = -1f;
private int lastgridsize;
private float lastgridx;
@ -125,6 +127,7 @@ namespace CodeImp.DoomBuilder.Rendering
public float TranslateY { get { return translatey; } }
public float Scale { get { return scale; } }
public int VertexSize { get { return vertexsize; } }
public bool DrawMapCenter { get { return drawmapcenter; } set { drawmapcenter = value; } } //mxd
public ViewMode ViewMode { get { return viewmode; } }
public SurfaceManager Surfaces { get { return surfaces; } }
public RectangleF Viewport { get { return viewport; } } //mxd
@ -810,8 +813,8 @@ namespace CodeImp.DoomBuilder.Rendering
private unsafe void RenderBackgroundGrid()
{
// Do we need to redraw grid?
if((lastgridsize != General.Map.Grid.GridSize) || (lastgridscale != scale) ||
(lastgridx != offsetx) || (lastgridy != offsety))
if(lastgridsize != General.Map.Grid.GridSize || lastgridscale != scale ||
lastgridx != offsetx || lastgridy != offsety || drawmapcenter != lastdrawmapcenter)
{
// Lock background rendertarget memory
DataRectangle lockedrect = backtex.LockRectangle(0, LockFlags.NoSystemLock);
@ -841,12 +844,15 @@ namespace CodeImp.DoomBuilder.Rendering
}
//mxd. Render center of map
Vector2D center = new Vector2D().GetTransformed(translatex, translatey, scale, -scale);
int cx = (int)center.x;
int cy = (int)center.y;
PixelColor c = General.Colors.Highlight;
gridplotter.DrawLineSolid(cx, cy + MAP_CENTER_SIZE, cx, cy - MAP_CENTER_SIZE, ref c);
gridplotter.DrawLineSolid(cx - MAP_CENTER_SIZE, cy, cx + MAP_CENTER_SIZE, cy, ref c);
if(drawmapcenter)
{
Vector2D center = new Vector2D().GetTransformed(translatex, translatey, scale, -scale);
int cx = (int)center.x;
int cy = (int)center.y;
PixelColor c = General.Colors.Highlight;
gridplotter.DrawLineSolid(cx, cy + MAP_CENTER_SIZE, cx, cy - MAP_CENTER_SIZE, ref c);
gridplotter.DrawLineSolid(cx - MAP_CENTER_SIZE, cy, cx + MAP_CENTER_SIZE, cy, ref c);
}
// Done
backtex.UnlockRectangle(0);
@ -855,6 +861,7 @@ namespace CodeImp.DoomBuilder.Rendering
lastgridsize = General.Map.Grid.GridSize;
lastgridx = offsetx;
lastgridy = offsety;
lastdrawmapcenter = drawmapcenter; //mxd
}
}
@ -2031,14 +2038,15 @@ namespace CodeImp.DoomBuilder.Rendering
}
// This renders a simple line
public void PlotLine(Vector2D start, Vector2D end, PixelColor c)
public void PlotLine(Vector2D start, Vector2D end, PixelColor c) { PlotLine(start, end, c, 0.0625f); }
public void PlotLine(Vector2D start, Vector2D end, PixelColor c, float lengthscaler)
{
// Transform coordinates
Vector2D v1 = start.GetTransformed(translatex, translatey, scale, -scale);
Vector2D v2 = end.GetTransformed(translatex, translatey, scale, -scale);
//mxd. Should we bother?
if((v2 - v1).GetLengthSq() < linenormalsize * 0.0625f) return;
if((v2 - v1).GetLengthSq() < linenormalsize * lengthscaler) return;
// Draw line
plotter.DrawLineSolid((int)v1.x, (int)v1.y, (int)v2.x, (int)v2.y, ref c);

View file

@ -0,0 +1,291 @@
#region ================== Copyright (c) 2016 Boris Iwanski
/*
* Copyright (c) 2016 Boris Iwanski https://github.com/biwa/automapmode
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Editing;
#endregion
namespace CodeImp.DoomBuilder.AutomapMode
{
[EditMode(DisplayName = "Automap Mode",
SwitchAction = "automapmode", // Action name used to switch to this mode
ButtonImage = "automap.png", // Image resource name for the button
ButtonOrder = int.MinValue + 503, // Position of the button (lower is more to the bottom)
ButtonGroup = "000_editing",
UseByDefault = true,
SafeStartMode = true)]
public class AutomapMode : ClassicMode
{
#region ================== Constants
private const float LINE_LENGTH_SCALER = 0.001f; //mxd
#endregion
#region ================== Variables
private CustomPresentation automappresentation;
private List<Linedef> validlinedefs;
// Highlighted item
private Linedef highlighted;
#endregion
#region ================== Properties
public override object HighlightedObject { get { return highlighted; } }
#endregion
#region ================== Constructor / Disposer
#endregion
#region ================== Methods
// This highlights a new item
private void Highlight(Linedef l)
{
// Update display
if(renderer.StartPlotter(false))
{
// Undraw previous highlight
if((highlighted != null) && !highlighted.IsDisposed)
{
PixelColor c = LinedefIsValid(highlighted) ? DetermineLinedefColor(highlighted) : new PixelColor(255, 0, 0, 0);
renderer.PlotLine(highlighted.Start.Position, highlighted.End.Position, c, LINE_LENGTH_SCALER);
}
// Set new highlight
highlighted = l;
// Render highlighted item
if((highlighted != null) && !highlighted.IsDisposed && LinedefIsValid(highlighted))
{
renderer.PlotLine(highlighted.Start.Position, highlighted.End.Position, General.Colors.InfoLine, LINE_LENGTH_SCALER);
}
// Done
renderer.Finish();
renderer.Present();
}
// Show highlight info
if((highlighted != null) && !highlighted.IsDisposed)
General.Interface.ShowLinedefInfo(highlighted);
else
General.Interface.HideInfo();
}
//mxd
internal void UpdateValidLinedefs()
{
validlinedefs = new List<Linedef>();
foreach(Linedef ld in General.Map.Map.Linedefs)
if(LinedefIsValid(ld)) validlinedefs.Add(ld);
}
private static PixelColor DetermineLinedefColor(Linedef ld)
{
if(ld.IsFlagSet(BuilderPlug.Me.HiddenFlag))
return new PixelColor(255, 192, 192, 192);
if(ld.Back == null || ld.IsFlagSet(BuilderPlug.Me.SecretFlag))
return new PixelColor(255, 252, 0, 0);
if(ld.Front.Sector.FloorHeight != ld.Back.Sector.FloorHeight)
return new PixelColor(255, 188, 120, 72);
if(ld.Front.Sector.CeilHeight != ld.Back.Sector.CeilHeight)
return new PixelColor(255, 252, 252, 0);
if(ld.Front.Sector.CeilHeight == ld.Back.Sector.CeilHeight && ld.Front.Sector.FloorHeight == ld.Back.Sector.FloorHeight)
return new PixelColor(255, 128, 128, 128);
if(General.Interface.CtrlState)
return new PixelColor(255, 192, 192, 192);
return new PixelColor(255, 255, 255, 255);
}
private static bool LinedefIsValid(Linedef ld)
{
if(General.Interface.CtrlState) return true;
if(ld.IsFlagSet(BuilderPlug.Me.HiddenFlag)) return false;
if(ld.Back == null || ld.IsFlagSet(BuilderPlug.Me.SecretFlag)) return true;
if(ld.Back != null && (ld.Front.Sector.FloorHeight != ld.Back.Sector.FloorHeight || ld.Front.Sector.CeilHeight != ld.Back.Sector.CeilHeight)) return true;
return false;
}
#endregion
#region ================== Events
public override void OnHelp()
{
General.ShowHelp("/gzdb/features/classic_modes/mode_automap.html");
}
// Cancel mode
public override void OnCancel()
{
base.OnCancel();
// Return to this mode
General.Editing.ChangeMode(new AutomapMode());
}
// Mode engages
public override void OnEngage()
{
base.OnEngage();
renderer.DrawMapCenter = false; //mxd
// Automap presentation without the surfaces
automappresentation = new CustomPresentation();
automappresentation.AddLayer(new PresentLayer(RendererLayer.Background, BlendingMode.Mask, General.Settings.BackgroundAlpha));
automappresentation.AddLayer(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
automappresentation.AddLayer(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
renderer.SetPresentation(automappresentation);
UpdateValidLinedefs();
}
// Mode disengages
public override void OnDisengage()
{
base.OnDisengage();
// Hide highlight info
General.Interface.HideInfo();
}
// This redraws the display
public override void OnRedrawDisplay()
{
renderer.RedrawSurface();
// Render lines
if(renderer.StartPlotter(true))
{
foreach(Linedef ld in General.Map.Map.Linedefs)
{
if(LinedefIsValid(ld))
renderer.PlotLine(ld.Start.Position, ld.End.Position, DetermineLinedefColor(ld), LINE_LENGTH_SCALER);
}
if((highlighted != null) && !highlighted.IsDisposed && LinedefIsValid(highlighted))
{
renderer.PlotLine(highlighted.Start.Position, highlighted.End.Position, General.Colors.InfoLine, LINE_LENGTH_SCALER);
}
renderer.Finish();
}
renderer.Present();
}
protected override void OnSelectEnd()
{
// Item highlighted?
if((highlighted != null) && !highlighted.IsDisposed)
{
General.Map.UndoRedo.CreateUndo("Toggle linedef show as 1-sided on automap flag");
// Toggle flag
highlighted.SetFlag(BuilderPlug.Me.SecretFlag, !highlighted.IsFlagSet(BuilderPlug.Me.SecretFlag));
UpdateValidLinedefs();
}
base.OnSelectEnd();
}
protected override void OnEditEnd()
{
// Item highlighted?
if((highlighted != null) && !highlighted.IsDisposed)
{
General.Map.UndoRedo.CreateUndo("Toggle linedef not shown on automap flag");
// Toggle flag
highlighted.SetFlag(BuilderPlug.Me.HiddenFlag, !highlighted.IsFlagSet(BuilderPlug.Me.HiddenFlag));
UpdateValidLinedefs();
General.Interface.RedrawDisplay();
}
base.OnEditEnd();
}
// Mouse moves
public override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
// Not holding any buttons?
if(e.Button == MouseButtons.None)
{
// Find the nearest linedef within highlight range
Linedef l = MapSet.NearestLinedefRange(validlinedefs, mousemappos, BuilderPlug.Me.HighlightRange / renderer.Scale);
// Highlight if not the same
if(l != highlighted) Highlight(l);
}
}
// Mouse leaves
public override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
// Highlight nothing
Highlight(null);
}
public override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
if(e.Control)
{
UpdateValidLinedefs();
General.Interface.RedrawDisplay();
}
}
public override void OnKeyUp(KeyEventArgs e)
{
base.OnKeyUp(e);
if(!e.Control)
{
UpdateValidLinedefs();
General.Interface.RedrawDisplay();
}
}
#endregion
}
}

View file

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B33F68D5-1335-400C-A1D7-7F5602A030EF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodeImp.DoomBuilder.AutomapMode</RootNamespace>
<AssemblyName>AutomapMode</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<StartupObject>
</StartupObject>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<Compile Include="BuilderPlug.cs" />
<Compile Include="AutomapMode.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\Builder.csproj">
<Project>{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}</Project>
<Name>Builder</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\automap.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Actions.cfg" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Hints.cfg" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,118 @@

#region ================== Copyright (c) 2016 Boris Iwanski
/*
* Copyright (c) 2016 Boris Iwanski https://github.com/biwa/automapmode
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using CodeImp.DoomBuilder.Plugins;
#endregion
namespace CodeImp.DoomBuilder.AutomapMode
{
//
// MANDATORY: The plug!
// This is an important class to the Doom Builder core. Every plugin must
// have exactly 1 class that inherits from Plug. When the plugin is loaded,
// this class is instantiated and used to receive events from the core.
// Make sure the class is public, because only public classes can be seen
// by the core.
//
public class BuilderPlug : Plug
{
#region ================== Variables
private float highlightrange;
// Static instance. We can't use a real static class, because BuilderPlug must
// be instantiated by the core, so we keep a static reference. (this technique
// should be familiar to object-oriented programmers)
private static BuilderPlug me;
#endregion
#region ================== Properties
public float HighlightRange { get { return highlightrange; } }
public string SecretFlag { get { return General.Map.UDMF ? "secret" : "32"; } }
public string HiddenFlag { get { return General.Map.UDMF ? "dontdraw" : "128"; } }
// This plugin relies on some functionality that wasn't there in older versions
public override int MinimumRevision { get { return 2651; } }
// Static property to access the BuilderPlug
public static BuilderPlug Me { get { return me; } }
#endregion
#region ================== Methods
// This event is called when the plugin is initialized
public override void OnInitialize()
{
base.OnInitialize();
// This binds the methods in this class that have the BeginAction
// and EndAction attributes with their actions. Without this, the
// attributes are useless. Note that in classes derived from EditMode
// this is not needed, because they are bound automatically when the
// editing mode is engaged.
General.Actions.BindMethods(this);
// TODO: Add DB2 version check so that old DB2 versions won't crash
// General.ErrorLogger.Add(ErrorType.Error, "zomg!");
// Keep a static reference
me = this;
LoadSettings();
}
//mxd
public override void OnMapOpenEnd()
{
AutomapMode mode = General.Editing.Mode as AutomapMode;
if(mode != null) mode.UpdateValidLinedefs();
base.OnMapOpenEnd();
}
//mxd
public override void OnMapNewEnd()
{
AutomapMode mode = General.Editing.Mode as AutomapMode;
if(mode != null) mode.UpdateValidLinedefs();
base.OnMapNewEnd();
}
// This is called when the plugin is terminated
public override void Dispose()
{
base.Dispose();
// This must be called to remove bound methods for actions.
General.Actions.UnbindMethods(this);
}
private void LoadSettings()
{
highlightrange = General.Settings.ReadPluginSetting("buildermodes", "highlightrange", 20);
}
#endregion
}
}

View file

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Automap Mode")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AutomapMode")]
[assembly: AssemblyCopyright("Copyright (c) 2016 Boris Iwanski")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("508a1fd7-53a2-40cf-be6c-9b306ee730fa")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View file

@ -0,0 +1,31 @@
//
// This file defines which actions there are, what description they have and
// some behaviour options. The Doom Builder core will bind to these actions
// with delegates (function pointers) where you use the BeginAction and
// EndAction attributes. This file must be named Actions.cfg and must be
// included in the plugin project as "Embedded Resource".
//
//
// Options:
//
// allowkeys: Allows the user to bind standard keys to this action.
// allowmouse: Allows the user to bind mouse buttons to this action.
// allowscroll: Allows the user to bind the scrollwheel to this action.
// disregardshift: This action will trigger regardless if Shift or Control is used.
// repeat: BeginAction will be called for automatic key repetition.
// default: Default key is only used when the action is loaded for the first
// time and the default key is not used by any other action.
//
// allowkeys and allowmouse are true by default, the others are false by default.
//
automapmode
{
title = "Automap mode";
category = "modes";
description = "Displays the map as shown in Doom's automap";
allowkeys = true;
allowmouse = true;
allowscroll = true;
}

View file

@ -0,0 +1,11 @@
// This is GZDB hints configuration file. It's dev-only stuff so bare minimum of boilerplate is present in the parser class
// (e.g. create your Hints.cfg exactly the way it's done here or face consequences).
// "class" should exactly match your classname; "group" can be anything. "general" and "multiselection" groups are shown automatically when appropriate.
// Supported tags are <b> for Bold and <br> for line break. Action name inside of <k> tag will insert keyboard shortcut for given action in bold.
// Only single-line comments are supported.
class AutomapMode
group general
"<b>Left click</b> on a line to toggle the <b>'Shown as 1-sided on automap'</b> flag."
"<b>Right click</b> on a line to toggle the <b>'Not shown on automap'</b> flag."
"Hold <b>Ctrl</b> to show lines that are not drawn, either because there was no height change (gray) or the <b>'Not shown on automap'</b> flag is set (light gray)."

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -9,7 +9,7 @@ using System.Resources;
[assembly: AssemblyDescription("GZDoom Builder Editing Modes")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CodeImp, MaxED")]
[assembly: AssemblyProduct("Doom Builder")]
[assembly: AssemblyProduct("GZDoom Builder")]
[assembly: AssemblyCopyright("Copyright © 2007, 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -29,5 +29,5 @@ using System.Resources;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.0.2411")]
[assembly: AssemblyVersion("2.3.0.2651")]
[assembly: NeutralResourcesLanguageAttribute("en")]