Exposed GetLumpData and SetLumpData for plugins to read/write map lumps

@ some work on the USDF plugin
@ some game config documentation I still have laying around here
This commit is contained in:
codeimp 2010-08-23 15:17:58 +00:00
parent 198d9ebfe5
commit 8c35fc2693
17 changed files with 858 additions and 62 deletions

View file

@ -196,6 +196,18 @@
<param name="Name" value="Resource Settings">
<param name="Local" value="gc_resourcesettings.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Sectors Settings">
<param name="Local" value="gc_sectorsettings.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Linedefs Settings">
<param name="Local" value="gc_linedefsettings.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Things Settings">
<param name="Local" value="gc_thingsettings.html">
</OBJECT>
</UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Scripting Configurations">

View file

@ -81,12 +81,6 @@ skills
<b class="fat">makedoorarg#</b> (0 .. 4) (integer)<br />
Arguments for the linedef action number to put on the lines when making a door.<br />
<br />
<b class="fat">generalizedlinedefs</b>(boolean)<br />
Set to <b>true</b> to support generalized linedef actions. This makes the gen_linedeftypes structure mandatory. Default value is <b>false</b>.<br />
<br />
<b class="fat">generalizedsectors</b> (boolean)<br />
Set to <b>true</b> to support generalized sector effects. This makes the gen_sectortypes structure mandatory. Default value is <b>false</b>.<br />
<br />
<b class="fat">doomlightlevels</b> (boolean)<br />
Set this to <b>false</b> to use linear lighting in Doom Builder. Normally Doom Builder uses a simulation of Doom's light levels. Default value is <b>true</b>.<br />
<br />
@ -99,32 +93,6 @@ skills
<b class="fat">maxtexturenamelength</b> (integer)<br />
Maximum length of texture names in characters. This is used by Doom Builder to limit the input fields in the user interface and to check the validity of texture names in resources. This does NOT determine the actual limitation on the texture names in the map file format. Default value is 8.<br />
<br />
<b class="fat">defaultthingflags</b> (structure)<br />
This defines what the default flags should be first the first new thing when inserted. In map formats that use numeric thing flags, the settings in this structure should be the numeric flags to set. In map formats that use named flags, the settings must be the names of the flags to set. The value of the settings is optional and is ignored by Doom Builder.<br />
<br />
Example for numeric flags:
<pre>
defaultthingflags
{
1;
2;
4;
32;
}
</pre>
<br />
Example for named flags:
<pre>
defaultthingflags
{
skill1;
skill2;
skill3;
single;
coop;
}
</pre>
<br />
</p>

View file

