]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_screen.c
changed brush model API - now uses function pointers for some of the brush model...
[xonotic/darkplaces.git] / cl_screen.c
index eca31c2e09916b55dc209713dcc9942fef67323b..c174176365bcbbdebdf3624c4f3388088c10a6a5 100644 (file)
@@ -168,7 +168,7 @@ void SCR_DrawTurtle (void)
        if (count < 3)
                return;
 
-       DrawQ_Pic (0, 0, "turtle", 0, 0, 1, 1, 1, 1, 0);
+       DrawQ_Pic (0, 0, "gfx/turtle.lmp", 0, 0, 1, 1, 1, 1, 0);
 }
 
 /*
@@ -185,7 +185,7 @@ void SCR_DrawNet (void)
        if (cls.demoplayback)
                return;
 
-       DrawQ_Pic (64, 0, "net", 0, 0, 1, 1, 1, 1, 0);
+       DrawQ_Pic (64, 0, "gfx/net.lmp", 0, 0, 1, 1, 1, 1, 0);
 }
 
 /*
@@ -355,7 +355,6 @@ void R_TimeReport(char *desc)
 extern int c_rt_lights, c_rt_clears, c_rt_scissored;
 extern int c_rt_shadowmeshes, c_rt_shadowtris, c_rt_lightmeshes, c_rt_lighttris;
 extern int c_rtcached_shadowmeshes, c_rtcached_shadowtris;
-extern int r_shadow_lightingmode;
 void R_TimeReport_Start(void)
 {
        r_timereport_active = r_speeds.integer && cls.signon == SIGNONS && cls.state == ca_connected;
@@ -373,16 +372,14 @@ void R_TimeReport_Start(void)
                        c_faces, c_nodes, c_leafs, c_light_polys,
                        c_models, c_bmodels, c_sprites, c_particles, c_dlights,
                        c_alias_polys, c_meshs, c_meshelements / 3);
-               if (r_shadow_lightingmode)
-               {
-                       sprintf(r_speeds_string + strlen(r_speeds_string),
-                               "realtime lighting:%4i lights%4i clears%4i scissored\n"
-                               "dynamic: %6i shadowmeshes%6i shadowtris%6i lightmeshes%6i lighttris\n"
-                               "precomputed: %6i shadowmeshes%6i shadowtris\n",
-                               c_rt_lights, c_rt_clears, c_rt_scissored,
-                               c_rt_shadowmeshes, c_rt_shadowtris, c_rt_lightmeshes, c_rt_lighttris,
-                               c_rtcached_shadowmeshes, c_rtcached_shadowtris);
-               }
+
+               sprintf(r_speeds_string + strlen(r_speeds_string),
+                       "realtime lighting:%4i lights%4i clears%4i scissored\n"
+                       "dynamic: %6i shadowmeshes%6i shadowtris%6i lightmeshes%6i lighttris\n"
+                       "precomputed: %6i shadowmeshes%6i shadowtris\n",
+                       c_rt_lights, c_rt_clears, c_rt_scissored,
+                       c_rt_shadowmeshes, c_rt_shadowtris, c_rt_lightmeshes, c_rt_lighttris,
+                       c_rtcached_shadowmeshes, c_rtcached_shadowtris);
 
                c_alias_polys = 0;
                c_light_polys = 0;
@@ -499,62 +496,7 @@ void DrawQ_Clear(void)
 static int picelements[6] = {0, 1, 2, 0, 2, 3};
 void DrawQ_Pic(float x, float y, char *picname, float width, float height, float red, float green, float blue, float alpha, int flags)
 {
-#if 1
        DrawQ_SuperPic(x,y,picname,width,height,0,0,red,green,blue,alpha,1,0,red,green,blue,alpha,0,1,red,green,blue,alpha,1,1,red,green,blue,alpha,flags);
-#elif 1
-       float floats[48];
-       cachepic_t *pic;
-       drawqueuemesh_t mesh;
-       if (alpha < (1.0f / 255.0f) || !picname || !picname[0])
-               return;
-       pic = Draw_CachePic(picname);
-       if (width == 0)
-               width = pic->width;
-       if (height == 0)
-               height = pic->height;
-       mesh.texture = pic->tex;
-       mesh.numtriangles = 2;
-       mesh.numvertices = 4;
-       mesh.indices = picelements;
-       mesh.vertex3f = floats;
-       mesh.texcoord2f = floats + 16;
-       mesh.color4f = floats + 32;
-       memset(floats, 0, sizeof(floats));
-       mesh.vertex3f[0] = mesh.vertex3f[12] = x;
-       mesh.vertex3f[1] = mesh.vertex3f[5] = y;
-       mesh.vertex3f[4] = mesh.vertex3f[8] = x + width;
-       mesh.vertex3f[9] = mesh.vertex3f[13] = y + height;
-       mesh.texcoord2f[4] = mesh.texcoord2f[8] = mesh.texcoord2f[9] = mesh.texcoord2f[13] = 1;
-       mesh.color4f[0] = mesh.color4f[4] = mesh.color4f[8] = mesh.color4f[12] = red;
-       mesh.color4f[1] = mesh.color4f[5] = mesh.color4f[9] = mesh.color4f[13] = green;
-       mesh.color4f[2] = mesh.color4f[6] = mesh.color4f[10] = mesh.color4f[14] = blue;
-       mesh.color4f[3] = mesh.color4f[7] = mesh.color4f[11] = mesh.color4f[15] = alpha;
-       DrawQ_Mesh (&mesh, flags);
-#else
-       int size;
-       drawqueue_t *dq;
-       if (alpha < (1.0f / 255.0f) || !picname || !picname[0])
-               return;
-       size = sizeof(*dq) + ((strlen(picname) + 1 + 3) & ~3);
-       if (r_refdef.drawqueuesize + size > r_refdef.maxdrawqueuesize)
-               return;
-       red = bound(0, red, 1);
-       green = bound(0, green, 1);
-       blue = bound(0, blue, 1);
-       alpha = bound(0, alpha, 1);
-       dq = (void *)(r_refdef.drawqueue + r_refdef.drawqueuesize);
-       dq->size = size;
-       dq->command = DRAWQUEUE_PIC;
-       dq->flags = flags;
-       dq->color = ((unsigned int) (red * 255.0f) << 24) | ((unsigned int) (green * 255.0f) << 16) | ((unsigned int) (blue * 255.0f) << 8) | ((unsigned int) (alpha * 255.0f));
-       dq->x = x;
-       dq->y = y;
-       // if these are not zero, they override the pic's size
-       dq->scalex = width;
-       dq->scaley = height;
-       strcpy((char *)(dq + 1), picname);
-       r_refdef.drawqueuesize += dq->size;
-#endif
 }
 
 void DrawQ_String(float x, float y, const char *string, int maxlen, float scalex, float scaley, float red, float green, float blue, float alpha, int flags)
@@ -598,55 +540,7 @@ void DrawQ_String(float x, float y, const char *string, int maxlen, float scalex
 
 void DrawQ_Fill (float x, float y, float w, float h, float red, float green, float blue, float alpha, int flags)
 {
-#if 1
        DrawQ_SuperPic(x,y,NULL,w,h,0,0,red,green,blue,alpha,1,0,red,green,blue,alpha,0,1,red,green,blue,alpha,1,1,red,green,blue,alpha,flags);
-#elif 1
-       float floats[48];
-       drawqueuemesh_t mesh;
-       if (alpha < (1.0f / 255.0f))
-               return;
-       mesh.texture = NULL;
-       mesh.numtriangles = 2;
-       mesh.numvertices = 4;
-       mesh.indices = picelements;
-       mesh.vertex3f = floats;
-       mesh.texcoord2f = floats + 16;
-       mesh.color4f = floats + 32;
-       memset(floats, 0, sizeof(floats));
-       mesh.vertex3f[0] = mesh.vertex3f[12] = x;
-       mesh.vertex3f[1] = mesh.vertex3f[5] = y;
-       mesh.vertex3f[4] = mesh.vertex3f[8] = x + w;
-       mesh.vertex3f[9] = mesh.vertex3f[13] = y + h;
-       mesh.color4f[0] = mesh.color4f[4] = mesh.color4f[8] = mesh.color4f[12] = red;
-       mesh.color4f[1] = mesh.color4f[5] = mesh.color4f[9] = mesh.color4f[13] = green;
-       mesh.color4f[2] = mesh.color4f[6] = mesh.color4f[10] = mesh.color4f[14] = blue;
-       mesh.color4f[3] = mesh.color4f[7] = mesh.color4f[11] = mesh.color4f[15] = alpha;
-       DrawQ_Mesh (&mesh, flags);
-#else
-       int size;
-       drawqueue_t *dq;
-       if (alpha < (1.0f / 255.0f))
-               return;
-       size = sizeof(*dq) + 4;
-       if (r_refdef.drawqueuesize + size > r_refdef.maxdrawqueuesize)
-               return;
-       red = bound(0, red, 1);
-       green = bound(0, green, 1);
-       blue = bound(0, blue, 1);
-       alpha = bound(0, alpha, 1);
-       dq = (void *)(r_refdef.drawqueue + r_refdef.drawqueuesize);
-       dq->size = size;
-       dq->command = DRAWQUEUE_PIC;
-       dq->flags = flags;
-       dq->color = ((unsigned int) (red * 255.0f) << 24) | ((unsigned int) (green * 255.0f) << 16) | ((unsigned int) (blue * 255.0f) << 8) | ((unsigned int) (alpha * 255.0f));
-       dq->x = x;
-       dq->y = y;
-       dq->scalex = w;
-       dq->scaley = h;
-       // empty pic name
-       *((char *)(dq + 1)) = 0;
-       r_refdef.drawqueuesize += dq->size;
-#endif
 }
 
 void DrawQ_SuperPic(float x, float y, char *picname, float width, float height, float s1, float t1, float r1, float g1, float b1, float a1, float s2, float t2, float r2, float g2, float b2, float a2, float s3, float t3, float r3, float g3, float b3, float a3, float s4, float t4, float r4, float g4, float b4, float a4, int flags)
@@ -799,7 +693,7 @@ static void SCR_CalcRefdef (void)
        if (cl.worldmodel)
        {
                Mod_CheckLoaded(cl.worldmodel);
-               contents = Mod_PointContents(r_refdef.vieworg, cl.worldmodel);
+               contents = cl.worldmodel ? cl.worldmodel->PointContents(cl.worldmodel, r_refdef.vieworg) : CONTENTS_EMPTY;
                if (contents != CONTENTS_EMPTY && contents != CONTENTS_SOLID)
                {
                        r_refdef.fov_x *= (sin(cl.time * 4.7) * 0.015 + 0.985);