X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=svvm_cmds.c;h=e4969440a27c713127c6eec5bf8da0a5371cd87d;hb=3161ae840da309834bd08f39be63777836fade71;hp=c6fe7c89984289827fe2cc9d54ecb1e3ad315a73;hpb=28f64beb60928fdcf2a8932a4971ce547fd98062;p=xonotic%2Fdarkplaces.git diff --git a/svvm_cmds.c b/svvm_cmds.c index c6fe7c89..e4969440 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -559,7 +559,7 @@ static void VM_SV_sound(prvm_prog_t *prog) else { // LordHavoc: we only let the qc set certain flags, others are off-limits - flags = (int)PRVM_G_FLOAT(OFS_PARM6) & (CHANNELFLAG_RELIABLE | CHANNELFLAG_FORCELOOP | CHANNELFLAG_PAUSED); + flags = (int)PRVM_G_FLOAT(OFS_PARM6) & (CHANNELFLAG_RELIABLE | CHANNELFLAG_FORCELOOP | CHANNELFLAG_PAUSED | CHANNELFLAG_FULLVOLUME); } if (nvolume < 0 || nvolume > 255) @@ -656,7 +656,7 @@ static void VM_SV_traceline(prvm_prog_t *prog) if (VEC_IS_NAN(v1[0]) || VEC_IS_NAN(v1[1]) || VEC_IS_NAN(v1[2]) || VEC_IS_NAN(v2[0]) || VEC_IS_NAN(v2[1]) || VEC_IS_NAN(v2[2])) prog->error_cmd("%s: NAN errors detected in traceline('%f %f %f', '%f %f %f', %i, entity %i)\n", prog->name, v1[0], v1[1], v1[2], v2[0], v2[1], v2[2], move, PRVM_EDICT_TO_PROG(ent)); - trace = SV_TraceLine(v1, v2, move, ent, SV_GenericHitSuperContentsMask(ent), collision_extendtracelinelength.value); + trace = SV_TraceLine(v1, v2, move, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendtracelinelength.value); VM_SetTraceGlobals(prog, &trace); } @@ -695,7 +695,7 @@ static void VM_SV_tracebox(prvm_prog_t *prog) if (VEC_IS_NAN(v1[0]) || VEC_IS_NAN(v1[1]) || VEC_IS_NAN(v1[2]) || VEC_IS_NAN(v2[0]) || VEC_IS_NAN(v2[1]) || VEC_IS_NAN(v2[2])) prog->error_cmd("%s: NAN errors detected in tracebox('%f %f %f', '%f %f %f', '%f %f %f', '%f %f %f', %i, entity %i)\n", prog->name, v1[0], v1[1], v1[2], m1[0], m1[1], m1[2], m2[0], m2[1], m2[2], v2[0], v2[1], v2[2], move, PRVM_EDICT_TO_PROG(ent)); - trace = SV_TraceBox(v1, m1, m2, v2, move, ent, SV_GenericHitSuperContentsMask(ent), collision_extendtraceboxlength.value); + trace = SV_TraceBox(v1, m1, m2, v2, move, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendtraceboxlength.value); VM_SetTraceGlobals(prog, &trace); } @@ -731,7 +731,7 @@ static trace_t SV_Trace_Toss(prvm_prog_t *prog, prvm_edict_t *tossent, prvm_edic VectorCopy(PRVM_serveredictvector(tossent, origin), tossentorigin); VectorCopy(PRVM_serveredictvector(tossent, mins), tossentmins); VectorCopy(PRVM_serveredictvector(tossent, maxs), tossentmaxs); - trace = SV_TraceBox(tossentorigin, tossentmins, tossentmaxs, end, MOVE_NORMAL, tossent, SV_GenericHitSuperContentsMask(tossent), collision_extendmovelength.value); + trace = SV_TraceBox(tossentorigin, tossentmins, tossentmaxs, end, MOVE_NORMAL, tossent, SV_GenericHitSuperContentsMask(tossent), 0, 0, collision_extendmovelength.value); VectorCopy (trace.endpos, PRVM_serveredictvector(tossent, origin)); PRVM_serveredictvector(tossent, velocity)[2] -= gravity; @@ -1159,13 +1159,13 @@ static void VM_SV_droptofloor(prvm_prog_t *prog) VectorCopy(PRVM_serveredictvector(ent, origin), entorigin); VectorCopy(PRVM_serveredictvector(ent, mins), entmins); VectorCopy(PRVM_serveredictvector(ent, maxs), entmaxs); - trace = SV_TraceBox(entorigin, entmins, entmaxs, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent), collision_extendmovelength.value); + trace = SV_TraceBox(entorigin, entmins, entmaxs, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value); if (trace.startsolid && sv_gameplayfix_droptofloorstartsolid.integer) { vec3_t offset, org; VectorSet(offset, 0.5f * (PRVM_serveredictvector(ent, mins)[0] + PRVM_serveredictvector(ent, maxs)[0]), 0.5f * (PRVM_serveredictvector(ent, mins)[1] + PRVM_serveredictvector(ent, maxs)[1]), PRVM_serveredictvector(ent, mins)[2]); VectorAdd(PRVM_serveredictvector(ent, origin), offset, org); - trace = SV_TraceLine(org, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent), collision_extendmovelength.value); + trace = SV_TraceLine(org, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value); VectorSubtract(trace.endpos, offset, trace.endpos); if (trace.startsolid) { @@ -1266,7 +1266,7 @@ static void VM_SV_pointcontents(prvm_prog_t *prog) vec3_t point; VM_SAFEPARMCOUNT(1, VM_SV_pointcontents); VectorCopy(PRVM_G_VECTOR(OFS_PARM0), point); - PRVM_G_FLOAT(OFS_RETURN) = Mod_Q1BSP_NativeContentsFromSuperContents(NULL, SV_PointSuperContents(point)); + PRVM_G_FLOAT(OFS_RETURN) = Mod_Q1BSP_NativeContentsFromSuperContents(SV_PointSuperContents(point)); } /* @@ -1313,7 +1313,7 @@ static void VM_SV_aim(prvm_prog_t *prog) // try sending a trace straight VectorCopy (PRVM_serverglobalvector(v_forward), dir); VectorMA (start, 2048, dir, end); - tr = SV_TraceLine(start, end, MOVE_NORMAL, ent, SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY, collision_extendmovelength.value); + tr = SV_TraceLine(start, end, MOVE_NORMAL, ent, SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY, 0, 0, collision_extendmovelength.value); if (tr.ent && PRVM_serveredictfloat(((prvm_edict_t *)tr.ent), takedamage) == DAMAGE_AIM && (!teamplay.integer || PRVM_serveredictfloat(ent, team) <=0 || PRVM_serveredictfloat(ent, team) != PRVM_serveredictfloat(((prvm_edict_t *)tr.ent), team)) ) { @@ -1345,7 +1345,7 @@ static void VM_SV_aim(prvm_prog_t *prog) dist = DotProduct (dir, PRVM_serverglobalvector(v_forward)); if (dist < bestdist) continue; // to far to turn - tr = SV_TraceLine(start, end, MOVE_NORMAL, ent, SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY, collision_extendmovelength.value); + tr = SV_TraceLine(start, end, MOVE_NORMAL, ent, SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY, 0, 0, collision_extendmovelength.value); if (tr.ent == check) { // can shoot at this one bestdist = dist; @@ -1648,6 +1648,10 @@ void VM_SV_UpdateCustomStats (client_t *client, prvm_edict_t *ent, sizebuf_t *ms prvm_prog_t *prog = SVVM_prog; int i; char s[17]; + union { + int i; + float f; + } u; if(!vm_customstats) return; @@ -1669,7 +1673,9 @@ void VM_SV_UpdateCustomStats (client_t *client, prvm_edict_t *ent, sizebuf_t *ms break; //float field sent as-is case 8: - stats[i+32] = PRVM_E_INT(ent, vm_customstats[i].fieldoffset); + // can't directly use PRVM_E_INT on the field because it may be PRVM_64 and a double is not the representation we want to send + u.f = PRVM_E_FLOAT(ent, vm_customstats[i].fieldoffset); + stats[i+32] = u.i; break; //integer value of float field case 2: