removed support for r_ser (also known as R_Clip or "Hidden Surface Removal") as it...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 5 Aug 2002 10:58:27 +0000 (10:58 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 5 Aug 2002 10:58:27 +0000 (10:58 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2197 d7cf8633-e32d-0410-b094-e92efae38249

14 files changed:
darkplaces.dsp
gl_rmain.c
gl_rsurf.c
makefile
makefile.mingw
menu.c
model_alias.c
model_brush.c
model_shared.h
model_sprite.c
r_clip.c [deleted file]
r_clip.h [deleted file]
r_sprites.c
render.h

index 37bc514..b5a7c99 100644 (file)
@@ -320,10 +320,6 @@ SOURCE=.\quakeio.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\r_clip.c\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\r_crosshairs.c\r
 # End Source File\r
 # Begin Source File\r
@@ -632,10 +628,6 @@ SOURCE=.\quakeio.h
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\r_clip.h\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\r_lerpanim.h\r
 # End Source File\r
 # Begin Source File\r
index 064bda6..8ec79d5 100644 (file)
@@ -65,8 +65,6 @@ cvar_t        gl_fogblue = {0, "gl_fogblue","0.3"};
 cvar_t gl_fogstart = {0, "gl_fogstart", "0"};
 cvar_t gl_fogend = {0, "gl_fogend","0"};
 
-cvar_t r_ser = {CVAR_SAVE, "r_ser", "0"};
-
 cvar_t r_multitexture = {0, "r_multitexture", "1"};
 
 /*
@@ -241,7 +239,6 @@ void GL_Main_Init(void)
        Cvar_RegisterVariable (&r_dynamic);
        Cvar_RegisterVariable (&r_waterripple);
        Cvar_RegisterVariable (&r_fullbright);
-       Cvar_RegisterVariable (&r_ser);
        Cvar_RegisterVariable (&r_multitexture);
        if (gamemode == GAME_NEHAHRA)
                Cvar_SetValue("r_fullbrights", 0);
@@ -278,7 +275,6 @@ extern void R_Crosshairs_Init(void);
 extern void R_Light_Init(void);
 extern void R_Particles_Init(void);
 extern void R_Explosion_Init(void);
-extern void R_Clip_Init(void);
 extern void ui_init(void);
 extern void gl_backend_init(void);
 
@@ -288,7 +284,6 @@ void Render_Init(void)
        R_Textures_Init();
        Mod_RenderInit();
        gl_backend_init();
-       R_Clip_Init();
        GL_Draw_Init();
        GL_Main_Init();
        GL_Models_Init();
@@ -373,10 +368,7 @@ static void R_MarkEntities (void)
                        continue;
 
                R_LerpAnimation(currentrenderentity);
-               if (r_ser.integer)
-                       currentrenderentity->model->SERAddEntity();
-               else
-                       currentrenderentity->visframe = r_framecount;
+               currentrenderentity->visframe = r_framecount;
        }
 }
 
@@ -550,8 +542,6 @@ void R_RenderView (void)
        R_SetFrustum();
        R_SetupFog();
        R_SkyStartFrame();
-       if (r_ser.integer)
-               R_Clip_StartFrame();
        R_BuildLightList();
 
        R_Mesh_Start();
@@ -564,12 +554,6 @@ void R_RenderView (void)
        R_MarkEntities();
        R_TimeReport("markentity");
 
-       if (r_ser.integer)
-       {
-               R_Clip_EndFrame();
-               R_TimeReport("hiddensurf");
-       }
-
        R_MarkWorldLights();
        R_TimeReport("marklights");
 
index 7e7a3b9..a9a6cb5 100644 (file)
@@ -1752,11 +1752,6 @@ static void RSurfShader_Wall_Lightmap(msurface_t *firstsurf)
 =============================================================
 */
 
-static void RSurf_Callback(void *data, void *junk)
-{
-       ((msurface_t *)data)->visframe = r_framecount;
-}
-
 static void R_SolidWorldNode (void)
 {
        if (r_viewleaf->contents != CONTENTS_SOLID)
@@ -1765,7 +1760,6 @@ static void R_SolidWorldNode (void)
                mportal_t *p, *pstack[8192];
                msurface_t *surf, **mark, **endmark;
                mleaf_t *leaf;
-               tinyplane_t plane;
                // LordHavoc: portal-passage worldnode; follows portals leading
                // outward from viewleaf, if a portal leads offscreen it is not
                // followed, in indoor maps this can often cull a great deal of
@@ -1783,54 +1777,25 @@ static void R_SolidWorldNode (void)
                {
                        mark = leaf->firstmarksurface;
                        endmark = mark + leaf->nummarksurfaces;
-                       if (r_ser.integer)
+                       do
                        {
-                               do
+                               surf = *mark++;
+                               // make sure surfaces are only processed once
+                               if (surf->worldnodeframe == r_framecount)
+                                       continue;
+                               surf->worldnodeframe = r_framecount;
+                               if (PlaneDist(r_origin, surf->plane) < surf->plane->dist)
                                {
-                                       surf = *mark++;
-                                       // make sure surfaces are only processed once
-                                       if (surf->worldnodeframe == r_framecount)
-                                               continue;
-                                       surf->worldnodeframe = r_framecount;
-                                       if (PlaneDist(r_origin, surf->plane) < surf->plane->dist)
-                                       {
-                                               if (surf->flags & SURF_PLANEBACK)
-                                               {
-                                                       VectorNegate(surf->plane->normal, plane.normal);
-                                                       plane.dist = -surf->plane->dist;
-                                                       R_Clip_AddPolygon((float *)surf->poly_verts, surf->poly_numverts, sizeof(float[3]), (surf->flags & SURF_CLIPSOLID) != 0, RSurf_Callback, surf, NULL, &plane);
-                                               }
-                                       }
-                                       else
-                                       {
-                                               if (!(surf->flags & SURF_PLANEBACK))
-                                                       R_Clip_AddPolygon((float *)surf->poly_verts, surf->poly_numverts, sizeof(float[3]), (surf->flags & SURF_CLIPSOLID) != 0, RSurf_Callback, surf, NULL, (tinyplane_t *)surf->plane);
-                                       }
+                                       if (surf->flags & SURF_PLANEBACK)
+                                               surf->visframe = r_framecount;
                                }
-                               while (mark < endmark);
-                       }
-                       else
-                       {
-                               do
+                               else
                                {
-                                       surf = *mark++;
-                                       // make sure surfaces are only processed once
-                                       if (surf->worldnodeframe == r_framecount)
-                                               continue;
-                                       surf->worldnodeframe = r_framecount;
-                                       if (PlaneDist(r_origin, surf->plane) < surf->plane->dist)
-                                       {
-                                               if (surf->flags & SURF_PLANEBACK)
-                                                       surf->visframe = r_framecount;
-                                       }
-                                       else
-                                       {
-                                               if (!(surf->flags & SURF_PLANEBACK))
-                                                       surf->visframe = r_framecount;
-                                       }
+                                       if (!(surf->flags & SURF_PLANEBACK))
+                                               surf->visframe = r_framecount;
                                }
-                               while (mark < endmark);
                        }
+                       while (mark < endmark);
                }
 
                // follow portals into other leafs
@@ -1876,49 +1841,21 @@ loc2:
                {
                        if (node->numsurfaces)
                        {
-                               if (r_ser.integer)
+                               msurface_t *surf = cl.worldmodel->surfaces + node->firstsurface, *surfend = surf + node->numsurfaces;
+                               if (PlaneDiff (r_origin, node->plane) < 0)
                                {
-                                       msurface_t *surf = cl.worldmodel->surfaces + node->firstsurface, *surfend = surf + node->numsurfaces;
-                                       tinyplane_t plane;
-                                       if (PlaneDiff (r_origin, node->plane) < 0)
-                                       {
-                                               for (;surf < surfend;surf++)
-                                               {
-                                                       if (surf->flags & SURF_PLANEBACK)
-                                                       {
-                                                               VectorNegate(surf->plane->normal, plane.normal);
-                                                               plane.dist = -surf->plane->dist;
-                                                               R_Clip_AddPolygon((float *)surf->poly_verts, surf->poly_numverts, sizeof(float[3]), surf->flags & SURF_CLIPSOLID, RSurf_Callback, surf, NULL, &plane);
-                                                       }
-                                               }
-                                       }
-                                       else
+                                       for (;surf < surfend;surf++)
                                        {
-                                               for (;surf < surfend;surf++)
-                                               {
-                                                       if (!(surf->flags & SURF_PLANEBACK))
-                                                               R_Clip_AddPolygon((float *)surf->poly_verts, surf->poly_numverts, sizeof(float[3]), surf->flags & SURF_CLIPSOLID, RSurf_Callback, surf, NULL, (tinyplane_t *)surf->plane);
-                                               }
+                                               if (surf->flags & SURF_PLANEBACK)
+                                                       surf->visframe = r_framecount;
                                        }
                                }
                                else
                                {
-                                       msurface_t *surf = cl.worldmodel->surfaces + node->firstsurface, *surfend = surf + node->numsurfaces;
-                                       if (PlaneDiff (r_origin, node->plane) < 0)
+                                       for (;surf < surfend;surf++)
                                        {
-                                               for (;surf < surfend;surf++)
-                                               {
-                                                       if (surf->flags & SURF_PLANEBACK)
-                                                               surf->visframe = r_framecount;
-                                               }
-                                       }
-                                       else
-                                       {
-                                               for (;surf < surfend;surf++)
-                                               {
-                                                       if (!(surf->flags & SURF_PLANEBACK))
-                                                               surf->visframe = r_framecount;
-                                               }
+                                               if (!(surf->flags & SURF_PLANEBACK))
+                                                       surf->visframe = r_framecount;
                                        }
                                }
                        }
@@ -1970,7 +1907,6 @@ static void R_PVSWorldNode()
        mportal_t *p, *pstack[8192];
        msurface_t *surf, **mark, **endmark;
        mleaf_t *leaf;
-       tinyplane_t plane;
        qbyte *worldvis;
 
        worldvis = Mod_LeafPVS (r_viewleaf, cl.worldmodel);
@@ -1987,54 +1923,25 @@ loc0:
        {
                mark = leaf->firstmarksurface;
                endmark = mark + leaf->nummarksurfaces;
-               if (r_ser.integer)
-               {
-                       do
+               do
+               {
+                       surf = *mark++;
+                       // make sure surfaces are only processed once
+                       if (surf->worldnodeframe == r_framecount)
+                               continue;
+                       surf->worldnodeframe = r_framecount;
+                       if (PlaneDist(r_origin, surf->plane) < surf->plane->dist)
                        {
-                               surf = *mark++;
-                               // make sure surfaces are only processed once
-                               if (surf->worldnodeframe == r_framecount)
-                                       continue;
-                               surf->worldnodeframe = r_framecount;
-                               if (PlaneDist(r_origin, surf->plane) < surf->plane->dist)
-                               {
-                                       if (surf->flags & SURF_PLANEBACK)
-                                       {
-                                               VectorNegate(surf->plane->normal, plane.normal);
-                                               plane.dist = -surf->plane->dist;
-                                               R_Clip_AddPolygon((float *)surf->poly_verts, surf->poly_numverts, sizeof(float[3]), (surf->flags & SURF_CLIPSOLID) != 0, RSurf_Callback, surf, NULL, &plane);
-                                       }
-                               }
-                               else
-                               {
-                                       if (!(surf->flags & SURF_PLANEBACK))
-                                               R_Clip_AddPolygon((float *)surf->poly_verts, surf->poly_numverts, sizeof(float[3]), (surf->flags & SURF_CLIPSOLID) != 0, RSurf_Callback, surf, NULL, (tinyplane_t *)surf->plane);
-                               }
+                               if (surf->flags & SURF_PLANEBACK)
+                                       surf->visframe = r_framecount;
                        }
-                       while (mark < endmark);
-               }
-               else
-               {
-                       do
+                       else
                        {
-                               surf = *mark++;
-                               // make sure surfaces are only processed once
-                               if (surf->worldnodeframe == r_framecount)
-                                       continue;
-                               surf->worldnodeframe = r_framecount;
-                               if (PlaneDist(r_origin, surf->plane) < surf->plane->dist)
-                               {
-                                       if (surf->flags & SURF_PLANEBACK)
-                                               surf->visframe = r_framecount;
-                               }
-                               else
-                               {
-                                       if (!(surf->flags & SURF_PLANEBACK))
-                                               surf->visframe = r_framecount;
-                               }
+                               if (!(surf->flags & SURF_PLANEBACK))
+                                       surf->visframe = r_framecount;
                        }
-                       while (mark < endmark);
                }
+               while (mark < endmark);
        }
 
        // follow portals into other leafs
index 2aacb9a..d650fbf 100644 (file)
--- a/makefile
+++ b/makefile
@@ -22,7 +22,7 @@ SOUNDLIB=
 #if you want no CD audio
 CD=cd_null.o
 
-OBJECTS= builddate.o $(CD) $(SND) chase.o cl_demo.o cl_input.o cl_main.o cl_parse.o cl_tent.o cmd.o common.o console.o crc.o cvar.o fractalnoise.o gl_draw.o r_sky.o gl_rmain.o gl_rsurf.o host.o host_cmd.o image.o keys.o mathlib.o menu.o model_alias.o model_brush.o model_shared.o model_sprite.o net_bsd.o net_udp.o net_dgrm.o net_loop.o net_main.o pr_cmds.o pr_edict.o pr_exec.o r_light.o r_explosion.o sbar.o sv_main.o sv_move.o sv_phys.o sv_user.o sv_light.o sys_linux.o transform.o view.o wad.o world.o zone.o vid_shared.o palette.o r_crosshairs.o gl_textures.o gl_models.o r_sprites.o r_modules.o r_explosion.o r_lerpanim.o protocol.o quakeio.o r_clip.o ui.o portals.o sys_shared.o cl_light.o gl_backend.o cl_particles.o cl_screen.o cgamevm.o cgame.o filematch.o collision.o cl_collision.o matrixlib.o cl_video.o dpvsimpledecode.o wavefile.o meshqueue.o
+OBJECTS= builddate.o $(CD) $(SND) chase.o cl_demo.o cl_input.o cl_main.o cl_parse.o cl_tent.o cmd.o common.o console.o crc.o cvar.o fractalnoise.o gl_draw.o r_sky.o gl_rmain.o gl_rsurf.o host.o host_cmd.o image.o keys.o mathlib.o menu.o model_alias.o model_brush.o model_shared.o model_sprite.o net_bsd.o net_udp.o net_dgrm.o net_loop.o net_main.o pr_cmds.o pr_edict.o pr_exec.o r_light.o r_explosion.o sbar.o sv_main.o sv_move.o sv_phys.o sv_user.o sv_light.o sys_linux.o transform.o view.o wad.o world.o zone.o vid_shared.o palette.o r_crosshairs.o gl_textures.o gl_models.o r_sprites.o r_modules.o r_explosion.o r_lerpanim.o protocol.o quakeio.o ui.o portals.o sys_shared.o cl_light.o gl_backend.o cl_particles.o cl_screen.o cgamevm.o cgame.o filematch.o collision.o cl_collision.o matrixlib.o cl_video.o dpvsimpledecode.o wavefile.o meshqueue.o
 
 #K6/athlon optimizations
 CPUOPTIMIZATIONS=-march=k6
index d306b4f..6c14afc 100644 (file)
@@ -1,5 +1,5 @@
 
-OBJECTS= builddate.o chase.o cl_demo.o cl_input.o cl_main.o cl_parse.o cl_tent.o cmd.o common.o console.o crc.o cvar.o fractalnoise.o gl_draw.o r_sky.o gl_rmain.o gl_rsurf.o host.o host_cmd.o image.o keys.o mathlib.o menu.o model_alias.o model_brush.o model_shared.o model_sprite.o net_dgrm.o net_loop.o net_main.o pr_cmds.o pr_edict.o pr_exec.o r_light.o r_explosion.o sbar.o snd_dma.o snd_mem.o snd_mix.o sv_main.o sv_move.o sv_phys.o sv_user.o sv_light.o transform.o view.o wad.o world.o zone.o vid_shared.o palette.o r_crosshairs.o gl_textures.o gl_models.o r_sprites.o r_modules.o r_explosion.o r_lerpanim.o protocol.o quakeio.o r_clip.o ui.o portals.o sys_shared.o cl_light.o gl_backend.o cl_particles.o cl_screen.o cgamevm.o cgame.o filematch.o collision.o cl_collision.o matrixlib.o cl_video.o dpvsimpledecode.o wavefile.o meshqueue.o
+OBJECTS= builddate.o chase.o cl_demo.o cl_input.o cl_main.o cl_parse.o cl_tent.o cmd.o common.o console.o crc.o cvar.o fractalnoise.o gl_draw.o r_sky.o gl_rmain.o gl_rsurf.o host.o host_cmd.o image.o keys.o mathlib.o menu.o model_alias.o model_brush.o model_shared.o model_sprite.o net_dgrm.o net_loop.o net_main.o pr_cmds.o pr_edict.o pr_exec.o r_light.o r_explosion.o sbar.o snd_dma.o snd_mem.o snd_mix.o sv_main.o sv_move.o sv_phys.o sv_user.o sv_light.o transform.o view.o wad.o world.o zone.o vid_shared.o palette.o r_crosshairs.o gl_textures.o gl_models.o r_sprites.o r_modules.o r_explosion.o r_lerpanim.o protocol.o quakeio.o ui.o portals.o sys_shared.o cl_light.o gl_backend.o cl_particles.o cl_screen.o cgamevm.o cgame.o filematch.o collision.o cl_collision.o matrixlib.o cl_video.o dpvsimpledecode.o wavefile.o meshqueue.o
 
 #K6/athlon optimizations
 #CPUOPTIMIZATIONS=-march=k6
diff --git a/menu.c b/menu.c
index 103c356..6f69c71 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -1250,7 +1250,7 @@ void M_DrawCheckbox (int x, int y, int on)
 }
 
 
-#define        OPTIONS_ITEMS   28
+#define        OPTIONS_ITEMS   27
 
 int            options_cursor;
 
@@ -1278,49 +1278,46 @@ void M_Menu_Options_AdjustSliders (int dir)
                Cvar_SetValueQuick (&r_skyquality, bound(0, r_skyquality.integer + dir, 2));
                break;
        case 8:
-               Cvar_SetValueQuick (&r_ser, !r_ser.integer);
-               break;
-       case 9:
                Cvar_SetValueQuick (&v_overbrightbits, bound(0, v_overbrightbits.integer + dir, 4));
                break;
-       case 10:
+       case 9:
                Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
                break;
-       case 11:
+       case 10:
                Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
                break;
-       case 12:
+       case 11:
                Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
                break;
-       case 13:
+       case 12:
                Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.25, 5));
                break;
-       case 14:
+       case 13:
                Cvar_SetValueQuick (&v_contrast, bound(0.5, v_contrast.value + dir * 0.25, 5));
                break;
-       case 15:
+       case 14:
                Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
                break;
-       case 16: // music volume
+       case 15: // music volume
                #ifdef _WIN32
                Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 1.0, 1));
                #else
                Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
                #endif
                break;
