]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - prvm_cmds.c
allow drawpic calls without flag parameter, as per CSQC spec
[xonotic/darkplaces.git] / prvm_cmds.c
index df5ea5eaf90a57d5db11d5e4373046359e747cdb..703280f37f004bad31df22f64ad6b61813bf87d1 100644 (file)
@@ -2923,7 +2923,8 @@ void VM_getsoundtime (void)
        }
        entnum = ((pnum == PRVM_CLIENTPROG) ? MAX_EDICTS : 0) + PRVM_NUM_FOR_EDICT(PRVM_G_EDICT(OFS_PARM0));
        entchannel = (int)PRVM_G_FLOAT(OFS_PARM1);
-       if (entchannel <= 0 || entchannel > 8)
+       entchannel = CHAN_USER2ENGINE(entchannel);
+       if (!IS_CHAN(entchannel))
                VM_Warning("VM_getsoundtime: %s: bad channel %i\n", PRVM_NAME, entchannel);
        PRVM_G_FLOAT(OFS_RETURN) = (float)S_GetEntChannelPosition(entnum, entchannel);
 }
@@ -3354,22 +3355,23 @@ void VM_drawcharacter(void)
 =========
 VM_drawstring
 
-float  drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag)
+float  drawstring(vector position, string text, vector scale, vector rgb, float alpha[, float flag])
 =========
 */
 void VM_drawstring(void)
 {
        float *pos,*scale,*rgb;
        const char  *string;
-       int flag;
+       int flag = 0;
        float sx, sy;
-       VM_SAFEPARMCOUNT(6,VM_drawstring);
+       VM_SAFEPARMCOUNTRANGE(5,6,VM_drawstring);
 
        string = PRVM_G_STRING(OFS_PARM1);
        pos = PRVM_G_VECTOR(OFS_PARM0);
        scale = PRVM_G_VECTOR(OFS_PARM2);
        rgb = PRVM_G_VECTOR(OFS_PARM3);
-       flag = (int)PRVM_G_FLOAT(OFS_PARM5);
+       if (prog->argc >= 6)
+               flag = (int)PRVM_G_FLOAT(OFS_PARM5);
 
        if(flag < DRAWFLAG_NORMAL || flag >=DRAWFLAG_NUMFLAGS)
        {
@@ -3697,9 +3699,9 @@ void VM_drawpic(void)
 {
        const char *picname;
        float *size, *pos, *rgb;
-       int flag;
+       int flag = 0;
 
-       VM_SAFEPARMCOUNT(6,VM_drawpic);
+       VM_SAFEPARMCOUNTRANGE(5,6,VM_drawpic);
 
        picname = PRVM_G_STRING(OFS_PARM1);
        VM_CheckEmptyString (picname);
@@ -3715,7 +3717,8 @@ void VM_drawpic(void)
        pos = PRVM_G_VECTOR(OFS_PARM0);
        size = PRVM_G_VECTOR(OFS_PARM2);
        rgb = PRVM_G_VECTOR(OFS_PARM3);
-       flag = (int) PRVM_G_FLOAT(OFS_PARM5);
+       if (prog->argc >= 6)
+               flag = (int) PRVM_G_FLOAT(OFS_PARM5);
 
        if(flag < DRAWFLAG_NORMAL || flag >=DRAWFLAG_NUMFLAGS)
        {