mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-24 05:10:42 -04:00
Use sides offset instead. (Thanks goodlyay)
This commit is contained in:
parent
e3582a8dff
commit
f71d88c699
@ -54,6 +54,6 @@ namespace ClassicalSharp.Events {
|
||||
WeatherSpeed,
|
||||
WeatherFade,
|
||||
ExpFog,
|
||||
SidesLevel,
|
||||
SidesOffset,
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ namespace ClassicalSharp.Map {
|
||||
throw new InvalidOperationException("Blocks array length does not match volume of map.");
|
||||
|
||||
if (Env.EdgeHeight == -1) Env.EdgeHeight = height / 2;
|
||||
if (Env.SidesHeight == -1) Env.SidesHeight = Env.EdgeHeight - 2;
|
||||
if (Env.CloudHeight == -1) Env.CloudHeight = height + 2;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,10 @@ namespace ClassicalSharp.Map {
|
||||
public BlockID SidesBlock = Block.Bedrock;
|
||||
|
||||
/// <summary> Maximum height of the various parts of the map sides, in world space. </summary>
|
||||
public int SidesHeight;
|
||||
public int SidesHeight { get { return EdgeHeight + SidesOffset; } }
|
||||
|
||||
/// <summary> Offset of height of map sides from height of map edge. </summary>
|
||||
public int SidesOffset = -2;
|
||||
|
||||
/// <summary> Whether exponential fog mode is used by default. </summary>
|
||||
public bool ExpFog;
|
||||
@ -77,7 +80,7 @@ namespace ClassicalSharp.Map {
|
||||
|
||||
/// <summary> Resets all of the environment properties to their defaults. </summary>
|
||||
public void Reset() {
|
||||
EdgeHeight = -1; SidesHeight = -1; CloudHeight = -1;
|
||||
EdgeHeight = -1; SidesOffset = -2; CloudHeight = -1;
|
||||
EdgeBlock = Block.StillWater; SidesBlock = Block.Bedrock;
|
||||
CloudsSpeed = 1; WeatherSpeed = 1; WeatherFade = 1;
|
||||
|
||||
@ -143,11 +146,11 @@ namespace ClassicalSharp.Map {
|
||||
|
||||
/// <summary> Sets height of the map edges in world space, and raises
|
||||
/// EnvVariableChanged event with variable 'EdgeLevel'. </summary>
|
||||
public void SetEdgeLevel(int level) { SidesHeight = level - 2; Set(level, ref EdgeHeight, EnvVar.EdgeLevel); }
|
||||
public void SetEdgeLevel(int level) { Set(level, ref EdgeHeight, EnvVar.EdgeLevel); }
|
||||
|
||||
/// <summary> Sets height of the map sides in world space, and raises
|
||||
/// <summary> Sets offset of the height of the map sides from map edges in world space, and raises
|
||||
/// EnvVariableChanged event with variable 'SidesLevel'. </summary>
|
||||
public void SetSidesLevel(int level) { Set(level, ref SidesHeight, EnvVar.SidesLevel); }
|
||||
public void SetSidesOffset(int level) { Set(level, ref SidesOffset, EnvVar.SidesOffset); }
|
||||
|
||||
/// <summary> Sets whether exponential fog is used, and raises
|
||||
/// EnvVariableChanged event with variable 'ExpFog'. </summary>
|
||||
|
@ -360,7 +360,7 @@ namespace ClassicalSharp.Network.Protocols {
|
||||
case 8:
|
||||
env.SetExpFog(value != 0); break;
|
||||
case 9:
|
||||
env.SetSidesLevel(value); break;
|
||||
env.SetSidesOffset(value); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ namespace ClassicalSharp.Renderers {
|
||||
void EnvVariableChanged(object sender, EnvVarEventArgs e) {
|
||||
if (e.Var == EnvVar.SunlightColour || e.Var == EnvVar.ShadowlightColour) {
|
||||
Refresh();
|
||||
} else if (e.Var == EnvVar.EdgeLevel || e.Var == EnvVar.SidesLevel) {
|
||||
} else if (e.Var == EnvVar.EdgeLevel || e.Var == EnvVar.SidesOffset) {
|
||||
int oldClip = builder.edgeLevel;
|
||||
builder.sidesLevel = Math.Max(0, game.World.Env.SidesHeight);
|
||||
builder.edgeLevel = Math.Max(0, game.World.Env.EdgeHeight);
|
||||
|
@ -114,7 +114,7 @@ namespace ClassicalSharp.Renderers {
|
||||
MakeTexture(ref sideTexId, ref lastSideTexLoc, map.Env.SidesBlock);
|
||||
if (game.BlockInfo.BlocksLight[map.Env.SidesBlock] != fullColSides)
|
||||
ResetSidesAndEdges(null, null);
|
||||
} else if (e.Var == EnvVar.EdgeLevel || e.Var == EnvVar.SidesLevel) {
|
||||
} else if (e.Var == EnvVar.EdgeLevel || e.Var == EnvVar.SidesOffset) {
|
||||
ResetSidesAndEdges(null, null);
|
||||
} else if (e.Var == EnvVar.SunlightColour) {
|
||||
ResetEdges();
|
||||
|
Loading…
x
Reference in New Issue
Block a user