'Join Last Server' option

This commit is contained in:
yamamama 2025-12-05 15:45:10 -05:00
parent 7f00c74e8a
commit 568949b8e5
5 changed files with 30 additions and 0 deletions

View file

@ -400,6 +400,7 @@ consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = { //Alam: Dummy for save
#endif
// SRB2kart
consvar_t cv_lastserver = CVAR_INIT ("lastserver", "", CV_SAVE, NULL, NULL);
static CV_PossibleValue_t kartminimap_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}};
consvar_t cv_kartminimap = CVAR_INIT ("kartminimap", "4", CV_SAVE, kartminimap_cons_t, NULL);
consvar_t cv_kartcheck = CVAR_INIT ("kartcheck", "Yes", CV_SAVE, CV_YesNo, NULL);
@ -1352,6 +1353,9 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_resume);
CV_RegisterVar(&cv_perfstats);
//Value used to store last server player has joined
CV_RegisterVar(&cv_lastserver);
CV_RegisterVar(&cv_laglesscam);
// ingame object placing

View file

@ -73,6 +73,9 @@ extern consvar_t cv_spectatorreentry, cv_antigrief;
extern consvar_t cv_debugtraversemax;
#endif
//Save server ip
extern consvar_t cv_lastserver;
extern consvar_t cv_kartminimap;
extern consvar_t cv_kartcheck;
extern consvar_t cv_kartinvinsfx;

View file

@ -764,6 +764,7 @@ struct menu_routine_s const MENU_ROUTINES[] = {
{ "TIMEATTACKPRESET", &MR_TimeAttackPreset },
{ "REPLAYSTAFF", &MR_ReplayStaff },
{ "CONNECTIP", &MR_ConnectIP },
{ "CONNECTLASTSERVER", &MR_ConnectLastServer },
{ "QUITMULTIPLAYERMENU", &MR_QuitMultiPlayerMenu },
{ "STARTSERVERMENU", &MR_StartServerMenu },
{ "STARTSERVER", &MR_StartServer },

View file

@ -59,6 +59,7 @@
#endif
#include "d_net.h"
#include "i_net.h"
#include "mserv.h"
#include "m_misc.h"
#include "m_anigif.h"
@ -6138,6 +6139,8 @@ INT32 MR_Connect(INT32 arg)
// do not call menuexitfunc
M_ClearMenus(false);
CV_Set(&cv_lastserver, I_GetNodeAddress(serverlist[arg + cv_dummyserverpage.value * M_ServersPerPage()].node));
COM_BufAddText(va("connect node %d\n", serverlist[arg + cv_dummyserverpage.value * M_ServersPerPage()].node));
return true;
}
@ -6804,6 +6807,7 @@ INT32 MR_ConnectIP(INT32 choice)
M_ClearMenus(true);
CV_Set(&cv_lastserver,cv_dummyip.string);
COM_BufAddText(va("connect \"%s\"\n", cv_dummyip.string));
// A little "please wait" message.
@ -6816,6 +6820,23 @@ INT32 MR_ConnectIP(INT32 choice)
return true;
}
//Join Last server
INT32 MR_ConnectLastServer(INT32 choice)
{
(void)choice;
if (!*cv_lastserver.string)
{
M_StartMessage("You haven't previosuly joined a server.\n", NULL, MM_NOTHING);
return false;
}
M_ClearMenus(true);
COM_BufAddText(va("connect \"%s\"\n", cv_lastserver.string));
return true;
}
// ========================
// MULTIPLAYER PLAYER SETUP
// ========================

View file

@ -272,6 +272,7 @@ INT32 MR_TimeAttackPreset(INT32 arg);
INT32 MR_ReplayTimeAttack(INT32 arg);
INT32 MR_ReplayStaff(INT32 choice);
INT32 MR_ConnectIP(INT32 choice);
INT32 MR_ConnectLastServer(INT32 choice);
INT32 MR_QuitMultiPlayerMenu(INT32 choice);
INT32 MR_StartServerMenu(INT32 choice);
INT32 MR_StartServer(INT32 choice);