aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorF1F7Y <64418963+F1F7Y@users.noreply.github.com>2022-03-31 23:26:19 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-04-01 00:01:22 +0200
commitc34b4b8f6c2240c79ba1ce47a5c538ddc1d10fb8 (patch)
treeabfceff33849c65291942f051c93c3afbc17e780
parenta1d29de9156f0f7dfd743a4b27d74d2c078168a5 (diff)
downloadNorthstarMods-c34b4b8f6c2240c79ba1ce47a5c538ddc1d10fb8.tar.gz
NorthstarMods-c34b4b8f6c2240c79ba1ce47a5c538ddc1d10fb8.zip
Fix maps menu mode lock and slider (#283)
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut29
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
}