* Added "EnforceObjectMaximums" setting that can be disabled to remove save checks on object maximums.

* Cleaned up some stuff in settings, and github manual / readme.
This commit is contained in:
Nyerguds 2023-05-24 17:14:56 +02:00
parent 81d7843100
commit 26a7854409
9 changed files with 96 additions and 76 deletions

View File

@ -462,4 +462,5 @@ Unreleased
* Added names to Overlay, Terrain, Smudge and Resources.
* Migrated resource randomisation from the map renderer to the density-update logic, so the actual objects don't always show as "TI01" / "GOLD01" / "GEM01".
* Changed TD Technology Center to its real name, instead of "Prison".
* Added reference to GraphicsFixesRA mod.
* Added reference to GraphicsFixesRA mod.
* Added "EnforceObjectMaximums" setting that can be disabled to remove save checks on object maximums.

View File

@ -13,6 +13,9 @@
</startup>
<applicationSettings>
<MobiusEditor.Properties.Settings>
<setting name="UseClassicGraphics" serializeAs="String">
<value>False</value>
</setting>
<setting name="ModsToLoadTD" serializeAs="String">
<value>2844969675;GraphicsFixesTD</value>
</setting>
@ -43,12 +46,12 @@
<setting name="DefaultShowMapGrid" serializeAs="String">
<value>False</value>
</setting>
<setting name="ZoomToBoundsOnLoad" serializeAs="String">
<value>True</value>
</setting>
<setting name="DefaultExportScale" serializeAs="String">
<value>-0.5</value>
</setting>
<setting name="ZoomToBoundsOnLoad" serializeAs="String">
<value>True</value>
</setting>
<setting name="MapGridColor" serializeAs="String">
<value>64, 0, 0, 255</value>
</setting>
@ -76,6 +79,9 @@
<setting name="MinimumClampSize" serializeAs="String">
<value>30, 30</value>
</setting>
<setting name="EnforceObjectMaximums" serializeAs="String">
<value>True</value>
</setting>
<setting name="Ignore106Scripting" serializeAs="String">
<value>True</value>
</setting>
@ -160,9 +166,9 @@
</setting>
</MobiusEditor.Properties.Settings>
</userSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin" />
</assemblyBinding>
</runtime>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin" />
</assemblyBinding>
</runtime>
</configuration>

View File

@ -48,6 +48,7 @@ namespace MobiusEditor
UndoRedoStackSize = Properties.Settings.Default.UndoRedoStackSize;
MinimumClampSize = Properties.Settings.Default.MinimumClampSize;
// Behavior tweaks
EnforceObjectMaximums = Properties.Settings.Default.EnforceObjectMaximums;
Ignore106Scripting = Properties.Settings.Default.Ignore106Scripting;
NoMetaFilesForSinglePlay = Properties.Settings.Default.NoMetaFilesForSinglePlay;
ConvertRaObsoleteClear = Properties.Settings.Default.ConvertRaObsoleteClear;
@ -105,6 +106,8 @@ namespace MobiusEditor
public static int UndoRedoStackSize { get; private set; }
public static Size MinimumClampSize { get; private set; }
public static bool EnforceObjectMaximums { get; private set; }
public static bool Ignore106Scripting { get; private set; }
public static bool NoMetaFilesForSinglePlay { get; private set; }
public static bool ConvertRaObsoleteClear { get; private set; }

View File

