From 5efdcfb8dfe4c689b2b5135f8b6e31e56cc0bc47 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 29 May 2020 23:14:48 +1000 Subject: [PATCH] Fix spawnpoints showing up white in teamplay gamemodes (networking causes teamplay to be set after spawnpoints are received), also allow cl_spawn_point_particles to be toggled mid-match --- qcsrc/client/main.qc | 26 +++++--------------------- qcsrc/common/effects/all.inc | 29 +++++++++++++++++++++++++---- qcsrc/server/spawnpoints.qc | 27 ++------------------------- 3 files changed, 32 insertions(+), 50 deletions(-) diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 909d1a2bca..e4661468d8 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -674,15 +674,15 @@ NET_HANDLE(ENT_CLIENT_ACCURACY, bool isnew) void Spawn_Draw(entity this) { - bool dodraw = true; - if(autocvar_cl_spawn_point_dist_max) + bool dodraw = autocvar_cl_spawn_point_particles; + if(dodraw && autocvar_cl_spawn_point_dist_max) { vector org = getpropertyvec(VF_ORIGIN); dodraw = vdist(org - this.origin, <, autocvar_cl_spawn_point_dist_max); } if(dodraw) - __pointparticles(this.cnt, this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1)); + pointparticles(((!teamplay) ? EFFECT_SPAWNPOINT_NEUTRAL : EFFECT_SPAWNPOINT(this.team - 1)), this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1)); } NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new) @@ -709,24 +709,8 @@ NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new) //this.draw = Spawn_Draw; IL_PUSH(g_drawables, this); }*/ - if(autocvar_cl_spawn_point_particles) - { - if(teamplay) - { - switch(teamnum) - { - case NUM_TEAM_1: this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_RED); break; - case NUM_TEAM_2: this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_BLUE); break; - case NUM_TEAM_3: this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_YELLOW); break; - case NUM_TEAM_4: this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_PINK); break; - default: this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_NEUTRAL); break; - } - } - else { this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_NEUTRAL); } - - this.draw = Spawn_Draw; - if (is_new) IL_PUSH(g_drawables, this); - } + this.draw = Spawn_Draw; + if (is_new) IL_PUSH(g_drawables, this); //} //printf("Ent_ReadSpawnPoint(is_new = %d); origin = %s, team = %d, effect = %d\n", is_new, vtos(this.origin), teamnum, this.cnt); diff --git a/qcsrc/common/effects/all.inc b/qcsrc/common/effects/all.inc index 882e715cde..c25805c0b7 100644 --- a/qcsrc/common/effects/all.inc +++ b/qcsrc/common/effects/all.inc @@ -140,15 +140,36 @@ EFFECT(0, BIGPLASMA_MUZZLEFLASH, "bigplasma_muzzleflash") EFFECT(0, TELEPORT, "teleport") EFFECT(0, SPAWNPOINT_RED, "spawn_point_red") -EFFECT(0, SPAWN_RED, "spawn_event_red") EFFECT(0, SPAWNPOINT_BLUE, "spawn_point_blue") -EFFECT(0, SPAWN_BLUE, "spawn_event_blue") EFFECT(0, SPAWNPOINT_YELLOW, "spawn_point_yellow") -EFFECT(0, SPAWN_YELLOW, "spawn_event_yellow") EFFECT(0, SPAWNPOINT_PINK, "spawn_point_pink") -EFFECT(0, SPAWN_PINK, "spawn_event_pink") EFFECT(0, SPAWNPOINT_NEUTRAL, "spawn_point_neutral") +entity EFFECT_SPAWNPOINT(int teamid) +{ + switch (teamid) { + case NUM_TEAM_1: return EFFECT_SPAWNPOINT_RED; + case NUM_TEAM_2: return EFFECT_SPAWNPOINT_BLUE; + case NUM_TEAM_3: return EFFECT_SPAWNPOINT_YELLOW; + case NUM_TEAM_4: return EFFECT_SPAWNPOINT_PINK; + default: return EFFECT_SPAWNPOINT_NEUTRAL; + } +} + +EFFECT(0, SPAWN_RED, "spawn_event_red") +EFFECT(0, SPAWN_BLUE, "spawn_event_blue") +EFFECT(0, SPAWN_YELLOW, "spawn_event_yellow") +EFFECT(0, SPAWN_PINK, "spawn_event_pink") EFFECT(0, SPAWN_NEUTRAL, "spawn_event_neutral") +entity EFFECT_SPAWN(int teamid) +{ + switch (teamid) { + case NUM_TEAM_1: return EFFECT_SPAWN_RED; + case NUM_TEAM_2: return EFFECT_SPAWN_BLUE; + case NUM_TEAM_3: return EFFECT_SPAWN_YELLOW; + case NUM_TEAM_4: return EFFECT_SPAWN_PINK; + default: return EFFECT_SPAWN_NEUTRAL; + } +} EFFECT(0, ICEORGLASS, "iceorglass") EFFECT(0, ICEFIELD, "icefield") diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 616824bbcb..3b321e8210 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -137,31 +137,8 @@ void relocate_spawnpoint(entity this) // Don't show team spawns in non-team matches, // and don't show non-team spawns in team matches. // (Unless useallspawns is activated) - if( - !( - ( // if this passes, there is a DM spawn on a team match - teamplay - && (this.team != NUM_TEAM_1) - && (this.team != NUM_TEAM_2) - && (this.team != NUM_TEAM_3) - && (this.team != NUM_TEAM_4) - ) - || - ( // if this passes, there is a team spawn on a DM match - !teamplay - && - ( - (this.team == NUM_TEAM_1) - || (this.team == NUM_TEAM_2) - || (this.team == NUM_TEAM_3) - || (this.team == NUM_TEAM_4) - ) - ) - ) - || - autocvar_g_spawn_useallspawns - ) - { Net_LinkEntity(this, false, 0, SpawnPoint_Send); } + if(autocvar_g_spawn_useallspawns || !((teamplay && !Team_IsValidTeam(this.team)) || (!teamplay && Team_IsValidTeam(this.team)))) + Net_LinkEntity(this, false, 0, SpawnPoint_Send); } spawnfunc(info_player_survivor) -- 2.39.2