X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fworld.qc;h=55195217250186bf498db837ac07b236503f3d1b;hp=9d4678ffd4814a04aed3a0185828e36dfbf8026a;hb=561489d21c9053b7103c6604c362aa24ee5c7916;hpb=d2b0f12cb08fe3d1e59d3c9514546c4858cf9012 diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 9d4678ffd4..5519521725 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; @@ -279,7 +277,6 @@ void cvar_changes_init() BADCVAR("g_duel_not_dm_maps"); BADCVAR("g_freezetag"); BADCVAR("g_freezetag_teams"); - BADCVAR("g_invasion_teams"); BADCVAR("g_invasion_type"); BADCVAR("g_jailbreak"); BADCVAR("g_jailbreak_teams"); @@ -495,6 +492,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 +818,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 +841,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", ""); @@ -1032,7 +999,7 @@ spawnfunc(light) delete(this); } -bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance) +bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance, bool frompos) { float m = e.dphitcontentsmask; e.dphitcontentsmask = goodcontents | badcontents; @@ -1089,15 +1056,23 @@ bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax continue; // rule 4: we must "see" some spawnpoint or item - entity sp = NULL; - IL_EACH(g_spawnpoints, checkpvs(mstart, it), - { - if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1) - { - sp = it; - break; - } - }); + entity sp = NULL; + if(frompos) + { + if((traceline(mstart, e.origin, MOVE_NORMAL, e), trace_fraction) >= 1) + sp = e; + } + if(!sp) + { + IL_EACH(g_spawnpoints, checkpvs(mstart, it), + { + if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1) + { + sp = it; + break; + } + }); + } if(!sp) { int items_checked = 0; @@ -1156,7 +1131,7 @@ bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance) { - return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance); + return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance, false); } /* @@ -2145,7 +2120,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); });