diff options
-rw-r--r-- | Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut index 44a54e62..efe1d462 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut @@ -77,9 +77,6 @@ void function InitMapsMenu() AddButtonEventHandler( button, UIE_CLICK, MapButton_Activate ) AddButtonEventHandler( button, UIE_GET_FOCUS, MapButton_Focus ) } - - - FilterMapsArray() } @@ -133,8 +130,12 @@ void function OnHitDummyBottom( var button ) file.scrollOffset += 1 + int compensate = 0 + if ( file.mapsArrayFiltered.len() % 3 != 0 ) + compensate = 1 + if ((file.scrollOffset + BUTTONS_PER_PAGE) * 3 > file.mapsArrayFiltered.len()) - file.scrollOffset = (file.mapsArrayFiltered.len() - BUTTONS_PER_PAGE * 3) / 3 + 1 + file.scrollOffset = (file.mapsArrayFiltered.len() - BUTTONS_PER_PAGE * 3) / 3 + compensate UpdateMapsGrid() UpdateListSliderPosition() @@ -260,7 +261,6 @@ void function FilterMapsArray() string searchTerm = Hud_GetUTF8Text( Hud_GetChild( file.menu, "BtnMapsSearch" ) ) bool useSearch = searchTerm != "" - bool hideLocked = bool( GetConVarInt( "filter_map_hide_locked" ) ) foreach ( string map in GetPrivateMatchMaps() ) @@ -321,6 +321,10 @@ bool function IsLocked( string map ) } } + if ( !PrivateMatch_IsValidMapModeCombo( map, PrivateMatch_GetSelectedMode() ) ) + return true + + return false } @@ -375,7 +379,11 @@ void function SliderBarUpdate() Hud_SetPos( sliderPanel , 2, newPos ) Hud_SetPos( movementCapture , 2, newPos ) - file.scrollOffset = -int( ( (newPos - minYPos) / useableSpace ) * ( file.mapsArrayFiltered.len() / 3 + 1 - BUTTONS_PER_PAGE) ) + int compensate = 0 + if ( file.mapsArrayFiltered.len() % 3 != 0 ) + compensate = 1 + + file.scrollOffset = -int( ( (newPos - minYPos) / useableSpace ) * ( file.mapsArrayFiltered.len() / 3 + compensate - BUTTONS_PER_PAGE) ) UpdateMapsGrid() } @@ -410,7 +418,11 @@ void function UpdateListSliderPosition() var sliderPanel = Hud_GetChild( file.menu , "BtnMapGridSliderPanel" ) var movementCapture = Hud_GetChild( file.menu , "MouseMovementCapture" ) - float maps = float ( file.mapsArrayFiltered.len() / 3 + 1 ) + int compensate = 0 + if ( file.mapsArrayFiltered.len() % 3 != 0 ) + compensate = 1 + + float maps = float ( file.mapsArrayFiltered.len() / 3 + compensate ) float minYPos = -42.0 * (GetScreenSize()[1] / 1080.0) float useableSpace = (582.0 * (GetScreenSize()[1] / 1080.0) - Hud_GetHeight( sliderPanel )) @@ -429,7 +441,10 @@ void function UpdateListSliderPosition() void function OnDownArrowSelected( var button ) { if ( file.mapsArrayFiltered.len() <= BUTTONS_PER_PAGE || file.mapsArrayFiltered.len() <= 12 ) return + if ( file.scrollOffset + 5 > file.mapsArrayFiltered.len() / 3 && file.mapsArrayFiltered.len() % 3 == 0 ) return + file.scrollOffset += 1 + if ((file.scrollOffset + BUTTONS_PER_PAGE) * 3 > file.mapsArrayFiltered.len()) { file.scrollOffset = (file.mapsArrayFiltered.len() - BUTTONS_PER_PAGE * 3) / 3 + 1 } |