UltimateZoneBuilder/Source/Core/Controls/ScriptLumpDocumentTab.cs
MaxED 592887a086 Configurations: increased game configuration loading speed (in previous builds it took ~650 ms. to load a single game configuration, now it takes ~120 ms. to load all 64 of them). As a side effect, New\Open Map Options, Map Options and Game Configurations windows are now opened noticeably faster. The editor starts up a bit faster as well.
Configurations: all 64 game configuration are now available by default.
Game Configurations window: game configurations can now be disabled. This setting is mostly cosmetic. When a game configuration is disabled, it won't be shown in "game configuration" dropdowns in New\Open Map Options and Map Options windows. If a map's .dbs file specifies a disabled configuration, it will be picked as a map configuration anyway.
Linedefs mode: vertex insert preview logic used Highlight range instead of Stitch range (which is used when draw mode engages).
Visual mode: double-sided middle textures were not selected when using "Select" action with "with same texture" modifier.
Textures: some optimizations in patch blending code.
ZDoom ACS script configuration: added definitions for StrLeft, StrMid and StrRight functions.
2014-02-18 14:04:14 +00:00

129 lines
3.1 KiB
C#

#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using CodeImp.DoomBuilder.Config;
using System.IO;
using CodeImp.DoomBuilder.Compilers;
using CodeImp.DoomBuilder.GZBuilder.Data; //mxd
#endregion
namespace CodeImp.DoomBuilder.Controls
{
internal sealed class ScriptLumpDocumentTab : ScriptDocumentTab
{
#region ================== Constants
#endregion
#region ================== Variables
private string lumpname;
private bool ismapheader;
#endregion
#region ================== Properties
public override bool ExplicitSave { get { return false; } }
public override bool IsSaveAsRequired { get { return false; } }
public override bool IsClosable { get { return false; } }
public override bool IsReconfigurable { get { return false; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
public ScriptLumpDocumentTab(ScriptEditorPanel panel, string lumpname, ScriptConfiguration config) : base(panel)
{
// Initialize
if(lumpname == MapManager.CONFIG_MAP_HEADER)
{
this.lumpname = MapManager.TEMP_MAP_HEADER;
this.ismapheader = true;
}
else
{
this.lumpname = lumpname;
this.ismapheader = false;
}
this.config = config;
editor.SetupStyles(config);
// Load the lump data
MemoryStream stream = General.Map.GetLumpData(this.lumpname);
if(stream != null)
{
editor.SetText(stream.ToArray());
editor.ClearUndoRedo();
//mxd
updateNavigator();
}
// Done
SetTitle(ismapheader ? General.Map.Options.CurrentName : this.lumpname.ToUpper());
}
#endregion
#region ================== Methods
// Compile script
public override void Compile()
{
bool success = false; //mxd
// Compile
if(ismapheader)
success = General.Map.CompileLump(MapManager.CONFIG_MAP_HEADER, true);
else
success = General.Map.CompileLump(lumpname, true);
//mxd
if (success && config.Description == ScriptTypes.TYPES[(int)ScriptType.ACS])
General.Map.UpdateScriptNames();
// Feed errors to panel
panel.ShowErrors(General.Map.Errors);
}
// Implicit save
public override bool Save()
{
// Store the lump data
MemoryStream stream = new MemoryStream(editor.GetText());
General.Map.SetLumpData(lumpname, stream);
editor.IsChanged = false;
return true;
}
// This checks if a script error applies to this script
public override bool VerifyErrorForScript(CompilerError e)
{
return (string.Compare(e.filename, "?" + lumpname, true) == 0);
}
#endregion
#region ================== Events
#endregion
}
}