Fix 3P and 4P configuration screens

They don't crash anymore!
This commit is contained in:
Wolfy 2017-12-18 04:56:38 -06:00
parent c5a4822df6
commit 2e26e79934
5 changed files with 126 additions and 9 deletions

View file

@ -766,6 +766,8 @@ void D_RegisterClientCommands(void)
// m_menu.c
CV_RegisterVar(&cv_crosshair);
CV_RegisterVar(&cv_crosshair2);
CV_RegisterVar(&cv_crosshair3);
CV_RegisterVar(&cv_crosshair4);
CV_RegisterVar(&cv_alwaysfreelook);
CV_RegisterVar(&cv_alwaysfreelook2);

View file

@ -947,7 +947,69 @@ static inline void HU_DrawCrosshair2(void)
#endif
y = viewwindowy + (viewheight>>1);
if (splitscreen)
if (splitscreen || splitscreen3 || splitscreen4)
{
#ifdef HWRENDER
if (rendermode != render_soft)
y += (INT32)gr_viewheight;
else
#endif
y += viewheight;
V_DrawScaledPatch(vid.width>>1, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]);
}
}
static inline void HU_DrawCrosshair3(void)
{
INT32 i, y;
i = cv_crosshair3.value & 3;
if (!i)
return;
if ((netgame || multiplayer) && players[thirddisplayplayer].spectator)
return;
#ifdef HWRENDER
if (rendermode != render_soft)
y = (INT32)gr_basewindowcentery;
else
#endif
y = viewwindowy + (viewheight>>1);
if (splitscreen3 || splitscreen4)
{
#ifdef HWRENDER
if (rendermode != render_soft)
y += (INT32)gr_viewheight;
else
#endif
y += viewheight;
V_DrawScaledPatch(vid.width>>1, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]);
}
}
static inline void HU_DrawCrosshair4(void)
{
INT32 i, y;
i = cv_crosshair4.value & 3;
if (!i)
return;
if ((netgame || multiplayer) && players[fourthdisplayplayer].spectator)
return;
#ifdef HWRENDER
if (rendermode != render_soft)
y = (INT32)gr_basewindowcentery;
else
#endif
y = viewwindowy + (viewheight>>1);
if (splitscreen4)
{
#ifdef HWRENDER
if (rendermode != render_soft)
@ -1187,6 +1249,12 @@ void HU_Drawer(void)
if (!automapactive && cv_crosshair2.value && !demoplayback && !camera2.chase && !players[secondarydisplayplayer].spectator)
HU_DrawCrosshair2();
if (!automapactive && cv_crosshair3.value && !demoplayback && !camera3.chase && !players[thirddisplayplayer].spectator)
HU_DrawCrosshair3();
if (!automapactive && cv_crosshair4.value && !demoplayback && !camera4.chase && !players[fourthdisplayplayer].spectator)
HU_DrawCrosshair4();
// draw desynch text
if (hu_resynching)

View file

@ -4211,7 +4211,7 @@ static void K_drawKartItemClose(void)
void K_drawMinimap(void)
{
// SRB2kart 010217 - Automap Hud (temporarily commented out)
// SRB2kart 12/18/17 - Automap HUD
/*
INT32 amnumxpos;
INT32 amnumypos;
@ -4229,7 +4229,7 @@ void K_drawMinimap(void)
lumpnum = W_CheckNumForName(va("%sR", G_BuildAutoMapName(gamemap)));
if (lumpnum != -1 && (!modifiedgame || (modifiedgame && mapheaderinfo[gamemap-1].automap)))
if (lumpnum != -1 && (!modifiedgame || (modifiedgame && mapheaderinfo[gamemap-1]->automap)))
AutomapPic = W_CachePatchName(va("%sR", G_BuildAutoMapName(gamemap)), PU_CACHE);
else
AutomapPic = W_CachePatchName(va("NOMAPR"), PU_CACHE);
@ -4248,7 +4248,7 @@ void K_drawMinimap(void)
V_DrawSmallScaledPatch(x, y, 0, AutomapPic);
// Player's tiny icons on the Automap.
if (lumpnum != -1 && (!modifiedgame || (modifiedgame && mapheaderinfo[gamemap-1].automap)))
if (lumpnum != -1 && (!modifiedgame || (modifiedgame && mapheaderinfo[gamemap-1]->automap)))
{
for (i = 0; i < MAXPLAYERS; i++)
{

View file

@ -507,6 +507,8 @@ static menuitem_t MPauseMenu[] =
{IT_CALL | IT_STRING, NULL, "Continue", M_SelectableClearMenus,40},
{IT_CALL | IT_STRING, NULL, "Player 1 Setup", M_SetupMultiPlayer, 48}, // splitscreen
{IT_CALL | IT_STRING, NULL, "Player 2 Setup", M_SetupMultiPlayer2, 56}, // splitscreen
{IT_CALL | IT_STRING, NULL, "Player 3 Setup", M_SetupMultiPlayer3, 64}, // splitscreen
{IT_CALL | IT_STRING, NULL, "Player 4 Setup", M_SetupMultiPlayer4, 72}, // splitscreen
{IT_STRING | IT_CALL, NULL, "Spectate", M_ConfirmSpectate, 48},
{IT_STRING | IT_CALL, NULL, "Enter Game", M_ConfirmEnterGame, 48},
@ -526,6 +528,8 @@ typedef enum
mpause_continue,
mpause_psetupsplit,
mpause_psetupsplit2,
mpause_psetupsplit3,
mpause_psetupsplit4,
mpause_spectate,
mpause_entergame,
mpause_switchteam,
@ -891,7 +895,7 @@ static menuitem_t MP_MainMenu[] =
#endif
{IT_CALL | IT_STRING, NULL, "TWO PLAYER GAME", M_StartSplitServerMenu, 60},
{IT_CALL | IT_STRING, NULL, "THREE PLAYER GAME", M_Start3PServerMenu, 70},
{IT_CALL | IT_STRING, NULL, "FOUR PLAYER GAME", M_Start4PServerMenu, 80},
{IT_CALL | IT_STRING, NULL, "FOUR PLAYER GAME", M_Start4PServerMenu, 80},
{IT_CALL | IT_STRING, NULL, "SETUP PLAYER 1", M_SetupMultiPlayer, 100},
{IT_CALL | IT_STRING, NULL, "SETUP PLAYER 2", M_SetupMultiPlayer2, 110},
@ -2697,10 +2701,16 @@ void M_StartControlPanel(void)
MPauseMenu[mpause_scramble].status = IT_DISABLED;
MPauseMenu[mpause_psetupsplit].status = IT_DISABLED;
MPauseMenu[mpause_psetupsplit2].status = IT_DISABLED;
MPauseMenu[mpause_psetupsplit3].status = IT_DISABLED;
MPauseMenu[mpause_psetupsplit4].status = IT_DISABLED;
MPauseMenu[mpause_spectate].status = IT_DISABLED;
MPauseMenu[mpause_entergame].status = IT_DISABLED;
MPauseMenu[mpause_switchteam].status = IT_DISABLED;
MPauseMenu[mpause_psetup].status = IT_DISABLED;
// Reset these in case splitscreen messes things up
MPauseMenu[mpause_options].alphaKey = 64;
MPauseMenu[mpause_title].alphaKey = 80;
MPauseMenu[mpause_quit].alphaKey = 88;
if ((server || IsPlayerAdmin(consoleplayer)))
{
@ -2709,8 +2719,31 @@ void M_StartControlPanel(void)
MPauseMenu[mpause_scramble].status = IT_STRING | IT_SUBMENU;
}
if (splitscreen)
if (splitscreen || splitscreen3 || splitscreen4)
{
MPauseMenu[mpause_psetupsplit].status = MPauseMenu[mpause_psetupsplit2].status = IT_STRING | IT_CALL;
if (splitscreen3 || splitscreen4)
{
MPauseMenu[mpause_psetupsplit3].status = IT_STRING | IT_CALL;
if (splitscreen3)
{
MPauseMenu[mpause_options].alphaKey = 72;
MPauseMenu[mpause_title].alphaKey = 88;
MPauseMenu[mpause_quit].alphaKey = 96;
}
if (splitscreen4)
{
MPauseMenu[mpause_psetupsplit4].status = IT_STRING | IT_CALL;
MPauseMenu[mpause_options].alphaKey = 80;
MPauseMenu[mpause_title].alphaKey = 96;
MPauseMenu[mpause_quit].alphaKey = 104;
}
}
}
else
{
MPauseMenu[mpause_psetup].status = IT_STRING | IT_CALL;
@ -7254,13 +7287,21 @@ static void M_DrawControl(void)
char tmp[50];
INT32 i;
INT32 keys[2];
const char *ctrl;
// draw title, strings and submenu
M_DrawGenericMenu();
M_CentreText(30,
(setupcontrols_secondaryplayer ? "SET CONTROLS FOR SECONDARY PLAYER" :
"PRESS ENTER TO CHANGE, BACKSPACE TO CLEAR"));
if (setupcontrols_secondaryplayer)
ctrl = "SET CONTROLS FOR SECONDARY PLAYER";
else if (setupcontrols_thirdplayer)
ctrl = "SET CONTROLS FOR THIRD PLAYER";
else if (setupcontrols_fourthplayer)
ctrl = "SET CONTROLS FOR FOURTH PLAYER";
else
ctrl = "PRESS ENTER TO CHANGE, BACKSPACE TO CLEAR";
M_CentreText(30, ctrl);
for (i = 0;i < currentMenu->numitems;i++)
{

View file

@ -2615,6 +2615,12 @@ boolean P_SetupLevel(boolean skipprecip)
// same for second player
if (!cv_chasecam2.changed)
CV_SetValue(&cv_chasecam2, chase);
if (!cv_chasecam3.changed)
CV_SetValue(&cv_chasecam3, chase);
if (!cv_chasecam4.changed)
CV_SetValue(&cv_chasecam4, chase);
}
// Initial height of PointOfView