]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/campaign_message_tweak' into 'master'
authorMario <mario.mario@y7mail.com>
Fri, 13 Mar 2020 12:14:39 +0000 (12:14 +0000)
committerMario <mario.mario@y7mail.com>
Fri, 13 Mar 2020 12:14:39 +0000 (12:14 +0000)
Campaign message tweaks

See merge request xonotic/xonotic-data.pk3dir!763

notifications.cfg
qcsrc/common/notifications/all.inc
qcsrc/common/notifications/all.qh
qcsrc/menu/xonotic/campaign.qc
qcsrc/server/campaign.qc
qcsrc/server/campaign.qh
qcsrc/server/client.qc

index 80b26a9d8a34151049d24e0a4a9bf007bcd2bf9f..41f0706ea3d72f95c1d2b4180c3a27d5dd6232ad 100644 (file)
@@ -351,11 +351,12 @@ seta notification_INFO_WEAPON_TUBA_SUICIDE "1" "0 = off, 1 = print to console, 2
 seta notification_INFO_WEAPON_VAPORIZER_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_VORTEX_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 
-// MSG_CENTER notifications (count = 239):
+// MSG_CENTER notifications (count = 240):
 seta notification_CENTER_ALONE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ASSAULT_ATTACKING "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ASSAULT_DEFENDING "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ASSAULT_OBJ_DESTROYED "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_CAMPAIGN_MESSAGE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_CAMPCHECK "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_COINTOSS "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_COUNTDOWN_BEGIN "1" "0 = off, 1 = centerprint"
@@ -753,4 +754,4 @@ seta notification_show_sprees_info "3" "Show spree information in MSG_INFO messa
 seta notification_show_sprees_info_newline "1" "Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself"
 seta notification_show_sprees_info_specialonly "1" "Don't show attacker spree information in MSG_INFO messages if it isn't an achievement"
 
-// Notification counts (total = 846): MSG_ANNCE = 89, MSG_INFO = 334, MSG_CENTER = 239, MSG_MULTI = 156, MSG_CHOICE = 28
+// Notification counts (total = 847): MSG_ANNCE = 89, MSG_INFO = 334, MSG_CENTER = 240, MSG_MULTI = 156, MSG_CHOICE = 28
index 036a8b5e3c74e6391cf1aadec15251ca8b871eb9..0b0ea6bd920d385915c71ea8b8cf185dfbbcc515 100644 (file)
     MSG_CENTER_NOTIF(INSTAGIB_FINDAMMO_FIRST,           N_ENABLE,    0, 0, "",               CPID_INSTAGIB_FINDAMMO, "1 10", _("^BGGet some ammo or you'll be dead in ^F4^COUNT^BG!"), _("^BGGet some ammo! ^F4^COUNT^BG left!"))
     MSG_CENTER_NOTIF(INSTAGIB_LIVES_REMAINING,          N_ENABLE,    0, 1, "f1",             CPID_Null,              "0 0",  _("^F2Extra lives remaining: ^K1%s"), "")
 
-    MSG_CENTER_NOTIF(MOTD,                              N_ENABLE,    1, 0, "s1",             CPID_MOTD,              "-1 0", "^BG%s", "")
+    MSG_CENTER_NOTIF(CAMPAIGN_MESSAGE,                  N_ENABLE,    1, 1, "f1 s1 join_key", CPID_CAMPAIGN_MESSAGE,  "-1 0", strcat(_("Level %s: "), "^BG%s\n^3\n", _("^BGPress ^F2%s^BG to enter the game")), "")
+    MSG_CENTER_NOTIF(MOTD,                              N_ENABLE,    1, 0, "s1 join_key",    CPID_MOTD,              "-1 0", strcat("^BG%s\n^3\n", _("^BGPress ^F2%s^BG to enter the game")), "")
 
     MSG_CENTER_NOTIF(NIX_COUNTDOWN,                     N_ENABLE,    0, 2, "item_wepname",   CPID_NIX,               "1 f2", _("^F2^COUNT^BG until weapon change...\nNext weapon: ^F1%s"), "")
     MSG_CENTER_NOTIF(NIX_NEWWEAPON,                     N_ENABLE,    0, 1, "item_wepname",   CPID_NIX,               "0 0",  _("^F2Active weapon: ^F1%s"), "")
index 7c341293b958fba3bc963d59eaa65f727553ec79..192c2243252650ecd02a1936660781a9f09c8b69 100644 (file)
@@ -62,6 +62,7 @@ ENUMCLASS(CPID)
        CASE(CPID, MISSING_TEAMS)
        CASE(CPID, MISSING_PLAYERS)
        CASE(CPID, INSTAGIB_FINDAMMO)
+       CASE(CPID, CAMPAIGN_MESSAGE)
        CASE(CPID, MOTD)
        CASE(CPID, NIX)
        CASE(CPID, ONSLAUGHT)
@@ -423,6 +424,7 @@ string BUFF_NAME(int i);
        ARG_CASE(ARG_CS,        "missing_teams", notif_arg_missing_teams(f1)) \
        ARG_CASE(ARG_CS,        "pass_key",      getcommandkey(_("drop flag"), "+use")) \
        ARG_CASE(ARG_CS,        "nade_key",      getcommandkey(_("throw nade"), "dropweapon")) \
