]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/net_notice.qc
Net: move message headers to their respective files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / net_notice.qc
index caaae8b4967bfa70c214d998ab05efc5aeacb94b..b54e19e98312b5ef91fb7e98293cb458a7ce86c3 100644 (file)
@@ -1,19 +1,23 @@
+#include "net_notice.qh"
+
+REGISTER_NET_TEMP(TE_CSQC_SVNOTICE)
+
 #ifdef SVQC
 void sv_notice_join_think()
-{
+{SELFPARAM();
     //NextLevel();
     float argc = tokenizebyseparator(autocvar_sv_join_notices, "|");
     if(argc > 0)
     {
         float i;
         for(i = argc - 1; i >= 0; --i)
-            sv_notice_to(self.owner, argv(i), autocvar_sv_join_notices_time, FALSE);
+            sv_notice_to(self.owner, argv(i), autocvar_sv_join_notices_time, false);
     }
     remove(self);
 }
 
 void sv_notice_join()
-{
+{SELFPARAM();
     // to-do: make sv_join_notices support per-entry times
     if(autocvar_sv_join_notices == "")
         return;
@@ -27,8 +31,7 @@ void sv_notice_join()
 void sv_notice_to(entity _to, string _notice, float _howlong, float _modal)
 {
        msg_entity = _to;
-       WriteByte(MSG_ONE, SVC_TEMPENTITY);
-       WriteByte(MSG_ONE, TE_CSQC_SVNOTICE);
+       WriteHeader(MSG_ONE, TE_CSQC_SVNOTICE);
        WriteString(MSG_ONE, _notice);
        WriteLong(MSG_ONE, _howlong);
        WriteByte(MSG_ONE, _modal);
@@ -45,16 +48,16 @@ void sv_notice_toall(string _notice, float _howlong, float _modal)
 #endif // SVQC
 
 #ifdef CSQC
-void SUB_Remove()
-{ remove(self); }
-
+NET_HANDLE(TE_CSQC_SVNOTICE, bool isNew)
+{
+       cl_notice_read();
+       return true;
+}
 void cl_notice_read()
 {
-    entity _notice;
     //float _done;
     //float _modal;
-    _notice = spawn();
-    _notice.classname = "sv_notice";
+    entity _notice = new(sv_notice);
     _notice.netname = strzone(ReadString());
     _notice.alpha = ReadLong() + time;
     _notice.skin = ReadByte();
@@ -64,11 +67,11 @@ float cl_notice_run()
 {
     entity _notes;
     string _notice;
-    float m = FALSE;
+    float m = false;
 
     _notes = findchain(classname, "sv_notice");
     if(!_notes)
-        return FALSE;
+        return false;
     #define M1 30
     #define M2 10
 
@@ -96,7 +99,7 @@ float cl_notice_run()
         OUT(_notice, 16);
 
         if(_notes.skin)
-            m = TRUE;
+            m = true;
 
         if(_notes.alpha <= time)
         {