]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Begin writing the networking system
authorSamual Lenks <samual@xonotic.org>
Tue, 25 Sep 2012 04:16:02 +0000 (00:16 -0400)
committerSamual Lenks <samual@xonotic.org>
Tue, 25 Sep 2012 04:16:02 +0000 (00:16 -0400)
qcsrc/common/notifications.qc
qcsrc/server/progs.src

index a956a5eaecc17af46ec248bc11f978414b606704..d63ad4251d5b7108cc1f36b75708796a5d8e8eb4 100644 (file)
@@ -1,7 +1,6 @@
 // =====================
 //  Notification System
 // =====================
-
 // main types/groups of notifications
 #define MSG_INFO 1 // information messages (sent to console)
 #define MSG_NOTIFY 2 // events to be sent to the notification panel
 #define CLPS3(arg1,arg2,arg3) arg1, arg2, arg3
 #define CLPS2(arg1,arg2) arg1, arg2
 
+
 // ===================
 //  Notification List
 // ===================
 // List of all notifications (including identifiers and display information)
-// Format: type, name, number, args, special, normal, gentle
+// Format: name, number, args, special, normal, gentle
 // Specifications:
-//    Type of notification
 //    Name of notification
 //    ID number of notification
 //    Arguments for sprintf(string, args), if no args needed then use ""
 //
 // Messages have ^FG1, ^FG2, and ^BG in them-- these are replaced
 // with colors according to the cvars the user has chosen.
+//    ^FG1 = highest priority, "primary"
+//    ^FG2 = next highest priority, "secondary"
+//    ^BG = less important information, "tertiary"
+
+#define MSG_INFO_NOTIFICATIONS \
+       NOTIFICATION(DEATH_MARBLES_LOST, 1, CLPS3(s1, s2, s3), "notify_death", _("^FG1%s^BG lost their marbles against ^FG1%s^BG using the ^FG2%s^BG\n"), "") \
+       /* nothing */
+
+#define MSG_NOTIFY_NOTIFICATIONS \
+       NOTIFICATION(DEATH_MARBLES_LOST2, 1, CLPS3(s1, s2, s3), "notify_death", _("^FG1%s^BG lost their marbles against ^FG1%s^BG using the ^FG2%s^BG\n"), "") \
+       /* nothing */
 
-#define NOTIFICATIONS \
-       NOTIFICATION(MSG_NOTIFY, DEATH_MARBLES_LOST, 1, CLPS3(s1, s2, s3), "notify_death", _("^FG1%s^BG lost their marbles against ^FG1%s^BG using the ^FG2%s^BG\n"), "") \
-       NOTIFICATION(MSG_CENTER, CENTER_CTF_CAPTURESHIELD_SHIELDED, 1, "", CPID_CTF_CAPTURESHIELD, _("^BGYou are now ^FG1shielded^BG from the flag\n^BGfor ^FG2too many unsuccessful attempts^BG to capture.\n\n^BGMake some defensive scores before trying again."), "") \
+#define MSG_CENTER_NOTIFICATIONS \
+       NOTIFICATION(CENTER_CTF_CAPTURESHIELD_SHIELDED, 1, "", CPID_CTF_CAPTURESHIELD, _("^BGYou are now ^FG1shielded^BG from the flag\n^BGfor ^FG2too many unsuccessful attempts^BG to capture.\n\n^BGMake some defensive scores before trying again."), "") \
+       NOTIFICATION(CENTER_CTF_CAPTURESHIELD_FREE, 2, "", CPID_CTF_CAPTURESHIELD, _("^BGYou are now free.\n\n^BGFeel free to ^FG2try to capture^BG the flag again\n^BGif you think you will succeed."), "") \
+       NOTIFICATION(CENTER_CTF_PASS, 10, CLPS2(s1, s2, s3), CPID_CTF_CAPTURESHIELD, _("^BG%s passed the ^FG1%s^BG to %s"), "") \
+       NOTIFICATION(CENTER_CTF_PASS_SENT, 11, CLPS2(s1, s2), CPID_CTF_CAPTURESHIELD, _("^BGYou passed the ^FG1%s^BG to %s"), "") \
+       NOTIFICATION(CENTER_CTF_PASS_RECEIVED, 12, CLPS2(s1, s2), CPID_CTF_CAPTURESHIELD, _("^BGYou received the ^FG1%s^BG from %s"), "") \
+       /* nothing */
+
+#define MSG_WEAPON_NOTIFICATIONS \
+       NOTIFICATION(DEATH_MARBLES_LOST3, 1, CLPS3(s1, s2, s3), "notify_death", _("^FG1%s^BG lost their marbles against ^FG1%s^BG using the ^FG2%s^BG\n"), "") \
        /* nothing */
 
 // declare notifications
-#define NOTIFICATION(type,name,num,args,special,normal,gentle) float name = num;
-NOTIFICATIONS
+#define NOTIFICATION(name,num,args,special,normal,gentle) float name = num;
+MSG_INFO_NOTIFICATIONS
+MSG_NOTIFY_NOTIFICATIONS
+MSG_CENTER_NOTIFICATIONS
+MSG_WEAPON_NOTIFICATIONS
 #undef NOTIFICATION
 
 
-void testingthisshit()
+#ifdef CSQC
+void readnotificationorwhatever()
 {
-       print("KILL_FRAG = ", ftos(KILL_FRAG), ".\n");
+       //stuff and things
+}
+#endif
 
 
-       return;
+// ================
+//  
+#ifdef SVQC
+//#define WRITESPECTATABLE_MSG_ONE_VARNAME(varname,statement) entity varname; varname = msg_entity; FOR_EACH_REALCLIENT(msg_entity) if(msg_entity == varname || (msg_entity.classname == STR_SPECTATOR && msg_entity.enemy == varname)) statement msg_entity = varname
+//#define WRITESPECTATABLE_MSG_ONE(statement) WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement)
+//#define WRITESPECTATABLE(msg,statement) if(msg == MSG_ONE) { WRITESPECTATABLE_MSG_ONE(statement); } else statement float WRITESPECTATABLE_workaround = 0
+
+void Send_Notification(float type, entity client, float id, string s, float duration, float countdown_num)
+{
+       if ((clienttype(client) == CLIENTTYPE_REAL) && (client.flags & FL_CLIENT))
+       {
+               msg_entity = client;
+               WRITESPECTATABLE_MSG_ONE({
+                       WriteByte(MSG_ONE, SVC_TEMPENTITY);
+                       //WriteByte(MSG_ONE, TE_CSQC_NOTIFICATION);
+                       WriteByte(MSG_ONE, id);
+                       WriteString(MSG_ONE, s);
+                       if (id != 0 && s != "")
+                       {
+                               WriteByte(MSG_ONE, duration);
+                               WriteByte(MSG_ONE, countdown_num);
+                       }
+               });
+       }
 }
+#endif
index 136ece3b16ea512bf75706932154ecc34eefe460..9c62fedc9a0ba76858e4f570860a058258d55a88 100644 (file)
@@ -82,12 +82,12 @@ playerdemo.qh
 item_key.qh
 secret.qh
 
-../common/notifications.qc
-
 scores_rules.qc
 
 miscfunctions.qc
 
+../common/notifications.qc
+
 waypointsprites.qc
 
 bot/bot.qc