From 2e26e79934ab2b74f04ce7c66ea2d16214b42029 Mon Sep 17 00:00:00 2001 From: Wolfy Date: Mon, 18 Dec 2017 04:56:38 -0600 Subject: [PATCH 1/2] Fix 3P and 4P configuration screens They don't crash anymore! --- src/d_netcmd.c | 2 ++ src/hu_stuff.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++- src/k_kart.c | 6 ++--- src/m_menu.c | 51 ++++++++++++++++++++++++++++++++---- src/p_setup.c | 6 +++++ 5 files changed, 126 insertions(+), 9 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b21bdd4d..13a2ee9f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -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); diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 22d802c0..0f1a35c8 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -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) diff --git a/src/k_kart.c b/src/k_kart.c index 4787a002..83ecb568 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -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++) { diff --git a/src/m_menu.c b/src/m_menu.c index b0d82f31..05e2d323 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -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++) { diff --git a/src/p_setup.c b/src/p_setup.c index e18c24c1..79c293c7 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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 From 36439da320c150970787213aa275650671bc6ed9 Mon Sep 17 00:00:00 2001 From: Wolfy Date: Mon, 18 Dec 2017 18:07:38 -0600 Subject: [PATCH 2/2] Resurrect the minimap Still kinda broken. --- src/hu_stuff.c | 73 +------------------------------------------------- src/hu_stuff.h | 1 + src/k_kart.c | 41 +++++++++++++++++++++------- src/k_kart.h | 1 + src/r_things.c | 11 ++++++++ src/r_things.h | 3 +++ src/st_stuff.c | 4 +++ src/st_stuff.h | 1 + 8 files changed, 53 insertions(+), 82 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 0f1a35c8..1018fbe0 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -86,6 +86,7 @@ patch_t *rmatcico; patch_t *bmatcico; patch_t *tagico; patch_t *tallminus; +patch_t *iconprefix[MAXSKINS]; // minimap icons //------------------------------------------- // coop hud @@ -1132,78 +1133,6 @@ static void HU_DrawDemoInfo(void) void HU_Drawer(void) { K_drawMinimap(); - // SRB2kart 010217 - Automap Hud (temporarily commented out) - /* - INT32 amnumxpos; - INT32 amnumypos; - INT32 amxpos; - INT32 amypos; - INT32 lumpnum; - patch_t *AutomapPic; - INT32 i = 0; - - // Draw the HUD only when playing in a level. - // hu_stuff needs this, unlike st_stuff. - if (Playing() && gamestate == GS_LEVEL) - { - INT32 x, y; - - lumpnum = W_CheckNumForName(va("%sR", G_BuildAutoMapName(gamemap))); - - 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); - - if (splitscreen) - { - x = 160 - (AutomapPic->width/4); - y = 100 - (AutomapPic->height/4); - } - else - { - x = 312 - (AutomapPic->width/2); - y = 60; - } - - V_DrawSmallScaledPatch(x, y, 0, AutomapPic); - - // Player's tiny icons on the Automap. - if (lumpnum != -1 && (!modifiedgame || (modifiedgame && mapheaderinfo[gamemap-1].automap))) - { - for (i = 0; i < MAXPLAYERS; i++) - { - if (players[i].mo && !players[i].spectator) - { - // amnum xpos & ypos are the icon's speed around the HUD. - // The number being divided by is for how fast it moves. - // The higher the number, the slower it moves. - - // am xpos & ypos are the icon's starting position. Withouht - // it, they wouldn't 'spawn' on the top-right side of the HUD. - amnumxpos = (players[i].mo->x / 320) >> FRACBITS; - amnumypos = (-players[i].mo->y / 340) >> FRACBITS; - - amxpos = (x + amnumxpos) - (iconprefix[players[i].skin]->width/4); - amypos = (y + amnumypos) - (iconprefix[players[i].skin]->height/4); - - if (!players[i].skincolor) // 'default' color - { - V_DrawSmallScaledPatch(amxpos, amypos, 0, iconprefix[players[i].skin]); - } - else - { - UINT8 *colormap = translationtables[players[i].skin] - 256 + (players[i].skincolor<<8); - V_DrawSmallMappedPatch(amxpos, amypos, 0,iconprefix[players[i].skin], colormap); - } - } - } - } - if (!splitscreen && maptol & TOL_KART && !hu_showscores) - HU_DrawRaceRankings(); - } - */ - // // draw chat string plus cursor if (chat_on) diff --git a/src/hu_stuff.h b/src/hu_stuff.h index a008d840..674e943f 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -78,6 +78,7 @@ extern patch_t *rmatcico; extern patch_t *bmatcico; extern patch_t *tagico; extern patch_t *tallminus; +extern patch_t *iconprefix[MAXSKINS]; // set true when entering a chat message extern boolean chat_on; diff --git a/src/k_kart.c b/src/k_kart.c index dde12b14..9993b493 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4175,10 +4175,31 @@ static void K_drawKartItemClose(void) V_DrawScaledPatch(ITEM_X, ITEM_Y, V_SNAPTORIGHT|V_SNAPTOTOP|splitflags, localpatch); } +void K_LoadIconGraphics(char *facestr, INT32 skinnum) +{ + char namelump[9]; + + // hack: make sure base face name is no more than 8 chars + if (strlen(facestr) > 8) + facestr[8] = '\0'; + strcpy(namelump, facestr); // copy base name + + iconprefix[skinnum] = W_CachePatchName(namelump, PU_HUDGFX); + iconfreed[skinnum] = false; +} + +#if 0 //unused +static void K_UnLoadIconGraphics(INT32 skinnum) +{ + Z_Free(iconprefix[skinnum]); + iconfreed[skinnum] = true; +} +#endif + void K_drawMinimap(void) { // SRB2kart 12/18/17 - Automap HUD - /* + INT32 amnumxpos; INT32 amnumypos; INT32 amxpos; @@ -4193,10 +4214,10 @@ void K_drawMinimap(void) { INT32 x, y; - lumpnum = W_CheckNumForName(va("%sR", G_BuildAutoMapName(gamemap))); + lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap))); - if (lumpnum != -1 && (!modifiedgame || (modifiedgame && mapheaderinfo[gamemap-1]->automap))) - AutomapPic = W_CachePatchName(va("%sR", G_BuildAutoMapName(gamemap)), PU_CACHE); + if (lumpnum != -1) + AutomapPic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_CACHE); else AutomapPic = W_CachePatchName(va("NOMAPR"), PU_CACHE); @@ -4214,7 +4235,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) { for (i = 0; i < MAXPLAYERS; i++) { @@ -4238,16 +4259,16 @@ void K_drawMinimap(void) } else { - UINT8 *colormap = transtables[players[i].skin] - 256 + (players[i].skincolor<<8); + UINT8 *colormap = R_GetTranslationColormap(players[i].skin, players[i].skincolor, 0); //transtables[players[i].skin] - 256 + (players[i].skincolor<<8); V_DrawSmallMappedPatch(amxpos, amypos, 0,iconprefix[players[i].skin], colormap); } } } } - if (!(splitscreen || splitscreen3 || splitscreen4) && maptol & TOL_KART && !hu_showscores) - HU_DrawRaceRankings(); - }*/ - ; + /*if (!(splitscreen || splitscreen3 || splitscreen4) && maptol & TOL_RACE && !hu_showscores) + HU_DrawRaceRankings();*/ + } + //; } static void K_drawKartItemRoulette(void) diff --git a/src/k_kart.h b/src/k_kart.h index d1c7716d..24fccd37 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -43,6 +43,7 @@ void K_CheckBalloons(void); void K_LoadKartHUDGraphics(void); fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my); void K_drawKartHUD(void); +void K_LoadIconGraphics(char *facestr, INT32 skinnum); void K_drawMinimap(void); // ========================================================================= diff --git a/src/r_things.c b/src/r_things.c index 5ecaf399..6f88367a 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2493,6 +2493,7 @@ static void Sk_SetDefaultValue(skin_t *skin) for (i = 0; i < sfx_skinsoundslot0; i++) if (S_sfx[i].skinsound != -1) skin->soundsid[S_sfx[i].skinsound] = i; + strncpy(skin->iconprefix, "SONICICN", 8); } // @@ -2542,6 +2543,8 @@ void R_InitSkins(void) skin->spritedef.numframes = sprites[SPR_PLAY].numframes; skin->spritedef.spriteframes = sprites[SPR_PLAY].spriteframes; ST_LoadFaceGraphics(skin->face, skin->superface, 0); + strncpy(skin->iconprefix, "SONICICN", 8); + K_LoadIconGraphics(skin->iconprefix, 0); //MD2 for sonic doesn't want to load in Linux. #ifdef HWRENDER @@ -2870,6 +2873,11 @@ void R_AddSkins(UINT16 wadnum) skin->jumpfactor = FLOAT_TO_FIXED(atof(value)); else if (!stricmp(stoken, "highresscale")) skin->highresscale = FLOAT_TO_FIXED(atof(value)); + else if (!stricmp(stoken, "faceicon")) + { + strupr(value); + strncpy(skin->iconprefix, value, sizeof skin->iconprefix); + } else { INT32 found = false; @@ -2971,6 +2979,9 @@ next_token: // add face graphics ST_LoadFaceGraphics(skin->face, skin->superface, numskins); + + // load minimap icons + K_LoadIconGraphics(skin->iconprefix, numskins); #ifdef HWRENDER if (rendermode == render_opengl) diff --git a/src/r_things.h b/src/r_things.h index 675579c8..7a9729a3 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -113,6 +113,9 @@ typedef struct // specific sounds per skin sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table + + // minimap icons + char iconprefix[9]; } skin_t; // ----------- diff --git a/src/st_stuff.c b/src/st_stuff.c index c3aee555..91fef419 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -129,6 +129,7 @@ static patch_t *gotbflag; // static boolean facefreed[MAXPLAYERS]; +boolean iconfreed[MAXPLAYERS]; hudinfo_t hudinfo[NUMHUDITEMS] = { @@ -412,7 +413,10 @@ void ST_Init(void) INT32 i; for (i = 0; i < MAXPLAYERS; i++) + { facefreed[i] = true; + iconfreed[i] = true; + } if (dedicated) return; diff --git a/src/st_stuff.h b/src/st_stuff.h index c11559d2..63bb89a1 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -70,6 +70,7 @@ extern patch_t *faceprefix[MAXSKINS]; // face status patches extern patch_t *superprefix[MAXSKINS]; // super face status patches extern patch_t *livesback; extern patch_t *ngradeletters[7]; +extern boolean iconfreed[MAXPLAYERS]; /** HUD location information (don't move this comment) */