mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
ref_soft: Fix breaking server vis, transparent texture decoding
This commit is contained in:
parent
58429bbc79
commit
e7f369a765
12
r_bsp.c
12
r_bsp.c
@ -143,7 +143,7 @@ void R_RotateBmodel (void)
|
|||||||
|
|
||||||
R_TransformFrustum ();
|
R_TransformFrustum ();
|
||||||
}
|
}
|
||||||
#if 1
|
#if 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
@ -472,7 +472,8 @@ void R_RecursiveClipBPoly (bedge_t *pedges, mnode_t *pnode, msurface_t *psurf)
|
|||||||
{
|
{
|
||||||
if (pn->contents != CONTENTS_SOLID)
|
if (pn->contents != CONTENTS_SOLID)
|
||||||
{
|
{
|
||||||
r_currentbkey = ((mleaf_t *)pn)->cluster;
|
//r_currentbkey = ((mleaf_t *)pn)->cluster;
|
||||||
|
r_currentbkey = LEAF_KEY (((mleaf_t *)pn));
|
||||||
R_RenderBmodelFace (psideedges[i], psurf);
|
R_RenderBmodelFace (psideedges[i], psurf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -718,7 +719,7 @@ void R_DrawSubmodelPolygons (model_t *pmodel, int clipflags, mnode_t *topnode)
|
|||||||
if (((psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) ||
|
if (((psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) ||
|
||||||
(!(psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON)))
|
(!(psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON)))
|
||||||
{
|
{
|
||||||
r_currentkey = ((mleaf_t *)topnode)->cluster;
|
r_currentkey = LEAF_KEY(((mleaf_t *)topnode));
|
||||||
|
|
||||||
// FIXME: use bounding-box-based frustum clipping info?
|
// FIXME: use bounding-box-based frustum clipping info?
|
||||||
R_RenderFace (psurf, clipflags);
|
R_RenderFace (psurf, clipflags);
|
||||||
@ -730,6 +731,7 @@ void R_DrawSubmodelPolygons (model_t *pmodel, int clipflags, mnode_t *topnode)
|
|||||||
|
|
||||||
|
|
||||||
int c_drawnode;
|
int c_drawnode;
|
||||||
|
int r_leafkeys[MAX_MAP_LEAFS];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
@ -812,7 +814,9 @@ void R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
|||||||
gEngfuncs.R_StoreEfrags(&pleaf->efrags,tr.realframecount);
|
gEngfuncs.R_StoreEfrags(&pleaf->efrags,tr.realframecount);
|
||||||
}
|
}
|
||||||
|
|
||||||
pleaf->cluster = r_currentkey;
|
|
||||||
|
// pleaf->cluster
|
||||||
|
LEAF_KEY(pleaf) = r_currentkey;
|
||||||
r_currentkey++; // all bmodels in a leaf share the same key
|
r_currentkey++; // all bmodels in a leaf share the same key
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1239,6 +1239,9 @@ extern qboolean insubmodel;
|
|||||||
|
|
||||||
extern vec3_t r_entorigin;
|
extern vec3_t r_entorigin;
|
||||||
|
|
||||||
|
extern int r_leafkeys[MAX_MAP_LEAFS];
|
||||||
|
#define LEAF_KEY(pleaf) r_leafkeys[(pleaf - WORLDMODEL->leafs)]
|
||||||
|
|
||||||
//
|
//
|
||||||
// r_blitscreen.c
|
// r_blitscreen.c
|
||||||
//
|
//
|
||||||
|
21
r_main.c
21
r_main.c
@ -398,7 +398,8 @@ qboolean R_AddEntity( struct cl_entity_s *clent, int type )
|
|||||||
if( type == ET_FRAGMENTED )
|
if( type == ET_FRAGMENTED )
|
||||||
r_stats.c_client_ents++;
|
r_stats.c_client_ents++;
|
||||||
|
|
||||||
if( R_OpaqueEntity( clent ))
|
// debug: mark all solid
|
||||||
|
if( true ) // R_OpaqueEntity( clent ))
|
||||||
{
|
{
|
||||||
// opaque
|
// opaque
|
||||||
if( tr.draw_list->num_solid_entities >= MAX_VISIBLE_PACKET )
|
if( tr.draw_list->num_solid_entities >= MAX_VISIBLE_PACKET )
|
||||||
@ -1261,9 +1262,6 @@ void R_DrawBEntitiesOnList (void)
|
|||||||
float minmaxs[6];
|
float minmaxs[6];
|
||||||
mnode_t *topnode;
|
mnode_t *topnode;
|
||||||
|
|
||||||
if (!r_drawentities->value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
VectorCopy (modelorg, oldorigin);
|
VectorCopy (modelorg, oldorigin);
|
||||||
insubmodel = true;
|
insubmodel = true;
|
||||||
//r_dlightframecount = r_framecount;
|
//r_dlightframecount = r_framecount;
|
||||||
@ -1284,12 +1282,21 @@ void R_DrawBEntitiesOnList (void)
|
|||||||
// trivial accept status
|
// trivial accept status
|
||||||
RotatedBBox (RI.currentmodel->mins, RI.currentmodel->maxs,
|
RotatedBBox (RI.currentmodel->mins, RI.currentmodel->maxs,
|
||||||
RI.currententity->angles, mins, maxs);
|
RI.currententity->angles, mins, maxs);
|
||||||
|
#if 0
|
||||||
|
mins[0] = mins[0] - 100;
|
||||||
|
mins[1] = mins[1] - 100;
|
||||||
|
mins[2] = mins[2] - 100;
|
||||||
|
maxs[0] = maxs[0] + 100;
|
||||||
|
maxs[1] = maxs[1] + 100;
|
||||||
|
maxs[2] = maxs[2] + 100;
|
||||||
|
#endif
|
||||||
VectorAdd (mins, RI.currententity->origin, minmaxs);
|
VectorAdd (mins, RI.currententity->origin, minmaxs);
|
||||||
VectorAdd (maxs, RI.currententity->origin, (minmaxs+3));
|
VectorAdd (maxs, RI.currententity->origin, (minmaxs+3));
|
||||||
|
|
||||||
clipflags = R_BmodelCheckBBox (minmaxs);
|
clipflags = R_BmodelCheckBBox (minmaxs);
|
||||||
if (clipflags == BMODEL_FULLY_CLIPPED)
|
if (clipflags == BMODEL_FULLY_CLIPPED)
|
||||||
continue; // off the edge of the screen
|
continue; // off the edge of the screen
|
||||||
|
//clipflags = 0;
|
||||||
|
|
||||||
topnode = R_FindTopnode (minmaxs, minmaxs+3);
|
topnode = R_FindTopnode (minmaxs, minmaxs+3);
|
||||||
if (!topnode)
|
if (!topnode)
|
||||||
@ -1319,13 +1326,13 @@ void R_DrawBEntitiesOnList (void)
|
|||||||
// RI.currententity = tr.draw_list->solid_entities[i];
|
// RI.currententity = tr.draw_list->solid_entities[i];
|
||||||
RI.currententity->topnode = topnode;
|
RI.currententity->topnode = topnode;
|
||||||
//ASSERT( RI.currentmodel == tr.draw_list->solid_entities[i]->model );
|
//ASSERT( RI.currentmodel == tr.draw_list->solid_entities[i]->model );
|
||||||
if (topnode->contents >= 0)
|
//if (topnode->contents >= 0)
|
||||||
{
|
{
|
||||||
// not a leaf; has to be clipped to the world BSP
|
// not a leaf; has to be clipped to the world BSP
|
||||||
r_clipflags = clipflags;
|
r_clipflags = clipflags;
|
||||||
R_DrawSolidClippedSubmodelPolygons (RI.currentmodel, topnode);
|
R_DrawSolidClippedSubmodelPolygons (RI.currentmodel, topnode);
|
||||||
}
|
}
|
||||||
else
|
//else
|
||||||
{
|
{
|
||||||
// falls entirely in one leaf, so we just put all the
|
// falls entirely in one leaf, so we just put all the
|
||||||
// edges in the edge list and let 1/z sorting handle
|
// edges in the edge list and let 1/z sorting handle
|
||||||
@ -1333,7 +1340,7 @@ void R_DrawBEntitiesOnList (void)
|
|||||||
//ASSERT( RI.currentmodel == tr.draw_list->solid_entities[i]->model );
|
//ASSERT( RI.currentmodel == tr.draw_list->solid_entities[i]->model );
|
||||||
|
|
||||||
|
|
||||||
R_DrawSubmodelPolygons (RI.currentmodel, clipflags, topnode);
|
//R_DrawSubmodelPolygons (RI.currentmodel, clipflags, topnode);
|
||||||
}
|
}
|
||||||
RI.currententity->topnode = NULL;
|
RI.currententity->topnode = NULL;
|
||||||
|
|
||||||
|
15
r_surf.c
15
r_surf.c
@ -180,7 +180,7 @@ texture_t *R_TextureAnimation( msurface_t *s )
|
|||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char r_transtexture;
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
R_DrawSurface
|
R_DrawSurface
|
||||||
@ -200,6 +200,7 @@ void R_DrawSurface (void)
|
|||||||
surfrowbytes = r_drawsurf.rowbytes;
|
surfrowbytes = r_drawsurf.rowbytes;
|
||||||
|
|
||||||
mt = r_drawsurf.image;
|
mt = r_drawsurf.image;
|
||||||
|
r_transtexture = mt->transparent;
|
||||||
|
|
||||||
r_source = mt->pixels[r_drawsurf.surfmip];
|
r_source = mt->pixels[r_drawsurf.surfmip];
|
||||||
|
|
||||||
@ -276,6 +277,7 @@ void R_DrawSurfaceBlock8_mip0 (void)
|
|||||||
|
|
||||||
psource = pbasesource;
|
psource = pbasesource;
|
||||||
prowdest = prowdestbase;
|
prowdest = prowdestbase;
|
||||||
|
char transtexture = r_transtexture;
|
||||||
|
|
||||||
for (v=0 ; v<r_numvblocks ; v++)
|
for (v=0 ; v<r_numvblocks ; v++)
|
||||||
{
|
{
|
||||||
@ -297,6 +299,8 @@ void R_DrawSurfaceBlock8_mip0 (void)
|
|||||||
for (b=15; b>=0; b--)
|
for (b=15; b>=0; b--)
|
||||||
{
|
{
|
||||||
pix = psource[b];
|
pix = psource[b];
|
||||||
|
if( transtexture )
|
||||||
|
pix = pix << 3;
|
||||||
prowdest[b] = pix;
|
prowdest[b] = pix;
|
||||||
//((unsigned char *)vid.colormap)
|
//((unsigned char *)vid.colormap)
|
||||||
//[(light & 0xFF00) + pix];
|
//[(light & 0xFF00) + pix];
|
||||||
@ -324,6 +328,7 @@ void R_DrawSurfaceBlock8_mip1 (void)
|
|||||||
{
|
{
|
||||||
int v, i, b, lightstep, lighttemp, light;
|
int v, i, b, lightstep, lighttemp, light;
|
||||||
pixel_t pix, *psource, *prowdest;
|
pixel_t pix, *psource, *prowdest;
|
||||||
|
char transtexture = r_transtexture;
|
||||||
|
|
||||||
psource = pbasesource;
|
psource = pbasesource;
|
||||||
prowdest = prowdestbase;
|
prowdest = prowdestbase;
|
||||||
@ -348,6 +353,8 @@ void R_DrawSurfaceBlock8_mip1 (void)
|
|||||||
for (b=7; b>=0; b--)
|
for (b=7; b>=0; b--)
|
||||||
{
|
{
|
||||||
pix = psource[b];
|
pix = psource[b];
|
||||||
|
if( transtexture )
|
||||||
|
pix = pix << 3;
|
||||||
prowdest[b] = pix;
|
prowdest[b] = pix;
|
||||||
//((unsigned char *)vid.colormap)
|
//((unsigned char *)vid.colormap)
|
||||||
//[(light & 0xFF00) + pix];
|
//[(light & 0xFF00) + pix];
|
||||||
@ -375,6 +382,7 @@ void R_DrawSurfaceBlock8_mip2 (void)
|
|||||||
{
|
{
|
||||||
int v, i, b, lightstep, lighttemp, light;
|
int v, i, b, lightstep, lighttemp, light;
|
||||||
pixel_t pix, *psource, *prowdest;
|
pixel_t pix, *psource, *prowdest;
|
||||||
|
char transtexture = r_transtexture;
|
||||||
|
|
||||||
psource = pbasesource;
|
psource = pbasesource;
|
||||||
prowdest = prowdestbase;
|
prowdest = prowdestbase;
|
||||||
@ -399,6 +407,8 @@ void R_DrawSurfaceBlock8_mip2 (void)
|
|||||||
for (b=3; b>=0; b--)
|
for (b=3; b>=0; b--)
|
||||||
{
|
{
|
||||||
pix = psource[b];
|
pix = psource[b];
|
||||||
|
if( transtexture )
|
||||||
|
pix = pix << 3;
|
||||||
prowdest[b] = pix;
|
prowdest[b] = pix;
|
||||||
//((unsigned char *)vid.colormap)
|
//((unsigned char *)vid.colormap)
|
||||||
//[(light & 0xFF00) + pix];
|
//[(light & 0xFF00) + pix];
|
||||||
@ -426,6 +436,7 @@ void R_DrawSurfaceBlock8_mip3 (void)
|
|||||||
{
|
{
|
||||||
int v, i, b, lightstep, lighttemp, light;
|
int v, i, b, lightstep, lighttemp, light;
|
||||||
pixel_t pix, *psource, *prowdest;
|
pixel_t pix, *psource, *prowdest;
|
||||||
|
char transtexture = r_transtexture;
|
||||||
|
|
||||||
psource = pbasesource;
|
psource = pbasesource;
|
||||||
prowdest = prowdestbase;
|
prowdest = prowdestbase;
|
||||||
@ -450,6 +461,8 @@ void R_DrawSurfaceBlock8_mip3 (void)
|
|||||||
for (b=1; b>=0; b--)
|
for (b=1; b>=0; b--)
|
||||||
{
|
{
|
||||||
pix = psource[b];
|
pix = psource[b];
|
||||||
|
if( transtexture )
|
||||||
|
pix = pix << 3;
|
||||||
prowdest[b] = pix;
|
prowdest[b] = pix;
|
||||||
//((unsigned char *)vid.colormap)
|
//((unsigned char *)vid.colormap)
|
||||||
//[(light & 0xFF00) + pix];
|
//[(light & 0xFF00) + pix];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user