Merge remote branch 'origin/master' into fruitiex/newpanelhud
authorFruitieX <rasse@rasse-lappy.localdomain>
Sun, 15 Aug 2010 08:45:01 +0000 (11:45 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Sun, 15 Aug 2010 08:45:01 +0000 (11:45 +0300)
14 files changed:
_hud_descriptions.cfg
defaultXonotic.cfg
gfx/hud/default/notify_telefrag.tga [new file with mode: 0644]
hud_default.cfg
hud_luminos_default.cfg
hud_old_nexuiz.cfg
qcsrc/client/View.qc
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/client/miscfunctions.qc
qcsrc/client/progs.src
qcsrc/client/scoreboard.qc
qcsrc/client/scoreboard.qh [new file with mode: 0644]
qcsrc/server/miscfunctions.qc

index 09860bbfa198d890d1fc3a451b67a875946c705b..ddcd45a364fcbb4dbdb4e1b089cdbbe979414c2a 100644 (file)
@@ -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"
index 48b04e8babb8c95e9b575e1651a58bcfa8962b80..eff54aaa006f14ad5d3537f1090c13973193f82a 100644 (file)
@@ -1356,6 +1356,8 @@ seta hud_panel_weapons_ammo_full_nails 200 "show 100% of the status bar at this
 seta hud_panel_weapons_ammo_full_cells 80 "show 100% of the status bar at this ammo count"
 seta hud_panel_weapons_ammo_full_rockets 80 "show 100% of the status bar at this ammo count"
 seta hud_panel_weapons_ammo_full_fuel 100 "show 100% of the status bar at this ammo count"
+seta hud_panel_weapons_timeout "10" "panel disappears if you don't switch weapon for this amount of seconds"
+seta hud_panel_weapons_timeout_effect "1" "disappearance effect: 0) no effect; 1) panel moves out of screen; 2) panel fades out"
 
 seta hud_panel_notify_time 10 "time that a new entry stays until it fades out"
 seta hud_panel_notify_fadetime 3 "fade out time"
@@ -1392,6 +1394,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.04 "how many pixels the scoreboard is offset from the left screen edge"
+seta scoreboard_offset_right 0.148 "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"
@@ -1518,7 +1522,7 @@ set capturelimit 0
 // hud: font size
 seta hud_fontsize 11
 seta hud_fontsize_spec 16
-seta scr_centersize 11
+seta scr_centersize 12
 seta hud_width 560
 // alias hud_font "loadfont user1 ${1},gfx/fallback ${2-}; loadfont user2 ${1}-big ${2-}; scoreboard_columns_set"
 alias sbar_font "set _requested_sbar_font \"${*}\""
diff --git a/gfx/hud/default/notify_telefrag.tga b/gfx/hud/default/notify_telefrag.tga
new file mode 100644 (file)
index 0000000..279910f
Binary files /dev/null and b/gfx/hud/default/notify_telefrag.tga differ
index 34fed7a999bf592509f95ad1c623a659aa8e5724..fd4980a55ea890f501e7ebf9d4eeb0d29b0e45cc 100644 (file)
@@ -20,12 +20,14 @@ seta hud_progressbar_armor_color "0 0.6 0"
 seta hud_progressbar_fuel_color "0.6 0.6 0"
 seta hud_progressbar_nexball_color "0.7 0.1 0"
 
-seta _hud_panelorder "11 0 9 2 10 14 12 6 3 13 4 8 7 1 5 "
+seta _hud_panelorder "2 14 13 9 1 3 11 0 10 12 6 4 8 7 5 "
 
 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"
@@ -46,18 +48,18 @@ seta hud_panel_weapons_aspect "2"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.190000 0.925000"
-seta hud_panel_ammo_size "0.095000 0.060000"
+seta hud_panel_ammo_size "0.110000 0.060000"
 seta hud_panel_ammo_bg ""
 seta hud_panel_ammo_bg_color ""
 seta hud_panel_ammo_bg_color_team ""
 seta hud_panel_ammo_bg_alpha ""
 seta hud_panel_ammo_bg_border ""
 seta hud_panel_ammo_bg_padding ""
-seta hud_panel_ammo_onlycurrent "1"
+seta hud_panel_ammo_onlycurrent "0"
 seta hud_panel_ammo_iconalign "0"
 
 seta hud_panel_powerups 1
-seta hud_panel_powerups_pos "0.365000 0.015000"
+seta hud_panel_powerups_pos "0.365000 0.105000"
 seta hud_panel_powerups_size "0.262500 0.048047"
 seta hud_panel_powerups_bg ""
 seta hud_panel_powerups_bg_color ""
@@ -71,8 +73,8 @@ seta hud_panel_powerups_baralign "4"
 seta hud_panel_powerups_progressbar "1"
 
 seta hud_panel_healtharmor 1
-seta hud_panel_healtharmor_pos "0.305000 0.925000"
-seta hud_panel_healtharmor_size "0.315000 0.060000"
+seta hud_panel_healtharmor_pos "0.320000 0.925000"
+seta hud_panel_healtharmor_size "0.300000 0.060000"
 seta hud_panel_healtharmor_bg ""
 seta hud_panel_healtharmor_bg_color ""
 seta hud_panel_healtharmor_bg_color_team "1"
@@ -94,7 +96,7 @@ seta hud_panel_notify_bg_alpha "0"
 seta hud_panel_notify_bg_border ""
 seta hud_panel_notify_bg_padding ""
 seta hud_panel_notify_flip "0"
-seta hud_panel_notify_print "0"
+seta hud_panel_notify_print "1"
 
 seta hud_panel_timer 1
 seta hud_panel_timer_pos "0.880000 0.012070"
@@ -138,7 +140,7 @@ seta hud_panel_racetimer_bg_border ""
 seta hud_panel_racetimer_bg_padding ""
 
 seta hud_panel_vote 1
-seta hud_panel_vote_pos "0.025000 0.660000"
+seta hud_panel_vote_pos "0.025000 0.655000"
 seta hud_panel_vote_size "0.264218 0.102462"
 seta hud_panel_vote_bg ""
 seta hud_panel_vote_bg_color ""
@@ -180,8 +182,8 @@ seta hud_panel_chat_bg_border ""
 seta hud_panel_chat_bg_padding ""
 
 seta hud_panel_engineinfo 1
-seta hud_panel_engineinfo_pos "0.860000 0.954667"
-seta hud_panel_engineinfo_size "0.125000 0.035000"
+seta hud_panel_engineinfo_pos "0.890000 0.955000"
+seta hud_panel_engineinfo_size "0.110000 0.035000"
 seta hud_panel_engineinfo_bg ""
 seta hud_panel_engineinfo_bg_color ""
 seta hud_panel_engineinfo_bg_color_team ""
@@ -190,11 +192,12 @@ seta hud_panel_engineinfo_bg_border ""
 seta hud_panel_engineinfo_bg_padding ""
 
 seta hud_panel_infomessages 1
-seta hud_panel_infomessages_pos "0.340000 0.350000"
-seta hud_panel_infomessages_size "0.320000 0.085000"
+seta hud_panel_infomessages_pos "0.515000 0"
+seta hud_panel_infomessages_size "0.340000 0.090000"
 seta hud_panel_infomessages_bg ""
 seta hud_panel_infomessages_bg_color ""
 seta hud_panel_infomessages_bg_color_team ""
 seta hud_panel_infomessages_bg_alpha "0"
 seta hud_panel_infomessages_bg_border ""
-seta hud_panel_infomessages_bg_padding ""
+seta hud_panel_infomessages_bg_padding "0"
+seta hud_panel_infomessages_flip "1"
index 8d1436a18a1224a0082f7c79dd41ffca329fbbfe..c677401d55d44d52181a7adbd8b2068c183e8e3e 100644 (file)
@@ -20,12 +20,14 @@ seta hud_progressbar_armor_color "0 0.6 0"
 seta hud_progressbar_fuel_color "0.6 0.6 0"
 seta hud_progressbar_nexball_color "0.7 0.1 0"
 
-seta _hud_panelorder "11 0 9 2 10 14 12 6 3 13 4 8 7 1 5 "
+seta _hud_panelorder "2 14 13 9 1 3 11 0 10 12 6 4 8 7 5 "
 
 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"
@@ -46,18 +48,18 @@ seta hud_panel_weapons_aspect "2"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.190000 0.925000"
-seta hud_panel_ammo_size "0.095000 0.060000"
+seta hud_panel_ammo_size "0.110000 0.060000"
 seta hud_panel_ammo_bg ""
 seta hud_panel_ammo_bg_color ""
 seta hud_panel_ammo_bg_color_team ""
 seta hud_panel_ammo_bg_alpha ""
 seta hud_panel_ammo_bg_border ""
 seta hud_panel_ammo_bg_padding ""
-seta hud_panel_ammo_onlycurrent "1"
+seta hud_panel_ammo_onlycurrent "0"
 seta hud_panel_ammo_iconalign "0"
 
 seta hud_panel_powerups 1
-seta hud_panel_powerups_pos "0.365000 0.015000"
+seta hud_panel_powerups_pos "0.365000 0.105000"
 seta hud_panel_powerups_size "0.262500 0.048047"
 seta hud_panel_powerups_bg ""
 seta hud_panel_powerups_bg_color ""
@@ -71,8 +73,8 @@ seta hud_panel_powerups_baralign "4"
 seta hud_panel_powerups_progressbar "1"
 
 seta hud_panel_healtharmor 1
-seta hud_panel_healtharmor_pos "0.305000 0.925000"
-seta hud_panel_healtharmor_size "0.315000 0.060000"
+seta hud_panel_healtharmor_pos "0.320000 0.925000"
+seta hud_panel_healtharmor_size "0.300000 0.060000"
 seta hud_panel_healtharmor_bg ""
 seta hud_panel_healtharmor_bg_color ""
 seta hud_panel_healtharmor_bg_color_team "1"
@@ -94,7 +96,7 @@ seta hud_panel_notify_bg_alpha "0"
 seta hud_panel_notify_bg_border ""
 seta hud_panel_notify_bg_padding ""
 seta hud_panel_notify_flip "0"
-seta hud_panel_notify_print "0"
+seta hud_panel_notify_print "1"
 
 seta hud_panel_timer 1
 seta hud_panel_timer_pos "0.880000 0.012070"
@@ -138,7 +140,7 @@ seta hud_panel_racetimer_bg_border ""
 seta hud_panel_racetimer_bg_padding ""
 
 seta hud_panel_vote 1
-seta hud_panel_vote_pos "0.025000 0.660000"
+seta hud_panel_vote_pos "0.025000 0.655000"
 seta hud_panel_vote_size "0.264218 0.102462"
 seta hud_panel_vote_bg ""
 seta hud_panel_vote_bg_color ""
@@ -180,8 +182,8 @@ seta hud_panel_chat_bg_border ""
 seta hud_panel_chat_bg_padding ""
 
 seta hud_panel_engineinfo 1
-seta hud_panel_engineinfo_pos "0.860000 0.954667"
-seta hud_panel_engineinfo_size "0.125000 0.035000"
+seta hud_panel_engineinfo_pos "0.890000 0.955000"
+seta hud_panel_engineinfo_size "0.110000 0.035000"
 seta hud_panel_engineinfo_bg ""
 seta hud_panel_engineinfo_bg_color ""
 seta hud_panel_engineinfo_bg_color_team ""
@@ -190,13 +192,14 @@ seta hud_panel_engineinfo_bg_border ""
 seta hud_panel_engineinfo_bg_padding ""
 
 seta hud_panel_infomessages 1
-seta hud_panel_infomessages_pos "0.340000 0.350000"
-seta hud_panel_infomessages_size "0.320000 0.085000"
+seta hud_panel_infomessages_pos "0.515000 0"
+seta hud_panel_infomessages_size "0.340000 0.090000"
 seta hud_panel_infomessages_bg ""
 seta hud_panel_infomessages_bg_color ""
 seta hud_panel_infomessages_bg_color_team ""
 seta hud_panel_infomessages_bg_alpha "0"
 seta hud_panel_infomessages_bg_border ""
-seta hud_panel_infomessages_bg_padding ""
+seta hud_panel_infomessages_bg_padding "0"
+seta hud_panel_infomessages_flip "1"
 
 menu_restart
index e803ed9d3487ab7bdc0c02dff709b44083a887ac..08bab6588ae8cc42dc0ad7373e5c55e1515e144b 100644 (file)
@@ -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"
@@ -94,7 +96,7 @@ seta hud_panel_notify_bg_alpha "0"
 seta hud_panel_notify_bg_border ""
 seta hud_panel_notify_bg_padding ""
 seta hud_panel_notify_flip "0"
-seta hud_panel_notify_print "0"
+seta hud_panel_notify_print "1"
 
 seta hud_panel_timer 1
 seta hud_panel_timer_pos "0.860000 0"
index d3a5ea6a2d87db4e3905d7a3090dcbfd75548471..a45b360e94ce21fe32d9448036f0baf0250150b2 100644 (file)
@@ -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:
index f2b900fa978bc7370b8e84c6da6ceed64243f4d8..6dc62337d52dea5e320795bdd1c847ba454cd7fe 100644 (file)
@@ -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,17 +260,10 @@ 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;
+
        centerprint_expire = time + cvar("scr_centertime");
 }
 
