]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix spawnpoints showing up white in teamplay gamemodes (networking causes teamplay...
authorMario <mario.mario@y7mail.com>
Fri, 29 May 2020 13:14:48 +0000 (23:14 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 29 May 2020 13:14:48 +0000 (23:14 +1000)
qcsrc/client/main.qc
qcsrc/common/effects/all.inc
qcsrc/server/spawnpoints.qc

index 909d1a2bcaa66fcc7c970c8e6e8b90e962732e5a..e4661468d8a8c050f44d19aea9973131b0023f6b 100644 (file)
@@ -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);
index 882e715cde3bf3673045499e643547a01a2d44bf..c25805c0b7ad4561a988b9d9a0a87643cad253d3 100644 (file)
@@ -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")
index 616824bbcbb78b4c0ebe2f2a67cd1ca65d54fc90..3b321e8210af698ea156174715f3bf7b485375c9 100644 (file)
@@ -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)