diff --git a/CnCTDRAMapEditor/App.config b/CnCTDRAMapEditor/App.config index 1d630ac..4d80115 100644 --- a/CnCTDRAMapEditor/App.config +++ b/CnCTDRAMapEditor/App.config @@ -29,6 +29,12 @@ + + 0 + + + 0.5 + diff --git a/CnCTDRAMapEditor/CnCTDRAMapEditor.csproj b/CnCTDRAMapEditor/CnCTDRAMapEditor.csproj index 0dc33b7..b5952a3 100644 --- a/CnCTDRAMapEditor/CnCTDRAMapEditor.csproj +++ b/CnCTDRAMapEditor/CnCTDRAMapEditor.csproj @@ -26,7 +26,7 @@ full false bin\Debug\ - TRACE;DEBUG;STEAMWORKS_WIN;STEAMWORKS_X64;DEVELOPER + TRACE;DEBUG;STEAMWORKS_WIN;STEAMWORKS_X64 prompt 4 7.3 @@ -37,7 +37,7 @@ pdbonly true bin\Release\ - TRACE;STEAMWORKS_WIN;STEAMWORKS_X64;DEVELOPER + TRACE;STEAMWORKS_WIN;STEAMWORKS_X64 prompt 4 7.3 diff --git a/CnCTDRAMapEditor/Properties/Settings.Designer.cs b/CnCTDRAMapEditor/Properties/Settings.Designer.cs index 4bbaaff..32f8069 100644 --- a/CnCTDRAMapEditor/Properties/Settings.Designer.cs +++ b/CnCTDRAMapEditor/Properties/Settings.Designer.cs @@ -67,5 +67,29 @@ namespace MobiusEditor.Properties { this["GameDirectoryPath"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public int MaxMapTileTextureSize { + get { + return ((int)(this["MaxMapTileTextureSize"])); + } + set { + this["MaxMapTileTextureSize"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0.5")] + public double TemplateToolTextureSizeMultiplier { + get { + return ((double)(this["TemplateToolTextureSizeMultiplier"])); + } + set { + this["TemplateToolTextureSizeMultiplier"] = value; + } + } } } diff --git a/CnCTDRAMapEditor/Properties/Settings.settings b/CnCTDRAMapEditor/Properties/Settings.settings index 9b66e8a..84e785a 100644 --- a/CnCTDRAMapEditor/Properties/Settings.settings +++ b/CnCTDRAMapEditor/Properties/Settings.settings @@ -14,5 +14,11 @@ + + 0 + + + 0.5 + \ No newline at end of file diff --git a/CnCTDRAMapEditor/Tools/TemplateTool.cs b/CnCTDRAMapEditor/Tools/TemplateTool.cs index 8d529ff..262ce26 100644 --- a/CnCTDRAMapEditor/Tools/TemplateTool.cs +++ b/CnCTDRAMapEditor/Tools/TemplateTool.cs @@ -30,6 +30,9 @@ namespace MobiusEditor.Tools { public class TemplateTool : ViewTool { + private const int DesignResWidth = 3840; + private const int DesignTextureWidth = 256; + private static readonly Regex CategoryRegex = new Regex(@"^([a-z]*)", RegexOptions.Compiled); private readonly ListView templateTypeListView; @@ -153,8 +156,16 @@ namespace MobiusEditor.Tools .GroupBy(t => templateCategory(t)).OrderBy(g => g.Key); var templateTypeImages = templateTypes.SelectMany(g => g).Select(t => t.Thumbnail); - var maxWidth = templateTypeImages.Max(t => t.Width); - var maxHeight = templateTypeImages.Max(t => t.Height); + Screen screen = Screen.FromHandle(mapPanel.Handle) ?? Screen.PrimaryScreen; + int maxSize = Properties.Settings.Default.MaxMapTileTextureSize; + if (maxSize == 0) + { + double ratio = DesignResWidth / (double)screen.Bounds.Width; + maxSize = (int)((DesignTextureWidth / ratio) * Properties.Settings.Default.TemplateToolTextureSizeMultiplier); + } + + var maxWidth = Math.Min(templateTypeImages.Max(t => t.Width), maxSize); + var maxHeight = Math.Min(templateTypeImages.Max(t => t.Height), maxSize); var imageList = new ImageList(); imageList.Images.AddRange(templateTypeImages.ToArray());