}
}
+void GenericCommand_restartnotifs(float request)
+{
+ switch(request)
+ {
+ case CMD_REQUEST_COMMAND:
+ {
+ #ifndef MENUQC
+ print(sprintf(
+ strcat(
+ "Restart_Notifications(): Restarting %d notifications... ",
+ "Counts: 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
+ ),
+ NOTIF_INFO_COUNT,
+ NOTIF_CENTER_COUNT,
+ NOTIF_WEAPON_COUNT,
+ NOTIF_DEATH_COUNT
+ ));
+ Destroy_All_Notifications();
+ CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
+ #else
+ print(_("Notification restart command only works with cl_cmd and sv_cmd.\n"));
+ #endif
+ return;
+ }
+
+ default:
+ case CMD_REQUEST_USAGE:
+ {
+ print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " restartnotifs"));
+ print(" No arguments required.\n");
+ return;
+ }
+ }
+}
+
void GenericCommand_settemp(float request, float argc)
{
switch(request)
GENERIC_COMMAND("nextframe", GenericCommand_nextframe(request, arguments, command), "Execute the given command next frame of this VM") \
GENERIC_COMMAND("qc_curl", GenericCommand_qc_curl(request, arguments), "Queries a URL") \
GENERIC_COMMAND("removefromlist", GenericCommand_removefromlist(request, arguments), "Remove a string from a cvar") \
+ GENERIC_COMMAND("restartnotifs", GenericCommand_restartnotifs(request), "Re-initialize all notifications") \
GENERIC_COMMAND("rpn", GenericCommand_rpn(request, arguments, command), "RPN calculator") \
GENERIC_COMMAND("settemp", GenericCommand_settemp(request, arguments), "Temporarily set a value to a cvar which is restored later") \
GENERIC_COMMAND("settemp_restore", GenericCommand_settemp_restore(request, arguments), "Restore all cvars set by settemp command") \
}
}
+void Destroy_Notification_Entity(entity notif)
+{
+ if(notif.nent_name != "") { strunzone(notif.nent_name); }
+ if(notif.nent_args != "") { strunzone(notif.nent_args); }
+ if(notif.nent_hudargs != "") { strunzone(notif.nent_hudargs); }
+ if(notif.nent_icon != "") { strunzone(notif.nent_icon); }
+ if(notif.nent_durcnt != "") { strunzone(notif.nent_durcnt); }
+ if(notif.nent_string != "") { strunzone(notif.nent_string); }
+ remove(notif);
+}
+
+void Destroy_All_Notifications(void)
+{
+ entity notif;
+ float i;
+ #define DESTROY_LOOP(type,count) \
+ for(i = 1; i <= count; ++i) \
+ { \
+ notif = Get_Notif_Ent(type, i); \
+ if not(notif) { backtrace("Destroy_All_Notifications(): Missing notification entity!\n"); return; } \
+ Destroy_Notification_Entity(notif); \
+ }
+
+ // kill all networked notifications
+ #ifdef SVQC
+ Kill_Notification(NOTIF_ANY, world, 0, 0);
+ #endif
+
+ // kill all real notification entities
+ DESTROY_LOOP(MSG_INFO, NOTIF_INFO_COUNT)
+ DESTROY_LOOP(MSG_CENTER, NOTIF_CENTER_COUNT)
+ DESTROY_LOOP(MSG_WEAPON, NOTIF_WEAPON_COUNT)
+ DESTROY_LOOP(MSG_DEATH, NOTIF_DEATH_COUNT)
+
+ //print("Destroyed all huma-- I mean... notifications.. successfully.\n");
+}
+
// =========================================
// Cvar Handling With 'dumpnotifs' Command
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 Create_Notification_Entity(
+ float var_default,
+ float var_cvar,
+ float typeid,
+ float nameid,
+ string namestring,
+ float infoname,
+ float centername,
+ float strnum,
+ float flnum,
+ string args,
+ string hudargs,
+ string icon,
+ float cpid,
+ string durcnt,
+ string normal,
+ string gentle,
+ float msg_is_info,
+ float msg_is_multi);
+
void Dump_Notifications(float fh, float alsoprint);
+
void Local_Notification(float net_type, float net_name, ...count);
void Local_Notification_WOVA(float net_type, float net_name, float stringcount, float floatcount, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4);
.string nent_strings[4];
.float nent_floats[4];
-void Create_Notification_Entity(
- float var_default,
- float var_cvar,
- float typeid,
- float nameid,
- string namestring,
- float infoname,
- float centername,
- float strnum,
- float flnum,
- string args,
- string hudargs,
- string icon,
- float cpid,
- string durcnt,
- string normal,
- string gentle,
- float msg_is_info,
- float msg_is_multi);
-
#define MSG_INFO_NOTIF(default,name,strnum,flnum,args,hudargs,icon,normal,gentle) \
NOTIF_ADD_AUTOCVAR(name, default) \
float name; \