-       case 17: // sfx volume
+       case 16: // sfx volume
                Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
                break;
-       case 18:
+       case 17:
                Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
                break;
-       case 19:
+       case 18:
                Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
                break;
-       case 20: // show framerate
+       case 19: // show framerate
                Cvar_SetValueQuick (&showfps, !showfps.integer);
                break;
-       case 21: // always run
+       case 20: // always run
                if (cl_forwardspeed.value > 200)
                {
                        Cvar_SetValueQuick (&cl_forwardspeed, 200);
@@ -1332,22 +1329,22 @@ void M_Menu_Options_AdjustSliders (int dir)
                        Cvar_SetValueQuick (&cl_backspeed, 400);
                }
                break;
-       case 22: // lookspring
+       case 21: // lookspring
                Cvar_SetValueQuick (&lookspring, !lookspring.integer);
                break;
-       case 23: // lookstrafe
+       case 22: // lookstrafe
                Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
                break;
-       case 24: // mouse speed
+       case 23: // mouse speed
                Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
                break;
-       case 25: // mouse look
+       case 24: // mouse look
                Cvar_SetValueQuick (&freelook, !freelook.integer);
                break;
-       case 26: // invert mouse
+       case 25: // invert mouse
                Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
                break;
-       case 27: // windowed mouse
+       case 26: // windowed mouse
                Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
                break;
        }
