diff --git a/src/hardware/hw_bsp.c b/src/hardware/hw_bsp.c index dea3b2692..3d7a3dda5 100644 --- a/src/hardware/hw_bsp.c +++ b/src/hardware/hw_bsp.c @@ -70,7 +70,7 @@ static INT32 totalsubsecpolys = 0; static poly_t *HWR_AllocPoly(INT32 numpts) { poly_t *p; - size_t size = sizeof (poly_t) + sizeof (polyvertex_t) * numpts; + size_t size = sizeof(poly_t) + sizeof(polyvertex_t) * numpts; p = Z_Malloc(size, PU_HWRPLANE, NULL); p->numpts = numpts; return p; @@ -79,7 +79,7 @@ static poly_t *HWR_AllocPoly(INT32 numpts) static polyvertex_t *HWR_AllocVertex(void) { polyvertex_t *p; - size_t size = sizeof (polyvertex_t); + size_t size = sizeof(polyvertex_t); p = Z_Malloc(size, PU_HWRPLANE, NULL); return p; } diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index 36f5326a5..cc8eb4c61 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -19,7 +19,7 @@ #ifndef _HWR_DEFS_ #define _HWR_DEFS_ #include "../doomtype.h" -#include "../r_defs.h" +#include "../m_fixed.h" #define ZCLIP_PLANE 4.0f // Used for the actual game drawing #define NZCLIP_PLANE 0.9f // Seems to be only used for the HUD and screen textures diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 3bfa1f216..fc4a55dc9 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -787,8 +787,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool if (line->pv1) { - x1 = ((polyvertex_t *)line->pv1)->x; - y1 = ((polyvertex_t *)line->pv1)->y; + x1 = line->pv1->x; + y1 = line->pv1->y; } else { @@ -797,8 +797,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool if (line->pv2) { - xd = ((polyvertex_t *)line->pv2)->x - x1; - yd = ((polyvertex_t *)line->pv2)->y - y1; + xd = line->pv2->x - x1; + yd = line->pv2->y - y1; } else { @@ -868,11 +868,11 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf) M_ClearBox(segbbox); M_AddToBox(segbbox, - FloatToFixed(((polyvertex_t *)gl_curline->pv1)->x), - FloatToFixed(((polyvertex_t *)gl_curline->pv1)->y)); + FloatToFixed(gl_curline->pv1->x), + FloatToFixed(gl_curline->pv1->y)); M_AddToBox(segbbox, - FloatToFixed(((polyvertex_t *)gl_curline->pv2)->x), - FloatToFixed(((polyvertex_t *)gl_curline->pv2)->y)); + FloatToFixed(gl_curline->pv2->x), + FloatToFixed(gl_curline->pv2->y)); splat = (wallsplat_t *)gl_curline->linedef->splats; for (; splat; splat = splat->next) @@ -1369,8 +1369,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (LIKELY(gl_curline->pv1)) { - vs.x = ((polyvertex_t *)gl_curline->pv1)->x; - vs.y = ((polyvertex_t *)gl_curline->pv1)->y; + vs.x = gl_curline->pv1->x; + vs.y = gl_curline->pv1->y; v1x = FloatToFixed(vs.x); v1y = FloatToFixed(vs.y); } @@ -1384,8 +1384,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (LIKELY(gl_curline->pv2)) { - ve.x = ((polyvertex_t *)gl_curline->pv2)->x; - ve.y = ((polyvertex_t *)gl_curline->pv2)->y; + ve.x = gl_curline->pv2->x; + ve.y = gl_curline->pv2->y; v2x = FloatToFixed(ve.x); v2y = FloatToFixed(ve.y); } @@ -2248,8 +2248,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector) if (LIKELY(gl_curline->pv1)) { - v1x = FloatToFixed(((polyvertex_t *)gl_curline->pv1)->x); - v1y = FloatToFixed(((polyvertex_t *)gl_curline->pv1)->y); + v1x = FloatToFixed(gl_curline->pv1->x); + v1y = FloatToFixed(gl_curline->pv1->y); } else { @@ -2259,8 +2259,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector) if (LIKELY(gl_curline->pv2)) { - v2x = FloatToFixed(((polyvertex_t *)gl_curline->pv2)->x); - v2y = FloatToFixed(((polyvertex_t *)gl_curline->pv2)->y); + v2x = FloatToFixed(gl_curline->pv2->x); + v2y = FloatToFixed(gl_curline->pv2->y); } else { @@ -2476,8 +2476,8 @@ static void HWR_AddLine(seg_t *line) if (LIKELY(gl_curline->pv1)) { - v1x = FloatToFixed(((polyvertex_t *)gl_curline->pv1)->x); - v1y = FloatToFixed(((polyvertex_t *)gl_curline->pv1)->y); + v1x = FloatToFixed(gl_curline->pv1->x); + v1y = FloatToFixed(gl_curline->pv1->y); } else { @@ -2487,8 +2487,8 @@ static void HWR_AddLine(seg_t *line) if (LIKELY(gl_curline->pv2)) { - v2x = FloatToFixed(((polyvertex_t *)gl_curline->pv2)->x); - v2y = FloatToFixed(((polyvertex_t *)gl_curline->pv2)->y); + v2x = FloatToFixed(gl_curline->pv2->x); + v2y = FloatToFixed(gl_curline->pv2->y); } else { diff --git a/src/r_defs.h b/src/r_defs.h index 62156e3d2..abd3b6bd7 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -15,6 +15,7 @@ #define __R_DEFS__ // Some more or less basic data types we depend on. +#include "hardware/hw_defs.h" #include "m_fixed.h" // We rely on the thinker data struct to handle sound origins in sectors. @@ -545,8 +546,8 @@ typedef struct seg_s fixed_t length; // precalculated seg length #ifdef HWRENDER // new pointers so that AdjustSegs doesn't mess with v1/v2 - void *pv1; // polyvertex_t - void *pv2; // polyvertex_t + polyvertex_t *pv1; // polyvertex_t + polyvertex_t *pv2; // polyvertex_t float flength; // length of the seg, used by hardware renderer #endif