Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to toggle klist/tracklist #382

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@
void Wp_Stats(float on);
void Sc_Stats(float on);
void t_jump(float j_type);
void klist(void);
void hdptoggle(void);
void handicap(void);
void noweapon(void);
void toggleklist(void);
void tracklist(void);
void klist(void);
void fpslist(void);
void krnd(void);
void agree_on_map(void);
Expand Down Expand Up @@ -819,6 +820,8 @@
{ "tkfjump", DEF(t_jump), 1, CF_BOTH_ADMIN, CD_TKFJUMP },
{ "tkrjump", DEF(t_jump), 2, CF_BOTH_ADMIN, CD_TKRJUMP },
{ "klist", klist, 0, CF_BOTH | CF_MATCHLESS, CD_KLIST },
{ "toggleklist", toggleklist, 0, CF_BOTH | CF_MATCHLESS, CD_TRACKLIST },
{ "toggletracklist", toggleklist, 0, CF_BOTH | CF_MATCHLESS, CD_TRACKLIST },
{ "hdptoggle", hdptoggle, 0, CF_BOTH_ADMIN, CD_HDPTOGGLE },
{ "handicap", handicap, 0, CF_PLAYER | CF_PARAMS | CF_MATCHLESS, CD_HANDICAP },
{ "noweapon", noweapon, 0, CF_PLAYER | CF_PARAMS | CF_SPC_ADMIN, CD_NOWEAPON },
Expand Down Expand Up @@ -1881,12 +1884,12 @@

if (floor(k_captains) == 1)
{
G_sprint(self, 2, "\2201\221 %s present\n", redtext("captain"));

Check warning on line 1887 in src/commands.c

View workflow job for this annotation

GitHub Actions / verify-msvc

decimal digit terminates octal escape sequence [D:\a\ktx\ktx\builddir\qwprogs.vcxproj]
}

if (floor(k_coaches) == 1)
{
G_sprint(self, 2, "\2201\221 %s present\n", redtext("coach"));

Check warning on line 1892 in src/commands.c

View workflow job for this annotation

GitHub Actions / verify-msvc

decimal digit terminates octal escape sequence [D:\a\ktx\ktx\builddir\qwprogs.vcxproj]
}

if (match_in_progress == 2)
Expand Down Expand Up @@ -4986,6 +4989,12 @@
gedict_t *p = world;
char *track;

if (!cvar("k_allowklist") && match_in_progress && self->ct == ctPlayer)
{
G_sprint(self, 2, "klist is disabled\n");
return;
}

for (i = 0, p = world; (p = find_plr(p)); i++)
{
if (!i)
Expand Down Expand Up @@ -5224,6 +5233,12 @@
char *track;
char *nt = redtext(" not tracking");

if (!cvar("k_allowklist") && match_in_progress && self->ct == ctPlayer)
{
G_sprint(self, 2, "tracklist is disabled\n");
return;
}

for (i = 0, p = world; (p = find_spc(p)); i++)
{
if (!i)
Expand All @@ -5242,6 +5257,27 @@
}
}

void toggleklist(void)
{
int k_allowklist = !cvar("k_allowklist");

if (match_in_progress)
{
return;
}

cvar_fset("k_allowklist", k_allowklist);

if (k_allowklist)
{
G_bprint(2, "klist: %s\n", redtext("on"));
}
else
{
G_bprint(2, "klist: %s\n", redtext("off"));
}
}

void fpslist(void)
{
int i;
Expand Down
1 change: 1 addition & 0 deletions src/world.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ void FirstFrame(void)
RegisterCvar("k_lockmin");
RegisterCvar("k_lockmax");
RegisterCvar("k_spectalk");
RegisterCvarEx("k_allowklist", "1");
RegisterCvarEx("k_keepspectalkindemos", "0");
RegisterCvar("k_sayteam_to_spec");
RegisterCvar("k_dis");
Expand Down
Loading