removed decals
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 3 Feb 2002 11:34:53 +0000 (11:34 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 3 Feb 2002 11:34:53 +0000 (11:34 +0000)
fixed viewmodel disappearing with masked sky (skybox or skyquality 2)
removed flare particle from rockets (might add it back later)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1485 d7cf8633-e32d-0410-b094-e92efae38249

cl_decals.c [deleted file]
cl_main.c
cl_particles.c
client.h
gl_rmain.c
gl_rsurf.c
makefile
r_decals.c [deleted file]
r_particles.c
render.h

diff --git a/cl_decals.c b/cl_decals.c
deleted file mode 100644 (file)
index 54f53a9..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
-#include "quakedef.h"
-
-#define MAX_DECALS 2048
-
-typedef struct decal_s
-{
-       entity_render_t *ent;
-       int tex;
-       model_t *model;
-       int surface;
-       float scale;
-       vec3_t org;
-       vec3_t dir;
-       float color[4];
-}
-decal_t;
-
-static decal_t *cl_decals;
-static int cl_currentdecal; // wraps around in decal array, replacing old ones when a new one is needed
-
-static renderdecal_t *cl_renderdecals;
-
-static mempool_t *cl_decal_mempool;
-
-void CL_Decals_Clear(void)
-{
-       memset(cl_decals, 0, MAX_DECALS * sizeof(decal_t));
-       cl_currentdecal = 0;
-}
-
-void CL_Decals_Init(void)
-{
-       cl_decal_mempool = Mem_AllocPool("CL_Decals");
-       cl_decals = (decal_t *) Mem_Alloc(cl_decal_mempool, MAX_DECALS * sizeof(decal_t));
-       memset(cl_decals, 0, MAX_DECALS * sizeof(decal_t));
-       cl_currentdecal = 0;
-
-       // FIXME: r_refdef stuff should be allocated somewhere else?
-       r_refdef.decals = cl_renderdecals = Mem_Alloc(cl_refdef_mempool, MAX_DECALS * sizeof(renderdecal_t));
-}
-
-
-// these are static globals only to avoid putting unnecessary things on the stack
-static vec3_t decalorg, decalbestorg;
-static float decalbestdist;
-static msurface_t *decalbestsurf;
-static entity_render_t *decalbestent, *decalent;
-static model_t *decalmodel;
-void CL_RecursiveDecalSurface (mnode_t *node)
-{
-       // these are static because only one occurance of them need exist at once, so avoid putting them on the stack
-       static float ndist, dist;
-       static msurface_t *surf, *endsurf;
-       static vec3_t impact;
-       static int ds, dt;
-
-loc0:
-       if (node->contents < 0)
-               return;
-
-       ndist = PlaneDiff(decalorg, node->plane);
-
-       if (ndist > 16)
-       {
-               node = node->children[0];
-               goto loc0;
-       }
-       if (ndist < -16)
-       {
-               node = node->children[1];
-               goto loc0;
-       }
-
-// mark the polygons
-       surf = decalmodel->surfaces + node->firstsurface;
-       endsurf = surf + node->numsurfaces;
-       for (;surf < endsurf;surf++)
-       {
-               if (!(surf->flags & SURF_LIGHTMAP))
-                       continue;
-
-               dist = PlaneDiff(decalorg, surf->plane);
-               if (surf->flags & SURF_PLANEBACK)
-                       dist = -dist;
-               if (dist < -1)
-                       continue;
-               if (dist >= decalbestdist)
-                       continue;
-
-               impact[0] = decalorg[0] - surf->plane->normal[0] * dist;
-               impact[1] = decalorg[1] - surf->plane->normal[1] * dist;
-               impact[2] = decalorg[2] - surf->plane->normal[2] * dist;
-
-               ds = (int) (DotProduct(impact, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]) - surf->texturemins[0];
-               dt = (int) (DotProduct(impact, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]) - surf->texturemins[1];
-
-               if (ds < 0 || dt < 0 || ds > surf->extents[0] || dt > surf->extents[1])
-                       continue;
-
-               VectorCopy(decalorg, decalbestorg);
-               decalbestent = decalent;
-               decalbestsurf = surf;
-               decalbestdist = dist;
-       }
-
-       if (node->children[0]->contents >= 0)
-       {
-               if (node->children[1]->contents >= 0)
-               {
-                       CL_RecursiveDecalSurface (node->children[0]);
-                       node = node->children[1];
-                       goto loc0;
-               }
-               else
-               {
-                       node = node->children[0];
-                       goto loc0;
-               }
-       }
-       else if (node->children[1]->contents >= 0)
-       {
-               node = node->children[1];
-               goto loc0;
-       }
-}
-
-void CL_Decal(vec3_t origin, int tex, float scale, float red, float green, float blue, float alpha)
-{
-       int i;
-       decal_t *decal;
-
-       if (alpha < (1.0f / 255.0f))
-               return;
-
-       // find the best surface to place the decal on
-       decalbestent = NULL;
-       decalbestsurf = NULL;
-       decalbestdist = 16;
-
-       decalent = NULL;
-       decalmodel = cl.worldmodel;
-       Mod_CheckLoaded(decalmodel);
-       VectorCopy(origin, decalorg);
-       CL_RecursiveDecalSurface (decalmodel->nodes);
-
-       for (i = 1;i < MAX_EDICTS;i++)
-       {
-               decalent = &cl_entities[i].render;
-               decalmodel = decalent->model;
-               if (decalmodel && decalmodel->name[0])
-               {
-                       Mod_CheckLoaded(decalmodel);
-                       if (decalmodel->type == mod_brush)
-                       {
-                               softwaretransformforentity(decalent);
-                               softwareuntransform(origin, decalorg);
-                               CL_RecursiveDecalSurface (decalmodel->nodes + decalmodel->hulls[0].firstclipnode);
-                       }
-               }
-       }
-
-       // abort if no suitable surface was found
-       if (decalbestsurf == NULL)
-               return;
-
-       // grab a decal from the array and advance to the next decal to replace, wrapping to replace an old decal if necessary
-       decal = &cl_decals[cl_currentdecal++];
-       if (cl_currentdecal >= MAX_DECALS)
-               cl_currentdecal = 0;
-       memset(decal, 0, sizeof(*decal));
-
-       decal->ent = decalbestent;
-       if (decal->ent)
-               decal->model = decal->ent->model;
-       else
-               decal->model = cl.worldmodel;
-
-       decal->tex = tex + 1; // our texture numbers are +1 to make 0 mean invisible
-       VectorNegate(decalbestsurf->plane->normal, decal->dir);
-       if (decalbestsurf->flags & SURF_PLANEBACK)
-               VectorNegate(decal->dir, decal->dir);
-       // 0.25 to push it off the surface a bit
-       decalbestdist -= 0.25f;
-       decal->org[0] = decalbestorg[0] + decal->dir[0] * decalbestdist;
-       decal->org[1] = decalbestorg[1] + decal->dir[1] * decalbestdist;
-       decal->org[2] = decalbestorg[2] + decal->dir[2] * decalbestdist;
-       decal->scale = scale * 0.5f;
-       // store the color
-       decal->color[0] = red;
-       decal->color[1] = green;
-       decal->color[2] = blue;
-       decal->color[3] = alpha;
-       // store the surface information
-       decal->surface = decalbestsurf - decal->model->surfaces;
-}
-
-void CL_UpdateDecals (void)
-{
-       int i;
-       decal_t *p;
-       renderdecal_t *r;
-
-       for (i = 0, p = cl_decals, r = r_refdef.decals;i < MAX_DECALS;i++, p++)
-       {
-               if (p->tex == 0)
-                       continue;
-
-               if (p->ent && p->ent->visframe == r_framecount && (p->ent->model != p->model || p->ent->model->type != mod_brush))
-               {
-                       p->tex = 0;
-                       continue;
-               }
-
-               r->ent = p->ent;
-               r->tex = p->tex - 1; // our texture numbers are +1 to make 0 mean invisible
-               r->surface = p->surface;
-               r->scale = p->scale;
-               VectorCopy(p->org, r->org);
-               VectorCopy(p->dir, r->dir);
-               VectorCopy4(p->color, r->color);
-               r++;
-       }
-       r_refdef.numdecals = r - r_refdef.decals;
-}
-
index 8c8868d..c2f433c 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -108,7 +108,6 @@ void CL_ClearState (void)
        memset(cl_effect, 0, sizeof(cl_effect));
        CL_Screen_NewMap();
        CL_Particles_Clear();
-       CL_Decals_Clear();
        // LordHavoc: have to set up the baseline info for alpha and other stuff
        for (i = 0;i < MAX_EDICTS;i++)
        {
@@ -758,7 +757,6 @@ void CL_RelinkEntities (void)
        TraceLine_ScanForBModels();
        CL_RelinkEffects();
        CL_MoveParticles();
-       CL_UpdateDecals();
        CL_UpdateTEnts();
 }
 
@@ -987,7 +985,6 @@ void CL_Init (void)
 
        CL_Parse_Init();
        CL_Particles_Init();
-       CL_Decals_Init();
        CL_Screen_Init();
        CL_CGVM_Init();
 }
