Skip to content

Commit

Permalink
WIPEOUT: show "1on1" when only two players remain
Browse files Browse the repository at this point in the history
  • Loading branch information
dusty-qw committed Oct 24, 2023
1 parent 587680e commit d110410
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
33 changes: 32 additions & 1 deletion src/clan_arena.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ void CA_MatchBreak(void)
{
k_respawn(p, false);
}

p->ca_ready = 0; // this needs to be reset
}
}

Expand Down Expand Up @@ -762,7 +764,7 @@ void CA_check_escape(gedict_t *targ, gedict_t *attacker)
float escape_time = g_globalvars.time - targ->escape_time;
gedict_t *p;

if (escape_time > 0 && escape_time < 0.2)
if (escape_time > 0 && escape_time < 0.3)
{
for (p = world; (p = find_plr_same_team(p, getteam(targ)));)
{
Expand Down Expand Up @@ -1362,6 +1364,7 @@ void CA_Frame(void)
int e_last_alive;
char str_last_alive[5];
char str_e_last_alive[5];
char spawncount[5];

for (p = world; (p = find_plr(p));)
{
Expand Down Expand Up @@ -1397,6 +1400,33 @@ void CA_Frame(void)
}
}
}
// both you and the enemy are the last alive on your team
else if (p->in_play && p->alive_time > 2 && last_alive && e_last_alive)
{
// if teammate will spawn before or at the same time as enemy
if (last_alive != 999 && last_alive <= e_last_alive)
{
sprintf(spawncount, "%d", last_alive);
}
// if enemy spawns before teammate
else if (e_last_alive != 999 && e_last_alive < last_alive)
{
sprintf(str_e_last_alive, "%d", e_last_alive);
sprintf(spawncount, "%s", redtext(str_e_last_alive));
}
// nobody else is spawning
else
{
sprintf(spawncount, "%s", " ");
}

//sprintf(str_last_alive, "%d", last_alive);
sprintf(p->cptext, "\n\n\n\n\n\n%s\n\n\n%s\n\n\n\n",
redtext("1 on 1"), spawncount);

G_centerprint(p, "%s", p->cptext);
}
// you're the last alive on your team versus two or more enemies... hide!
else if (p->in_play && p->alive_time > 2 && last_alive)
{
sprintf(str_last_alive, "%d", last_alive);
Expand All @@ -1405,6 +1435,7 @@ void CA_Frame(void)

G_centerprint(p, "%s", p->cptext);
}
// only one enemy remains... find him!
else if (p->in_play && p->alive_time > 2 && e_last_alive)
{
sprintf(str_e_last_alive, "%d", e_last_alive);
Expand Down
2 changes: 1 addition & 1 deletion src/match.c
Original file line number Diff line number Diff line change
Expand Up @@ -2686,7 +2686,7 @@ void PlayerReady(qbool startIdlebot)
}

// do not allow empty team in team mode, because it cause problems
if ((isTeam() || isCTF()) && strnull(getteam(self)))
if ((isTeam() || isCTF() || isCA()) && strnull(getteam(self)))
{
G_sprint(self, 2, "Set your %s before ready!\n", redtext("team"));

Expand Down

0 comments on commit d110410

Please sign in to comment.