Make sure the menus for quake2 and hexen2 have a splitscreen option.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5490 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2019-07-07 04:20:09 +00:00
parent 145c99e802
commit f75beaff81
2 changed files with 39 additions and 28 deletions

View file

@ -330,6 +330,25 @@ void M_Menu_SinglePlayer_f (void)
static menuresel_t resel;
#endif
#if MAX_SPLITS > 1
static const char *splitopts[] =
{
"Single",
"Dual",
"Tripple",
"QUAD",
NULL
};
static const char *splitvals[] =
{
"0",
"1",
"2",
"3",
NULL
};
#endif
Key_Dest_Add(kdm_emenu);
#ifdef CLIENTONLY
@ -351,13 +370,18 @@ void M_Menu_SinglePlayer_f (void)
//quake2 uses the 'newgame' alias, which controls the intro video and then start map.
menu->selecteditem = (menuoption_t*)
MC_AddConsoleCommand (menu, 64, 170, 40, "Easy", va("closemenu; skill 0;deathmatch 0; coop %i;newgame\n", cl_splitscreen.ival>0));
MC_AddConsoleCommand (menu, 64, 170, 48, "Medium", va("closemenu; skill 1;deathmatch 0; coop %i;newgame\n", cl_splitscreen.ival>0));
MC_AddConsoleCommand (menu, 64, 170, 56, "Hard", va("closemenu; skill 2;deathmatch 0; coop %i;newgame\n", cl_splitscreen.ival>0));
MC_AddConsoleCommand (menu, 64, 170, 40, "Easy", va("closemenu; skill 0;deathmatch 0; set_calc coop ($cl_splitscreen>0);newgame\n"));
MC_AddConsoleCommand (menu, 64, 170, 48, "Medium", va("closemenu; skill 1;deathmatch 0; set_calc coop ($cl_splitscreen>0);newgame\n"));
MC_AddConsoleCommand (menu, 64, 170, 56, "Hard", va("closemenu; skill 2;deathmatch 0; set_calc coop ($cl_splitscreen>0);newgame\n"));
#ifdef SAVEDGAMES
MC_AddConsoleCommand (menu, 64, 170, 72, "Load Game", "menu_load\n");
MC_AddConsoleCommand (menu, 64, 170, 80, "Save Game", "menu_save\n");
#endif
#if MAX_SPLITS > 1
b = (menubutton_t*)MC_AddCvarCombo(menu, 72, 170, 96, "Splitscreen", &cl_splitscreen, splitopts, splitvals);
#endif
menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 48, 0, 40, NULL, false);
return;
#endif
@ -483,6 +507,8 @@ void M_Menu_SinglePlayer_f (void)
MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, "Save Game", "menu_save\n");
MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, "Load Game", "menu_load\n");
#endif
MC_AddCvarCombo(menu, 72, 170, y+=20, "Splitscreen", &cl_splitscreen, splitopts, splitvals);
}
menu->cursoritem = (menuoption_t *)MC_AddCursor(menu, &resel, 56, menu->selecteditem?menu->selecteditem->common.posy:0);
@ -527,24 +553,6 @@ void M_Menu_SinglePlayer_f (void)
}
else
{
#if MAX_SPLITS > 1
const char *opts[] =
{
"Single",
"Dual",
"Tripple",
"QUAD",
NULL
};
const char *vals[] =
{
"0",
"1",
"2",
"3",
NULL
};
#endif
int width;
if (R_GetShaderSizes(p, &width, NULL, true) <= 0)
width = 232;
@ -565,7 +573,7 @@ void M_Menu_SinglePlayer_f (void)
#endif
#if MAX_SPLITS > 1
b = (menubutton_t*)MC_AddCvarCombo(menu, 72, 72+width/2, 92, "", &cl_splitscreen, opts, vals);
b = (menubutton_t*)MC_AddCvarCombo(menu, 72, 72+width/2, 92, "", &cl_splitscreen, splitopts, splitvals);
MC_AddWhiteText(menu, 72, 0, 92, "^aSplitscreen", false);
b->common.height = 20;
b->common.width = width;

View file

@ -908,15 +908,18 @@ qboolean SVQ2_InitGameProgs(void)
return false;
}
//stop q2 from crashing.
//Q2 gamecode depends upon maxclients being set+locked in order to know how many player slots there actually are. It crashes when its wrong.
if (!deathmatch.value && !coop.value)
maxclients.value = 1;
svq2_maxclients = 1;
else
maxclients.value = maxclients.ival;
if (maxclients.value > MAX_CLIENTS)
Cvar_SetValue(&maxclients, MAX_CLIENTS);
svq2_maxclients = maxclients.ival;
if (Cvar_VariableValue("cl_splitscreen"))
svq2_maxclients = max(svq2_maxclients, MAX_SPLITS);
if (svq2_maxclients > MAX_CLIENTS)
svq2_maxclients = MAX_CLIENTS;
if (svq2_maxclients != maxclients.value)
Cvar_SetValue(&maxclients, svq2_maxclients);
svq2_maxclients = maxclients.value;
maxclients.flags |= CVAR_LATCH;
deathmatch.flags |= CVAR_LATCH;
coop.flags |= CVAR_LATCH;