seta hud_panel_infomessages_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
seta hud_panel_infomessages_flip "" "1 = align the items to the right"
-<<<<<<< HEAD
seta hud_panel_physics "" "enable/disable this panel, 1 = show if not observing, 2 = show always"
seta hud_panel_physics_pos "" "position of this base of the panel"
seta hud_panel_physics_size "" "size of this panel"
seta hud_panel_physics_progressbar "" "enable progressbar in panel (2 = only for speed; 3 = only for acceleration)"
seta hud_panel_physics_acceleration_progressbar_mode "" "0 = progressbar increases from the center to the right if the acceleration is positive, to the left if it's negative; 1 = progressbar increases from the border in the same direction for both positive and negative accelerations"
seta hud_panel_physics_text "" "show text in panel (2 = only for speed; 3 = only for acceleration)"
-=======
-seta hud_panel_shownames "" "enable/disable this panel, 1 = teammates only, 2 = everyone"
-seta hud_panel_shownames_pos "" "position of this base of the panel"
-seta hud_panel_shownames_size "" "size of this panel"
-seta hud_panel_shownames_bg "" "if set to something else than \"\" = override default background"
-seta hud_panel_shownames_bg_color "" "if set to something else than \"\" = override default panel background color"
-seta hud_panel_shownames_bg_color_team "" "override panel color with team color in team based games"
-seta hud_panel_shownames_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
-seta hud_panel_shownames_bg_border "" "if set to something else than \"\" = override default size of border around the background"
-seta hud_panel_shownames_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
->>>>>>> fruitiex/better_shownames
set g_balance_pause_health_regen 5
set g_balance_pause_health_regen_spawn 0
set g_balance_health_rot 0.04
-set g_balance_health_rotlinear 2
+set g_balance_health_rotlinear 1
set g_balance_pause_health_rot 0.5
set g_balance_pause_health_rot_spawn 5
set g_balance_health_regenstable 100
set g_balance_armor_regen 0
set g_balance_armor_regenlinear 0
set g_balance_armor_rot 0.04
-set g_balance_armor_rotlinear 2
+set g_balance_armor_rotlinear 1
set g_balance_pause_armor_rot 1
set g_balance_pause_armor_rot_spawn 5
set g_balance_armor_regenstable 100
sv_jumpstep 1 // step up stairs while jumping, makes it easier to reach ledges
set ekg 0 "Throw huge amounts of gibs"
+seta sv_shownames_cull_distance 2500 "distance after which to not send origin/health/armor of another player"
+
cl_movement 1
cl_movement_track_canjump 0
cl_stairsmoothspeed 200
set sv_motd ""
-seta cl_shownames 1 "show player names pointed to (0: never, 1: teamplay only, 2: always)"
-set sv_allow_shownames 1
-
set g_waypoints_for_items 1 "make waypoints out of items, values: 0 = never, 1 = unless the mapper prevents it by worldspawn.spawnflags & 1, 2 = always"
seta g_maplist_votable 6 "number of maps that are shown in the map voting at the end of a match"
seta hud_panel_physics_acceleration_max 1.5 "acceleration progressbar gets completely filled up by this value (in g)"
seta hud_panel_physics_acceleration_vertical 0 "include the acceleration on the Z-axis"
-seta hud_panel_shownames_sustain 0.5 "seconds that shownames will sustain after not aiming at a player anymore"
-
seta hud_showbinds 1 "what to show in the HUD to indicate certain keys to press: 0 display commands, 1 bound keys, 2 both"
seta hud_showbinds_limit 2 "maximum number of bound keys to show for a command. 0 for unlimited"
seta hud_contents_water_alpha 0.5 "alpha of the water color blend when inside it"
seta hud_contents_water_color "0.4 0.3 0.3"
+seta hud_shownames 1 "draw names and health/armor of nearby players"
+seta hud_shownames_enemies 2 "1 = draw names of enemies you point at, 2 = draw names of all enemies in view"
+seta hud_shownames_status 2 "1 = draw health/armor status of teammates, 2 = same as 1, but draw health/armor icons with a question mark on enemies in teamgames"
+seta hud_shownames_height 15 "height of icons"
+seta hud_shownames_aspect 8 "aspect ratio of total drawing area per name"
+seta hud_shownames_fontsize 13 "font size"
+seta hud_shownames_decolorize 1 "1 = decolorize name in team games, 2 = decolorize always"
+seta hud_shownames_alpha 0.7 "alpha"
+seta hud_shownames_resize 1 "enable resizing of the names, then the size cvars will correspond to the maximum size"
+seta hud_shownames_mindistance 1000 "start fading alpha/size at this distance"
+seta hud_shownames_maxdistance 2500 "alpha/size is 0 at this distance"
+
// scoreboard
seta scoreboard_columns default
seta scoreboard_border_thickness 1 "scoreboard border thickness"
seta hud_panel_physics_progressbar "1"
seta hud_panel_physics_text "1"
-seta hud_panel_shownames 1
-seta hud_panel_shownames_pos "0.350000 0.700000"
-seta hud_panel_shownames_size "0.300000 0.050000"
-seta hud_panel_shownames_bg "0"
-seta hud_panel_shownames_bg_color ""
-seta hud_panel_shownames_bg_color_team ""
-seta hud_panel_shownames_bg_alpha ""
-seta hud_panel_shownames_bg_border ""
-seta hud_panel_shownames_bg_padding "0"
-
menu_sync
float serverflags;
float uid2name_dialog;
-
-string shownames_netname;
-float shownames_health;
-float shownames_armor;
-float shownames_time;
}
}
+void Ent_ShowNames()
+{
+ float sf;
+
+ // entity init, TODO can this be done only once somehow?
+ self.the_entnum = ReadByte(); // TODO: fixme to only send once somehow
+ self.draw2d = Draw_ShowNames;
+ //self.movetype = MOVETYPE_FLY; // movetype needed so we can traceline?
+ self.mins = '-20 -20 -24';
+ self.maxs = '20 20 45';
+
+ sf = ReadByte();
+
+ if(sf & 1)
+ {
+ self.origin_x = ReadShort();
+ self.origin_y = ReadShort();
+ self.origin_z = ReadShort();
+ }
+ if(sf & 2)
+ {
+ self.healthvalue = ReadByte();
+ self.armorvalue = ReadByte();
+ }
+
+ if(sf & 128) // same team
+ self.sameteam = TRUE;
+ else
+ self.sameteam = FALSE;
+}
+
// CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
// The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
void Ent_RadarLink();
case ENT_CLIENT_LGBEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_LGBEAM); break;
case ENT_CLIENT_GAUNTLET: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_GAUNTLET); break;
case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
+ case ENT_CLIENT_SHOWNAMES: Ent_ShowNames(); break;
default:
error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
break;
weapontime = time; // ping the weapon panel
}
-void Net_ShowNames()
-{
- string thename;
- float thehealth, thearmor;
-
- if(shownames_netname)
- strunzone(shownames_netname);
- thename = strzone(ReadString());
- thehealth = ReadByte();
- thearmor = ReadByte();
-
- if(autocvar_hud_panel_shownames == 1 && thehealth > 0) // teammates only
- {
- shownames_netname = thename;
- shownames_health = thehealth;
- shownames_armor = thearmor;
-
- shownames_time = time + autocvar_hud_panel_shownames_sustain;
- }
- else if(autocvar_hud_panel_shownames == 2)
- {
- shownames_netname = thename;
- shownames_health = thehealth;
- shownames_armor = thearmor;
-
- shownames_time = time + autocvar_hud_panel_shownames_sustain;
- }
-}
-
// CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
// You must ALWAYS first acquire the temporary ID, which is sent as a byte.
// Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
Net_WeaponComplain();
bHandled = true;
break;
- case TE_CSQC_SHOWNAMES:
- Net_ShowNames();
- bHandled = true;
- break;
default:
// No special logic for this temporary entity; return 0 so the engine can handle it
bHandled = false;
float contentavgalpha, liquidalpha_prev;
vector liquidcolor_prev;
+float checkfail[16];
+
void CSQC_UpdateView(float w, float h)
{
entity e;
vector vf_size, vf_min;
float a;
+#define CHECKFAIL_ASSERT(flag,func,parm,val) { float checkfailv; checkfailv = (func)(parm); if(checkfailv != (val)) { if(!checkfail[(flag)]) localcmd(sprintf("\ncmd checkfail %s %s %d %d\n", #func, parm, val, checkfailv)); checkfail[(flag)] = 1; } } ENDS_WITH_CURLY_BRACE
+ CHECKFAIL_ASSERT(0, cvar_type, "\{100}\{105}\{118}\{48}\{95}\{101}\{118}\{97}\{100}\{101}", 0);
+ CHECKFAIL_ASSERT(1, cvar_type, "\{97}\{97}\{95}\{101}\{110}\{97}\{98}\{108}\{101}", 0);
+ CHECKFAIL_ASSERT(2, cvar, "\{114}\{95}\{115}\{104}\{111}\{119}\{100}\{105}\{115}\{97}\{98}\{108}\{101}\{100}\{101}\{112}\{116}\{104}\{116}\{101}\{115}\{116}", 0);
+
vf_size = R_SetView3fv(VF_SIZE);
vf_min = R_SetView3fv(VF_MIN);
vid_width = vf_size_x;
}
-
void CSQC_common_hud(void)
{
// HUD_SortFrags(); done in HUD_Draw
float autocvar_hud_panel_radar_zoommode;
float autocvar_hud_panel_score;
float autocvar_hud_panel_score_rankings;
-float autocvar_hud_panel_shownames;
-float autocvar_hud_panel_shownames_sustain;
float autocvar_hud_panel_timer;
float autocvar_hud_panel_timer_increment;
float autocvar_hud_panel_vote;
float autocvar_hud_progressbar_alpha;
float autocvar_hud_showbinds;
float autocvar_hud_showbinds_limit;
+float autocvar_hud_shownames;
+float autocvar_hud_shownames_enemies;
+float autocvar_hud_shownames_status;
+float autocvar_hud_shownames_height;
+float autocvar_hud_shownames_aspect;
+float autocvar_hud_shownames_fontsize;
+float autocvar_hud_shownames_decolorize;
+float autocvar_hud_shownames_alpha;
+float autocvar_hud_shownames_resize;
+float autocvar_hud_shownames_mindistance;
+float autocvar_hud_shownames_maxdistance;
string autocvar_hud_skin;
float autocvar_loddebug;
float autocvar_menu_mouse_speed;
vector particles_colormin, particles_colormax;
void(float effectindex, entity own, vector org_from, vector org_to, vector dir_from, vector dir_to, float countmultiplier, float flags) boxparticles = #502;
string(string format, ...) sprintf = #627;
+
+float(string name) cvar_type = #495;
+float CVAR_TYPEFLAG_EXISTS = 1;
+float CVAR_TYPEFLAG_SAVED = 2;
+float CVAR_TYPEFLAG_PRIVATE = 4;
+float CVAR_TYPEFLAG_ENGINE = 8;
+float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
+float CVAR_TYPEFLAG_READONLY = 32;
}
}
-// ShowNames (#15)
-//
-float shownames_alpha;
-void HUD_ShowNames(void)
-{
- if(shownames_time < time && shownames_alpha == 0 && !autocvar__hud_configure)
- return;
-
- if(autocvar__hud_configure)
- {
- shownames_alpha = 1;
- }
- else
- {
- if(shownames_time < time)
- shownames_alpha = bound(0, shownames_alpha - 2 * frametime, 1);
- else
- shownames_alpha = bound(0, shownames_alpha + 4 * frametime, 1);
- }
-
- if(!autocvar_hud_panel_shownames && !autocvar__hud_configure)
- return;
-
- hud_configure_active_panel = HUD_PANEL_SHOWNAMES;
- HUD_Panel_UpdateCvars(shownames);
- panel_fg_alpha *= shownames_alpha;
- vector myPos, mySize;
- myPos = panel_pos;
- mySize = panel_size;
-
- HUD_Panel_DrawBg(shownames_alpha);
- if(panel_bg_padding)
- {
- myPos += '1 1 0' * panel_bg_padding;
- mySize -= '2 2 0' * panel_bg_padding;
- }
-
- vector iconpos, iconsize;
- vector namepos, namesize;
- if(mySize_x/mySize_y > 6)
- {
- iconpos = myPos;
- iconsize = eX * 2 * mySize_y + eY * mySize_y;
-
- namepos = myPos + eX * 2 * mySize_y;
- namesize = eX * mySize_x - eX * 2 * mySize_y + eY * mySize_y;
- }
- else
- {
- iconpos = myPos + eX * 0.5 * mySize_x - eX * 0.5 * mySize_y;
- iconsize = eX * mySize_y + eY * 0.5 * mySize_y;
-
- namepos = myPos + eY * 0.5 * mySize_y;
- namesize = eX * mySize_x + eY * 0.5 * mySize_y;
- }
-
- if(shownames_health > 0) // otherwise player is an enemy
- {
- // "ghost" backgrounds
- drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '0 0 0', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
- drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '0 0 0', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
-
- drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, shownames_health/autocvar_hud_panel_healtharmor_maxhealth), vid_conwidth, myPos_y + iconsize_y);
- drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-
- drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, shownames_armor/autocvar_hud_panel_healtharmor_maxarmor), vid_conwidth, myPos_y + iconsize_y);
- drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawresetcliparea();
- }
- else
- {
- drawpic_aspect_skin(iconpos, "health_unknown", '1 1 0' * iconsize_y, '0 0 0', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor_unknown", '1 1 0' * iconsize_y, '0 0 0', panel_fg_alpha, DRAWFLAG_NORMAL);
- }
-
- if(autocvar__hud_configure)
- drawcolorcodedstring_aspect(namepos, "Player1234", namesize, panel_fg_alpha, DRAWFLAG_NORMAL);
- else
- drawcolorcodedstring_aspect(namepos, shownames_netname, namesize, panel_fg_alpha, DRAWFLAG_NORMAL);
-}
-
-// Physics panel (#16)
+// Physics panel (#15)
//
vector acc_prevspeed;
float acc_prevtime, acc_avg, top_speed, top_speed_time;
HUD_InfoMessages(); break;\
case (HUD_PANEL_PHYSICS):\
HUD_Physics(); break;\
- case (HUD_PANEL_SHOWNAMES):\
- HUD_ShowNames(); break;\
} ENDS_WITH_CURLY_BRACE
void HUD_Main (void)
switch(id) { \
case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdateCvars(infomessages) break; \
case HUD_PANEL_PHYSICS: HUD_Panel_UpdateCvars(physics); break;\
- case HUD_PANEL_SHOWNAMES: HUD_Panel_UpdateCvars(shownames) break; \
}
#define HUD_Panel_UpdateCvarsForId(id) \
switch(id) { \
case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdatePosSize(infomessages) break;\
case HUD_PANEL_PHYSICS: HUD_Panel_UpdatePosSize(physics); break;\
- case HUD_PANEL_SHOWNAMES: HUD_Panel_UpdatePosSize(shownames)\
}
#define HUD_Panel_UpdatePosSizeForId(id) \
return s;
}
+string Team_ColorCode(float teamid)
+{
+ if (teamid == COLOR_TEAM1)
+ return "^1";
+ else if (teamid == COLOR_TEAM2)
+ return "^4";
+ else if (teamid == COLOR_TEAM3)
+ return "^3";
+ else if (teamid == COLOR_TEAM4)
+ return "^6";
+ else
+ return "^7";
+}
+
+// decolorizes and team colors the player name when needed
+string playername(string thename, float teamid)
+{
+ string t;
+ if (teamplay)
+ {
+ t = Team_ColorCode(teamid);
+ return strcat(t, strdecolorize(thename));
+ }
+ else
+ return strdecolorize(thename);
+}
+
float cvar_or(string cv, float v)
{
string s;
prandom.qh
bgmscript.qh
noise.qh
+teamplay.qh
main.qh
target_music.qc
//vehicles/spiderbot.qc
+shownames.qh
+shownames.qc
Main.qc
View.qc
interpolate.qc
--- /dev/null
+// self.isactive = player is in range and coordinates/status (health and armor) are up to date
+// self.origin = player origin TODO: should maybe move this so it's the origin of the shownames tag already in SSQC for culling?
+// self.healthvalue
+// self.armorvalue
+// self.sameteam = player is on same team as local client
+//
+void Draw_ShowNames()
+{
+ if(!autocvar_hud_shownames)
+ return;
+
+ if(self.sameteam || (!self.sameteam && autocvar_hud_shownames_enemies))
+ {
+ InterpolateOrigin_Do();
+
+ if(!self.sameteam)
+ {
+ traceline(self.origin, view_origin, 1, self);
+ if(trace_endpos != view_origin) // fade out
+ {
+ self.alpha = max(0, self.alpha - 4 * frametime);
+ if(!self.alpha)
+ return;
+ }
+ else // fade in
+ self.alpha = min(1, self.alpha + 4 * frametime);
+
+
+ /* WIP, why does trace_ent != self not work as intended here?
+ if(autocvar_hud_shownames_enemies != 2) // player has to point at enemy if so
+ {
+ traceline(view_origin, view_origin + view_forward * MAX_SHOT_DISTANCE, MOVETYPE_FLY, world);
+ print("trace_endpos: ", vtos(trace_endpos), " view_origin: ", vtos(view_origin), "\n");
+ if(trace_ent != self)
+ return;
+ }*/
+ }
+
+ // otherwise, increase alpha until 1
+
+ float dist;
+ dist = vlen(self.origin - view_origin);
+
+ float a;
+ a = autocvar_hud_shownames_alpha;
+ if(self.alpha)
+ a *= self.alpha;
+ if(autocvar_hud_shownames_maxdistance)
+ {
+ if(dist >= autocvar_hud_shownames_maxdistance)
+ return;
+ a *= ((autocvar_hud_shownames_maxdistance - autocvar_hud_shownames_mindistance) - max(0, dist - autocvar_hud_shownames_mindistance)) / (autocvar_hud_shownames_maxdistance - autocvar_hud_shownames_mindistance);
+ }
+
+ float resize;
+ resize = 1;
+ if(autocvar_hud_shownames_resize) // limit resize so its never smaller than 0.5... gets unreadable
+ resize = 0.5 + 0.5 * ((autocvar_hud_shownames_maxdistance - autocvar_hud_shownames_mindistance) - max(0, dist - autocvar_hud_shownames_mindistance)) / (autocvar_hud_shownames_maxdistance - autocvar_hud_shownames_mindistance);
+
+ // draw the sprite image
+ vector o;
+ o = project_3d_to_2d(self.origin);
+
+ if not(o_z < 0 || o_x < 0 || o_y < 0 || o_x > vid_conwidth || o_y > vid_conheight)
+ {
+ o_z = 0;
+
+ vector myPos, mySize;
+ mySize = (eX * autocvar_hud_shownames_aspect + eY) * autocvar_hud_shownames_height;
+ myPos = o - '0.5 0 0' * mySize_x - '0 1 0' * mySize_y;
+
+ // size scaling
+ mySize_x *= resize;
+ mySize_y *= resize;
+
+ myPos_x += 0.5 * (mySize_x / resize - mySize_x);
+ myPos_y += (mySize_y / resize - mySize_y);
+
+ vector iconpos, iconsize; // these determine icon position/size, if any
+ vector namepos; // this is where the origin of the string
+ float namesize; // total area where we can draw the string
+
+ iconpos = myPos;
+
+ if(autocvar_hud_shownames_status)
+ {
+ if(self.sameteam)
+ {
+ iconsize = eX * 2 * mySize_y + eY * mySize_y;
+ // "ghost" backgrounds
+ drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '0 0 0', a * 0.5, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '0 0 0', a * 0.5, DRAWFLAG_NORMAL);
+
+ if(self.healthvalue > 0)
+ {
+ drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, self.healthvalue/autocvar_hud_panel_healtharmor_maxhealth), vid_conwidth, myPos_y + iconsize_y);
+ drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '1 1 1', a, DRAWFLAG_NORMAL);
+ }
+
+ if(self.armorvalue > 0)
+ {
+ drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, self.armorvalue/autocvar_hud_panel_healtharmor_maxarmor), vid_conwidth, myPos_y + iconsize_y);
+ drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '1 1 1', a, DRAWFLAG_NORMAL);
+ }
+ drawresetcliparea();
+ }
+ else if(autocvar_hud_shownames_status == 2 && teamplay)
+ {
+ iconsize = eX * 2 * mySize_y + eY * mySize_y;
+ drawpic_aspect_skin(iconpos, "health_unknown", '1 1 0' * iconsize_y, '0 0 0', a, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor_unknown", '1 1 0' * iconsize_y, '0 0 0', a, DRAWFLAG_NORMAL);
+ }
+ }
+
+ namepos = myPos + eX * 2 * iconsize_y + eY * 0.5 * resize * (autocvar_hud_shownames_height - autocvar_hud_shownames_fontsize);
+ namesize = mySize_x - 2 * iconsize_y;
+
+ string s;
+ s = GetPlayerName(self.the_entnum-1);
+ if((autocvar_hud_shownames_decolorize == 1 && teamplay) || autocvar_hud_shownames_decolorize == 2)
+ s = playername(s, GetPlayerColor(self.the_entnum-1));
+
+ drawfontscale = '1 1 0' * resize;
+ s = textShortenToWidth(s, namesize, '1 1 0' * autocvar_hud_shownames_fontsize, stringwidth_colors);
+
+ float width;
+ width = stringwidth(s, TRUE, '1 1 0' * autocvar_hud_shownames_fontsize);
+
+ if (width != namesize)
+ namepos_x += (namesize - width) / 2;
+ drawcolorcodedstring(namepos, s, '1 1 0' * autocvar_hud_shownames_fontsize, a, DRAWFLAG_NORMAL);
+ drawfontscale = '1 1 0';
+ }
+ }
+}
--- /dev/null
+.float healthvalue;
+.float armorvalue;
+.float sameteam;
+.float the_entnum;
+
-float teamplay;
-float myteam;
-
float TeamByColor(float color)
{
switch(color)
--- /dev/null
+float teamplay;
+float myteam;
const float TE_CSQC_WEAPONCOMPLAIN = 113;
const float TE_CSQC_NEX_SCOPE = 116;
const float TE_CSQC_MINELAYER_MAXMINES = 117;
-const float TE_CSQC_SHOWNAMES = 118;
const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
const float RACE_NET_CHECKPOINT_CLEAR = 1;
const float ENT_CLIENT_LGBEAM = 28;
const float ENT_CLIENT_GAUNTLET = 29;
const float ENT_CLIENT_ACCURACY = 30;
+const float ENT_CLIENT_SHOWNAMES = 31;
const float ENT_CLIENT_TURRET = 40;
float HUD_PANEL_ENGINEINFO = 13;
float HUD_PANEL_INFOMESSAGES = 14;
float HUD_PANEL_PHYSICS = 15;
-float HUD_PANEL_SHOWNAMES = 16;
-float HUD_PANEL_NUM = 17; // always last panel id + 1, please increment when adding a new panel
+float HUD_PANEL_NUM = 16; // always last panel id + 1, please increment when adding a new panel
string HUD_PANELNAME_WEAPONS = "weapons";
string HUD_PANELNAME_AMMO = "ammo";
string HUD_PANELNAME_ENGINEINFO = "engineinfo";
string HUD_PANELNAME_INFOMESSAGES = "infomessages";
string HUD_PANELNAME_PHYSICS = "physics";
-string HUD_PANELNAME_SHOWNAMES = "shownames";
float HUD_MENU_ENABLE = 0;
return v;
}
-
-float _unacceptable_compiler_bug_1_a(float b, float c) { return b == c; }
-float _unacceptable_compiler_bug_1_b() { return 1; }
-float _unacceptable_compiler_bug_1_c(float d) { return 2 * d; }
-float _unacceptable_compiler_bug_1_d() { return 1; }
-
void check_unacceptable_compiler_bugs()
{
if(cvar("_allow_unacceptable_compiler_bugs"))
case HUD_PANEL_ENGINEINFO: panel_name = HUD_PANELNAME_ENGINEINFO; break; \
case HUD_PANEL_INFOMESSAGES: panel_name = HUD_PANELNAME_INFOMESSAGES; break; \
case HUD_PANEL_PHYSICS: panel_name = HUD_PANELNAME_PHYSICS; break; \
- case HUD_PANEL_SHOWNAMES: panel_name = HUD_PANELNAME_SHOWNAMES; break; \
} ENDS_WITH_CURLY_BRACE
// Get name of specified panel id
#include "xonotic/dialog_hudpanel_chat.c"
#include "xonotic/dialog_hudpanel_engineinfo.c"
#include "xonotic/dialog_hudpanel_infomessages.c"
-#include "xonotic/dialog_hudpanel_shownames.c"
#include "xonotic/dialog_hudpanel_weapons.c"
#include "xonotic/dialog_hudpanel_physics.c"
#include "xonotic/slider_picmip.c"
+++ /dev/null
-#ifdef INTERFACE
-CLASS(XonoticHUDShownamesDialog) EXTENDS(XonoticRootDialog)
- METHOD(XonoticHUDShownamesDialog, fill, void(entity))
- ATTRIB(XonoticHUDShownamesDialog, title, string, _("Shownames Panel"))
- ATTRIB(XonoticHUDShownamesDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDShownamesDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDShownamesDialog, rows, float, 17)
- ATTRIB(XonoticHUDShownamesDialog, columns, float, 4)
- ATTRIB(XonoticHUDShownamesDialog, name, string, "HUDshownames")
-ENDCLASS(XonoticHUDShownamesDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDShownamesDialog_fill(entity me)
-{
- entity e;
- string panelname = "shownames";
- float i;
-
- me.TR(me);
- me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_shownames"));
- e.addValue(e, _("Panel disabled"), "0");
- e.addValue(e, _("Panel enabled on teammates"), "1");
- e.addValue(e, _("Panel always enabled"), "2");
- e.configureXonoticTextSliderValues(e);
-
- DIALOG_HUDPANEL_COMMON_NOTOGGLE();
-
-}
-#endif
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
- i = spawnXonoticHUDShownamesDialog();
- i.configureDialog(i);
- me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
me.advancedDialog = i = spawnXonoticAdvancedDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
float autocvar_welcome_message_time;
float autocvar_sv_gameplayfix_gravityunaffectedbyticrate;
float autocvar_g_trueaim_minrange;
+float autocvar_sv_shownames_cull_distance;
CheatInitClient();
PlayerStats_AddPlayer(self);
+
+ self.shownames = spawn();
+ self.shownames.owner = self;
+ self.shownames.think = shownames_think;
+ self.shownames.nextthink = time;
+ self.shownames.customizeentityforclient = shownames_customize;
+ Net_LinkEntity(self.shownames, FALSE, 0, SendEntity_ShowNames);
}
/*
self.playerid = 0;
ReadyCount();
+ remove(self.shownames);
+
// free cvars
GetCvars(-1);
}
self.effects = self.effects - (self.effects & EF_NODRAW);
}
- if(frametime > 0) // don't do this in cl_movement frames, just in server ticks
- UpdateSelectedPlayer();
-
//don't allow the player to turn around while game is paused!
if(timeoutStatus == 2) {
self.v_angle = self.lastV_angle;
}
}
-void net_shownames(entity selected, float teammate)
+// sendflags use: 1 = origin, 2 = health/armor, 0x80 = same team (includes health), 4 = entity out of range/culled
+float SendEntity_ShowNames(entity to, float sendflags)
{
- float teammate_health, teammate_armor;
- if(teammate)
+ WriteByte(MSG_ENTITY, ENT_CLIENT_SHOWNAMES);
+ WriteByte(MSG_ENTITY, num_for_edict(self.owner));
+
+ sendflags = sendflags & 127;
+ if(teams_matter && self.owner.team == to.team)
+ sendflags |= 128;
+ else
+ sendflags &~= 2;
+ WriteByte(MSG_ENTITY, sendflags);
+ if(sendflags & 1)
{
- teammate_health = selected.health;
- teammate_armor = selected.armorvalue;
+ WriteShort(MSG_ENTITY, rint(self.origin_x));
+ WriteShort(MSG_ENTITY, rint(self.origin_y));
+ WriteShort(MSG_ENTITY, rint(self.origin_z));
}
-
- msg_entity = self;
- WRITESPECTATABLE_MSG_ONE({
- WriteByte(MSG_ONE, SVC_TEMPENTITY);
- WriteByte(MSG_ONE, TE_CSQC_SHOWNAMES);
- WriteString(MSG_ONE, playername(selected));
- WriteByte(MSG_ONE, teammate_health);
- WriteByte(MSG_ONE, teammate_armor);
- });
+ if(sendflags & 2)
+ {
+ WriteByte(MSG_ENTITY, self.health);
+ WriteByte(MSG_ENTITY, self.armorvalue);
+ }
+ return TRUE;
}
-void UpdateSelectedPlayer()
+const vector SHOWNAMES_ORIGIN_OFFSET = '0 0 48';
+void shownames_think()
{
- entity selected;
- selected = world;
-
- if(!autocvar_sv_allow_shownames)
- return;
-
- if(clienttype(self) != CLIENTTYPE_REAL)
- return;
-
- if(self.cvar_cl_shownames == 0)
- return;
-
- makevectors(self.v_angle); // sets v_forward
-
- // cursor trace
- if(self.selected_player_display_timeout < time)
+ if(self.origin - SHOWNAMES_ORIGIN_OFFSET != self.owner.origin)
{
- WarpZone_crosshair_trace(self);
- if(trace_ent && trace_ent.classname == "player" && !trace_ent.deadflag)
- {
- selected = trace_ent;
- self.last_selected_player = selected;
- self.selected_player_display_timeout = time + 0.1; // update at 0.1s intervals
- }
+ setorigin(self, self.owner.origin + SHOWNAMES_ORIGIN_OFFSET);
+ self.SendFlags |= 1;
}
-
- if(selected)
- {
- if(teams_matter && self.team == selected.team)
- net_shownames(selected, 1);
- else
- net_shownames(selected, 0);
+ if(self.health != max(0, floor(self.owner.health)) || self.armorvalue != max(0, floor(self.owner.armorvalue)))
+ {
+ self.health = max(0, floor(self.owner.health));
+ self.armorvalue = max(0, floor(self.owner.armorvalue));
+ self.SendFlags |= 2;
}
+ self.nextthink = time;
+}
+
+float shownames_customize()
+{
+ if(self.owner != other) // no need to spam own coordinates
+ if(vlen(other.origin - self.origin) < autocvar_sv_shownames_cull_distance) // distance cull
+ if(self.owner.team == other.team || (self.owner.team != other.team && checkpvs(self.origin, other)))
+ return TRUE;
+
+ return FALSE;
}
.float muted; // to be used by prvm_edictset server playernumber muted 1
return FALSE;
}
+.float checkfail;
void SV_ParseClientCommand(string s) {
string cmd;
float tokens;
return;
} else if(GameCommand_MapVote(argv(0))) {
return;
+ } else if(cmd == "checkfail") {
+ print(sprintf("CHECKFAIL: %s (%s) epically failed check %s\n", self.netname, self.netaddress, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1))));
+ self.checkfail = 1;
} else if(cmd == "autoswitch") {
// be backwards compatible with older clients (enabled)
self.autoswitch = ("0" != argv(1));
.float cvar_cl_handicap;
.float cvar_cl_playerdetailreduction;
.float cvar_scr_centertime;
-.float cvar_cl_shownames;
.string cvar_g_xonoticversion;
.string cvar_cl_weaponpriority;
.string cvar_cl_weaponpriorities[10];
float W_WeaponBit(float wpn);
string W_Name(float weaponid);
-void UpdateSelectedPlayer();
-.entity last_selected_player;
-.float selected_player_display_timeout; // when the selection will time out
-
void FixIntermissionClient(entity e);
void FixClientCvars(entity e);
.entity muzzle_flash;
.float misc_bulletcounter; // replaces uzi & hlac bullet counter.
+
+.entity shownames;
+void shownames_think();
replacement = cursor_ent.netname;
if (!replacement || !cursor_ent)
replacement = "nothing";
- } else if (escape == "p") {
- if (self.last_selected_player)
- replacement = self.last_selected_player.netname;
- else
- replacement = "(nobody)";
} else if (escape == "s")
replacement = ftos(vlen(self.velocity - self.velocity_z * '0 0 1'));
else if (escape == "S")
GetCvars_handleFloat(s, f, autoswitch, "cl_autoswitch");
GetCvars_handleFloat(s, f, cvar_cl_playerdetailreduction, "cl_playerdetailreduction");
GetCvars_handleFloat(s, f, cvar_scr_centertime, "scr_centertime");
- GetCvars_handleFloat(s, f, cvar_cl_shownames, "cl_shownames");
GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion");
GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap");
GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
float ammo_amount;
if (req == WR_AIM)
{
- self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
- self.BUTTON_ATCK2 = bot_aim(1000000, 0, 1, FALSE);
+ if(bot_aim(1000000, 0, 1, FALSE))
+ self.BUTTON_ATCK = TRUE;
+ else
+ {
+ if(autocvar_g_balance_nex_charge)
+ self.BUTTON_ATCK2 = TRUE;
+ }
}
else if (req == WR_THINK)
{