+       ARG_CASE(ARG_CS,        "join_key",      getcommandkey(_("jump"), "+jump")) \
        ARG_CASE(ARG_CS,        "frag_ping",     notif_arg_frag_ping(true, f2)) \
        ARG_CASE(ARG_CS,        "frag_stats",    notif_arg_frag_stats(f2, f3, f4)) \
        /*ARG_CASE(ARG_CS,      "frag_pos",      ((Should_Print_Score_Pos(f1)) ? sprintf("\n^BG%s", Read_Score_Pos(f1)) : ""))*/ \
index 0f64aefdbc1a207248f7d1b29e206610b8d7c18e..6f1d5111b84ea5c6c2af47e48e7430704293278a 100644 (file)
@@ -239,7 +239,9 @@ void XonoticCampaignList_drawListBoxItem(entity me, int i, vector absSize, bool
                s = campaign_shortdesc[i]; // fteqcc sucks
        else
                s = "???";
-       s = draw_TextShortenToWidth(sprintf(_("Level %d: %s"), i+1, s), me.columnNameSize, 0, me.realFontSize);
+       // NOTE the following string is equal to the one used in the campaign level notification
+       // (CAMPAIGN_MESSAGE) to avoid adding another duplicate string to translate
+       s = draw_TextShortenToWidth(strcat(sprintf(_("Level %s: "), itos(i+1)), s), me.columnNameSize, 0, me.realFontSize);
        draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, theColor, theAlpha, 0);
 
        if(i <= me.campaignIndex)
index f0fcea6abf62def2f2d8cabf03556955cf7dbd7d..336d825a7f58cc2ba4aa99ae1a45d81781293b80 100644 (file)
@@ -75,10 +75,19 @@ float Campaign_Invalid()
        return 0;
 }
 
+int Campaign_GetLevelNum()
+{
+       return campaign_level + 1;
+}
+
+string Campaign_GetMessage()
+{
+       return strcat(campaign_shortdesc[0], "\n^3\n", campaign_longdesc[0]);
+}
+
 void CampaignPreInit()
 {
        float baseskill;
-       string title;
        campaign_level = autocvar__campaign_index;
        campaign_name = strzone(autocvar__campaign_name);
        campaign_index_var = strzone(strcat("g_campaign", campaign_name, "_index"));
@@ -142,11 +151,6 @@ void CampaignPreInit()
 
        if(Campaign_Invalid())
                return;
-
-       title = campaign_shortdesc[0];
-       title = strzone(strcat("Level ", ftos(campaign_level + 1), ": ", title));
-       campaign_message = strzone(strcat(title, "\n^3\n", campaign_longdesc[0], "\n\n^1press jump to enter the game"));
-       strunzone(title);
 }
 
 void CampaignPostInit()
@@ -309,7 +313,6 @@ void CampaignPostIntermission()
 
        CampaignSetup(campaign_won);
        CampaignFile_Unload();
-       strunzone(campaign_message);
        strunzone(campaign_index_var);
        strunzone(campaign_name);
        campaign_name = "";
index df25c6c6ac5430581e13b7bb293446159e38b1d6..0662a3704f1eeaa0b0ea0a3560477f10c9d3579a 100644 (file)
@@ -3,7 +3,8 @@
 // this must be included BEFORE campaign_common.h to make this a memory saving
 #define CAMPAIGN_MAX_ENTRIES 2
 
-string campaign_message;
+int Campaign_GetLevelNum();
+string Campaign_GetMessage();
 
 void CampaignPreInit();
 void CampaignPostInit();
index b06f16310cea3f1e036631b7bd39016577d56d26..dd906931176d48a4293b2792044ff4258da73496 100644 (file)
@@ -2027,7 +2027,7 @@ void PrintWelcomeMessage(entity this)
                if (autocvar_g_campaign) {
                        if ((IS_PLAYER(this) && PHYS_INPUT_BUTTON_INFO(this)) || (!IS_PLAYER(this))) {
                                CS(this).motd_actived_time = time;
-                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, campaign_message);
+                               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_CAMPAIGN_MESSAGE, Campaign_GetMessage(), Campaign_GetLevelNum());
                        }
                } else {
                        if (PHYS_INPUT_BUTTON_INFO(this)) {
@@ -2043,7 +2043,7 @@ void PrintWelcomeMessage(entity this)
                                CS(this).motd_actived_time = time;
                        else if ((time - CS(this).motd_actived_time > 2) && IS_PLAYER(this)) { // hide it some seconds after BUTTON_INFO has been released
                                CS(this).motd_actived_time = 0;
-                               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
+                               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_CAMPAIGN_MESSAGE);
                        }
                } else {
                        if (PHYS_INPUT_BUTTON_INFO(this))
@@ -2062,7 +2062,10 @@ void PrintWelcomeMessage(entity this)
                {
                        // instantly hide MOTD
                        CS(this).motd_actived_time = 0;
-                       Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
+                       if (autocvar_g_campaign)
+                               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_CAMPAIGN_MESSAGE);
+                       else
+                               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
                }
                else if (IS_PLAYER(this) || IS_SPEC(this))
                {