X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=svvm_cmds.c;h=0bd684c91c752af429d6b481cb9c897c884c00e8;hp=4f43379eaffc1e1d659233194cd49ba4f4eeb140;hb=c3ea7019c9ce6dd91e6f40a027a45cd27da17385;hpb=1d8da07221092afe494af77d6cd5e47fa9d8bf5d diff --git a/svvm_cmds.c b/svvm_cmds.c index 4f43379e..0bd684c9 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -1,6 +1,7 @@ #include "quakedef.h" #include "prvm_cmds.h" +#include "jpeg.h" //============================================================================ // Server @@ -13,6 +14,7 @@ char *vm_sv_extensions = "DP_BUTTONUSE " "DP_CL_LOADSKY " "DP_CON_ALIASPARAMETERS " +"DP_CON_BESTWEAPON " "DP_CON_EXPANDCVAR " "DP_CON_SET " "DP_CON_SETA " @@ -24,10 +26,12 @@ char *vm_sv_extensions = "DP_EF_FULLBRIGHT " "DP_EF_NODEPTHTEST " "DP_EF_NODRAW " -"DP_EF_NOSHADOW " "DP_EF_NOGUNBOB " +"DP_EF_NOSELFSHADOW " +"DP_EF_NOSHADOW " "DP_EF_RED " "DP_EF_STARDUST " +"DP_EF_TELEPORT_BIT " "DP_ENT_ALPHA " "DP_ENT_COLORMOD " "DP_ENT_CUSTOMCOLORMAP " @@ -36,6 +40,7 @@ char *vm_sv_extensions = "DP_ENT_LOWPRECISION " "DP_ENT_SCALE " "DP_ENT_VIEWMODEL " +"DP_GECKO_SUPPORT " "DP_GFX_EXTERNALTEXTURES " "DP_GFX_EXTERNALTEXTURES_PERMAP " "DP_GFX_FOG " @@ -51,11 +56,18 @@ char *vm_sv_extensions = "DP_MONSTERWALK " "DP_MOVETYPEBOUNCEMISSILE " "DP_MOVETYPEFOLLOW " +"DP_NULL_MODEL " "DP_QC_ASINACOSATANATAN2TAN " "DP_QC_CHANGEPITCH " +"DP_QC_CMD " "DP_QC_COPYENTITY " +"DP_QC_CRC16 " "DP_QC_CVAR_DEFSTRING " +"DP_QC_CVAR_DESCRIPTION " "DP_QC_CVAR_STRING " +"DP_QC_CVAR_TYPE " +"DP_QC_EDICT_NUM " +"DP_QC_ENTITYDATA " "DP_QC_ETOS " "DP_QC_FINDCHAIN " "DP_QC_FINDCHAINFLAGS " @@ -65,23 +77,32 @@ char *vm_sv_extensions = "DP_QC_FS_SEARCH " "DP_QC_GETLIGHT " "DP_QC_GETSURFACE " +"DP_QC_GETSURFACEPOINTATTRIBUTE " "DP_QC_GETTAGINFO " +"DP_QC_GETTAGINFO_BONEPROPERTIES " "DP_QC_MINMAXBOUND " "DP_QC_MULTIPLETEMPSTRINGS " +"DP_QC_NUM_FOR_EDICT " "DP_QC_RANDOMVEC " "DP_QC_SINCOSSQRTPOW " "DP_QC_STRFTIME " -"DP_QC_STRING_CASE_FUNCTIONS " "DP_QC_STRINGBUFFERS " +"DP_QC_STRINGBUFFERS_CVARLIST " "DP_QC_STRINGCOLORFUNCTIONS " +"DP_QC_STRING_CASE_FUNCTIONS " +"DP_QC_STRREPLACE " "DP_QC_TOKENIZEBYSEPARATOR " +"DP_QC_TOKENIZE_CONSOLE " "DP_QC_TRACEBOX " "DP_QC_TRACETOSS " "DP_QC_TRACE_MOVETYPE_HITMODEL " "DP_QC_TRACE_MOVETYPE_WORLDONLY " "DP_QC_UNLIMITEDTEMPSTRINGS " +"DP_QC_URI_ESCAPE " +"DP_QC_URI_GET " "DP_QC_VECTOANGLES_WITH_ROLL " "DP_QC_VECTORVECTORS " +"DP_QC_WHICHPACK " "DP_QUAKE2_MODEL " "DP_QUAKE2_SPRITE " "DP_QUAKE3_MAP " @@ -96,15 +117,18 @@ char *vm_sv_extensions = "DP_SV_BOTCLIENT " "DP_SV_CLIENTCOLORS " "DP_SV_CLIENTNAME " +"DP_SV_CMD " "DP_SV_CUSTOMIZEENTITYFORCLIENT " "DP_SV_DRAWONLYTOCLIENT " "DP_SV_DROPCLIENT " "DP_SV_EFFECT " "DP_SV_ENTITYCONTENTSTRANSITION " -"DP_SV_ONENTITYNOSPAWNFUNCTION " "DP_SV_MODELFLAGS_AS_EFFECTS " +"DP_SV_MOVETYPESTEP_LANDEVENT " "DP_SV_NETADDRESS " "DP_SV_NODRAWTOCLIENT " +"DP_SV_ONENTITYNOSPAWNFUNCTION " +"DP_SV_ONENTITYPREPOSTSPAWNFUNCTION " "DP_SV_PING " "DP_SV_PLAYERPHYSICS " "DP_SV_POINTPARTICLES " @@ -112,9 +136,13 @@ char *vm_sv_extensions = "DP_SV_PRECACHEANYTIME " "DP_SV_PRINT " "DP_SV_PUNCHVECTOR " +"DP_SV_QCSTATUS " "DP_SV_ROTATINGBMODEL " "DP_SV_SETCOLOR " +"DP_SV_SHUTDOWN " "DP_SV_SLOWMO " +"DP_SV_SPAWNFUNC_PREFIX " +"DP_SV_WRITEPICTURE " "DP_SV_WRITEUNTERMINATEDSTRING " "DP_TE_BLOOD " "DP_TE_BLOODSHOWER " @@ -132,8 +160,8 @@ char *vm_sv_extensions = "DP_TRACE_HITCONTENTSMASK_SURFACEINFO " "DP_VIEWZOOM " "EXT_BITSHIFT " -//"EXT_CSQC " // not ready yet "FRIK_FILE " +"FTE_STRINGS " "KRIMZON_SV_PARSECLIENTCOMMAND " "NEH_CMD_PLAY2 " "NEH_RESTOREGAME " @@ -142,12 +170,8 @@ char *vm_sv_extensions = "PRYDON_CLIENTCURSOR " "TENEBRAE_GFX_DLIGHTS " "TW_SV_STEPCONTROL " -"DP_SV_CMD " -"DP_QC_CMD " -"FTE_STRINGS " -"DP_CON_BESTWEAPON " -"DP_QC_STRREPLACE " -"DP_QC_CRC16 " +"ZQ_PAUSE " +//"EXT_CSQC " // not ready yet ; /* @@ -244,7 +268,7 @@ static vec3_t quakemins = {-16, -16, -16}, quakemaxs = {16, 16, 16}; static void VM_SV_setmodel (void) { prvm_edict_t *e; - model_t *mod; + dp_model_t *mod; int i; VM_SAFEPARMCOUNT(2, VM_setmodel); @@ -616,7 +640,7 @@ static trace_t SV_Trace_Toss (prvm_edict_t *tossent, prvm_edict_t *ignore) gravity = val->_float; else gravity = 1.0; - gravity *= sv_gravity.value * 0.05; + gravity *= sv_gravity.value * 0.025; for (i = 0;i < 200;i++) // LordHavoc: sanity check; never trace more than 10 seconds { @@ -627,6 +651,7 @@ static trace_t SV_Trace_Toss (prvm_edict_t *tossent, prvm_edict_t *ignore) VectorAdd (tossent->fields.server->origin, move, end); trace = SV_Move (tossent->fields.server->origin, tossent->fields.server->mins, tossent->fields.server->maxs, end, MOVE_NORMAL, tossent, SV_GenericHitSuperContentsMask(tossent)); VectorCopy (trace.endpos, tossent->fields.server->origin); + tossent->fields.server->velocity[2] -= gravity; if (trace.fraction < 1) break; @@ -967,18 +992,52 @@ static void VM_SV_droptofloor (void) VectorCopy (ent->fields.server->origin, end); end[2] -= 256; - trace = SV_Move (ent->fields.server->origin, ent->fields.server->mins, ent->fields.server->maxs, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent)); + if (sv_gameplayfix_droptofloorstartsolid_nudgetocorrect.integer) + SV_UnstickEntity(ent); - if (trace.fraction != 1 || (trace.startsolid && sv_gameplayfix_droptofloorstartsolid.integer)) - { - if (trace.fraction < 1) + trace = SV_Move (ent->fields.server->origin, ent->fields.server->mins, ent->fields.server->maxs, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent)); + if (trace.startsolid && sv_gameplayfix_droptofloorstartsolid.integer) + { + vec3_t offset, org; + VectorSet(offset, 0.5f * (ent->fields.server->mins[0] + ent->fields.server->maxs[0]), 0.5f * (ent->fields.server->mins[1] + ent->fields.server->maxs[1]), ent->fields.server->mins[2]); + VectorAdd(ent->fields.server->origin, offset, org); + trace = SV_Move (org, vec3_origin, vec3_origin, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent)); + VectorSubtract(trace.endpos, offset, trace.endpos); + if (trace.startsolid) + { + Con_DPrintf("droptofloor at %f %f %f - COULD NOT FIX BADLY PLACED ENTITY\n", ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2]); + SV_UnstickEntity(ent); + SV_LinkEdict (ent, false); + ent->fields.server->flags = (int)ent->fields.server->flags | FL_ONGROUND; + ent->fields.server->groundentity = 0; + PRVM_G_FLOAT(OFS_RETURN) = 1; + } + else if (trace.fraction < 1) + { + Con_DPrintf("droptofloor at %f %f %f - FIXED BADLY PLACED ENTITY\n", ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2]); VectorCopy (trace.endpos, ent->fields.server->origin); - SV_LinkEdict (ent, false); - ent->fields.server->flags = (int)ent->fields.server->flags | FL_ONGROUND; - ent->fields.server->groundentity = PRVM_EDICT_TO_PROG(trace.ent); - PRVM_G_FLOAT(OFS_RETURN) = 1; - // if support is destroyed, keep suspended (gross hack for floating items in various maps) - ent->priv.server->suspendedinairflag = true; + SV_UnstickEntity(ent); + SV_LinkEdict (ent, false); + ent->fields.server->flags = (int)ent->fields.server->flags | FL_ONGROUND; + ent->fields.server->groundentity = PRVM_EDICT_TO_PROG(trace.ent); + PRVM_G_FLOAT(OFS_RETURN) = 1; + // if support is destroyed, keep suspended (gross hack for floating items in various maps) + ent->priv.server->suspendedinairflag = true; + } + } + else + { + if (trace.fraction != 1) + { + if (trace.fraction < 1) + VectorCopy (trace.endpos, ent->fields.server->origin); + SV_LinkEdict (ent, false); + ent->fields.server->flags = (int)ent->fields.server->flags | FL_ONGROUND; + ent->fields.server->groundentity = PRVM_EDICT_TO_PROG(trace.ent); + PRVM_G_FLOAT(OFS_RETURN) = 1; + // if support is destroyed, keep suspended (gross hack for floating items in various maps) + ent->priv.server->suspendedinairflag = true; + } } } @@ -1251,6 +1310,39 @@ static void VM_SV_WriteEntity (void) MSG_WriteShort (WriteDest(), PRVM_G_EDICTNUM(OFS_PARM1)); } +// writes a picture as at most size bytes of data +// message: +// IMGNAME \0 SIZE(short) IMGDATA +// if failed to read/compress: +// IMGNAME \0 \0 \0 +//#501 void(float dest, string name, float maxsize) WritePicture (DP_SV_WRITEPICTURE)) +static void VM_SV_WritePicture (void) +{ + const char *imgname; + void *buf; + size_t size; + + VM_SAFEPARMCOUNT(3, VM_SV_WritePicture); + + imgname = PRVM_G_STRING(OFS_PARM1); + size = (int) PRVM_G_FLOAT(OFS_PARM2); + if(size > 65535) + size = 65535; + + MSG_WriteString(WriteDest(), imgname); + if(Image_Compress(imgname, size, &buf, &size)) + { + // actual picture + MSG_WriteShort(WriteDest(), size); + SZ_Write(WriteDest(), (unsigned char *) buf, size); + } + else + { + // placeholder + MSG_WriteShort(WriteDest(), 0); + } +} + ////////////////////////////////////////////////////////// static void VM_SV_makestatic (void) @@ -1410,11 +1502,11 @@ void VM_SV_UpdateCustomStats (client_t *client, prvm_edict_t *ent, sizebuf_t *ms stats[i+35] = s[12] + s[13] * 256 + s[14] * 65536 + s[15] * 16777216; break; //float field sent as-is - case 2: + case 8: stats[i+32] = PRVM_E_INT(ent, vm_customstats[i].fieldoffset); break; //integer value of float field - case 8: + case 2: stats[i+32] = (int)PRVM_E_FLOAT(ent, vm_customstats[i].fieldoffset); break; default: @@ -1608,9 +1700,9 @@ static void VM_SV_te_blood (void) MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[1], sv.protocol); MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[2], sv.protocol); // velocity - MSG_WriteByte(&sv.datagram, bound(-128, (int) PRVM_G_VECTOR(OFS_PARM1)[0], 127)); - MSG_WriteByte(&sv.datagram, bound(-128, (int) PRVM_G_VECTOR(OFS_PARM1)[1], 127)); - MSG_WriteByte(&sv.datagram, bound(-128, (int) PRVM_G_VECTOR(OFS_PARM1)[2], 127)); + MSG_WriteChar(&sv.datagram, bound(-128, (int) PRVM_G_VECTOR(OFS_PARM1)[0], 127)); + MSG_WriteChar(&sv.datagram, bound(-128, (int) PRVM_G_VECTOR(OFS_PARM1)[1], 127)); + MSG_WriteChar(&sv.datagram, bound(-128, (int) PRVM_G_VECTOR(OFS_PARM1)[2], 127)); // count MSG_WriteByte(&sv.datagram, bound(0, (int) PRVM_G_FLOAT(OFS_PARM2), 255)); SV_FlushBroadcastMessages(); @@ -1748,9 +1840,9 @@ static void VM_SV_te_spark (void) MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[1], sv.protocol); MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[2], sv.protocol); // velocity - MSG_WriteByte(&sv.datagram, bound(-128, (int) PRVM_G_VECTOR(OFS_PARM1)[0], 127)); - MSG_WriteByte(&sv.datagram, bound(-128, (int) PRVM_G_VECTOR(OFS_PARM1)[1], 127)); - MSG_WriteByte(&sv.datagram, bound(-128, (int) PRVM_G_VECTOR(OFS_PARM1)[2], 127)); + MSG_WriteChar(&sv.datagram, bound(-128, (int) PRVM_G_VECTOR(OFS_PARM1)[0], 127)); + MSG_WriteChar(&sv.datagram, bound(-128, (int) PRVM_G_VECTOR(OFS_PARM1)[1], 127)); + MSG_WriteChar(&sv.datagram, bound(-128, (int) PRVM_G_VECTOR(OFS_PARM1)[2], 127)); // count MSG_WriteByte(&sv.datagram, bound(0, (int) PRVM_G_FLOAT(OFS_PARM2), 255)); SV_FlushBroadcastMessages(); @@ -2062,7 +2154,7 @@ static void VM_SV_te_flamejet (void) SV_FlushBroadcastMessages(); } -void clippointtosurface(model_t *model, msurface_t *surface, vec3_t p, vec3_t out) +void clippointtosurface(dp_model_t *model, msurface_t *surface, vec3_t p, vec3_t out) { int i, j, k; float *v[3], facenormal[3], edgenormal[3], sidenormal[3], temp[3], offsetdist, dist, bestdist; @@ -2098,7 +2190,7 @@ void clippointtosurface(model_t *model, msurface_t *surface, vec3_t p, vec3_t ou } } -static model_t *getmodel(prvm_edict_t *ed) +static dp_model_t *getmodel(prvm_edict_t *ed) { int modelindex; if (!ed || ed->priv.server->free) @@ -2109,7 +2201,7 @@ static model_t *getmodel(prvm_edict_t *ed) return sv.models[modelindex]; } -static msurface_t *getsurface(model_t *model, int surfacenum) +static msurface_t *getsurface(dp_model_t *model, int surfacenum) { if (surfacenum < 0 || surfacenum >= model->nummodelsurfaces) return NULL; @@ -2120,7 +2212,7 @@ static msurface_t *getsurface(model_t *model, int surfacenum) //PF_getsurfacenumpoints, // #434 float(entity e, float s) getsurfacenumpoints = #434; static void VM_SV_getsurfacenumpoints(void) { - model_t *model; + dp_model_t *model; msurface_t *surface; VM_SAFEPARMCOUNT(2, VM_SV_getsurfacenumpoints); // return 0 if no such surface @@ -2137,7 +2229,7 @@ static void VM_SV_getsurfacenumpoints(void) static void VM_SV_getsurfacepoint(void) { prvm_edict_t *ed; - model_t *model; + dp_model_t *model; msurface_t *surface; int pointnum; VM_SAFEPARMCOUNT(3, VM_SV_getsurfacepoint); @@ -2163,7 +2255,7 @@ static void VM_SV_getsurfacepoint(void) static void VM_SV_getsurfacepointattribute(void) { prvm_edict_t *ed; - model_t *model; + dp_model_t *model; msurface_t *surface; int pointnum; int attributetype; @@ -2228,7 +2320,7 @@ static void VM_SV_getsurfacepointattribute(void) //PF_getsurfacenormal, // #436 vector(entity e, float s) getsurfacenormal = #436; static void VM_SV_getsurfacenormal(void) { - model_t *model; + dp_model_t *model; msurface_t *surface; vec3_t normal; VM_SAFEPARMCOUNT(2, VM_SV_getsurfacenormal); @@ -2246,7 +2338,7 @@ static void VM_SV_getsurfacenormal(void) //PF_getsurfacetexture, // #437 string(entity e, float s) getsurfacetexture = #437; static void VM_SV_getsurfacetexture(void) { - model_t *model; + dp_model_t *model; msurface_t *surface; VM_SAFEPARMCOUNT(2, VM_SV_getsurfacetexture); PRVM_G_INT(OFS_RETURN) = OFS_NULL; @@ -2261,7 +2353,7 @@ static void VM_SV_getsurfacenearpoint(void) vec3_t clipped, p; vec_t dist, bestdist; prvm_edict_t *ed; - model_t *model; + dp_model_t *model; msurface_t *surface; vec_t *point; VM_SAFEPARMCOUNT(2, VM_SV_getsurfacenearpoint); @@ -2307,7 +2399,7 @@ static void VM_SV_getsurfacenearpoint(void) static void VM_SV_getsurfaceclippedpoint(void) { prvm_edict_t *ed; - model_t *model; + dp_model_t *model; msurface_t *surface; vec3_t p, out; VM_SAFEPARMCOUNT(3, VM_SV_te_getsurfaceclippedpoint); @@ -2352,7 +2444,7 @@ static void VM_SV_setattachment (void) const char *tagname = PRVM_G_STRING(OFS_PARM2); prvm_eval_t *v; int modelindex; - model_t *model; + dp_model_t *model; VM_SAFEPARMCOUNT(3, VM_SV_setattachment); if (e == prog->edicts) @@ -2396,7 +2488,7 @@ static void VM_SV_setattachment (void) int SV_GetTagIndex (prvm_edict_t *e, const char *tagname) { int i; - model_t *model; + dp_model_t *model; i = (int)e->fields.server->modelindex; if (i < 1 || i >= MAX_MODELS) @@ -2404,7 +2496,38 @@ int SV_GetTagIndex (prvm_edict_t *e, const char *tagname) model = sv.models[i]; return Mod_Alias_GetTagIndexForName(model, (int)e->fields.server->skin, tagname); -}; +} + +int SV_GetExtendedTagInfo (prvm_edict_t *e, int tagindex, int *parentindex, const char **tagname, matrix4x4_t *tag_localmatrix) +{ + int r; + dp_model_t *model; + int frame; + int modelindex; + + *tagname = NULL; + *parentindex = 0; + Matrix4x4_CreateIdentity(tag_localmatrix); + + if (tagindex >= 0 + && (modelindex = (int)e->fields.server->modelindex) >= 1 && modelindex < MAX_MODELS + && (model = sv.models[(int)e->fields.server->modelindex]) + && model->animscenes) + { + frame = (int)e->fields.server->frame; + if (frame < 0 || frame >= model->numframes) + frame = 0; + + r = Mod_Alias_GetExtendedTagInfoForIndex(model, (int)e->fields.server->skin, model->animscenes[frame].firstframe, tagindex - 1, parentindex, tagname, tag_localmatrix); + + if(!r) // success? + *parentindex += 1; + + return r; + } + + return 1; +} void SV_GetEntityMatrix (prvm_edict_t *ent, matrix4x4_t *out, qboolean viewmatrix) { @@ -2421,7 +2544,7 @@ int SV_GetEntityLocalTagMatrix(prvm_edict_t *ent, int tagindex, matrix4x4_t *out { int modelindex; int frame; - model_t *model; + dp_model_t *model; if (tagindex >= 0 && (modelindex = (int)ent->fields.server->modelindex) >= 1 && modelindex < MAX_MODELS && (model = sv.models[(int)ent->fields.server->modelindex]) @@ -2453,7 +2576,7 @@ int SV_GetTagMatrix (matrix4x4_t *out, prvm_edict_t *ent, int tagindex) prvm_eval_t *val; int modelindex, attachloop; matrix4x4_t entitymatrix, tagmatrix, attachmatrix; - model_t *model; + dp_model_t *model; *out = identitymatrix; // warnings and errors return identical matrix @@ -2573,7 +2696,12 @@ static void VM_SV_gettaginfo (void) prvm_edict_t *e; int tagindex; matrix4x4_t tag_matrix; + matrix4x4_t tag_localmatrix; + int parentindex; + const char *tagname; int returncode; + prvm_eval_t *val; + vec3_t fo, ri, up, trans; VM_SAFEPARMCOUNT(2, VM_SV_gettaginfo); @@ -2582,6 +2710,21 @@ static void VM_SV_gettaginfo (void) returncode = SV_GetTagMatrix(&tag_matrix, e, tagindex); Matrix4x4_ToVectors(&tag_matrix, prog->globals.server->v_forward, prog->globals.server->v_right, prog->globals.server->v_up, PRVM_G_VECTOR(OFS_RETURN)); + SV_GetExtendedTagInfo(e, tagindex, &parentindex, &tagname, &tag_localmatrix); + Matrix4x4_ToVectors(&tag_localmatrix, fo, ri, up, trans); + + if((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.gettaginfo_parent))) + val->_float = parentindex; + if((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.gettaginfo_name))) + val->string = tagname ? PRVM_SetTempString(tagname) : 0; + if((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.gettaginfo_offset))) + VectorCopy(trans, val->vector); + if((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.gettaginfo_forward))) + VectorCopy(fo, val->vector); + if((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.gettaginfo_right))) + VectorCopy(ri, val->vector); + if((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.gettaginfo_up))) + VectorCopy(up, val->vector); switch(returncode) { @@ -2685,7 +2828,7 @@ void VM_SV_serverkey(void) static void VM_SV_setmodelindex (void) { prvm_edict_t *e; - model_t *mod; + dp_model_t *mod; int i; VM_SAFEPARMCOUNT(2, VM_SV_setmodelindex); @@ -2767,6 +2910,9 @@ static void VM_SV_trailparticles (void) { VM_SAFEPARMCOUNT(4, VM_SV_trailparticles); + if ((int)PRVM_G_FLOAT(OFS_PARM0) < 0) + return; + 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)); @@ -2781,6 +2927,10 @@ static void VM_SV_pointparticles (void) int effectnum, count; vec3_t org, vel; VM_SAFEPARMCOUNTRANGE(4, 8, VM_SV_pointparticles); + + if ((int)PRVM_G_FLOAT(OFS_PARM0) < 0) + return; + effectnum = (int)PRVM_G_FLOAT(OFS_PARM0); VectorCopy(PRVM_G_VECTOR(OFS_PARM1), org); VectorCopy(PRVM_G_VECTOR(OFS_PARM2), vel); @@ -2805,6 +2955,24 @@ static void VM_SV_pointparticles (void) SV_FlushBroadcastMessages(); } +//PF_setpause, // void(float pause) setpause = #531; +static void VM_SV_setpause(void) { + int pauseValue; + pauseValue = (int)PRVM_G_FLOAT(OFS_PARM0); + if (pauseValue != 0) { //pause the game + sv.paused = 1; + sv.pausedstart = Sys_DoubleTime(); + } else { //disable pause, in case it was enabled + if (sv.paused != 0) { + sv.paused = 0; + sv.pausedstart = 0; + } + } + // send notification to all clients + MSG_WriteByte(&sv.reliable_datagram, svc_setpause); + MSG_WriteByte(&sv.reliable_datagram, sv.paused); +} + prvm_builtin_t vm_sv_builtins[] = { NULL, // #0 NULL function (not callable) (QUAKE) VM_makevectors, // #1 void(vector ang) makevectors (QUAKE) @@ -3305,11 +3473,44 @@ NULL, // #491 NULL, // #492 NULL, // #493 VM_crc16, // #494 float(float caseinsensitive, string s, ...) crc16 = #494 (DP_QC_CRC16) -NULL, // #495 -NULL, // #496 -NULL, // #497 -NULL, // #498 -NULL, // #499 +VM_cvar_type, // #495 float(string name) cvar_type = #495; (DP_QC_CVAR_TYPE) +VM_numentityfields, // #496 float() numentityfields = #496; (DP_QC_ENTITYDATA) +VM_entityfieldname, // #497 string(float fieldnum) entityfieldname = #497; (DP_QC_ENTITYDATA) +VM_entityfieldtype, // #498 float(float fieldnum) entityfieldtype = #498; (DP_QC_ENTITYDATA) +VM_getentityfieldstring, // #499 string(float fieldnum, entity ent) getentityfieldstring = #499; (DP_QC_ENTITYDATA) +VM_putentityfieldstring, // #500 float(float fieldnum, entity ent, string s) putentityfieldstring = #500; (DP_QC_ENTITYDATA) +VM_SV_WritePicture, // #501 +NULL, // #502 +VM_whichpack, // #503 string(string) whichpack = #503; +NULL, // #504 +NULL, // #505 +NULL, // #506 +NULL, // #507 +NULL, // #508 +NULL, // #509 +VM_uri_escape, // #510 string(string in) uri_escape = #510; +VM_uri_unescape, // #511 string(string in) uri_unescape = #511; +VM_etof, // #512 float(entity ent) num_for_edict = #512 (DP_QC_NUM_FOR_EDICT) +VM_uri_get, // #513 float(string uril, float id) uri_get = #513; (DP_QC_URI_GET) +VM_tokenize_console, // #514 float(string str) tokenize_console = #514; (DP_QC_TOKENIZE_CONSOLE) +VM_argv_start_index, // #515 float(float idx) argv_start_index = #515; (DP_QC_TOKENIZE_CONSOLE) +VM_argv_end_index, // #516 float(float idx) argv_end_index = #516; (DP_QC_TOKENIZE_CONSOLE) +VM_buf_cvarlist, // #517 void(float buf, string prefix, string antiprefix) buf_cvarlist = #517; (DP_QC_STRINGBUFFERS_CVARLIST) +VM_cvar_description, // #518 float(string name) cvar_description = #518; (DP_QC_CVAR_DESCRIPTION) +NULL, // #519 +NULL, // #520 +NULL, // #521 +NULL, // #522 +NULL, // #523 +NULL, // #524 +NULL, // #525 +NULL, // #526 +NULL, // #527 +NULL, // #528 +NULL, // #529 +NULL, // #530 +VM_SV_setpause, // #531 void(float pause) setpause = #531; +NULL, // #532 }; const int vm_sv_numbuiltins = sizeof(vm_sv_builtins) / sizeof(prvm_builtin_t);