Merged in GZDB r2479.

This commit is contained in:
MascaraSnake 2016-01-23 09:47:27 +01:00
parent 287d1fe968
commit 2e4150b3b4
3 changed files with 82 additions and 56 deletions

View file

@ -2171,12 +2171,12 @@ namespace CodeImp.DoomBuilder
configinfo = General.GetConfigurationInfo(options.ConfigFile);
Type oldiotype = io.GetType(); //mxd
//mxd. Step 1 of hackish way to translate SP/MP thing flags to Hexen map format...
//TODO: add proper Doom -> Hexen thing flags translation to the configs?
if(oldiotype == typeof(DoomMapSetIO) && configinfo.FormatInterface == "hexenmapsetio")
{
// Translate to UDMF using Doom things flags translation table
foreach(Thing t in General.Map.Map.Things) t.TranslateToUDMF();
//mxd. Step 1 of hackish way to translate SP/MP thing flags to Hexen / UDMF formats...
//TODO: add proper Doom -> Hexen thing flags translation to the configs?
if (oldiotype == typeof(DoomMapSetIO) && configinfo.FormatInterface != "doommapsetio")
{
// Translate to UDMF using Doom things flags translation table
foreach (Thing t in General.Map.Map.Things) t.TranslateToUDMF();
}
config = new GameConfiguration(configinfo.Configuration); //mxd
@ -2202,26 +2202,38 @@ namespace CodeImp.DoomBuilder
{
foreach(Linedef l in General.Map.Map.Linedefs) l.TranslateFromUDMF();
foreach(Thing t in General.Map.Map.Things) t.TranslateFromUDMF();
}
else if(oldiotype != typeof(UniversalMapSetIO) && io is UniversalMapSetIO)
{
foreach(Linedef l in General.Map.Map.Linedefs) l.TranslateToUDMF(oldiotype);
foreach(Thing t in General.Map.Map.Things) t.TranslateToUDMF();
}
else if(oldiotype != typeof(DoomMapSetIO) && io is DoomMapSetIO)
{
// Drop all arguments
foreach(Linedef l in General.Map.Map.Linedefs)
for(int i = 0; i < l.Args.Length; i++) l.Args[i] = 0;
foreach(Thing t in General.Map.Map.Things)
for(int i = 0; i < t.Args.Length; i++) t.Args[i] = 0;
}
else if(oldiotype == typeof(DoomMapSetIO) && io is HexenMapSetIO)
{
// Step 2 of hackish way to translate SP/MP thing flags to Hexen map format...
foreach(Thing t in General.Map.Map.Things) t.TranslateFromUDMF();
}
map.UpdateCustomLinedefColors();
else if (oldiotype == typeof(DoomMapSetIO))
{
if (io is UniversalMapSetIO)
{
//Thing flags were already translated in Setp 1...
//TODO: linedef actions will require the same handling...
foreach (Linedef l in General.Map.Map.Linedefs) l.TranslateToUDMF(oldiotype);
}
else if (io is HexenMapSetIO)
{
// Step 2 of hackish way to translate SP/MP thing flags to Hexen map format...
foreach (Thing t in General.Map.Map.Things) t.TranslateFromUDMF();
}
}
else if (oldiotype != typeof(UniversalMapSetIO) && io is UniversalMapSetIO)
{
foreach (Linedef l in General.Map.Map.Linedefs) l.TranslateToUDMF(oldiotype);
foreach (Thing t in General.Map.Map.Things) t.TranslateToUDMF();
}
// Drop all arguments
if (oldiotype != typeof(DoomMapSetIO) && io is DoomMapSetIO)
{
foreach (Linedef l in General.Map.Map.Linedefs)
for (int i = 0; i < l.Args.Length; i++) l.Args[i] = 0;
foreach (Thing t in General.Map.Map.Things)
for (int i = 0; i < t.Args.Length; i++) t.Args[i] = 0;
}
map.UpdateCustomLinedefColors();
// Reload resources
ReloadResources();

View file

@ -555,21 +555,21 @@ namespace CodeImp.DoomBuilder.VisualModes
{
n = 0;
lightRenderStyle = DynamicLightRenderStyle.NORMAL;
//lightColor.Alpha used in shader to perform some calculations based on light type
lightColor = new Color4((float)lightRenderStyle / 100.0f, thing.Args[0] / scaled_intensity, thing.Args[1] / scaled_intensity, thing.Args[2] / scaled_intensity);
}
//lightColor.Alpha used in shader to perform some calculations based on light type
lightColor = new Color4((float)lightRenderStyle / 100.0f, thing.Args[0] / scaled_intensity / 2, thing.Args[1] / scaled_intensity / 2, thing.Args[2] / scaled_intensity / 2);
}
else if(lightId < GZBuilder.GZGeneral.GZ_LIGHT_TYPES[1])
{
n = 10;
lightRenderStyle = DynamicLightRenderStyle.ADDITIVE;
lightColor = new Color4((float)lightRenderStyle / 100.0f, thing.Args[0] / scaled_intensity, thing.Args[1] / scaled_intensity, thing.Args[2] / scaled_intensity);
}
lightColor = new Color4((float)lightRenderStyle / 100.0f, thing.Args[0] / scaled_intensity / 2, thing.Args[1] / scaled_intensity / 2, thing.Args[2] / scaled_intensity / 2);
}
else
{
n = 20;
lightRenderStyle = DynamicLightRenderStyle.NEGATIVE;
lightColor = new Color4((float)lightRenderStyle / 100.0f, thing.Args[0] / scaled_intensity, thing.Args[1] / scaled_intensity, thing.Args[2] / scaled_intensity);
}
lightColor = new Color4((float)lightRenderStyle / 100.0f, thing.Args[0] / scaled_intensity / 3, thing.Args[1] / scaled_intensity / 3, thing.Args[2] / scaled_intensity / 3);
}
lightType = (DynamicLightType)(thing.Type - 9800 - n);
if(lightType == DynamicLightType.SECTOR)
@ -589,10 +589,10 @@ namespace CodeImp.DoomBuilder.VisualModes
lightRenderStyle = DynamicLightRenderStyle.VAVOOM;
lightType = (DynamicLightType)thing.Type;
if(lightType == DynamicLightType.VAVOOM_COLORED)
lightColor = new Color4((float)lightRenderStyle / 100.0f, thing.Args[1] / scaled_intensity, thing.Args[2] / scaled_intensity, thing.Args[3] / scaled_intensity);
else
lightColor = new Color4((float)lightRenderStyle / 100.0f, General.Settings.GZDynamicLightIntensity, General.Settings.GZDynamicLightIntensity, General.Settings.GZDynamicLightIntensity);
lightPrimaryRadius = (thing.Args[0] * 8) * General.Settings.GZDynamicLightRadius;
lightColor = new Color4((float)lightRenderStyle / 100.0f, thing.Args[1] / scaled_intensity / 2, thing.Args[2] / scaled_intensity / 2, thing.Args[3] / scaled_intensity / 2);
else
lightColor = new Color4((float)lightRenderStyle / 100.0f, General.Settings.GZDynamicLightIntensity / 2, General.Settings.GZDynamicLightIntensity / 2, General.Settings.GZDynamicLightIntensity / 2);
lightPrimaryRadius = (thing.Args[0] * 8) * General.Settings.GZDynamicLightRadius;
}
UpdateLightRadius();

