From c54cc42e74c33678bb5a2eb5c5e25803455bdc8f Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Mon, 13 May 2019 19:53:17 +0200 Subject: [PATCH] Add command to disable followers clientside --- src/d_netcmd.c | 5 +++++ src/d_netcmd.h | 1 + src/g_game.c | 1 - src/k_kart.c | 4 ++-- src/m_menu.c | 27 +++++++++++++++------------ src/p_user.c | 6 +++--- 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a4d384d77..0b27dab98 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -282,6 +282,10 @@ consvar_t cv_follower2 = {"follower2", "-1", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Fo consvar_t cv_follower3 = {"follower3", "-1", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Follower3_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_follower4 = {"follower4", "-1", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Follower4_OnChange, 0, NULL, NULL, 0, 0, NULL}; +// Follower toggle +static CV_PossibleValue_t followers_cons_t[] = {{0, "Yours only"}, {1, "Everyone's"}, {0, NULL}}; +consvar_t cv_showfollowers = {"showfollowers", "Everyone's", CV_SAVE, followers_cons_t, 0, 0, NULL, NULL, 0, 0, NULL}; + consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; INT32 cv_debug; @@ -804,6 +808,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_playercolor); CV_RegisterVar(&cv_skin); // r_things.c (skin NAME) CV_RegisterVar(&cv_follower); + CV_RegisterVar(&cv_showfollowers); // secondary player (splitscreen) CV_RegisterVar(&cv_playername2); CV_RegisterVar(&cv_playercolor2); diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 9d2229c4d..966351181 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -22,6 +22,7 @@ extern consvar_t cv_playername; extern consvar_t cv_playercolor; extern consvar_t cv_skin; extern consvar_t cv_follower; +extern consvar_t cv_showfollowers; // secondary splitscreen player extern consvar_t cv_playername2; extern consvar_t cv_playercolor2; diff --git a/src/g_game.c b/src/g_game.c index 74e4b1906..dea7d6aa7 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -5058,7 +5058,6 @@ void G_WriteDemoExtraData(void) // write follower memset(name, 0, 16); strncpy(name, followers[players[i].followerskin].skinname, 16); - CONS_Printf("%s\n", name); M_Memcpy(demo_p, name, 16); demo_p += 16; } diff --git a/src/k_kart.c b/src/k_kart.c index bb2cbc701..1ac9fa6d7 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1739,13 +1739,13 @@ void K_PlayOvertakeSound(mobj_t *source) void K_PlayHitEmSound(mobj_t *source) { - + if (source->player->follower) { follower_t fl = followers[source->player->followerskin]; source->player->follower->movecount = fl.hitconfirmtime; // movecount is used to play the hitconfirm animation for followers. } - + if (cv_kartvoices.value) S_StartSound(source, sfx_khitem); else diff --git a/src/m_menu.c b/src/m_menu.c index e07abff9d..5437562d0 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1429,24 +1429,27 @@ enum static menuitem_t OP_HUDOptionsMenu[] = { - {IT_STRING | IT_CVAR, NULL, "Show HUD (F3)", &cv_showhud, 10}, - {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "HUD Visibility", &cv_translucenthud, 20}, - {IT_STRING | IT_SUBMENU, NULL, "Online HUD options...",&OP_ChatOptionsDef, 35}, - {IT_STRING | IT_CVAR, NULL, "Background Glass", &cons_backcolor, 45}, + {IT_STRING | IT_CVAR, NULL, "Show Followers", &cv_showfollowers, 10}, + + {IT_STRING | IT_CVAR, NULL, "Show HUD (F3)", &cv_showhud, 20}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, + NULL, "HUD Visibility", &cv_translucenthud, 30}, + + {IT_STRING | IT_SUBMENU, NULL, "Online HUD options...",&OP_ChatOptionsDef, 45}, + {IT_STRING | IT_CVAR, NULL, "Background Glass", &cons_backcolor, 55}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Minimap Visibility", &cv_kartminimap, 60}, - {IT_STRING | IT_CVAR, NULL, "Speedometer Display", &cv_kartspeedometer, 70}, - {IT_STRING | IT_CVAR, NULL, "Show \"CHECK\"", &cv_kartcheck, 80}, + NULL, "Minimap Visibility", &cv_kartminimap, 70}, + {IT_STRING | IT_CVAR, NULL, "Speedometer Display", &cv_kartspeedometer, 80}, + {IT_STRING | IT_CVAR, NULL, "Show \"CHECK\"", &cv_kartcheck, 90}, - {IT_STRING | IT_CVAR, NULL, "Menu Highlights", &cons_menuhighlight, 95}, + {IT_STRING | IT_CVAR, NULL, "Menu Highlights", &cons_menuhighlight, 105}, // highlight info - (GOOD HIGHLIGHT, WARNING HIGHLIGHT) - 105 (see M_DrawHUDOptions) - {IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120}, + {IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 130}, - {IT_STRING | IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 135}, + {IT_STRING | IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 145}, }; // Ok it's still called chatoptions but we'll put ping display in here to be clean @@ -10621,7 +10624,7 @@ static void M_DrawHUDOptions(void) const char *str1 = " Warning highlight"; const char *str2 = ","; const char *str3 = "Good highlight"; - INT32 x = BASEVIDWIDTH - currentMenu->x + 2, y = currentMenu->y + 105; + INT32 x = BASEVIDWIDTH - currentMenu->x + 2, y = currentMenu->y + 115; INT32 w0 = V_StringWidth(str0, 0), w1 = V_StringWidth(str1, 0), w2 = V_StringWidth(str2, 0), w3 = V_StringWidth(str3, 0); M_DrawGenericMenu(); diff --git a/src/p_user.c b/src/p_user.c index 8b59fd22c..756d94f95 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8171,9 +8171,9 @@ static void P_HandleFollower(player_t *player) player->follower->flags2 = (player->follower->flags2 & ~MF2_SHADOW)|(player->mo->flags2 & MF2_SHADOW); // Make the follower invisible if we no contest'd rather than removing it. No one will notice the diff seriously. - - if (player->pflags & PF_TIMEOVER) // there is more to it than that to check for a full no contest but this isn't used for anything else. - player->follower->flags2 &= MF2_DONTDRAW; + // Also make the follower invisible if we choose not to have it displayed because it isn't ours. (also quick hacky check for f12) + if (player->pflags & PF_TIMEOVER || (!cv_showfollowers.value && (!P_IsDisplayPlayer(player) || displayplayers[0] != consoleplayer) )) + player->follower->flags2 |= MF2_DONTDRAW; if (player->speed) player->follower->angle = R_PointToAngle2(0, 0, player->follower->momx, player->follower->momy);