X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fserver%2Fworld.qc;h=6c2e4a3f71b906f18242bf69ac8220aab0b6d2ab;hb=1f1fa1320e2dc0234f853ae4dc29cc4d6c0d40f0;hp=51093d51b512abb12fc687c7b391ee0fea9b28db;hpb=f384efe9ffa660805f56e90573e9173adacd248e;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 51093d51b..6c2e4a3f7 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -46,7 +45,6 @@ #include #include #include -#include #include const float LATENCY_THINKRATE = 10; @@ -495,6 +493,7 @@ void cvar_changes_init() BADCVAR("sv_motd"); BADCVAR("sv_public"); BADCVAR("sv_showfps"); + BADCVAR("sv_showspectators"); BADCVAR("sv_status_privacy"); BADCVAR("sv_taunt"); BADCVAR("sv_vote_call"); @@ -820,11 +819,11 @@ spawnfunc(worldspawn) if(autocvar_g_campaign) CampaignPreInit(); + else + PlayerStats_GameReport_Init(); // we need this to be initiated before InitGameplayMode Map_MarkAsRecent(mapname); - PlayerStats_GameReport_Init(); // we need this to be initiated before InitGameplayMode - InitGameplayMode(); static_init_late(); static_init_precache(); @@ -843,46 +842,15 @@ spawnfunc(worldspawn) WaypointSprite_Init(); - GameLogInit(); // prepare everything // NOTE for matchid: // changing the logic generating it is okay. But: // it HAS to stay <= 64 chars // character set: ASCII 33-126 without the following characters: : ; ' " \ $ - if(autocvar_sv_eventlog) - { - string num = strftime_s(); // strftime(false, "%s") isn't reliable, see strftime_s description - string s = sprintf("%s.%s.%06d", itos(autocvar_sv_eventlog_files_counter), num, floor(random() * 1000000)); - matchid = strzone(s); - - GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", s)); - s = ":gameinfo:mutators:LIST"; - - MUTATOR_CALLHOOK(BuildMutatorsString, s); - s = M_ARGV(0, string); - - // initialiation stuff, not good in the mutator system - if(!autocvar_g_use_ammunition) - s = strcat(s, ":no_use_ammunition"); + // strftime(false, "%s") isn't reliable, see strftime_s description + matchid = strzone(sprintf("%d.%s.%06d", autocvar_sv_eventlog_files_counter, strftime_s(), random() * 1000000)); - // initialiation stuff, not good in the mutator system - if(autocvar_g_pickup_items == 0) - s = strcat(s, ":no_pickup_items"); - if(autocvar_g_pickup_items > 0) - s = strcat(s, ":pickup_items"); - - // initialiation stuff, not good in the mutator system - if(autocvar_g_weaponarena != "0") - s = strcat(s, ":", autocvar_g_weaponarena, " arena"); - - // TODO to mutator system - if(autocvar_g_norecoil) - s = strcat(s, ":norecoil"); - - GameLogEcho(s); - GameLogEcho(":gameinfo:end"); - } - else - matchid = strzone(ftos(random())); + if(autocvar_sv_eventlog) + GameLogInit(); // requires matchid to be set cvar_set("nextmap", ""); @@ -1275,6 +1243,7 @@ only called if a time or frag limit has expired */ void NextLevel() { + cvar_set("_endmatch", "0"); game_stopped = true; intermission_running = true; // game over @@ -1333,7 +1302,7 @@ void NextLevel() } -float InitiateSuddenDeath() +int InitiateSuddenDeath() { // Check first whether normal overtimes could be added before initiating suddendeath mode // - for this timelimit_overtime needs to be >0 of course @@ -1350,9 +1319,14 @@ float InitiateSuddenDeath() if(!checkrules_suddendeathend) { if(autocvar_g_campaign) + { checkrules_suddendeathend = time; // no suddendeath in campaign + } else + { checkrules_suddendeathend = time + 60 * autocvar_timelimit_suddendeath; + overtimes = -1; + } if(g_race && !g_race_qualifying) race_StartCompleting(); } @@ -1363,6 +1337,7 @@ float InitiateSuddenDeath() void InitiateOvertime() // ONLY call this if InitiateSuddenDeath returned true { ++checkrules_overtimesadded; + overtimes = checkrules_overtimesadded; //add one more overtime by simply extending the timelimit cvar_set("timelimit", ftos(autocvar_timelimit + autocvar_timelimit_overtime)); Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_OVERTIME_TIME, autocvar_timelimit_overtime * 60); @@ -1613,19 +1588,18 @@ void CheckRules_World() leadlimit = 0; // no leadlimit for now } - if(timelimit > 0) - { - timelimit += game_starttime; - } - else if (timelimit < 0) + if (autocvar__endmatch || timelimit < 0) { // endmatch NextLevel(); return; } - float wantovertime; - wantovertime = 0; + if(timelimit > 0) + timelimit += game_starttime; + + int overtimes_prev = overtimes; + int wantovertime = 0; if(checkrules_suddendeathend) { @@ -1711,6 +1685,12 @@ void CheckRules_World() if(checkrules_status == WINNING_YES) { + if (overtimes == -1 && overtimes != overtimes_prev) + { + // if suddendeathend overtime has just begun, revert it + checkrules_suddendeathend = 0; + overtimes = overtimes_prev; + } //print("WINNING\n"); NextLevel(); } @@ -1872,25 +1852,25 @@ void readplayerstartcvars() else if (s == "all" || s == "1") { g_weaponarena = 1; - g_weaponarena_list = "All Weapons"; + g_weaponarena_list = "All Weapons Arena"; g_weaponarena_weapons = weapons_all(); } else if (s == "devall") { g_weaponarena = 1; - g_weaponarena_list = "Dev All Weapons"; + g_weaponarena_list = "Dev All Weapons Arena"; g_weaponarena_weapons = weapons_devall(); } else if (s == "most") { g_weaponarena = 1; - g_weaponarena_list = "Most Weapons"; + g_weaponarena_list = "Most Weapons Arena"; g_weaponarena_weapons = weapons_most(); } else if (s == "all_available") { g_weaponarena = 1; - g_weaponarena_list = "All Available Weapons"; + g_weaponarena_list = "All Available Weapons Arena"; // this needs to run after weaponsInMapAll is initialized InitializeEntity(NULL, weaponarena_available_all_update, INITPRIO_FINDTARGET); @@ -1898,7 +1878,7 @@ void readplayerstartcvars() else if (s == "devall_available") { g_weaponarena = 1; - g_weaponarena_list = "Dev All Available Weapons"; + g_weaponarena_list = "Dev All Available Weapons Arena"; // this needs to run after weaponsInMapAll is initialized InitializeEntity(NULL, weaponarena_available_devall_update, INITPRIO_FINDTARGET); @@ -1906,7 +1886,7 @@ void readplayerstartcvars() else if (s == "most_available") { g_weaponarena = 1; - g_weaponarena_list = "Most Available Weapons"; + g_weaponarena_list = "Most Available Weapons Arena"; // this needs to run after weaponsInMapAll is initialized InitializeEntity(NULL, weaponarena_available_most_update, INITPRIO_FINDTARGET); @@ -1914,7 +1894,7 @@ void readplayerstartcvars() else if (s == "none") { g_weaponarena = 1; - g_weaponarena_list = "No Weapons"; + g_weaponarena_list = "No Weapons Arena"; } else { @@ -1928,10 +1908,13 @@ void readplayerstartcvars() if(wep != WEP_Null) { g_weaponarena_weapons |= (wep.m_wepset); - g_weaponarena_list = strcat(g_weaponarena_list, wep.m_name, " & "); + g_weaponarena_list = strcat(g_weaponarena_list, wep.netname, " & "); } } - g_weaponarena_list = strzone(substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3)); + if (g_weaponarena_list != "") // remove trailing " & " + g_weaponarena_list = substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3); + else // no valid weapon found + g_weaponarena_list = "No Weapons Arena"; } if (g_weaponarena) @@ -1939,6 +1922,7 @@ void readplayerstartcvars() g_weapon_stay = 0; // incompatible start_weapons = g_weaponarena_weapons; start_items |= IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS; + g_weaponarena_list = strzone(g_weaponarena_list); } else { @@ -2129,7 +2113,7 @@ void readlevelcvars() MUTATOR_CALLHOOK(ReadLevelCvars); - if (!warmup_stage) + if (!warmup_stage && !autocvar_g_campaign) game_starttime = time + cvar("g_start_delay"); FOREACH(Weapons, it != WEP_Null, { it.wr_init(it); });