From: FruitieX Date: Mon, 11 Apr 2011 13:38:02 +0000 (+0300) Subject: Merge branch 'fruitiex/better_shownames' into terencehill/newpanelhud X-Git-Tag: xonotic-v0.5.0~305 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=28e574de4fbb3760e35fe59aa1fb53c1066ff0c9;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'fruitiex/better_shownames' into terencehill/newpanelhud Conflicts: _hud_descriptions.cfg defaultXonotic.cfg hud_luminos.cfg hud_luminos_minimal.cfg hud_luminos_xhair_minimal.cfg hud_nexuiz.cfg qcsrc/client/autocvars.qh qcsrc/client/hud.qc qcsrc/client/hud.qh qcsrc/common/constants.qh qcsrc/common/util.qh qcsrc/menu/xonotic/mainwindow.c --- 28e574de4fbb3760e35fe59aa1fb53c1066ff0c9 diff --cc _hud_descriptions.cfg index e4c669663,7ec11f8a4..09c35e37b --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@@ -220,17 -217,12 +220,29 @@@ seta hud_panel_infomessages_bg_border " seta hud_panel_infomessages_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" seta hud_panel_infomessages_flip "" "1 = align the items to the right" ++<<<<<<< HEAD +seta hud_panel_physics "" "enable/disable this panel, 1 = show if not observing, 2 = show always" +seta hud_panel_physics_pos "" "position of this base of the panel" +seta hud_panel_physics_size "" "size of this panel" +seta hud_panel_physics_bg "" "if set to something else than \"\" = override default background" +seta hud_panel_physics_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_panel_physics_bg_color_team "" "override panel color with team color in team based games" +seta hud_panel_physics_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" +seta hud_panel_physics_bg_border "" "if set to something else than \"\" = override default size of border around the background" +seta hud_panel_physics_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" +seta hud_panel_physics_baralign "" "0 = align bars to the left, 1 = align bars to the right, 2 = align only left bar to the right, 3 = align only right bar to the right, 4 = align bars to the center" +seta hud_panel_physics_flip "" "flip speed/acceleration positions" +seta hud_panel_physics_progressbar "" "enable progressbar in panel (2 = only for speed; 3 = only for acceleration)" +seta hud_panel_physics_acceleration_progressbar_mode "" "0 = progressbar increases from the center to the right if the acceleration is positive, to the left if it's negative; 1 = progressbar increases from the border in the same direction for both positive and negative accelerations" +seta hud_panel_physics_text "" "show text in panel (2 = only for speed; 3 = only for acceleration)" ++======= + seta hud_panel_shownames "" "enable/disable this panel, 1 = teammates only, 2 = everyone" + seta hud_panel_shownames_pos "" "position of this base of the panel" + seta hud_panel_shownames_size "" "size of this panel" + seta hud_panel_shownames_bg "" "if set to something else than \"\" = override default background" + seta hud_panel_shownames_bg_color "" "if set to something else than \"\" = override default panel background color" + seta hud_panel_shownames_bg_color_team "" "override panel color with team color in team based games" + seta hud_panel_shownames_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" + seta hud_panel_shownames_bg_border "" "if set to something else than \"\" = override default size of border around the background" + seta hud_panel_shownames_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" ++>>>>>>> fruitiex/better_shownames diff --cc defaultXonotic.cfg index f0016dfcd,3501e8084..ffd314825 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@@ -1444,16 -1439,9 +1444,18 @@@ seta hud_panel_engineinfo_framecounter_ seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_new_weight 0.1 "weight of latest data point" seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold 0.5 "threshold for fps change when to update instantly, to make big fps changes update faster" +seta hud_panel_physics_speed_unit 3 "speed unit (1 = qu/s, 2 = m/s, 3 = km/h, 4 = mph, 5 = knots)" +seta hud_panel_physics_speed_unit_show 1 "also show speed unit" +seta hud_panel_physics_speed_max 1800 "speed progressbar gets filled up completely by this value (in qu/s)" +seta hud_panel_physics_speed_vertical 0 "include the speed on the Z-axis" +seta hud_panel_physics_topspeed 1 "also show top speed" +seta hud_panel_physics_topspeed_time 4 "how many seconds the top speed takes to fade out" +seta hud_panel_physics_acceleration_max 1.5 "acceleration progressbar gets completely filled up by this value (in g)" +seta hud_panel_physics_acceleration_vertical 0 "include the acceleration on the Z-axis" + + seta hud_panel_shownames_sustain 0.5 "seconds that shownames will sustain after not aiming at a player anymore" + -seta hud_showbinds 1 "the way to show the keys to press in HUD messages: 0 displays commands, 1 bound keys, 2 both" +seta hud_showbinds 1 "what to show in the HUD to indicate certain keys to press: 0 display commands, 1 bound keys, 2 both" seta hud_showbinds_limit 2 "maximum number of bound keys to show for a command. 0 for unlimited" seta hud_colorflash_alpha 0.5 "starting alpha of the color flash" diff --cc hud_luminos.cfg index 836641e9e,90f18262b..de45c8609 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@@ -19,11 -19,8 +19,11 @@@ seta hud_progressbar_health_color "0.6 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_progressbar_speed_color "1 0.75 0" +seta hud_progressbar_acceleration_color "0.5 0.75 1" +seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" - seta _hud_panelorder "10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 15 " + seta _hud_panelorder "15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 " seta hud_configure_grid "1" seta hud_configure_grid_xsize "0.010000" @@@ -218,19 -215,14 +218,29 @@@ seta hud_panel_infomessages_bg_border " seta hud_panel_infomessages_bg_padding "0" seta hud_panel_infomessages_flip "1" +seta hud_panel_physics 0 +seta hud_panel_physics_pos "0.410000 0.590000" +seta hud_panel_physics_size "0.180000 0.100000" +seta hud_panel_physics_bg "" +seta hud_panel_physics_bg_color "" +seta hud_panel_physics_bg_color_team "" +seta hud_panel_physics_bg_alpha "" +seta hud_panel_physics_bg_border "" +seta hud_panel_physics_bg_padding "" +seta hud_panel_physics_flip "0" +seta hud_panel_physics_baralign "0" +seta hud_panel_physics_acceleration_progressbar_mode "0" +seta hud_panel_physics_progressbar "1" +seta hud_panel_physics_text "1" + + seta hud_panel_shownames 1 + seta hud_panel_shownames_pos "0.350000 0.700000" + seta hud_panel_shownames_size "0.300000 0.050000" + seta hud_panel_shownames_bg "0" + seta hud_panel_shownames_bg_color "" + seta hud_panel_shownames_bg_color_team "" + seta hud_panel_shownames_bg_alpha "" + seta hud_panel_shownames_bg_border "" + seta hud_panel_shownames_bg_padding "0" + menu_sync diff --cc hud_luminos_xhair_minimal.cfg index 5f769f8f1,6c95c17d7..55a1149e9 --- a/hud_luminos_xhair_minimal.cfg +++ b/hud_luminos_xhair_minimal.cfg @@@ -19,11 -19,8 +19,11 @@@ seta hud_progressbar_health_color "0.6 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_progressbar_speed_color "1 0.75 0" +seta hud_progressbar_acceleration_color "0.5 0.75 1" +seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" - seta _hud_panelorder "3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 15 " + seta _hud_panelorder "15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 " seta hud_configure_grid "1" seta hud_configure_grid_xsize "0.010000" diff --cc hud_nexuiz.cfg index 5f8127f27,1f012d78c..87bebc5d0 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@@ -19,11 -19,8 +19,11 @@@ seta hud_progressbar_health_color "0.6 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_progressbar_speed_color "0.25 0.25 1" +seta hud_progressbar_acceleration_color "0.25 1 0.25" +seta hud_progressbar_acceleration_neg_color "1 0.25 0.25" - seta _hud_panelorder "0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 15 " + seta _hud_panelorder "15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 " seta hud_configure_grid "1" seta hud_configure_grid_xsize "0.01" diff --cc qcsrc/client/autocvars.qh index 79dc7237a,762472fcc..b9ea7b4ba --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@@ -241,7 -237,8 +241,9 @@@ float autocvar_hud_panel_radar_rotation float autocvar_hud_panel_radar_scale; float autocvar_hud_panel_radar_zoommode; float autocvar_hud_panel_score; +float autocvar_hud_panel_score_rankings; + float autocvar_hud_panel_shownames; + float autocvar_hud_panel_shownames_sustain; float autocvar_hud_panel_timer; float autocvar_hud_panel_timer_increment; float autocvar_hud_panel_vote; diff --cc qcsrc/client/hud.qc index 580637b65,35de11ccb..fbde7368c --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@@ -4208,37 -5005,106 +4208,117 @@@ void HUD_InfoMessages(void } } - // Physics panel (#15) + // ShowNames (#15) + // + float shownames_alpha; + void HUD_ShowNames(void) + { + if(shownames_time < time && shownames_alpha == 0 && !autocvar__hud_configure) + return; + + if(autocvar__hud_configure) + { + shownames_alpha = 1; + } + else + { + if(shownames_time < time) + shownames_alpha = bound(0, shownames_alpha - 2 * frametime, 1); + else + shownames_alpha = bound(0, shownames_alpha + 4 * frametime, 1); + } + + if(!autocvar_hud_panel_shownames && !autocvar__hud_configure) + return; + - active_panel = HUD_PANEL_SHOWNAMES; ++ hud_configure_active_panel = HUD_PANEL_SHOWNAMES; + HUD_Panel_UpdateCvars(shownames); + panel_fg_alpha *= shownames_alpha; + vector myPos, mySize; + myPos = panel_pos; + mySize = panel_size; + + HUD_Panel_DrawBg(shownames_alpha); + if(panel_bg_padding) + { + myPos += '1 1 0' * panel_bg_padding; + mySize -= '2 2 0' * panel_bg_padding; + } + + vector iconpos, iconsize; + vector namepos, namesize; + if(mySize_x/mySize_y > 6) + { + iconpos = myPos; + iconsize = eX * 2 * mySize_y + eY * mySize_y; + + namepos = myPos + eX * 2 * mySize_y; + namesize = eX * mySize_x - eX * 2 * mySize_y + eY * mySize_y; + } + else + { + iconpos = myPos + eX * 0.5 * mySize_x - eX * 0.5 * mySize_y; + iconsize = eX * mySize_y + eY * 0.5 * mySize_y; + + namepos = myPos + eY * 0.5 * mySize_y; + namesize = eX * mySize_x + eY * 0.5 * mySize_y; + } + + if(shownames_health > 0) // otherwise player is an enemy + { + // "ghost" backgrounds + drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '0 0 0', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL); + drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '0 0 0', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL); + + drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, shownames_health/200), vid_conwidth, myPos_y + iconsize_y); + drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + + drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, shownames_armor/200), vid_conwidth, myPos_y + iconsize_y); + drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawresetcliparea(); + } + else + { + drawpic_aspect_skin(iconpos, "health_unknown", '1 1 0' * iconsize_y, '0 0 0', panel_fg_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor_unknown", '1 1 0' * iconsize_y, '0 0 0', panel_fg_alpha, DRAWFLAG_NORMAL); + } + + if(autocvar__hud_configure) + drawcolorcodedstring_aspect(namepos, "Player1234", namesize, panel_fg_alpha, DRAWFLAG_NORMAL); + else + drawcolorcodedstring_aspect(namepos, shownames_netname, namesize, panel_fg_alpha, DRAWFLAG_NORMAL); + } + -/* -================== -Main HUD system -================== -*/ - -void HUD_ShowSpeed(void) ++// Physics panel (#16) +// +vector acc_prevspeed; +float acc_prevtime, acc_avg, top_speed, top_speed_time; - +void HUD_Physics(void) { - vector numsize; - float pos, conversion_factor; - string speed, zspeed, unit; + if(!autocvar__hud_configure) + { + if(!autocvar_hud_panel_physics) return; + if(spectatee_status == -1 && autocvar_hud_panel_physics < 2) return; + } + else + hud_configure_active_panel = HUD_PANEL_PHYSICS; + + HUD_Panel_UpdateCvars(physics); + + HUD_Panel_DrawBg(1); + if(panel_bg_padding) + { + panel_pos += '1 1 0' * panel_bg_padding; + panel_size -= '2 2 0' * panel_bg_padding; + } + + //compute speed + float speed, conversion_factor; + string unit; - switch(autocvar_cl_showspeed_unit) + switch(autocvar_hud_panel_physics_speed_unit) { default: - case 0: - unit = ""; - conversion_factor = 1.0; - break; case 1: unit = _(" qu/s"); conversion_factor = 1.0; @@@ -4481,8 -5226,8 +4561,10 @@@ switch (id) { HUD_EngineInfo(); break;\ case (HUD_PANEL_INFOMESSAGES):\ HUD_InfoMessages(); break;\ + case (HUD_PANEL_PHYSICS):\ + HUD_Physics(); break;\ + case (HUD_PANEL_SHOWNAMES):\ + HUD_ShowNames(); break;\ } ENDS_WITH_CURLY_BRACE void HUD_Main (void) diff --cc qcsrc/client/hud.qh index f46f5873f,d0c1b1a90..0f9c8bb44 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@@ -275,11 -266,14 +275,15 @@@ if(menu_enabled == 2 && hud_configure_a HUD_Panel_GetMenuPos()\ } ENDS_WITH_CURLY_BRACE + // FTEQCC I HATE YOU WHY DO YOU MAKE ME DO THIS??? :( + // max macro length is 1024 characters, I must split it up :( + // Update all common cvars of given panel id -#define HUD_Panel_UpdateCvarsForId2(id) \ +#define HUD_Panel_UpdateCvarsForId_Part2(id) \ switch(id) { \ case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdateCvars(infomessages) break; \ + case HUD_PANEL_PHYSICS: HUD_Panel_UpdateCvars(physics); break;\ + case HUD_PANEL_SHOWNAMES: HUD_Panel_UpdateCvars(shownames) break; \ } #define HUD_Panel_UpdateCvarsForId(id) \ @@@ -313,11 -307,12 +317,13 @@@ panel_bg_border_str = cvar_string("hud_ HUD_Panel_GetBorder() // Update pos and size of given panel id -#define HUD_Panel_UpdatePosSizeForId2(id) \ +#define HUD_Panel_UpdatePosSizeForId_Part2(id) \ switch(id) { \ - case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdatePosSize(infomessages)\ + case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdatePosSize(infomessages) break;\ + case HUD_PANEL_PHYSICS: HUD_Panel_UpdatePosSize(physics); break;\ + case HUD_PANEL_SHOWNAMES: HUD_Panel_UpdatePosSize(shownames)\ } + #define HUD_Panel_UpdatePosSizeForId(id) \ switch(id) { \ case HUD_PANEL_WEAPONS: HUD_Panel_UpdatePosSize(weapons) break;\ diff --cc qcsrc/common/constants.qh index 295cc664f,9ea8a5e75..13c1bc824 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@@ -633,7 -628,7 +634,6 @@@ float WR_RESETPLAYER = 10; // (SVQC float WR_IMPACTEFFECT = 11; // (CSQC) impact effect float WR_SWITCHABLE = 12; // (CSQC) impact effect -- float HUD_PANEL_WEAPONS = 0; float HUD_PANEL_AMMO = 1; float HUD_PANEL_POWERUPS = 2; @@@ -649,8 -644,8 +649,9 @@@ float HUD_PANEL_PRESSEDKEYS = 11 float HUD_PANEL_CHAT = 12; float HUD_PANEL_ENGINEINFO = 13; float HUD_PANEL_INFOMESSAGES = 14; -float HUD_PANEL_SHOWNAMES = 15; -float HUD_PANEL_NUM = 16; // always last panel id + 1, please increment when adding a new panel +float HUD_PANEL_PHYSICS = 15; - float HUD_PANEL_NUM = 16; // always last panel id + 1, please increment when adding a new panel ++float HUD_PANEL_SHOWNAMES = 16; ++float HUD_PANEL_NUM = 17; // always last panel id + 1, please increment when adding a new panel string HUD_PANELNAME_WEAPONS = "weapons"; string HUD_PANELNAME_AMMO = "ammo"; @@@ -667,7 -662,9 +668,10 @@@ string HUD_PANELNAME_PRESSEDKEYS = "pr string HUD_PANELNAME_CHAT = "chat"; string HUD_PANELNAME_ENGINEINFO = "engineinfo"; string HUD_PANELNAME_INFOMESSAGES = "infomessages"; +string HUD_PANELNAME_PHYSICS = "physics"; + string HUD_PANELNAME_SHOWNAMES = "shownames"; + + float HUD_MENU_ENABLE = 0; #define SERVERFLAG_ALLOW_FULLBRIGHT 1 #define SERVERFLAG_TEAMPLAY 2 diff --cc qcsrc/common/util.qh index 00c65227f,56a24e690..3b6033f6f --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@@ -219,7 -219,7 +219,8 @@@ float get_model_parameters(string mod, switch(id) {\ case HUD_PANEL_ENGINEINFO: panel_name = HUD_PANELNAME_ENGINEINFO; break; \ case HUD_PANEL_INFOMESSAGES: panel_name = HUD_PANELNAME_INFOMESSAGES; break; \ + case HUD_PANEL_PHYSICS: panel_name = HUD_PANELNAME_PHYSICS; break; \ + case HUD_PANEL_SHOWNAMES: panel_name = HUD_PANELNAME_SHOWNAMES; break; \ } ENDS_WITH_CURLY_BRACE // Get name of specified panel id @@@ -238,8 -238,8 +239,8 @@@ switch(id) { case HUD_PANEL_MODICONS: panel_name = HUD_PANELNAME_MODICONS; break; \ case HUD_PANEL_PRESSEDKEYS: panel_name = HUD_PANELNAME_PRESSEDKEYS; break; \ case HUD_PANEL_CHAT: panel_name = HUD_PANELNAME_CHAT; break; \ --}\ --HUD_Panel_GetName_Part2(id) ++ default: HUD_Panel_GetName_Part2(id)\ ++} vector vec2(vector v); diff --cc qcsrc/menu/classes.c index 61f5a4877,c93fda6f9..80aae373c --- a/qcsrc/menu/classes.c +++ b/qcsrc/menu/classes.c @@@ -102,6 -102,6 +102,7 @@@ #include "xonotic/dialog_hudpanel_chat.c" #include "xonotic/dialog_hudpanel_engineinfo.c" #include "xonotic/dialog_hudpanel_infomessages.c" + #include "xonotic/dialog_hudpanel_shownames.c" #include "xonotic/dialog_hudpanel_weapons.c" +#include "xonotic/dialog_hudpanel_physics.c" #include "xonotic/slider_picmip.c" diff --cc qcsrc/menu/xonotic/mainwindow.c index feec5a9b9,379646db7..1d7d50d87 --- a/qcsrc/menu/xonotic/mainwindow.c +++ b/qcsrc/menu/xonotic/mainwindow.c @@@ -114,10 -114,10 +114,14 @@@ void MainWindow_configureMainWindow(ent i.configureDialog(i); me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + i = spawnXonoticHUDPhysicsDialog(); + i.configureDialog(i); + me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + + i = spawnXonoticHUDShownamesDialog(); + i.configureDialog(i); + me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + me.advancedDialog = i = spawnXonoticAdvancedDialog(); i.configureDialog(i); me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);