Client should draw blocks at map boundaries.

This commit is contained in:
UnknownShadow200 2015-09-19 20:35:04 +10:00
parent c756094023
commit 60b87b7a6f
2 changed files with 18 additions and 14 deletions

View File

@ -22,7 +22,7 @@ namespace ClassicalSharp {
game.TerrainAtlasChanged += TerrainAtlasChanged;
}
int width, length, height;
internal int width, length, height, edgeLevel;
int maxX, maxY, maxZ;
byte[] counts = new byte[chunkSize3 * TileSide.Sides];
byte[] chunk = new byte[extChunkSize3];
@ -92,6 +92,8 @@ namespace ClassicalSharp {
}
}
if( x1 == 0 || y1 == 0 || z1 == 0 || x1 + chunkSize >= width ||
y1 + chunkSize >= height || z1 + chunkSize >= length ) allSolid = false;
if( !( allAir || allSolid ) ) {
map.HeightmapHint( x1 - 1, z1 - 1, mapPtr );
}
@ -191,10 +193,9 @@ namespace ClassicalSharp {
void TestAndStretchX( int xx, int index, byte tile, int chunkIndex, int value, int test, int tileSide, int offset ) {
index += tileSide;
if( value == test ) {
counts[index] = 0;
} else if( counts[index] != 0 ) {
if( info.IsFaceHidden( tile, chunk[chunkIndex + offset], tileSide ) ) {
if( counts[index] != 0 ) {
if( (value == test && Y < edgeLevel) ||
(value != test && info.IsFaceHidden( tile, chunk[chunkIndex + offset], tileSide )) ) {
counts[index] = 0;
} else {
int count = StretchX( xx, index, X, Y, Z, chunkIndex, tile, tileSide );
@ -206,10 +207,9 @@ namespace ClassicalSharp {
void TestAndStretchZ( int zz, int index, byte tile, int chunkIndex, int value, int test, int tileSide, int offset ) {
index += tileSide;
if( value == test ) {
counts[index] = 0;
} else if( counts[index] != 0 ) {
if( info.IsFaceHidden( tile, chunk[chunkIndex + offset], tileSide ) ) {
if( counts[index] != 0 ) {
if( (value == test && Y < edgeLevel) ||
(value != test && info.IsFaceHidden( tile, chunk[chunkIndex + offset], tileSide )) ) {
counts[index] = 0;
} else {
int count = StretchZ( zz, index, X, Y, Z, chunkIndex, tile, tileSide );
@ -282,6 +282,7 @@ namespace ClassicalSharp {
width = map.Width;
height = map.Height;
length = map.Length;
edgeLevel = map.GroundHeight;
maxX = width - 1;
maxY = height - 1;
maxZ = length - 1;

View File

@ -69,6 +69,9 @@ namespace ClassicalSharp {
void EnvVariableChanged( object sender, EnvVariableEventArgs e ) {
if( e.Var == EnvVariable.SunlightColour || e.Var == EnvVariable.ShadowlightColour ) {
Refresh();
} else if( e.Var == EnvVariable.WaterLevel ) {
builder.edgeLevel = game.Map.WaterHeight;
Refresh();
}
}