X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_world.qc;h=a31871d8648ed90339637a28096e7b1167710b42;hp=019d0a2169dbfa0baea915e2a152e9e3b6af4fa7;hb=1bc3ab0285f65c7ed0c75cbba00da2460921c973;hpb=57e8b59f96ec28979c3dc01811412c9c26e60fdc diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 019d0a216..a31871d86 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1,4 +1,42 @@ -#define LATENCY_THINKRATE 10 +#include "g_world.qh" +#include "_all.qh" + +#include "anticheat.qh" +#include "antilag.qh" +#include "bot/bot.qh" +#include "campaign.qh" +#include "cheats.qh" +#include "cl_client.qh" +#include "command/common.qh" +#include "command/getreplies.qh" +#include "command/sv_cmd.qh" +#include "command/vote.qh" +#include "g_hook.qh" +#include "ipban.qh" +#include "mapvoting.qh" +#include "mutators/mutators_include.qh" +#include "race.qh" +#include "scores.qh" +#include "secret.qh" +#include "teamplay.qh" +#include "waypointsprites.qh" +#include "weapons/weaponstats.qh" +#include "../common/buffs.qh" +#include "../common/constants.qh" +#include "../common/deathtypes.qh" +#include "../common/mapinfo.qh" +#include "../common/monsters/all.qh" +#include "../common/monsters/sv_monsters.qh" +#include "../common/vehicles/vehicles.qh" +#include "../common/notifications.qh" +#include "../common/playerstats.qh" +#include "../common/stats.qh" +#include "../common/teams.qh" +#include "../common/util.qh" +#include "../common/items/all.qh" +#include "../common/weapons/all.qh" + +const float LATENCY_THINKRATE = 10; .float latency_sum; .float latency_cnt; .float latency_time; @@ -41,7 +79,7 @@ void PingPLReport_Think() WriteByte(MSG_BROADCAST, 0); WriteByte(MSG_BROADCAST, 0); } - self.cnt = mod(self.cnt + 1, maxclients); + self.cnt = (self.cnt + 1) % maxclients; } void PingPLReport_Spawn() { @@ -56,9 +94,7 @@ string redirection_target; float world_initialized; string GetGametype(); -void GotoNextMap(float reinit); void ShuffleMaplist(); -float(float reinit) DoNextMapOverride; void SetDefaultAlpha() { @@ -81,32 +117,6 @@ void SetDefaultAlpha() } } -void fteqcc_testbugs() -{ - float a, b; - - if(!autocvar_developer_fteqccbugs) - return; - - dprint("*** fteqcc test: checking for bugs...\n"); - - a = 1; - b = 5; - if(sqrt(a) - sqrt(b - a) == 0) - dprint("*** fteqcc test: found same-function-twice bug\n"); - else - dprint("*** fteqcc test: same-function-twice bug got FINALLY FIXED! HOORAY!\n"); - - world.cnt = -10; - world.enemy = world; - world.enemy.cnt += 10; - if(world.cnt > 0.2 || world.cnt < -0.2) // don't error out if it's just roundoff errors - dprint("*** fteqcc test: found += bug\n"); - else - dprint("*** fteqcc test: += bug got FINALLY FIXED! HOORAY!\n"); - world.cnt = 0; -} - void GotoFirstMap() { float n; @@ -159,8 +169,8 @@ void cvar_changes_init() buf_cvarlist(h, "", "_"); // exclude all _ cvars as they are temporary n = buf_getsize(h); - adding = TRUE; - pureadding = TRUE; + adding = true; + pureadding = true; for(i = 0; i < n; ++i) { @@ -180,6 +190,8 @@ void cvar_changes_init() BADCVAR("g_configversion"); BADCVAR("g_maplist_index"); BADCVAR("halflifebsp"); + BADCVAR("sv_mapformat_is_quake2"); + BADCVAR("sv_mapformat_is_quake3"); BADPREFIX("sv_world"); // client @@ -262,6 +274,7 @@ void cvar_changes_init() BADCVAR("g_domination_default_teams"); BADCVAR("g_freezetag"); BADCVAR("g_freezetag_teams"); + BADCVAR("g_invasion_teams"); BADCVAR("g_keepaway"); BADCVAR("g_keyhunt"); BADCVAR("g_keyhunt_teams"); @@ -303,15 +316,21 @@ void cvar_changes_init() // does nothing visible BADCVAR("captureleadlimit_override"); BADCVAR("g_balance_kill_delay"); + BADCVAR("g_ca_point_limit"); BADCVAR("g_ca_point_leadlimit"); BADCVAR("g_ctf_captimerecord_always"); BADCVAR("g_ctf_flag_glowtrails"); BADCVAR("g_ctf_flag_pickup_verbosename"); BADCVAR("g_domination_point_leadlimit"); BADCVAR("g_forced_respawn"); + BADCVAR("g_freezetag_point_limit"); + BADCVAR("g_freezetag_point_leadlimit"); BADCVAR("g_keyhunt_point_leadlimit"); BADPREFIX("g_mod_"); + BADCVAR("g_invasion_point_limit"); BADCVAR("g_nexball_goalleadlimit"); + BADCVAR("g_tdm_point_limit"); + BADCVAR("g_tdm_point_leadlimit"); BADCVAR("leadlimit_and_fraglimit"); BADCVAR("leadlimit_override"); BADCVAR("pausable"); @@ -359,6 +378,7 @@ void cvar_changes_init() BADCVAR("g_ca_teams_override"); BADCVAR("g_ctf_ignore_frags"); BADCVAR("g_domination_point_limit"); + BADCVAR("g_domination_teams_override"); BADCVAR("g_freezetag_teams_override"); BADCVAR("g_friendlyfire"); BADCVAR("g_fullbrightitems"); @@ -379,6 +399,7 @@ void cvar_changes_init() BADCVAR("g_nexball_goallimit"); BADCVAR("g_powerups"); BADCVAR("g_start_delay"); + BADCVAR("g_tdm_teams_override"); BADCVAR("g_warmup"); BADCVAR("g_weapon_stay"); BADPRESUFFIX("g_", "_weapon_stay"); BADCVAR("hostname"); @@ -465,12 +486,12 @@ void detect_maptype() vector o, v; float i; - for(;;) + for (;;) { o = world.mins; - o_x += random() * (world.maxs_x - world.mins_x); - o_y += random() * (world.maxs_y - world.mins_y); - o_z += random() * (world.maxs_z - world.mins_z); + o.x += random() * (world.maxs.x - world.mins.x); + o.y += random() * (world.maxs.y - world.mins.y); + o.z += random() * (world.maxs.z - world.mins.z); tracebox(o, PL_MIN, PL_MAX, o - '0 0 32768', MOVE_WORLDONLY, world); if(trace_fraction == 1) @@ -492,11 +513,11 @@ void detect_maptype() } entity randomseed; -float RandomSeed_Send(entity to, float sf) +float RandomSeed_Send(entity to, int sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_RANDOMSEED); WriteShort(MSG_ENTITY, self.cnt); - return TRUE; + return true; } void RandomSeed_Think() { @@ -509,7 +530,7 @@ void RandomSeed_Spawn() { randomseed = spawn(); randomseed.think = RandomSeed_Think; - Net_LinkEntity(randomseed, FALSE, 0, RandomSeed_Send); + Net_LinkEntity(randomseed, false, 0, RandomSeed_Send); entity oldself; oldself = self; @@ -541,7 +562,9 @@ void spawnfunc___init_dedicated_server(void) // needs to be done so early because of the constants they create CALL_ACCUMULATED_FUNCTION(RegisterWeapons); + CALL_ACCUMULATED_FUNCTION(RegisterVehicles); CALL_ACCUMULATED_FUNCTION(RegisterMonsters); + CALL_ACCUMULATED_FUNCTION(RegisterItems); CALL_ACCUMULATED_FUNCTION(RegisterGametypes); CALL_ACCUMULATED_FUNCTION(RegisterNotifications); CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes); @@ -559,7 +582,7 @@ void WeaponStats_Init(); void WeaponStats_Shutdown(); void spawnfunc_worldspawn (void) { - float fd, l, i, j, n; + float fd, l, j, n; string s; cvar = cvar_normal; @@ -568,12 +591,10 @@ void spawnfunc_worldspawn (void) if(world_already_spawned) error("world already spawned - you may have EXACTLY ONE worldspawn!"); - world_already_spawned = TRUE; + world_already_spawned = true; remove = remove_safely; // during spawning, watch what you remove! - check_unacceptable_compiler_bugs(); - cvar_changes_init(); // do this very early now so it REALLY matches the server config compressShortVector_init(); @@ -587,11 +608,13 @@ void spawnfunc_worldspawn (void) head = nextent(head); } - server_is_dedicated = (stof(cvar_defstring("is_dedicated")) ? TRUE : FALSE); + 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(RegisterVehicles); CALL_ACCUMULATED_FUNCTION(RegisterMonsters); + CALL_ACCUMULATED_FUNCTION(RegisterItems); CALL_ACCUMULATED_FUNCTION(RegisterGametypes); CALL_ACCUMULATED_FUNCTION(RegisterNotifications); CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes); @@ -647,7 +670,7 @@ void spawnfunc_worldspawn (void) Map_MarkAsRecent(mapname); - PlayerStats_Init(); // we need this to be initiated before InitGameplayMode + PlayerStats_GameReport_Init(); // we need this to be initiated before InitGameplayMode precache_model ("null"); // we need this one before InitGameplayMode InitGameplayMode(); @@ -671,7 +694,7 @@ void spawnfunc_worldspawn (void) // character set: ASCII 33-126 without the following characters: : ; ' " \ $ if(autocvar_sv_eventlog) { - s = sprintf("%d.%s.%06d", ftos(autocvar_sv_eventlog_files_counter), strftime(FALSE, "%s"), floor(random() * 1000000)); + s = sprintf("%d.%s.%06d", itos(autocvar_sv_eventlog_files_counter), strftime(false, "%s"), floor(random() * 1000000)); matchid = strzone(s); GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", s)); @@ -722,8 +745,6 @@ void spawnfunc_worldspawn (void) if(autocvar_g_campaign) CampaignPostInit(); - fteqcc_testbugs(); - Ban_LoadBans(); MapInfo_Enumerate(); @@ -785,6 +806,7 @@ void spawnfunc_worldspawn (void) addstat(STAT_WEAPON_CLIPLOAD, AS_INT, clip_load); addstat(STAT_WEAPON_CLIPSIZE, AS_INT, clip_size); addstat(STAT_LAST_PICKUP, AS_FLOAT, last_pickup); + addstat(STAT_HIT_TIME, AS_FLOAT, hit_time); addstat(STAT_DAMAGE_DEALT_TOTAL, AS_INT, damage_dealt_total); addstat(STAT_TYPEHIT_TIME, AS_FLOAT, typehit_time); addstat(STAT_LAYED_MINES, AS_INT, minelayer_mines); @@ -793,7 +815,7 @@ void spawnfunc_worldspawn (void) addstat(STAT_VORTEX_CHARGEPOOL, AS_FLOAT, vortex_chargepool_ammo); addstat(STAT_HAGAR_LOAD, AS_INT, hagar_load); - + addstat(STAT_ARC_HEAT, AS_FLOAT, arc_heat_percent); // freeze attacks @@ -806,6 +828,27 @@ void spawnfunc_worldspawn (void) addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw); addstat(STAT_MOVEVARS_AIRSTRAFEACCEL_QW, AS_FLOAT, stat_sv_airstrafeaccel_qw); + // new properties + addstat(STAT_MOVEVARS_JUMPVELOCITY, AS_FLOAT, stat_sv_jumpvelocity); + addstat(STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, AS_FLOAT, stat_sv_airaccel_qw_stretchfactor); + addstat(STAT_MOVEVARS_MAXAIRSTRAFESPEED, AS_FLOAT, stat_sv_maxairstrafespeed); + addstat(STAT_MOVEVARS_MAXAIRSPEED, AS_FLOAT, stat_sv_maxairspeed); + addstat(STAT_MOVEVARS_AIRSTRAFEACCELERATE, AS_FLOAT, stat_sv_airstrafeaccelerate); + addstat(STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL, AS_FLOAT, stat_sv_warsowbunny_turnaccel); + addstat(STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, AS_FLOAT, stat_sv_airaccel_sideways_friction); + addstat(STAT_MOVEVARS_AIRCONTROL, AS_FLOAT, stat_sv_aircontrol); + addstat(STAT_MOVEVARS_AIRCONTROL_POWER, AS_FLOAT, stat_sv_aircontrol_power); + addstat(STAT_MOVEVARS_AIRCONTROL_PENALTY, AS_FLOAT, stat_sv_aircontrol_penalty); + addstat(STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, AS_FLOAT, stat_sv_warsowbunny_airforwardaccel); + addstat(STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED, AS_FLOAT, stat_sv_warsowbunny_topspeed); + addstat(STAT_MOVEVARS_WARSOWBUNNY_ACCEL, AS_FLOAT, stat_sv_warsowbunny_accel); + addstat(STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, AS_FLOAT, stat_sv_warsowbunny_backtosideratio); + addstat(STAT_MOVEVARS_FRICTION, AS_FLOAT, stat_sv_friction); + addstat(STAT_MOVEVARS_ACCELERATE, AS_FLOAT, stat_sv_accelerate); + addstat(STAT_MOVEVARS_STOPSPEED, AS_FLOAT, stat_sv_stopspeed); + addstat(STAT_MOVEVARS_AIRACCELERATE, AS_FLOAT, stat_sv_airaccelerate); + addstat(STAT_MOVEVARS_AIRSTOPACCELERATE, AS_FLOAT, stat_sv_airstopaccelerate); + // secrets addstat(STAT_SECRETS_TOTAL, AS_FLOAT, stat_secrets_total); addstat(STAT_SECRETS_FOUND, AS_FLOAT, stat_secrets_found); @@ -825,7 +868,7 @@ void spawnfunc_worldspawn (void) maplist_reply = strzone(getmaplist()); lsmaps_reply = strzone(getlsmaps()); monsterlist_reply = strzone(getmonsterlist()); - for(i = 0; i < 10; ++i) + for(int i = 0; i < 10; ++i) { s = getrecords(i); if (s) @@ -848,23 +891,23 @@ void spawnfunc_worldspawn (void) { s = ""; n = tokenize_console(cvar_string("sv_curl_serverpackages")); - for(i = 0; i < n; ++i) + for(int i = 0; i < n; ++i) if(substring(argv(i), -18, -1) != "-serverpackage.txt") if(substring(argv(i), -14, -1) != ".serverpackage") // OLD legacy s = strcat(s, " ", argv(i)); - fd = search_begin("*-serverpackage.txt", TRUE, FALSE); + fd = search_begin("*-serverpackage.txt", true, false); if(fd >= 0) { j = search_getsize(fd); - for(i = 0; i < j; ++i) + for(int i = 0; i < j; ++i) s = strcat(s, " ", search_getfilename(fd, i)); search_end(fd); } - fd = search_begin("*.serverpackage", TRUE, FALSE); + fd = search_begin("*.serverpackage", true, false); if(fd >= 0) { j = search_getsize(fd); - for(i = 0; i < j; ++i) + for(int i = 0; i < j; ++i) s = strcat(s, " ", search_getfilename(fd, i)); search_end(fd); } @@ -942,7 +985,7 @@ float MapHasRightSize(string map) if(!fexists(strcat("maps/", map, ".waypoints"))) { dprint(": no waypoints\n"); - return FALSE; + return false; } dprint(": has waypoints\n"); } @@ -960,18 +1003,18 @@ float MapHasRightSize(string map) if(player_count < mapmin) { dprint("not enough\n"); - return FALSE; + return false; } if(player_count > mapmax) { dprint("too many\n"); - return FALSE; + return false; } dprint("right size\n"); - return TRUE; + return true; } dprint(": not found\n"); - return TRUE; + return true; } string Map_Filename(float position) @@ -1065,7 +1108,7 @@ float() MaplistMethod_Iterate = // usual method for(i = 1; i < Map_Count; ++i) { float mapindex; - mapindex = mod(i + Map_Current, Map_Count); + mapindex = (i + Map_Current) % Map_Count; if(Map_Check(mapindex, pass)) return mapindex; } @@ -1093,7 +1136,7 @@ float() MaplistMethod_Random = // random map selection for(i = 0; i <= imax; ++i) { float mapindex; - mapindex = mod(Map_Current + floor(random() * (Map_Count - 1) + 1), Map_Count); // any OTHER map + mapindex = (Map_Current + floor(random() * (Map_Count - 1) + 1)) % Map_Count; // any OTHER map if(Map_Check(mapindex, 1)) return mapindex; } @@ -1201,60 +1244,60 @@ float DoNextMapOverride(float reinit) if(autocvar_g_campaign) { CampaignPostIntermission(); - alreadychangedlevel = TRUE; - return TRUE; + alreadychangedlevel = true; + return true; } if(autocvar_quit_when_empty) { if(player_count <= currentbots) { localcmd("quit\n"); - alreadychangedlevel = TRUE; - return TRUE; + alreadychangedlevel = true; + return true; } } if(autocvar_quit_and_redirect != "") { redirection_target = strzone(autocvar_quit_and_redirect); - alreadychangedlevel = TRUE; - return TRUE; + alreadychangedlevel = true; + return true; } if (!reinit && autocvar_samelevel) // if samelevel is set, stay on same level { localcmd("restart\n"); - alreadychangedlevel = TRUE; - return TRUE; + alreadychangedlevel = true; + return true; } if(autocvar_nextmap != "") { string m; m = GameTypeVote_MapInfo_FixName(autocvar_nextmap); cvar_set("nextmap",m); - + if(!m || gametypevote) - return FALSE; + return false; if(autocvar_sv_vote_gametype) { Map_Goto_SetStr(m); - return FALSE; + return false; } - + if(MapInfo_CheckMap(m)) { Map_Goto_SetStr(m); Map_Goto(reinit); - alreadychangedlevel = TRUE; - return TRUE; + alreadychangedlevel = true; + return true; } } if(!reinit && autocvar_lastlevel) { cvar_settemp_restore(); localcmd("set lastlevel 0\ntogglemenu 1\n"); - alreadychangedlevel = TRUE; - return TRUE; + alreadychangedlevel = true; + return true; } - return FALSE; + return false; } void GotoNextMap(float reinit) @@ -1264,7 +1307,7 @@ void GotoNextMap(float reinit) //string s; if (alreadychangedlevel) return; - alreadychangedlevel = TRUE; + alreadychangedlevel = true; string nextMap; @@ -1294,7 +1337,7 @@ void IntermissionThink() && ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) ) { self.autoscreenshot = -1; - if(IS_REAL_CLIENT(self)) { 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"))); } + if(IS_REAL_CLIENT(self)) { 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; } @@ -1379,13 +1422,13 @@ void DumpStats(float final) if(!final) { - to_console = TRUE; // always print printstats replies - to_eventlog = FALSE; // but never print them to the event log + to_console = true; // always print printstats replies + to_eventlog = false; // but never print them to the event log } if(to_eventlog) if(autocvar_sv_eventlog_console) - to_console = FALSE; // otherwise we get the output twice + to_console = false; // otherwise we get the output twice if(final) s = ":scores:"; @@ -1403,7 +1446,7 @@ void DumpStats(float final) { file = fopen(autocvar_sv_logscores_filename, FILE_APPEND); if(file == -1) - to_file = FALSE; + to_file = false; else fputs(file, strcat(s, "\n")); } @@ -1505,7 +1548,7 @@ only called if a time or frag limit has expired */ void NextLevel() { - gameover = TRUE; + gameover = true; intermission_running = 1; @@ -1526,14 +1569,10 @@ void NextLevel() VoteReset(); - DumpStats(TRUE); + DumpStats(true); // send statistics - entity e; - PlayerStats_EndMatch(1); - FOR_EACH_CLIENT(e) - PlayerStats_AddGlobalInfo(e); - PlayerStats_Shutdown(); + PlayerStats_GameReport(true); WeaponStats_Shutdown(); Kill_Notification(NOTIF_ALL, world, MSG_CENTER, 0); // kill all centerprints now @@ -1576,15 +1615,6 @@ void CheckRules_Player() // (div0: and that in CheckRules_World please) } -float checkrules_equality; -float checkrules_suddendeathwarning; -float checkrules_suddendeathend; -float checkrules_overtimesadded; //how many overtimes have been already added - -const float WINNING_NO = 0; // no winner, but time limits may terminate the game -const float WINNING_YES = 1; // winner found -const float WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached -const float WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW float InitiateSuddenDeath() { @@ -1649,7 +1679,7 @@ void SetWinners(.float field, float value) { entity head; FOR_EACH_PLAYER(head) - head.winning = (head.field == value); + head.winning = (head.(field) == value); } // set the .winning flag for those players with a given field value @@ -1657,7 +1687,7 @@ void AddWinners(.float field, float value) { entity head; FOR_EACH_PLAYER(head) - if(head.field == value) + if (head.(field) == value) head.winning = 1; } @@ -1770,16 +1800,16 @@ float WinningCondition_LMS() float have_players; float l; - have_player = FALSE; - have_players = FALSE; + have_player = false; + have_players = false; l = LMS_NewPlayerLives(); head = find(world, classname, "player"); if(head) - have_player = TRUE; + have_player = true; head2 = find(head, classname, "player"); if(head2) - have_players = TRUE; + have_players = true; if(have_player) { @@ -1831,7 +1861,7 @@ float WinningCondition_LMS() ClearWinners(); if(WinningConditionHelper_winner) - WinningConditionHelper_winner.winning = TRUE; + WinningConditionHelper_winner.winning = true; if(WinningConditionHelper_topscore == WinningConditionHelper_secondscore) return WINNING_NEVER; @@ -1893,10 +1923,10 @@ float WinningCondition_Scores(float limit, float leadlimit) } } - limitreached = FALSE; + limitreached = false; if(limit) if(WinningConditionHelper_topscore >= limit) - limitreached = TRUE; + limitreached = true; if(leadlimit) { float leadlimitreached; @@ -1963,7 +1993,7 @@ float WinningCondition_RanOutOfSpawns() if(have_team_spawns <= 0) return WINNING_NO; - if(autocvar_g_spawn_useallspawns <= 0) + if(!autocvar_g_spawn_useallspawns) return WINNING_NO; if(!some_spawn_has_been_used) @@ -1998,7 +2028,7 @@ float WinningCondition_RanOutOfSpawns() ClearWinners(); if(team1_score + team2_score + team3_score + team4_score == 0) { - checkrules_equality = TRUE; + checkrules_equality = true; return WINNING_YES; } else if(team1_score + team2_score + team3_score + team4_score == 1) @@ -2035,7 +2065,6 @@ CheckRules_World Exit deathmatch games upon conditions ============ */ -void ReadyRestart(); void CheckRules_World() { float timelimit; @@ -2095,7 +2124,7 @@ void CheckRules_World() { if(!checkrules_suddendeathwarning) { - checkrules_suddendeathwarning = TRUE; + checkrules_suddendeathwarning = true; if(g_race && !g_race_qualifying) Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_RACE_FINISHLAP); else @@ -2237,21 +2266,13 @@ void EndFrame() float altime; FOR_EACH_REALCLIENT(self) { - self.damage_dealt_total = 0; - - if(IS_SPEC(self)) + entity e = IS_SPEC(self) ? self.enemy : self; + if(e.typehitsound) + self.typehit_time = time; + else if(e.damage_dealt) { - if(self.enemy.typehitsound) - self.typehit_time = time; - else if(self.enemy.damage_dealt) - self.damage_dealt_total = ceil(self.enemy.damage_dealt); - } - else - { - if(self.typehitsound) - self.typehit_time = time; - else if(self.damage_dealt) - self.damage_dealt_total = ceil(self.damage_dealt); + self.hit_time = time; + self.damage_dealt_total += ceil(e.damage_dealt); } } altime = time + frametime * (1 + autocvar_g_antilag_nudge); @@ -2262,7 +2283,7 @@ void EndFrame() // needed! FOR_EACH_CLIENT(self) { - self.typehitsound = FALSE; + self.typehitsound = false; self.damage_dealt = 0; antilag_record(self, altime); } @@ -2273,7 +2294,7 @@ void EndFrame() /* * RedirectionThink: - * returns TRUE if redirecting + * returns true if redirecting */ float redirection_timeout; float redirection_nextthink; @@ -2282,7 +2303,7 @@ float RedirectionThink() float clients_found; if(redirection_target == "") - return FALSE; + return false; if(!redirection_timeout) { @@ -2295,7 +2316,7 @@ float RedirectionThink() } if(time < redirection_nextthink) - return TRUE; + return true; redirection_nextthink = time + 1; @@ -2316,7 +2337,7 @@ float RedirectionThink() if(time > redirection_timeout || clients_found == 0) localcmd("\nwait; wait; wait; quit\n"); - return TRUE; + return true; } void TargetMusic_RestoreGame(); @@ -2339,8 +2360,6 @@ void RestoreGame() void Shutdown() { - entity e; - gameover = 2; if(world_initialized > 0) @@ -2349,10 +2368,8 @@ void Shutdown() print("Saving persistent data...\n"); Ban_SaveBans(); - PlayerStats_EndMatch(0); - FOR_EACH_CLIENT(e) - PlayerStats_AddGlobalInfo(e); - PlayerStats_Shutdown(); + // playerstats with unfinished match + PlayerStats_GameReport(false); if(!cheatcount_total) {