X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fnotifications%2Fall.qh;h=dc63a70803963ceb4c7c8f2e9b49066a6dca225e;hp=1721303ab526a6d2fc93d5a406d99b5ad1973d43;hb=991de5e6922cd3c283de56c3249624f0f1bfe767;hpb=ecd018b0f2a99be972759503e3efea35b6717ee9 diff --git a/qcsrc/common/notifications/all.qh b/qcsrc/common/notifications/all.qh index 1721303ab5..dc63a70803 100644 --- a/qcsrc/common/notifications/all.qh +++ b/qcsrc/common/notifications/all.qh @@ -5,6 +5,8 @@ #include #include #include +#include +#include #ifdef CSQC #include @@ -308,7 +310,6 @@ float autocvar_notification_lifetime_mapload = 10; #endif #ifdef SVQC -.float FRAG_VERBOSE; void Notification_GetCvars(entity this); float autocvar_notification_server_allows_location = 1; // 0 = no, 1 = yes #else @@ -369,7 +370,7 @@ float autocvar_notification_show_sprees_center_specialonly = true; spree_end: placed at the end of murder messages to show ending of sprees spree_lost: placed at the end of suicide messages to show losing of sprees item_wepname: return full name of a weapon from weaponid - item_wepammo: ammo display for weapon from string + item_wepammo: ammo display for weapon from f1 and f2 item_centime: amount of time to display weapon message in centerprint item_buffname: return full name of a buff from buffid death_team: show the full name of the team a player is switching from @@ -432,16 +433,17 @@ string BUFF_NAME(int i); ARG_CASE(ARG_CS_SV, "item_wepname", Weapons_from(f1).m_name) \ ARG_CASE(ARG_CS_SV, "item_buffname", BUFF_NAME(f1)) \ ARG_CASE(ARG_CS_SV, "f3buffname", BUFF_NAME(f3)) \ - ARG_CASE(ARG_CS_SV, "item_wepammo", (s1 != "" ? sprintf(_(" with %s"), s1) : "")) \ + ARG_CASE(ARG_CS_SV, "item_wepammo", (f2 > 0 ? notif_arg_item_wepammo(f1, f2) : "")) \ ARG_CASE(ARG_DC, "item_centime", ftos(autocvar_notification_item_centerprinttime)) \ ARG_CASE(ARG_SV, "death_team", Team_ColoredFullName(f1)) \ ARG_CASE(ARG_CS, "death_team", Team_ColoredFullName(f1 - 1)) \ ARG_CASE(ARG_CS_SV_HA, "minigame1_name",find(NULL,netname,s1).descriptor.message) \ ARG_CASE(ARG_CS_SV_HA, "minigame1_d", find(NULL,netname,s1).descriptor.netname) -#define NOTIF_HIT_MAX(count,funcname) MACRO_BEGIN { \ +#define NOTIF_HIT_MAX(count,funcname) MACRO_BEGIN \ if(sel_num == count) { backtrace(sprintf("%s: Hit maximum arguments!\n", funcname)); break; } \ -} MACRO_END +MACRO_END + #define NOTIF_HIT_UNKNOWN(token,funcname) { backtrace(sprintf("%s: Hit unknown token in selected string! '%s'\n", funcname, selected)); break; } #define KILL_SPREE_LIST \ @@ -623,6 +625,23 @@ string notif_arg_spree_inf(float type, string input, string player, float spree) return ""; } +string notif_arg_item_wepammo(float f1, float f2) +{ + string ammoitems = ""; + Weapon wep = Weapons_from(f1); + switch (wep.ammo_type) + { + case RES_SHELLS: ammoitems = ITEM_Shells.m_name; break; + case RES_BULLETS: ammoitems = ITEM_Bullets.m_name; break; + case RES_ROCKETS: ammoitems = ITEM_Rockets.m_name; break; + case RES_CELLS: ammoitems = ITEM_Cells.m_name; break; + case RES_PLASMA: ammoitems = ITEM_Plasma.m_name; break; + case RES_FUEL: ammoitems = ITEM_JetpackFuel.m_name; break; + default: return ""; // doesn't use ammo + } + return sprintf(_(" with %d %s"), f2, ammoitems); +} + // ==================================== // Initialization/Create Declarations @@ -676,7 +695,8 @@ string notif_arg_spree_inf(float type, string input, string player, float spree) REGISTRY(Notifications, BITS(11)) REGISTER_REGISTRY(Notifications) -REGISTRY_SORT(Notifications); STATIC_INIT(Notifications) { FOREACH(Notifications, true, it.m_id = i); } +REGISTRY_SORT(Notifications); +STATIC_INIT(Notifications) { FOREACH(Notifications, true, it.m_id = i); } REGISTRY_CHECK(Notifications) const int NOTIF_CHOICE_MAX = 50;