- made option for square things

- some minor fixes
This commit is contained in:
codeimp 2008-05-10 16:09:45 +00:00
parent 737886ca8b
commit e521dabf42
18 changed files with 59 additions and 41 deletions

BIN
Resources/ThingTexture3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

BIN
Resources/ThingTexture4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -24,6 +24,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<DocumentationFile>..\Build\Builder.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\Build\</OutputPath>
@ -33,6 +34,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<DocumentationFile>..\Build\Builder.xml</DocumentationFile>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@ -499,17 +501,19 @@
</EmbeddedResource>
<EmbeddedResource Include="Resources\Actions.cfg" />
<EmbeddedResource Include="Resources\display2d.fx" />
<EmbeddedResource Include="Resources\Thing2D.png" />
<EmbeddedResource Include="Resources\Thing2D_1.png" />
<EmbeddedResource Include="Resources\things2d.fx" />
<None Include="Resources\Splash2.png" />
<EmbeddedResource Include="Resources\world3d.fx" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\MissingTexture3D.png" />
<EmbeddedResource Include="Resources\Thing2D_Simple.png" />
<EmbeddedResource Include="Resources\Thing2D_0.png" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\DB2.ico" />
<EmbeddedResource Include="Resources\Thing2D_3.png" />
<EmbeddedResource Include="Resources\Thing2D_2.png" />
<EmbeddedResource Include="Resources\White.png" />
<EmbeddedResource Include="Resources\color2d.fx" />
<None Include="Resources\Splash2_small.png" />

View file

@ -52,6 +52,7 @@ namespace CodeImp.DoomBuilder.Config
private float visualviewrange;
private int imagebrightness;
private bool qualitydisplay;
private bool squarethings;
// These are not stored in the configuration, only used at runtime
private string defaulttexture;
@ -74,6 +75,7 @@ namespace CodeImp.DoomBuilder.Config
public float VisualMouseSensY { get { return visualmousesensy; } internal set { visualmousesensy = value; } }
public float VisualViewRange { get { return visualviewrange; } internal set { visualviewrange = value; } }
public bool QualityDisplay { get { return qualitydisplay; } internal set { qualitydisplay = value; } }
public bool SquareThings { get { return squarethings; } internal set { squarethings = value; } }
public string DefaultTexture { get { return defaulttexture; } set { defaulttexture = value; } }
public string DefaultFloorTexture { get { return defaultfloortexture; } set { defaultfloortexture = value; } }
@ -112,6 +114,7 @@ namespace CodeImp.DoomBuilder.Config
visualviewrange = cfg.ReadSetting("visualviewrange", 1000f);
imagebrightness = cfg.ReadSetting("imagebrightness", 3);
qualitydisplay = cfg.ReadSetting("qualitydisplay", true);
squarethings = cfg.ReadSetting("squarethings", true);
// Success
return true;
@ -135,6 +138,7 @@ namespace CodeImp.DoomBuilder.Config
cfg.WriteSetting("visualviewrange", visualviewrange);
cfg.WriteSetting("imagebrightness", imagebrightness);
cfg.WriteSetting("qualitydisplay", qualitydisplay);
cfg.WriteSetting("squarethings", squarethings);
// Save settings configuration
General.WriteLogLine("Saving program configuration...");

View file

