UltimateZoneBuilder/Source/Core/GZBuilder/GZGeneral.cs
MaxED 37feaa5de1 Added, Visual mode: sky rendering. Currently classic skies and GLDEFS Skyboxes are supported.
Added "Toggle sky rendering" action and toolbar button.
Added, MAPINFO parser: the editor now recognizes map number from classic map definition format. Hexen MAPINFO is now properly parsed.
Added, MAPINFO support: if current map definition contains map name as a text string, it will be shown in the editor's header.
Changed: "Toggle dynamic lights rendering" now toggles between "Don't show dynamic lights" and "Show dynamic lights" when used in Classic modes. 
Changed, Things mode: lowered the opacity of dynamic light radii.
Changed, (G)ZDoom text parsers: empty include files now trigger a warning instead of an error and no longer abort parsing.
Fixed, Game configurations: moved Stalagmite:5050 thing to Doom block (so the editor no longer tries to load it for non-Doom game configurations).
Fixed(?), Visual mode: probably fixed a hard-to-trigger exception when sorting translucent geometry.
Fixed, Visual mode: floor glow effect was incorrectly applied to walls (was broken in R2452).
Internal: restructured most of MAPINFO and GLDEFS parsers. Should be more maintainable now.  
Updated ZDoom ACC.
Updated zdbsp to 1.19.
Updated documentation.
2016-01-11 13:00:52 +00:00

189 lines
No EOL
6.7 KiB
C#

