From: FruitieX Date: Tue, 8 Jun 2010 18:09:17 +0000 (+0300) Subject: cvar time/fadetime, fix scoreboard X-Git-Tag: xonotic-v0.1.0preview~541^2~96 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=04ba1c5563c486d9b0c7a459cd57cb1a9c6d614b;p=xonotic%2Fxonotic-data.pk3dir.git cvar time/fadetime, fix scoreboard --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 286eb4313..560efb682 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1407,6 +1407,8 @@ seta hud_notify_bg_alpha "" "if set to something else than \"\" = override defau seta hud_notify_bg_border "" "if set to something else than \"\" = override default size of border around the background" seta hud_notify_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" seta hud_notify_print 0 "also con_notify print the messages that are shown on the notify panel" +seta hud_notify_time 5 "time that a new entry stays until it fades out" +seta hud_notify_fadetime 2 "fade out time" seta hud_timer 1 "enable/disable this panel" seta hud_timer_pos "-0.213725 0" "position of this base of the panel" @@ -1482,6 +1484,7 @@ seta hud_pressedkeys_bg_border "" "if set to something else than \"\" = override seta hud_pressedkeys_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" // scoreboard +seta scoreboard_columns default seta scoreboard_border_thickness 1 "scoreboard border thickness" seta scoreboard_accuracy_border_thickness 1 "accuracy stats border thickness" seta scoreboard_accuracy_doublerows 0 "use two rows instead of one" @@ -1615,9 +1618,8 @@ seta hud_fontsize 11 seta hud_fontsize_spec 16 seta scr_centersize 11 seta hud_width 560 -// alias hud_font "loadfont user1 ${1},gfx/fallback ${2-}; loadfont user2 ${1}-big ${2-}; hud_columns_set" +// alias hud_font "loadfont user1 ${1},gfx/fallback ${2-}; loadfont user2 ${1}-big ${2-}; scoreboard_columns_set" alias sbar_font "set _requested_sbar_font \"${*}\"" -seta hud_columns default sbar_font gfx/vera-sans 8 12 16 24 32 seta hud_showbinds 1 "display actions / bound keys in the strings shown during the game. 0 displays only actions, 1 displays only bound keys, 2 displays both" seta hud_showbinds_limit 2 "maximum number of bound keys to show for an action. 0 for unlimited" @@ -1665,8 +1667,8 @@ seta g_start_delay 0 "delay before the game starts, so everyone can join; recomm alias ons_map "cl_cmd radar" // legacy alias alias radar "cl_cmd radar" -alias hud_columns_set "cl_cmd hud_columns_set $*" -alias hud_columns_help "cl_cmd hud_columns_help $*" +alias scoreboard_columns_set "cl_cmd scoreboard_columns_set $*" +alias scoreboard_columns_help "cl_cmd scoreboard_columns_help $*" alias _gl_flashblend_update_00 "gl_flashblend 1" alias _gl_flashblend_update_10 "gl_flashblend 0" diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index a21bea985..e87c24900 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -113,7 +113,7 @@ void CSQC_Init(void) } #endif registercvar("hud_usecsqc", "1"); - registercvar("hud_columns", "default", CVAR_SAVE); + registercvar("scoreboard_columns", "default", CVAR_SAVE); gametype = 0; @@ -342,7 +342,7 @@ void TrueAim_Init(); void PostInit(void) { print(strcat("PostInit\n maxclients = ", ftos(maxclients), "\n")); - localcmd(strcat("\nhud_columns_set ", cvar_string("hud_columns"), ";\n")); + localcmd(strcat("\nscoreboard_columns_set ", cvar_string("scoreboard_columns"), ";\n")); entity playerchecker; playerchecker = spawn(); @@ -523,8 +523,8 @@ void GameCommand(string msg) { print("Usage: cl_cmd COMMAND..., where possible commands are:\n"); print(" settemp cvar value\n"); - print(" hud_columns_set ...\n"); - print(" hud_columns_help\n"); + print(" scoreboard_columns_set ...\n"); + print(" scoreboard_columns_help\n"); GameCommand_Generic("help"); return; } @@ -540,10 +540,10 @@ void GameCommand(string msg) else if(cmd == "settemp") { cvar_clientsettemp(argv(1), argv(2)); } - else if(cmd == "hud_columns_set") { + else if(cmd == "scoreboard_columns_set") { Cmd_HUD_SetFields(argc); } - else if(cmd == "hud_columns_help") { + else if(cmd == "scoreboard_columns_help") { Cmd_HUD_Help(argc); } #ifdef BLURTEST diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 6a9e8695c..77650a1bf 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -2398,17 +2398,30 @@ void HUD_Notify (void) float a; float when; - when = 5; + when = cvar("hud_notify_time"); float fadetime; - fadetime = 2; + fadetime = cvar("hud_notify_fadetime"); string s; float i; for(i = 0; i < entries; ++i) { - a = bound(0, when + (fadetime - (time - killnotify_times[i]))/fadetime, 1); - + if(fadetime) + { + if(killnotify_times[i] + when > time) + a = 1; + else + a = bound(0, (killnotify_times[i] + when + fadetime - time) / fadetime, 1); + } + else + { + if(killnotify_times[i] + when > time) + a = 1; + else + a = 0; + } + // X [did action to] Y if(WEP_VALID(killnotify_deathtype[i])) { diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index d575649ea..7214cb271 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -195,11 +195,11 @@ void HUD_UpdateTeamPos(entity Team) void Cmd_HUD_Help(float argc) { - print("You can modify the scoreboard using the ^2hud_columns_set command.\n"); + print("You can modify the scoreboard using the ^2scoreboard_columns_set command.\n"); print("^3|---------------------------------------------------------------|\n"); print("Usage:\n"); - print("^2hud_columns_set default\n"); - print("^2hud_columns_set ^7filed1 field2 ...\n"); + print("^2scoreboard_columns_set default\n"); + print("^2scoreboard_columns_set ^7filed1 field2 ...\n"); print("The following field names are recognized (case insensitive):\n"); print("You can use a ^3|^7 to start the right-aligned fields.\n\n"); @@ -237,7 +237,7 @@ void Cmd_HUD_Help(float argc) print("The special game type names 'teams' and 'noteams' can be used to\n"); print("include/exclude ALL teams/noteams game modes.\n\n"); - print("Example: hud_columns_set name ping pl | +ctf/field3 -dm/field4\n"); + print("Example: scoreboard_columns_set name ping pl | +ctf/field3 -dm/field4\n"); print("will display name, ping and pl aligned to the left, and the fields\n"); print("right of the vertical bar aligned to the right.\n"); print("'field3' will only be shown in CTF, and 'field4' will be shown in all\n"); @@ -266,7 +266,7 @@ void Cmd_HUD_SetFields(float argc) // TODO: re enable with gametype dependant cvars? if(argc < 2) // no arguments provided - argc = tokenizebyseparator(strcat("x ", cvar_string("hud_columns")), " "); + argc = tokenizebyseparator(strcat("x ", cvar_string("scoreboard_columns")), " "); if(argc < 2) argc = tokenizebyseparator(strcat("x ", HUD_DefaultColumnLayout()), " "); @@ -623,9 +623,9 @@ void HUD_PrintScoreboardItem(vector pos, entity pl, float is_self, float pl_numb is_spec = (GetPlayerColor(pl.sv_entnum) == COLOR_SPECTATOR); if((rgb == '1 1 1') && (!is_spec)) { - rgb_x = cvar("hud_color_bg_r") + 0.5; - rgb_y = cvar("hud_color_bg_g") + 0.5; - rgb_z = cvar("hud_color_bg_b") + 0.5; } + rgb_x = cvar("scoreboard_color_bg_r") + 0.5; + rgb_y = cvar("scoreboard_color_bg_g") + 0.5; + rgb_z = cvar("scoreboard_color_bg_b") + 0.5; } // Layout: tmp_x = sbwidth; @@ -892,7 +892,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size) float fontsize = 40 * 1/3; float weapon_cnt = 12; float rows; - if(cvar("hud_accuracy_doublerows")) + if(cvar("scoreboard_accuracy_doublerows")) rows = 2; else rows = 1; @@ -1001,9 +1001,9 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl, vector rgb, vector bg_ float is_spec; is_spec = (GetPlayerColor(pl.sv_entnum) == COLOR_SPECTATOR); vector hl_rgb; - hl_rgb_x = cvar("hud_color_bg_r") + 0.5; - hl_rgb_y = cvar("hud_color_bg_g") + 0.5; - hl_rgb_z = cvar("hud_color_bg_b") + 0.5; + hl_rgb_x = cvar("scoreboard_color_bg_r") + 0.5; + hl_rgb_y = cvar("scoreboard_color_bg_g") + 0.5; + hl_rgb_z = cvar("scoreboard_color_bg_b") + 0.5; pos_y += hud_fontsize_y; drawstring(pos, strcat("Rankings"), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); @@ -1124,9 +1124,9 @@ void HUD_DrawScoreboard() } else { - rgb_x = cvar("hud_color_bg_r"); - rgb_y = cvar("hud_color_bg_g"); - rgb_z = cvar("hud_color_bg_b"); + rgb_x = cvar("scoreboard_color_bg_r"); + rgb_y = cvar("scoreboard_color_bg_g"); + rgb_z = cvar("scoreboard_color_bg_b"); for(tm = teams.sort_next; tm; tm = tm.sort_next) { @@ -1148,7 +1148,7 @@ void HUD_DrawScoreboard() } pos = HUD_DrawScoreboardRankings(pos, pl, rgb, bg_size); } - else if(cvar("hud_accuracy") && spectatee_status != -1) { + else if(cvar("scoreboard_accuracy") && spectatee_status != -1) { if(teamplay) pos = HUD_DrawScoreboardAccuracyStats(pos, GetTeamRGB(myteam), bg_size); else