From 902776d303651e49fd84100459abd860f8a50d23 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Tue, 26 Feb 2013 21:14:08 -0500 Subject: [PATCH] Implement mapload specific lifetime of notification entities (plus cvar it) --- qcsrc/common/notifications.qc | 10 +++++++--- qcsrc/common/notifications.qh | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 88c2d71b1..1fc3a0521 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -190,6 +190,8 @@ void Dump_Notifications(float fh, float alsoprint) NOTIF_WRITE("seta notification_ctf_pickup_enemy_verbose 1 \"Show extra information if an enemy picks up a flag\"\n"); NOTIF_WRITE("seta notification_ctf_capture_verbose 1 \"Show extra information when someone captures a flag\"\n"); NOTIF_WRITE("seta notification_frag_verbose 1 \"Show extra information when you frag someone (or when you are fragged\"\n"); + NOTIF_WRITE("seta notification_lifetime_runtime 0.5 \"Amount of time that notification entities last on the server during runtime (In seconds)\"\n"); + NOTIF_WRITE("seta notification_lifetime_mapload 10 \"Amount of time that notification entities last immediately at mapload (in seconds) to help prevent notifications from being lost on early init (like gamestart countdown)\"\n"); NOTIF_WRITE(sprintf("\n// Notification counts (total = %d): MSG_INFO = %d, MSG_CENTER = %d, MSG_WEAPON = %d, MSG_DEATH = %d\n", (NOTIF_INFO_COUNT + NOTIF_CENTER_COUNT + NOTIF_WEAPON_COUNT + NOTIF_DEATH_COUNT), @@ -616,7 +618,7 @@ void Kill_Notification(float broadcast, entity client, float net_type, float net notif.nent_client = client; notif.nent_net_type = MSG_CENTER_KILL; notif.nent_net_name = net_name; - Net_LinkEntity(notif, FALSE, 0.5, Net_Write_Notification); + Net_LinkEntity(notif, FALSE, autocvar_notification_lifetime_runtime, Net_Write_Notification); } for(notif = world; (notif = find(notif, classname, "net_notification"));) @@ -697,9 +699,11 @@ void Send_Notification(float broadcast, entity client, float i; for(i = 0; i < net_notif.nent_stringcount; ++i) { net_notif.nent_strings[i] = strzone(...(i, string)); } for(i = 0; i < net_notif.nent_floatcount; ++i) { net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i), float); } - + net_notif.think = Net_Notification_Remove; - net_notif.nextthink = (time + 0.5); + net_notif.nextthink = ((time > autocvar_notification_lifetime_mapload) ? + (time + autocvar_notification_lifetime_runtime) : + autocvar_notification_lifetime_mapload); Net_LinkEntity(net_notif, FALSE, 0, Net_Write_Notification); diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index c9db63c15..952972002 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -7,7 +7,7 @@ #define MSG_INFO 1 // "Global" information messages (sent to console, and notify panel if it has an icon) #define MSG_CENTER 2 // "Personal" centerprint messages #define MSG_CENTER_KILL 3 // Kill centerprint message -#define MSG_WEAPON 4 // "Personal" weapon messages (like "You got the Nex", sent to weapon notify panel) +#define MSG_WEAPON 4 // "Global" weapon messages #define MSG_DEATH 5 // "Personal" AND "Global" death messages #define NO_MSG -12345 @@ -556,6 +556,8 @@ var float autocvar_notification_show_sprees_info = 3; // 0 = off, 1 = target onl var float autocvar_notification_show_sprees_info_newline = FALSE; var float autocvar_notification_show_sprees_info_specialonly = TRUE; var float autocvar_notification_errors_are_fatal = TRUE; +var float autocvar_notification_lifetime_runtime = 0.5; +var float autocvar_notification_lifetime_mapload = 10; #ifdef SVQC .float FRAG_VERBOSE; -- 2.39.2