@ -75,6 +75,7 @@ namespace CodeImp.DoomBuilder.Interface
this.colorselection3d = new CodeImp.DoomBuilder.Interface.ColorControl();
this.colorhighlight3d = new CodeImp.DoomBuilder.Interface.ColorControl();
this.colorcrosshair3d = new CodeImp.DoomBuilder.Interface.ColorControl();
this.squarethings = new System.Windows.Forms.CheckBox();
label7 = new System.Windows.Forms.Label();
label6 = new System.Windows.Forms.Label();
label5 = new System.Windows.Forms.Label();
@ -121,6 +122,7 @@ namespace CodeImp.DoomBuilder.Interface
//
// groupBox1
//
groupBox1.Controls.Add(this.squarethings);
groupBox1.Controls.Add(this.qualitydisplay);
groupBox1.Controls.Add(this.imagebrightnesslabel);
groupBox1.Controls.Add(this.imagebrightness);
@ -654,6 +656,16 @@ namespace CodeImp.DoomBuilder.Interface
this.colorcrosshair3d.Size = new System.Drawing.Size(150, 23);
this.colorcrosshair3d.TabIndex = 6;
//
// squarethings
//
this.squarethings.AutoSize = true;
this.squarethings.Location = new System.Drawing.Point(25, 150);
this.squarethings.Name = "squarethings";
this.squarethings.Size = new System.Drawing.Size(93, 18);
this.squarethings.TabIndex = 11;
this.squarethings.Text = "Square things";
this.squarethings.UseVisualStyleBackColor = true;
//
// PreferencesForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@ -733,5 +745,6 @@ namespace CodeImp.DoomBuilder.Interface
private System.Windows.Forms.CheckBox qualitydisplay;
private System.Windows.Forms.Label imagebrightnesslabel;
private System.Windows.Forms.TrackBar imagebrightness;
private System.Windows.Forms.CheckBox squarethings;
}
}

View file

@ -52,6 +52,7 @@ namespace CodeImp.DoomBuilder.Interface
// Interface
imagebrightness.Value = General.Settings.ImageBrightness;
qualitydisplay.Checked = General.Settings.QualityDisplay;
squarethings.Checked = General.Settings.SquareThings;
// Fill list of actions
actions = General.Actions.GetAllActions();
@ -292,6 +293,7 @@ namespace CodeImp.DoomBuilder.Interface
// Apply interface
General.Settings.ImageBrightness = imagebrightness.Value;
General.Settings.QualityDisplay = qualitydisplay.Checked;
General.Settings.SquareThings = squarethings.Checked;
// Apply control keys to actions
foreach(ListViewItem item in listactions.Items)

View file