@@ -279,32 +272,39 @@ void HUD_DrawCenterPrint (void)
        float i;
        vector pos;
        string ts;
-       float a;
+       float a, sz;
 
-       //if(time > centerprint_expire)
-       //      return;
-
-       //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);
+
+       if(centerprint_num * cvar("scr_centersize") > 24 && HUD_WouldDrawScoreboard()) // 24 = height of Scoreboard text
+       {
+               centerprint_start_y = scoreboard_bottom + centerprint_fontsize_y;
+       }
        pos = centerprint_start;
        for (i=0; i<centerprint_num; i = i + 1)
        {
-               pos_x = (vid_conwidth - centerprint_width[i]) * 0.5;
                ts = centerprint_messages[i];
+               drawfontscale = sz * '1 1 0';
+               drawfont = hud_bigfont;
+               pos_x = (vid_conwidth - stringwidth(ts, TRUE, centerprint_fontsize)) * 0.5;
                if (ts != "")
                {
-                       drawcolorcodedstring(pos, ts, centerprint_fontsize, a, DRAWFLAG_NORMAL);
-                       //  - '0 0.5 0' * (sz - 1) * centerprint_fontsize_x - '0.5 0 0' * (sz - 1) * centerprint_width[i] * centerprint_fontsize_y, centerprint_fontsize * sz
+                       drawcolorcodedstring(pos + '0 1 0' * (1 - sz) * 0.5 *centerprint_fontsize_y, ts, centerprint_fontsize, a, DRAWFLAG_NORMAL);
                        pos_y = pos_y + centerprint_fontsize_y;
                }
                else
                        // half height for empty lines looks better
-                       pos_y = pos_y + centerprint_fontsize_y * 0.5;
+                       pos_y = pos_y + sz * centerprint_fontsize_y * 0.5;
+               drawfontscale = '1 1 0';
+               drawfont = hud_font;
        }
 }
 
