Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Vanilla and Northstar compatibility #800

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
42bb3e7
It's fixed
VITALISED Apr 6, 2024
1c98028
Get rid of spammy print
VITALISED Apr 6, 2024
8e04301
It's really not fixed
VITALISED Apr 6, 2024
48e0b71
Note behaviour
VITALISED Apr 6, 2024
8ee2f62
Add vanilla check
VITALISED Apr 6, 2024
84a51ea
Fix for vanilla const not existing
VITALISED Apr 6, 2024
c946f46
Add a handy loc string
VITALISED Apr 6, 2024
a05063c
Use new auth script stuff
VITALISED Apr 28, 2024
bf5acf5
Merge branch 'main' into fix-ui
VITALISED Apr 28, 2024
f9ccd7e
Fix openinvites
VITALISED Apr 28, 2024
b7506fa
Remove old lobbytype function
VITALISED Apr 29, 2024
711a325
Fix entitlement menu not working on vanilla
VITALISED Apr 29, 2024
a2fd37e
Revert random testing stuff
VITALISED Apr 29, 2024
5effa70
Improve combo button stuff, actually readable now
VITALISED Apr 30, 2024
c81a604
Give progression button similar treatment
VITALISED Apr 30, 2024
5cbc103
Don't bother asking user to disable northstar.custom
VITALISED Apr 30, 2024
098465c
Lock buttons between lobbies that don't work
VITALISED Apr 30, 2024
ed08d1a
Move around progression stuff too since we have the space
VITALISED May 1, 2024
591e683
Move to disabling mods to main menu
VITALISED May 1, 2024
bbbde5e
Wrap all Northstar.Custom remotes for vanilla compat
VITALISED May 1, 2024
8414fa0
Disable non-vanilla modes on vanilla mode selector
VITALISED May 1, 2024
0643c47
Switch around attrition and skirmish because why
VITALISED May 1, 2024
371f285
Lock private match store buttons
VITALISED May 1, 2024
d5c08d0
Move remote function code to CustomServers
VITALISED May 1, 2024
7cbf509
Stub buttons better
VITALISED May 1, 2024
b0c6686
Move weapon mods to custom weapons, prevent indexing issues
VITALISED May 2, 2024
df19227
Fix modes menu and server browser playlist stuff
VITALISED May 2, 2024
361d867
Move around communities stuff
VITALISED May 2, 2024
aba850c
Fix minor button issue
VITALISED May 2, 2024
d61aa88
Fix invalid ui player crash
VITALISED May 2, 2024
28ec211
Shuffle around serverfilter stuff
VITALISED May 2, 2024
b47f5b9
Revert changes, drop token on mpbutton
VITALISED May 2, 2024
bba9eb1
ooptm
VITALISED May 2, 2024
09db81d
Update nativefuncs.json with vanilla compat fns
VITALISED May 3, 2024
1bed1b2
Why the fuck did I commit this in
VITALISED May 3, 2024
ad4aaf7
Fix nativefuncs.json again
VITALISED May 3, 2024
2832851
Allow remotes to be created when there's no integrity
VITALISED May 3, 2024
145e3ab
Null out mpButtonActivateFunc if using no integrity
VITALISED May 3, 2024
8edb669
I hate vscode git
VITALISED May 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 134 additions & 30 deletions Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ struct

int inboxHeaderIndex
var inboxButton
var switchButton

int customizeHeaderIndex
var pilotButton
var titanButton
var boostsButton
var progressionButton
var storeButton
var storeNewReleasesButton
var storeBundlesButton
Expand All @@ -94,6 +96,7 @@ struct

array<var> lobbyButtons
var playHeader
var nsHeader
var customizeHeader
var callsignHeader

Expand Down Expand Up @@ -179,7 +182,6 @@ void function InitLobbyMenu()
AddMenuFooterOption( menu, BUTTON_BACK, "#BACK_BUTTON_POSTGAME_REPORT", "#POSTGAME_REPORT", OpenPostGameMenu, IsPostGameMenuValid )
AddMenuFooterOption( menu, BUTTON_TRIGGER_RIGHT, "#R_TRIGGER_CHAT", "", null, IsVoiceChatPushToTalk )
// Client side progression toggle
AddMenuFooterOption( menu, BUTTON_Y, "#Y_BUTTON_TOGGLE_PROGRESSION", "#TOGGLE_PROGRESSION", ShowToggleProgressionDialog )

InitChatroom( menu )

Expand Down Expand Up @@ -230,6 +232,9 @@ void function InitLobbyMenu()

