From: bones_was_here Date: Sun, 26 Jan 2025 10:32:29 +0000 (+1000) Subject: Apply standard code style to gametype headers and ecs code X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9a31fe17a4dceb1d91bffc4109cf62b13d0a3ad9;p=xonotic%2Fxonotic-data.pk3dir.git Apply standard code style to gametype headers and ecs code --- diff --git a/qcsrc/common/gamemodes/gamemode/assault/assault.qh b/qcsrc/common/gamemodes/gamemode/assault/assault.qh index c07002d8f3..f0a500e903 100644 --- a/qcsrc/common/gamemodes/gamemode/assault/assault.qh +++ b/qcsrc/common/gamemodes/gamemode/assault/assault.qh @@ -3,25 +3,25 @@ #include CLASS(Assault, Gametype) - INIT(Assault) - { - this.gametype_init(this, _("Assault"),"as","g_assault",GAMETYPE_FLAG_TEAMPLAY,"","timelimit=20",_("Destroy obstacles to find and destroy the enemy power core before time runs out")); - } - METHOD(Assault, m_generate_mapinfo, void(Gametype this, string v)) - { - if(v == "target_assault_roundend") - MapInfo_Map_supportedGametypes |= this.gametype_flags; - } - METHOD(Assault, m_isTwoBaseMode, bool()) - { - return true; - } - METHOD(Assault, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Point limit:"), 50, 500, 10, string_null, string_null, string_null); - } - ATTRIB(Assault, m_legacydefaults, string, "20 0"); + INIT(Assault) + { + this.gametype_init(this, _("Assault"),"as","g_assault",GAMETYPE_FLAG_TEAMPLAY,"","timelimit=20",_("Destroy obstacles to find and destroy the enemy power core before time runs out")); + } + METHOD(Assault, m_generate_mapinfo, void(Gametype this, string v)) + { + if(v == "target_assault_roundend") + MapInfo_Map_supportedGametypes |= this.gametype_flags; + } + METHOD(Assault, m_isTwoBaseMode, bool()) + { + return true; + } + METHOD(Assault, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Point limit:"), 50, 500, 10, string_null, string_null, string_null); + } + ATTRIB(Assault, m_legacydefaults, string, "20 0"); ENDCLASS(Assault) REGISTER_GAMETYPE(ASSAULT, NEW(Assault)); #define g_assault IS_GAMETYPE(ASSAULT) diff --git a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh index 6e30d4d9d5..803d6ec87f 100644 --- a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh +++ b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh @@ -13,18 +13,19 @@ IntrusiveList g_assault_objectives; REGISTER_MUTATOR(as, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); MUTATOR_ONADD { g_assault_destructibles = IL_NEW(); g_assault_objectivedecreasers = IL_NEW(); g_assault_objectives = IL_NEW(); - GameRules_teams(true); - int teams = BITS(2); // always red vs blue - GameRules_scoring(teams, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, { - field_team(ST_ASSAULT_OBJECTIVES, "objectives", SFL_SORT_PRIO_PRIMARY); - field(SP_ASSAULT_OBJECTIVES, "objectives", SFL_SORT_PRIO_PRIMARY); - }); + GameRules_teams(true); + int teams = BITS(2); // always red vs blue + GameRules_scoring(teams, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, + { + field_team(ST_ASSAULT_OBJECTIVES, "objectives", SFL_SORT_PRIO_PRIMARY); + field(SP_ASSAULT_OBJECTIVES, "objectives", SFL_SORT_PRIO_PRIMARY); + }); } return 0; } diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/clanarena.qh b/qcsrc/common/gamemodes/gamemode/clanarena/clanarena.qh index b3a8635a14..392786842b 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/clanarena.qh +++ b/qcsrc/common/gamemodes/gamemode/clanarena/clanarena.qh @@ -7,43 +7,45 @@ void HUD_Mod_CA(vector pos, vector mySize); void HUD_Mod_CA_Export(int fh); #endif CLASS(ClanArena, Gametype) - INIT(ClanArena) - { - this.gametype_init(this, _("Clan Arena"),"ca","g_ca",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=10 teams=2 leadlimit=6",_("Kill all enemy teammates to win the round")); - } - METHOD(ClanArena, m_parse_mapinfo, bool(string k, string v)) - { - if (!k) { - cvar_set("g_ca_teams", cvar_defstring("g_ca_teams")); - return true; - } - switch (k) { - case "teams": - cvar_set("g_ca_teams", v); - return true; - } - return false; - } - METHOD(ClanArena, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) - { - if(spawnpoints >= 8 && diameter > 3250) - return true; - return false; - } - METHOD(ClanArena, m_setTeams, void(string sa)) - { - cvar_set("g_ca_teams", sa); - } - METHOD(ClanArena, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Round limit:"), 5, 100, 5, "fraglimit_override", "g_ca_teams_override", _("The amount of rounds won needed before the match will end")); - } + INIT(ClanArena) + { + this.gametype_init(this, _("Clan Arena"),"ca","g_ca",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=10 teams=2 leadlimit=6",_("Kill all enemy teammates to win the round")); + } + METHOD(ClanArena, m_parse_mapinfo, bool(string k, string v)) + { + if (!k) + { + cvar_set("g_ca_teams", cvar_defstring("g_ca_teams")); + return true; + } + switch (k) + { + case "teams": + cvar_set("g_ca_teams", v); + return true; + } + return false; + } + METHOD(ClanArena, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + if(spawnpoints >= 8 && diameter > 3250) + return true; + return false; + } + METHOD(ClanArena, m_setTeams, void(string sa)) + { + cvar_set("g_ca_teams", sa); + } + METHOD(ClanArena, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Round limit:"), 5, 100, 5, "fraglimit_override", "g_ca_teams_override", _("The amount of rounds won needed before the match will end")); + } #ifdef CSQC - ATTRIB(ClanArena, m_modicons, void(vector pos, vector mySize), HUD_Mod_CA); - ATTRIB(ClanArena, m_modicons_export, void(int fh), HUD_Mod_CA_Export); + ATTRIB(ClanArena, m_modicons, void(vector pos, vector mySize), HUD_Mod_CA); + ATTRIB(ClanArena, m_modicons_export, void(int fh), HUD_Mod_CA_Export); #endif - ATTRIB(ClanArena, m_legacydefaults, string, "10 20 0"); + ATTRIB(ClanArena, m_legacydefaults, string, "10 20 0"); ENDCLASS(ClanArena) REGISTER_GAMETYPE(CA, NEW(ClanArena)); #define g_ca IS_GAMETYPE(CA) diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh index 3a9931e431..cb2d20ec04 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh @@ -29,22 +29,23 @@ bool ca_isEliminated(entity e); REGISTER_MUTATOR(ca, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); MUTATOR_ONADD { GameRules_teams(true); - GameRules_spawning_teams(autocvar_g_ca_team_spawns); - GameRules_limit_score(autocvar_g_ca_point_limit); - GameRules_limit_lead(autocvar_g_ca_point_leadlimit); + GameRules_spawning_teams(autocvar_g_ca_team_spawns); + GameRules_limit_score(autocvar_g_ca_point_limit); + GameRules_limit_lead(autocvar_g_ca_point_leadlimit); ca_teams = autocvar_g_ca_teams_override; if (ca_teams < 2) ca_teams = cvar("g_ca_teams"); // read the cvar directly as it gets written earlier in the same frame ca_teams = BITS(bound(2, ca_teams, 4)); - GameRules_scoring(ca_teams, SFL_SORT_PRIO_PRIMARY, 0, { - field_team(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY); - }); + GameRules_scoring(ca_teams, SFL_SORT_PRIO_PRIMARY, 0, + { + field_team(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY); + }); allowed_to_spawn = true; g_ca_spectate_enemies = autocvar_g_ca_spectate_enemies; diff --git a/qcsrc/common/gamemodes/gamemode/ctf/ctf.qh b/qcsrc/common/gamemodes/gamemode/ctf/ctf.qh index c5d15fec94..ae53b213e4 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/ctf.qh +++ b/qcsrc/common/gamemodes/gamemode/ctf/ctf.qh @@ -7,33 +7,33 @@ void HUD_Mod_CTF(vector pos, vector mySize); void HUD_Mod_CTF_Reset(); #endif CLASS(CaptureTheFlag, Gametype) - INIT(CaptureTheFlag) - { - this.gametype_init(this, _("Capture the Flag"),"ctf","g_ctf",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PRIORITY,"","timelimit=20 caplimit=10 leadlimit=6",_("Find and bring the enemy flag to your base to capture it, defend your base from the other team")); - } - METHOD(CaptureTheFlag, m_generate_mapinfo, void(Gametype this, string v)) - { - if(v == "item_flag_team2" || v == "team_CTF_blueflag") - MapInfo_Map_supportedGametypes |= this.gametype_flags; - } - METHOD(CaptureTheFlag, m_isTwoBaseMode, bool()) - { - return true; - } - METHOD(CaptureTheFlag, m_setTeams, void(string sa)) - { - cvar_set("fraglimit", sa); - } - METHOD(CaptureTheFlag, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Capture limit:"), 1, 20, 1, "capturelimit_override", string_null, _("The amount of captures needed before the match will end")); - } + INIT(CaptureTheFlag) + { + this.gametype_init(this, _("Capture the Flag"),"ctf","g_ctf",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PRIORITY,"","timelimit=20 caplimit=10 leadlimit=6",_("Find and bring the enemy flag to your base to capture it, defend your base from the other team")); + } + METHOD(CaptureTheFlag, m_generate_mapinfo, void(Gametype this, string v)) + { + if(v == "item_flag_team2" || v == "team_CTF_blueflag") + MapInfo_Map_supportedGametypes |= this.gametype_flags; + } + METHOD(CaptureTheFlag, m_isTwoBaseMode, bool()) + { + return true; + } + METHOD(CaptureTheFlag, m_setTeams, void(string sa)) + { + cvar_set("fraglimit", sa); + } + METHOD(CaptureTheFlag, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Capture limit:"), 1, 20, 1, "capturelimit_override", string_null, _("The amount of captures needed before the match will end")); + } #ifdef CSQC - ATTRIB(CaptureTheFlag, m_modicons, void(vector pos, vector mySize), HUD_Mod_CTF); - ATTRIB(CaptureTheFlag, m_modicons_reset, void(), HUD_Mod_CTF_Reset); + ATTRIB(CaptureTheFlag, m_modicons, void(vector pos, vector mySize), HUD_Mod_CTF); + ATTRIB(CaptureTheFlag, m_modicons_reset, void(), HUD_Mod_CTF_Reset); #endif - ATTRIB(CaptureTheFlag, m_legacydefaults, string, "300 20 10 0"); + ATTRIB(CaptureTheFlag, m_legacydefaults, string, "300 20 10 0"); ENDCLASS(CaptureTheFlag) REGISTER_GAMETYPE(CTF, NEW(CaptureTheFlag)); #define g_ctf IS_GAMETYPE(CTF) diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh index adb061809f..3787c8bfbf 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh @@ -6,8 +6,8 @@ #include CLASS(Flag, Pickup) - ATTRIB(Flag, m_mins, vector, (PL_MIN_CONST + '0 0 -13') * 1.4); // scaling be damned - ATTRIB(Flag, m_maxs, vector, (PL_MAX_CONST + '0 0 -13') * 1.4); + ATTRIB(Flag, m_mins, vector, (PL_MIN_CONST + '0 0 -13') * 1.4); // scaling be damned + ATTRIB(Flag, m_maxs, vector, (PL_MAX_CONST + '0 0 -13') * 1.4); ENDCLASS(Flag) Flag CTF_FLAG; void ctf_Initialize(); @@ -17,16 +17,16 @@ int autocvar_capturelimit_override; REGISTER_MUTATOR(ctf, false) { - MUTATOR_STATIC(); - MUTATOR_ONADD - { - GameRules_teams(true); - GameRules_limit_score(autocvar_capturelimit_override); - GameRules_limit_lead(autocvar_captureleadlimit_override); - - ctf_Initialize(); - } - return 0; + MUTATOR_STATIC(); + MUTATOR_ONADD + { + GameRules_teams(true); + GameRules_limit_score(autocvar_capturelimit_override); + GameRules_limit_lead(autocvar_captureleadlimit_override); + + ctf_Initialize(); + } + return 0; } // used in cheats.qc diff --git a/qcsrc/common/gamemodes/gamemode/cts/cts.qh b/qcsrc/common/gamemodes/gamemode/cts/cts.qh index c677ff6021..87ecd23ac6 100644 --- a/qcsrc/common/gamemodes/gamemode/cts/cts.qh +++ b/qcsrc/common/gamemodes/gamemode/cts/cts.qh @@ -6,31 +6,31 @@ #endif CLASS(RaceCTS, Gametype) - INIT(RaceCTS) - { - this.gametype_init(this, _("Race CTS"),"cts","g_cts",0,"cloaked","timelimit=20",_("Race for fastest time.")); - } - METHOD(RaceCTS, m_generate_mapinfo, void(Gametype this, string v)) - { - if(v == "target_startTimer") - MapInfo_Map_supportedGametypes |= this.gametype_flags; - } - METHOD(RaceCTS, m_setTeams, void(string sa)) - { - // this is the skill of the map - // not parsed by anything yet - // for map databases - // cvar_set("fraglimit", sa); - } - METHOD(RaceCTS, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Point limit:"), 50, 500, 10, string_null, string_null, string_null); - } + INIT(RaceCTS) + { + this.gametype_init(this, _("Race CTS"),"cts","g_cts",0,"cloaked","timelimit=20",_("Race for fastest time.")); + } + METHOD(RaceCTS, m_generate_mapinfo, void(Gametype this, string v)) + { + if(v == "target_startTimer") + MapInfo_Map_supportedGametypes |= this.gametype_flags; + } + METHOD(RaceCTS, m_setTeams, void(string sa)) + { + // this is the skill of the map + // not parsed by anything yet + // for map databases + // cvar_set("fraglimit", sa); + } + METHOD(RaceCTS, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Point limit:"), 50, 500, 10, string_null, string_null, string_null); + } #ifdef CSQC - ATTRIB(RaceCTS, m_modicons, void(vector pos, vector mySize), HUD_Mod_Race); + ATTRIB(RaceCTS, m_modicons, void(vector pos, vector mySize), HUD_Mod_Race); #endif - ATTRIB(RaceCTS, m_legacydefaults, string, "20 0 0"); + ATTRIB(RaceCTS, m_legacydefaults, string, "20 0 0"); ENDCLASS(RaceCTS) REGISTER_GAMETYPE(CTS, NEW(RaceCTS)); #define g_cts IS_GAMETYPE(CTS) diff --git a/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qh b/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qh index 371f7a250e..e4dce94676 100644 --- a/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qh +++ b/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qh @@ -7,13 +7,13 @@ void cts_Initialize(); REGISTER_MUTATOR(cts, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); MUTATOR_ONADD { g_race_qualifying = 1; independent_players = 1; - GameRules_limit_score(0); - GameRules_limit_lead(0); + GameRules_limit_score(0); + GameRules_limit_lead(0); cts_Initialize(); } diff --git a/qcsrc/common/gamemodes/gamemode/deathmatch/deathmatch.qh b/qcsrc/common/gamemodes/gamemode/deathmatch/deathmatch.qh index ca55a3b872..88ee25d7b4 100644 --- a/qcsrc/common/gamemodes/gamemode/deathmatch/deathmatch.qh +++ b/qcsrc/common/gamemodes/gamemode/deathmatch/deathmatch.qh @@ -3,14 +3,14 @@ #include CLASS(Deathmatch, Gametype) - INIT(Deathmatch) - { - this.gametype_init(this, _("Deathmatch"),"dm","g_dm",GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PREFERRED,"","timelimit=15 pointlimit=30 leadlimit=0",_("Score as many frags as you can")); - } - METHOD(Deathmatch, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) - { - return true; - } - ATTRIB(Deathmatch, m_legacydefaults, string, "30 20 0"); + INIT(Deathmatch) + { + this.gametype_init(this, _("Deathmatch"),"dm","g_dm",GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PREFERRED,"","timelimit=15 pointlimit=30 leadlimit=0",_("Score as many frags as you can")); + } + METHOD(Deathmatch, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + return true; + } + ATTRIB(Deathmatch, m_legacydefaults, string, "30 20 0"); ENDCLASS(Deathmatch) REGISTER_GAMETYPE(DEATHMATCH, NEW(Deathmatch)); diff --git a/qcsrc/common/gamemodes/gamemode/deathmatch/sv_deathmatch.qh b/qcsrc/common/gamemodes/gamemode/deathmatch/sv_deathmatch.qh index c08d5f87a1..d1219c652b 100644 --- a/qcsrc/common/gamemodes/gamemode/deathmatch/sv_deathmatch.qh +++ b/qcsrc/common/gamemodes/gamemode/deathmatch/sv_deathmatch.qh @@ -3,6 +3,6 @@ #include REGISTER_MUTATOR(dm, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); return 0; } diff --git a/qcsrc/common/gamemodes/gamemode/domination/domination.qh b/qcsrc/common/gamemodes/gamemode/domination/domination.qh index 3117c2980e..d4ef60482f 100644 --- a/qcsrc/common/gamemodes/gamemode/domination/domination.qh +++ b/qcsrc/common/gamemodes/gamemode/domination/domination.qh @@ -7,37 +7,39 @@ void HUD_Mod_Dom(vector pos, vector mySize); void HUD_Mod_Dom_Export(int fh); #endif CLASS(Domination, Gametype) - INIT(Domination) - { - this.gametype_init(this, _("Domination"),"dom","g_domination",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=200 teams=2 leadlimit=0",_("Capture and defend all the control points to win")); - } - METHOD(Domination, m_parse_mapinfo, bool(string k, string v)) - { - if (!k) { - cvar_set("g_domination_default_teams", cvar_defstring("g_domination_default_teams")); - return true; - } - switch (k) { - case "teams": - cvar_set("g_domination_default_teams", v); - return true; - } - return false; - } - METHOD(Domination, m_generate_mapinfo, void(Gametype this, string v)) - { - if(v == "dom_controlpoint" || v == "team_dom_point") - MapInfo_Map_supportedGametypes |= this.gametype_flags; - } - METHOD(Domination, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Point limit:"), 50, 500, 10, "g_domination_point_limit", "g_domination_teams_override", _("The amount of points needed before the match will end")); - } + INIT(Domination) + { + this.gametype_init(this, _("Domination"),"dom","g_domination",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=200 teams=2 leadlimit=0",_("Capture and defend all the control points to win")); + } + METHOD(Domination, m_parse_mapinfo, bool(string k, string v)) + { + if (!k) + { + cvar_set("g_domination_default_teams", cvar_defstring("g_domination_default_teams")); + return true; + } + switch (k) + { + case "teams": + cvar_set("g_domination_default_teams", v); + return true; + } + return false; + } + METHOD(Domination, m_generate_mapinfo, void(Gametype this, string v)) + { + if(v == "dom_controlpoint" || v == "team_dom_point") + MapInfo_Map_supportedGametypes |= this.gametype_flags; + } + METHOD(Domination, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Point limit:"), 50, 500, 10, "g_domination_point_limit", "g_domination_teams_override", _("The amount of points needed before the match will end")); + } #ifdef CSQC - ATTRIB(Domination, m_modicons, void(vector pos, vector mySize), HUD_Mod_Dom); - ATTRIB(Domination, m_modicons_export, void(int fh), HUD_Mod_Dom_Export); + ATTRIB(Domination, m_modicons, void(vector pos, vector mySize), HUD_Mod_Dom); + ATTRIB(Domination, m_modicons_export, void(int fh), HUD_Mod_Dom_Export); #endif - ATTRIB(Domination, m_legacydefaults, string, "200 20 0"); + ATTRIB(Domination, m_legacydefaults, string, "200 20 0"); ENDCLASS(Domination) REGISTER_GAMETYPE(DOMINATION, NEW(Domination)); diff --git a/qcsrc/common/gamemodes/gamemode/duel/duel.qh b/qcsrc/common/gamemodes/gamemode/duel/duel.qh index 316b6c341e..5435fe6169 100644 --- a/qcsrc/common/gamemodes/gamemode/duel/duel.qh +++ b/qcsrc/common/gamemodes/gamemode/duel/duel.qh @@ -4,25 +4,25 @@ #include CLASS(Duel, Gametype) - INIT(Duel) - { - this.gametype_init(this, _("Duel"),"duel","g_duel",GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_1V1,"","timelimit=10 pointlimit=0 leadlimit=0",_("Fight in a one versus one arena battle to decide the winner")); - } - METHOD(Duel, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) - { - return (diameter < 3250); - } - METHOD(Duel, m_isForcedSupported, bool(Gametype this)) - { - if(!cvar("g_duel_not_dm_maps")) - { - // if this is set, all DM maps support duel too - // TODO: we should really check the size of maps, some DM maps do not work for duel! - if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.gametype_flags)) - return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported) - } - return false; - } + INIT(Duel) + { + this.gametype_init(this, _("Duel"),"duel","g_duel",GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_1V1,"","timelimit=10 pointlimit=0 leadlimit=0",_("Fight in a one versus one arena battle to decide the winner")); + } + METHOD(Duel, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + return (diameter < 3250); + } + METHOD(Duel, m_isForcedSupported, bool(Gametype this)) + { + if(!cvar("g_duel_not_dm_maps")) + { + // if this is set, all DM maps support duel too + // TODO: we should really check the size of maps, some DM maps do not work for duel! + if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.gametype_flags)) + return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported) + } + return false; + } ENDCLASS(Duel) REGISTER_GAMETYPE(DUEL, NEW(Duel)); #define g_duel IS_GAMETYPE(DUEL) diff --git a/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qh b/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qh index d255c9b353..2d7b16b365 100644 --- a/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qh +++ b/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qh @@ -3,7 +3,7 @@ #include REGISTER_MUTATOR(duel, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); return 0; } diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/freezetag.qh b/qcsrc/common/gamemodes/gamemode/freezetag/freezetag.qh index f1723757a6..f8bfa25b7d 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/freezetag.qh +++ b/qcsrc/common/gamemodes/gamemode/freezetag/freezetag.qh @@ -10,43 +10,45 @@ void HUD_Mod_FreezeTag(vector myPos, vector mySize); void HUD_Mod_FreezeTag_Export(int fh); #endif CLASS(FreezeTag, Gametype) - INIT(FreezeTag) - { - this.gametype_init(this, _("Freeze Tag"),"ft","g_freezetag",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=10 teams=2 leadlimit=6",_("Kill enemies to freeze them, stand next to frozen teammates to revive them; freeze all enemies to win")); - } - METHOD(FreezeTag, m_parse_mapinfo, bool(string k, string v)) - { - if (!k) { - cvar_set("g_freezetag_teams", cvar_defstring("g_freezetag_teams")); - return true; - } - switch (k) { - case "teams": - cvar_set("g_freezetag_teams", v); - return true; - } - return false; - } - METHOD(FreezeTag, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) - { - if(spawnpoints >= 8 && diameter > 3250) - return true; - return false; - } - METHOD(FreezeTag, m_setTeams, void(string sa)) - { - cvar_set("g_freezetag_teams", sa); - } - METHOD(FreezeTag, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Round limit:"), 5, 100, 5, "fraglimit_override", "g_freezetag_teams_override", _("The amount of rounds won needed before the match will end")); - } + INIT(FreezeTag) + { + this.gametype_init(this, _("Freeze Tag"),"ft","g_freezetag",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=10 teams=2 leadlimit=6",_("Kill enemies to freeze them, stand next to frozen teammates to revive them; freeze all enemies to win")); + } + METHOD(FreezeTag, m_parse_mapinfo, bool(string k, string v)) + { + if (!k) + { + cvar_set("g_freezetag_teams", cvar_defstring("g_freezetag_teams")); + return true; + } + switch (k) + { + case "teams": + cvar_set("g_freezetag_teams", v); + return true; + } + return false; + } + METHOD(FreezeTag, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + if(spawnpoints >= 8 && diameter > 3250) + return true; + return false; + } + METHOD(FreezeTag, m_setTeams, void(string sa)) + { + cvar_set("g_freezetag_teams", sa); + } + METHOD(FreezeTag, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Round limit:"), 5, 100, 5, "fraglimit_override", "g_freezetag_teams_override", _("The amount of rounds won needed before the match will end")); + } #ifdef CSQC - ATTRIB(FreezeTag, m_modicons, void(vector pos, vector mySize), HUD_Mod_FreezeTag); - ATTRIB(FreezeTag, m_modicons_export, void(int fh), HUD_Mod_FreezeTag_Export); + ATTRIB(FreezeTag, m_modicons, void(vector pos, vector mySize), HUD_Mod_FreezeTag); + ATTRIB(FreezeTag, m_modicons_export, void(int fh), HUD_Mod_FreezeTag_Export); #endif - ATTRIB(FreezeTag, m_legacydefaults, string, "10 20 0"); + ATTRIB(FreezeTag, m_legacydefaults, string, "10 20 0"); ENDCLASS(FreezeTag) REGISTER_GAMETYPE(FREEZETAG, NEW(FreezeTag)); #define g_freezetag IS_GAMETYPE(FREEZETAG) diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh index f760331dfb..b0f595d7e8 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh @@ -14,13 +14,13 @@ void freezetag_Initialize(); REGISTER_MUTATOR(ft, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); MUTATOR_ONADD { GameRules_teams(true); - GameRules_spawning_teams(autocvar_g_freezetag_team_spawns); - GameRules_limit_score(autocvar_g_freezetag_point_limit); - GameRules_limit_lead(autocvar_g_freezetag_point_leadlimit); + GameRules_spawning_teams(autocvar_g_freezetag_team_spawns); + GameRules_limit_score(autocvar_g_freezetag_point_limit); + GameRules_limit_lead(autocvar_g_freezetag_point_leadlimit); freezetag_Initialize(); } diff --git a/qcsrc/common/gamemodes/gamemode/invasion/invasion.qh b/qcsrc/common/gamemodes/gamemode/invasion/invasion.qh index 71f6b7d143..6c2aad4698 100644 --- a/qcsrc/common/gamemodes/gamemode/invasion/invasion.qh +++ b/qcsrc/common/gamemodes/gamemode/invasion/invasion.qh @@ -3,28 +3,29 @@ #include CLASS(Invasion, Gametype) - INIT(Invasion) - { - this.gametype_init(this, _("Invasion"),"inv","g_invasion",GAMETYPE_FLAG_USEPOINTS,"","pointlimit=50 type=0",_("Survive against waves of monsters")); - } - METHOD(Invasion, m_parse_mapinfo, bool(string k, string v)) - { - switch (k) { - case "type": - cvar_set("g_invasion_type", v); - return true; - } - return false; - } - METHOD(Invasion, m_generate_mapinfo, void(Gametype this, string v)) - { - if(v == "invasion_spawnpoint") - MapInfo_Map_supportedGametypes |= this.gametype_flags; - } - METHOD(Invasion, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Point limit:"), 50, 500, 10, string_null, string_null, string_null); - } + INIT(Invasion) + { + this.gametype_init(this, _("Invasion"),"inv","g_invasion",GAMETYPE_FLAG_USEPOINTS,"","pointlimit=50 type=0",_("Survive against waves of monsters")); + } + METHOD(Invasion, m_parse_mapinfo, bool(string k, string v)) + { + switch (k) + { + case "type": + cvar_set("g_invasion_type", v); + return true; + } + return false; + } + METHOD(Invasion, m_generate_mapinfo, void(Gametype this, string v)) + { + if(v == "invasion_spawnpoint") + MapInfo_Map_supportedGametypes |= this.gametype_flags; + } + METHOD(Invasion, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Point limit:"), 50, 500, 10, string_null, string_null, string_null); + } ENDCLASS(Invasion) REGISTER_GAMETYPE(INVASION, NEW(Invasion)); diff --git a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh index 9d01851a93..0134ed5d7f 100644 --- a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh +++ b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh @@ -11,13 +11,13 @@ void invasion_Initialize(); REGISTER_MUTATOR(inv, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); MUTATOR_ONADD { g_invasion_roundends = IL_NEW(); g_invasion_waves = IL_NEW(); g_invasion_spawns = IL_NEW(); - GameRules_limit_score(autocvar_g_invasion_point_limit); + GameRules_limit_score(autocvar_g_invasion_point_limit); g_invasion = true; cvar_settemp("g_monsters", "1"); diff --git a/qcsrc/common/gamemodes/gamemode/keepaway/keepaway.qh b/qcsrc/common/gamemodes/gamemode/keepaway/keepaway.qh index 3aac451d1c..00dfa3c893 100644 --- a/qcsrc/common/gamemodes/gamemode/keepaway/keepaway.qh +++ b/qcsrc/common/gamemodes/gamemode/keepaway/keepaway.qh @@ -6,16 +6,16 @@ void HUD_Mod_Keepaway(vector pos, vector mySize); #endif CLASS(Keepaway, Gametype) - INIT(Keepaway) - { - this.gametype_init(this, _("Keepaway"),"ka","g_keepaway",GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=30",_("Hold the ball to get points for kills")); - } - METHOD(Keepaway, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) - { - return true; - } + INIT(Keepaway) + { + this.gametype_init(this, _("Keepaway"),"ka","g_keepaway",GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=30",_("Hold the ball to get points for kills")); + } + METHOD(Keepaway, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + return true; + } #ifdef CSQC - ATTRIB(Keepaway, m_modicons, void(vector pos, vector mySize), HUD_Mod_Keepaway); + ATTRIB(Keepaway, m_modicons, void(vector pos, vector mySize), HUD_Mod_Keepaway); #endif ENDCLASS(Keepaway) REGISTER_GAMETYPE(KEEPAWAY, NEW(Keepaway)); diff --git a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qh b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qh index 736a655392..ba64519faa 100644 --- a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qh +++ b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qh @@ -11,7 +11,8 @@ REGISTER_MUTATOR(ka, false) MUTATOR_STATIC(); MUTATOR_ONADD { - GameRules_scoring(0, SFL_SORT_PRIO_PRIMARY, 0, { + GameRules_scoring(0, SFL_SORT_PRIO_PRIMARY, 0, + { field(SP_KEEPAWAY_PICKUPS, "pickups", 0); field(SP_KEEPAWAY_CARRIERKILLS, "bckills", 0); field(SP_KEEPAWAY_BCTIME, "bctime", SFL_SORT_PRIO_SECONDARY); diff --git a/qcsrc/common/gamemodes/gamemode/keyhunt/keyhunt.qh b/qcsrc/common/gamemodes/gamemode/keyhunt/keyhunt.qh index cc9cecdaf2..9cad64f748 100644 --- a/qcsrc/common/gamemodes/gamemode/keyhunt/keyhunt.qh +++ b/qcsrc/common/gamemodes/gamemode/keyhunt/keyhunt.qh @@ -6,38 +6,40 @@ void HUD_Mod_KH(vector pos, vector mySize); #endif CLASS(KeyHunt, Gametype) - INIT(KeyHunt) - { - this.gametype_init(this, _("Key Hunt"),"kh","g_keyhunt",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=1000 teams=3 leadlimit=0",_("Gather all the keys to win the round")); - } - METHOD(KeyHunt, m_parse_mapinfo, bool(string k, string v)) - { - if (!k) { - cvar_set("g_keyhunt_teams", cvar_defstring("g_keyhunt_teams")); - return true; - } - switch (k) { - case "teams": - cvar_set("g_keyhunt_teams", v); - return true; - } - return false; - } - METHOD(KeyHunt, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) - { - if(spawnpoints >= 12 && diameter > 5120) - return true; - return false; - } - METHOD(KeyHunt, m_setTeams, void(string sa)) - { - cvar_set("g_keyhunt_teams", sa); - } - METHOD(KeyHunt, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Point limit:"), 200, 1500, 50, "g_keyhunt_point_limit", "g_keyhunt_teams_override", _("The amount of points needed before the match will end")); - } + INIT(KeyHunt) + { + this.gametype_init(this, _("Key Hunt"),"kh","g_keyhunt",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=1000 teams=3 leadlimit=0",_("Gather all the keys to win the round")); + } + METHOD(KeyHunt, m_parse_mapinfo, bool(string k, string v)) + { + if (!k) + { + cvar_set("g_keyhunt_teams", cvar_defstring("g_keyhunt_teams")); + return true; + } + switch (k) + { + case "teams": + cvar_set("g_keyhunt_teams", v); + return true; + } + return false; + } + METHOD(KeyHunt, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + if(spawnpoints >= 12 && diameter > 5120) + return true; + return false; + } + METHOD(KeyHunt, m_setTeams, void(string sa)) + { + cvar_set("g_keyhunt_teams", sa); + } + METHOD(KeyHunt, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Point limit:"), 200, 1500, 50, "g_keyhunt_point_limit", "g_keyhunt_teams_override", _("The amount of points needed before the match will end")); + } #ifdef CSQC ATTRIB(KeyHunt, m_modicons, void(vector pos, vector mySize), HUD_Mod_KH); #endif diff --git a/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qh b/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qh index 66321c3d9d..e2b83edbb1 100644 --- a/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qh +++ b/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qh @@ -8,13 +8,13 @@ void kh_Initialize(); REGISTER_MUTATOR(kh, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); MUTATOR_ONADD { GameRules_teams(true); - GameRules_spawning_teams(autocvar_g_keyhunt_team_spawns); - GameRules_limit_score(autocvar_g_keyhunt_point_limit); - GameRules_limit_lead(autocvar_g_keyhunt_point_leadlimit); + GameRules_spawning_teams(autocvar_g_keyhunt_team_spawns); + GameRules_limit_score(autocvar_g_keyhunt_point_limit); + GameRules_limit_lead(autocvar_g_keyhunt_point_leadlimit); kh_Initialize(); } diff --git a/qcsrc/common/gamemodes/gamemode/lms/lms.qh b/qcsrc/common/gamemodes/gamemode/lms/lms.qh index b90f6c6eb1..258f830072 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/lms.qh +++ b/qcsrc/common/gamemodes/gamemode/lms/lms.qh @@ -6,22 +6,22 @@ void HUD_Mod_LMS(vector myPos, vector mySize); #endif CLASS(LastManStanding, Gametype) - INIT(LastManStanding) - { - this.gametype_init(this, _("Last Man Standing"),"lms","g_lms",GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_HIDELIMITS,"","timelimit=20 lives=5 leadlimit=0",_("Survive and kill until the enemies have no lives left")); - } - METHOD(LastManStanding, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) - { - return true; - } - METHOD(LastManStanding, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Lives:"), 3, 50, 1, "g_lms_lives_override", string_null, string_null); - } - ATTRIB(LastManStanding, m_legacydefaults, string, "9 20 0"); + INIT(LastManStanding) + { + this.gametype_init(this, _("Last Man Standing"),"lms","g_lms",GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_HIDELIMITS,"","timelimit=20 lives=5 leadlimit=0",_("Survive and kill until the enemies have no lives left")); + } + METHOD(LastManStanding, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + return true; + } + METHOD(LastManStanding, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Lives:"), 3, 50, 1, "g_lms_lives_override", string_null, string_null); + } + ATTRIB(LastManStanding, m_legacydefaults, string, "9 20 0"); #ifdef CSQC - ATTRIB(LastManStanding, m_modicons, void(vector myPos, vector mySize), HUD_Mod_LMS); + ATTRIB(LastManStanding, m_modicons, void(vector myPos, vector mySize), HUD_Mod_LMS); #endif ENDCLASS(LastManStanding) REGISTER_GAMETYPE(LMS, NEW(LastManStanding)); diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh index 8019c76ddb..3705ab5054 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh @@ -14,16 +14,17 @@ void lms_Initialize(); REGISTER_MUTATOR(lms, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); MUTATOR_ONADD { - GameRules_limit_score(((!autocvar_g_lms_lives_override) ? -1 : autocvar_g_lms_lives_override)); - GameRules_limit_lead(0); - GameRules_score_enabled(false); - GameRules_scoring(0, 0, 0, { - field(SP_LMS_LIVES, "lives", SFL_SORT_PRIO_SECONDARY); - field(SP_LMS_RANK, "rank", SFL_LOWER_IS_BETTER | SFL_RANK | SFL_SORT_PRIO_PRIMARY | SFL_ALLOW_HIDE); - }); + GameRules_limit_score(((!autocvar_g_lms_lives_override) ? -1 : autocvar_g_lms_lives_override)); + GameRules_limit_lead(0); + GameRules_score_enabled(false); + GameRules_scoring(0, 0, 0, + { + field(SP_LMS_LIVES, "lives", SFL_SORT_PRIO_SECONDARY); + field(SP_LMS_RANK, "rank", SFL_LOWER_IS_BETTER | SFL_RANK | SFL_SORT_PRIO_PRIMARY | SFL_ALLOW_HIDE); + }); lms_Initialize(); } diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qh b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qh index 845fb2ec11..d3d86912f1 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qh +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qh @@ -6,28 +6,28 @@ void HUD_Mod_NexBall(vector pos, vector mySize); #endif CLASS(NexBall, Gametype) - INIT(NexBall) - { - this.gametype_init(this, _("Nexball"),"nb","g_nexball",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_WEAPONARENA,"","timelimit=20 pointlimit=5 leadlimit=0",_("Shoot and kick the ball into the enemies goal, keep your goal clean")); - } - METHOD(NexBall, m_generate_mapinfo, void(Gametype this, string v)) - { - if(substring(v, 0, 8) == "nexball_" || substring(v, 0, 4) == "ball") - MapInfo_Map_supportedGametypes |= this.gametype_flags; - } - METHOD(NexBall, m_isTwoBaseMode, bool()) - { - return true; - } - METHOD(NexBall, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Goal limit:"), 1, 50, 1, "g_nexball_goallimit", string_null, _("The amount of goals needed before the match will end")); - } + INIT(NexBall) + { + this.gametype_init(this, _("Nexball"),"nb","g_nexball",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_WEAPONARENA,"","timelimit=20 pointlimit=5 leadlimit=0",_("Shoot and kick the ball into the enemies goal, keep your goal clean")); + } + METHOD(NexBall, m_generate_mapinfo, void(Gametype this, string v)) + { + if(substring(v, 0, 8) == "nexball_" || substring(v, 0, 4) == "ball") + MapInfo_Map_supportedGametypes |= this.gametype_flags; + } + METHOD(NexBall, m_isTwoBaseMode, bool()) + { + return true; + } + METHOD(NexBall, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Goal limit:"), 1, 50, 1, "g_nexball_goallimit", string_null, _("The amount of goals needed before the match will end")); + } #ifdef CSQC - ATTRIB(NexBall, m_modicons, void(vector pos, vector mySize), HUD_Mod_NexBall); + ATTRIB(NexBall, m_modicons, void(vector pos, vector mySize), HUD_Mod_NexBall); #endif - ATTRIB(NexBall, m_legacydefaults, string, "5 20 0"); + ATTRIB(NexBall, m_legacydefaults, string, "5 20 0"); ENDCLASS(NexBall) REGISTER_GAMETYPE(NEXBALL, NEW(NexBall)); #define g_nexball IS_GAMETYPE(NEXBALL) diff --git a/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qh b/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qh index d1cd4c6680..b98181de55 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qh +++ b/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qh @@ -6,7 +6,7 @@ void nb_Initialize(); REGISTER_MUTATOR(nb, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); MUTATOR_ONADD { nb_Initialize(); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh index fc3938b924..cef742a5f4 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh @@ -3,21 +3,21 @@ #include CLASS(Onslaught, Gametype) - INIT(Onslaught) - { - this.gametype_init(this, _("Onslaught"),"ons","g_onslaught",GAMETYPE_FLAG_TEAMPLAY,"","pointlimit=1 timelimit=20",_("Capture control points to reach and destroy the enemy generator")); - } - METHOD(Onslaught, m_generate_mapinfo, void(Gametype this, string v)) - { - if(v == "onslaught_generator") - MapInfo_Map_supportedGametypes |= this.gametype_flags; - } - METHOD(Onslaught, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Point limit:"), 50, 500, 10, string_null, string_null, string_null); - } - ATTRIB(Onslaught, m_legacydefaults, string, "20 0"); + INIT(Onslaught) + { + this.gametype_init(this, _("Onslaught"),"ons","g_onslaught",GAMETYPE_FLAG_TEAMPLAY,"","pointlimit=1 timelimit=20",_("Capture control points to reach and destroy the enemy generator")); + } + METHOD(Onslaught, m_generate_mapinfo, void(Gametype this, string v)) + { + if(v == "onslaught_generator") + MapInfo_Map_supportedGametypes |= this.gametype_flags; + } + METHOD(Onslaught, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Point limit:"), 50, 500, 10, string_null, string_null, string_null); + } + ATTRIB(Onslaught, m_legacydefaults, string, "20 0"); ENDCLASS(Onslaught) REGISTER_GAMETYPE(ONSLAUGHT, NEW(Onslaught)); diff --git a/qcsrc/common/gamemodes/gamemode/race/race.qh b/qcsrc/common/gamemodes/gamemode/race/race.qh index ddc11089c1..2e921893eb 100644 --- a/qcsrc/common/gamemodes/gamemode/race/race.qh +++ b/qcsrc/common/gamemodes/gamemode/race/race.qh @@ -6,41 +6,43 @@ void HUD_Mod_Race(vector pos, vector mySize); #endif CLASS(Race, Gametype) - INIT(Race) - { - this.gametype_init(this, _("Race"),"rc","g_race",GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 qualifying_timelimit=5 laplimit=7 teamlaplimit=15 leadlimit=0",_("Race against other players to the finish line")); - } - METHOD(Race, m_parse_mapinfo, bool(string k, string v)) - { - if (!k) { - cvar_set("g_race_qualifying_timelimit", cvar_defstring("g_race_qualifying_timelimit")); - return true; - } - switch (k) { - case "qualifying_timelimit": - cvar_set("g_race_qualifying_timelimit", v); - return true; - } - return false; - } - METHOD(Race, m_generate_mapinfo, void(Gametype this, string v)) - { - if(v == "trigger_race_checkpoint") - MapInfo_Map_supportedGametypes |= this.gametype_flags; - } - METHOD(Race, m_isTwoBaseMode, bool()) - { - return true; - } - METHOD(Race, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Laps:"), 1, 25, 1, "g_race_laps_limit", string_null, string_null); - } + INIT(Race) + { + this.gametype_init(this, _("Race"),"rc","g_race",GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 qualifying_timelimit=5 laplimit=7 teamlaplimit=15 leadlimit=0",_("Race against other players to the finish line")); + } + METHOD(Race, m_parse_mapinfo, bool(string k, string v)) + { + if (!k) + { + cvar_set("g_race_qualifying_timelimit", cvar_defstring("g_race_qualifying_timelimit")); + return true; + } + switch (k) + { + case "qualifying_timelimit": + cvar_set("g_race_qualifying_timelimit", v); + return true; + } + return false; + } + METHOD(Race, m_generate_mapinfo, void(Gametype this, string v)) + { + if(v == "trigger_race_checkpoint") + MapInfo_Map_supportedGametypes |= this.gametype_flags; + } + METHOD(Race, m_isTwoBaseMode, bool()) + { + return true; + } + METHOD(Race, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Laps:"), 1, 25, 1, "g_race_laps_limit", string_null, string_null); + } #ifdef CSQC - ATTRIB(Race, m_modicons, void(vector pos, vector mySize), HUD_Mod_Race); + ATTRIB(Race, m_modicons, void(vector pos, vector mySize), HUD_Mod_Race); #endif - ATTRIB(Race, m_legacydefaults, string, "20 5 7 15 0"); + ATTRIB(Race, m_legacydefaults, string, "20 5 7 15 0"); ENDCLASS(Race) REGISTER_GAMETYPE(RACE, NEW(Race)); #define g_race IS_GAMETYPE(RACE) diff --git a/qcsrc/common/gamemodes/gamemode/race/sv_race.qh b/qcsrc/common/gamemodes/gamemode/race/sv_race.qh index 9928b8cb75..92a9431b05 100644 --- a/qcsrc/common/gamemodes/gamemode/race/sv_race.qh +++ b/qcsrc/common/gamemodes/gamemode/race/sv_race.qh @@ -6,7 +6,7 @@ void race_Initialize(); REGISTER_MUTATOR(rc, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); MUTATOR_ONADD { rc_SetLimits(); diff --git a/qcsrc/common/gamemodes/gamemode/survival/survival.qh b/qcsrc/common/gamemodes/gamemode/survival/survival.qh index 7c5d8c7c40..4b5e1a39ed 100644 --- a/qcsrc/common/gamemodes/gamemode/survival/survival.qh +++ b/qcsrc/common/gamemodes/gamemode/survival/survival.qh @@ -7,26 +7,26 @@ void HUD_Mod_Survival(vector pos, vector mySize); #endif CLASS(Survival, Gametype) - INIT(Survival) - { - this.gametype_init(this, _("Survival"), "surv", "g_survival", GAMETYPE_FLAG_USEPOINTS, "", "timelimit=20 pointlimit=12", _("Identify and eliminate all the hunters before all your allies are gone")); - } - METHOD(Survival, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) - { - return true; - } - METHOD(Survival, m_isForcedSupported, bool(Gametype this)) - { - if(!cvar("g_survival_not_lms_maps")) - { - // if this is unset, all LMS maps support Survival too - if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_LMS.gametype_flags)) - return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported) - } - return false; - } + INIT(Survival) + { + this.gametype_init(this, _("Survival"), "surv", "g_survival", GAMETYPE_FLAG_USEPOINTS, "", "timelimit=20 pointlimit=12", _("Identify and eliminate all the hunters before all your allies are gone")); + } + METHOD(Survival, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + return true; + } + METHOD(Survival, m_isForcedSupported, bool(Gametype this)) + { + if(!cvar("g_survival_not_lms_maps")) + { + // if this is unset, all LMS maps support Survival too + if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_LMS.gametype_flags)) + return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported) + } + return false; + } #ifdef CSQC - ATTRIB(Survival, m_modicons, void(vector pos, vector mySize), HUD_Mod_Survival); + ATTRIB(Survival, m_modicons, void(vector pos, vector mySize), HUD_Mod_Survival); #endif ENDCLASS(Survival) REGISTER_GAMETYPE(SURVIVAL, NEW(Survival)); diff --git a/qcsrc/common/gamemodes/gamemode/survival/sv_survival.qh b/qcsrc/common/gamemodes/gamemode/survival/sv_survival.qh index 129410a5af..c7f2fc556d 100644 --- a/qcsrc/common/gamemodes/gamemode/survival/sv_survival.qh +++ b/qcsrc/common/gamemodes/gamemode/survival/sv_survival.qh @@ -6,7 +6,7 @@ void surv_Initialize(); REGISTER_MUTATOR(surv, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); MUTATOR_ONADD { surv_Initialize(); diff --git a/qcsrc/common/gamemodes/gamemode/tdm/sv_tdm.qh b/qcsrc/common/gamemodes/gamemode/tdm/sv_tdm.qh index 783655bba5..42bc4ed872 100644 --- a/qcsrc/common/gamemodes/gamemode/tdm/sv_tdm.qh +++ b/qcsrc/common/gamemodes/gamemode/tdm/sv_tdm.qh @@ -8,7 +8,7 @@ void tdm_Initialize(); REGISTER_MUTATOR(tdm, false) { - MUTATOR_STATIC(); + MUTATOR_STATIC(); MUTATOR_ONADD { tdm_Initialize(); diff --git a/qcsrc/common/gamemodes/gamemode/tdm/tdm.qh b/qcsrc/common/gamemodes/gamemode/tdm/tdm.qh index ab7a16427c..386c9e4cfe 100644 --- a/qcsrc/common/gamemodes/gamemode/tdm/tdm.qh +++ b/qcsrc/common/gamemodes/gamemode/tdm/tdm.qh @@ -4,49 +4,51 @@ #include CLASS(TeamDeathmatch, Gametype) - INIT(TeamDeathmatch) - { - this.gametype_init(this, _("Team Deathmatch"),"tdm","g_tdm",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PRIORITY,"","timelimit=15 pointlimit=50 teams=2 leadlimit=0",_("Help your team score the most frags against the enemy team")); - } - METHOD(TeamDeathmatch, m_parse_mapinfo, bool(string k, string v)) - { - if (!k) { - cvar_set("g_tdm_teams", cvar_defstring("g_tdm_teams")); - return true; - } - switch (k) { - case "teams": - cvar_set("g_tdm_teams", v); - return true; - } - return false; - } - METHOD(TeamDeathmatch, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) - { - if(spawnpoints >= 8 && diameter > 3250) - return true; - return false; - } - METHOD(TeamDeathmatch, m_isForcedSupported, bool(Gametype this)) - { - if(cvar("g_tdm_on_dm_maps")) - { - // if this is set, all DM maps support TDM too - if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.gametype_flags)) - return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported) - } - return false; - } - METHOD(TeamDeathmatch, m_setTeams, void(string sa)) - { - cvar_set("g_tdm_teams", sa); - } - METHOD(TeamDeathmatch, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) - { - TC(Gametype, this); - returns(menu, _("Point limit:"), 5, 100, 5, "g_tdm_point_limit", "g_tdm_teams_override", _("The amount of points needed before the match will end")); - } - ATTRIB(TeamDeathmatch, m_legacydefaults, string, "50 20 2 0"); + INIT(TeamDeathmatch) + { + this.gametype_init(this, _("Team Deathmatch"),"tdm","g_tdm",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PRIORITY,"","timelimit=15 pointlimit=50 teams=2 leadlimit=0",_("Help your team score the most frags against the enemy team")); + } + METHOD(TeamDeathmatch, m_parse_mapinfo, bool(string k, string v)) + { + if (!k) + { + cvar_set("g_tdm_teams", cvar_defstring("g_tdm_teams")); + return true; + } + switch (k) + { + case "teams": + cvar_set("g_tdm_teams", v); + return true; + } + return false; + } + METHOD(TeamDeathmatch, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + if(spawnpoints >= 8 && diameter > 3250) + return true; + return false; + } + METHOD(TeamDeathmatch, m_isForcedSupported, bool(Gametype this)) + { + if(cvar("g_tdm_on_dm_maps")) + { + // if this is set, all DM maps support TDM too + if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.gametype_flags)) + return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported) + } + return false; + } + METHOD(TeamDeathmatch, m_setTeams, void(string sa)) + { + cvar_set("g_tdm_teams", sa); + } + METHOD(TeamDeathmatch, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns)) + { + TC(Gametype, this); + returns(menu, _("Point limit:"), 5, 100, 5, "g_tdm_point_limit", "g_tdm_teams_override", _("The amount of points needed before the match will end")); + } + ATTRIB(TeamDeathmatch, m_legacydefaults, string, "50 20 2 0"); ENDCLASS(TeamDeathmatch) REGISTER_GAMETYPE(TEAM_DEATHMATCH, NEW(TeamDeathmatch)); #define g_tdm IS_GAMETYPE(TEAM_DEATHMATCH) diff --git a/qcsrc/common/gamemodes/gamemode/tka/tka.qh b/qcsrc/common/gamemodes/gamemode/tka/tka.qh index af9d60db3a..8dc03b1185 100644 --- a/qcsrc/common/gamemodes/gamemode/tka/tka.qh +++ b/qcsrc/common/gamemodes/gamemode/tka/tka.qh @@ -8,51 +8,53 @@ #endif CLASS(TeamKeepaway, Gametype) - INIT(TeamKeepaway) - { - this.gametype_init(this, _("Team Keepaway"),"tka","g_tka",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=15 pointlimit=50 teams=2 leadlimit=0",_("Keep the ball in your team's possession to get points for kills")); - } - METHOD(TeamKeepaway, m_parse_mapinfo, bool(string k, string v)) - { - if (!k) { - cvar_set("g_tka_teams", cvar_defstring("g_tka_teams")); - return true; - } - switch (k) { - case "teams": - cvar_set("g_tka_teams", v); - return true; - } - return false; - } - METHOD(TeamKeepaway, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) - { - if(spawnpoints >= 8 && diameter > 4096) - return true; - return false; - } - METHOD(TeamKeepaway, m_isForcedSupported, bool(Gametype this)) - { - if(cvar("g_tka_on_ka_maps")) - { - // if this is set, all KA maps support TKA too - if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEEPAWAY.gametype_flags)) - return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported) - } - if(cvar("g_tka_on_tdm_maps")) - { - // if this is set, all TDM maps support TKA too - if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH.gametype_flags)) - return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported) - } - return false; - } - METHOD(TeamKeepaway, m_setTeams, void(string sa)) - { - cvar_set("g_tka_teams", sa); - } + INIT(TeamKeepaway) + { + this.gametype_init(this, _("Team Keepaway"),"tka","g_tka",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=15 pointlimit=50 teams=2 leadlimit=0",_("Keep the ball in your team's possession to get points for kills")); + } + METHOD(TeamKeepaway, m_parse_mapinfo, bool(string k, string v)) + { + if (!k) + { + cvar_set("g_tka_teams", cvar_defstring("g_tka_teams")); + return true; + } + switch (k) + { + case "teams": + cvar_set("g_tka_teams", v); + return true; + } + return false; + } + METHOD(TeamKeepaway, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + if(spawnpoints >= 8 && diameter > 4096) + return true; + return false; + } + METHOD(TeamKeepaway, m_isForcedSupported, bool(Gametype this)) + { + if(cvar("g_tka_on_ka_maps")) + { + // if this is set, all KA maps support TKA too + if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEEPAWAY.gametype_flags)) + return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported) + } + if(cvar("g_tka_on_tdm_maps")) + { + // if this is set, all TDM maps support TKA too + if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH.gametype_flags)) + return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported) + } + return false; + } + METHOD(TeamKeepaway, m_setTeams, void(string sa)) + { + cvar_set("g_tka_teams", sa); + } #ifdef CSQC - ATTRIB(TeamKeepaway, m_modicons, void(vector pos, vector mySize), HUD_Mod_TeamKeepaway); + ATTRIB(TeamKeepaway, m_modicons, void(vector pos, vector mySize), HUD_Mod_TeamKeepaway); #endif ENDCLASS(TeamKeepaway) REGISTER_GAMETYPE(TEAM_KEEPAWAY, NEW(TeamKeepaway)); diff --git a/qcsrc/common/gamemodes/gamemode/tmayhem/tmayhem.qh b/qcsrc/common/gamemodes/gamemode/tmayhem/tmayhem.qh index 5280e79fc8..6372cc5369 100644 --- a/qcsrc/common/gamemodes/gamemode/tmayhem/tmayhem.qh +++ b/qcsrc/common/gamemodes/gamemode/tmayhem/tmayhem.qh @@ -11,14 +11,16 @@ CLASS(tmayhem, Gametype) } METHOD(tmayhem, m_parse_mapinfo, bool(string k, string v)) { - if (!k) { + if (!k) + { cvar_set("g_tmayhem_teams", cvar_defstring("g_tmayhem_teams")); return true; } - switch (k) { + switch (k) + { case "teams": - cvar_set("g_tmayhem_teams", v); - return true; + cvar_set("g_tmayhem_teams", v); + return true; } return false; } diff --git a/qcsrc/ecs/systems/physics.qc b/qcsrc/ecs/systems/physics.qc index da2000c212..5e3d4cc765 100644 --- a/qcsrc/ecs/systems/physics.qc +++ b/qcsrc/ecs/systems/physics.qc @@ -10,7 +10,8 @@ void sys_phys_postupdate(entity this); void sys_phys_update(entity this, float dt) { - if (!IS_CLIENT(this)) { + if (!IS_CLIENT(this)) + { sys_phys_simulate_simple(this, dt); return; } @@ -30,8 +31,10 @@ void sys_phys_update(entity this, float dt) sys_phys_pregame_hold(this); - if (IS_SVQC) { - if (this.move_movetype == MOVETYPE_NONE) { return; } + if (IS_SVQC) + { + if (this.move_movetype == MOVETYPE_NONE) + return; // when we get here, disableclientprediction cannot be 2 if(this.move_movetype == MOVETYPE_FOLLOW) // not compatible with prediction this.disableclientprediction = 1; @@ -50,20 +53,24 @@ void sys_phys_update(entity this, float dt) float maxspeed_mod = 1; // conveyors: first fix velocity - if (this.conveyor.active) { this.velocity -= this.conveyor.movedir; } + if (this.conveyor.active) + this.velocity -= this.conveyor.movedir; MUTATOR_CALLHOOK(PlayerPhysics, this, dt); - if (!IS_PLAYER(this)) { + if (!IS_PLAYER(this)) + { sys_phys_spectator_control(this); maxspeed_mod = STAT(SPECTATORSPEED, this); } sys_phys_fixspeed(this, maxspeed_mod); - if (IS_DEAD(this)) { + if (IS_DEAD(this)) + { // handle water here vector midpoint = ((this.absmin + this.absmax) * 0.5); int cont = pointcontents(midpoint); - if (cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME) { + if (cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME) + { this.velocity = this.velocity * 0.5; // do we want this? @@ -76,30 +83,36 @@ void sys_phys_update(entity this, float dt) PM_check_slick(this); - if (IS_SVQC && !PHYS_FIXANGLE(this)) { this.angles = eY * this.v_angle.y; } - if (IS_PLAYER(this)) { - if (IS_ONGROUND(this)) { + if (IS_SVQC && !PHYS_FIXANGLE(this)) + this.angles = eY * this.v_angle.y; + if (IS_PLAYER(this)) + { + if (IS_ONGROUND(this)) + { PM_check_hitground(this); PM_Footsteps(this); - } else if (IsFlying(this)) { - this.wasFlying = true; } + else if (IsFlying(this)) + this.wasFlying = true; CheckPlayerJump(this); } - if (this.flags & FL_WATERJUMP) { + if (this.flags & FL_WATERJUMP) + { this.velocity_x = this.movedir.x; this.velocity_y = this.movedir.y; - if (time > this.teleport_time || this.waterlevel == WATERLEVEL_NONE) { + if (time > this.teleport_time || this.waterlevel == WATERLEVEL_NONE) + { this.flags &= ~FL_WATERJUMP; this.teleport_time = 0; } - } else if (MUTATOR_CALLHOOK(PM_Physics, this, maxspeed_mod, dt)) { - // handled - } else if (this.move_movetype == MOVETYPE_NOCLIP - || this.move_movetype == MOVETYPE_FLY - || this.move_movetype == MOVETYPE_FLY_WORLDONLY - || MUTATOR_CALLHOOK(IsFlying, this)) + } + else if (MUTATOR_CALLHOOK(PM_Physics, this, maxspeed_mod, dt)) + { /* handled */ } + else if (this.move_movetype == MOVETYPE_NOCLIP + || this.move_movetype == MOVETYPE_FLY + || this.move_movetype == MOVETYPE_FLY_WORLDONLY + || MUTATOR_CALLHOOK(IsFlying, this)) { this.com_phys_friction = PHYS_FRICTION(this); this.com_phys_vel_max = PHYS_MAXSPEED(this) * maxspeed_mod; @@ -107,44 +120,54 @@ void sys_phys_update(entity this, float dt) this.com_phys_friction_air = true; sys_phys_simulate(this, dt); this.com_phys_friction_air = false; - } else if (this.waterlevel >= WATERLEVEL_SWIMMING) { + } + else if (this.waterlevel >= WATERLEVEL_SWIMMING) + { this.com_phys_vel_max = PHYS_MAXSPEED(this) * maxspeed_mod; this.com_phys_acc_rate = PHYS_ACCELERATE(this) * maxspeed_mod; this.com_phys_water = true; sys_phys_simulate(this, dt); this.com_phys_water = false; this.jumppadcount = 0; - } else if (this.ladder_entity) { + } + else if (this.ladder_entity) + { this.com_phys_friction = PHYS_FRICTION(this); this.com_phys_vel_max = PHYS_MAXSPEED(this) * maxspeed_mod; this.com_phys_acc_rate = PHYS_ACCELERATE(this) * maxspeed_mod; this.com_phys_gravity = -PHYS_GRAVITY(this) * dt; - if (PHYS_ENTGRAVITY(this)) { this.com_phys_gravity *= PHYS_ENTGRAVITY(this); } + if (PHYS_ENTGRAVITY(this)) + this.com_phys_gravity *= PHYS_ENTGRAVITY(this); this.com_phys_ladder = true; this.com_phys_friction_air = true; sys_phys_simulate(this, dt); this.com_phys_friction_air = false; this.com_phys_ladder = false; this.com_phys_gravity = 0; - } else if (ITEMS_STAT(this) & IT_USING_JETPACK) { + } + else if (ITEMS_STAT(this) & IT_USING_JETPACK) PM_jetpack(this, maxspeed_mod, dt); - } else if (IS_ONGROUND(this) && (!IS_ONSLICK(this) || !PHYS_SLICK_APPLYGRAVITY(this))) { - if (!WAS_ONGROUND(this)) { + else if (IS_ONGROUND(this) && (!IS_ONSLICK(this) || !PHYS_SLICK_APPLYGRAVITY(this))) + { + if (!WAS_ONGROUND(this)) + { emit(phys_land, this); - if (this.lastground < time - 0.3) { + if (this.lastground < time - 0.3) this.velocity *= (1 - PHYS_FRICTION_ONLAND(this)); - } } this.com_phys_vel_max = PHYS_MAXSPEED(this) * maxspeed_mod; this.com_phys_gravity = -PHYS_GRAVITY(this) * dt; - if (PHYS_ENTGRAVITY(this)) { this.com_phys_gravity *= PHYS_ENTGRAVITY(this); } + if (PHYS_ENTGRAVITY(this)) + this.com_phys_gravity *= PHYS_ENTGRAVITY(this); this.com_phys_ground = true; this.com_phys_vel_2d = true; sys_phys_simulate(this, dt); this.com_phys_vel_2d = false; this.com_phys_ground = false; this.com_phys_gravity = 0; - } else { + } + else + { this.com_phys_acc_rate_air = PHYS_AIRACCELERATE(this) * min(maxspeed_mod, 1); this.com_phys_acc_rate_air_stop = PHYS_AIRSTOPACCELERATE(this) * maxspeed_mod; this.com_phys_acc_rate_air_strafe = PHYS_AIRSTRAFEACCELERATE(this) * maxspeed_mod; @@ -163,9 +186,11 @@ void sys_phys_update(entity this, float dt) void sys_phys_postupdate(entity this) { - if (IS_ONGROUND(this)) { this.lastground = time; } + if (IS_ONGROUND(this)) + this.lastground = time; // conveyors: then break velocity again - if (this.conveyor.active) { this.velocity += this.conveyor.movedir; } + if (this.conveyor.active) + this.velocity += this.conveyor.movedir; this.lastflags = this.flags; this.lastclassname = this.classname; @@ -174,7 +199,8 @@ void sys_phys_postupdate(entity this) /** for players */ void sys_phys_simulate(entity this, float dt) { - if (!this.com_phys_ground && !this.com_phys_air) { + if (!this.com_phys_ground && !this.com_phys_air) + { // noclipping // flying // on a spawnfunc_func_ladder @@ -182,7 +208,8 @@ void sys_phys_simulate(entity this, float dt) // swimming UNSET_ONGROUND(this); - if (this.com_phys_friction_air) { + if (this.com_phys_friction_air) + { const float grav = -this.com_phys_gravity; this.velocity_z += grav / 2; this.velocity = this.velocity * (1 - dt * this.com_phys_friction); @@ -190,20 +217,28 @@ void sys_phys_simulate(entity this, float dt) } } - if (this.com_phys_water) { + if (this.com_phys_water) + { // water jump only in certain situations // this mimics quakeworld code - if (this.com_in_jump && this.waterlevel == WATERLEVEL_SWIMMING && this.velocity_z >= -180 && !this.viewloc && !PHYS_FROZEN(this)) { + if (this.com_in_jump + && this.waterlevel == WATERLEVEL_SWIMMING + && this.velocity_z >= -180 + && !this.viewloc + && !PHYS_FROZEN(this)) + { vector yawangles = eY * this.v_angle.y; vector forward, right, up; MAKE_VECTORS(yawangles, forward, right, up); vector spot = this.origin + 24 * forward; spot_z += 8; traceline(spot, spot, MOVE_NOMONSTERS, this); - if (trace_startsolid) { + if (trace_startsolid) + { spot_z += 24; traceline(spot, spot, MOVE_NOMONSTERS, this); - if (!trace_startsolid) { + if (!trace_startsolid) + { this.velocity = forward * 50; this.velocity_z = 310; UNSET_ONGROUND(this); @@ -220,7 +255,8 @@ void sys_phys_simulate(entity this, float dt) vector wishvel = forward * PHYS_CS(this).movement.x + right * PHYS_CS(this).movement.y + eZ * (this.com_phys_vel_2d ? 0 : PHYS_CS(this).movement.z); - if (this.com_phys_water) { + if (this.com_phys_water) + { if (PHYS_FROZEN(this)) { if(this.waterlevel >= WATERLEVEL_SUBMERGED && this.velocity.z >= -70) // don't change the speed too abruptally @@ -230,35 +266,35 @@ void sys_phys_simulate(entity this, float dt) } else { - if (PHYS_INPUT_BUTTON_CROUCH(this)) { + if (PHYS_INPUT_BUTTON_CROUCH(this)) wishvel.z = -PHYS_MAXSPEED(this); - } - if (this.viewloc) { + if (this.viewloc) wishvel.z = -160; // drift anyway - } else if (wishvel == '0 0 0') { + else if (wishvel == '0 0 0') wishvel.z = -60; // drift towards bottom - } } } - if (this.com_phys_ladder) { - if (this.viewloc) { + if (this.com_phys_ladder) + { + if (this.viewloc) wishvel.z = PHYS_CS(this).movement_old.x; - } - if (this.ladder_entity.classname == "func_water") { + + if (this.ladder_entity.classname == "func_water") + { float f = vlen(wishvel); - if (f > this.ladder_entity.speed) { + if (f > this.ladder_entity.speed) wishvel *= (this.ladder_entity.speed / f); - } this.watertype = this.ladder_entity.skin; f = this.ladder_entity.origin_z + this.ladder_entity.maxs_z; - if ((this.origin_z + this.view_ofs_z) < f) { + if ((this.origin_z + this.view_ofs_z) < f) this.waterlevel = WATERLEVEL_SUBMERGED; - } else if ((this.origin_z + (this.mins_z + this.maxs_z) * 0.5) < f) { + else if ((this.origin_z + (this.mins_z + this.maxs_z) * 0.5) < f) this.waterlevel = WATERLEVEL_SWIMMING; - } else if ((this.origin_z + this.mins_z + 1) < f) { + else if ((this.origin_z + this.mins_z + 1) < f) this.waterlevel = WATERLEVEL_WETFEET; - } else { + else + { this.waterlevel = WATERLEVEL_NONE; this.watertype = CONTENT_EMPTY; } @@ -272,23 +308,26 @@ void sys_phys_simulate(entity this, float dt) const vector wishdir = wishspeed ? wishvel * (1 / wishspeed) : '0 0 0'; wishspeed = min(wishspeed, this.com_phys_vel_max); - if (this.com_phys_air) { - if (!(this.flags & FL_WATERJUMP)) { + if (this.com_phys_air) + { + if (!(this.flags & FL_WATERJUMP)) + { // apply air speed limit float airaccelqw = PHYS_AIRACCEL_QW(this); float wishspeed0 = wishspeed; const float maxairspd = this.com_phys_vel_max; wishspeed = min(wishspeed, maxairspd); - if (IS_DUCKED(this)) { + if (IS_DUCKED(this)) wishspeed *= 0.5; - } + float airaccel = this.com_phys_acc_rate_air; float accelerating = (this.velocity * wishdir > 0); float wishspeed2 = wishspeed; // CPM: air control - if (PHYS_AIRSTOPACCELERATE(this)) { + if (PHYS_AIRSTOPACCELERATE(this)) + { vector curdir = normalize(vec2(this.velocity)); airaccel += (this.com_phys_acc_rate_air_stop - airaccel) * max(0, -(curdir * wishdir)); } @@ -301,36 +340,41 @@ void sys_phys_simulate(entity this, float dt) // log dv/dt = logaccel + logmaxspeed (when slow) // log dv/dt = logaccel + logmaxspeed + log(1 - accelqw) (when fast) float strafity = IsMoveInDirection(PHYS_CS(this).movement, -90) + IsMoveInDirection(PHYS_CS(this).movement, +90); // if one is nonzero, other is always zero - if (PHYS_MAXAIRSTRAFESPEED(this)) { - wishspeed = min(wishspeed, - GeomLerp(this.com_phys_vel_max_air, strafity, this.com_phys_vel_max_air_strafe)); - } - if (PHYS_AIRSTRAFEACCELERATE(this)) { + if (PHYS_MAXAIRSTRAFESPEED(this)) + wishspeed = min(wishspeed, GeomLerp(this.com_phys_vel_max_air, + strafity, + this.com_phys_vel_max_air_strafe)); + + if (PHYS_AIRSTRAFEACCELERATE(this)) airaccel = GeomLerp(airaccel, strafity, this.com_phys_acc_rate_air_strafe); - } - if (PHYS_AIRSTRAFEACCEL_QW(this)) { + + if (PHYS_AIRSTRAFEACCEL_QW(this)) airaccelqw = (((strafity > 0.5 ? PHYS_AIRSTRAFEACCEL_QW(this) : PHYS_AIRACCEL_QW(this)) >= 0) ? +1 : -1) * (1 - GeomLerp(1 - fabs(PHYS_AIRACCEL_QW(this)), strafity, 1 - fabs(PHYS_AIRSTRAFEACCEL_QW(this)))); - } // !CPM - if (PHYS_WARSOWBUNNY_TURNACCEL(this) && accelerating && PHYS_CS(this).movement.y == 0 && PHYS_CS(this).movement.x != 0) { + if (PHYS_WARSOWBUNNY_TURNACCEL(this) && accelerating && PHYS_CS(this).movement.y == 0 && PHYS_CS(this).movement.x != 0) PM_AirAccelerate(this, dt, wishdir, wishspeed2); - } else { + else + { float sidefric = maxairspd ? (PHYS_AIRACCEL_SIDEWAYS_FRICTION(this) / maxairspd) : 0; PM_Accelerate(this, dt, wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, PHYS_AIRACCEL_QW_STRETCHFACTOR(this), sidefric, PHYS_AIRSPEEDLIMIT_NONQW(this)); } - if (PHYS_AIRCONTROL(this)) { + if (PHYS_AIRCONTROL(this)) CPM_PM_Aircontrol(this, dt, wishdir, wishspeed2); - } } - } else { - if (this.com_phys_ground && IS_DUCKED(this)) { wishspeed *= 0.5; } - if (this.com_phys_water) { + } + else + { + if (this.com_phys_ground && IS_DUCKED(this)) + wishspeed *= 0.5; + + if (this.com_phys_water) + { wishspeed *= 0.7; // if (!(this.flags & FL_WATERJUMP)) // TODO: use @@ -341,41 +385,48 @@ void sys_phys_simulate(entity this, float dt) this.velocity *= f; f = wishspeed - this.velocity * wishdir; - if (f > 0) { + if (f > 0) + { float accelspeed = min(PHYS_ACCELERATE(this) * dt * wishspeed, f); this.velocity += accelspeed * wishdir; } // holding jump button swims upward slowly - if (this.com_in_jump && !this.viewloc && !PHYS_FROZEN(this)) { + if (this.com_in_jump && !this.viewloc && !PHYS_FROZEN(this)) + { // was: // lava: 50 // slime: 80 // water: 100 // idea: double those - if (this.waterlevel >= WATERLEVEL_SUBMERGED) { + if (this.waterlevel >= WATERLEVEL_SUBMERGED) this.velocity_z = PHYS_MAXSPEED(this) * 0.7; - } else { + else this.velocity_z = 200; - } } } - if (this.viewloc) { + if (this.viewloc) + { const float addspeed = wishspeed - this.velocity * wishdir; - if (addspeed > 0) { + if (addspeed > 0) + { const float accelspeed = min(PHYS_ACCELERATE(this) * dt * wishspeed, addspeed); this.velocity += accelspeed * wishdir; } - } else { + } + else + { // water acceleration PM_Accelerate(this, dt, wishdir, wishspeed, wishspeed, this.com_phys_acc_rate, 1, 0, 0, 0); } return; } - if (this.com_phys_ground) { + if (this.com_phys_ground) + { // apply edge friction const float f2 = vlen2(vec2(this.velocity)); - if (f2 > 0) { + if (f2 > 0) + { // TODO: apply edge friction // apply ground friction const int realfriction = (IS_ONSLICK(this)) @@ -411,16 +462,16 @@ void sys_phys_simulate(entity this, float dt) */ } const float addspeed = wishspeed - this.velocity * wishdir; - if (addspeed > 0) { + if (addspeed > 0) + { const float accelspeed = min(PHYS_ACCELERATE(this) * dt * wishspeed, addspeed); this.velocity += accelspeed * wishdir; } return; } - if (!(this.flags & FL_WATERJUMP)) { + if (!(this.flags & FL_WATERJUMP)) PM_Accelerate(this, dt, wishdir, wishspeed, wishspeed, this.com_phys_acc_rate, 1, 0, 0, 0); - } } } @@ -432,7 +483,8 @@ void sys_phys_simulate_simple(entity this, float dt) vector mx = this.maxs; vector g = '0 0 0'; - if (this.com_phys_gravity_factor && !g) g = '0 0 -1' * PHYS_GRAVITY(NULL); + if (this.com_phys_gravity_factor && !g) + g = '0 0 -1' * PHYS_GRAVITY(NULL); vector vel = this.com_phys_vel; vector pos = this.com_phys_pos; @@ -443,21 +495,27 @@ void sys_phys_simulate_simple(entity this, float dt) this.angles += dt * this.avelocity; float movetime = dt; - for (int i = 0; i < MAX_CLIP_PLANES && movetime > 0; ++i) { + for (int i = 0; i < MAX_CLIP_PLANES && movetime > 0; ++i) + { vector push = vel * movetime; vector p0 = pos; vector p1 = p0 + push; // SV_PushEntity tracebox(p0, mn, mx, p1, MOVE_NORMAL, this); - if (!trace_startsolid) { + if (!trace_startsolid) + { bool hit = trace_fraction < 1; pos = trace_endpos; entity ent = trace_ent; // SV_LinkEdict_TouchAreaGrid - if (this.solid != SOLID_NOT) { - FOREACH_ENTITY_RADIUS_ORDERED(0.5 * (this.absmin + this.absmax), 0.5 * vlen(this.absmax - this.absmin), true, { - if (it.solid != SOLID_TRIGGER || it == this) continue; - if (gettouch(it) && boxesoverlap(it.absmin, it.absmax, this.absmin, this.absmax)) { + if (this.solid != SOLID_NOT) + { + FOREACH_ENTITY_RADIUS_ORDERED(0.5 * (this.absmin + this.absmax), 0.5 * vlen(this.absmax - this.absmin), true, + { + if (it.solid != SOLID_TRIGGER || it == this) + continue; + if (gettouch(it) && boxesoverlap(it.absmin, it.absmax, this.absmin, this.absmax)) + { // SV_LinkEdict_TouchAreaGrid_Call trace_allsolid = false; trace_startsolid = false; @@ -477,15 +535,17 @@ void sys_phys_simulate_simple(entity this, float dt) } }); } - if (hit && this.solid >= SOLID_TRIGGER && (!IS_ONGROUND(this) || this.groundentity != ent)) { + if (hit && this.solid >= SOLID_TRIGGER && (!IS_ONGROUND(this) || this.groundentity != ent)) + { // SV_Impact (ent, trace); tracebox(p0, mn, mx, p1, MOVE_NORMAL, this); void(entity, entity) touched = gettouch(this); - if (touched && this.solid != SOLID_NOT) { + if (touched && this.solid != SOLID_NOT) touched(ent, this); - } + void(entity, entity) touched2 = gettouch(ent); - if (this && ent && touched2 && ent.solid != SOLID_NOT) { + if (this && ent && touched2 && ent.solid != SOLID_NOT) + { trace_endpos = ent.origin; trace_plane_normal *= -1; trace_plane_dist *= -1; @@ -499,9 +559,11 @@ void sys_phys_simulate_simple(entity this, float dt) } } // end SV_PushEntity - if (wasfreed(this)) { return; } + if (wasfreed(this)) + return; tracebox(p0, mn, mx, p1, MOVE_NORMAL, this); - if (trace_fraction == 1) { break; } + if (trace_fraction == 1) + break; movetime *= 1 - min(1, trace_fraction); ClipVelocity(vel, trace_plane_normal, vel, 1); } diff --git a/qcsrc/ecs/systems/sv_physics.qc b/qcsrc/ecs/systems/sv_physics.qc index 8b39cfee11..14b0fcd70d 100644 --- a/qcsrc/ecs/systems/sv_physics.qc +++ b/qcsrc/ecs/systems/sv_physics.qc @@ -16,8 +16,10 @@ bool sys_phys_override(entity this, float dt) int buttons = PHYS_INPUT_BUTTON_MASK(this); float idlesince = CS(this).parm_idlesince; CS(this).parm_idlesince = time; // in the case that physics are overridden - if (PM_check_specialcommand(this, buttons)) { return true; } - if (this.PlayerPhysplug && this.PlayerPhysplug(this, dt)) { return true; } + if (PM_check_specialcommand(this, buttons)) + return true; + if (this.PlayerPhysplug && this.PlayerPhysplug(this, dt)) + return true; CS(this).parm_idlesince = idlesince; return false; } @@ -39,20 +41,26 @@ void sys_phys_monitor(entity this, float dt) void sys_phys_ai(entity this) { - if (!IS_BOT_CLIENT(this)) { return; } + if (!IS_BOT_CLIENT(this)) + return; bot_think(this); } void sys_phys_pregame_hold(entity this) { - if (!IS_PLAYER(this)) { return; } + if (!IS_PLAYER(this)) + return; const bool allowed_to_move = (time >= game_starttime && !game_stopped); - if (!allowed_to_move) { + if (!allowed_to_move) + { this.velocity = '0 0 0'; set_movetype(this, MOVETYPE_NONE); this.disableclientprediction = 2; - } else if (this.disableclientprediction == 2) { - if (this.move_movetype == MOVETYPE_NONE) { set_movetype(this, MOVETYPE_WALK); } + } + else if (this.disableclientprediction == 2) + { + if (this.move_movetype == MOVETYPE_NONE) + set_movetype(this, MOVETYPE_WALK); this.disableclientprediction = 0; } } @@ -60,29 +68,36 @@ void sys_phys_pregame_hold(entity this) void sys_phys_spectator_control(entity this) { float maxspeed_mod = autocvar_sv_spectator_speed_multiplier; - if (!STAT(SPECTATORSPEED, this)) { STAT(SPECTATORSPEED, this) = maxspeed_mod; } - if ((CS(this).impulse >= 1 && CS(this).impulse <= 19) - || (CS(this).impulse >= 200 && CS(this).impulse <= 209) - || (CS(this).impulse >= 220 && CS(this).impulse <= 229) - ) { - if (this.lastclassname != STR_PLAYER) { + if (!STAT(SPECTATORSPEED, this)) + STAT(SPECTATORSPEED, this) = maxspeed_mod; + if ((CS(this).impulse >= 1 && CS(this).impulse <= 19) + || (CS(this).impulse >= 200 && CS(this).impulse <= 209) + || (CS(this).impulse >= 220 && CS(this).impulse <= 229)) + { + if (this.lastclassname != STR_PLAYER) + { if (CS(this).impulse == 10 - || CS(this).impulse == 15 - || CS(this).impulse == 18 - || (CS(this).impulse >= 200 && CS(this).impulse <= 209) - ) { - STAT(SPECTATORSPEED, this) = bound(autocvar_sv_spectator_speed_multiplier_min, STAT(SPECTATORSPEED, this) + 0.5, autocvar_sv_spectator_speed_multiplier_max); - } else if (CS(this).impulse == 11) { + || CS(this).impulse == 15 + || CS(this).impulse == 18 + || (CS(this).impulse >= 200 && CS(this).impulse <= 209)) + { + STAT(SPECTATORSPEED, this) = bound(autocvar_sv_spectator_speed_multiplier_min, + STAT(SPECTATORSPEED, this) + 0.5, + autocvar_sv_spectator_speed_multiplier_max); + } + else if (CS(this).impulse == 11) STAT(SPECTATORSPEED, this) = maxspeed_mod; - } else if (CS(this).impulse == 12 - || CS(this).impulse == 16 - || CS(this).impulse == 19 - || (CS(this).impulse >= 220 && CS(this).impulse <= 229) - ) { - STAT(SPECTATORSPEED, this) = bound(autocvar_sv_spectator_speed_multiplier_min, STAT(SPECTATORSPEED, this) - 0.5, autocvar_sv_spectator_speed_multiplier_max); - } else if (CS(this).impulse >= 1 && CS(this).impulse <= 9) { - STAT(SPECTATORSPEED, this) = 1 + 0.5 * (CS(this).impulse - 1); + else if (CS(this).impulse == 12 + || CS(this).impulse == 16 + || CS(this).impulse == 19 + || (CS(this).impulse >= 220 && CS(this).impulse <= 229)) + { + STAT(SPECTATORSPEED, this) = bound(autocvar_sv_spectator_speed_multiplier_min, + STAT(SPECTATORSPEED, this) - 0.5, + autocvar_sv_spectator_speed_multiplier_max); } + else if (CS(this).impulse >= 1 && CS(this).impulse <= 9) + STAT(SPECTATORSPEED, this) = 1 + 0.5 * (CS(this).impulse - 1); } // otherwise just clear CS(this).impulse = 0; } @@ -91,7 +106,8 @@ void sys_phys_spectator_control(entity this) void sys_phys_fixspeed(entity this, float maxspeed_mod) { float spd = max(PHYS_MAXSPEED(this), PHYS_MAXAIRSPEED(this)) * maxspeed_mod; - if (this.speed != spd) { + if (this.speed != spd) + { this.speed = spd; // TODO: send this as a stat and set the below cvars on the client? string temps = ftos(spd); stuffcmd(this, strcat("cl_forwardspeed ", temps, "\n")); @@ -100,11 +116,13 @@ void sys_phys_fixspeed(entity this, float maxspeed_mod) stuffcmd(this, strcat("cl_upspeed ", temps, "\n")); } - if (this.jumpspeedcap_min != autocvar_sv_jumpspeedcap_min) { + if (this.jumpspeedcap_min != autocvar_sv_jumpspeedcap_min) + { this.jumpspeedcap_min = autocvar_sv_jumpspeedcap_min; stuffcmd(this, sprintf("\ncl_jumpspeedcap_min \"%s\"\n", autocvar_sv_jumpspeedcap_min)); } - if (this.jumpspeedcap_max != autocvar_sv_jumpspeedcap_max) { + if (this.jumpspeedcap_max != autocvar_sv_jumpspeedcap_max) + { this.jumpspeedcap_max = autocvar_sv_jumpspeedcap_max; stuffcmd(this, sprintf("\ncl_jumpspeedcap_max \"%s\"\n", autocvar_sv_jumpspeedcap_max)); } @@ -112,12 +130,12 @@ void sys_phys_fixspeed(entity this, float maxspeed_mod) void sys_phys_land(entity this) { - if (autocvar_speedmeter) { + if (autocvar_speedmeter) LOG_TRACEF("landing velocity: %v (abs: %f)", this.velocity, vlen(this.velocity)); - } - if (this.jumppadcount > 1) { + + if (this.jumppadcount > 1) LOG_TRACEF("%dx jumppad combo", this.jumppadcount); - } + this.jumppadcount = 0; }