@ -0,0 +1,102 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Game Configuration - Linedefs Settings</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="default.css" media="screen" title="Default" />
</head>
<body>
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="Configurations">
<param name="keyword" value="Game Configurations">
</object>
<div id="title"><h1>Game Configuration - Linedefs Settings</h1></div>
<div id="contents">
<p>
<b class="fat">generalizedlinedefs</b> (boolean)<br />
Set to <b>true</b> to support generalized linedef actions. This makes the <b>gen_linedeftypes</b> structure mandatory. Default value is <b>false</b>.<br />
<br />
<b class="fat">linedefflags</b> (structure)<br />
Lists the options that can be set on a linedef. In case of a map format that works with numeric flags, the values of the chosen options are added together to form the final linedef flags value (so each option should use its own bit). Note that with numeric flags, the linedef activation flags are also incorporated in the same value (see <b>linedefactivations</b>).<br />
Example for numeric flags:
<pre>
linedefflags
{
1 = "Impassable";
2 = "Block Monster";
4 = "Double Sided";
8 = "Upper Unpegged";
16 = "Lower Unpegged";
32 = "Secret";
64 = "Block Sound";
}
</pre>
<br />
Example for named flags:
<pre>
linedefflags
{
blocking = "Impassable";
blockmonsters = "Block monster";
twosided = "Doublesided";
dontpegtop = "Upper unpegged";
dontpegbottom = "Lower unpegged";
secret = "Secret";
blocksound = "Block sound";
}
</pre>
<br />
<b class="fat">linedefactivations</b> (structure)<br />
This provides a list of choices about how a linedef is activated. Only one of these choices can be selected by the user. In case of a map format that works with numeric flags, the value is part of the linedef flags value and should have it's own range of bits. To separate these bits from the linedef flag options, use the <b>linedefactivationsfilter</b> setting. For map formats which use named flags, you can just use names for the settings.<br />
<br />
Example for numeric flags:
<pre>
linedefactivations
{
0 = "Player walks over";
1024 = "Player presses Use";
2048 = "Monster walks over";
3072 = "Projectile hits";
4096 = "Player bumps";
5120 = "Projectile flies over";
}
</pre>
<br />
<b class="fat">linedefactivationsfilter</b> (integer)<br />
Bit mask value that separates the <b>linedefactivations</b> bits from the <b>linedefflags</b> bits. This is required in map formats that use numeric linedef flags, because the bits share the same integer linedef flags value in the map data. This setting is ignored for map formats that use named flags.<br />
<br />
<b class="fat">linedefflagstranslation</b> (structure)<br />
This is a translation between named (UDMF) linedef flags and the numeric linedef flags that your configuration uses (including linedef activation flags, if any). This structure is mandatory for all Game Configurations that do not use the UDMF map format and should not exist in Game Configurations that use the UDMF map format. Doom Builder uses this translation ot correctly work with copy/paste and prefabs (which are all converted to/from UDMF format). The setting names should be the non-UDMF flags. In case that your Game Configuration uses numeric flags map format, the setting names should be numeric. The setting values must be the equivalent UDMF flag names. The value can be prefixed with <b>!</b> to indicate that the value should be inverted (for example, if a setting 32 with value '!raisable' is to be converted, the existance of the bit value 32 will set 'raisable' to <b>false</b>).<br />
<br />
Example for numeric flags:
<pre>
linedefflagstranslation
{
1 = "blocking";
2 = "blockmonsters";
4 = "twosided";
8 = "dontpegtop";
16 = "dontpegbottom";
32 = "secret";
64 = "blocksound";
512 = "repeatspecial";
1024 = "playeruse";
2048 = "monstercross";
3072 = "impact";
4096 = "playerpush";
5120 = "missilecross";
8192 = "monsteractivate";
}
</pre>
<br />
</p>
</div>
</body>

View file

@ -0,0 +1,88 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Game Configuration - Sectors Settings</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="default.css" media="screen" title="Default" />
</head>
<body>
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="Configurations">
<param name="keyword" value="Game Configurations">
</object>
<div id="title"><h1>Game Configuration - Sectors Settings</h1></div>
<div id="contents">
<p>
<b class="fat">generalizedsectors</b> (boolean)<br />
Set to <b>true</b> to support generalized sector effects. This makes the <b>gen_sectortypes</b> structure mandatory. Default value is <b>false</b>.<br />
<br />
<b class="fat">sectorbrightness</b> (structure)<br />
This structure provides Doom Builder with a list of sector brightness levels that are most common. Doom Builder will use these levels to increase/decrease the brightness quickly. The structure must contain numeric setting names for the brightness levels. The settings don't need a value and any value will be ignored by Doom Builder.<br />
<br />
Example:
<pre>
sectorbrightness
{
96;
64;
32;
0;
}
</pre>
<br />
<b class="fat">gen_sectortypes</b> (structure)<br />
Generalized sector types are described in this structure. This structure is required when <b>generalizedsectors</b> is set to <b>true</b>. For each option there should be a structure. The name of the structure is displayed as the option description. Each option structure should contain a setting for the available choices. The setting name must be a numeric value that is added to the final sector effect value along with the values of the choices from other options (so the final sector effect value is the sum of the choices from every option). The setting must have a string value containing the choice description to be displayed.<br />
<br />
Example:
<pre>
gen_sectortypes
{
secret
{
0 = "No";
128 = "Yes";
}
friction
{
0 = "Disabled";
256 = "Enabled";
}
wind
{
0 = "Disabled";
512 = "Enabled";
}
}
</pre>
<br />
<b class="fat">sectortypes</b> (structure)<br />
This is a simple list of all available sector effects that the user can choose from. The setting names must be numeric (the sector effect number) and the value must be a string containing the description to display.<br />
<br />
Example:
<pre>
sectortypes
{
0 = "Normal";
1 = "Light Blinks (randomly)";
2 = "Light Blinks (2 Hz)";
3 = "Light Blinks (1 Hz)";
4 = "Damage -10 or 20% health and Light Blinks (2 Hz)";
5 = "Damage -5 or 10% health";
7 = "Damage -2 or 5% health";
8 = "Light Glows (1+ sec)";
9 = "Secret";
}
</pre>
<br />
</p>
</div>
</body>

