Add command to disable followers clientside

This commit is contained in:
Latapostrophe 2019-05-13 19:53:17 +02:00
parent a0e27c22e7
commit c54cc42e74
6 changed files with 26 additions and 18 deletions

View file

@ -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_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}; 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}; consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
INT32 cv_debug; INT32 cv_debug;
@ -804,6 +808,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_playercolor); CV_RegisterVar(&cv_playercolor);
CV_RegisterVar(&cv_skin); // r_things.c (skin NAME) CV_RegisterVar(&cv_skin); // r_things.c (skin NAME)
CV_RegisterVar(&cv_follower); CV_RegisterVar(&cv_follower);
CV_RegisterVar(&cv_showfollowers);
// secondary player (splitscreen) // secondary player (splitscreen)
CV_RegisterVar(&cv_playername2); CV_RegisterVar(&cv_playername2);
CV_RegisterVar(&cv_playercolor2); CV_RegisterVar(&cv_playercolor2);

View file

@ -22,6 +22,7 @@ extern consvar_t cv_playername;
extern consvar_t cv_playercolor; extern consvar_t cv_playercolor;
extern consvar_t cv_skin; extern consvar_t cv_skin;
extern consvar_t cv_follower; extern consvar_t cv_follower;
extern consvar_t cv_showfollowers;
// secondary splitscreen player // secondary splitscreen player
extern consvar_t cv_playername2; extern consvar_t cv_playername2;
extern consvar_t cv_playercolor2; extern consvar_t cv_playercolor2;

View file

@ -5058,7 +5058,6 @@ void G_WriteDemoExtraData(void)
// write follower // write follower
memset(name, 0, 16); memset(name, 0, 16);
strncpy(name, followers[players[i].followerskin].skinname, 16); strncpy(name, followers[players[i].followerskin].skinname, 16);
CONS_Printf("%s\n", name);
M_Memcpy(demo_p, name, 16); M_Memcpy(demo_p, name, 16);
demo_p += 16; demo_p += 16;
} }

View file

@ -1739,13 +1739,13 @@ void K_PlayOvertakeSound(mobj_t *source)
void K_PlayHitEmSound(mobj_t *source) void K_PlayHitEmSound(mobj_t *source)
{ {
if (source->player->follower) if (source->player->follower)
{ {
follower_t fl = followers[source->player->followerskin]; follower_t fl = followers[source->player->followerskin];
source->player->follower->movecount = fl.hitconfirmtime; // movecount is used to play the hitconfirm animation for followers. source->player->follower->movecount = fl.hitconfirmtime; // movecount is used to play the hitconfirm animation for followers.
} }
if (cv_kartvoices.value) if (cv_kartvoices.value)
S_StartSound(source, sfx_khitem); S_StartSound(source, sfx_khitem);
else else

View file

@ -1429,24 +1429,27 @@ enum
static menuitem_t OP_HUDOptionsMenu[] = 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, "Show Followers", &cv_showfollowers, 10},
{IT_STRING | IT_CVAR, NULL, "Background Glass", &cons_backcolor, 45},
{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, {IT_STRING | IT_CVAR | IT_CV_SLIDER,
NULL, "Minimap Visibility", &cv_kartminimap, 60}, NULL, "Minimap Visibility", &cv_kartminimap, 70},
{IT_STRING | IT_CVAR, NULL, "Speedometer Display", &cv_kartspeedometer, 70}, {IT_STRING | IT_CVAR, NULL, "Speedometer Display", &cv_kartspeedometer, 80},
{IT_STRING | IT_CVAR, NULL, "Show \"CHECK\"", &cv_kartcheck, 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) // 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 // 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 *str1 = " Warning highlight";
const char *str2 = ","; const char *str2 = ",";
const char *str3 = "Good highlight"; 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); INT32 w0 = V_StringWidth(str0, 0), w1 = V_StringWidth(str1, 0), w2 = V_StringWidth(str2, 0), w3 = V_StringWidth(str3, 0);
M_DrawGenericMenu(); M_DrawGenericMenu();

View file

@ -8171,9 +8171,9 @@ static void P_HandleFollower(player_t *player)
player->follower->flags2 = (player->follower->flags2 & ~MF2_SHADOW)|(player->mo->flags2 & MF2_SHADOW); 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. // Make the follower invisible if we no contest'd rather than removing it. No one will notice the diff seriously.
// 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) // there is more to it than that to check for a full no contest but this isn't used for anything else. if (player->pflags & PF_TIMEOVER || (!cv_showfollowers.value && (!P_IsDisplayPlayer(player) || displayplayers[0] != consoleplayer) ))
player->follower->flags2 &= MF2_DONTDRAW; player->follower->flags2 |= MF2_DONTDRAW;
if (player->speed) if (player->speed)
player->follower->angle = R_PointToAngle2(0, 0, player->follower->momx, player->follower->momy); player->follower->angle = R_PointToAngle2(0, 0, player->follower->momx, player->follower->momy);