diff --git a/Assets/GFX/Shaders/FaTerrainShader.shader b/Assets/GFX/Shaders/FaTerrainShader.shader index dda4641e..d9d38beb 100644 --- a/Assets/GFX/Shaders/FaTerrainShader.shader +++ b/Assets/GFX/Shaders/FaTerrainShader.shader @@ -343,8 +343,8 @@ Properties { else SlopeColor = half3(1, 0, 0); } - Emit = SlopeColor * 0.5; - col.rgb = lerp(col.rgb, SlopeColor, 0.5); + Emit = SlopeColor * 0.8; + col.rgb = lerp(col.rgb, 0, 0.8); } else if (_Water > 0) col.rgb = ApplyWaterColor(WaterDepth, col.rgb); @@ -437,5 +437,5 @@ Properties { } -FallBack "Diffuse" +//FallBack "Diffuse" } diff --git a/Assets/GFX/Shaders/grid_build_texture.png b/Assets/GFX/Shaders/grid_build_texture.png index 2df37ef9..718f1883 100644 Binary files a/Assets/GFX/Shaders/grid_build_texture.png and b/Assets/GFX/Shaders/grid_build_texture.png differ diff --git a/Assets/MapEditor.unity b/Assets/MapEditor.unity index c5b5ebe5..561f18d6 100644 --- a/Assets/MapEditor.unity +++ b/Assets/MapEditor.unity @@ -39733,7 +39733,7 @@ Camera: serializedVersion: 2 m_Bits: 2560 m_RenderingPath: 1 - m_TargetTexture: {fileID: 1384490039} + m_TargetTexture: {fileID: 1492203055} m_TargetDisplay: 0 m_TargetEye: 3 m_HDR: 0 @@ -96327,6 +96327,11 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: SlopeData: {fileID: 0} + Flat: {r: 0.13333334, g: 0.7176471, b: 0.13333334, a: 1} + LowAngle: {r: 0.4509804, g: 0.8117647, b: 0.08235294, a: 1} + HighAngle: {r: 0.9, g: 0.8694916, b: 0, a: 1} + AlmostUnpassable: {r: 0.8666667, g: 0.5805229, b: 0.086274505, a: 1} + Unpassable: {r: 0.8313726, g: 0.12941177, b: 0.12941177, a: 1} --- !u!1 &1336186173 GameObject: m_ObjectHideFlags: 0 @@ -100633,37 +100638,6 @@ RectTransform: m_PrefabParentObject: {fileID: 224077777350642360, guid: ac95df46b11bff845bd7247ddbab7227, type: 2} m_PrefabInternal: {fileID: 1382992340} ---- !u!84 &1384490039 -RenderTexture: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_Name: - m_ImageContentsHash: - serializedVersion: 2 - Hash: 00000000000000000000000000000000 - m_ForcedFallbackFormat: 4 - m_DownscaleFallback: 0 - m_Width: 256 - m_Height: 256 - m_AntiAliasing: 1 - m_DepthFormat: 1 - m_ColorFormat: 0 - m_MipMap: 0 - m_GenerateMips: 1 - m_SRGB: 0 - m_UseDynamicScale: 0 - m_BindMS: 0 - m_TextureSettings: - serializedVersion: 2 - m_FilterMode: 1 - m_Aniso: 0 - m_MipBias: 0 - m_WrapU: 1 - m_WrapV: 1 - m_WrapW: 1 - m_Dimension: 2 - m_VolumeDepth: 1 --- !u!1 &1385165962 GameObject: m_ObjectHideFlags: 0 @@ -107280,6 +107254,37 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1491225762} +--- !u!84 &1492203055 +RenderTexture: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + m_Width: 256 + m_Height: 256 + m_AntiAliasing: 1 + m_DepthFormat: 1 + m_ColorFormat: 0 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 --- !u!1 &1493707076 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Camera/CameraControlerCam.cs b/Assets/Scripts/Camera/CameraControlerCam.cs index 4f083ed6..d52db64f 100644 --- a/Assets/Scripts/Camera/CameraControlerCam.cs +++ b/Assets/Scripts/Camera/CameraControlerCam.cs @@ -207,7 +207,7 @@ void CursorUiPos() GameplayCursorPos = hit.point; GameplayCursorPosScm = ScmapEditor.WorldPosToScmap(GameplayCursorPos); GameplayCursorPosScm.y = hit.point.y * 10; - GameplayCursorPosScm.z = ScmapEditor.Current.map.Height - GameplayCursorPosScm.z; + //GameplayCursorPosScm.z = ScmapEditor.Current.map.Height - GameplayCursorPosScm.z; string X = GameplayCursorPosScm.x.ToString("N2"); string Y = GameplayCursorPosScm.y.ToString("N2"); string Z = GameplayCursorPosScm.z.ToString("N2"); diff --git a/Assets/Scripts/HazardX SCMAP Code/DecalShared.cs b/Assets/Scripts/HazardX SCMAP Code/DecalShared.cs index e35b61fe..4d8fe843 100644 --- a/Assets/Scripts/HazardX SCMAP Code/DecalShared.cs +++ b/Assets/Scripts/HazardX SCMAP Code/DecalShared.cs @@ -27,7 +27,8 @@ public DecalSharedSettings Shared if (_Shared != null) _Shared.OnVisibilityChanged -= UpdateVisibility; _Shared = value; - _Shared.OnVisibilityChanged += UpdateVisibility; + if(_Shared != null) + _Shared.OnVisibilityChanged += UpdateVisibility; UpdateVisibility(); } } @@ -93,7 +94,7 @@ public bool Hidden set { _Hidden = value; - OnVisibilityChanged(); + OnVisibilityChanged?.Invoke(); } } diff --git a/Assets/Scripts/HazardX SCMAP Code/SkyboxData.cs b/Assets/Scripts/HazardX SCMAP Code/SkyboxData.cs index 8edb0603..7b9cf673 100644 --- a/Assets/Scripts/HazardX SCMAP Code/SkyboxData.cs +++ b/Assets/Scripts/HazardX SCMAP Code/SkyboxData.cs @@ -118,6 +118,8 @@ public void UpdateSize() { Position = ScmapEditor.WorldPosToScmap( MapLuaParser.Current.MapCenterPoint); Scale = Mathf.Max(ScmapEditor.Current.map.Width, ScmapEditor.Current.map.Height) * 2.288245f; + + ScmapEditor.Current.Skybox.LoadSkybox(); } } #endregion diff --git a/Assets/Scripts/Ozone SCMAP Code/GetGamedataFile/GetGamedataFile_Unit.cs b/Assets/Scripts/Ozone SCMAP Code/GetGamedataFile/GetGamedataFile_Unit.cs index d19e3f77..5b7b06fa 100644 --- a/Assets/Scripts/Ozone SCMAP Code/GetGamedataFile/GetGamedataFile_Unit.cs +++ b/Assets/Scripts/Ozone SCMAP Code/GetGamedataFile/GetGamedataFile_Unit.cs @@ -43,6 +43,12 @@ public class UnitBluePrint public string StrategicIconName; public int StrategicIconSortPriority; + // Skirt + public float SkirtOffsetX; + public float SkirtOffsetZ; + public Vector3 SkirtSize; + public float TurnRate; + // Intel public float VisionRadius; @@ -258,14 +264,6 @@ public static UnitSource LoadUnit(string scd, string LocalPath) } - PhisicsLayersTab = BP.GetTable("UnitBlueprint.Physics"); - if (PhisicsLayersTab != null) - { - CurrentValue = PhisicsLayersTab.RawGet("Elevation"); - if (CurrentValue != null) - ToReturn.BP.PhysicsElevation = LuaParser.Read.StringToFloat(CurrentValue.ToString()); - } - float BiggestLodDistance = 100; //Display if (BP.GetTable("UnitBlueprint.Display") != null) @@ -334,6 +332,50 @@ public static UnitSource LoadUnit(string scd, string LocalPath) ToReturn.BP.Size.z = LuaParser.Read.StringToFloat(CurrentValue.ToString()); + ToReturn.BP.SelectionSize = ToReturn.BP.Size; + + CurrentValue = UnitBlueprintTable.RawGet("SelectionSizeX"); + if (CurrentValue != null) + ToReturn.BP.SelectionSize.x = LuaParser.Read.StringToFloat(CurrentValue.ToString()); + CurrentValue = UnitBlueprintTable.RawGet("SelectionSizeZ"); + if (CurrentValue != null) + ToReturn.BP.SelectionSize.z = LuaParser.Read.StringToFloat(CurrentValue.ToString()); + CurrentValue = UnitBlueprintTable.RawGet("SelectionThickness"); + if (CurrentValue != null) + ToReturn.BP.SelectionSize.y = LuaParser.Read.StringToFloat(CurrentValue.ToString()); + + ToReturn.BP.SkirtSize = ToReturn.BP.SelectionSize; + ToReturn.BP.SkirtSize.y = 1; + + PhisicsLayersTab = BP.GetTable("UnitBlueprint.Physics"); + if (PhisicsLayersTab != null) + { + CurrentValue = PhisicsLayersTab.RawGet("Elevation"); + if (CurrentValue != null) + ToReturn.BP.PhysicsElevation = LuaParser.Read.StringToFloat(CurrentValue.ToString()); + + CurrentValue = PhisicsLayersTab.RawGet("SkirtOffsetX"); + if (CurrentValue != null) + ToReturn.BP.SkirtOffsetX = LuaParser.Read.StringToFloat(CurrentValue.ToString()); + + CurrentValue = PhisicsLayersTab.RawGet("SkirtOffsetZ"); + if (CurrentValue != null) + ToReturn.BP.SkirtOffsetZ = LuaParser.Read.StringToFloat(CurrentValue.ToString()); + + CurrentValue = PhisicsLayersTab.RawGet("SkirtSizeX"); + if (CurrentValue != null) + ToReturn.BP.SkirtSize.x = LuaParser.Read.StringToFloat(CurrentValue.ToString()); + + CurrentValue = PhisicsLayersTab.RawGet("SkirtSizeZ"); + if (CurrentValue != null) + ToReturn.BP.SkirtSize.z = LuaParser.Read.StringToFloat(CurrentValue.ToString()); + + CurrentValue = PhisicsLayersTab.RawGet("TurnRate"); + if (CurrentValue != null) + ToReturn.BP.TurnRate = LuaParser.Read.StringToFloat(CurrentValue.ToString()); + } + + ToReturn.BP.SkirtSize *= 0.1f; LuaTable FootprintTab = BP.GetTable("UnitBlueprint.Footprint"); if (FootprintTab != null) diff --git a/Assets/Scripts/Ozone SCMAP Code/MapLuaParser.cs b/Assets/Scripts/Ozone SCMAP Code/MapLuaParser.cs index f6ba59a7..7058c6ef 100644 --- a/Assets/Scripts/Ozone SCMAP Code/MapLuaParser.cs +++ b/Assets/Scripts/Ozone SCMAP Code/MapLuaParser.cs @@ -268,6 +268,9 @@ IEnumerator LoadingFile() if (ScenarioLuaFile.Load(FolderName, ScenarioFileName, FolderParentPath)) { //Map Loaded + MapCenterPoint = Vector3.zero; + MapCenterPoint.x = (GetMapSizeX() / 20f); + MapCenterPoint.z = -1 * (GetMapSizeY() / 20f); } @@ -411,11 +414,6 @@ void SetSaveLua() UpdateArea(); //MapElements.SetActive(false); - - MapCenterPoint = Vector3.zero; - MapCenterPoint.x = (GetMapSizeX() / 20f); - MapCenterPoint.z = -1 * (GetMapSizeY() / 20f); - //SortArmys(); } #endregion diff --git a/Assets/Scripts/Ozone SCMAP Code/ScmapEditor.cs b/Assets/Scripts/Ozone SCMAP Code/ScmapEditor.cs index 2f694550..7476099e 100644 --- a/Assets/Scripts/Ozone SCMAP Code/ScmapEditor.cs +++ b/Assets/Scripts/Ozone SCMAP Code/ScmapEditor.cs @@ -115,20 +115,14 @@ public void UpdateLighting() public IEnumerator LoadScmapFile() { - //UnloadMap(); - map = new Map(); //string MapPath = EnvPaths.GetMapsPath(); string path = MapLuaParser.MapRelativePath(MapLuaParser.Current.ScenarioLuaFile.Data.map); - //Debug.Log("Load SCMAP file: " + path); - - if (map.Load(path)) { UpdateLighting(); - Skybox.LoadSkybox(); } else { @@ -139,6 +133,7 @@ public IEnumerator LoadScmapFile() if (map.VersionMinor >= 60) { + map.AdditionalSkyboxData.Data.UpdateSize(); } else { @@ -182,17 +177,6 @@ public IEnumerator LoadScmapFile() WaterMaterial.SetFloat("_GridScale", HalfxRes); - - - /* - * // Cubemap - Texture2D Cubemap = GetGamedataFile.LoadTexture2DFromGamedata(GetGamedataFile.TexturesScd, map.Water.TexPathCubemap); - Debug.Log(Cubemap.width); - Cubemap cb = new Cubemap(Cubemap.width, TextureFormat.RGB24, Cubemap.mipmapCount > 1); - cb.SetPixels(Cubemap.GetPixels(), CubemapFace.PositiveX); - WaterMaterial.SetTexture("_Reflection", cb); - */ - for (int i = 0; i < map.EnvCubemapsFile.Length; i++) { if (map.EnvCubemapsName[i] == "") @@ -215,9 +199,6 @@ public IEnumerator LoadScmapFile() SetWater(); - - - Teren.gameObject.layer = 8; SetTextures(); @@ -228,9 +209,6 @@ public IEnumerator LoadScmapFile() } yield return null; - //Debug.Log("Scmap load complited"); - - //GetGamedataFile.UnitObject NewUnit = new GetGamedataFile.UnitObject(); } public void LoadHeights() @@ -658,11 +636,12 @@ public void SaveScmapFile() LowestElevation = (LowestElevation * TerrainHeight) / 0.1f; HighestElevation = (HighestElevation * TerrainHeight) / 0.1f; - Debug.Log("Lowest point: " + LowestElevation); - Debug.Log("Highest point: " + HighestElevation); if (HighestElevation - LowestElevation > 49.9) { + Debug.Log("Lowest point: " + LowestElevation); + Debug.Log("Highest point: " + HighestElevation); + Debug.LogWarning("Height difference is too high! it might couse rendering issues! Height difference is: " + (HighestElevation - LowestElevation)); GenericInfoPopup.ShowInfo("Height difference " + (HighestElevation - LowestElevation) + " is too high!\nIt might couse rendering issues!"); } @@ -671,14 +650,14 @@ public void SaveScmapFile() if (MapLuaParser.Current.EditMenu.MapInfoMenu.SaveAsFa.isOn) { if(map.AdditionalSkyboxData == null || map.AdditionalSkyboxData.Data == null || map.AdditionalSkyboxData.Data.Position.x == 0) - { + { // Convert to v60 LoadDefaultSkybox(); } map.VersionMinor = 60; map.AdditionalSkyboxData.Data.UpdateSize(); } - else if(map.VersionMinor >= 60) + else if(map.VersionMinor >= 60) // Convert to v56 { LoadDefaultSkybox(); map.AdditionalSkyboxData.Data.UpdateSize(); @@ -785,8 +764,6 @@ public void LoadDefaultSkybox() { map.AdditionalSkyboxData = UnityEngine.JsonUtility.FromJson(DefaultSkybox.text); map.AdditionalSkyboxData.Data.UpdateSize(); - - Skybox.LoadSkybox(); } public void UnloadMap() diff --git a/Assets/Scripts/Ozone SCMAP Code/Texture/GenerateControlTex.cs b/Assets/Scripts/Ozone SCMAP Code/Texture/GenerateControlTex.cs index 0f7a868e..14f941a6 100644 --- a/Assets/Scripts/Ozone SCMAP Code/Texture/GenerateControlTex.cs +++ b/Assets/Scripts/Ozone SCMAP Code/Texture/GenerateControlTex.cs @@ -151,16 +151,23 @@ public static void GenerateNormal() { if (GeneratingNormalTex) { + //Debug.Log("Buffor Generate Normals"); + BufforNormalTex = true; } else + { + //Debug.Log("Start Generate Normals"); NormalCoroutine = Current.StartCoroutine(Current.GeneratingNormal()); + } } public static void StopGenerateNormal() { if (GeneratingNormalTex) { + //Debug.Log("Stop Generate Normals"); + BufforNormalTex = false; Current.StopCoroutine(NormalCoroutine); ScmapEditor.Current.TerrainMaterial.SetFloat("_GeneratingNormal", 0); @@ -179,6 +186,7 @@ static bool GeneratingNormalTex public IEnumerator GeneratingNormal() { + //Debug.Log("Begin Generate Normals"); ScmapEditor.Current.TerrainMaterial.SetFloat("_GeneratingNormal", 1); Color[] AllColors = ScmapEditor.Current.map.UncompressedNormalmapTex.GetPixels(); @@ -217,18 +225,21 @@ public IEnumerator GeneratingNormal() } } + //Debug.Log("Success Generate Normals"); ScmapEditor.Current.map.UncompressedNormalmapTex.SetPixels(AllColors); ScmapEditor.Current.map.UncompressedNormalmapTex.Apply(false); ScmapEditor.Current.TerrainMaterial.SetFloat("_GeneratingNormal", 0); ScmapEditor.Current.TerrainMaterial.SetTexture("_TerrainNormal", ScmapEditor.Current.map.UncompressedNormalmapTex); yield return null; + //Debug.Log("Finalize Generate Normals"); NormalCoroutine = null; if (BufforNormalTex) { + //Debug.Log("Start buffor Generate Normals"); BufforNormalTex = false; GenerateNormal(); } @@ -291,25 +302,30 @@ IEnumerator GeneratingSlope() } } - const float FlatHeight = 0.000045f; - const float NonFlatHeight = 0.0022f; - const float AlmostUnpassableHeight = 0.0055f; - const float UnpassableHeight = 0.01f; + const float FlatHeight = 0.995f; + const float NonFlatHeight = 0.88f; + const float AlmostUnpassableHeight = 0.74f; + const float UnpassableHeight = 0.541f; + + public Color Flat; + public Color LowAngle; + public Color HighAngle; + public Color AlmostUnpassable; + public Color Unpassable; + IEnumerator GeneratingSlopeTask() { - const float Saturation = 0.8f; - Color Flat = new Color(0.1f * Saturation, 0.78f * Saturation, 0.1f * Saturation, 1); - Color LowAngle = new Color(0.3f * Saturation, 0.89f * Saturation, 0.1f * Saturation, 1); - Color HighAngle = new Color(0.6f * Saturation, 0.9f * Saturation, 0.1f * Saturation, 1); - Color Unpassable = new Color(0.8f * Saturation, 0.05f * Saturation, 0.05f * Saturation, 1); - Color AlmostUnpassable = new Color(0.7f * Saturation, 0.4f * Saturation, 0.05f * Saturation, 1); - Color[] Pixels = new Color[ScmapEditor.Current.map.Width * ScmapEditor.Current.map.Height]; int x = 0; int y = 0; int i = 0; + Vector3 Vert0 = Vector3.zero; + Vector3 Vert1 = Vector3.zero; + Vector3 Vert2 = Vector3.zero; + Vector3 Vert3 = Vector3.zero; + for (x = 0; x < ScmapEditor.Current.map.Width; x++) { @@ -317,11 +333,43 @@ IEnumerator GeneratingSlopeTask() { i = y + x * ScmapEditor.Current.map.Height; - float Slope0 = SlopeHeightmapPixels[x, y]; - float Slope1 = SlopeHeightmapPixels[x + 1, y]; - float Slope2 = SlopeHeightmapPixels[x, y + 1]; - float Slope3 = SlopeHeightmapPixels[x + 1, y + 1]; + Vert0.x = x; + Vert1.x = x + 1; + Vert2.x = x; + Vert3.x = x + 1; + + Vert0.z = y; + Vert1.z = y; + Vert2.z = y + 1; + Vert3.z = y + 1; + + Vert0.y = SlopeHeightmapPixels[x, y] * 512f; + Vert1.y = SlopeHeightmapPixels[x + 1, y] * 512f; + Vert2.y = SlopeHeightmapPixels[x, y + 1] * 512f; + Vert3.y = SlopeHeightmapPixels[x + 1, y + 1] * 512f; + + // Triangle 1: 0, 2, 1 + // 0, 3, 1 + float Dot = Vector3.Dot(GetTriangleVector(Vert0, Vert2, Vert1), Vector3.up); + + // Triangle 2: 3, 1, 2 + // 3, 0, 2 + //if (Dot > 0.5f) + Dot = Mathf.Min(Dot, Vector3.Dot(GetTriangleVector(Vert3, Vert1, Vert2), Vector3.up)); + + if(Dot > FlatHeight) + Pixels[i] = Flat; + else if(Dot > NonFlatHeight) + Pixels[i] = LowAngle; + else if (Dot > AlmostUnpassableHeight) + Pixels[i] = HighAngle; + else if (Dot > UnpassableHeight) + Pixels[i] = AlmostUnpassable; + else + Pixels[i] = Unpassable; + + /* float Min = Mathf.Min(Slope0, Slope1, Slope2, Slope3); float Max = Mathf.Max(Slope0, Slope1, Slope2, Slope3); @@ -337,6 +385,7 @@ IEnumerator GeneratingSlopeTask() Pixels[i] = AlmostUnpassable; else Pixels[i] = Unpassable; + */ } } @@ -350,4 +399,9 @@ IEnumerator GeneratingSlopeTask() //yield return null; } + static Vector3 GetTriangleVector(Vector3 Vert0, Vector3 Vert1, Vector3 Vert2) + { + return Vector3.Cross(Vert1 - Vert0, Vert2 - Vert0).normalized; + } + } diff --git a/Assets/Scripts/Selection/SelectionManager_Ring.cs b/Assets/Scripts/Selection/SelectionManager_Ring.cs index 878fbf58..c0dd0217 100644 --- a/Assets/Scripts/Selection/SelectionManager_Ring.cs +++ b/Assets/Scripts/Selection/SelectionManager_Ring.cs @@ -75,7 +75,7 @@ private void UpdateSelectionRing() } else if(LastControlType == SelectionControlTypes.Units) { - Selection.SelectionRings[i].transform.localScale = AffectedGameObjects[ID].GetComponent().size; + Selection.SelectionRings[i].transform.localScale = AffectedGameObjects[ID].GetComponent().UnitRenderer.BP.SkirtSize; Selection.SelectionRings[i].transform.localRotation = AffectedGameObjects[ID].transform.localRotation; } else @@ -125,6 +125,11 @@ private void GenerateSymmetrySelectionRing(SelectedObjects Sel) Sel.SelectionRings[i].transform.localScale = AffectedGameObjects[ID].transform.localScale; Sel.SelectionRings[i].transform.localRotation = AffectedGameObjects[ID].transform.localRotation; } + else if (LastControlType == SelectionControlTypes.Units) + { + Sel.SelectionRings[i].transform.localScale = AffectedGameObjects[ID].GetComponent().UnitRenderer.BP.SkirtSize; + Sel.SelectionRings[i].transform.localRotation = AffectedGameObjects[ID].transform.localRotation; + } else { MeshRenderer Mr = AffectedGameObjects[ID].GetComponent(); diff --git a/Assets/Scripts/UI/AppMenu/AppMenu.cs b/Assets/Scripts/UI/AppMenu/AppMenu.cs index c2ed02ed..871c9eb1 100644 --- a/Assets/Scripts/UI/AppMenu/AppMenu.cs +++ b/Assets/Scripts/UI/AppMenu/AppMenu.cs @@ -176,7 +176,9 @@ public void MenuButton(string func) Arguments += " /faction " + (FafEditorSettings.GetFaction() + 1).ToString(); Arguments += " /victory sandbox"; Arguments += " /gamespeed adjustable"; - Arguments += " /predeployed /enablediskwatch"; + Arguments += " /civilians"; + Arguments += " /enablediskwatch"; + //Arguments += " / predeployed/"; if (!FafEditorSettings.GetFogOfWar()) Arguments += " /nofog"; diff --git a/Assets/Scripts/UI/AppMenu/AppMenu_SaveAs.cs b/Assets/Scripts/UI/AppMenu/AppMenu_SaveAs.cs index 12d3a740..34106b33 100644 --- a/Assets/Scripts/UI/AppMenu/AppMenu_SaveAs.cs +++ b/Assets/Scripts/UI/AppMenu/AppMenu_SaveAs.cs @@ -87,7 +87,11 @@ public void SaveMapAs() return; } - if(SaveAsNewFolder(NewFolderName, NonVersionControlledName(NewFolderName))) + System.IO.DirectoryInfo Dir = new DirectoryInfo(ChosenPath); + MapLuaParser.Current.FolderParentPath = Dir.Parent.FullName.Replace("\\", "/") + "/"; + Debug.Log(MapLuaParser.Current.FolderParentPath); + + if (SaveAsNewFolder(NewFolderName, NonVersionControlledName(NewFolderName))) { // Inform user, that map was saved into different folder than he chose if (ChosenFolderName != NewFolderName) @@ -119,8 +123,14 @@ void OverwriteYes() Directory.Delete(path, true); } + System.IO.DirectoryInfo Dir = new DirectoryInfo(OverwritePath); + string FileName = Dir.Name; + + MapLuaParser.Current.FolderParentPath = Dir.Parent.FullName.Replace("\\", "/") + "\\"; + Debug.Log(MapLuaParser.Current.FolderParentPath); + // Now we can save to clean folder - SaveAsNewFolder(OverwritePath, NonVersionControlledName(OverwritePath)); + SaveAsNewFolder(FileName, NonVersionControlledName(FileName)); } @@ -153,6 +163,7 @@ public void SaveAsNewVersionYes() bool SaveAsNewFolder(string NewFolderName, string FileBeginName = "") { + Debug.Log(NewFolderName + ", " + FileBeginName); string SystemPath = MapLuaParser.Current.FolderParentPath + NewFolderName; if (!System.IO.Directory.Exists(SystemPath)) diff --git a/Assets/Scripts/UI/Tools/Stratum/StratumInfo.cs b/Assets/Scripts/UI/Tools/Stratum/StratumInfo.cs index 188686c7..27f3811d 100644 --- a/Assets/Scripts/UI/Tools/Stratum/StratumInfo.cs +++ b/Assets/Scripts/UI/Tools/Stratum/StratumInfo.cs @@ -917,7 +917,7 @@ public void SelectAlbedo() return; if (ResourceBrowser.SelectedCategory == 0 || ResourceBrowser.SelectedCategory == 1) { - if (ResourceBrowser.Current.LoadedPaths[ResourceBrowser.DragedObject.InstanceId].ToLower().Contains("normal")) + if (IsTextureNormalMap(ResourceBrowser.Current.LoadedPaths[ResourceBrowser.DragedObject.InstanceId])) { GenericInfoPopup.ShowInfo("Can't assign normal map as albedo!"); return; @@ -938,6 +938,13 @@ public void SelectAlbedo() } } + bool IsTextureNormalMap(string LoadPath) + { + LoadPath = LoadPath.ToLower(); + + return LoadPath.Contains("normal") || LoadPath.Contains("nornal"); + } + public void SelectNormal() { if (ResourceBrowser.DragedObject == null || ResourceBrowser.DragedObject.ContentType != ResourceObject.ContentTypes.Texture) @@ -947,7 +954,7 @@ public void SelectNormal() return; if (ResourceBrowser.SelectedCategory == 0 || ResourceBrowser.SelectedCategory == 1) { - if (!ResourceBrowser.Current.LoadedPaths[ResourceBrowser.DragedObject.InstanceId].ToLower().Contains("normal")) + if (!IsTextureNormalMap(ResourceBrowser.Current.LoadedPaths[ResourceBrowser.DragedObject.InstanceId])) { GenericInfoPopup.ShowInfo("Can't assign albedo as normal map!"); return; diff --git a/Assets/Scripts/UI/Tools/TerrainInfo.cs b/Assets/Scripts/UI/Tools/TerrainInfo.cs index 53b568fd..77cb0b62 100644 --- a/Assets/Scripts/UI/Tools/TerrainInfo.cs +++ b/Assets/Scripts/UI/Tools/TerrainInfo.cs @@ -282,13 +282,7 @@ void Update() } else if (Input.GetMouseButtonUp(0)) { - PaintStarted = false; - ScmapEditor.Current.Teren.heightmapPixelError = 4; - if (Painting) - { - Painting = false; - RegenerateMaps(); - } + } else { @@ -350,6 +344,14 @@ void Update() { Undo.RegisterUndo(new UndoHistory.HistoryTerrainHeight(), new UndoHistory.HistoryTerrainHeight.TerrainHeightHistoryParameter(beginHeights)); TerainChanged = false; + + PaintStarted = false; + ScmapEditor.Current.Teren.heightmapPixelError = 4; + if (Painting) + { + Painting = false; + RegenerateMaps(); + } } diff --git a/Assets/Scripts/UI/Tools/Units/UnitSource.cs b/Assets/Scripts/UI/Tools/Units/UnitSource.cs index 14db7245..57b13288 100644 --- a/Assets/Scripts/UI/Tools/Units/UnitSource.cs +++ b/Assets/Scripts/UI/Tools/Units/UnitSource.cs @@ -186,8 +186,8 @@ public UnitInstance FillGameObjectValues(GameObject Obj, MapLua.SaveLua.Army.Uni UInst.SetMatrix(UInst.GetSnapPosition(position), rotation); UInst.ArmyColor = Group.Owner.ArmyColor; - if (BP.Footprint.x > 0 && BP.Footprint.y > 0) - UInst.Col.size = new Vector3(BP.Footprint.x * 0.1f, BP.Size.y * 0.1f, BP.Footprint.y * 0.1f); + if (BP.SelectionSize.x > 0 && BP.SelectionSize.y > 0) + UInst.Col.size = BP.SelectionSize * 0.1f; else UInst.Col.size = BP.Size * 0.1f; UInst.Col.center = Vector3.up * (BP.Size.y * 0.05f);