]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Declare multi-team notifications with only one line per notification
authorSamual Lenks <samual@xonotic.org>
Sun, 30 Sep 2012 03:55:05 +0000 (23:55 -0400)
committerSamual Lenks <samual@xonotic.org>
Sun, 30 Sep 2012 03:55:05 +0000 (23:55 -0400)
qcsrc/common/notifications.qc

index acde116c27562925401241563db611d49be84412..0416a3a59f7cf091db6f8f9bdcc8fe735e2d0f78 100644 (file)
@@ -36,6 +36,9 @@ var float autocvar_notification_ctf_pickup_enemy_verbose = TRUE;
 #define ADD_CSQC_AUTOCVAR(name)
 #endif
 
+string team_red = _("^1RED");
+string team_blue = _("^5BLUE");
+
 
 // ====================================
 //  Notifications List and Information
@@ -79,59 +82,56 @@ var float autocvar_notification_ctf_pickup_enemy_verbose = TRUE;
 
 // flag.netname = ((teamnumber) ? "^1RED^7 flag" : "^4BLUE^7 flag");
 // weaponorder[f1].netname
+
+#define TWO_TEAMS_INFO(prefix,strnum,flnum,args,icon,normal,gentle) \
+       #define _COL team_red \
+       MSG_INFO_NOTIF(prefix##RED, strnum, flnum, args, sprintf(icon, "red"), normal, gentle) \
+       #undef _COL \
+       #define _COL team_blue \
+       MSG_INFO_NOTIF(prefix##BLUE, strnum, flnum, args, sprintf(icon, "blue"), normal, gentle) \
+       #undef _COL
 #define MSG_INFO_NOTIFICATIONS \
-       MSG_INFO_NOTIF(INFO_EMPTY,                                                      0, 0, NO_STR_ARG,                       "",                                             "", "") \
-       MSG_INFO_NOTIF(INFO_CTF_FLAGRETURN_DROPPED_RED,         0, 0, NO_STR_ARG,                       "",                                             _("^BGThe ^1RED^BG flag was dropped in the base and returned itself\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_FLAGRETURN_DROPPED_BLUE,        0, 0, NO_STR_ARG,                       "",                                             _("^BGThe ^5BLUE^BG flag was dropped in the base and returned itself\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_FLAGRETURN_DAMAGED_RED,         0, 0, NO_STR_ARG,                       "",                                             _("^BGThe ^1RED^BG flag was destroyed and returned to base\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_FLAGRETURN_DAMAGED_BLUE,        0, 0, NO_STR_ARG,                       "",                                             _("^BGThe ^5BLUE^BG flag was destroyed and returned to base\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_FLAGRETURN_SPEEDRUN_RED,        0, 1, f1/100,                           "",                                             _("^BGThe ^1RED^BG flag became impatient after ^F1%.2f^BG seconds and returned itself\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_FLAGRETURN_SPEEDRUN_BLUE,       0, 1, f1/100,                           "",                                             _("^BGThe ^5BLUE^BG flag became impatient after ^F1%.2f^BG seconds and returned itself\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_FLAGRETURN_NEEDKILL_RED,        0, 0, NO_STR_ARG,                       "",                                             _("^BGThe ^1RED^BG flag fell somewhere it couldn't be reached and returned to base\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_FLAGRETURN_NEEDKILL_BLUE,       0, 0, NO_STR_ARG,                       "",                                             _("^BGThe ^5BLUE^BG flag fell somewhere it couldn't be reached and returned to base\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_FLAGRETURN_ABORTRUN_RED,        0, 0, NO_STR_ARG,                       "",                                             _("^BGThe ^1RED^BG flag was returned to base by its owner\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_FLAGRETURN_ABORTRUN_BLUE,       0, 0, NO_STR_ARG,                       "",                                             _("^BGThe ^5BLUE^BG flag was returned to base by its owner\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_PICKUP_RED,                                     1, 0, s1,                                       "notify_red_taken",             _("^BG%s^BG got the ^1RED^BG flag\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_PICKUP_BLUE,                            1, 0, s1,                                       "notify_blue_taken",    _("^BG%s^BG got the ^5BLUE^BG flag\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_RETURN_RED,                                     1, 0, s1,                                       "notify_red_returned",  _("^BG%s^BG returned the ^1RED^BG flag\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_RETURN_BLUE,                            1, 0, s1,                                       "notify_blue_returned", _("^BG%s^BG returned the ^5BLUE^BG flag\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_LOST_RED,                                       1, 0, s1,                                       "notify_red_lost",              _("^BG%s^BG lost the ^1RED^BG flag\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_LOST_BLUE,                                      1, 0, s1,                                       "notify_blue_lost",             _("^BG%s^BG lost the ^5BLUE^BG flag\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_CAPTURE_RED,                            1, 0, s1,                                       "notify_red_capture",   _("^BG%s^BG captured the ^1RED^BG flag\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_CAPTURE_BLUE,                           1, 0, s1,                                       "notify_blue_capture",  _("^BG%s^BG captured the ^5BLUE^BG flag\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_CAPTURE_TIME_RED,                       1, 1, XPND2(s1, f1/100),        "notify_red_capture",   _("^BG%s^BG captured the ^1RED^BG flag in ^F1%.2f^BG seconds\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_CAPTURE_TIME_BLUE,                      1, 1, XPND2(s1, f1/100),        "notify_blue_capture",  _("^BG%s^BG captured the ^5BLUE^BG flag in ^F1%.2f^BG seconds\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_CAPTURE_BROKEN_RED,                     2, 2, XPND4(s1, f1/100, s2, f2/100),    "notify_red_capture",   _("^BG%s^BG captured the ^1RED^BG flag in ^F1%.2f^BG seconds, breaking ^BG%s^BG's previous record of ^F2%.2f^BG seconds\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_CAPTURE_BROKEN_BLUE,            2, 2, XPND4(s1, f1/100, s2, f2/100),    "notify_blue_capture",  _("^BG%s^BG captured the ^5BLUE^BG flag in ^F1%.2f^BG seconds, breaking ^BG%s^BG's previous record of ^F2%.2f^BG seconds\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_CAPTURE_UNBROKEN_RED,           2, 2, XPND4(s1, f1/100, s2, f2/100),    "notify_red_capture",   _("^BG%s^BG captured the ^1RED^BG flag in ^F2%.2f^BG seconds, failing to break ^BG%s^BG's previous record of ^F1%.2f^BG seconds\n"), "") \
-       MSG_INFO_NOTIF(INFO_CTF_CAPTURE_UNBROKEN_BLUE,          2, 2, XPND4(s1, f1/100, s2, f2/100),    "notify_blue_capture",  _("^BG%s^BG captured the ^5BLUE^BG flag in ^F2%.2f^BG seconds, failing to break ^BG%s^BG's previous record of ^F1%.2f^BG seconds\n"), "") \
+       MSG_INFO_NOTIF(INFO_EMPTY,                                              0, 0, NO_STR_ARG,                                                       "", "", "") \
+       TWO_TEAMS_INFO(INFO_CTF_FLAGRETURN_DROPPED_,    0, 0, _COL,                                                             "", _("^BGThe %s^BG flag was dropped in the base and returned itself\n"), "") \
+       TWO_TEAMS_INFO(INFO_CTF_FLAGRETURN_DAMAGED_,    0, 0, _COL,                                                             "", _("^BGThe %s^BG flag was destroyed and returned to base\n"), "") \
+       TWO_TEAMS_INFO(INFO_CTF_FLAGRETURN_SPEEDRUN_,   0, 1, XPND2(_COL, f1/100),                                      "", _("^BGThe %s^BG flag became impatient after ^F1%.2f^BG seconds and returned itself\n"), "") \
+       TWO_TEAMS_INFO(INFO_CTF_FLAGRETURN_NEEDKILL_,   0, 0, _COL,                                                             "", _("^BGThe %s^BG flag fell somewhere it couldn't be reached and returned to base\n"), "") \
+       TWO_TEAMS_INFO(INFO_CTF_FLAGRETURN_ABORTRUN_,   0, 0, _COL,                                                             "", _("^BGThe %s^BG flag was returned to base by its owner\n"), "") \
+       TWO_TEAMS_INFO(INFO_CTF_PICKUP_,                                1, 0, XPND2(s1, _COL),                                          "notify_%s_taken", _("^BG%s^BG got the %s^BG flag\n"), "") \
+       TWO_TEAMS_INFO(INFO_CTF_RETURN_,                                1, 0, XPND2(s1, _COL),                                          "notify_%s_returned", _("^BG%s^BG returned the %s^BG flag\n"), "") \
+       TWO_TEAMS_INFO(INFO_CTF_LOST_,                                  1, 0, XPND2(s1, _COL),                                          "notify_%s_lost", _("^BG%s^BG lost the %s^BG flag\n"), "") \
+       TWO_TEAMS_INFO(INFO_CTF_CAPTURE_,                               1, 0, XPND2(s1, _COL),                                          "notify_%s_capture", _("^BG%s^BG captured the %s^BG flag\n"), "") \
+       TWO_TEAMS_INFO(INFO_CTF_CAPTURE_TIME_,                  1, 1, XPND3(s1, _COL, f1/100),                          "notify_%s_capture", _("^BG%s^BG captured the %s^BG flag in ^F1%.2f^BG seconds\n"), "") \
+       TWO_TEAMS_INFO(INFO_CTF_CAPTURE_BROKEN_,                2, 2, XPND5(s1, _COL, f1/100, s2, f2/100),      "notify_%s_capture", _("^BG%s^BG captured the %s^BG flag in ^F1%.2f^BG seconds, breaking ^BG%s^BG's previous record of ^F2%.2f^BG seconds\n"), "") \
+       TWO_TEAMS_INFO(INFO_CTF_CAPTURE_UNBROKEN_,              2, 2, XPND5(s1, _COL, f1/100, s2, f2/100),      "notify_%s_capture", _("^BG%s^BG captured the %s^BG flag in ^F2%.2f^BG seconds, failing to break ^BG%s^BG's previous record of ^F1%.2f^BG seconds\n"), "") \
        #undef MSG_INFO_NOTIF
 
+#define TWO_TEAMS_CENTER(prefix,strnum,flnum,args,cpid,durcnt,normal,gentle) \
+       #define _COL team_red \
+       MSG_CENTER_NOTIF(prefix##RED, strnum, flnum, args, cpid, durcnt, normal, gentle) \
+       #undef _COL \
+       #define _COL team_blue \
+       MSG_CENTER_NOTIF(prefix##BLUE, strnum, flnum, args, cpid, durcnt, normal, gentle) \
+       #undef _COL
 #define MSG_CENTER_NOTIFICATIONS \
-       MSG_CENTER_NOTIF(CENTER_EMPTY,                                                  0, 0, NO_STR_ARG,                       NO_CPID,                                XPND2(0, 0), "", "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_CAPTURESHIELD_SHIELDED,             0, 0, NO_STR_ARG,                       CPID_CTF_CAPTURESHIELD, XPND2(0, 0), _("^BGYou are now ^F1shielded^BG from the flag\n^BGfor ^F2too many unsuccessful attempts^BG to capture.\n^BGMake some defensive scores before trying again."), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_CAPTURESHIELD_FREE,                 0, 0, NO_STR_ARG,                       CPID_CTF_CAPTURESHIELD, XPND2(0, 0), _("^BGYou are now free.\n^BGFeel free to ^F2try to capture^BG the flag again\n^BGif you think you will succeed."), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PASS_OTHER_RED,                     2, 0, XPND2(s1, s2),            CPID_CTF_PASS,                  XPND2(0, 0), _("^BG%s^BG passed the ^1RED^BG flag to %s"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PASS_OTHER_BLUE,                    2, 0, XPND2(s1, s2),            CPID_CTF_PASS,                  XPND2(0, 0), _("^BG%s^BG passed the ^4BLUE^BG flag to %s"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PASS_SENT_RED,                              1, 0, s1,                                       CPID_CTF_PASS,                  XPND2(0, 0), _("^BGYou passed the ^1RED^BG flag to %s"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PASS_SENT_BLUE,                     1, 0, s1,                                       CPID_CTF_PASS,                  XPND2(0, 0), _("^BGYou passed the ^4BLUE^BG flag to %s"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PASS_RECEIVED_RED,                  1, 0, s1,                                       CPID_CTF_PASS,                  XPND2(0, 0), _("^BGYou received the ^1RED^BG flag from %s"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PASS_RECEIVED_BLUE,                 1, 0, s1,                                       CPID_CTF_PASS,                  XPND2(0, 0), _("^BGYou received the ^4BLUE^BG flag from %s"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PASS_REQUESTING,                    1, 0, s1,                                       CPID_CTF_PASS,                  XPND2(0, 0), _("^BGRequesting %s^BG to pass you the flag"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PASS_REQUESTED,                     1, 0, XPND2(s1, PASS_KEY),      CPID_CTF_PASS,                  XPND2(0, 0), _("^BG%s^BG requests you to pass the flag%s"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_RETURN_RED,                                 0, 0, NO_STR_ARG,                       CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYou returned the ^1RED^BG flag"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_RETURN_BLUE,                                0, 0, NO_STR_ARG,                       CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYou returned the ^4BLUE^BG flag"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_CAPTURE_RED,                                0, 0, NO_STR_ARG,                       CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYou captured the ^1RED^BG flag"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_CAPTURE_BLUE,                               0, 0, NO_STR_ARG,                       CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYou captured the ^4BLUE^BG flag"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PICKUP_RED,                                 0, 0, NO_STR_ARG,                       CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYou got the ^1RED^BG flag!"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PICKUP_BLUE,                                0, 0, NO_STR_ARG,                       CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYou got the ^4BLUE^BG flag!"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PICKUP_TEAM,                                1, 0, s1,                                       CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYour %steam mate^BG got the flag! Protect them!"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PICKUP_TEAM_VERBOSE,                2, 0, XPND3(s1, s2, s1),        CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYour %steam mate (^BG%s%s)^BG got the flag! Protect them!"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PICKUP_ENEMY,                               1, 0, s1,                                       CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGThe %senemy^BG got your flag! Retrieve it!"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_PICKUP_ENEMY_VERBOSE,               2, 0, XPND3(s1, s2, s1),        CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGThe %senemy (^BG%s%s)^BG got your flag! Retrieve it!"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_STALEMATE_CARRIER,                  0, 0, NO_STR_ARG,                       CPID_STALEMATE,                 XPND2(0, 0), _("^BGStalemate! Enemies can now see you on radar!"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_STALEMATE_OTHER,                    0, 0, NO_STR_ARG,                       CPID_STALEMATE,                 XPND2(0, 0), _("^BGStalemate! Flag carriers can now be seen by enemies on radar!"), "") \
-       MSG_CENTER_NOTIF(CENTER_CTF_FLAG_THROW_PUNISH,                  0, 1, f1,                                       CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGToo many flag throws! Throwing disabled for %d seconds."), "") \
+       MSG_CENTER_NOTIF(CENTER_EMPTY,                                                  0, 0, NO_STR_ARG,                               NO_CPID,                                XPND2(0, 0), "", "") \
+       MSG_CENTER_NOTIF(CENTER_CTF_CAPTURESHIELD_SHIELDED,             0, 0, NO_STR_ARG,                               CPID_CTF_CAPSHIELD,             XPND2(0, 0), _("^BGYou are now ^F1shielded^BG from the flag\n^BGfor ^F2too many unsuccessful attempts^BG to capture.\n^BGMake some defensive scores before trying again."), "") \
+       MSG_CENTER_NOTIF(CENTER_CTF_CAPTURESHIELD_FREE,                 0, 0, NO_STR_ARG,                               CPID_CTF_CAPSHIELD,             XPND2(0, 0), _("^BGYou are now free.\n^BGFeel free to ^F2try to capture^BG the flag again\n^BGif you think you will succeed."), "") \
+       TWO_TEAMS_CENTER(CENTER_CTF_PASS_OTHER_,                                2, 0, XPND3(s1, _COL, s2),              CPID_CTF_PASS,                  XPND2(0, 0), _("^BG%s^BG passed the %s^BG flag to %s"), "") \
+       TWO_TEAMS_CENTER(CENTER_CTF_PASS_SENT_,                                 1, 0, XPND2(_COL, s1),                  CPID_CTF_PASS,                  XPND2(0, 0), _("^BGYou passed the %s^BG flag to %s"), "") \
+       TWO_TEAMS_CENTER(CENTER_CTF_PASS_RECEIVED_,                             1, 0, XPND2(_COL, s1),                  CPID_CTF_PASS,                  XPND2(0, 0), _("^BGYou received the %s^BG flag from %s"), "") \
+       MSG_CENTER_NOTIF(CENTER_CTF_PASS_REQUESTING,                    1, 0, s1,                                               CPID_CTF_PASS,                  XPND2(0, 0), _("^BGRequesting %s^BG to pass you the flag"), "") \
+       MSG_CENTER_NOTIF(CENTER_CTF_PASS_REQUESTED,                     1, 0, XPND2(s1, PASS_KEY),              CPID_CTF_PASS,                  XPND2(0, 0), _("^BG%s^BG requests you to pass the flag%s"), "") \
+       TWO_TEAMS_CENTER(CENTER_CTF_RETURN_,                                    0, 0, _COL,                                             CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYou returned the %s^BG flag"), "") \
+       TWO_TEAMS_CENTER(CENTER_CTF_CAPTURE_,                                   0, 0, _COL,                                             CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYou captured the %s^BG flag"), "") \
+       TWO_TEAMS_CENTER(CENTER_CTF_PICKUP_,                                    0, 0, _COL,                                             CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYou got the %s^BG flag!"), "") \
+       MSG_CENTER_NOTIF(CENTER_CTF_PICKUP_TEAM,                                1, 0, s1,                                               CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYour %steam mate^BG got the flag! Protect them!"), "") \
+       MSG_CENTER_NOTIF(CENTER_CTF_PICKUP_TEAM_VERBOSE,                2, 0, XPND3(s1, s2, s1),                CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGYour %steam mate (^BG%s%s)^BG got the flag! Protect them!"), "") \
+       MSG_CENTER_NOTIF(CENTER_CTF_PICKUP_ENEMY,                               1, 0, s1,                                               CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGThe %senemy^BG got your flag! Retrieve it!"), "") \
+       MSG_CENTER_NOTIF(CENTER_CTF_PICKUP_ENEMY_VERBOSE,               2, 0, XPND3(s1, s2, s1),                CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGThe %senemy (^BG%s%s)^BG got your flag! Retrieve it!"), "") \
+       MSG_CENTER_NOTIF(CENTER_CTF_STALEMATE_CARRIER,                  0, 0, NO_STR_ARG,                               CPID_STALEMATE,                 XPND2(0, 0), _("^BGStalemate! Enemies can now see you on radar!"), "") \
+       MSG_CENTER_NOTIF(CENTER_CTF_STALEMATE_OTHER,                    0, 0, NO_STR_ARG,                               CPID_STALEMATE,                 XPND2(0, 0), _("^BGStalemate! Flag carriers can now be seen by enemies on radar!"), "") \
+       MSG_CENTER_NOTIF(CENTER_CTF_FLAG_THROW_PUNISH,                  0, 1, f1,                                               CPID_CTF_LOWPRIO,               XPND2(0, 0), _("^BGToo many flag throws! Throwing disabled for %d seconds."), "") \
        #undef MSG_CENTER_NOTIF
 
 #define MSG_WEAPON_NOTIFICATIONS \