VM_drawsetcliparea, // #324 void(float x, float y, float width, float height) drawsetcliparea
VM_drawresetcliparea, // #325 void(void) drawresetcliparea
VM_drawcolorcodedstring, // #326 float drawcolorcodedstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) (EXT_CSQC)
-NULL, // #327
+NULL, // #327 // FIXME add stringwidth() here?
NULL, // #328
NULL, // #329
VM_CL_getstatf, // #330 float(float stnum) getstatf (EXT_CSQC)
VM_cin_restart, // #465
VM_drawline, // #466
VM_drawcolorcodedstring, // #467
-NULL, // #468
+VM_stringwidth, // #468
NULL, // #469
NULL, // #470
VM_asin, // #471 float(float s) VM_asin (DP_QC_ASINACOSATANATAN2TAN)
}
/*
=========
+VM_stringwidth
+
+float stringwidth(string text, float allowColorCodes)
+=========
+*/
+void VM_stringwidth(void)
+{
+ const char *string;
+ int colors;
+ VM_SAFEPARMCOUNT(2,VM_drawstring);
+
+ string = PRVM_G_STRING(OFS_PARM0);
+ colors = (int)PRVM_G_FLOAT(OFS_PARM1);
+
+ PRVM_G_FLOAT(OFS_RETURN) = DrawQ_String(0, 0, string, 0, 1, 1, 0, 0, 0, 0, 0, NULL, !colors); // 1x1 characters, don't actually draw
+}
+/*
+=========
VM_drawpic
float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag)
freepic(string s)
float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag)
float drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag)
+float drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag)
+float stringwidth(string text, float handleColors)
float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag)
float drawfill(vector position, vector size, vector rgb, float alpha, float flag)
drawsetcliparea(float x, float y, float width, float height)
void VM_drawcharacter(void);
void VM_drawstring(void);
void VM_drawcolorcodedstring(void);
+void VM_stringwidth(void);
void VM_drawpic(void);
void VM_drawfill(void);
void VM_drawsetcliparea(void);