Skip to content

Commit

Permalink
WIP4 v0.603
Browse files Browse the repository at this point in the history
  • Loading branch information
ozonexo3 committed Jul 11, 2018
1 parent c78e8d6 commit 53690ae
Show file tree
Hide file tree
Showing 16 changed files with 216 additions and 110 deletions.
6 changes: 3 additions & 3 deletions Assets/GFX/Shaders/FaTerrainShader.shader
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -437,5 +437,5 @@ Properties {
}


FallBack "Diffuse"
//FallBack "Diffuse"
}
Binary file modified Assets/GFX/Shaders/grid_build_texture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 37 additions & 32 deletions Assets/MapEditor.unity
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Camera/CameraControlerCam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 3 additions & 2 deletions Assets/Scripts/HazardX SCMAP Code/DecalShared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -93,7 +94,7 @@ public bool Hidden
set
{
_Hidden = value;
OnVisibilityChanged();
OnVisibilityChanged?.Invoke();
}

}
Expand Down
2 changes: 2 additions & 0 deletions Assets/Scripts/HazardX SCMAP Code/SkyboxData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 3 additions & 5 deletions Assets/Scripts/Ozone SCMAP Code/MapLuaParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down Expand Up @@ -411,11 +414,6 @@ void SetSaveLua()
UpdateArea();

//MapElements.SetActive(false);

MapCenterPoint = Vector3.zero;
MapCenterPoint.x = (GetMapSizeX() / 20f);
MapCenterPoint.z = -1 * (GetMapSizeY() / 20f);

//SortArmys();
}
#endregion
Expand Down
35 changes: 6 additions & 29 deletions Assets/Scripts/Ozone SCMAP Code/ScmapEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -139,6 +133,7 @@ public IEnumerator LoadScmapFile()

if (map.VersionMinor >= 60)
{
map.AdditionalSkyboxData.Data.UpdateSize();
}
else
{
Expand Down Expand Up @@ -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] == "<default>")
Expand All @@ -215,9 +199,6 @@ public IEnumerator LoadScmapFile()

SetWater();




Teren.gameObject.layer = 8;

SetTextures();
Expand All @@ -228,9 +209,6 @@ public IEnumerator LoadScmapFile()
}

yield return null;
//Debug.Log("Scmap load complited");

//GetGamedataFile.UnitObject NewUnit = new GetGamedataFile.UnitObject();
}

public void LoadHeights()
Expand Down Expand Up @@ -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!");
}
Expand All @@ -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();
Expand Down Expand Up @@ -785,8 +764,6 @@ public void LoadDefaultSkybox()
{
map.AdditionalSkyboxData = UnityEngine.JsonUtility.FromJson<SkyboxData>(DefaultSkybox.text);
map.AdditionalSkyboxData.Data.UpdateSize();

Skybox.LoadSkybox();
}

public void UnloadMap()
Expand Down
Loading

0 comments on commit 53690ae

Please sign in to comment.