@@ -453,6 +453,9 @@ void HUD_Panel_ExportCfg(string cfgname)
                fputs(fh, strcat("seta hud_configure_grid_ysize \"", cvar_string("hud_configure_grid_ysize"), "\"", "\n"));
                fputs(fh, "\n");
 
+               fputs(fh, strcat("seta scr_centerpos \"", cvar_string("scr_centerpos"), "\"", "\n"));
+               fputs(fh, "\n");
+
                // common cvars for all panels
                float i;
                for (i = 0; i < HUD_PANEL_NUM; ++i)
@@ -508,6 +511,9 @@ void HUD_Panel_ExportCfg(string cfgname)
                                case HUD_PANEL_PRESSEDKEYS:
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_aspect \"", cvar_string(strcat("hud_panel_", panel_name, "_aspect")), "\"", "\n"));
                                        break;
+                               case HUD_PANEL_INFOMESSAGES:
+                                       fputs(fh, strcat("seta hud_panel_", panel_name, "_flip \"", cvar_string(strcat("hud_panel_", panel_name, "_flip")), "\"", "\n"));
+                                       break;
                        }
                        fputs(fh, "\n");
                }
@@ -940,6 +946,10 @@ void HUD_Panel_Arrow_Action(float nPrimary)
 
        HUD_Panel_UpdatePosSizeForId(highlightedPanel)
 
