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

Add separate toggle for tracklist #385

Merged
merged 1 commit into from
Jan 12, 2025
Merged
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
40 changes: 31 additions & 9 deletions src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@
void hdptoggle(void);
void handicap(void);
void noweapon(void);
void toggleklist(void);
void toggletracklist(void);
void tracklist(void);
void toggleklist(void);
void klist(void);
void fpslist(void);
void krnd(void);
Expand Down Expand Up @@ -821,14 +822,14 @@
{ "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 },

{ "cam", ShowCamHelp, 0, CF_SPECTATOR | CF_MATCHLESS, CD_CAM },

{ "tracklist", tracklist, 0, CF_BOTH | CF_MATCHLESS, CD_TRACKLIST },
{ "toggletracklist", toggletracklist, 0, CF_BOTH | CF_MATCHLESS, CD_TRACKLIST },
{ "fpslist", fpslist, 0, CF_BOTH | CF_MATCHLESS, CD_FPSLIST },

{ "fav1_add", DEF(favx_add), 1, CF_SPECTATOR, CD_FAV1_ADD },
Expand Down Expand Up @@ -1884,12 +1885,12 @@

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

Check warning on line 1888 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 1893 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 @@ -5088,6 +5089,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 - remember to also toggle tracklist\n", redtext("on"));
}
else
{
G_bprint(2, "klist: %s - remember to also toggle tracklist\n", redtext("off"));
}
}

void hdptoggle(void)
{
if (match_in_progress)
Expand Down Expand Up @@ -5234,7 +5256,7 @@
char *track;
char *nt = redtext(" not tracking");

if (!cvar("k_allowklist") && match_in_progress && self->ct == ctPlayer)
if (!cvar("k_allowtracklist") && match_in_progress && self->ct == ctPlayer)
{
G_sprint(self, 2, "tracklist is disabled\n");
return;
Expand All @@ -5258,24 +5280,24 @@
}
}

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

if (match_in_progress)
{
return;
}

cvar_fset("k_allowklist", k_allowklist);
cvar_fset("k_allowtracklist", k_allowtracklist);

if (k_allowklist)
if (k_allowtracklist)
{
G_bprint(2, "klist: %s\n", redtext("on"));
G_bprint(2, "tracklist: %s - remember to also toggle klist\n", redtext("on"));
}
else
{
G_bprint(2, "klist: %s\n", redtext("off"));
G_bprint(2, "tracklist: %s - remember to also toggle klist\n", redtext("off"));
}
}

Expand Down
1 change: 1 addition & 0 deletions src/world.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
{
bodyque[i] = spawn();
bodyque[i]->classname = "bodyque";
bodyque[i - 1]->s.v.owner = EDICT_TO_PROG(bodyque[i]);

Check warning on line 56 in src/world.c

View workflow job for this annotation

GitHub Actions / verify-macos

implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
}

bodyque[MAX_BODYQUE - 1]->s.v.owner = EDICT_TO_PROG(bodyque[0]);

Check warning on line 59 in src/world.c

View workflow job for this annotation

GitHub Actions / verify-macos

implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
bodyque_head = 0;
}

Expand Down Expand Up @@ -144,7 +144,7 @@
e = spawn();

e->classname = "mapguard";
e->s.v.owner = EDICT_TO_PROG(world);

Check warning on line 147 in src/world.c

View workflow job for this annotation

GitHub Actions / verify-macos

implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
e->think = (func_t) CheckDefMap;
e->s.v.nextthink = g_globalvars.time + max(0.0001, timeout);
}
Expand Down Expand Up @@ -579,7 +579,7 @@

self = spawn();
setorigin(self, -912.6f, -898.9f, 248.0f); // oh, ktpro like
self->s.v.owner = EDICT_TO_PROG(world);

Check warning on line 582 in src/world.c

View workflow job for this annotation

GitHub Actions / verify-macos

implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
SP_item_artifact_super_damage();

self = swp; // restore self
Expand Down Expand Up @@ -851,6 +851,7 @@
RegisterCvar("k_lockmax");
RegisterCvar("k_spectalk");
RegisterCvarEx("k_allowklist", "1");
RegisterCvarEx("k_allowtracklist", "1");
RegisterCvarEx("k_keepspectalkindemos", "0");
RegisterCvar("k_sayteam_to_spec");
RegisterCvar("k_dis");
Expand Down
Loading