#region ================== Namespaces
using CodeImp.DoomBuilder.Actions;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.GZBuilder.Data;
#endregion
namespace CodeImp.DoomBuilder.GZBuilder
{
//mxd. should get rid of this class one day...
public static class GZGeneral
{
#region ================== Properties
//gzdoom light types
private static readonly int[] gzLights = { /* normal lights */ 9800, 9801, 9802, 9803, 9804, /* additive lights */ 9810, 9811, 9812, 9813, 9814, /* negative lights */ 9820, 9821, 9822, 9823, 9824, /* vavoom lights */ 1502, 1503};
public static int[] GZ_LIGHTS { get { return gzLights; } }
private static readonly int[] gzLightTypes = { 5, 10, 15 }; //these are actually offsets in gz_lights
public static int[] GZ_LIGHT_TYPES { get { return gzLightTypes; } }
private static readonly DynamicLightType[] gzAnimatedLightTypes = { DynamicLightType.FLICKER, DynamicLightType.RANDOM, DynamicLightType.PULSE };
public static DynamicLightType[] GZ_ANIMATED_LIGHT_TYPES { get { return gzAnimatedLightTypes; } }
//asc script action specials
private static readonly int[] acsSpecials = { 80, 81, 82, 83, 84, 85, 226 };
public static int[] ACS_SPECIALS { get { return acsSpecials; } }
#endregion
#region ================== Methods
public static void Init()
{
//bind actions
General.Actions.BindMethods(typeof(GZGeneral));
}
#endregion
#region ================== Actions
[BeginAction("gztogglemodels")]
private static void ToggleModelsRenderingMode()
{
switch(General.Settings.GZDrawModelsMode)
{
case ModelRenderMode.NONE:
General.Settings.GZDrawModelsMode = ModelRenderMode.SELECTION;
General.MainWindow.DisplayStatus(StatusType.Action, "Models rendering mode: SELECTION ONLY");
break;
case ModelRenderMode.SELECTION:
General.Settings.GZDrawModelsMode = ModelRenderMode.ACTIVE_THINGS_FILTER;
General.MainWindow.DisplayStatus(StatusType.Action, "Models rendering mode: ACTIVE THINGS FILTER ONLY");
break;
case ModelRenderMode.ACTIVE_THINGS_FILTER:
General.Settings.GZDrawModelsMode = ModelRenderMode.ALL;
General.MainWindow.DisplayStatus(StatusType.Action, "Models rendering mode: ALL");
break;
case ModelRenderMode.ALL:
General.Settings.GZDrawModelsMode = ModelRenderMode.NONE;
General.MainWindow.DisplayStatus(StatusType.Action, "Models rendering mode: NONE");
break;
}
General.MainWindow.RedrawDisplay();
General.MainWindow.UpdateGZDoomPanel();
}
[BeginAction("gztogglelights")]
private static void ToggleLightsRenderingMode()
{
if(General.Editing.Mode is ClassicMode)
{
switch(General.Settings.GZDrawLightsMode)
{
case LightRenderMode.NONE:
General.Settings.GZDrawLightsMode = LightRenderMode.ALL;
General.MainWindow.DisplayStatus(StatusType.Action, "Dynamic lights rendering mode: ALL");
break;
default:
General.Settings.GZDrawLightsMode = LightRenderMode.NONE;
General.MainWindow.DisplayStatus(StatusType.Action, "Dynamic lights rendering mode: NONE");
break;
}
}
else
{
switch(General.Settings.GZDrawLightsMode)
{
case LightRenderMode.NONE:
General.Settings.GZDrawLightsMode = LightRenderMode.ALL;
General.MainWindow.DisplayStatus(StatusType.Action, "Dynamic lights rendering mode: ALL");
break;
case LightRenderMode.ALL:
General.Settings.GZDrawLightsMode = LightRenderMode.ALL_ANIMATED;
General.MainWindow.DisplayStatus(StatusType.Action, "Dynamic lights rendering mode: ANIMATED");
break;
case LightRenderMode.ALL_ANIMATED:
General.Settings.GZDrawLightsMode = LightRenderMode.NONE;
General.MainWindow.DisplayStatus(StatusType.Action, "Dynamic lights rendering mode: NONE");
break;
}
}
General.MainWindow.RedrawDisplay();
General.MainWindow.UpdateGZDoomPanel();
}
[BeginAction("gztogglefog")]
private static void ToggleFog()
{
General.Settings.GZDrawFog = !General.Settings.GZDrawFog;
General.MainWindow.DisplayStatus(StatusType.Action, "Fog rendering is " + (General.Settings.GZDrawFog ? "ENABLED" : "DISABLED"));
General.MainWindow.RedrawDisplay();
General.MainWindow.UpdateGZDoomPanel();
}
[BeginAction("gztogglesky")]
private static void ToggleSky()
{
General.Settings.GZDrawSky = !General.Settings.GZDrawSky;
General.MainWindow.DisplayStatus(StatusType.Action, "Sky rendering is " + (General.Settings.GZDrawSky ? "ENABLED" : "DISABLED"));
General.MainWindow.RedrawDisplay();
General.MainWindow.UpdateGZDoomPanel();
}
[BeginAction("gztogglefx")]
private static void ToggleFx()
{
int on = 0;
on += General.Settings.GZDrawFog ? 1 : -1;
on += General.Settings.GZDrawSky ? 1 : -1;
on += General.Settings.GZDrawLightsMode != LightRenderMode.NONE ? 1 : -1;
on += General.Settings.GZDrawModelsMode != ModelRenderMode.NONE ? 1 : -1;
bool enable = (on < 0);
General.Settings.GZDrawFog = enable;
General.Settings.GZDrawSky = enable;
General.Settings.GZDrawLightsMode = (enable ? LightRenderMode.ALL : LightRenderMode.NONE);
General.Settings.GZDrawModelsMode = (enable ? ModelRenderMode.ALL : ModelRenderMode.NONE);
General.MainWindow.DisplayStatus(StatusType.Action, "Advanced effects are " + (enable ? "ENABLED" : "DISABLED") );
General.MainWindow.RedrawDisplay();
General.MainWindow.UpdateGZDoomPanel();
}
[BeginAction("gztoggleeventlines")]
private static void ToggleEventLines()
{
General.Settings.GZShowEventLines = !General.Settings.GZShowEventLines;
General.MainWindow.DisplayStatus(StatusType.Action, "Event lines are " + (General.Settings.GZShowEventLines ? "ENABLED" : "DISABLED"));
General.MainWindow.RedrawDisplay();
General.MainWindow.UpdateGZDoomPanel();
}
[BeginAction("gztogglevisualvertices")]
private static void ToggleVisualVertices()
{
General.Settings.GZShowVisualVertices = !General.Settings.GZShowVisualVertices;
General.MainWindow.DisplayStatus(StatusType.Action, "Visual vertices are " + (General.Settings.GZShowVisualVertices ? "ENABLED" : "DISABLED"));
General.MainWindow.RedrawDisplay();
General.MainWindow.UpdateGZDoomPanel();
}
//main menu actions
[BeginAction("gzreloadmodeldef")]
private static void ReloadModeldef()
{
if(General.Map != null) General.Map.Data.ReloadModeldef();
}
[BeginAction("gzreloadgldefs")]
private static void ReloadGldefs()
{
if(General.Map != null) General.Map.Data.ReloadGldefs();
}
#endregion
}
}