]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_world.qc
Merge remote-tracking branch 'origin/master' into Mario/lms_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_world.qc
index f00e468185f88b74dcba238678b9357499876aaa..1af52b13209eea54f3d915f1a1992a1c0b12cc6f 100644 (file)
@@ -256,22 +256,22 @@ void cvar_changes_init()
                BADCVAR("g_arena");
                BADCVAR("g_assault");
                BADCVAR("g_ca");
+               BADCVAR("g_ca_teams");
                BADCVAR("g_ctf");
                BADCVAR("g_cts");
                BADCVAR("g_dm");
                BADCVAR("g_domination");
                BADCVAR("g_domination_default_teams");
                BADCVAR("g_freezetag");
+               BADCVAR("g_freezetag_teams");
                BADCVAR("g_keepaway");
                BADCVAR("g_keyhunt");
                BADCVAR("g_keyhunt_teams");
-               BADCVAR("g_keyhunt_teams");
                BADCVAR("g_lms");
                BADCVAR("g_nexball");
                BADCVAR("g_onslaught");
                BADCVAR("g_race");
                BADCVAR("g_race_qualifying_timelimit");
-               BADCVAR("g_runematch");
                BADCVAR("g_tdm");
                BADCVAR("g_tdm_teams");
                BADCVAR("leadlimit");
@@ -315,7 +315,6 @@ void cvar_changes_init()
                BADCVAR("g_keyhunt_point_leadlimit");
                BADPREFIX("g_mod_");
                BADCVAR("g_nexball_goalleadlimit");
-               BADCVAR("g_runematch_point_leadlimit");
                BADCVAR("leadlimit_and_fraglimit");
                BADCVAR("leadlimit_override");
                BADCVAR("pausable");
@@ -361,8 +360,10 @@ void cvar_changes_init()
                BADCVAR("g_balance_teams_scorefactor");
                BADCVAR("g_ban_sync_trusted_servers");
                BADCVAR("g_ban_sync_uri");
+               BADCVAR("g_ca_teams_override");
                BADCVAR("g_ctf_ignore_frags");
                BADCVAR("g_domination_point_limit");
+               BADCVAR("g_freezetag_teams_override");
                BADCVAR("g_friendlyfire");
                BADCVAR("g_fullbrightitems");
                BADCVAR("g_fullbrightplayers");
@@ -381,7 +382,6 @@ void cvar_changes_init()
                BADCVAR("g_mirrordamage");
                BADCVAR("g_nexball_goallimit");
                BADCVAR("g_powerups");
-               BADCVAR("g_runematch_point_limit");
                BADCVAR("g_start_delay");
                BADCVAR("g_warmup");
                BADCVAR("g_weapon_stay"); BADPRESUFFIX("g_", "_weapon_stay");
@@ -584,8 +584,6 @@ void spawnfunc_worldspawn (void)
 
        compressShortVector_init();
 
-       allowed_to_spawn = TRUE;
-
        entity head;
        head = nextent(world);
        maxclients = 0;
@@ -595,6 +593,8 @@ void spawnfunc_worldspawn (void)
                head = nextent(head);
        }
 
+       server_is_dedicated = (stof(cvar_defstring("is_dedicated")) ? TRUE : FALSE);
+
        // needs to be done so early because of the constants they create
        CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
        CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
@@ -784,6 +784,7 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_SWITCHWEAPON, AS_INT, switchweapon);
        addstat(STAT_SWITCHINGWEAPON, AS_INT, switchingweapon);
        addstat(STAT_GAMESTARTTIME, AS_FLOAT, stat_game_starttime);
+       addstat(STAT_ROUNDSTARTTIME, AS_FLOAT, stat_round_starttime);
        addstat(STAT_ALLOW_OLDNEXBEAM, AS_INT, stat_allow_oldnexbeam);
        Nagger_Init();
 
@@ -806,19 +807,6 @@ void spawnfunc_worldspawn (void)
 
        addstat(STAT_HAGAR_LOAD, AS_INT, hagar_load);
 
-       if(g_ca || g_freezetag)
-       {
-               addstat(STAT_REDALIVE, AS_INT, redalive_stat);
-               addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat);
-               addstat(STAT_YELLOWALIVE, AS_INT, yellowalive_stat);
-               addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat);
-       }
-       if(g_freezetag)
-       {
-               addstat(STAT_FROZEN, AS_INT, freezetag_frozen);
-               addstat(STAT_REVIVE_PROGRESS, AS_FLOAT, freezetag_revive_progress);
-       }
-
        // g_movementspeed hack
        addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw);
        addstat(STAT_MOVEVARS_MAXSPEED, AS_FLOAT, stat_sv_maxspeed);
