From 6b5f5813e46217fbc250fae8f4d8b24ae8edc6a4 Mon Sep 17 00:00:00 2001 From: drjaska Date: Thu, 5 May 2022 15:55:26 +0300 Subject: [PATCH] fix gamemode checks where mode was checked to see if it's race or cts to also include ctscup --- qcsrc/common/effects/qc/gibs.qc | 2 +- .../gamemodes/gamemode/ctscup/cl_ctscup.qc | 18 +++++++++--------- .../common/gamemodes/gamemode/ctscup/ctscup.qh | 4 ++-- qcsrc/common/mapinfo.qc | 3 ++- qcsrc/common/mapobjects/teleporters.qc | 2 +- .../mutators/mutator/cloaked/sv_cloaked.qc | 2 +- .../mutator/powerups/powerup/invisibility.qc | 2 +- .../mutator/powerups/powerup/shield.qc | 2 +- .../mutators/mutator/powerups/powerup/speed.qc | 2 +- .../mutator/powerups/powerup/strength.qc | 2 +- qcsrc/common/util.qc | 2 +- qcsrc/menu/xonotic/util.qc | 1 + qcsrc/server/client.qc | 6 +++--- qcsrc/server/command/getreplies.qc | 4 ++-- qcsrc/server/compat/quake3.qc | 4 ++-- qcsrc/server/damage.qc | 2 +- qcsrc/server/impulse.qc | 4 ++-- qcsrc/server/items/items.qc | 2 +- qcsrc/server/race.qc | 10 +++++----- qcsrc/server/spawnpoints.qc | 2 +- qcsrc/server/world.qc | 1 + 21 files changed, 40 insertions(+), 37 deletions(-) diff --git a/qcsrc/common/effects/qc/gibs.qc b/qcsrc/common/effects/qc/gibs.qc index 64a847e27..7879f1734 100644 --- a/qcsrc/common/effects/qc/gibs.qc +++ b/qcsrc/common/effects/qc/gibs.qc @@ -22,7 +22,7 @@ bool Violence_GibSplash_SendEntity(entity this, entity to, int sf) void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker) { - if(g_cts) // no gibs in CTS + if(g_cts || g_ctscup) // no gibs in CTS return; entity e = new_pure(gibsplash); diff --git a/qcsrc/common/gamemodes/gamemode/ctscup/cl_ctscup.qc b/qcsrc/common/gamemodes/gamemode/ctscup/cl_ctscup.qc index 6afb8ccdf..953935045 100644 --- a/qcsrc/common/gamemodes/gamemode/ctscup/cl_ctscup.qc +++ b/qcsrc/common/gamemodes/gamemode/ctscup/cl_ctscup.qc @@ -6,37 +6,37 @@ REGISTER_MUTATOR(cl_ctscup, true); MUTATOR_HOOKFUNCTION(cl_ctscup, HUD_Physics_showoptional) { - return ISGAMETYPE(CTSCup); // show the optional physics panel + return ISGAMETYPE(CTSCUP); // show the optional physics panel } MUTATOR_HOOKFUNCTION(cl_ctscup, HUD_StrafeHUD_showoptional) { - return ISGAMETYPE(CTSCup); // show the optional strafehud + return ISGAMETYPE(CTSCUP); // show the optional strafehud } MUTATOR_HOOKFUNCTION(cl_ctscup, HUD_Score_show) { - return spectatee_status == -1 && ISGAMETYPE(CTSCup); // hide the score panel while observing + return spectatee_status == -1 && ISGAMETYPE(CTSCUP); // hide the score panel while observing } MUTATOR_HOOKFUNCTION(cl_ctscup, DrawScoreboardItemStats) { - return ISGAMETYPE(CTSCup); // hide the item stats panel + return ISGAMETYPE(CTSCUP); // hide the item stats panel } MUTATOR_HOOKFUNCTION(cl_ctscup, DrawDeathScoreboard) { - return ISGAMETYPE(CTSCup); // no scoreboard shown while dead + return ISGAMETYPE(CTSCUP); // no scoreboard shown while dead } MUTATOR_HOOKFUNCTION(cl_ctscup, DrawScoreboardAccuracy) { - return ISGAMETYPE(CTSCup); // accuracy is not a factor in this gamemode + return ISGAMETYPE(CTSCUP); // accuracy is not a factor in this gamemode } MUTATOR_HOOKFUNCTION(cl_ctscup, ShowRankings) { - if(ISGAMETYPE(CTSCup)) + if(ISGAMETYPE(CTSCUP)) { M_ARGV(0, string) = _("Rankings"); return true; @@ -45,10 +45,10 @@ MUTATOR_HOOKFUNCTION(cl_ctscup, ShowRankings) MUTATOR_HOOKFUNCTION(cl_ctscup, ShowNames_Draw) { - return (ISGAMETYPE(CTSCup) && M_ARGV(1, float) < ALPHA_MIN_VISIBLE); + return (ISGAMETYPE(CTSCUP) && M_ARGV(1, float) < ALPHA_MIN_VISIBLE); } MUTATOR_HOOKFUNCTION(cl_ctscup, ShowRaceTimer) { - return ISGAMETYPE(CTSCup); // show the race timer panel + return ISGAMETYPE(CTSCUP); // show the race timer panel } diff --git a/qcsrc/common/gamemodes/gamemode/ctscup/ctscup.qh b/qcsrc/common/gamemodes/gamemode/ctscup/ctscup.qh index d51636b0e..254ddef43 100644 --- a/qcsrc/common/gamemodes/gamemode/ctscup/ctscup.qh +++ b/qcsrc/common/gamemodes/gamemode/ctscup/ctscup.qh @@ -32,5 +32,5 @@ CLASS(RaceCTSCup, Gametype) #endif ATTRIB(RaceCTSCup, m_legacydefaults, string, "20 0 0"); ENDCLASS(RaceCTSCup) -REGISTER_GAMETYPE(CTSCup, NEW(RaceCTSCup)); -#define g_ctscup IS_GAMETYPE(CTSCup) +REGISTER_GAMETYPE(CTSCUP, NEW(RaceCTSCup)); +#define g_ctscup IS_GAMETYPE(CTSCUP) diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index c0b67ff4d..8413d4f8f 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -398,6 +398,7 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp { MapInfo_Map_supportedGametypes &= ~MAPINFO_TYPE_RACE.m_flags; MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CTS.m_flags; + MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CTSCUP.m_flags; } LOG_TRACE("-> diameter ", ftos(diameter)); @@ -1142,7 +1143,7 @@ int MapInfo_CurrentFeatures() int req = 0; // TODO: find a better way to check if weapons are required on the map if(!(cvar("g_instagib") || cvar("g_overkill") || cvar("g_nix") || cvar("g_weaponarena") || !cvar("g_pickup_items") || !cvar("g_melee_only") - || cvar("g_race") || cvar("g_cts") || cvar("g_nexball") || cvar("g_ca") || cvar("g_freezetag") || cvar("g_lms"))) + || cvar("g_race") || cvar("g_cts") || cvar("g_ctscup") || cvar("g_nexball") || cvar("g_ca") || cvar("g_freezetag") || cvar("g_lms"))) req |= MAPINFO_FEATURE_WEAPONS; return req; } diff --git a/qcsrc/common/mapobjects/teleporters.qc b/qcsrc/common/mapobjects/teleporters.qc index c8f9ad245..38727c1d5 100644 --- a/qcsrc/common/mapobjects/teleporters.qc +++ b/qcsrc/common/mapobjects/teleporters.qc @@ -146,7 +146,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle if(IS_PLAYER(player)) { if((tflags & TELEPORT_FLAG_TDEATH) && player.takedamage && !IS_DEAD(player) - && !g_race && !g_cts && (autocvar_g_telefrags || (tflags & TELEPORT_FLAG_FORCE_TDEATH)) + && !g_race && !g_cts && !g_ctscup && (autocvar_g_telefrags || (tflags & TELEPORT_FLAG_FORCE_TDEATH)) && !(round_handler_IsActive() && !round_handler_IsRoundStarted())) { tdeath(player, teleporter, telefragger, telefragmin, telefragmax); diff --git a/qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qc b/qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qc index 5f9de3b7c..2472269b1 100644 --- a/qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qc +++ b/qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qc @@ -14,5 +14,5 @@ MUTATOR_HOOKFUNCTION(cloaked, SetDefaultAlpha) MUTATOR_HOOKFUNCTION(cloaked, BuildMutatorsPrettyString) { - if (!g_cts) M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Cloaked"); + if (!g_cts && !g_ctscup) M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Cloaked"); } diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc index dda2dcf8f..ed8be1430 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc +++ b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc @@ -24,7 +24,7 @@ METHOD(Invisibility, m_apply, void(StatusEffects this, entity actor, float eff_t bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); if(!wasactive && IS_PLAYER(actor)) { - if(!g_cts) + if((!g_cts && !g_ctscup)) Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_INVISIBILITY, actor.netname); Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_INVISIBILITY); } diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qc b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qc index 230967b2b..1d98b28c8 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qc +++ b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qc @@ -19,7 +19,7 @@ METHOD(Shield, m_apply, void(StatusEffects this, entity actor, float eff_time, f bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); if(!wasactive && IS_PLAYER(actor)) { - if(!g_cts) + if(!g_cts && !g_ctscup) Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_SHIELD, actor.netname); Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_SHIELD); } diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qc b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qc index 4a2fe2c89..1b9a5a844 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qc +++ b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qc @@ -19,7 +19,7 @@ METHOD(Speed, m_apply, void(StatusEffects this, entity actor, float eff_time, fl bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); if(!wasactive && IS_PLAYER(actor)) { - if(!g_cts) + if(!g_cts && !g_ctscup) Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_SPEED, actor.netname); Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_SPEED); } diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qc b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qc index c2f257292..0ba12624d 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qc +++ b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qc @@ -19,7 +19,7 @@ METHOD(Strength, m_apply, void(StatusEffects this, entity actor, float eff_time, bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); if(!wasactive && IS_PLAYER(actor)) { - if(!g_cts) + if(!g_cts && !g_ctscup) Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_STRENGTH, actor.netname); Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_STRENGTH); } diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 0b1b96880..05ada8d39 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -1045,7 +1045,7 @@ float isGametypeInFilter(Gametype gt, float tp, float ts, string pattern) subpattern3 = ",teamspawns,"; else subpattern3 = ",noteamspawns,"; - if(gt == MAPINFO_TYPE_RACE || gt == MAPINFO_TYPE_CTS) + if(gt == MAPINFO_TYPE_RACE || gt == MAPINFO_TYPE_CTS || gt == MAPINFO_TYPE_CTSCUP) subpattern4 = ",race,"; else subpattern4 = string_null; diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index 691404ac1..154d24d28 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -694,6 +694,7 @@ float updateCompression() #define HIDDEN_GAMETYPES \ GAMETYPE(MAPINFO_TYPE_RACE) \ GAMETYPE(MAPINFO_TYPE_CTS) \ + GAMETYPE(MAPINFO_TYPE_CTSCUP) \ /**/ Gametype GameType_GetID(int cnt) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index cab642e67..db41740cf 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1051,7 +1051,7 @@ void SendWelcomemessage_msg_type(entity this, bool force_centerprint, int msg_ty modifications = strcat(modifications, ", No start weapons"); if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity"))) modifications = strcat(modifications, ", Low gravity"); - if(g_weapon_stay && !g_cts) + if(g_weapon_stay && !g_cts && !g_ctscup) modifications = strcat(modifications, ", Weapons stay"); if(autocvar_g_jetpack) modifications = strcat(modifications, ", Jetpack"); @@ -1508,7 +1508,7 @@ void player_powerups(entity this) this.items = this.items | IT_SUPERWEAPON; if(!(this.items & IT_UNLIMITED_SUPERWEAPONS)) { - if(!g_cts) + if(!g_cts && !g_ctscup) Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_SUPERWEAPON_PICKUP, this.netname); Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP); } @@ -1817,7 +1817,7 @@ void SetSpectatee_status(entity this, int spectatee_num) STAT(PRESSED_KEYS, this) = 0; } ClientData_Touch(this); - if (g_race || g_cts) race_InitSpectator(); + if (g_race || g_cts || g_ctscup) race_InitSpectator(); } } diff --git a/qcsrc/server/command/getreplies.qc b/qcsrc/server/command/getreplies.qc index 3f82484ab..f23410176 100644 --- a/qcsrc/server/command/getreplies.qc +++ b/qcsrc/server/command/getreplies.qc @@ -73,7 +73,7 @@ string getladder() int i, j, k, uidcnt = 0, thiscnt; string s, temp_s, rr, myuid, thisuid; - rr = (g_cts) ? CTS_RECORD : RACE_RECORD; + rr = ((g_cts || g_ctscup)) ? CTS_RECORD : RACE_RECORD; for (k = 0; k < MapInfo_count; ++k) { @@ -266,7 +266,7 @@ string getlsmaps() continue; // we still get the added count, but skip the actual processing // todo: Check by play count of maps for other game types? - if((g_race || g_cts) && !race_readTime(MapInfo_Map_bspname, 1)) + if((g_race || g_cts || g_ctscup) && !race_readTime(MapInfo_Map_bspname, 1)) { newmaps = true; if (i % 2) col = "^4*"; else col = "^5*"; diff --git a/qcsrc/server/compat/quake3.qc b/qcsrc/server/compat/quake3.qc index 911ab0f81..609b8b602 100644 --- a/qcsrc/server/compat/quake3.qc +++ b/qcsrc/server/compat/quake3.qc @@ -249,7 +249,7 @@ void score_use(entity this, entity actor, entity trigger) } spawnfunc(target_score) { - if(!g_cts) { delete(this); return; } + if(!g_cts && !g_ctscup) { delete(this); return; } if(!this.count) this.count = 1; @@ -265,7 +265,7 @@ void fragsfilter_use(entity this, entity actor, entity trigger) } spawnfunc(target_fragsFilter) { - if(!g_cts) { delete(this); return; } + if(!g_cts && !g_ctscup) { delete(this); return; } if(!this.frags) this.frags = 1; diff --git a/qcsrc/server/damage.qc b/qcsrc/server/damage.qc index d0b3a288f..f9bb25d9d 100644 --- a/qcsrc/server/damage.qc +++ b/qcsrc/server/damage.qc @@ -142,7 +142,7 @@ void Obituary_SpecialDeath( return; } - if(g_cts && deathtype == DEATH_KILL.m_id) + if((g_cts || g_ctscup) && deathtype == DEATH_KILL.m_id) return; // TODO: somehow put this in CTS gamemode file! Notification death_message = (murder) ? deathent.death_msgmurder : deathent.death_msgself; diff --git a/qcsrc/server/impulse.qc b/qcsrc/server/impulse.qc index be66fe968..8267dca91 100644 --- a/qcsrc/server/impulse.qc +++ b/qcsrc/server/impulse.qc @@ -502,7 +502,7 @@ IMPULSE(waypoint_clear_personal) delete(this.personal); this.personal = NULL; - if((g_cts || g_race) && autocvar_g_allow_checkpoints) + if((g_race || g_cts || g_ctscup) && autocvar_g_allow_checkpoints) ClientKill(this); } sprint(this, "personal waypoint cleared\n"); @@ -515,7 +515,7 @@ IMPULSE(waypoint_clear) { delete(this.personal); this.personal = NULL; - if((g_cts || g_race) && autocvar_g_allow_checkpoints) + if((g_race || g_cts || g_ctscup) && autocvar_g_allow_checkpoints) ClientKill(this); } sprint(this, "all waypoints cleared\n"); diff --git a/qcsrc/server/items/items.qc b/qcsrc/server/items/items.qc index 99c0165fd..56e8f73ec 100644 --- a/qcsrc/server/items/items.qc +++ b/qcsrc/server/items/items.qc @@ -603,7 +603,7 @@ bool Item_GiveTo(entity item, entity player) return false; // crude hack to enforce switching weapons - if(g_cts && item.itemdef.instanceOfWeaponPickup && !CS_CVAR(player).cvar_cl_cts_noautoswitch) + if((g_cts || g_ctscup) && item.itemdef.instanceOfWeaponPickup && !CS_CVAR(player).cvar_cl_cts_noautoswitch) { for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 4ecda0a9a..24a25f87f 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -1036,7 +1036,7 @@ vector trigger_race_checkpoint_spawn_evalfunc(entity this, entity player, entity spawnfunc(trigger_race_checkpoint) { vector o; - if(!g_race && !g_cts) { delete(this); return; } + if(!g_race && !g_cts && !g_ctscup) { delete(this); return; } EXACTTRIGGER_INIT; @@ -1091,7 +1091,7 @@ spawnfunc(trigger_race_checkpoint) void target_checkpoint_setup(entity this) { - if(!g_race && !g_cts) { delete(this); return; } + if(!g_race && !g_cts && !g_ctscup) { delete(this); return; } defrag_ents = 1; // if this is targeted, then it probably isn't a trigger @@ -1178,7 +1178,7 @@ void race_PreparePlayer(entity this) void race_RetractPlayer(entity this) { - if(!g_race && !g_cts) + if(!g_race && !g_cts && !g_ctscup) return; if(this.race_respawn_checkpoint == 0 || this.race_respawn_checkpoint == race_timed_checkpoint) race_ClearTime(this); @@ -1187,7 +1187,7 @@ void race_RetractPlayer(entity this) spawnfunc(info_player_race) { - if(!g_race && !g_cts) { delete(this); return; } + if(!g_race && !g_cts && !g_ctscup) { delete(this); return; } ++race_spawns; spawnfunc_info_player_deathmatch(this); @@ -1262,7 +1262,7 @@ void penalty_use(entity this, entity actor, entity trigger) spawnfunc(trigger_race_penalty) { // TODO: find out why this wasnt done: - //if(!g_cts && !g_race) { remove(this); return; } + //if(!g_race && !g_cts && !g_ctscup) { remove(this); return; } EXACTTRIGGER_INIT; diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index ab0d2bea4..c3a39bca6 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -259,7 +259,7 @@ vector Spawn_Score(entity this, entity spot, float mindist, float teamcheck, boo } } - if(!found && !g_cts) + if(!found && !g_cts && !g_ctscup) { LOG_TRACE("WARNING: spawnpoint at ", vtos(spot.origin), " could not find its target ", spot.target); return '-1 0 0'; diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index fca7c1741..3b06e6eac 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -271,6 +271,7 @@ void cvar_changes_init() BADCVAR("g_conquest_teams"); BADCVAR("g_ctf"); BADCVAR("g_cts"); + BADCVAR("g_ctscup"); BADCVAR("g_dotc"); BADCVAR("g_dm"); BADCVAR("g_domination"); -- 2.39.2