void function ShowToggleProgressionDialog( var button )
{
if( Hud_IsLocked( button ) )
return;

bool enabled = Progression_GetPreference()

DialogData dialogData
Expand Down Expand Up @@ -288,21 +293,31 @@ void function SetupComboButtonTest( var menu )
int buttonIndex = 0
file.playHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_HEADER_PLAY" )

// server browser
file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SERVER_BROWSER" )
// vanilla

file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_FIND_GAME" )
file.lobbyButtons.append( file.findGameButton )
Hud_SetLocked( file.findGameButton, true )
Hud_AddEventHandler( file.findGameButton, UIE_CLICK, OpenServerBrowser )
Hud_AddEventHandler( file.findGameButton, UIE_CLICK, BigPlayButton1_Activate )

// private match
file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#PRIVATE_MATCH" )
Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, StartPrivateMatch )
file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_ROOM" )
Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, DoRoomInviteIfAllowed )

file.inviteFriendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" )
Hud_AddEventHandler( file.inviteFriendsButton, UIE_CLICK, InviteFriendsIfAllowed )

Hud_SetEnabled( file.inviteFriendsButton, false )
Hud_SetVisible( file.inviteFriendsButton, false )
// server browser
// file.serverBrowserButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SERVER_BROWSER" )
// file.lobbyButtons.append( file.serverBrowserButton )
// Hud_SetLocked( file.serverBrowserButton, true )
// Hud_AddEventHandler( file.serverBrowserButton, UIE_CLICK, OpenServerBrowser )

// private match
// file.privateMatchButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#PRIVATE_MATCH" )
// Hud_AddEventHandler( file.privateMatchButton, UIE_CLICK, StartPrivateMatch )


// Hud_SetEnabled( file.inviteFriendsButton, false )
// Hud_SetVisible( file.inviteFriendsButton, false )

// file.toggleMenuModeButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LOBBY_SWITCH_FD" )
// Hud_AddEventHandler( file.toggleMenuModeButton, UIE_CLICK, ToggleLobbyMode )
Expand All @@ -320,6 +335,8 @@ void function SetupComboButtonTest( var menu )
Hud_AddEventHandler( titanButton, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "EditTitanLoadoutsMenu" ) ) )
file.boostsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_BOOSTS" )
Hud_AddEventHandler( file.boostsButton, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "BurnCardMenu" ) ) )
// file.progressionButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#TOGGLE_PROGRESSION" )
// Hud_AddEventHandler( file.progressionButton, UIE_CLICK, ShowToggleProgressionDialog )

headerIndex++
buttonIndex = 0
Expand All @@ -343,12 +360,13 @@ void function SetupComboButtonTest( var menu )
var networksInbox = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INBOX" )
file.inboxButton = networksInbox
file.lobbyButtons.append( networksInbox )
Hud_AddEventHandler( networksInbox, UIE_CLICK, OnInboxButton_Activate )
Hud_AddEventHandler( networksInbox, UIE_CLICK, _OnInboxButton_Activate )
var switchButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#COMMUNITY_SWITCHCOMMUNITY" )
Hud_AddEventHandler( switchButton, UIE_CLICK, OnSwitchButton_Activate )
file.switchButton = switchButton
Hud_AddEventHandler( switchButton, UIE_CLICK, _OnSwitchButton_Activate )
var browseButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#COMMUNITY_BROWSE_NETWORKS" )
file.lobbyButtons.append( browseButton )
Hud_AddEventHandler( browseButton, UIE_CLICK, OnBrowseNetworksButton_Activate )
Hud_AddEventHandler( browseButton, UIE_CLICK, _OnBrowseNetworksButton_Activate )
file.browseNetworkButton = browseButton
#if NETWORK_INVITE
file.inviteFriendsToNetworkButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#INVITE_FRIENDS" )
Expand Down Expand Up @@ -392,6 +410,30 @@ void function SetupComboButtonTest( var menu )
ComboButtons_Finalize( comboStruct )
}

void function _OnInboxButton_Activate( var button )
{
if ( Hud_IsLocked( button ) )
return

OnInboxButton_Activate( button)
}

void function _OnSwitchButton_Activate( var button )
{
if ( Hud_IsLocked( button ) )
return

OnSwitchButton_Activate( button)
}

void function _OnBrowseNetworksButton_Activate( var button )
{
if ( Hud_IsLocked( button ) )
return

OnBrowseNetworksButton_Activate( button)
}

