]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_screen.c
add cl_dyntexture.o to makefile
[xonotic/darkplaces.git] / cl_screen.c
index 5da743c7032ca6ba66ea2b4e52bb0d6d73022674..55603fe6c6a9df733d18619dfe32a360ff44275c 100644 (file)
@@ -683,7 +683,8 @@ void R_TimeReport_Frame(void)
                if (loc)
                        sprintf(r_speeds_string + strlen(r_speeds_string), "Location: %s\n", loc->name);
                sprintf(r_speeds_string + strlen(r_speeds_string), "org:'%+8.2f %+8.2f %+8.2f' dir:'%+2.3f %+2.3f %+2.3f'\n", r_view.origin[0], r_view.origin[1], r_view.origin[2], r_view.forward[0], r_view.forward[1], r_view.forward[2]);
-               sprintf(r_speeds_string + strlen(r_speeds_string), "%5i entities%6i surfaces%6i triangles%5i leafs%5i portals%6i particles\n", r_refdef.stats.entities, r_refdef.stats.entities_surfaces, r_refdef.stats.entities_triangles, r_refdef.stats.world_leafs, r_refdef.stats.world_portals, r_refdef.stats.particles);
+               sprintf(r_speeds_string + strlen(r_speeds_string), "%7i surfaces%7i triangles %5i entities (%7i surfaces%7i triangles)\n", r_refdef.stats.world_surfaces, r_refdef.stats.world_triangles, r_refdef.stats.entities, r_refdef.stats.entities_surfaces, r_refdef.stats.entities_triangles);
+               sprintf(r_speeds_string + strlen(r_speeds_string), "%5ileafs%5i portals%6i particles%6i decals\n", r_refdef.stats.world_leafs, r_refdef.stats.world_portals, r_refdef.stats.particles, r_refdef.stats.decals);
                sprintf(r_speeds_string + strlen(r_speeds_string), "%4i lights%4i clears%4i scissored%7i light%7i shadow%7i dynamic\n", r_refdef.stats.lights, r_refdef.stats.lights_clears, r_refdef.stats.lights_scissored, r_refdef.stats.lights_lighttriangles, r_refdef.stats.lights_shadowtriangles, r_refdef.stats.lights_dynamicshadowtriangles);
                if (r_refdef.stats.bloom)
                        sprintf(r_speeds_string + strlen(r_speeds_string), "rendered%6i meshes%8i triangles bloompixels%8i copied%8i drawn\n", r_refdef.stats.meshes, r_refdef.stats.meshes_elements / 3, r_refdef.stats.bloom_copypixels, r_refdef.stats.bloom_drawpixels);