View file

@ -0,0 +1,51 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Game Configuration - Things Settings</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="default.css" media="screen" title="Default" />
</head>
<body>
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="Configurations">
<param name="keyword" value="Game Configurations">
</object>
<div id="title"><h1>Game Configuration - Things Settings</h1></div>
<div id="contents">
<p>
<b class="fat">defaultthingflags</b> (structure)<br />
This defines what the default flags should be first the first new thing when inserted. In map formats that use numeric thing flags, the settings in this structure should be the numeric flags to set. In map formats that use named flags, the settings must be the names of the flags to set. The value of the settings is optional and is ignored by Doom Builder.<br />
<br />
Example for numeric flags:
<pre>
defaultthingflags
{
1;
2;
4;
32;
}
</pre>
<br />
Example for named flags:
<pre>
defaultthingflags
{
skill1;
skill2;
skill3;
single;
coop;
}
</pre>
<br />
</p>
</div>
</body>

View file

@ -856,10 +856,10 @@ namespace CodeImp.DoomBuilder
#endregion
#region ================== Lumps
// This returns a copy of the requested lump stream data
// This is copied from the temp wad file and returns null when the lump is not found
internal MemoryStream GetLumpData(string lumpname)
public MemoryStream GetLumpData(string lumpname)
{
Lump l = tempwad.FindLump(lumpname);
if(l != null)
@ -872,9 +872,9 @@ namespace CodeImp.DoomBuilder
return null;
}
}
// This writes a copy of the data to a lump in the temp file
internal void SetLumpData(string lumpname, MemoryStream data)
public void SetLumpData(string lumpname, MemoryStream data)
{
int insertindex = tempwad.Lumps.Count;
@ -891,7 +891,13 @@ namespace CodeImp.DoomBuilder
l.Stream.Seek(0, SeekOrigin.Begin);
data.WriteTo(l.Stream);
}
// This checks if the specified lump exists in the temp file
public bool LumpExists(string lumpname)
{
return (tempwad.FindLumpIndex(lumpname) > -1);
}
// This creates empty lumps for those required
private void CreateRequiredLumps(WAD target, string mapname)
{

View file

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4016
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CodeImp.DoomBuilder.Statistics.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CodeImp.DoomBuilder.Statistics.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -48,17 +48,23 @@ namespace CodeImp.DoomBuilder.ZDoomUSDF
// Static instance
private static BuilderPlug me;
// Tools form
private ToolsForm toolsform;
// Main form
private MainForm mainform;
#endregion
#region ================== Properties
// Static property to access the BuilderPlug
public static BuilderPlug Me { get { return me; } }
// Is the editor opened?
public bool EditorOpen { get { return (mainform != null) && !mainform.IsDisposed; } }
#endregion
#region ================== Methods
@ -73,7 +79,7 @@ namespace CodeImp.DoomBuilder.ZDoomUSDF
if(lump.Key.Trim().ToUpperInvariant() == "DIALOGUE")
editlump = true;
}
if(editlump)
{
// Load tools (this adds our button to the toolbar)
@ -81,18 +87,21 @@ namespace CodeImp.DoomBuilder.ZDoomUSDF
toolsform = new ToolsForm();
}
}
// This unloads everything
private void Unload()
{
if(mainform != null)
mainform.Dispose();
if(toolsform != null)
toolsform.Dispose();
toolsform = null;
}
#endregion
#region ================== Events
// This event is called when the plugin is initialized
@ -127,7 +136,15 @@ namespace CodeImp.DoomBuilder.ZDoomUSDF
base.OnMapOpenEnd();
Load();
}
// Map is being saved
public override void OnMapSaveBegin(SavePurpose purpose)
{
base.OnMapSaveBegin(purpose);
if(this.EditorOpen)
mainform.SaveData();
}
// Map closed
public override void OnMapCloseEnd()
{
@ -146,15 +163,25 @@ namespace CodeImp.DoomBuilder.ZDoomUSDF
#endregion
#region ================== Actions
[BeginAction("openconversationeditor")]
[BeginAction("opendialogeditor")]
public void OpenConversationEditor()
{
MessageBox.Show("Not implemented yet.");
if(!this.EditorOpen)
{
mainform = new MainForm();
if(General.Settings.ScriptOnTop)
mainform.Show(General.Interface);
else
mainform.Show();
}
else
{
mainform.Activate();
}
}
#endregion
}
}