index 61a66e1..a755aab 100644 (file)
@@ -93,12 +93,11 @@ static int explosparkramp[8] = {0x4b0700, 0x6f0f00, 0x931f07, 0xb7330f, 0xcf632b
 
 // these must match r_part.c's textures
 static const int tex_smoke[8] = {0, 1, 2, 3, 4, 5, 6, 7};
-static const int tex_bullethole[8] = {8, 9, 10, 11, 12, 13, 14, 15};
-static const int tex_rainsplash[16] = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
-static const int tex_particle = 32;
-static const int tex_rain = 33;
-static const int tex_bubble = 34;
-static const int tex_rocketglow = 35;
+static const int tex_rainsplash[16] = {8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23};
+static const int tex_particle = 24;
+static const int tex_rain = 25;
+static const int tex_bubble = 26;
+static const int tex_rocketglow = 27;
 
 static int                     cl_maxparticles;
 static int                     cl_numparticles;
@@ -451,7 +450,6 @@ void CL_SparkShower (vec3_t org, vec3_t dir, int count)
        if (!cl_particles.integer) return;
 
        R_Stain(org, 32, 96, 96, 96, 32, 128, 128, 128, 32);
-       CL_Decal(org, tex_bullethole[rand()&7], 16 * cl_particles_size.value, 0, 0, 0, 1);
 
        // smoke puff
        if (cl_particles_smoke.integer)
@@ -657,8 +655,8 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
        VectorSubtract(end, start, dir);
        VectorNormalize(dir);
 
-       if (type == 0 && host_frametime != 0) // rocket glow
-               particle(pt_oneframe, PARTICLE_BILLBOARD, 0xFFFFFF, tex_rocketglow, false, true, 24, 24, 255, 9999, 0, end[0] - 12 * dir[0], end[1] - 12 * dir[1], end[2] - 12 * dir[2], 0, 0, 0, 0, 0, 0, 0, 0, 0);
+       //if (type == 0 && host_frametime != 0) // rocket glow
+       //      particle(pt_oneframe, PARTICLE_BILLBOARD, 0xFFFFFF, tex_rocketglow, false, true, 24, 24, 255, 9999, 0, end[0] - 12 * dir[0], end[1] - 12 * dir[1], end[2] - 12 * dir[2], 0, 0, 0, 0, 0, 0, 0, 0, 0);
 
        t = ent->persistent.trail_time;
        if (t >= cl.time)
@@ -863,7 +861,6 @@ void CL_MoveParticles (void)
                                {
                                        // assume it's blood (lame, but...)
                                        R_Stain(v, 48, 64, 24, 24, 48, 192, 48, 48, 48);
-                                       CL_Decal(v, p->tex, p->scalex * cl_particles_size.value, p->color[0] * (1.0f / 255.0f), p->color[1] * (1.0f / 255.0f), p->color[2] * (1.0f / 255.0f), p->alpha * (1.0f / 255.0f));
                                        p->die = -1;
                                        freeparticles[j++] = p;
                                        continue;
index e7ce7b1..5e2831d 100644 (file)
--- a/client.h
+++ b/client.h
@@ -462,30 +462,9 @@ void CL_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);
 void CL_LavaSplash (vec3_t org);
 void CL_TeleportSplash (vec3_t org);
 void CL_MoveParticles(void);
-void CL_UpdateDecals(void);
 void R_MoveExplosions(void);
 void R_NewExplosion(vec3_t org);
 
-//
-// cl_decal
-//
-
-typedef struct renderdecal_s
-{
-       entity_render_t *ent;
-       int tex;
-       int surface;
-       float scale;
-       vec3_t org;
-       vec3_t dir;
-       float color[4];
-}
-renderdecal_t;
-
-void CL_Decals_Clear(void);
-void CL_Decals_Init(void);
-void CL_Decal(vec3_t origin, int tex, float scale, float red, float green, float blue, float alpha);
-
 // if contents is not zero, it will impact on content changes
 // (leafs matching contents are considered empty, others are solid)
 extern int traceline_endcontents; // set by TraceLine
@@ -513,9 +492,6 @@ typedef struct
        // weapon model
        entity_render_t viewent;
 
-       int numdecals;
-       renderdecal_t *decals;
-
        int numentities;
        entity_render_t **entities;
 
index 210d1d7..6deea8e 100644 (file)
@@ -323,7 +323,6 @@ void Render_Init(void)
        R_Light_Init();
        R_Particles_Init();
        R_Explosion_Init();
-       R_Decals_Init();
        ui_init();
        R_Modules_Start();
 }
