* Added option to encode names in classic text encoding when running in classic mode.
* Removed the resources randomising seed itself being a randomised value.
This commit is contained in:
parent
f8d5ab6677
commit
48099c36d3
@ -71,6 +71,7 @@ namespace MobiusEditor
|
|||||||
EnforceObjectMaximums = Properties.Settings.Default.EnforceObjectMaximums;
|
EnforceObjectMaximums = Properties.Settings.Default.EnforceObjectMaximums;
|
||||||
Ignore106Scripting = Properties.Settings.Default.Ignore106Scripting;
|
Ignore106Scripting = Properties.Settings.Default.Ignore106Scripting;
|
||||||
ClassicProducesNoMetaFiles = Properties.Settings.Default.ClassicProducesNoMetaFiles;
|
ClassicProducesNoMetaFiles = Properties.Settings.Default.ClassicProducesNoMetaFiles;
|
||||||
|
ClassicEncodesNameAsCp437 = Properties.Settings.Default.ClassicEncodesNameAsCp437;
|
||||||
ConvertRaObsoleteClear = Properties.Settings.Default.ConvertRaObsoleteClear;
|
ConvertRaObsoleteClear = Properties.Settings.Default.ConvertRaObsoleteClear;
|
||||||
BlockingBibs = Properties.Settings.Default.BlockingBibs;
|
BlockingBibs = Properties.Settings.Default.BlockingBibs;
|
||||||
DisableAirUnits = Properties.Settings.Default.DisableAirUnits;
|
DisableAirUnits = Properties.Settings.Default.DisableAirUnits;
|
||||||
@ -187,6 +188,7 @@ namespace MobiusEditor
|
|||||||
public static bool ConvertCraters { get; private set; }
|
public static bool ConvertCraters { get; private set; }
|
||||||
public static bool FilterTheaterObjects { get; private set; }
|
public static bool FilterTheaterObjects { get; private set; }
|
||||||
public static bool WriteClassicBriefing { get; private set; }
|
public static bool WriteClassicBriefing { get; private set; }
|
||||||
|
public static bool ClassicEncodesNameAsCp437 { get; private set; }
|
||||||
public static bool ApplyHarvestBug { get; private set; }
|
public static bool ApplyHarvestBug { get; private set; }
|
||||||
public static bool NoOwnedObjectsInSole { get; private set; }
|
public static bool NoOwnedObjectsInSole { get; private set; }
|
||||||
public static bool FixClassicEinstein { get; private set; }
|
public static bool FixClassicEinstein { get; private set; }
|
||||||
|
@ -2517,7 +2517,10 @@ namespace MobiusEditor
|
|||||||
if (activeToolForm != null)
|
if (activeToolForm != null)
|
||||||
{
|
{
|
||||||
activeToolForm.ResizeEnd -= ActiveToolForm_ResizeEnd;
|
activeToolForm.ResizeEnd -= ActiveToolForm_ResizeEnd;
|
||||||
|
activeToolForm.Shown -= this.ActiveToolForm_Shown;
|
||||||
activeToolForm.Hide();
|
activeToolForm.Hide();
|
||||||
|
activeToolForm.Visible = false;
|
||||||
|
activeToolForm.Owner = null;
|
||||||
activeToolForm = null;
|
activeToolForm = null;
|
||||||
}
|
}
|
||||||
toolStatusLabel.Text = String.Empty;
|
toolStatusLabel.Text = String.Empty;
|
||||||
@ -2662,9 +2665,10 @@ namespace MobiusEditor
|
|||||||
// Allow the tool to refresh the cell info under the mouse cursor.
|
// Allow the tool to refresh the cell info under the mouse cursor.
|
||||||
activeTool.RequestMouseInfoRefresh += ViewTool_RequestMouseInfoRefresh;
|
activeTool.RequestMouseInfoRefresh += ViewTool_RequestMouseInfoRefresh;
|
||||||
activeToolForm.ResizeEnd -= ActiveToolForm_ResizeEnd;
|
activeToolForm.ResizeEnd -= ActiveToolForm_ResizeEnd;
|
||||||
activeToolForm.Shown -= this.ActiveToolForm_Shown;
|
|
||||||
activeToolForm.Shown += this.ActiveToolForm_Shown;
|
activeToolForm.Shown += this.ActiveToolForm_Shown;
|
||||||
activeToolForm.Show(this);
|
activeToolForm.Visible = false;
|
||||||
|
activeToolForm.Owner = this;
|
||||||
|
activeToolForm.Show();
|
||||||
activeTool.Activate();
|
activeTool.Activate();
|
||||||
activeToolForm.ResizeEnd += ActiveToolForm_ResizeEnd;
|
activeToolForm.ResizeEnd += ActiveToolForm_ResizeEnd;
|
||||||
}
|
}
|
||||||
|
@ -134,12 +134,12 @@ namespace MobiusEditor.Model
|
|||||||
Bottom /**/ = 1 << 4,
|
Bottom /**/ = 1 << 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly int randomSeed;
|
// Seed itself is no longer random. Fixed seed gives consistency on resaves.
|
||||||
|
private const int randomSeed = 1621259415;
|
||||||
private static Dictionary<ConcFill, int> concreteStateToIcon = new Dictionary<ConcFill, int>();
|
private static Dictionary<ConcFill, int> concreteStateToIcon = new Dictionary<ConcFill, int>();
|
||||||
|
|
||||||
static Map()
|
static Map()
|
||||||
{
|
{
|
||||||
randomSeed = Guid.NewGuid().GetHashCode();
|
|
||||||
concreteStateToIcon = IconFillStates.Select((value, index) => new { value, index })
|
concreteStateToIcon = IconFillStates.Select((value, index) => new { value, index })
|
||||||
.ToDictionary(pair => pair.value, pair => pair.index);
|
.ToDictionary(pair => pair.value, pair => pair.index);
|
||||||
// Add default, since it does not appear in the cellStates.
|
// Add default, since it does not appear in the cellStates.
|
||||||
|
9
CnCTDRAMapEditor/Properties/Settings.Designer.cs
generated
9
CnCTDRAMapEditor/Properties/Settings.Designer.cs
generated
@ -77,6 +77,15 @@ namespace MobiusEditor.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
|
public bool ClassicEncodesNameAsCp437 {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["ClassicEncodesNameAsCp437"]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
<Setting Name="ClassicProducesNoMetaFiles" Type="System.Boolean" Scope="Application">
|
<Setting Name="ClassicProducesNoMetaFiles" Type="System.Boolean" Scope="Application">
|
||||||
<Value Profile="(Default)">False</Value>
|
<Value Profile="(Default)">False</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="ClassicEncodesNameAsCp437" Type="System.Boolean" Scope="Application">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
<Setting Name="LazyInitSteam" Type="System.Boolean" Scope="Application">
|
<Setting Name="LazyInitSteam" Type="System.Boolean" Scope="Application">
|
||||||
<Value Profile="(Default)">True</Value>
|
<Value Profile="(Default)">True</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
@ -3154,6 +3154,12 @@ namespace MobiusEditor.RedAlert
|
|||||||
Encoding utf8 = new UTF8Encoding(false, false);
|
Encoding utf8 = new UTF8Encoding(false, false);
|
||||||
byte[] linebreak = utf8.GetBytes("\r\n");
|
byte[] linebreak = utf8.GetBytes("\r\n");
|
||||||
INI ini = new INI();
|
INI ini = new INI();
|
||||||
|
List<(string section, string key)> utf8Components = new List<(string section, string key)>();
|
||||||
|
utf8Components.AddRange(new[] { ("Steam", null), ("Briefing", "Text"), ("Basic", "Author") });
|
||||||
|
if (!Globals.UseClassicFiles || !Globals.ClassicEncodesNameAsCp437 || fileType == FileType.PGM || fileType == FileType.MEG)
|
||||||
|
{
|
||||||
|
utf8Components.Add(("Basic", "Name"));
|
||||||
|
}
|
||||||
switch (fileType)
|
switch (fileType)
|
||||||
{
|
{
|
||||||
case FileType.INI:
|
case FileType.INI:
|
||||||
@ -3164,7 +3170,7 @@ namespace MobiusEditor.RedAlert
|
|||||||
{
|
{
|
||||||
string iniText = ini.ToString("\n");
|
string iniText = ini.ToString("\n");
|
||||||
// Possibly scan extra ini content for all units/structs/etc with "Name" fields and save them as UTF-8 too? Not sure how the Remaster handles these.
|
// Possibly scan extra ini content for all units/structs/etc with "Name" fields and save them as UTF-8 too? Not sure how the Remaster handles these.
|
||||||
GeneralUtils.WriteMultiEncoding(iniText.Split('\n'), mprWriter, dos437, utf8, new[] { ("Steam", null), ("Briefing", "Text"), ("Basic", "Name"), ("Basic", "Author") }, linebreak);
|
GeneralUtils.WriteMultiEncoding(iniText.Split('\n'), mprWriter, dos437, utf8, utf8Components.ToArray(), linebreak);
|
||||||
}
|
}
|
||||||
if (!Map.BasicSection.SoloMission && (!Globals.UseClassicFiles || !Globals.ClassicProducesNoMetaFiles))
|
if (!Map.BasicSection.SoloMission && (!Globals.UseClassicFiles || !Globals.ClassicProducesNoMetaFiles))
|
||||||
{
|
{
|
||||||
@ -3202,7 +3208,7 @@ namespace MobiusEditor.RedAlert
|
|||||||
using (MegafileBuilder megafileBuilder = new MegafileBuilder(String.Empty, path))
|
using (MegafileBuilder megafileBuilder = new MegafileBuilder(String.Empty, path))
|
||||||
{
|
{
|
||||||
string iniText = ini.ToString("\n");
|
string iniText = ini.ToString("\n");
|
||||||
GeneralUtils.WriteMultiEncoding(iniText.Split('\n'), mprWriter, dos437, utf8, new[] { ("Steam", null), ("Briefing", "Text"), ("Basic", "Name"), ("Basic", "Author") }, linebreak);
|
GeneralUtils.WriteMultiEncoding(iniText.Split('\n'), mprWriter, dos437, utf8, utf8Components.ToArray(), linebreak);
|
||||||
mprStream.Position = 0;
|
mprStream.Position = 0;
|
||||||
if (customPreview != null)
|
if (customPreview != null)
|
||||||
{
|
{
|
||||||
|
@ -2526,6 +2526,12 @@ namespace MobiusEditor.TiberianDawn
|
|||||||
Encoding utf8 = new UTF8Encoding(false, false);
|
Encoding utf8 = new UTF8Encoding(false, false);
|
||||||
byte[] linebreak = utf8.GetBytes("\r\n");
|
byte[] linebreak = utf8.GetBytes("\r\n");
|
||||||
INI ini = new INI();
|
INI ini = new INI();
|
||||||
|
List<(string section, string key)> utf8Components = new List<(string section, string key)>();
|
||||||
|
utf8Components.AddRange(new[] { ("Steam", null), ("Briefing", "Text"), ("Basic", "Author") });
|
||||||
|
if (!Globals.UseClassicFiles || !Globals.ClassicEncodesNameAsCp437 || fileType == FileType.PGM || fileType == FileType.MEG)
|
||||||
|
{
|
||||||
|
utf8Components.Add(("Basic", "Name"));
|
||||||
|
}
|
||||||
switch (fileType)
|
switch (fileType)
|
||||||
{
|
{
|
||||||
case FileType.INI:
|
case FileType.INI:
|
||||||
@ -2536,7 +2542,7 @@ namespace MobiusEditor.TiberianDawn
|
|||||||
{
|
{
|
||||||
// Use '\n' in proprocessing for simplicity. WriteMultiEncoding will use full line breaks.
|
// Use '\n' in proprocessing for simplicity. WriteMultiEncoding will use full line breaks.
|
||||||
string iniText = forSole ? ini.ToString("\n") : FixRoad2Save(ini, "\n");
|
string iniText = forSole ? ini.ToString("\n") : FixRoad2Save(ini, "\n");
|
||||||
GeneralUtils.WriteMultiEncoding(iniText.Split('\n'), iniWriter, dos437, utf8, new[] { ("Steam", null), ("Briefing", "Text"), ("Basic", "Name"), ("Basic", "Author") }, linebreak);
|
GeneralUtils.WriteMultiEncoding(iniText.Split('\n'), iniWriter, dos437, utf8, utf8Components.ToArray(), linebreak);
|
||||||
}
|
}
|
||||||
using (FileStream binStream = new FileStream(binPath, FileMode.Create))
|
using (FileStream binStream = new FileStream(binPath, FileMode.Create))
|
||||||
using (BinaryWriter binWriter = new BinaryWriter(binStream))
|
using (BinaryWriter binWriter = new BinaryWriter(binStream))
|
||||||
@ -2590,7 +2596,7 @@ namespace MobiusEditor.TiberianDawn
|
|||||||
using (MegafileBuilder megafileBuilder = new MegafileBuilder(String.Empty, path))
|
using (MegafileBuilder megafileBuilder = new MegafileBuilder(String.Empty, path))
|
||||||
{
|
{
|
||||||
string iniText = forSole ? ini.ToString("\n") : FixRoad2Save(ini, "\n");
|
string iniText = forSole ? ini.ToString("\n") : FixRoad2Save(ini, "\n");
|
||||||
GeneralUtils.WriteMultiEncoding(iniText.Split('\n'), iniWriter, dos437, utf8, new[] { ("Steam", null), ("Briefing", "Text"), ("Basic", "Name"), ("Basic", "Author") }, linebreak);
|
GeneralUtils.WriteMultiEncoding(iniText.Split('\n'), iniWriter, dos437, utf8, utf8Components.ToArray(), linebreak);
|
||||||
iniWriter.Flush();
|
iniWriter.Flush();
|
||||||
iniStream.Position = 0;
|
iniStream.Position = 0;
|
||||||
if (!isMegaMap)
|
if (!isMegaMap)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user