X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_world.qc;h=a07fc32a4fc2d1841410c0c4ca4a0a70bcbe6da1;hb=99e4fa0264127dfcf4675d5f645061b51af815e4;hp=001fbc5bb5d2d5dd718bbd188eddbf1a4dd5c307;hpb=e53a7fa61810047536f1e2b2da0a7d0bc5c8c8a0;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 001fbc5bb..a07fc32a4 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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: @@ -563,6 +560,7 @@ void spawnfunc___init_dedicated_server(void) void Map_MarkAsRecent(string m); float world_already_spawned; void Nagger_Init(); +void Item_ItemsTime_Init(); void ClientInit_Spawn(); void WeaponStats_Init(); void WeaponStats_Shutdown(); @@ -598,6 +596,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 +673,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: @@ -812,6 +809,18 @@ void spawnfunc_worldspawn (void) addstat(STAT_HAGAR_LOAD, AS_INT, hagar_load); + addstat(STAT_ARMOR_LARGE_TIME, AS_FLOAT, item_armor_large_time); + addstat(STAT_HEALTH_MEGA_TIME, AS_FLOAT, item_health_mega_time); + addstat(STAT_INVISIBLE_TIME, AS_FLOAT, item_invisible_time); + addstat(STAT_SPEED_TIME, AS_FLOAT, item_speed_time); + addstat(STAT_EXTRALIFE_TIME, AS_FLOAT, item_extralife_time); + addstat(STAT_STRENGTH_TIME, AS_FLOAT, item_strength_time); + addstat(STAT_SHIELD_TIME, AS_FLOAT, item_shield_time); + addstat(STAT_FUELREGEN_TIME, AS_FLOAT, item_fuelregen_time); + addstat(STAT_JETPACK_TIME, AS_FLOAT, item_jetpack_time); + addstat(STAT_SUPERWEAPONS_TIME, AS_FLOAT, item_superweapons_time); + Item_ItemsTime_Init(); + if(g_ca || g_freezetag) { addstat(STAT_REDALIVE, AS_INT, redalive_stat); @@ -848,7 +857,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"; @@ -948,9 +957,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); @@ -1602,6 +1609,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"); @@ -1684,20 +1693,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) @@ -1765,10 +1762,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"); } @@ -1776,10 +1773,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; } @@ -1817,13 +1814,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; @@ -1949,10 +1946,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(); @@ -2068,25 +2065,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; } @@ -2100,20 +2097,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); @@ -2203,9 +2200,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