]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - svvm_cmds.c
Fix a bug with PRVM_64 where CSQC float stats were sent by aliasing to int64 and...
[xonotic/darkplaces.git] / svvm_cmds.c
index b5f96a84827f8e2a69e5d9fe568a2e6b2b6efce0..eeaf4e1db1deac4aae2e6dc12aeaae96371455bb 100644 (file)
@@ -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)
@@ -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: