mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-25 22:10:59 +00:00
Use local currentmodel
This commit is contained in:
parent
0ff5dc804d
commit
c30cffd1ed
8 changed files with 48 additions and 50 deletions
|
@ -446,7 +446,6 @@ extern mplane_t screenedge[4];
|
|||
extern vec3_t r_origin;
|
||||
|
||||
extern entity_t r_worldentity;
|
||||
extern model_t *currentmodel;
|
||||
extern vec3_t modelorg;
|
||||
extern vec3_t r_entorigin;
|
||||
|
||||
|
@ -463,20 +462,19 @@ extern qboolean insubmodel;
|
|||
|
||||
void R_DrawAlphaSurfaces(const entity_t *currententity);
|
||||
|
||||
void R_DrawSprite(entity_t *currententity);
|
||||
void R_DrawSprite(entity_t *currententity, const model_t *currentmodel);
|
||||
|
||||
void R_RenderFace(entity_t *currententity, msurface_t *fa, int clipflags);
|
||||
void R_RenderFace(entity_t *currententity, const model_t *currentmodel, msurface_t *fa, int clipflags);
|
||||
void R_RenderBmodelFace(entity_t *currententity, bedge_t *pedges, msurface_t *psurf);
|
||||
void R_TransformFrustum(void);
|
||||
|
||||
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_DrawSubmodelPolygons(entity_t *currententity, const model_t *currentmodel, int clipflags, mnode_t *topnode);
|
||||
void R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *currentmodel, mnode_t *topnode);
|
||||
|
||||
void R_AliasDrawModel(entity_t *currententity);
|
||||
void R_AliasDrawModel(entity_t *currententity, const model_t *currentmodel);
|
||||
void R_BeginEdgeFrame(void);
|
||||
void R_ScanEdges(surf_t *surface);
|
||||
void R_PushDlights(const model_t *model);
|
||||
|
||||
void R_RotateBmodel(const entity_t *currententity);
|
||||
|
||||
extern int c_faceclip;
|
||||
|
|
|
@ -482,7 +482,7 @@ R_AliasSetupSkin
|
|||
===============
|
||||
*/
|
||||
static qboolean
|
||||
R_AliasSetupSkin(const entity_t *currententity)
|
||||
R_AliasSetupSkin(const entity_t *currententity, const model_t *currentmodel)
|
||||
{
|
||||
image_t *pskindesc;
|
||||
|
||||
|
@ -616,7 +616,7 @@ R_AliasSetupFrames
|
|||
=================
|
||||
*/
|
||||
static void
|
||||
R_AliasSetupFrames(const entity_t *currententity, dmdl_t *pmdl)
|
||||
R_AliasSetupFrames(const entity_t *currententity, const model_t *currentmodel, dmdl_t *pmdl)
|
||||
{
|
||||
int thisframe = currententity->frame;
|
||||
int lastframe = currententity->oldframe;
|
||||
|
@ -701,7 +701,7 @@ R_AliasDrawModel
|
|||
================
|
||||
*/
|
||||
void
|
||||
R_AliasDrawModel(entity_t *currententity)
|
||||
R_AliasDrawModel(entity_t *currententity, const model_t *currentmodel)
|
||||
{
|
||||
s_pmdl = (dmdl_t *)currentmodel->extradata;
|
||||
|
||||
|
@ -730,7 +730,7 @@ R_AliasDrawModel(entity_t *currententity)
|
|||
** we have to set our frame pointers and transformations before
|
||||
** doing any real work
|
||||
*/
|
||||
R_AliasSetupFrames(currententity, s_pmdl);
|
||||
R_AliasSetupFrames(currententity, currentmodel, s_pmdl);
|
||||
R_AliasSetUpTransform(currententity);
|
||||
|
||||
// see if the bounding box lets us trivially reject, also sets
|
||||
|
@ -746,7 +746,7 @@ R_AliasDrawModel(entity_t *currententity)
|
|||
}
|
||||
|
||||
// set up the skin and verify it exists
|
||||
if ( !R_AliasSetupSkin(currententity) )
|
||||
if ( !R_AliasSetupSkin(currententity, currentmodel) )
|
||||
{
|
||||
R_Printf( PRINT_ALL, "R_AliasDrawModel %s: NULL skin found\n",
|
||||
currentmodel->name);
|
||||
|
|
|
@ -338,7 +338,7 @@ Bmodel crosses multiple leafs
|
|||
================
|
||||
*/
|
||||
void
|
||||
R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *pmodel, mnode_t *topnode)
|
||||
R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *currentmodel, mnode_t *topnode)
|
||||
{
|
||||
int i, j, lindex;
|
||||
vec_t dot;
|
||||
|
@ -348,9 +348,9 @@ R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *pmode
|
|||
medge_t *pedge, *pedges;
|
||||
|
||||
// FIXME: use bounding-box-based frustum clipping info?
|
||||
psurf = &pmodel->surfaces[pmodel->firstmodelsurface];
|
||||
numsurfaces = pmodel->nummodelsurfaces;
|
||||
pedges = pmodel->edges;
|
||||
psurf = ¤tmodel->surfaces[currentmodel->firstmodelsurface];
|
||||
numsurfaces = currentmodel->nummodelsurfaces;
|
||||
pedges = currentmodel->edges;
|
||||
|
||||
for (i=0 ; i<numsurfaces ; i++, psurf++)
|
||||
{
|
||||
|
@ -380,7 +380,7 @@ R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *pmode
|
|||
|
||||
for (j=0 ; j<psurf->numedges ; j++)
|
||||
{
|
||||
lindex = pmodel->surfedges[psurf->firstedge+j];
|
||||
lindex = currentmodel->surfedges[psurf->firstedge+j];
|
||||
|
||||
if (lindex > 0)
|
||||
{
|
||||
|
@ -417,7 +417,7 @@ All in one leaf
|
|||
================
|
||||
*/
|
||||
void
|
||||
R_DrawSubmodelPolygons(entity_t *currententity, const model_t *pmodel, int clipflags, mnode_t *topnode)
|
||||
R_DrawSubmodelPolygons(entity_t *currententity, const model_t *currentmodel, int clipflags, mnode_t *topnode)
|
||||
{
|
||||
int i;
|
||||
vec_t dot;
|
||||
|
@ -425,8 +425,8 @@ R_DrawSubmodelPolygons(entity_t *currententity, const model_t *pmodel, int clipf
|
|||
int numsurfaces;
|
||||
|
||||
// FIXME: use bounding-box-based frustum clipping info?
|
||||
psurf = &pmodel->surfaces[pmodel->firstmodelsurface];
|
||||
numsurfaces = pmodel->nummodelsurfaces;
|
||||
psurf = ¤tmodel->surfaces[currentmodel->firstmodelsurface];
|
||||
numsurfaces = currentmodel->nummodelsurfaces;
|
||||
|
||||
for (i=0 ; i<numsurfaces ; i++, psurf++)
|
||||
{
|
||||
|
@ -443,7 +443,7 @@ R_DrawSubmodelPolygons(entity_t *currententity, const model_t *pmodel, int clipf
|
|||
r_currentkey = ((mleaf_t *)topnode)->key;
|
||||
|
||||
// FIXME: use bounding-box-based frustum clipping info?
|
||||
R_RenderFace(currententity, psurf, clipflags);
|
||||
R_RenderFace(currententity, currentmodel, psurf, clipflags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ R_RecursiveWorldNode
|
|||
================
|
||||
*/
|
||||
static void
|
||||
R_RecursiveWorldNode (entity_t *currententity, mnode_t *node, int clipflags)
|
||||
R_RecursiveWorldNode (entity_t *currententity, const model_t *currentmodel, mnode_t *node, int clipflags)
|
||||
{
|
||||
int c;
|
||||
vec3_t acceptpt, rejectpt;
|
||||
|
@ -570,7 +570,7 @@ R_RecursiveWorldNode (entity_t *currententity, mnode_t *node, int clipflags)
|
|||
side = 1;
|
||||
|
||||
// recurse down the children, front side first
|
||||
R_RecursiveWorldNode (currententity, node->children[side], clipflags);
|
||||
R_RecursiveWorldNode (currententity, currentmodel, node->children[side], clipflags);
|
||||
|
||||
// draw stuff
|
||||
c = node->numsurfaces;
|
||||
|
@ -588,7 +588,7 @@ R_RecursiveWorldNode (entity_t *currententity, mnode_t *node, int clipflags)
|
|||
if ((surf->flags & SURF_PLANEBACK) &&
|
||||
(surf->visframe == r_framecount))
|
||||
{
|
||||
R_RenderFace (currententity, surf, clipflags);
|
||||
R_RenderFace (currententity, currentmodel, surf, clipflags);
|
||||
}
|
||||
|
||||
surf++;
|
||||
|
@ -601,7 +601,7 @@ R_RecursiveWorldNode (entity_t *currententity, mnode_t *node, int clipflags)
|
|||
if (!(surf->flags & SURF_PLANEBACK) &&
|
||||
(surf->visframe == r_framecount))
|
||||
{
|
||||
R_RenderFace (currententity, surf, clipflags);
|
||||
R_RenderFace (currententity, currentmodel, surf, clipflags);
|
||||
}
|
||||
|
||||
surf++;
|
||||
|
@ -613,7 +613,7 @@ R_RecursiveWorldNode (entity_t *currententity, mnode_t *node, int clipflags)
|
|||
}
|
||||
|
||||
// recurse down the back side
|
||||
R_RecursiveWorldNode (currententity, node->children[!side], clipflags);
|
||||
R_RecursiveWorldNode (currententity, currentmodel, node->children[!side], clipflags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -625,6 +625,7 @@ R_RenderWorld
|
|||
void
|
||||
R_RenderWorld (void)
|
||||
{
|
||||
const model_t *currentmodel = r_worldmodel;
|
||||
|
||||
if (!r_drawworld->value)
|
||||
return;
|
||||
|
@ -637,8 +638,7 @@ R_RenderWorld (void)
|
|||
r_worldentity.frame = (int)(r_newrefdef.time*2);
|
||||
|
||||
VectorCopy (r_origin, modelorg);
|
||||
currentmodel = r_worldmodel;
|
||||
r_pcurrentvertbase = currentmodel->vertexes;
|
||||
|
||||
R_RecursiveWorldNode (&r_worldentity, currentmodel->nodes, ALIAS_XY_CLIP_MASK);
|
||||
R_RecursiveWorldNode (&r_worldentity, currentmodel, currentmodel->nodes, ALIAS_XY_CLIP_MASK);
|
||||
}
|
||||
|
|
|
@ -738,7 +738,6 @@ static msurface_t *pface;
|
|||
static surfcache_t *pcurrentcache;
|
||||
static vec3_t transformed_modelorg;
|
||||
static vec3_t world_transformed_modelorg;
|
||||
static vec3_t local_modelorg;
|
||||
|
||||
/*
|
||||
=============
|
||||
|
@ -887,6 +886,7 @@ D_TurbulentSurf(surf_t *s)
|
|||
if (s->insubmodel)
|
||||
{
|
||||
entity_t *currententity;
|
||||
vec3_t local_modelorg;
|
||||
|
||||
// FIXME: we don't want to do all this for every polygon!
|
||||
// TODO: store once at start of frame
|
||||
|
@ -979,6 +979,8 @@ D_SolidSurf (surf_t *s)
|
|||
|
||||
if (s->insubmodel)
|
||||
{
|
||||
vec3_t local_modelorg;
|
||||
|
||||
// FIXME: we don't want to do all this for every polygon!
|
||||
// TODO: store once at start of frame
|
||||
currententity = s->entity;
|
||||
|
|
|
@ -46,7 +46,6 @@ char skyname[MAX_QPATH];
|
|||
vec3_t skyaxis;
|
||||
|
||||
refdef_t r_newrefdef;
|
||||
model_t *currentmodel;
|
||||
|
||||
model_t *r_worldmodel;
|
||||
|
||||
|
@ -655,12 +654,12 @@ R_DrawEntitiesOnList (void)
|
|||
modelorg[0] = -r_origin[0];
|
||||
modelorg[1] = -r_origin[1];
|
||||
modelorg[2] = -r_origin[2];
|
||||
VectorCopy( vec3_origin, r_entorigin );
|
||||
R_DrawBeam( currententity );
|
||||
VectorCopy(vec3_origin, r_entorigin);
|
||||
R_DrawBeam(currententity);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentmodel = currententity->model;
|
||||
const model_t *currentmodel = currententity->model;
|
||||
if (!currentmodel)
|
||||
{
|
||||
R_DrawNullModel();
|
||||
|
@ -672,11 +671,11 @@ R_DrawEntitiesOnList (void)
|
|||
switch (currentmodel->type)
|
||||
{
|
||||
case mod_sprite:
|
||||
R_DrawSprite(currententity);
|
||||
R_DrawSprite(currententity, currentmodel);
|
||||
break;
|
||||
|
||||
case mod_alias:
|
||||
R_AliasDrawModel(currententity);
|
||||
R_AliasDrawModel(currententity, currentmodel);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -705,7 +704,7 @@ R_DrawEntitiesOnList (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
currentmodel = currententity->model;
|
||||
const model_t *currentmodel = currententity->model;
|
||||
if (!currentmodel)
|
||||
{
|
||||
R_DrawNullModel();
|
||||
|
@ -717,11 +716,11 @@ R_DrawEntitiesOnList (void)
|
|||
switch (currentmodel->type)
|
||||
{
|
||||
case mod_sprite:
|
||||
R_DrawSprite(currententity);
|
||||
R_DrawSprite(currententity, currentmodel);
|
||||
break;
|
||||
|
||||
case mod_alias:
|
||||
R_AliasDrawModel(currententity);
|
||||
R_AliasDrawModel(currententity, currentmodel);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -909,7 +908,7 @@ R_DrawBEntitiesOnList (void)
|
|||
for (i=0 ; i<r_newrefdef.num_entities ; i++)
|
||||
{
|
||||
entity_t *currententity = &r_newrefdef.entities[i];
|
||||
currentmodel = currententity->model;
|
||||
const model_t *currentmodel = currententity->model;
|
||||
if (!currentmodel)
|
||||
continue;
|
||||
if (currentmodel->nummodelsurfaces == 0)
|
||||
|
|
|
@ -1026,9 +1026,9 @@ R_ClipAndDrawPoly ( float alpha, int isturbulent, qboolean textured )
|
|||
** R_BuildPolygonFromSurface
|
||||
*/
|
||||
static void
|
||||
R_BuildPolygonFromSurface(const entity_t *currententity, msurface_t *fa)
|
||||
R_BuildPolygonFromSurface(const entity_t *currententity, const model_t *currentmodel, msurface_t *fa)
|
||||
{
|
||||
int i, lnumverts;
|
||||
int i, lnumverts;
|
||||
medge_t *pedges, *r_pedge;
|
||||
float *vec;
|
||||
vec5_t *pverts;
|
||||
|
@ -1213,8 +1213,7 @@ void
|
|||
R_DrawAlphaSurfaces(const entity_t *currententity)
|
||||
{
|
||||
msurface_t *s = r_alpha_surfaces;
|
||||
|
||||
currentmodel = r_worldmodel;
|
||||
const model_t *currentmodel = r_worldmodel;
|
||||
|
||||
modelorg[0] = -r_origin[0];
|
||||
modelorg[1] = -r_origin[1];
|
||||
|
@ -1222,7 +1221,7 @@ R_DrawAlphaSurfaces(const entity_t *currententity)
|
|||
|
||||
while ( s )
|
||||
{
|
||||
R_BuildPolygonFromSurface(currententity, s);
|
||||
R_BuildPolygonFromSurface(currententity, currentmodel, s);
|
||||
|
||||
//=======
|
||||
//PGM
|
||||
|
|
|
@ -163,7 +163,7 @@ R_EmitSkyBox
|
|||
================
|
||||
*/
|
||||
static void
|
||||
R_EmitSkyBox(entity_t *currententity)
|
||||
R_EmitSkyBox(entity_t *currententity, const model_t *currentmodel)
|
||||
{
|
||||
int i, j;
|
||||
int oldkey;
|
||||
|
@ -199,7 +199,7 @@ R_EmitSkyBox(entity_t *currententity)
|
|||
r_currentkey = 0x7ffffff0;
|
||||
for (i=0 ; i<6 ; i++)
|
||||
{
|
||||
R_RenderFace(currententity, r_skyfaces + i, ALIAS_XY_CLIP_MASK);
|
||||
R_RenderFace(currententity, currentmodel, r_skyfaces + i, ALIAS_XY_CLIP_MASK);
|
||||
}
|
||||
r_currentkey = oldkey; // bsp sorting order
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ R_RenderFace
|
|||
================
|
||||
*/
|
||||
void
|
||||
R_RenderFace (entity_t *currententity, msurface_t *fa, int clipflags)
|
||||
R_RenderFace (entity_t *currententity, const model_t *currentmodel, msurface_t *fa, int clipflags)
|
||||
{
|
||||
int i;
|
||||
unsigned mask;
|
||||
|
@ -541,7 +541,7 @@ R_RenderFace (entity_t *currententity, msurface_t *fa, int clipflags)
|
|||
// environment box surfaces to be emited
|
||||
if ( fa->texinfo->flags & SURF_SKY )
|
||||
{
|
||||
R_EmitSkyBox (currententity);
|
||||
R_EmitSkyBox (currententity, currentmodel);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ extern polydesc_t r_polydesc;
|
|||
|
||||
extern vec5_t r_clip_verts[2][MAXWORKINGVERTS+2];
|
||||
|
||||
extern void R_ClipAndDrawPoly( float alpha, qboolean isturbulent, qboolean textured );
|
||||
extern void R_ClipAndDrawPoly(float alpha, qboolean isturbulent, qboolean textured);
|
||||
|
||||
/*
|
||||
** R_DrawSprite
|
||||
|
@ -33,7 +33,7 @@ extern void R_ClipAndDrawPoly( float alpha, qboolean isturbulent, qboolean textu
|
|||
** mapped polygon
|
||||
*/
|
||||
void
|
||||
R_DrawSprite(entity_t *currententity)
|
||||
R_DrawSprite(entity_t *currententity, const model_t *currentmodel)
|
||||
{
|
||||
vec5_t *pverts;
|
||||
vec3_t left, up, right, down;
|
||||
|
|
Loading…
Reference in a new issue