]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_dyntexture.c
srcon: add random digits to the the time
[xonotic/darkplaces.git] / cl_dyntexture.c
index 8ee494640e73c355db0801e22f066e518642e27b..cd310aabdc908d875a4d6512c1981e95356eaf01 100644 (file)
@@ -15,16 +15,15 @@ static unsigned dyntexturecount;
 \r
 #define DEFAULT_DYNTEXTURE r_texture_grey128\r
 \r
-static dyntexture_t * cl_finddyntexture( const char *name ) {\r
+static dyntexture_t * cl_finddyntexture( const char *name, qboolean warnonfailure ) {\r
        unsigned i;\r
        dyntexture_t *dyntexture = NULL;\r
 \r
        // sanity checks - make sure its actually a dynamic texture path\r
        if( !name || !*name || strncmp( name, CLDYNTEXTUREPREFIX, sizeof( CLDYNTEXTUREPREFIX ) - 1 ) != 0 ) {\r
                // TODO: print a warning or something\r
-               if( developer.integer > 0 ) {\r
+               if (warnonfailure)\r
                        Con_Printf( "cl_finddyntexture: Bad dynamic texture name '%s'\n", name );\r
-               }\r
                return NULL;\r
        }\r
 \r
@@ -46,7 +45,7 @@ static dyntexture_t * cl_finddyntexture( const char *name ) {
 }\r
 \r
 rtexture_t * CL_GetDynTexture( const char *name ) {\r
-       dyntexture_t *dyntexture = cl_finddyntexture( name );\r
+       dyntexture_t *dyntexture = cl_finddyntexture( name, false );\r
        if( dyntexture ) {\r
                return dyntexture->texture;\r
        } else {\r
@@ -59,12 +58,16 @@ void CL_LinkDynTexture( const char *name, rtexture_t *texture ) {
        cachepic_t *cachepic;\r
        skinframe_t *skinframe;\r
 \r
-       dyntexture = cl_finddyntexture( name );\r
+       dyntexture = cl_finddyntexture( name, true );\r
+       if( !dyntexture ) {\r
+               Con_Printf( "CL_LinkDynTexture: internal error in cl_finddyntexture!\n" );\r
+               return;\r
+       }\r
        // TODO: assert dyntexture != NULL!\r
        if( dyntexture->texture != texture ) {\r
                dyntexture->texture = texture;\r
 \r
-               cachepic = Draw_CachePic( name, false );\r
+               cachepic = Draw_CachePic_Flags( name, CACHEPICFLAG_NOTPERSISTENT );\r
                // TODO: assert cachepic and skinframe should be valid pointers...\r
                // TODO: assert cachepic->tex = dyntexture->texture\r
                cachepic->tex = texture;\r