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 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;
|
||||
|
||||
|
@ -447,7 +447,6 @@ extern vec3_t r_origin;
|
|||
|
||||
extern entity_t r_worldentity;
|
||||
extern model_t *currentmodel;
|
||||
extern entity_t *currententity;
|
||||
extern vec3_t modelorg;
|
||||
extern vec3_t r_entorigin;
|
||||
|
||||
|
@ -462,23 +461,23 @@ extern msurface_t *r_alpha_surfaces;
|
|||
//
|
||||
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_RenderBmodelFace(bedge_t *pedges, msurface_t *psurf);
|
||||
void R_RenderFace(entity_t *currententity, msurface_t *fa, int clipflags);
|
||||
void R_RenderBmodelFace(entity_t *currententity, bedge_t *pedges, msurface_t *psurf);
|
||||
void R_TransformFrustum(void);
|
||||
|
||||
void R_DrawSubmodelPolygons(model_t *pmodel, int clipflags, mnode_t *topnode);
|
||||
void R_DrawSolidClippedSubmodelPolygons(model_t *pmodel, mnode_t *topnode);
|
||||
void R_DrawSubmodelPolygons(entity_t *currententity, const model_t *pmodel, int clipflags, 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_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 r_polycount;
|
||||
|
@ -525,8 +524,8 @@ extern int r_outoftriangles;
|
|||
|
||||
extern mvertex_t *r_pcurrentvertbase;
|
||||
|
||||
void R_DrawTriangle(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_DrawTriangle(const entity_t *currententity, const finalvert_t *a, const finalvert_t *b, const finalvert_t *c);
|
||||
void R_AliasClipTriangle(const entity_t *currententity, const finalvert_t *index0, const finalvert_t *index1, finalvert_t *index2);
|
||||
|
||||
|
||||
extern float r_time1;
|
||||
|
@ -543,7 +542,7 @@ extern model_t *r_worldmodel;
|
|||
void R_PrintAliasStats (void);
|
||||
void R_PrintTimes (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);
|
||||
|
||||
extern refdef_t r_newrefdef;
|
||||
|
|
|
@ -217,7 +217,7 @@ R_AliasClipTriangle
|
|||
================
|
||||
*/
|
||||
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;
|
||||
unsigned clipflags;
|
||||
|
@ -304,6 +304,6 @@ R_AliasClipTriangle (const finalvert_t *index0, const finalvert_t *index1, final
|
|||
// draw triangles
|
||||
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_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);
|
||||
|
||||
|
@ -170,7 +170,7 @@ R_AliasCheckFrameBBox( daliasframe_t *frame, float worldxf[3][4] )
|
|||
}
|
||||
|
||||
static int
|
||||
R_AliasCheckBBox (void)
|
||||
R_AliasCheckBBox (const entity_t *currententity)
|
||||
{
|
||||
unsigned long ccodes[2] = { 0, 0 };
|
||||
|
||||
|
@ -223,7 +223,7 @@ General clipped case
|
|||
*/
|
||||
|
||||
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;
|
||||
dstvert_t *pstverts;
|
||||
|
@ -236,7 +236,8 @@ R_AliasPreparePoints (finalvert_t *verts, const finalvert_t *verts_max)
|
|||
return;
|
||||
}
|
||||
|
||||
R_AliasTransformFinalVerts( s_pmdl->num_xyz,
|
||||
R_AliasTransformFinalVerts(currententity,
|
||||
s_pmdl->num_xyz,
|
||||
verts, // destination for transformed verts
|
||||
r_lastframe->verts, // verts from the last 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) )
|
||||
{
|
||||
// totally unclipped
|
||||
R_DrawTriangle(pfv[2], pfv[1], pfv[0]);
|
||||
R_DrawTriangle(currententity, pfv[2], pfv[1], pfv[0]);
|
||||
}
|
||||
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) )
|
||||
{
|
||||
// totally unclipped
|
||||
R_DrawTriangle(pfv[0], pfv[1], pfv[2]);
|
||||
R_DrawTriangle(currententity, pfv[0], pfv[1], pfv[2]);
|
||||
}
|
||||
else
|
||||
{ // 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
|
||||
R_AliasSetUpTransform (void)
|
||||
R_AliasSetUpTransform(const entity_t *currententity)
|
||||
{
|
||||
int i;
|
||||
static float viewmatrix[3][4];
|
||||
vec3_t angles;
|
||||
|
||||
// TODO: should really be stored with the entity instead of being reconstructed
|
||||
// TODO: should use a look-up table
|
||||
// TODO: could cache lazily, stored in the entity
|
||||
//
|
||||
angles[ROLL] = currententity->angles[ROLL];
|
||||
angles[PITCH] = currententity->angles[PITCH];
|
||||
angles[YAW] = currententity->angles[YAW];
|
||||
AngleVectors( angles, s_alias_forward, s_alias_right, s_alias_up );
|
||||
AngleVectors((float *)currententity->angles, s_alias_forward, s_alias_right, s_alias_up );
|
||||
|
||||
// TODO: can do this with simple matrix rearrangement
|
||||
memset( aliasworldtransform, 0, sizeof( aliasworldtransform ) );
|
||||
|
@ -389,7 +386,7 @@ R_AliasTransformFinalVerts
|
|||
================
|
||||
*/
|
||||
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;
|
||||
|
||||
|
@ -485,7 +482,7 @@ R_AliasSetupSkin
|
|||
===============
|
||||
*/
|
||||
static qboolean
|
||||
R_AliasSetupSkin (void)
|
||||
R_AliasSetupSkin(const entity_t *currententity)
|
||||
{
|
||||
image_t *pskindesc;
|
||||
|
||||
|
@ -527,7 +524,7 @@ R_AliasSetupLighting
|
|||
================
|
||||
*/
|
||||
static void
|
||||
R_AliasSetupLighting (void)
|
||||
R_AliasSetupLighting(entity_t *currententity)
|
||||
{
|
||||
alight_t lighting;
|
||||
float lightvec[3] = {-1, 0, 0};
|
||||
|
@ -542,7 +539,7 @@ R_AliasSetupLighting (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
R_LightPoint (currententity->origin, light);
|
||||
R_LightPoint (currententity, currententity->origin, light);
|
||||
}
|
||||
|
||||
// save off light value for server to look at (BIG HACK!)
|
||||
|
@ -619,7 +616,7 @@ R_AliasSetupFrames
|
|||
=================
|
||||
*/
|
||||
static void
|
||||
R_AliasSetupFrames( dmdl_t *pmdl )
|
||||
R_AliasSetupFrames(const entity_t *currententity, dmdl_t *pmdl)
|
||||
{
|
||||
int thisframe = currententity->frame;
|
||||
int lastframe = currententity->oldframe;
|
||||
|
@ -650,7 +647,7 @@ R_AliasSetupFrames( dmdl_t *pmdl )
|
|||
** Precomputes lerp coefficients used for the whole frame.
|
||||
*/
|
||||
static void
|
||||
R_AliasSetUpLerpData( dmdl_t *pmdl, float backlerp )
|
||||
R_AliasSetUpLerpData(entity_t *currententity, dmdl_t *pmdl, float backlerp)
|
||||
{
|
||||
float frontlerp;
|
||||
vec3_t translation, vectors[3];
|
||||
|
@ -691,21 +688,21 @@ R_AliasSetUpLerpData( dmdl_t *pmdl, float backlerp )
|
|||
|
||||
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
|
||||
================
|
||||
*/
|
||||
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;
|
||||
|
||||
if ( r_lerpmodels->value == 0 )
|
||||
|
@ -733,12 +730,12 @@ R_AliasDrawModel (void)
|
|||
** we have to set our frame pointers and transformations before
|
||||
** doing any real work
|
||||
*/
|
||||
R_AliasSetupFrames( s_pmdl );
|
||||
R_AliasSetUpTransform();
|
||||
R_AliasSetupFrames(currententity, s_pmdl);
|
||||
R_AliasSetUpTransform(currententity);
|
||||
|
||||
// see if the bounding box lets us trivially reject, also sets
|
||||
// trivial accept status
|
||||
if ( R_AliasCheckBBox() == BBOX_TRIVIAL_REJECT )
|
||||
if ( R_AliasCheckBBox(currententity) == BBOX_TRIVIAL_REJECT )
|
||||
{
|
||||
if ( currententity->flags & RF_WEAPONMODEL )
|
||||
{
|
||||
|
@ -749,7 +746,7 @@ R_AliasDrawModel (void)
|
|||
}
|
||||
|
||||
// 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",
|
||||
currentmodel->name);
|
||||
|
@ -759,7 +756,7 @@ R_AliasDrawModel (void)
|
|||
}
|
||||
|
||||
r_amodels_drawn++;
|
||||
R_AliasSetupLighting ();
|
||||
R_AliasSetupLighting(currententity);
|
||||
|
||||
/*
|
||||
** select the proper span routine based on translucency
|
||||
|
@ -843,14 +840,14 @@ R_AliasDrawModel (void)
|
|||
/*
|
||||
** 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)
|
||||
s_ziscale = (float)0x8000 * (float)SHIFT16XYZ_MULT * 3.0;
|
||||
else
|
||||
s_ziscale = (float)0x8000 * (float)SHIFT16XYZ_MULT;
|
||||
|
||||
R_AliasPreparePoints (finalverts, finalverts_max);
|
||||
R_AliasPreparePoints(currententity, finalverts, finalverts_max);
|
||||
|
||||
if ( currententity->flags & RF_WEAPONMODEL )
|
||||
{
|
||||
|
|
|
@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
//
|
||||
// current entity info
|
||||
//
|
||||
entity_t *currententity;
|
||||
vec3_t modelorg; // modelorg is the viewpoint reletive to
|
||||
// the currently rendering entity
|
||||
vec3_t r_entorigin; // the currently rendering entity in world
|
||||
|
@ -75,7 +74,7 @@ R_RotateBmodel
|
|||
================
|
||||
*/
|
||||
void
|
||||
R_RotateBmodel (void)
|
||||
R_RotateBmodel(const entity_t *currententity)
|
||||
{
|
||||
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
|
||||
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;
|
||||
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_RenderBmodelFace (psideedges[i], psurf);
|
||||
R_RenderBmodelFace(currententity, psideedges[i], psurf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
R_RecursiveClipBPoly (psideedges[i], pnode->children[i],
|
||||
R_RecursiveClipBPoly(currententity, psideedges[i], pnode->children[i],
|
||||
psurf);
|
||||
}
|
||||
}
|
||||
|
@ -339,7 +338,7 @@ Bmodel crosses multiple leafs
|
|||
================
|
||||
*/
|
||||
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;
|
||||
vec_t dot;
|
||||
|
@ -403,9 +402,9 @@ R_DrawSolidClippedSubmodelPolygons (model_t *pmodel, mnode_t *topnode)
|
|||
pbedge[j-1].pnext = NULL; // mark end of edges
|
||||
|
||||
if ( !( psurf->texinfo->flags & ( SURF_TRANS66 | SURF_TRANS33 ) ) )
|
||||
R_RecursiveClipBPoly (pbedge, topnode, psurf);
|
||||
R_RecursiveClipBPoly(currententity, pbedge, topnode, psurf);
|
||||
else
|
||||
R_RenderBmodelFace( pbedge, psurf );
|
||||
R_RenderBmodelFace(currententity, pbedge, psurf );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -418,7 +417,7 @@ All in one leaf
|
|||
================
|
||||
*/
|
||||
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;
|
||||
vec_t dot;
|
||||
|
@ -444,7 +443,7 @@ R_DrawSubmodelPolygons (model_t *pmodel, int clipflags, mnode_t *topnode)
|
|||
r_currentkey = ((mleaf_t *)topnode)->key;
|
||||
|
||||
// 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
|
||||
R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
||||
R_RecursiveWorldNode (entity_t *currententity, mnode_t *node, int clipflags)
|
||||
{
|
||||
int c;
|
||||
vec3_t acceptpt, rejectpt;
|
||||
|
@ -571,7 +570,7 @@ R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
|||
side = 1;
|
||||
|
||||
// recurse down the children, front side first
|
||||
R_RecursiveWorldNode (node->children[side], clipflags);
|
||||
R_RecursiveWorldNode (currententity, node->children[side], clipflags);
|
||||
|
||||
// draw stuff
|
||||
c = node->numsurfaces;
|
||||
|
@ -589,7 +588,7 @@ R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
|||
if ((surf->flags & SURF_PLANEBACK) &&
|
||||
(surf->visframe == r_framecount))
|
||||
{
|
||||
R_RenderFace (surf, clipflags);
|
||||
R_RenderFace (currententity, surf, clipflags);
|
||||
}
|
||||
|
||||
surf++;
|
||||
|
@ -602,7 +601,7 @@ R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
|||
if (!(surf->flags & SURF_PLANEBACK) &&
|
||||
(surf->visframe == r_framecount))
|
||||
{
|
||||
R_RenderFace (surf, clipflags);
|
||||
R_RenderFace (currententity, surf, clipflags);
|
||||
}
|
||||
|
||||
surf++;
|
||||
|
@ -614,12 +613,10 @@ R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
|||
}
|
||||
|
||||
// recurse down the back side
|
||||
R_RecursiveWorldNode (node->children[!side], clipflags);
|
||||
R_RecursiveWorldNode (currententity, node->children[!side], clipflags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
R_RenderWorld
|
||||
|
@ -638,11 +635,10 @@ R_RenderWorld (void)
|
|||
|
||||
// auto cycle the world frame for texture animation
|
||||
r_worldentity.frame = (int)(r_newrefdef.time*2);
|
||||
currententity = &r_worldentity;
|
||||
|
||||
VectorCopy (r_origin, modelorg);
|
||||
currentmodel = r_worldmodel;
|
||||
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;
|
||||
|
||||
// FIXME: should go away
|
||||
extern void R_RotateBmodel (void);
|
||||
extern void R_TransformFrustum (void);
|
||||
|
||||
static void R_GenerateSpans (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
|
||||
// the next scan
|
||||
if (span_p > max_span_p)
|
||||
if (span_p >= max_span_p)
|
||||
{
|
||||
// Draw stuff on screen
|
||||
D_DrawSurfaces (surface);
|
||||
|
@ -890,15 +886,16 @@ D_TurbulentSurf (surf_t *s)
|
|||
|
||||
if (s->insubmodel)
|
||||
{
|
||||
entity_t *currententity;
|
||||
|
||||
// FIXME: we don't want to do all this for every polygon!
|
||||
// TODO: store once at start of frame
|
||||
currententity = s->entity; //FIXME: make this passed in to
|
||||
// R_RotateBmodel ()
|
||||
currententity = s->entity;
|
||||
VectorSubtract (r_origin, currententity->origin,
|
||||
local_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
|
||||
}
|
||||
|
||||
|
@ -923,7 +920,6 @@ D_TurbulentSurf (surf_t *s)
|
|||
// FIXME: we don't want to do this every time!
|
||||
// TODO: speed up
|
||||
//
|
||||
currententity = NULL; // &r_worldentity;
|
||||
VectorCopy (world_transformed_modelorg,
|
||||
transformed_modelorg);
|
||||
VectorCopy (base_vpn, vpn);
|
||||
|
@ -975,6 +971,8 @@ Normal surface cached, texture mapped surface
|
|||
static void
|
||||
D_SolidSurf (surf_t *s)
|
||||
{
|
||||
entity_t *currententity;
|
||||
|
||||
d_zistepu = s->d_zistepu;
|
||||
d_zistepv = s->d_zistepv;
|
||||
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!
|
||||
// TODO: store once at start of frame
|
||||
currententity = s->entity; // FIXME: make this passed in to
|
||||
// R_RotateBmodel ()
|
||||
currententity = s->entity;
|
||||
VectorSubtract(r_origin, currententity->origin, local_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
|
||||
}
|
||||
else
|
||||
|
@ -998,7 +995,7 @@ D_SolidSurf (surf_t *s)
|
|||
miplevel = D_MipLevelForScale(s->nearzi * scale_for_mip * pface->texinfo->mipadjust);
|
||||
|
||||
// FIXME: make this passed in to D_CacheSurface
|
||||
pcurrentcache = D_CacheSurface (pface, miplevel);
|
||||
pcurrentcache = D_CacheSurface (currententity, pface, miplevel);
|
||||
|
||||
cacheblock = (pixel_t *)pcurrentcache->data;
|
||||
cachewidth = pcurrentcache->width;
|
||||
|
@ -1022,7 +1019,6 @@ D_SolidSurf (surf_t *s)
|
|||
VectorCopy (base_vup, vup);
|
||||
VectorCopy (base_vright, vright);
|
||||
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
|
||||
D_DrawSurfaces (surf_t *surface)
|
||||
{
|
||||
// currententity = NULL;
|
||||
// &r_worldentity;
|
||||
VectorSubtract (r_origin, vec3_origin, modelorg);
|
||||
TransformVector (modelorg, transformed_modelorg);
|
||||
VectorCopy (transformed_modelorg, world_transformed_modelorg);
|
||||
|
@ -1098,7 +1092,6 @@ D_DrawSurfaces (surf_t *surface)
|
|||
else
|
||||
D_DrawflatSurfaces (surface);
|
||||
|
||||
currententity = NULL; //&r_worldentity;
|
||||
VectorSubtract (r_origin, vec3_origin, modelorg);
|
||||
R_TransformFrustum ();
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ R_PushDlights
|
|||
=============
|
||||
*/
|
||||
void
|
||||
R_PushDlights (model_t *model)
|
||||
R_PushDlights (const model_t *model)
|
||||
{
|
||||
int i;
|
||||
dlight_t *l;
|
||||
|
@ -217,7 +217,7 @@ R_LightPoint
|
|||
===============
|
||||
*/
|
||||
void
|
||||
R_LightPoint (vec3_t p, vec3_t color)
|
||||
R_LightPoint (const entity_t *currententity, vec3_t p, vec3_t color)
|
||||
{
|
||||
vec3_t end;
|
||||
float r;
|
||||
|
|
|
@ -642,7 +642,7 @@ R_DrawEntitiesOnList (void)
|
|||
// all bmodels have already been drawn by the edge list
|
||||
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 )
|
||||
{
|
||||
|
@ -672,11 +672,11 @@ R_DrawEntitiesOnList (void)
|
|||
switch (currentmodel->type)
|
||||
{
|
||||
case mod_sprite:
|
||||
R_DrawSprite ();
|
||||
R_DrawSprite(currententity);
|
||||
break;
|
||||
|
||||
case mod_alias:
|
||||
R_AliasDrawModel ();
|
||||
R_AliasDrawModel(currententity);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -690,7 +690,7 @@ R_DrawEntitiesOnList (void)
|
|||
|
||||
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 ) )
|
||||
continue;
|
||||
|
@ -717,11 +717,11 @@ R_DrawEntitiesOnList (void)
|
|||
switch (currentmodel->type)
|
||||
{
|
||||
case mod_sprite:
|
||||
R_DrawSprite ();
|
||||
R_DrawSprite(currententity);
|
||||
break;
|
||||
|
||||
case mod_alias:
|
||||
R_AliasDrawModel ();
|
||||
R_AliasDrawModel(currententity);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -908,7 +908,7 @@ R_DrawBEntitiesOnList (void)
|
|||
|
||||
for (i=0 ; i<r_newrefdef.num_entities ; i++)
|
||||
{
|
||||
currententity = &r_newrefdef.entities[i];
|
||||
entity_t *currententity = &r_newrefdef.entities[i];
|
||||
currentmodel = currententity->model;
|
||||
if (!currentmodel)
|
||||
continue;
|
||||
|
@ -939,7 +939,7 @@ R_DrawBEntitiesOnList (void)
|
|||
r_pcurrentvertbase = currentmodel->vertexes;
|
||||
|
||||
// FIXME: stop transforming twice
|
||||
R_RotateBmodel ();
|
||||
R_RotateBmodel(currententity);
|
||||
|
||||
// calculate dynamic lighting for bmodel
|
||||
R_PushDlights (currentmodel);
|
||||
|
@ -948,14 +948,14 @@ R_DrawBEntitiesOnList (void)
|
|||
{
|
||||
// not a leaf; has to be clipped to the world BSP
|
||||
r_clipflags = clipflags;
|
||||
R_DrawSolidClippedSubmodelPolygons (currentmodel, topnode);
|
||||
R_DrawSolidClippedSubmodelPolygons(currententity, currentmodel, topnode);
|
||||
}
|
||||
else
|
||||
{
|
||||
// falls entirely in one leaf, so we just put all the
|
||||
// edges in the edge list and let 1/z sorting handle
|
||||
// drawing order
|
||||
R_DrawSubmodelPolygons (currentmodel, clipflags, topnode);
|
||||
R_DrawSubmodelPolygons(currententity, currentmodel, clipflags, topnode);
|
||||
}
|
||||
|
||||
// put back world rotation and frustum clipping
|
||||
|
@ -1079,7 +1079,7 @@ R_CalcPalette (void)
|
|||
//=======================================================================
|
||||
|
||||
static void
|
||||
R_SetLightLevel (void)
|
||||
R_SetLightLevel (const entity_t *currententity)
|
||||
{
|
||||
vec3_t light;
|
||||
|
||||
|
@ -1090,7 +1090,7 @@ R_SetLightLevel (void)
|
|||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
|
||||
|
@ -1151,10 +1151,10 @@ RE_RenderFrame (refdef_t *fd)
|
|||
dp_time2 = SDL_GetTicks();
|
||||
|
||||
// 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!)
|
||||
R_SetLightLevel ();
|
||||
R_SetLightLevel (&r_worldentity);
|
||||
|
||||
if (r_dowarp)
|
||||
D_WarpScreen ();
|
||||
|
|
|
@ -1026,7 +1026,7 @@ R_ClipAndDrawPoly ( float alpha, int isturbulent, qboolean textured )
|
|||
** R_BuildPolygonFromSurface
|
||||
*/
|
||||
static void
|
||||
R_BuildPolygonFromSurface(msurface_t *fa)
|
||||
R_BuildPolygonFromSurface(const entity_t *currententity, msurface_t *fa)
|
||||
{
|
||||
int i, lnumverts;
|
||||
medge_t *pedges, *r_pedge;
|
||||
|
@ -1084,7 +1084,7 @@ R_BuildPolygonFromSurface(msurface_t *fa)
|
|||
{
|
||||
surfcache_t *scache;
|
||||
|
||||
scache = D_CacheSurface( fa, 0 );
|
||||
scache = D_CacheSurface(currententity, fa, 0);
|
||||
|
||||
r_polydesc.pixels = scache->data;
|
||||
r_polydesc.pixel_width = scache->width;
|
||||
|
@ -1210,7 +1210,7 @@ R_DrawPoly(int iswater)
|
|||
** R_DrawAlphaSurfaces
|
||||
*/
|
||||
void
|
||||
R_DrawAlphaSurfaces(void)
|
||||
R_DrawAlphaSurfaces(const entity_t *currententity)
|
||||
{
|
||||
msurface_t *s = r_alpha_surfaces;
|
||||
|
||||
|
@ -1222,7 +1222,7 @@ R_DrawAlphaSurfaces(void)
|
|||
|
||||
while ( s )
|
||||
{
|
||||
R_BuildPolygonFromSurface( s );
|
||||
R_BuildPolygonFromSurface(currententity, s);
|
||||
|
||||
//=======
|
||||
//PGM
|
||||
|
|
|
@ -94,15 +94,15 @@ static byte *skintable[MAX_LBM_HEIGHT];
|
|||
int skinwidth;
|
||||
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_66 (spanpackage_t *pspanpackage);
|
||||
void R_PolysetDrawSpans8_Opaque (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_PolysetDrawSpans8_Opaque (const entity_t *currententity, spanpackage_t *pspanpackage);
|
||||
|
||||
static void R_PolysetCalcGradients (int skinwidth);
|
||||
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);
|
||||
|
||||
// ======================
|
||||
|
@ -181,7 +181,7 @@ R_DrawTriangle
|
|||
================
|
||||
*/
|
||||
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 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_PolysetSetEdgeTable ();
|
||||
R_RasterizeAliasPolySmooth ();
|
||||
R_RasterizeAliasPolySmooth(currententity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ R_PolysetDrawSpans8
|
|||
================
|
||||
*/
|
||||
void
|
||||
R_PolysetDrawSpans8_33( spanpackage_t *pspanpackage)
|
||||
R_PolysetDrawSpans8_33(const entity_t *currententity, spanpackage_t *pspanpackage)
|
||||
{
|
||||
byte *lpdest;
|
||||
byte *lptex;
|
||||
|
@ -528,7 +528,7 @@ R_PolysetDrawSpans8_33( spanpackage_t *pspanpackage)
|
|||
}
|
||||
|
||||
void
|
||||
R_PolysetDrawSpansConstant8_33( spanpackage_t *pspanpackage)
|
||||
R_PolysetDrawSpansConstant8_33(const entity_t *currententity, spanpackage_t *pspanpackage)
|
||||
{
|
||||
pixel_t *lpdest;
|
||||
int lzi;
|
||||
|
@ -574,7 +574,7 @@ R_PolysetDrawSpansConstant8_33( spanpackage_t *pspanpackage)
|
|||
}
|
||||
|
||||
void
|
||||
R_PolysetDrawSpans8_66(spanpackage_t *pspanpackage)
|
||||
R_PolysetDrawSpans8_66(const entity_t *currententity, spanpackage_t *pspanpackage)
|
||||
{
|
||||
pixel_t *lpdest;
|
||||
pixel_t *lptex;
|
||||
|
@ -641,7 +641,7 @@ R_PolysetDrawSpans8_66(spanpackage_t *pspanpackage)
|
|||
}
|
||||
|
||||
void
|
||||
R_PolysetDrawSpansConstant8_66( spanpackage_t *pspanpackage)
|
||||
R_PolysetDrawSpansConstant8_66(const entity_t *currententity, spanpackage_t *pspanpackage)
|
||||
{
|
||||
pixel_t *lpdest;
|
||||
zvalue_t lzi;
|
||||
|
@ -687,7 +687,7 @@ R_PolysetDrawSpansConstant8_66( spanpackage_t *pspanpackage)
|
|||
}
|
||||
|
||||
void
|
||||
R_PolysetDrawSpans8_Opaque (spanpackage_t *pspanpackage)
|
||||
R_PolysetDrawSpans8_Opaque (const entity_t *currententity, spanpackage_t *pspanpackage)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
@ -762,7 +762,7 @@ R_RasterizeAliasPolySmooth
|
|||
================
|
||||
*/
|
||||
static void
|
||||
R_RasterizeAliasPolySmooth (void)
|
||||
R_RasterizeAliasPolySmooth(const entity_t *currententity)
|
||||
{
|
||||
int initialleftheight, initialrightheight;
|
||||
int *plefttop, *prighttop, *pleftbottom, *prightbottom;
|
||||
|
@ -949,7 +949,7 @@ R_RasterizeAliasPolySmooth (void)
|
|||
}
|
||||
originalcount = triangle_spans[initialrightheight].count;
|
||||
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
|
||||
if (pedgetable->numrightedges == 2)
|
||||
|
@ -979,7 +979,7 @@ R_RasterizeAliasPolySmooth (void)
|
|||
return;
|
||||
}
|
||||
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
|
||||
R_EmitSkyBox (void)
|
||||
R_EmitSkyBox(entity_t *currententity)
|
||||
{
|
||||
int i, j;
|
||||
int oldkey;
|
||||
|
@ -199,7 +199,7 @@ R_EmitSkyBox (void)
|
|||
r_currentkey = 0x7ffffff0;
|
||||
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
|
||||
}
|
||||
|
@ -354,9 +354,13 @@ R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1)
|
|||
// the edge of the screen
|
||||
// FIXME: is this actually needed?
|
||||
if (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;
|
||||
}
|
||||
|
||||
//
|
||||
// sort the edge in normally
|
||||
|
@ -515,7 +519,7 @@ R_RenderFace
|
|||
================
|
||||
*/
|
||||
void
|
||||
R_RenderFace (msurface_t *fa, int clipflags)
|
||||
R_RenderFace (entity_t *currententity, msurface_t *fa, int clipflags)
|
||||
{
|
||||
int i;
|
||||
unsigned mask;
|
||||
|
@ -537,7 +541,7 @@ R_RenderFace (msurface_t *fa, int clipflags)
|
|||
// environment box surfaces to be emited
|
||||
if ( fa->texinfo->flags & SURF_SKY )
|
||||
{
|
||||
R_EmitSkyBox ();
|
||||
R_EmitSkyBox (currententity);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -731,7 +735,7 @@ R_RenderBmodelFace
|
|||
================
|
||||
*/
|
||||
void
|
||||
R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf)
|
||||
R_RenderBmodelFace(entity_t *currententity, bedge_t *pedges, msurface_t *psurf)
|
||||
{
|
||||
int i;
|
||||
unsigned mask;
|
||||
|
|
|
@ -33,7 +33,7 @@ extern void R_ClipAndDrawPoly( float alpha, qboolean isturbulent, qboolean textu
|
|||
** mapped polygon
|
||||
*/
|
||||
void
|
||||
R_DrawSprite (void)
|
||||
R_DrawSprite(entity_t *currententity)
|
||||
{
|
||||
vec5_t *pverts;
|
||||
vec3_t left, up, right, down;
|
||||
|
|
|
@ -50,7 +50,7 @@ Returns the proper texture for a given time and base texture
|
|||
===============
|
||||
*/
|
||||
static image_t *
|
||||
R_TextureAnimation (mtexinfo_t *tex)
|
||||
R_TextureAnimation (const entity_t *currententity, mtexinfo_t *tex)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
@ -344,14 +344,14 @@ D_CacheSurface
|
|||
================
|
||||
*/
|
||||
surfcache_t *
|
||||
D_CacheSurface (msurface_t *surface, int miplevel)
|
||||
D_CacheSurface (const entity_t *currententity, msurface_t *surface, int miplevel)
|
||||
{
|
||||
surfcache_t *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[1] = r_newrefdef.lightstyles[surface->styles[1]].white*128;
|
||||
r_drawsurf.lightadj[2] = r_newrefdef.lightstyles[surface->styles[2]].white*128;
|
||||
|
|
Loading…
Reference in a new issue