@@ -695,19 +694,24 @@ void R_RenderView (void)
        R_MarkWorldLights();
        R_TimeReport("marklights");
 
-       if (skyrendermasked && R_DrawBModelSky())
+       if (skyrendermasked)
        {
-               R_TimeReport("bmodelsky");
+               if (R_DrawBModelSky())
+                       R_TimeReport("bmodelsky");
+       }
+       else
+       {
+               R_DrawViewModel();
+               R_TimeReport("viewmodel");
        }
-
-       R_DrawViewModel();
-       R_TimeReport("viewmodel");
 
        R_SetupForWorldRendering();
        R_PrepareSurfaces();
        R_TimeReport("surfprep");
 
-       R_DrawSurfacesAll();
+       R_DrawSurfaces(SHADERSTAGE_SKY);
+       R_DrawSurfaces(SHADERSTAGE_NORMAL);
+       R_DrawSurfaces(SHADERSTAGE_FOG);
        R_TimeReport("surfdraw");
 
        if (r_drawportals.integer)
@@ -720,12 +724,15 @@ void R_RenderView (void)
        if (!intimerefresh && !r_speeds.integer)
                S_ExtraUpdate ();
 
+       if (skyrendermasked)
+       {
+               R_DrawViewModel();
+               R_TimeReport("viewmodel");
+       }
+
        R_DrawModels();
        R_TimeReport("models");
 
-       R_DrawDecals();
-       R_TimeReport("decals");
-
        R_DrawParticles();
        R_TimeReport("particles");
 
index 4dfd196..6b1df59 100644 (file)
@@ -2000,13 +2000,6 @@ done:;
        }
 }
 
-void R_DrawSurfacesAll (void)
-{
-       R_DrawSurfaces(SHADERSTAGE_SKY);
-       R_DrawSurfaces(SHADERSTAGE_NORMAL);
-       R_DrawSurfaces(SHADERSTAGE_FOG);
-}
-
 static float portalpointbuffer[256][3];
 
 void R_DrawPortals(void)
index 48743bc..07e0eaa 100644 (file)
--- a/makefile
+++ b/makefile
@@ -9,7 +9,7 @@ SOUNDLIB=-lasound
 #SND=snd_oss.o
 #SOUNDLIB=
 
-OBJECTS= builddate.o cd_linux.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 gl_screen.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_particles.o r_explosion.o sbar.o snd_dma.o snd_mem.o snd_mix.o $(SND) 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 r_decals.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_decals.o cl_screen.o cgamevm.o cgame.o
+OBJECTS= builddate.o cd_linux.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 gl_screen.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_particles.o r_explosion.o sbar.o snd_dma.o snd_mem.o snd_mix.o $(SND) 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
 
 #K6/athlon optimizations
 CPUOPTIMIZATIONS=-march=k6