@@ -1371,7 +1368,6 @@ void M_Options_Draw (void)
        M_Print(16, y, "         2D Resolution");M_DrawSlider(220, y, scr_2dresolution.value);y += 8;
        M_Print(16, y, "           Screen size");M_DrawSlider(220, y, (scr_viewsize.value - 30) /(120 - 30));y += 8;
        M_Print(16, y, "           Sky Quality");M_DrawSlider(220, y, r_skyquality.value / 2);y += 8;
-       M_Print(16, y, "Hidden Surface Removal");M_DrawCheckbox(220, y, r_ser.integer);y += 8;
        M_Print(16, y, "       Overbright Bits");M_DrawSlider(220, y, (v_overbrightbits.value) / 4);y += 8;
        M_Print(16, y, "       Texture Combine");M_DrawCheckbox(220, y, gl_combine.integer);y += 8;
        M_Print(16, y, "             Dithering");M_DrawCheckbox(220, y, gl_dither.integer);y += 8;
index 5bdf6f9..6247e5b 100644 (file)
@@ -27,11 +27,6 @@ void Mod_AliasInit (void)
        Cvar_RegisterVariable(&r_mipskins);
 }
 
-static void Mod_Alias_SERAddEntity(void)
-{
-       R_Clip_AddBox(currentrenderentity->mins, currentrenderentity->maxs, R_Entity_Callback, currentrenderentity, NULL);
-}
-
 // LordHavoc: proper bounding box considerations
 static float aliasbboxmin[3], aliasbboxmax[3], modelyawradius, modelradius;
 
@@ -497,7 +492,6 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
        loadmodel->yawmins[2] = loadmodel->normalmins[2];
        loadmodel->yawmaxs[2] = loadmodel->normalmaxs[2];
 
-       loadmodel->SERAddEntity = Mod_Alias_SERAddEntity;
        loadmodel->Draw = R_DrawAliasModel;
        loadmodel->DrawSky = NULL;
        loadmodel->DrawShadow = NULL;
@@ -572,7 +566,6 @@ void Mod_LoadQ2AliasModel (model_t *mod, void *buffer)
 
        loadmodel->type = mod_alias;
        loadmodel->aliastype = ALIASTYPE_MDLMD2;
-       loadmodel->SERAddEntity = Mod_Alias_SERAddEntity;
        loadmodel->Draw = R_DrawAliasModel;
        loadmodel->DrawSky = NULL;
        loadmodel->DrawShadow = NULL;
@@ -959,7 +952,6 @@ void Mod_LoadZymoticModel(model_t *mod, void *buffer)
        loadmodel->yawmins[2] = loadmodel->normalmins[2];
        loadmodel->yawmaxs[2] = loadmodel->normalmaxs[2];
 
-       loadmodel->SERAddEntity = Mod_Alias_SERAddEntity;
        loadmodel->Draw = R_DrawAliasModel;
        loadmodel->DrawSky = NULL;
        loadmodel->DrawShadow = NULL;
index feab7d7..c5c8336 100644 (file)
@@ -49,11 +49,6 @@ void Mod_BrushInit (void)
        memset(mod_novis, 0xff, sizeof(mod_novis));
 }
 
