if(teamplay)
isfriend = (cm == 1024 + 17 * myteam);
+ else if(ISGAMETYPE(BR))
+ isfriend = br_isSameSquad(this);
else
isfriend = islocalplayer;
if ((team_count == 2) && (myteam != NUM_SPECTATOR) && (fpc == 2 || fpc == 4 || fpc == 5))
forceplayercolors_enabled = true;
}
+ else if (ISGAMETYPE(BR))
+ {
+ if (br_inSquad() && (fpc == 2 || fpc == 5))
+ forceplayercolors_enabled = true;
+ }
else
{
- if ((!(ISGAMETYPE(BR) && STAT(SQUADCOLORS)) && fpc == 1) || fpc == 2)
+ if (fpc == 1 || fpc == 2)
forceplayercolors_enabled = true;
}
// forceplayercolors too
- if(teamplay)
+ if(teamplay || ISGAMETYPE(BR))
{
// own team's color is never forced
int forcecolor_friend = 0, forcecolor_enemy = 0;
if(forceplayercolors_enabled)
forcecolor_enemy = 1024 + autocvar__cl_color;
- if(forcecolor_enemy && !forcecolor_friend)
+ if(!ISGAMETYPE(BR) && forcecolor_enemy && !forcecolor_friend)
{
// only enemy color is forced?
// verify it is not equal to the friend color
forcecolor_enemy = 0;
}
- if(forcecolor_friend && !forcecolor_enemy)
+ if(!ISGAMETYPE(BR) && forcecolor_friend && !forcecolor_enemy)
{
// only friend color is forced?
// verify it is not equal to the enemy color
forcecolor_friend = 0;
}
- if(cm == 1024 + 17 * myteam)
+ if((!ISGAMETYPE(BR) && (cm == 1024 + 17 * myteam)) || (ISGAMETYPE(BR) && br_isSameSquad(this)))
{
if(forcecolor_friend)
this.colormap = forcecolor_friend;
case SP_DMG: case SP_DMGTAKEN:
return sprintf("%.1f k", pl.(scores(field)) / 1000);
+ case SP_BR_SQUAD:
+ tmp = pl.(scores(field));
+ if(tmp == 0)
+ return string_null;
+
+ if(STAT(SQUADCOLORS))
+ {
+ int f = entcs_GetClientColors(pl.sv_entnum);
+ sbt_field_icon0 = "gfx/scoreboard/playercolor_base";
+ sbt_field_icon1 = "gfx/scoreboard/playercolor_shirt";
+ sbt_field_icon1_rgb = colormapPaletteColor(floor(f / 16), 0);
+ sbt_field_icon2 = "gfx/scoreboard/playercolor_pants";
+ sbt_field_icon2_rgb = colormapPaletteColor(f % 16, 1);
+ }
+ return ftos(tmp);
+
default: case SP_SCORE:
tmp = pl.(scores(field));
f = scores_flags(field);
#ifdef SVQC
#include <common/gamemodes/gamemode/br/sv_dropship.qc>
#endif
+#ifdef CSQC
+ #include <common/gamemodes/gamemode/br/cl_squad.qc>
+#endif
#ifdef SVQC
#include <common/gamemodes/gamemode/br/sv_squad.qc>
#endif
#ifdef SVQC
#include <common/gamemodes/gamemode/br/sv_dropship.qh>
#endif
+#ifdef CSQC
+ #include <common/gamemodes/gamemode/br/cl_squad.qh>
+#endif
#ifdef SVQC
#include <common/gamemodes/gamemode/br/sv_squad.qh>
#endif
#ifdef GAMEQC
REGISTER_NET_LINKED(ENT_CLIENT_RING)
+REGISTER_NET_TEMP(TE_CSQC_BR_SQUAD)
#endif
--- /dev/null
+#include "cl_squad.qh"
+
+int csqcsquad_cnt = 0;
+int csqcsquad[255]; // 255 is the engine limit on maxclients
+
+NET_HANDLE(TE_CSQC_BR_SQUAD, bool isNew)
+{
+ csqcsquad_cnt = ReadByte();
+
+ if(csqcsquad_cnt == 0)
+ {
+ LOG_SEVERE("server sent empty squad data");
+ return true;
+ }
+
+ for(int i = 0; i < csqcsquad_cnt; ++i)
+ {
+ int entnum = ReadByte();
+ csqcsquad[i] = entnum;
+ }
+
+ return true;
+}
+
+bool br_isSameSquad(entity this)
+{
+ for(int i = 0; i < csqcsquad_cnt; ++i)
+ {
+ int member = csqcsquad[i];
+
+ if(this.entnum == member)
+ return true;
+ }
+
+ return false;
+}
+
+bool br_inSquad()
+{
+ return (csqcsquad_cnt > 0);
+}
--- /dev/null
+#pragma once
+
+bool br_isSameSquad(entity this);
+bool br_inSquad();
FOREACH_CLIENT(IS_REAL_CLIENT(it),
{
+ br_SendSquad(it);
STAT(SQUADCOLORS, it) = squads_colored;
});
for(entity member = it.br_squad_first; member; member = member.br_squad_next)
{
- member.colormap = 1024 + squad_color;
+ member.clientcolors = 1024 + squad_color;
}
}
FOREACH_CLIENT(IS_REAL_CLIENT(it),
{
+ if(IN_SQUAD(it))
+ br_SendSquad(it);
+
STAT(SQUADSALIVE, it) = alive_squads;
STAT(PLAYERSALIVE, it) = alive_players;
});
return last_alive;
}
+
+void br_SendSquad(entity to)
+{
+ msg_entity = to;
+ entity squad = to.br_squad;
+
+ if(!squad)
+ return;
+
+ WriteHeader(MSG_ONE, TE_CSQC_BR_SQUAD);
+ WriteByte(MSG_ONE, squad.br_squad_members);
+
+ for(entity member = squad.br_squad_first; member; member = member.br_squad_next)
+ {
+ WriteByte(MSG_ONE, etof(member));
+ }
+}
bool br_SquadIsBotsOnly(entity squad);
entity br_SquadGetRandomAvail();
entity br_SquadFindLastAlive(entity squad, bool healthy_only);
+void br_SendSquad(entity to);