]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/net_notice.qc
Merge branch 'master' into TimePath/csqc_sounds
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / net_notice.qc
index fb9958b08fcbd186fd151b65afb89462d442a357..5deb0960e2daadefae90bec456b45510459d0241 100644 (file)
@@ -1,8 +1,10 @@
 #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)
@@ -15,7 +17,7 @@ void sv_notice_join_think()
 }
 
 void sv_notice_join()
-{
+{SELFPARAM();
     // to-do: make sv_join_notices support per-entry times
     if(autocvar_sv_join_notices == "")
         return;
@@ -29,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);
@@ -47,13 +48,16 @@ void sv_notice_toall(string _notice, float _howlong, float _modal)
 #endif // SVQC
 
 #ifdef CSQC
+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();
@@ -68,8 +72,8 @@ float cl_notice_run()
     _notes = findchain(classname, "sv_notice");
     if(!_notes)
         return false;
-    #define M1 30
-    #define M2 10
+    const int M1 = 30;
+    const int M2 = 10;
 
     vector v1, v2 = '0 0 0', v3;
     v1 = '1 1 0' * M1;
@@ -99,7 +103,7 @@ float cl_notice_run()
 
         if(_notes.alpha <= time)
         {
-            _notes.think = SUB_Remove;
+            _notes.think = SUB_Remove_self;
             _notes.nextthink = time;
         }
 
@@ -107,8 +111,6 @@ float cl_notice_run()
     }
 
     #undef OUT
-    #undef M1
-    #undef M2
 
     return m;
 }