]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - prvm_cmds.c
getimagesize(): return '0 0 0' for missing texture (previously the size of the notext...
[xonotic/darkplaces.git] / prvm_cmds.c
index 657e4b81914b5c3904b8ebaae6d1aee176da08ea..6490bf18a5d51513505b54db1f48735a46d3541c 100644 (file)
@@ -96,7 +96,7 @@ void VM_FrameBlendFromFrameGroupBlend(frameblend_t *frameblend, const framegroup
 
        memset(blend, 0, MAX_FRAMEBLENDS * sizeof(*blend));
 
-       if (!model || !model->surfmesh.isanimated || model->numframes <= 1)
+       if (!model || !model->surfmesh.isanimated)
        {
                blend[0].lerp = 1;
                return;
@@ -3911,9 +3911,16 @@ void VM_getimagesize(prvm_prog_t *prog)
        VM_CheckEmptyString(prog, p);
 
        pic = Draw_CachePic_Flags (p, CACHEPICFLAG_NOTPERSISTENT);
-
-       PRVM_G_VECTOR(OFS_RETURN)[0] = pic->width;
-       PRVM_G_VECTOR(OFS_RETURN)[1] = pic->height;
+       if( Draw_CachePic_Flags(s, 0)->tex == r_texture_notexture )
+       {
+               PRVM_G_VECTOR(OFS_RETURN)[0] = 0;
+               PRVM_G_VECTOR(OFS_RETURN)[1] = 0;
+       }
+       else
+       {
+               PRVM_G_VECTOR(OFS_RETURN)[0] = pic->width;
+               PRVM_G_VECTOR(OFS_RETURN)[1] = pic->height;
+       }
        PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
 }
 
@@ -6326,7 +6333,10 @@ nolength:
                                                        {
                                                                if(precision < 0) // not set
                                                                        precision = end - o - 1;
-                                                               o += u8_strpad(o, end - o, GETARG_STRING(thisarg), (flags & PRINTF_LEFT) != 0, width, precision);
+                                                               if(flags & PRINTF_SIGNPOSITIVE)
+                                                                       o += u8_strpad(o, end - o, GETARG_STRING(thisarg), (flags & PRINTF_LEFT) != 0, width, precision);
+                                                               else
+                                                                       o += u8_strpad_colorcodes(o, end - o, GETARG_STRING(thisarg), (flags & PRINTF_LEFT) != 0, width, precision);
                                                        }
                                                        break;
                                                default:
@@ -6826,9 +6836,9 @@ void VM_physics_addforce(prvm_prog_t *prog)
                VM_Warning(prog, "VM_physics_addforce: entity is not MOVETYPE_PHYSICS!\n");
                return;
        }
-       f.type = ODEFUNC_RELFORCEATPOS;
+       f.type = ODEFUNC_FORCE;
        VectorCopy(PRVM_G_VECTOR(OFS_PARM1), f.v1);
-       VectorSubtract(PRVM_serveredictvector(ed, origin), PRVM_G_VECTOR(OFS_PARM2), f.v2);
+       VectorCopy(PRVM_G_VECTOR(OFS_PARM2), f.v2);
        VM_physics_ApplyCmd(ed, &f);
 }
 
@@ -6852,7 +6862,7 @@ void VM_physics_addtorque(prvm_prog_t *prog)
                VM_Warning(prog, "VM_physics_addtorque: entity is not MOVETYPE_PHYSICS!\n");
                return;
        }
-       f.type = ODEFUNC_RELTORQUE;
+       f.type = ODEFUNC_TORQUE;
        VectorCopy(PRVM_G_VECTOR(OFS_PARM1), f.v1);
        VM_physics_ApplyCmd(ed, &f);
 }