bool function MatchResultsExist()
{
return true // TODO
Expand All @@ -410,22 +452,27 @@ void function DoRoomInviteIfAllowed( var button )
if ( Hud_IsLocked( button ) )
return

if ( !DoesCurrentCommunitySupportInvites() )
if ( !NSIsVanilla() )
StartPrivateMatch( button )
else
{
OnBrowseNetworksButton_Activate( button )
return
}
if ( !DoesCurrentCommunitySupportInvites() )
{
OnBrowseNetworksButton_Activate( button )
return
}

entity player = GetUIPlayer()
entity player = GetUIPlayer()

if ( IsValid( player ) && Player_NextAvailableMatchmakingTime( player ) > 0 )
{
DisplayMatchmakingPenaltyDialog( player )
return
}
if ( IsValid( player ) && Player_NextAvailableMatchmakingTime( player ) > 0 )
{
DisplayMatchmakingPenaltyDialog( player )
return
}

SendOpenInvite( true )
OpenSelectedPlaylistMenu()
SendOpenInvite( true )
OpenSelectedPlaylistMenu()
}
}

void function DisplayMatchmakingPenaltyDialog( entity player )
Expand Down Expand Up @@ -492,6 +539,9 @@ void function InviteFriendsIfAllowed( var button )
if ( Hud_IsLocked( button ) )
return

if ( !NSIsVanilla() )
ShowToggleProgressionDialog( button )

entity player = GetUIPlayer()
if ( IsValid( player ) && Player_NextAvailableMatchmakingTime( player ) > 0 )
{
Expand Down Expand Up @@ -578,6 +628,8 @@ void function OnLobbyMenu_Open()
// code will start loading DLC info from first party unless already done
InitDLCStore()

DoNSButtonState()

thread UpdateCachedNewItems()
if ( file.putPlayerInMatchmakingAfterDelay )
{
Expand Down Expand Up @@ -683,6 +735,41 @@ void function OnLobbyMenu_Open()
}
}

void function DoNSButtonState()
{
if ( NSIsVanilla() )
{
ComboButton_SetText( file.findGameButton, "#MENU_TITLE_FIND_GAME" )
ComboButton_SetText( file.inviteRoomButton, "#MENU_TITLE_INVITE_ROOM" )
ComboButton_SetText( file.inviteFriendsButton, "#MENU_TITLE_INVITE_FRIENDS" )

Hud_SetLocked( file.inboxButton, false )
Hud_SetLocked( file.browseNetworkButton, false )
Hud_SetLocked( file.switchButton, false )
Hud_SetLocked( file.inviteFriendsToNetworkButton, false )

Hud_SetLocked( file.storeButton, false )
Hud_SetLocked( file.storeNewReleasesButton, false )
Hud_SetLocked( file.storeBundlesButton, false )

}
else
{
ComboButton_SetText( file.findGameButton, "#MENU_TITLE_SERVER_BROWSER" )
ComboButton_SetText( file.inviteRoomButton, "#PRIVATE_MATCH" )
ComboButton_SetText( file.inviteFriendsButton, "#TOGGLE_PROGRESSION" )

Hud_SetLocked( file.inboxButton, true )
Hud_SetLocked( file.browseNetworkButton, true )
Hud_SetLocked( file.switchButton, true )
Hud_SetLocked( file.inviteFriendsToNetworkButton, true )

Hud_SetLocked( file.storeButton, true )
Hud_SetLocked( file.storeNewReleasesButton, true )
Hud_SetLocked( file.storeBundlesButton, true )
}
}

