diff --git a/libs/video/renderer/sw/d_edge.c b/libs/video/renderer/sw/d_edge.c index a69f9a7fe..38f6c7584 100644 --- a/libs/video/renderer/sw/d_edge.c +++ b/libs/video/renderer/sw/d_edge.c @@ -105,15 +105,15 @@ D_DrawSolidSurface (surf_t *surf, int color) static void -D_CalcGradients (msurface_t *pface) +D_CalcGradients (msurface_t *face) { float mipscale, t; vec3_t p_temp1, p_saxis, p_taxis; mipscale = 1.0 / (float) (1 << miplevel); - TransformVector ((vec_t*)&pface->texinfo->vecs[0], p_saxis);//FIXME - TransformVector ((vec_t*)&pface->texinfo->vecs[1], p_taxis);//FIXME + TransformVector ((vec_t*)&face->texinfo->vecs[0], p_saxis);//FIXME + TransformVector ((vec_t*)&face->texinfo->vecs[1], p_taxis);//FIXME t = xscaleinv * mipscale; d_sdivzstepu = p_saxis[0] * t; @@ -132,15 +132,15 @@ D_CalcGradients (msurface_t *pface) t = 0x10000 * mipscale; sadjust = ((fixed16_t) (DotProduct (p_temp1, p_saxis) * 0x10000 + 0.5)) - - ((pface->texturemins[0] << 16) >> miplevel) - + pface->texinfo->vecs[0][3] * t; + ((face->texturemins[0] << 16) >> miplevel) + + face->texinfo->vecs[0][3] * t; tadjust = ((fixed16_t) (DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5)) - - ((pface->texturemins[1] << 16) >> miplevel) - + pface->texinfo->vecs[1][3] * t; + ((face->texturemins[1] << 16) >> miplevel) + + face->texinfo->vecs[1][3] * t; // -1 (-epsilon) so we never wander off the edge of the texture - bbextents = ((pface->extents[0] << 16) >> miplevel) - 1; - bbextentt = ((pface->extents[1] << 16) >> miplevel) - 1; + bbextents = ((face->extents[0] << 16) >> miplevel) - 1; + bbextentt = ((face->extents[1] << 16) >> miplevel) - 1; } static void @@ -160,7 +160,7 @@ void D_DrawSurfaces (void) { surf_t *s; - msurface_t *pface; + msurface_t *face; surfcache_t *pcurrentcache; vec3_t world_transformed_modelorg; @@ -208,17 +208,17 @@ D_DrawSurfaces (void) D_DrawSolidSurface (s, r_clearcolor & 0xFF); D_DrawZSpans (s->spans); } else if (s->flags & SURF_DRAWTURB) { - pface = s->data; + face = s->data; miplevel = 0; - cacheblock = ((byte *) pface->texinfo->texture + - pface->texinfo->texture->offsets[0]); + cacheblock = ((byte *) face->texinfo->texture + + face->texinfo->texture->offsets[0]); cachewidth = 64; if (s->insubmodel) { transform_submodel_poly (s); } - D_CalcGradients (pface); + D_CalcGradients (face); Turbulent (s->spans); D_DrawZSpans (s->spans); @@ -241,17 +241,17 @@ D_DrawSurfaces (void) transform_submodel_poly (s); } - pface = s->data; + face = s->data; miplevel = D_MipLevelForScale (s->nearzi * scale_for_mip - * pface->texinfo->mipadjust); + * face->texinfo->mipadjust); // FIXME: make this passed in to D_CacheSurface - pcurrentcache = D_CacheSurface (s->render_id, pface, miplevel); + pcurrentcache = D_CacheSurface (s->render_id, face, miplevel); cacheblock = (byte *) pcurrentcache->data; cachewidth = pcurrentcache->width; - D_CalcGradients (pface); + D_CalcGradients (face); (*d_drawspans) (s->spans); diff --git a/libs/video/renderer/sw/sw_rbsp.c b/libs/video/renderer/sw/sw_rbsp.c index d7d94e36e..5f79a42a5 100644 --- a/libs/video/renderer/sw/sw_rbsp.c +++ b/libs/video/renderer/sw/sw_rbsp.c @@ -101,7 +101,7 @@ R_RotateBmodel (vec4f_t *mat) static void R_RecursiveClipBPoly (uint32_t render_id, bedge_t *pedges, mnode_t *pnode, - msurface_t *psurf) + msurface_t *surf) { bedge_t *psideedges[2], *pnextedge, *ptedge; int i, side, lastside; @@ -236,12 +236,12 @@ R_RecursiveClipBPoly (uint32_t render_id, bedge_t *pedges, mnode_t *pnode, == r_visstate.visframecount && leaf->contents != CONTENTS_SOLID) { r_currentbkey = leaf->key; - R_RenderBmodelFace (render_id, psideedges[i], psurf); + R_RenderBmodelFace (render_id, psideedges[i], surf); } } else { if (r_visstate.node_visframes[child_id] == r_visstate.visframecount) { - R_RecursiveClipBPoly (render_id, psideedges[i], pn, psurf); + R_RecursiveClipBPoly (render_id, psideedges[i], pn, surf); } } } @@ -255,7 +255,7 @@ R_DrawSolidClippedSubmodelPolygons (uint32_t render_id, mod_brush_t *brush, { int i, j, lindex; vec_t dot; - msurface_t *psurf; + msurface_t *surf; int numsurfaces; plane_t *pplane; mvertex_t bverts[MAX_BMODEL_VERTS]; @@ -264,19 +264,19 @@ R_DrawSolidClippedSubmodelPolygons (uint32_t render_id, mod_brush_t *brush, // FIXME: use bounding-box-based frustum clipping info? - psurf = &brush->surfaces[brush->firstmodelsurface]; + surf = &brush->surfaces[brush->firstmodelsurface]; numsurfaces = brush->nummodelsurfaces; pedges = brush->edges; - for (i = 0; i < numsurfaces; i++, psurf++) { + for (i = 0; i < numsurfaces; i++, surf++) { // find which side of the node we are on - pplane = psurf->plane; + pplane = surf->plane; dot = DotProduct (modelorg, pplane->normal) - pplane->dist; // draw the polygon - if (((psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) || - (!(psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON))) { + if (((surf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) || + (!(surf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON))) { // FIXME: use bounding-box-based frustum clipping info? // copy the edges to bedges, flipping if necessary so always @@ -287,12 +287,12 @@ R_DrawSolidClippedSubmodelPolygons (uint32_t render_id, mod_brush_t *brush, pbedges = bedges; numbverts = numbedges = 0; - if (psurf->numedges > 0) { + if (surf->numedges > 0) { pbedge = &bedges[numbedges]; - numbedges += psurf->numedges; + numbedges += surf->numedges; - for (j = 0; j < psurf->numedges; j++) { - lindex = brush->surfedges[psurf->firstedge + j]; + for (j = 0; j < surf->numedges; j++) { + lindex = brush->surfedges[surf->firstedge + j]; if (lindex > 0) { pedge = &pedges[lindex]; @@ -310,7 +310,7 @@ R_DrawSolidClippedSubmodelPolygons (uint32_t render_id, mod_brush_t *brush, pbedge[j - 1].pnext = NULL; // mark end of edges - R_RecursiveClipBPoly (render_id, pbedge, topnode, psurf); + R_RecursiveClipBPoly (render_id, pbedge, topnode, surf); } else { Sys_Error ("no edges in bmodel"); } @@ -325,28 +325,28 @@ R_DrawSubmodelPolygons (uint32_t render_id, mod_brush_t *brush, int clipflags, { int i; vec_t dot; - msurface_t *psurf; + msurface_t *surf; int numsurfaces; plane_t *pplane; // FIXME: use bounding-box-based frustum clipping info? - psurf = &brush->surfaces[brush->firstmodelsurface]; + surf = &brush->surfaces[brush->firstmodelsurface]; numsurfaces = brush->nummodelsurfaces; - for (i = 0; i < numsurfaces; i++, psurf++) { + for (i = 0; i < numsurfaces; i++, surf++) { // find which side of the node we are on - pplane = psurf->plane; + pplane = surf->plane; dot = DotProduct (modelorg, pplane->normal) - pplane->dist; // draw the polygon - if (((psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) || - (!(psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON))) { + if (((surf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) || + (!(surf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON))) { r_currentkey = topleaf->key; // FIXME: use bounding-box-based frustum clipping info? - R_RenderFace (render_id, psurf, clipflags); + R_RenderFace (render_id, surf, clipflags); } } } diff --git a/libs/video/renderer/sw/sw_rdraw.c b/libs/video/renderer/sw/sw_rdraw.c index 0d66bd9e0..21fe4927a 100644 --- a/libs/video/renderer/sw/sw_rdraw.c +++ b/libs/video/renderer/sw/sw_rdraw.c @@ -346,11 +346,11 @@ R_EmitCachedEdge (void) void -R_RenderFace (uint32_t render_id, msurface_t *fa, int clipflags) +R_RenderFace (uint32_t render_id, msurface_t *face, int clipflags) { int i, lindex; unsigned int mask; - plane_t *pplane; + plane_t *plane; float distinv; vec3_t p_normal; medge_t *pedges, tedge; @@ -363,8 +363,8 @@ R_RenderFace (uint32_t render_id, msurface_t *fa, int clipflags) return; } // ditto if not enough edges left, or switch to auxedges if possible - if ((edge_p + fa->numedges + 4) >= edge_max) { - r_outofedges += fa->numedges; + if ((edge_p + face->numedges + 4) >= edge_max) { + r_outofedges += face->numedges; return; } @@ -388,8 +388,8 @@ R_RenderFace (uint32_t render_id, msurface_t *fa, int clipflags) pedges = brush->edges; r_lastvertvalid = false; - for (i = 0; i < fa->numedges; i++) { - lindex = brush->surfedges[fa->firstedge + i]; + for (i = 0; i < face->numedges; i++) { + lindex = brush->surfedges[face->firstedge + i]; if (lindex > 0) { r_pedge = &pedges[lindex]; @@ -487,20 +487,20 @@ R_RenderFace (uint32_t render_id, msurface_t *fa, int clipflags) r_polycount++; - surface_p->data = (void *) fa; + surface_p->data = (void *) face; surface_p->nearzi = r_nearzi; - surface_p->flags = fa->flags; + surface_p->flags = face->flags; surface_p->insubmodel = insubmodel; surface_p->spanstate = 0; surface_p->render_id = render_id; surface_p->key = r_currentkey++; surface_p->spans = NULL; - pplane = fa->plane; + plane = face->plane; // FIXME: cache this? - TransformVector (pplane->normal, p_normal); + TransformVector (plane->normal, p_normal); // FIXME: cache this? - distinv = 1.0 / (pplane->dist - DotProduct (modelorg, pplane->normal)); + distinv = 1.0 / (plane->dist - DotProduct (modelorg, plane->normal)); surface_p->d_zistepu = p_normal[0] * xscaleinv * distinv; surface_p->d_zistepv = -p_normal[1] * yscaleinv * distinv; @@ -512,11 +512,11 @@ R_RenderFace (uint32_t render_id, msurface_t *fa, int clipflags) void -R_RenderBmodelFace (uint32_t render_id, bedge_t *pedges, msurface_t *psurf) +R_RenderBmodelFace (uint32_t render_id, bedge_t *pedges, msurface_t *surf) { int i; unsigned int mask; - plane_t *pplane; + plane_t *plane; float distinv; vec3_t p_normal; clipplane_t *pclip; @@ -527,8 +527,8 @@ R_RenderBmodelFace (uint32_t render_id, bedge_t *pedges, msurface_t *psurf) return; } // ditto if not enough edges left, or switch to auxedges if possible - if ((edge_p + psurf->numedges + 4) >= edge_max) { - r_outofedges += psurf->numedges; + if ((edge_p + surf->numedges + 4) >= edge_max) { + r_outofedges += surf->numedges; return; } @@ -586,20 +586,20 @@ R_RenderBmodelFace (uint32_t render_id, bedge_t *pedges, msurface_t *psurf) r_polycount++; - surface_p->data = (void *) psurf; + surface_p->data = (void *) surf; surface_p->nearzi = r_nearzi; - surface_p->flags = psurf->flags; + surface_p->flags = surf->flags; surface_p->insubmodel = true; surface_p->spanstate = 0; surface_p->render_id = render_id; surface_p->key = r_currentbkey; surface_p->spans = NULL; - pplane = psurf->plane; + plane = surf->plane; // FIXME: cache this? - TransformVector (pplane->normal, p_normal); + TransformVector (plane->normal, p_normal); // FIXME: cache this? - distinv = 1.0 / (pplane->dist - DotProduct (modelorg, pplane->normal)); + distinv = 1.0 / (plane->dist - DotProduct (modelorg, plane->normal)); surface_p->d_zistepu = p_normal[0] * xscaleinv * distinv; surface_p->d_zistepv = -p_normal[1] * yscaleinv * distinv; @@ -611,7 +611,7 @@ R_RenderBmodelFace (uint32_t render_id, bedge_t *pedges, msurface_t *psurf) void -R_RenderPoly (uint32_t render_id, msurface_t *fa, int clipflags) +R_RenderPoly (uint32_t render_id, msurface_t *face, int clipflags) { int i, lindex, lnumverts, s_axis, t_axis; float dist, lastdist, lzi, scale, u, v, frac; @@ -619,7 +619,7 @@ R_RenderPoly (uint32_t render_id, msurface_t *fa, int clipflags) vec3_t local, transformed; clipplane_t *pclip; medge_t *pedges; - plane_t *pplane; + plane_t *plane; mvertex_t verts[2][100]; // FIXME: do real number polyvert_t pverts[100]; // FIXME: do real number, safely int vertpage, newverts, newpage, lastvert; @@ -644,11 +644,11 @@ R_RenderPoly (uint32_t render_id, msurface_t *fa, int clipflags) // reconstruct the polygon // FIXME: these should be precalculated and loaded off disk pedges = brush->edges; - lnumverts = fa->numedges; + lnumverts = face->numedges; vertpage = 0; for (i = 0; i < lnumverts; i++) { - lindex = brush->surfedges[fa->firstedge + i]; + lindex = brush->surfedges[face->firstedge + i]; if (lindex > 0) { r_pedge = &pedges[lindex]; @@ -710,8 +710,8 @@ R_RenderPoly (uint32_t render_id, msurface_t *fa, int clipflags) // transform and project, remembering the z values at the vertices and // r_nearzi, and extract the s and t coordinates at the vertices - pplane = fa->plane; - switch (pplane->type) { + plane = face->plane; + switch (plane->type) { case PLANE_X: case PLANE_ANYX: s_axis = 1; @@ -766,11 +766,11 @@ R_RenderPoly (uint32_t render_id, msurface_t *fa, int clipflags) pverts[i].t = verts[vertpage][i].position[t_axis]; } - // build the polygon descriptor, including fa, r_nearzi, and u, v, s, t, + // build the polygon descriptor, including face, r_nearzi, and u, v, s, t, // and z for each vertex r_polydesc.numverts = lnumverts; r_polydesc.nearzi = r_nearzi; - r_polydesc.pcurrentface = fa; + r_polydesc.pcurrentface = face; r_polydesc.pverts = pverts; // draw the polygon @@ -782,24 +782,24 @@ void R_ZDrawSubmodelPolys (uint32_t render_id, mod_brush_t *brush) { int i, numsurfaces; - msurface_t *psurf; + msurface_t *surf; float dot; - plane_t *pplane; + plane_t *plane; - psurf = &brush->surfaces[brush->firstmodelsurface]; + surf = &brush->surfaces[brush->firstmodelsurface]; numsurfaces = brush->nummodelsurfaces; - for (i = 0; i < numsurfaces; i++, psurf++) { + for (i = 0; i < numsurfaces; i++, surf++) { // find which side of the node we are on - pplane = psurf->plane; + plane = surf->plane; - dot = DotProduct (modelorg, pplane->normal) - pplane->dist; + dot = DotProduct (modelorg, plane->normal) - plane->dist; // draw the polygon - if (((psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) || - (!(psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON))) { + if (((surf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) || + (!(surf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON))) { // FIXME: use bounding-box-based frustum clipping info? - R_RenderPoly (render_id, psurf, 15); + R_RenderPoly (render_id, surf, 15); } } } diff --git a/libs/video/renderer/sw/sw_redge.c b/libs/video/renderer/sw/sw_redge.c index df49f89ad..93f43632e 100644 --- a/libs/video/renderer/sw/sw_redge.c +++ b/libs/video/renderer/sw/sw_redge.c @@ -80,7 +80,6 @@ static void R_DrawCulledPolys (void) { surf_t *s; - msurface_t *pface; if (r_worldpolysbacktofront) { for (s = surface_p - 1; s > &surfaces[1]; s--) { @@ -88,8 +87,8 @@ R_DrawCulledPolys (void) continue; if (!(s->flags & SURF_DRAWBACKGROUND)) { - pface = (msurface_t *) s->data; - R_RenderPoly (s->render_id, pface, 15); + auto face = (msurface_t *) s->data; + R_RenderPoly (s->render_id, face, 15); } } } else { @@ -98,8 +97,8 @@ R_DrawCulledPolys (void) continue; if (!(s->flags & SURF_DRAWBACKGROUND)) { - pface = (msurface_t *) s->data; - R_RenderPoly (s->render_id, pface, 15); + auto face = (msurface_t *) s->data; + R_RenderPoly (s->render_id, face, 15); } } } diff --git a/libs/video/renderer/sw/sw_rsurf.c b/libs/video/renderer/sw/sw_rsurf.c index 289c63145..ec941598f 100644 --- a/libs/video/renderer/sw/sw_rsurf.c +++ b/libs/video/renderer/sw/sw_rsurf.c @@ -462,13 +462,13 @@ R_GenTurbTile (byte *pbasetex, void *pdest) } void -R_GenTile (msurface_t *psurf, void *pdest) +R_GenTile (msurface_t *surf, void *dest) { - if (psurf->flags & SURF_DRAWTURB) { - R_GenTurbTile (((byte *) psurf->texinfo->texture + - psurf->texinfo->texture->offsets[0]), pdest); - } else if (psurf->flags & SURF_DRAWSKY) { - R_GenSkyTile (pdest); + if (surf->flags & SURF_DRAWTURB) { + R_GenTurbTile (((byte *) surf->texinfo->texture + + surf->texinfo->texture->offsets[0]), dest); + } else if (surf->flags & SURF_DRAWSKY) { + R_GenSkyTile (dest); } else { Sys_Error ("Unknown tile type"); }