]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - clvm_cmds.c
DP_SND_SOUND7_WIP1
[xonotic/darkplaces.git] / clvm_cmds.c
index cedd20815f1da92d18f43f4d1356a13b75d530a6..5b0b804360474f9f11edcb170be92772be8ce12f 100644 (file)
@@ -161,9 +161,11 @@ static void VM_CL_sound (void)
        prvm_edict_t            *entity;
        float                           volume;
        float                           attenuation;
+       float pitchchange;
+       int flags;
        vec3_t                          org;
 
-       VM_SAFEPARMCOUNT(5, VM_CL_sound);
+       VM_SAFEPARMCOUNTRANGE(5, 7, VM_CL_sound);
 
        entity = PRVM_G_EDICT(OFS_PARM0);
        channel = (int)PRVM_G_FLOAT(OFS_PARM1);
@@ -183,9 +185,22 @@ static void VM_CL_sound (void)
                return;
        }
 
-       if (channel < 0 || channel > 7)
+       if (prog->argc < 6)
+               pitchchange = 0;
+       else
+               pitchchange = PRVM_G_FLOAT(OFS_PARM5);
+       // ignoring prog->argc < 7 for now (no flags supported yet)
+
+       if (prog->argc < 7)
+               flags = 0;
+       else
+               flags = PRVM_G_FLOAT(OFS_PARM6);
+
+       channel = CHAN_USER2ENGINE(channel);
+
+       if (!IS_CHAN(channel))
        {
-               VM_Warning("VM_CL_sound: channel must be in range 0-7\n");
+               VM_Warning("VM_CL_sound: channel must be in range 0-127\n");
                return;
        }