aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut')
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut31
1 files changed, 23 insertions, 8 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..930e472b 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() )
@@ -309,7 +309,7 @@ void function LockMapButton( var element )
bool function IsLocked( string map )
{
- bool sp = map.find( "sp_" ) == 0
+ bool sp = map.find( "sp_" ) == 0 && PrivateMatch_GetSelectedMode() != "sp_coop"
if ( sp )
return true
@@ -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
}