@ -12,7 +12,7 @@ namespace MobiusEditor.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -43,7 +43,7 @@ namespace MobiusEditor.Properties {
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
[global::System.Configuration.DefaultSettingValueAttribute("2978875641;GraphicsFixesRA")]
public string ModsToLoadRA {
get {
return ((string)(this["ModsToLoadRA"]));
@ -221,6 +221,15 @@ namespace MobiusEditor.Properties {
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool EnforceObjectMaximums {
get {
return ((bool)(this["EnforceObjectMaximums"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]

View File

@ -9,7 +9,7 @@
<Value Profile="(Default)">2844969675;GraphicsFixesTD</Value>
</Setting>
<Setting Name="ModsToLoadRA" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
<Value Profile="(Default)">2978875641;GraphicsFixesRA</Value>
</Setting>
<Setting Name="ModsToLoadSS" Type="System.String" Scope="Application">
<Value Profile="(Default)">2844969675;GraphicsFixesTD</Value>
@ -68,6 +68,9 @@
<Setting Name="MinimumClampSize" Type="System.Drawing.Size" Scope="Application">
<Value Profile="(Default)">30, 30</Value>
</Setting>
<Setting Name="EnforceObjectMaximums" Type="System.Boolean" Scope="Application">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Ignore106Scripting" Type="System.Boolean" Scope="Application">
<Value Profile="(Default)">True</Value>
</Setting>

View File

@ -2934,42 +2934,42 @@ namespace MobiusEditor.RedAlert
int numUnits = Map.Technos.OfType<Unit>().Where(u => u.Occupier.Type.IsGroundUnit).Count();
int numVessels = Map.Technos.OfType<Unit>().Where(u => u.Occupier.Type.IsVessel).Count();
int numWaypoints = Map.Waypoints.Count(w => (w.Flag & WaypointFlag.PlayerStart) == WaypointFlag.PlayerStart && w.Cell.HasValue);
if (numAircraft > Constants.MaxAircraft)
if (!Globals.DisableAirUnits && numAircraft > Constants.MaxAircraft && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of aircraft exceeded ({0} > {1})", numAircraft, Constants.MaxAircraft));
ok = false;
}
if (numBuildings > Constants.MaxBuildings)
if (numBuildings > Constants.MaxBuildings && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of structures exceeded ({0} > {1})", numBuildings, Constants.MaxBuildings));
ok = false;
}
if (numInfantry > Constants.MaxInfantry)
if (numInfantry > Constants.MaxInfantry && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of infantry exceeded ({0} > {1})", numInfantry, Constants.MaxInfantry));
ok = false;
}
if (numTerrain > Constants.MaxTerrain)
if (numTerrain > Constants.MaxTerrain && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of terrain objects exceeded ({0} > {1})", numTerrain, Constants.MaxTerrain));
ok = false;
}
if (numUnits > Constants.MaxUnits)
if (numUnits > Constants.MaxUnits && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of units exceeded ({0} > {1})", numUnits, Constants.MaxUnits));
ok = false;
}
if (numVessels > Constants.MaxVessels)
if (numVessels > Constants.MaxVessels && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of ships exceeded ({0} > {1})", numVessels, Constants.MaxVessels));
ok = false;
}
if (Map.TeamTypes.Count > Constants.MaxTeams)
if (Map.TeamTypes.Count > Constants.MaxTeams && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of team types exceeded ({0} > {1})", Map.TeamTypes.Count, Constants.MaxTeams));
ok = false;
}
if (Map.Triggers.Count > Constants.MaxTriggers)
if (Map.Triggers.Count > Constants.MaxTriggers && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of triggers exceeded ({0} > {1})", Map.Triggers.Count, Constants.MaxTriggers));
ok = false;
@ -3482,79 +3482,74 @@ namespace MobiusEditor.RedAlert
private void CheckActionGlobals(string prefix, TriggerAction action, List<string> errors, Int32 nr, ref bool fatal, bool fatalOnly, bool fix, ref bool wasFixed, List<int> availableGlobals, Dictionary<long, int> globalFixes)
{
if (!fatalOnly)
if (fatalOnly)
{
switch (action.ActionType)
{
case ActionTypes.TACTION_SET_GLOBAL:
case ActionTypes.TACTION_CLEAR_GLOBAL:
if (action.Data < 0 || action.Data > 29)
return;
}
switch (action.ActionType)
{
case ActionTypes.TACTION_SET_GLOBAL:
case ActionTypes.TACTION_CLEAR_GLOBAL:
if (action.Data < 0 || action.Data > 29)
{
string error = prefix + "Action " + nr + " has an illegal global value \""+ action.Data + "\": Globals only go from 0 to 29.";
if (fix)
{
string error = prefix + "Action " + nr + " has an illegal global value \""+ action.Data + "\": Globals only go from 0 to 29.";
if (fix)
int fixedVal = -1;
if (globalFixes.TryGetValue(action.Data, out int fixVal))
{
int fixedVal = -1;
if (globalFixes.TryGetValue(action.Data, out int fixVal))
{
fixedVal = fixVal;
}
else if (availableGlobals.Count > 0)
{
fixedVal = availableGlobals[0];
availableGlobals.RemoveAt(0);
globalFixes.Add(action.Data, fixedVal);
}
action.Data = fixedVal == -1 ? action.Data.Restrict(0, 29) : fixedVal;
wasFixed = true;
error += fixedVal == -1 ? (" Fixed to \"" + action.Data + "\".") : (" Fixed to available global \"" + action.Data + "\".");
fixedVal = fixVal;
}
errors.Add(error);
else if (availableGlobals.Count > 0)
{
fixedVal = availableGlobals[0];
availableGlobals.RemoveAt(0);
globalFixes.Add(action.Data, fixedVal);
}
action.Data = fixedVal == -1 ? action.Data.Restrict(0, 29) : fixedVal;
wasFixed = true;
error += fixedVal == -1 ? (" Fixed to \"" + action.Data + "\".") : (" Fixed to available global \"" + action.Data + "\".");
}
break;
}
errors.Add(error);
}
break;
}
}
private void CheckActionTeam(string prefix, TriggerAction action, List<string> errors, int nr, ref bool fatal, bool fatalOnly)
{
if (!TeamType.IsEmpty(action.Team))
if (!TeamType.IsEmpty(action.Team) || fatalOnly)
{
return;
}
switch (action.ActionType)
{
case ActionTypes.TACTION_REINFORCEMENTS:
if (fatalOnly)
{
errors.Add(prefix + "Action " + nr + ": There is no team type set to reinforce.");
}
errors.Add(prefix + "Action " + nr + ": There is no team type set to reinforce.");
break;
case ActionTypes.TACTION_CREATE_TEAM:
errors.Add(prefix + (fatalOnly ? String.Empty : "[FATAL] - ") + "Action " + nr + ": There is no team type set to create.");
fatal = true;
errors.Add(prefix + "Action " + nr + ": There is no team type set to create.");
break;
case ActionTypes.TACTION_DESTROY_TEAM:
if (fatalOnly)
{
errors.Add(prefix + "Action " + nr + ": There is no team type set to disband.");
}
errors.Add(prefix + "Action " + nr + ": There is no team type set to disband.");
break;
}
}
private void CheckActionTrigger(string prefix, TriggerAction action, List<string> errors, Int32 nr, ref bool fatal, bool fatalOnly)
{
if (!Trigger.IsEmpty(action.Trigger))
return;
if (!fatalOnly)
if (!Trigger.IsEmpty(action.Trigger) || fatalOnly)
{
switch (action.ActionType)
{
case ActionTypes.TACTION_FORCE_TRIGGER:
errors.Add(prefix + "Action " + nr + ": There is no trigger set to force.");
break;
case ActionTypes.TACTION_DESTROY_TRIGGER:
errors.Add(prefix + "Action " + nr + ": There is no trigger set to destroy.");
break;
}
return;
}
switch (action.ActionType)
{
case ActionTypes.TACTION_FORCE_TRIGGER:
errors.Add(prefix + "Action " + nr + ": There is no trigger set to force.");
break;
case ActionTypes.TACTION_DESTROY_TRIGGER:
errors.Add(prefix + "Action " + nr + ": There is no trigger set to destroy.");
break;
}
}

View File

@ -2743,39 +2743,39 @@ namespace MobiusEditor.TiberianDawn
int maxTer = classicSole ? Constants.MaxTerrainClassic : Constants.MaxTerrain;
int maxUni = classicSole ? Constants.MaxUnitsClassic : Constants.MaxUnits;
bool noSoleSkip = !forSole || !Globals.NoOwnedObjectsInSole;
if (!Globals.DisableAirUnits && numAircraft > maxAir && noSoleSkip)
if (!Globals.DisableAirUnits && numAircraft > maxAir && noSoleSkip && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of aircraft exceeded ({0} > {1})", numAircraft, maxAir));
ok = false;
}
if (numBuildings > maxBld && noSoleSkip)
if (numBuildings > maxBld && noSoleSkip && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of structures exceeded ({0} > {1})", numBuildings, maxBld));
ok = false;
}
if (numInfantry > maxInf && noSoleSkip)
if (numInfantry > maxInf && noSoleSkip && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of infantry exceeded ({0} > {1})", numInfantry, maxInf));
ok = false;
}
if (numTerrain > maxTer)
if (numTerrain > maxTer && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of terrain objects exceeded ({0} > {1})", numTerrain, maxTer));
ok = false;
}
if (numUnits > maxUni && noSoleSkip)
if (numUnits > maxUni && noSoleSkip && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of units exceeded ({0} > {1})", numUnits, maxUni));
ok = false;
}
if (!forSole)
{
if (Map.TeamTypes.Count > Constants.MaxTeams)
if (Map.TeamTypes.Count > Constants.MaxTeams && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of team types exceeded ({0} > {1})", Map.TeamTypes.Count, Constants.MaxTeams));
ok = false;
}
if (Map.Triggers.Count > Constants.MaxTriggers)
if (Map.Triggers.Count > Constants.MaxTriggers && Globals.EnforceObjectMaximums)
{
sb.AppendLine().Append(string.Format("Maximum number of triggers exceeded ({0} > {1})", Map.Triggers.Count, Constants.MaxTriggers));
ok = false;

View File

@ -75,6 +75,7 @@ You can find the mod [on the Steam workshop](https://steamcommunity.com/sharedfi
These options are all enabled by default, but can be disabled if you wish. Use these at your own risk.
* **EnforceObjectMaximums**: (NEXT VERSION; NOT AVAILABLE YET) Don't allow saving a map if any of the the object amounts exceed the normal internal maximums of the game. Can be disabled in case a mission is specifically meant to be played on a modded game that increases these limits.
* **Ignore106Scripting**: Don't support the extended scripting added by the C&C95 v1.06 patch. If this option is disabled, additional triggers named UUUU, VVVV and WWWW can also be destroyed with "Dstry Trig" actions.
* **NoMetaFilesForSinglePlay**: Suppresses the generation of .tga and .json files for single player maps saved to disc, since they are useless clutter and unused by the game. This does not affect Steam uploads. Note that json files for single player maps will now only contain the Home waypoint.
* **ConvertRaObsoleteClear**: Automatically clear tiles with ID 255 on RA Temperate/Snow maps, or on Interior maps if more than 80% of the area outside the map bounds is filled with it, to fix the fact old versions of RA saved that as Clear terrain. This can be disabled to research changes on old maps.

View File

@ -16,7 +16,9 @@ Right now, I'm not really looking into making this a joint project. Specific bug
Simply unpack the editor into a new folder on your disk somewhere. On first startup, it will automatically try to detect the folder in which the game is installed, and if it can't find it, it will show a popup asking you to locate it. Note that this autodetect only works on Steam installations of the game.
It is advised to install the `GraphicsFixesTD` mod, to complete errors and missing bits in the TD Remastered graphics. The editor will use this mod automatically when it is installed, even if it is not enabled inside the game. You can find it [on the Steam workshop](https://steamcommunity.com/sharedfiles/filedetails/?id=2844969675) and [on ModDB](https://www.moddb.com/games/command-conquer-remastered/addons/graphicsfixestd).
It is advised to install the `GraphicsFixesTD` and `GraphicsFixesRA` mods, to fix errors and add missing bits in the Remastered graphics. The editor will use the mods automatically when they are installed, even if they are not enabled inside the game. You can find them on the Steam workshop ([GraphicsFixesTD](https://steamcommunity.com/sharedfiles/filedetails/?id=2844969675), [GraphicsFixesRA](https://steamcommunity.com/sharedfiles/filedetails/?id=2978875641)) and on ModDB ([GraphicsFixesTD](https://www.moddb.com/games/command-conquer-remastered/addons/graphicsfixestd), [GraphicsFixesRA](https://www.moddb.com/games/command-conquer-remastered/addons/graphicsfixesra)).
**The GraphicsFixesRA mod is not currently configured in the settings file to load automatically; this will be amended in the next release. To add it manually, edit `CnCTDRAMapEditor.exe.config` and replace the `<value />` under the "ModsToLoadRA" setting with `<value>2978875641;GraphicsFixesRA</value>`**
For usage and configuration, see [MANUAL.md](MANUAL.md).