diff --git a/ClassicalSharp/2D/Screens/Bindings/KeyBindingsScreen.cs b/ClassicalSharp/2D/Screens/Bindings/KeyBindingsScreen.cs index a8a4cc3c9..754fc81e5 100644 --- a/ClassicalSharp/2D/Screens/Bindings/KeyBindingsScreen.cs +++ b/ClassicalSharp/2D/Screens/Bindings/KeyBindingsScreen.cs @@ -77,7 +77,7 @@ namespace ClassicalSharp { } curWidget = null; } - return true; + return key < Key.F1 || key > Key.F35; } public override void Dispose() { diff --git a/ClassicalSharp/2D/Screens/Menu/GenLevelScreen.cs b/ClassicalSharp/2D/Screens/Menu/GenLevelScreen.cs index f20e918cb..45d4872f2 100644 --- a/ClassicalSharp/2D/Screens/Menu/GenLevelScreen.cs +++ b/ClassicalSharp/2D/Screens/Menu/GenLevelScreen.cs @@ -42,7 +42,7 @@ namespace ClassicalSharp { game.SetNewScreen( null ); return true; } - return selectedWidget == null ? true : + return selectedWidget == null ? (key < Key.F1 || key > Key.F35) : selectedWidget.HandlesKeyDown( key ); } diff --git a/ClassicalSharp/2D/Screens/Menu/MenuInputScreen.cs b/ClassicalSharp/2D/Screens/Menu/MenuInputScreen.cs index 0490cecd4..e601bb3b8 100644 --- a/ClassicalSharp/2D/Screens/Menu/MenuInputScreen.cs +++ b/ClassicalSharp/2D/Screens/Menu/MenuInputScreen.cs @@ -45,7 +45,8 @@ namespace ClassicalSharp { ChangeSetting(); return true; } - if( inputWidget == null ) return true; + if( inputWidget == null ) + return key < Key.F1 || key > Key.F35; return inputWidget.HandlesKeyDown( key ); } diff --git a/ClassicalSharp/2D/Screens/Menu/PauseScreen.cs b/ClassicalSharp/2D/Screens/Menu/PauseScreen.cs index 5ff10869e..caff877da 100644 --- a/ClassicalSharp/2D/Screens/Menu/PauseScreen.cs +++ b/ClassicalSharp/2D/Screens/Menu/PauseScreen.cs @@ -80,7 +80,7 @@ namespace ClassicalSharp { public override bool HandlesKeyDown( Key key ) { if( key == Key.Escape ) game.SetNewScreen( null ); - return true; + return key < Key.F1 || key > Key.F35; } public override void Dispose() { diff --git a/ClassicalSharp/2D/Widgets/Menu/MenuInputWidget.cs b/ClassicalSharp/2D/Widgets/Menu/MenuInputWidget.cs index e225843b7..2f36f06ae 100644 --- a/ClassicalSharp/2D/Widgets/Menu/MenuInputWidget.cs +++ b/ClassicalSharp/2D/Widgets/Menu/MenuInputWidget.cs @@ -135,7 +135,7 @@ namespace ClassicalSharp { graphicsApi.DeleteTexture( ref chatInputTexture ); SetText( chatInputText.ToString() ); } - return true; + return key < Key.F1 || key > Key.F35; } public override bool HandlesKeyUp( Key key ) { diff --git a/ClassicalSharp/Entities/Entity.cs b/ClassicalSharp/Entities/Entity.cs index 8f6da6466..7885460c0 100644 --- a/ClassicalSharp/Entities/Entity.cs +++ b/ClassicalSharp/Entities/Entity.cs @@ -91,13 +91,12 @@ namespace ClassicalSharp { { if( !game.Map.IsValidPos( x, y, z ) ) continue; byte block = game.Map.GetBlock( x, y, z ); + Vector3 min = new Vector3( x, y, z ) + info.MinBB[block]; + Vector3 max = new Vector3( x, y, z ) + info.MaxBB[block]; - if( condition( block ) ) { - Vector3 min = new Vector3( x, y, z ) + info.MinBB[block]; - Vector3 max = new Vector3( x, y, z ) + info.MaxBB[block]; - BoundingBox blockBB = new BoundingBox( min, max ); - if( blockBB.Intersects( bounds ) ) return true; - } + BoundingBox blockBB = new BoundingBox( min, max ); + if( !blockBB.Intersects( bounds ) ) continue; + if( condition( block ) ) return true; } return false; } diff --git a/ClassicalSharp/Map/ChunkMeshBuilder.cs b/ClassicalSharp/Map/ChunkMeshBuilder.cs index 2e8d19386..9670df3ca 100644 --- a/ClassicalSharp/Map/ChunkMeshBuilder.cs +++ b/ClassicalSharp/Map/ChunkMeshBuilder.cs @@ -137,6 +137,7 @@ namespace ClassicalSharp { x1 = x + min.X; y1 = y + min.Y; z1 = z + min.Z; x2 = x + max.X; y2 = y + max.Y; z2 = z + max.Z; this.minBB = min; this.maxBB = max; + minBB.Y = 1 - minBB.Y; maxBB.Y = 1 - maxBB.Y; fullBright = info.FullBright[tile]; isTranslucent = info.IsTranslucent[tile]; diff --git a/ClassicalSharp/Map/ChunkMeshBuilderTex2Col4.cs b/ClassicalSharp/Map/ChunkMeshBuilderTex2Col4.cs index 5e981e544..22e665884 100644 --- a/ClassicalSharp/Map/ChunkMeshBuilderTex2Col4.cs +++ b/ClassicalSharp/Map/ChunkMeshBuilderTex2Col4.cs @@ -168,8 +168,8 @@ namespace ClassicalSharp { int offset = (lightFlags >> TileSide.Left) & 1; float u1 = minBB.Z, u2 = (count - 1) + maxBB.Z * 15.99f/16f; - float v1 = vOrigin + minBB.Y * invVerElementSize; - float v2 = vOrigin + maxBB.Y * invVerElementSize * 15.99f/16f; + float v1 = vOrigin + maxBB.Y * invVerElementSize; + float v2 = vOrigin + minBB.Y * invVerElementSize * 15.99f/16f; DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i]; FastColour col = fullBright ? FastColour.White : X >= offset ? (Y > map.heightmap[(Z * width) + (X - offset)] ? map.SunlightXSide : map.ShadowlightXSide) : map.SunlightXSide; @@ -187,8 +187,8 @@ namespace ClassicalSharp { int offset = (lightFlags >> TileSide.Right) & 1; float u1 = minBB.Z, u2 = (count - 1) + maxBB.Z * 15.99f/16f; - float v1 = vOrigin + minBB.Y * invVerElementSize; - float v2 = vOrigin + maxBB.Y * invVerElementSize * 15.99f/16f; + float v1 = vOrigin + maxBB.Y * invVerElementSize; + float v2 = vOrigin + minBB.Y * invVerElementSize * 15.99f/16f; DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i]; FastColour col = fullBright ? FastColour.White : X <= (maxX - offset) ? (Y > map.heightmap[(Z * width) + (X + offset)] ? map.SunlightXSide : map.ShadowlightXSide) : map.SunlightXSide; @@ -206,8 +206,8 @@ namespace ClassicalSharp { int offset = (lightFlags >> TileSide.Front) & 1; float u1 = minBB.X, u2 = (count - 1) + maxBB.X * 15.99f/16f; - float v1 = vOrigin + minBB.Y * invVerElementSize; - float v2 = vOrigin + maxBB.Y * invVerElementSize * 15.99f/16f; + float v1 = vOrigin + maxBB.Y * invVerElementSize; + float v2 = vOrigin + minBB.Y * invVerElementSize * 15.99f/16f; DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i]; FastColour col = fullBright ? FastColour.White : Z >= offset ? (Y > map.heightmap[((Z - offset) * width) + X] ? map.SunlightZSide : map.ShadowlightZSide) : map.SunlightZSide; @@ -225,8 +225,8 @@ namespace ClassicalSharp { int offset = (lightFlags >> TileSide.Back) & 1; float u1 = minBB.X, u2 = (count - 1) + maxBB.X * 15.99f/16f; - float v1 = vOrigin + minBB.Y * invVerElementSize; - float v2 = vOrigin + maxBB.Y * invVerElementSize * 15.99f/16f; + float v1 = vOrigin + maxBB.Y * invVerElementSize; + float v2 = vOrigin + minBB.Y * invVerElementSize * 15.99f/16f; DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i]; FastColour col = fullBright ? FastColour.White : Z <= (maxZ - offset) ? (Y > map.heightmap[((Z + offset) * width) + X] ? map.SunlightZSide : map.ShadowlightZSide) : map.SunlightZSide;