drawfill(pos, eX * mySize.x + eY * fontsize.y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
- s = strcat(Team_ColorCode(tm.team), strtoupper(Team_ColorName(tm.team)), "^7 team");
+ s = Team_CustomName(tm.team);
//s = textShortenToWidth(Team_ColorName(tm.team), name_size, fontsize, stringwidth_colors);
score_color = Team_ColorRGB(tm.team) * 0.8;
vector duel_score_fontsize;
vector duel_name_fontsize;
vector duel_score_size;
+vector team_score_fontsize;
+vector team_name_fontsize;
+vector team_score_size;
int total_medals;
float sbt_bg_alpha;
duel_score_fontsize = hud_fontsize * 3;
duel_name_fontsize = hud_fontsize * 1.5;
duel_score_size = vec2(duel_score_fontsize.x * 1.5, duel_score_fontsize.y * 1.25);
+
+ team_score_fontsize = hud_fontsize * 2;
+ team_name_fontsize = hud_fontsize * 1.5;
+ team_score_size = vec2(team_score_fontsize.x * 1.5, team_score_fontsize.y * 1.25);
for(i = 1; i < argc - 1; ++i)
{
if(!tm.team)
continue;
- draw_beginBoldFont();
vector rgb = Team_ColorRGB(tm.team);
+ /*draw_beginBoldFont();
str = ftos(tm.(teamscores(ts_primary)));
if (autocvar_hud_panel_scoreboard_team_size_position != 1) // team size not on left
{
drawstring(str_pos, str, hud_fontsize, rgb, panel_fg_alpha, DRAWFLAG_NORMAL);
}
draw_endBoldFont();
+ */
+
+ // z411 My team header
+ // Score: highlight
+ drawfill(pos, team_score_size, rgb * 0.5, sbt_highlight_alpha, DRAWFLAG_NORMAL);
+
+ // Score: text
+ str = ftos(tm.(teamscores(ts_primary)));
+ str_pos = pos;
+ str_pos.x += (team_score_size.x / 2) - (stringwidth(str, true, team_score_fontsize) / 2);
+ str_pos.y += (team_score_size.y / 2) - (team_score_fontsize.y / 2);
+
+ draw_beginBoldFont();
+ drawstring(str_pos, str, team_score_fontsize, rgb, panel_fg_alpha, DRAWFLAG_NORMAL);
+ draw_endBoldFont();
+
+ // Team name
+ str = Team_CustomName(tm.team);
+ str_pos = pos;
+ str_pos.x += team_score_size.x + team_name_fontsize.x * 0.5;
+ str_pos.y += (team_score_size.y / 2) - (team_name_fontsize.y / 2);
+ drawcolorcodedstring(str_pos, str, team_name_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+
+ pos.y += team_score_size.y + (hud_fontsize.y * 0.5);
+
if(autocvar_hud_panel_scoreboard_bg_teams_color_team > 0)
panel_bg_color = rgb * autocvar_hud_panel_scoreboard_bg_teams_color_team;
else if(panel_bg_color_team > 0)
#include <common/net_linked.qh>
#include <common/net_notice.qh>
#include <common/scores.qh>
+#include <common/teams.qh>
#include <common/mapobjects/_mod.qh>
#include <common/vehicles/all.qh>
#include <lib/csqcmodel/cl_model.qh>
if (!postinit) PostInit();
}
+NET_HANDLE(TE_CSQC_TEAMNAMES, bool isNew)
+{
+ teamname_red = strzone(ReadString());
+ teamname_blue = strzone(ReadString());
+ teamname_yellow = strzone(ReadString());
+ teamname_pink = strzone(ReadString());
+
+ return = true;
+}
+
float GetSpeedUnitFactor(int speed_unit)
{
switch(speed_unit)
REGISTER_NET_TEMP(TE_CSQC_WEAPONCOMPLAIN)
REGISTER_NET_TEMP(TE_CSQC_VEHICLESETUP)
+REGISTER_NET_TEMP(TE_CSQC_TEAMNAMES)
+
const int RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
const int RACE_NET_CHECKPOINT_CLEAR = 1;
const int RACE_NET_CHECKPOINT_NEXT_QUALIFYING = 2; // byte nextcheckpoint, short recordtime, string recordholder
#ifdef CSQC
bool teamplay;
int myteam;
+
+// z411 used for custom names
+string teamname_red;
+string teamname_blue;
+string teamname_yellow;
+string teamname_pink;
#endif
string Team_ColorCode(int teamid)
return '0 0 0';
}
+#ifdef CSQC
+string Team_CustomName(int teamid)
+{
+ switch(teamid)
+ {
+ case NUM_TEAM_1: return ((teamname_red != "") ? teamname_red : "^1RED^7 team");
+ case NUM_TEAM_2: return ((teamname_blue != "")? teamname_blue : "^4BLUE^7 team");
+ case NUM_TEAM_3: return ((teamname_yellow != "") ? teamname_yellow : "^3YELLOW^7 team");
+ case NUM_TEAM_4: return ((teamname_pink != "") ? teamname_pink : "^6PINK^7 team");
+ }
+
+ return NAME_NEUTRAL;
+}
+#endif
+
string Team_ColorName(int teamid)
{
switch(teamid)
bool autocvar_sv_jingle_end; // z411
string autocvar_sv_jingle_end_list; // z411
float autocvar_sv_jingle_end_volume; // z411
+string autocvar_g_teamnames_red;
+string autocvar_g_teamnames_blue;
+string autocvar_g_teamnames_yellow;
+string autocvar_g_teamnames_pink;
#define autocvar_g_friendlyfire cvar("g_friendlyfire")
#define autocvar_g_friendlyfire_virtual cvar("g_friendlyfire_virtual")
WriteHeader(MSG_BROADCAST, TE_CSQC_TEAMNAGGER);
}
+void send_TeamNames(int channel, entity to) {
+ msg_entity = to;
+
+ LOG_INFOF("Sending team names");
+ WriteHeader(channel, TE_CSQC_TEAMNAMES);
+ WriteString(channel, autocvar_g_teamnames_red);
+ WriteString(channel, autocvar_g_teamnames_blue);
+ WriteString(channel, autocvar_g_teamnames_yellow);
+ WriteString(channel, autocvar_g_teamnames_pink);
+}
+
int CountSpectators(entity player, entity to)
{
if(!player) { return 0; } // not sure how, but best to be safe
} else if (IS_PLAYER(this)) {
PutPlayerInServer(this);
}
+
+ // send team names
+ if(teamplay && IS_REAL_CLIENT(this))
+ send_TeamNames(MSG_ONE, this);
}
// TODO do we need all these fields, or should we stop autodetecting runtime
ClientInit_misc(this);
MUTATOR_CALLHOOK(Ent_Init);
}
+
void ClientInit_misc(entity this)
{
int channel = MSG_ONE;
event_log_msg = sprintf(":chat_spec:%d:%s", source.playerid, strreplace("\n", " ", msgin));
}
else
- {
+ {
if (source) {
sprint(source, sourcemsgstr);
dedicated_print(msgstr); // send to server console too
bool play_chatsound(entity source, string msgin)
{
- if(autocvar_sv_chat_sounds && CS(source).cvar_cl_chat_sounds) {
+ //bprintf("Source (%s) has cl_chat_sounds = %d\n", source.netname, CS(source).cvar_cl_chat_sounds);
+ //if(autocvar_sv_chat_sounds && CS(source).cvar_cl_chat_sounds) {
+ if(autocvar_sv_chat_sounds) {
var .float flood_sound = floodcontrol_chatsound;
if (source.(flood_sound) < time - autocvar_sv_chat_sounds_flood) {
if (findinlist_abbrev(rawmsg, autocvar_sv_chat_sounds_list)) {
string sndname = strcat("sound/chat/", rawmsg, ".ogg");
- FOREACH_CLIENT(IS_REAL_CLIENT(it) && CS(it).cvar_cl_chat_sounds, play2(it, sndname));
- source.(flood_sound) = time;
+ /*FOREACH_CLIENT(true, {
+ if(IS_REAL_CLIENT(it)) {
+ bprintf("Destination (%s) has cl_chat_sounds = %d\n", it.netname, CS(it).cvar_cl_chat_sounds);
+ if(CS(it).cvar_cl_chat_sounds) {
+ precache_sound(sndname);
+ play2(it, sndname);
+ }
+ } else {
+ bprintf("Destination (%s) has cl_chat_sounds = %d but it's not a real client\n", it.netname, CS(it).cvar_cl_chat_sounds);
+ }
+ });*/
+ play2all(sndname);
+ source.(flood_sound) = time;
return true;
}
}
}
}
+void GameCommand_sendteams(int request)
+{
+ switch (request)
+ {
+ case CMD_REQUEST_COMMAND:
+ {
+ send_TeamNames(MSG_BROADCAST, NULL);
+ return;
+ }
+
+ default:
+ case CMD_REQUEST_USAGE:
+ {
+ LOG_HELP("Usage:^3 sv_cmd sendteams");
+ LOG_HELP(" No arguments required.");
+ return;
+ }
+ }
+}
void GameCommand_allready(int request)
{
switch (request)
if (teamplay)
{
lockteams = 1;
- bprint("^1The teams are now locked.\n");
+ bprint("\{1}^1The teams are now locked.\n");
}
else
{
if (teamplay)
{
lockteams = 0;
- bprint("^1The teams are now unlocked.\n");
+ bprint("\{1}^1The teams are now unlocked.\n");
}
else
{
// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
SERVER_COMMAND(adminmsg, "Send an admin message to a client directly") { GameCommand_adminmsg(request, arguments); }
+SERVER_COMMAND(sendteams, "Send team names") { GameCommand_sendteams(request); }
SERVER_COMMAND(allready, "Restart the server and reset the players") { GameCommand_allready(request); }
SERVER_COMMAND(allspec, "Force all players to spectate") { GameCommand_allspec(request, arguments); }
SERVER_COMMAND(anticheat, "Create an anticheat report for a client") { GameCommand_anticheat(request, arguments); }
.int m_team_balance_state; ///< Holds the state of the team balance entity.
.entity m_team_balance_team[NUM_TEAMS]; ///< ???
+.string m_team_name; // z411 team name
.float m_team_score; ///< The score of the team.
.int m_num_players; ///< Number of players (both humans and bots) in a team.
.int m_num_bots; ///< Number of bots in a team.
return g_team_entities[Team_TeamToIndex(team_num) - 1];
}
+string Team_GetTeamName(entity team_ent)
+{
+ return team_ent.m_team_name;
+}
+
+void Team_SetTeamName(entity team_ent, string name)
+{
+ team_ent.m_team_name = name;
+}
+
float Team_GetTeamScore(entity team_ent)
{
return team_ent.m_team_score;