diff --git a/r_decals.c b/r_decals.c
deleted file mode 100644 (file)
index 74a9b35..0000000
+++ /dev/null
@@ -1,598 +0,0 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
-#include "quakedef.h"
-
-cvar_t r_drawdecals = {0, "r_drawdecals", "1"};
-
-static void r_decals_start(void)
-{
-}
-
-static void r_decals_shutdown(void)
-{
-}
-
-static void r_decals_newmap(void)
-{
-}
-
-void R_Decals_Init(void)
-{
-       Cvar_RegisterVariable (&r_drawdecals);
-
-       R_RegisterModule("R_Decals", r_decals_start, r_decals_shutdown, r_decals_newmap);
-}
-
-/*
-static int decalindexarray[2*3] =
-{
-       0, 1, 2,
-       0, 2, 3,
-};
-*/
-
-void R_DrawDecals (void)
-{
-       renderdecal_t *r;
-       int i, j, lightmapstep, ds, dt;
-       float fscale, fr, fg, fb, dist, f, fog, ifog, fogvec[3], impact[3], v[3], org[3], dir[3], right[3], up[3], tvxyz[4][4], tvst[4][2];
-       particletexture_t *tex, *texfog;
-       byte *lightmap;
-       msurface_t *surf;
-       rdlight_t *rd;
-       rmeshinfo_t m;
-
-       if (!r_drawdecals.integer)
-               return;
-
-       fog = 0;
-       ifog = 1;
-
-       Mod_CheckLoaded(cl.worldmodel);
-
-       // LordHavoc: this meshinfo must match up with R_Mesh_DrawDecal
-       // LordHavoc: the commented out lines are hardwired behavior in R_Mesh_DrawDecal
-       memset(&m, 0, sizeof(m));
-       m.blendfunc1 = GL_SRC_ALPHA;
-       m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
-       //m.numtriangles = 2;
-       //m.numverts = 4;
-       //m.index = decalindexarray;
-       m.vertex = &tvxyz[0][0];
-       //m.vertexstep = sizeof(float[4]);
-       m.tex[0] = R_GetTexture(particlefonttexture);
-       m.texcoords[0] = &tvst[0][0];
-       //m.texcoordstep[0] = sizeof(float[2]);
-
-       for (i = 0, r = r_refdef.decals;i < r_refdef.numdecals;i++, r++)
-       {
-               if (r->ent)
-               {
-                       if (r->ent->visframe != r_framecount)
-                               continue;
-
-                       Mod_CheckLoaded(r->ent->model);
-                       if (r->ent->model->type != mod_brush)
-                               continue;
-
-                       surf = r->ent->model->surfaces + r->surface;
-
-                       // skip decals on surfaces that aren't visible in this frame
-                       if (surf->visframe != r_framecount)
-                               continue;
-
-                       softwaretransformforentity(r->ent);
-                       softwaretransform(r->org, org);
-                       softwaretransformdirection(r->dir, dir);
-
-                       // do not render if the view origin is behind the decal
-                       VectorSubtract(org, r_origin, fogvec);
-                       if (DotProduct(dir, fogvec) < 0)
-                               continue;
-               }
-               else
-               {
-                       surf = cl.worldmodel->surfaces + r->surface;
-
-                       // skip decals on surfaces that aren't visible in this frame
-                       if (surf->visframe != r_framecount)
-                               continue;
-
-                       // do not render if the view origin is behind the decal
-                       VectorSubtract(r->org, r_origin, fogvec);
-                       if (DotProduct(r->dir, fogvec) < 0)
-                               continue;
-
-                       VectorCopy(r->org, org);
-                       VectorCopy(r->dir, dir);
-               }
-
-               dist = -PlaneDiff(r->org, surf->plane);
-               VectorMA(r->org, dist, surf->plane->normal, impact);
-
-               ds = (int) (DotProduct(impact, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]) - surf->texturemins[0];
-               dt = (int) (DotProduct(impact, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]) - surf->texturemins[1];
-
-               if (ds < 0 || dt < 0 || ds > surf->extents[0] || dt > surf->extents[1])
-               {
-                       // this should never happen
-                       continue;
-               }
-
-               tex = &particletexture[r->tex][0];
-               VectorVectors(dir, right, up);
-               VectorScale(right, r->scale, right);
-               VectorScale(up, r->scale, up);
-               tvxyz[0][0] = org[0] - right[0] - up[0];
-               tvxyz[0][1] = org[1] - right[1] - up[1];
-               tvxyz[0][2] = org[2] - right[2] - up[2];
-               tvxyz[1][0] = org[0] - right[0] + up[0];
-               tvxyz[1][1] = org[1] - right[1] + up[1];
-               tvxyz[1][2] = org[2] - right[2] + up[2];
-               tvxyz[2][0] = org[0] + right[0] + up[0];
-               tvxyz[2][1] = org[1] + right[1] + up[1];
-               tvxyz[2][2] = org[2] + right[2] + up[2];
-               tvxyz[3][0] = org[0] + right[0] - up[0];
-               tvxyz[3][1] = org[1] + right[1] - up[1];
-               tvxyz[3][2] = org[2] + right[2] - up[2];
-               tvst[0][0] = tex->s1;
-               tvst[0][1] = tex->t1;
-               tvst[1][0] = tex->s1;
-               tvst[1][1] = tex->t2;
-               tvst[2][0] = tex->s2;
-               tvst[2][1] = tex->t2;
-               tvst[3][0] = tex->s2;
-               tvst[3][1] = tex->t1;
-
-               // lighting
-               fr = fg = fb = 0.0f;
-
-               if ((lightmap = surf->samples))
-               {
-                       if (surf->styles[0] != 255)
-                       {
-                               lightmap += ((dt >> 4) * ((surf->extents[0] >> 4) + 1) + (ds >> 4)) * 3;
-                               fscale = d_lightstylevalue[surf->styles[0]] * (1.0f / 32768.0f);
-                               fr += lightmap[0] * fscale;
-                               fg += lightmap[1] * fscale;
-                               fb += lightmap[2] * fscale;
-                               if (surf->styles[1] != 255)
-                               {
-                                       lightmapstep = (((surf->extents[0] >> 4) + 1) * ((surf->extents[1] >> 4) + 1)) * 3;
-                                       lightmap += lightmapstep;
-                                       fscale = d_lightstylevalue[surf->styles[1]] * (1.0f / 32768.0f);
-                                       fr += lightmap[0] * fscale;
-                                       fg += lightmap[1] * fscale;
-                                       fb += lightmap[2] * fscale;
-                                       if (surf->styles[2] != 255)
-                                       {
-                                               lightmap += lightmapstep;
-                                               fscale = d_lightstylevalue[surf->styles[2]] * (1.0f / 32768.0f);
-                                               fr += lightmap[0] * fscale;
-                                               fg += lightmap[1] * fscale;
-                                               fb += lightmap[2] * fscale;
-                                               if (surf->styles[3] != 255)
-                                               {
-                                                       lightmap += lightmapstep;
-                                                       fscale = d_lightstylevalue[surf->styles[3]] * (1.0f / 32768.0f);
-                                                       fr += lightmap[0] * fscale;
-                                                       fg += lightmap[1] * fscale;
-                                                       fb += lightmap[2] * fscale;
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               if (surf->dlightframe == r_framecount)
-               {
-                       for (j = 0;j < r_numdlights;j++)
-                       {
-                               if (surf->dlightbits[j >> 5] & (1 << (j & 31)))
-                               {
-                                       rd = &r_dlight[j];
-                                       VectorSubtract(r->org, rd->origin, v);
-                                       dist = DotProduct(v, v) + LIGHTOFFSET;
-                                       if (dist < rd->cullradius2)
-                                       {
-                                               f = (1.0f / dist) - rd->lightsubtract;
-                                               if (f > 0)
-                                               {
-                                                       fr += f * rd->light[0];
-                                                       fg += f * rd->light[1];
-                                                       fb += f * rd->light[2];
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               // if the surface is transparent, render as transparent
-               m.transparent = !(surf->flags & SURF_CLIPSOLID);
-               m.cr = r->color[0] * fr;
-               m.cg = r->color[1] * fg;
-               m.cb = r->color[2] * fb;
-               m.ca = r->color[3];
-
-               if (fogenabled)
-               {
-                       fog = exp(fogdensity/DotProduct(fogvec,fogvec));
-                       texfog = &particletexture[r->tex][1];
-                       if (fog >= (1.0f / 64.0f))
-                       {
-                               if (fog >= (1.0f - (1.0f / 64.0f)))
-                               {
-                                       // fully fogged, just use the fog texture and render as alpha
-                                       m.cr = fogcolor[0];
-                                       m.cg = fogcolor[1];
-                                       m.cb = fogcolor[2];
-                                       m.ca = r->color[3];
-                                       tvst[0][0] = texfog->s1;
-                                       tvst[0][1] = texfog->t1;
-                                       tvst[1][0] = texfog->s1;
-                                       tvst[1][1] = texfog->t2;
-                                       tvst[2][0] = texfog->s2;
-                                       tvst[2][1] = texfog->t2;
-                                       tvst[3][0] = texfog->s2;
-                                       tvst[3][1] = texfog->t1;
-                                       R_Mesh_DrawDecal(&m);
-                               }
-                               else
-                               {
-                                       // partially fogged, darken the first pass
-                                       ifog = 1 - fog;
-                                       m.cr *= ifog;
-                                       m.cg *= ifog;
-                                       m.cb *= ifog;
-                                       if (tex->s1 == texfog->s1 && tex->t1 == texfog->t1)
-                                       {
-                                               // fog texture is the same as the base, just change the color
-                                               m.cr += fogcolor[0] * fog;
-                                               m.cg += fogcolor[1] * fog;
-                                               m.cb += fogcolor[2] * fog;
-                                               R_Mesh_DrawDecal(&m);
-                                       }
-                                       else
-                                       {
-                                               // render the first pass (alpha), then do additive fog
-                                               R_Mesh_DrawDecal(&m);
-                                               m.blendfunc2 = GL_ONE;
-                                               m.cr = fogcolor[0];
-                                               m.cg = fogcolor[1];
-                                               m.cb = fogcolor[2];
-                                               m.ca = r->color[3] * fog;
-                                               tvst[0][0] = texfog->s1;
-                                               tvst[0][1] = texfog->t1;
-                                               tvst[1][0] = texfog->s1;
-                                               tvst[1][1] = texfog->t2;
-                                               tvst[2][0] = texfog->s2;
-                                               tvst[2][1] = texfog->t2;
-                                               tvst[3][0] = texfog->s2;
-                                               tvst[3][1] = texfog->t1;
-                                               R_Mesh_DrawDecal(&m);
-                                               m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
-                                       }
-                               }
-                       }
-                       else
-                               R_Mesh_DrawDecal(&m);
-               }
-               else
-                       R_Mesh_DrawDecal(&m);
-       }
-}
-
-/*
-void R_DrawDecals (void)
-{
-       renderdecal_t *r;
-       int i, j, lightmapstep, ds, dt;
-       float fscale, fr, fg, fb, dist, f, fog, ifog, impact[3], v[3], org[3], dir[3], right[3], up[3], tv[4][5];
-       particletexture_t *tex;
-       byte *lightmap;
-       msurface_t *surf;
-       rdlight_t *rd;
-       rmeshinfo_t m;
-
-       if (!r_drawdecals.integer)
-               return;
-
-       ifog = 1;
-
-       Mod_CheckLoaded(cl.worldmodel);
-
-       memset(&m, 0, sizeof(m));
-       m.blendfunc1 = GL_SRC_ALPHA;
-       m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
-       m.numtriangles = 2;
-       m.numverts = 4;
-       m.index = decalindexarray;
-       m.vertex = &tv[0][0];
-       m.vertexstep = sizeof(float[5]);
-       m.tex[0] = R_GetTexture(particlefonttexture);
-       m.texcoords[0] = &tv[0][3];
-       m.texcoordstep[0] = sizeof(float[5]);
-
-       for (i = 0, r = r_refdef.decals;i < r_refdef.numdecals;i++, r++)
-       {
-               if (r->ent)
-               {
-                       if (r->ent->visframe != r_framecount)
-                               continue;
-
-                       Mod_CheckLoaded(r->ent->model);
-                       if (r->ent->model->type != mod_brush)
-                               continue;
-
-                       surf = r->ent->model->surfaces + r->surface;
-
-                       // skip decals on surfaces that aren't visible in this frame
-                       if (surf->visframe != r_framecount)
-                               continue;
-
-                       softwaretransformforentity(r->ent);
-                       softwaretransform(r->org, org);
-                       softwaretransformdirection(r->dir, dir);
-
-                       // do not render if the view origin is behind the decal
-                       VectorSubtract(org, r_origin, v);
-                       if (DotProduct(dir, v) < 0)
-                               continue;
-               }
-               else
-               {
-                       surf = cl.worldmodel->surfaces + r->surface;
-
-                       // skip decals on surfaces that aren't visible in this frame
-                       if (surf->visframe != r_framecount)
-                               continue;
-
-                       // do not render if the view origin is behind the decal
-                       VectorSubtract(r->org, r_origin, v);
-                       if (DotProduct(r->dir, v) < 0)
-                               continue;
-
-                       VectorCopy(r->org, org);
-                       VectorCopy(r->dir, dir);
-               }
-
-               dist = -PlaneDiff(r->org, surf->plane);
-               VectorMA(r->org, dist, surf->plane->normal, impact);
-
-               ds = (int) (DotProduct(impact, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]) - surf->texturemins[0];
-               dt = (int) (DotProduct(impact, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]) - surf->texturemins[1];
-
-               if (ds < 0 || dt < 0 || ds > surf->extents[0] || dt > surf->extents[1])
-               {
-                       // this should never happen
-                       continue;
-               }
-
-               if (fogenabled)
-               {
-                       ifog = 1 - exp(fogdensity/DotProduct(v,v));
-                       ifog = bound(0, ifog, 1);
-               }
-
-               tex = &particletexture[r->tex][0];
-               VectorVectors(dir, right, up);
-               VectorScale(right, r->scale, right);
-               VectorScale(up, r->scale, up);
-               tv[0][0] = org[0] - right[0] - up[0];
-               tv[0][1] = org[1] - right[1] - up[1];
-               tv[0][2] = org[2] - right[2] - up[2];
-               tv[0][3] = tex->s1;
-               tv[0][4] = tex->t1;
-               tv[1][0] = org[0] - right[0] + up[0];
-               tv[1][1] = org[1] - right[1] + up[1];
-               tv[1][2] = org[2] - right[2] + up[2];
-               tv[1][3] = tex->s1;
-               tv[1][4] = tex->t2;
-               tv[2][0] = org[0] + right[0] + up[0];
-               tv[2][1] = org[1] + right[1] + up[1];
-               tv[2][2] = org[2] + right[2] + up[2];
-               tv[2][3] = tex->s2;
-               tv[2][4] = tex->t2;
-               tv[3][0] = org[0] + right[0] - up[0];
-               tv[3][1] = org[1] + right[1] - up[1];
-               tv[3][2] = org[2] + right[2] - up[2];
-               tv[3][3] = tex->s2;
-               tv[3][4] = tex->t1;
-
-               // lighting
-               fr = fg = fb = 0.0f;
-
-               if ((lightmap = surf->samples))
-               {
-                       if (surf->styles[0] != 255)
-                       {
-                               lightmap += ((dt >> 4) * ((surf->extents[0] >> 4) + 1) + (ds >> 4)) * 3;
-                               fscale = d_lightstylevalue[surf->styles[0]] * (1.0f / 32768.0f);
-                               fr += lightmap[0] * fscale;
-                               fg += lightmap[1] * fscale;
-                               fb += lightmap[2] * fscale;
-                               if (surf->styles[1] != 255)
-                               {
-                                       lightmapstep = (((surf->extents[0] >> 4) + 1) * ((surf->extents[1] >> 4) + 1)) * 3;
-                                       lightmap += lightmapstep;
-                                       fscale = d_lightstylevalue[surf->styles[1]] * (1.0f / 32768.0f);
-                                       fr += lightmap[0] * fscale;
-                                       fg += lightmap[1] * fscale;
-                                       fb += lightmap[2] * fscale;
-                                       if (surf->styles[2] != 255)
-                                       {
-                                               lightmap += lightmapstep;
-                                               fscale = d_lightstylevalue[surf->styles[2]] * (1.0f / 32768.0f);
-                                               fr += lightmap[0] * fscale;
-                                               fg += lightmap[1] * fscale;
-                                               fb += lightmap[2] * fscale;
-                                               if (surf->styles[3] != 255)
-                                               {
-                                                       lightmap += lightmapstep;
-                                                       fscale = d_lightstylevalue[surf->styles[3]] * (1.0f / 32768.0f);
-                                                       fr += lightmap[0] * fscale;
-                                                       fg += lightmap[1] * fscale;
-                                                       fb += lightmap[2] * fscale;
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               if (surf->dlightframe == r_framecount)
-               {
-                       for (j = 0;j < r_numdlights;j++)
-                       {
-                               if (surf->dlightbits[j >> 5] & (1 << (j & 31)))
-                               {
-                                       rd = &r_dlight[j];
-                                       VectorSubtract(r->org, rd->origin, v);
-                                       dist = DotProduct(v, v) + LIGHTOFFSET;
-                                       if (dist < rd->cullradius2)
-                                       {
-                                               f = (1.0f / dist) - rd->lightsubtract;
-                                               if (f > 0)
-                                               {
-                                                       fr += f * rd->light[0];
-                                                       fg += f * rd->light[1];
-                                                       fb += f * rd->light[2];
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               // if the surface is transparent, render as transparent
-               m.transparent = !(surf->flags & SURF_CLIPSOLID);
-               m.cr = r->color[0] * fr;
-               m.cg = r->color[1] * fg;
-               m.cb = r->color[2] * fb;
-               m.ca = r->color[3];
-
-               if (fogenabled)
-               {
-                       m.cr *= ifog;
-                       m.cg *= ifog;
-                       m.cb *= ifog;
-               }
-
-               R_Mesh_DrawDecal(&m);
-       }
-
-       if (!fogenabled)
-               return;
-
-       m.blendfunc2 = GL_ONE;
-       m.cr = fogcolor[0];
-       m.cg = fogcolor[1];
-       m.cb = fogcolor[2];
-
-       for (i = 0, r = r_refdef.decals;i < r_refdef.numdecals;i++, r++)
-       {
-               if (r->ent)
-               {
-                       if (r->ent->visframe != r_framecount)
-                               continue;
-
-                       Mod_CheckLoaded(r->ent->model);
-
-                       surf = r->ent->model->surfaces + r->surface;
-
-                       // skip decals on surfaces that aren't visible in this frame
-                       if (surf->visframe != r_framecount)
-                               continue;
-
-                       softwaretransformforentity(r->ent);
-                       softwaretransform(r->org, org);
-                       softwaretransformdirection(r->dir, dir);
-
-                       // do not render if the view origin is behind the decal
-                       VectorSubtract(org, r_origin, v);
-                       if (DotProduct(dir, v) < 0)
-                               continue;
-               }
-               else
-               {
-                       surf = cl.worldmodel->surfaces + r->surface;
-
-                       // skip decals on surfaces that aren't visible in this frame
-                       if (surf->visframe != r_framecount)
-                               continue;
-
-                       // do not render if the view origin is behind the decal
-                       VectorSubtract(r->org, r_origin, v);
-                       if (DotProduct(r->dir, v) < 0)
-                               continue;
-
-                       VectorCopy(r->org, org);
-                       VectorCopy(r->dir, dir);
-               }
-
-               fog = exp(fogdensity/DotProduct(v,v));
-               fog = bound(0, fog, 1);
-               m.ca = r->color[3] * fog;
-
-               if (m.ca >= 0.01f)
-               {
-                       dist = -PlaneDiff(r->org, surf->plane);
-                       VectorMA(r->org, dist, surf->plane->normal, impact);
-
-                       ds = (int) (DotProduct(impact, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]) - surf->texturemins[0];
-                       dt = (int) (DotProduct(impact, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]) - surf->texturemins[1];
-
-                       if (ds < 0 || dt < 0 || ds > surf->extents[0] || dt > surf->extents[1])
-                       {
-                               // this should never happen
-                               continue;
-                       }
-
-                       tex = &particletexture[r->tex][1];
-                       VectorVectors(dir, right, up);
-                       VectorScale(right, r->scale, right);
-                       VectorScale(up, r->scale, up);
-                       tv[0][0] = org[0] - right[0] - up[0];
-                       tv[0][1] = org[1] - right[1] - up[1];
-                       tv[0][2] = org[2] - right[2] - up[2];
-                       tv[0][3] = tex->s1;
-                       tv[0][4] = tex->t1;
-                       tv[1][0] = org[0] - right[0] + up[0];
-                       tv[1][1] = org[1] - right[1] + up[1];
-                       tv[1][2] = org[2] - right[2] + up[2];
-                       tv[1][3] = tex->s1;
-                       tv[1][4] = tex->t2;
-                       tv[2][0] = org[0] + right[0] + up[0];
-                       tv[2][1] = org[1] + right[1] + up[1];
-                       tv[2][2] = org[2] + right[2] + up[2];
-                       tv[2][3] = tex->s2;
-                       tv[2][4] = tex->t2;
-                       tv[3][0] = org[0] + right[0] - up[0];
-                       tv[3][1] = org[1] + right[1] - up[1];
-                       tv[3][2] = org[2] + right[2] - up[2];
-                       tv[3][3] = tex->s2;
-                       tv[3][4] = tex->t1;
-
-                       // if the surface is transparent, render as transparent
-                       m.transparent = !(surf->flags & SURF_CLIPSOLID);
-                       R_Mesh_DrawDecal(&m);
-               }
-       }
-}
-*/
index dec8dff..affa059 100644 (file)
@@ -22,10 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 static rtexturepool_t *particletexturepool;
 
-// these are used by the decal system so they can't be static
-rtexture_t *particlefonttexture;
+static rtexture_t *particlefonttexture;
 // [0] is normal, [1] is fog, they may be the same
-particletexture_t particletexture[MAX_PARTICLETEXTURES][2];
+static particletexture_t particletexture[MAX_PARTICLETEXTURES][2];
 
 static cvar_t r_drawparticles = {0, "r_drawparticles", "1"};
 static cvar_t r_particles_lighting = {0, "r_particles_lighting", "1"};
@@ -123,64 +122,6 @@ static void R_InitParticleTexture (void)
                setuptex(i + 0, 1, i + 8, &data[0][0][0], particletexturedata);
        }
 
-       // bullet hole
-       for (i = 0;i < 8;i++)
-       {
-               float p[32][32];
-               fractalnoise(&noise1[0][0], 64, 8);
-               for (y = 0;y < 32;y++)
-                       for (x = 0;x < 32;x++)
-                               p[y][x] = (noise1[y][x] / 8.0f) - 64.0f;
-               for (m = 0;m < 32;m++)
-               {
-                       int j;
-                       float fx, fy, f;
-                       fx = lhrandom(14, 18);
-                       fy = lhrandom(14, 18);
-                       do
-                       {
-                               dx = lhrandom(-1, 1);
-                               dy = lhrandom(-1, 1);
-                               f = (dx * dx + dy * dy);
-                       }
-                       while(f < 0.125f || f > 1.0f);
-                       f = (m + 1) / 40.0f; //lhrandom(0.0f, 1.0);
-                       dx *= 1.0f / 32.0f;
-                       dy *= 1.0f / 32.0f;
-                       for (j = 0;f > 0 && j < (32 * 14);j++)
-                       {
-                               y = fy;
-                               x = fx;
-                               fx += dx;
-                               fy += dy;
-                               if (x < 1 || y < 1 || x >= 31 || y >= 31)
-                                       break;
-                               p[y - 1][x - 1] += f * 0.125f;
-                               p[y - 1][x    ] += f * 0.25f;
-                               p[y - 1][x + 1] += f * 0.125f;
-                               p[y    ][x - 1] += f * 0.25f;
-                               p[y    ][x    ] += f;
-                               p[y    ][x + 1] += f * 0.25f;
-                               p[y + 1][x - 1] += f * 0.125f;
-                               p[y + 1][x    ] += f * 0.25f;
-                               p[y + 1][x + 1] += f * 0.125f;
-//                             f -= (0.5f / (32 * 16));
-                       }
-               }
-               for (y = 0;y < 32;y++)
-               {
-                       for (x = 0;x < 32;x++)
-                       {
-                               m = p[y][x];
-                               data[y][x][0] = data[y][x][1] = data[y][x][2] = 255;
-                               data[y][x][3] = (byte) bound(0, m, 255);
-                       }
-               }
-
-               setuptex(i + 8, 0, i + 16, &data[0][0][0], particletexturedata);
-               setuptex(i + 8, 1, i + 16, &data[0][0][0], particletexturedata);
-       }
-
        // rain splash
        for (i = 0;i < 16;i++)
        {
@@ -198,8 +139,8 @@ static void R_InitParticleTexture (void)
                                data[y][x][3] = (int) f;
                        }
                }
-               setuptex(i + 16, 0, i + 24, &data[0][0][0], particletexturedata);
-               setuptex(i + 16, 1, i + 24, &data[0][0][0], particletexturedata);
+               setuptex(i + 8, 0, i + 16, &data[0][0][0], particletexturedata);
+               setuptex(i + 8, 1, i + 16, &data[0][0][0], particletexturedata);
        }
 
        // normal particle
@@ -215,8 +156,8 @@ static void R_InitParticleTexture (void)
                        data[y][x][3] = (byte) d;
                }
        }
-       setuptex(32, 0, 40, &data[0][0][0], particletexturedata);
-       setuptex(32, 1, 40, &data[0][0][0], particletexturedata);
+       setuptex(24, 0, 32, &data[0][0][0], particletexturedata);
+       setuptex(24, 1, 32, &data[0][0][0], particletexturedata);
 
        // rain
        light[0] = 1;light[1] = 1;light[2] = 1;
@@ -229,8 +170,8 @@ static void R_InitParticleTexture (void)
                        data[y][x][3] = shadebubble((x - 16) * (1.0 / 8.0), y < 24 ? (y - 24) * (1.0 / 24.0) : (y - 24) * (1.0 / 8.0), light);
                }
        }
-       setuptex(33, 0, 41, &data[0][0][0], particletexturedata);
-       setuptex(33, 1, 41, &data[0][0][0], particletexturedata);
+       setuptex(25, 0, 33, &data[0][0][0], particletexturedata);
+       setuptex(25, 1, 33, &data[0][0][0], particletexturedata);
 
        // bubble
        light[0] = 1;light[1] = 1;light[2] = 1;
@@ -243,8 +184,8 @@ static void R_InitParticleTexture (void)
                        data[y][x][3] = shadebubble((x - 16) * (1.0 / 16.0), (y - 16) * (1.0 / 16.0), light);
                }
        }
-       setuptex(34, 0, 42, &data[0][0][0], particletexturedata);
-       setuptex(34, 1, 42, &data[0][0][0], particletexturedata);
+       setuptex(26, 0, 34, &data[0][0][0], particletexturedata);
+       setuptex(26, 1, 34, &data[0][0][0], particletexturedata);
 
        // rocket flare
        for (y = 0;y < 32;y++)
@@ -260,11 +201,11 @@ static void R_InitParticleTexture (void)
                        data[y][x][3] = bound(0, d * 1.0f, 255);
                }
        }
