cachepic_t *sb_inter;
cachepic_t *sb_finale;
-cvar_t showfps = {CVAR_SAVE, "showfps", "0", "shows your rendered fps (frames per second)"};
-cvar_t showsound = {CVAR_SAVE, "showsound", "0", "shows number of active sound sources, sound latency, and other statistics"};
-cvar_t showblur = {CVAR_SAVE, "showblur", "0", "shows the current alpha level of motionblur"};
-cvar_t showspeed = {CVAR_SAVE, "showspeed", "0", "shows your current speed (qu per second); number selects unit: 1 = qu/s, 2 = m/s, 3 = km/h, 4 = mph, 5 = knots"};
-cvar_t showtopspeed = {CVAR_SAVE, "showtopspeed", "0", "shows your top speed (kept on screen for max 3 seconds); value -1 takes over the unit from showspeed, otherwise it's an unit number just like in showspeed"};
-cvar_t showtime = {CVAR_SAVE, "showtime", "0", "shows current time of day (useful on screenshots)"};
-cvar_t showtime_format = {CVAR_SAVE, "showtime_format", "%H:%M:%S", "format string for time of day"};
-cvar_t showdate = {CVAR_SAVE, "showdate", "0", "shows current date (useful on screenshots)"};
-cvar_t showdate_format = {CVAR_SAVE, "showdate_format", "%Y-%m-%d", "format string for date"};
-cvar_t showtex = {0, "showtex", "0", "shows the name of the texture on the crosshair (for map debugging)"};
-cvar_t sbar_alpha_bg = {CVAR_SAVE, "sbar_alpha_bg", "0.4", "opacity value of the statusbar background image"};
-cvar_t sbar_alpha_fg = {CVAR_SAVE, "sbar_alpha_fg", "1", "opacity value of the statusbar weapon/item icons and numbers"};
-cvar_t sbar_hudselector = {CVAR_SAVE, "sbar_hudselector", "0", "selects which of the builtin hud layouts to use (meaning is somewhat dependent on gamemode, so nexuiz has a very different set of hud layouts than quake for example)"};
-cvar_t sbar_scorerank = {CVAR_SAVE, "sbar_scorerank", "1", "shows an overlay for your score (or team score) and rank in the scoreboard"};
-cvar_t sbar_gametime = {CVAR_SAVE, "sbar_gametime", "1", "shows an overlay for the time left in the current match/level (or current game time if there is no timelimit set)"};
-cvar_t sbar_miniscoreboard_size = {CVAR_SAVE, "sbar_miniscoreboard_size", "-1", "sets the size of the mini deathmatch overlay in items, or disables it when set to 0, or sets it to a sane default when set to -1"};
-cvar_t sbar_flagstatus_right = {CVAR_SAVE, "sbar_flagstatus_right", "0", "moves Nexuiz flag status icons to the right"};
-cvar_t sbar_flagstatus_pos = {CVAR_SAVE, "sbar_flagstatus_pos", "115", "pixel position of the Nexuiz flag status icons, from the bottom"};
-cvar_t sbar_info_pos = {CVAR_SAVE, "sbar_info_pos", "0", "pixel position of the info strings (such as showfps), from the bottom"};
-
-cvar_t cl_deathscoreboard = {0, "cl_deathscoreboard", "1", "shows scoreboard (+showscores) while dead"};
-
-cvar_t crosshair_color_red = {CVAR_SAVE, "crosshair_color_red", "1", "customizable crosshair color"};
-cvar_t crosshair_color_green = {CVAR_SAVE, "crosshair_color_green", "0", "customizable crosshair color"};
-cvar_t crosshair_color_blue = {CVAR_SAVE, "crosshair_color_blue", "0", "customizable crosshair color"};
-cvar_t crosshair_color_alpha = {CVAR_SAVE, "crosshair_color_alpha", "1", "how opaque the crosshair should be"};
-cvar_t crosshair_size = {CVAR_SAVE, "crosshair_size", "1", "adjusts size of the crosshair on the screen"};
+cvar_t showfps = {CVAR_CLIENT | CVAR_SAVE, "showfps", "0", "shows your rendered fps (frames per second)"};
+cvar_t showsound = {CVAR_CLIENT | CVAR_SAVE, "showsound", "0", "shows number of active sound sources, sound latency, and other statistics"};
+cvar_t showblur = {CVAR_CLIENT | CVAR_SAVE, "showblur", "0", "shows the current alpha level of motionblur"};
+cvar_t showspeed = {CVAR_CLIENT | CVAR_SAVE, "showspeed", "0", "shows your current speed (qu per second); number selects unit: 1 = qu/s, 2 = m/s, 3 = km/h, 4 = mph, 5 = knots"};
+cvar_t showtopspeed = {CVAR_CLIENT | CVAR_SAVE, "showtopspeed", "0", "shows your top speed (kept on screen for max 3 seconds); value -1 takes over the unit from showspeed, otherwise it's an unit number just like in showspeed"};
+cvar_t showtime = {CVAR_CLIENT | CVAR_SAVE, "showtime", "0", "shows current time of day (useful on screenshots)"};
+cvar_t showtime_format = {CVAR_CLIENT | CVAR_SAVE, "showtime_format", "%H:%M:%S", "format string for time of day"};
+cvar_t showdate = {CVAR_CLIENT | CVAR_SAVE, "showdate", "0", "shows current date (useful on screenshots)"};
+cvar_t showdate_format = {CVAR_CLIENT | CVAR_SAVE, "showdate_format", "%Y-%m-%d", "format string for date"};
+cvar_t showtex = {CVAR_CLIENT, "showtex", "0", "shows the name of the texture on the crosshair (for map debugging)"};
+cvar_t sbar_alpha_bg = {CVAR_CLIENT | CVAR_SAVE, "sbar_alpha_bg", "0.4", "opacity value of the statusbar background image"};
+cvar_t sbar_alpha_fg = {CVAR_CLIENT | CVAR_SAVE, "sbar_alpha_fg", "1", "opacity value of the statusbar weapon/item icons and numbers"};
+cvar_t sbar_hudselector = {CVAR_CLIENT | CVAR_SAVE, "sbar_hudselector", "0", "selects which of the builtin hud layouts to use (meaning is somewhat dependent on gamemode, so nexuiz has a very different set of hud layouts than quake for example)"};
+cvar_t sbar_scorerank = {CVAR_CLIENT | CVAR_SAVE, "sbar_scorerank", "1", "shows an overlay for your score (or team score) and rank in the scoreboard"};
+cvar_t sbar_gametime = {CVAR_CLIENT | CVAR_SAVE, "sbar_gametime", "1", "shows an overlay for the time left in the current match/level (or current game time if there is no timelimit set)"};
+cvar_t sbar_miniscoreboard_size = {CVAR_CLIENT | CVAR_SAVE, "sbar_miniscoreboard_size", "-1", "sets the size of the mini deathmatch overlay in items, or disables it when set to 0, or sets it to a sane default when set to -1"};
+cvar_t sbar_flagstatus_right = {CVAR_CLIENT | CVAR_SAVE, "sbar_flagstatus_right", "0", "moves Nexuiz flag status icons to the right"};
+cvar_t sbar_flagstatus_pos = {CVAR_CLIENT | CVAR_SAVE, "sbar_flagstatus_pos", "115", "pixel position of the Nexuiz flag status icons, from the bottom"};
+cvar_t sbar_info_pos = {CVAR_CLIENT | CVAR_SAVE, "sbar_info_pos", "0", "pixel position of the info strings (such as showfps), from the bottom"};
+
+cvar_t cl_deathscoreboard = {CVAR_CLIENT, "cl_deathscoreboard", "1", "shows scoreboard (+showscores) while dead"};
+
+cvar_t crosshair_color_red = {CVAR_CLIENT | CVAR_SAVE, "crosshair_color_red", "1", "customizable crosshair color"};
+cvar_t crosshair_color_green = {CVAR_CLIENT | CVAR_SAVE, "crosshair_color_green", "0", "customizable crosshair color"};
+cvar_t crosshair_color_blue = {CVAR_CLIENT | CVAR_SAVE, "crosshair_color_blue", "0", "customizable crosshair color"};
+cvar_t crosshair_color_alpha = {CVAR_CLIENT | CVAR_SAVE, "crosshair_color_alpha", "1", "how opaque the crosshair should be"};
+cvar_t crosshair_size = {CVAR_CLIENT | CVAR_SAVE, "crosshair_size", "1", "adjusts size of the crosshair on the screen"};
static void Sbar_MiniDeathmatchOverlay (int x, int y);
static void Sbar_DeathmatchOverlay (void);
Tab key down
===============
*/
-static void Sbar_ShowScores (void)
+static void Sbar_ShowScores_f(cmd_state_t *cmd)
{
if (sb_showscores)
return;
Tab key up
===============
*/
-static void Sbar_DontShowScores (void)
+static void Sbar_DontShowScores_f(cmd_state_t *cmd)
{
sb_showscores = false;
CL_VM_UpdateShowingScoresState(sb_showscores);
for (i = 0;i < 10;i++)
sb_nums[0][i] = Draw_CachePic_Flags (va(vabuf, sizeof(vabuf), "gfx/num_%i",i), CACHEPICFLAG_QUIET);
sb_nums[0][10] = Draw_CachePic_Flags ("gfx/num_minus", CACHEPICFLAG_QUIET);
- sb_colon = Draw_CachePic_Flags ("gfx/num_colon", CACHEPICFLAG_QUIET);
+ sb_colon = Draw_CachePic_Flags ("gfx/num_colon", CACHEPICFLAG_QUIET | CACHEPICFLAG_FAILONMISSING);
sb_ammo[0] = Draw_CachePic_Flags ("gfx/sb_shells", CACHEPICFLAG_QUIET);
sb_ammo[1] = Draw_CachePic_Flags ("gfx/sb_bullets", CACHEPICFLAG_QUIET);
sb_nums[0][10] = Draw_CachePic_Flags ("gfx/num_minus", CACHEPICFLAG_QUIET);
sb_nums[1][10] = Draw_CachePic_Flags ("gfx/anum_minus", CACHEPICFLAG_QUIET);
- sb_colon = Draw_CachePic_Flags ("gfx/num_colon", CACHEPICFLAG_QUIET);
+ sb_colon = Draw_CachePic_Flags ("gfx/num_colon", CACHEPICFLAG_QUIET | CACHEPICFLAG_FAILONMISSING);
sb_slash = Draw_CachePic_Flags ("gfx/num_slash", CACHEPICFLAG_QUIET);
sb_weapons[0][0] = Draw_CachePic_Flags ("gfx/inv_shotgun", CACHEPICFLAG_QUIET);
void Sbar_Init (void)
{
- Cmd_AddCommand("+showscores", Sbar_ShowScores, "show scoreboard");
- Cmd_AddCommand("-showscores", Sbar_DontShowScores, "hide scoreboard");
+ if(gamemode == GAME_NORMAL) // Workaround so Quake doesn't trample on Xonotic.
+ {
+ Cmd_AddCommand(&cmd_client, "+showscores", Sbar_ShowScores_f, "show scoreboard");
+ Cmd_AddCommand(&cmd_client, "-showscores", Sbar_DontShowScores_f, "hide scoreboard");
+ }
Cvar_RegisterVariable(&showfps);
Cvar_RegisterVariable(&showsound);
Cvar_RegisterVariable(&showblur);
static void Sbar_DrawScoreboard (void)
{
Sbar_SoloScoreboard ();
- // LordHavoc: changed to draw the deathmatch overlays in any multiplayer mode
+ // LadyHavoc: changed to draw the deathmatch overlays in any multiplayer mode
//if (cl.gametype == GAME_DEATHMATCH)
if (!cl.islocalgame)
Sbar_DeathmatchOverlay ();
char blurstring[32];
char topspeedstring[48];
char texstring[MAX_QPATH];
+ char entstring[32];
qboolean red = false;
soundstring[0] = 0;
fpsstring[0] = 0;
datestring[0] = 0;
speedstring[0] = 0;
blurstring[0] = 0;
- texstring[0] = 0;
topspeedstring[0] = 0;
+ texstring[0] = 0;
+ entstring[0] = 0;
if (showfps.integer)
{
red = (showfps_framerate < 1.0f);
vec3_t org;
vec3_t dest;
vec3_t temp;
- trace_t trace;
+ trace_t svtrace, cltrace;
+ int hitnetentity = -1;
Matrix4x4_OriginFromMatrix(&r_refdef.view.matrix, org);
VectorSet(temp, 65536, 0, 0);
Matrix4x4_Transform(&r_refdef.view.matrix, temp, dest);
- trace.hittexture = NULL; // to make sure
- // TODO change this trace to be stopped by anything "visible" (i.e. with a drawsurface), but not stuff like weapclip
- // probably needs adding a new SUPERCONTENTS type
- trace = CL_TraceLine(org, dest, MOVE_NORMAL, NULL, SUPERCONTENTS_SOLID, 0, collision_extendmovelength.value, true, false, NULL, true, true);
- if(trace.hittexture)
- strlcpy(texstring, trace.hittexture->name, sizeof(texstring));
+ // clear the traces as we may or may not fill them out, and mark them with an invalid fraction so we know if we did
+ memset(&svtrace, 0, sizeof(svtrace));
+ memset(&cltrace, 0, sizeof(cltrace));
+ svtrace.fraction = 2.0;
+ cltrace.fraction = 2.0;
+ // ray hits models (even animated ones) and ignores translucent materials
+ if (SVVM_prog != NULL)
+ svtrace = SV_TraceLine(org, dest, MOVE_HITMODEL, NULL, SUPERCONTENTS_SOLID, 0, MATERIALFLAGMASK_TRANSLUCENT, collision_extendmovelength.value);
+ cltrace = CL_TraceLine(org, dest, MOVE_HITMODEL, NULL, SUPERCONTENTS_SOLID, 0, MATERIALFLAGMASK_TRANSLUCENT, collision_extendmovelength.value, true, false, &hitnetentity, true, true);
+ if (cltrace.hittexture)
+ strlcpy(texstring, cltrace.hittexture->name, sizeof(texstring));
else
strlcpy(texstring, "(no texture hit)", sizeof(texstring));
fps_strings++;
+ if (svtrace.fraction < cltrace.fraction)
+ {
+ if (svtrace.ent != NULL)
+ {
+ prvm_prog_t *prog = SVVM_prog;
+ dpsnprintf(entstring, sizeof(entstring), "server entity %i", (int)PRVM_EDICT_TO_PROG(svtrace.ent));
+ }
+ else
+ strlcpy(entstring, "(no entity hit)", sizeof(entstring));
+ }
+ else
+ {
+ if (CLVM_prog != NULL && cltrace.ent != NULL)
+ {
+ prvm_prog_t *prog = CLVM_prog;
+ dpsnprintf(entstring, sizeof(entstring), "client entity %i", (int)PRVM_EDICT_TO_PROG(cltrace.ent));
+ }
+ else if (hitnetentity > 0)
+ dpsnprintf(entstring, sizeof(entstring), "network entity %i", hitnetentity);
+ else if (hitnetentity == 0)
+ strlcpy(entstring, "world entity", sizeof(entstring));
+ else
+ strlcpy(entstring, "(no entity hit)", sizeof(entstring));
+ }
+ fps_strings++;
}
if (fps_strings)
{
DrawQ_String(fps_x, fps_y, texstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
fps_y += fps_scaley;
}
+ if (entstring[0])
+ {
+ fps_x = vid_conwidth.integer - DrawQ_TextWidth(entstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
+ DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
+ DrawQ_String(fps_x, fps_y, entstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
+ fps_y += fps_scaley;
+ }
}
}
{
sbar_x = (vid_conwidth.integer - 320)/2;
sbar_y = vid_conheight.integer - SBAR_HEIGHT;
- // LordHavoc: changed to draw the deathmatch overlays in any multiplayer mode
+ // LadyHavoc: changed to draw the deathmatch overlays in any multiplayer mode
//if (cl.gametype == GAME_DEATHMATCH && gamemode != GAME_TRANSFUSION)
if (sb_lines > 24)
Sbar_DrawNum (248, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
- // LordHavoc: changed to draw the deathmatch overlays in any multiplayer mode
+ // LadyHavoc: changed to draw the deathmatch overlays in any multiplayer mode
if ((!cl.islocalgame || cl.gametype != GAME_COOP))
{
if (gamemode == GAME_TRANSFUSION)
if (cl.csqc_vidvars.drawcrosshair && crosshair.integer >= 1 && !cl.intermission && !r_letterbox.value)
{
pic = Draw_CachePic (va(vabuf, sizeof(vabuf), "gfx/crosshair%i", crosshair.integer));
- DrawQ_Pic((vid_conwidth.integer - pic->width * crosshair_size.value) * 0.5f, (vid_conheight.integer - pic->height * crosshair_size.value) * 0.5f, pic, pic->width * crosshair_size.value, pic->height * crosshair_size.value, crosshair_color_red.value, crosshair_color_green.value, crosshair_color_blue.value, crosshair_color_alpha.value, 0);
+ DrawQ_Pic((vid_conwidth.integer - Draw_GetPicWidth(pic) * crosshair_size.value) * 0.5f, (vid_conheight.integer - Draw_GetPicHeight(pic) * crosshair_size.value) * 0.5f, pic, Draw_GetPicWidth(pic) * crosshair_size.value, Draw_GetPicHeight(pic) * crosshair_size.value, crosshair_color_red.value, crosshair_color_green.value, crosshair_color_blue.value, crosshair_color_alpha.value, 0);
}
if (cl_prydoncursor.integer > 0)
if(IS_OLDNEXUIZ_DERIVED(gamemode))
DrawQ_Pic (xmin - 8, ymin - 8, 0, xmax-xmin+1 + 2*8, ymax-ymin+1 + 2*8, 0, 0, 0, sbar_alpha_bg.value, 0);
- DrawQ_Pic ((vid_conwidth.integer - sb_ranking->width)/2, 8, sb_ranking, 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
+ DrawQ_Pic ((vid_conwidth.integer - Draw_GetPicWidth(sb_ranking))/2, 8, sb_ranking, 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
// draw the text
y = 40;
if (minutes >= 5)
{
Sbar_DrawXNum(-12*6, 32, minutes, 3, 12, 1, 1, 1, 1, 0);
- if(sb_colon && sb_colon->tex != r_texture_notexture)
+ if (Draw_IsPicLoaded(sb_colon))
DrawQ_Pic(sbar_x + -12*3, sbar_y + 32, sb_colon, 12, 12, 1, 1, 1, sbar_alpha_fg.value, 0);
Sbar_DrawXNum(-12*2, 32, seconds, -2, 12, 1, 1, 1, 1, 0);
}
else if (minutes >= 1)
{
Sbar_DrawXNum(-12*6, 32, minutes, 3, 12, 1, 1, 0, 1, 0);
- if(sb_colon && sb_colon->tex != r_texture_notexture)
+ if (Draw_IsPicLoaded(sb_colon))
DrawQ_Pic(sbar_x + -12*3, sbar_y + 32, sb_colon, 12, 12, 1, 1, 0, sbar_alpha_fg.value, 0);
Sbar_DrawXNum(-12*2, 32, seconds, -2, 12, 1, 1, 0, 1, 0);
}
minutes = (int)floor(cl.time / 60);
seconds = (int)(floor(cl.time) - minutes * 60);
Sbar_DrawXNum(-12*6, 32, minutes, 3, 12, 1, 1, 1, 1, 0);
- if(sb_colon && sb_colon->tex != r_texture_notexture)
+ if (Draw_IsPicLoaded(sb_colon))
DrawQ_Pic(sbar_x + -12*3, sbar_y + 32, sb_colon, 12, 12, 1, 1, 1, sbar_alpha_fg.value, 0);
Sbar_DrawXNum(-12*2, 32, seconds, -2, 12, 1, 1, 1, 1, 0);
}
*/
void Sbar_FinaleOverlay (void)
{
- DrawQ_Pic((vid_conwidth.integer - sb_finale->width)/2, 16, sb_finale, 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
+ DrawQ_Pic((vid_conwidth.integer - Draw_GetPicWidth(sb_finale))/2, 16, sb_finale, 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
}