From: FruitieX Date: Wed, 4 Aug 2010 14:57:55 +0000 (+0300) Subject: fix a load of things concerning the scoreboard, leftalign scoreboard, make centerprin... X-Git-Tag: xonotic-v0.1.0preview~370 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e3327be0ebf714e06be19a77c0429d4d504c737f;p=xonotic%2Fxonotic-data.pk3dir.git fix a load of things concerning the scoreboard, leftalign scoreboard, make centerprints static, move centerprints to another static position when the scoreboard is open. TODO: MOTD must be moved --- diff --git a/_hud_descriptions.cfg b/_hud_descriptions.cfg index 09860bbfa..ddcd45a36 100644 --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@ -28,6 +28,8 @@ seta hud_configure_grid "" "snap to grid when moving/resizing panels" seta hud_configure_grid_xsize "" "snap to X * vid_conwidth" seta hud_configure_grid_ysize "" "snap to Y * vid_conheight" +seta scr_centerpos "" "Y position of the centerprint" + seta hud_panel_weapons "" "enable/disable this panel" seta hud_panel_weapons_pos "" "position of this panel" seta hud_panel_weapons_size "" "size of this panel" diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 6b0a9be7d..a8e9fe969 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1391,6 +1391,8 @@ seta scoreboard_fadeoutspeed 5 "speed at which scoreboard fades out, higher is f seta scoreboard_highlight 1 "enable highlighting for rows and columns in the scoreboard" seta scoreboard_highlight_alpha 0.10 "highlight alpha value (depends on hud_scoreboard_highlight 1)" seta scoreboard_highlight_alpha_self 0.25 "self highlight alpha value" +seta scoreboard_offset_left 0.02 "how many pixels the scoreboard is offset from the left screen edge" +seta scoreboard_offset_right 0.1 "how many pixels the scoreboard is offset from the right screen edge" // for menu server list (eventually make them have engine support?) seta menu_slist_showfull 1 "show servers even if they are full and have no slots to join" diff --git a/hud_default.cfg b/hud_default.cfg index 34fed7a99..7c658d7a9 100644 --- a/hud_default.cfg +++ b/hud_default.cfg @@ -26,6 +26,8 @@ seta hud_configure_grid "1" seta hud_configure_grid_xsize "0.005000" seta hud_configure_grid_ysize "0.005000" +seta scr_centerpos 0.25 + seta hud_panel_weapons 1 seta hud_panel_weapons_pos "0.915000 0.085000" seta hud_panel_weapons_size "0.060000 0.635000" diff --git a/hud_luminos_default.cfg b/hud_luminos_default.cfg index 8d1436a18..6a01bb47f 100644 --- a/hud_luminos_default.cfg +++ b/hud_luminos_default.cfg @@ -26,6 +26,8 @@ seta hud_configure_grid "1" seta hud_configure_grid_xsize "0.005000" seta hud_configure_grid_ysize "0.005000" +seta scr_centerpos 0.25 + seta hud_panel_weapons 1 seta hud_panel_weapons_pos "0.915000 0.085000" seta hud_panel_weapons_size "0.060000 0.635000" diff --git a/hud_old_nexuiz.cfg b/hud_old_nexuiz.cfg index e803ed9d3..c4bf3d8a6 100644 --- a/hud_old_nexuiz.cfg +++ b/hud_old_nexuiz.cfg @@ -26,6 +26,8 @@ seta hud_configure_grid "1" seta hud_configure_grid_xsize "0.01" seta hud_configure_grid_ysize "0.01" +seta scr_centerpos 0.25 + seta hud_panel_weapons 1 seta hud_panel_weapons_pos "0.370000 0.870000" seta hud_panel_weapons_size "0.330000 0.060000" diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index d3a5ea6a2..a45b360e9 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -623,11 +623,6 @@ void CSQC_UpdateView(float w, float h) self.draw2d(); self = e; - // draw hud - if(cvar("r_letterbox") == 0) { - HUD_DrawCenterPrint(); // draw centerprint messages even if viewsize >= 120 - } - float hud; hud = getstati(STAT_HUD); if(hud == HUD_SPIDERBOT) @@ -645,7 +640,7 @@ void CSQC_UpdateView(float w, float h) CSQC_common_hud(); // crosshair goes VERY LAST - if(!scoreboard_active && !camera_active) { + if(!scoreboard_active && !camera_active && intermission != 2) { // TrueAim check float shottype; float bullets, ring_scale; @@ -1204,23 +1199,29 @@ void CSQC_common_hud(void) acc_lev[i] = stof(argv(i)); } - // hud first - HUD_Main(); + HUD_Main(); // always run these functions for alpha checks + HUD_DrawScoreboard(); - // scoreboard/accuracy - if (intermission == 2 && !scoreboard_showaccuracy && !scoreboard_showscores) // map voting screen + if (scoreboard_showscores || scoreboard_showscores_force || getstati(STAT_HEALTH) <= 0 || intermission == 1) // scoreboard/accuracy + { + HUD_Reset(); + // HUD_DrawScoreboard takes care of centerprint_start + } + else if (intermission == 2) // map voting screen { HUD_FinaleOverlay(); HUD_Reset(); - } - else if(scoreboard_showaccuracy && spectatee_status != -1) - HUD_DrawAccuracyStats(); - else - HUD_DrawScoreboard(); - if (scoreboard_showscores || scoreboard_showaccuracy || scoreboard_showscores_force || getstati(STAT_HEALTH) <= 0 || intermission == 1) - HUD_Reset(); + centerprint_start_x = 0; + centerprint_start_y = cvar("scr_centerpos") * vid_conheight; + } + else // hud + { + centerprint_start_x = 0; + centerprint_start_y = cvar("scr_centerpos") * vid_conheight; + } + HUD_DrawCenterPrint(); break; case HUD_SPIDERBOT: diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 924627d0c..cd44e450f 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -131,7 +131,7 @@ float stringwidth_nocolors(string s, vector theSize) #define CENTERPRINT_MAX_LINES 30 string centerprint_messages[CENTERPRINT_MAX_LINES]; float centerprint_width[CENTERPRINT_MAX_LINES]; -vector centerprint_start; +float centerprint_time; float centerprint_expire; float centerprint_num; float centerprint_offset_hint; @@ -182,6 +182,8 @@ void centerprint(string strMessage) while(getWrappedLine_remaining) { s = getWrappedLine(vid_conwidth * 0.75, centerprint_fontsize, stringwidth_colors); + if(centerprint_messages[i] != s) // don't fade the same message in, looks stupid + centerprint_time = time; if(centerprint_messages[i]) strunzone(centerprint_messages[i]); centerprint_messages[i] = strzone(s); @@ -208,8 +210,6 @@ void centerprint(string strMessage) if(havail > vid_conheight - 70) havail = vid_conheight - 70; // avoid overlapping HUD - centerprint_start_x = 0; - #if 0 float forbiddenmin, forbiddenmax, allowedmin, allowedmax, preferred; @@ -260,14 +260,6 @@ void centerprint(string strMessage) centerprint_start_y = bound(forbiddenmax, preferred, allowedmax); } #else - centerprint_start_y = - min( - max( - max(scoreboard_bottom, vid_conheight * 0.5 + 16), - (havail - h)/2 - ), - havail - h - ); #endif centerprint_num = i; @@ -279,32 +271,35 @@ void HUD_DrawCenterPrint (void) float i; vector pos; string ts; - float a; - - //if(time > centerprint_expire) - // return; + float a, sz; - //a = bound(0, 1 - 2 * (time - centerprint_expire), 1); - a = bound(0, 1 - 4 * (time - centerprint_expire), 1); - //sz = 1.2 / (a + 0.2); + if(time - centerprint_time < 0.25) + a = (time - centerprint_time) / 0.25; + else + a = bound(0, 1 - 4 * (time - centerprint_expire), 1); if(a <= 0) return; + sz = 0.8 + (a / 5); + pos = centerprint_start; for (i=0; i vid_conwidth - 2 * teamcolumnwidth) - f = vid_conwidth - 2 * teamcolumnwidth; - return f; -} - float PreviewExists(string name) { float f; diff --git a/qcsrc/client/progs.src b/qcsrc/client/progs.src index 4569e497c..1334d7d3c 100644 --- a/qcsrc/client/progs.src +++ b/qcsrc/client/progs.src @@ -22,6 +22,7 @@ autocvars.qh interpolate.qh teamradar.qh hud.qh +scoreboard.qh waypointsprites.qh movetypes.qh prandom.qh diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index 29fb20642..d40dea006 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -877,7 +877,7 @@ float HUD_WouldDrawScoreboard() { return 1; else if (intermission == 1) return 1; - else if (intermission == 2) + else if (intermission == 2 && scoreboard_showscores) return 1; else if (getstati(STAT_HEALTH) <= 0 && cvar("cl_deathscoreboard")) return 1; @@ -907,7 +907,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size) } drawstring(pos, strcat("Accuracy stats (average ", ftos(average_accuracy), "%)"), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); - pos_y += 18; + pos_y += 1.25 * hud_fontsize_y; vector tmp; tmp_x = sbwidth; tmp_y = height * rows; @@ -1006,6 +1006,8 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size) pos_x -= sbwidth/weapon_cnt / 2; pos_x -= sbwidth; pos_y += height; + + pos_y += 1.25 * hud_fontsize_y; return pos; } @@ -1054,13 +1056,12 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl, vector rgb, vector bg_ drawstring(pos, p, hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); drawstring(pos + '3 0 0' * hud_fontsize_x, TIME_ENCODED_TOSTRING(t), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); drawcolorcodedstring(pos + '8 0 0' * hud_fontsize_x, n, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL); - pos += '0 1 0' * hud_fontsize_y; + pos_y += 1.25 * hud_fontsize_y; } return pos; } -float scoreboard_fade_alpha; float hud_woulddrawscoreboard_prev; float hud_woulddrawscoreboard_change; // "time" at which HUD_WouldDrawScoreboard() changed void HUD_DrawScoreboard() @@ -1102,13 +1103,11 @@ void HUD_DrawScoreboard() vector rgb, pos, tmp; entity pl, tm; - sbwidth = HUD_GetWidth(6.5 * hud_fontsize_y); + xmin = cvar("scoreboard_offset_left") * vid_conwidth; + ymin = cvar("con_notify") * cvar("con_notifysize"); - xmin = 0.5 * (vid_conwidth - sbwidth); - ymin = SCOREBOARD_OFFSET; - - xmax = vid_conwidth - xmin; - ymax = vid_conheight - 0.2*vid_conheight; + sbwidth = xmax = vid_conwidth - xmin - cvar("scoreboard_offset_right") * vid_conwidth; + ymax = vid_conheight - ymin; // Initializes position pos_x = xmin; @@ -1117,10 +1116,12 @@ void HUD_DrawScoreboard() // Heading drawfont = hud_bigfont; - drawstringcenter('0 1 0' * ymin, "Scoreboard", '24 24 0', '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); + drawstring(pos, "Scoreboard", '24 24 0', '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); + + centerprint_start_x = vid_conwidth - 0.5 * (pos_x + stringwidth("Scoreboard", FALSE, '24 24 0')); + centerprint_start_y = pos_y; - pos_y += 24 + 4; - pos_y += hud_fontsize_y; + pos_y += 24; drawfont = hud_font; @@ -1177,23 +1178,24 @@ void HUD_DrawScoreboard() pos = HUD_DrawScoreboardAccuracyStats(pos, rgb, bg_size); } - tmp = pos + '0 1.5 0' * hud_fontsize_y; - pos_y += 3 * hud_fontsize_y; - // List spectators float specs; specs = 0; + tmp = pos; for(pl = players.sort_next; pl; pl = pl.sort_next) { if(pl.team != COLOR_SPECTATOR) continue; - HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localentnum - 1), specs); pos_y += 1.25 * hud_fontsize_y; + HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localentnum - 1), specs); ++specs; } if(specs) + { drawstring(tmp, "Spectators", hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); + pos_y += 1.25 * hud_fontsize_y; + } // Print info string string str; diff --git a/qcsrc/client/scoreboard.qh b/qcsrc/client/scoreboard.qh new file mode 100644 index 000000000..3ba6808ae --- /dev/null +++ b/qcsrc/client/scoreboard.qh @@ -0,0 +1 @@ +float scoreboard_fade_alpha;