void Dump_Notifications(float fh, float alsoprint)
{
- #define NOTIF_WRITE(type,name,text) { \
- notif_msg = sprintf("seta %s 1 // %s - %s\n", name, #type, strreplace("\n", "\\n", text)); \
- fputs(fh, notif_msg); \
- if(alsoprint) { print(strreplace("^", "^^", notif_msg)); } }
+ #define NOTIF_WRITE(a,b) { \
+ fputs(fh, a); \
+ if(alsoprint) \
+ { \
+ if(b != "") { print(b); } \
+ else { print(a); } \
+ } }
+ #define NOTIF_WRITE_SETA(name,text) { \
+ notif_msg = sprintf("seta notification_%s 1 \"notif string: %s\"\n", name, strreplace("\n", "\\n", text)); \
+ NOTIF_WRITE(notif_msg, strreplace("^", "^^", notif_msg)) }
string notif_msg;
float i;
entity e;
+ // Note: This warning only applies to the notifications.cfg file that is output...
+
+ // You ARE supposed to manually edit this function to add i.e. hard coded
+ // notification variables for mutators or game modes or such and then
+ // regenerate the notifications.cfg file from the new code.
+
+ NOTIF_WRITE("// ********************************************** //\n", "");
+ NOTIF_WRITE("// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n", "");
+ NOTIF_WRITE("// ** ** //\n", "");
+ NOTIF_WRITE("// ** This file is automatically generated ** //\n", "");
+ NOTIF_WRITE("// ** by code with the command 'dumpnotifs'. ** //\n", "");
+ NOTIF_WRITE("// ** ** //\n", "");
+ NOTIF_WRITE("// ** If you add a new notification, please ** //\n", "");
+ NOTIF_WRITE("// ** regenerate this file with that command ** //\n", "");
+ NOTIF_WRITE("// ** making sure that the output matches ** //\n", "");
+ NOTIF_WRITE("// ** with the lists and defaults in code. ** //\n", "");
+ NOTIF_WRITE("// ** ** //\n", "");
+ NOTIF_WRITE("// ********************************************** //\n", "");
+
+ NOTIF_WRITE("\n// Version number to identify mismatches between code and config file...\n", "");
+ NOTIF_WRITE("// Increment NOTIF_VERSION in common/notifications.qh with any\n", "");
+ NOTIF_WRITE("// new notifications or other changes to notif cvars/this config.\n", "");
+
+ NOTIF_WRITE(sprintf("set notification_version %d\n", NOTIF_VERSION), "");
+
+ // These notifications will also append their string as a comment...
+ // This is not necessary, and does not matter if they vary between config versions,
+ // it is just a semi-helpful tool for those who want to manually change their user settings.
+
+ NOTIF_WRITE(sprintf("\n// MSG_INFO notifications (count = %d):\n", NOTIF_INFO_COUNT), "");
for(i = 0; i < NOTIF_INFO_COUNT; ++i) {
e = Get_Notif_Ent(MSG_INFO, i);
- NOTIF_WRITE(MSG_INFO, e.nent_name, e.nent_string); }
-
+ NOTIF_WRITE_SETA(e.nent_name, e.nent_string); }
+
+ NOTIF_WRITE(sprintf("\n// MSG_CENTER notifications (count = %d):\n", NOTIF_CENTER_COUNT), "");
for(i = 0; i < NOTIF_CENTER_COUNT; ++i) {
e = Get_Notif_Ent(MSG_CENTER, i);
- NOTIF_WRITE(MSG_CENTER, e.nent_name, e.nent_string); }
-
+ NOTIF_WRITE_SETA(e.nent_name, e.nent_string); }
+
+ NOTIF_WRITE(sprintf("\n// MSG_WEAPON notifications (count = %d):\n", NOTIF_WEAPON_COUNT), "");
for(i = 0; i < NOTIF_WEAPON_COUNT; ++i) {
e = Get_Notif_Ent(MSG_WEAPON, i);
- NOTIF_WRITE(MSG_WEAPON, e.nent_name, sprintf("infoname: %s, centername: %s",
+ NOTIF_WRITE_SETA(e.nent_name, sprintf("infoname: %s, centername: %s",
e.nent_msginfo.nent_name, e.nent_msgcenter.nent_name)); }
-
+
+ NOTIF_WRITE(sprintf("\n// MSG_DEATH notifications (count = %d):\n", NOTIF_DEATH_COUNT), "");
for(i = 0; i < NOTIF_DEATH_COUNT; ++i) {
e = Get_Notif_Ent(MSG_DEATH, i);
- NOTIF_WRITE(MSG_DEATH, e.nent_name, sprintf("infoname: %s, centername: %s",
+ NOTIF_WRITE_SETA(e.nent_name, sprintf("infoname: %s, centername: %s",
e.nent_msginfo.nent_name, e.nent_msgcenter.nent_name)); }
- print(sprintf("Notification 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));
+ // edit these to match whichever cvars are used for specific notification options
+ NOTIF_WRITE("\n// HARD CODED notification variables:\n", "");
+ NOTIF_WRITE("seta notification_errors_are_fatal 1 \"If a notification fails upon initialization, cause a Host_Error to stop the program\"\n", "");
+ NOTIF_WRITE("seta notification_ctf_pickup_team_verbose 1 \"Show extra information if a team mate picks up a flag\"\n", "");
+ 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(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),
+ NOTIF_INFO_COUNT, NOTIF_CENTER_COUNT, NOTIF_WEAPON_COUNT, NOTIF_DEATH_COUNT), "");
return;
+ #undef NOTIF_WRITE_SETA
#undef NOTIF_WRITE
}