From 9fb8b97bdc806e7f73fe8cc78a5e30cc7d90eb80 Mon Sep 17 00:00:00 2001 From: themuffinator Date: Sat, 14 Sep 2024 23:51:52 +0100 Subject: [PATCH] team names --- src/g_cmds.cpp | 48 +++++++++++++++---------------- src/g_local.h | 6 ++-- src/g_main.cpp | 74 ++++++++++++++++++++++++------------------------ src/g_menu.cpp | 32 ++++++++++----------- src/g_misc.cpp | 8 +++--- src/g_spawn.cpp | 4 +-- src/g_target.cpp | 4 +-- src/g_utils.cpp | 48 +++++++++++++++---------------- src/p_client.cpp | 4 +-- src/p_hud.cpp | 36 +++++++++++------------ 10 files changed, 132 insertions(+), 132 deletions(-) diff --git a/src/g_cmds.cpp b/src/g_cmds.cpp index 72dda55..bc68fe2 100644 --- a/src/g_cmds.cpp +++ b/src/g_cmds.cpp @@ -1594,16 +1594,16 @@ team_t PickTeam(int ignore_client_num) { return TEAM_FREE; if (level.num_playing_blue > level.num_playing_red) - return TEAM_RED; + return TEAM_SOLDIERS; if (level.num_playing_red > level.num_playing_blue) - return TEAM_BLUE; + return TEAM_PREDATOR; // equal team count, so join the team with the lowest score - if (level.team_scores[TEAM_BLUE] > level.team_scores[TEAM_RED]) - return TEAM_RED; - if (level.team_scores[TEAM_RED] > level.team_scores[TEAM_BLUE]) - return TEAM_BLUE; + if (level.team_scores[TEAM_PREDATOR] > level.team_scores[TEAM_SOLDIERS]) + return TEAM_SOLDIERS; + if (level.team_scores[TEAM_SOLDIERS] > level.team_scores[TEAM_PREDATOR]) + return TEAM_PREDATOR; // equal team scores, so join team with lowest total individual scores int iscore_red = 0, iscore_blue = 0; @@ -1614,23 +1614,23 @@ team_t PickTeam(int ignore_client_num) { if (!game.clients[i].pers.connected) continue; - if (game.clients[i].sess.team == TEAM_RED) { + if (game.clients[i].sess.team == TEAM_SOLDIERS) { iscore_red += game.clients[i].resp.score; continue; } - if (game.clients[i].sess.team == TEAM_BLUE) { + if (game.clients[i].sess.team == TEAM_PREDATOR) { iscore_blue += game.clients[i].resp.score; continue; } } if (iscore_blue > iscore_red) - return TEAM_RED; + return TEAM_SOLDIERS; if (iscore_red > iscore_blue) - return TEAM_BLUE; + return TEAM_PREDATOR; // otherwise just randomly select a team - return brandom() ? TEAM_RED : TEAM_BLUE; + return brandom() ? TEAM_SOLDIERS : TEAM_PREDATOR; } /* @@ -1676,8 +1676,8 @@ void BroadcastTeamChange(gentity_t *ent, int old_team, bool inactive, bool silen t = "You are now spectating."; } break; - case TEAM_RED: - case TEAM_BLUE: + case TEAM_SOLDIERS: + case TEAM_PREDATOR: s = G_Fmt("{} joined the {} Team.\n", name, Teams_TeamName(ent->client->sess.team)).data(); t = G_Fmt("You have joined the {} Team.\n", Teams_TeamName(ent->client->sess.team)).data(); break; @@ -1721,8 +1721,8 @@ static bool AllowTeamSwitch(gentity_t *ent, team_t desired_team) { if (Teams()) { if (g_teamplay_force_balance->integer) { // We allow a spread of two - if ((desired_team == TEAM_RED && (level.num_playing_red - level.num_playing_blue > 1)) || - (desired_team == TEAM_BLUE && (level.num_playing_blue - level.num_playing_red > 1))) { + if ((desired_team == TEAM_SOLDIERS && (level.num_playing_red - level.num_playing_blue > 1)) || + (desired_team == TEAM_PREDATOR && (level.num_playing_blue - level.num_playing_red > 1))) { gi.LocClient_Print(ent, PRINT_HIGH, "{} has too many players.\n", Teams_TeamName(desired_team)); return false; // ignore the request } @@ -1796,7 +1796,7 @@ int TeamBalance(bool force) { if (delta < 2) return level.num_playing_red - level.num_playing_blue; - team_t stack_team = level.num_playing_red > level.num_playing_blue ? TEAM_RED : TEAM_BLUE; + team_t stack_team = level.num_playing_red > level.num_playing_blue ? TEAM_SOLDIERS : TEAM_PREDATOR; size_t count = 0; int index[MAX_CLIENTS_KEX/2]; @@ -1830,7 +1830,7 @@ int TeamBalance(bool force) { if (cl->sess.team != stack_team) continue; - cl->sess.team = stack_team == TEAM_RED ? TEAM_BLUE : TEAM_RED; + cl->sess.team = stack_team == TEAM_SOLDIERS ? TEAM_PREDATOR : TEAM_SOLDIERS; //TODO: queue this change in round-based games ClientRespawn(&g_entities[cl - game.clients + 1]); @@ -1871,7 +1871,7 @@ bool TeamShuffle() { // determine max team size based from active players int maxteam = ceil(level.num_playing_clients / 2); int count_red = 0, count_blue = 0; - team_t setteam = join_red ? TEAM_RED : TEAM_BLUE; + team_t setteam = join_red ? TEAM_SOLDIERS : TEAM_PREDATOR; // create random array for (size_t i = 0; i < MAX_CLIENTS_KEX; i++) { @@ -1906,18 +1906,18 @@ bool TeamShuffle() { continue; if (count_red >= maxteam || count_red > count_blue) - setteam = TEAM_BLUE; + setteam = TEAM_PREDATOR; else if (count_blue >= maxteam || count_blue > count_red) - setteam = TEAM_RED; + setteam = TEAM_SOLDIERS; ent->client->sess.team = setteam; - if (setteam == TEAM_RED) + if (setteam == TEAM_SOLDIERS) count_red++; else count_blue++; join_red ^= true; - setteam = join_red ? TEAM_RED : TEAM_BLUE; + setteam = join_red ? TEAM_SOLDIERS : TEAM_PREDATOR; } return true; @@ -2087,8 +2087,8 @@ static void Cmd_Team_f(gentity_t *ent) { case TEAM_FREE: gi.LocClient_Print(ent, PRINT_HIGH, "You are in the match.\n"); break; - case TEAM_RED: - case TEAM_BLUE: + case TEAM_SOLDIERS: + case TEAM_PREDATOR: gi.LocClient_Print(ent, PRINT_HIGH, "Your team: {}\n", Teams_TeamName(ent->client->sess.team)); break; default: diff --git a/src/g_local.h b/src/g_local.h index 80533a8..9ed1ee7 100644 --- a/src/g_local.h +++ b/src/g_local.h @@ -84,8 +84,8 @@ enum team_t { TEAM_NONE, TEAM_SPECTATOR, TEAM_FREE, - TEAM_RED, - TEAM_BLUE, + TEAM_SOLDIERS, + TEAM_PREDATOR, TEAM_NUM_TEAMS }; @@ -2333,7 +2333,7 @@ void InitItems(); void SetItemNames(); gitem_t *FindItem(const char *pickup_name); gitem_t *FindItemByClassname(const char *classname); -gentity_t *Drop_Item(gentity_t *ent, gitem_t *item); +gentity_t *Drop_Item(gentity_t *ent, gitem_t *item); void SetRespawn(gentity_t *ent, gtime_t delay, bool hide_self = true); void Change_Weapon(gentity_t *ent); bool SpawnItem(gentity_t *ent, gitem_t *item); diff --git a/src/g_main.cpp b/src/g_main.cpp index ac86b31..cd54f1d 100644 --- a/src/g_main.cpp +++ b/src/g_main.cpp @@ -575,8 +575,8 @@ static void InitGame() { level.locked[TEAM_SPECTATOR] = false; level.locked[TEAM_FREE] = false; - level.locked[TEAM_RED] = false; - level.locked[TEAM_BLUE] = false; + level.locked[TEAM_SOLDIERS] = false; + level.locked[TEAM_PREDATOR] = false; *level.weapon_count = { 0 }; @@ -815,7 +815,7 @@ void Match_Start() { level.warmup_requisite = warmupreq_t::WARMUP_REQ_NONE; level.warmup_notice_time = 0_sec; - level.team_scores[TEAM_RED] = level.team_scores[TEAM_BLUE] = 0; + level.team_scores[TEAM_SOLDIERS] = level.team_scores[TEAM_PREDATOR] = 0; level.total_player_deaths = 0; @@ -979,12 +979,12 @@ static void CheckDMRoundState(void) { for (auto ec : active_clients()) { switch (ec->client->sess.team) { - case TEAM_RED: + case TEAM_SOLDIERS: count_red++; if (!ec->client->eliminated) count_living_red++; break; - case TEAM_BLUE: + case TEAM_PREDATOR: count_blue++; if (!ec->client->eliminated) count_living_blue++; @@ -995,16 +995,16 @@ static void CheckDMRoundState(void) { // check eliminated first if (!count_living_red && count_living_blue) { int points = 1; - G_AdjustTeamScore(TEAM_BLUE, points); - gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(eliminated {})\n", Teams_TeamName(TEAM_BLUE), Teams_TeamName(TEAM_RED)); + G_AdjustTeamScore(TEAM_PREDATOR, points); + gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(eliminated {})\n", Teams_TeamName(TEAM_PREDATOR), Teams_TeamName(TEAM_SOLDIERS)); gi.positioned_sound(world->s.origin, world, CHAN_AUTO | CHAN_RELIABLE, gi.soundindex("ctf/flagcap.wav"), 1, ATTN_NONE, 0); Round_End(); return; } if (!count_living_blue && count_living_red) { int points = 1; - G_AdjustTeamScore(TEAM_RED, points); - gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(eliminated {})\n", Teams_TeamName(TEAM_RED), Teams_TeamName(TEAM_BLUE)); + G_AdjustTeamScore(TEAM_SOLDIERS, points); + gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(eliminated {})\n", Teams_TeamName(TEAM_SOLDIERS), Teams_TeamName(TEAM_PREDATOR)); gi.positioned_sound(world->s.origin, world, CHAN_AUTO | CHAN_RELIABLE, gi.soundindex("ctf/flagcap.wav"), 1, ATTN_NONE, 0); Round_End(); return; @@ -1013,12 +1013,12 @@ static void CheckDMRoundState(void) { // hit the round time limit, check any other winning conditions if (level.time >= level.round_state_timer) { if (level.num_living_red > level.num_living_blue) { - G_AdjustTeamScore(TEAM_RED, 1); - gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(players remaining: {} vs {})\n", Teams_TeamName(TEAM_RED), level.num_living_red, level.num_living_blue); + G_AdjustTeamScore(TEAM_SOLDIERS, 1); + gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(players remaining: {} vs {})\n", Teams_TeamName(TEAM_SOLDIERS), level.num_living_red, level.num_living_blue); gi.positioned_sound(world->s.origin, world, CHAN_AUTO | CHAN_RELIABLE, gi.soundindex("ctf/flagcap.wav"), 1, ATTN_NONE, 0); } else if (level.num_living_blue > level.num_living_red) { - G_AdjustTeamScore(TEAM_BLUE, 1); - gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(players remaining: {} vs {})\n", Teams_TeamName(TEAM_BLUE), level.num_living_blue, level.num_living_red); + G_AdjustTeamScore(TEAM_PREDATOR, 1); + gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(players remaining: {} vs {})\n", Teams_TeamName(TEAM_PREDATOR), level.num_living_blue, level.num_living_red); gi.positioned_sound(world->s.origin, world, CHAN_AUTO | CHAN_RELIABLE, gi.soundindex("ctf/flagcap.wav"), 1, ATTN_NONE, 0); } else { int total_health_red = 0, total_health_blue = 0; @@ -1027,22 +1027,22 @@ static void CheckDMRoundState(void) { if (ec->health <= 0) continue; switch (ec->client->sess.team) { - case TEAM_RED: + case TEAM_SOLDIERS: total_health_red += ec->health; break; - case TEAM_BLUE: + case TEAM_PREDATOR: total_health_blue += ec->health; break; } } if (total_health_red > total_health_blue) { - G_AdjustTeamScore(TEAM_RED, 1); - gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(total health: {} vs {})\n", Teams_TeamName(TEAM_RED), total_health_red, total_health_blue); + G_AdjustTeamScore(TEAM_SOLDIERS, 1); + gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(total health: {} vs {})\n", Teams_TeamName(TEAM_SOLDIERS), total_health_red, total_health_blue); gi.positioned_sound(world->s.origin, world, CHAN_AUTO | CHAN_RELIABLE, gi.soundindex("ctf/flagcap.wav"), 1, ATTN_NONE, 0); } else if (total_health_blue > total_health_red) { - G_AdjustTeamScore(TEAM_BLUE, 1); - gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(total health: {} vs {})\n", Teams_TeamName(TEAM_BLUE), total_health_blue, total_health_red); + G_AdjustTeamScore(TEAM_PREDATOR, 1); + gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(total health: {} vs {})\n", Teams_TeamName(TEAM_PREDATOR), total_health_blue, total_health_red); gi.positioned_sound(world->s.origin, world, CHAN_AUTO | CHAN_RELIABLE, gi.soundindex("ctf/flagcap.wav"), 1, ATTN_NONE, 0); } else { gi.LocBroadcast_Print(PRINT_CENTER, "Round draw!"); @@ -1429,7 +1429,7 @@ static bool ScoreIsTied(void) { return false; if (Teams()) - return level.team_scores[TEAM_RED] == level.team_scores[TEAM_BLUE]; + return level.team_scores[TEAM_SOLDIERS] == level.team_scores[TEAM_PREDATOR]; return game.clients[level.sorted_clients[0]].resp.score == game.clients[level.sorted_clients[1]].resp.score; } @@ -1545,7 +1545,7 @@ void CalculateRanks() { level.follow2 = ec->client - game.clients; if (teams) { - if (cl->sess.team == TEAM_RED) { + if (cl->sess.team == TEAM_SOLDIERS) { level.num_playing_red++; if (cl->pers.health > 0) level.num_living_red++; @@ -1568,9 +1568,9 @@ void CalculateRanks() { // in team games, rank is just the order of the teams, 0=red, 1=blue, 2=tied for (size_t i = 0; i < level.num_connected_clients; i++) { cl = &game.clients[level.sorted_clients[i]]; - if (level.team_scores[TEAM_RED] == level.team_scores[TEAM_BLUE]) { + if (level.team_scores[TEAM_SOLDIERS] == level.team_scores[TEAM_PREDATOR]) { cl->resp.rank = 2; - } else if (level.team_scores[TEAM_RED] > level.team_scores[TEAM_BLUE]) { + } else if (level.team_scores[TEAM_SOLDIERS] > level.team_scores[TEAM_PREDATOR]) { cl->resp.rank = 0; } else { cl->resp.rank = 1; @@ -2070,12 +2070,12 @@ void CheckDMExitRules() { // find the winner and broadcast it if (teams) { - if (level.team_scores[TEAM_RED] > level.team_scores[TEAM_BLUE]) { - QueueIntermission(G_Fmt("{} Team WINS with a final score of {} to {}.\n", Teams_TeamName(TEAM_RED), level.team_scores[TEAM_RED], level.team_scores[TEAM_BLUE]).data(), false, false); + if (level.team_scores[TEAM_SOLDIERS] > level.team_scores[TEAM_PREDATOR]) { + QueueIntermission(G_Fmt("{} Team WINS with a final score of {} to {}.\n", Teams_TeamName(TEAM_SOLDIERS), level.team_scores[TEAM_SOLDIERS], level.team_scores[TEAM_PREDATOR]).data(), false, false); return; } - if (level.team_scores[TEAM_BLUE] > level.team_scores[TEAM_RED]) { - QueueIntermission(G_Fmt("{} Team WINS with a final score of {} to {}.\n", Teams_TeamName(TEAM_BLUE), level.team_scores[TEAM_BLUE], level.team_scores[TEAM_RED]).data(), false, false); + if (level.team_scores[TEAM_PREDATOR] > level.team_scores[TEAM_SOLDIERS]) { + QueueIntermission(G_Fmt("{} Team WINS with a final score of {} to {}.\n", Teams_TeamName(TEAM_PREDATOR), level.team_scores[TEAM_PREDATOR], level.team_scores[TEAM_SOLDIERS]).data(), false, false); return; } } else { @@ -2091,12 +2091,12 @@ void CheckDMExitRules() { if (mercylimit->integer > 0) { if (teams) { - if (level.team_scores[TEAM_RED] >= level.team_scores[TEAM_BLUE] + mercylimit->integer) { - QueueIntermission(G_Fmt("{} hit the mercylimit ({}).", Teams_TeamName(TEAM_RED), mercylimit->integer).data(), true, false); + if (level.team_scores[TEAM_SOLDIERS] >= level.team_scores[TEAM_PREDATOR] + mercylimit->integer) { + QueueIntermission(G_Fmt("{} hit the mercylimit ({}).", Teams_TeamName(TEAM_SOLDIERS), mercylimit->integer).data(), true, false); return; } - if (level.team_scores[TEAM_BLUE] >= level.team_scores[TEAM_RED] + mercylimit->integer) { - QueueIntermission(G_Fmt("{} hit the mercylimit ({}).", Teams_TeamName(TEAM_BLUE), mercylimit->integer).data(), true, false); + if (level.team_scores[TEAM_PREDATOR] >= level.team_scores[TEAM_SOLDIERS] + mercylimit->integer) { + QueueIntermission(G_Fmt("{} hit the mercylimit ({}).", Teams_TeamName(TEAM_PREDATOR), mercylimit->integer).data(), true, false); return; } } @@ -2110,12 +2110,12 @@ void CheckDMExitRules() { if (!scorelimit) return; if (teams) { - if (level.team_scores[TEAM_RED] >= scorelimit) { - QueueIntermission(G_Fmt("{} WINS! (hit the {} limit)", Teams_TeamName(TEAM_RED), GT_ScoreLimitString()).data(), false, false); + if (level.team_scores[TEAM_SOLDIERS] >= scorelimit) { + QueueIntermission(G_Fmt("{} WINS! (hit the {} limit)", Teams_TeamName(TEAM_SOLDIERS), GT_ScoreLimitString()).data(), false, false); return; } - if (level.team_scores[TEAM_BLUE] >= scorelimit) { - QueueIntermission(G_Fmt("{} WINS! (hit the {} limit)", Teams_TeamName(TEAM_BLUE), GT_ScoreLimitString()).data(), false, false); + if (level.team_scores[TEAM_PREDATOR] >= scorelimit) { + QueueIntermission(G_Fmt("{} WINS! (hit the {} limit)", Teams_TeamName(TEAM_PREDATOR), GT_ScoreLimitString()).data(), false, false); return; } } else { @@ -2153,12 +2153,12 @@ void Teams_CalcRankings(std::array &player_ranks) { return; // we're all winners.. or losers. whatever - if (level.team_scores[TEAM_RED] == level.team_scores[TEAM_BLUE]) { + if (level.team_scores[TEAM_SOLDIERS] == level.team_scores[TEAM_PREDATOR]) { player_ranks.fill(1); return; } - team_t winning_team = (level.team_scores[TEAM_RED] > level.team_scores[TEAM_BLUE]) ? TEAM_RED : TEAM_BLUE; + team_t winning_team = (level.team_scores[TEAM_SOLDIERS] > level.team_scores[TEAM_PREDATOR]) ? TEAM_SOLDIERS : TEAM_PREDATOR; for (auto player : active_clients()) if (player->client->pers.spawned && ClientIsPlaying(player->client)) diff --git a/src/g_menu.cpp b/src/g_menu.cpp index a9babee..d7ac4a6 100644 --- a/src/g_menu.cpp +++ b/src/g_menu.cpp @@ -668,14 +668,14 @@ static void G_Menu_Join_Team_Free(gentity_t *ent, menu_hnd_t *p) { } static void G_Menu_Join_Team_Red(gentity_t *ent, menu_hnd_t *p) { - SetTeam(ent, !g_teamplay_allow_team_pick->integer ? PickTeam(-1) : TEAM_RED, false, false, false); + SetTeam(ent, !g_teamplay_allow_team_pick->integer ? PickTeam(-1) : TEAM_SOLDIERS, false, false, false); } static void G_Menu_Join_Team_Blue(gentity_t *ent, menu_hnd_t *p) { if (!g_teamplay_allow_team_pick->integer) return; - SetTeam(ent, TEAM_BLUE, false, false, false); + SetTeam(ent, TEAM_PREDATOR, false, false, false); } static void G_Menu_Join_Team_Spec(gentity_t *ent, menu_hnd_t *p) { @@ -1118,10 +1118,10 @@ static void G_Menu_Join_Update(gentity_t *ent) { case TEAM_FREE: num_free++; break; - case TEAM_RED: + case TEAM_SOLDIERS: num_red++; break; - case TEAM_BLUE: + case TEAM_PREDATOR: num_blue++; break; } @@ -1132,25 +1132,25 @@ static void G_Menu_Join_Update(gentity_t *ent) { G_Menu_SetGamemodName(entries + jmenu_gamemod); if (Teams()) { - if (!g_teamplay_allow_team_pick->integer && !level.locked[TEAM_RED] && !level.locked[TEAM_BLUE]) { + if (!g_teamplay_allow_team_pick->integer && !level.locked[TEAM_SOLDIERS] && !level.locked[TEAM_PREDATOR]) { Q_strlcpy(entries[jmenu_teams_join_red].text, G_Fmt("Join a Team ({}/{})", num_red + num_blue, pmax).data(), sizeof(entries[jmenu_teams_join_red].text)); Q_strlcpy(entries[jmenu_teams_join_blue].text, "", sizeof(entries[jmenu_teams_join_blue].text)); entries[jmenu_teams_join_red].SelectFunc = G_Menu_Join_Team_Red; entries[jmenu_teams_join_blue].SelectFunc = nullptr; } else { - if (level.locked[TEAM_RED] || level.match_state == matchst_t::MATCH_IN_PROGRESS && g_match_lock->integer) { - Q_strlcpy(entries[jmenu_teams_join_red].text, G_Fmt("{} is LOCKED during play", Teams_TeamName(TEAM_RED)).data(), sizeof(entries[jmenu_teams_join_red].text)); + if (level.locked[TEAM_SOLDIERS] || level.match_state == matchst_t::MATCH_IN_PROGRESS && g_match_lock->integer) { + Q_strlcpy(entries[jmenu_teams_join_red].text, G_Fmt("{} is LOCKED during play", Teams_TeamName(TEAM_SOLDIERS)).data(), sizeof(entries[jmenu_teams_join_red].text)); entries[jmenu_teams_join_red].SelectFunc = nullptr; } else { - Q_strlcpy(entries[jmenu_teams_join_red].text, G_Fmt("Join {} ({}/{})", Teams_TeamName(TEAM_RED), num_red, floor(pmax / 2)).data(), sizeof(entries[jmenu_teams_join_red].text)); + Q_strlcpy(entries[jmenu_teams_join_red].text, G_Fmt("Join {} ({}/{})", Teams_TeamName(TEAM_SOLDIERS), num_red, floor(pmax / 2)).data(), sizeof(entries[jmenu_teams_join_red].text)); entries[jmenu_teams_join_red].SelectFunc = G_Menu_Join_Team_Red; } - if (level.locked[TEAM_BLUE] || level.match_state == matchst_t::MATCH_IN_PROGRESS && g_match_lock->integer) { - Q_strlcpy(entries[jmenu_teams_join_blue].text, G_Fmt("{} is LOCKED during play", Teams_TeamName(TEAM_BLUE)).data(), sizeof(entries[jmenu_teams_join_blue].text)); + if (level.locked[TEAM_PREDATOR] || level.match_state == matchst_t::MATCH_IN_PROGRESS && g_match_lock->integer) { + Q_strlcpy(entries[jmenu_teams_join_blue].text, G_Fmt("{} is LOCKED during play", Teams_TeamName(TEAM_PREDATOR)).data(), sizeof(entries[jmenu_teams_join_blue].text)); entries[jmenu_teams_join_blue].SelectFunc = nullptr; } else { - Q_strlcpy(entries[jmenu_teams_join_blue].text, G_Fmt("Join {} ({}/{})", Teams_TeamName(TEAM_BLUE), num_blue, floor(pmax / 2)).data(), sizeof(entries[jmenu_teams_join_blue].text)); + Q_strlcpy(entries[jmenu_teams_join_blue].text, G_Fmt("Join {} ({}/{})", Teams_TeamName(TEAM_PREDATOR), num_blue, floor(pmax / 2)).data(), sizeof(entries[jmenu_teams_join_blue].text)); entries[jmenu_teams_join_blue].SelectFunc = G_Menu_Join_Team_Blue; } @@ -1245,21 +1245,21 @@ void G_Menu_Join_Open(gentity_t *ent) { for (auto ec : active_clients()) { switch (ec->client->sess.team) { - case TEAM_RED: + case TEAM_SOLDIERS: num_red++; break; - case TEAM_BLUE: + case TEAM_PREDATOR: num_blue++; break; } } if (num_red > num_blue) - team = TEAM_RED; + team = TEAM_SOLDIERS; else if (num_blue > num_red) - team = TEAM_BLUE; + team = TEAM_PREDATOR; else - team = brandom() ? TEAM_RED : TEAM_BLUE; + team = brandom() ? TEAM_SOLDIERS : TEAM_PREDATOR; P_Menu_Open(ent, teams_join_menu, team, sizeof(teams_join_menu) / sizeof(menu_t), nullptr, G_Menu_Join_Update); } else { diff --git a/src/g_misc.cpp b/src/g_misc.cpp index b9538a3..a8401fd 100644 --- a/src/g_misc.cpp +++ b/src/g_misc.cpp @@ -1320,7 +1320,7 @@ void SP_misc_banner(gentity_t *ent) { } /*-----------------------------------------------------------------------*/ -/*QUAKED misc_ctf_banner (1 .5 0) (-4 -64 0) (4 64 248) TEAM_BLUE x x x x x x x NOT_EASY NOT_MEDIUM NOT_HARD NOT_DM NOT_COOP +/*QUAKED misc_ctf_banner (1 .5 0) (-4 -64 0) (4 64 248) TEAM_PREDATOR x x x x x x x NOT_EASY NOT_MEDIUM NOT_HARD NOT_DM NOT_COOP The origin is the bottom of the banner. The banner is 248 tall. */ @@ -1335,7 +1335,7 @@ void SP_misc_ctf_banner(gentity_t *ent) { ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_NOT; ent->s.modelindex = gi.modelindex("models/ctf/banner/tris.md2"); - if (ent->spawnflags.has(SPAWNFLAG_CTF_BANNER_BLUE)) // TEAM_BLUE + if (ent->spawnflags.has(SPAWNFLAG_CTF_BANNER_BLUE)) // TEAM_PREDATOR ent->s.skinnum = 1; ent->s.frame = irandom(16); @@ -1345,7 +1345,7 @@ void SP_misc_ctf_banner(gentity_t *ent) { ent->nextthink = level.time + 10_hz; } -/*QUAKED misc_ctf_small_banner (1 .5 0) (-4 -32 0) (4 32 124) TEAM_BLUE x x x x x x x NOT_EASY NOT_MEDIUM NOT_HARD NOT_DM NOT_COOP +/*QUAKED misc_ctf_small_banner (1 .5 0) (-4 -32 0) (4 32 124) TEAM_PREDATOR x x x x x x x NOT_EASY NOT_MEDIUM NOT_HARD NOT_DM NOT_COOP The origin is the bottom of the banner. The banner is 124 tall. */ @@ -1353,7 +1353,7 @@ void SP_misc_ctf_small_banner(gentity_t *ent) { ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_NOT; ent->s.modelindex = gi.modelindex("models/ctf/banner/small.md2"); - if (ent->spawnflags.has(SPAWNFLAG_CTF_BANNER_BLUE)) // TEAM_BLUE + if (ent->spawnflags.has(SPAWNFLAG_CTF_BANNER_BLUE)) // TEAM_PREDATOR ent->s.skinnum = 1; ent->s.frame = irandom(16); diff --git a/src/g_spawn.cpp b/src/g_spawn.cpp index 410f1f4..de67505 100644 --- a/src/g_spawn.cpp +++ b/src/g_spawn.cpp @@ -1437,14 +1437,14 @@ static void G_LocateSpawnSpots(void) { if (!Q_strcasecmp(ent->classname + sl, "team_red")) { level.spawn_spots[n] = ent; n++; level.num_spawn_spots_team++; - ent->fteam = TEAM_RED; + ent->fteam = TEAM_SOLDIERS; ent->count = 1; // means its not initial spawn point continue; } if (!Q_strcasecmp(ent->classname + sl, "team_blue")) { level.spawn_spots[n] = ent; n++; level.num_spawn_spots_team++; - ent->fteam = TEAM_BLUE; + ent->fteam = TEAM_PREDATOR; ent->count = 1; // means its not initial spawn point continue; } diff --git a/src/g_target.cpp b/src/g_target.cpp index 527c681..94bc796 100644 --- a/src/g_target.cpp +++ b/src/g_target.cpp @@ -2366,9 +2366,9 @@ static USE(target_print_use) (gentity_t *ent, gentity_t *other, gentity_t *activ if (ent->spawnflags.has(3_spawnflag)) { if (ent->spawnflags.has(1_spawnflag)) - BroadcastTeamMessage(TEAM_RED, PRINT_CENTER, G_Fmt("{}", ent->message).data()); + BroadcastTeamMessage(TEAM_SOLDIERS, PRINT_CENTER, G_Fmt("{}", ent->message).data()); if (ent->spawnflags.has(2_spawnflag)) - BroadcastTeamMessage(TEAM_BLUE, PRINT_CENTER, G_Fmt("{}", ent->message).data()); + BroadcastTeamMessage(TEAM_PREDATOR, PRINT_CENTER, G_Fmt("{}", ent->message).data()); return; } diff --git a/src/g_utils.cpp b/src/g_utils.cpp index 1b131e6..2cc3c22 100644 --- a/src/g_utils.cpp +++ b/src/g_utils.cpp @@ -542,10 +542,10 @@ bool KillBox(gentity_t *ent, bool from_spawning, mod_id_t mod, bool bsp_clipping const char *Teams_TeamName(team_t team) { switch (team) { - case TEAM_RED: - return "RED"; - case TEAM_BLUE: - return "BLUE"; + case TEAM_SOLDIERS: + return "SOLDIERS"; + case TEAM_PREDATOR: + return "PREDATOR"; case TEAM_SPECTATOR: return "SPECTATOR"; case TEAM_FREE: @@ -556,20 +556,20 @@ const char *Teams_TeamName(team_t team) { const char *Teams_OtherTeamName(team_t team) { switch (team) { - case TEAM_RED: - return "BLUE"; - case TEAM_BLUE: - return "RED"; + case TEAM_SOLDIERS: + return "SOLDIERS"; + case TEAM_PREDATOR: + return "PREDATOR"; } return "UNKNOWN"; } team_t Teams_OtherTeam(team_t team) { switch (team) { - case TEAM_RED: - return TEAM_BLUE; - case TEAM_BLUE: - return TEAM_RED; + case TEAM_SOLDIERS: + return TEAM_PREDATOR; + case TEAM_PREDATOR: + return TEAM_SOLDIERS; } return TEAM_SPECTATOR; // invalid value } @@ -592,10 +592,10 @@ void G_AssignPlayerSkin(gentity_t *ent, const char *s) { t = "male/"; switch (ent->client->sess.team) { - case TEAM_RED: + case TEAM_SOLDIERS: t = G_Fmt("{}\\{}{}\\default", ent->client->resp.netname, t, TEAM_RED_SKIN); break; - case TEAM_BLUE: + case TEAM_PREDATOR: t = G_Fmt("{}\\{}{}\\default", ent->client->resp.netname, t, TEAM_BLUE_SKIN); break; default: @@ -665,10 +665,10 @@ void G_AdjustTeamScore(team_t team, int32_t offset) { if (!Teams()) return; - if (team == TEAM_RED) - level.team_scores[TEAM_RED] += offset; - else if (team == TEAM_BLUE) - level.team_scores[TEAM_BLUE] += offset; + if (team == TEAM_SOLDIERS) + level.team_scores[TEAM_SOLDIERS] += offset; + else if (team == TEAM_PREDATOR) + level.team_scores[TEAM_PREDATOR] += offset; else return; CalculateRanks(); } @@ -688,10 +688,10 @@ void G_SetTeamScore(team_t team, int32_t value) { if (!Teams()) return; - if (team == TEAM_RED) - level.team_scores[TEAM_RED] = value; - else if (team == TEAM_BLUE) - level.team_scores[TEAM_BLUE] = value; + if (team == TEAM_SOLDIERS) + level.team_scores[TEAM_SOLDIERS] = value; + else if (team == TEAM_PREDATOR) + level.team_scores[TEAM_PREDATOR] = value; else return; CalculateRanks(); } @@ -857,9 +857,9 @@ team_t StringToTeamNum(const char *in) { return PickTeam(-1); } else if (Teams()) { if (!Q_strcasecmp(in, "blue") || !Q_strcasecmp(in, "b")) - return TEAM_BLUE; + return TEAM_PREDATOR; else if (!Q_strcasecmp(in, "red") || !Q_strcasecmp(in, "r")) - return TEAM_RED; + return TEAM_SOLDIERS; } else { if (!Q_strcasecmp(in, "free") || !Q_strcasecmp(in, "f")) return TEAM_FREE; diff --git a/src/p_client.cpp b/src/p_client.cpp index 9adfdc5..225caa7 100644 --- a/src/p_client.cpp +++ b/src/p_client.cpp @@ -1643,10 +1643,10 @@ static gentity_t *SelectTeamSpawnPoint(gentity_t *ent, bool force_spawn) { const char *cname; switch (ent->client->sess.team) { - case TEAM_RED: + case TEAM_SOLDIERS: cname = "info_player_team_red"; break; - case TEAM_BLUE: + case TEAM_PREDATOR: cname = "info_player_team_blue"; break; default: diff --git a/src/p_hud.cpp b/src/p_hud.cpp index 8b24b4f..977941f 100644 --- a/src/p_hud.cpp +++ b/src/p_hud.cpp @@ -187,8 +187,8 @@ void G_ReportMatchDetails(bool is_end) { Teams_CalcRankings(player_ranks); gi.WriteByte(2); - gi.WriteString("RED TEAM"); - gi.WriteString("BLUE TEAM"); + gi.WriteString("HUMANS"); + gi.WriteString("PREDATOR"); } else { // sort players by score, then match everybody to // the current highest score downwards until we run out of players. @@ -242,7 +242,7 @@ void G_ReportMatchDetails(bool is_end) { gi.WriteByte(player_ranks[player->s.number - 1]); if (teams) - gi.WriteByte(player->client->sess.team == TEAM_RED ? 0 : 1); + gi.WriteByte(player->client->sess.team == TEAM_SOLDIERS ? 0 : 1); } } @@ -277,9 +277,9 @@ void TeamsScoreboardMessage(gentity_t *ent, gentity_t *killer) { cl_ent = g_entities + 1 + i; if (!cl_ent->inuse) continue; - if (game.clients[i].sess.team == TEAM_RED) + if (game.clients[i].sess.team == TEAM_SOLDIERS) team = 0; - else if (game.clients[i].sess.team == TEAM_BLUE) + else if (game.clients[i].sess.team == TEAM_PREDATOR) team = 1; else continue; // unknown team? @@ -686,7 +686,7 @@ void DeathmatchScoreboardMessage(gentity_t *ent, gentity_t *killer) { // selected player/killer tag if (cl_ent == ent) { - const char *s = cl->sess.team == TEAM_RED ? "/tags/ctf_red" : cl->sess.team == TEAM_BLUE ? "/tags/ctf_blue" : "/tags/default"; + const char *s = cl->sess.team == TEAM_SOLDIERS ? "/tags/ctf_red" : cl->sess.team == TEAM_PREDATOR ? "/tags/ctf_blue" : "/tags/default"; fmt::format_to(std::back_inserter(entry), FMT_STRING("xv {} yv {} picn {} "), x, y, s); } else if (cl_ent == killer) fmt::format_to(std::back_inserter(entry), FMT_STRING("xv {} yv {} picn {} "), x, y, "/tags/bloody"); @@ -992,9 +992,9 @@ static void SetCrosshairIDView(gentity_t *ent) { return; ent->client->ps.stats[STAT_CROSSHAIR_ID_VIEW] = (tr.ent - g_entities); - if (tr.ent->client->sess.team == TEAM_RED) + if (tr.ent->client->sess.team == TEAM_SOLDIERS) ent->client->ps.stats[STAT_CROSSHAIR_ID_VIEW_COLOR] = ii_teams_red_tiny; - else if (tr.ent->client->sess.team == TEAM_BLUE) + else if (tr.ent->client->sess.team == TEAM_PREDATOR) ent->client->ps.stats[STAT_CROSSHAIR_ID_VIEW_COLOR] = ii_teams_blue_tiny; return; } @@ -1020,9 +1020,9 @@ static void SetCrosshairIDView(gentity_t *ent) { } if (bd > 0.90f) { ent->client->ps.stats[STAT_CROSSHAIR_ID_VIEW] = (best - g_entities); - if (best->client->sess.team == TEAM_RED) + if (best->client->sess.team == TEAM_SOLDIERS) ent->client->ps.stats[STAT_CROSSHAIR_ID_VIEW_COLOR] = ii_teams_red_tiny; - else if (best->client->sess.team == TEAM_BLUE) + else if (best->client->sess.team == TEAM_PREDATOR) ent->client->ps.stats[STAT_CROSSHAIR_ID_VIEW_COLOR] = ii_teams_blue_tiny; } } @@ -1110,9 +1110,9 @@ static void SetMiniScoreStats(gentity_t *ent) { if (level.intermission_time && blink) { // blink half second // note that level.total[12] is set when we go to intermission - if (level.team_scores[TEAM_RED] > level.team_scores[TEAM_BLUE]) + if (level.team_scores[TEAM_SOLDIERS] > level.team_scores[TEAM_PREDATOR]) ent->client->ps.stats[STAT_TEAM_RED_HEADER] = 0; - else if (level.team_scores[TEAM_BLUE] > level.team_scores[TEAM_RED]) + else if (level.team_scores[TEAM_PREDATOR] > level.team_scores[TEAM_SOLDIERS]) ent->client->ps.stats[STAT_TEAM_BLUE_HEADER] = 0; else { // tie game! ent->client->ps.stats[STAT_TEAM_RED_HEADER] = 0; @@ -1125,9 +1125,9 @@ static void SetMiniScoreStats(gentity_t *ent) { if (teams) { if (level.match_state == MATCH_IN_PROGRESS) { ent->client->ps.stats[STAT_MINISCORE_FIRST_PIC] = ii_teams_red_default; - ent->client->ps.stats[STAT_MINISCORE_FIRST_SCORE] = level.team_scores[TEAM_RED]; + ent->client->ps.stats[STAT_MINISCORE_FIRST_SCORE] = level.team_scores[TEAM_SOLDIERS]; ent->client->ps.stats[STAT_MINISCORE_SECOND_PIC] = ii_teams_blue_default; - ent->client->ps.stats[STAT_MINISCORE_SECOND_SCORE] = level.team_scores[TEAM_BLUE]; + ent->client->ps.stats[STAT_MINISCORE_SECOND_SCORE] = level.team_scores[TEAM_PREDATOR]; } //TODO: configstrings?? @@ -1162,9 +1162,9 @@ static void SetMiniScoreStats(gentity_t *ent) { ent->client->ps.stats[STAT_MINISCORE_SECOND_POS] = 0; if (level.match_state == MATCH_IN_PROGRESS) { if (teams) { - if (ent->client->sess.team == TEAM_RED) + if (ent->client->sess.team == TEAM_SOLDIERS) ent->client->ps.stats[STAT_MINISCORE_FIRST_POS] = ii_highlight; - else if (ent->client->sess.team == TEAM_BLUE) + else if (ent->client->sess.team == TEAM_PREDATOR) ent->client->ps.stats[STAT_MINISCORE_SECOND_POS] = ii_highlight; } else { if (own_num >= 0) { @@ -1198,10 +1198,10 @@ void G_SetStats(gentity_t *ent) { ent->client->ps.stats[STAT_HEALTH_ICON] = level.disguise_icon; else { switch (ent->client->sess.team) { - case TEAM_RED: + case TEAM_SOLDIERS: ent->client->ps.stats[STAT_HEALTH_ICON] = ii_teams_red_default; break; - case TEAM_BLUE: + case TEAM_PREDATOR: ent->client->ps.stats[STAT_HEALTH_ICON] = ii_teams_blue_default; break; default: