X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fnotifications.qh;h=f3cd0ba494ea482f77b60441f0d7219cc365a815;hb=0fd6fa4f46e6e704eceac437d05daa326fa8cb14;hp=e5e43100427743853e1817ff0751aaf1d367d728;hpb=3589bb7872babf0ee489a54c85c9213562c1ffe9;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index e5e431004..f3cd0ba49 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -1,6 +1,8 @@ #ifndef NOTIFICATIONS_H #define NOTIFICATIONS_H +#include "command/all.qh" + #include "constants.qh" #include "teams.qh" #include "util.qh" @@ -48,7 +50,7 @@ const int NOTIF_ABORT = -1234; // allows Send_Notification to safely abort sen VARITEM(3, 4, XPD(s1, s2, s3, f1, f2, f3, f4)) \ VARITEM(4, 4, XPD(s1, s2, s3, s4, f1, f2, f3, f4)) -void Destroy_All_Notifications(void); +void Destroy_All_Notifications(); void Create_Notification_Entity( float var_default, float var_cvar, @@ -83,6 +85,57 @@ void Create_Notification_Entity( void Dump_Notifications(float fh, float alsoprint); + +GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt") +{ + switch(request) + { + case CMD_REQUEST_COMMAND: + { + #ifndef MENUQC + float fh, alsoprint = false; + string filename = argv(1); + + if(filename == "") + { + filename = "notifications_dump.cfg"; + alsoprint = false; + } + else if(filename == "-") + { + filename = "notifications_dump.cfg"; + alsoprint = true; + } + fh = fopen(filename, FILE_WRITE); + + if(fh >= 0) + { + Dump_Notifications(fh, alsoprint); + LOG_INFOF("Dumping notifications... File located in ^2data/data/%s^7.\n", filename); + fclose(fh); + } + else + { + LOG_INFOF("^1Error: ^7Could not open file '%s'!\n", filename); + } + #else + LOG_INFO(_("Notification dump command only works with cl_cmd and sv_cmd.\n")); + #endif + return; + } + + default: + case CMD_REQUEST_USAGE: + { + LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [filename]")); + LOG_INFO(" Where 'filename' is the file to write (default is notifications_dump.cfg),\n"); + LOG_INFO(" if supplied with '-' output to console as well as default,\n"); + LOG_INFO(" if left blank, it will only write to default.\n"); + return; + } + } +} + #ifdef NOTIFICATIONS_DEBUG void Debug_Notification(string input); #endif @@ -95,7 +148,6 @@ void Local_Notification_WOVA( float f1, float f2, float f3, float f4); #ifdef CSQC // CLIENT ONLY -void Read_Notification(float is_new); string prev_soundfile; float prev_soundtime; #endif @@ -150,7 +202,7 @@ float autocvar_notification_debug = false; #ifdef SVQC .float FRAG_VERBOSE; -void Notification_GetCvars(void); +void Notification_GetCvars(); float autocvar_notification_server_allows_location = 1; // 0 = no, 1 = yes #else float autocvar_notification_item_centerprinttime = 1.5; @@ -232,6 +284,8 @@ const float ARG_DC = 6; // unique result to durcnt/centerprint // todo possible idea.... declare how many floats/strings each arg needs, and then dynamically increment the input // this way, we don't need to have duplicates like i.e. s2loc and s3loc? +string BUFF_NAME(int i); + #define NOTIF_ARGUMENT_LIST \ ARG_CASE(ARG_CS_SV_HA, "s1", s1) \ ARG_CASE(ARG_CS_SV_HA, "s2", s2) \ @@ -265,8 +319,8 @@ const float ARG_DC = 6; // unique result to durcnt/centerprint ARG_CASE(ARG_CS_SV, "spree_end", (autocvar_notification_show_sprees ? notif_arg_spree_inf(-1, "", "", f1) : "")) \ ARG_CASE(ARG_CS_SV, "spree_lost", (autocvar_notification_show_sprees ? notif_arg_spree_inf(-2, "", "", f1) : "")) \ ARG_CASE(ARG_CS_SV, "item_wepname", WEP_NAME(f1)) \ - ARG_CASE(ARG_CS_SV, "item_buffname", sprintf("%s%s", rgb_to_hexcolor(Buffs[f1].m_color), Buffs[f1].m_prettyName)) \ - ARG_CASE(ARG_CS_SV, "f3buffname", sprintf("%s%s", rgb_to_hexcolor(Buffs[f3].m_color), Buffs[f3].m_prettyName)) \ + 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_DC, "item_centime", ftos(autocvar_notification_item_centerprinttime)) \ ARG_CASE(ARG_SV, "death_team", Team_ColoredFullName(f1)) \ @@ -521,11 +575,11 @@ float NOTIF_MULTI_COUNT; float NOTIF_CHOICE_COUNT; // notification limits -- INCREASE AS NECESSARY -const float NOTIF_ANNCE_MAX = 100; -const float NOTIF_INFO_MAX = 350; -const float NOTIF_CENTER_MAX = 250; -const float NOTIF_MULTI_MAX = 200; -const float NOTIF_CHOICE_MAX = 30; +const float NOTIF_ANNCE_MAX = 400; +const float NOTIF_INFO_MAX = 450; +const float NOTIF_CENTER_MAX = 350; +const float NOTIF_MULTI_MAX = 300; +const float NOTIF_CHOICE_MAX = 50; // notification entities entity msg_annce_notifs[NOTIF_ANNCE_MAX];