View file

@ -0,0 +1,54 @@
namespace CodeImp.DoomBuilder.ZDoomUSDF
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(813, 612);
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.MinimizeBox = false;
this.Name = "MainForm";
this.Opacity = 0;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Dialog Editor";
this.Load += new System.EventHandler(this.MainForm_Load);
this.Move += new System.EventHandler(this.MainForm_Move);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.ResizeEnd += new System.EventHandler(this.MainForm_ResizeEnd);
this.ResumeLayout(false);
}
#endregion
}
}

View file

@ -0,0 +1,130 @@
#region === Copyright (c) 2010 Pascal van der Heiden ===
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Windows;
using System.IO;
#endregion
namespace CodeImp.DoomBuilder.ZDoomUSDF
{
public partial class MainForm : DelayedForm
{
#region ================== Constants
#endregion
#region ================== Variables
// Position/size
private Point lastposition;
private Size lastsize;
#endregion
#region ================== Properties
#endregion
#region ================== Constructor / Destructor
// Constructor
public MainForm()
{
InitializeComponent();
// Load data from DIALOGUE lump
MemoryStream s = General.Map.GetLumpData("DIALOGUE");
if(s != null)
{
}
}
#endregion
#region ================== Methods
// Called before the map is saved so we can save our data
public void SaveData()
{
}
#endregion
#region ================== Events
// Form loaded
private void MainForm_Load(object sender, EventArgs e)
{
this.SuspendLayout();
this.Location = new Point(General.Settings.ReadPluginSetting("mainwindow.positionx", this.Location.X),
General.Settings.ReadPluginSetting("mainwindow.positiony", this.Location.Y));
this.Size = new Size(General.Settings.ReadPluginSetting("mainwindow.sizewidth", this.Size.Width),
General.Settings.ReadPluginSetting("mainwindow.sizeheight", this.Size.Height));
this.WindowState = (FormWindowState)General.Settings.ReadPluginSetting("mainwindow.windowstate", (int)FormWindowState.Normal);
this.ResumeLayout(true);
// Normal windowstate?
if(this.WindowState == FormWindowState.Normal)
{
// Keep last position and size
lastposition = this.Location;
lastsize = this.Size;
}
}
// Form is being closed
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
int windowstate;
// Determine window state to save
if(this.WindowState != FormWindowState.Minimized)
windowstate = (int)this.WindowState;
else
windowstate = (int)FormWindowState.Normal;
// Save window settings
General.Settings.WritePluginSetting("mainwindow.positionx", lastposition.X);
General.Settings.WritePluginSetting("mainwindow.positiony", lastposition.Y);
General.Settings.WritePluginSetting("mainwindow.sizewidth", lastsize.Width);
General.Settings.WritePluginSetting("mainwindow.sizeheight", lastsize.Height);
General.Settings.WritePluginSetting("mainwindow.windowstate", windowstate);
// Save dialog data
SaveData();
}
// Form resized
private void MainForm_ResizeEnd(object sender, EventArgs e)
{
// Normal windowstate?
if(this.WindowState == FormWindowState.Normal)
{
// Keep last position and size
lastposition = this.Location;
lastsize = this.Size;
}
}
// Form moved
private void MainForm_Move(object sender, EventArgs e)
{
// Normal windowstate?
if(this.WindowState == FormWindowState.Normal)
{
// Keep last position and size
lastposition = this.Location;
lastsize = this.Size;
}
}
#endregion
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -3,11 +3,11 @@
\******************************************/
openconversationeditor
opendialogeditor
{
title = "Conversation Editor";
title = "Dialog Editor";
category = "view";
description = "This opens the conversation editor that allows you to edit DIALOGUE conversations in your map.";
description = "This opens the dialog editor that allows you to edit DIALOGUE conversations in your map.";
allowkeys = true;
allowmouse = true;
allowscroll = true;

View file

@ -17,14 +17,18 @@
{
this.toolstrip = new System.Windows.Forms.ToolStrip();
this.dialogbutton = new System.Windows.Forms.ToolStripButton();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.editmenu = new System.Windows.Forms.ToolStripMenuItem();
this.dialogitem = new System.Windows.Forms.ToolStripMenuItem();
this.toolstrip.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// toolstrip
//
this.toolstrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.dialogbutton});
this.toolstrip.Location = new System.Drawing.Point(0, 0);
this.toolstrip.Location = new System.Drawing.Point(0, 24);
this.toolstrip.Name = "toolstrip";
this.toolstrip.Size = new System.Drawing.Size(196, 25);
this.toolstrip.TabIndex = 0;
@ -37,17 +41,46 @@
this.dialogbutton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.dialogbutton.Name = "dialogbutton";
this.dialogbutton.Size = new System.Drawing.Size(23, 22);
this.dialogbutton.Tag = "openconversationeditor";
this.dialogbutton.Text = "Open Conversation Editor";
this.dialogbutton.Tag = "opendialogeditor";
this.dialogbutton.Text = "Open Dialog Editor";
this.dialogbutton.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.editmenu});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(196, 24);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
// editmenu
//
this.editmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.dialogitem});
this.editmenu.Name = "editmenu";
this.editmenu.Size = new System.Drawing.Size(39, 20);
this.editmenu.Text = "Edit";
//
// dialogitem
//
this.dialogitem.Image = global::CodeImp.DoomBuilder.ZDoomUSDF.Properties.Resources.Dialog;
this.dialogitem.Name = "dialogitem";
this.dialogitem.Size = new System.Drawing.Size(152, 22);
this.dialogitem.Tag = "opendialogeditor";
this.dialogitem.Text = "Dialog Editor...";
this.dialogitem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// ToolsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(196, 78);
this.Controls.Add(this.toolstrip);
this.Controls.Add(this.menuStrip1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MainMenuStrip = this.menuStrip1;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ToolsForm";
@ -56,6 +89,8 @@
this.Text = "ToolsForm";
this.toolstrip.ResumeLayout(false);
this.toolstrip.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -65,5 +100,8 @@
private System.Windows.Forms.ToolStrip toolstrip;
private System.Windows.Forms.ToolStripButton dialogbutton;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem editmenu;
private System.Windows.Forms.ToolStripMenuItem dialogitem;
}
}