+       vector prev_pos, prev_size;
+       prev_pos = panel_pos;
+       prev_size = panel_size;
+
        if (hudShiftState & S_ALT) // resize
        {
                highlightedAction = 1;
@@ -993,6 +1003,16 @@ void HUD_Panel_Arrow_Action(float nPrimary)
 
                HUD_Panel_SetPos(pos);
        }
+
+       HUD_Panel_UpdatePosSizeForId(highlightedPanel)
+
+       if (prev_pos != panel_pos || prev_size != panel_size)
+       {
+               // backup!
+               panel_pos_backup = prev_pos;
+               panel_size_backup = prev_size;
+               highlightedPanel_backup = highlightedPanel;
+       }
 }
 
 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
@@ -1044,6 +1064,66 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                menu_enabled_time = time;
                localcmd("menu_showhudexit\n");
        }
+       else if(hudShiftState & S_CTRL)
+       {
+               if (mouseClicked)
+                       return true;
+
+               if(nPrimary == K_SPACE) // enable/disable highlighted panel or dock
+               {
+                       if (bInputType == 1)
+                               return true;
+
+                       if (highlightedPanel_prev != -1)
+                               cvar_set(strcat("hud_panel_", panel_name), ftos(!(panel_enabled)));
+                       else
+                               cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
+               }
+               if(nPrimary == 'c') // copy highlighted panel size
+               {
+                       if (bInputType == 1)
+                               return true;
+
+                       if (highlightedPanel_prev != -1)
+                       {
+                               panel_size_copied = panel_size;
+                               highlightedPanel_copied = highlightedPanel_prev;
+                       }
+               }
+               else if(nPrimary == 'v') // past copied size on the highlighted panel
+               {
+                       if (bInputType == 1)
+                               return true;
+
+                       if (highlightedPanel_copied != -1 && highlightedPanel_prev != -1)
+                       {
+                               // backup first!
+                               panel_pos_backup = panel_pos;
+                               panel_size_backup = panel_size;
+                               highlightedPanel_backup = highlightedPanel_prev;
+
+                               string s;
+                               s = strcat(ftos(panel_size_copied_x/vid_conwidth), " ", ftos(panel_size_copied_y/vid_conheight));
+                               cvar_set(strcat("hud_panel_", panel_name, "_size"), s);
+                       }
+               }
+               else if(nPrimary == 'z') // undo last action
+               {
+                       if (bInputType == 1)
+                               return true;
+                       //restore previous values
+                       if (highlightedPanel_backup != -1)
+                       {
+                               HUD_Panel_GetName(highlightedPanel_backup)
+                               string s;
+                               s = strcat(ftos(panel_pos_backup_x/vid_conwidth), " ", ftos(panel_pos_backup_y/vid_conheight));
+                               cvar_set(strcat("hud_panel_", panel_name, "_pos"), s);
+                               s = strcat(ftos(panel_size_backup_x/vid_conwidth), " ", ftos(panel_size_backup_y/vid_conheight));
+                               cvar_set(strcat("hud_panel_", panel_name, "_size"), s);
+                               highlightedPanel_backup = -1;
+                       }
+               }
+       }
        else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
        {
                if (bInputType == 1)
@@ -1226,6 +1306,7 @@ void HUD_Panel_Highlight()
 }
 
 float highlightcheck;
