new menu QC builtin "stringwidth(string text, float handleColors)", does not do anyth...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 27 Oct 2007 10:59:44 +0000 (10:59 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 27 Oct 2007 10:59:44 +0000 (10:59 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7654 d7cf8633-e32d-0410-b094-e92efae38249

clvm_cmds.c
mvm_cmds.c
prvm_cmds.c
prvm_cmds.h

index f4cab9c..68b8ecc 100644 (file)
@@ -3076,7 +3076,7 @@ VM_drawfill,                                      // #323 float(vector position, vector size, vector rgb, float a
 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)
index 6939110..dddf5a1 100644 (file)
@@ -1228,7 +1228,7 @@ VM_cin_getstate,                  // #464
 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)
index 36cb5db..1c7f423 100644 (file)
@@ -2729,6 +2729,24 @@ void VM_drawcolorcodedstring(void)
 }
 /*
 =========
+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)
index 1efbd26..fb48373 100644 (file)
@@ -134,6 +134,8 @@ string      precache_pic(string pic)
                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)
@@ -324,6 +326,7 @@ void VM_freepic(void);
 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);