-void Mod_Brush_SERAddEntity(void)
-{
-       R_Clip_AddBox(currentrenderentity->mins, currentrenderentity->maxs, R_Entity_Callback, currentrenderentity, NULL);
-}
-
 /*
 ===============
 Mod_PointInLeaf
@@ -2522,7 +2517,6 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
 
                mod->numleafs = bm->visleafs;
 
-               mod->SERAddEntity = Mod_Brush_SERAddEntity;
                mod->Draw = R_DrawBrushModelNormal;
                mod->DrawShadow = NULL;
 
index 6d7cb0c..21deb6a 100644 (file)
@@ -192,9 +192,6 @@ typedef struct model_s
        int                             sprnum_type;
        mspriteframe_t  *sprdata_frames;
 
-       // adds a box (or individual polygons) to the clipping engine,
-       // which will mark the entity visible if seen
-       void(*SERAddEntity)(void);
        // draw the model
        void(*Draw)(void);
        // draw the model's sky polygons (only used by brush models)
index 7af45a9..3c01af1 100644 (file)
@@ -36,7 +36,7 @@ void Mod_SpriteInit (void)
        Cvar_RegisterVariable(&r_mipsprites);
 }
 
-void Mod_Sprite_StripExtension(char *in, char *out)
+static void Mod_Sprite_StripExtension(char *in, char *out)
 {
        char *end;
        end = in + strlen(in);
@@ -51,7 +51,7 @@ void Mod_Sprite_StripExtension(char *in, char *out)
        *out++ = 0;
 }
 
-void Mod_Sprite_SharedSetup(qbyte *datapointer, int version, int *palette)
+static void Mod_Sprite_SharedSetup(qbyte *datapointer, int version, int *palette)
 {
        int                                     i, j, k, groupframes, realframes, x, y, origin[2], width, height;
        dspriteframetype_t      *pinframetype;
@@ -227,12 +227,6 @@ void Mod_Sprite_SharedSetup(qbyte *datapointer, int version, int *palette)
        }
 }
 
-void Mod_Sprite_SERAddEntity(void)
-{
-       R_ClipSprite();
-}
-
-
 /*
 =================
 Mod_LoadSpriteModel
@@ -248,7 +242,6 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer)
 
        datapointer = buffer;
 
-       loadmodel->SERAddEntity = Mod_Sprite_SERAddEntity;
        loadmodel->Draw = R_DrawSpriteModel;
        loadmodel->DrawSky = NULL;
        loadmodel->DrawShadow = NULL;
diff --git a/r_clip.c b/r_clip.c
deleted file mode 100644 (file)
index 362268c..0000000
--- a/r_clip.c
+++ /dev/null
@@ -1,820 +0,0 @@
-
-#include "quakedef.h"
-
-typedef struct clipsurf_s
-{
-       struct clipsurf_s *next, *prev;
-       int state;
-       int visible;
-       int solid;
-       int removed;
-       void (*callback)(void *nativedata, void *nativedata2);
-       void *nativedata;
-       void *nativedata2;
-       float wstepx, wstepy, w00;
-       // wcurrent is a cached copy of w00 + wstepy * y,
-       // updated each time the surface is added to the stack,
-       // for quicker comparisons.
-       float wcurrent;
-}
-clipsurf_t;
-
-typedef struct clipedge_s
-{
-       float x, realx, realxstep;
-       struct clipedge_s *next, *prev, *nextremove;
-       clipsurf_t *psurf;
-       int leading;
-       int pad;
-}
-clipedge_t;
-
-clipsurf_t *pavailsurf, *clipsurfs, *clipsurfsend;
-clipedge_t *pavailedge, *clipedges, *clipedgesend, *newedges, **removeedges;
-
-clipsurf_t surfstack;
-clipedge_t edgehead, edgetail;
-clipedge_t maxedge = {2000000000.0f};
-
-cvar_t r_clipwidth = {0, "r_clipwidth", "800"};
-cvar_t r_clipheight = {0, "r_clipheight", "600"};
-cvar_t r_clipedges = {CVAR_SAVE, "r_clipedges", "32768"};
-cvar_t r_clipsurfaces = {CVAR_SAVE, "r_clipsurfaces", "8192"};
-
-int clipwidth = 0, clipheight = 0;
-int maxclipsurfs = 0, maxclipedges = 0;
-int needededges, neededsurfs;
-
-#if CLIPTEST
-typedef struct
-{
-       float w; // inverse depth (1/z)
-}
-clippixel_t;
-
-clippixel_t *clipbuffer;
-#endif
-
-float r_clip_viewmatrix[3][3], r_clip_viewmulx, r_clip_viewmuly, r_clip_viewcenterx, r_clip_viewcentery;
-tinyplane_t r_clip_viewplane[5];
-
-mempool_t *r_clip_mempool;
-
-void R_Clip_MakeViewMatrix(void)
-{
-       float pixelaspect, screenaspect, horizontalfieldofview, verticalfieldofview;
-       pixelaspect = (float) clipheight / (float) clipwidth * 320 / 240.0;
-       horizontalfieldofview = 2.0 * tan (r_refdef.fov_x/360*M_PI);
-       screenaspect = clipwidth * pixelaspect / clipheight;
-       verticalfieldofview = horizontalfieldofview / screenaspect;
-       r_clip_viewcenterx = clipwidth * 0.5 - 0.5;
-       r_clip_viewcentery = clipheight * 0.5 - 0.5;
-       r_clip_viewmulx = clipwidth / horizontalfieldofview;
-       r_clip_viewmuly = r_clip_viewmulx * pixelaspect;
-       // this constructs a transposed rotation matrix for the view (transposed matrices do the opposite of their normal behavior)
-       VectorCopy (vright, r_clip_viewmatrix[0]);
-       VectorNegate (vup, r_clip_viewmatrix[1]);
-       VectorCopy (vpn, r_clip_viewmatrix[2]);
-       VectorCopy (vpn, r_clip_viewplane[0].normal);
-       r_clip_viewplane[0].dist = DotProduct(r_origin, vpn);
-       memcpy(&r_clip_viewplane[1], &frustum[0], sizeof(tinyplane_t));
-       memcpy(&r_clip_viewplane[2], &frustum[1], sizeof(tinyplane_t));
-       memcpy(&r_clip_viewplane[3], &frustum[2], sizeof(tinyplane_t));
-       memcpy(&r_clip_viewplane[4], &frustum[3], sizeof(tinyplane_t));
-}
-
-void R_Clip_StartFrame(void)
-{
-       int i;
-       int newwidth, newheight, newmaxedges, newmaxsurfs;
-       newwidth = bound(80, r_clipwidth.integer, vid.realwidth * 2);
-       newheight = bound(60, r_clipheight.integer, vid.realheight * 2);
-       newmaxedges = bound(128, r_clipedges.integer, 262144);
-       newmaxsurfs = bound(32, r_clipsurfaces.integer, 65536);
-       if (newwidth != clipwidth || newheight != clipheight || maxclipedges != newmaxedges || maxclipsurfs != newmaxsurfs)
-       {
-#if CLIPTEST
-               if (clipbuffer)
-                       Mem_Free(clipbuffer);
-#endif
-               if (clipedges)
-                       Mem_Free(clipedges);
-               if (clipsurfs)
-                       Mem_Free(clipsurfs);
-               if (newedges)
-                       Mem_Free(newedges);
-               if (removeedges)
-                       Mem_Free(removeedges);
-               clipwidth = newwidth;
-               clipheight = newheight;
-               maxclipedges = newmaxedges;
-               maxclipsurfs = newmaxsurfs;
-#if CLIPTEST
-               clipbuffer = Mem_Alloc(r_clip_mempool, clipwidth * clipheight * sizeof(clippixel_t));
-#endif
-               clipedges = Mem_Alloc(r_clip_mempool, maxclipedges * sizeof(clipedge_t));
-               clipsurfs = Mem_Alloc(r_clip_mempool, maxclipsurfs * sizeof(clipsurf_t));
-               newedges = Mem_Alloc(r_clip_mempool, clipheight * sizeof(clipedge_t));
-               removeedges = Mem_Alloc(r_clip_mempool, clipheight * sizeof(clipedge_t *));
-               clipedgesend = clipedges + maxclipedges;
-               clipsurfsend = clipsurfs + maxclipsurfs;
-       }
-#if CLIPTEST
-       memset(clipbuffer, 0, clipwidth * clipheight * sizeof(clippixel_t));
-#endif
-       pavailedge = clipedges;
-       pavailsurf = clipsurfs;
-       // Clear the lists of edges to add and remove on each scan line.
-
-       needededges = 0;
-       neededsurfs = 0;
-       for (i = 0;i < clipheight;i++)
-       {
-               newedges[i].next = &maxedge;
-               removeedges[i] = NULL;
-       }
-
-       R_Clip_MakeViewMatrix();
-}
-
-void ScanEdges (void);
-
-void R_Clip_EndFrame(void)
-{
-       ScanEdges();
-       if (maxclipedges < needededges)
-       {
-               Con_Printf("R_Clip: ran out of edges, increasing limit from %d to %d\n", maxclipedges, needededges);
-               Cvar_SetValue("r_clipedges", needededges);
-       }
-       if (maxclipsurfs < neededsurfs)
-       {
-               Con_Printf("R_Clip: ran out of surfaces, increasing limit from %d to %d\n", maxclipsurfs, neededsurfs);
-               Cvar_SetValue("r_clipsurfaces", neededsurfs);
-       }
-}
-
-void r_clip_start(void)
-{
-       r_clip_mempool = Mem_AllocPool("R_Clip");
-}
-
-void r_clip_shutdown(void)
-{
-       Mem_FreePool(&r_clip_mempool);
-#if CLIPTEST
-       clipbuffer = NULL;
-#endif
-       clipsurfs = NULL;
-       clipedges = NULL;
-       newedges = NULL;
-       removeedges = NULL;
-       clipwidth = -1;
-       clipheight = -1;
-}
-
-void r_clip_newmap(void)
-{
-}
-
-void R_Clip_Init(void)
-{
-       Cvar_RegisterVariable(&r_clipwidth);
-       Cvar_RegisterVariable(&r_clipheight);
-       Cvar_RegisterVariable(&r_clipedges);
-       Cvar_RegisterVariable(&r_clipsurfaces);
-       R_RegisterModule("R_Clip", r_clip_start, r_clip_shutdown, r_clip_newmap);
-}
-
-int R_Clip_TriangleToPlane(vec3_t point1, vec3_t point2, vec3_t point3, tinyplane_t *p)
-{
-       float y, number;
-       vec3_t v1, v2;
-       VectorSubtract(point1, point2, v1);
-       VectorSubtract(point3, point2, v2);
-       CrossProduct(v1, v2, p->normal);
-       number = DotProduct(p->normal, p->normal);
-       if (number >= 0.1f)
-       {
-               *((int *)&y) = 0x5f3759df - ((* (int *) &number) >> 1);
-               y = y * (1.5f - (number * 0.5f * y * y));
-               VectorScale(p->normal, y, p->normal);
-               p->dist = DotProduct(point1, p->normal);
-               return true;
-       }
-       else
-               return false;
-}
-
-
-int R_Clip_ClipPolygonToPlane(float *in, float *out, int inpoints, int stride, tinyplane_t *plane)
-{
-       int i, outpoints, prevside, side;
-       float *prevpoint, prevdist, dist, dot;
-
-       // begin with the last point, then enter the loop with the first point as current
-       prevpoint = (float *) ((qbyte *)in + stride * (inpoints - 1));
-       prevdist = DotProduct(prevpoint, plane->normal) - plane->dist;
-       prevside = prevdist >= 0 ? SIDE_FRONT : SIDE_BACK;
-       i = 0;
-       outpoints = 0;
-       goto begin;
-       for (;i < inpoints;i++)
-       {
-               prevpoint = in;
-               prevdist = dist;
-               prevside = side;
-               (qbyte *)in += stride;
-
-begin:
-               dist = DotProduct(in, plane->normal) - plane->dist;
-               side = dist >= 0 ? SIDE_FRONT : SIDE_BACK;
-
-               if (prevside == SIDE_FRONT)
-               {
-                       VectorCopy(prevpoint, out);
-                       out += 3;
-                       outpoints++;
-                       if (side == SIDE_FRONT)
-                               continue;
-               }
-               else if (side == SIDE_BACK)
-                       continue;
-
-               // generate a split point
-               dot = prevdist / (prevdist - dist);
-               out[0] = prevpoint[0] + dot * (in[0] - prevpoint[0]);
-               out[1] = prevpoint[1] + dot * (in[1] - prevpoint[1]);
-               out[2] = prevpoint[2] + dot * (in[2] - prevpoint[2]);
-               out += 3;
-               outpoints++;
-       }
-
-       return outpoints;
-}
-
-float tempverts[256][3];
-float tempverts2[256][3];
-float screenverts[256][3];
-
-// LordHavoc: this code is based primarily on the ddjzsort code
-
-// Clips polygon to view frustum and nearclip, transforms polygon to viewspace, perspective projects polygon to screenspace,
-// and adds polygon's edges to the global edge table.
-void R_Clip_AddPolygon (vec_t *points, int numverts, int stride, int solid, void (*callback)(void *nativedata, void *nativedata2), void *nativedata, void *nativedata2, tinyplane_t *polyplane)
-{
-       float deltax, deltay, vx, vy, vz, fx;
-       int i, j, k, nextvert, temp, topy, bottomy, height, addededges;
-       clipedge_t *pedge;
-       tinyplane_t localplane;
-       float distinv;
-
-       if (polyplane == NULL)
-       {
-               polyplane = &localplane;
-               // calculate the plane for the polygon
-               if (!R_Clip_TriangleToPlane((float *) points, (float *) ((qbyte *)points + stride), (float *) ((qbyte *)points + 2 * stride), polyplane))
-               {
-                       for (i = 0;i < numverts;i++)
-                               for (j = i + 1;j < numverts;j++)
-                                       for (k = j + 1;k < numverts;k++)
-                                               if (R_Clip_TriangleToPlane((float *) ((qbyte *)points + i * stride), (float *) ((qbyte *)points + j * stride), (float *) ((qbyte *)points + k * stride), polyplane))
-                                                       goto valid1;
-                       return; // gave up
-                       valid1:;
-               }
-
-               // caller hasn't checked if this polygon faces the view, so we have to check
-               if (DotProduct(r_origin, polyplane->normal) < (polyplane->dist + 0.5f))
-                       return;
-       }
-
-       // for adaptive limits
-       needededges += numverts;
-       neededsurfs++;
-
-       if (pavailsurf >= clipsurfsend)
-               return;
-
-       // clip to view frustum and nearclip
-       if (numverts < 3) return;numverts = R_Clip_ClipPolygonToPlane(points      , tempverts2[0], numverts, stride, &r_clip_viewplane[0]);
-       if (numverts < 3) return;numverts = R_Clip_ClipPolygonToPlane(tempverts2[0], tempverts[0], numverts, sizeof(float) * 3, &r_clip_viewplane[1]);
-       if (numverts < 3) return;numverts = R_Clip_ClipPolygonToPlane(tempverts[0], tempverts2[0], numverts, sizeof(float) * 3, &r_clip_viewplane[2]);
-       if (numverts < 3) return;numverts = R_Clip_ClipPolygonToPlane(tempverts2[0], tempverts[0], numverts, sizeof(float) * 3, &r_clip_viewplane[3]);
-       if (numverts < 3) return;numverts = R_Clip_ClipPolygonToPlane(tempverts[0], tempverts2[0], numverts, sizeof(float) * 3, &r_clip_viewplane[4]);
-       if (numverts < 3)
-               return;
-       if (numverts > 256)
-               Sys_Error("R_Clip_AddPolygon: polygon exceeded 256 vertex buffer\n");
-
-       // it survived the clipping, transform to viewspace and project to screenspace
-
-       if (pavailedge + numverts > clipedgesend)
-               return;
-
-       for (i = 0;i < numverts;i++)
-       {
-               vx = tempverts2[i][0] - r_origin[0];
-               vy = tempverts2[i][1] - r_origin[1];
-               vz = tempverts2[i][2] - r_origin[2];
-               screenverts[i][2] = 1.0f / (r_clip_viewmatrix[2][0] * vx + r_clip_viewmatrix[2][1] * vy + r_clip_viewmatrix[2][2] * vz);
-               screenverts[i][0] = (r_clip_viewmatrix[0][0] * vx + r_clip_viewmatrix[0][1] * vy + r_clip_viewmatrix[0][2] * vz) * r_clip_viewmulx * screenverts[i][2] + r_clip_viewcenterx;
-               screenverts[i][1] = (r_clip_viewmatrix[1][0] * vx + r_clip_viewmatrix[1][1] * vy + r_clip_viewmatrix[1][2] * vz) * r_clip_viewmuly * screenverts[i][2] + r_clip_viewcentery;
-       }
-
-       // calculate the plane for the polygon
-       if (!R_Clip_TriangleToPlane(screenverts[0], screenverts[1], screenverts[2], &localplane))
-       {
-               for (i = 0;i < numverts;i++)
-                       for (j = i + 1;j < numverts;j++)
-                               for (k = j + 1;k < numverts;k++)
-                                       if (R_Clip_TriangleToPlane(screenverts[i], screenverts[j], screenverts[k], &localplane))
-                                               goto valid;
-               return; // gave up
-valid:;
-       }
-
-       // Set up the 1/z gradients from the polygon, calculating the
-       // base value at screen coordinate 0,0 so we can use screen
-       // coordinates directly when calculating 1/z from the gradients
-       distinv = 1.0f / localplane.normal[2];
-       pavailsurf->wstepx = -(localplane.normal[0] * distinv);
-       pavailsurf->wstepy = -(localplane.normal[1] * distinv);
-       pavailsurf->w00 = localplane.dist * distinv;
-
-       addededges = false;
-
-       // Add each edge in turn
-       for (i = 0;i < numverts;i++)
-       {
-               nextvert = i + 1;
-               if (nextvert >= numverts)
-                       nextvert = 0;
-
-               topy = (int)ceil(screenverts[i][1]);
-               bottomy = (int)ceil(screenverts[nextvert][1]);
-               height = bottomy - topy;
-               if (height == 0)
-                       continue;       // doesn't cross any scan lines
-               if (height < 0)
-               {
-                       // Leading edge
-                       temp = topy;
-                       topy = bottomy;
-                       bottomy = temp;
-                       if (topy < 0)
-                               topy = 0;
-                       if (bottomy > clipheight)
-                               bottomy = clipheight;
-                       if (topy >= bottomy)
-                               continue;
-
-                       pavailedge->leading = 1;
-
-                       deltax = screenverts[i][0] - screenverts[nextvert][0];
-                       deltay = screenverts[i][1] - screenverts[nextvert][1];
-
-                       pavailedge->realxstep = deltax / deltay;
-                       pavailedge->realx = screenverts[nextvert][0] + ((float)topy - screenverts[nextvert][1]) * pavailedge->realxstep;
-               }
-               else
-               {
-                       // Trailing edge
-                       if (topy < 0)
-                               topy = 0;
-                       if (bottomy > clipheight)
-                               bottomy = clipheight;
-                       if (topy >= bottomy)
-                               continue;
-
-                       pavailedge->leading = 0;
-
-                       deltax = screenverts[nextvert][0] - screenverts[i][0];
-                       deltay = screenverts[nextvert][1] - screenverts[i][1];
-
-                       pavailedge->realxstep = deltax / deltay;
-                       pavailedge->realx = screenverts[i][0] + ((float)topy - screenverts[i][1]) * pavailedge->realxstep;
-               }
-
-               // Put the edge on the list to be added on top scan
-               fx = pavailedge->x = bound(0.0f, pavailedge->realx, clipwidth - 0.5f);
-               pedge = &newedges[topy];
-               while (fx > pedge->next->x)
-                       pedge = pedge->next;
-               pavailedge->next = pedge->next;
-               pedge->next = pavailedge;
-
-               // Put the edge on the list to be removed after final scan
-               pavailedge->nextremove = removeedges[bottomy - 1];
-               removeedges[bottomy - 1] = pavailedge;
-
-               // Associate the edge with the surface
-               pavailedge->psurf = pavailsurf;
-
-               pavailedge++;
-
-               addededges = true;
-       }
-
-       if (!addededges)
-               return;
-
-       // Create the surface, so we'll know how to sort and draw from the edges
-       pavailsurf->next = NULL;
-       pavailsurf->prev = NULL;
-       pavailsurf->state = 0;
-       pavailsurf->visible = false;
-       pavailsurf->callback = callback;
-       pavailsurf->nativedata = nativedata;
-       pavailsurf->nativedata2 = nativedata2;
-       pavailsurf->solid = solid;
-       pavailsurf->removed = false;
-       pavailsurf++;
-}
-
-// Scan all the edges in the global edge table into spans.
-void ScanEdges (void)
-{
-       int y, rescan;
-       float fx, fy, w, w2, clipwidthf = clipwidth - 0.5f;
-       clipedge_t *pedge, *pedge2, *ptemp;
-       clipsurf_t *psurf, *psurf2;
-#if CLIPTEST
-       int x, x2;
-       float zi;
-       clippixel_t *cb;
-#endif
-       float cx;
-
-       // Set up the active edge list as initially empty, containing
-       // only the sentinels (which are also the background fill). Most
-       // of these fields could be set up just once at start-up
-       edgehead.next = &edgetail;
-       edgehead.prev = NULL;
-       edgehead.x = edgehead.realx = -0.9999f; // left edge of screen
-       edgehead.realxstep = 0;
-       edgehead.leading = 1;
-       edgehead.psurf = &surfstack;
-
-       edgetail.next = NULL; // mark end of list
-       edgetail.prev = &edgehead;
-       edgetail.x = edgetail.realx = clipwidth + 0.5f; // right edge of screen
-       edgetail.realxstep = 0;
-       edgetail.leading = 0;
-       edgetail.psurf = &surfstack;
-
-       // The background surface is the entire stack initially, and
-       // is infinitely far away, so everything sorts in front of it.
-       // This could be set just once at start-up
-       surfstack.solid = true;
-       surfstack.visible = true; // no callback
-       surfstack.next = surfstack.prev = &surfstack;
-       surfstack.wcurrent = surfstack.w00 = -999999.0;
-       surfstack.wstepx = surfstack.wstepy = 0.0;
-       surfstack.removed = false;
-
-       // rescan causes the edges to be compared at the span level
-       // it is false if the scanline will be identical to the previous
-       rescan = true;
-       for (y = 0;y < clipheight;y++)
-       {
-               fy = y;
-#if CLIPTEST
-               cb = clipbuffer + y * clipwidth;
-#endif
-
-               // Sort in any edges that start on this scan
-               if (newedges[y].next != &maxedge)
-               {
-                       rescan = true;
-                       pedge = newedges[y].next;
-                       pedge2 = &edgehead;
-                       while (pedge != &maxedge)
-                       {
-                               if (pedge->psurf->removed)
-                               {
-                                       pedge = pedge->next;
-                                       continue;
-                               }
-
-                               while (pedge->x > pedge2->next->x)
-                                       pedge2 = pedge2->next;
-
-                               ptemp = pedge->next;
-                               pedge->next = pedge2->next;
-                               pedge->prev = pedge2;
-                               pedge2->next->prev = pedge;
-                               pedge2->next = pedge;
-
-                               pedge2 = pedge;
-                               pedge = ptemp;
-                       }
-               }
-
-               // Scan out the active edges into spans
-
-               // Start out with the left background edge already inserted, and the surface stack containing only the background
-               surfstack.state = 1;
-               cx = 0;
-
-               // must always rescan if rendering to wbuffer
-#ifndef CLIPTEST
-//             if (rescan)
-#endif
-               {
-                       for (pedge = edgehead.next;pedge;pedge = pedge->next)
-                       {
-                               edgeremoved:
-                               psurf = pedge->psurf;
-                               if (psurf->removed)
-                               {
-                                       pedge2 = pedge->next;
-                                       pedge->prev->next = pedge->next;
-                                       pedge->next->prev = pedge->prev;
-                                       pedge->next = pedge->prev = pedge;
-                                       pedge = pedge2;
-                                       if (pedge)
-                                               goto edgeremoved;
-                                       else
-                                               break;
-                               }
-
-                               if (pedge->leading)
-                               {
-                                       // It's a leading edge. Figure out where it is
-                                       // relative to the current surfaces and insert in
-                                       // the surface stack; if it's on top, emit the span
-                                       // for the current top.
-                                       // First, make sure the edges don't cross
-                                       if (++psurf->state == 1)
-                                       {
-                                               fx = pedge->x;
-                                               // Calculate the surface's 1/z value at this pixel, and cache the y depth for quick compares later
-                                               w = (psurf->wcurrent = psurf->w00 + psurf->wstepy * fy) + psurf->wstepx * fx;
-
-                                               // See if that makes it a new top surface
-                                               psurf2 = surfstack.next;
-                                               w2 = psurf2->wcurrent + psurf2->wstepx * fx;
-
-                                               if (w >= w2)
-                                               {
-                                                       // It's a new top surface
-                                                       // emit the span for the current top
-                                                       if (fx > cx && !psurf2->visible)
-                                                       {
-                                                               psurf2->visible = true;
-                                                               psurf2->callback(psurf2->nativedata, psurf2->nativedata2);
-                                                       }
-
-#if CLIPTEST
-                                                       for (x = ceil(cx), x2 = ceil(fx) >= clipwidth ? clipwidth : ceil(fx), zi = psurf2->wcurrent + psurf2->wstepx * x;x < x2;x++, zi += psurf2->wstepx)
-                                                               cb[x].w = zi;
-#endif
-
-                                                       cx = fx;
-
-                                                       // Add the edge to the stack
-                                                       psurf->next = psurf2;
-                                                       psurf2->prev = psurf;
-                                                       surfstack.next = psurf;
-                                                       psurf->prev = &surfstack;
-                                               }
-                                               else
-                                               {
-                                                       // Not a new top; sort into the surface stack.
-                                                       // Guaranteed to terminate due to sentinel background surface
-                                                       do
-                                                       {
-                                                               psurf2 = psurf2->next;
-                                                               w2 = psurf2->wcurrent + psurf2->wstepx * fx;
-                                                       }
-                                                       while (w < w2);
-
-                                                       // Insert the surface into the stack
-                                                       psurf->next = psurf2;
-                                                       psurf->prev = psurf2->prev;
-                                                       psurf2->prev->next = psurf;
-                                                       psurf2->prev = psurf;
-                                               }
-                                       }
-                               }
-                               else
-                               {
-                                       // It's a trailing edge; if this was the top surface,
-                                       // emit the span and remove it.
-                                       // First, make sure the edges didn't cross
-                                       if (--psurf->state == 0)
-                                       {
-                                               if (surfstack.next == psurf)
-                                               {
-                                                       fx = pedge->x;
-
-                                                       // It's on top, emit the span
-                                                       if (fx > cx && !psurf->visible)
-                                                       {
-                                                               psurf->visible = true;
-                                                               psurf->callback(psurf->nativedata, psurf->nativedata2);
-                                                       }
-
-#if CLIPTEST
-                                                       fx = pedge->x;
-                                                       for (x = ceil(cx), x2 = ceil(fx) >= clipwidth ? clipwidth : ceil(fx), zi = psurf->w00 + psurf->wstepx * x + psurf->wstepy * fy;x < x2;x++, zi += psurf->wstepx)
-                                                               cb[x].w = zi;
-#endif
-
-                                                       cx = fx;
-                                               }
-
-                                               // Remove the surface from the stack
-                                               psurf->next->prev = psurf->prev;
-                                               psurf->prev->next = psurf->next;
-                                       }
-                               }
-
-                               // mark and remove all non-solid surfaces that are ontop
-                               while (!surfstack.next->solid)
-                               {
-                                       psurf = surfstack.next;
-                                       if (!psurf->visible)
-                                       {
-                                               psurf->visible = true;
-                                               psurf->callback(psurf->nativedata, psurf->nativedata2);
-                                       }
-                                       psurf->removed = true;
-                                       psurf->next->prev = psurf->prev;
-                                       psurf->prev->next = psurf->next;
-                                       // isolate the surface
-                                       psurf->next = psurf->prev = psurf;
-                               }
-                       }
-                       rescan = false;
-               }
-
-               // Remove edges that are done
-               pedge = removeedges[y];
-               if (pedge)
-               {
-                       while (pedge)
-                       {
-                               if (!pedge->psurf->removed)
-                               {
-                                       pedge->prev->next = pedge->next;
-                                       pedge->next->prev = pedge->prev;
-                                       if (pedge->psurf->visible)
-                                               rescan = true;
-                               }
-                               pedge = pedge->nextremove;
-                       }
-               }
-
-               // Step the remaining edges one scan line, and re-sort
-               for (pedge = edgehead.next;pedge != &edgetail;)
-               {
-                       ptemp = pedge->next;
-                       if (pedge->psurf->removed)
-                       {
-                               pedge->next->prev = pedge->prev;
-                               pedge->prev->next = pedge->next;
-                               pedge->next = pedge->prev = pedge;
-                               pedge = ptemp;
-                               continue;
-                       }
-
-                       // Step the edge
-                       if (pedge->realxstep)
-                       {
-                               pedge->realx += pedge->realxstep;
-                               pedge->x = bound(0.0f, pedge->realx, clipwidthf);
-                       }
-                       fx = pedge->x;
-
-                       // Move the edge back to the proper sorted location, if necessary
-                       while (fx < pedge->prev->x)
-                       {
-                               if (!rescan && (pedge->psurf->solid || pedge->prev->psurf->solid))
-                                       rescan = true;
-                               pedge2 = pedge->prev;
-                               pedge2->next = pedge->next;
-                               pedge->next->prev = pedge2;
-                               pedge2->prev->next = pedge;
-                               pedge->prev = pedge2->prev;
-                               pedge->next = pedge2;
-                               pedge2->prev = pedge;
-                       }
-
-                       pedge = ptemp;
-               }
-       }
-}
-
-void R_Clip_DisplayBuffer(void)
-{
-}
-
-float boxpoints[4*3];
-
-#define R_Clip_MinsBoxPolygon(axis, axisvalue, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4, callback, nativedata, nativedata2, plane) \
-{\
-       if (r_origin[(axis)] < ((axisvalue) - 0.5f))\
-       {\
-               (plane)->dist = -axisvalue;\
-               boxpoints[ 0] = x1;boxpoints[ 1] = y1;boxpoints[ 2] = z1;\
-               boxpoints[ 3] = x2;boxpoints[ 4] = y2;boxpoints[ 5] = z2;\
-               boxpoints[ 6] = x3;boxpoints[ 7] = y3;boxpoints[ 8] = z3;\
-               boxpoints[ 9] = x4;boxpoints[10] = y4;boxpoints[11] = z4;\
-               R_Clip_AddPolygon (boxpoints, 4, sizeof(float[3]), false, callback, nativedata, nativedata2, plane);\
-       }\
-}
-
-#define R_Clip_MaxsBoxPolygon(axis, axisvalue, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4, callback, nativedata, nativedata2, plane) \
-{\
-       if (r_origin[(axis)] > ((axisvalue) + 0.5f))\
-       {\
-               (plane)->dist = axisvalue;\
-               boxpoints[ 0] = x1;boxpoints[ 1] = y1;boxpoints[ 2] = z1;\
-               boxpoints[ 3] = x2;boxpoints[ 4] = y2;boxpoints[ 5] = z2;\
-               boxpoints[ 6] = x3;boxpoints[ 7] = y3;boxpoints[ 8] = z3;\
-               boxpoints[ 9] = x4;boxpoints[10] = y4;boxpoints[11] = z4;\
-               R_Clip_AddPolygon (boxpoints, 4, sizeof(float[3]), false, callback, nativedata, nativedata2, plane);\
-       }\
-}
-
-tinyplane_t clipboxplane[6] =
-{
-       {{-1,  0,  0}, 0},
-       {{ 1,  0,  0}, 0},
-       {{ 0, -1,  0}, 0},
-       {{ 0,  1,  0}, 0},
-       {{ 0,  0, -1}, 0},
-       {{ 0,  0,  1}, 0},
-};
-
-void R_Clip_AddBox(float *a, float *b, void (*callback)(void *nativedata, void *nativedata2), void *nativedata, void *nativedata2)
-{
-       if (r_origin[0] >= (a[0] - 5.0f) && r_origin[0] < (b[0] + 5.0f)
-        && r_origin[1] >= (a[1] - 5.0f) && r_origin[1] < (b[1] + 5.0f)
-        && r_origin[2] >= (a[2] - 5.0f) && r_origin[2] < (b[2] + 5.0f))
-       {
-               callback(nativedata, nativedata2);
-               return;
-       }
-
-       if (R_CullBox(a, b))
-               return;
-
-       R_Clip_MinsBoxPolygon
-       (
-               0, a[0],
-               a[0], a[1], a[2],
-               a[0], b[1], a[2],
-               a[0], b[1], b[2],
-               a[0], a[1], b[2],
-               callback, nativedata, nativedata2, &clipboxplane[0]
-       );
-       R_Clip_MaxsBoxPolygon
-       (
-               0, b[0],
-               b[0], b[1], a[2],
-               b[0], a[1], a[2],
-               b[0], a[1], b[2],
-               b[0], b[1], b[2],
-               callback, nativedata, nativedata2, &clipboxplane[1]
-       );
-       R_Clip_MinsBoxPolygon
-       (
-               1, a[1],
-               b[0], a[1], a[2],
-               a[0], a[1], a[2],
-               a[0], a[1], b[2],
-               b[0], a[1], b[2],
-               callback, nativedata, nativedata2, &clipboxplane[2]
-       );
-       R_Clip_MaxsBoxPolygon
-       (
-               1, b[1],
-               a[0], b[1], a[2],
-               b[0], b[1], a[2],
-               b[0], b[1], b[2],
-               a[0], b[1], b[2],
-               callback, nativedata, nativedata2, &clipboxplane[3]
-       );
-       R_Clip_MinsBoxPolygon
-       (
-               2, a[2],
-               a[0], a[1], a[2],
-               b[0], a[1], a[2],
-               b[0], b[1], a[2],
-               a[0], b[1], a[2],
-               callback, nativedata, nativedata2, &clipboxplane[4]
-       );
-       R_Clip_MaxsBoxPolygon
-       (
-               2, b[2],
-               b[0], a[1], b[2],
-               a[0], a[1], b[2],
-               a[0], b[1], b[2],
-               b[0], b[1], b[2],
-               callback, nativedata, nativedata2, &clipboxplane[5]
-       );
-}
-
diff --git a/r_clip.h b/r_clip.h
deleted file mode 100644 (file)
index d945703..0000000
--- a/r_clip.h
+++ /dev/null
@@ -1,18 +0,0 @@
-
-#ifndef R_CLIP_H
-#define R_CLIP_H
-
-void R_Clip_StartFrame(void);
-void R_Clip_EndFrame(void);
-// This takes a polygon in the form of vec_t triplets, at a caller specified
-// stride (structure size), it can be solid (obscures other geometry) or not,
-// a callback and two parameters must be provided (will be called if it is
-// determined visible), and a plane can be provided (this also indicates that
-// the surface is not a backface, so if a plane is provided, the caller must
-// check that it is not a backface, it is not likely to be fatal if the caller
-// does not, but it is inadvisable)
-void R_Clip_AddPolygon (vec_t *points, int numverts, int stride, int solid, void (*callback)(void *nativedata, void *nativedata2), void *nativedata, void *nativedata2, tinyplane_t *polyplane);
-void R_Clip_AddBox(float *mins, float *maxs, void (*callback)(void *nativedata, void *nativedata2), void *nativedata, void *nativedata2);
-
-#endif
-
index 37d870c..f7e8a8e 100644 (file)
@@ -3,61 +3,7 @@
 
 #define LERPSPRITES
 
-#ifdef LERPSPRITES
-void R_ClipSpriteImage (vec3_t origin, vec3_t left, vec3_t up)
-{
-       int i;
-       mspriteframe_t *frame;
-       vec3_t points[4];
-       float fleft, fright, fdown, fup;
-       frame = currentrenderentity->model->sprdata_frames + currentrenderentity->frameblend[0].frame;
-       fleft  = frame->left;
-       fdown  = frame->down;
-       fright = frame->right;
-       fup    = frame->up;
-       for (i = 1;i < 4 && currentrenderentity->frameblend[i].lerp;i++)
-       {
-               frame = currentrenderentity->model->sprdata_frames + currentrenderentity->frameblend[i].frame;
-               fleft  = min(fleft , frame->left );
-               fdown  = min(fdown , frame->down );
-               fright = max(fright, frame->right);
-               fup    = max(fup   , frame->up   );
-       }
-       // FIXME: reverse these in loader to save time
-       fleft = -fleft;
-       fright = -fright;
-       points[0][0] = origin[0] + fdown * up[0] + fleft  * left[0];points[0][1] = origin[1] + fdown * up[1] + fleft  * left[1];points[0][2] = origin[2] + fdown * up[2] + fleft  * left[2];
-       points[1][0] = origin[0] + fup   * up[0] + fleft  * left[0];points[1][1] = origin[1] + fup   * up[1] + fleft  * left[1];points[1][2] = origin[2] + fup   * up[2] + fleft  * left[2];
-       points[2][0] = origin[0] + fup   * up[0] + fright * left[0];points[2][1] = origin[1] + fup   * up[1] + fright * left[1];points[2][2] = origin[2] + fup   * up[2] + fright * left[2];
-       points[3][0] = origin[0] + fdown * up[0] + fright * left[0];points[3][1] = origin[1] + fdown * up[1] + fright * left[1];points[3][2] = origin[2] + fdown * up[2] + fright * left[2];
-       R_Clip_AddPolygon(&points[0][0], 4, sizeof(float[3]), false, R_Entity_Callback, currentrenderentity, NULL, NULL);
-}
-#else
-void R_ClipSpriteImage (vec3_t origin, vec3_t left, vec3_t up)
-{
-       int i;
-       mspriteframe_t *frame;
-       vec3_t points[4];
-       float fleft, fright, fdown, fup;
-       frame = NULL;
-       for (i = 0;i < 4 && currentrenderentity->frameblend[i].lerp;i++)
-               frame = currentrenderentity->model->sprdata_frames + currentrenderentity->frameblend[i].frame;
-       fleft  = frame->left;
-       fdown  = frame->down;
-       fright = frame->right;
-       fup    = frame->up;
-       // FIXME: reverse these in loader to save time
-       fleft = -fleft;
-       fright = -fright;
-       points[0][0] = origin[0] + fdown * up[0] + fleft  * left[0];points[0][1] = origin[1] + fdown * up[1] + fleft  * left[1];points[0][2] = origin[2] + fdown * up[2] + fleft  * left[2];
-       points[1][0] = origin[0] + fup   * up[0] + fleft  * left[0];points[1][1] = origin[1] + fup   * up[1] + fleft  * left[1];points[1][2] = origin[2] + fup   * up[2] + fleft  * left[2];
-       points[2][0] = origin[0] + fup   * up[0] + fright * left[0];points[2][1] = origin[1] + fup   * up[1] + fright * left[1];points[2][2] = origin[2] + fup   * up[2] + fright * left[2];
-       points[3][0] = origin[0] + fdown * up[0] + fright * left[0];points[3][1] = origin[1] + fdown * up[1] + fright * left[1];points[3][2] = origin[2] + fdown * up[2] + fright * left[2];
-       R_Clip_AddPolygon(&points[0][0], 4, sizeof(float[3]), false, R_Entity_Callback, currentrenderentity, NULL, NULL);
-}
-#endif
-
-int R_SpriteSetup (int type, float org[3], float left[3], float up[3])
+static int R_SpriteSetup (int type, float org[3], float left[3], float up[3])
 {
        float matrix1[3][3], matrix2[3][3], matrix3[3][3];
 
@@ -132,23 +78,9 @@ int R_SpriteSetup (int type, float org[3], float left[3], float up[3])
        return false;
 }
 
-void R_ClipSprite (void)
-{
-       vec3_t org, left, up;
-
-       if (currentrenderentity->frameblend[0].frame < 0)
-               return;
-
-       if (R_SpriteSetup(currentrenderentity->model->sprnum_type, org, left, up))
-               return;
-
-       // LordHavoc: interpolated sprite rendering
-       R_ClipSpriteImage(org, left, up);
-}
-
-int spritepolyindex[6] = {0, 1, 2, 0, 2, 3};
+static int spritepolyindex[6] = {0, 1, 2, 0, 2, 3};
 
-void GL_DrawSpriteImage (int fog, mspriteframe_t *frame, int texture, vec3_t origin, vec3_t up, vec3_t left, float red, float green, float blue, float alpha)
+static void GL_DrawSpriteImage (int fog, mspriteframe_t *frame, int texture, vec3_t origin, vec3_t up, vec3_t left, float red, float green, float blue, float alpha)
 {
        rmeshinfo_t m;
        float v[4][4], st[4][2];
index a98e07d..a1f175a 100644 (file)
--- a/render.h
+++ b/render.h
@@ -114,8 +114,6 @@ void R_DrawPortals(void);
 void R_DrawParticles(void);
 void R_DrawExplosions(void);
 
-#include "r_clip.h"
-
 // LordHavoc: vertex transform
 #include "transform.h"
 
@@ -145,11 +143,7 @@ void R_DrawBrushModelNormal (void);
 void R_DrawAliasModel (void);
 void R_DrawSpriteModel (void);
 
-void R_ClipSprite (void);
-void R_Entity_Callback(void *data, void *junk);
-
 extern cvar_t r_render;
-extern cvar_t r_ser;
 #include "image.h"
 
 extern cvar_t r_multitexture;