mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
- Scales are now generally accepted and exposed by the ImageData class instead of just ScaleWidth/ScaledHeight
- Camera offsets in Visual Modes now changeable in Game Configurations (default is Doom's camera position) @ Some other stuff dealing with the new dockers I forgot what it's for.
This commit is contained in:
parent
d913121423
commit
50b9765377
19 changed files with 128 additions and 91 deletions
|
@ -64,6 +64,9 @@ defaultflatscale = 1.0f;
|
|||
// Some common settings
|
||||
include("Includes\\Common.cfg");
|
||||
|
||||
// Flat used as sky
|
||||
skyflatname = "F_SKY";
|
||||
|
||||
|
||||
// Default flags for first new thing
|
||||
defaultthingflags
|
||||
|
|
|
@ -59,6 +59,9 @@ defaultflatscale = 1.0f;
|
|||
// Some common settings
|
||||
include("Includes\\Common.cfg");
|
||||
|
||||
// Flat used as sky
|
||||
skyflatname = "F_SKY001";
|
||||
|
||||
|
||||
// Default flags for first new thing
|
||||
defaultthingflags
|
||||
|
|
|
@ -66,6 +66,9 @@ defaultflatscale = 1.0f;
|
|||
// Some common settings
|
||||
include("Includes\\Common.cfg");
|
||||
|
||||
// Flat used as sky
|
||||
skyflatname = "F_SKY";
|
||||
|
||||
|
||||
// Default flags for first new thing
|
||||
defaultthingflags
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.textbox.Size = new System.Drawing.Size(160, 20);
|
||||
this.textbox.TabIndex = 0;
|
||||
this.textbox.TextChanged += new System.EventHandler(this.textbox_TextChanged);
|
||||
this.textbox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textbox_KeyDown);
|
||||
//
|
||||
// ButtonsNumericTextbox
|
||||
//
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
public event EventHandler WhenTextChanged;
|
||||
public event EventHandler WhenButtonsClicked;
|
||||
public event EventHandler WhenEnterPressed;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -161,6 +162,14 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
buttons.Value -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Key pressed in textbox
|
||||
private void textbox_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
// Enter key?
|
||||
if((e.KeyData == Keys.Enter) && (WhenEnterPressed != null))
|
||||
WhenEnterPressed(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Selection
|
||||
private string currentselected;
|
||||
private string previousselected;
|
||||
private bool controlledselection;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -148,7 +149,8 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
public void Collapse()
|
||||
{
|
||||
if(iscollapsed) return;
|
||||
|
||||
|
||||
controlledselection = true;
|
||||
splitter.Enabled = false;
|
||||
splitter.BackColor = SystemColors.Control;
|
||||
splitter.Width = (int)(2.0f * (this.CurrentAutoScaleDimensions.Width / this.AutoScaleDimensions.Width));
|
||||
|
@ -160,6 +162,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.Width = GetCollapsedWidth();
|
||||
General.MainWindow.UnlockUpdate();
|
||||
this.Invalidate(true);
|
||||
controlledselection = false;
|
||||
|
||||
iscollapsed = true;
|
||||
|
||||
|
@ -171,6 +174,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
if(!iscollapsed) return;
|
||||
|
||||
controlledselection = true;
|
||||
splitter.Enabled = true;
|
||||
splitter.BackColor = Color.Transparent;
|
||||
splitter.Width = (int)(4.0f * (this.CurrentAutoScaleDimensions.Width / this.AutoScaleDimensions.Width));
|
||||
|
@ -180,6 +184,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
General.MainWindow.UnlockUpdate();
|
||||
tabs.SelectedIndex = expandedtab;
|
||||
tabs.Invalidate(true);
|
||||
controlledselection = false;
|
||||
|
||||
iscollapsed = false;
|
||||
|
||||
|
@ -258,13 +263,23 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// This selects a docker
|
||||
public bool SelectDocker(Docker d)
|
||||
{
|
||||
int index = 0;
|
||||
foreach(TabPage page in tabs.TabPages)
|
||||
{
|
||||
if((page.Tag as Docker) == d)
|
||||
{
|
||||
tabs.SelectedTab = page;
|
||||
if(iscollapsed)
|
||||
{
|
||||
previousselected = currentselected;
|
||||
expandedtab = index;
|
||||
}
|
||||
else
|
||||
tabs.SelectedTab = page;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -275,13 +290,23 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
if(!string.IsNullOrEmpty(previousselected))
|
||||
{
|
||||
int index = 0;
|
||||
foreach(TabPage page in tabs.TabPages)
|
||||
{
|
||||
if((page.Tag as Docker).FullName == previousselected)
|
||||
{
|
||||
tabs.SelectedTab = page;
|
||||
if(iscollapsed)
|
||||
{
|
||||
previousselected = currentselected;
|
||||
expandedtab = index;
|
||||
}
|
||||
else
|
||||
tabs.SelectedTab = page;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -334,16 +359,19 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Tab selected
|
||||
private void tabs_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Keep track of previous selected tab
|
||||
previousselected = currentselected;
|
||||
if(tabs.SelectedTab != null)
|
||||
if(!controlledselection)
|
||||
{
|
||||
Docker d = (tabs.SelectedTab.Tag as Docker);
|
||||
currentselected = d.FullName;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentselected = null;
|
||||
// Keep track of previous selected tab
|
||||
previousselected = currentselected;
|
||||
if(tabs.SelectedTab != null)
|
||||
{
|
||||
Docker d = (tabs.SelectedTab.Tag as Docker);
|
||||
currentselected = d.FullName;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentselected = null;
|
||||
}
|
||||
}
|
||||
|
||||
General.MainWindow.FocusDisplay();
|
||||
|
|
|
@ -93,11 +93,11 @@ namespace CodeImp.DoomBuilder.Data
|
|||
|
||||
if(bitmap != null)
|
||||
{
|
||||
// Get width and height from image
|
||||
// Get width and height from image and set the scale
|
||||
width = bitmap.Size.Width;
|
||||
height = bitmap.Size.Height;
|
||||
scaledwidth = (float)width * General.Map.Config.DefaultFlatScale;
|
||||
scaledheight = (float)height * General.Map.Config.DefaultFlatScale;
|
||||
scale.x = General.Map.Config.DefaultFlatScale;
|
||||
scale.y = General.Map.Config.DefaultFlatScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -36,8 +36,6 @@ namespace CodeImp.DoomBuilder.Data
|
|||
|
||||
private string filepathname;
|
||||
private int probableformat;
|
||||
private float scalex;
|
||||
private float scaley;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -53,14 +51,14 @@ namespace CodeImp.DoomBuilder.Data
|
|||
if(asflat)
|
||||
{
|
||||
probableformat = ImageDataFormat.DOOMFLAT;
|
||||
scalex = General.Map.Config.DefaultFlatScale;
|
||||
scaley = General.Map.Config.DefaultFlatScale;
|
||||
this.scale.x = General.Map.Config.DefaultFlatScale;
|
||||
this.scale.y = General.Map.Config.DefaultFlatScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
probableformat = ImageDataFormat.DOOMPICTURE;
|
||||
scalex = General.Map.Config.DefaultTextureScale;
|
||||
scaley = General.Map.Config.DefaultTextureScale;
|
||||
this.scale.x = General.Map.Config.DefaultTextureScale;
|
||||
this.scale.y = General.Map.Config.DefaultTextureScale;
|
||||
}
|
||||
|
||||
// We have no destructor
|
||||
|
@ -72,8 +70,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
{
|
||||
// Initialize
|
||||
this.filepathname = filepathname;
|
||||
this.scalex = scalex;
|
||||
this.scaley = scaley;
|
||||
this.scale.x = scalex;
|
||||
this.scale.y = scaley;
|
||||
SetName(name);
|
||||
|
||||
if(asflat)
|
||||
|
@ -123,11 +121,9 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
else
|
||||
{
|
||||
// Get width and height from image
|
||||
// Get width and height
|
||||
width = bitmap.Size.Width;
|
||||
height = bitmap.Size.Height;
|
||||
scaledwidth = (float)bitmap.Size.Width * scalex;
|
||||
scaledheight = (float)bitmap.Size.Height * scaley;
|
||||
}
|
||||
|
||||
// Pass on to base
|
||||
|
|
|
@ -93,11 +93,11 @@ namespace CodeImp.DoomBuilder.Data
|
|||
|
||||
if(bitmap != null)
|
||||
{
|
||||
// Get width and height from image
|
||||
// Get width and height from image and set the scale
|
||||
width = bitmap.Size.Width;
|
||||
height = bitmap.Size.Height;
|
||||
scaledwidth = (float)width * General.Map.Config.DefaultFlatScale;
|
||||
scaledheight = (float)height * General.Map.Config.DefaultFlatScale;
|
||||
scale.x = General.Map.Config.DefaultFlatScale;
|
||||
scale.y = General.Map.Config.DefaultFlatScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -36,8 +36,6 @@ namespace CodeImp.DoomBuilder.Data
|
|||
#region ================== Variables
|
||||
|
||||
private List<TexturePatch> patches;
|
||||
private float scalex;
|
||||
private float scaley;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -49,10 +47,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Initialize
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.scalex = scalex;
|
||||
this.scaley = scaley;
|
||||
this.scaledwidth = (float)width * scalex;
|
||||
this.scaledheight = (float)height * scaley;
|
||||
this.scale.x = scalex;
|
||||
this.scale.y = scaley;
|
||||
this.patches = new List<TexturePatch>();
|
||||
SetName(name);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ using System.Drawing.Drawing2D;
|
|||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using SlimDX.Direct3D9;
|
||||
using System.Drawing.Imaging;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
|
@ -49,6 +50,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
private long longname;
|
||||
protected int width;
|
||||
protected int height;
|
||||
protected Vector2D scale;
|
||||
protected float scaledwidth;
|
||||
protected float scaledheight;
|
||||
protected bool usecolorcorrection;
|
||||
|
@ -93,8 +95,9 @@ namespace CodeImp.DoomBuilder.Data
|
|||
public int Width { get { return width; } }
|
||||
public int Height { get { return height; } }
|
||||
internal int PreviewIndex { get { return previewindex; } set { previewindex = value; } }
|
||||
public float ScaledWidth { get { return scaledwidth; } }
|
||||
public float ScaledHeight { get { return scaledheight; } }
|
||||
public float ScaledWidth { get { return width * scale.x; } }
|
||||
public float ScaledHeight { get { return height * scale.y; } }
|
||||
public Vector2D Scale { get { return scale; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -208,23 +211,12 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// This loads the image
|
||||
public void LoadImage()
|
||||
{
|
||||
// Keep original dimensions
|
||||
int oldwidth = width;
|
||||
int oldheight = height;
|
||||
float oldscaledwidth = scaledwidth;
|
||||
float oldscaledheight = scaledheight;
|
||||
|
||||
// Do the loading
|
||||
LocalLoadImage();
|
||||
|
||||
// Anything changed?
|
||||
//if((oldwidth != width) || (oldheight != height) ||
|
||||
// (oldscaledwidth != scaledwidth) || (oldscaledheight != scaledheight))
|
||||
{
|
||||
// Notify the main thread about the change so that sectors can update their buffers
|
||||
IntPtr strptr = Marshal.StringToCoTaskMemAuto(this.name);
|
||||
General.SendMessage(General.MainWindow.Handle, (int)MainForm.ThreadMessages.ImageDataLoaded, strptr.ToInt32(), 0);
|
||||
}
|
||||
// Notify the main thread about the change so that sectors can update their buffers
|
||||
IntPtr strptr = Marshal.StringToCoTaskMemAuto(this.name);
|
||||
General.SendMessage(General.MainWindow.Handle, (int)MainForm.ThreadMessages.ImageDataLoaded, strptr.ToInt32(), 0);
|
||||
}
|
||||
|
||||
// This requests loading the image
|
||||
|
@ -302,17 +294,17 @@ namespace CodeImp.DoomBuilder.Data
|
|||
height = bitmap.Size.Height;
|
||||
|
||||
// Do we still have to set a scale?
|
||||
if((scaledwidth == 0.0f) && (scaledheight == 0.0f))
|
||||
if((scale.x == 0.0f) && (scale.y == 0.0f))
|
||||
{
|
||||
if((General.Map != null) && (General.Map.Config != null))
|
||||
{
|
||||
scaledwidth = (float)bitmap.Size.Width * General.Map.Config.DefaultTextureScale;
|
||||
scaledheight = (float)bitmap.Size.Height * General.Map.Config.DefaultTextureScale;
|
||||
scale.x = General.Map.Config.DefaultTextureScale;
|
||||
scale.y = General.Map.Config.DefaultTextureScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
scaledwidth = (float)bitmap.Size.Width;
|
||||
scaledheight = (float)bitmap.Size.Height;
|
||||
scale.x = 1.0f;
|
||||
scale.y = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,8 +37,6 @@ namespace CodeImp.DoomBuilder.Data
|
|||
private PK3Reader datareader;
|
||||
private string filepathname;
|
||||
private int probableformat;
|
||||
private float scalex;
|
||||
private float scaley;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -55,14 +53,14 @@ namespace CodeImp.DoomBuilder.Data
|
|||
if(asflat)
|
||||
{
|
||||
probableformat = ImageDataFormat.DOOMFLAT;
|
||||
scalex = General.Map.Config.DefaultFlatScale;
|
||||
scaley = General.Map.Config.DefaultFlatScale;
|
||||
this.scale.x = General.Map.Config.DefaultFlatScale;
|
||||
this.scale.y = General.Map.Config.DefaultFlatScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
probableformat = ImageDataFormat.DOOMPICTURE;
|
||||
scalex = General.Map.Config.DefaultTextureScale;
|
||||
scaley = General.Map.Config.DefaultTextureScale;
|
||||
this.scale.x = General.Map.Config.DefaultTextureScale;
|
||||
this.scale.y = General.Map.Config.DefaultTextureScale;
|
||||
}
|
||||
|
||||
// We have no destructor
|
||||
|
@ -110,8 +108,6 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Get width and height from image
|
||||
width = bitmap.Size.Width;
|
||||
height = bitmap.Size.Height;
|
||||
scaledwidth = (float)bitmap.Size.Width * scalex;
|
||||
scaledheight = (float)bitmap.Size.Height * scaley;
|
||||
}
|
||||
|
||||
// Pass on to base
|
||||
|
|
|
@ -59,8 +59,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Get width and height from image
|
||||
width = bmp.Size.Width;
|
||||
height = bmp.Size.Height;
|
||||
scaledwidth = (float)bmp.Size.Width;
|
||||
scaledheight = (float)bmp.Size.Height;
|
||||
scale.x = 1.0f;
|
||||
scale.y = 1.0f;
|
||||
|
||||
// Done
|
||||
bmp.Dispose();
|
||||
|
|
|
@ -40,8 +40,6 @@ namespace CodeImp.DoomBuilder.Data
|
|||
#region ================== Variables
|
||||
|
||||
private string lumpname;
|
||||
private float scalex;
|
||||
private float scaley;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -51,10 +49,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
public SimpleTextureImage(string name, string lumpname, float scalex, float scaley)
|
||||
{
|
||||
// Initialize
|
||||
this.scalex = scalex;
|
||||
this.scaley = scaley;
|
||||
this.scaledwidth = (float)width * scalex;
|
||||
this.scaledheight = (float)height * scaley;
|
||||
this.scale.x = scalex;
|
||||
this.scale.y = scaley;
|
||||
this.lumpname = lumpname;
|
||||
SetName(name);
|
||||
|
||||
|
@ -116,8 +112,6 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Get width and height from image
|
||||
width = bitmap.Size.Width;
|
||||
height = bitmap.Size.Height;
|
||||
scaledwidth = (float)width * scalex;
|
||||
scaledheight = (float)height * scaley;
|
||||
}
|
||||
|
||||
// Done
|
||||
|
|
|
@ -111,14 +111,14 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Get width and height from image
|
||||
width = bitmap.Size.Width;
|
||||
height = bitmap.Size.Height;
|
||||
scaledwidth = (float)bitmap.Size.Width;
|
||||
scaledheight = (float)bitmap.Size.Height;
|
||||
scale.x = 1.0f;
|
||||
scale.y = 1.0f;
|
||||
|
||||
// Make offset corrections if the offset was not given
|
||||
if((offsetx == int.MinValue) || (offsety == int.MinValue))
|
||||
{
|
||||
offsetx = (int)(scaledwidth * 0.5f);
|
||||
offsety = (int)scaledheight;
|
||||
offsetx = (int)((width * scale.x) * 0.5f);
|
||||
offsety = (int)(height * scale.y);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -36,8 +36,6 @@ namespace CodeImp.DoomBuilder.Data
|
|||
#region ================== Variables
|
||||
|
||||
private List<TexturePatch> patches;
|
||||
private float scalex;
|
||||
private float scaley;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -49,10 +47,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Initialize
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.scalex = scalex;
|
||||
this.scaley = scaley;
|
||||
this.scaledwidth = (float)width * scalex;
|
||||
this.scaledheight = (float)height * scaley;
|
||||
this.scale.x = scalex;
|
||||
this.scale.y = scaley;
|
||||
this.patches = new List<TexturePatch>();
|
||||
SetName(name);
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
private volatile bool storeondisk;
|
||||
private volatile bool isondisk;
|
||||
private bool isdisposed;
|
||||
private Dictionary<string, MemoryStream> customdata;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -158,6 +158,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.relposy.Size = new System.Drawing.Size(82, 24);
|
||||
this.relposy.StepValues = null;
|
||||
this.relposy.TabIndex = 11;
|
||||
this.relposy.WhenEnterPressed += new System.EventHandler(this.relposy_Validated);
|
||||
this.relposy.Validated += new System.EventHandler(this.relposy_Validated);
|
||||
this.relposy.WhenButtonsClicked += new System.EventHandler(this.relposy_Validated);
|
||||
this.relposy.WhenTextChanged += new System.EventHandler(this.WhenTextChanged);
|
||||
|
@ -173,6 +174,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.relposx.Size = new System.Drawing.Size(82, 24);
|
||||
this.relposx.StepValues = null;
|
||||
this.relposx.TabIndex = 10;
|
||||
this.relposx.WhenEnterPressed += new System.EventHandler(this.relposx_Validated);
|
||||
this.relposx.Validated += new System.EventHandler(this.relposx_Validated);
|
||||
this.relposx.WhenButtonsClicked += new System.EventHandler(this.relposx_Validated);
|
||||
this.relposx.WhenTextChanged += new System.EventHandler(this.WhenTextChanged);
|
||||
|
@ -188,6 +190,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.absposy.Size = new System.Drawing.Size(82, 24);
|
||||
this.absposy.StepValues = null;
|
||||
this.absposy.TabIndex = 9;
|
||||
this.absposy.WhenEnterPressed += new System.EventHandler(this.absposy_Validated);
|
||||
this.absposy.Validated += new System.EventHandler(this.absposy_Validated);
|
||||
this.absposy.WhenButtonsClicked += new System.EventHandler(this.absposy_Validated);
|
||||
this.absposy.WhenTextChanged += new System.EventHandler(this.WhenTextChanged);
|
||||
|
@ -203,6 +206,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.absposx.Size = new System.Drawing.Size(82, 24);
|
||||
this.absposx.StepValues = null;
|
||||
this.absposx.TabIndex = 8;
|
||||
this.absposx.WhenEnterPressed += new System.EventHandler(this.absposx_Validated);
|
||||
this.absposx.Validated += new System.EventHandler(this.absposx_Validated);
|
||||
this.absposx.WhenButtonsClicked += new System.EventHandler(this.absposx_Validated);
|
||||
this.absposx.WhenTextChanged += new System.EventHandler(this.WhenTextChanged);
|
||||
|
@ -317,6 +321,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.relsizey.Size = new System.Drawing.Size(82, 24);
|
||||
this.relsizey.StepValues = null;
|
||||
this.relsizey.TabIndex = 15;
|
||||
this.relsizey.WhenEnterPressed += new System.EventHandler(this.relsizey_Validated);
|
||||
this.relsizey.Validated += new System.EventHandler(this.relsizey_Validated);
|
||||
this.relsizey.WhenButtonsClicked += new System.EventHandler(this.relsizey_Validated);
|
||||
this.relsizey.WhenTextChanged += new System.EventHandler(this.WhenTextChanged);
|
||||
|
@ -332,6 +337,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.relsizex.Size = new System.Drawing.Size(82, 24);
|
||||
this.relsizex.StepValues = null;
|
||||
this.relsizex.TabIndex = 14;
|
||||
this.relsizex.WhenEnterPressed += new System.EventHandler(this.relsizex_Validated);
|
||||
this.relsizex.Validated += new System.EventHandler(this.relsizex_Validated);
|
||||
this.relsizex.WhenButtonsClicked += new System.EventHandler(this.relsizex_Validated);
|
||||
this.relsizex.WhenTextChanged += new System.EventHandler(this.WhenTextChanged);
|
||||
|
@ -356,6 +362,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.abssizey.Size = new System.Drawing.Size(82, 24);
|
||||
this.abssizey.StepValues = null;
|
||||
this.abssizey.TabIndex = 12;
|
||||
this.abssizey.WhenEnterPressed += new System.EventHandler(this.abssizey_Validated);
|
||||
this.abssizey.Validated += new System.EventHandler(this.abssizey_Validated);
|
||||
this.abssizey.WhenButtonsClicked += new System.EventHandler(this.abssizey_Validated);
|
||||
this.abssizey.WhenTextChanged += new System.EventHandler(this.WhenTextChanged);
|
||||
|
@ -371,6 +378,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.abssizex.Size = new System.Drawing.Size(82, 24);
|
||||
this.abssizex.StepValues = null;
|
||||
this.abssizex.TabIndex = 11;
|
||||
this.abssizex.WhenEnterPressed += new System.EventHandler(this.abssizex_Validated);
|
||||
this.abssizex.Validated += new System.EventHandler(this.abssizex_Validated);
|
||||
this.abssizex.WhenButtonsClicked += new System.EventHandler(this.abssizex_Validated);
|
||||
this.abssizex.WhenTextChanged += new System.EventHandler(this.WhenTextChanged);
|
||||
|
@ -461,6 +469,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.absrot.Size = new System.Drawing.Size(82, 24);
|
||||
this.absrot.StepValues = null;
|
||||
this.absrot.TabIndex = 24;
|
||||
this.absrot.WhenEnterPressed += new System.EventHandler(this.absrot_Validated);
|
||||
this.absrot.Validated += new System.EventHandler(this.absrot_Validated);
|
||||
this.absrot.WhenButtonsClicked += new System.EventHandler(this.absrot_Validated);
|
||||
this.absrot.WhenTextChanged += new System.EventHandler(this.WhenTextChanged);
|
||||
|
|
|
@ -55,15 +55,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Gravity
|
||||
private const float GRAVITY = -0.06f;
|
||||
private const float CAMERA_FLOOR_OFFSET = 41f; // same as in doom
|
||||
private const float CAMERA_CEILING_OFFSET = 10f;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Gravity vector
|
||||
// Gravity
|
||||
private Vector3D gravity;
|
||||
private float cameraflooroffset = 41f; // same as in doom
|
||||
private float cameraceilingoffset = 10f;
|
||||
|
||||
// Object picking
|
||||
private VisualPickResult target;
|
||||
|
@ -418,6 +418,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.ShowHelp("e_visual.html");
|
||||
}
|
||||
|
||||
// When entering this mode
|
||||
public override void OnEngage()
|
||||
{
|
||||
base.OnEngage();
|
||||
|
||||
// Read settings
|
||||
cameraflooroffset = General.Map.Config.ReadSetting("cameraflooroffset", cameraflooroffset);
|
||||
cameraceilingoffset = General.Map.Config.ReadSetting("cameraceilingoffset", cameraceilingoffset);
|
||||
}
|
||||
|
||||
// When returning to another mode
|
||||
public override void OnDisengage()
|
||||
{
|
||||
|
@ -440,13 +450,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(BuilderPlug.Me.UseGravity && (General.Map.VisualCamera.Sector != null))
|
||||
{
|
||||
// Camera below floor level?
|
||||
if(General.Map.VisualCamera.Position.z <= (General.Map.VisualCamera.Sector.FloorHeight + CAMERA_FLOOR_OFFSET + 0.1f))
|
||||
if(General.Map.VisualCamera.Position.z <= (General.Map.VisualCamera.Sector.FloorHeight + cameraflooroffset + 0.1f))
|
||||
{
|
||||
// Stay above floor
|
||||
gravity = new Vector3D(0.0f, 0.0f, 0.0f);
|
||||
General.Map.VisualCamera.Position = new Vector3D(General.Map.VisualCamera.Position.x,
|
||||
General.Map.VisualCamera.Position.y,
|
||||
General.Map.VisualCamera.Sector.FloorHeight + CAMERA_FLOOR_OFFSET);
|
||||
General.Map.VisualCamera.Sector.FloorHeight + cameraflooroffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -456,12 +466,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// Camera above ceiling level?
|
||||
if(General.Map.VisualCamera.Position.z >= (General.Map.VisualCamera.Sector.CeilHeight - CAMERA_CEILING_OFFSET - 0.1f))
|
||||
if(General.Map.VisualCamera.Position.z >= (General.Map.VisualCamera.Sector.CeilHeight - cameraceilingoffset - 0.1f))
|
||||
{
|
||||
// Stay below ceiling
|
||||
General.Map.VisualCamera.Position = new Vector3D(General.Map.VisualCamera.Position.x,
|
||||
General.Map.VisualCamera.Position.y,
|
||||
General.Map.VisualCamera.Sector.CeilHeight - CAMERA_CEILING_OFFSET);
|
||||
General.Map.VisualCamera.Sector.CeilHeight - cameraceilingoffset);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue