]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - prvm_cmds.c
reworked transparent sorting of MATERIALFLAG_BLENDED to not sort water
[xonotic/darkplaces.git] / prvm_cmds.c
index cc01c830333dc42b68f28f6ad3e24d24f4a009f9..b7cae0d24e345234b08789055f888fcaed3820e4 100644 (file)
@@ -9,19 +9,28 @@
 #include "prvm_cmds.h"
 #include <time.h>
 
+extern cvar_t prvm_backtraceforwarnings;
+
 // LordHavoc: changed this to NOT use a return statement, so that it can be used in functions that must return a value
 void VM_Warning(const char *fmt, ...)
 {
        va_list argptr;
        char msg[MAX_INPUTLINE];
+       static double recursive = -1;
 
        va_start(argptr,fmt);
        dpvsnprintf(msg,sizeof(msg),fmt,argptr);
        va_end(argptr);
 
-       Con_Print(msg);
+       Con_Printf(msg);
+
        // TODO: either add a cvar/cmd to control the state dumping or replace some of the calls with Con_Printf [9/13/2006 Black]
-       //PRVM_PrintState();
+       if(prvm_backtraceforwarnings.integer && recursive != realtime) // NOTE: this compares to the time, just in case if PRVM_PrintState causes a Host_Error and keeps recursive set
+       {
+               recursive = realtime;
+               PRVM_PrintState();
+               recursive = -1;
+       }
 }
 
 
@@ -2726,7 +2735,7 @@ void VM_stringwidth(void)
        string = PRVM_G_STRING(OFS_PARM0);
        colors = (int)PRVM_G_FLOAT(OFS_PARM1);
 
-       PRVM_G_FLOAT(OFS_RETURN) = DrawQ_String_Font(0, 0, string, 0, 1, 1, 0, 0, 0, 0, 0, NULL, !colors, getdrawfont()); // 1x1 characters, don't actually draw
+       PRVM_G_FLOAT(OFS_RETURN) = DrawQ_TextWidth_Font(string, 0, !colors, getdrawfont()); // 1x1 characters, don't actually draw
 }
 /*
 =========