Main Menu Crash Fix & Options Menu Cursor Fix

Fixed a crash when moving to the content pack button in the main menu options row while having no savegames.

Fixed the options pointer changing position when resizing the game window.
This commit is contained in:
JappaWakka 2021-09-29 14:32:05 +02:00
parent d3bad8913b
commit 106de657f0
2 changed files with 36 additions and 23 deletions

View File

@ -320,7 +320,7 @@ Public Class NewMainMenuScreen
Public Overrides Sub Update()
PreScreen.Update()
If _loading = False Then
'Shift the top row horizontally
'Shift the Top row horizontally
_mainOffset.X = _screenOffset.X
'Shift the main menu vertically
Select Case _menuIndex
@ -470,25 +470,27 @@ Public Class NewMainMenuScreen
End If
End Select
End If
If _MainProfiles(_selectedProfile).IsGameJolt AndAlso _MainProfiles(_selectedProfile).Loaded Then
If Controls.Down(True, True, False) Then
_GameJoltButtonIndex += 1
If _menuIndex = 0 Then
If _MainProfiles(_selectedProfile).IsGameJolt AndAlso _MainProfiles(_selectedProfile).Loaded Then
If Controls.Down(True, True, False) Then
_GameJoltButtonIndex += 1
End If
If Controls.Up(True, True, False) Then
_GameJoltButtonIndex -= 1
End If
_GameJoltButtonIndex = Clamp(_GameJoltButtonIndex, 0, 3)
End If
If Controls.Up(True, True, False) Then
_GameJoltButtonIndex -= 1
End If
_GameJoltButtonIndex = Clamp(_GameJoltButtonIndex, 0, 3)
End If
Select Case _menuIndex
Case 0
_selectedProfile = _selectedProfile.Clamp(0, _MainProfiles.Count - 1)
Case 1
_selectedProfile = _selectedProfile.Clamp(0, _GameJoltProfiles.Count - 1)
Case 2, 3
_selectedProfile = _selectedProfile.Clamp(0, _OptionsProfiles.Count - 1)
End Select
Case 0
_selectedProfile = _selectedProfile.Clamp(0, _MainProfiles.Count - 1)
Case 1
_selectedProfile = _selectedProfile.Clamp(0, _GameJoltProfiles.Count - 1)
Case 2, 3
_selectedProfile = _selectedProfile.Clamp(0, _OptionsProfiles.Count - 1)
End Select
If _fadeInMain = 1.0F Then
If Controls.Accept(False, True, True) Then
Select Case _GameJoltButtonIndex
@ -514,11 +516,12 @@ Public Class NewMainMenuScreen
' Try to load the GameJolt profile once the player has logged in.
_MainProfiles(0).LoadGameJolt()
End If
If _MainProfiles(_selectedProfile).Loaded = False Then
_closingDisplay = True
Else
_closingDisplay = False
If _menuIndex = 0 Then
If _MainProfiles(_selectedProfile).Loaded = False Then
_closingDisplay = True
Else
_closingDisplay = False
End If
End If
_sliderTarget = GetSliderTarget(_selectedProfile)

View File

@ -20,6 +20,8 @@
Dim GamePadEnabled As Boolean = True
Dim PreferMultiSampling As Boolean = True
Private _subMenu As Integer = 0
Private _screenSize As Size = New Size(CInt(ScreenSize.Width), CInt(ScreenSize.Height))
Private LastControl As Integer = 0
Private Languages As New List(Of String)
Private LanguageNames As New List(Of String)
@ -320,6 +322,7 @@
For Each control As Control In ControlList
If control._position = _cursorDestPosition Then
LastControl = control.ID
currentControl = control
Exit For
End If
@ -655,9 +658,16 @@
'New stuff
If _opening Then
InitializeControls()
LastControl = 0
_opening = False
End If
'Refresh button positions
If ScreenSize.Width <> _screenSize.Width Or ScreenSize.Height <> _screenSize.Height Then
_screenSize = New Size(CInt(ScreenSize.Width), CInt(ScreenSize.Height))
InitializeControls()
End If
If _closing Then
' When the interface is closing, only update the closing animation
' Once the interface is completely closed, set to the previous screen.
@ -803,6 +813,7 @@
For Each control As Control In ControlList
If control._position = _cursorDestPosition Then
LastControl = control.ID
currentControl = control
Exit For
End If
@ -1020,8 +1031,7 @@
End Select
If ScreenIndex <> 7 Then
'_cursorPosition = ControlList(0)._position
_cursorDestPosition = ControlList(0)._position
_cursorDestPosition = ControlList(LastControl)._position
Else
_cursorDestPosition = ControlList(4)._position
End If