View file

@ -35,6 +35,7 @@ namespace CodeImp.DoomBuilder.ZDoomUSDF
InitializeComponent();
General.Interface.AddButton(dialogbutton, ToolbarSection.Script);
General.Interface.AddMenu(dialogitem, MenuSection.ViewScriptEdit);
}
// Disposer
@ -43,10 +44,11 @@ namespace CodeImp.DoomBuilder.ZDoomUSDF
if(disposing && (components != null))
{
components.Dispose();
General.Interface.RemoveButton(dialogbutton);
}
General.Interface.RemoveButton(dialogbutton);
General.Interface.RemoveMenu(dialogitem);
base.Dispose(disposing);
}
@ -63,7 +65,7 @@ namespace CodeImp.DoomBuilder.ZDoomUSDF
#endregion
#region ================== Events
#endregion
}
}

View file

@ -123,4 +123,7 @@
<metadata name="toolstrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>114, 17</value>
</metadata>
</root>

View file

@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CC9BAD62-C57B-45A0-BC5D-172A2957ADC7}</ProjectGuid>
<OutputType>Library</OutputType>
@ -40,6 +40,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BuilderPlug.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
@ -57,9 +63,11 @@
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="ToolsForm.resx">
<DependentUpon>ToolsForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
@ -69,10 +77,14 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MainForm.resx">
<SubType>Designer</SubType>
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Actions.cfg" />
<None Include="Resources\Dialog.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">