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

Query f_{modified,ruleset,version} on match {start,end} #377

Merged
merged 1 commit into from
Dec 12, 2024
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
32 changes: 32 additions & 0 deletions src/match.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
char *tmp;
float f1;
qbool is_real_match_end = !isHoonyModeAny() || HM_is_game_over();
qbool f_modified_done = false, f_ruleset_done = false, f_version_done = false;

if (match_over || !match_in_progress)
{
Expand Down Expand Up @@ -399,6 +400,22 @@
for (p = world; (p = find_plr(p));)
{
p->ready = 0; // force players be not ready after match is end.

if (cvar("k_on_end_f_modified") && !f_modified_done)
{
stuffcmd(p, "say f_modified\n");
f_modified_done = true;
}
if (cvar("k_on_end_f_ruleset") && !f_ruleset_done)
{
stuffcmd(p, "say f_ruleset\n");
f_ruleset_done = true;
}
if (cvar("k_on_end_f_version") && !f_version_done)
{
stuffcmd(p, "say f_version\n");
f_version_done = true;
}
}
}

Expand Down Expand Up @@ -1530,7 +1547,7 @@
if (hm_timelimit)
{
int minutes = hm_timelimit / 60;
int seconds = hm_timelimit % 60;

Check warning on line 1550 in src/match.c

View workflow job for this annotation

GitHub Actions / verify-msvc

declaration of 'seconds' hides function parameter [D:\a\ktx\ktx\builddir\qwprogs.vcxproj]

if (minutes == 0)
{
Expand Down Expand Up @@ -2784,6 +2801,21 @@
G_bprint(2, "All players ready\n");
}

if (cvar("k_on_start_f_modified"))
{
stuffcmd(self, "say f_modified\n");
}

if (cvar("k_on_start_f_ruleset"))
{
stuffcmd(self, "say f_ruleset\n");
}

if (cvar("k_on_start_f_version"))
dsvensson marked this conversation as resolved.
Show resolved Hide resolved
{
stuffcmd(self, "say f_version\n");
}

G_bprint(2, "Timer started\n");
}

Expand Down
6 changes: 6 additions & 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 @@ -795,6 +795,12 @@
RegisterCvar("k_lock_hdp");
RegisterCvar("k_disallow_weapons");
RegisterCvar("k_force_mapcycle"); // will use mapcycle even when /deathmatch 0
RegisterCvarEx("k_on_start_f_modified", "1");
RegisterCvarEx("k_on_start_f_ruleset", "1");
RegisterCvarEx("k_on_start_f_version", "1");
RegisterCvarEx("k_on_end_f_modified", "1");
RegisterCvarEx("k_on_end_f_ruleset", "1");
RegisterCvarEx("k_on_end_f_version", "1");

RegisterCvar("k_pow");
RegisterCvarEx("k_pow_q", "1"); // quad
Expand Down
Loading