From 4cb0405b45eb7b62f0c5c167a909910d084acf85 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 18 Feb 2007 12:57:43 +0000 Subject: [PATCH] added svc_trailparticles and svc_pointparticles, these are written by the trailparticles and pointparticles server builtins (matching the csqc ones), these can utilize any effect defined in effectinfo.txt without using csqc git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6855 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_parse.c | 33 +++++++++++++++++++++++++++++++++ protocol.h | 4 +++- svvm_cmds.c | 40 ++++++++++++++++++++++++++++++++-------- 3 files changed, 68 insertions(+), 9 deletions(-) diff --git a/cl_parse.c b/cl_parse.c index ef9805b2..b33fd7e7 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -2367,6 +2367,33 @@ void CL_ParseTempEntity(void) } } +void CL_ParseTrailParticles(void) +{ + int entityindex; + int effectindex; + vec3_t start, end; + entityindex = (unsigned short)MSG_ReadShort(); + if (entityindex >= MAX_EDICTS) + entityindex = 0; + if (entityindex >= cl.max_entities) + CL_ExpandEntities(entityindex); + effectindex = (unsigned short)MSG_ReadShort(); + MSG_ReadVector(start, cls.protocol); + MSG_ReadVector(end, cls.protocol); + CL_ParticleEffect(effectindex, VectorDistance(start, end), start, end, vec3_origin, vec3_origin, entityindex > 0 ? cl.entities + entityindex : NULL, 0); +} + +void CL_ParsePointParticles(void) +{ + int effectindex, count; + vec3_t origin, velocity; + effectindex = (unsigned short)MSG_ReadShort(); + MSG_ReadVector(origin, cls.protocol); + MSG_ReadVector(velocity, cls.protocol); + count = (unsigned short)MSG_ReadShort(); + CL_ParticleEffect(effectindex, count, origin, origin, velocity, velocity, NULL, 0); +} + // look for anything interesting like player IP addresses or ping reports qboolean CL_ExaminePrintString(const char *text) { @@ -3313,6 +3340,12 @@ void CL_ParseServerMessage(void) case svc_downloaddata: CL_ParseDownload(); break; + case svc_trailparticles: + CL_ParseTrailParticles(); + break; + case svc_pointparticles: + CL_ParsePointParticles(); + break; } } } diff --git a/protocol.h b/protocol.h index 350bdb60..00f25a89 100644 --- a/protocol.h +++ b/protocol.h @@ -224,7 +224,7 @@ void Protocol_Names(char *buffer, size_t buffersize); #define svc_hidelmp 36 // [string] slotname #define svc_skybox 37 // [string] skyname -// LordHavoc: my svc_ range, 50-59 +// LordHavoc: my svc_ range, 50-69 #define svc_downloaddata 50 // [int] start [short] size #define svc_updatestatubyte 51 // [byte] stat [byte] value #define svc_effect 52 // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate @@ -236,6 +236,8 @@ void Protocol_Names(char *buffer, size_t buffersize); #define svc_entities 57 // [int] deltaframe [int] thisframe [float vector] eye [variable length] entitydata #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 // // client to server diff --git a/svvm_cmds.c b/svvm_cmds.c index e58daf81..74634725 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -8,19 +8,19 @@ cvar_t sv_aim = {CVAR_SAVE, "sv_aim", "2", "maximum cosine angle for quake's ver char *vm_sv_extensions = "BX_WAL_SUPPORT " -"DP_CON_EXPANDCVAR " -"DP_CON_ALIASPARAMETERS " "DP_BUTTONCHAT " "DP_BUTTONUSE " "DP_CL_LOADSKY " +"DP_CON_ALIASPARAMETERS " +"DP_CON_EXPANDCVAR " "DP_CON_SET " "DP_CON_SETA " "DP_CON_STARTMAP " "DP_EF_ADDITIVE " "DP_EF_BLUE " +"DP_EF_DOUBLESIDED " "DP_EF_FLAME " "DP_EF_FULLBRIGHT " -"DP_EF_DOUBLESIDED " "DP_EF_NODEPTHTEST " "DP_EF_NODRAW " "DP_EF_NOSHADOW " @@ -59,7 +59,7 @@ char *vm_sv_extensions = "DP_QC_FINDCHAINFLOAT " "DP_QC_FINDFLAGS " "DP_QC_FINDFLOAT " -"DP_QC_FS_SEARCH " // Black: same as in the menu qc +"DP_QC_FS_SEARCH " "DP_QC_GETLIGHT " "DP_QC_GETSURFACE " "DP_QC_GETTAGINFO " @@ -70,11 +70,11 @@ char *vm_sv_extensions = "DP_QC_STRFTIME " "DP_QC_STRINGBUFFERS " "DP_QC_STRINGCOLORFUNCTIONS " -"DP_QC_UNLIMITEDTEMPSTRINGS " "DP_QC_TRACEBOX " "DP_QC_TRACETOSS " "DP_QC_TRACE_MOVETYPE_HITMODEL " "DP_QC_TRACE_MOVETYPE_WORLDONLY " +"DP_QC_UNLIMITEDTEMPSTRINGS " "DP_QC_VECTORVECTORS " "DP_QUAKE2_MODEL " "DP_QUAKE2_SPRITE " @@ -126,11 +126,11 @@ char *vm_sv_extensions = "KRIMZON_SV_PARSECLIENTCOMMAND " "NEH_CMD_PLAY2 " "NEH_RESTOREGAME " +"NEXUIZ_PLAYERMODEL " "NXQ_GFX_LETTERBOX " "PRYDON_CLIENTCURSOR " "TENEBRAE_GFX_DLIGHTS " "TW_SV_STEPCONTROL " -"NEXUIZ_PLAYERMODEL " ; /* @@ -2517,6 +2517,30 @@ void PF_edict_num (void) VM_RETURN_EDICT(PRVM_EDICT_NUM((int)PRVM_G_FLOAT(OFS_PARM0))); } +// #336 void(entity ent, float effectnum, vector start, vector end) trailparticles (EXT_CSQC) +static void VM_SV_trailparticles (void) +{ + VM_SAFEPARMCOUNT(4, VM_SV_trailparticles); + + MSG_WriteByte(&sv.datagram, svc_trailparticles); + MSG_WriteShort(&sv.datagram, PRVM_G_EDICTNUM(OFS_PARM0)); + MSG_WriteShort(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM1)); + MSG_WriteVector(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2), sv.protocol); + MSG_WriteVector(&sv.datagram, PRVM_G_VECTOR(OFS_PARM3), sv.protocol); +} + +//#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); + + 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)); +} + prvm_builtin_t vm_sv_builtins[] = { NULL, // #0 PF_makevectors, // #1 void(vector ang) makevectors @@ -2677,8 +2701,8 @@ NULL, // #332 NULL, // #333 NULL, // #334 NULL, // #335 -NULL, // #336 -NULL, // #337 +VM_SV_trailparticles, // #336 void(entity ent, float effectnum, vector start, vector end) trailparticles (EXT_CSQC) +VM_SV_pointparticles, // #337 void(float effectnum, vector origin [, vector dir, float count]) pointparticles (EXT_CSQC) NULL, // #338 VM_print, // #339 void(string, ...) print (DP_SV_PRINT) e10, // #340-349 -- 2.39.2