@@ -842,7 +830,7 @@ void spawnfunc_worldspawn (void)
        for(i = 0, j = 0; i < MapInfo_count; ++i)
        {
                if(MapInfo_Get_ByID(i))
-                       if not(MapInfo_Map_flags & (MAPINFO_FLAG_HIDDEN | MAPINFO_FLAG_FORBIDDEN))
+                       if not(MapInfo_Map_flags & MapInfo_ForbiddenFlags())
                        {
                                if(mod(i, 2))
                                        col = "^2";
@@ -1351,7 +1339,7 @@ void IntermissionThink()
                && ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) )
        {
                self.autoscreenshot = -1;
-               if(clienttype(self) == CLIENTTYPE_REAL) { stuffcmd(self, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"", GetMapname(), strftime(FALSE, "%s"))); }
+               if(clienttype(self) == CLIENTTYPE_REAL) { stuffcmd(self, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"\n", GetMapname(), strftime(FALSE, "%s"))); }
                return;
        }
 
@@ -1479,7 +1467,7 @@ void DumpStats(float final)
                {
                        s = strcat(":player:see-labels:", GetPlayerScoreString(other, 0), ":");
                        s = strcat(s, ftos(rint(time - other.jointime)), ":");
-                       if(other.classname == "player" || g_arena || g_ca || g_lms)
+                       if(other.classname == "player" || g_arena || other.caplayer == 1 || g_lms)
                                s = strcat(s, ftos(other.team), ":");
                        else
                                s = strcat(s, "spectator:");
@@ -1593,6 +1581,8 @@ void NextLevel()
                PlayerStats_AddGlobalInfo(e);
        PlayerStats_Shutdown();
        WeaponStats_Shutdown();
+       
+       Kill_Notification(NOTIF_ALL, world, MSG_CENTER, 0); // kill all centerprints now
 
        if(autocvar_sv_eventlog)
                GameLogEcho(":gameover");
@@ -1677,7 +1667,7 @@ void InitiateOvertime() // ONLY call this if InitiateSuddenDeath returned true
        tl += autocvar_timelimit_overtime;
        cvar_set("timelimit", ftos(tl));
 
-       Send_Notification(NOTIF_ANY, world, MSG_CENTER, CENTER_OVERTIME_TIME, autocvar_timelimit_overtime);
+       Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_OVERTIME_TIME, autocvar_timelimit_overtime * 60);
 }
 
 float GetWinningCode(float fraglimitreached, float equality)
@@ -1745,10 +1735,10 @@ float WinningCondition_Onslaught()
        {
                if (head.health > 0)
                {
-                       if (head.team == FL_TEAM_1) t1 = 1;
-                       if (head.team == FL_TEAM_2) t2 = 1;
-                       if (head.team == FL_TEAM_3) t3 = 1;
-                       if (head.team == FL_TEAM_4) t4 = 1;
+                       if (head.team == NUM_TEAM_1) t1 = 1;
+                       if (head.team == NUM_TEAM_2) t2 = 1;
+                       if (head.team == NUM_TEAM_3) t3 = 1;
+                       if (head.team == NUM_TEAM_4) t4 = 1;
                }
                head = find(head, classname, "onslaught_generator");
        }
@@ -1756,10 +1746,10 @@ float WinningCondition_Onslaught()
        {
                // game over, only one team remains (or none)
                ClearWinners();
-               if (t1) SetWinners(team, FL_TEAM_1);
-               if (t2) SetWinners(team, FL_TEAM_2);
-               if (t3) SetWinners(team, FL_TEAM_3);
-               if (t4) SetWinners(team, FL_TEAM_4);
+               if (t1) SetWinners(team, NUM_TEAM_1);
+               if (t2) SetWinners(team, NUM_TEAM_2);
+               if (t3) SetWinners(team, NUM_TEAM_3);
+               if (t4) SetWinners(team, NUM_TEAM_4);
                dprint("Have a winner, ending game.\n");
                return WINNING_YES;
        }
@@ -1768,24 +1758,6 @@ float WinningCondition_Onslaught()
        return WINNING_NO;
 }
 
-float LMS_NewPlayerLives()
-{
-       float fl;
-       fl = autocvar_fraglimit;
-       if(fl == 0)
-               fl = 999;
-
-       // first player has left the game for dying too much? Nobody else can get in.
-       if(lms_lowest_lives < 1)
-               return 0;
-
-       if(!autocvar_g_lms_join_anytime)
-               if(lms_lowest_lives < fl - autocvar_g_lms_last_join)
-                       return 0;
-
-       return bound(1, lms_lowest_lives, fl);
-}
-
 // Assault winning condition: If the attackers triggered a round end (by fulfilling all objectives)
 // they win. Otherwise the defending team wins once the timelimit passes.
 void assault_new_round();
@@ -1797,13 +1769,13 @@ float WinningCondition_Assault()
 
        status = WINNING_NO;
        // as the timelimit has not yet passed just assume the defending team will win
-       if(assault_attacker_team == FL_TEAM_1)
+       if(assault_attacker_team == NUM_TEAM_1)
        {
-               SetWinners(team, FL_TEAM_2);
+               SetWinners(team, NUM_TEAM_2);
        }
        else
        {
-               SetWinners(team, FL_TEAM_1);
+               SetWinners(team, NUM_TEAM_1);
        }
 
        entity ent;
