X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=svvm_cmds.c;h=6226561d61afd355b4ecf536497cbdf89b995e7b;hb=74114c15d518859de79175ce60347ce6d959f81c;hp=f47c05b091013258abc24df0ae97e5b2157164f8;hpb=ff8d70aa70289d8978b991f0214de17b0c5e1aed;p=xonotic%2Fdarkplaces.git diff --git a/svvm_cmds.c b/svvm_cmds.c index f47c05b0..6226561d 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -3,7 +3,6 @@ //============================================================================ // Server -cvar_t sv_aim = {CVAR_SAVE, "sv_aim", "2", "maximum cosine angle for quake's vertical autoaim, a value above 1 completely disables the autoaim, quake used 0.93"}; char *vm_sv_extensions = @@ -24,6 +23,7 @@ char *vm_sv_extensions = "DP_EF_NODEPTHTEST " "DP_EF_NODRAW " "DP_EF_NOSHADOW " +"DP_EF_NOGUNBOB " "DP_EF_RED " "DP_EF_STARDUST " "DP_ENT_ALPHA " @@ -52,6 +52,7 @@ char *vm_sv_extensions = "DP_QC_ASINACOSATANATAN2TAN " "DP_QC_CHANGEPITCH " "DP_QC_COPYENTITY " +"DP_QC_CVAR_DEFSTRING " "DP_QC_CVAR_STRING " "DP_QC_ETOS " "DP_QC_FINDCHAIN " @@ -102,6 +103,7 @@ char *vm_sv_extensions = "DP_SV_NODRAWTOCLIENT " "DP_SV_PING " "DP_SV_PLAYERPHYSICS " +"DP_SV_POINTPARTICLES " "DP_SV_PRECACHEANYTIME " "DP_SV_PRINT " "DP_SV_PUNCHVECTOR " @@ -436,13 +438,18 @@ static void VM_SV_sound (void) int volume; float attenuation; - VM_SAFEPARMCOUNT(5, VM_SV_sound); + VM_SAFEPARMCOUNTRANGE(4, 5, VM_SV_sound); entity = PRVM_G_EDICT(OFS_PARM0); channel = (int)PRVM_G_FLOAT(OFS_PARM1); sample = PRVM_G_STRING(OFS_PARM2); volume = (int)(PRVM_G_FLOAT(OFS_PARM3) * 255); attenuation = PRVM_G_FLOAT(OFS_PARM4); + if (prog->argc < 5) + { + Con_DPrintf("VM_SV_sound: given only 4 parameters, expected 5, assuming attenuation = ATTN_NORMAL\n"); + attenuation = 1; + } if (volume < 0 || volume > 255) { @@ -798,7 +805,7 @@ static void VM_SV_findradius (void) eorg[2] -= bound(ent->fields.server->mins[2], eorg[2], ent->fields.server->maxs[2]); } else - VectorMAMAM(1, eorg, 0.5f, ent->fields.server->mins, 0.5f, ent->fields.server->maxs, eorg); + VectorMAMAM(1, eorg, -0.5f, ent->fields.server->mins, -0.5f, ent->fields.server->maxs, eorg); if (DotProduct(eorg, eorg) < radius2) { ent->fields.server->chain = PRVM_EDICT_TO_PROG(chain); @@ -2644,13 +2651,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)) + { + // 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(); } @@ -3103,10 +3127,10 @@ VM_SV_clientcommand, // #440 void(entity e, string s) clientcommand (KRIMZON_S VM_tokenize, // #441 float(string s) tokenize (KRIMZON_SV_PARSECLIENTCOMMAND) VM_argv, // #442 string(float n) argv (KRIMZON_SV_PARSECLIENTCOMMAND) VM_SV_setattachment, // #443 void(entity e, entity tagentity, string tagname) setattachment (DP_GFX_QUAKE3MODELTAGS) -VM_search_begin, // #444 float(string pattern, float caseinsensitive, float quiet) search_begin (DP_FS_SEARCH) -VM_search_end, // #445 void(float handle) search_end (DP_FS_SEARCH) -VM_search_getsize, // #446 float(float handle) search_getsize (DP_FS_SEARCH) -VM_search_getfilename, // #447 string(float handle, float num) search_getfilename (DP_FS_SEARCH) +VM_search_begin, // #444 float(string pattern, float caseinsensitive, float quiet) search_begin (DP_QC_FS_SEARCH) +VM_search_end, // #445 void(float handle) search_end (DP_QC_FS_SEARCH) +VM_search_getsize, // #446 float(float handle) search_getsize (DP_QC_FS_SEARCH) +VM_search_getfilename, // #447 string(float handle, float num) search_getfilename (DP_QC_FS_SEARCH) VM_cvar_string, // #448 string(string s) cvar_string (DP_QC_CVAR_STRING) VM_findflags, // #449 entity(entity start, .float fld, float match) findflags (DP_QC_FINDFLAGS) VM_findchainflags, // #450 entity(.float fld, float match) findchainflags (DP_QC_FINDCHAINFLAGS) @@ -3139,9 +3163,9 @@ VM_strlennocol, // #476 float(string s) : DRESK - String Length (not countin VM_strdecolorize, // #477 string(string s) : DRESK - Decolorized String (DP_SV_STRINGCOLORFUNCTIONS) VM_strftime, // #478 string(float uselocaltime, string format, ...) (DP_QC_STRFTIME) VM_tokenizebyseparator, // #479 float(string s) tokenizebyseparator (DP_QC_TOKENIZEBYSEPARATOR) -VM_strtolower, // #480 string(string s) VM_strtolower : DRESK - Return string as lowercase -VM_strtoupper, // #481 string(string s) VM_strtoupper : DRESK - Return string as uppercase -NULL, // #482 +VM_strtolower, // #480 string(string s) VM_strtolower (DP_QC_STRING_CASE_FUNCTIONS) +VM_strtoupper, // #481 string(string s) VM_strtoupper (DP_QC_STRING_CASE_FUNCTIONS) +VM_cvar_defstring, // #482 string(string s) cvar_defstring (DP_QC_CVAR_DEFSTRING) NULL, // #483 NULL, // #484 NULL, // #485