X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fgamemodes%2Fgamemode%2Fclanarena%2Fclanarena.qh;h=27846b3ca4df7e10d831b27aebfe807f122985a1;hb=9f7869b83e8dfee3d1bd05a67760eb662d05a4b8;hp=8a94acd18746f927cdc1db8a7ee19d2921d8f51e;hpb=b6fcf9d4f43bc2a40fa6a947e3148c154136c6d1;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/clanarena.qh b/qcsrc/common/gamemodes/gamemode/clanarena/clanarena.qh index 8a94acd18..27846b3ca 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/clanarena.qh +++ b/qcsrc/common/gamemodes/gamemode/clanarena/clanarena.qh @@ -1,56 +1,51 @@ #pragma once -#ifdef SVQC -#include -#include -#include +#include -int autocvar_g_ca_point_limit; -int autocvar_g_ca_point_leadlimit; -float autocvar_g_ca_round_timelimit; -bool autocvar_g_ca_team_spawns; -//int autocvar_g_ca_teams; -int autocvar_g_ca_teams_override; -float autocvar_g_ca_warmup; - - -int ca_teams; -bool allowed_to_spawn; - -const int ST_CA_ROUNDS = 1; - -bool CA_CheckTeams(); -bool CA_CheckWinner(); -void CA_RoundStart(); -bool ca_isEliminated(entity e); - -REGISTER_MUTATOR(ca, false) -{ - 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); - - 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); - }); - - allowed_to_spawn = true; - round_handler_Spawn(CA_CheckTeams, CA_CheckWinner, CA_RoundStart); - round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit); - EliminatedPlayers_Init(ca_isEliminated); - } - return 0; -} - -// should be removed in the future, as other code should not have to care -.float caplayer; // 0.5 if scheduled to join the next round +#ifdef CSQC +//void HUD_Mod_CA(vector pos, vector mySize); +//void HUD_Mod_CA_Export(int fh); +int HUD_Scores_CA(int team); +#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 > 4096) + 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, _("Frag limit:"), 5, 100, 5, "fraglimit_override", "g_ca_teams_override", _("The amount of frags 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_modscores, int(int team), HUD_Scores_CA); #endif + ATTRIB(ClanArena, m_legacydefaults, string, "10 20 0"); +ENDCLASS(ClanArena) +REGISTER_GAMETYPE(CA, NEW(ClanArena)); +#define g_ca IS_GAMETYPE(CA)