+float would_backup;
 void HUD_Panel_Mouse()
 {
        // TODO: needs better check... is there any float that contains the current state of the menu? _menu_alpha isn't apparently updated the frame the menu gets enabled
@@ -1254,8 +1335,20 @@ void HUD_Panel_Mouse()
 
        if(mouseClicked)
        {
+               vector prev_pos, prev_size;
                if(prevMouseClicked == 0)
+               {
                        HUD_Panel_Highlight(); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
+                                                                       // and calls HUD_Panel_UpdatePosSizeForId() for the highlighted panel
+                       would_backup = TRUE;
+               }
+               else if (would_backup)
+               {
+                       // this is not the actual backup! Saving pos and size values
+                       // only to check later if they are different from new values
+                       prev_pos = panel_pos;
+                       prev_size = panel_size;
+               }
 
                hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
 
@@ -1280,6 +1373,18 @@ void HUD_Panel_Mouse()
                        HUD_Panel_SetPosSize(mySize);
                }
 
+               HUD_Panel_UpdatePosSizeForId(highlightedPanel)
+               if (prevMouseClicked)
+               if (would_backup)
+               if (prev_pos != panel_pos || prev_size != panel_size)
+               {
+                       // backup!
+                       panel_pos_backup = prev_pos;
+                       panel_size_backup = prev_size;
+                       highlightedPanel_backup = highlightedPanel;
+                       would_backup = FALSE;
+               }
+
                // doubleclick check
                if(time - prevMouseClickedTime < 0.4 && prevMouseClicked == 0 && prevMouseClickedPos == mousepos && highlightedPanel >= 0)
                {
@@ -1385,14 +1490,52 @@ void HUD_Weapons(void)
        if(!autocvar_hud_panel_weapons && !autocvar__hud_configure)
                return;
 
+       float timeout = cvar("hud_panel_weapons_timeout");
+       float timeout_effect_lenght;
+       if (cvar("hud_panel_weapons_timeout_effect") == 0)
+               timeout_effect_lenght = 0;
+       else
+               timeout_effect_lenght = 0.75;
+
+       if (timeout && time >= weapontime + timeout + timeout_effect_lenght && !autocvar__hud_configure)
+               return;
+
        active_panel = HUD_PANEL_WEAPONS;
        HUD_Panel_UpdateCvars(weapons);
-       vector pos, mySize;
-       float i, weapid, fade, weapon_stats, weapon_number, weapon_cnt;
 
-       pos = panel_pos;
-       mySize = panel_size;
+       if (timeout && time >= weapontime + timeout && !autocvar__hud_configure)
+       {
+               float f = (time - (weapontime + timeout)) / timeout_effect_lenght;
+               if (cvar("hud_panel_weapons_timeout_effect") == 2)
+               {
+                       panel_bg_alpha *= (1 - f);
+                       panel_fg_alpha *= (1 - f);
+               }
+               else
+               {
+                       f *= f; // for a cooler movement
+                       vector center;
+                       center_x = panel_pos_x + panel_size_x/2;
+                       center_y = panel_pos_y + panel_size_y/2;
+                       float screen_ar = vid_conwidth/vid_conheight;
+                       if (center_x/center_y < screen_ar) //bottom left
+                       {
+                               if ((vid_conwidth - center_x)/center_y < screen_ar) //bottom
+                                       panel_pos_y += f * (vid_conheight - panel_pos_y);
+                               else //left
+                                       panel_pos_x -= f * (panel_pos_x + panel_size_x);
+                       }
+                       else //top right
+                       {
+                               if ((vid_conwidth - center_x)/center_y < screen_ar) //right
+                                       panel_pos_x += f * (vid_conwidth - panel_pos_x);
+                               else //top
+                                       panel_pos_y -= f * (panel_pos_y + panel_size_y);
+                       }
+               }
+       }
 
+       float i, weapid, fade, weapon_stats, weapon_number, weapon_cnt;
        weapon_cnt = 0;
        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
        {
@@ -1425,8 +1568,8 @@ void HUD_Weapons(void)
        HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
-               pos += '1 1 0' * panel_bg_padding;
-               mySize -= '2 2 0' * panel_bg_padding;
+               panel_pos += '1 1 0' * panel_bg_padding;
+               panel_size -= '2 2 0' * panel_bg_padding;
        }
 
        // hits
@@ -1449,7 +1592,7 @@ void HUD_Weapons(void)
        HUD_Weapons_Clear();
 
        float rows, columns;
-       rows = mySize_y/mySize_x;
+       rows = panel_size_y/panel_size_x;
        rows = bound(1, floor((sqrt(4 * autocvar_hud_panel_weapons_aspect * rows * WEP_COUNT + rows * rows) + rows + 0.5) / 2), WEP_COUNT);
 
        columns = ceil(WEP_COUNT/rows);
@@ -1467,8 +1610,8 @@ void HUD_Weapons(void)
 
        for(i = 0; i < weapon_cnt; ++i)
        {
-               wpnpos = pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows);
-               wpnsize = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
+               wpnpos = panel_pos + eX * column * panel_size_x*(1/columns) + eY * row * panel_size_y*(1/rows);
+               wpnsize = eX * panel_size_x*(1/columns) + eY * panel_size_y*(1/rows);
 
                self = weaponorder[i];
                weapid = self.impulse;
@@ -1510,9 +1653,9 @@ void HUD_Weapons(void)
                        drawpic_aspect_skin(wpnpos, strcat("weapon", self.netname), wpnsize, '1 1 1', fade * panel_fg_alpha, DRAWFLAG_NORMAL);
 
                        if(autocvar_hud_panel_weapons_label == 1) // weapon number
-                               drawstring(wpnpos, ftos(weapid), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawstring(wpnpos, ftos(weapid), '1 1 0' * 0.5 * panel_size_y*(1/rows), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                        else if(autocvar_hud_panel_weapons_label == 2) // bind
-                               drawstring(wpnpos, getcommandkey(ftos(weapid), strcat("impulse ", ftos(weapid))), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawstring(wpnpos, getcommandkey(ftos(weapid), strcat("impulse ", ftos(weapid))), '1 1 0' * 0.5 * panel_size_y*(1/rows), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 
                        // draw ammo status bar
                        if(autocvar_hud_panel_weapons_ammo && weapid != WEP_TUBA && weapid != WEP_LASER && weapid != WEP_PORTO)
@@ -1845,10 +1988,17 @@ void HUD_Powerups(void) {
        pos = panel_pos;
        mySize = panel_size;
 
-       float strength_time, shield_time;
-
-       strength_time = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 99);
-       shield_time = bound(0, getstatf(STAT_INVINCIBLE_FINISHED) - time, 99);
+       float strength_time, shield_time;
+       if(autocvar__hud_configure)
+       {
+               strength_time = 15;
+               shield_time = 27;
+       }
+       else
+       {
+               strength_time = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 99);
+               shield_time = bound(0, getstatf(STAT_INVINCIBLE_FINISHED) - time, 99);
+       }
 
        HUD_Panel_DrawBg(bound(0, max(strength_time, shield_time), 1));
        if(panel_bg_padding)
@@ -1857,12 +2007,6 @@ void HUD_Powerups(void) {
                mySize -= '2 2 0' * panel_bg_padding;
        }
 
-       if(autocvar__hud_configure)
-       {
-               strength_time = 15;
-               shield_time = 27;
-       }
-
        vector barpos, barsize;
        vector picpos;
        vector numpos;
@@ -2473,8 +2617,13 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
                else if(type == KILL_FIRST_BLOOD)
                        print("^1",s1, "^1 drew first blood", "\n");
                // TODO: icon!
-               else if (type == DEATH_TELEFRAG)
-                       print ("^1",s1, "^1 was telefragged by ", s2, "\n");
+               else if (type == DEATH_TELEFRAG) {
+                       HUD_KillNotify_Push(s2, s1, 1, DEATH_TELEFRAG);
+                       if(gentle)
+                               print ("^1",s1, "^1 tried to occupy ", s2, "^1's teleport destination space\n");
+                       else
+                               print ("^1",s1, "^1 was telefragged by ", s2, "\n");
+               }
                else if (type == DEATH_DROWN) {
                        HUD_KillNotify_Push(s2, s1, 1, DEATH_DROWN);
                        if(alsoprint)
@@ -2752,7 +2901,7 @@ void HUD_Centerprint(string s1, string s2, float type, float msg)
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Don't shoot your team mates!"));
                } else if (type == DEATH_QUIET) {
                        // do nothing
-               } else if (type == DEATH_KILL) {
+               } else { // generic message
                        if(gentle)
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You need to be more careful!"));
                        else
@@ -2795,7 +2944,7 @@ void HUD_Centerprint(string s1, string s2, float type, float msg)
                        } else {
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^4You fragged ^7", s1, s2));
                        }
-               } else if (type == KILL_FRAGGED) {
+               } else { // generic message
                        if(gentle) {
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You were scored against by ^7", s1, s2));
                        } else {
@@ -2846,7 +2995,7 @@ void HUD_Notify (void)
        float width_attacker;
        string attacker, victim;
 
-       float i, j;
+       float i, j, w;
        for(j = 0; j < entries; ++j)
        {
                s = "";
@@ -2870,7 +3019,7 @@ void HUD_Notify (void)
                                a = 0;
                }
 
-               float w;
+               w = -1;
                w = DEATH_WEAPONOF(killnotify_deathtype[j]);
 
                // TODO: maybe print in team colors?
@@ -3024,6 +3173,10 @@ void HUD_Notify (void)
                        {
                                s = "notify_teamkill_red";
                        }
+                       else if(killnotify_deathtype[j] == DEATH_TELEFRAG)
+                       {
+                               s = "notify_telefrag";
+                       }
                        else if(killnotify_deathtype[j] == DEATH_DROWN)
                        {
                                s = "notify_water";
@@ -4383,6 +4536,12 @@ void HUD_InfoMessages(void)
        vector fontsize;
        fontsize = '0.20 0.20 0' * mySize_y;
        
+       float a;
+       if(spectatee_status != 0)
+               a = 1;
+       else
+               a = panel_fg_alpha;
+
        string s;
        if(!autocvar__hud_configure)
        {
@@ -4395,7 +4554,7 @@ void HUD_InfoMessages(void)
 
                        if(autocvar_hud_panel_infomessages_flip)
                                o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                        o += eY * fontsize_y;
 
                        if(spectatee_status == -1)
@@ -4404,7 +4563,7 @@ void HUD_InfoMessages(void)
                                s = strcat("^1Press ^3", getcommandkey("primary fire", "+attack"), "^1 for another player");
                        if(autocvar_hud_panel_infomessages_flip)
                                o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                        o += eY * fontsize_y;
 
                        if(spectatee_status == -1)
@@ -4413,13 +4572,13 @@ void HUD_InfoMessages(void)
                                s = strcat("^1Press ^3", getcommandkey("secondary fire", "+attack2"), "^1 to observe");
                        if(autocvar_hud_panel_infomessages_flip)
                                o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                        o += eY * fontsize_y;
 
                        s = strcat("^1Press ^3", getcommandkey("server info", "+show_info"), "^1 for gamemode info");
                        if(autocvar_hud_panel_infomessages_flip)
                                o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                        o += eY * fontsize_y;
 
                        if(gametype == GAME_ARENA)
@@ -4439,7 +4598,7 @@ void HUD_InfoMessages(void)
                                s = strcat("^1Press ^3", getcommandkey("jump", "+jump"), "^1 to join");
                        if(autocvar_hud_panel_infomessages_flip)
                                o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                        o += eY * fontsize_y;
 
                        //show restart countdown:
@@ -4448,7 +4607,7 @@ void HUD_InfoMessages(void)
                                //we need to ceil, otherwise the countdown would be off by .5 when using round()
                                countdown = ceil(getstatf(STAT_GAMESTARTTIME) - time);
                                s = strcat("^1Game starts in ^3", ftos(countdown), "^1 seconds");
-                               drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                                o += eY * fontsize_y;
                        }
                }
@@ -4457,7 +4616,7 @@ void HUD_InfoMessages(void)
                        s = "^2Currently in ^1warmup^2 stage!";
                        if(autocvar_hud_panel_infomessages_flip)
                                o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                        o += eY * fontsize_y;
                }
 
@@ -4485,7 +4644,7 @@ void HUD_InfoMessages(void)
                        }
                        if(autocvar_hud_panel_infomessages_flip)
                                o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                        o += eY * fontsize_y;
                }
                else if(warmup_stage && !intermission && !spectatee_status)
@@ -4493,7 +4652,7 @@ void HUD_InfoMessages(void)
                        s = strcat("^2Press ^3", getcommandkey("ready", "ready"), "^2 to end warmup");
                        if(autocvar_hud_panel_infomessages_flip)
                                o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                        o += eY * fontsize_y;
                }
 
@@ -4523,7 +4682,7 @@ void HUD_InfoMessages(void)
 
                                        if(autocvar_hud_panel_infomessages_flip)
                                                o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                                        o += eY * fontsize_y;
                                }
                        }