@@ -1929,10 +1901,10 @@ float WinningCondition_Scores(float limit, float leadlimit)
 
        if(teamplay)
        {
-               team1_score = TeamScore_GetCompareValue(FL_TEAM_1);
-               team2_score = TeamScore_GetCompareValue(FL_TEAM_2);
-               team3_score = TeamScore_GetCompareValue(FL_TEAM_3);
-               team4_score = TeamScore_GetCompareValue(FL_TEAM_4);
+               team1_score = TeamScore_GetCompareValue(NUM_TEAM_1);
+               team2_score = TeamScore_GetCompareValue(NUM_TEAM_2);
+               team3_score = TeamScore_GetCompareValue(NUM_TEAM_3);
+               team4_score = TeamScore_GetCompareValue(NUM_TEAM_4);
        }
 
        ClearWinners();
@@ -1960,11 +1932,11 @@ float WinningCondition_Scores(float limit, float leadlimit)
 
                        if (limit)
                        if (leaderfrags == limit - 1)
-                               Announce("1fragleft");
+                               Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_REMAINING_FRAG_1);
                        else if (leaderfrags == limit - 2)
-                               Announce("2fragsleft");
+                               Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_REMAINING_FRAG_2);
                        else if (leaderfrags == limit - 3)
-                               Announce("3fragsleft");
+                               Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_REMAINING_FRAG_3);
                }
        }
 
@@ -2048,25 +2020,25 @@ float WinningCondition_RanOutOfSpawns()
 
        FOR_EACH_PLAYER(head) if(head.deadflag == DEAD_NO)
        {
-               if(head.team == FL_TEAM_1)
+               if(head.team == NUM_TEAM_1)
                        team1_score = 1;
-               else if(head.team == FL_TEAM_2)
+               else if(head.team == NUM_TEAM_2)
                        team2_score = 1;
-               else if(head.team == FL_TEAM_3)
+               else if(head.team == NUM_TEAM_3)
                        team3_score = 1;
-               else if(head.team == FL_TEAM_4)
+               else if(head.team == NUM_TEAM_4)
                        team4_score = 1;
        }
 
        for(head = world; (head = find(head, classname, "info_player_deathmatch")) != world; )
        {
-               if(head.team == FL_TEAM_1)
+               if(head.team == NUM_TEAM_1)
                        team1_score = 1;
-               else if(head.team == FL_TEAM_2)
+               else if(head.team == NUM_TEAM_2)
                        team2_score = 1;
-               else if(head.team == FL_TEAM_3)
+               else if(head.team == NUM_TEAM_3)
                        team3_score = 1;
-               else if(head.team == FL_TEAM_4)
+               else if(head.team == NUM_TEAM_4)
                        team4_score = 1;
        }
 
@@ -2080,20 +2052,20 @@ float WinningCondition_RanOutOfSpawns()
        {
                float t, i;
                if(team1_score)
-                       t = FL_TEAM_1;
+                       t = NUM_TEAM_1;
                else if(team2_score)
-                       t = FL_TEAM_2;
+                       t = NUM_TEAM_2;
                else if(team3_score)
-                       t = FL_TEAM_3;
+                       t = NUM_TEAM_3;
                else // if(team4_score)
-                       t = FL_TEAM_4;
+                       t = NUM_TEAM_4;
                CheckAllowedTeams(world);
                for(i = 0; i < MAX_TEAMSCORE; ++i)
                {
-                       if(t != FL_TEAM_1) if(c1 >= 0) TeamScore_AddToTeam(FL_TEAM_1, i, -1000);
-                       if(t != FL_TEAM_2) if(c2 >= 0) TeamScore_AddToTeam(FL_TEAM_2, i, -1000);
-                       if(t != FL_TEAM_3) if(c3 >= 0) TeamScore_AddToTeam(FL_TEAM_3, i, -1000);
-                       if(t != FL_TEAM_4) if(c4 >= 0) TeamScore_AddToTeam(FL_TEAM_4, i, -1000);
+                       if(t != NUM_TEAM_1) if(c1 >= 0) TeamScore_AddToTeam(NUM_TEAM_1, i, -1000);
+                       if(t != NUM_TEAM_2) if(c2 >= 0) TeamScore_AddToTeam(NUM_TEAM_2, i, -1000);
+                       if(t != NUM_TEAM_3) if(c3 >= 0) TeamScore_AddToTeam(NUM_TEAM_3, i, -1000);
+                       if(t != NUM_TEAM_4) if(c4 >= 0) TeamScore_AddToTeam(NUM_TEAM_4, i, -1000);
                }
 
                AddWinners(team, t);
@@ -2183,9 +2155,9 @@ void CheckRules_World()
                {
                        checkrules_suddendeathwarning = TRUE;
                        if(g_race && !g_race_qualifying)
-                               Send_Notification(NOTIF_ANY, world, MSG_CENTER, CENTER_RACE_FINISHLAP);
+                               Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_RACE_FINISHLAP);
                        else
-                               Send_Notification(NOTIF_ANY, world, MSG_CENTER, CENTER_OVERTIME_FRAG);
+                               Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_OVERTIME_FRAG);
                }
        }
        else