@@ -971,7 +972,7 @@ static void SCR_CaptureVideo_RIFF_MakeIxChunk(const char *fcc, const char *dwChu
        SCR_CaptureVideo_RIFF_Write32(nMatching); // nEntriesInUse
        SCR_CaptureVideo_RIFF_WriteFourCC(dwChunkId); // dwChunkId
        SCR_CaptureVideo_RIFF_Write32(cls.capturevideo.videofile_ix_movistart & (fs_offset_t) 0xFFFFFFFFu);
-       SCR_CaptureVideo_RIFF_Write32(((long long) cls.capturevideo.videofile_ix_movistart) >> 32);
+       SCR_CaptureVideo_RIFF_Write32(((fs_offset_t) cls.capturevideo.videofile_ix_movistart) >> 32);
        SCR_CaptureVideo_RIFF_Write32(0); // dwReserved
 
        for(i = 0; i < cls.capturevideo.riffindexbuffer.cursize; i += 16)
@@ -994,7 +995,7 @@ static void SCR_CaptureVideo_RIFF_MakeIxChunk(const char *fcc, const char *dwChu
 
        FS_Seek(cls.capturevideo.videofile, masteridx_start + 16 * *masteridx_count, SEEK_SET);
        SCR_CaptureVideo_RIFF_Write32(ix & (fs_offset_t) 0xFFFFFFFFu);
-       SCR_CaptureVideo_RIFF_Write32(((long long) ix) >> 32);
+       SCR_CaptureVideo_RIFF_Write32(((fs_offset_t) ix) >> 32);
        SCR_CaptureVideo_RIFF_Write32(pos - ix);
        SCR_CaptureVideo_RIFF_Write32(nMatching);
        SCR_CaptureVideo_RIFF_Flush();
@@ -1304,7 +1305,6 @@ Cr = R *  .500 + G * -.419 + B * -.0813 + 128.;
                        SCR_CaptureVideo_RIFF_Write16(16); // bits per sample
                        SCR_CaptureVideo_RIFF_Write16(0); // size
                        SCR_CaptureVideo_RIFF_Pop();
-                       SCR_CaptureVideo_RIFF_Pop();
                        // master index
                        SCR_CaptureVideo_RIFF_Push("indx", NULL);
                        SCR_CaptureVideo_RIFF_Write16(4); // wLongsPerEntry
@@ -1319,6 +1319,7 @@ Cr = R *  .500 + G * -.419 + B * -.0813 + 128.;
                        for(i = 0; i < AVI_MASTER_INDEX_SIZE * 4; ++i)
                                SCR_CaptureVideo_RIFF_Write32(0); // fill up later
                        SCR_CaptureVideo_RIFF_Pop();
+                       SCR_CaptureVideo_RIFF_Pop();
                }
 
                cls.capturevideo.videofile_ix_master_audio_inuse = cls.capturevideo.videofile_ix_master_video_inuse = 0;
@@ -1707,36 +1708,22 @@ static void R_Envmap_f (void)
 
 //=============================================================================
 
-// LordHavoc: SHOWLMP stuff
-#define SHOWLMP_MAXLABELS 256
-typedef struct showlmp_s
-{
-       qboolean        isactive;
-       float           x;
-       float           y;
-       char            label[32];
-       char            pic[128];
-}
-showlmp_t;
-
-showlmp_t showlmp[SHOWLMP_MAXLABELS];
-
 void SHOWLMP_decodehide(void)
 {
        int i;
        char *lmplabel;
        lmplabel = MSG_ReadString();
-       for (i = 0;i < SHOWLMP_MAXLABELS;i++)
-               if (showlmp[i].isactive && strcmp(showlmp[i].label, lmplabel) == 0)
+       for (i = 0;i < cl.num_showlmps;i++)
+               if (cl.showlmps[i].isactive && strcmp(cl.showlmps[i].label, lmplabel) == 0)
                {
-                       showlmp[i].isactive = false;
+                       cl.showlmps[i].isactive = false;
                        return;
                }
 }
 
 void SHOWLMP_decodeshow(void)
 {
-       int i, k;
+       int k;
        char lmplabel[256], picname[256];
        float x, y;
        strlcpy (lmplabel,MSG_ReadString(), sizeof (lmplabel));
@@ -1751,41 +1738,37 @@ void SHOWLMP_decodeshow(void)
                x = MSG_ReadShort();
                y = MSG_ReadShort();
        }
-       k = -1;
-       for (i = 0;i < SHOWLMP_MAXLABELS;i++)
-               if (showlmp[i].isactive)
-               {
-                       if (strcmp(showlmp[i].label, lmplabel) == 0)
-                       {
-                               k = i;
-                               break; // drop out to replace it
-                       }
-               }
-               else if (k < 0) // find first empty one to replace
-                       k = i;
-       if (k < 0)
-               return; // none found to replace
-       // change existing one
-       showlmp[k].isactive = true;
-       strlcpy (showlmp[k].label, lmplabel, sizeof (showlmp[k].label));
-       strlcpy (showlmp[k].pic, picname, sizeof (showlmp[k].pic));
-       showlmp[k].x = x;
-       showlmp[k].y = y;
+       if (!cl.showlmps || cl.num_showlmps >= cl.max_showlmps)
+       {
+               showlmp_t *oldshowlmps = cl.showlmps;
+               cl.max_showlmps += 16;
+               cl.showlmps = Mem_Alloc(cls.levelmempool, cl.max_showlmps * sizeof(showlmp_t));
+               if (cl.num_showlmps)
+                       memcpy(cl.showlmps, oldshowlmps, cl.num_showlmps * sizeof(showlmp_t));
+               if (oldshowlmps)
+                       Mem_Free(oldshowlmps);
+       }
+       for (k = 0;k < cl.max_showlmps;k++)
+               if (cl.showlmps[k].isactive && !strcmp(cl.showlmps[k].label, lmplabel))
+                       break;
+       if (k == cl.max_showlmps)
+               for (k = 0;k < cl.max_showlmps;k++)
+                       if (!cl.showlmps[k].isactive)
+                               break;
+       cl.showlmps[k].isactive = true;
+       strlcpy (cl.showlmps[k].label, lmplabel, sizeof (cl.showlmps[k].label));
+       strlcpy (cl.showlmps[k].pic, picname, sizeof (cl.showlmps[k].pic));
+       cl.showlmps[k].x = x;
+       cl.showlmps[k].y = y;
+       cl.num_showlmps = max(cl.num_showlmps, k + 1);
 }
 
 void SHOWLMP_drawall(void)
 {
        int i;
-       for (i = 0;i < SHOWLMP_MAXLABELS;i++)
-               if (showlmp[i].isactive)
-                       DrawQ_Pic(showlmp[i].x, showlmp[i].y, Draw_CachePic(showlmp[i].pic, true), 0, 0, 1, 1, 1, 1, 0);
-}
-
-void SHOWLMP_clear(void)
-{
-       int i;
-       for (i = 0;i < SHOWLMP_MAXLABELS;i++)
-               showlmp[i].isactive = false;
+       for (i = 0;i < cl.num_showlmps;i++)
+               if (cl.showlmps[i].isactive)
+                       DrawQ_Pic(cl.showlmps[i].x, cl.showlmps[i].y, Draw_CachePic(cl.showlmps[i].pic, true), 0, 0, 1, 1, 1, 1, 0);
 }
 
 /*
@@ -1875,7 +1858,7 @@ void SCR_DrawScreen (void)
        R_Mesh_Start();
 
        if (r_timereport_active)
-               R_TimeReport("setup");
+               R_TimeReport("screensetup");
 
        R_UpdateVariables();
 
@@ -2139,7 +2122,8 @@ void CL_UpdateScreen(void)
        qglDepthMask(1);CHECKGLERROR
        qglColorMask(1,1,1,1);CHECKGLERROR
        qglClearColor(0,0,0,0);CHECKGLERROR
-       qglClear(GL_COLOR_BUFFER_BIT);CHECKGLERROR
+       R_ClearScreen();
+       r_view.clear = false;
 
        if(scr_stipple.integer)
        {
@@ -2164,7 +2148,7 @@ void CL_UpdateScreen(void)
                qglDisable(GL_POLYGON_STIPPLE);
 
        if (r_timereport_active)
-               R_TimeReport("clear");
+               R_TimeReport("screenclear");
 
        qglDrawBuffer(GL_BACK);
 
@@ -2222,5 +2206,4 @@ void CL_UpdateScreen(void)
 
 void CL_Screen_NewMap(void)
 {
-       SHOWLMP_clear();
 }