]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/notifications.qc
Replace `vector_[xyz]` with `vector.[xyz]` where possible
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / notifications.qc
index 3605d0b6f1eede3da4a001aef33ea9846ffd4ebb..5bb9fcdd51dbe4b30541700156d193fa3dbf1c1c 100644 (file)
@@ -3,7 +3,7 @@
 //  Last updated: August, 2013
 // ================================================
 
-string Get_Notif_TypeName(float net_type)
+string Get_Notif_TypeName(int net_type)
 {
        switch(net_type)
        {
@@ -18,7 +18,7 @@ string Get_Notif_TypeName(float net_type)
        return "";
 }
 
-entity Get_Notif_Ent(float net_type, float net_name)
+entity Get_Notif_Ent(int net_type, int net_name)
 {
        switch(net_type)
        {
@@ -224,7 +224,7 @@ void Destroy_Notification_Entity(entity notif)
 void Destroy_All_Notifications(void)
 {
        entity notif;
-       float i;
+       int i;
 
        #define DESTROY_LOOP(type,count) \
                for(i = 1; i <= count; ++i) \
@@ -251,15 +251,15 @@ void Destroy_All_Notifications(void)
 }
 
 string Process_Notif_Line(
-       float typeid,
-       float chat,
+       int typeId,
+       bool chat,
        string input,
        string notiftype,
        string notifname,
        string stringtype)
 {
        #ifdef CSQC
-       if(typeid == MSG_INFO)
+       if(typeId == MSG_INFO)
        {
                if((chat && autocvar_notification_allow_chatboxprint)
                        || (autocvar_notification_allow_chatboxprint == 2))
@@ -306,7 +306,7 @@ string Process_Notif_Args(
        string selected, remaining = args;
        float sel_num = 0;
 
-       for(;(remaining != "");)
+       for(0;(remaining != "");)
        {
                selected = car(remaining); remaining = cdr(remaining);
 
@@ -477,8 +477,8 @@ string Process_Notif_Args(
 void Create_Notification_Entity(
        float var_default,
        float var_cvar,
-       float typeid,
-       float nameid,
+       int typeId,
+       int nameid,
        string namestring,
        float strnum,
        float flnum,
@@ -496,21 +496,21 @@ void Create_Notification_Entity(
        string normal,
        string gentle,
        /* MSG_MULTI */
-       float anncename,
-       float infoname,
-       float centername,
+       int anncename,
+       int infoname,
+       int centername,
        /* MSG_CHOICE */
        float challow_def,
        float challow_var,
-       float chtype,
-       float optiona,
-       float optionb)
+       int chtype,
+       int optiona,
+       int optionb)
 {
        // =====================
        //  Global Entity Setup
        // =====================
        entity notif = spawn();
-       switch(typeid)
+       switch(typeId)
        {
                case MSG_ANNCE:
                {
@@ -550,7 +550,7 @@ void Create_Notification_Entity(
                                        "^1NOTIFICATION WITH IMPROPER TYPE: ",
                                        "^7net_type = %d, net_name = %s.\n"
                                ),
-                               typeid,
+                               typeId,
                                namestring
                        ));
                        return; // It's not possible to recover from this one
@@ -558,11 +558,11 @@ void Create_Notification_Entity(
        }
        notif.nent_default = var_default;
        notif.nent_enabled = (1 <= var_cvar);
-       notif.nent_type = typeid;
+       notif.nent_type = typeId;
        notif.nent_id = nameid;
        notif.nent_name = strzone(namestring);
 
-       string typestring = Get_Notif_TypeName(typeid);
+       string typestring = Get_Notif_TypeName(typeId);
 
        // Other pre-notif-setup requisites
        notif_error = FALSE;
@@ -570,7 +570,7 @@ void Create_Notification_Entity(
        // ====================
        //  Notification Setup
        // ====================
-       switch(typeid)
+       switch(typeId)
        {
                case MSG_ANNCE:
                {
@@ -725,7 +725,7 @@ void Create_Notification_Entity(
                                #define SET_NOTIF_STRING(string,stringname) \
                                        notif.nent_string = strzone(CCR( \
                                                Process_Notif_Line( \
-                                                       typeid, \
+                                                       typeId, \
                                                        (var_cvar > 1), \
                                                        string, \
                                                        typestring, \
@@ -862,7 +862,7 @@ void Create_Notification_Entity(
                                                                "^1NOTIFICATION WITH IMPROPER TYPE: ",
                                                                "^7net_type = %d, net_name = %s.\n"
                                                        ),
-                                                       typeid,
+                                                       typeId,
                                                        namestring
                                                );
                                                notif_error = TRUE;
@@ -905,7 +905,7 @@ void Create_Notification_Entity(
                                        "^1NOTIFICATION WITH IMPROPER TYPE: ",
                                        "^7net_type = %d, net_name = %s.\n"
                                ),
-                               typeid,
+                               typeId,
                                namestring
                        );
                        notif_error = TRUE;
@@ -974,7 +974,7 @@ void Dump_Notifications(float fh, float alsoprint)
                NOTIF_WRITE(notif_msg) }
 
        string notif_msg;
-       float i;
+       int i;
        entity e;
 
        // Note: This warning only applies to the notifications.cfg file that is output...
@@ -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(
@@ -1186,7 +1188,7 @@ void Debug_Notification(string input)
 string Local_Notification_sprintf(
        string input, string args,
        string s1, string s2, string s3, string s4,
-       float f1, float f2, float f3, float f4)
+       int f1, float f2, float f3, float f4)
 {
        #ifdef NOTIFICATIONS_DEBUG
        Debug_Notification(sprintf(
@@ -1199,7 +1201,7 @@ string Local_Notification_sprintf(
        #endif
 
        string selected;
-       float sel_num;
+       int sel_num;
        for(sel_num = 0; sel_num < NOTIF_MAX_ARGS; ++sel_num) { arg_slot[sel_num] = ""; }
 
        string tmp_s;
@@ -1312,12 +1314,13 @@ 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;
        arg_slot[0] = ""; arg_slot[1] = "";
 
+       int sel_num;
        for(sel_num = 0;(hudargs != "");)
        {
                selected = car(hudargs); hudargs = cdr(hudargs);
@@ -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; \