X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_world.qc;h=894ffd6158b7b347a5ed283d6f334ee3aef57988;hb=489318817dc508e24f479090ddcf53ace10adbf0;hp=dfef41e7bd1e79c71021336e3cd473bee3652a66;hpb=74cb317eb10d44a2f21bd16c352092da742f880f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index dfef41e7b..894ffd615 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -58,7 +58,7 @@ float world_initialized; string GetMapname(); string GetGametype(); void GotoNextMap(float reinit); -void ShuffleMaplist() +void ShuffleMaplist(); float(float reinit) DoNextMapOverride; void SetDefaultAlpha() @@ -340,9 +340,6 @@ void cvar_changes_init() BADCVAR("gameversion"); BADPREFIX("gameversion_"); BADCVAR("sv_namechangetimer"); -#ifndef NO_LEGACY_NETWORKING - BADCVAR("sv_use_csqc_players"); // transition -#endif // allowed changes to server admins (please sync this to server.cfg) // vi commands: @@ -598,6 +595,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); @@ -673,9 +672,6 @@ void spawnfunc_worldspawn (void) WaypointSprite_Init(); - //if (g_domination) - // dom_init(); - GameLogInit(); // prepare everything // NOTE for matchid: // changing the logic generating it is okay. But: @@ -830,42 +826,42 @@ void spawnfunc_worldspawn (void) addstat(STAT_MOVEVARS_MAXSPEED, AS_FLOAT, stat_sv_maxspeed); addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw); addstat(STAT_MOVEVARS_AIRSTRAFEACCEL_QW, AS_FLOAT, stat_sv_airstrafeaccel_qw); - + // secrets addstat(STAT_SECRETS_TOTAL, AS_FLOAT, stat_secrets_total); addstat(STAT_SECRETS_FOUND, AS_FLOAT, stat_secrets_found); // misc addstat(STAT_RESPAWN_TIME, AS_FLOAT, stat_respawn_time); - + next_pingtime = time + 5; detect_maptype(); - + // set up information replies for clients and server to use lsmaps_reply = "^7Maps available: "; lsnewmaps_reply = "^7Maps without a record set: "; 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"; else col = "^3"; - + ++j; - + lsmaps_reply = strcat(lsmaps_reply, col, MapInfo_Map_bspname, " "); - + if(g_race && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, RACE_RECORD, "time")))) lsnewmaps_reply = strcat(lsnewmaps_reply, col, MapInfo_Map_bspname, " "); else if(g_cts && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, CTS_RECORD, "time")))) lsnewmaps_reply = strcat(lsnewmaps_reply, col, MapInfo_Map_bspname, " "); } } - + lsmaps_reply = strzone(strcat(lsmaps_reply, "\n")); lsnewmaps_reply = strzone(strcat(((!g_race && !g_cts) ? "Need to be playing race or CTS for lsnewmaps to work." : lsnewmaps_reply), "\n")); @@ -888,9 +884,11 @@ void spawnfunc_worldspawn (void) for(i = 0; i < 10; ++i) { - records_reply[i] = strzone(getrecords(i)); + s = getrecords(i); + if (s) + records_reply[i] = strzone(s); } - + ladder_reply = strzone(getladder()); rankings_reply = strzone(getrankings()); @@ -946,9 +944,7 @@ void spawnfunc_worldspawn (void) modname = "MinstaGib"; // extra mutators that deserve to count as mod MUTATOR_CALLHOOK(SetModname); - // weird game types that deserve to count as mod - if(g_cts) - modname = "CTS"; + // save it for later modname = strzone(modname); @@ -1349,10 +1345,10 @@ float mapvote_initialized; void IntermissionThink() { FixIntermissionClient(self); - + float server_screenshot = (autocvar_sv_autoscreenshot && self.cvar_cl_autoscreenshot); float client_screenshot = (self.cvar_cl_autoscreenshot == 2); - + if( (server_screenshot || client_screenshot) && ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) ) { @@ -1600,6 +1596,8 @@ void NextLevel() PlayerStats_Shutdown(); WeaponStats_Shutdown(); + Kill_Notification(NOTIF_ALL, world, MSG_CENTER, 0); // kill all centerprints now + if(autocvar_sv_eventlog) GameLogEcho(":gameover"); @@ -1615,6 +1613,8 @@ void NextLevel() if(autocvar_g_campaign) CampaignPreIntermission(); + MUTATOR_CALLHOOK(MatchEnd); + localcmd("\nsv_hook_gameend\n"); } @@ -1680,20 +1680,8 @@ void InitiateOvertime() // ONLY call this if InitiateSuddenDeath returned true tl = autocvar_timelimit; tl += autocvar_timelimit_overtime; cvar_set("timelimit", ftos(tl)); - string minutesPlural; - if (autocvar_timelimit_overtime == 1) - minutesPlural = " ^3minute"; - else - minutesPlural = " ^3minutes"; - - bcenterprint( - strcat( - "^3Now playing ^1OVERTIME^3!\n\n^3Added ^1", - ftos(autocvar_timelimit_overtime), - minutesPlural, - " to the game!" - ) - ); + + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_OVERTIME_TIME, autocvar_timelimit_overtime); } float GetWinningCode(float fraglimitreached, float equality) @@ -1761,10 +1749,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"); } @@ -1772,10 +1760,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; } @@ -1813,13 +1801,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; @@ -1945,10 +1933,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(); @@ -2031,7 +2019,6 @@ float WinningCondition_Race(float fraglimit) return WINNING_STARTSUDDENDEATHOVERTIME; else return WINNING_NEVER; - return wc; } float WinningCondition_QualifyingThenRace(float limit) @@ -2065,25 +2052,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; } @@ -2097,20 +2084,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); @@ -2200,9 +2187,9 @@ void CheckRules_World() { checkrules_suddendeathwarning = TRUE; if(g_race && !g_race_qualifying) - bcenterprint("^3Everyone, finish your lap! The race is over!"); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_RACE_FINISHLAP); else - bcenterprint("^3Now playing ^1OVERTIME^3!\n\n^3Keep fragging until we have a ^1winner^3!"); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_OVERTIME_FRAG); } } else @@ -2351,7 +2338,7 @@ string MapVote_Suggest(string m) if(mapvote_initialized) return "Can't suggest - voting is already in progress!"; m = MapInfo_FixName(m); - if(!m) + if not(m) return "The map you suggested is not available on this server."; if(!autocvar_g_maplist_votable_suggestions_override_mostrecent) if(Map_IsRecent(m))