* This panel shows the weapon or item that has been just picked up, with its icon, item name, and time of pickup.
* The time of pickup can be hidden by the client or the server (default in XPM ruleset).
* If you pick up the same item several times in a row it will show (x2, x3...) in parentheses.
* Display time, fade out time and icon size can all be configured. The size of its contents automatically change size to fit the panel size.
seta hud_panel_scoreboard_ctf_leaderboard 1 "show a capture time rankings leaderboard in the scoreboard if allowed by the server"
seta hud_panel_scoreboard_itemstats 1 "show item stats panel in the scoreboard"
seta hud_panel_strafehud 3 "enable this panel, 1 = show if not observing, 2 = show always, 3 = show only in race/cts if not observing"
+seta hud_panel_pickup 1 "enable this panel"
seta hud_panel_weapons_dynamichud 1 "apply the dynamic hud effects to this panel"
seta hud_panel_ammo_dynamichud 1 "apply the dynamic hud effects to this panel"
seta hud_panel_itemstime_dynamichud 1 "apply the dynamic hud effects to this panel"
seta hud_panel_scoreboard_dynamichud 0 "apply the dynamic hud effects to this panel"
seta hud_panel_strafehud_dynamichud 1 "apply the dynamic hud effects to this panel"
+seta hud_panel_pickup_dynamichud 1 "apply the dynamic hud effects to this panel"
seta hud_panel_weapons_ammo_full_shells 60 "show 100% of the status bar at this ammo count"
seta hud_panel_weapons_ammo_full_nails 320 "show 100% of the status bar at this ammo count"
seta hud_shownames_antioverlap 1 "if two tags overlap, fade out the one further away from you"
seta hud_shownames_antioverlap_minalpha 0.4 "fade out overlapping tags to this alpha value"
seta hud_shownames_offset 52 "offset (along z-axis) tag from player origin by this many units"
+
+seta hud_panel_pickup_showtimer 1 "0 = hide timer, 1 = show timer, 2 = only when spectating"
+seta hud_panel_pickup_iconsize 1.5 "icon size scale"
+seta hud_panel_pickup_time 3 "pickup message duration (can't be higher than 5)"
+seta hud_panel_pickup_fade_out 0.15 "how long a pickup message takes to fade out (this time is included in the message duration)"
seta hud_panel_strafehud_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
seta hud_panel_strafehud_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_strafehud_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
+
+seta hud_panel_pickup_pos "" "position of this base of the panel"
+seta hud_panel_pickup_size "" "size of this panel"
+seta hud_panel_pickup_bg "" "if set to something else than \"\" = override default background"
+seta hud_panel_pickup_bg_color "" "if set to something else than \"\" = override default panel background color"
+seta hud_panel_pickup_bg_color_team "" "override panel color with team color in team based games"
+seta hud_panel_pickup_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
+seta hud_panel_pickup_bg_border "" "if set to something else than \"\" = override default size of border around the background"
+seta hud_panel_pickup_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
seta hud_progressbar_vehicles_ammo1_color "0.77 0.67 0"
seta hud_progressbar_vehicles_ammo2_color "0.86 0.35 0"
-seta _hud_panelorder "17 25 15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 24 "
+seta _hud_panelorder "17 25 15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 24 25 26 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.005000"
seta hud_panel_strafehud_bg_border ""
seta hud_panel_strafehud_bg_padding ""
+seta hud_panel_pickup_pos "0.010000 0.945000"
+seta hud_panel_pickup_size "0.260000 0.035000"
+seta hud_panel_pickup_bg "0"
+seta hud_panel_pickup_bg_color ""
+seta hud_panel_pickup_bg_color_team ""
+seta hud_panel_pickup_bg_alpha "1"
+seta hud_panel_pickup_bg_border ""
+seta hud_panel_pickup_bg_padding ""
+
menu_sync
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 25 15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 24 "
+seta _hud_panelorder "17 25 15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 24 25 26 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_strafehud_bg_border ""
seta hud_panel_strafehud_bg_padding ""
+seta hud_panel_pickup_pos "0.010000 0.950000"
+seta hud_panel_pickup_size "0.260000 0.030000"
+seta hud_panel_pickup_bg "0"
+seta hud_panel_pickup_bg_color ""
+seta hud_panel_pickup_bg_color_team ""
+seta hud_panel_pickup_bg_alpha "1"
+seta hud_panel_pickup_bg_border ""
+seta hud_panel_pickup_bg_padding ""
+
menu_sync
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 25 15 16 18 23 19 20 21 22 24 "
+seta _hud_panelorder "17 10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 25 15 16 18 23 19 20 21 22 24 25 26 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
-seta hud_panel_vote_pos "0 0.890000"
+seta hud_panel_vote_pos "0.720000 0.890000"
seta hud_panel_vote_size "0.170000 0.110000"
seta hud_panel_vote_bg ""
seta hud_panel_vote_bg_color ""
seta hud_panel_strafehud_bg_border ""
seta hud_panel_strafehud_bg_padding ""
+seta hud_panel_pickup_pos "0 0.960000"
+seta hud_panel_pickup_size "0.270000 0.030000"
+seta hud_panel_pickup_bg "0"
+seta hud_panel_pickup_bg_color ""
+seta hud_panel_pickup_bg_color_team ""
+seta hud_panel_pickup_bg_alpha "1"
+seta hud_panel_pickup_bg_border ""
+seta hud_panel_pickup_bg_padding ""
+
menu_sync
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 25 15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 18 23 19 20 21 22 24 "
+seta _hud_panelorder "17 25 15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 18 23 19 20 21 22 24 25 26 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
-seta hud_panel_vote_pos "0 0.890000"
+seta hud_panel_vote_pos "0.720000 0.890000"
seta hud_panel_vote_size "0.170000 0.110000"
seta hud_panel_vote_bg ""
seta hud_panel_vote_bg_color ""
seta hud_panel_strafehud_bg_border ""
seta hud_panel_strafehud_bg_padding ""
+seta hud_panel_pickup_pos "0 0.960000"
+seta hud_panel_pickup_size "0.270000 0.030000"
+seta hud_panel_pickup_bg "0"
+seta hud_panel_pickup_bg_color ""
+seta hud_panel_pickup_bg_color_team ""
+seta hud_panel_pickup_bg_alpha "1"
+seta hud_panel_pickup_bg_border ""
+seta hud_panel_pickup_bg_padding ""
+
menu_sync
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 25 15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 18 23 19 20 21 22 24 "
+seta _hud_panelorder "17 25 15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 18 23 19 20 21 22 24 25 26 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_strafehud_bg_border ""
seta hud_panel_strafehud_bg_padding ""
+seta hud_panel_pickup_pos "0.700000 0.940000"
+seta hud_panel_pickup_size "0.260000 0.040000"
+seta hud_panel_pickup_bg "0"
+seta hud_panel_pickup_bg_color ""
+seta hud_panel_pickup_bg_color_team ""
+seta hud_panel_pickup_bg_alpha "1"
+seta hud_panel_pickup_bg_border ""
+seta hud_panel_pickup_bg_padding ""
+
menu_sync
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 25 15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 18 23 19 20 21 22 24 "
+seta _hud_panelorder "17 25 15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 18 23 19 20 21 22 24 25 26 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_pressedkeys_aspect "1.8"
seta hud_panel_pressedkeys_attack "0"
-seta hud_panel_chat_pos "0 0.760000"
+seta hud_panel_chat_pos "0 0.730000"
seta hud_panel_chat_size "0.420000 0.130000"
seta hud_panel_chat_bg "0"
seta hud_panel_chat_bg_color ""
seta hud_panel_strafehud_bg_border ""
seta hud_panel_strafehud_bg_padding ""
+seta hud_panel_pickup_pos "0.010000 0.860000"
+seta hud_panel_pickup_size "0.330000 0.030000"
+seta hud_panel_pickup_bg "0"
+seta hud_panel_pickup_bg_color ""
+seta hud_panel_pickup_bg_color_team ""
+seta hud_panel_pickup_bg_alpha "1"
+seta hud_panel_pickup_bg_border ""
+seta hud_panel_pickup_bg_padding ""
+
menu_sync
float weapontime;
float weaponprevtime;
+float timer;
float teamnagger;
int hudShiftState;
REGISTER_HUD_PANEL(QUICKMENU, HUD_QuickMenu, PANEL_CONFIG_MAIN , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME ) // QUICKMENU
REGISTER_HUD_PANEL(SCOREBOARD, Scoreboard_Draw, PANEL_CONFIG_NO , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // SCOREBOARD
REGISTER_HUD_PANEL(STRAFEHUD, HUD_StrafeHUD, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME ) // STRAFEHUD
+REGISTER_HUD_PANEL(PICKUP, HUD_Pickup, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME ) // PICKUP
// always add new panels to the end of list
// Because calling lots of functions in QC apparently cuts fps in half on many machines:
#include <client/hud/panel/modicons.qc>
#include <client/hud/panel/notify.qc>
#include <client/hud/panel/physics.qc>
+#include <client/hud/panel/pickup.qc>
#include <client/hud/panel/powerups.qc>
#include <client/hud/panel/pressedkeys.qc>
#include <client/hud/panel/quickmenu.qc>
#include <client/hud/panel/modicons.qh>
#include <client/hud/panel/notify.qh>
#include <client/hud/panel/physics.qh>
+#include <client/hud/panel/pickup.qh>
#include <client/hud/panel/powerups.qh>
#include <client/hud/panel/pressedkeys.qh>
#include <client/hud/panel/quickmenu.qh>
--- /dev/null
+#include "pickup.qh"
+
+#include <client/draw.qh>
+#include <client/hud/hud.qh>
+#include <client/hud/panel/timer.qh>
+#include <common/items/inventory.qh>
+
+// Pickup (#26)
+
+void HUD_Pickup_Export(int fh)
+{
+ // allow saving cvars that aesthetically change the panel into hud skin files
+}
+
+void Pickup_Update(entity it, int count)
+{
+ if(last_pickup_item != it || time - STAT(LAST_PICKUP) > autocvar_hud_panel_pickup_time)
+ last_pickup_count = 0;
+ last_pickup_item = it;
+ last_pickup_count += count;
+}
+
+float HUD_Pickup_Time(float t)
+{
+ float timelimit = (warmup_stage ? STAT(WARMUP_TIMELIMIT) : STAT(TIMELIMIT) * 60);
+
+ if(autocvar_hud_panel_timer_increment || timelimit <= 0)
+ return floor(t - STAT(GAMESTARTTIME));
+ else
+ return ceil(timelimit + STAT(GAMESTARTTIME) - t);
+}
+
+void HUD_Pickup()
+{
+ if(!autocvar_hud_panel_pickup) return;
+
+ HUD_Panel_LoadCvars();
+ vector pos, mySize;
+ pos = panel_pos;
+ mySize = panel_size;
+
+ if (autocvar_hud_panel_pickup_dynamichud)
+ HUD_Scale_Enable();
+ else
+ HUD_Scale_Disable();
+ HUD_Panel_DrawBg();
+ if(panel_bg_padding)
+ {
+ pos += '1 1 0' * panel_bg_padding;
+ mySize -= '2 2 0' * panel_bg_padding;
+ }
+
+ float last_pickup_time = STAT(LAST_PICKUP);
+ float display_time = min(5, autocvar_hud_panel_pickup_time);
+ entity it = last_pickup_item;
+
+ if((last_pickup_time && last_pickup_time > time - display_time && it) || autocvar__hud_configure) {
+ string str_timer, str_name, icon;
+ vector sz, sz2;
+ vector fontsize = '1 1 0' * mySize.y;
+ vector iconsize = fontsize * autocvar_hud_panel_pickup_iconsize;
+
+ if(autocvar__hud_configure)
+ icon = strcat(hud_skin_path, "/armor_mega");
+ else
+ icon = strcat(hud_skin_path, "/", ((it.model2) ? it.model2 : it.m_icon));
+
+ sz = draw_getimagesize(icon);
+ sz2 = vec2(iconsize.y*(sz.x/sz.y), iconsize.y);
+ if(autocvar__hud_configure)
+ str_name = "Mega armor";
+ else
+ str_name = ((last_pickup_count > 1) ? sprintf("%s (x%d)", it.m_name, last_pickup_count) : it.m_name);
+
+ float a;
+ float fade_out_time = min(display_time, autocvar_hud_panel_pickup_fade_out);
+
+ if(autocvar__hud_configure)
+ a = 1;
+ else if(time < last_pickup_time + display_time - fade_out_time)
+ a = 1;
+ else
+ a = (last_pickup_time + display_time - time) / fade_out_time;
+
+ if(autocvar_hud_panel_pickup_showtimer) {
+ // 1 will show the timer always
+ // 2 will show the timer only if spectating
+ // forbid serverflag will force the 2nd behavior
+ if((autocvar_hud_panel_pickup_showtimer == 1 && !(serverflags & SERVERFLAG_FORBID_PICKUPTIMER)) || spectatee_status)
+ {
+ if(autocvar__hud_configure)
+ str_timer = "13:02";
+ else
+ str_timer = seconds_tostring(HUD_Pickup_Time(last_pickup_time));
+ drawstring(pos, str_timer, fontsize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
+ pos.x += stringwidth(str_timer, false, fontsize) + fontsize.x * 0.25;
+ }
+ }
+
+ drawpic(pos - eY * ((iconsize.y - fontsize.y) / 2), icon, sz2, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
+ pos.x += sz2.x + fontsize.x * 0.25;
+ str_name = textShortenToWidth(str_name, mySize.x - (pos.x - panel_pos.x), fontsize, stringwidth_nocolors);
+ drawstring(pos, str_name, fontsize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
+ }
+}
--- /dev/null
+#pragma once
+#include "../panel.qh"
+
+bool autocvar_hud_panel_pickup;
+bool autocvar_hud_panel_pickup_dynamichud = true;
+int autocvar_hud_panel_pickup_showtimer = 1;
+float autocvar_hud_panel_pickup_iconsize = 1.5;
+float autocvar_hud_panel_pickup_time = 3;
+float autocvar_hud_panel_pickup_fade_out = 0.15;
+
+entity last_pickup_item;
+int last_pickup_count;
+
+void Pickup_Update(entity it, int count);
mySize -= '2 2 0' * panel_bg_padding;
}
- string timer;
- string subtimer = string_null;
+ string timer_str = string_null;
+ string subtimer_str = string_null;
string subtext = string_null;
float curtime, timelimit, timeleft;
vector timer_size, subtext_size, subtimer_size;
// Use real or frozen time and get the time limit
curtime = (intermission_time ? intermission_time : time);
- if(warmup_stage)
- timelimit = STAT(WARMUP_TIMELIMIT);
- else
- timelimit = STAT(TIMELIMIT) * 60;
+ timelimit = (warmup_stage ? STAT(WARMUP_TIMELIMIT) : STAT(TIMELIMIT) * 60);
// Calculate time left
timeleft = HUD_Timer_TimeLeft(curtime, STAT(GAMESTARTTIME), timelimit);
// Timer text
if (autocvar_hud_panel_timer_increment || timelimit <= 0)
- timer = seconds_tostring(HUD_Timer_TimeElapsed(curtime, STAT(GAMESTARTTIME)));
+ timer = HUD_Timer_TimeElapsed(curtime, STAT(GAMESTARTTIME));
else
- timer = seconds_tostring(timeleft);
+ timer = timeleft;
// Secondary timer for round-based game modes
if(STAT(ROUNDSTARTTIME) && autocvar_hud_panel_timer_secondary)
{
if(STAT(ROUNDSTARTTIME) == -1) {
// Round can't start
- subtimer = "--:--";
+ subtimer_str = "--:--";
subtimer_color = '1 0 0';
} else {
float round_curtime, round_timelimit, round_timeleft;
// Subtimer text
if (autocvar_hud_panel_timer_increment || round_timelimit <= 0)
- subtimer = seconds_tostring(HUD_Timer_TimeElapsed(round_curtime, STAT(ROUNDSTARTTIME)));
+ subtimer_str = seconds_tostring(HUD_Timer_TimeElapsed(round_curtime, STAT(ROUNDSTARTTIME)));
else
- subtimer = seconds_tostring(round_timeleft);
+ subtimer_str = seconds_tostring(round_timeleft);
}
}
subtext_size = vec2(mySize.x, mySize.y / 3);
timer_size = vec2(mySize.x, mySize.y - subtext_size.y);
subtimer_size = vec2(mySize.x / 3, mySize.y - subtext_size.y);
+ timer_str = seconds_tostring(timer);
panel_size.y -= subtext_size.y;
HUD_Panel_DrawBg();
- if(subtimer) {
+ if(subtimer_str) {
float subtimer_padding = subtimer_size.y / 5;
timer_size.x -= subtimer_size.x;
- drawstring_aspect(pos + eX * timer_size.x + eY * subtimer_padding, (swap ? timer : subtimer), subtimer_size - eY * subtimer_padding * 2, (swap ? timer_color : subtimer_color), panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + eX * timer_size.x + eY * subtimer_padding, (swap ? timer_str : subtimer_str), subtimer_size - eY * subtimer_padding * 2, (swap ? timer_color : subtimer_color), panel_fg_alpha, DRAWFLAG_NORMAL);
}
- drawstring_aspect(pos, (swap ? subtimer : timer), timer_size, (swap ? subtimer_color : timer_color), panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos, (swap ? subtimer_str : timer_str), timer_size, (swap ? subtimer_color : timer_color), panel_fg_alpha, DRAWFLAG_NORMAL);
if(subtext)
drawstring_aspect(pos + eY * timer_size.y, subtext, subtext_size, '0 1 0', panel_fg_alpha, DRAWFLAG_NORMAL);
const int SERVERFLAG_TEAMPLAY = BIT(1);
const int SERVERFLAG_PLAYERSTATS = BIT(2);
const int SERVERFLAG_PLAYERSTATS_CUSTOM = BIT(3);
+const int SERVERFLAG_FORBID_PICKUPTIMER = BIT(4);
const int SPECIES_HUMAN = 0;
const int SPECIES_ROBOT_SOLID = 1;
#endif
#ifdef CSQC
+#include <client/hud/panel/pickup.qh>
+
Inventory g_inventory;
+
void Inventory_remove(entity this)
{
if(g_inventory == this)
.int fld = inv_items[it.m_id];
int prev = this.(fld);
int next = this.(fld) = ReadByte();
+
+ Pickup_Update(it, next - prev);
LOG_DEBUGF("%s: %.0f -> %.0f", it.m_name, prev, next);
}
}
return true;
}
+
+NET_HANDLE(TE_CSQC_WEAPONPICKUP, bool isnew)
+{
+ const Weapon it = REGISTRY_GET(Weapons, ReadByte());
+ Pickup_Update(it, 1);
+ return true;
+}
#endif
#ifdef SVQC
this.m_model = MDL_Shells_ITEM;
#endif
this.netname = "shells";
- this.m_name = _("shells");
+ this.m_name = _("Shells");
this.m_icon = "ammo_shells";
#ifdef SVQC
this.m_botvalue = 1000;
this.m_model = MDL_Bullets_ITEM;
#endif
this.netname = "bullets";
- this.m_name = _("bullets");
+ this.m_name = _("Bullets");
this.m_icon = "ammo_bullets";
#ifdef SVQC
this.m_botvalue = 1500;
this.m_model = MDL_Rockets_ITEM;
#endif
this.netname = "rockets";
- this.m_name = _("rockets");
+ this.m_name = _("Rockets");
this.m_icon = "ammo_rockets";
#ifdef SVQC
this.m_botvalue = 1500;
this.m_model = MDL_Cells_ITEM;
#endif
this.netname = "cells";
- this.m_name = _("cells");
+ this.m_name = _("Cells");
this.m_icon = "ammo_cells";
#ifdef SVQC
this.m_botvalue = 1500;
this.m_model = MDL_Plasma_ITEM;
#endif
this.netname = "plasma";
- this.m_name = _("plasma");
+ this.m_name = _("Plasma");
this.m_icon = "ammo_plasma";
#ifdef SVQC
this.m_botvalue = 1500;
this.m_model = MDL_JetpackFuel_ITEM;
#endif
this.netname = "fuel";
- this.m_name = _("fuel");
+ this.m_name = _("Fuel");
this.m_icon = "ammo_fuel";
#ifdef SVQC
this.m_botvalue = 2000;
REGISTER_NET_TEMP(TE_CSQC_WEAPONCOMPLAIN)
REGISTER_NET_TEMP(TE_CSQC_SERVERWELCOME)
REGISTER_NET_TEMP(TE_CSQC_VEHICLESETUP)
+REGISTER_NET_TEMP(TE_CSQC_WEAPONPICKUP)
const int RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
const int RACE_NET_CHECKPOINT_CLEAR = 1;
case RES_FUEL: ammoitems = ITEM_JetpackFuel.m_name; break;
default: return ""; // doesn't use ammo
}
- return sprintf(_(" with %d %s"), f2, ammoitems);
+ return sprintf(_(" with %d %s"), f2, strtolower(ammoitems));
}
#include <menu/xonotic/dialog_hudpanel_modicons.qc>
#include <menu/xonotic/dialog_hudpanel_notification.qc>
#include <menu/xonotic/dialog_hudpanel_physics.qc>
+#include <menu/xonotic/dialog_hudpanel_pickup.qc>
#include <menu/xonotic/dialog_hudpanel_powerups.qc>
#include <menu/xonotic/dialog_hudpanel_pressedkeys.qc>
#include <menu/xonotic/dialog_hudpanel_quickmenu.qc>
#include <menu/xonotic/dialog_hudpanel_modicons.qh>
#include <menu/xonotic/dialog_hudpanel_notification.qh>
#include <menu/xonotic/dialog_hudpanel_physics.qh>
+#include <menu/xonotic/dialog_hudpanel_pickup.qh>
#include <menu/xonotic/dialog_hudpanel_powerups.qh>
#include <menu/xonotic/dialog_hudpanel_pressedkeys.qh>
#include <menu/xonotic/dialog_hudpanel_quickmenu.qh>
--- /dev/null
+#include "dialog_hudpanel_pickup.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "slider.qh"
+#include "textslider.qh"
+
+void XonoticHUDPickupDialog_fill(entity me)
+{
+ entity e;
+ string panelname = "pickup";
+
+ dialog_hudpanel_main_checkbox(me, panelname);
+
+ dialog_hudpanel_main_settings(me, panelname);
+
+ me.TR(me);
+ me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Pickup messages:")));
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Message duration:")));
+ me.TD(me, 1, 2.6, e = makeXonoticSlider(1, 5, 1, "hud_panel_pickup_time"));
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Fade time:")));
+ me.TD(me, 1, 2.6, e = makeXonoticSlider(0, 1, 0.05, "hud_panel_pickup_fade_out"));
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Show timer:")));
+ me.TD(me, 1, 2, e = makeXonoticTextSlider("hud_panel_pickup_showtimer"));
+ e.addValue(e, _("Never"), "0");
+ e.addValue(e, _("Always"), "1");
+ e.addValue(e, _("Spectating"), "2");
+ e.configureXonoticTextSliderValues(e);
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Icon size scale:")));
+ me.TD(me, 1, 2.6, e = makeXonoticSlider(1, 3, 0.1, "hud_panel_pickup_iconsize"));
+}
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDPickupDialog, XonoticRootDialog)
+ METHOD(XonoticHUDPickupDialog, fill, void(entity));
+ ATTRIB(XonoticHUDPickupDialog, title, string, _("Pickup Panel"));
+ ATTRIB(XonoticHUDPickupDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT);
+ ATTRIB(XonoticHUDPickupDialog, intendedWidth, float, 0.4);
+ ATTRIB(XonoticHUDPickupDialog, rows, float, 15.5);
+ ATTRIB(XonoticHUDPickupDialog, columns, float, 4);
+ ATTRIB(XonoticHUDPickupDialog, name, string, "HUDpickup");
+ ATTRIB(XonoticHUDPickupDialog, requiresConnection, float, true);
+ENDCLASS(XonoticHUDPickupDialog)
#include "dialog_hudpanel_timer.qh"
#include "dialog_hudpanel_vote.qh"
#include "dialog_hudpanel_weapons.qh"
+#include "dialog_hudpanel_pickup.qh"
#include "dialog_hudpanel_engineinfo.qh"
#include "dialog_hudpanel_infomessages.qh"
#include "dialog_hudpanel_physics.qh"
i.configureDialog(i);
me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+ i = NEW(XonoticHUDPickupDialog);
+ i.configureDialog(i);
+ me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
i = NEW(XonoticHUDInfoMessagesDialog);
i.configureDialog(i);
me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
#include <common/mutators/mutator/buffs/sv_buffs.qh>
#include <common/mutators/mutator/powerups/_mod.qh>
#include <common/mutators/mutator/status_effects/_mod.qh>
+#include <common/net_linked.qh>
#include <common/notifications/all.qh>
#include <common/resources/resources.qh>
#include <common/util.qh>
return true;
}
+void Item_NotifyWeapon(entity player, int wep)
+{
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && (it == player || (IS_SPEC(it) && it.enemy == player)), {
+ msg_entity = it;
+ WriteHeader(MSG_ONE, TE_CSQC_WEAPONPICKUP);
+ WriteByte(MSG_ONE, wep);
+ });
+}
+
bool Item_GiveTo(entity item, entity player)
{
// if nothing happens to player, just return without taking the item
pickedup |= Item_GiveAmmoTo(item, player, RES_FUEL, g_pickup_fuel_max);
if (item.itemdef.instanceOfWeaponPickup)
{
- WepSet w;
+ WepSet w, wp;
w = STAT(WEAPONS, item);
- w &= ~STAT(WEAPONS, player);
+ wp = w & ~STAT(WEAPONS, player);
- if (w || (item.spawnshieldtime && item.pickup_anyway > 0))
+ if (wp || (item.spawnshieldtime && item.pickup_anyway > 0))
{
pickedup = true;
FOREACH(Weapons, it != WEP_Null, {
if(w & (it.m_wepset))
+ Item_NotifyWeapon(player, it.m_id);
+
+ if(wp & (it.m_wepset))
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
if (!wep) return;
STAT(WEAPONS, e) |= WepSet_FromWeapon(REGISTRY_GET(Weapons, wep));
-
- if (IS_PLAYER(e)) {
- Send_Notification(NOTIF_ONE, e, MSG_MULTI, ITEM_WEAPON_GOT, wep);
- }
}
void W_PlayStrengthSound(entity player)
if(cvar("sv_allow_fullbright"))
serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT;
+ serverflags &= ~SERVERFLAG_FORBID_PICKUPTIMER;
+ if(cvar("sv_forbid_pickuptimer"))
+ serverflags |= SERVERFLAG_FORBID_PICKUPTIMER;
+
sv_ready_restart_after_countdown = cvar("sv_ready_restart_after_countdown");
warmup_stage = cvar("g_warmup");
sv_showspectators 0
sv_taunt 0
sv_maxidle_playertospectator 0
+sv_forbid_pickuptimer 1 // we don't want people seeing their pickup times in competitive matches
g_ca_spectate_enemies -1 // block freeroam camera in CA matches
// allow fullbright
set sv_allow_fullbright 1 "when set, clients may use r_fullbright on this server without getting a night vision effect overlay"
+// forbid pickup timer
+set sv_forbid_pickuptimer 0 "when set, clients won't be able to see the time they picked up an item"
+
// auto-teams (team selection by player ID)
// any player not listed is forced to spectate
set g_forced_team_red "" "list of player IDs for red team"