@@ -4534,22 +4693,22 @@ void HUD_InfoMessages(void)
                s = "^7Press ^3ESC ^7to show HUD options.";
                if(autocvar_hud_panel_infomessages_flip)
                        o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-               drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                o += eY * fontsize_y;
                s = "^3Doubleclick ^7a panel for panel-specific options.";
                if(autocvar_hud_panel_infomessages_flip)
                        o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-               drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                o += eY * fontsize_y;
                s = "^3CTRL ^7to disable collision testing, ^3SHIFT ^7and";
                if(autocvar_hud_panel_infomessages_flip)
                        o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-               drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                o += eY * fontsize_y;
                s = "^3ALT ^7+ ^3ARROW KEYS ^7for fine adjustments.";
                if(autocvar_hud_panel_infomessages_flip)
                        o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-               drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
                o += eY * fontsize_y;
        }
 }
@@ -4703,10 +4862,19 @@ void HUD_Main (void)
 {
        hud_skin_path = strcat("gfx/hud/", autocvar_hud_skin);
 
+       // global hud alpha fade
        if(disable_menu_alphacheck == 1)
-               menu_fade_alpha = 1;
+               hud_fade_alpha = 1;
        else
-               menu_fade_alpha = (1 - autocvar__menu_alpha);
+               hud_fade_alpha = (1 - autocvar__menu_alpha);
+
+       if(scoreboard_fade_alpha)
+               hud_fade_alpha = (1 - scoreboard_fade_alpha);
+
+       if(intermission == 2) // no hud during mapvote
+               hud_fade_alpha = 0;
+       else if(autocvar__menu_alpha == 0 && scoreboard_fade_alpha == 0)
+               hud_fade_alpha = 1;
 
        hud_border_thickness = bound(0, cvar("hud_border_thickness"), 5);
        hud_accuracy_border_thickness = bound(0, cvar_or("hud_accuracy_border_thickness", 1), 5);
@@ -4760,7 +4928,7 @@ void HUD_Main (void)
                if(precache_pic(pic) == "") {
                        pic = "gfx/hud/default/dock";
                }
-               drawpic('0 0 0', pic, eX * vid_conwidth + eY * vid_conheight, color, autocvar_hud_dock_alpha * menu_fade_alpha, DRAWFLAG_NORMAL); // no aspect ratio forcing on dock...
+               drawpic('0 0 0', pic, eX * vid_conwidth + eY * vid_conheight, color, autocvar_hud_dock_alpha * hud_fade_alpha, DRAWFLAG_NORMAL); // no aspect ratio forcing on dock...
        }
 
        // cache the panel order into the panel_order array
