]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/notifications.qc
Merge branch 'master' into terencehill/music_player
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / notifications.qc
index 8c297513e72e4f97ac85a42ffa24a5043498ea93..a5a2ff445e60d376463d1265af9ba19657cd5575 100644 (file)
@@ -281,7 +281,7 @@ string Process_Notif_Line(
        // done to both MSG_INFO and MSG_CENTER
        if(substring(input, (strlen(input) - 1), 1) == "\n")
        {
-               print(sprintf(
+               printf(
                        strcat(
                                "^1TRAILING NEW LINE AT END OF NOTIFICATION: ",
                                "^7net_type = %s, net_name = %s, string = %s.\n"
@@ -289,7 +289,7 @@ string Process_Notif_Line(
                        notiftype,
                        notifname,
                        stringtype
-               ));
+               );
                notif_error = TRUE;
                input = substring(input, 1, (strlen(input) - 1));
        }
@@ -316,7 +316,7 @@ string Process_Notif_Args(
                        {
                                if(sel_num == NOTIF_MAX_ARGS)
                                {
-                                       print(sprintf(
+                                       printf(
                                                strcat(
                                                        "^1NOTIFICATION HAS TOO MANY ARGUMENTS: ",
                                                        "^7net_type = %s, net_name = %s, max args = %d.\n"
@@ -324,7 +324,7 @@ string Process_Notif_Args(
                                                notiftype,
                                                notifname,
                                                NOTIF_MAX_ARGS
-                                       ));
+                                       );
                                        notif_error = TRUE;
                                        break;
                                }
@@ -348,7 +348,7 @@ string Process_Notif_Args(
                                        #undef ARG_CASE_ARG_CS_SV_HA
                                        default:
                                        {
-                                               print(sprintf(
+                                               printf(
                                                        strcat(
                                                                "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: ",
                                                                "^7net_type = %s, net_name = %s, args arg = '%s'.\n"
@@ -356,7 +356,7 @@ string Process_Notif_Args(
                                                        notiftype,
                                                        notifname,
                                                        selected
-                                               ));
+                                               );
                                                notif_error = TRUE;
                                                break;
                                        }
@@ -367,7 +367,7 @@ string Process_Notif_Args(
                        {
                                if(sel_num == NOTIF_MAX_HUDARGS)
                                {
-                                       print(sprintf(
+                                       printf(
                                                strcat(
                                                        "^1NOTIFICATION HAS TOO MANY ARGUMENTS: ",
                                                        "^7net_type = %s, net_name = %s, max hudargs = %d.\n"
@@ -375,7 +375,7 @@ string Process_Notif_Args(
                                                notiftype,
                                                notifname,
                                                NOTIF_MAX_HUDARGS
-                                       ));
+                                       );
                                        notif_error = TRUE;
                                        break;
                                }
@@ -399,7 +399,7 @@ string Process_Notif_Args(
                                        #undef ARG_CASE_ARG_CS_SV_HA
                                        default:
                                        {
-                                               print(sprintf(
+                                               printf(
                                                        strcat(
                                                                "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: ",
                                                                "^7net_type = %s, net_name = %s, hudargs arg = '%s'.\n"
@@ -407,7 +407,7 @@ string Process_Notif_Args(
                                                        notiftype,
                                                        notifname,
                                                        selected
-                                               ));
+                                               );
                                                notif_error = TRUE;
                                                break;
                                        }
@@ -418,7 +418,7 @@ string Process_Notif_Args(
                        {
                                if(sel_num == NOTIF_MAX_DURCNT)
                                {
-                                       print(sprintf(
+                                       printf(
                                                strcat(
                                                        "^1NOTIFICATION HAS TOO MANY ARGUMENTS: ",
                                                        "^7net_type = %s, net_name = %s, max durcnt = %d.\n"
@@ -426,7 +426,7 @@ string Process_Notif_Args(
                                                notiftype,
                                                notifname,
                                                NOTIF_MAX_DURCNT
-                                       ));
+                                       );
                                        notif_error = TRUE;
                                        break;
                                }
@@ -453,7 +453,7 @@ string Process_Notif_Args(
                                                if(ftos(stof(selected)) != "") { ++sel_num; }
                                                else
                                                {
-                                                       print(sprintf(
+                                                       printf(
                                                                strcat(
                                                                        "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: ",
                                                                        "^7net_type = %s, net_name = %s, durcnt arg = '%s'.\n"
@@ -461,7 +461,7 @@ string Process_Notif_Args(
                                                                notiftype,
                                                                notifname,
                                                                selected
-                                                       ));
+                                                       );
                                                        notif_error = TRUE;
                                                }
                                                break;
@@ -591,14 +591,14 @@ void Create_Notification_Entity(
                                }
                                else
                                {
-                                       print(sprintf(
+                                       printf(
                                                strcat(
                                                        "^1NOTIFICATION WITH NO SOUND: ",
                                                        "^7net_type = %s, net_name = %s.\n"
                                                ),
                                                typestring,
                                                namestring
-                                       ));
+                                       );
                                        notif_error = TRUE;
                                }
                        }
@@ -638,7 +638,7 @@ void Create_Notification_Entity(
                                        }
                                        else if((hudargs == "") && (durcnt ==""))
                                        {
-                                               print(sprintf(
+                                               printf(
                                                        strcat(
                                                                "^1NOTIFICATION HAS ARG COUNTS BUT NO ARGS OR HUDARGS OR DURCNT: ",
                                                                "^7net_type = %s, net_name = %s, strnum = %d, flnum = %d\n"
@@ -647,7 +647,7 @@ void Create_Notification_Entity(
                                                        namestring,
                                                        strnum,
                                                        flnum
-                                               ));
+                                               );
                                                notif_error = TRUE;
                                        }
                                }
@@ -672,27 +672,27 @@ void Create_Notification_Entity(
                                        if(icon != "") { notif.nent_icon = strzone(icon); }
                                        else
                                        {
-                                               print(sprintf(
+                                               printf(
                                                        strcat(
                                                                "^1NOTIFICATION HAS HUDARGS BUT NO ICON: ",
                                                                "^7net_type = %s, net_name = %s.\n"
                                                        ),
                                                        typestring,
                                                        namestring
-                                               ));
+                                               );
                                                notif_error = TRUE;
                                        }
                                }
                                else if(icon != "")
                                {
-                                       print(sprintf(
+                                       printf(
                                                strcat(
                                                        "^1NOTIFICATION HAS ICON BUT NO HUDARGS: ",
                                                        "^7net_type = %s, net_name = %s.\n"
                                                ),
                                                typestring,
                                                namestring
-                                       ));
+                                       );
                                        notif_error = TRUE;
                                }
 
@@ -704,14 +704,14 @@ void Create_Notification_Entity(
                                        if(cpid != NO_MSG) { notif.nent_cpid = cpid; }
                                        else
                                        {
-                                               print(sprintf(
+                                               printf(
                                                        strcat(
                                                                "^1NOTIFICATION HAS DURCNT BUT NO CPID: ",
                                                                "^7net_type = %s, net_name = %s.\n"
                                                        ),
                                                        typestring,
                                                        namestring
-                                               ));
+                                               );
                                                notif_error = TRUE;
                                        }
                                }
@@ -746,14 +746,14 @@ void Create_Notification_Entity(
                                // Check to make sure a string was chosen
                                if(notif.nent_string == "")
                                {
-                                       print(sprintf(
+                                       printf(
                                                strcat(
                                                        "^1EMPTY NOTIFICATION: ",
                                                        "^7net_type = %s, net_name = %s.\n"
                                                ),
                                                typestring,
                                                namestring
-                                       ));
+                                       );
                                        notif_error = TRUE;
                                }
                        }
@@ -766,14 +766,14 @@ void Create_Notification_Entity(
                        // Set MSG_MULTI string/float counts
                        if((anncename == NO_MSG) && (infoname == NO_MSG) && (centername == NO_MSG))
                        {
-                               print(sprintf(
+                               printf(
                                        strcat(
                                                "^1NOTIFICATION WITH NO SUBCALLS: ",
                                                "^7net_type = %s, net_name = %s.\n"
                                        ),
                                        typestring,
                                        namestring
-                               ));
+                               );
                                notif_error = TRUE;
                        }
                        else
@@ -810,14 +810,14 @@ void Create_Notification_Entity(
                {
                        if((chtype == NO_MSG) || (optiona == NO_MSG) || (optionb == NO_MSG))
                        {
-                               print(sprintf(
+                               printf(
                                        strcat(
                                                "^1NOTIFICATION IS MISSING CHOICE PARAMS: ",
                                                "^7net_type = %s, net_name = %s.\n"
                                        ),
                                        typestring,
                                        namestring
-                               ));
+                               );
                                notif_error = TRUE;
                        }
                        else
@@ -857,14 +857,14 @@ void Create_Notification_Entity(
 
                                        default:
                                        {
-                                               print(sprintf(
+                                               printf(
                                                        strcat(
                                                                "^1NOTIFICATION WITH IMPROPER TYPE: ",
                                                                "^7net_type = %d, net_name = %s.\n"
                                                        ),
                                                        typeid,
                                                        namestring
-                                               ));
+                                               );
                                                notif_error = TRUE;
                                                break;
                                        }
@@ -900,14 +900,14 @@ void Create_Notification_Entity(
 
                default:
                {
-                       print(sprintf(
+                       printf(
                                strcat(
                                        "^1NOTIFICATION WITH IMPROPER TYPE: ",
                                        "^7net_type = %d, net_name = %s.\n"
                                ),
                                typeid,
                                namestring
-                       ));
+                       );
                        notif_error = TRUE;
                        break;
                }
@@ -1007,7 +1007,7 @@ void Dump_Notifications(float fh, float alsoprint)
                if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
 
                NOTIF_WRITE_ENTITY(
-                       "Notification control cvar: 0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled)"
+                       "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled"
                );
        }
 
@@ -1018,7 +1018,7 @@ void Dump_Notifications(float fh, float alsoprint)
                if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
 
                NOTIF_WRITE_ENTITY(
-                       "Notification control cvar: 0 = off, 1 = print to console, "
+                       "0 = off, 1 = print to console, "
                        "2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
                );
        }
@@ -1030,7 +1030,7 @@ void Dump_Notifications(float fh, float alsoprint)
                if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
 
                NOTIF_WRITE_ENTITY(
-                       "Notification control cvar: 0 = off, 1 = centerprint"
+                       "0 = off, 1 = centerprint"
                );
        }
 
@@ -1041,7 +1041,7 @@ void Dump_Notifications(float fh, float alsoprint)
                if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
 
                NOTIF_WRITE_ENTITY(
-                       "Notification control cvar: 0 = off, 1 = trigger subcalls"
+                       "Enable this multiple notification"
                );
        }
 
@@ -1052,8 +1052,8 @@ void Dump_Notifications(float fh, float alsoprint)
                if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
 
                NOTIF_WRITE_ENTITY_CHOICE(
-                       "Notification control cvar: 0 = off, 1 = trigger option A subcall, 2 = trigger option B subcall",
-                       "Notification control cvar: 0 = off, 1 = allowed in warmup mode, 2 = always allowed"
+                       "Choice for this notification 0 = off, 1 = default message, 2 = verbose message",
+                       "Allow choice for this notification 0 = off, 1 = only in warmup mode, 2 = always"
                );
        }
 
@@ -1062,8 +1062,10 @@ void Dump_Notifications(float fh, float alsoprint)
 
        NOTIF_WRITE_HARDCODED(
                "allow_chatboxprint", "1",
-               "Allow notifications to be printed to chat box by setting notification cvar to 2 "
-               "(You can also set this cvar to 2 to force ALL notifications to be printed to the chatbox)"
+               "Allow INFO notifications to be printed to chat box"
+               "0 = do not allow, "
+               "1 = allow only if allowed by individual notification_INFO* cvars, "
+               "2 = force all INFO notifications to be printed to the chatbox"
        );
 
        NOTIF_WRITE_HARDCODED(
@@ -1312,7 +1314,8 @@ void Local_Notification_sound(
 
 void Local_Notification_HUD_Notify_Push(
        string icon, string hudargs,
-       string s1, string s2, string s3, string s4)
+       string s1, string s2, string s3, string s4,
+       float f1, float f2, float f3, float f4)
 {
        string selected;
        float sel_num;
@@ -1344,10 +1347,11 @@ void Local_Notification_HUD_Notify_Push(
        }
        #ifdef NOTIFICATIONS_DEBUG
        Debug_Notification(sprintf(
-               "Local_Notification_HUD_Notify_Push('%s^7', '%s', %s, %s);\n",
+               "Local_Notification_HUD_Notify_Push('%s^7', '%s', %s, %s, %s);\n",
                icon,
                hudargs,
                MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
+               sprintf("%d, %d, %d, %d", f1, f2, f3, f4),
                MakeConsoleSafe(sprintf("'%s^7', '%s^7'", stof(arg_slot[0]), stof(arg_slot[1])))
        ));
        #endif
@@ -1547,7 +1551,8 @@ void Local_Notification(float net_type, float net_name, ...count)
                                Local_Notification_HUD_Notify_Push(
                                        notif.nent_icon,
                                        notif.nent_hudargs,
-                                       s1, s2, s3, s4);
+                                       s1, s2, s3, s4,
+                                       f1, f2, f3, f4);
                        }
                        #endif
                        break;
@@ -2024,7 +2029,7 @@ void Send_Notification(
                #define RECURSE_FROM_CHOICE(ent,action) \
                        if(notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) \
                        { \
-                               switch(ent.msg_choice_choices[net_name]) \
+                               switch(ent.msg_choice_choices[net_name - 1]) \
                                { \
                                        case 1: found_choice = notif.nent_optiona; break; \
                                        case 2: found_choice = notif.nent_optionb; break; \