-       setuptex(35, 0, 43, &data[0][0][0], particletexturedata);
+       setuptex(27, 0, 35, &data[0][0][0], particletexturedata);
        for (y = 0;y < 32;y++)
                for (x = 0;x < 32;x++)
                        data[y][x][0] = data[y][x][1] = data[y][x][2] = 255;
-       setuptex(35, 1, 44, &data[0][0][0], particletexturedata);
+       setuptex(28, 1, 36, &data[0][0][0], particletexturedata);
 
        particlefonttexture = R_LoadTexture (particletexturepool, "particlefont", 256, 256, particletexturedata, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE);
 }
index ea393f0..bd28ea5 100644 (file)
--- a/render.h
+++ b/render.h
@@ -114,14 +114,11 @@ void R_InitSky (byte *src, int bytesperpixel); // called at level load
 
 void R_NewMap (void);
 
-void R_Decals_Init(void);
-void R_DrawDecals(void);
-
 void R_DrawWorld(void);
 void R_SetupForWorldRendering(void);
 void R_MarkWorldLights(void);
 void R_PrepareSurfaces(void);
-void R_DrawSurfacesAll(void);
+void R_DrawSurfaces(int type);
 void R_DrawPortals(void);
 void R_DrawParticles(void);
 void R_DrawExplosions(void);