diff --git a/common/r_bsp.c b/common/r_bsp.c index e3a1f0a..133864a 100644 --- a/common/r_bsp.c +++ b/common/r_bsp.c @@ -537,7 +537,7 @@ R_RecursiveWorldNode(mnode_t *node, int clipflags) numbtofpolys++; } } else { - R_RenderPoly(surf, clipflags); + R_RenderPoly(currententity, surf, clipflags); } } else { R_RenderFace(currententity, surf, clipflags); @@ -558,7 +558,7 @@ R_RecursiveWorldNode(mnode_t *node, int clipflags) numbtofpolys++; } } else { - R_RenderPoly(surf, clipflags); + R_RenderPoly(currententity, surf, clipflags); } } else { R_RenderFace(currententity, surf, clipflags); @@ -602,7 +602,7 @@ R_RenderWorld(void) // in that order if (r_worldpolysbacktofront) { for (i = numbtofpolys - 1; i >= 0; i--) { - R_RenderPoly(btofpolys[i].psurf, btofpolys[i].clipflags); + R_RenderPoly(currententity, btofpolys[i].psurf, btofpolys[i].clipflags); } } } diff --git a/common/r_draw.c b/common/r_draw.c index 017f478..4eff712 100644 --- a/common/r_draw.c +++ b/common/r_draw.c @@ -633,7 +633,7 @@ R_RenderPoly ================ */ void -R_RenderPoly(msurface_t *fa, int clipflags) +R_RenderPoly(entity_t *e, msurface_t *fa, int clipflags) { int i, lindex, lnumverts, s_axis, t_axis; float dist, lastdist, lzi, scale, u, v, frac; @@ -664,12 +664,12 @@ R_RenderPoly(msurface_t *fa, int clipflags) // reconstruct the polygon // FIXME: these should be precalculated and loaded off disk - pedges = currententity->model->edges; + pedges = e->model->edges; lnumverts = fa->numedges; vertpage = 0; for (i = 0; i < lnumverts; i++) { - lindex = currententity->model->surfedges[fa->firstedge + i]; + lindex = e->model->surfedges[fa->firstedge + i]; if (lindex > 0) { r_pedge = &pedges[lindex]; @@ -825,7 +825,7 @@ R_ZDrawSubmodelPolys(model_t *pmodel) if (((psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) || (!(psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON))) { // FIXME: use bounding-box-based frustum clipping info? - R_RenderPoly(psurf, 15); + R_RenderPoly(currententity, psurf, 15); } } } diff --git a/common/r_edge.c b/common/r_edge.c index 76963d9..df0b432 100644 --- a/common/r_edge.c +++ b/common/r_edge.c @@ -93,7 +93,7 @@ R_DrawCulledPolys(void) if (!(s->flags & SURF_DRAWBACKGROUND)) { pface = (msurface_t *)s->data; - R_RenderPoly(pface, 15); + R_RenderPoly(currententity, pface, 15); } } } else { @@ -103,7 +103,7 @@ R_DrawCulledPolys(void) if (!(s->flags & SURF_DRAWBACKGROUND)) { pface = (msurface_t *)s->data; - R_RenderPoly(pface, 15); + R_RenderPoly(currententity, pface, 15); } } } diff --git a/include/r_local.h b/include/r_local.h index d23b87c..7167976 100644 --- a/include/r_local.h +++ b/include/r_local.h @@ -119,7 +119,7 @@ extern qboolean insubmodel; void R_DrawSprite(void); void R_RenderFace(entity_t *e, msurface_t *fa, int clipflags); -void R_RenderPoly(msurface_t *fa, int clipflags); +void R_RenderPoly(entity_t *e, msurface_t *fa, int clipflags); void R_RenderBmodelFace(entity_t *e, bedge_t *pedges, msurface_t *psurf); void R_TransformPlane(mplane_t *p, float *normal, float *dist); void R_TransformFrustum(void);