#include "player_skeleton.qh"
#include "weapons/projectile.qh"
#include <common/animdecide.qh>
+#include <common/ent_cs.qh>
#include <common/physics/movetypes/movetypes.qh>
#include <common/viewloc.qh>
#include <lib/csqcmodel/cl_model.qh>
bool isfriend;
int cm;
cm = this.forceplayermodels_savecolormap;
- cm = (cm >= 1024) ? cm : (stof(getplayerkeyvalue(cm - 1, "colors")) + 1024);
+ cm = (cm >= 1024) ? cm : (entcs_GetClientColors(cm - 1) + 1024);
if(teamplay)
isfriend = (cm == 1024 + 17 * myteam);
// GLOWMOD AND DEATH FADING
if(this.colormap > 0)
- this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : stof(getplayerkeyvalue(this.colormap - 1, "colors"))) & 0x0F, true) * 2;
+ this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : entcs_GetClientColors(this.colormap - 1)) & 0x0F, true) * 2;
else
this.glowmod = '1 1 1';
{
string hud_dock_color = autocvar_hud_dock_color;
if(hud_dock_color == "shirt") {
- f = stof(getplayerkeyvalue(current_player, "colors"));
+ f = entcs_GetClientColors(current_player);
color = colormapPaletteColor(floor(f / 16), 0);
}
else if(hud_dock_color == "pants") {
- f = stof(getplayerkeyvalue(current_player, "colors"));
+ f = entcs_GetClientColors(current_player);
color = colormapPaletteColor(f % 16, 1);
}
else
panel_bg_color = autocvar_hud_panel_bg_color; \
} else { \
if (panel_bg_color_str == "shirt") { \
- panel_bg_color = colormapPaletteColor(floor(stof(getplayerkeyvalue(current_player, "colors")) / 16), 0); \
+ panel_bg_color = colormapPaletteColor(floor(entcs_GetClientColors(current_player) / 16), 0); \
} else if (panel_bg_color_str == "pants") { \
- panel_bg_color = colormapPaletteColor(stof(getplayerkeyvalue(current_player, "colors")) % 16, 1); \
+ panel_bg_color = colormapPaletteColor(entcs_GetClientColors(current_player) % 16, 1); \
} else { \
panel_bg_color = stov(panel_bg_color_str); \
} \
}
else if(!teamplay)
{
- f = stof(getplayerkeyvalue(pl.sv_entnum, "colors"));
+ f = entcs_GetClientColors(pl.sv_entnum);
{
sbt_field_icon0 = "gfx/scoreboard/playercolor_base";
sbt_field_icon1 = "gfx/scoreboard/playercolor_shirt";
else if (wasinvehicle) a = 1;
wasinvehicle = invehicle;
Weapon wep = activeweapon;
- int c = stof(getplayerkeyvalue(current_player, "colors"));
+ int c = entcs_GetClientColors(current_player);
vector g = weaponentity_glowmod(wep, c);
entity me = CSQCModel_server2csqc(player_localentnum - 1);
int fx = ((me.csqcmodel_effects & EFMASK_CHEAP)
PROP(true, skin, \
{ WriteByte(chan, this.skin); }, \
{ this.skin = ReadByte(); }) \
+ \
+ PROP(true, clientcolors, \
+ { WriteByte(chan, this.clientcolors); }, \
+ { this.colormap = ReadByte(); }) \
\
/**/
return unconnected || stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR;
}
+ /**
+ * @param i zero indexed player
+ */
+ int entcs_GetClientColors(int i)
+ {
+ entity e = entcs_receiver(i);
+ return e ? e.colormap : stof(getplayerkeyvalue(i, "colors"));
+ }
+
/**
* @param i zero indexed player
* @returns 0 if not teamplay
*/
int entcs_GetTeamColor(int i)
{
- return (!teamplay) ? 0 : stof(getplayerkeyvalue(i, "colors")) & 15;
+ return (!teamplay) ? 0 : entcs_GetClientColors(i) & 15;
}
/**
*/
string entcs_GetName(int i)
{
- return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
+ entity e = entcs_receiver(i);
+ return e ? ColorTranslateRGB(e.netname) : ColorTranslateRGB(getplayerkeyvalue(i, "name"));
}
/**
? '1 1 1'
: colormapPaletteColor(((e.colormap >= 1024)
? e.colormap
- : stof(getplayerkeyvalue(e.colormap - 1, "colors"))) & 15, true)
+ : entcs_GetClientColors(e.colormap - 1)) & 15, true)
;
}
{
this.beam_type = ReadByte();
- vector beamcolor = ((autocvar_cl_arcbeam_teamcolor) ? colormapPaletteColor(stof(getplayerkeyvalue(this.sv_entnum - 1, "colors")) & 0x0F, true) : '1 1 1');
+ vector beamcolor = ((autocvar_cl_arcbeam_teamcolor) ? colormapPaletteColor(entcs_GetClientColors(this.sv_entnum - 1) & 0x0F, true) : '1 1 1');
switch(this.beam_type)
{
case ARC_BT_MISS:
//entity e = CSQCModel_server2csqc(this.sv_entnum - 1);
//if (e == NULL)
//{
- rgb = colormapPaletteColor(stof(getplayerkeyvalue(this.sv_entnum - 1, "colors")) & 0x0F, true);
+ rgb = colormapPaletteColor(entcs_GetClientColors(this.sv_entnum - 1) & 0x0F, true);
//rgb = '1 1 1';
//}
//else
this.bot_config_loaded = true;
// this is really only a default, JoinBestTeam is called later
- setcolor(this, stof(bot_shirt) * 16 + stof(bot_pants));
+ set_color(this, stof(bot_shirt) * 16 + stof(bot_pants));
this.bot_preferredcolors = this.clientcolors;
// pick the name
e = bot_list;
while (e)
{
- setcolor(e, e.bot_preferredcolors);
+ set_color(e, e.bot_preferredcolors);
e = e.nextbot;
}
// if dynamic waypoints are ever implemented, save them here
if(!teamplay)
if(strlen(autocvar_sv_defaultplayercolors))
if(player.clientcolors != stof(autocvar_sv_defaultplayercolors))
- setcolor(player, stof(autocvar_sv_defaultplayercolors));
+ set_color(player, stof(autocvar_sv_defaultplayercolors));
}
return s;
}
+void set_color(entity this, int clr)
+{
+#if 0
+ this.clientcolors = clr;
+ this.team = (clr & 15) + 1;
+#else
+ setcolor(this, clr);
+#endif
+}
+
void SetPlayerColors(entity pl, float _color)
{
/*string s;
if(teamplay) {
- setcolor(pl, 16*pants + pants);
+ set_color(pl, 16*pants + pants);
} else {
- setcolor(pl, shirt + pants);
+ set_color(pl, shirt + pants);
}
}