View file

@ -138,7 +138,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
private bool modealreadyswitching;
private bool clearselection; //mxd
private bool pasting;
private PasteOptions pasteoptions;
private bool autodrag; //mxd
private PasteOptions pasteoptions;
// Docker
private EditSelectionPanel panel;
@ -383,11 +384,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Not in any modifying mode?
if(mode == ModifyMode.None)
{
// Check what grip the mouse is over
// and change cursor accordingly
Grip mousegrip = CheckMouseGrip();
switch(mousegrip)
{
// Check what grip the mouse is over
// and change cursor accordingly
Grip mousegrip = (autodrag ? Grip.Main : CheckMouseGrip()); //mxd. We only want to move when starting auto-dragging
switch (mousegrip)
{
case Grip.Main:
// Find the nearest vertex within highlight range
@ -1035,9 +1036,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override void OnEngage()
{
base.OnEngage();
bool autodrag = (pasting && mouseinside && BuilderPlug.Me.AutoDragOnPaste);
snaptonearest = General.Interface.AutoMerge; //mxd
autodrag = (pasting && mouseinside && BuilderPlug.Me.AutoDragOnPaste);
snaptonearest = General.Interface.AutoMerge; //mxd
// Add toolbar buttons
General.Interface.AddButton(BuilderPlug.Me.MenusForm.FlipSelectionH);
@ -1191,10 +1192,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
UpdateRectangleComponents();
UpdatePanel();
Update();
// When pasting and mouse is in screen, drag selection immediately
if(autodrag) OnSelectBegin();
}
// When pasting and mouse is in screen, drag selection immediately
if (autodrag)
{
OnSelectBegin();
autodrag = false; //mxd. Don't need this any more
}
}
else
{
General.Interface.MessageBeep(MessageBeepType.Default);
@ -1642,9 +1647,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D center = offset + size * 0.5f;
Vector2D delta;
// Check what grip the mouse is over
switch(CheckMouseGrip())
{
// Check what grip the mouse is over
Grip mousegrip = (autodrag ? Grip.Main : CheckMouseGrip()); //mxd. We only want to move when starting auto-dragging
switch (mousegrip)
{
// Drag main rectangle
case Grip.Main:
@ -1654,8 +1660,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
int index = 0;
foreach(Vertex v in selectedvertices)
{
if(v == highlighted) highlightedpos = vertexpos[index];
index++;
if (v == highlighted)
{
highlightedpos = vertexpos[index];
break;
}
index++;
}
}
else if(highlighted is Thing)
@ -1663,8 +1673,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
int index = 0;
foreach(Thing t in selectedthings)
{
if(t == highlighted) highlightedpos = thingpos[index];
index++;
if (t == highlighted)
{
highlightedpos = thingpos[index];
break;
}
index++;
}
}