From c39b58bbd0777dd7a819acc548eeab11aca20a6b Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 19 Jan 2016 20:35:24 +1100 Subject: [PATCH] Fix hotkeys past five not being added properly, and reshuffling when unncessary (Thanks MrGoober), also fix custom liquid blocks being able to 'pick up' the player when they shouldn't. (Thanks Empy) --- ClassicalSharp/2D/Screens/HotkeyScreen.cs | 12 ++++-------- ClassicalSharp/Entities/LocalPlayer.Physics.cs | 5 +++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ClassicalSharp/2D/Screens/HotkeyScreen.cs b/ClassicalSharp/2D/Screens/HotkeyScreen.cs index 9dcb4f4b0..889ac88f4 100644 --- a/ClassicalSharp/2D/Screens/HotkeyScreen.cs +++ b/ClassicalSharp/2D/Screens/HotkeyScreen.cs @@ -122,14 +122,14 @@ namespace ClassicalSharp { } ButtonWidget MakeHotkey( int x, int y, int index ) { - string text = Get( index ); + string text = Get( index + currentIndex ); ButtonWidget button = ButtonWidget.Create( game, x, y, 240, 30, text, Anchor.Centre, Anchor.Centre, textFont, TextButtonClick ); button.Metadata = default( Hotkey ); if( text != "-----" ) - button.Metadata = hotkeys.Hotkeys[index]; + button.Metadata = hotkeys.Hotkeys[index + currentIndex]; return button; } @@ -146,7 +146,7 @@ namespace ClassicalSharp { button.SetText( text ); button.Metadata = default( Hotkey ); if( text != "-----" ) - button.Metadata = hotkeys.Hotkeys[index]; + button.Metadata = hotkeys.Hotkeys[index + currentIndex]; } string MakeFlagsString( byte flags ) { @@ -179,6 +179,7 @@ namespace ClassicalSharp { } #region Modifying hotkeys + Hotkey curHotkey, origHotkey; MenuInputWidget currentAction; TextWidget currentMoreInputLabel; @@ -231,11 +232,6 @@ namespace ClassicalSharp { } void SaveChangesClick( Game game, Widget widget ) { - if( origHotkey.BaseKey != Key.Unknown ) { - hotkeys.RemoveHotkey( origHotkey.BaseKey, origHotkey.Flags ); - hotkeys.UserRemovedHotkey( origHotkey.BaseKey, origHotkey.Flags ); - } - if( curHotkey.BaseKey != Key.Unknown ) { hotkeys.AddHotkey( curHotkey.BaseKey, curHotkey.Flags, currentAction.GetText(), curHotkey.MoreInput ); diff --git a/ClassicalSharp/Entities/LocalPlayer.Physics.cs b/ClassicalSharp/Entities/LocalPlayer.Physics.cs index fb51557e0..92f695d5a 100644 --- a/ClassicalSharp/Entities/LocalPlayer.Physics.cs +++ b/ClassicalSharp/Entities/LocalPlayer.Physics.cs @@ -210,6 +210,11 @@ namespace ClassicalSharp { if( type == BlockCollideType.Solid && !checkSolid ) continue; + 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 ) ) continue; + modifier = Math.Min( modifier, info.SpeedMultiplier[block] ); if( block >= BlockInfo.CpeBlocksCount && type == BlockCollideType.SwimThrough ) useLiquidGravity = true;