Adjust profile "guessing"

- Remove block from using connect with uninitialised profile. Instead, CL_ConnectToServer handles the guess entirely.
- Add splitscreen player initialisation in circumstances previously missing it
This commit is contained in:
toaster 2022-09-13 12:38:30 +01:00
parent c493ee9ee3
commit 033d87fbe1
3 changed files with 18 additions and 27 deletions

View file

@ -2018,7 +2018,13 @@ static void CL_ConnectToServer(void)
}
if (cv_currprofile.value == -1)
{
PR_ApplyProfilePretend(cv_ttlprofilen.value, 0);
for (i = 1; i < cv_splitplayers.value; i++)
{
PR_ApplyProfile(cv_lastprofile[i].value, i);
}
}
if (gamestate == GS_INTERMISSION)
Y_EndIntermission(); // clean up intermission graphics etc
if (gamestate == GS_VOTING)
@ -2279,33 +2285,6 @@ static void Command_connect(void)
CONS_Printf(M_GetText("You cannot connect while in a game. End this game first.\n"));
return;
}
else if (cv_currprofile.value == 0)
{
CONS_Printf(M_GetText("You cannot connect while using the Guest Profile. Use a Custom Profile to play Online.\n"));
return;
}
else if (cv_currprofile.value == -1)
{
// No profile set, we're attempting to connect from the title screen. (Discord RPC / connect command)
// Automatically apply the last profiles for every potential split player.
// Make sure Player 1's Profile ISN'T the guest profile even if we do that.
UINT8 i;
CONS_Printf(M_GetText("No Profile set, attempting to use last used Profiles...\n"));
for (i = 0; i < cv_splitplayers.value; i++)
{
if (cv_lastprofile[i].value || i > 0)
PR_ApplyProfile(cv_lastprofile[i].value, i);
else
{
CONS_Printf(M_GetText("Player 1's last used Profile is the Guest Profile, which cannot be used to play Online.\n"));
return;
}
}
CONS_Printf(M_GetText("Profiles have been automatically set according to the last used Profiles.\n"));
}
// modified game check: no longer handled
// we don't request a restart unless the filelist differs

View file

@ -1784,6 +1784,12 @@ void D_SRB2Main(void)
// Has to be done before anything else so skin, color, etc in command buffer has an affect.
// ttlprofilen used because it's roughly equivalent in functionality - a QoL aid for quickly getting from startup to action
PR_ApplyProfile(cv_ttlprofilen.value, 0);
{
for (i = 1; i < cv_splitplayers.value; i++)
{
PR_ApplyProfile(cv_lastprofile[i].value, i);
}
}
// Do this here so if you run SRB2 with eg +timelimit 5, the time limit counts
// as having been modified for the first game.

View file

@ -1266,7 +1266,13 @@ void G_DoLoadLevel(boolean resetplayer)
wipegamestate = -1; // force a wipe
if (cv_currprofile.value == -1)
{
PR_ApplyProfilePretend(cv_ttlprofilen.value, 0);
for (i = 1; i < cv_splitplayers.value; i++)
{
PR_ApplyProfile(cv_lastprofile[i].value, i);
}
}
if (gamestate == GS_INTERMISSION)
Y_EndIntermission();
if (gamestate == GS_VOTING)