@ -113,7 +113,7 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Constructor / Disposer
// Constructor
public Linedef(MapSet map, LinkedListNode<Linedef> listitem, Vertex start, Vertex end)
internal Linedef(MapSet map, LinkedListNode<Linedef> listitem, Vertex start, Vertex end)
{
// Initialize
this.map = map;

View file

@ -74,7 +74,7 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Constructor / Disposer
// Constructor
public MapOptions()
internal MapOptions()
{
// Initialize
this.previousname = "";
@ -84,7 +84,7 @@ namespace CodeImp.DoomBuilder.Map
}
// Constructor to load from Doom Builder Map Settings Configuration
public MapOptions(Configuration cfg, string mapname)
internal MapOptions(Configuration cfg, string mapname)
{
IDictionary mapinfo, resinfo;
DataLocation res;

View file

@ -81,7 +81,7 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Constructor / Disposer
// Constructor for new empty map
public MapSet()
internal MapSet()
{
// Initialize
vertices = new LinkedList<Vertex>();
@ -98,7 +98,7 @@ namespace CodeImp.DoomBuilder.Map
}
// Disposer
public void Dispose()
internal void Dispose()
{
ArrayList list;

View file

@ -108,7 +108,7 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Constructor / Disposer
// Constructor
public Sector(MapSet map, LinkedListNode<Sector> listitem, int index)
internal Sector(MapSet map, LinkedListNode<Sector> listitem, int index)
{
// Initialize
this.map = map;

View file

@ -95,7 +95,7 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Constructor / Disposer
// Constructor
public Sidedef(MapSet map, LinkedListNode<Sidedef> listitem, Linedef l, bool front, Sector s)
internal Sidedef(MapSet map, LinkedListNode<Sidedef> listitem, Linedef l, bool front, Sector s)
{
// Initialize
this.map = map;

View file

@ -106,7 +106,7 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Constructor / Disposer
// Constructor
public Thing(MapSet map, LinkedListNode<Thing> listitem)
internal Thing(MapSet map, LinkedListNode<Thing> listitem)
{
// Initialize
this.map = map;

View file

@ -84,7 +84,7 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Constructor / Disposer
// Constructor
public Vertex(MapSet map, LinkedListNode<Vertex> listitem, Vector2D pos)
internal Vertex(MapSet map, LinkedListNode<Vertex> listitem, Vector2D pos)
{
// Initialize
this.map = map;

View file

@ -65,13 +65,17 @@ namespace CodeImp.DoomBuilder.Rendering
private const float THING_ARROW_SIZE = 1.5f;
private const float THING_ARROW_SHRINK = 2f;
private const float THING_CIRCLE_SIZE = 1f;
private const float THING_CIRCLE_SHRINK = 2f;
private const float THING_CIRCLE_SHRINK = 0f;
private const int THING_BUFFER_STEP = 100;
private const float THINGS_BACK_ALPHA = 0.3f;
private const string FONT_NAME = "Verdana";
private const int FONT_WIDTH = 0;
private const int FONT_HEIGHT = 0;
private const int THING_SHINY = 1;
private const int THING_SQUARE = 2;
private const int NUM_THING_TEXTURES = 4;
#endregion
@ -115,8 +119,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Images
private ResourceImage whitetexture;
private ResourceImage thingtexture;
private ResourceImage thingtexturesimple;
private ResourceImage[] thingtexture;
// View settings (world coordinates)
private float scale;
@ -146,15 +149,17 @@ namespace CodeImp.DoomBuilder.Rendering
// Constructor
internal Renderer2D(D3DDevice graphics) : base(graphics)
{
// Initialize
thingtexturesimple = new ResourceImage("Thing2D_Simple.png");
thingtexturesimple.UseColorCorrection = false;
thingtexturesimple.LoadImage();
thingtexturesimple.CreateTexture();
thingtexture = new ResourceImage("Thing2D.png");
thingtexture.UseColorCorrection = false;
thingtexture.LoadImage();
thingtexture.CreateTexture();
// Load thing textures
thingtexture = new ResourceImage[NUM_THING_TEXTURES];
for(int i = 0; i < NUM_THING_TEXTURES; i++)
{
thingtexture[i] = new ResourceImage("Thing2D_" + i.ToString(CultureInfo.InvariantCulture) + ".png");
thingtexture[i].UseColorCorrection = false;
thingtexture[i].LoadImage();
thingtexture[i].CreateTexture();
}
// Load white texture
whitetexture = new ResourceImage("White.png");
whitetexture.UseColorCorrection = false;
whitetexture.LoadImage();
@ -175,8 +180,7 @@ namespace CodeImp.DoomBuilder.Rendering
{
// Destroy rendertargets
DestroyRendertargets();
thingtexture.Dispose();
thingtexturesimple.Dispose();
foreach(ResourceImage i in thingtexture) i.Dispose();
whitetexture.Dispose();
// Done
@ -312,9 +316,6 @@ namespace CodeImp.DoomBuilder.Rendering
// This is called before a device is reset
// (when resized or display adapter was changed)
/// <summary>
/// DO NOT USE.
/// </summary>
public override void UnloadResource()
{
// Destroy rendertargets
@ -323,9 +324,6 @@ namespace CodeImp.DoomBuilder.Rendering
// This is called resets when the device is reset
// (when resized or display adapter was changed)
/// <summary>
/// DO NOT USE.
/// </summary>
public override void ReloadResource()
{
// Re-create rendertargets
@ -957,6 +955,8 @@ namespace CodeImp.DoomBuilder.Rendering
// This draws a set of things
private void RenderThingsBatch(int offset, int count)
{
int thingtextureindex = 0;
// Anything to render?
if(count > 0)
{
@ -968,16 +968,11 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetStreamSource(0, thingsvertices, 0, FlatVertex.Stride);
if(General.Settings.QualityDisplay)
{
graphics.Device.SetTexture(0, thingtexture.Texture);
graphics.Shaders.Things2D.Texture1 = thingtexture.Texture;
}
else
{
graphics.Device.SetTexture(0, thingtexturesimple.Texture);
graphics.Shaders.Things2D.Texture1 = thingtexturesimple.Texture;
}
// Determine things texture to use
if(General.Settings.QualityDisplay) thingtextureindex |= THING_SHINY;
if(General.Settings.SquareThings) thingtextureindex |= THING_SQUARE;
graphics.Device.SetTexture(0, thingtexture[thingtextureindex].Texture);
graphics.Shaders.Things2D.Texture1 = thingtexture[thingtextureindex].Texture;
// Draw the things batched
graphics.Shaders.Things2D.Begin();

View file

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB