sv_jumpstep 1 // step up stairs while jumping, makes it easier to reach ledges\r
set ekg 0 "Throw huge amounts of gibs"\r
\r
+seta sv_shownames_cull_distance 2500 "distance after which to not send origin/health/armor of another player"\r
+\r
cl_movement 1\r
cl_stairsmoothspeed 200\r
cl_forwardspeed $sv_maxspeed\r
seta hud_contents_stomach_alpha 0.2 "alpha of the stomach color blend when inside it"\r
seta hud_contents_stomach_color "0.3 0.2 0"\r
\r
+seta hud_shownames 1 "draw names and health/armor of nearby players"\r
+seta hud_shownames_enemies 2 "1 = draw names of enemies you point at (TODO), 2 = draw names of all enemies in view"\r
+seta hud_shownames_status 1 "1 = draw health/armor status of teammates"\r
+seta hud_shownames_statusbar_height 4 "height of status bar"\r
+seta hud_shownames_aspect 8 "aspect ratio of total drawing area per name"\r
+seta hud_shownames_fontsize 12 "font size"\r
+seta hud_shownames_decolorize 1 "1 = decolorize name in team games, 2 = decolorize always"\r
+seta hud_shownames_alpha 0.7 "alpha"\r
+seta hud_shownames_resize 1 "enable resizing of the names, then the size cvars will correspond to the maximum size"\r
+seta hud_shownames_mindistance 1000 "start fading alpha/size at this distance"\r
+seta hud_shownames_maxdistance 2500 "alpha/size is 0 at this distance"\r
+seta hud_shownames_antioverlap 1 "if two tags get too close to each other, fade out the one further away from you"\r
+seta hud_shownames_antioverlap_distance 125 "2d distance to other tag after which to fade out"\r
+seta hud_shownames_offset 52 "offset (along z-axis) tag from player origin by this many units"\r
+\r
sbar_info_pos 50\r
seta sbar_alpha_bg 0.8 "alpha value of the HUD background"\r
seta sbar_alpha_fg 1 "alpha value of the HUD foreground items"\r
\r
// --------------------------------------------------------------------------\r
// BEGIN OPTIONAL CSQC FUNCTIONS\r
+void Ent_RemoveEntCS()\r
+{\r
+ entcs_receiver[self.sv_entnum] = world;\r
+}\r
void Ent_ReadEntCS()\r
{\r
+ float sf;\r
InterpolateOrigin_Undo();\r
\r
self.classname = "entcs_receiver";\r
- self.sv_entnum = ReadByte() - 1;\r
- self.origin_x = ReadShort();\r
- self.origin_y = ReadShort();\r
- self.origin_z = ReadShort();\r
- self.angles_y = ReadByte() * 360.0 / 256;\r
- self.origin_z = self.angles_x = self.angles_z = 0;\r
+ sf = ReadByte();\r
+\r
+ if(sf & 1)\r
+ self.sv_entnum = ReadByte();\r
+ if(sf & 2)\r
+ {\r
+ self.origin_x = ReadShort();\r
+ self.origin_y = ReadShort();\r
+ self.origin_z = ReadShort();\r
+ }\r
+ if(sf & 4)\r
+ {\r
+ self.angles_y = ReadByte() * 360.0 / 256;\r
+ self.angles_x = self.angles_z = 0;\r
+ }\r
+ if(sf & 8)\r
+ self.healthvalue = ReadByte() * 10;\r
+ if(sf & 16)\r
+ self.armorvalue = ReadByte() * 10;\r
+\r
+ entcs_receiver[self.sv_entnum] = self;\r
+ self.entremove = Ent_RemoveEntCS;\r
\r
InterpolateOrigin_Note();\r
}\r
if(self.draw2d)\r
self.draw2d();\r
self = e;\r
+ Draw_ShowNames_All();\r
\r
// draw radar\r
if(\r
\r
.float ping, ping_packetloss, ping_movementloss;\r
.float plhealth, plpredator;\r
+\r
+entity entcs_receiver[255]; // 255 is the engine limit on maxclients\r
return s;\r
}\r
\r
+string Team_ColorCode(float teamid)\r
+{\r
+ if (teamid == COLOR_TEAM1)\r
+ return "^1";\r
+ else if (teamid == COLOR_TEAM2)\r
+ return "^4";\r
+ else if (teamid == COLOR_TEAM3)\r
+ return "^3";\r
+ else if (teamid == COLOR_TEAM4)\r
+ return "^6";\r
+ else\r
+ return "^7";\r
+}\r
+\r
+// decolorizes and team colors the player name when needed\r
+string playername(string thename, float teamid)\r
+{\r
+ string t;\r
+ if (teamplay)\r
+ {\r
+ t = Team_ColorCode(teamid);\r
+ return strcat(t, strdecolorize(thename));\r
+ }\r
+ else\r
+ return strdecolorize(thename);\r
+}\r
+\r
float cvar_or(string cv, float v)\r
{\r
string s;\r
R_EndPolygon();\r
}\r
}\r
+\r
+const vector GETPLAYERORIGIN_ERROR = '1123581321 2357111317 3141592653'; // way out of bounds for anything on the map\r
+vector getplayerorigin(float pl)\r
+{\r
+ string s;\r
+ entity e;\r
+\r
+ s = getplayerkey(pl, "TEMPHACK_origin");\r
+ if(s != "")\r
+ return stov(s);\r
+\r
+ e = entcs_receiver[pl];\r
+ if(e)\r
+ return e.origin;\r
+\r
+ return GETPLAYERORIGIN_ERROR;\r
+}\r
prandom.qh\r
bgmscript.qh\r
\r
+teamplay.qh\r
main.qh\r
\r
sortlist.qc\r
modeleffects.qc\r
target_music.qc\r
\r
+shownames.qh\r
+shownames.qc\r
+\r
Main.qc\r
View.qc\r
interpolate.qc\r
if(other == o)\r
return FALSE;\r
if(other.classname == "player")\r
- if(o.team != other.team)\r
+ if(!teamplay || o.team != other.team)\r
if not (radar_showennemies)\r
return FALSE;\r
return TRUE;\r
\r
float entcs_send(entity to, float sf)\r
{\r
- entity o;\r
- o = self.owner;\r
WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS);\r
- WriteByte(MSG_ENTITY, num_for_edict(o));\r
- WriteShort(MSG_ENTITY, o.origin_x);\r
- WriteShort(MSG_ENTITY, o.origin_y);\r
- WriteShort(MSG_ENTITY, o.origin_z);\r
- WriteByte(MSG_ENTITY, o.angles_y * 256.0 / 360);\r
+ WriteByte(MSG_ENTITY, sf);\r
+ if(sf & 1)\r
+ WriteByte(MSG_ENTITY, num_for_edict(self.owner)-1);\r
+ if(sf & 2)\r
+ {\r
+ WriteShort(MSG_ENTITY, self.origin_x);\r
+ WriteShort(MSG_ENTITY, self.origin_y);\r
+ WriteShort(MSG_ENTITY, self.origin_z);\r
+ }\r
+ if(sf & 4)\r
+ WriteByte(MSG_ENTITY, self.angles_y * 256.0 / 360);\r
+ if(sf & 8)\r
+ WriteByte(MSG_ENTITY, self.health / 10); // FIXME use a better scale?\r
+ if(sf & 16)\r
+ WriteByte(MSG_ENTITY, self.armorvalue / 10); // FIXME use a better scale?\r
return TRUE;\r
};\r
\r
void entcs_think()\r
{\r
- self.nextthink = time;\r
+ self.nextthink = time + 0.033333333333; // increase this to like 0.15 once the client can do smoothing\r
\r
entity o;\r
o = self.owner;\r
\r
- if(o.origin != self.origin || o.angles != self.angles)\r
+ if(o.origin != self.origin)\r
{\r
setorigin(self, o.origin);\r
+ self.SendFlags |= 2;\r
+ }\r
+ if(o.angles_y != self.angles_y)\r
+ {\r
self.angles = o.angles;\r
- self.SendFlags |= 1;\r
+ self.SendFlags |= 4;\r
+ }\r
+ if(o.health != self.health)\r
+ {\r
+ self.health = o.health;\r
+ self.SendFlags |= 8;\r
+ }\r
+ if(o.armorvalue != self.armorvalue)\r
+ {\r
+ self.armorvalue = o.armorvalue;\r
+ self.SendFlags |= 16;\r
}\r
};\r
\r