index bdc533edbd7e818a56c7b473cf7c63980a124e1c..e416da62aee32babca9ad8e437e039eda9c74575 100644 (file)
@@ -1,5 +1,7 @@
 float log(float f);
 
+vector centerprint_start;
+
 float panel_order[HUD_PANEL_NUM];
 string hud_panelorder_prev;
 
@@ -46,12 +48,19 @@ const float S_CTRL = 2;
 const float S_ALT = 4;
 
 float disable_menu_alphacheck; // 0 = enable alpha check, 1 = disable for entire hud, 2 = disable for one panel
-float menu_fade_alpha;
+float hud_fade_alpha;
 
 string hud_skin_path;
 
 var vector progressbar_color;
 
+var float highlightedPanel_backup = -1;
+var vector panel_pos_backup;
+var vector panel_size_backup;
+
+var float highlightedPanel_copied = -1; //this is good only to know if there is something copied
+var vector panel_size_copied;
+
 var float active_panel; // this panel has recently referred the UpdateCvars macro
 var string panel_name;
 var float panel_enabled;
@@ -162,7 +171,7 @@ if(autocvar__hud_configure && disable_menu_alphacheck == 2 && highlightedPanel =
 } if(autocvar__hud_configure && !panel_enabled) {\
        panel_bg_alpha = 0.25;\
 } if(!(disable_menu_alphacheck == 2 && highlightedPanel == active_panel)) {\
-       panel_bg_alpha *= menu_fade_alpha;\
+       panel_bg_alpha *= hud_fade_alpha;\
 }
 
 // Get value for panel_fg_alpha. Also do various minalpha checks
