X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fspawnpoints.qc;h=cd393b64196a1cbab9f0128623f3ef8be7adc612;hp=4be19b879d317ac5976bbe87f3c70cd7f1870e93;hb=d865de7a9a17c5a1d9286aec40f68c3530697660;hpb=ee7a78f942624de2ab30112a798e3f663cf9cc2f diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 4be19b879d..cd393b6419 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -1,9 +1,10 @@ #include "spawnpoints.qh" -#include "mutators/all.qh" +#include "mutators/_mod.qh" #include "g_world.qh" #include "race.qh" #include "../common/constants.qh" +#include #include "../common/teams.qh" #include "../common/triggers/subs.qh" #include "../common/util.qh" @@ -63,7 +64,7 @@ void spawnpoint_use(entity this, entity actor, entity trigger) if(have_team_spawns > 0) { this.team = actor.team; - some_spawn_has_been_used = 1; + some_spawn_has_been_used = true; } //LOG_INFO("spawnpoint was used!\n"); } @@ -82,14 +83,15 @@ void relocate_spawnpoint(entity this) this.maxs = PL_MAX_CONST; if (!move_out_of_solid(this)) objerror(this, "could not get out of solid at all!"); - LOG_INFO("^1NOTE: this map needs FIXING. Spawnpoint at ", vtos(o - '0 0 1')); - LOG_INFO(" needs to be moved out of solid, e.g. by '", ftos(this.origin.x - o.x)); - LOG_INFO(" ", ftos(this.origin.y - o.y)); - LOG_INFO(" ", ftos(this.origin.z - o.z), "'\n"); + LOG_INFOF( + "^1NOTE: this map needs FIXING. Spawnpoint at %s needs to be moved out of solid, e.g. by %s", + vtos(o - '0 0 1'), + vtos(this.origin - o) + ); if (autocvar_g_spawnpoints_auto_move_out_of_solid) { if (!spawnpoint_nag) - LOG_INFO("\{1}^1NOTE: this map needs FIXING (it contains spawnpoints in solid, see server log)\n"); + LOG_INFO("\{1}^1NOTE: this map needs FIXING (it contains spawnpoints in solid, see server log)"); spawnpoint_nag = 1; } else @@ -105,13 +107,14 @@ void relocate_spawnpoint(entity this) setthink(this, spawnpoint_think); this.nextthink = time + 0.5 + random() * 2; // shouldn't need it for a little second this.team_saved = this.team; + IL_PUSH(g_saved_team, this); if (!this.cnt) this.cnt = 1; if (have_team_spawns != 0) if (this.team) have_team_spawns = 1; - have_team_spawns_forteam[this.team] = 1; + have_team_spawns_forteams |= BIT(this.team); if (autocvar_r_showbboxes) { @@ -166,6 +169,7 @@ spawnfunc(info_player_start) spawnfunc(info_player_deathmatch) { this.classname = "info_player_deathmatch"; + IL_PUSH(g_spawnpoints, this); relocate_spawnpoint(this); } @@ -238,11 +242,11 @@ vector Spawn_Score(entity this, entity spot, float mindist, float teamcheck) } shortest = vlen(world.maxs - world.mins); - FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != this, { thisdist = vlen(it.origin - spot.origin); if (thisdist < shortest) shortest = thisdist; - )); + }); if(shortest > mindist) prio += SPAWN_PRIO_GOOD_DISTANCE; @@ -265,7 +269,7 @@ vector Spawn_Score(entity this, entity spot, float mindist, float teamcheck) if(!found) { - LOG_TRACE("WARNING: spawnpoint at ", vtos(spot.origin), " could not find its target ", spot.target, "\n"); + LOG_TRACE("WARNING: spawnpoint at ", vtos(spot.origin), " could not find its target ", spot.target); return '-1 0 0'; } } @@ -316,7 +320,7 @@ entity Spawn_WeightedPoint(entity firstspot, float lower, float upper, float exp RandomSelection_Init(); for(spot = firstspot; spot; spot = spot.chain) - RandomSelection_Add(spot, 0, string_null, pow(bound(lower, spot.spawnpoint_score.y, upper), exponent) * spot.cnt, (spot.spawnpoint_score.y >= lower) * 0.5 + spot.spawnpoint_score.x); + RandomSelection_AddEnt(spot, (bound(lower, spot.spawnpoint_score.y, upper) ** exponent) * spot.cnt, (spot.spawnpoint_score.y >= lower) * 0.5 + spot.spawnpoint_score.x); return RandomSelection_chosen_ent; } @@ -333,7 +337,7 @@ entity SelectSpawnPoint(entity this, bool anypoint) float teamcheck; entity spot, firstspot; - spot = find (NULL, classname, "testplayerstart"); + spot = find(NULL, classname, "testplayerstart"); if (spot) return spot; @@ -341,11 +345,11 @@ entity SelectSpawnPoint(entity this, bool anypoint) teamcheck = -1; else if(have_team_spawns > 0) { - if(have_team_spawns_forteam[this.team] == 0) + if(!(have_team_spawns_forteams & BIT(this.team))) { // we request a spawn for a team, and we have team // spawns, but that team has no spawns? - if(have_team_spawns_forteam[0]) + if(have_team_spawns_forteams & BIT(0)) // try noteam spawns teamcheck = 0; else @@ -355,7 +359,7 @@ entity SelectSpawnPoint(entity this, bool anypoint) else teamcheck = this.team; // MUST be team } - else if(have_team_spawns == 0 && have_team_spawns_forteam[0]) + else if(have_team_spawns == 0 && (have_team_spawns_forteams & BIT(0))) teamcheck = 0; // MUST be noteam else teamcheck = -1;