bool function DLCStoreShouldBeMarkedAsNew()
{
if ( !IsFullyConnected() )
Expand All @@ -703,9 +790,12 @@ void function LobbyMenuUpdate( var menu )
while ( GetTopNonDialogMenu() == menu )
{
bool inPendingOpenInvite = InPendingOpenInvite()
Hud_SetLocked( file.findGameButton, !IsPartyLeader() || inPendingOpenInvite )
Hud_SetLocked( file.inviteRoomButton, IsOpenInviteVisible() || GetPartySize() > 1 || inPendingOpenInvite )
Hud_SetLocked( file.inviteFriendsButton, inPendingOpenInvite )
if( NSIsVanilla() )
{
Hud_SetLocked( file.findGameButton, !IsPartyLeader() || inPendingOpenInvite )
Hud_SetLocked( file.inviteRoomButton, IsOpenInviteVisible() || GetPartySize() > 1 || inPendingOpenInvite )
Hud_SetLocked( file.inviteFriendsButton, inPendingOpenInvite )
}

bool canGenUp = false
if ( GetUIPlayer() )
Expand Down Expand Up @@ -1230,8 +1320,13 @@ void function BigPlayButton1_Activate( var button )
if ( Hud_IsLocked( button ) )
return

SendOpenInvite( false )
OpenSelectedPlaylistMenu()
if ( !NSIsVanilla() )
OpenServerBrowser( button )
else
{
SendOpenInvite( false )
OpenSelectedPlaylistMenu()
}
}

function EnableButton( button )
Expand Down Expand Up @@ -1562,17 +1657,26 @@ void function SetPutPlayerInMatchmakingAfterDelay( bool value )

void function OnStoreButton_Activate( var button )
{
if( Hud_IsLocked( button ) )
return

LaunchGamePurchaseOrDLCStore()
}

void function OnStoreNewReleasesButton_Activate( var button )
{
if( Hud_IsLocked( button ) )
return

//LaunchGamePurchaseOrDLCStore( [ "StoreMenu", "StoreMenu_NewReleases" ] )
LaunchGamePurchaseOrDLCStore( [ "StoreMenu", "StoreMenu_WeaponSkins" ] )
}

void function OnStoreBundlesButton_Activate( var button )
{
if( Hud_IsLocked( button ) )
return

LaunchGamePurchaseOrDLCStore( [ "StoreMenu", "StoreMenu_Sales" ] )
}

Expand Down
3 changes: 2 additions & 1 deletion Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void function OnMainMenu_Open()
Signal( uiGlobal.signalDummy, "EndOnMainMenu_Open" )
EndSignal( uiGlobal.signalDummy, "EndOnMainMenu_Open" )

SetConVarString( "communities_hostname", "" ) // disable communities due to crash exploits that are still possible through it
// SetConVarString( "communities_hostname", "" ) // disable communities due to crash exploits that are still possible through it

UpdatePromoData() // On script restarts this gives us the last data until the new request is complete
RequestMainMenuPromos() // This will be ignored if there was a recent request. "infoblock_requestInterval"
Expand Down Expand Up @@ -298,6 +298,7 @@ void function LaunchSPTrialMission()
void function LaunchMP()
{
uiGlobal.launching = eLaunching.MULTIPLAYER
NSResetToken()
LaunchGame()
}

Expand Down
29 changes: 26 additions & 3 deletions Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@ global function InitModesMenu

struct {
int currentModePage
array<string> modes = [ // default modes in vanilla
"aitdm",
"tdm",
"cp",
"at",
"ctf",
"lts",
"ps",
"speedball",
"mfd",
"ttdm",
"fd_easy",
"fd_normal",
"fd_hard",
"fd_master",
"fd_insane"
]
} file

const int MODES_PER_PAGE = 15
Expand Down Expand Up @@ -39,24 +56,30 @@ void function UpdateVisibleModes()
Hud_SetEnabled( button, false )
Hud_SetVisible( button, false )
}

array<string> modesArray = GetPrivateMatchModes()

for ( int i = 0; i < MODES_PER_PAGE; i++ )
{
if ( i + ( file.currentModePage * MODES_PER_PAGE ) >= modesArray.len() )
break

int modeIndex = i + ( file.currentModePage * MODES_PER_PAGE )
SetButtonRuiText( buttons[ i ], GetGameModeDisplayName( modesArray[ modeIndex ] ) )

Hud_SetEnabled( buttons[ i ], true )
Hud_SetVisible( buttons[ i ], true )

// This check is refactored in the new mode menu so we can just ignore this atrocity
if ( !ModeSettings_RequiresAI( modesArray[ modeIndex ] ) || modesArray[ modeIndex ] == "aitdm" || modesArray[ modeIndex ] == "at" )
Hud_SetLocked( buttons[ i ], false )
else
Hud_SetLocked( buttons[ i ], true )

if ( !file.modes.contains( modesArray[ modeIndex ] ) && NSIsVanilla() )
{
Hud_SetLocked( buttons[ i ], true )
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ void function OnSettingButtonPressed( var button )
file.enumRealValues[ int( Hud_GetScriptID( button ) ) ] = enumVal
Hud_SetText( textPanel, setting.enumNames[ enumVal ] )


string str = PrivateMatch_GetSelectedMode()
int gamemodeIdx = GetPrivateMatchModeIndex( str )
Hud_SetGamemodeIdx( button, gamemodeIdx )
Hud_SetPlaylistVarName( button, setting.playlistVar )

// you'll get booted for this right now because the playlist native crap is fucked
ClientCommand( "PrivateMatchSetPlaylistVarOverride " + setting.playlistVar + " " + setting.enumValues[ enumVal ] )
}
else
Expand Down
Loading
Loading