diff --git a/ClassicalSharp/2D/Screens/Menu/NostalgiaScreen.cs b/ClassicalSharp/2D/Screens/Menu/NostalgiaScreen.cs index 903a1ab65..883578b8d 100644 --- a/ClassicalSharp/2D/Screens/Menu/NostalgiaScreen.cs +++ b/ClassicalSharp/2D/Screens/Menu/NostalgiaScreen.cs @@ -27,7 +27,7 @@ namespace ClassicalSharp { Options.Set( OptionsKey.UseClassicGui, v == "yes" ); } ), - Make( -140, -50, "Classic player list", OnWidgetClick, + Make( -140, 0, "Classic player list", OnWidgetClick, g => g.UseClassicTabList ? "yes" : "no", (g, v) => { g.UseClassicTabList = v == "yes"; Options.Set( OptionsKey.UseClassicTabList, v == "yes" ); diff --git a/ClassicalSharp/Model/BlockModel.cs b/ClassicalSharp/Model/BlockModel.cs index 54b4d8fa5..25b05bef9 100644 --- a/ClassicalSharp/Model/BlockModel.cs +++ b/ClassicalSharp/Model/BlockModel.cs @@ -79,11 +79,11 @@ namespace ClassicalSharp.Model { atlas = game.TerrainAtlas1D; if( game.BlockInfo.IsSprite[block] ) { - SpriteXQuad( TileSide.Right, true ); + SpriteXQuad( TileSide.Right, false ); SpriteZQuad( TileSide.Back, false ); - SpriteXQuad( TileSide.Right, false ); SpriteZQuad( TileSide.Back, true ); + SpriteXQuad( TileSide.Right, true ); } else { YQuad( 0, TileSide.Bottom, FastColour.ShadeYBottom ); XQuad( maxBB.X - 0.5f, TileSide.Right, true, FastColour.ShadeX ); @@ -174,7 +174,7 @@ namespace ClassicalSharp.Model { cache.vertices[index++] = new VertexPos3fTex2fCol4b( p2, 0, p2, rec.U1, rec.V2, col ); } - void SpriteXQuad( int side, bool firstPart ) { // dis is broken + void SpriteXQuad( int side, bool firstPart ) { int texId = game.BlockInfo.GetTextureLoc( block, side ), texIndex = 0; TextureRec rec = atlas.GetTexRec( texId, 1, out texIndex ); FlushIfNotSame( texIndex ); diff --git a/ClassicalSharp/Utils/Camera.cs b/ClassicalSharp/Utils/Camera.cs index f0f0d1921..e1943dd5f 100644 --- a/ClassicalSharp/Utils/Camera.cs +++ b/ClassicalSharp/Utils/Camera.cs @@ -32,6 +32,14 @@ namespace ClassicalSharp { /// Calculates the picked block based on the camera's current position. public virtual void GetPickedBlock( PickedPos pos ) { } + + protected float AdjustPitch( float value ) { + if( value >= 90.00f && value <= 90.25f ) return 90.25f * Utils.Deg2Rad; + if( value >= 89.75f && value <= 90.00f ) return 89.75f * Utils.Deg2Rad; + if( value >= 270.00f && value <= 270.25f ) return 270.25f * Utils.Deg2Rad; + if( value >= 269.75f && value <= 270.00f ) return 269.75f * Utils.Deg2Rad; + return value * Utils.Deg2Rad; + } } public abstract class PerspectiveCamera : Camera { @@ -54,7 +62,8 @@ namespace ClassicalSharp { } public override void GetPickedBlock( PickedPos pos ) { - Vector3 dir = Utils.GetDirVector( player.HeadYawRadians, player.PitchRadians ); + Vector3 dir = Utils.GetDirVector( player.HeadYawRadians, + AdjustPitch( player.PitchDegrees ) ); Vector3 eyePos = player.EyePosition; float reach = game.LocalPlayer.ReachDistance; Picking.CalculatePickedBlock( game, eyePos, dir, reach, pos ); @@ -142,7 +151,8 @@ namespace ClassicalSharp { Vector3 eyePos = player.EyePosition; eyePos.Y += bobYOffset; - Vector3 dir = -Utils.GetDirVector( player.HeadYawRadians, player.PitchRadians ); + Vector3 dir = -Utils.GetDirVector( player.HeadYawRadians, + AdjustPitch( player.PitchDegrees ) ); Picking.ClipCameraPos( game, eyePos, dir, distance, game.CameraClipPos ); Vector3 cameraPos = game.CameraClipPos.IntersectPoint; return Matrix4.LookAt( cameraPos, eyePos, Vector3.UnitY ) * tiltMatrix; @@ -153,7 +163,8 @@ namespace ClassicalSharp { } public override Vector3 GetCameraPos( Vector3 eyePos ) { - Vector3 dir = -Utils.GetDirVector( player.HeadYawRadians, player.PitchRadians ); + Vector3 dir = -Utils.GetDirVector( player.HeadYawRadians, + AdjustPitch( player.PitchDegrees ) ); Picking.ClipCameraPos( game, eyePos, dir, distance, game.CameraClipPos ); return game.CameraClipPos.IntersectPoint; } @@ -176,7 +187,8 @@ namespace ClassicalSharp { Vector3 eyePos = player.EyePosition; eyePos.Y += bobYOffset; - Vector3 dir = Utils.GetDirVector( player.HeadYawRadians, player.PitchRadians ); + Vector3 dir = Utils.GetDirVector( player.HeadYawRadians, + AdjustPitch( player.PitchDegrees ) ); Picking.ClipCameraPos( game, eyePos, dir, distance, game.CameraClipPos ); Vector3 cameraPos = game.CameraClipPos.IntersectPoint; return Matrix4.LookAt( cameraPos, eyePos, Vector3.UnitY ) * tiltMatrix; @@ -187,7 +199,8 @@ namespace ClassicalSharp { } public override Vector3 GetCameraPos( Vector3 eyePos ) { - Vector3 dir = Utils.GetDirVector( player.HeadYawRadians, player.PitchRadians ); + Vector3 dir = Utils.GetDirVector( player.HeadYawRadians, + AdjustPitch( player.PitchDegrees ) ); Picking.ClipCameraPos( game, eyePos, dir, distance, game.CameraClipPos ); return game.CameraClipPos.IntersectPoint; } @@ -202,7 +215,8 @@ namespace ClassicalSharp { CalcViewBobbing( delta ); Vector3 eyePos = player.EyePosition; eyePos.Y += bobYOffset; - Vector3 cameraDir = Utils.GetDirVector( player.HeadYawRadians, player.PitchRadians ); + Vector3 cameraDir = Utils.GetDirVector( player.HeadYawRadians, + AdjustPitch( player.PitchDegrees ) ); return Matrix4.LookAt( eyePos, eyePos + cameraDir, Vector3.UnitY ) * tiltMatrix; }