X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=svvm_cmds.c;h=12ef69dab455c345729fb55c0bcb73a7f5e81adb;hb=197da0b9148dfb2d1b16457df1ba1c08b86ff9c2;hp=b98563fc48944e5b18aa1705eefb31944c08c93e;hpb=c38d0d2d6409d9b3174b6cf04f1bd09694cbfc81;p=xonotic%2Fdarkplaces.git diff --git a/svvm_cmds.c b/svvm_cmds.c index b98563fc..12ef69da 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -227,6 +227,7 @@ const char *vm_sv_extensions = "TENEBRAE_GFX_DLIGHTS " "TW_SV_STEPCONTROL " "ZQ_PAUSE " +"DP_RM_CLIPGROUP " //"EXT_CSQC " // not ready yet ; @@ -243,7 +244,7 @@ static void VM_SV_setorigin(prvm_prog_t *prog) { prvm_edict_t *e; - VM_SAFEPARMCOUNT(2, VM_setorigin); + VM_SAFEPARMCOUNT(2, VM_SV_setorigin); e = PRVM_G_EDICT(OFS_PARM0); if (e == prog->edicts) @@ -294,7 +295,7 @@ static void VM_SV_setsize(prvm_prog_t *prog) prvm_edict_t *e; vec3_t mins, maxs; - VM_SAFEPARMCOUNT(3, VM_setsize); + VM_SAFEPARMCOUNT(3, VM_SV_setsize); e = PRVM_G_EDICT(OFS_PARM0); if (e == prog->edicts) @@ -327,7 +328,7 @@ static void VM_SV_setmodel(prvm_prog_t *prog) dp_model_t *mod; int i; - VM_SAFEPARMCOUNT(2, VM_setmodel); + VM_SAFEPARMCOUNT(2, VM_SV_setmodel); e = PRVM_G_EDICT(OFS_PARM0); if (e == prog->edicts) @@ -968,7 +969,7 @@ static void VM_SV_stuffcmd(prvm_prog_t *prog) old = host_client; host_client = svs.clients + entnum-1; - Host_ClientCommands ("%s", string); + SV_ClientCommands ("%s", string); host_client = old; } @@ -1626,21 +1627,17 @@ static void VM_SV_getlight(prvm_prog_t *prog) typedef struct { - unsigned char type; // 1/2/8 or other value if isn't used + unsigned char type; // 1/2/8 or 0 to indicate unused int fieldoffset; }customstat_t; -static customstat_t *vm_customstats = NULL; //[515]: it starts from 0, not 32 +static customstat_t vm_customstats[MAX_CL_STATS]; // matches the regular stat numbers, but only MIN_VM_STAT to MAX_VM_STAT range is used if things are working properly (can register stats from MAX_VM_STAT to MAX_CL_STATS but will warn) static int vm_customstats_last; void VM_CustomStats_Clear (void) { - if(vm_customstats) - { - Z_Free(vm_customstats); - vm_customstats = NULL; - vm_customstats_last = -1; - } + memset(vm_customstats, 0, sizeof(vm_customstats)); + vm_customstats_last = -1; } void VM_SV_UpdateCustomStats (client_t *client, prvm_edict_t *ent, sizebuf_t *msg, int *stats) @@ -1653,10 +1650,7 @@ void VM_SV_UpdateCustomStats (client_t *client, prvm_edict_t *ent, sizebuf_t *ms float f; } u; - if(!vm_customstats) - return; - - for(i=0; i= (MAX_CL_STATS-32)) + + if (i >= MAX_CL_STATS) { - VM_Warning(prog, "PF_SV_AddStat: index >= MAX_CL_STATS\n"); + VM_Warning(prog, "PF_SV_AddStat: index (%i) >= MAX_CL_STATS (%i), not supported by protocol, and AddStat beyond MAX_VM_STAT (%i) conflicts with engine MOVEVARS\n", i, MAX_CL_STATS, MAX_VM_STAT); return; } - if(i > (MAX_CL_STATS-32-4) && type == 1) + + if (i > (MAX_CL_STATS - 4) && type == 1) { - VM_Warning(prog, "PF_SV_AddStat: index > (MAX_CL_STATS-4) with string\n"); + VM_Warning(prog, "PF_SV_AddStat: index (%i) > (MAX_CL_STATS (%i) - 4) with string type won't fit in the protocol, and AddStat beyond MAX_VM_STAT conflicts with engine MOVEVARS\n", i, MAX_CL_STATS); return; } + + // these are hazardous to override but sort of allowed if one wants to be adventurous... and enjoys warnings. + if (i < MIN_VM_STAT) + VM_Warning(prog, "PF_SV_AddStat: index (%i) < MIN_VM_STAT (%i) may conflict with engine stats - allowed, but this may break things\n", i, MIN_VM_STAT); + else if (i >= MAX_VM_STAT && !sv_gameplayfix_customstats.integer) + VM_Warning(prog, "PF_SV_AddStat: index (%i) >= MAX_VM_STAT (%i) conflicts with engine stats - allowed, but this may break slowmo and stuff\n", i, MAX_VM_STAT); + else if (i > (MAX_VM_STAT - 4) && type == 1 && !sv_gameplayfix_customstats.integer) + VM_Warning(prog, "PF_SV_AddStat: index (%i) >= MAX_VM_STAT (%i) - 4 with string type won't fit within MAX_VM_STAT, thus conflicting with engine stats - allowed, but this may break slowmo and stuff\n", i, MAX_VM_STAT); + vm_customstats[i].type = type; vm_customstats[i].fieldoffset = off; if(vm_customstats_last < i) @@ -1772,6 +1779,8 @@ static void VM_SV_copyentity(prvm_prog_t *prog) return; } memcpy(out->fields.fp, in->fields.fp, prog->entityfields * sizeof(prvm_vec_t)); + if (VectorCompare(PRVM_serveredictvector(out, absmin), PRVM_serveredictvector(out, absmax))) + return; SV_LinkEdict(out); } @@ -2867,7 +2876,7 @@ static void VM_SV_setpause(prvm_prog_t *prog) { pauseValue = (int)PRVM_G_FLOAT(OFS_PARM0); if (pauseValue != 0) { //pause the game sv.paused = 1; - sv.pausedstart = realtime; + sv.pausedstart = host.realtime; } else { //disable pause, in case it was enabled if (sv.paused != 0) { sv.paused = 0;