From: Samual Lenks <samual@xonotic.org>
Date: Tue, 25 Sep 2012 04:16:02 +0000 (-0400)
Subject: Begin writing the networking system
X-Git-Tag: xonotic-v0.7.0~62^2~23^2~428
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8a93411472f8df543b2d86ba3e6ad0a0617f3d32;p=xonotic%2Fxonotic-data.pk3dir.git

Begin writing the networking system
---

diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc
index a956a5eaec..d63ad4251d 100644
--- a/qcsrc/common/notifications.qc
+++ b/qcsrc/common/notifications.qc
@@ -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
@@ -12,13 +11,13 @@
 #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 ""
@@ -32,22 +31,70 @@
 //
 // 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
diff --git a/qcsrc/server/progs.src b/qcsrc/server/progs.src
index 136ece3b16..9c62fedc9a 100644
--- a/qcsrc/server/progs.src
+++ b/qcsrc/server/progs.src
@@ -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