mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
GZDoom Builder 1.07b:
Visplane Explorer plugin will show warning message instead of chashing if current map is not in Doom map format. Fixed a crash when trying to undo sector creation in Visual Modes. Fixed incorrect colors in Script Editor.
This commit is contained in:
parent
4c54ed8cce
commit
a9bc8f9e05
10 changed files with 110 additions and 100 deletions
|
@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuilderModes", "..\Plugins\
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisplaneExplorer", "..\Plugins\VisplaneExplorer\VisplaneExplorer.csproj", "{CF670175-7099-4090-A330-EE25C7230139}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorPicker", "..\Plugins\ColorPicker\ColorPicker.csproj", "{A4761900-0EA3-4FE4-A919-847FD5080EFC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -61,6 +63,16 @@ Global
|
|||
{CF670175-7099-4090-A330-EE25C7230139}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Release|x86.Build.0 = Release|Any CPU
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x86.Build.0 = Debug|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x86.ActiveCfg = Release|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -290,10 +290,10 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
scriptedit.StyleSetItalic(DEFAULT_STYLE, false);
|
||||
scriptedit.StyleSetUnderline(DEFAULT_STYLE, false);
|
||||
scriptedit.StyleSetCase(DEFAULT_STYLE, ScriptCaseVisible.Mixed);
|
||||
scriptedit.StyleSetFore(DEFAULT_STYLE, General.Colors.PlainText.ToColorRef());
|
||||
scriptedit.StyleSetBack(DEFAULT_STYLE, General.Colors.ScriptBackground.ToColorRef());
|
||||
scriptedit.StyleSetFore(DEFAULT_STYLE, General.Colors.PlainText.ToInversedColorRef());
|
||||
scriptedit.StyleSetBack(DEFAULT_STYLE, General.Colors.ScriptBackground.ToInversedColorRef());
|
||||
scriptedit.CaretPeriod = SystemInformation.CaretBlinkTime;
|
||||
scriptedit.CaretFore = General.Colors.ScriptBackground.Inverse().ToColorRef();
|
||||
scriptedit.CaretFore = General.Colors.ScriptBackground.Inverse().ToInversedColorRef();
|
||||
scriptedit.StyleBits = 7;
|
||||
|
||||
// These don't work?
|
||||
|
@ -317,8 +317,8 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
scriptedit.StyleSetSize(DEFAULT_STYLE, (int)Math.Round(this.Font.SizeInPoints));
|
||||
|
||||
// Set style for linenumbers and margins
|
||||
scriptedit.StyleSetBack((int)ScriptStylesCommon.LineNumber, General.Colors.ScriptBackground.ToColorRef());
|
||||
|
||||
scriptedit.StyleSetBack((int)ScriptStylesCommon.LineNumber, General.Colors.ScriptBackground.ToInversedColorRef());
|
||||
|
||||
// Clear all keywords
|
||||
for(int i = 0; i < 9; i++) scriptedit.KeyWords(i, null);
|
||||
|
||||
|
@ -347,7 +347,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
case ScriptStyleType.Literal: colorindex = ColorCollection.LITERALS; break;
|
||||
default: colorindex = ColorCollection.PLAINTEXT; break;
|
||||
}
|
||||
scriptedit.StyleSetFore(stylenum, General.Colors.Colors[colorindex].ToColorRef());
|
||||
scriptedit.StyleSetFore(stylenum, General.Colors.Colors[colorindex].ToInversedColorRef());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Drawing;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using CodeImp.DoomBuilder.Controls;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.ZDoom;
|
||||
using CodeImp.DoomBuilder.Actions;
|
||||
|
|
|
@ -128,15 +128,6 @@ namespace CodeImp.DoomBuilder.Plugins
|
|||
return plugin.GetResourceStream(resourcename);
|
||||
}
|
||||
|
||||
//mxd. It's nice to have these avaliable to plugins...
|
||||
public static bool DisplayStatus(StatusType type, string message) {
|
||||
if (General.MainWindow != null) {
|
||||
General.MainWindow.DisplayStatus(type, message);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Events
|
||||
|
|
|
@ -115,13 +115,12 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
{
|
||||
return Color.FromArgb(a, r, g, b);
|
||||
}
|
||||
|
||||
// To ColorRef (alpha-less)
|
||||
public int ToColorRef()
|
||||
|
||||
//To ColorRef (alpha-less). mxd. Changed function name to more descriptive one...
|
||||
public int ToInversedColorRef()
|
||||
{
|
||||
//mxd
|
||||
//return ((int)r + ((int)b << 16) + ((int)g << 8));
|
||||
return (((int)r << 16) + ((int)g << 8) + (int)b);
|
||||
return ((int)r + ((int)b << 16) + ((int)g << 8));
|
||||
//return (((int)r << 16) + ((int)g << 8) + (int)b);
|
||||
}
|
||||
|
||||
// To ColorValue
|
||||
|
|
|
@ -714,7 +714,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
if(g.Sector.NeedsUpdateGeo) g.Sector.Update();
|
||||
|
||||
// Only do this sector when a vertexbuffer is created
|
||||
if(g.Sector.GeometryBuffer != null)
|
||||
//mxd. no Map means that sector was deleted recently, I suppose
|
||||
if (g.Sector.GeometryBuffer != null && g.Sector.Sector.Map != null)
|
||||
{
|
||||
// Change current sector
|
||||
sector = g.Sector;
|
||||
|
@ -726,9 +727,9 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
{
|
||||
sector = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(sector != null)
|
||||
}
|
||||
|
||||
if (sector != null)
|
||||
{
|
||||
// Determine the shader pass we want to use for this object
|
||||
int wantedshaderpass = (((g == highlighted) && showhighlight) || (g.Selected && showselection)) ? highshaderpass : shaderpass;
|
||||
|
@ -744,7 +745,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
litGeometry[curtexture.Texture] = new List<VisualGeometry>();
|
||||
litGeometry[curtexture.Texture].Add(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Switch shader pass?
|
||||
if(currentshaderpass != wantedshaderpass)
|
||||
|
@ -1096,7 +1097,10 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
//mxd. returns true if sector has fog color
|
||||
private bool getFogColor(Sector sector, out Color4 color) {
|
||||
if (GZBuilder.GZGeneral.UDMF && sector.Fields.ContainsKey("fadecolor")) {
|
||||
/*if(sector.Fields == null){
|
||||
color = new Color4(); //black
|
||||
return false;
|
||||
} else*/ if (GZBuilder.GZGeneral.UDMF && sector.Fields.ContainsKey("fadecolor")) {
|
||||
color = new Color4((int)sector.Fields["fadecolor"].Value);
|
||||
return true;
|
||||
} else if (General.Map.Data.MapInfo.HasOutsideFogColor && sector.CeilTexture == General.Map.Config.SkyFlatName) {
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace CodeImp.DoomBuilder.ColorPicker
|
|||
//display one of colorPickers or tell the user why we can't do that
|
||||
if (currentModeName == "ThingsMode") {
|
||||
if(General.Map.Map.SelectedThingsCount == 0){
|
||||
Plug.DisplayStatus(StatusType.Warning, "Select some lights first!");
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Select some lights first!");
|
||||
return;
|
||||
}
|
||||
form = new LightColorPicker();
|
||||
|
@ -80,12 +80,12 @@ namespace CodeImp.DoomBuilder.ColorPicker
|
|||
} else if (currentModeName == "SectorsMode") {
|
||||
if (GZBuilder.GZGeneral.UDMF) {
|
||||
if (General.Map.Map.SelectedSectorsCount == 0) {
|
||||
Plug.DisplayStatus(StatusType.Warning, "Select some sectors first!");
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Select some sectors first!");
|
||||
return;
|
||||
}
|
||||
form = new SectorColorPicker();
|
||||
} else {
|
||||
Plug.DisplayStatus(StatusType.Warning, "Sector colors can only be set if map is in UDMF format!");
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Sector colors can only be set if map is in UDMF format!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -97,14 +97,14 @@ namespace CodeImp.DoomBuilder.ColorPicker
|
|||
if (GZBuilder.GZGeneral.UDMF && (selectedSectorsCount > 0 || General.Map.Map.SelectedSectorsCount > 0)) {
|
||||
form = new SectorColorPicker();
|
||||
} else {
|
||||
Plug.DisplayStatus(StatusType.Warning, "Select some lights " + (GZBuilder.GZGeneral.UDMF ? "or sectors " : "") + "first!");
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Select some lights " + (GZBuilder.GZGeneral.UDMF ? "or sectors " : "") + "first!");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
form = new LightColorPicker();
|
||||
}
|
||||
} else { //wrong mode
|
||||
Plug.DisplayStatus(StatusType.Warning, "Switch to" + (GZBuilder.GZGeneral.UDMF ? " Sectors," : "") + " Things or GZDoom Visual Mode first!");
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Switch to" + (GZBuilder.GZGeneral.UDMF ? " Sectors," : "") + " Things or GZDoom Visual Mode first!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows {
|
|||
|
||||
int selCount = selection.Count;
|
||||
if (selCount == 0) {
|
||||
Plug.DisplayStatus(StatusType.Warning, "No lights found in selection!");
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "No lights found in selection!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
|
|||
{
|
||||
base.OnMapOpenBegin();
|
||||
|
||||
if(palettes == null)
|
||||
if (palettes == null)
|
||||
{
|
||||
// Load palettes
|
||||
palettes = new Palette[(int)ViewStats.NumStats];
|
||||
|
@ -129,7 +129,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
|
|||
// This applies user-defined appearance colors to the palettes
|
||||
private void ApplyUserColors()
|
||||
{
|
||||
if(palettes != null)
|
||||
if(palettes != null)
|
||||
{
|
||||
// Override special palette indices with user-defined colors
|
||||
for(int i = 0; i < palettes.Length; i++)
|
||||
|
|
|
@ -263,80 +263,83 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
|
|||
// Mode starts
|
||||
public override void OnEngage()
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
base.OnEngage();
|
||||
General.Interface.DisplayStatus(StatusType.Busy, "Setting up test environment...");
|
||||
|
||||
CleanUp();
|
||||
//mxd. I think it only applies to maps in Doom format
|
||||
if (General.Map.Config.FormatInterface == "DoomMapSetIO") {
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
base.OnEngage();
|
||||
General.Interface.DisplayStatus(StatusType.Busy, "Setting up test environment...");
|
||||
|
||||
BuilderPlug.InterfaceForm.AddToInterface();
|
||||
lastviewstats = BuilderPlug.InterfaceForm.ViewStats;
|
||||
|
||||
// Export the current map to a temporary WAD file
|
||||
tempfile = BuilderPlug.MakeTempFilename(".wad");
|
||||
General.Map.ExportToFile(tempfile);
|
||||
|
||||
// Load the map in VPO_DLL
|
||||
BuilderPlug.VPO.Start(tempfile, General.Map.Options.LevelName);
|
||||
CleanUp();
|
||||
|
||||
// Determine map boundary
|
||||
mapbounds = Rectangle.Round(MapSet.CreateArea(General.Map.Map.Vertices));
|
||||
BuilderPlug.InterfaceForm.AddToInterface();
|
||||
lastviewstats = BuilderPlug.InterfaceForm.ViewStats;
|
||||
|
||||
// Create tiles for all points inside the map
|
||||
Point lt = TileForPoint(mapbounds.Left - Tile.TILE_SIZE, mapbounds.Top - Tile.TILE_SIZE);
|
||||
Point rb = TileForPoint(mapbounds.Right + Tile.TILE_SIZE, mapbounds.Bottom + Tile.TILE_SIZE);
|
||||
Rectangle tilesrect = new Rectangle(lt.X, lt.Y, rb.X - lt.X, rb.Y - lt.Y);
|
||||
NearestLineBlockmap blockmap = new NearestLineBlockmap(tilesrect);
|
||||
for(int x = tilesrect.X; x <= tilesrect.Right; x += Tile.TILE_SIZE)
|
||||
{
|
||||
for(int y = tilesrect.Y; y <= tilesrect.Bottom; y += Tile.TILE_SIZE)
|
||||
{
|
||||
// If the tile is obviously outside the map, don't create it
|
||||
Vector2D pc = new Vector2D(x + (Tile.TILE_SIZE >> 1), y + (Tile.TILE_SIZE >> 1));
|
||||
Linedef ld = MapSet.NearestLinedef(blockmap.GetBlockAt(pc).Lines, pc);
|
||||
float distancesq = ld.DistanceToSq(pc, true);
|
||||
if(distancesq > (Tile.TILE_SIZE * Tile.TILE_SIZE))
|
||||
{
|
||||
float side = ld.SideOfLine(pc);
|
||||
if((side > 0.0f) && (ld.Back == null)) continue;
|
||||
}
|
||||
// Export the current map to a temporary WAD file
|
||||
tempfile = BuilderPlug.MakeTempFilename(".wad");
|
||||
General.Map.ExportToFile(tempfile);
|
||||
|
||||
Point tp = new Point(x, y);
|
||||
tiles.Add(tp, new Tile(tp));
|
||||
}
|
||||
}
|
||||
// Load the map in VPO_DLL
|
||||
BuilderPlug.VPO.Start(tempfile, General.Map.Options.LevelName);
|
||||
|
||||
QueuePoints(0);
|
||||
// Determine map boundary
|
||||
mapbounds = Rectangle.Round(MapSet.CreateArea(General.Map.Map.Vertices));
|
||||
|
||||
// Make an image to draw on.
|
||||
// The BitmapImage for Doom Builder's resources must be Format32bppArgb and NOT using color correction,
|
||||
// otherwise DB will make a copy of the bitmap when LoadImage() is called! This is normally not a problem,
|
||||
// but we want to keep drawing to the same bitmap.
|
||||
int width = General.NextPowerOf2(General.Interface.Display.ClientSize.Width);
|
||||
int height = General.NextPowerOf2(General.Interface.Display.ClientSize.Height);
|
||||
canvas = new Bitmap(width, height, PixelFormat.Format32bppArgb);
|
||||
image = new DynamicBitmapImage(canvas, "_CANVAS_");
|
||||
image.UseColorCorrection = false;
|
||||
image.MipMapLevels = 1;
|
||||
image.LoadImage();
|
||||
image.CreateTexture();
|
||||
// Create tiles for all points inside the map
|
||||
Point lt = TileForPoint(mapbounds.Left - Tile.TILE_SIZE, mapbounds.Top - Tile.TILE_SIZE);
|
||||
Point rb = TileForPoint(mapbounds.Right + Tile.TILE_SIZE, mapbounds.Bottom + Tile.TILE_SIZE);
|
||||
Rectangle tilesrect = new Rectangle(lt.X, lt.Y, rb.X - lt.X, rb.Y - lt.Y);
|
||||
NearestLineBlockmap blockmap = new NearestLineBlockmap(tilesrect);
|
||||
for (int x = tilesrect.X; x <= tilesrect.Right; x += Tile.TILE_SIZE) {
|
||||
for (int y = tilesrect.Y; y <= tilesrect.Bottom; y += Tile.TILE_SIZE) {
|
||||
// If the tile is obviously outside the map, don't create it
|
||||
Vector2D pc = new Vector2D(x + (Tile.TILE_SIZE >> 1), y + (Tile.TILE_SIZE >> 1));
|
||||
Linedef ld = MapSet.NearestLinedef(blockmap.GetBlockAt(pc).Lines, pc);
|
||||
float distancesq = ld.DistanceToSq(pc, true);
|
||||
if (distancesq > (Tile.TILE_SIZE * Tile.TILE_SIZE)) {
|
||||
float side = ld.SideOfLine(pc);
|
||||
if ((side > 0.0f) && (ld.Back == null)) continue;
|
||||
}
|
||||
|
||||
// Make custom presentation
|
||||
CustomPresentation p = new CustomPresentation();
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Overlay, BlendingMode.Mask, 1f, false));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
|
||||
renderer.SetPresentation(p);
|
||||
Point tp = new Point(x, y);
|
||||
tiles.Add(tp, new Tile(tp));
|
||||
}
|
||||
}
|
||||
|
||||
// Setup processing
|
||||
nextupdate = DateTime.Now + new TimeSpan(0, 0, 0, 0, 100);
|
||||
General.Interface.EnableProcessing();
|
||||
processingenabled = true;
|
||||
QueuePoints(0);
|
||||
|
||||
RedrawAllTiles();
|
||||
Cursor.Current = Cursors.Default;
|
||||
General.Interface.SetCursor(Cursors.Cross);
|
||||
General.Interface.DisplayReady();
|
||||
// Make an image to draw on.
|
||||
// The BitmapImage for Doom Builder's resources must be Format32bppArgb and NOT using color correction,
|
||||
// otherwise DB will make a copy of the bitmap when LoadImage() is called! This is normally not a problem,
|
||||
// but we want to keep drawing to the same bitmap.
|
||||
int width = General.NextPowerOf2(General.Interface.Display.ClientSize.Width);
|
||||
int height = General.NextPowerOf2(General.Interface.Display.ClientSize.Height);
|
||||
canvas = new Bitmap(width, height, PixelFormat.Format32bppArgb);
|
||||
image = new DynamicBitmapImage(canvas, "_CANVAS_");
|
||||
image.UseColorCorrection = false;
|
||||
image.MipMapLevels = 1;
|
||||
image.LoadImage();
|
||||
image.CreateTexture();
|
||||
|
||||
// Make custom presentation
|
||||
CustomPresentation p = new CustomPresentation();
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Overlay, BlendingMode.Mask, 1f, false));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
|
||||
renderer.SetPresentation(p);
|
||||
|
||||
// Setup processing
|
||||
nextupdate = DateTime.Now + new TimeSpan(0, 0, 0, 0, 100);
|
||||
General.Interface.EnableProcessing();
|
||||
processingenabled = true;
|
||||
|
||||
RedrawAllTiles();
|
||||
Cursor.Current = Cursors.Default;
|
||||
General.Interface.SetCursor(Cursors.Cross);
|
||||
General.Interface.DisplayReady();
|
||||
} else {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Vsiplane Explorer requires map in Doom format!");
|
||||
OnCancel(); //return to previous mode
|
||||
}
|
||||
}
|
||||
|
||||
// Mode ends
|
||||
|
|
Loading…
Reference in a new issue