From d52948b8a60be7d505e4abe0bf0fd6229cdcfd50 Mon Sep 17 00:00:00 2001 From: themuffinator Date: Sat, 14 Sep 2024 23:33:15 +0100 Subject: [PATCH] remove gametype system and most of the logic --- src/bots/bot_utils.cpp | 6 - src/g_chase.cpp | 4 - src/g_cmds.cpp | 233 +-------- src/g_combat.cpp | 57 +-- src/g_ctf.cpp | 540 ------------------- src/g_items.cpp | 132 +---- src/g_local.h | 121 ----- src/g_main.cpp | 1111 +++------------------------------------- src/g_menu.cpp | 89 +--- src/g_misc.cpp | 7 +- src/g_monster.cpp | 6 +- src/g_spawn.cpp | 285 +---------- src/g_target.cpp | 12 +- src/g_trigger.cpp | 8 +- src/g_utils.cpp | 48 +- src/g_weapon.cpp | 37 +- src/p_client.cpp | 168 ++---- src/p_hud.cpp | 398 +++----------- src/p_view.cpp | 21 +- src/p_weapon.cpp | 19 +- 20 files changed, 294 insertions(+), 3008 deletions(-) diff --git a/src/bots/bot_utils.cpp b/src/bots/bot_utils.cpp index 297cbcd..80b1e3d 100644 --- a/src/bots/bot_utils.cpp +++ b/src/bots/bot_utils.cpp @@ -248,12 +248,6 @@ static void Item_UpdateState(gentity_t *item) { } } - const item_id_t itemID = item->item->id; - if (itemID == IT_FLAG_RED || itemID == IT_FLAG_BLUE) { - item->sv.ent_flags |= SVFL_IS_OBJECTIVE; - // TODO: figure out if the objective is dropped/carried/home... - } - // always need to update these for items, since random item spawning // could change them at any time... item->sv.classname = item->classname; diff --git a/src/g_chase.cpp b/src/g_chase.cpp index de6a537..46317ea 100644 --- a/src/g_chase.cpp +++ b/src/g_chase.cpp @@ -398,10 +398,6 @@ void FollowCycle(gentity_t *ent, int dir) { gclient_t *cl = ent->client; gentity_t *follow_ent = nullptr; - // if they are playing a duel game, count as a loss - if (GT(GT_DUEL) && ent->client->sess.team == TEAM_FREE) - ent->client->sess.losses++; - // first set them to spectator if (cl->sess.spectator_state == SPECTATOR_NOT && !cl->eliminated) SetTeam(ent, TEAM_SPECTATOR, false, false, false); diff --git a/src/g_cmds.cpp b/src/g_cmds.cpp index c7b68d8..72dda55 100644 --- a/src/g_cmds.cpp +++ b/src/g_cmds.cpp @@ -286,8 +286,6 @@ static void Cmd_Give_f(gentity_t *ent) { continue; if (it->flags & (IF_ARMOR | IF_POWER_ARMOR | IF_WEAPON | IF_AMMO | IF_NOT_GIVEABLE | IF_TECH)) continue; - else if (it->pickup == CTF_PickupFlag) - continue; else if ((it->flags & IF_HEALTH) && !it->use) continue; ent->client->pers.inventory[i] = (it->flags & IF_KEY) ? 8 : 1; @@ -718,10 +716,7 @@ static void Cmd_Drop_f(gentity_t *ent) { } const char *t = nullptr; - if (it->id == IT_FLAG_RED || it->id == IT_FLAG_BLUE) { - if (!(g_drop_cmds->integer & 1)) - t = "Flag"; - } else if (it->flags & IF_POWERUP) { + if (it->flags & IF_POWERUP) { if (!(g_drop_cmds->integer & 2)) t = "Powerup"; } else if (it->flags & IF_WEAPON || it->flags & IF_AMMO) { @@ -1026,32 +1021,6 @@ static void Cmd_InvDrop_f(gentity_t *ent) { ValidateSelectedItem(ent); } -/* -================= -Cmd_Forfeit_f -================= -*/ -static void Cmd_Forfeit_f(gentity_t *ent) { - if (notGT(GT_DUEL)) { - gi.LocClient_Print(ent, PRINT_HIGH, "Forfeit is only available in a duel.\n"); - return; - } - if (level.match_state < matchst_t::MATCH_IN_PROGRESS) { - gi.LocClient_Print(ent, PRINT_HIGH, "Forfeit is not available during warmup.\n"); - return; - } - if (ent->client != &game.clients[level.sorted_clients[1]]) { - gi.LocClient_Print(ent, PRINT_HIGH, "Forfeit is only available to the losing player.\n"); - return; - } - if (!g_allow_forfeit->integer) { - gi.LocClient_Print(ent, PRINT_HIGH, "Forfeits are not enabled on this server.\n"); - return; - } - - QueueIntermission(G_Fmt("{} forfeits the match.", ent->client->resp.netname).data(), true, false); -} - /* ================= Cmd_Kill_f @@ -1077,7 +1046,7 @@ static void Cmd_Kill_f(gentity_t *ent) { } // [Paril-KEX] don't allow kill to take points away in TDM - player_die(ent, ent, ent, 100000, vec3_origin, { MOD_SUICIDE, GT(GT_TDM) }); + player_die(ent, ent, ent, 100000, vec3_origin, { MOD_SUICIDE, false }); } /* @@ -1223,7 +1192,7 @@ static void PlayersList(gentity_t *ent, bool ranked) { fmt::format_to(std::back_inserter(small), FMT_STRING("{:9} {:32} {:32} {:02}:{:02} {:4} {:5} {}{}\n"), index[i], cl->pers.social_id, value, (level.time - cl->resp.entertime).milliseconds() / 60000, ((level.time - cl->resp.entertime).milliseconds() % 60000) / 1000, cl->ping, - cl->resp.score, cl->sess.duel_queued ? "QUEUE" : Teams_TeamName(cl->sess.team), cl->sess.admin ? " (admin)" : cl->sess.inactive ? " (inactive)" : ""); + cl->resp.score, Teams_TeamName(cl->sess.team), cl->sess.admin ? " (admin)" : cl->sess.inactive ? " (inactive)" : ""); if (small.length() + large.length() > MAX_IDEAL_PACKET_SIZE - 50) { // can't print all of them in one packet large += "...\n"; @@ -1637,32 +1606,29 @@ team_t PickTeam(int ignore_client_num) { return TEAM_BLUE; // equal team scores, so join team with lowest total individual scores - // skip in tdm as it's redundant - if (notGT(GT_TDM)) { - int iscore_red = 0, iscore_blue = 0; + int iscore_red = 0, iscore_blue = 0; - for (size_t i = 0; i < game.maxclients; i++) { - if (i == ignore_client_num) - continue; - if (!game.clients[i].pers.connected) - continue; + for (size_t i = 0; i < game.maxclients; i++) { + if (i == ignore_client_num) + continue; + if (!game.clients[i].pers.connected) + continue; - if (game.clients[i].sess.team == TEAM_RED) { - iscore_red += game.clients[i].resp.score; - continue; - } - if (game.clients[i].sess.team == TEAM_BLUE) { - iscore_blue += game.clients[i].resp.score; - continue; - } + if (game.clients[i].sess.team == TEAM_RED) { + iscore_red += game.clients[i].resp.score; + continue; + } + if (game.clients[i].sess.team == TEAM_BLUE) { + iscore_blue += game.clients[i].resp.score; + continue; } - - if (iscore_blue > iscore_red) - return TEAM_RED; - if (iscore_red > iscore_blue) - return TEAM_BLUE; } + if (iscore_blue > iscore_red) + return TEAM_RED; + if (iscore_red > iscore_blue) + return TEAM_BLUE; + // otherwise just randomly select a team return brandom() ? TEAM_RED : TEAM_BLUE; } @@ -1682,7 +1648,7 @@ void BroadcastTeamChange(gentity_t *ent, int old_team, bool inactive, bool silen if (!ent->client) return; - if (notGT(GT_DUEL) && ent->client->sess.team == old_team) + if (ent->client->sess.team == old_team) return; if (silent) @@ -1706,13 +1672,8 @@ void BroadcastTeamChange(gentity_t *ent, int old_team, bool inactive, bool silen s = G_Fmt("{} is inactive,\nmoved to spectators.\n", name).data(); t = "You are inactive and have been\nmoved to spectators."; } else { - if (GT(GT_DUEL) && ent->client->sess.duel_queued) { - s = G_Fmt("{} is in the queue to play.\n", name).data(); - t = "You are in the queue to play."; - } else { - s = G_Fmt("{} joined the spectators.\n", name).data(); - t = "You are now spectating."; - } + s = G_Fmt("{} joined the spectators.\n", name).data(); + t = "You are now spectating."; } break; case TEAM_RED: @@ -1746,12 +1707,7 @@ AllowTeamSwitch ================= */ static bool AllowTeamSwitch(gentity_t *ent, team_t desired_team) { - /* - if (desired_team != ent->client->sess.team && GT(GT_RR) && level.match_state == matchst_t::MATCH_IN_PROGRESS) { - gi.LocClient_Print(ent, PRINT_HIGH, "You cannot change teams during a Red Rover match.\n"); - return false; - } - */ + if (desired_team != TEAM_SPECTATOR && maxplayers->integer && level.num_playing_clients >= maxplayers->integer) { gi.LocClient_Print(ent, PRINT_HIGH, "Maximum player count has been reached.\n"); return false; // ignore the request @@ -1835,9 +1791,6 @@ int TeamBalance(bool force) { if (!Teams()) return 0; - if (GT(GT_RR)) - return 0; - int delta = abs(level.num_playing_red - level.num_playing_blue); if (delta < 2) @@ -2059,14 +2012,6 @@ bool SetTeam(gentity_t *ent, team_t desired_team, bool inactive, bool force, boo return false; } - if (GT(GT_DUEL)) { - if (desired_team != TEAM_SPECTATOR && level.num_playing_clients >= 2) { - desired_team = TEAM_SPECTATOR; - queue = true; - P_Menu_Close(ent); - } - } - if (!AllowTeamSwitch(ent, desired_team)) return false; @@ -2075,13 +2020,6 @@ bool SetTeam(gentity_t *ent, team_t desired_team, bool inactive, bool force, boo P_Menu_Close(ent); return false; } - } else { - if (GT(GT_DUEL)) { - if (desired_team == TEAM_NONE) { - desired_team = TEAM_SPECTATOR; - queue = true; - } - } } // allow the change... @@ -2092,7 +2030,6 @@ bool SetTeam(gentity_t *ent, team_t desired_team, bool inactive, bool force, boo if (ent->movetype == MOVETYPE_NOCLIP) Weapon_Grapple_DoReset(ent->client); - CTF_DeadDropFlag(ent); Tech_DeadDrop(ent); FreeFollower(ent); @@ -2107,7 +2044,6 @@ bool SetTeam(gentity_t *ent, team_t desired_team, bool inactive, bool force, boo ent->client->resp.team_delay_time = force || !ent->client->sess.initialised ? level.time : level.time + 5_sec; ent->client->sess.spectator_state = desired_team == TEAM_SPECTATOR ? SPECTATOR_FREE : SPECTATOR_NOT; ent->client->sess.spectator_client = 0; - ent->client->sess.duel_queued = queue; if (desired_team != TEAM_SPECTATOR) { if (Teams()) @@ -2124,10 +2060,6 @@ bool SetTeam(gentity_t *ent, team_t desired_team, bool inactive, bool force, boo ent->client->sess.initialised = true; - // if they are playing a duel, count as a loss - if (GT(GT_DUEL) && old_team == TEAM_FREE) - ent->client->sess.losses++; - ClientSpawn(ent); G_PostRespawn(ent); @@ -2269,75 +2201,6 @@ static void Cmd_Ghost_f(gentity_t *ent) { gi.LocClient_Print(ent, PRINT_HIGH, "Invalid ghost code.\n"); } - -static void Cmd_Stats_f(gentity_t *ent) { - if (!(GTF(GTF_CTF))) - return; - - ghost_t *g; - static std::string text; - - text.clear(); - - if (level.match_state == matchst_t::MATCH_WARMUP_READYUP) { - for (auto ec : active_clients()) { - if (!ClientIsPlaying(ec->client)) - continue; - if (ec->client->resp.ready) - continue; - - std::string_view str = G_Fmt("{} is not ready.\n", ec->client->resp.netname); - if (text.length() + str.length() < MAX_STRING_CHARS - 50) - text += str; - } - } - - uint32_t i; - for (i = 0, g = level.ghosts; i < MAX_CLIENTS_KEX; i++, g++) - if (g->ent) - break; - - if (i == MAX_CLIENTS_KEX) { - if (!text.length()) - text = "No statistics available.\n"; - - gi.Client_Print(ent, PRINT_HIGH, text.c_str()); - return; - } - - text += " #|Name |Score|Kills|Death|BasDf|CarDf|Effcy|\n"; - - for (i = 0, g = level.ghosts; i < MAX_CLIENTS_KEX; i++, g++) { - if (!*g->netname) - continue; - - int32_t e; - - if (g->deaths + g->kills == 0) - e = 50; - else - e = g->kills * 100 / (g->kills + g->deaths); - std::string_view str = G_Fmt("{:3}|{:<16.16}|{:5}|{:5}|{:5}|{:5}|{:5}|{:4}%|\n", - g->number, - g->netname, - g->score, - g->kills, - g->deaths, - g->basedef, - g->carrierdef, - e); - - if (text.length() + str.length() > MAX_STRING_CHARS - 50) { - text += "And more...\n"; - break; - } - - text += str; - } - - gi.Client_Print(ent, PRINT_HIGH, text.c_str()); -} - static void Cmd_Boot_f(gentity_t *ent) { if (gi.argc() < 2) { gi.LocClient_Print(ent, PRINT_HIGH, "Usage: {} [client name/num]\n", gi.argv(0)); @@ -2408,23 +2271,6 @@ void Vote_Pass_RestartMatch() { Match_Reset(); } -void Vote_Pass_Gametype() { - gametype_t gt = GT_IndexFromString(level.vote_arg.data()); - if (gt == GT_NONE) - return; - - ChangeGametype(gt); -} - -static bool Vote_Val_Gametype(gentity_t *ent) { - if (GT_IndexFromString(gi.argv(2)) == gametype_t::GT_NONE) { - gi.LocClient_Print(ent, PRINT_HIGH, "Invalid gametype.\n"); - return false; - } - - return true; -} - static void Vote_Pass_Ruleset() { ruleset_t rs = RS_IndexFromString(level.vote_arg.data()); if (rs == ruleset_t::RS_NONE) @@ -2571,7 +2417,6 @@ vcmds_t vote_cmds[] = { {"map", Vote_Val_Map, Vote_Pass_Map, 1, 2, "[mapname]", "changes to the specified map"}, {"nextmap", Vote_Val_None, Vote_Pass_NextMap, 2, 1, "", "move to the next map in the rotation"}, {"restart", Vote_Val_None, Vote_Pass_RestartMatch, 4, 1, "", "restarts the current match"}, - {"gametype", Vote_Val_Gametype, Vote_Pass_Gametype, 8, 2, "", "changes the current gametype"}, {"timelimit", Vote_Val_Timelimit, Vote_Pass_Timelimit, 16, 2, "<0..$>", "alters the match time limit, 0 for no time limit"}, {"scorelimit", Vote_Val_Scorelimit, Vote_Pass_Scorelimit, 32, 2, "<0..$>", "alters the match score limit, 0 for no score limit"}, {"shuffle", Vote_Val_ShuffleTeams, Vote_Pass_ShuffleTeams, 64, 2, "", "shuffles teams"}, @@ -3046,29 +2891,6 @@ static void Cmd_ForceVote_f(gentity_t *ent) { } } -/* -================= -Cmd_Gametype_f -================= -*/ -static void Cmd_Gametype_f(gentity_t *ent) { - if (!deathmatch->integer) - return; - - if (gi.argc() < 2) { - gi.LocClient_Print(ent, PRINT_HIGH, "Usage: {} \nChanges current gametype. Current gametype is {} ({}).\n", gi.argv(0), gt_long_name[g_gametype->integer], g_gametype->integer); - return; - } - - gametype_t gt = GT_IndexFromString(gi.argv(1)); - if (gt == GT_NONE) { - gi.LocClient_Print(ent, PRINT_HIGH, "Invalid gametype.\n"); - return; - } - - ChangeGametype(gt); -} - /* ================= Cmd_Ruleset_f @@ -3164,7 +2986,7 @@ static bool ReadyConditions(gentity_t *ent, bool desired_status, bool admin_cmd) switch (level.warmup_requisite) { case warmupreq_t::WARMUP_REQ_MORE_PLAYERS: { - int minp = GT(GT_DUEL) ? 2 : minplayers->integer; + int minp = minplayers->integer; int req = minp - level.num_playing_clients; gi.LocClient_Print(ent, PRINT_HIGH, "{}{} more player{} present.\n", s, req, req > 1 ? "s are" : " is"); break; @@ -3408,8 +3230,6 @@ cmds_t client_cmds[] = { {"fm", Cmd_FragMessages_f, CF_ALLOW_SPEC | CF_ALLOW_DEAD}, {"follow", Cmd_Follow_f, CF_ALLOW_SPEC | CF_ALLOW_DEAD}, {"forcevote", Cmd_ForceVote_f, CF_ADMIN_ONLY | CF_ALLOW_INT | CF_ALLOW_SPEC}, - {"forfeit", Cmd_Forfeit_f, CF_ALLOW_DEAD}, - {"gametype", Cmd_Gametype_f, CF_ADMIN_ONLY | CF_ALLOW_INT | CF_ALLOW_SPEC}, {"ghost", Cmd_Ghost_f, CF_ALLOW_DEAD | CF_ALLOW_INT | CF_ALLOW_SPEC}, {"give", Cmd_Give_f, CF_ALLOW_SPEC | CF_CHEAT_PROTECT}, {"god", Cmd_God_f, CF_ALLOW_SPEC | CF_CHEAT_PROTECT}, @@ -3458,7 +3278,6 @@ cmds_t client_cmds[] = { {"shuffle", Cmd_Shuffle_f, CF_ADMIN_ONLY | CF_ALLOW_INT | CF_ALLOW_SPEC}, {"spawn", Cmd_Spawn_f, CF_ADMIN_ONLY | CF_ALLOW_SPEC}, {"startmatch", Cmd_StartMatch_f, CF_ADMIN_ONLY | CF_ALLOW_INT | CF_ALLOW_SPEC}, - {"stats", Cmd_Stats_f, CF_ALLOW_INT | CF_ALLOW_SPEC}, {"target", Cmd_Target_f, CF_ALLOW_DEAD | CF_ALLOW_SPEC | CF_CHEAT_PROTECT}, {"team", Cmd_Team_f, CF_ALLOW_DEAD | CF_ALLOW_SPEC}, {"teleport", Cmd_Teleport_f, CF_ALLOW_SPEC | CF_CHEAT_PROTECT}, diff --git a/src/g_combat.cpp b/src/g_combat.cpp index 3c948e4..189fbed 100644 --- a/src/g_combat.cpp +++ b/src/g_combat.cpp @@ -196,7 +196,7 @@ static int CheckPowerArmor(gentity_t *ent, const vec3_t &point, const vec3_t &no damage = damage / 3; } else { if (deathmatch->integer) - damagePerCell = !!(RS(RS_MM)) ? 1 : GTF(GTF_CTF) ? 1 : 2; // power armor is weaker in DM + damagePerCell = !!(RS(RS_MM)) ? 1 : 2; else damagePerCell = 2; pa_te_type = TE_SCREEN_SPARKS; @@ -554,14 +554,9 @@ void T_Damage(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, const knockback = 200; } -/*freeze*/ - if (GT(GT_FREEZE) && client && client->eliminated) - knockback *= 2; - else -/*freeze*/ - if ((targ->flags & FL_NO_KNOCKBACK) || - ((targ->flags & FL_ALIVE_KNOCKBACK_ONLY) && (!targ->deadflag || targ->dead_time != level.time))) - knockback = 0; + if ((targ->flags & FL_NO_KNOCKBACK) || + ((targ->flags & FL_ALIVE_KNOCKBACK_ONLY) && (!targ->deadflag || targ->dead_time != level.time))) + knockback = 0; // figure momentum add if (!(dflags & DAMAGE_NO_KNOCKBACK)) { @@ -583,10 +578,6 @@ void T_Damage(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, const kvel *= g_knockback_scale->value; - // arena gives a bit more knockback - if (GTF(GTF_ARENA)) - kvel *= 1.25f; - targ->velocity += kvel; } } @@ -602,22 +593,11 @@ void T_Damage(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, const save = 0; if (!(dflags & DAMAGE_NO_PROTECTION)) { - if (IsCombatDisabled() || GT(GT_BALL)) { + if (IsCombatDisabled()) { take = 0; save = damage; } -/*freeze*/ -#if 0 - if (GT(GT_FREEZE) && playerDamage(targ, attacker, damage)) { - take = 0; - save = damage; - SpawnDamage(te_sparks, point, normal, save); - return; - } -#endif -/*freeze*/ - // instagib railgun splash never inflicts damage if (mod.id == MOD_RAILGUN_SPLASH) { take = 0; @@ -676,27 +656,17 @@ void T_Damage(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, const g_teamplay_armor_protect->integer) { psave = asave = 0; } else { - if (targ == attacker && GTF(GTF_ARENA) && !g_arena_dmg_armor->integer) { - take = 0; - save = damage; - } else { - psave = CheckPowerArmor(targ, point, normal, take, dflags); - take -= psave; + psave = CheckPowerArmor(targ, point, normal, take, dflags); + take -= psave; - asave = CheckArmor(targ, point, normal, take, te_sparks, dflags); - take -= asave; - } + asave = CheckArmor(targ, point, normal, take, te_sparks, dflags); + take -= asave; } // treat cheat/powerup savings the same as armor asave += save; if (!(dflags & DAMAGE_NO_PROTECTION)) { - if (targ == attacker && GTF(GTF_ARENA)) { - take = 0; - save = 0; // damage; - } - // check for protection powerup if (take && client && client->pu_time_protection > level.time) { gi.sound(targ, CHAN_AUX, gi.soundindex("items/protect3.wav"), 1, ATTN_NORM, 0); @@ -707,8 +677,6 @@ void T_Damage(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, const // resistance tech take = Tech_ApplyDisruptorShield(targ, take); - CTF_CheckHurtCarrier(targ, attacker); - // this option will do damage both to the armor and person. originally for DPU rounds if ((dflags & DAMAGE_DESTROY_ARMOR)) { if (!(targ->flags & FL_GODMODE) && !(dflags & DAMAGE_NO_PROTECTION) && @@ -723,7 +691,7 @@ void T_Damage(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, const stat_take = targ->health; // arena player scoring: 1 point per 100 damage dealt to opponents, capped to 0 health - if (GTF(GTF_ARENA) && !OnSameTeam(targ, attacker)) { + if (!OnSameTeam(targ, attacker)) { attacker->client->pers.dmg_scorer += stat_take + psave + asave; if (attacker->client->pers.dmg_scorer >= 100) { @@ -789,11 +757,6 @@ void T_Damage(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, const if ((targ->svflags & SVF_MONSTER) || (client)) { targ->flags |= FL_ALIVE_KNOCKBACK_ONLY; targ->dead_time = level.time; - - // don't gib in freeze tag unless thawing - if (GT(GT_FREEZE) && mod.id != MOD_THAW && targ->health <= targ->gib_health) { - targ->health = targ->gib_health + 1; - } } targ->monsterinfo.damage_blood += take; targ->monsterinfo.damage_attacker = attacker; diff --git a/src/g_ctf.cpp b/src/g_ctf.cpp index 2d67c11..e69de29 100644 --- a/src/g_ctf.cpp +++ b/src/g_ctf.cpp @@ -1,540 +0,0 @@ -// Copyright (c) ZeniMax Media Inc. -// Licensed under the GNU General Public License 2.0. -#include "g_local.h" - -constexpr int32_t CTF_CAPTURE_BONUS = 15; // what you get for capture -constexpr int32_t CTF_TEAM_BONUS = 10; // what your team gets for capture -constexpr int32_t CTF_RECOVERY_BONUS = 1; // what you get for recovery -constexpr int32_t CTF_FLAG_BONUS = 0; // what you get for picking up enemy flag -constexpr int32_t CTF_FRAG_CARRIER_BONUS = 2; // what you get for fragging enemy flag carrier -constexpr gtime_t CTF_FLAG_RETURN_TIME = 40_sec; // seconds until auto return - -constexpr int32_t CTF_CARRIER_DANGER_PROTECT_BONUS = 2; // bonus for fraggin someone who has recently hurt your flag carrier -constexpr int32_t CTF_CARRIER_PROTECT_BONUS = 1; // bonus for fraggin someone while either you or your target are near your flag carrier -constexpr int32_t CTF_FLAG_DEFENSE_BONUS = 1; // bonus for fraggin someone while either you or your target are near your flag -constexpr int32_t CTF_RETURN_FLAG_ASSIST_BONUS = 1; // awarded for returning a flag that causes a capture to happen almost immediately -constexpr int32_t CTF_FRAG_CARRIER_ASSIST_BONUS = 2; // award for fragging a flag carrier if a capture happens almost immediately - -constexpr float CTF_TARGET_PROTECT_RADIUS = 400; // the radius around an object being defended where a target will be worth extra frags -constexpr float CTF_ATTACKER_PROTECT_RADIUS = 400; // the radius around an object being defended where an attacker will get extra frags when making kills - -constexpr gtime_t CTF_CARRIER_DANGER_PROTECT_TIMEOUT = 8_sec; -constexpr gtime_t CTF_FRAG_CARRIER_ASSIST_TIMEOUT = 10_sec; -constexpr gtime_t CTF_RETURN_FLAG_ASSIST_TIMEOUT = 10_sec; - -constexpr gtime_t CTF_AUTO_FLAG_RETURN_TIMEOUT = 30_sec; // number of seconds before dropped flag auto-returns - -/* -============ -CTF_ScoreBonuses - -Calculate the bonuses for flag defense, flag carrier defense, etc. -Note that bonuses are not cumaltive. You get one, they are in importance -order. -============ -*/ -void CTF_ScoreBonuses(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker) { - item_id_t flag_item, enemy_flag_item; - team_t otherteam; - gentity_t *flag, *carrier = nullptr; - const char *c; - vec3_t v1, v2; - - if (!(GTF(GTF_CTF))) - return; - - if (targ->client && attacker->client) { - if (attacker->client->resp.ghost) - if (attacker != targ) - attacker->client->resp.ghost->kills++; - if (targ->client->resp.ghost) - targ->client->resp.ghost->deaths++; - } - - // no bonus for fragging yourself - if (!targ->client || !attacker->client || targ == attacker) - return; - - otherteam = Teams_OtherTeam(targ->client->sess.team); - if (otherteam < 0) - return; // whoever died isn't on a team - - // same team, if the flag at base, check to he has the enemy flag - if (targ->client->sess.team == TEAM_RED) { - flag_item = IT_FLAG_RED; - enemy_flag_item = IT_FLAG_BLUE; - } else { - flag_item = IT_FLAG_BLUE; - enemy_flag_item = IT_FLAG_RED; - } - - // did the attacker frag the flag carrier? - if (targ->client->pers.inventory[enemy_flag_item]) { - attacker->client->resp.ctf_lastfraggedcarrier = level.time; - G_AdjustPlayerScore(attacker->client, CTF_FRAG_CARRIER_BONUS, false, 0); - gi.LocClient_Print(attacker, PRINT_MEDIUM, "$g_bonus_enemy_carrier", - CTF_FRAG_CARRIER_BONUS); - - // the target had the flag, clear the hurt carrier - // field on the other team - for (auto ec : active_clients()) { - if (ec->inuse && ec->client->sess.team == otherteam) - ec->client->resp.ctf_lasthurtcarrier = 0_ms; - } - return; - } - - if (targ->client->resp.ctf_lasthurtcarrier && - level.time - targ->client->resp.ctf_lasthurtcarrier < CTF_CARRIER_DANGER_PROTECT_TIMEOUT && - !attacker->client->pers.inventory[flag_item]) { - // attacker is on the same team as the flag carrier and - // fragged a guy who hurt our flag carrier - G_AdjustPlayerScore(attacker->client, CTF_CARRIER_DANGER_PROTECT_BONUS, false, 0); - gi.LocBroadcast_Print(PRINT_MEDIUM, "$g_bonus_flag_defense", - attacker->client->resp.netname, - Teams_TeamName(attacker->client->sess.team)); - if (attacker->client->resp.ghost) - attacker->client->resp.ghost->carrierdef++; - return; - } - - // flag and flag carrier area defense bonuses - - // we have to find the flag and carrier entities - - // find the flag - switch (attacker->client->sess.team) { - case TEAM_RED: - c = ITEM_CTF_FLAG_RED; - break; - case TEAM_BLUE: - c = ITEM_CTF_FLAG_BLUE; - break; - default: - return; - } - - flag = nullptr; - while ((flag = G_FindByString<&gentity_t::classname>(flag, c)) != nullptr) { - if (!(flag->spawnflags & SPAWNFLAG_ITEM_DROPPED)) - break; - } - - if (!flag) - return; // can't find attacker's flag - - // find attacker's team's flag carrier - for (auto ec : active_clients()) { - if (ec->client->pers.inventory[flag_item]) { - carrier = ec; - break; - } - } - - // ok we have the attackers flag and a pointer to the carrier - - // check to see if we are defending the base's flag - v1 = targ->s.origin - flag->s.origin; - v2 = attacker->s.origin - flag->s.origin; - - if ((v1.length() < CTF_TARGET_PROTECT_RADIUS || - v2.length() < CTF_TARGET_PROTECT_RADIUS || - loc_CanSee(flag, targ) || loc_CanSee(flag, attacker)) && - attacker->client->sess.team != targ->client->sess.team) { - // we defended the base flag - G_AdjustPlayerScore(attacker->client, CTF_FLAG_DEFENSE_BONUS, false, 0); - if (flag->solid == SOLID_NOT) - gi.LocBroadcast_Print(PRINT_MEDIUM, "$g_bonus_defend_base", - attacker->client->resp.netname, - Teams_TeamName(attacker->client->sess.team)); - else - gi.LocBroadcast_Print(PRINT_MEDIUM, "$g_bonus_defend_flag", - attacker->client->resp.netname, - Teams_TeamName(attacker->client->sess.team)); - if (attacker->client->resp.ghost) - attacker->client->resp.ghost->basedef++; - return; - } - - if (carrier && carrier != attacker) { - v1 = targ->s.origin - carrier->s.origin; - v2 = attacker->s.origin - carrier->s.origin; - - if (v1.length() < CTF_ATTACKER_PROTECT_RADIUS || - v2.length() < CTF_ATTACKER_PROTECT_RADIUS || - loc_CanSee(carrier, targ) || loc_CanSee(carrier, attacker)) { - G_AdjustPlayerScore(attacker->client, CTF_CARRIER_PROTECT_BONUS, false, 0); - gi.LocBroadcast_Print(PRINT_MEDIUM, "$g_bonus_defend_carrier", - attacker->client->resp.netname, - Teams_TeamName(attacker->client->sess.team)); - if (attacker->client->resp.ghost) - attacker->client->resp.ghost->carrierdef++; - return; - } - } -} - -/* -============ -CTF_CheckHurtCarrier -============ -*/ -void CTF_CheckHurtCarrier(gentity_t *targ, gentity_t *attacker) { - if (!(GTF(GTF_CTF))) - return; - - if (!targ->client || !attacker->client) - return; - - item_id_t flag_item = targ->client->sess.team == TEAM_RED ? IT_FLAG_BLUE : IT_FLAG_RED; - - if (targ->client->pers.inventory[flag_item] && - targ->client->sess.team != attacker->client->sess.team) - attacker->client->resp.ctf_lasthurtcarrier = level.time; -} - -/* -============ -CTF_ResetTeamFlag -============ -*/ -void CTF_ResetTeamFlag(team_t team) { - if (!(GTF(GTF_CTF))) - return; - - gentity_t *ent; - const char *c = team == TEAM_RED ? ITEM_CTF_FLAG_RED : ITEM_CTF_FLAG_BLUE; - - ent = nullptr; - while ((ent = G_FindByString<&gentity_t::classname>(ent, c)) != nullptr) { - if (ent->spawnflags.has(SPAWNFLAG_ITEM_DROPPED)) - G_FreeEntity(ent); - else { - ent->svflags &= ~SVF_NOCLIENT; - ent->solid = SOLID_TRIGGER; - gi.linkentity(ent); - ent->s.event = EV_ITEM_RESPAWN; - } - } -} - -/* -============ -CTF_ResetFlags -============ -*/ -void CTF_ResetFlags() { - if (!(GTF(GTF_CTF))) - return; - - CTF_ResetTeamFlag(TEAM_RED); - CTF_ResetTeamFlag(TEAM_BLUE); -} - -/* -============ -CTF_PickupFlag -============ -*/ -bool CTF_PickupFlag(gentity_t *ent, gentity_t *other) { - if (!(GTF(GTF_CTF))) - return false; - - team_t team; - item_id_t flag_item, enemy_flag_item; - - // figure out what team this flag is - if (ent->item->id == IT_FLAG_RED) - team = TEAM_RED; - else if (ent->item->id == IT_FLAG_BLUE) - team = TEAM_BLUE; - else { - gi.LocClient_Print(other, PRINT_HIGH, "Don't know what team the flag is on, removing.\n"); - G_FreeEntity(ent); - return false; - } - - // same team, if the flag at base, check to he has the enemy flag - if (team == TEAM_RED) { - flag_item = IT_FLAG_RED; - enemy_flag_item = IT_FLAG_BLUE; - } else { - flag_item = IT_FLAG_BLUE; - enemy_flag_item = IT_FLAG_RED; - } - - if (team == other->client->sess.team) { - - if (!(ent->spawnflags & SPAWNFLAG_ITEM_DROPPED)) { - // the flag is at home base. if the player has the enemy - // flag, he's just scored a capture! - - if (other->client->pers.inventory[enemy_flag_item]) { - if (other->client->pers.team_state.flag_pickup_time) { - gi.LocBroadcast_Print(PRINT_HIGH, "{} TEAM CAPTURED the flag! ({} captured in {})\n", - Teams_TeamName(team), other->client->resp.netname, G_TimeStringMs((level.time - other->client->pers.team_state.flag_pickup_time).milliseconds(), false)); - } else { - gi.LocBroadcast_Print(PRINT_HIGH, "{} TEAM CAPTURED the flag! (captured by {})\n", - Teams_TeamName(team), other->client->resp.netname); - } - other->client->pers.inventory[enemy_flag_item] = 0; - - level.ctf_last_flag_capture = level.time; - level.ctf_last_capture_team = team; - G_AdjustTeamScore(team, GT(GT_STRIKE) ? 2 : 1); - - gi.sound(ent, CHAN_RELIABLE | CHAN_NO_PHS_ADD | CHAN_AUX, gi.soundindex("ctf/flagcap.wav"), 1, ATTN_NONE, 0); - - // other gets capture bonus - G_AdjustPlayerScore(other->client, CTF_CAPTURE_BONUS, false, 0); - if (other->client->resp.ghost) - other->client->resp.ghost->caps++; - - // Ok, let's do the player loop, hand out the bonuses - for (auto ec : active_clients()) { - if (ec->client->sess.team != other->client->sess.team) - ec->client->resp.ctf_lasthurtcarrier = -5_sec; - else if (ec->client->sess.team == other->client->sess.team) { - if (ec != other) - G_AdjustPlayerScore(ec->client, CTF_TEAM_BONUS, false, 0); - // award extra points for capture assists - if (ec->client->resp.ctf_lastreturnedflag && ec->client->resp.ctf_lastreturnedflag + CTF_RETURN_FLAG_ASSIST_TIMEOUT > level.time) { - gi.LocBroadcast_Print(PRINT_HIGH, "$g_bonus_assist_return", ec->client->resp.netname); - G_AdjustPlayerScore(ec->client, CTF_RETURN_FLAG_ASSIST_BONUS, false, 0); - } - if (ec->client->resp.ctf_lastfraggedcarrier && ec->client->resp.ctf_lastfraggedcarrier + CTF_FRAG_CARRIER_ASSIST_TIMEOUT > level.time) { - gi.LocBroadcast_Print(PRINT_HIGH, "$g_bonus_assist_frag_carrier", ec->client->resp.netname); - G_AdjustPlayerScore(ec->client, CTF_FRAG_CARRIER_ASSIST_BONUS, false, 0); - } - } - } - - CTF_ResetFlags(); - - if (GT(GT_STRIKE)) { - gi.LocBroadcast_Print(PRINT_CENTER, "Flag captured!\n{} wins the round!\n", Teams_TeamName(team)); - Round_End(); - } - - return false; - } - return false; // its at home base already - } - // hey, its not home. return it by teleporting it back - gi.LocBroadcast_Print(PRINT_HIGH, "$g_returned_flag", - other->client->resp.netname, Teams_TeamName(team)); - G_AdjustPlayerScore(other->client, CTF_RECOVERY_BONUS, false, 0); - other->client->resp.ctf_lastreturnedflag = level.time; - gi.sound(ent, CHAN_RELIABLE | CHAN_NO_PHS_ADD | CHAN_AUX, gi.soundindex("ctf/flagret.wav"), 1, ATTN_NONE, 0); - // CTF_ResetTeamFlag will remove this entity! We must return false - CTF_ResetTeamFlag((team_t)team); - return false; - } - - // capturestrike: can't pick up enemy flag if defending - if (GT(GT_STRIKE)) { - if ((level.strike_red_attacks && other->client->sess.team != TEAM_RED) || - (!level.strike_red_attacks && other->client->sess.team != TEAM_BLUE)) { - //gi.LocClient_Print(other, PRINT_CENTER, "Your team is defending!\n"); - return false; - } - } - - // hey, its not our flag, pick it up - if (!(ent->spawnflags & SPAWNFLAG_ITEM_DROPPED)) { - other->client->pers.team_state.flag_pickup_time = level.time; - } - gi.LocBroadcast_Print(PRINT_HIGH, "$g_got_flag", - other->client->resp.netname, Teams_TeamName(team)); - G_AdjustPlayerScore(other->client, CTF_FLAG_BONUS, false, 0); - if (!level.strike_flag_touch) { - G_AdjustTeamScore(other->client->sess.team, 1); - level.strike_flag_touch = true; - } - - other->client->pers.inventory[flag_item] = 1; - other->client->resp.ctf_flagsince = level.time; - - - // pick up the flag - // if it's not a dropped flag, we just make is disappear - // if it's dropped, it will be removed by the pickup caller - if (!(ent->spawnflags & SPAWNFLAG_ITEM_DROPPED)) { - ent->flags |= FL_RESPAWN; - ent->svflags |= SVF_NOCLIENT; - ent->solid = SOLID_NOT; - } - return true; -} - -/* -============ -CTF_DropFlagTouch -============ -*/ -static TOUCH(CTF_DropFlagTouch) (gentity_t *ent, gentity_t *other, const trace_t &tr, bool other_touching_self) -> void { - if (!(GTF(GTF_CTF))) - return; - - // owner (who dropped us) can't touch for two secs - if (other == ent->owner && - ent->nextthink - level.time > CTF_AUTO_FLAG_RETURN_TIMEOUT - 2_sec) - return; - - Touch_Item(ent, other, tr, other_touching_self); -} - -/* -============ -CTF_DropFlagThink -============ -*/ -static THINK(CTF_DropFlagThink) (gentity_t *ent) -> void { - if (!(GTF(GTF_CTF))) - return; - - // auto return the flag - // reset flag will remove ourselves - if (ent->item->id == IT_FLAG_RED) { - CTF_ResetTeamFlag(TEAM_RED); - gi.LocBroadcast_Print(PRINT_HIGH, "$g_flag_returned", - Teams_TeamName(TEAM_RED)); - } else if (ent->item->id == IT_FLAG_BLUE) { - CTF_ResetTeamFlag(TEAM_BLUE); - gi.LocBroadcast_Print(PRINT_HIGH, "$g_flag_returned", - Teams_TeamName(TEAM_BLUE)); - } - - gi.sound(ent, CHAN_RELIABLE | CHAN_NO_PHS_ADD | CHAN_AUX, gi.soundindex("ctf/flagret.wav"), 1, ATTN_NONE, 0); -} - -/* -============ -CTF_DeadDropFlag - -Called from PlayerDie, to drop the flag from a dying player -============ -*/ -void CTF_DeadDropFlag(gentity_t *self) { - if (!(GTF(GTF_CTF))) - return; - - gentity_t *dropped = nullptr; - - if (self->client->pers.inventory[IT_FLAG_RED]) { - dropped = Drop_Item(self, GetItemByIndex(IT_FLAG_RED)); - self->client->pers.inventory[IT_FLAG_RED] = 0; - gi.LocBroadcast_Print(PRINT_HIGH, "$g_lost_flag", - self->client->resp.netname, Teams_TeamName(TEAM_RED)); - } else if (self->client->pers.inventory[IT_FLAG_BLUE]) { - dropped = Drop_Item(self, GetItemByIndex(IT_FLAG_BLUE)); - self->client->pers.inventory[IT_FLAG_BLUE] = 0; - gi.LocBroadcast_Print(PRINT_HIGH, "$g_lost_flag", - self->client->resp.netname, Teams_TeamName(TEAM_BLUE)); - } - - self->client->pers.team_state.flag_pickup_time = 0_ms; - - if (dropped) { - dropped->think = CTF_DropFlagThink; - dropped->nextthink = level.time + CTF_AUTO_FLAG_RETURN_TIMEOUT; - dropped->touch = CTF_DropFlagTouch; - } -} - -/* -============ -CTF_DropFlag -============ -*/ -void CTF_DropFlag(gentity_t *ent, gitem_t *item) { - if (!(GTF(GTF_CTF))) - return; - - ent->client->pers.team_state.flag_pickup_time = 0_ms; - - if (brandom()) - gi.LocClient_Print(ent, PRINT_HIGH, "$g_lusers_drop_flags"); - else - gi.LocClient_Print(ent, PRINT_HIGH, "$g_winners_drop_flags"); -} - -/* -============ -CTF_FlagThink -============ -*/ -static THINK(CTF_FlagThink) (gentity_t *ent) -> void { - if (!(GTF(GTF_CTF))) - return; - - if (ent->solid != SOLID_NOT) - ent->s.frame = 173 + (((ent->s.frame - 173) + 1) % 16); - ent->nextthink = level.time + 10_hz; -} - -/* -============ -CTF_FlagSetup -============ -*/ -THINK(CTF_FlagSetup) (gentity_t *ent) -> void { - if (!(GTF(GTF_CTF))) - return; - - trace_t tr; - vec3_t dest; - - ent->mins = { -15, -15, -15 }; - ent->maxs = { 15, 15, 15 }; - - if (ent->model) - gi.setmodel(ent, ent->model); - else - gi.setmodel(ent, ent->item->world_model); - ent->solid = SOLID_TRIGGER; - ent->movetype = MOVETYPE_TOSS; - ent->touch = Touch_Item; - ent->s.frame = 173; - - dest = ent->s.origin + vec3_t{ 0, 0, -128 }; - - tr = gi.trace(ent->s.origin, ent->mins, ent->maxs, dest, ent, MASK_SOLID); - if (tr.startsolid) { - gi.Com_PrintFmt("{}: {} startsolid\n", __FUNCTION__, *ent); - G_FreeEntity(ent); - return; - } - - ent->s.origin = tr.endpos; - - gi.linkentity(ent); - - ent->nextthink = level.time + 10_hz; - ent->think = CTF_FlagThink; -} - -/* -============ -CTF_ClientEffects -============ -*/ -void CTF_ClientEffects(gentity_t *player) { - if (!(GTF(GTF_CTF))) - return; - - player->s.effects &= ~(EF_FLAG_RED | EF_FLAG_BLUE); - if (player->health > 0) { - if (player->client->pers.inventory[IT_FLAG_RED]) - player->s.effects |= EF_FLAG_RED; - if (player->client->pers.inventory[IT_FLAG_BLUE]) - player->s.effects |= EF_FLAG_BLUE; - } - - if (player->client->pers.inventory[IT_FLAG_RED]) - player->s.modelindex3 = mi_ctf_red_flag; - else if (player->client->pers.inventory[IT_FLAG_BLUE]) - player->s.modelindex3 = mi_ctf_blue_flag; - else - player->s.modelindex3 = 0; -} diff --git a/src/g_items.cpp b/src/g_items.cpp index fe27a94..bbb3e9c 100644 --- a/src/g_items.cpp +++ b/src/g_items.cpp @@ -980,10 +980,7 @@ static void Tech_Spawn(gitem_t *item, gentity_t *spot) { } static bool AllowTechs() { - if (!strcmp(g_allow_techs->string, "auto")) - return !!(GT(GT_CTF) && !g_instagib->integer && !g_nadefest->integer && notGT(GT_BALL)); - else - return !!(g_allow_techs->integer && ItemSpawnsEnabled()); + return !!(g_allow_techs->integer && ItemSpawnsEnabled()); } static THINK(Tech_SpawnAll) (gentity_t *ent) -> void { @@ -1104,7 +1101,7 @@ void Tech_ApplyAutoDoc(gentity_t *ent) { int index; float volume = 1.0; bool mod = g_instagib->integer || g_nadefest->integer; - bool no_health = mod || GTF(GTF_ARENA) || g_no_health->integer; + bool no_health = mod || g_no_health->integer; int max = g_vampiric_damage->integer ? ceil(g_vampiric_health_max->integer/2) : mod ? 100 : 150; cl = ent->client; @@ -1249,7 +1246,7 @@ static inline item_flags_t GetSubstituteItemFlags(item_id_t id) { static inline item_id_t FindSubstituteItem(gentity_t *ent) { // never replace flags - if (ent->item->id == IT_FLAG_RED || ent->item->id == IT_FLAG_BLUE || ent->item->id == IT_TAG_TOKEN) + if (ent->item->id == IT_TAG_TOKEN) return IT_NULL; // never replace meaty goodness @@ -1400,32 +1397,28 @@ THINK(RespawnItem) (gentity_t *ent) -> void { // in ctf, when we are weapons stay, only the master of a team of weapons // is spawned - if (GT(GT_CTF) && g_dm_weapons_stay->integer && master->item && (master->item->flags & IF_WEAPON)) - ent = master; - else { - int current_index = 0; + int current_index = 0; - ent->svflags |= SVF_NOCLIENT; - ent->solid = SOLID_NOT; - gi.linkentity(ent); + ent->svflags |= SVF_NOCLIENT; + ent->solid = SOLID_NOT; + gi.linkentity(ent); - for (count = 0, ent = master; ent; ent = ent->chain, count++) { - // reset spawn timers on all teamed entities - ent->nextthink = 0_sec; - if (ent == current) - current_index = count; - } + for (count = 0, ent = master; ent; ent = ent->chain, count++) { + // reset spawn timers on all teamed entities + ent->nextthink = 0_sec; + if (ent == current) + current_index = count; + } - if (RS(RS_MM)) { - choice = (current_index + 1) % count; - //gi.Com_PrintFmt("ci={} co={} ch={}\n", current_index, count, choice); - for (count = 0, ent = master; count < choice; ent = ent->chain, count++) - ; - } else { - choice = irandom(count); - for (count = 0, ent = master; count < choice; ent = ent->chain, count++) - ; - } + if (RS(RS_MM)) { + choice = (current_index + 1) % count; + //gi.Com_PrintFmt("ci={} co={} ch={}\n", current_index, count, choice); + for (count = 0, ent = master; count < choice; ent = ent->chain, count++) + ; + } else { + choice = irandom(count); + for (count = 0, ent = master; count < choice; ent = ent->chain, count++) + ; } } @@ -1495,10 +1488,6 @@ void SetRespawn(gentity_t *ent, gtime_t delay, bool hide_self) { ent->nextthink = level.time + delay + t; - // 4x longer delay in horde - if (GT(GT_HORDE)) - ent->nextthink += delay*3; - ent->think = RespawnItem; } @@ -2133,7 +2122,7 @@ void Powerup_ApplyRegeneration(gentity_t *ent) { gclient_t *cl; float volume = 1.0; bool mod = g_instagib->integer || g_nadefest->integer; - bool no_health = mod || GTF(GTF_ARENA) || g_no_health->integer; + bool no_health = mod || g_no_health->integer; cl = ent->client; if (!cl) @@ -2421,9 +2410,6 @@ static bool Pickup_Health(gentity_t *ent, gentity_t *other) { other->health += count; - if (GTF(GTF_CTF) && other->health > max && count > 25) - other->health = max; - if (!(health_flags & HEALTH_IGNORE_MAX)) if (other->health > other->max_health) other->health = other->max_health; @@ -3059,11 +3045,6 @@ bool CheckItemEnabled(gitem_t *item) { cv = gi.cvar(G_Fmt("disable_{}", item->classname).data(), "0", CVAR_NOFLAGS); if (cv->integer) return false; - // Don't spawn the flags unless enabled - if (!(GTF(GTF_CTF)) && (item->id == IT_FLAG_RED || item->id == IT_FLAG_BLUE)) { - return false; - } - if (!ItemSpawnsEnabled()) { if (item->flags & (IF_ARMOR | IF_POWER_ARMOR | IF_TIMED | IF_POWERUP | IF_SPHERE | IF_HEALTH | IF_AMMO | IF_WEAPON)) return false; @@ -3094,9 +3075,6 @@ bool CheckItemEnabled(gitem_t *item) { if (subtract) return false; - if (GT(GT_BALL) && item->id != IT_BALL) - return false; - if (!add) { if (g_no_armor->integer && item->flags & (IF_ARMOR | IF_POWER_ARMOR)) return false; @@ -3283,10 +3261,6 @@ bool SpawnItem(gentity_t *ent, gitem_t *item) { if (ent->spawnflags.has(SPAWNFLAG_ITEM_TRIGGER_SPAWN)) SetTriggeredSpawn(ent); - // flags are server animated and have special handling - if (item->id == IT_FLAG_RED || item->id == IT_FLAG_BLUE) - ent->think = CTF_FlagSetup; - if (item->flags & IF_WEAPON && item->id >= FIRST_WEAPON && item->id <= LAST_WEAPON) level.weapon_count[item->id - FIRST_WEAPON]++; @@ -5541,66 +5515,6 @@ model="models/items/mega_h/tris.md2" /* tag */ HEALTH_IGNORE_MAX | HEALTH_TIMED }, -/*QUAKED item_flag_team_red (1 0.2 0) (-16 -16 -24) (16 16 32) TRIGGER_SPAWN x x SUSPENDED x x x x NOT_EASY NOT_MEDIUM NOT_HARD NOT_DM NOT_COOP -Red Flag for CTF. --------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY -------- -model="players/male/flag1.md2" -*/ - { - /* id */ IT_FLAG_RED, - /* classname */ ITEM_CTF_FLAG_RED, - /* pickup */ CTF_PickupFlag, - /* use */ nullptr, - /* drop */ CTF_DropFlag, //Should this be null if we don't want players to drop it manually? - /* weaponthink */ nullptr, - /* pickup_sound */ "ctf/flagtk.wav", - /* world_model */ "players/male/flag1.md2", - /* world_model_flags */ EF_FLAG_RED, - /* view_model */ nullptr, - /* icon */ "i_ctf1", - /* use_name */ "Red Flag", - /* pickup_name */ "$item_red_flag", - /* pickup_name_definite */ "$item_red_flag_def", - /* quantity */ 0, - /* ammo */ IT_NULL, - /* chain */ IT_NULL, - /* flags */ IF_NONE, - /* vwep_model */ nullptr, - /* armor_info */ nullptr, - /* tag */ 0, - /* precaches */ "ctf/flagcap.wav" - }, - -/*QUAKED item_flag_team_blue (1 0.2 0) (-16 -16 -24) (16 16 32) TRIGGER_SPAWN x x SUSPENDED x x x x NOT_EASY NOT_MEDIUM NOT_HARD NOT_DM NOT_COOP -Blue Flag for CTF. --------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY -------- -model="players/male/flag2.md2" -*/ - { - /* id */ IT_FLAG_BLUE, - /* classname */ ITEM_CTF_FLAG_BLUE, - /* pickup */ CTF_PickupFlag, - /* use */ nullptr, - /* drop */ CTF_DropFlag, - /* weaponthink */ nullptr, - /* pickup_sound */ "ctf/flagtk.wav", - /* world_model */ "players/male/flag2.md2", - /* world_model_flags */ EF_FLAG_BLUE, - /* view_model */ nullptr, - /* icon */ "i_ctf2", - /* use_name */ "Blue Flag", - /* pickup_name */ "$item_blue_flag", - /* pickup_name_definite */ "$item_blue_flag_def", - /* quantity */ 0, - /* ammo */ IT_NULL, - /* chain */ IT_NULL, - /* flags */ IF_NONE, - /* vwep_model */ nullptr, - /* armor_info */ nullptr, - /* tag */ 0, - /* precaches */ "ctf/flagcap.wav" - }, - /* Disruptor Shield Tech */ { /* id */ IT_TECH_DISRUPTOR_SHIELD, diff --git a/src/g_local.h b/src/g_local.h index 931780c..80533a8 100644 --- a/src/g_local.h +++ b/src/g_local.h @@ -89,85 +89,6 @@ enum team_t { TEAM_NUM_TEAMS }; -enum gametype_t { - GT_NONE, - GT_FFA, - GT_DUEL, - GT_TDM, - GT_CTF, - GT_CA, - GT_FREEZE, - GT_STRIKE, - GT_RR, - GT_LMS, - GT_HORDE, - GT_RACE, - GT_BALL, - GT_NUM_GAMETYPES -}; -constexpr gametype_t GT_FIRST = GT_FFA; -constexpr gametype_t GT_LAST = GT_BALL; - -enum gtf_t { - GTF_TEAMS = 0x01, - GTF_CTF = 0x02, - GTF_ARENA = 0x04, - GTF_ROUNDS = 0x08, - GTF_ELIMINATION = 0x10, -}; - -extern int _gt[GT_NUM_GAMETYPES]; - -#define GTF( x ) _gt[g_gametype->integer] & (x) -#define GT( x ) g_gametype->integer == (int)(x) -#define notGT( x ) g_gametype->integer != (int)(x) - -constexpr const char *gt_short_name[GT_NUM_GAMETYPES] = { - "cmp", - "ffa", - "duel", - "tdm", - "ctf", - "ca", - "ft", - "strike", - "rr", - "lms", - "horde", - "race", - "ball" -}; -constexpr const char *gt_short_name_upper[GT_NUM_GAMETYPES] = { - "CMP", - "FFA", - "DUEL", - "TDM", - "CTF", - "CA", - "FT", - "STRIKE", - "REDROVER", - "LMS", - "HORDE", - "RACE", - "BALL", -}; -constexpr const char *gt_long_name[GT_NUM_GAMETYPES] = { - "Campaign", - "Deathmatch", - "Duel", - "Team Deathmatch", - "Capture the Flag", - "Clan Arena", - "Freeze Tag", - "CaptureStrike", - "Red Rover", - "Last Man Standing", - "Horde Mode", - "Race", - "ProBall" -}; - enum monflags_t { MF_NONE = 0x00, MF_GROUND = 0x01, @@ -239,7 +160,6 @@ struct vcmds_t { extern vcmds_t vote_cmds[]; extern int ii_highlight; -extern int ii_duel_header; extern int ii_teams_red_default; extern int ii_teams_blue_default; extern int ii_ctf_red_dropped; @@ -1090,9 +1010,6 @@ enum item_id_t : int32_t { IT_HEALTH_LARGE, IT_HEALTH_MEGA, - IT_FLAG_RED, - IT_FLAG_BLUE, - IT_TECH_DISRUPTOR_SHIELD, IT_TECH_POWER_AMP, IT_TECH_TIME_ACCEL, @@ -1126,9 +1043,6 @@ constexpr int LAST_WEAPON = IT_WEAPON_DISRUPTOR; constexpr item_id_t tech_ids[] = { IT_TECH_DISRUPTOR_SHIELD, IT_TECH_POWER_AMP, IT_TECH_TIME_ACCEL, IT_TECH_AUTODOC }; -constexpr const char *ITEM_CTF_FLAG_RED = "item_flag_team_red"; -constexpr const char *ITEM_CTF_FLAG_BLUE = "item_flag_team_blue"; - struct gitem_t { item_id_t id; // matches item list index const char *classname; // spawning name @@ -1310,7 +1224,6 @@ struct game_locals_t { std::vector mapqueue; - gametype_t gametype; std::string motd; int motd_modcount = 0; @@ -1488,7 +1401,6 @@ struct level_locals_t { gtime_t next_match_report; char gamemod_name[64]; - char gametype_name[64]; //voting gclient_t *vote_client; @@ -1562,10 +1474,6 @@ struct level_locals_t { bool strike_turn_red; bool strike_turn_blue; - gtime_t horde_monster_spawn_time; - int8_t horde_num_monsters_to_spawn; - bool horde_all_spawned; - char author[MAX_QPATH]; char author2[MAX_QPATH]; @@ -2177,7 +2085,6 @@ extern cvar_t *hostname; extern cvar_t *deathmatch; extern cvar_t *ctf; extern cvar_t *teamplay; -extern cvar_t *g_gametype; extern cvar_t *coop; @@ -2320,7 +2227,6 @@ extern cvar_t *g_no_nukes; extern cvar_t *g_no_powerups; extern cvar_t *g_no_spheres; extern cvar_t *g_owner_auto_join; -extern cvar_t *g_gametype_cfg; extern cvar_t *g_quadhog; extern cvar_t *g_quick_weapon_switch; extern cvar_t *g_rollangle; @@ -2393,7 +2299,6 @@ void VoteCommandStore(gentity_t *ent); vcmds_t *FindVoteCmdByName(const char *name); void Vote_Pass_Map(); void Vote_Pass_RestartMatch(); -void Vote_Pass_Gametype(); void Vote_Pass_NextMap(); void Vote_Pass_ShuffleTeams(); void Vote_Pass_Cointoss(); @@ -2493,7 +2398,6 @@ const char *Teams_OtherTeamName(team_t team); team_t Teams_OtherTeam(team_t team); bool Teams(); void G_AdjustPlayerScore(gclient_t *cl, int32_t offset, bool adjust_team, int32_t team_offset); -void Horde_AdjustPlayerScore(gclient_t *cl, int32_t offset); void G_SetPlayerScore(gclient_t *cl, int32_t value); void G_AdjustTeamScore(team_t team, int32_t offset); void G_SetTeamScore(team_t team, int32_t value); @@ -2508,7 +2412,6 @@ void BroadcastTeamMessage(team_t team, print_type_t level, const char *msg); team_t StringToTeamNum(const char *in); bool IsCombatDisabled(); bool IsPickupsDisabled(); -gametype_t GT_IndexFromString(const char *in); bool IsScoringDisabled(); void BroadcastReadyReminderMessage(); void TeleportPlayerToRandomSpawnPoint(gentity_t *ent, bool fx); @@ -2523,8 +2426,6 @@ void MS_Adjust(gclient_t *cl, mstats_t index, int count); // void ED_CallSpawn(gentity_t *ent); char *ED_NewString(char *string); -void GT_SetLongName(void); -void GT_PrecacheAssets(); // // g_target.cpp @@ -2858,20 +2759,6 @@ struct select_spawn_result_t { select_spawn_result_t SelectDeathmatchSpawnPoint(gentity_t *ent, vec3_t avoid_point, playerspawn_t mode, bool force_spawn, bool fallback_to_ctf_or_start, bool intermission, bool initial); void G_PostRespawn(gentity_t *self); -// -// g_ctf.cpp -// -bool CTF_PickupFlag(gentity_t *ent, gentity_t *other); -void CTF_DropFlag(gentity_t *ent, gitem_t *item); -void CTF_ClientEffects(gentity_t *player); -void CTF_DeadDropFlag(gentity_t *self); -void CTF_FlagSetup(gentity_t *ent); -void CTF_ResetTeamFlag(team_t team); -void CTF_ResetFlags(); -void CTF_ScoreBonuses(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker); -void CTF_CheckHurtCarrier(gentity_t *targ, gentity_t *attacker); - - // // g_menu.cpp // @@ -2999,8 +2886,6 @@ int MQ_Count(); bool MQ_Add(gentity_t *ent, const char *mapname); gentity_t *CreateTargetChangeLevel(const char *map); bool InAMatch(); -void ChangeGametype(gametype_t gt); -void GT_Changes(); void SpawnEntities(const char *mapname, const char *entities, const char *spawnpoint); void G_LoadMOTD(); @@ -3268,10 +3153,6 @@ struct client_session_t { bool inactive; gtime_t inactivity_time; bool inactivity_warning; - - // duel stats - bool duel_queued; - int wins, losses; }; // client data that stays across deathmatch respawns @@ -3779,8 +3660,6 @@ struct gentity_t { // in g_save.cpp too! //muff - const char *gametype; - const char *not_gametype; const char *notteam; const char *notfree; const char *notq2; diff --git a/src/g_main.cpp b/src/g_main.cpp index efcce96..ac86b31 100644 --- a/src/g_main.cpp +++ b/src/g_main.cpp @@ -36,7 +36,6 @@ cvar_t *hostname; cvar_t *deathmatch; cvar_t *ctf; cvar_t *teamplay; -cvar_t *g_gametype; cvar_t *coop; @@ -150,7 +149,6 @@ cvar_t *g_grapple_fly_speed; cvar_t *g_grapple_offhand; cvar_t *g_grapple_pull_speed; cvar_t *g_gravity; -cvar_t *g_horde_starting_wave; cvar_t *g_huntercam; cvar_t *g_inactivity; cvar_t *g_infinite_ammo; @@ -179,7 +177,6 @@ cvar_t *g_no_nukes; cvar_t *g_no_powerups; cvar_t *g_no_spheres; cvar_t *g_owner_auto_join; -cvar_t *g_gametype_cfg; cvar_t *g_quadhog; cvar_t *g_quick_weapon_switch; cvar_t *g_rollangle; @@ -217,7 +214,6 @@ cvar_t *bot_name_prefix; static cvar_t *g_frames_per_frame; -int ii_duel_header; int ii_highlight; int ii_ctf_red_dropped; int ii_ctf_blue_dropped; @@ -248,301 +244,8 @@ void InitSave(); #include -int _gt[] = { - /* GT_NONE */ 0, - /* GT_FFA */ 0, - /* GT_DUEL */ 0, - /* GT_TDM */ GTF_TEAMS, - /* GT_CTF */ GTF_TEAMS | GTF_CTF, - /* GT_CA */ GTF_TEAMS | GTF_ARENA | GTF_ROUNDS | GTF_ELIMINATION, - /* GT_FREEZE */ GTF_TEAMS | GTF_ELIMINATION, - /* GT_STRIKE */ GTF_TEAMS | GTF_ARENA | GTF_ROUNDS | GTF_CTF | GTF_ELIMINATION, - /* GT_RR */ GTF_TEAMS | GTF_ROUNDS | GTF_ARENA, - /* GT_LMS */ GTF_ELIMINATION, - /* GT_HORDE */ GTF_ROUNDS, - /* GT_RACE */ GTF_ARENA, - /* GT_BALL */ 0 -}; - // ================================================= -static gentity_t *FindClosestPlayerToPoint(vec3_t point) { - float bestplayerdistance; - vec3_t v; - float playerdistance; - gentity_t *closest = nullptr; - - bestplayerdistance = 9999999; - - for (auto ec : active_clients()) { - if (ec->health <= 0 || ec->client->eliminated) - continue; - - v = point - ec->s.origin; - playerdistance = v.length(); - - if (playerdistance < bestplayerdistance) { - bestplayerdistance = playerdistance; - closest = ec; - } - } - - return closest; -} - -struct weighted_item_t; - -using weight_adjust_func_t = void(*)(const weighted_item_t &item, float &weight); - -void adjust_weight_health(const weighted_item_t &item, float &weight); -void adjust_weight_weapon(const weighted_item_t &item, float &weight); -void adjust_weight_ammo(const weighted_item_t &item, float &weight); -void adjust_weight_armor(const weighted_item_t &item, float &weight); - -constexpr struct weighted_item_t { - const char *classname; - int32_t min_level = -1, max_level = -1; - float weight = 1.0f; - float lvl_w_adjust = 0; - int flags; - item_id_t item[4]; - weight_adjust_func_t adjust_weight = nullptr; -} items[] = { - { "item_health_small" }, - - { "item_health", -1, -1, 1.0f, 0, 0, { IT_NULL }, adjust_weight_health }, - { "item_health_large", -1, -1, 0.85f, 0, 0, { IT_NULL }, adjust_weight_health }, - - { "item_armor_shard" }, - { "item_armor_jacket", -1, 4, 0.65f, 0, 0, { IT_NULL }, adjust_weight_armor }, - { "item_armor_combat", 2, -1, 0.62f, 0, 0, { IT_NULL }, adjust_weight_armor }, - { "item_armor_body", 4, -1, 0.35f, 0, 0, { IT_NULL }, adjust_weight_armor }, - - { "weapon_shotgun", -1, -1, 0.98f, 0, 0, { IT_NULL }, adjust_weight_weapon }, - { "weapon_supershotgun", 2, -1, 1.02f, 0, 0, { IT_NULL }, adjust_weight_weapon }, - { "weapon_machinegun", -1, -1, 1.05f, 0, 0, { IT_NULL }, adjust_weight_weapon }, - { "weapon_chaingun", 3, -1, 1.01f, 0, 0, { IT_NULL }, adjust_weight_weapon }, - { "weapon_grenadelauncher", 4, -1, 0.75f, 0, 0, { IT_NULL }, adjust_weight_weapon }, - - { "ammo_shells", -1, -1, 1.25f, 0, 0, { IT_NULL }, adjust_weight_ammo }, - { "ammo_bullets", -1, -1, 1.25f, 0, 0, { IT_NULL }, adjust_weight_ammo }, - { "ammo_grenades", 2, -1, 1.25f, 0, 0, { IT_NULL }, adjust_weight_ammo }, -}; - -void adjust_weight_health(const weighted_item_t &item, float &weight) {} - -void adjust_weight_weapon(const weighted_item_t &item, float &weight) {} - -void adjust_weight_ammo(const weighted_item_t &item, float &weight) {} - -void adjust_weight_armor(const weighted_item_t &item, float &weight) {} - -// classname, min_level, max_level, weight, lvl_w_adjust, flags, items -constexpr weighted_item_t monsters[] = { - { "monster_soldier_light", -1, 7, 1.50f, -0.45f, MF_GROUND, { IT_HEALTH_SMALL } }, - { "monster_soldier", -1, 7, 0.85f, -0.25f, MF_GROUND, { IT_AMMO_BULLETS_SMALL, IT_HEALTH_SMALL } }, - { "monster_soldier_ss", 2, 7, 1.01f, -0.125f, MF_GROUND, { IT_AMMO_SHELLS_SMALL, IT_HEALTH_SMALL } }, - { "monster_soldier_hypergun", 2, 9, 1.2f, 0.15f, MF_GROUND, { IT_AMMO_CELLS_SMALL, IT_HEALTH_SMALL } }, - { "monster_soldier_lasergun", 3, 9, 1.15f, 0.2f, MF_GROUND, { IT_AMMO_CELLS_SMALL, IT_HEALTH_SMALL } }, - { "monster_soldier_ripper", 3, 9, 1.25f, 0.25f, MF_GROUND, { IT_AMMO_CELLS_SMALL, IT_HEALTH_SMALL } }, - { "monster_infantry", 3, 16, 1.05f, 0.125f, MF_GROUND, { IT_AMMO_BULLETS_SMALL, IT_AMMO_BULLETS } }, - { "monster_gunner", 4, 16, 1.08f, 0.5f, MF_GROUND, { IT_AMMO_GRENADES, IT_AMMO_BULLETS_SMALL } }, - { "monster_berserk", 4, 16, 1.05f, 0.1f, MF_GROUND, { IT_ARMOR_SHARD } }, - //{ "monster_flipper", 4, 8, 0.85f, -0.15f, MF_WATER, { IT_NULL } }, - { "monster_parasite", 5, 16, 1.04f, -0.08f, MF_GROUND, { IT_NULL } }, - { "monster_gladiator", 5, 16, 1.07f, 0.3f, MF_GROUND, { IT_AMMO_SLUGS } }, - { "monster_gekk", 6, 16, 0.99f, -0.15f, MF_GROUND | MF_WATER, { IT_NULL } }, - { "monster_brain", 6, 16, 0.95f, 0, MF_GROUND, { IT_AMMO_CELLS_SMALL } }, - { "monster_flyer", 6, 16, 0.92f, 0.15f, MF_GROUND | MF_AIR, { IT_AMMO_CELLS_SMALL } }, - { "monster_floater", 7, 16, 0.9f, 0, MF_GROUND | MF_AIR, { IT_NULL } }, - { "monster_mutant", 7, 16, 0.85f, 0, MF_GROUND, { IT_NULL } }, - { "monster_hover", 8, 16, 0.8f, 0, MF_GROUND | MF_AIR, { IT_NULL } }, - { "monster_guncmdr", 8, -1, 0, 0.125f, MF_GROUND | MF_MEDIUM, { IT_AMMO_GRENADES, IT_AMMO_BULLETS_SMALL, IT_AMMO_BULLETS, IT_AMMO_CELLS_SMALL } }, - { "monster_chick", 9, 20, 1.01f, -0.05f, MF_GROUND, { IT_AMMO_ROCKETS_SMALL, IT_AMMO_ROCKETS } }, - { "monster_daedalus", 9, -1, 0.99f, 0.05f, MF_GROUND | MF_AIR, { IT_AMMO_CELLS_SMALL } }, - { "monster_medic", 10, 16, 0.95f, -0.05f, MF_GROUND, { IT_HEALTH_SMALL, IT_HEALTH_MEDIUM } }, - { "monster_tank", 11, -1, 0.85f, 0, MF_GROUND | MF_MEDIUM, { IT_AMMO_ROCKETS } }, - { "monster_chick_heat", 12, -1, 0.87f, 0.065f, MF_GROUND, { IT_AMMO_CELLS_SMALL, IT_AMMO_CELLS } }, - { "monster_tank_commander", 12, -1, 0.45f, 0.16f, MF_GROUND | MF_MEDIUM, { IT_AMMO_ROCKETS_SMALL, IT_AMMO_BULLETS_SMALL, IT_AMMO_ROCKETS, IT_AMMO_BULLETS } }, - { "monster_medic_commander", 13, -1, 0.4f, 0.15f, MF_GROUND | MF_MEDIUM, { IT_AMMO_CELLS_SMALL, IT_HEALTH_MEDIUM, IT_HEALTH_LARGE } }, - { "monster_kamikaze", 13, -1, 0.85f, 0.04f, MF_GROUND | MF_AIR, { IT_NULL } }, - /* - { "monster_boss2", 0, 0, 0, 0, MF_GROUND | MF_BOSS, { IT_HEALTH_MEGA, IT_AMMO_BULLETS_LARGE, IT_AMMO_ROCKETS } }, // hornet - { "monster_jorg", 0, 0, 0, 0, MF_GROUND | MF_BOSS, { IT_HEALTH_MEGA, IT_AMMO_CELLS_LARGE } }, - { "monster_makron", 0, 0, 0, 0, MF_GROUND | MF_BOSS, { IT_HEALTH_MEGA, IT_AMMO_CELLS_LARGE } }, - { "monster_guardian", 0, 0, 0, 0, MF_GROUND | MF_BOSS, { IT_HEALTH_MEGA } }, - { "monster_arachnid", 0, 0, 0, 0, MF_GROUND | MF_BOSS, { IT_HEALTH_MEGA } }, - { "monster_boss5", 0, 0, 0, 0, MF_GROUND | MF_BOSS, { IT_HEALTH_MEGA, IT_AMMO_BULLETS_LARGE, IT_AMMO_CELLS, IT_AMMO_GRENADES } }, // super tank - { "monster_carrier", 0, 0, 0, 0, MF_GROUND | MF_BOSS, { IT_AMMO_BULLETS_LARGE, IT_AMMO_SLUGS, IT_AMMO_GRENADES, IT_POWERUPS_QUAD } }, - { "monster_widow", 0, 0, 0, 0, MF_GROUND | MF_BOSS, { IT_HEALTH_MEGA, IT_AMMO_ROUNDS, IT_POWERUPS_QUAD } }, - { "monster_widow2", 0, 0, 0, 0, MF_GROUND | MF_BOSS, { IT_HEALTH_MEGA, IT_AMMO_ROUNDS, IT_POWERUPS_QUAD } }, - */ -}; - -struct picked_item_t { - const weighted_item_t *item; - float weight; -}; - -static gitem_t *Horde_PickItem() { - // collect valid items - static std::array picked_items; - static size_t num_picked_items; - - num_picked_items = 0; - - float total_weight = 0; - - for (auto &item : items) { - if (item.min_level != -1 && level.round_number < item.min_level) - continue; - if (item.max_level != -1 && level.round_number > item.max_level) - continue; - - float weight = item.weight + ((level.round_number - item.min_level) * item.lvl_w_adjust); - - if (item.adjust_weight) - item.adjust_weight(item, weight); - - if (weight <= 0) - continue; - - total_weight += weight; - picked_items[num_picked_items++] = { &item, total_weight }; - } - - if (!total_weight) - return nullptr; - - float r = frandom() * total_weight; - - for (size_t i = 0; i < num_picked_items; i++) - if (r < picked_items[i].weight) - return FindItemByClassname(picked_items[i].item->classname); - - return nullptr; -} - -static const char *Horde_PickMonster() { - // collect valid monsters - static std::array picked_monsters; - static size_t num_picked_monsters; - - num_picked_monsters = 0; - - float total_weight = 0; - - for (auto &monster : monsters) { - if (monster.min_level != -1 && level.round_number < monster.min_level) - continue; - if (monster.max_level != -1 && level.round_number > monster.max_level) - continue; - - float weight = monster.weight + ((level.round_number - monster.min_level) * monster.lvl_w_adjust); - - if (monster.adjust_weight) - monster.adjust_weight(monster, weight); - - if (weight <= 0) - continue; - - total_weight += weight; - picked_monsters[num_picked_monsters++] = { &monster, total_weight }; - } - - if (!total_weight) - return nullptr; - - float r = frandom() * total_weight; - - for (size_t i = 0; i < num_picked_monsters; i++) - if (r < picked_monsters[i].weight) - return picked_monsters[i].item->classname; - - return nullptr; -} - -static void Horde_RunSpawning() { - if (notGT(GT_HORDE)) - return; - - bool warmup = level.match_state == MATCH_WARMUP_DEFAULT || level.match_state == MATCH_WARMUP_READYUP; - - if (!warmup && level.round_state != ROUND_IN_PROGRESS) - return; - - if (warmup && (level.total_monsters - level.killed_monsters >= 30)) - return; - - if (level.horde_all_spawned) - return; - - if (level.horde_monster_spawn_time <= level.time) { - gentity_t *e = G_Spawn(); - e->classname = Horde_PickMonster(); - select_spawn_result_t result = SelectDeathmatchSpawnPoint(nullptr, vec3_origin, SPAWN_FARTHEST, false, true, false, false); - - if (result.any_valid) { - e->s.origin = result.spot->s.origin; - e->s.angles = result.spot->s.angles; - - e->item = Horde_PickItem(); - ED_CallSpawn(e); - level.horde_monster_spawn_time = warmup ? level.time + 5_sec : level.time + random_time(0.3_sec, 0.5_sec); - - e->enemy = FindClosestPlayerToPoint(e->s.origin); - if (e->enemy) - FoundTarget(e); - - if (!warmup) { - level.horde_num_monsters_to_spawn--; - - if (!level.horde_num_monsters_to_spawn) { - //gi.LocBroadcast_Print(PRINT_CENTER, "All monsters spawned.\nClean up time!"); - level.horde_all_spawned = true; - } - } - } else - level.horde_monster_spawn_time = warmup ? level.time + 5_sec : level.time + 1_sec; - } -} - -static void Horde_Init() { - // this crashes the game -/* - if (notGT(GT_HORDE)) - return; - - // precache all items - for (auto &item : itemlist) - PrecacheItem(&item); - - // all monsters too - for (auto &monster : monsters) { - gentity_t *e = G_Spawn(); - e->classname = monster.classname; - ED_CallSpawn(e); - G_FreeEntity(e); - } - */ -} - -static bool Horde_AllMonstersDead() { - for (size_t i = 0; i < globals.max_entities; i++) { - if (!g_entities[i].inuse) - continue; - else if (g_entities[i].svflags & SVF_MONSTER) { - if (!g_entities[i].deadflag && g_entities[i].health > 0) - return false; - } - } - - return true; -} - -// ================================================= - - void G_LoadMOTD() { // load up ent override const char *name = G_Fmt("baseq2/{}", g_motd_filename->string[0] ? g_motd_filename->string : "motd.txt").data(); @@ -600,205 +303,6 @@ static void CheckRuleset() { gi.LocBroadcast_Print(PRINT_HIGH, "Ruleset: {}\n", rs_long_name[(int)game.ruleset]); } -static void InitGametype() { - constexpr const char *COOP = "coop"; - bool force_dm = false; - - if (g_gametype->integer < 0 || g_gametype->integer >= GT_NUM_GAMETYPES) - gi.cvar_forceset("g_gametype", G_Fmt("{}", clamp(g_gametype->integer, (int)GT_FIRST, (int)GT_LAST)).data()); - - if (ctf->integer) { - force_dm = true; - // force coop off - if (coop->integer) - gi.cvar_set(COOP, "0"); - // force tdm off - if (teamplay->integer) - gi.cvar_set("teamplay", "0"); - } - if (teamplay->integer) { - force_dm = true; - // force coop off - if (coop->integer) - gi.cvar_set(COOP, "0"); - } - - if (force_dm && !deathmatch->integer) { - gi.Com_Print("Forcing deathmatch.\n"); - gi.cvar_forceset("deathmatch", "1"); - } - - // force even maxplayers value during teamplay - if (Teams()) { - int pmax = maxplayers->integer; - - if (pmax != floor(pmax / 2)) - gi.cvar_set("maxplayers", G_Fmt("{}", floor(pmax / 2) * 2).data()); - } -} - -void ChangeGametype(gametype_t gt) { - switch (gt) { - case gametype_t::GT_CTF: - if (!ctf->integer) - gi.cvar_forceset("ctf", "1"); - break; - case gametype_t::GT_TDM: - if (!teamplay->integer) - gi.cvar_forceset("teamplay", "1"); - break; - default: - if (ctf->integer) - gi.cvar_forceset("ctf", "0"); - if (teamplay->integer) - gi.cvar_forceset("teamplay", "0"); - break; - } - - if (!deathmatch->integer) { - gi.Com_Print("Forcing deathmatch.\n"); - gi.cvar_forceset("deathmatch", "1"); - } - - if ((int)gt != g_gametype->integer) - gi.cvar_forceset("g_gametype", G_Fmt("{}", (int)gt).data()); -} - -int gt_teamplay = 0; -int gt_ctf = 0; -int gt_g_gametype = 0; -bool gt_teams_on = false; -gametype_t gt_check = GT_NONE; -void GT_Changes() { - if (!deathmatch->integer) - return; - - // do these checks only once level has initialised - if (!level.init) - return; - - bool changed = false, team_reset = false; - gametype_t gt = gametype_t::GT_NONE; - - if (gt_g_gametype != g_gametype->modified_count) { - gt = (gametype_t)clamp(g_gametype->integer, (int)GT_FIRST, (int)GT_LAST); - - if (gt != gt_check) { - switch (gt) { - case gametype_t::GT_TDM: - if (!teamplay->integer) - gi.cvar_forceset("teamplay", "1"); - break; - case gametype_t::GT_CTF: - if (!ctf->integer) - gi.cvar_forceset("ctf", "1"); - break; - default: - if (teamplay->integer) - gi.cvar_forceset("teamplay", "0"); - if (ctf->integer) - gi.cvar_forceset("ctf", "0"); - break; - } - gt_teamplay = teamplay->modified_count; - gt_ctf = ctf->modified_count; - changed = true; - } - } - - if (!changed) { - if (gt_teamplay != teamplay->modified_count) { - if (teamplay->integer) { - gt = gametype_t::GT_TDM; - if (!teamplay->integer) - gi.cvar_forceset("teamplay", "1"); - if (ctf->integer) - gi.cvar_forceset("ctf", "0"); - } else { - gt = gametype_t::GT_FFA; - if (teamplay->integer) - gi.cvar_forceset("teamplay", "0"); - if (ctf->integer) - gi.cvar_forceset("ctf", "0"); - } - changed = true; - gt_teamplay = teamplay->modified_count; - gt_ctf = ctf->modified_count; - } - if (gt_ctf != ctf->modified_count) { - if (ctf->integer) { - gt = gametype_t::GT_CTF; - if (teamplay->integer) - gi.cvar_forceset("teamplay", "0"); - if (!ctf->integer) - gi.cvar_forceset("ctf", "1"); - } else { - gt = gametype_t::GT_TDM; - if (!teamplay->integer) - gi.cvar_forceset("teamplay", "1"); - if (ctf->integer) - gi.cvar_forceset("ctf", "0"); - } - changed = true; - gt_teamplay = teamplay->modified_count; - gt_ctf = ctf->modified_count; - } - } - - if (!changed || gt == gametype_t::GT_NONE) - return; - - //gi.Com_PrintFmt("GAMETYPE = {}\n", (int)gt); - - if (gt_teams_on != Teams()) { - team_reset = true; - gt_teams_on = Teams(); - } - - if (team_reset) { - // move all to spectator first - for (auto ec : active_clients()) { - SetIntermissionPoint(); - - ec->s.origin = level.intermission_origin; - ec->client->ps.pmove.origin = level.intermission_origin; - ec->client->ps.viewangles = level.intermission_angle; - - ec->client->awaiting_respawn = true; - ec->client->ps.pmove.pm_type = PM_FREEZE; - ec->client->ps.rdflags = RDF_NONE; - ec->deadflag = false; - ec->solid = SOLID_NOT; - ec->movetype = MOVETYPE_FREECAM; - ec->s.modelindex = 0; - ec->svflags |= SVF_NOCLIENT; - gi.linkentity(ec); - } - - // set to team and reset match - for (auto ec : active_clients()) { - if (!ClientIsPlaying(ec->client)) - continue; - SetTeam(ec, PickTeam(-1), false, false, true); - } - } - - if ((int)gt != gt_check) { - gi.cvar_forceset("g_gametype", G_Fmt("{}", (int)gt).data()); - gt_g_gametype = g_gametype->modified_count; - gt_check = (gametype_t)g_gametype->integer; - } else return; - - //TODO: save ent string so we can simply reload it and Match_Reset - //gi.AddCommandString("map_restart"); - - gi.AddCommandString(G_Fmt("gamemap {}\n", level.mapname).data()); - - GT_PrecacheAssets(); - GT_SetLongName(); - gi.LocBroadcast_Print(PRINT_CENTER, "{}", level.gametype_name); -} - /* ============ PreInitGame @@ -816,9 +320,7 @@ static void PreInitGame() { deathmatch = gi.cvar("deathmatch", "1", CVAR_LATCH); teamplay = gi.cvar("teamplay", "0", CVAR_SERVERINFO); ctf = gi.cvar("ctf", "0", CVAR_SERVERINFO); - g_gametype = gi.cvar("g_gametype", G_Fmt("{}", (int)GT_FFA).data(), CVAR_SERVERINFO); coop = gi.cvar("coop", "0", CVAR_LATCH); - InitGametype(); } /* @@ -851,8 +353,6 @@ static void InitGame() { g_stopspeed = gi.cvar("g_stopspeed", "100", CVAR_NOFLAGS); - g_horde_starting_wave = gi.cvar("g_horde_starting_wave", "1", CVAR_SERVERINFO | CVAR_LATCH); - g_huntercam = gi.cvar("g_huntercam", "1", CVAR_SERVERINFO | CVAR_LATCH); g_dm_strong_mines = gi.cvar("g_dm_strong_mines", "0", CVAR_NOFLAGS); g_dm_random_items = gi.cvar("g_dm_random_items", "0", CVAR_NOFLAGS); @@ -861,7 +361,6 @@ static void InitGame() { g_instagib = gi.cvar("g_instagib", "0", CVAR_SERVERINFO | CVAR_LATCH); g_instagib_splash = gi.cvar("g_instagib_splash", "0", CVAR_NOFLAGS); g_owner_auto_join = gi.cvar("g_owner_auto_join", "1", CVAR_NOFLAGS); - g_gametype_cfg = gi.cvar("g_gametype_cfg", "1", CVAR_NOFLAGS); g_quadhog = gi.cvar("g_quadhog", "0", CVAR_SERVERINFO | CVAR_LATCH); g_nadefest = gi.cvar("g_nadefest", "0", CVAR_SERVERINFO | CVAR_LATCH); g_frenzy = gi.cvar("g_frenzy", "0", CVAR_SERVERINFO | CVAR_LATCH); @@ -1086,22 +585,11 @@ static void InitGame() { level.total_player_deaths = 0; - gt_teamplay = teamplay->modified_count; - gt_ctf = ctf->modified_count; - gt_g_gametype = g_gametype->modified_count; - gt_teams_on = Teams(); - - Horde_Init(); - G_LoadMOTD(); if (g_dm_exec_level_cfg->integer) gi.AddCommandString(G_Fmt("exec {}\n", level.mapname).data()); - if (g_gametype_cfg->integer && deathmatch->integer) { - //gi.Com_PrintFmt("exec gt-{}.cfg\n", gt_short_name_upper[g_gametype->integer]); - gi.AddCommandString(G_Fmt("exec gt-{}.cfg\n", gt_short_name_upper[g_gametype->integer]).data()); - } } //=================================================================== @@ -1165,32 +653,6 @@ static void Entities_ItemTeams_Reset() { for (count = 0, ent = master; count < choice; ent = ent->chain, count++) ; } - /* - for (ent = g_entities + 1, i = 1; i < globals.num_entities; i++, ent++) { - if (!ent->inuse) - continue; - - if (!ent->team) - continue; - - if (!ent->item) - continue; - - ent->flags &= ~FL_TEAMSLAVE; - ent->chain = ent->teamchain; - ent->teamchain = nullptr; - - ent->svflags |= SVF_NOCLIENT; - ent->solid = SOLID_NOT; - - if (ent == ent->teammaster) { - ent->nextthink = level.time + 10_hz; - if (!ent->think) - ent->think = RespawnItem; - } else - ent->nextthink = 0_sec; - } - */ } /* @@ -1243,7 +705,6 @@ static void Entities_Reset(bool reset_players, bool reset_ghost, bool reset_scor // reset the level items Tech_Reset(); - CTF_ResetFlags(); Monsters_KillAll(); @@ -1263,10 +724,6 @@ static void Entities_Reset(bool reset_players, bool reset_ghost, bool reset_scor } else if ((ent->svflags & SVF_PROJECTILE) || (ent->clipmask & CONTENTS_PROJECTILECLIP)) { G_FreeEntity(ent); } else if (ent->item) { - // already processed in CTF_ResetFlags() - if (ent->item->id == IT_FLAG_RED || ent->item->id == IT_FLAG_BLUE) - continue; - if (ent->spawnflags.has(SPAWNFLAG_ITEM_DROPPED | SPAWNFLAG_ITEM_DROPPED_PLAYER)) { //G_FreeEntity(ent); ent->nextthink = level.time; @@ -1303,113 +760,20 @@ static void Entities_Reset(bool reset_players, bool reset_ghost, bool reset_scor } } } -#if 0 -static int SortRoundScores(const void *a, const void *b) { - gclient_t *ca, *cb; - - ca = &game.clients[*(int *)a]; - cb = &game.clients[*(int *)b]; - - // sort special clients last - if (ca->sess.spectator_client < 0) - return 1; - if (cb->sess.spectator_client < 0) - return -1; - - // then connecting clients - if (!ca->pers.connected) - return 1; - if (!cb->pers.connected) - return -1; - - // then spectators - if (!ClientIsPlaying(ca) && !ClientIsPlaying(cb)) { - if (ca->sess.duel_queued && cb->sess.duel_queued) { - if (ca->resp.team_join_time > cb->resp.team_join_time) - return -1; - if (ca->resp.team_join_time < cb->resp.team_join_time) - return 1; - } - if (ca->sess.duel_queued) - return -1; - if (cb->sess.duel_queued) - return 1; - if (ca->resp.team_join_time > cb->resp.team_join_time) - return -1; - if (ca->resp.team_join_time < cb->resp.team_join_time) - return 1; - return 0; - } - if (!ClientIsPlaying(ca)) - return 1; - if (!ClientIsPlaying(cb)) - return -1; - - // then sort by score - if (ca->resp.score - ca->resp.old_score > cb->resp.score - cb->resp.old_score) - return -1; - if (ca->resp.score - ca->resp.old_score < cb->resp.score - cb->resp.old_score) - return 1; - - return 0; -} -gclient_t *Round_SaveOldPlayerScore() { - gclient_t *cl = nullptr; - int high = 0; - for (auto ec : active_clients()) { - - ec->client->resp.old_score = ec->client->resp.score; - } -} -#endif /* ============= Round_StartNew ============= */ static bool Round_StartNew() { - if (!(GTF(GTF_ROUNDS))) { - level.round_state = roundst_t::ROUND_NONE; - level.round_state_timer = 0_sec; - return false; - } - - bool horde = GT(GT_HORDE); - level.round_state = roundst_t::ROUND_COUNTDOWN; level.round_state_timer = level.time + gtime_t::from_sec(g_round_countdown->integer); level.countdown_check = 0_sec; - if (!horde) - Entities_Reset(!horde, false, false); - - if (GT(GT_STRIKE)) { - level.strike_red_attacks ^= true; - level.strike_flag_touch = false; - - int round_num; - if (level.round_number && (!level.strike_turn_red && level.strike_turn_blue || - level.strike_turn_red && !level.strike_turn_blue)) - round_num = level.round_number; - else { - round_num = level.round_number + 1; - } - BroadcastTeamMessage(TEAM_RED, PRINT_CENTER, G_Fmt("Your team is on {}!\nRound {} - Begins in...", level.strike_red_attacks ? "OFFENSE" : "DEFENSE", round_num).data()); - BroadcastTeamMessage(TEAM_BLUE, PRINT_CENTER, G_Fmt("Your team is on {}!\nRound {} - Begins in...", !level.strike_red_attacks ? "OFFENSE" : "DEFENSE", round_num).data()); - } else { - int round_num; - - if (horde && !level.round_number && g_horde_starting_wave->integer > 0) - round_num = g_horde_starting_wave->integer; - else - round_num = level.round_number + 1; + Entities_Reset(true, false, false); - if (GT(GT_RR) && roundlimit->integer) { - gi.LocBroadcast_Print(PRINT_CENTER, "{} {} of {}\nBegins in...", horde ? "Wave" : "Round", round_num, roundlimit->integer); - } else - gi.LocBroadcast_Print(PRINT_CENTER, "{} {}\nBegins in...", horde ? "Wave" : "Round", round_num); - } + gi.LocBroadcast_Print(PRINT_CENTER, "Round {}\nBegins in...", level.round_number + 1); return true; } @@ -1420,20 +784,12 @@ Round_End ============= */ void Round_End() { - // reset if not round based - if (!(GTF(GTF_ROUNDS))) { - level.round_state = roundst_t::ROUND_NONE; - level.round_state_timer = 0_sec; - return; - } - // there must be a round to end if (level.round_state != ROUND_IN_PROGRESS) return; level.round_state = roundst_t::ROUND_ENDED; level.round_state_timer = level.time + 3_sec; - level.horde_all_spawned = false; } /* @@ -1470,9 +826,6 @@ void Match_Start() { gi.LocBroadcast_Print(PRINT_TTS, "The match has started!\n"); - if (GT(GT_STRIKE)) - level.strike_red_attacks = brandom(); - if (Round_StartNew()) return; @@ -1508,104 +861,6 @@ void Match_Reset() { gi.LocBroadcast_Print(PRINT_TTS, "The match has been reset.\n"); } -/* -============= -Duel_AddPlayer - -If there are less than two players in the arena, place the -next queued player in the game and restart -============= -*/ -static bool Duel_AddPlayer(void) { - if (notGT(GT_DUEL)) - return true; - - if (level.num_playing_clients >= 2) - return true; - - // never change during intermission or outside of warmup - if (level.match_state > matchst_t::MATCH_WARMUP_DEFAULT || level.intermission_time || level.intermission_queued) - return false; - - gclient_t *next_in_line = nullptr; - - for (auto ec : active_clients()) { - if (ClientIsPlaying(ec->client)) - continue; - - //gi.Com_PrintFmt("Duel: {}, join time={}\n", ec->client->resp.netname, ec->client->resp.team_join_time.milliseconds()); - - if (!ec->client->sess.duel_queued) - continue; - - if (!next_in_line || ec->client->resp.team_join_time < next_in_line->resp.team_join_time) { - //gi.Com_PrintFmt("Duel: A next-in-line considered: {}, join time={}\n", ec->client->resp.netname, ec->client->resp.team_join_time.milliseconds()); - next_in_line = ec->client; - } - } - - if (!next_in_line) - return false; - /* - level.match_state_timer = 0_sec; - level.match_state = matchst_t::MATCH_WARMUP_DEFAULT; - level.warmup_requisite = warmupreq_t::WARMUP_REQ_NONE; - level.warmup_notice_time = 0_sec; - */ - // set them to free-for-all team - SetTeam(&g_entities[next_in_line - game.clients + 1], TEAM_FREE, false, true, false); - - return false; -} - -/* -======================= -Duel_RemoveLoser - -Make the loser a queued player at the back of the line -======================= -*/ -static void Duel_RemoveLoser(void) { - if (level.num_playing_clients != 2) - return; - - gentity_t *ent = &g_entities[level.sorted_clients[1] + 1]; - - if (!ent || !ent->client || !ent->client->pers.connected) - return; - - if (g_verbose->integer) - gi.Com_PrintFmt( "Duel: Moving the loser, {}, to end of queue.\n", ent->client->resp.netname); - - // make them a queued player - SetTeam(ent, TEAM_NONE, false, true, false); -} - -/* -======================= -Duel_MatchEnd_AdjustScores -======================= -*/ -static void Duel_MatchEnd_AdjustScores(void) { - if (notGT(GT_DUEL)) - return; - - int client_num; - - client_num = level.sorted_clients[0]; - if (game.clients[client_num].pers.connected) { - game.clients[client_num].sess.wins++; - //ClientUserinfoChanged(&g_entities[client_num], g_entities[client_num].client->pers.userinfo); - } - - client_num = level.sorted_clients[1]; - if (game.clients[client_num].pers.connected) { - // handled in SetTeam - //game.clients[client_num].sess.losses++; - //ClientUserinfoChanged(&g_entities[client_num], g_entities[client_num].client->pers.userinfo); - } -} - /* ============= ReadyAll @@ -1686,9 +941,6 @@ CheckDMRoundState ============= */ static void CheckDMRoundState(void) { - if (!(GTF(GTF_ROUNDS))) - return; - if (level.match_state != matchst_t::MATCH_IN_PROGRESS) return; @@ -1697,10 +949,6 @@ static void CheckDMRoundState(void) { if (level.round_state_timer > level.time) return; - if (GT(GT_RR) && level.round_state == roundst_t::ROUND_ENDED) { - TeamShuffle(); - } - Round_StartNew(); return; } @@ -1715,172 +963,91 @@ static void CheckDMRoundState(void) { level.round_state_timer = level.time + gtime_t::from_min(roundtimelimit->value); bool turn = false; - if (GT(GT_STRIKE)) { - if (!level.strike_turn_red && !level.strike_turn_blue) { - level.strike_turn_red = level.strike_red_attacks; - level.strike_turn_blue = !level.strike_red_attacks; - } else if (!level.strike_turn_red && level.strike_red_attacks) { - level.strike_turn_red = true; - turn = true; - } else if (!level.strike_turn_blue && !level.strike_red_attacks) { - level.strike_turn_blue = true; - turn = true; - } else { - level.strike_turn_red = level.strike_red_attacks; - level.strike_turn_blue = !level.strike_red_attacks; - } - } - if (!turn) { - if (GT(GT_HORDE) && !level.round_number && g_horde_starting_wave->integer > 0) - level.round_number = g_horde_starting_wave->integer; - else - level.round_number++; - } - if (GT(GT_STRIKE)) { - gi.LocBroadcast_Print(PRINT_CHAT, "Round {}: {} is attacking!\n", level.round_number, Teams_TeamName(level.strike_red_attacks ? TEAM_RED : TEAM_BLUE)); - const char *msg[2] = { "DEFEND", "CAPTURE" }; - BroadcastTeamMessage(TEAM_RED, PRINT_CENTER, G_Fmt("Round {} has begun!\n{} THE FLAG!", level.round_number, msg[level.strike_red_attacks]).data()); - BroadcastTeamMessage(TEAM_BLUE, PRINT_CENTER, G_Fmt("Round {} has begun!\n{} THE FLAG!", level.round_number, msg[!level.strike_red_attacks]).data()); - } else { - bool horde = GT(GT_HORDE); - gi.LocBroadcast_Print(PRINT_CHAT, "{} {} has begun!\n", horde ? "Wave" : "Round", level.round_number); - gi.LocBroadcast_Print(PRINT_CENTER, horde ? (brandom() ? "INCOMING!" : "LOCK AND LOAD!") : "FIGHT!"); + if (!turn) + level.round_number++; - if (horde) { - level.horde_num_monsters_to_spawn = clamp(15 + (level.round_number * 5), 20, 80); - level.horde_monster_spawn_time = level.time + 500_ms; // random_time(1_sec, 2_sec); - } - } + gi.LocBroadcast_Print(PRINT_CHAT, "Round {} has begun!\n", level.round_number); + gi.LocBroadcast_Print(PRINT_CENTER, "GET TO THE CHOPPUH!"); } return; } // end round if (level.round_state == roundst_t::ROUND_IN_PROGRESS) { - switch (g_gametype->integer) { - case GT_CA: - { - int8_t count_red = 0, count_blue = 0; - int8_t count_living_red = 0, count_living_blue = 0; + int8_t count_red = 0, count_blue = 0; + int8_t count_living_red = 0, count_living_blue = 0; - for (auto ec : active_clients()) { - switch (ec->client->sess.team) { - case TEAM_RED: - count_red++; - if (!ec->client->eliminated) - count_living_red++; - break; - case TEAM_BLUE: - count_blue++; - if (!ec->client->eliminated) - count_living_blue++; - break; - } - } - - // check eliminated first - if (!count_living_red && count_living_blue) { - int points = GT(GT_STRIKE) ? (level.strike_red_attacks ? 0 : 2) : 1; - G_AdjustTeamScore(TEAM_BLUE, points); - if (GT(GT_STRIKE)) - gi.LocBroadcast_Print(PRINT_CENTER, "Turn has ended.\n{} successfully {}!\n", Teams_TeamName(TEAM_BLUE), points ? "attacked" : "defended"); - else - gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(eliminated {})\n", Teams_TeamName(TEAM_BLUE), Teams_TeamName(TEAM_RED)); - 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 = GT(GT_STRIKE) ? (!level.strike_red_attacks ? 0 : 2) : 1; - G_AdjustTeamScore(TEAM_RED, points); - if (GT(GT_STRIKE)) { - gi.LocBroadcast_Print(PRINT_CENTER, "Turn has ended.\n{} successfully {}!\n", Teams_TeamName(TEAM_RED), points ? "attacked" : "defended"); - } else - gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(eliminated {})\n", Teams_TeamName(TEAM_RED), Teams_TeamName(TEAM_BLUE)); - gi.positioned_sound(world->s.origin, world, CHAN_AUTO | CHAN_RELIABLE, gi.soundindex("ctf/flagcap.wav"), 1, ATTN_NONE, 0); - Round_End(); - return; + for (auto ec : active_clients()) { + switch (ec->client->sess.team) { + case TEAM_RED: + count_red++; + if (!ec->client->eliminated) + count_living_red++; + break; + case TEAM_BLUE: + count_blue++; + if (!ec->client->eliminated) + count_living_blue++; + break; } - break; } - case GT_HORDE: - Horde_RunSpawning(); - //if (level.horde_all_spawned && Horde_AllMonstersDead()) { - if (level.horde_all_spawned && !(level.total_monsters - level.killed_monsters)) { - gi.LocBroadcast_Print(PRINT_CENTER, "Monsters eliminated!\n"); - gi.positioned_sound(world->s.origin, world, CHAN_AUTO | CHAN_RELIABLE, gi.soundindex("ctf/flagcap.wav"), 1, ATTN_NONE, 0); - Round_End(); - return; - } - break; - - case GT_RR: - if (!level.num_playing_red || !level.num_playing_blue) { - gclient_t *cl = &game.clients[level.sorted_clients[0]]; - - gi.Broadcast_Print(PRINT_CENTER, "Round Ends!\n"); - - gi.positioned_sound(world->s.origin, world, CHAN_AUTO | CHAN_RELIABLE, gi.soundindex("ctf/flagcap.wav"), 1, ATTN_NONE, 0); - - if (level.round_number + 1 >= roundlimit->integer) { - QueueIntermission("MATCH ENDED", false, false); - } else - Round_End(); - return; - } - break; + // 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)); + 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)); + gi.positioned_sound(world->s.origin, world, CHAN_AUTO | CHAN_RELIABLE, gi.soundindex("ctf/flagcap.wav"), 1, ATTN_NONE, 0); + Round_End(); + return; } // hit the round time limit, check any other winning conditions if (level.time >= level.round_state_timer) { - // highest number of players remaining or highest total health wins - if (GT(GT_CA)) { - if (level.num_living_red > level.num_living_blue) { + 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); + 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); + 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; + + for (auto ec : active_players()) { + if (ec->health <= 0) + continue; + switch (ec->client->sess.team) { + case TEAM_RED: + total_health_red += ec->health; + break; + case TEAM_BLUE: + 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(players remaining: {} vs {})\n", Teams_TeamName(TEAM_RED), level.num_living_red, level.num_living_blue); + gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(total health: {} vs {})\n", Teams_TeamName(TEAM_RED), 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 (level.num_living_blue > level.num_living_red) { + } else if (total_health_blue > total_health_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); + gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n(total health: {} vs {})\n", Teams_TeamName(TEAM_BLUE), 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 { - int total_health_red = 0, total_health_blue = 0; - - for (auto ec : active_players()) { - if (ec->health <= 0) - continue; - switch (ec->client->sess.team) { - case TEAM_RED: - total_health_red += ec->health; - break; - case TEAM_BLUE: - 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); - 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); - 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!"); - } - } - } else { - if (GT(GT_STRIKE)) { - if (level.strike_flag_touch) - gi.LocBroadcast_Print(PRINT_CENTER, "Turn has ended.\n{} scored a point!\n", Teams_TeamName(level.strike_red_attacks ? TEAM_RED : TEAM_BLUE)); - else - gi.LocBroadcast_Print(PRINT_CENTER, "Turn has ended.\n{} successfully defended!", Teams_TeamName(!level.strike_red_attacks ? TEAM_RED : TEAM_BLUE)); + gi.LocBroadcast_Print(PRINT_CENTER, "Round draw!"); } } - //gi.LocBroadcast_Print(PRINT_CENTER, "{} wins the round!\n", Teams_TeamName(TEAM_BLUE)); Round_End(); return; } @@ -1916,25 +1083,7 @@ CheckDMMatchEndWarning ============= */ static void CheckDMMatchEndWarning(void) { - if (GTF(GTF_ROUNDS)) - return; - if (level.match_state != matchst_t::MATCH_IN_PROGRESS || !timelimit->value) { - if (level.matchendwarn_check) - level.matchendwarn_check = 0_sec; - return; - } - - int t = (level.match_time + gtime_t::from_min(timelimit->value) - level.time).seconds(); // +1; - - if (!level.matchendwarn_check || level.matchendwarn_check.seconds() > t) { - if (t && (t == 30 || t == 20 || t <= 10)) { - gi.positioned_sound(world->s.origin, world, CHAN_AUTO | CHAN_RELIABLE, gi.soundindex(G_Fmt("world/{}{}.wav", t, t >= 20 ? "sec" : "").data()), 1, ATTN_NONE, 0); - if (t >= 10) - gi.LocBroadcast_Print(PRINT_HIGH, "{} second warning!\n", t); - } - level.matchendwarn_check = gtime_t::from_sec(t); - } } /* @@ -1958,11 +1107,7 @@ static void CheckDMWarmupState(void) { return; } - // duel: pull in a queued spectator if needed - if (!Duel_AddPlayer()) - return; - - min_players = GT(GT_DUEL) ? 2 : minplayers->integer; + min_players = minplayers->integer; if (level.match_state < matchst_t::MATCH_COUNTDOWN && !g_dm_do_warmup->integer && level.num_playing_clients >= min_players) { Match_Start(); return; @@ -1981,22 +1126,12 @@ static void CheckDMWarmupState(void) { if (level.match_state == matchst_t::MATCH_WARMUP_DELAYED && level.match_state_timer > level.time) return; - if (level.match_state == matchst_t::MATCH_WARMUP_DEFAULT || level.match_state == matchst_t::MATCH_WARMUP_READYUP) - Horde_RunSpawning(); - bool not_enough = false; bool teams_imba = false; - if (Teams()) { - if (g_teamplay_force_balance->integer && abs(level.num_playing_red - level.num_playing_blue) > 1) { - teams_imba = true; - } else if (level.num_playing_red < 1 || level.num_playing_blue < 1 || level.num_playing_clients < min_players) { - not_enough = true; - } - } else if (GT(GT_DUEL)) { - if (level.num_playing_clients != 2) - not_enough = true; - } else if (level.num_playing_clients < min_players) { + if (g_teamplay_force_balance->integer && abs(level.num_playing_red - level.num_playing_blue) > 1) { + teams_imba = true; + } else if (level.num_playing_red < 1 || level.num_playing_blue < 1 || level.num_playing_clients < min_players) { not_enough = true; } @@ -2059,10 +1194,7 @@ static void CheckDMWarmupState(void) { //gi.positioned_sound(world->s.origin, world, CHAN_AUTO | CHAN_RELIABLE, gi.soundindex("world/10_0.wav"), 1, ATTN_NONE, 0); // announce it - if (GT(GT_DUEL) && &game.clients[level.sorted_clients[0]] && &game.clients[level.sorted_clients[1]]) - gi.LocBroadcast_Print(PRINT_CENTER, "{} vs {}\nBegins in...", game.clients[level.sorted_clients[0]].resp.netname, game.clients[level.sorted_clients[1]].resp.netname); - else - gi.LocBroadcast_Print(PRINT_CENTER, "{}\nBegins in...", level.gametype_name); + gi.Broadcast_Print(PRINT_CENTER, "Predator\nBegins in..."); } else { level.match_state_timer = 0_ms; goto start; @@ -2296,7 +1428,7 @@ static bool ScoreIsTied(void) { if (level.num_playing_clients < 2) return false; - if (Teams() && notGT(GT_RR)) + if (Teams()) return level.team_scores[TEAM_RED] == level.team_scores[TEAM_BLUE]; return game.clients[level.sorted_clients[0]].resp.score == game.clients[level.sorted_clients[1]].resp.score; @@ -2329,16 +1461,6 @@ static int SortRanks(const void *a, const void *b) { // then spectators if (!ClientIsPlaying(ca) && !ClientIsPlaying(cb)) { - if (ca->sess.duel_queued && cb->sess.duel_queued) { - if (ca->resp.team_join_time > cb->resp.team_join_time) - return -1; - if (ca->resp.team_join_time < cb->resp.team_join_time) - return 1; - } - if (ca->sess.duel_queued) - return -1; - if (cb->sess.duel_queued) - return 1; if (ca->resp.team_join_time > cb->resp.team_join_time) return -1; if (ca->resp.team_join_time < cb->resp.team_join_time) @@ -2442,7 +1564,7 @@ void CalculateRanks() { qsort(level.sorted_clients, level.num_connected_clients, sizeof(level.sorted_clients[0]), SortRanks); // set the rank value for all clients that are connected and not spectators - if (teams && notGT(GT_RR)) { + if (teams) { // 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]]; @@ -2858,19 +1980,11 @@ void QueueIntermission(const char *msg, bool boo, bool reset) { } int GT_ScoreLimit() { - if (GTF(GTF_ROUNDS)) - return roundlimit->integer; - if (GT(GT_CTF)) - return capturelimit->integer; - return fraglimit->integer; + return roundlimit->integer; } const char *GT_ScoreLimitString() { - if (GT(GT_CTF)) - return "capture"; - if (GTF(GTF_ROUNDS)) - return "round"; - return "frag"; + return "round"; } /* @@ -2910,24 +2024,9 @@ void CheckDMExitRules() { if (level.time - level.match_time <= FRAME_TIME_MS) return; - if (GT(GT_HORDE)) { - if ((level.total_monsters - level.killed_monsters) >= 100) { - gi.Broadcast_Print(PRINT_CENTER, "DEFEATED!"); - QueueIntermission("OVERRUN BY MONSTERS!", true, false); - return; - } - } - - if (GTF(GTF_ROUNDS) && level.round_state != roundst_t::ROUND_ENDED) + if (level.round_state != roundst_t::ROUND_ENDED) return; - if (GT(GT_HORDE)) { - if (roundlimit->integer > 0 && level.round_number >= roundlimit->integer) { - QueueIntermission(G_Fmt("{} WINS with a final score of {}.", game.clients[level.sorted_clients[0]].resp.netname, game.clients[level.sorted_clients[0]].resp.score).data(), false, false); - return; - } - } - if (!g_dm_allow_no_humans->integer && !level.num_playing_human_clients) { QueueIntermission("No human players remaining.", true, false); return; @@ -2938,7 +2037,7 @@ void CheckDMExitRules() { return; } - bool teams = Teams() && notGT(GT_RR); + bool teams = Teams(); if (teams && g_teamplay_force_balance->integer) { if (abs(level.num_playing_red - level.num_playing_blue) > 1) { @@ -2952,17 +2051,13 @@ void CheckDMExitRules() { } if (timelimit->value) { - if (!(GTF(GTF_ROUNDS)) || level.round_state == roundst_t::ROUND_ENDED) { + if (level.round_state == roundst_t::ROUND_ENDED) { if (level.time >= level.match_time + gtime_t::from_min(timelimit->value) + level.overtime) { // check for overtime if (ScoreIsTied()) { bool play = false; - if (GT(GT_DUEL) && g_dm_overtime->integer > 0) { - level.overtime += gtime_t::from_sec(g_dm_overtime->integer); - gi.LocBroadcast_Print(PRINT_CENTER, "Overtime!\n{} added", G_TimeString(g_dm_overtime->integer * 1000, false)); - play = true; - } else if (!level.suddendeath) { + if (!level.suddendeath) { gi.LocBroadcast_Print(PRINT_CENTER, "Sudden Death!"); level.suddendeath = true; play = true; @@ -3004,19 +2099,6 @@ void CheckDMExitRules() { QueueIntermission(G_Fmt("{} hit the mercylimit ({}).", Teams_TeamName(TEAM_BLUE), mercylimit->integer).data(), true, false); return; } - } else { - if (notGT(GT_HORDE)) { - gclient_t *cl1, *cl2; - - cl1 = &game.clients[level.sorted_clients[0]]; - cl2 = &game.clients[level.sorted_clients[1]]; - if (cl1 && cl2) { - if (cl1->resp.score >= cl2->resp.score + mercylimit->integer) { - QueueIntermission(G_Fmt("{} hit the mercylimit ({}).", cl1->resp.netname, mercylimit->integer).data(), true, false); - return; - } - } - } } } @@ -3024,10 +2106,6 @@ void CheckDMExitRules() { if (ScoreIsTied()) return; - // no score limit in horde - if (GT(GT_HORDE)) - return; - int scorelimit = GT_ScoreLimit(); if (!scorelimit) return; @@ -3096,9 +2174,6 @@ void BeginIntermission(gentity_t *targ) { if (level.intermission_time) return; // already activated - // if in a duel, change the wins / losses - Duel_MatchEnd_AdjustScores(); - game.autosaved = false; level.intermission_time = level.time; @@ -3190,22 +2265,11 @@ void ExitLevel() { const char *s = ""; - if (GT(GT_DUEL)) { - gentity_t *e1 = &g_entities[level.sorted_clients[0] + 1]; - gentity_t *e2 = &g_entities[level.sorted_clients[1] + 1]; - const char *n1 = e1 ? e1->client->resp.netname : ""; - const char *n2 = e2 ? e2->client->resp.netname : ""; + gentity_t *ent = &g_entities[1]; + const char *name = ent->client->follow_target ? ent->client->follow_target->client->resp.netname : ent->client->resp.netname; - s = G_Fmt("screenshot {}-vs-{}-{}-{}_{:02}_{:02}-{:02}_{:02}_{:02}\n", - n1, n2, level.mapname, 1900 + ltime->tm_year, ltime->tm_mon + 1, ltime->tm_mday, ltime->tm_hour, ltime->tm_min, ltime->tm_sec).data(); - gi.Com_Print(s); - } else { - gentity_t *ent = &g_entities[1]; - const char *name = ent->client->follow_target ? ent->client->follow_target->client->resp.netname : ent->client->resp.netname; - - s = G_Fmt("screenshot {}-{}-{}-{}_{:02}_{:02}-{:02}_{:02}_{:02}\n", gt_short_name_upper[g_gametype->integer], - name, level.mapname, 1900 + ltime->tm_year, ltime->tm_mon + 1, ltime->tm_mday, ltime->tm_hour, ltime->tm_min, ltime->tm_sec).data(); - } + s = G_Fmt("screenshot {}-{}-{}_{:02}_{:02}-{:02}_{:02}_{:02}\n", + name, level.mapname, 1900 + ltime->tm_year, ltime->tm_mon + 1, ltime->tm_mday, ltime->tm_hour, ltime->tm_min, ltime->tm_sec).data(); gi.AddCommandString(s); } @@ -3218,11 +2282,6 @@ void ExitLevel() { ClientEndServerFrames(); - // if we are running a duel, kick the loser to queue, - // which will automatically grab the next queued player and restart - if (deathmatch->integer && GT(GT_DUEL)) - Duel_RemoveLoser(); - level.intermission_time = 0_ms; // [Paril-KEX] support for intermission completely wiping players @@ -3262,9 +2321,6 @@ void ExitLevel() { // end game size_t start_offset = (level.changemap[0] == '*' ? 1 : 0); - if (GT(GT_RR) && level.num_playing_clients > 1 && (!level.num_playing_red || !level.num_playing_blue)) - TeamShuffle(); - if (strlen(level.changemap) > (6 + start_offset) && !Q_strncasecmp(level.changemap + start_offset, "victor", 6) && !Q_strncasecmp(level.changemap + strlen(level.changemap) - 4, ".pcx", 4)) @@ -3404,9 +2460,6 @@ Advances the world by 0.1 seconds static inline void G_RunFrame_(bool main_loop) { level.in_frame = true; - // track gametype changes and update accordingly - GT_Changes(); - // cancel vote if timed out CheckVote(); diff --git a/src/g_menu.cpp b/src/g_menu.cpp index 92102ee..a9babee 100644 --- a/src/g_menu.cpp +++ b/src/g_menu.cpp @@ -28,10 +28,6 @@ static void G_Menu_SetGamemodName(menu_t *p) { Q_strlcpy(p->text, level.gamemod_name, sizeof(p->text)); } -static void G_Menu_SetGametypeName(menu_t *p) { - Q_strlcpy(p->text, level.gametype_name, sizeof(p->text)); -} - static void G_Menu_SetLevelName(menu_t *p) { static char levelname[33]; @@ -372,19 +368,17 @@ static void G_Menu_PMStats(gentity_t *ent, menu_hnd_t *p) { static const int cvmenu_map = 3; static const int cvmenu_nextmap = 4; static const int cvmenu_restart = 5; -static const int cvmenu_gametype = 6; -static const int cvmenu_timelimit = 7; -static const int cvmenu_scorelimit = 8; -static const int cvmenu_shuffle = 9; -static const int cvmenu_balance = 10; -static const int cvmenu_unlagged = 11; -static const int cvmenu_cointoss = 12; -static const int cvmenu_random = 13; +static const int cvmenu_timelimit = 6; +static const int cvmenu_scorelimit = 7; +static const int cvmenu_shuffle = 8; +static const int cvmenu_balance = 9; +static const int cvmenu_unlagged = 10; +static const int cvmenu_cointoss = 11; +static const int cvmenu_random = 12; void G_Menu_CallVote_Map(gentity_t *ent, menu_hnd_t *p); void G_Menu_CallVote_NextMap(gentity_t *ent, menu_hnd_t *p); void G_Menu_CallVote_Restart(gentity_t *ent, menu_hnd_t *p); -void G_Menu_CallVote_GameType(gentity_t *ent, menu_hnd_t *p); void G_Menu_CallVote_TimeLimit_Update(gentity_t *ent); void G_Menu_CallVote_TimeLimit(gentity_t *ent, menu_hnd_t *p); void G_Menu_CallVote_ScoreLimit(gentity_t *ent, menu_hnd_t *p); @@ -402,7 +396,6 @@ const menu_t pmcallvotemenu[] = { { "change map", MENU_ALIGN_LEFT, G_Menu_CallVote_Map }, { "go to next map", MENU_ALIGN_LEFT, G_Menu_CallVote_NextMap }, { "restart match", MENU_ALIGN_LEFT, G_Menu_CallVote_Restart }, - { "change gametype", MENU_ALIGN_LEFT, G_Menu_CallVote_GameType }, { "change time limit", MENU_ALIGN_LEFT, G_Menu_CallVote_TimeLimit }, { "change score limit", MENU_ALIGN_LEFT, G_Menu_CallVote_ScoreLimit }, { "shuffle teams", MENU_ALIGN_LEFT, G_Menu_CallVote_ShuffleTeams }, @@ -521,10 +514,6 @@ void G_Menu_CallVote_Restart(gentity_t *ent, menu_hnd_t *p) { P_Menu_Close(ent); } -void G_Menu_CallVote_GameType(gentity_t *ent, menu_hnd_t *p) { - -} - void G_Menu_CallVote_TimeLimit_Update(gentity_t *ent) { level.vote_arg = nullptr; @@ -579,29 +568,6 @@ static void G_Menu_CallVote_Update(gentity_t *ent) { Q_strlcpy(entries[i].text, "Call a Vote", sizeof(entries[i].text)); i++; i++; - /* - entries[cvmenu_map].SelectFunc = G_Menu_CallVote_Map; - i++; - entries[cvmenu_nextmap].SelectFunc = G_Menu_CallVote_NextMap; - i++; - entries[cvmenu_restart].SelectFunc = G_Menu_CallVote_Restart; - i++; - entries[cvmenu_gametype].SelectFunc = G_Menu_CallVote_GameType; - i++; - entries[cvmenu_timelimit].SelectFunc = G_Menu_CallVote_TimeLimit; - i++; - entries[cvmenu_scorelimit].SelectFunc = G_Menu_CallVote_ScoreLimit; - i++; - entries[cvmenu_shuffle].SelectFunc = G_Menu_CallVote_ShuffleTeams; - i++; - entries[cvmenu_balance].SelectFunc = G_Menu_CallVote_BalanceTeams; - i++; - entries[cvmenu_unlagged].SelectFunc = G_Menu_CallVote_Unlagged; - i++; - entries[cvmenu_cointoss].SelectFunc = G_Menu_CallVote_Cointoss; - i++; - entries[cvmenu_random].SelectFunc = G_Menu_CallVote_Random; - */ } static void G_Menu_CallVote(gentity_t *ent, menu_hnd_t *p) { @@ -722,9 +688,8 @@ void G_Menu_HostInfo(gentity_t *ent, menu_hnd_t *p); void G_Menu_ServerInfo(gentity_t *ent, menu_hnd_t *p); static const int jmenu_hostname = 0; -static const int jmenu_gametype = 1; -static const int jmenu_level = 2; -static const int jmenu_match = 3; +static const int jmenu_level = 1; +static const int jmenu_match = 2; static const int jmenu_teams_join_red = 5; static const int jmenu_teams_join_blue = 6; @@ -850,7 +815,6 @@ static void G_Menu_NoChaseCamUpdate(gentity_t *ent) { menu_t *entries = ent->client->menu->entries; G_Menu_SetGamemodName(&entries[jmenu_gamemod]); - G_Menu_SetGametypeName(&entries[jmenu_gametype]); G_Menu_SetLevelName(&entries[jmenu_level]); } @@ -931,7 +895,6 @@ static void G_Menu_ServerInfo_Update(gentity_t *ent) { Q_strlcpy(entries[i].text, BREAKER, sizeof(entries[i].text)); i++; - Q_strlcpy(entries[i].text, level.gametype_name, sizeof(entries[i].text)); i++; if (level.level_name[0]) { @@ -1038,7 +1001,7 @@ static void G_Menu_ServerInfo_Update(gentity_t *ent) { i++; } - if (Teams() && g_teamplay_force_balance->integer && notGT(GT_RR)) { + if (Teams() && g_teamplay_force_balance->integer) { if (i >= 16) return; Q_strlcpy(entries[i].text, "forced team balancing", sizeof(entries[i].text)); i++; @@ -1138,7 +1101,6 @@ static void G_Menu_GameRules_Update(gentity_t *ent) { Q_strlcpy(entries[i].text, "Game Rules", sizeof(entries[i].text)); i++; Q_strlcpy(entries[i].text, BREAKER, sizeof(entries[i].text)); i++; - Q_strlcpy(entries[i].text, G_Fmt("{}", level.gametype_name).data(), sizeof(entries[i].text)); i++; } static void G_Menu_GameRules(gentity_t *ent, menu_hnd_t *p) { @@ -1152,27 +1114,22 @@ static void G_Menu_Join_Update(gentity_t *ent) { uint8_t num_red = 0, num_blue = 0, num_free = 0, num_queue = 0; for (auto ec : active_clients()) { - if (GT(GT_DUEL) && ec->client->sess.team == TEAM_SPECTATOR && ec->client->sess.duel_queued) { - num_queue++; - } else { - switch (ec->client->sess.team) { - case TEAM_FREE: - num_free++; - break; - case TEAM_RED: - num_red++; - break; - case TEAM_BLUE: - num_blue++; - break; - } + switch (ec->client->sess.team) { + case TEAM_FREE: + num_free++; + break; + case TEAM_RED: + num_red++; + break; + case TEAM_BLUE: + num_blue++; + break; } } if (pmax < 1) pmax = 1; G_Menu_SetGamemodName(entries + jmenu_gamemod); - G_Menu_SetGametypeName(entries + jmenu_gametype); if (Teams()) { if (!g_teamplay_allow_team_pick->integer && !level.locked[TEAM_RED] && !level.locked[TEAM_BLUE]) { @@ -1202,11 +1159,8 @@ static void G_Menu_Join_Update(gentity_t *ent) { if (level.locked[TEAM_FREE] || level.match_state == matchst_t::MATCH_IN_PROGRESS && g_match_lock->integer) { Q_strlcpy(entries[jmenu_free_join].text, "Match LOCKED during play", sizeof(entries[jmenu_free_join].text)); entries[jmenu_free_join].SelectFunc = nullptr; - } else if (GT(GT_DUEL) && level.num_playing_clients == 2) { - Q_strlcpy(entries[jmenu_free_join].text, G_Fmt("Join Queue to Play ({}/{})", num_queue, pmax - 2).data(), sizeof(entries[jmenu_free_join].text)); - entries[jmenu_free_join].SelectFunc = G_Menu_Join_Team_Free; } else { - Q_strlcpy(entries[jmenu_free_join].text, G_Fmt("Join Match ({}/{})", num_free, GT(GT_DUEL) ? 2 : pmax).data(), sizeof(entries[jmenu_free_join].text)); + Q_strlcpy(entries[jmenu_free_join].text, G_Fmt("Join Match ({}/{})", num_free, pmax).data(), sizeof(entries[jmenu_free_join].text)); entries[jmenu_free_join].SelectFunc = G_Menu_Join_Team_Free; } } @@ -1241,7 +1195,6 @@ static void G_Menu_Join_Update(gentity_t *ent) { Q_strlcpy(entries[index].text, "$g_pc_chase_camera", sizeof(entries[index].text)); G_Menu_SetHostName(entries + jmenu_hostname); - G_Menu_SetGametypeName(entries + jmenu_gametype); G_Menu_SetLevelName(entries + jmenu_level); G_Menu_SetGamemodName(entries + jmenu_gamemod); diff --git a/src/g_misc.cpp b/src/g_misc.cpp index 15bfbd6..b9538a3 100644 --- a/src/g_misc.cpp +++ b/src/g_misc.cpp @@ -164,11 +164,6 @@ gentity_t *ThrowGib(gentity_t *self, const char *gibname, int damage, gib_type_t gib->s.sound = 0; gib->monsterinfo.engine_sound = 0; - if (GT(GT_FREEZE)) { - gib->s.renderfx |= (RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE); - gib->s.effects |= EF_COLOR_SHELL; - } - if (!(type & GIB_METALLIC)) { gib->movetype = MOVETYPE_TOSS; vscale = (type & GIB_ACID) ? 3.0 : 0.5; @@ -2001,7 +1996,7 @@ void SP_misc_teleporter_dest(gentity_t *ent) { if (level.is_n64) return; - if (g_dm_spawnpads->integer > 1 || (g_dm_spawnpads->integer == 1 && ItemSpawnsEnabled() && notGT(GT_HORDE))) { + if (g_dm_spawnpads->integer > 1 || (g_dm_spawnpads->integer == 1 && ItemSpawnsEnabled())) { if (!level.no_dm_spawnpads) { gi.setmodel(ent, "models/objects/dmspot/tris.md2"); ent->s.skinnum = 0; diff --git a/src/g_monster.cpp b/src/g_monster.cpp index 882eab7..4fd9058 100644 --- a/src/g_monster.cpp +++ b/src/g_monster.cpp @@ -409,9 +409,8 @@ void M_SetEffects(gentity_t *ent) { } bool M_AllowSpawn(gentity_t *self) { - if (deathmatch->integer && !(ai_allow_dm_spawn->integer || GT(GT_HORDE))) { + if (deathmatch->integer && !ai_allow_dm_spawn->integer) return false; - } return true; } @@ -616,7 +615,6 @@ void M_ProcessPain(gentity_t *e) { if (!e->deadflag) { int32_t score_value = ceil(e->monsterinfo.base_health / 100); if (score_value < 1) score_value = 1; - Horde_AdjustPlayerScore(e->monsterinfo.damage_attacker->client, score_value); } e->die(e, e->monsterinfo.damage_inflictor, e->monsterinfo.damage_attacker, e->monsterinfo.damage_blood, e->monsterinfo.damage_from, e->monsterinfo.damage_mod); @@ -900,7 +898,7 @@ THINK(monster_think) (gentity_t *self) -> void { if (!self->inuse || self->think != monster_think) return; - if (self->hackflags & HACKFLAG_ATTACK_PLAYER || GT(GT_HORDE)) { + if (self->hackflags & HACKFLAG_ATTACK_PLAYER) { if (!self->enemy && g_entities[1].inuse && ClientIsPlaying(g_entities[1].client)) { self->enemy = &g_entities[1]; FoundTarget(self); diff --git a/src/g_spawn.cpp b/src/g_spawn.cpp index 3bf76dd..410f1f4 100644 --- a/src/g_spawn.cpp +++ b/src/g_spawn.cpp @@ -510,15 +510,6 @@ void ED_CallSpawn(gentity_t *ent) { ent->sv.init = false; -#if 0 - if (GT(GT_HORDE)) { - // remove monsters from map, we will spawn them in during wave starts - if (!strnicmp(ent->classname, "monster_", 8)) { - G_FreeEntity(ent); - return; - } - } -#endif // FIXME - PMM classnames hack if (!strcmp(ent->classname, "weapon_nailgun")) ent->classname = GetItemByIndex(IT_WEAPON_ETF_RIFLE)->classname; @@ -532,10 +523,6 @@ void ED_CallSpawn(gentity_t *ent) { ent->classname = "info_player_team_red"; else if (!strcmp(ent->classname, "info_player_team2")) ent->classname = "info_player_team_blue"; - else if (!strcmp(ent->classname, "item_flag_team1")) - ent->classname = ITEM_CTF_FLAG_RED; - else if (!strcmp(ent->classname, "item_flag_team2")) - ent->classname = ITEM_CTF_FLAG_BLUE; if (RS(RS_Q1)) { if (!strcmp(ent->classname, "weapon_machinegun")) @@ -590,16 +577,6 @@ void ED_CallSpawn(gentity_t *ent) { } } - if (!strcmp(ent->classname, "item_ball")) { - if (GT(GT_BALL)) { - ent->s.effects |= EF_COLOR_SHELL; - ent->s.renderfx |= RF_SHELL_RED | RF_SHELL_GREEN; - } else { - G_FreeEntity(ent); - } - return; - } - gi.Com_PrintFmt("{}: {} doesn't have a spawn function.\n", __FUNCTION__, *ent); G_FreeEntity(ent); } @@ -851,8 +828,6 @@ static const std::initializer_list entity_fields = { }, //muff - FIELD_AUTO(gametype), - FIELD_AUTO(not_gametype), FIELD_AUTO(notteam), FIELD_AUTO(notfree), FIELD_AUTO(notq2), @@ -945,22 +920,6 @@ static const std::initializer_list temp_fields = { }; // clang-format on -static constexpr const char *gt_spawn_string[GT_NUM_GAMETYPES] = { - "campaign", - "ffa", - "tournament", - "team", - "ctf", - "ca", - "freeze", - "strike", - "rr", - "lms", - "horde", - "race", - "ball" -}; - /* =============== ED_ParseField @@ -1164,17 +1123,6 @@ static void G_FindTeams() { // inhibit entities from game based on cvars & spawnflags static inline bool G_InhibitEntity(gentity_t *ent) { - if (ent->gametype) { - const char *s = strstr(ent->gametype, gt_spawn_string[g_gametype->integer]); - if (!s) - return true; - } - if (ent->not_gametype) { - const char *s = strstr(ent->not_gametype, gt_spawn_string[g_gametype->integer]); - if (s) - return true; - } - if (ent->notteam && Teams()) return true; if (ent->notfree && !Teams()) @@ -1184,8 +1132,6 @@ static inline bool G_InhibitEntity(gentity_t *ent) { return true; if (ent->notq3a && RS(RS_Q3A)) return true; - if (ent->notarena && (GTF(GTF_ARENA))) - return true; if (ent->powerups_on && g_no_powerups->integer) return true; @@ -1312,31 +1258,6 @@ static void PrecachePlayerSounds() { gi.soundindex("*drown1.wav"); // [Paril-KEX] } -void GT_PrecacheAssets() { - if (Teams()) { - if (notGT(GT_RR)) { - ii_teams_header_red = gi.imageindex("tag4"); - ii_teams_header_blue = gi.imageindex("tag5"); - } - ii_teams_red_default = gi.imageindex("i_ctf1"); - ii_teams_blue_default = gi.imageindex("i_ctf2"); - ii_teams_red_tiny = gi.imageindex("sbfctf1"); - ii_teams_blue_tiny = gi.imageindex("sbfctf2"); - } - - if (GT(GT_DUEL)) - ii_duel_header = gi.imageindex("/tags/default"); - - if (GTF(GTF_CTF)) { - ii_ctf_red_dropped = gi.imageindex("i_ctf1d"); - ii_ctf_blue_dropped = gi.imageindex("i_ctf2d"); - ii_ctf_red_taken = gi.imageindex("i_ctf1t"); - ii_ctf_blue_taken = gi.imageindex("i_ctf2t"); - mi_ctf_red_flag = gi.modelindex("players/male/flag1.md2"); - mi_ctf_blue_flag = gi.modelindex("players/male/flag2.md2"); - } -} - // [Paril-KEX] static void PrecacheAssets() { if (!deathmatch->integer) { @@ -1374,7 +1295,10 @@ static void PrecacheAssets() { ii_highlight = gi.imageindex("i_ctfj"); - GT_PrecacheAssets(); + ii_teams_red_default = gi.imageindex("i_ctf1"); + ii_teams_blue_default = gi.imageindex("i_ctf2"); + ii_teams_red_tiny = gi.imageindex("sbfctf1"); + ii_teams_blue_tiny = gi.imageindex("sbfctf2"); } #define MAX_READ 0x10000 // read in blocks of 64k @@ -1924,18 +1848,6 @@ static void G_InitStatusbar() { if (g_coop_enable_lives->integer && g_coop_num_lives->integer > 0) sb.ifstat(STAT_LIVES).xr(-16).yt(y = 2).lives_num(STAT_LIVES).xr(0).yt(y += text_adj).loc_rstring("$g_lives").endifstat(); - // total monsters - if (GT(GT_HORDE)) { - int num, chars; - - num = level.round_number; - chars = num > 99 ? 3 : num > 9 ? 2 : 1; - sb.ifstat(STAT_ROUND_NUMBER).xr(-32 - (16 * chars)).yt(y += 10).num(3, STAT_ROUND_NUMBER).xr(0).yt(y += text_adj).loc_rstring("Wave").endifstat(); - - num = level.total_monsters - level.killed_monsters; - chars = num > 99 ? 3 : num > 9 ? 2 : 1; - sb.ifstat(STAT_MONSTER_COUNT).xr(-32 - (16 * chars)).yt(y += 10).num(3, STAT_MONSTER_COUNT).xr(0).yt(y += text_adj).loc_rstring("Monsters").endifstat(); - } } if (!deathmatch->integer) { // SP/coop @@ -1958,10 +1870,6 @@ static void G_InitStatusbar() { sb.story(); } else { if (Teams()) { - // flag carrier indicator - if (GTF(GTF_CTF)) - sb.ifstat(STAT_CTF_FLAG_PIC).xr(-24).yt(26).pic(STAT_CTF_FLAG_PIC).endifstat(); - // teams unbalanced warning sb.ifstat(STAT_TEAMPLAY_INFO).xl(0).yb(-88).stat_string(STAT_TEAMPLAY_INFO).endifstat(); } @@ -1996,177 +1904,6 @@ static void G_InitStatusbar() { gi.configstring(CS_STATUSBAR, sb.sb.str().c_str()); } -void GT_SetLongName(void) { - const char *s; - if (deathmatch->integer) { - if (GT(GT_CTF)) { - if (g_instagib->integer) { - s = "Insta-CTF"; - } else if (g_vampiric_damage->integer) { - s = "Vampiric CTF"; - } else if (g_frenzy->integer) { - s = "Frenzy CTF"; - } else if (g_nadefest->integer) { - s = "NadeFest CTF"; - } else if (g_quadhog->integer) { - s = "Quad Hog CTF"; - } else { - s = gt_long_name[GT_CTF]; - } - } else if (GT(GT_FREEZE)) { - if (g_instagib->integer) { - s = "Insta-Freeze"; - } else if (g_vampiric_damage->integer) { - s = "Vampiric Freeze"; - } else if (g_frenzy->integer) { - s = "Frenzy Freeze"; - } else if (g_nadefest->integer) { - s = "NadeFest Freeze"; - } else if (g_quadhog->integer) { - s = "Quad Hog Freeze"; - } else { - s = gt_long_name[GT_FREEZE]; - } - } else if (GT(GT_CA)) { - if (g_instagib->integer) { - s = "Insta-CA"; - } else if (g_vampiric_damage->integer) { - s = "Vampiric CA"; - } else if (g_frenzy->integer) { - s = "Frenzy CA"; - } else if (g_nadefest->integer) { - s = "NadeFest CA"; - } else if (g_quadhog->integer) { - s = "Quad Hog CA"; - } else { - s = gt_long_name[GT_CA]; - } - } else if (GT(GT_RR)) { - if (g_instagib->integer) { - s = "Insta-RR"; - } else if (g_vampiric_damage->integer) { - s = "Vampiric RR"; - } else if (g_frenzy->integer) { - s = "Frenzy RR"; - } else if (g_nadefest->integer) { - s = "NadeFest RR"; - } else if (g_quadhog->integer) { - s = "Quad Hog RR"; - } else { - s = gt_long_name[GT_RR]; - } - } else if (GT(GT_STRIKE)) { - if (g_instagib->integer) { - s = "Insta-Strike"; - } else if (g_vampiric_damage->integer) { - s = "Vampiric Strike"; - } else if (g_frenzy->integer) { - s = "Frenzy Strike"; - } else if (g_nadefest->integer) { - s = "NadeFest Strike"; - } else if (g_quadhog->integer) { - s = "Quad Hog Strike"; - } else { - s = gt_long_name[GT_STRIKE]; - } - } else if (GT(GT_TDM)) { - if (g_instagib->integer) { - s = "Insta-TDM"; - } else if (g_vampiric_damage->integer) { - s = "Vampiric TDM"; - } else if (g_frenzy->integer) { - s = "Frenzy TDM"; - } else if (g_nadefest->integer) { - s = "NadeFest TDM"; - } else if (g_quadhog->integer) { - s = "Quad Hog TDM"; - } else { - s = gt_long_name[GT_TDM]; - } - } else if (GT(GT_DUEL)) { - if (g_instagib->integer) { - s = "Insta-Duel"; - } else if (g_vampiric_damage->integer) { - s = "Vampiric Duel"; - } else if (g_frenzy->integer) { - s = "Frenzy Duel"; - } else if (g_nadefest->integer) { - s = "NadeFest Duel"; - } else if (g_quadhog->integer) { - s = "Quad Hog Duel"; - } else { - s = gt_long_name[GT_DUEL]; - } - } else if (GT(GT_HORDE)) { - if (g_instagib->integer) { - s = "Insta-Horde"; - } else if (g_vampiric_damage->integer) { - s = "Vampiric Horde"; - } else if (g_frenzy->integer) { - s = "Frenzy Horde"; - } else if (g_nadefest->integer) { - s = "NadeFest Horde"; - } else if (g_quadhog->integer) { - s = "Quad Hog Horde"; - } else { - s = gt_long_name[GT_HORDE]; - } - } else if (GT(GT_RACE)) { - if (g_instagib->integer) { - s = "Insta-Race"; - } else if (g_vampiric_damage->integer) { - s = "Vampiric Race"; - } else if (g_frenzy->integer) { - s = "Frenzy Race"; - } else if (g_nadefest->integer) { - s = "NadeFest Race"; - } else if (g_quadhog->integer) { - s = "Quad Hog Race"; - } else { - s = gt_long_name[GT_RACE]; - } - } else if (GT(GT_BALL)) { - if (g_instagib->integer) { - s = "Insta-ProBall"; - } else if (g_vampiric_damage->integer) { - s = "Vampiric ProBall"; - } else if (g_frenzy->integer) { - s = "Frenzy ProBall"; - } else if (g_nadefest->integer) { - s = "NadeFest ProBall"; - } else if (g_quadhog->integer) { - s = "Quad Hog ProBall"; - } else { - s = gt_long_name[GT_BALL]; - } - } else if (deathmatch->integer) { - if (g_instagib->integer) { - s = "InstaGib"; - } else if (g_vampiric_damage->integer) { - s = "Vampiric FFA"; - } else if (g_frenzy->integer) { - s = "Frenzy FFA"; - } else if (g_nadefest->integer) { - s = "NadeFest"; - } else if (g_quadhog->integer) { - s = "Quad Hog"; - } else { - s = gt_long_name[GT_FFA]; - } - } else { - s = "Unknown Gametype"; - } - } else { - if (coop->integer) { - s = "Co-op"; - } else { - s = "Single Player"; - } - } - if (s) - Q_strlcpy(level.gametype_name, s, sizeof(level.gametype_name)); -} - /*QUAKED worldspawn (0 0 0) ? Only used for the world. @@ -2268,7 +2005,7 @@ void SP_worldspawn(gentity_t *ent) { // [Paril-KEX] if (!deathmatch->integer) gi.configstring(CS_GAME_STYLE, G_Fmt("{}", (int32_t)game_style_t::GAME_STYLE_PVE).data()); - else if (Teams() && notGT(GT_RR)) + else if (Teams()) gi.configstring(CS_GAME_STYLE, G_Fmt("{}", (int32_t)game_style_t::GAME_STYLE_TDM).data()); else gi.configstring(CS_GAME_STYLE, G_Fmt("{}", (int32_t)game_style_t::GAME_STYLE_FFA).data()); @@ -2320,17 +2057,11 @@ void SP_worldspawn(gentity_t *ent) { if (!deathmatch->integer) PrecacheItem(GetItemByIndex(IT_COMPASS)); - if (!g_instagib->integer && !g_nadefest->integer && notGT(GT_BALL)) + if (!g_instagib->integer && !g_nadefest->integer) PrecacheItem(GetItemByIndex(IT_WEAPON_BLASTER)); - if (GT(GT_BALL)) - PrecacheItem(GetItemByIndex(IT_BALL)); - - if ((!strcmp(g_allow_grapple->string, "auto")) ? - (GTF(GTF_CTF) ? !level.no_grapple : 0) : - g_allow_grapple->integer) { + if ((!strcmp(g_allow_grapple->string, "auto")) ? 0 : g_allow_grapple->integer) PrecacheItem(GetItemByIndex(IT_WEAPON_GRAPPLE)); - } if (g_dm_random_items->integer) { for (item_id_t i = static_cast(IT_NULL + 1); i < IT_TOTAL; i = static_cast(i + 1)) @@ -2365,8 +2096,6 @@ void SP_worldspawn(gentity_t *ent) { PrecacheAssets(); - GT_SetLongName(); - // // Setup light animation tables. 'a' is total darkness, 'z' is doublebright. // diff --git a/src/g_target.cpp b/src/g_target.cpp index 5676f02..527c681 100644 --- a/src/g_target.cpp +++ b/src/g_target.cpp @@ -486,10 +486,6 @@ For gibs: void ED_CallSpawn(gentity_t *ent); static USE(use_target_spawner) (gentity_t *self, gentity_t *other, gentity_t *activator) -> void { - // don't trigger spawn monsters in horde mode - if (GT(GT_HORDE) && !Q_strncasecmp("monster_", self->target, 8)) - return; - gentity_t *ent; ent = G_Spawn(); @@ -2260,12 +2256,6 @@ static USE(target_remove_powerups_use) (gentity_t *ent, gentity_t *other, gentit } else if (itemlist[i].flags & IF_TECH) { activator->client->pers.inventory[i] = 0; Tech_DeadDrop(activator); - } else if (itemlist[i].id == IT_FLAG_BLUE) { - activator->client->pers.inventory[i] = 0; - CTF_ResetTeamFlag(TEAM_BLUE); - } else if (itemlist[i].id == IT_FLAG_RED) { - activator->client->pers.inventory[i] = 0; - CTF_ResetTeamFlag(TEAM_RED); } } } @@ -2516,7 +2506,7 @@ static USE(target_score_use) (gentity_t *self, gentity_t *other, gentity_t *acti if (!activator || !activator->client) return; - G_AdjustPlayerScore(activator->client, self->count, GT(GT_TDM) || self->spawnflags.has(1_spawnflag), self->count); + G_AdjustPlayerScore(activator->client, self->count, self->spawnflags.has(1_spawnflag), self->count); } void SP_target_score(gentity_t *ent) { diff --git a/src/g_trigger.cpp b/src/g_trigger.cpp index 9166ad3..7ef573f 100644 --- a/src/g_trigger.cpp +++ b/src/g_trigger.cpp @@ -438,12 +438,12 @@ void SP_trigger_deathcount(gentity_t *ent) { /*QUAKED trigger_no_monsters (1 0 0) (-8 -8 -8) (8 8 8) ONCE Fires targets only if all monsters have been killed or none are present. -Auto-removed in deathmatch (except horde mode). +Auto-removed in deathmatch. ONCE : will be removed after firing once */ void SP_trigger_no_monsters(gentity_t *ent) { - if (deathmatch->integer && notGT(GT_HORDE)) { + if (deathmatch->integer) { G_FreeEntity(ent); return; } @@ -461,12 +461,12 @@ void SP_trigger_no_monsters(gentity_t *ent) { /*QUAKED trigger_monsters (1 0 0) (-8 -8 -8) (8 8 8) ONCE Fires targets only if monsters are present in the level. -Auto-removed in deathmatch (except horde mode). +Auto-removed in deathmatch. ONCE : will be removed after firing once */ void SP_trigger_monsters(gentity_t *ent) { - if (deathmatch->integer && notGT(GT_HORDE)) { + if (deathmatch->integer) { G_FreeEntity(ent); return; } diff --git a/src/g_utils.cpp b/src/g_utils.cpp index 211074d..1b131e6 100644 --- a/src/g_utils.cpp +++ b/src/g_utils.cpp @@ -631,21 +631,6 @@ void G_AdjustPlayerScore(gclient_t *cl, int32_t offset, bool adjust_team, int32_ G_AdjustTeamScore(cl->sess.team, team_offset); } -/* -=================== -Horde_AdjustPlayerScore -=================== -*/ -void Horde_AdjustPlayerScore(gclient_t *cl, int32_t offset) { - if (notGT(GT_HORDE)) return; - if (!cl || !cl->pers.connected) return; - - if (IsScoringDisabled()) - return; - - G_AdjustPlayerScore(cl, offset, false, 0); -} - /* =================== G_SetPlayerScore @@ -677,7 +662,7 @@ void G_AdjustTeamScore(team_t team, int32_t offset) { if (level.intermission_queued) return; - if (!Teams() || GT(GT_RR)) + if (!Teams()) return; if (team == TEAM_RED) @@ -700,7 +685,7 @@ void G_SetTeamScore(team_t team, int32_t value) { if (level.intermission_queued) return; - if (!Teams() || GT(GT_RR)) + if (!Teams()) return; if (team == TEAM_RED) @@ -755,13 +740,7 @@ const char *G_PlaceString(int rank) { } bool ItemSpawnsEnabled() { - if (g_no_items->integer) - return false; - if (g_instagib->integer || g_nadefest->integer) - return false; - if (GTF(GTF_ARENA)) - return false; - return true; + return false; } @@ -809,8 +788,7 @@ bool loc_CanSee(gentity_t *targ, gentity_t *inflictor) { } bool Teams() { - return GTF(GTF_TEAMS); - //return GT(GT_CTF) || GT(GT_TDM) || GT(GT_FREEZE) || GT(GT_CA) || GT(GT_STRIKE) || GT(GT_RR); + return true; } /* @@ -909,10 +887,10 @@ bool IsCombatDisabled() { return true; if (level.match_state == matchst_t::MATCH_COUNTDOWN) return true; - if (GTF(GTF_ROUNDS) && level.match_state == matchst_t::MATCH_IN_PROGRESS) { + if (level.match_state == matchst_t::MATCH_IN_PROGRESS) { // added round ended to allow gibbing etc. at end of rounds // scoring to be explicitly disabled during this time - if (level.round_state == roundst_t::ROUND_COUNTDOWN && (notGT(GT_HORDE))) + if (level.round_state == roundst_t::ROUND_COUNTDOWN) return true; } return false; @@ -935,21 +913,9 @@ bool IsScoringDisabled() { return true; if (IsCombatDisabled()) return true; - if (GTF(GTF_ROUNDS) && level.round_state != roundst_t::ROUND_IN_PROGRESS) - return true; return false; } -gametype_t GT_IndexFromString(const char *in) { - for (size_t i = 0; i < gametype_t::GT_NUM_GAMETYPES; i++) { - if (!Q_strcasecmp(in, gt_short_name[i])) - return (gametype_t)i; - if (!Q_strcasecmp(in, gt_long_name[i])) - return (gametype_t)i; - } - return gametype_t::GT_NONE; -} - void BroadcastReadyReminderMessage() { for (auto ec : active_players()) { if (!ClientIsPlaying(ec->client)) @@ -979,7 +945,7 @@ void TeleportPlayerToRandomSpawnPoint(gentity_t *ent, bool fx) { } bool InCoopStyle() { - return coop->integer || GT(GT_HORDE); + return coop->integer; } /* diff --git a/src/g_weapon.cpp b/src/g_weapon.cpp index 8f32517..1af89db 100644 --- a/src/g_weapon.cpp +++ b/src/g_weapon.cpp @@ -635,16 +635,6 @@ static TOUCH(Grenade_Touch) (gentity_t *ent, gentity_t *other, const trace_t &tr return; } - if (GT(GT_BALL)) { - if ((tr.contents & CONTENTS_LAVA) || (tr.contents & CONTENTS_SLIME)) { - G_FreeEntity(ent); - return; - } - if (other->client) { - other->client->pers.inventory[IT_BALL] = 1; - } - } - ent->enemy = other; Grenade_Explode(ent); } @@ -748,29 +738,12 @@ void fire_handgrenade(gentity_t *self, const vec3_t &start, const vec3_t &aimdir grenade->flags |= (FL_DODGE | FL_TRAP); - if (GT(GT_BALL)) { - gitem_t *it = GetItemByIndex(IT_BALL); - if (it) - Drop_Item(self, it); - //return; - /* - grenade->s.effects |= EF_GRENADE | EF_COLOR_SHELL; - grenade->s.renderfx |= RF_GLOW | RF_NO_LOD | RF_IR_VISIBLE | RF_SHELL_RED | RF_SHELL_GREEN; - grenade->s.modelindex = gi.modelindex("models/items/ammo/grenades/medium/tris.md2"); - grenade->s.scale = 4.0f; - grenade->mins = { -15, -15, -15 }; - grenade->maxs = { 15, 15, 15 }; - grenade->movetype = MOVETYPE_TOSS; - grenade->solid = SOLID_TRIGGER; - */ - } else { - grenade->solid = SOLID_BBOX; - grenade->svflags |= SVF_PROJECTILE; + grenade->solid = SOLID_BBOX; + grenade->svflags |= SVF_PROJECTILE; - grenade->s.effects |= EF_GRENADE; - grenade->s.modelindex = gi.modelindex("models/objects/grenade3/tris.md2"); - grenade->s.scale = 1.25f; - } + grenade->s.effects |= EF_GRENADE; + grenade->s.modelindex = gi.modelindex("models/objects/grenade3/tris.md2"); + grenade->s.scale = 1.25f; grenade->owner = self; grenade->touch = Grenade_Touch; diff --git a/src/p_client.cpp b/src/p_client.cpp index e329bb5..9adfdc5 100644 --- a/src/p_client.cpp +++ b/src/p_client.cpp @@ -610,18 +610,10 @@ static void ClientObituary(gentity_t *self, gentity_t *inflictor, gentity_t *att if (level.match_state == matchst_t::MATCH_WARMUP_READYUP) { BroadcastReadyReminderMessage(); } else { - if (GTF(GTF_ROUNDS) && GTF(GTF_ELIMINATION) && level.round_state == roundst_t::ROUND_IN_PROGRESS) { + if (level.round_state == roundst_t::ROUND_IN_PROGRESS) { gi.LocClient_Print(self, PRINT_CENTER, "You were fragged by {}\nYou will respawn next round.", attacker->client->resp.netname); - } else if (GT(GT_FREEZE) && level.round_state == roundst_t::ROUND_IN_PROGRESS) { - bool last_standing = true; - if (self->client->sess.team == TEAM_RED && level.num_living_red > 1 || - self->client->sess.team == TEAM_BLUE && level.num_living_blue > 1) - last_standing = false; - gi.LocClient_Print(self, PRINT_CENTER, "You were frozen by {}{}", - attacker->client->resp.netname, - last_standing ? "" : "\nYou will respawn once thawed."); } else { - gi.LocClient_Print(self, PRINT_CENTER, "You were {} by {}", GT(GT_FREEZE) ? "frozen" : "fragged", attacker->client->resp.netname); + gi.LocClient_Print(self, PRINT_CENTER, "You were fragged by {}", attacker->client->resp.netname); } } } @@ -632,15 +624,15 @@ static void ClientObituary(gentity_t *self, gentity_t *inflictor, gentity_t *att if (level.match_state == matchst_t::MATCH_WARMUP_READYUP) { BroadcastReadyReminderMessage(); } else if (attacker->client->resp.kill_count && !(attacker->client->resp.kill_count % 10)) { - gi.LocBroadcast_Print(PRINT_CENTER, "{} is on a {} spree\nwith {} frags!", attacker->client->resp.netname, GT(GT_FREEZE) ? "freezing" : "fragging", attacker->client->resp.kill_count); + gi.LocBroadcast_Print(PRINT_CENTER, "{} is on a fragging spree\nwith {} frags!", attacker->client->resp.netname, attacker->client->resp.kill_count); } else if (self->client->resp.kill_count >= 10) { - gi.LocBroadcast_Print(PRINT_CENTER, "{} put an end to {}'s\n{} spree!", attacker->client->resp.netname, self->client->resp.netname, GT(GT_FREEZE) ? "freezing" : "fragging"); + gi.LocBroadcast_Print(PRINT_CENTER, "{} put an end to {}'s\nfragging spree!", attacker->client->resp.netname, self->client->resp.netname); } else if (Teams() || level.match_state != matchst_t::MATCH_IN_PROGRESS) { if (attacker->client->sess.pc.show_fragmessages) - gi.LocClient_Print(attacker, PRINT_CENTER, "You {} {}", GT(GT_FREEZE) ? "froze" : "fragged", self->client->resp.netname); + gi.LocClient_Print(attacker, PRINT_CENTER, "You fragged {}", self->client->resp.netname); } else { if (attacker->client->sess.pc.show_fragmessages) - gi.LocClient_Print(attacker, PRINT_CENTER, "You {} {}\n{} place with {}", GT(GT_FREEZE) ? "froze" : "fragged", + gi.LocClient_Print(attacker, PRINT_CENTER, "You fragged {}\n{} place with {}", self->client->resp.netname, G_PlaceString(attacker->client->resp.rank + 1), attacker->client->resp.score); } } @@ -670,9 +662,6 @@ static void TossClientItems(gentity_t *self) { if (!deathmatch->integer) return; - if (GTF(GTF_ARENA)) - return; - // don't drop anything when combat is disabled if (IsCombatDisabled()) return; @@ -709,9 +698,6 @@ static void TossClientItems(gentity_t *self) { //drop tech Tech_DeadDrop(self); - // drop CTF flags - CTF_DeadDropFlag(self); - // drop powerup quad = g_dm_no_quad_drop->integer ? false : (self->client->pu_time_quad > (level.time + 1_sec)); duelfire = g_dm_no_quadfire_drop->integer ? false : (self->client->pu_time_duelfire > (level.time + 1_sec)); @@ -919,10 +905,10 @@ DIE(player_die) (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int if (attacker && attacker->client && level.match_state == matchst_t::MATCH_IN_PROGRESS) { if (attacker == self || mod.friendly_fire) { if (!mod.no_point_loss) - G_AdjustPlayerScore(attacker->client, -1, GT(GT_TDM), -1); + G_AdjustPlayerScore(attacker->client, -1, false, -1); attacker->client->resp.kill_count = 0; } else { - G_AdjustPlayerScore(attacker->client, 1, GT(GT_TDM), 1); + G_AdjustPlayerScore(attacker->client, 1, false, 1); if (attacker->health > 0) attacker->client->resp.kill_count++; @@ -930,7 +916,7 @@ DIE(player_die) (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int } } else { if (!mod.no_point_loss) - G_AdjustPlayerScore(self->client, -1, GT(GT_TDM), -1); + G_AdjustPlayerScore(self->client, -1, false, -1); } MS_Adjust(self->client, MSTAT_DEATHS, 1); @@ -948,7 +934,6 @@ DIE(player_die) (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int self->client->ps.pmove.pm_type = PM_DEAD; ClientObituary(self, inflictor, attacker, mod); - CTF_ScoreBonuses(self, inflictor, attacker); TossClientItems(self); Weapon_Grapple_DoReset(self->client); @@ -997,13 +982,8 @@ DIE(player_die) (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage = 400; } - if (GT(GT_FREEZE) && !level.intermission_time && self->client->eliminated && !self->client->resp.thawer) { - self->s.effects |= EF_COLOR_SHELL; - self->s.renderfx |= (RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE); - } else { - self->s.effects = EF_NONE; - self->s.renderfx = RF_NONE; - } + self->s.effects = EF_NONE; + self->s.renderfx = RF_NONE; // make sure no trackers are still hurting us. if (self->client->tracker_pain_time) { @@ -1041,30 +1021,25 @@ DIE(player_die) (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int self->takedamage = false; } else { // normal death if (!self->deadflag) { - if (GT(GT_FREEZE)) { - self->s.frame = FRAME_crstnd01 - 1; - self->client->anim_end = self->s.frame; + // start a death animation + self->client->anim_priority = ANIM_DEATH; + if (self->client->ps.pmove.pm_flags & PMF_DUCKED) { + self->s.frame = FRAME_crdeath1 - 1; + self->client->anim_end = FRAME_crdeath5; } else { - // start a death animation - self->client->anim_priority = ANIM_DEATH; - if (self->client->ps.pmove.pm_flags & PMF_DUCKED) { - self->s.frame = FRAME_crdeath1 - 1; - self->client->anim_end = FRAME_crdeath5; - } else { - switch (irandom(3)) { - case 0: - self->s.frame = FRAME_death101 - 1; - self->client->anim_end = FRAME_death106; - break; - case 1: - self->s.frame = FRAME_death201 - 1; - self->client->anim_end = FRAME_death206; - break; - case 2: - self->s.frame = FRAME_death301 - 1; - self->client->anim_end = FRAME_death308; - break; - } + switch (irandom(3)) { + case 0: + self->s.frame = FRAME_death101 - 1; + self->client->anim_end = FRAME_death106; + break; + case 1: + self->s.frame = FRAME_death201 - 1; + self->client->anim_end = FRAME_death206; + break; + case 2: + self->s.frame = FRAME_death301 - 1; + self->client->anim_end = FRAME_death308; + break; } } static constexpr const char *death_sounds[] = { @@ -1184,13 +1159,8 @@ void InitClientPersistant(gentity_t *ent, gclient_t *client) { int health, armor; gitem_armor_t armor_type = jacketarmor_info; - if (GTF(GTF_ARENA)) { - health = clamp(g_arena_start_health->integer, 1, 999); - armor = clamp(g_arena_start_armor->integer, 0, 999); - } else { - health = clamp(g_starting_health->integer, 1, 999); - armor = clamp(g_starting_armor->integer, 0, 999); - } + health = clamp(g_starting_health->integer, 1, 999); + armor = clamp(g_starting_armor->integer, 0, 999); if (armor > jacketarmor_info.max_count) if (armor > combatarmor_info.max_count) @@ -1200,7 +1170,7 @@ void InitClientPersistant(gentity_t *ent, gclient_t *client) { client->pers.health = client->pers.max_health = health; int bonus = RS(RS_Q3A) ? 25 : g_starting_health_bonus->integer; - if (!(GTF(GTF_ARENA)) && bonus > 0) { + if (bonus > 0) { client->pers.health += bonus; if (!(RS(RS_Q3A))) { client->pers.health_bonus = bonus; @@ -1231,52 +1201,12 @@ void InitClientPersistant(gentity_t *ent, gclient_t *client) { } } - if (GT(GT_BALL)) { - client->pers.inventory[IT_WEAPON_CHAINFIST] = 1; - } else if (!taken_loadout) { + if (!taken_loadout) { if (g_instagib->integer) { client->pers.inventory[IT_WEAPON_RAILGUN] = 1; client->pers.inventory[IT_AMMO_SLUGS] = AMMO_INFINITE; } else if (g_nadefest->integer) { client->pers.inventory[IT_AMMO_GRENADES] = AMMO_INFINITE; - } else if (GTF(GTF_ARENA)) { - client->pers.max_ammo.fill(50); - client->pers.max_ammo[AMMO_SHELLS] = 50; - client->pers.max_ammo[AMMO_BULLETS] = 300; - client->pers.max_ammo[AMMO_GRENADES] = 50; - client->pers.max_ammo[AMMO_ROCKETS] = 50; - client->pers.max_ammo[AMMO_CELLS] = 200; - client->pers.max_ammo[AMMO_SLUGS] = 25; - /* - client->pers.max_ammo[AMMO_TRAP] = 5; - client->pers.max_ammo[AMMO_FLECHETTES] = 200; - client->pers.max_ammo[AMMO_DISRUPTOR] = 12; - client->pers.max_ammo[AMMO_TESLA] = 5; - */ - client->pers.inventory[IT_AMMO_SHELLS] = 50; - if (!(RS(RS_Q1))) { - client->pers.inventory[IT_AMMO_BULLETS] = 200; - client->pers.inventory[IT_AMMO_GRENADES] = 50; - } - client->pers.inventory[IT_AMMO_ROCKETS] = 50; - client->pers.inventory[IT_AMMO_CELLS] = 200; - if (!(RS(RS_Q1))) - client->pers.inventory[IT_AMMO_SLUGS] = 50; - - client->pers.inventory[IT_WEAPON_BLASTER] = 1; - client->pers.inventory[IT_WEAPON_SHOTGUN] = 1; - if (!(RS(RS_Q3A))) - client->pers.inventory[IT_WEAPON_SSHOTGUN] = 1; - if (!(RS(RS_Q1))) { - client->pers.inventory[IT_WEAPON_MACHINEGUN] = 1; - client->pers.inventory[IT_WEAPON_CHAINGUN] = 1; - } - client->pers.inventory[IT_WEAPON_GLAUNCHER] = 1; - client->pers.inventory[IT_WEAPON_RLAUNCHER] = 1; - client->pers.inventory[IT_WEAPON_HYPERBLASTER] = 1; - client->pers.inventory[IT_WEAPON_PLASMABEAM] = 1; - if (!(RS(RS_Q1))) - client->pers.inventory[IT_WEAPON_RAILGUN] = 1; } else { if (RS(RS_Q3A)) { client->pers.max_ammo.fill(200); @@ -1291,7 +1221,7 @@ void InitClientPersistant(gentity_t *ent, gclient_t *client) { client->pers.inventory[IT_WEAPON_CHAINFIST] = 1; client->pers.inventory[IT_WEAPON_MACHINEGUN] = 1; - client->pers.inventory[IT_AMMO_BULLETS] = (GT(GT_TDM)) ? 50 : 100; + client->pers.inventory[IT_AMMO_BULLETS] = 100; } else if (RS(RS_Q1)) { client->pers.max_ammo.fill(200); client->pers.max_ammo[AMMO_BULLETS] = 200; @@ -1352,8 +1282,7 @@ void InitClientPersistant(gentity_t *ent, gclient_t *client) { client->pers.inventory[IT_COMPASS] = 1; bool give_grapple = (!strcmp(g_allow_grapple->string, "auto")) ? - (GTF(GTF_CTF) ? !level.no_grapple : 0) : - (g_allow_grapple->integer && !g_grapple_offhand->integer); + 0 : (g_allow_grapple->integer && !g_grapple_offhand->integer); if (give_grapple) client->pers.inventory[IT_WEAPON_GRAPPLE] = 1; } @@ -2201,7 +2130,6 @@ void CopyToBodyQue(gentity_t *ent) { return; gentity_t *body; - bool frozen = !!(GT(GT_FREEZE) && !level.intermission_time && ent->client->eliminated && !ent->client->resp.thawer); // grab a body que and cycle to the next one body = &g_entities[game.maxclients + level.body_que + 1]; @@ -2216,13 +2144,8 @@ void CopyToBodyQue(gentity_t *ent) { body->s.number = body - g_entities; body->s.skinnum = ent->s.skinnum & 0xFF; // only copy the client # - if (frozen) { - body->s.effects |= EF_COLOR_SHELL; - body->s.renderfx |= (RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE); - } else { - body->s.effects = EF_NONE; - body->s.renderfx = RF_NONE; - } + body->s.effects = EF_NONE; + body->s.renderfx = RF_NONE; body->svflags = ent->svflags; body->absmin = ent->absmin; @@ -2246,7 +2169,7 @@ void CopyToBodyQue(gentity_t *ent) { } else body->mins = body->maxs = {}; - if (g_corpse_sink_time->value > 0 && notGT(GT_FREEZE)) { + if (g_corpse_sink_time->value > 0) { body->timestamp = level.time + gtime_t::from_sec(g_corpse_sink_time->value + 1.5); body->nextthink = level.time + gtime_t::from_sec(g_corpse_sink_time->value); body->think = BodySink; @@ -2318,11 +2241,6 @@ void ClientRespawn(gentity_t *ent) { CopyToBodyQue(ent); ent->svflags &= ~SVF_NOCLIENT; - if (GT(GT_RR) && level.match_state == matchst_t::MATCH_IN_PROGRESS) { - ent->client->sess.team = Teams_OtherTeam(ent->client->sess.team); - G_AssignPlayerSkin(ent, ent->client->pers.skin); - } - ClientSpawn(ent); G_PostRespawn(ent); return; @@ -2608,7 +2526,7 @@ void ClientSpawn(gentity_t *ent) { client_respawn_t resp; client_session_t sess; - if (GTF(GTF_ROUNDS) && GTF(GTF_ELIMINATION) && level.match_state == matchst_t::MATCH_IN_PROGRESS && notGT(GT_HORDE)) + if (level.match_state == matchst_t::MATCH_IN_PROGRESS) if (level.round_state == roundst_t::ROUND_IN_PROGRESS || level.round_state == roundst_t::ROUND_ENDED) ClientSetEliminated(ent); bool eliminated = ent->client->eliminated; @@ -2881,7 +2799,7 @@ void ClientSpawn(gentity_t *ent) { } // force the current weapon up - if (GTF(GTF_ARENA) && client->pers.inventory[IT_WEAPON_RLAUNCHER]) + if (client->pers.inventory[IT_WEAPON_RLAUNCHER]) client->newweapon = &itemlist[IT_WEAPON_RLAUNCHER]; else client->newweapon = client->pers.weapon; @@ -3496,7 +3414,6 @@ bool ClientConnect(gentity_t *ent, char *userinfo, const char *social_id, bool i // clear the respawning variables if (!ent->client->sess.initialised && !ent->client->sess.team) { - //gi.Com_PrintFmt_("ClientConnect: {} q={}\n", ent->client->resp.netname, ent->client->sess.duel_queued); // force team join ent->client->sess.team = deathmatch->integer ? TEAM_NONE : TEAM_FREE; ent->client->sess.pc.show_id = true; @@ -3645,9 +3562,6 @@ static trace_t G_PM_Clip(const vec3_t &start, const vec3_t *mins, const vec3_t * } bool G_ShouldPlayersCollide(bool weaponry) { - if (GT(GT_RACE)) - return false; - if (g_disable_player_collision->integer) return false; // only for debugging. @@ -3735,7 +3649,7 @@ static void P_FallingDamage(gentity_t *ent, const pmove_t &pm) { ent->s.event = EV_FALL_FAR; else ent->s.event = EV_FALL_MEDIUM; - if (!deathmatch->integer || !(g_dm_no_fall_damage->integer || GTF(GTF_ARENA))) { + if (!deathmatch->integer || !g_dm_no_fall_damage->integer) { ent->pain_debounce_time = level.time + FRAME_TIME_S; // no normal pain sound if (RS(RS_Q3A)) damage = ent->s.event == EV_FALL_FAR ? 10 : 5; diff --git a/src/p_hud.cpp b/src/p_hud.cpp index d965cbb..8b24b4f 100644 --- a/src/p_hud.cpp +++ b/src/p_hud.cpp @@ -11,19 +11,6 @@ INTERMISSION ====================================================================== */ -static const char *EndMatchVictorString() { - if (!level.intermission_time) - return nullptr; - - const char *s = nullptr; - - if (Teams() && !(GT(GT_RR))) { - - return s; - } - -} - void MultiplayerScoreboard(gentity_t *ent); void MoveClientToIntermission(gentity_t *ent) { @@ -193,7 +180,7 @@ void G_ReportMatchDetails(bool is_end) { static std::array player_ranks; player_ranks = {}; - bool teams = Teams() && notGT(GT_RR); + bool teams = Teams(); // teamplay is simple if (teams) { @@ -318,12 +305,10 @@ void TeamsScoreboardMessage(gentity_t *ent, gentity_t *killer) { static std::string string; string.clear(); - fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -40 cstring2 \"{} on {}\" "), level.gametype_name, level.level_name); + fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -40 cstring2 \"{}\" "), level.level_name); fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -30 cstring2 \"Score Limit: {}\" "), GT_ScoreLimit()); if (level.intermission_time) { - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -50 cstring2 \"{} - {}\" "), level.gamemod_name, level.gametype_name); - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -40 cstring2 \"[{}] {}\" "), level.mapname, level.level_name); if (level.match_start_time) { int t = (level.intermission_time - level.match_start_time - 1_sec).milliseconds(); fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -50 cstring2 \"Total Match Time: {}\" "), G_TimeStringMs(t, false)); @@ -337,72 +322,23 @@ void TeamsScoreboardMessage(gentity_t *ent, gentity_t *killer) { fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -10 cstring2 \"{} place with a score of {}\" "), G_PlaceString(ent->client->resp.rank + 1), ent->client->resp.score); } - //if (fraglimit->integer && !(GTF(GTF_ROUNDS))) - // fmt::format_to(std::back_inserter(string), FMT_STRING("xv -20 yv -10 loc_string2 1 $g_score_frags \"{}\" "), fraglimit->integer); - /* - else if (GT(GT_HORDE) && level.round_number > 0) - fmt::format_to(std::back_inserter(string), FMT_STRING("xv -20 yv -10 loc_string2 1 Wave: \"{}\" "), level.round_number); - */ - if (timelimit->value && !level.intermission_time) { - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 340 yv -10 time_limit {} "), gi.ServerFrame() + ((gtime_t::from_min(timelimit->value) - level.time)).milliseconds() / gi.frame_time_ms); -#if 0 - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 340 yv -10 loc_string2 1 {} "), gi.ServerFrame() + level.time.milliseconds() / gi.frame_time_ms); - int32_t val = gi.ServerFrame() + ((gtime_t::from_min(timelimit->value) - level.time)).milliseconds() / gi.frame_time_ms; - const char *s; - int32_t remaining_ms = gtime_t::from_ms(level.time); // (val - gi.ServerFrame()) *gi.frame_time_ms; - - s = G_Fmt("{:02}:{:02}", (remaining_ms / 1000) / 60, (remaining_ms / 1000) % 60).data(); - - fmt::format_to(std::back_inserter(string), FMT_STRING("xv 340 yv -10 loc_string2 1 \"{}\" "), s); -#endif - } fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yb -48 cstring2 \"{}\" "), "Use inventory bind to toggle menu."); } - if (GT(GT_CTF)) { - fmt::format_to(std::back_inserter(string), - FMT_STRING("if 25 xv -32 yv 8 pic 25 endif " - "xv 0 yv 28 string \"{}/{}\" " - "xv 58 yv 12 num 2 19 " - "xv -40 yv 42 string \"SC\" " - "xv -12 yv 42 picn ping " - "if 26 xv 208 yv 8 pic 26 endif " - "xv 240 yv 28 string \"{}/{}\" " - "xv 296 yv 12 num 2 21 " - "xv 200 yv 42 string \"SC\" " - "xv 228 yv 42 picn ping "), - total[0], teamsize, - total[1], teamsize); - } else if (GTF(GTF_ROUNDS)) { - fmt::format_to(std::back_inserter(string), - FMT_STRING("if 25 xv -32 yv 8 pic 25 endif " - "xv 0 yv 28 string \"{}/{}/{}\" " - "xv 58 yv 12 num 2 19 " - "xv -40 yv 42 string \"SC\" " - "xv -12 yv 42 picn ping " - "if 26 xv 208 yv 8 pic 26 endif " - "xv 240 yv 28 string \"{}/{}/{}\" " - "xv 296 yv 12 num 2 21 " - "xv 200 yv 42 string \"SC\" " - "xv 228 yv 42 picn ping "), - total_living[0], total[0], teamsize, - total_living[1], total[1], teamsize); - } else { - fmt::format_to(std::back_inserter(string), - FMT_STRING("if 25 xv -32 yv 8 pic 25 endif " - "xv -123 yv 28 cstring \"{}/{}\" " - "xv 41 yv 12 num 3 19 " - "xv -40 yv 42 string \"SC\" " - "xv -12 yv 42 picn ping " - "if 26 xv 208 yv 8 pic 26 endif " - "xv 117 yv 28 cstring \"{}/{}\" " - "xv 280 yv 12 num 3 21 " - "xv 200 yv 42 string \"SC\" " - "xv 228 yv 42 picn ping "), - total[0], teamsize, - total[1], teamsize); - } + fmt::format_to(std::back_inserter(string), + FMT_STRING("if 25 xv -32 yv 8 pic 25 endif " + "xv 0 yv 28 string \"{}/{}/{}\" " + "xv 58 yv 12 num 2 19 " + "xv -40 yv 42 string \"SC\" " + "xv -12 yv 42 picn ping " + "if 26 xv 208 yv 8 pic 26 endif " + "xv 240 yv 28 string \"{}/{}/{}\" " + "xv 296 yv 12 num 2 21 " + "xv 200 yv 42 string \"SC\" " + "xv 228 yv 42 picn ping "), + total_living[0], total[0], teamsize, + total_living[1], total[1], teamsize); for (i = 0; i < 16; i++) { if (i >= total[0] && i >= total[1]) @@ -415,17 +351,16 @@ void TeamsScoreboardMessage(gentity_t *ent, gentity_t *killer) { int ty = 52 + i * 8; - std::string_view entry = G_Fmt("ctf -40 {} {} {} {} {} ", + std::string_view entry = G_Fmt("ctf -40 {} {} {} {} \"\" ", ty, sorted[0][i], cl->resp.score, - cl->ping > 999 ? 999 : cl->ping, - cl_ent->client->pers.inventory[IT_FLAG_BLUE] ? "sbfctf2" : "\"\""); + cl->ping > 999 ? 999 : cl->ping); if (level.match_state == MATCH_WARMUP_READYUP && (cl->resp.ready || cl->sess.is_a_bot)) fmt::format_to(std::back_inserter(string), FMT_STRING("xv -56 yv {} picn {} "), ty - 2, "wheel/p_compass_selected"); - else if (GTF(GTF_ROUNDS) && level.match_state == MATCH_IN_PROGRESS && !cl->eliminated) + else if (level.match_state == MATCH_IN_PROGRESS && !cl->eliminated) fmt::format_to(std::back_inserter(string), FMT_STRING("xv -50 yv {} picn {} "), ty, "sbfctf1"); @@ -442,17 +377,16 @@ void TeamsScoreboardMessage(gentity_t *ent, gentity_t *killer) { int ty = 52 + i * 8; - std::string_view entry = G_Fmt("ctf 200 {} {} {} {} {} ", + std::string_view entry = G_Fmt("ctf 200 {} {} {} {} \"\" ", ty, sorted[1][i], cl->resp.score, - cl->ping > 999 ? 999 : cl->ping, - cl_ent->client->pers.inventory[IT_FLAG_RED] ? "sbfctf1" : "\"\""); + cl->ping > 999 ? 999 : cl->ping); if (level.match_state == MATCH_WARMUP_READYUP && (cl->resp.ready || cl->sess.is_a_bot)) fmt::format_to(std::back_inserter(string), FMT_STRING("xv 182 yv {} picn {} "), ty - 2, "wheel/p_compass_selected"); - else if (GTF(GTF_ROUNDS) && level.match_state == MATCH_IN_PROGRESS && !cl->eliminated) + else if (level.match_state == MATCH_IN_PROGRESS && !cl->eliminated) fmt::format_to(std::back_inserter(string), FMT_STRING("xv 190 yv {} picn {} "), ty, "sbfctf2"); @@ -528,12 +462,10 @@ static void DuelScoreboardMessage(gentity_t *ent, gentity_t *killer) { string.clear(); - fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -40 cstring2 \"{} on {}\" "), level.gametype_name, level.level_name); + fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -40 cstring2 \"{}\" "), level.level_name); fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -30 cstring2 \"Score Limit: {}\" "), GT_ScoreLimit()); if (level.intermission_time) { - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -50 cstring2 \"{} - {}\" "), level.gamemod_name, level.gametype_name); - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -40 cstring2 \"[{}] {}\" "), level.mapname, level.level_name); if (level.match_start_time) { int t = (level.intermission_time - level.match_start_time - 1_sec).milliseconds(); fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -50 cstring2 \"Total Match Time: {}\" "), G_TimeStringMs(t, false)); @@ -547,26 +479,6 @@ static void DuelScoreboardMessage(gentity_t *ent, gentity_t *killer) { fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -10 cstring2 \"{} place with a score of {}\" "), G_PlaceString(ent->client->resp.rank + 1), ent->client->resp.score); } - //if (fraglimit->integer && !(GTF(GTF_ROUNDS))) - // fmt::format_to(std::back_inserter(string), FMT_STRING("xv -20 yv -10 loc_string2 1 $g_score_frags \"{}\" "), fraglimit->integer); - /* - else if (GT(GT_HORDE) && level.round_number > 0) - fmt::format_to(std::back_inserter(string), FMT_STRING("xv -20 yv -10 loc_string2 1 Wave: \"{}\" "), level.round_number); - */ - if (timelimit->value && !level.intermission_time) { - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 340 yv -10 time_limit {} "), gi.ServerFrame() + ((gtime_t::from_min(timelimit->value) - level.time)).milliseconds() / gi.frame_time_ms); -#if 0 - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 340 yv -10 loc_string2 1 {} "), gi.ServerFrame() + level.time.milliseconds() / gi.frame_time_ms); - int32_t val = gi.ServerFrame() + ((gtime_t::from_min(timelimit->value) - level.time)).milliseconds() / gi.frame_time_ms; - const char *s; - int32_t remaining_ms = gtime_t::from_ms(level.time); // (val - gi.ServerFrame()) *gi.frame_time_ms; - - s = G_Fmt("{:02}:{:02}", (remaining_ms / 1000) / 60, (remaining_ms / 1000) % 60).data(); - - fmt::format_to(std::back_inserter(string), FMT_STRING("xv 340 yv -10 loc_string2 1 \"{}\" "), s); -#endif - } - fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yb -48 cstring2 \"{}\" "), "Use inventory bind to toggle menu."); } @@ -647,9 +559,6 @@ static void DuelScoreboardMessage(gentity_t *ent, gentity_t *killer) { if (ClientIsPlaying(cl)) continue; - if (!cl->sess.duel_queued) - continue; - if (!k) { k = 1; fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv {} loc_string2 0 \"Queued Contenders:\" "), j); @@ -658,12 +567,10 @@ static void DuelScoreboardMessage(gentity_t *ent, gentity_t *killer) { j += 8; } - std::string_view entry = G_Fmt("ctf {} {} {} {} {} \"\" ", + std::string_view entry = G_Fmt("ctf {} {} {} 0 0 \"\" ", -40, // x j, // y - level.sorted_clients[i], // playernum - cl->sess.wins, - cl->sess.losses + level.sorted_clients[i] // playernum ); if (string.size() + entry.size() < MAX_STRING_CHARS) @@ -693,9 +600,6 @@ static void DuelScoreboardMessage(gentity_t *ent, gentity_t *killer) { if (ClientIsPlaying(cl)) continue; - if (cl->sess.duel_queued) - continue; - if (!k) { k = 1; fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv {} loc_string2 0 \"Spectators:\" "), j); @@ -725,12 +629,10 @@ static void DuelScoreboardMessage(gentity_t *ent, gentity_t *killer) { } static inline void ScoreboardNotice(gentity_t *ent, std::string string) { - fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -40 cstring2 \"{} on {}\" "), level.gametype_name, level.level_name); + fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -40 cstring2 \"{}\" "), level.level_name); fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -30 cstring2 \"Score Limit: {}\" "), GT_ScoreLimit()); if (level.intermission_time) { - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -50 cstring2 \"{} - {}\" "), level.gamemod_name, level.gametype_name); - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -40 cstring2 \"[{}] {}\" "), level.mapname, level.level_name); if (level.match_start_time) { int t = (level.intermission_time - level.match_start_time - 1_sec).milliseconds(); fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -50 cstring2 \"Total Match Time: {}\" "), G_TimeStringMs(t, false)); @@ -744,26 +646,6 @@ static inline void ScoreboardNotice(gentity_t *ent, std::string string) { fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -10 cstring2 \"{} place with a score of {}\" "), G_PlaceString(ent->client->resp.rank + 1), ent->client->resp.score); } - //if (fraglimit->integer && !(GTF(GTF_ROUNDS))) - // fmt::format_to(std::back_inserter(string), FMT_STRING("xv -20 yv -10 loc_string2 1 $g_score_frags \"{}\" "), fraglimit->integer); - /* - else if (GT(GT_HORDE) && level.round_number > 0) - fmt::format_to(std::back_inserter(string), FMT_STRING("xv -20 yv -10 loc_string2 1 Wave: \"{}\" "), level.round_number); - */ - if (timelimit->value && !level.intermission_time) { - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 340 yv -10 time_limit {} "), gi.ServerFrame() + ((gtime_t::from_min(timelimit->value) - level.time)).milliseconds() / gi.frame_time_ms); -#if 0 - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 340 yv -10 loc_string2 1 {} "), gi.ServerFrame() + level.time.milliseconds() / gi.frame_time_ms); - int32_t val = gi.ServerFrame() + ((gtime_t::from_min(timelimit->value) - level.time)).milliseconds() / gi.frame_time_ms; - const char *s; - int32_t remaining_ms = gtime_t::from_ms(level.time); // (val - gi.ServerFrame()) *gi.frame_time_ms; - - s = G_Fmt("{:02}:{:02}", (remaining_ms / 1000) / 60, (remaining_ms / 1000) % 60).data(); - - fmt::format_to(std::back_inserter(string), FMT_STRING("xv 340 yv -10 loc_string2 1 \"{}\" "), s); -#endif - } - fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yb -48 cstring2 \"{}\" "), "Use inventory bind to toggle menu."); } } @@ -775,14 +657,10 @@ DeathmatchScoreboardMessage ================== */ void DeathmatchScoreboardMessage(gentity_t *ent, gentity_t *killer) { - if (Teams() && notGT(GT_RR)) { + if (Teams()) { TeamsScoreboardMessage(ent, ent->enemy); return; } - if (GT(GT_DUEL)) { - DuelScoreboardMessage(ent, ent->enemy); - return; - } uint8_t total = level.num_playing_clients; @@ -807,7 +685,7 @@ void DeathmatchScoreboardMessage(gentity_t *ent, gentity_t *killer) { y = 0 + 32 * (i % 8); // selected player/killer tag - if (cl_ent == ent || GT(GT_RR)) { + 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"; fmt::format_to(std::back_inserter(entry), FMT_STRING("xv {} yv {} picn {} "), x, y, s); } else if (cl_ent == killer) @@ -844,12 +722,10 @@ void DeathmatchScoreboardMessage(gentity_t *ent, gentity_t *killer) { entry.clear(); } - fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -40 cstring2 \"{} on {}\" "), level.gametype_name, level.level_name); + fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -40 cstring2 \"{}\" "), level.level_name); fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -30 cstring2 \"Score Limit: {}\" "), GT_ScoreLimit()); if (level.intermission_time) { - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -50 cstring2 \"{} - {}\" "), level.gamemod_name, level.gametype_name); - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -40 cstring2 \"[{}] {}\" "), level.mapname, level.level_name); if (level.match_start_time) { int t = (level.intermission_time - level.match_start_time - 1_sec).milliseconds(); fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -50 cstring2 \"Total Match Time: {}\" "), G_TimeStringMs(t, false)); @@ -863,26 +739,6 @@ void DeathmatchScoreboardMessage(gentity_t *ent, gentity_t *killer) { fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yv -10 cstring2 \"{} place with a score of {}\" "), G_PlaceString(ent->client->resp.rank + 1), ent->client->resp.score); } - //if (fraglimit->integer && !(GTF(GTF_ROUNDS))) - // fmt::format_to(std::back_inserter(string), FMT_STRING("xv -20 yv -10 loc_string2 1 $g_score_frags \"{}\" "), fraglimit->integer); - /* - else if (GT(GT_HORDE) && level.round_number > 0) - fmt::format_to(std::back_inserter(string), FMT_STRING("xv -20 yv -10 loc_string2 1 Wave: \"{}\" "), level.round_number); - */ - if (timelimit->value && !level.intermission_time) { - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 340 yv -10 time_limit {} "), gi.ServerFrame() + ((gtime_t::from_min(timelimit->value) - level.time)).milliseconds() / gi.frame_time_ms); -#if 0 - //fmt::format_to(std::back_inserter(string), FMT_STRING("xv 340 yv -10 loc_string2 1 {} "), gi.ServerFrame() + level.time.milliseconds() / gi.frame_time_ms); - int32_t val = gi.ServerFrame() + ((gtime_t::from_min(timelimit->value) - level.time)).milliseconds() / gi.frame_time_ms; - const char *s; - int32_t remaining_ms = gtime_t::from_ms(level.time); // (val - gi.ServerFrame()) *gi.frame_time_ms; - - s = G_Fmt("{:02}:{:02}", (remaining_ms / 1000) / 60, (remaining_ms / 1000) % 60).data(); - - fmt::format_to(std::back_inserter(string), FMT_STRING("xv 340 yv -10 loc_string2 1 \"{}\" "), s); -#endif - } - fmt::format_to(std::back_inserter(string), FMT_STRING("xv 0 yb -48 cstring2 \"{}\" "), "Use inventory bind to toggle menu."); } @@ -1072,15 +928,9 @@ void G_SetCoopStats(gentity_t *ent) { ent->client->ps.stats[STAT_LIVES] = 0; if (level.match_state == MATCH_IN_PROGRESS) { - if (GT(GT_HORDE)) - ent->client->ps.stats[STAT_MONSTER_COUNT] = level.total_monsters - level.killed_monsters; - else - ent->client->ps.stats[STAT_MONSTER_COUNT] = 0; + ent->client->ps.stats[STAT_MONSTER_COUNT] = 0; - if (GTF(GTF_ROUNDS)) - ent->client->ps.stats[STAT_ROUND_NUMBER] = level.round_number; - else - ent->client->ps.stats[STAT_ROUND_NUMBER] = 0; + ent->client->ps.stats[STAT_ROUND_NUMBER] = level.round_number; } // stat for text on what we're doing for respawn @@ -1177,113 +1027,8 @@ static void SetCrosshairIDView(gentity_t *ent) { } } - -static void CTF_SetStats(gentity_t *ent, bool blink) { - uint32_t i; - int p1, p2; - gentity_t *e; - - if (!(GTF(GTF_CTF))) return; - - // figure out what icon to display for team logos - // three states: - // flag at base - // flag taken - // flag dropped - p1 = ii_teams_red_default; - e = G_FindByString<&gentity_t::classname>(nullptr, ITEM_CTF_FLAG_RED); - if (e != nullptr) { - if (e->solid == SOLID_NOT) { - // not at base - // check if on player - p1 = ii_ctf_red_dropped; // default to dropped - for (i = 1; i <= game.maxclients; i++) - if (g_entities[i].inuse && - g_entities[i].client->pers.inventory[IT_FLAG_RED]) { - // enemy has it - p1 = ii_ctf_red_taken; - break; - } - - // [Paril-KEX] make sure there is a dropped version on the map somewhere - if (p1 == ii_ctf_red_dropped) { - e = G_FindByString<&gentity_t::classname>(e, ITEM_CTF_FLAG_RED); - - if (e == nullptr) { - CTF_ResetTeamFlag(TEAM_RED); - gi.LocBroadcast_Print(PRINT_HIGH, "$g_flag_returned", - Teams_TeamName(TEAM_RED)); - gi.sound(ent, CHAN_RELIABLE | CHAN_NO_PHS_ADD | CHAN_AUX, gi.soundindex("ctf/flagret.wav"), 1, ATTN_NONE, 0); - } - } - } else if (e->spawnflags.has(SPAWNFLAG_ITEM_DROPPED)) - p1 = ii_ctf_red_dropped; // must be dropped - } - p2 = ii_teams_blue_default; - e = G_FindByString<&gentity_t::classname>(nullptr, ITEM_CTF_FLAG_BLUE); - if (e != nullptr) { - if (e->solid == SOLID_NOT) { - // not at base - // check if on player - p2 = ii_ctf_blue_dropped; // default to dropped - for (i = 1; i <= game.maxclients; i++) - if (g_entities[i].inuse && - g_entities[i].client->pers.inventory[IT_FLAG_BLUE]) { - // enemy has it - p2 = ii_ctf_blue_taken; - break; - } - - // [Paril-KEX] make sure there is a dropped version on the map somewhere - if (p2 == ii_ctf_blue_dropped) { - e = G_FindByString<&gentity_t::classname>(e, ITEM_CTF_FLAG_BLUE); - - if (e == nullptr) { - CTF_ResetTeamFlag(TEAM_BLUE); - gi.LocBroadcast_Print(PRINT_HIGH, "$g_flag_returned", - Teams_TeamName(TEAM_BLUE)); - gi.sound(ent, CHAN_RELIABLE | CHAN_NO_PHS_ADD | CHAN_AUX, gi.soundindex("ctf/flagret.wav"), 1, ATTN_NONE, 0); - } - } - } else if (e->spawnflags.has(SPAWNFLAG_ITEM_DROPPED)) - p2 = ii_ctf_blue_dropped; // must be dropped - } - - ent->client->ps.stats[STAT_MINISCORE_FIRST_PIC] = p1; - ent->client->ps.stats[STAT_MINISCORE_SECOND_PIC] = p2; - - if (level.ctf_last_flag_capture && level.time - level.ctf_last_flag_capture < 5_sec) { - if (level.ctf_last_capture_team == TEAM_RED) - if (blink) - ent->client->ps.stats[STAT_MINISCORE_FIRST_PIC] = p1; - else - ent->client->ps.stats[STAT_MINISCORE_FIRST_PIC] = 0; - else if (blink) - ent->client->ps.stats[STAT_MINISCORE_SECOND_PIC] = p2; - else - ent->client->ps.stats[STAT_MINISCORE_SECOND_PIC] = 0; - } - - if (level.match_state == MATCH_IN_PROGRESS) { - ent->client->ps.stats[STAT_MINISCORE_FIRST_SCORE] = level.team_scores[TEAM_RED]; - ent->client->ps.stats[STAT_MINISCORE_SECOND_SCORE] = level.team_scores[TEAM_BLUE]; - } - - ent->client->ps.stats[STAT_CTF_FLAG_PIC] = 0; - if (ent->client->sess.team == TEAM_RED && - ent->client->pers.inventory[IT_FLAG_BLUE] && - (blink)) - ent->client->ps.stats[STAT_CTF_FLAG_PIC] = ii_teams_blue_default; - - else if (ent->client->sess.team == TEAM_BLUE && - ent->client->pers.inventory[IT_FLAG_RED] && - (blink)) - ent->client->ps.stats[STAT_CTF_FLAG_PIC] = ii_teams_red_default; -} - - static void SetMiniScoreStats(gentity_t *ent) { - bool teams = Teams() && notGT(GT_RR); + bool teams = Teams(); int16_t pos1_num = -1, pos2_num = -1; int16_t own_num = -1; @@ -1356,9 +1101,6 @@ static void SetMiniScoreStats(gentity_t *ent) { pos2_num = other_other_num; } - if (GT(GT_DUEL)) - ent->client->ps.stats[STAT_DUEL_HEADER] = ii_duel_header; - } else { // logo headers for the frag display ent->client->ps.stats[STAT_TEAM_RED_HEADER] = ii_teams_header_red; @@ -1380,48 +1122,39 @@ static void SetMiniScoreStats(gentity_t *ent) { } // set scores and images - if (GTF(GTF_CTF)) { - CTF_SetStats(ent, blink); + 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_SECOND_PIC] = ii_teams_blue_default; + ent->client->ps.stats[STAT_MINISCORE_SECOND_SCORE] = level.team_scores[TEAM_BLUE]; + } + + //TODO: configstrings?? + ent->client->ps.stats[STAT_MINISCORE_FIRST_VAL] = 0; // level.num_playing_red - level.num_eliminated_red; + ent->client->ps.stats[STAT_MINISCORE_SECOND_VAL] = 0; //level.num_playing_blue - level.num_eliminated_blue; } else { - 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_SECOND_PIC] = ii_teams_blue_default; - ent->client->ps.stats[STAT_MINISCORE_SECOND_SCORE] = level.team_scores[TEAM_BLUE]; - } + int16_t pic1 = 0, pic2 = 0; - if (GTF(GTF_ROUNDS)) { - //TODO: configstrings?? - ent->client->ps.stats[STAT_MINISCORE_FIRST_VAL] = 0; // level.num_playing_red - level.num_eliminated_red; - ent->client->ps.stats[STAT_MINISCORE_SECOND_VAL] = 0; //level.num_playing_blue - level.num_eliminated_blue; - } else { - ent->client->ps.stats[STAT_MINISCORE_FIRST_VAL] = 0; - ent->client->ps.stats[STAT_MINISCORE_SECOND_VAL] = 0; + ent->client->ps.stats[STAT_MINISCORE_FIRST_SCORE] = -999; + if (level.match_state == MATCH_IN_PROGRESS) { + if (pos1_num >= 0) { + pic1 = game.clients[pos1_num].pers.skin_icon_index; + ent->client->ps.stats[STAT_MINISCORE_FIRST_SCORE] = game.clients[pos1_num].resp.score; } - } else { - int16_t pic1 = 0, pic2 = 0; - - ent->client->ps.stats[STAT_MINISCORE_FIRST_SCORE] = -999; - if (level.match_state == MATCH_IN_PROGRESS) { - if (pos1_num >= 0) { - pic1 = game.clients[pos1_num].pers.skin_icon_index; - ent->client->ps.stats[STAT_MINISCORE_FIRST_SCORE] = game.clients[pos1_num].resp.score; - } - ent->client->ps.stats[STAT_MINISCORE_FIRST_PIC] = pic1; - } else - ent->client->ps.stats[STAT_MINISCORE_FIRST_PIC] = 0; - - ent->client->ps.stats[STAT_MINISCORE_SECOND_SCORE] = -999; - if (level.match_state == MATCH_IN_PROGRESS) { - if (pos2_num >= 0) { - pic2 = game.clients[pos2_num].pers.skin_icon_index; - ent->client->ps.stats[STAT_MINISCORE_SECOND_SCORE] = game.clients[pos2_num].resp.score; - } - ent->client->ps.stats[STAT_MINISCORE_SECOND_PIC] = pic2; - } else - ent->client->ps.stats[STAT_MINISCORE_SECOND_PIC] = 0; - } + ent->client->ps.stats[STAT_MINISCORE_FIRST_PIC] = pic1; + } else + ent->client->ps.stats[STAT_MINISCORE_FIRST_PIC] = 0; + + ent->client->ps.stats[STAT_MINISCORE_SECOND_SCORE] = -999; + if (level.match_state == MATCH_IN_PROGRESS) { + if (pos2_num >= 0) { + pic2 = game.clients[pos2_num].pers.skin_icon_index; + ent->client->ps.stats[STAT_MINISCORE_SECOND_SCORE] = game.clients[pos2_num].resp.score; + } + ent->client->ps.stats[STAT_MINISCORE_SECOND_PIC] = pic2; + } else + ent->client->ps.stats[STAT_MINISCORE_SECOND_PIC] = 0; } // highlight miniscores position/team @@ -1804,11 +1537,6 @@ void G_SetStats(gentity_t *ent) { ent->client->ps.stats[STAT_CROSSHAIR_ID_VIEW_COLOR] = 0; } - if (GT(GT_CTF)) { - //ent->client->ps.stats[STAT_MATCH_STATE] = level.match_state > matchst_t::MATCH_NONE ? CONFIG_MATCH_STATE : 0; - //ent->client->ps.stats[STAT_TEAMPLAY_INFO] = level.warnactive ? CONFIG_TEAMINFO : 0; - } - // match countdown ent->client->ps.stats[STAT_COUNTDOWN] = level.countdown_check.seconds(); // @@ -1850,7 +1578,7 @@ void G_SetStats(gentity_t *ent) { default: { if (t < 0 && t >= -4) { s1 = "OVERTIME!"; - } else if (GTF(GTF_ROUNDS)) { + } else { if (level.round_state == roundst_t::ROUND_COUNTDOWN) { s1 = "COUNTDOWN"; } else if (level.round_state == roundst_t::ROUND_IN_PROGRESS) { @@ -1859,8 +1587,6 @@ void G_SetStats(gentity_t *ent) { } else { s1 = ""; } - } else { - s1 = G_TimeString(t, false); } break; } diff --git a/src/p_view.cpp b/src/p_view.cpp index 6a16377..6feb635 100644 --- a/src/p_view.cpp +++ b/src/p_view.cpp @@ -568,11 +568,6 @@ static void G_CalcBlend(gentity_t *ent) { if (G_PowerUpExpiringRelative(remaining)) G_AddBlend(0.4f, 1, 0.4f, 0.04f, ent->client->ps.screen_blend); } -/*freeze*/ - else if (GT(GT_FREEZE) && ent->client->eliminated && !ent->client->follow_target && (!ent->client->resp.thawer)) { // || level.framenum &8)) - G_AddBlend(0.6f, 0.6f, 0.6f, 0.4f, ent->client->ps.screen_blend); - } -/*freeze*/ if (ent->client->nuke_time > level.time) { float brightness = (ent->client->nuke_time - level.time).seconds() / 2.0f; @@ -807,13 +802,6 @@ static void G_SetClientEffects(gentity_t *ent) { ent->s.renderfx |= RF_SHELL_RED; } - CTF_ClientEffects(ent); - - if (GT(GT_BALL) && ent->client->pers.inventory[IT_BALL] > 0) { - ent->s.effects |= EF_COLOR_SHELL; - ent->s.renderfx |= RF_SHELL_RED | RF_SHELL_GREEN; - } - if (ent->client->pu_time_quad > level.time) if (G_PowerUpExpiring(ent->client->pu_time_quad)) ent->s.effects |= EF_QUAD; @@ -1266,7 +1254,7 @@ void ClientEndServerFrame(gentity_t *ent) { ent->health -= quantity; ent->client->vampire_expiretime = level.time + 1_sec; if (ent->health <= 0) { - G_AdjustPlayerScore(ent->client, -1, GT(GT_TDM), -1); + G_AdjustPlayerScore(ent->client, -1, false, -1); player_die(ent, ent, ent, 1, vec3_origin, { MOD_EXPIRE, true }); if (!ent->client->eliminated) @@ -1306,13 +1294,6 @@ void ClientEndServerFrame(gentity_t *ent) { ent->client->menutime = 0_ms; } -/*freeze*/ - if (GT(GT_FREEZE) && !level.intermission_time && ent->client->eliminated && !ent->client->resp.thawer) { // || level.framenum & 8) { - ent->s.effects |= EF_COLOR_SHELL; - ent->s.renderfx |= (RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE); - } -/*freeze*/ - return; } diff --git a/src/p_weapon.cpp b/src/p_weapon.cpp index 7ab3e81..bd91f57 100644 --- a/src/p_weapon.cpp +++ b/src/p_weapon.cpp @@ -1812,7 +1812,7 @@ static void Weapon_Machinegun_Fire(gentity_t *ent) { int vs, hs; if (RS(RS_Q3A)) { - damage = GT(GT_TDM) ? 5 : 7; + damage = 7; vs = 200; hs = 200; } else { @@ -2297,23 +2297,6 @@ static void Weapon_ChainFist_Fire(gentity_t *ent) { // set start point vec3_t start, dir; - if (GT(GT_BALL) && ent->client->pers.inventory[IT_BALL] > 0) { - //fire_grenade(ent, start, dir, damage, 800, 25_sec, 0, (crandom_open() * 10.0f), (200 + crandom_open() * 10.0f), false); - - constexpr int pause_frames[] = { 29, 34, 39, 48, 0 }; - Throw_Generic(ent, 15, 48, 5, "weapons/hgrena1b.wav", 11, 12, pause_frames, true, "weapons/hgrenc1b.wav", Weapon_HandGrenade_Fire, true); - - gi.WriteByte(svc_muzzleflash); - gi.WriteEntity(ent); - gi.WriteByte(MZ_GRENADE | is_silenced); - gi.multicast(ent->s.origin, MULTICAST_PVS, false); - - PlayerNoise(ent, start, PNOISE_WEAPON); - - ent->client->pers.inventory[IT_BALL] = 0; - return; - } - P_ProjectSource(ent, ent->client->v_angle, { 0, 0, -4 }, start, dir); if (fire_player_melee(ent, start, dir, CHAINFIST_REACH, damage, 100, MOD_CHAINFIST)) {