]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added svc_pointparticles1 for next protocol bump (uses 15 bytes instead
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 21 May 2007 22:13:46 +0000 (22:13 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 21 May 2007 22:13:46 +0000 (22:13 +0000)
of 29 bytes for the potentially common case of zero velocity and a count
of 1)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7330 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
protocol.h
svvm_cmds.c

index 5c80f8a7fd1e1d09c5be680f535eb18a7cdbb999..7c0dac208cc72daecf7ea9cf22e10d7d0e1f2eb3 100644 (file)
@@ -2539,6 +2539,15 @@ void CL_ParsePointParticles(void)
        CL_ParticleEffect(effectindex, count, origin, origin, velocity, velocity, NULL, 0);
 }
 
+void CL_ParsePointParticles1(void)
+{
+       int effectindex;
+       vec3_t origin;
+       effectindex = (unsigned short)MSG_ReadShort();
+       MSG_ReadVector(origin, cls.protocol);
+       CL_ParticleEffect(effectindex, 1, origin, origin, vec3_origin, vec3_origin, NULL, 0);
+}
+
 typedef struct cl_iplog_item_s
 {
        char *address;
@@ -3714,6 +3723,9 @@ void CL_ParseServerMessage(void)
                        case svc_pointparticles:
                                CL_ParsePointParticles();
                                break;
+                       case svc_pointparticles1:
+                               CL_ParsePointParticles1();
+                               break;
                        }
                }
        }
index b12aab92aaaf3a857ed0a7b47d950da8e1f2f33e..309057400c8095bd3865029ff938d79f6ead64ff 100644 (file)
@@ -251,7 +251,8 @@ void Protocol_Names(char *buffer, size_t buffersize);
 #define svc_csqcentities       58              // [short] entnum [variable length] entitydata ... [short] 0x0000
 #define        svc_spawnstaticsound2   59      // [coord3] [short] samp [byte] vol [byte] aten
 #define svc_trailparticles     60              // [short] entnum [short] effectnum [vector] start [vector] end
-#define svc_pointparticles     61              // [short] effectnum [vector] start [vector] end [short] count
+#define svc_pointparticles     61              // [short] effectnum [vector] start [vector] velocity [short] count
+#define svc_pointparticles1    62              // [short] effectnum [vector] start, same as svc_pointparticles except velocity is zero and count is 1 (PROTOCOL_DARKPLACES8)
 
 //
 // client to server
index 23a7524e0a4e9a583e5d9856e0d75673474dcbbf..f6149fe10599c8b2e170384a10e4ce8ac4c0fdb8 100644 (file)
@@ -2648,13 +2648,30 @@ static void VM_SV_trailparticles (void)
 //#337 void(float effectnum, vector origin, vector dir, float count) pointparticles (EXT_CSQC)
 static void VM_SV_pointparticles (void)
 {
-       VM_SAFEPARMCOUNT(4, VM_SV_pointparticles);
+       int effectnum, count;
+       vec3_t org, vel;
+       VM_SAFEPARMCOUNTRANGE(4, 8, VM_SV_pointparticles);
+       effectnum = (int)PRVM_G_FLOAT(OFS_PARM0);
+       VectorCopy(PRVM_G_VECTOR(OFS_PARM1), org);
+       VectorCopy(PRVM_G_VECTOR(OFS_PARM2), vel);
+       count = bound(0, (int)PRVM_G_FLOAT(OFS_PARM3), 65535);
+       if (count == 1 && !VectorLength2(vel) && (sv.protocol != PROTOCOL_QUAKE && sv.protocol != PROTOCOL_QUAKEDP && sv.protocol != PROTOCOL_NEHAHRAMOVIE && sv.protocol != PROTOCOL_DARKPLACES1 && sv.protocol != DARKPLACES2 && sv.protocol != DARKPLACES3 && sv.protocol != DARKPLACES4 && sv.protocol != DARKPLACES5 && sv.protocol != DARKPLACES6 && sv.protocol != DARKPLACES7))
+       {
+               // 1+2+12=15 bytes
+               MSG_WriteByte(&sv.datagram, svc_pointparticles1);
+               MSG_WriteShort(&sv.datagram, effectnum);
+               MSG_WriteVector(&sv.datagram, org, sv.protocol);
+       }
+       else
+       {
+               // 1+2+12+12+2=29 bytes
+               MSG_WriteByte(&sv.datagram, svc_pointparticles);
+               MSG_WriteShort(&sv.datagram, effectnum);
+               MSG_WriteVector(&sv.datagram, org, sv.protocol);
+               MSG_WriteVector(&sv.datagram, vel, sv.protocol);
+               MSG_WriteShort(&sv.datagram, count);
+       }
 
-       MSG_WriteByte(&sv.datagram, svc_pointparticles);
-       MSG_WriteShort(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM0));
-       MSG_WriteVector(&sv.datagram, PRVM_G_VECTOR(OFS_PARM1), sv.protocol);
-       MSG_WriteVector(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2), sv.protocol);
-       MSG_WriteShort(&sv.datagram, bound(0, (int)PRVM_G_FLOAT(OFS_PARM3), 65535));
        SV_FlushBroadcastMessages();
 }