]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
hud_panel_centerprint_align to change text alignment
authorterencehill <piuntn@gmail.com>
Mon, 23 May 2011 17:54:01 +0000 (19:54 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 23 May 2011 17:54:01 +0000 (19:54 +0200)
hud_luminos.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/hud_config.qc

index 13b241d4f8258044177d1258e42e927fecd174b7..372839ae5016b9b59f2c6489e0158998ef7609f1 100644 (file)
@@ -110,6 +110,7 @@ seta hud_panel_centerprint_bg_color_team ""
 seta hud_panel_centerprint_bg_alpha ""
 seta hud_panel_centerprint_bg_border ""
 seta hud_panel_centerprint_bg_padding ""
+seta hud_panel_centerprint_align "0.5"
 seta hud_panel_centerprint_fontscale "1"
 seta hud_panel_centerprint_time "2"
 
index bb7d4e6ed1958adda910ad69d339a8417ce6e1a0..fc7fd4e9e5b852ba99fc194977507bcaa8141fd1 100644 (file)
@@ -206,6 +206,7 @@ float autocvar_hud_panel_healtharmor_progressbar_gfx_lowhealth;
 float autocvar_hud_panel_healtharmor_progressbar_gfx_smooth;
 
 float autocvar_hud_panel_centerprint;
+float autocvar_hud_panel_centerprint_align;
 float autocvar_hud_panel_centerprint_fontscale;
 float autocvar_hud_panel_centerprint_time;
 float autocvar_hud_panel_healtharmor_text;
index 81607939c61e6fa33aaa2f16b0f83f6c5816da24..45993d30961769eb993d1517a0f26cb28f4e3983 100644 (file)
@@ -4411,12 +4411,13 @@ void HUD_CenterPrint (void)
        entries = bound(1, floor(panel_size_y/height), CENTERPRINT_MAX_ENTRIES);
 
        float i, j, k, n;
+       float a, sz, fade, align;
        vector pos;
        string ts;
-       float a, sz, fade;
 
        pos = panel_pos;
        fade = min(autocvar_hud_panel_centerprint_time/8, 0.25);
+       align = bound(0, autocvar_hud_panel_centerprint_align, 1);
        for (i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
        {
                if (j == CENTERPRINT_MAX_MSGS)
@@ -4442,9 +4443,10 @@ void HUD_CenterPrint (void)
                        while(getWrappedLine_remaining)
                        {
                                ts = getWrappedLine(panel_size_x, fontsize, stringwidth_colors);
-                               pos_x = panel_pos_x + (panel_size_x - stringwidth(ts, TRUE, fontsize)) * 0.5;
                                if (ts != "")
                                {
+                                       if (align)
+                                               pos_x = panel_pos_x + (panel_size_x - stringwidth(ts, TRUE, fontsize)) * align;
                                        drawcolorcodedstring(pos + '0 1 0' * 1.5 * (1 - sz) * fontsize_y, ts, fontsize, a, DRAWFLAG_NORMAL);
                                        pos_y += fontsize_y * 1.5;
                                }
index 97a0cb6cc787773f1932f7818cc9b4682b2a0eb6..80a28a48a96eec7c8f487bf7c985b64bfe70e9a1 100644 (file)
@@ -122,6 +122,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_acceleration_mode");
                                        break;
                                case HUD_PANEL_CENTERPRINT:
+                                       HUD_Write_PanelCvar_q("_align");
                                        HUD_Write_PanelCvar_q("_fontscale");
                                        HUD_Write_PanelCvar_q("_time");
                                        break;