mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 14:30:48 +00:00
Use local currententity
This commit is contained in:
parent
9e4bde0803
commit
0ff5dc804d
12 changed files with 128 additions and 139 deletions
|
@ -367,7 +367,7 @@ void D_DrawZSpans(espan_t *pspans);
|
||||||
void TurbulentPow2(espan_t *pspan);
|
void TurbulentPow2(espan_t *pspan);
|
||||||
void NonTurbulentPow2(espan_t *pspan); //PGM
|
void NonTurbulentPow2(espan_t *pspan); //PGM
|
||||||
|
|
||||||
surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel);
|
surfcache_t *D_CacheSurface(const entity_t *currententity, msurface_t *surface, int miplevel);
|
||||||
|
|
||||||
extern int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle;
|
extern int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle;
|
||||||
|
|
||||||
|
@ -447,7 +447,6 @@ extern vec3_t r_origin;
|
||||||
|
|
||||||
extern entity_t r_worldentity;
|
extern entity_t r_worldentity;
|
||||||
extern model_t *currentmodel;
|
extern model_t *currentmodel;
|
||||||
extern entity_t *currententity;
|
|
||||||
extern vec3_t modelorg;
|
extern vec3_t modelorg;
|
||||||
extern vec3_t r_entorigin;
|
extern vec3_t r_entorigin;
|
||||||
|
|
||||||
|
@ -462,23 +461,23 @@ extern msurface_t *r_alpha_surfaces;
|
||||||
//
|
//
|
||||||
extern qboolean insubmodel;
|
extern qboolean insubmodel;
|
||||||
|
|
||||||
void R_DrawAlphaSurfaces(void);
|
void R_DrawAlphaSurfaces(const entity_t *currententity);
|
||||||
|
|
||||||
void R_DrawSprite(void);
|
void R_DrawSprite(entity_t *currententity);
|
||||||
|
|
||||||
void R_RenderFace(msurface_t *fa, int clipflags);
|
void R_RenderFace(entity_t *currententity, msurface_t *fa, int clipflags);
|
||||||
void R_RenderBmodelFace(bedge_t *pedges, msurface_t *psurf);
|
void R_RenderBmodelFace(entity_t *currententity, bedge_t *pedges, msurface_t *psurf);
|
||||||
void R_TransformFrustum(void);
|
void R_TransformFrustum(void);
|
||||||
|
|
||||||
void R_DrawSubmodelPolygons(model_t *pmodel, int clipflags, mnode_t *topnode);
|
void R_DrawSubmodelPolygons(entity_t *currententity, const model_t *pmodel, int clipflags, mnode_t *topnode);
|
||||||
void R_DrawSolidClippedSubmodelPolygons(model_t *pmodel, mnode_t *topnode);
|
void R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *pmodel, mnode_t *topnode);
|
||||||
|
|
||||||
void R_AliasDrawModel(void);
|
void R_AliasDrawModel(entity_t *currententity);
|
||||||
void R_BeginEdgeFrame(void);
|
void R_BeginEdgeFrame(void);
|
||||||
void R_ScanEdges(surf_t *surface);
|
void R_ScanEdges(surf_t *surface);
|
||||||
void R_PushDlights(model_t *model);
|
void R_PushDlights(const model_t *model);
|
||||||
|
|
||||||
extern void R_RotateBmodel (void);
|
void R_RotateBmodel(const entity_t *currententity);
|
||||||
|
|
||||||
extern int c_faceclip;
|
extern int c_faceclip;
|
||||||
extern int r_polycount;
|
extern int r_polycount;
|
||||||
|
@ -525,8 +524,8 @@ extern int r_outoftriangles;
|
||||||
|
|
||||||
extern mvertex_t *r_pcurrentvertbase;
|
extern mvertex_t *r_pcurrentvertbase;
|
||||||
|
|
||||||
void R_DrawTriangle(const finalvert_t *a, const finalvert_t *b, const finalvert_t *c);
|
void R_DrawTriangle(const entity_t *currententity, const finalvert_t *a, const finalvert_t *b, const finalvert_t *c);
|
||||||
void R_AliasClipTriangle (const finalvert_t *index0, const finalvert_t *index1, finalvert_t *index2);
|
void R_AliasClipTriangle(const entity_t *currententity, const finalvert_t *index0, const finalvert_t *index1, finalvert_t *index2);
|
||||||
|
|
||||||
|
|
||||||
extern float r_time1;
|
extern float r_time1;
|
||||||
|
@ -543,7 +542,7 @@ extern model_t *r_worldmodel;
|
||||||
void R_PrintAliasStats (void);
|
void R_PrintAliasStats (void);
|
||||||
void R_PrintTimes (void);
|
void R_PrintTimes (void);
|
||||||
void R_PrintDSpeeds (void);
|
void R_PrintDSpeeds (void);
|
||||||
void R_LightPoint (vec3_t p, vec3_t color);
|
void R_LightPoint (const entity_t *currententity, vec3_t p, vec3_t color);
|
||||||
void R_SetupFrame (void);
|
void R_SetupFrame (void);
|
||||||
|
|
||||||
extern refdef_t r_newrefdef;
|
extern refdef_t r_newrefdef;
|
||||||
|
|
|
@ -217,7 +217,7 @@ R_AliasClipTriangle
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_AliasClipTriangle (const finalvert_t *index0, const finalvert_t *index1, finalvert_t *index2)
|
R_AliasClipTriangle(const entity_t *currententity, const finalvert_t *index0, const finalvert_t *index1, finalvert_t *index2)
|
||||||
{
|
{
|
||||||
int i, k, pingpong;
|
int i, k, pingpong;
|
||||||
unsigned clipflags;
|
unsigned clipflags;
|
||||||
|
@ -304,6 +304,6 @@ R_AliasClipTriangle (const finalvert_t *index0, const finalvert_t *index1, final
|
||||||
// draw triangles
|
// draw triangles
|
||||||
for (i=1 ; i<k-1 ; i++)
|
for (i=1 ; i<k-1 ; i++)
|
||||||
{
|
{
|
||||||
R_DrawTriangle(&fv[pingpong][0], &fv[pingpong][i], &fv[pingpong][i+1]);
|
R_DrawTriangle(currententity, &fv[pingpong][0], &fv[pingpong][i], &fv[pingpong][i+1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ static const float r_avertexnormals[NUMVERTEXNORMALS][3] = {
|
||||||
|
|
||||||
|
|
||||||
static void R_AliasTransformVector(const vec3_t in, vec3_t out, const float m[3][4]);
|
static void R_AliasTransformVector(const vec3_t in, vec3_t out, const float m[3][4]);
|
||||||
static void R_AliasTransformFinalVerts(int numpoints, finalvert_t *fv, dtrivertx_t *oldv, dtrivertx_t *newv );
|
static void R_AliasTransformFinalVerts(const entity_t *currententity, int numpoints, finalvert_t *fv, dtrivertx_t *oldv, dtrivertx_t *newv );
|
||||||
|
|
||||||
void R_AliasProjectAndClipTestFinalVert(finalvert_t *fv);
|
void R_AliasProjectAndClipTestFinalVert(finalvert_t *fv);
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ R_AliasCheckFrameBBox( daliasframe_t *frame, float worldxf[3][4] )
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
R_AliasCheckBBox (void)
|
R_AliasCheckBBox (const entity_t *currententity)
|
||||||
{
|
{
|
||||||
unsigned long ccodes[2] = { 0, 0 };
|
unsigned long ccodes[2] = { 0, 0 };
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ General clipped case
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
R_AliasPreparePoints (finalvert_t *verts, const finalvert_t *verts_max)
|
R_AliasPreparePoints (const entity_t *currententity, finalvert_t *verts, const finalvert_t *verts_max)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
dstvert_t *pstverts;
|
dstvert_t *pstverts;
|
||||||
|
@ -236,7 +236,8 @@ R_AliasPreparePoints (finalvert_t *verts, const finalvert_t *verts_max)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
R_AliasTransformFinalVerts( s_pmdl->num_xyz,
|
R_AliasTransformFinalVerts(currententity,
|
||||||
|
s_pmdl->num_xyz,
|
||||||
verts, // destination for transformed verts
|
verts, // destination for transformed verts
|
||||||
r_lastframe->verts, // verts from the last frame
|
r_lastframe->verts, // verts from the last frame
|
||||||
r_thisframe->verts // verts from this frame
|
r_thisframe->verts // verts from this frame
|
||||||
|
@ -271,11 +272,11 @@ R_AliasPreparePoints (finalvert_t *verts, const finalvert_t *verts_max)
|
||||||
if ( ! (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) )
|
if ( ! (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) )
|
||||||
{
|
{
|
||||||
// totally unclipped
|
// totally unclipped
|
||||||
R_DrawTriangle(pfv[2], pfv[1], pfv[0]);
|
R_DrawTriangle(currententity, pfv[2], pfv[1], pfv[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R_AliasClipTriangle (pfv[2], pfv[1], pfv[0]);
|
R_AliasClipTriangle(currententity, pfv[2], pfv[1], pfv[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,11 +304,11 @@ R_AliasPreparePoints (finalvert_t *verts, const finalvert_t *verts_max)
|
||||||
if ( ! (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) )
|
if ( ! (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) )
|
||||||
{
|
{
|
||||||
// totally unclipped
|
// totally unclipped
|
||||||
R_DrawTriangle(pfv[0], pfv[1], pfv[2]);
|
R_DrawTriangle(currententity, pfv[0], pfv[1], pfv[2]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // partially clipped
|
{ // partially clipped
|
||||||
R_AliasClipTriangle (pfv[0], pfv[1], pfv[2]);
|
R_AliasClipTriangle(currententity, pfv[0], pfv[1], pfv[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,20 +321,16 @@ R_AliasSetUpTransform
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_AliasSetUpTransform (void)
|
R_AliasSetUpTransform(const entity_t *currententity)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static float viewmatrix[3][4];
|
static float viewmatrix[3][4];
|
||||||
vec3_t angles;
|
|
||||||
|
|
||||||
// TODO: should really be stored with the entity instead of being reconstructed
|
// TODO: should really be stored with the entity instead of being reconstructed
|
||||||
// TODO: should use a look-up table
|
// TODO: should use a look-up table
|
||||||
// TODO: could cache lazily, stored in the entity
|
// TODO: could cache lazily, stored in the entity
|
||||||
//
|
//
|
||||||
angles[ROLL] = currententity->angles[ROLL];
|
AngleVectors((float *)currententity->angles, s_alias_forward, s_alias_right, s_alias_up );
|
||||||
angles[PITCH] = currententity->angles[PITCH];
|
|
||||||
angles[YAW] = currententity->angles[YAW];
|
|
||||||
AngleVectors( angles, s_alias_forward, s_alias_right, s_alias_up );
|
|
||||||
|
|
||||||
// TODO: can do this with simple matrix rearrangement
|
// TODO: can do this with simple matrix rearrangement
|
||||||
memset( aliasworldtransform, 0, sizeof( aliasworldtransform ) );
|
memset( aliasworldtransform, 0, sizeof( aliasworldtransform ) );
|
||||||
|
@ -389,7 +386,7 @@ R_AliasTransformFinalVerts
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_AliasTransformFinalVerts( int numpoints, finalvert_t *fv, dtrivertx_t *oldv, dtrivertx_t *newv )
|
R_AliasTransformFinalVerts(const entity_t *currententity, int numpoints, finalvert_t *fv, dtrivertx_t *oldv, dtrivertx_t *newv )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -485,7 +482,7 @@ R_AliasSetupSkin
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static qboolean
|
static qboolean
|
||||||
R_AliasSetupSkin (void)
|
R_AliasSetupSkin(const entity_t *currententity)
|
||||||
{
|
{
|
||||||
image_t *pskindesc;
|
image_t *pskindesc;
|
||||||
|
|
||||||
|
@ -527,7 +524,7 @@ R_AliasSetupLighting
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_AliasSetupLighting (void)
|
R_AliasSetupLighting(entity_t *currententity)
|
||||||
{
|
{
|
||||||
alight_t lighting;
|
alight_t lighting;
|
||||||
float lightvec[3] = {-1, 0, 0};
|
float lightvec[3] = {-1, 0, 0};
|
||||||
|
@ -542,7 +539,7 @@ R_AliasSetupLighting (void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R_LightPoint (currententity->origin, light);
|
R_LightPoint (currententity, currententity->origin, light);
|
||||||
}
|
}
|
||||||
|
|
||||||
// save off light value for server to look at (BIG HACK!)
|
// save off light value for server to look at (BIG HACK!)
|
||||||
|
@ -619,7 +616,7 @@ R_AliasSetupFrames
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_AliasSetupFrames( dmdl_t *pmdl )
|
R_AliasSetupFrames(const entity_t *currententity, dmdl_t *pmdl)
|
||||||
{
|
{
|
||||||
int thisframe = currententity->frame;
|
int thisframe = currententity->frame;
|
||||||
int lastframe = currententity->oldframe;
|
int lastframe = currententity->oldframe;
|
||||||
|
@ -650,7 +647,7 @@ R_AliasSetupFrames( dmdl_t *pmdl )
|
||||||
** Precomputes lerp coefficients used for the whole frame.
|
** Precomputes lerp coefficients used for the whole frame.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_AliasSetUpLerpData( dmdl_t *pmdl, float backlerp )
|
R_AliasSetUpLerpData(entity_t *currententity, dmdl_t *pmdl, float backlerp)
|
||||||
{
|
{
|
||||||
float frontlerp;
|
float frontlerp;
|
||||||
vec3_t translation, vectors[3];
|
vec3_t translation, vectors[3];
|
||||||
|
@ -691,21 +688,21 @@ R_AliasSetUpLerpData( dmdl_t *pmdl, float backlerp )
|
||||||
|
|
||||||
finalvert_t *finalverts = NULL, *finalverts_max = NULL;
|
finalvert_t *finalverts = NULL, *finalverts_max = NULL;
|
||||||
|
|
||||||
|
extern void (*d_pdrawspans)(const entity_t *currententity, spanpackage_t *pspanpackage);
|
||||||
|
void R_PolysetDrawSpans8_Opaque(const entity_t *currententity, spanpackage_t *pspanpackage);
|
||||||
|
void R_PolysetDrawSpans8_33(const entity_t *currententity, spanpackage_t *pspanpackage);
|
||||||
|
void R_PolysetDrawSpans8_66(const entity_t *currententity, spanpackage_t *pspanpackage);
|
||||||
|
void R_PolysetDrawSpansConstant8_33(const entity_t *currententity, spanpackage_t *pspanpackage);
|
||||||
|
void R_PolysetDrawSpansConstant8_66(const entity_t *currententity, spanpackage_t *pspanpackage);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
R_AliasDrawModel
|
R_AliasDrawModel
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_AliasDrawModel (void)
|
R_AliasDrawModel(entity_t *currententity)
|
||||||
{
|
{
|
||||||
extern void (*d_pdrawspans)(void *);
|
|
||||||
extern void R_PolysetDrawSpans8_Opaque( void * );
|
|
||||||
extern void R_PolysetDrawSpans8_33( void * );
|
|
||||||
extern void R_PolysetDrawSpans8_66( void * );
|
|
||||||
extern void R_PolysetDrawSpansConstant8_33( void * );
|
|
||||||
extern void R_PolysetDrawSpansConstant8_66( void * );
|
|
||||||
|
|
||||||
s_pmdl = (dmdl_t *)currentmodel->extradata;
|
s_pmdl = (dmdl_t *)currentmodel->extradata;
|
||||||
|
|
||||||
if ( r_lerpmodels->value == 0 )
|
if ( r_lerpmodels->value == 0 )
|
||||||
|
@ -733,12 +730,12 @@ R_AliasDrawModel (void)
|
||||||
** we have to set our frame pointers and transformations before
|
** we have to set our frame pointers and transformations before
|
||||||
** doing any real work
|
** doing any real work
|
||||||
*/
|
*/
|
||||||
R_AliasSetupFrames( s_pmdl );
|
R_AliasSetupFrames(currententity, s_pmdl);
|
||||||
R_AliasSetUpTransform();
|
R_AliasSetUpTransform(currententity);
|
||||||
|
|
||||||
// see if the bounding box lets us trivially reject, also sets
|
// see if the bounding box lets us trivially reject, also sets
|
||||||
// trivial accept status
|
// trivial accept status
|
||||||
if ( R_AliasCheckBBox() == BBOX_TRIVIAL_REJECT )
|
if ( R_AliasCheckBBox(currententity) == BBOX_TRIVIAL_REJECT )
|
||||||
{
|
{
|
||||||
if ( currententity->flags & RF_WEAPONMODEL )
|
if ( currententity->flags & RF_WEAPONMODEL )
|
||||||
{
|
{
|
||||||
|
@ -749,7 +746,7 @@ R_AliasDrawModel (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the skin and verify it exists
|
// set up the skin and verify it exists
|
||||||
if ( !R_AliasSetupSkin () )
|
if ( !R_AliasSetupSkin(currententity) )
|
||||||
{
|
{
|
||||||
R_Printf( PRINT_ALL, "R_AliasDrawModel %s: NULL skin found\n",
|
R_Printf( PRINT_ALL, "R_AliasDrawModel %s: NULL skin found\n",
|
||||||
currentmodel->name);
|
currentmodel->name);
|
||||||
|
@ -759,7 +756,7 @@ R_AliasDrawModel (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
r_amodels_drawn++;
|
r_amodels_drawn++;
|
||||||
R_AliasSetupLighting ();
|
R_AliasSetupLighting(currententity);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** select the proper span routine based on translucency
|
** select the proper span routine based on translucency
|
||||||
|
@ -843,14 +840,14 @@ R_AliasDrawModel (void)
|
||||||
/*
|
/*
|
||||||
** compute this_frame and old_frame addresses
|
** compute this_frame and old_frame addresses
|
||||||
*/
|
*/
|
||||||
R_AliasSetUpLerpData( s_pmdl, currententity->backlerp );
|
R_AliasSetUpLerpData(currententity, s_pmdl, currententity->backlerp);
|
||||||
|
|
||||||
if (currententity->flags & RF_DEPTHHACK)
|
if (currententity->flags & RF_DEPTHHACK)
|
||||||
s_ziscale = (float)0x8000 * (float)SHIFT16XYZ_MULT * 3.0;
|
s_ziscale = (float)0x8000 * (float)SHIFT16XYZ_MULT * 3.0;
|
||||||
else
|
else
|
||||||
s_ziscale = (float)0x8000 * (float)SHIFT16XYZ_MULT;
|
s_ziscale = (float)0x8000 * (float)SHIFT16XYZ_MULT;
|
||||||
|
|
||||||
R_AliasPreparePoints (finalverts, finalverts_max);
|
R_AliasPreparePoints(currententity, finalverts, finalverts_max);
|
||||||
|
|
||||||
if ( currententity->flags & RF_WEAPONMODEL )
|
if ( currententity->flags & RF_WEAPONMODEL )
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
//
|
//
|
||||||
// current entity info
|
// current entity info
|
||||||
//
|
//
|
||||||
entity_t *currententity;
|
|
||||||
vec3_t modelorg; // modelorg is the viewpoint reletive to
|
vec3_t modelorg; // modelorg is the viewpoint reletive to
|
||||||
// the currently rendering entity
|
// the currently rendering entity
|
||||||
vec3_t r_entorigin; // the currently rendering entity in world
|
vec3_t r_entorigin; // the currently rendering entity in world
|
||||||
|
@ -75,7 +74,7 @@ R_RotateBmodel
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_RotateBmodel (void)
|
R_RotateBmodel(const entity_t *currententity)
|
||||||
{
|
{
|
||||||
float angle, s, c, temp1[3][3], temp2[3][3], temp3[3][3];
|
float angle, s, c, temp1[3][3], temp2[3][3], temp3[3][3];
|
||||||
|
|
||||||
|
@ -157,7 +156,7 @@ Clip a bmodel poly down the world bsp tree
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_RecursiveClipBPoly (bedge_t *pedges, mnode_t *pnode, msurface_t *psurf)
|
R_RecursiveClipBPoly(entity_t *currententity, bedge_t *pedges, mnode_t *pnode, msurface_t *psurf)
|
||||||
{
|
{
|
||||||
bedge_t *psideedges[2], *pnextedge, *ptedge;
|
bedge_t *psideedges[2], *pnextedge, *ptedge;
|
||||||
int i, side, lastside;
|
int i, side, lastside;
|
||||||
|
@ -318,12 +317,12 @@ R_RecursiveClipBPoly (bedge_t *pedges, mnode_t *pnode, msurface_t *psurf)
|
||||||
}
|
}
|
||||||
|
|
||||||
r_currentbkey = ((mleaf_t *)pn)->key;
|
r_currentbkey = ((mleaf_t *)pn)->key;
|
||||||
R_RenderBmodelFace (psideedges[i], psurf);
|
R_RenderBmodelFace(currententity, psideedges[i], psurf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R_RecursiveClipBPoly (psideedges[i], pnode->children[i],
|
R_RecursiveClipBPoly(currententity, psideedges[i], pnode->children[i],
|
||||||
psurf);
|
psurf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,7 +338,7 @@ Bmodel crosses multiple leafs
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_DrawSolidClippedSubmodelPolygons (model_t *pmodel, mnode_t *topnode)
|
R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *pmodel, mnode_t *topnode)
|
||||||
{
|
{
|
||||||
int i, j, lindex;
|
int i, j, lindex;
|
||||||
vec_t dot;
|
vec_t dot;
|
||||||
|
@ -403,9 +402,9 @@ R_DrawSolidClippedSubmodelPolygons (model_t *pmodel, mnode_t *topnode)
|
||||||
pbedge[j-1].pnext = NULL; // mark end of edges
|
pbedge[j-1].pnext = NULL; // mark end of edges
|
||||||
|
|
||||||
if ( !( psurf->texinfo->flags & ( SURF_TRANS66 | SURF_TRANS33 ) ) )
|
if ( !( psurf->texinfo->flags & ( SURF_TRANS66 | SURF_TRANS33 ) ) )
|
||||||
R_RecursiveClipBPoly (pbedge, topnode, psurf);
|
R_RecursiveClipBPoly(currententity, pbedge, topnode, psurf);
|
||||||
else
|
else
|
||||||
R_RenderBmodelFace( pbedge, psurf );
|
R_RenderBmodelFace(currententity, pbedge, psurf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,7 +417,7 @@ All in one leaf
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_DrawSubmodelPolygons (model_t *pmodel, int clipflags, mnode_t *topnode)
|
R_DrawSubmodelPolygons(entity_t *currententity, const model_t *pmodel, int clipflags, mnode_t *topnode)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
vec_t dot;
|
vec_t dot;
|
||||||
|
@ -444,7 +443,7 @@ R_DrawSubmodelPolygons (model_t *pmodel, int clipflags, mnode_t *topnode)
|
||||||
r_currentkey = ((mleaf_t *)topnode)->key;
|
r_currentkey = ((mleaf_t *)topnode)->key;
|
||||||
|
|
||||||
// FIXME: use bounding-box-based frustum clipping info?
|
// FIXME: use bounding-box-based frustum clipping info?
|
||||||
R_RenderFace (psurf, clipflags);
|
R_RenderFace(currententity, psurf, clipflags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -458,7 +457,7 @@ R_RecursiveWorldNode
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
R_RecursiveWorldNode (entity_t *currententity, mnode_t *node, int clipflags)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
vec3_t acceptpt, rejectpt;
|
vec3_t acceptpt, rejectpt;
|
||||||
|
@ -571,7 +570,7 @@ R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
||||||
side = 1;
|
side = 1;
|
||||||
|
|
||||||
// recurse down the children, front side first
|
// recurse down the children, front side first
|
||||||
R_RecursiveWorldNode (node->children[side], clipflags);
|
R_RecursiveWorldNode (currententity, node->children[side], clipflags);
|
||||||
|
|
||||||
// draw stuff
|
// draw stuff
|
||||||
c = node->numsurfaces;
|
c = node->numsurfaces;
|
||||||
|
@ -589,7 +588,7 @@ R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
||||||
if ((surf->flags & SURF_PLANEBACK) &&
|
if ((surf->flags & SURF_PLANEBACK) &&
|
||||||
(surf->visframe == r_framecount))
|
(surf->visframe == r_framecount))
|
||||||
{
|
{
|
||||||
R_RenderFace (surf, clipflags);
|
R_RenderFace (currententity, surf, clipflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
surf++;
|
surf++;
|
||||||
|
@ -602,7 +601,7 @@ R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
||||||
if (!(surf->flags & SURF_PLANEBACK) &&
|
if (!(surf->flags & SURF_PLANEBACK) &&
|
||||||
(surf->visframe == r_framecount))
|
(surf->visframe == r_framecount))
|
||||||
{
|
{
|
||||||
R_RenderFace (surf, clipflags);
|
R_RenderFace (currententity, surf, clipflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
surf++;
|
surf++;
|
||||||
|
@ -614,12 +613,10 @@ R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
||||||
}
|
}
|
||||||
|
|
||||||
// recurse down the back side
|
// recurse down the back side
|
||||||
R_RecursiveWorldNode (node->children[!side], clipflags);
|
R_RecursiveWorldNode (currententity, node->children[!side], clipflags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
R_RenderWorld
|
R_RenderWorld
|
||||||
|
@ -638,11 +635,10 @@ R_RenderWorld (void)
|
||||||
|
|
||||||
// auto cycle the world frame for texture animation
|
// auto cycle the world frame for texture animation
|
||||||
r_worldentity.frame = (int)(r_newrefdef.time*2);
|
r_worldentity.frame = (int)(r_newrefdef.time*2);
|
||||||
currententity = &r_worldentity;
|
|
||||||
|
|
||||||
VectorCopy (r_origin, modelorg);
|
VectorCopy (r_origin, modelorg);
|
||||||
currentmodel = r_worldmodel;
|
currentmodel = r_worldmodel;
|
||||||
r_pcurrentvertbase = currentmodel->vertexes;
|
r_pcurrentvertbase = currentmodel->vertexes;
|
||||||
|
|
||||||
R_RecursiveWorldNode (currentmodel->nodes, ALIAS_XY_CLIP_MASK);
|
R_RecursiveWorldNode (&r_worldentity, currentmodel->nodes, ALIAS_XY_CLIP_MASK);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,10 +55,6 @@ static int miplevel;
|
||||||
|
|
||||||
float scale_for_mip;
|
float scale_for_mip;
|
||||||
|
|
||||||
// FIXME: should go away
|
|
||||||
extern void R_RotateBmodel (void);
|
|
||||||
extern void R_TransformFrustum (void);
|
|
||||||
|
|
||||||
static void R_GenerateSpans (void);
|
static void R_GenerateSpans (void);
|
||||||
static void R_GenerateSpansBackward (void);
|
static void R_GenerateSpansBackward (void);
|
||||||
|
|
||||||
|
@ -691,7 +687,7 @@ R_ScanEdges (surf_t *surface)
|
||||||
|
|
||||||
// flush the span list if we can't be sure we have enough spans left for
|
// flush the span list if we can't be sure we have enough spans left for
|
||||||
// the next scan
|
// the next scan
|
||||||
if (span_p > max_span_p)
|
if (span_p >= max_span_p)
|
||||||
{
|
{
|
||||||
// Draw stuff on screen
|
// Draw stuff on screen
|
||||||
D_DrawSurfaces (surface);
|
D_DrawSurfaces (surface);
|
||||||
|
@ -877,7 +873,7 @@ D_TurbulentSurf
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
D_TurbulentSurf (surf_t *s)
|
D_TurbulentSurf(surf_t *s)
|
||||||
{
|
{
|
||||||
d_zistepu = s->d_zistepu;
|
d_zistepu = s->d_zistepu;
|
||||||
d_zistepv = s->d_zistepv;
|
d_zistepv = s->d_zistepv;
|
||||||
|
@ -890,15 +886,16 @@ D_TurbulentSurf (surf_t *s)
|
||||||
|
|
||||||
if (s->insubmodel)
|
if (s->insubmodel)
|
||||||
{
|
{
|
||||||
|
entity_t *currententity;
|
||||||
|
|
||||||
// FIXME: we don't want to do all this for every polygon!
|
// FIXME: we don't want to do all this for every polygon!
|
||||||
// TODO: store once at start of frame
|
// TODO: store once at start of frame
|
||||||
currententity = s->entity; //FIXME: make this passed in to
|
currententity = s->entity;
|
||||||
// R_RotateBmodel ()
|
|
||||||
VectorSubtract (r_origin, currententity->origin,
|
VectorSubtract (r_origin, currententity->origin,
|
||||||
local_modelorg);
|
local_modelorg);
|
||||||
TransformVector (local_modelorg, transformed_modelorg);
|
TransformVector (local_modelorg, transformed_modelorg);
|
||||||
|
|
||||||
R_RotateBmodel (); // FIXME: don't mess with the frustum,
|
R_RotateBmodel(currententity); // FIXME: don't mess with the frustum,
|
||||||
// make entity passed in
|
// make entity passed in
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -923,7 +920,6 @@ D_TurbulentSurf (surf_t *s)
|
||||||
// FIXME: we don't want to do this every time!
|
// FIXME: we don't want to do this every time!
|
||||||
// TODO: speed up
|
// TODO: speed up
|
||||||
//
|
//
|
||||||
currententity = NULL; // &r_worldentity;
|
|
||||||
VectorCopy (world_transformed_modelorg,
|
VectorCopy (world_transformed_modelorg,
|
||||||
transformed_modelorg);
|
transformed_modelorg);
|
||||||
VectorCopy (base_vpn, vpn);
|
VectorCopy (base_vpn, vpn);
|
||||||
|
@ -975,6 +971,8 @@ Normal surface cached, texture mapped surface
|
||||||
static void
|
static void
|
||||||
D_SolidSurf (surf_t *s)
|
D_SolidSurf (surf_t *s)
|
||||||
{
|
{
|
||||||
|
entity_t *currententity;
|
||||||
|
|
||||||
d_zistepu = s->d_zistepu;
|
d_zistepu = s->d_zistepu;
|
||||||
d_zistepv = s->d_zistepv;
|
d_zistepv = s->d_zistepv;
|
||||||
d_ziorigin = s->d_ziorigin;
|
d_ziorigin = s->d_ziorigin;
|
||||||
|
@ -983,12 +981,11 @@ D_SolidSurf (surf_t *s)
|
||||||
{
|
{
|
||||||
// FIXME: we don't want to do all this for every polygon!
|
// FIXME: we don't want to do all this for every polygon!
|
||||||
// TODO: store once at start of frame
|
// TODO: store once at start of frame
|
||||||
currententity = s->entity; // FIXME: make this passed in to
|
currententity = s->entity;
|
||||||
// R_RotateBmodel ()
|
VectorSubtract(r_origin, currententity->origin, local_modelorg);
|
||||||
VectorSubtract (r_origin, currententity->origin, local_modelorg);
|
TransformVector(local_modelorg, transformed_modelorg);
|
||||||
TransformVector (local_modelorg, transformed_modelorg);
|
|
||||||
|
|
||||||
R_RotateBmodel (); // FIXME: don't mess with the frustum,
|
R_RotateBmodel(currententity); // FIXME: don't mess with the frustum,
|
||||||
// make entity passed in
|
// make entity passed in
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -998,7 +995,7 @@ D_SolidSurf (surf_t *s)
|
||||||
miplevel = D_MipLevelForScale(s->nearzi * scale_for_mip * pface->texinfo->mipadjust);
|
miplevel = D_MipLevelForScale(s->nearzi * scale_for_mip * pface->texinfo->mipadjust);
|
||||||
|
|
||||||
// FIXME: make this passed in to D_CacheSurface
|
// FIXME: make this passed in to D_CacheSurface
|
||||||
pcurrentcache = D_CacheSurface (pface, miplevel);
|
pcurrentcache = D_CacheSurface (currententity, pface, miplevel);
|
||||||
|
|
||||||
cacheblock = (pixel_t *)pcurrentcache->data;
|
cacheblock = (pixel_t *)pcurrentcache->data;
|
||||||
cachewidth = pcurrentcache->width;
|
cachewidth = pcurrentcache->width;
|
||||||
|
@ -1022,7 +1019,6 @@ D_SolidSurf (surf_t *s)
|
||||||
VectorCopy (base_vup, vup);
|
VectorCopy (base_vup, vup);
|
||||||
VectorCopy (base_vright, vright);
|
VectorCopy (base_vright, vright);
|
||||||
R_TransformFrustum ();
|
R_TransformFrustum ();
|
||||||
currententity = NULL; //&r_worldentity;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1068,8 +1064,6 @@ May be called more than once a frame if the surf list overflows (higher res)
|
||||||
static void
|
static void
|
||||||
D_DrawSurfaces (surf_t *surface)
|
D_DrawSurfaces (surf_t *surface)
|
||||||
{
|
{
|
||||||
// currententity = NULL;
|
|
||||||
// &r_worldentity;
|
|
||||||
VectorSubtract (r_origin, vec3_origin, modelorg);
|
VectorSubtract (r_origin, vec3_origin, modelorg);
|
||||||
TransformVector (modelorg, transformed_modelorg);
|
TransformVector (modelorg, transformed_modelorg);
|
||||||
VectorCopy (transformed_modelorg, world_transformed_modelorg);
|
VectorCopy (transformed_modelorg, world_transformed_modelorg);
|
||||||
|
@ -1098,7 +1092,6 @@ D_DrawSurfaces (surf_t *surface)
|
||||||
else
|
else
|
||||||
D_DrawflatSurfaces (surface);
|
D_DrawflatSurfaces (surface);
|
||||||
|
|
||||||
currententity = NULL; //&r_worldentity;
|
|
||||||
VectorSubtract (r_origin, vec3_origin, modelorg);
|
VectorSubtract (r_origin, vec3_origin, modelorg);
|
||||||
R_TransformFrustum ();
|
R_TransformFrustum ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ R_PushDlights
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_PushDlights (model_t *model)
|
R_PushDlights (const model_t *model)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
dlight_t *l;
|
dlight_t *l;
|
||||||
|
@ -217,7 +217,7 @@ R_LightPoint
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_LightPoint (vec3_t p, vec3_t color)
|
R_LightPoint (const entity_t *currententity, vec3_t p, vec3_t color)
|
||||||
{
|
{
|
||||||
vec3_t end;
|
vec3_t end;
|
||||||
float r;
|
float r;
|
||||||
|
|
|
@ -642,7 +642,7 @@ R_DrawEntitiesOnList (void)
|
||||||
// all bmodels have already been drawn by the edge list
|
// all bmodels have already been drawn by the edge list
|
||||||
for (i=0 ; i<r_newrefdef.num_entities ; i++)
|
for (i=0 ; i<r_newrefdef.num_entities ; i++)
|
||||||
{
|
{
|
||||||
currententity = &r_newrefdef.entities[i];
|
entity_t *currententity = &r_newrefdef.entities[i];
|
||||||
|
|
||||||
if ( currententity->flags & RF_TRANSLUCENT )
|
if ( currententity->flags & RF_TRANSLUCENT )
|
||||||
{
|
{
|
||||||
|
@ -672,11 +672,11 @@ R_DrawEntitiesOnList (void)
|
||||||
switch (currentmodel->type)
|
switch (currentmodel->type)
|
||||||
{
|
{
|
||||||
case mod_sprite:
|
case mod_sprite:
|
||||||
R_DrawSprite ();
|
R_DrawSprite(currententity);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case mod_alias:
|
case mod_alias:
|
||||||
R_AliasDrawModel ();
|
R_AliasDrawModel(currententity);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -690,7 +690,7 @@ R_DrawEntitiesOnList (void)
|
||||||
|
|
||||||
for (i=0 ; i<r_newrefdef.num_entities ; i++)
|
for (i=0 ; i<r_newrefdef.num_entities ; i++)
|
||||||
{
|
{
|
||||||
currententity = &r_newrefdef.entities[i];
|
entity_t *currententity = &r_newrefdef.entities[i];
|
||||||
|
|
||||||
if ( !( currententity->flags & RF_TRANSLUCENT ) )
|
if ( !( currententity->flags & RF_TRANSLUCENT ) )
|
||||||
continue;
|
continue;
|
||||||
|
@ -717,11 +717,11 @@ R_DrawEntitiesOnList (void)
|
||||||
switch (currentmodel->type)
|
switch (currentmodel->type)
|
||||||
{
|
{
|
||||||
case mod_sprite:
|
case mod_sprite:
|
||||||
R_DrawSprite ();
|
R_DrawSprite(currententity);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case mod_alias:
|
case mod_alias:
|
||||||
R_AliasDrawModel ();
|
R_AliasDrawModel(currententity);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -908,7 +908,7 @@ R_DrawBEntitiesOnList (void)
|
||||||
|
|
||||||
for (i=0 ; i<r_newrefdef.num_entities ; i++)
|
for (i=0 ; i<r_newrefdef.num_entities ; i++)
|
||||||
{
|
{
|
||||||
currententity = &r_newrefdef.entities[i];
|
entity_t *currententity = &r_newrefdef.entities[i];
|
||||||
currentmodel = currententity->model;
|
currentmodel = currententity->model;
|
||||||
if (!currentmodel)
|
if (!currentmodel)
|
||||||
continue;
|
continue;
|
||||||
|
@ -939,7 +939,7 @@ R_DrawBEntitiesOnList (void)
|
||||||
r_pcurrentvertbase = currentmodel->vertexes;
|
r_pcurrentvertbase = currentmodel->vertexes;
|
||||||
|
|
||||||
// FIXME: stop transforming twice
|
// FIXME: stop transforming twice
|
||||||
R_RotateBmodel ();
|
R_RotateBmodel(currententity);
|
||||||
|
|
||||||
// calculate dynamic lighting for bmodel
|
// calculate dynamic lighting for bmodel
|
||||||
R_PushDlights (currentmodel);
|
R_PushDlights (currentmodel);
|
||||||
|
@ -948,14 +948,14 @@ R_DrawBEntitiesOnList (void)
|
||||||
{
|
{
|
||||||
// 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 (currentmodel, topnode);
|
R_DrawSolidClippedSubmodelPolygons(currententity, 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
|
||||||
// drawing order
|
// drawing order
|
||||||
R_DrawSubmodelPolygons (currentmodel, clipflags, topnode);
|
R_DrawSubmodelPolygons(currententity, currentmodel, clipflags, topnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// put back world rotation and frustum clipping
|
// put back world rotation and frustum clipping
|
||||||
|
@ -1079,7 +1079,7 @@ R_CalcPalette (void)
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
static void
|
static void
|
||||||
R_SetLightLevel (void)
|
R_SetLightLevel (const entity_t *currententity)
|
||||||
{
|
{
|
||||||
vec3_t light;
|
vec3_t light;
|
||||||
|
|
||||||
|
@ -1090,7 +1090,7 @@ R_SetLightLevel (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// save off light value for server to look at (BIG HACK!)
|
// save off light value for server to look at (BIG HACK!)
|
||||||
R_LightPoint (r_newrefdef.vieworg, light);
|
R_LightPoint (currententity, r_newrefdef.vieworg, light);
|
||||||
r_lightlevel->value = 150.0 * light[0];
|
r_lightlevel->value = 150.0 * light[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1151,10 +1151,10 @@ RE_RenderFrame (refdef_t *fd)
|
||||||
dp_time2 = SDL_GetTicks();
|
dp_time2 = SDL_GetTicks();
|
||||||
|
|
||||||
// Perform pixel palette blending ia the pics/colormap.pcx lower part lookup table.
|
// Perform pixel palette blending ia the pics/colormap.pcx lower part lookup table.
|
||||||
R_DrawAlphaSurfaces();
|
R_DrawAlphaSurfaces(&r_worldentity);
|
||||||
|
|
||||||
// Save off light value for server to look at (BIG HACK!)
|
// Save off light value for server to look at (BIG HACK!)
|
||||||
R_SetLightLevel ();
|
R_SetLightLevel (&r_worldentity);
|
||||||
|
|
||||||
if (r_dowarp)
|
if (r_dowarp)
|
||||||
D_WarpScreen ();
|
D_WarpScreen ();
|
||||||
|
|
|
@ -1026,7 +1026,7 @@ R_ClipAndDrawPoly ( float alpha, int isturbulent, qboolean textured )
|
||||||
** R_BuildPolygonFromSurface
|
** R_BuildPolygonFromSurface
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_BuildPolygonFromSurface(msurface_t *fa)
|
R_BuildPolygonFromSurface(const entity_t *currententity, msurface_t *fa)
|
||||||
{
|
{
|
||||||
int i, lnumverts;
|
int i, lnumverts;
|
||||||
medge_t *pedges, *r_pedge;
|
medge_t *pedges, *r_pedge;
|
||||||
|
@ -1084,7 +1084,7 @@ R_BuildPolygonFromSurface(msurface_t *fa)
|
||||||
{
|
{
|
||||||
surfcache_t *scache;
|
surfcache_t *scache;
|
||||||
|
|
||||||
scache = D_CacheSurface( fa, 0 );
|
scache = D_CacheSurface(currententity, fa, 0);
|
||||||
|
|
||||||
r_polydesc.pixels = scache->data;
|
r_polydesc.pixels = scache->data;
|
||||||
r_polydesc.pixel_width = scache->width;
|
r_polydesc.pixel_width = scache->width;
|
||||||
|
@ -1210,7 +1210,7 @@ R_DrawPoly(int iswater)
|
||||||
** R_DrawAlphaSurfaces
|
** R_DrawAlphaSurfaces
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_DrawAlphaSurfaces(void)
|
R_DrawAlphaSurfaces(const entity_t *currententity)
|
||||||
{
|
{
|
||||||
msurface_t *s = r_alpha_surfaces;
|
msurface_t *s = r_alpha_surfaces;
|
||||||
|
|
||||||
|
@ -1222,7 +1222,7 @@ R_DrawAlphaSurfaces(void)
|
||||||
|
|
||||||
while ( s )
|
while ( s )
|
||||||
{
|
{
|
||||||
R_BuildPolygonFromSurface( s );
|
R_BuildPolygonFromSurface(currententity, s);
|
||||||
|
|
||||||
//=======
|
//=======
|
||||||
//PGM
|
//PGM
|
||||||
|
|
|
@ -94,15 +94,15 @@ static byte *skintable[MAX_LBM_HEIGHT];
|
||||||
int skinwidth;
|
int skinwidth;
|
||||||
static byte *skinstart;
|
static byte *skinstart;
|
||||||
|
|
||||||
void (*d_pdrawspans)(spanpackage_t *pspanpackage);
|
void (*d_pdrawspans)(const entity_t *currententity, spanpackage_t *pspanpackage);
|
||||||
|
|
||||||
void R_PolysetDrawSpans8_33 (spanpackage_t *pspanpackage);
|
void R_PolysetDrawSpans8_33 (const entity_t *currententity, spanpackage_t *pspanpackage);
|
||||||
void R_PolysetDrawSpans8_66 (spanpackage_t *pspanpackage);
|
void R_PolysetDrawSpans8_66 (const entity_t *currententity, spanpackage_t *pspanpackage);
|
||||||
void R_PolysetDrawSpans8_Opaque (spanpackage_t *pspanpackage);
|
void R_PolysetDrawSpans8_Opaque (const entity_t *currententity, spanpackage_t *pspanpackage);
|
||||||
|
|
||||||
static void R_PolysetCalcGradients (int skinwidth);
|
static void R_PolysetCalcGradients (int skinwidth);
|
||||||
static void R_PolysetSetEdgeTable (void);
|
static void R_PolysetSetEdgeTable (void);
|
||||||
static void R_RasterizeAliasPolySmooth (void);
|
static void R_RasterizeAliasPolySmooth(const entity_t *currententity);
|
||||||
static void R_PolysetScanLeftEdge_C(int height);
|
static void R_PolysetScanLeftEdge_C(int height);
|
||||||
|
|
||||||
// ======================
|
// ======================
|
||||||
|
@ -181,7 +181,7 @@ R_DrawTriangle
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_DrawTriangle(const finalvert_t *a, const finalvert_t *b, const finalvert_t *c)
|
R_DrawTriangle(const entity_t *currententity, const finalvert_t *a, const finalvert_t *b, const finalvert_t *c)
|
||||||
{
|
{
|
||||||
int dv1_ab, dv0_ac;
|
int dv1_ab, dv0_ac;
|
||||||
int dv0_ab, dv1_ac;
|
int dv0_ab, dv1_ac;
|
||||||
|
@ -229,7 +229,7 @@ R_DrawTriangle(const finalvert_t *a, const finalvert_t *b, const finalvert_t *c)
|
||||||
r_p2[5] = c->zi;
|
r_p2[5] = c->zi;
|
||||||
|
|
||||||
R_PolysetSetEdgeTable ();
|
R_PolysetSetEdgeTable ();
|
||||||
R_RasterizeAliasPolySmooth ();
|
R_RasterizeAliasPolySmooth(currententity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ R_PolysetDrawSpans8
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_PolysetDrawSpans8_33( spanpackage_t *pspanpackage)
|
R_PolysetDrawSpans8_33(const entity_t *currententity, spanpackage_t *pspanpackage)
|
||||||
{
|
{
|
||||||
byte *lpdest;
|
byte *lpdest;
|
||||||
byte *lptex;
|
byte *lptex;
|
||||||
|
@ -528,7 +528,7 @@ R_PolysetDrawSpans8_33( spanpackage_t *pspanpackage)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_PolysetDrawSpansConstant8_33( spanpackage_t *pspanpackage)
|
R_PolysetDrawSpansConstant8_33(const entity_t *currententity, spanpackage_t *pspanpackage)
|
||||||
{
|
{
|
||||||
pixel_t *lpdest;
|
pixel_t *lpdest;
|
||||||
int lzi;
|
int lzi;
|
||||||
|
@ -574,7 +574,7 @@ R_PolysetDrawSpansConstant8_33( spanpackage_t *pspanpackage)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_PolysetDrawSpans8_66(spanpackage_t *pspanpackage)
|
R_PolysetDrawSpans8_66(const entity_t *currententity, spanpackage_t *pspanpackage)
|
||||||
{
|
{
|
||||||
pixel_t *lpdest;
|
pixel_t *lpdest;
|
||||||
pixel_t *lptex;
|
pixel_t *lptex;
|
||||||
|
@ -641,7 +641,7 @@ R_PolysetDrawSpans8_66(spanpackage_t *pspanpackage)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_PolysetDrawSpansConstant8_66( spanpackage_t *pspanpackage)
|
R_PolysetDrawSpansConstant8_66(const entity_t *currententity, spanpackage_t *pspanpackage)
|
||||||
{
|
{
|
||||||
pixel_t *lpdest;
|
pixel_t *lpdest;
|
||||||
zvalue_t lzi;
|
zvalue_t lzi;
|
||||||
|
@ -687,7 +687,7 @@ R_PolysetDrawSpansConstant8_66( spanpackage_t *pspanpackage)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_PolysetDrawSpans8_Opaque (spanpackage_t *pspanpackage)
|
R_PolysetDrawSpans8_Opaque (const entity_t *currententity, spanpackage_t *pspanpackage)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -762,7 +762,7 @@ R_RasterizeAliasPolySmooth
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_RasterizeAliasPolySmooth (void)
|
R_RasterizeAliasPolySmooth(const entity_t *currententity)
|
||||||
{
|
{
|
||||||
int initialleftheight, initialrightheight;
|
int initialleftheight, initialrightheight;
|
||||||
int *plefttop, *prighttop, *pleftbottom, *prightbottom;
|
int *plefttop, *prighttop, *pleftbottom, *prightbottom;
|
||||||
|
@ -949,7 +949,7 @@ R_RasterizeAliasPolySmooth (void)
|
||||||
}
|
}
|
||||||
originalcount = triangle_spans[initialrightheight].count;
|
originalcount = triangle_spans[initialrightheight].count;
|
||||||
triangle_spans[initialrightheight].count = -999999; // mark end of the spanpackages
|
triangle_spans[initialrightheight].count = -999999; // mark end of the spanpackages
|
||||||
(*d_pdrawspans) (triangle_spans);
|
(*d_pdrawspans) (currententity, triangle_spans);
|
||||||
|
|
||||||
// scan out the bottom part of the right edge, if it exists
|
// scan out the bottom part of the right edge, if it exists
|
||||||
if (pedgetable->numrightedges == 2)
|
if (pedgetable->numrightedges == 2)
|
||||||
|
@ -979,7 +979,7 @@ R_RasterizeAliasPolySmooth (void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
triangle_spans[initialrightheight + height].count = -999999; // mark end of the spanpackages
|
triangle_spans[initialrightheight + height].count = -999999; // mark end of the spanpackages
|
||||||
(*d_pdrawspans) (pstart);
|
(*d_pdrawspans) (currententity, pstart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ R_EmitSkyBox
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_EmitSkyBox (void)
|
R_EmitSkyBox(entity_t *currententity)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int oldkey;
|
int oldkey;
|
||||||
|
@ -199,7 +199,7 @@ R_EmitSkyBox (void)
|
||||||
r_currentkey = 0x7ffffff0;
|
r_currentkey = 0x7ffffff0;
|
||||||
for (i=0 ; i<6 ; i++)
|
for (i=0 ; i<6 ; i++)
|
||||||
{
|
{
|
||||||
R_RenderFace (r_skyfaces + i, ALIAS_XY_CLIP_MASK);
|
R_RenderFace(currententity, r_skyfaces + i, ALIAS_XY_CLIP_MASK);
|
||||||
}
|
}
|
||||||
r_currentkey = oldkey; // bsp sorting order
|
r_currentkey = oldkey; // bsp sorting order
|
||||||
}
|
}
|
||||||
|
@ -354,9 +354,13 @@ R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1)
|
||||||
// the edge of the screen
|
// the edge of the screen
|
||||||
// FIXME: is this actually needed?
|
// FIXME: is this actually needed?
|
||||||
if (edge->u < r_refdef.vrect_x_adj_shift20)
|
if (edge->u < r_refdef.vrect_x_adj_shift20)
|
||||||
|
{
|
||||||
edge->u = r_refdef.vrect_x_adj_shift20;
|
edge->u = r_refdef.vrect_x_adj_shift20;
|
||||||
if (edge->u > r_refdef.vrectright_adj_shift20)
|
}
|
||||||
|
else if (edge->u > r_refdef.vrectright_adj_shift20)
|
||||||
|
{
|
||||||
edge->u = r_refdef.vrectright_adj_shift20;
|
edge->u = r_refdef.vrectright_adj_shift20;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sort the edge in normally
|
// sort the edge in normally
|
||||||
|
@ -515,7 +519,7 @@ R_RenderFace
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_RenderFace (msurface_t *fa, int clipflags)
|
R_RenderFace (entity_t *currententity, msurface_t *fa, int clipflags)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned mask;
|
unsigned mask;
|
||||||
|
@ -537,7 +541,7 @@ R_RenderFace (msurface_t *fa, int clipflags)
|
||||||
// environment box surfaces to be emited
|
// environment box surfaces to be emited
|
||||||
if ( fa->texinfo->flags & SURF_SKY )
|
if ( fa->texinfo->flags & SURF_SKY )
|
||||||
{
|
{
|
||||||
R_EmitSkyBox ();
|
R_EmitSkyBox (currententity);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,7 +735,7 @@ R_RenderBmodelFace
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf)
|
R_RenderBmodelFace(entity_t *currententity, bedge_t *pedges, msurface_t *psurf)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned mask;
|
unsigned mask;
|
||||||
|
|
|
@ -33,7 +33,7 @@ extern void R_ClipAndDrawPoly( float alpha, qboolean isturbulent, qboolean textu
|
||||||
** mapped polygon
|
** mapped polygon
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_DrawSprite (void)
|
R_DrawSprite(entity_t *currententity)
|
||||||
{
|
{
|
||||||
vec5_t *pverts;
|
vec5_t *pverts;
|
||||||
vec3_t left, up, right, down;
|
vec3_t left, up, right, down;
|
||||||
|
|
|
@ -50,7 +50,7 @@ Returns the proper texture for a given time and base texture
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static image_t *
|
static image_t *
|
||||||
R_TextureAnimation (mtexinfo_t *tex)
|
R_TextureAnimation (const entity_t *currententity, mtexinfo_t *tex)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
@ -344,14 +344,14 @@ D_CacheSurface
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
surfcache_t *
|
surfcache_t *
|
||||||
D_CacheSurface (msurface_t *surface, int miplevel)
|
D_CacheSurface (const entity_t *currententity, msurface_t *surface, int miplevel)
|
||||||
{
|
{
|
||||||
surfcache_t *cache;
|
surfcache_t *cache;
|
||||||
|
|
||||||
//
|
//
|
||||||
// if the surface is animating or flashing, flush the cache
|
// if the surface is animating or flashing, flush the cache
|
||||||
//
|
//
|
||||||
r_drawsurf.image = R_TextureAnimation (surface->texinfo);
|
r_drawsurf.image = R_TextureAnimation (currententity, surface->texinfo);
|
||||||
r_drawsurf.lightadj[0] = r_newrefdef.lightstyles[surface->styles[0]].white*128;
|
r_drawsurf.lightadj[0] = r_newrefdef.lightstyles[surface->styles[0]].white*128;
|
||||||
r_drawsurf.lightadj[1] = r_newrefdef.lightstyles[surface->styles[1]].white*128;
|
r_drawsurf.lightadj[1] = r_newrefdef.lightstyles[surface->styles[1]].white*128;
|
||||||
r_drawsurf.lightadj[2] = r_newrefdef.lightstyles[surface->styles[2]].white*128;
|
r_drawsurf.lightadj[2] = r_newrefdef.lightstyles[surface->styles[2]].white*128;
|
||||||
|
|
Loading…
Reference in a new issue