@@ -173,7 +182,7 @@ panel_fg_alpha = autocvar_hud_panel_fg_alpha;\
 if(autocvar__hud_configure && !panel_enabled)\
        panel_fg_alpha = 0.25;\
 if(!(disable_menu_alphacheck == 2 && highlightedPanel == active_panel))\
-       panel_fg_alpha *= menu_fade_alpha;
+       panel_fg_alpha *= hud_fade_alpha;
 
 // Get border. See comments above, it's similar.
 #define HUD_Panel_GetBorder()\
index 02698745083654f3b71b0da7579ebf3b634b5ded..cc94efb6e40aec290d834e42223431b0b45ae084 100644 (file)
@@ -324,19 +324,6 @@ vector HUD_GetFontsize(string cvarname)
        return v;
 }
 
-float HUD_GetWidth(float teamcolumnwidth)
-{
-       float f;
-       f = cvar("hud_width");
-       if(f == 0)
-               f = 640;
-       if(f < 320)
-               f = 320;
-       if(f > vid_conwidth - 2 * teamcolumnwidth)
-               f = vid_conwidth - 2 * teamcolumnwidth;
-       return f;
-}
-
 float PreviewExists(string name)
 {
        float f;
index 4569e497ce30dc1cffbf40f7ae2371f65836d4ee..1334d7d3c7b6251f25651ee280d418fffdf0a592 100644 (file)
@@ -22,6 +22,7 @@ autocvars.qh
 interpolate.qh
 teamradar.qh
 hud.qh
+scoreboard.qh
 waypointsprites.qh
 movetypes.qh
 prandom.qh
index 29fb20642a90fbb514f7a1244c0d79b4541b1dcb..0566ec14ab961b9cc7c5ca39206b51f47b7e51ee 100644 (file)
@@ -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;
 
@@ -1136,10 +1137,10 @@ void HUD_DrawScoreboard()
                                continue;
 
                        rgb = GetTeamRGB(tm.team);
-                       drawstring(pos - '9.5 0 0' * hud_fontsize_y + '0 1 0' * hud_fontsize_y, ftos(tm.(teamscores[ts_primary])), '1 1 0' * hud_fontsize_y * 1.5, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+                       drawstring(pos - '2 0 0' * hud_fontsize_x + '0 1 0' * hud_fontsize_y, ftos(tm.(teamscores[ts_primary])), '1 1 0' * hud_fontsize_y * 1.5, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
 
                        if(ts_primary != ts_secondary)
-                               drawstring(pos - '7.5 0 0' * hud_fontsize_y + '0 2.5 0' * hud_fontsize_y, ftos(tm.(teamscores[ts_secondary])), '1 1 0' * hud_fontsize_y * 1, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+                               drawstring(pos - '2 0 0' * hud_fontsize_x + '0 2.5 0' * hud_fontsize_y, ftos(tm.(teamscores[ts_secondary])), '1 1 0' * hud_fontsize_y * 1, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
 
                        pos = HUD_Scoreboard_MakeTable(pos, tm, rgb, bg_size);
                }
@@ -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 (file)
index 0000000..b39b48e
--- /dev/null
@@ -0,0 +1,2 @@
+float HUD_WouldDrawScoreboard(void);
+float scoreboard_fade_alpha;
index 5b0fa2b8caabc429fd3bdae394326bffb1ef616b..3db4e47be8d2e154732916bda9d1de44bee0cad8 100644 (file)
@@ -100,9 +100,9 @@ string GetAdvancedDeathReports(entity enPlayer) // Extra fragmessage information
 
        if(cvar("sv_fragmessage_information_ping")) {
                if(clienttype(enPlayer) == CLIENTTYPE_BOT) // Bots have no ping
-                       strMessage = strcat(strMessage, "\n^7(^2Bot");
+                       strMessage = strcat(strMessage, " ^7(^2Bot");
                else
-                       strMessage = strcat(strMessage, "\n^7(Ping ", strPlayerPingColor, ftos(nPlayerPing), "ms");
+                       strMessage = strcat(strMessage, " ^7(Ping ", strPlayerPingColor, ftos(nPlayerPing), "ms");
                if(cvar("sv_fragmessage_information_handicap"))
                        if(cvar("sv_fragmessage_information_handicap") == 2)
                                if(nPlayerHandicap <= 1)