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