diff --git a/src/command.c b/src/command.c index f5c02d877dadb087efce2d0ecfcb825ae66acdb2..fdfc95c6dd17158156e446a88f2aae210cf31fb0 100644 --- a/src/command.c +++ b/src/command.c @@ -620,7 +620,7 @@ static void COM_ExecuteString(char *ptext) // check cvars // Hurdler: added at Ebola's request ;) - // (don't flood the console in software mode with bad gr_xxx command) + // (don't flood the console in software mode with bad gl_xxx command) if (!CV_Command() && con_destlines) CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0)); } diff --git a/src/d_main.c b/src/d_main.c index 28570b90938eaea055bc24b1b058c0ee49b13c6e..5ad46de31650b25ed08a5874363dd58de486bc15 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -599,7 +599,7 @@ static void D_Display(void) snprintf(s, sizeof s - 1, "SysMiss %.2f%%", lostpercent); V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-10, V_YELLOWMAP, s); } - + if (cv_renderstats.value) { char s[50]; @@ -608,7 +608,7 @@ static void D_Display(void) rs_prevframetime = I_GetTimeMicros(); if (rs_rendercalltime > 10000) divisor = 1000; - + snprintf(s, sizeof s - 1, "ft %d", frametime / divisor); V_DrawThinString(30, 10, V_MONOSPACE | V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "rtot %d", rs_rendercalltime / divisor); @@ -635,7 +635,7 @@ static void D_Display(void) V_DrawThinString(30, 70, V_MONOSPACE | V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "fin %d", rs_swaptime / divisor); V_DrawThinString(30, 80, V_MONOSPACE | V_YELLOWMAP, s); - if (cv_grbatching.value) + if (cv_glbatching.value) { snprintf(s, sizeof s - 1, "bsrt %d", rs_hw_batchsorttime / divisor); V_DrawThinString(80, 55, V_MONOSPACE | V_REDMAP, s); diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index 5c5379f6ddee431a9e3eb0948898a51838d3b099..492cea5fa13653163bfef64c6581ceb1b55280df 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -250,7 +250,7 @@ void HWR_RenderBatches(void) // sort polygons rs_hw_batchsorttime = I_GetTimeMicros(); - if (cv_grshaders.value && gr_shadersavailable) + if (cv_glshaders.value && gl_shadersavailable) qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygons); else qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygonsNoShaders); @@ -272,8 +272,8 @@ void HWR_RenderBatches(void) // and a color array could replace the color calls. // set state for first batch - - if (cv_grshaders.value && gr_shadersavailable) + + if (cv_glshaders.value && gl_shadersavailable) { HWD.pfnSetShader(currentShader); } @@ -355,7 +355,7 @@ void HWR_RenderBatches(void) nextSurfaceInfo = polygonArray[nextIndex].surf; if (nextPolyFlags & PF_NoTexture) nextTexture = 0; - if (currentShader != nextShader && cv_grshaders.value && gr_shadersavailable) + if (currentShader != nextShader && cv_glshaders.value && gl_shadersavailable) { changeState = true; changeShader = true; @@ -370,7 +370,7 @@ void HWR_RenderBatches(void) changeState = true; changePolyFlags = true; } - if (cv_grshaders.value && gr_shadersavailable) + if (cv_glshaders.value && gl_shadersavailable) { if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba || currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba || diff --git a/src/hardware/hw_bsp.c b/src/hardware/hw_bsp.c index 6987e9d01c6adaab73016fa8becd403b2d9a3dd7..4db69ff8b130b00eb46c403f8a47a8c86e535947 100644 --- a/src/hardware/hw_bsp.c +++ b/src/hardware/hw_bsp.c @@ -61,17 +61,17 @@ static INT32 totalsubsecpolys = 0; /// \todo check out how much is used static size_t POLYPOOLSIZE = 1024000; -static UINT8 *gr_polypool = NULL; -static UINT8 *gr_ppcurrent; -static size_t gr_ppfree; +static UINT8 *gl_polypool = NULL; +static UINT8 *gl_ppcurrent; +static size_t gl_ppfree; #endif // only between levels, clear poly pool static void HWR_ClearPolys(void) { #ifndef ZPLANALLOC - gr_ppcurrent = gr_polypool; - gr_ppfree = POLYPOOLSIZE; + gl_ppcurrent = gl_polypool; + gl_ppfree = POLYPOOLSIZE; #endif } @@ -86,8 +86,8 @@ void HWR_InitPolyPool(void) POLYPOOLSIZE = atoi(myargv[pnum+1])*1024; // (in kb) CONS_Debug(DBG_RENDER, "HWR_InitPolyPool(): allocating %d bytes\n", POLYPOOLSIZE); - gr_polypool = malloc(POLYPOOLSIZE); - if (!gr_polypool) + gl_polypool = malloc(POLYPOOLSIZE); + if (!gl_polypool) I_Error("HWR_InitPolyPool(): couldn't malloc polypool\n"); HWR_ClearPolys(); #endif @@ -96,9 +96,9 @@ void HWR_InitPolyPool(void) void HWR_FreePolyPool(void) { #ifndef ZPLANALLOC - if (gr_polypool) - free(gr_polypool); - gr_polypool = NULL; + if (gl_polypool) + free(gl_polypool); + gl_polypool = NULL; #endif } @@ -110,19 +110,19 @@ static poly_t *HWR_AllocPoly(INT32 numpts) p = Z_Malloc(size, PU_HWRPLANE, NULL); #else #ifdef PARANOIA - if (!gr_polypool) - I_Error("Used gr_polypool without init!\n"); - if (!gr_ppcurrent) - I_Error("gr_ppcurrent == NULL!\n"); + if (!gl_polypool) + I_Error("Used gl_polypool without init!\n"); + if (!gl_ppcurrent) + I_Error("gl_ppcurrent == NULL!\n"); #endif - if (gr_ppfree < size) + if (gl_ppfree < size) I_Error("HWR_AllocPoly(): no more memory %u bytes left, %u bytes needed\n\n%s\n", - gr_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)"); + gl_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)"); - p = (poly_t *)gr_ppcurrent; - gr_ppcurrent += size; - gr_ppfree -= size; + p = (poly_t *)gl_ppcurrent; + gl_ppcurrent += size; + gl_ppfree -= size; #endif p->numpts = numpts; return p; @@ -135,13 +135,13 @@ static polyvertex_t *HWR_AllocVertex(void) #ifdef ZPLANALLOC p = Z_Malloc(size, PU_HWRPLANE, NULL); #else - if (gr_ppfree < size) + if (gl_ppfree < size) I_Error("HWR_AllocVertex(): no more memory %u bytes left, %u bytes needed\n\n%s\n", - gr_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)"); + gl_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)"); - p = (polyvertex_t *)gr_ppcurrent; - gr_ppcurrent += size; - gr_ppfree -= size; + p = (polyvertex_t *)gl_ppcurrent; + gl_ppcurrent += size; + gl_ppfree -= size; #endif return p; } @@ -829,7 +829,7 @@ static INT32 SolveTProblem(void) INT32 i; size_t l; - if (cv_grsolvetjoin.value == 0) + if (cv_glsolvetjoin.value == 0) return 0; CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n"); @@ -983,9 +983,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum) I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors)); // allocate table for back to front drawing of subsectors - /*gr_drawsubsectors = (INT16 *)malloc(sizeof (*gr_drawsubsectors) * totsubsectors); - if (!gr_drawsubsectors) - I_Error("couldn't malloc gr_drawsubsectors\n");*/ + /*gl_drawsubsectors = (INT16 *)malloc(sizeof (*gl_drawsubsectors) * totsubsectors); + if (!gl_drawsubsectors) + I_Error("couldn't malloc gl_drawsubsectors\n");*/ // number of the first new subsector that might be added addsubsector = numsubsectors; diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 0b3169147a247231728f76027692fedc40c80a14..79610cbd0c1e75af84654e770d090690c7b21eee 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -598,14 +598,14 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm // CACHING HANDLING // ================================================= -static size_t gr_numtextures = 0; // Texture count -static GLMapTexture_t *gr_textures; // For all textures -static GLMapTexture_t *gr_flats; // For all (texture) flats, as normal flats don't need to be cached +static size_t gl_numtextures = 0; // Texture count +static GLMapTexture_t *gl_textures; // For all textures +static GLMapTexture_t *gl_flats; // For all (texture) flats, as normal flats don't need to be cached void HWR_InitTextureCache(void) { - gr_textures = NULL; - gr_flats = NULL; + gl_textures = NULL; + gl_flats = NULL; } // Callback function for HWR_FreeTextureCache. @@ -673,13 +673,13 @@ void HWR_FreeTextureCache(void) // now the heap don't have any 'user' pointing to our // texturecache info, we can free it - if (gr_textures) - free(gr_textures); - if (gr_flats) - free(gr_flats); - gr_textures = NULL; - gr_flats = NULL; - gr_numtextures = 0; + if (gl_textures) + free(gl_textures); + if (gl_flats) + free(gl_flats); + gl_textures = NULL; + gl_flats = NULL; + gl_numtextures = 0; } void HWR_LoadTextures(size_t pnumtextures) @@ -688,13 +688,13 @@ void HWR_LoadTextures(size_t pnumtextures) HWR_FreeTextureCache(); // Why not Z_Malloc? - gr_numtextures = pnumtextures; - gr_textures = calloc(gr_numtextures, sizeof(*gr_textures)); - gr_flats = calloc(gr_numtextures, sizeof(*gr_flats)); + gl_numtextures = pnumtextures; + gl_textures = calloc(gl_numtextures, sizeof(*gl_textures)); + gl_flats = calloc(gl_numtextures, sizeof(*gl_flats)); // Doesn't tell you which it _is_, but hopefully // should never ever happen (right?!) - if ((gr_textures == NULL) || (gr_flats == NULL)) + if ((gl_textures == NULL) || (gl_flats == NULL)) I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!"); } @@ -718,13 +718,13 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex) { GLMapTexture_t *grtex; #ifdef PARANOIA - if ((unsigned)tex >= gr_numtextures) + if ((unsigned)tex >= gl_numtextures) I_Error("HWR_GetTexture: tex >= numtextures\n"); #endif // Every texture in memory, stored in the // hardware renderer's bit depth format. Wow! - grtex = &gr_textures[tex]; + grtex = &gl_textures[tex]; // Generate texture if missing from the cache if (!grtex->mipmap.data && !grtex->mipmap.downloaded) @@ -836,7 +836,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat) GLMapTexture_t *grtex; INT32 texturenum = levelflat->u.texture.num; #ifdef PARANOIA - if ((unsigned)texturenum >= gr_numtextures) + if ((unsigned)texturenum >= gl_numtextures) I_Error("HWR_GetLevelFlat: texturenum >= numtextures\n"); #endif @@ -845,7 +845,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat) return; // Every texture in memory, stored as a 8-bit flat. Wow! - grtex = &gr_flats[texturenum]; + grtex = &gl_flats[texturenum]; // Generate flat if missing from the cache if (!grtex->mipmap.data && !grtex->mipmap.downloaded) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 3d20cd9b077ea9e0fe06328f00f9385a5da6b244..f5a984d5d3a23ed3bd80d4d7e690bcba8d42422c 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -936,17 +936,17 @@ void HWR_DrawViewBorder(INT32 clearlines) INT32 basewindowx, basewindowy; GLPatch_t *patch; -// if (gr_viewwidth == vid.width) +// if (gl_viewwidth == vid.width) // return; if (!clearlines) clearlines = BASEVIDHEIGHT; // refresh all // calc view size based on original game resolution - baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7; - baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewheight), vid.fdupy)); - top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowy), vid.fdupy)); - side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwindowx), vid.fdupx)); + baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7; + baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdupy)); + top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdupy)); + side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwindowx), vid.fdupx)); // top HWR_DrawFlatFill(0, 0, diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 8e3760fd151dd12a35de8e89d8567e0991192d98..57f3c54d90df34847d0770b4e2d3a8e0c523db3f 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -59,7 +59,7 @@ typedef struct // needed for sprite rendering // equivalent of the software renderer's vissprites -typedef struct gr_vissprite_s +typedef struct gl_vissprite_s { float x1, x2; float tz, ty; @@ -74,7 +74,7 @@ typedef struct gr_vissprite_s UINT8 *colormap; INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing float z1, z2; -} gr_vissprite_t; +} gl_vissprite_t; // -------- // hw_bsp.c diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 4005510162093c2612ae81a058316136606fa6d7..32c2d550d4355b02b039bb2a8ee708b9afd17c51 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -821,7 +821,7 @@ void HWR_WallLighting(FOutVector *wlVerts) { int i, j; - // dynlights->nb == 0 if cv_grdynamiclighting.value is not set + // dynlights->nb == 0 if cv_gldynamiclighting.value is not set for (j = 0; j < dynlights->nb; j++) { FVector inter; @@ -970,7 +970,7 @@ static lumpnum_t coronalumpnum = LUMPERROR; // -------------------------------------------------------------------------- // coronas lighting // -------------------------------------------------------------------------- -void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr) +void HWR_DoCoronasLighting(FOutVector *outVerts, gl_vissprite_t *spr) { light_t *p_lspr; @@ -985,7 +985,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr) p_lspr = &lspr[ROCKETEXP_L]; } - if (cv_grcoronas.value && (p_lspr->type & CORONA_SPR)) + if (cv_glcoronas.value && (p_lspr->type & CORONA_SPR)) { // it's an object which emits light FOutVector light[4]; FSurfaceInfo Surf; @@ -1010,7 +1010,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr) } if (size > p_lspr->corona_radius) size = p_lspr->corona_radius; - size *= FIXED_TO_FLOAT(cv_grcoronasize.value<<1); + size *= FIXED_TO_FLOAT(cv_glcoronasize.value<<1); // compute position doing average for (i = 0; i < 4; i++) @@ -1067,7 +1067,7 @@ void HWR_DrawCoronas(void) { int j; - if (!cv_grcoronas.value || dynlights->nb <= 0 || coronalumpnum == LUMPERROR) + if (!cv_glcoronas.value || dynlights->nb <= 0 || coronalumpnum == LUMPERROR) return; HWR_GetPic(coronalumpnum); /// \todo use different coronas @@ -1121,7 +1121,7 @@ void HWR_DrawCoronas(void) } if (size > p_lspr->corona_radius) size = p_lspr->corona_radius; - size = (float)(FIXED_TO_FLOAT(cv_grcoronasize.value<<1)*size); + size = (float)(FIXED_TO_FLOAT(cv_glcoronasize.value<<1)*size); // put light little forward the sprite so there is no // z-buffer problem (coplanar polygons) @@ -1170,13 +1170,13 @@ void HWR_SetLights(int viewnumber) // Add a light for dynamic lighting // The light position is already transformed execpt for mlook // -------------------------------------------------------------------------- -void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch) +void HWR_DL_AddLight(gl_vissprite_t *spr, GLPatch_t *patch) { light_t *p_lspr; //Hurdler: moved here because it's better;-) (void)patch; - if (!cv_grdynamiclighting.value) + if (!cv_gldynamiclighting.value) return; if (!spr->mobj) @@ -1193,7 +1193,7 @@ void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch) p_lspr = t_lspr[spr->mobj->sprite]; if (!(p_lspr->type & DYNLIGHT_SPR)) return; - if ((p_lspr->type != LIGHT_SPR) || cv_grstaticlighting.value) + if ((p_lspr->type != LIGHT_SPR) || cv_glstaticlighting.value) return; LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(spr->mobj->x); @@ -1265,8 +1265,8 @@ static void HWR_SetLight(void) #ifdef STATICLIGHT // is this really necessary? -static sector_t *lgr_backsector; -static seg_t *lgr_curline; +static sector_t *lgl_backsector; +static seg_t *lgl_curline; #endif // p1 et p2 c'est le deux bou du seg en float @@ -1304,27 +1304,27 @@ static void HWR_AddLightMapForLine(int lightnum, seg_t *line) */ FVector p1,p2; - lgr_curline = line; - lgr_backsector = line->backsector; + lgl_curline = line; + lgl_backsector = line->backsector; // Reject empty lines used for triggers and special events. // Identical floor and ceiling on both sides, // identical light levels on both sides, // and no middle texture. /* - if ( lgr_backsector->ceilingpic == gr_frontsector->ceilingpic - && lgr_backsector->floorpic == gr_frontsector->floorpic - && lgr_backsector->lightlevel == gr_frontsector->lightlevel - && lgr_curline->sidedef->midtexture == 0) + if ( lgl_backsector->ceilingpic == gl_frontsector->ceilingpic + && lgl_backsector->floorpic == gl_frontsector->floorpic + && lgl_backsector->lightlevel == gl_frontsector->lightlevel + && lgl_curline->sidedef->midtexture == 0) { return; } */ - p1.y = FIXED_TO_FLOAT(lgr_curline->v1->y); - p1.x = FIXED_TO_FLOAT(lgr_curline->v1->x); - p2.y = FIXED_TO_FLOAT(lgr_curline->v2->y); - p2.x = FIXED_TO_FLOAT(lgr_curline->v2->x); + p1.y = FIXED_TO_FLOAT(lgl_curline->v1->y); + p1.x = FIXED_TO_FLOAT(lgl_curline->v1->x); + p2.y = FIXED_TO_FLOAT(lgl_curline->v2->y); + p2.x = FIXED_TO_FLOAT(lgl_curline->v2->x); // check bbox of the seg // if (CircleTouchBBox(&p1, &p2, &LIGHT_POS(lightnum), DL_RADIUS(lightnum))==false) diff --git a/src/hardware/hw_light.h b/src/hardware/hw_light.h index 3b12f9c8715e5de6acfca21b3e7953b1030af88a..fed7db47f2a67e6b81f82bfe2e97048594ce43be 100644 --- a/src/hardware/hw_light.h +++ b/src/hardware/hw_light.h @@ -24,7 +24,7 @@ #define DL_MAX_LIGHT 256 // maximum number of lights (extra lights are ignored) void HWR_InitLight(void); -void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch); +void HWR_DL_AddLight(gl_vissprite_t *spr, GLPatch_t *patch); void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts); void HWR_WallLighting(FOutVector *wlVerts); void HWR_ResetLights(void); @@ -33,7 +33,7 @@ void HWR_SetLights(int viewnumber); #ifdef NEWCORONAS void HWR_DrawCoronas(void); #else -void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr); +void HWR_DoCoronasLighting(FOutVector *outVerts, gl_vissprite_t *spr); #endif typedef struct diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index ab6d487366e07ed62617b01d8faf483e26c7f792..db9dfdda791cd4c9cecba61c15bd6dc456405fe8 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -77,18 +77,18 @@ boolean drawsky = true; #define FIELDOFVIEW ANGLE_90 #define ABS(x) ((x) < 0 ? -(x) : (x)) -static angle_t gr_clipangle; +static angle_t gl_clipangle; // The viewangletox[viewangle + FINEANGLES/4] lookup // maps the visible view angles to screen X coordinates, // flattening the arc to a flat projection plane. // There will be many angles mapped to the same X. -static INT32 gr_viewangletox[FINEANGLES/2]; +static INT32 gl_viewangletox[FINEANGLES/2]; // The xtoviewangleangle[] table maps a screen pixel // to the lowest viewangle that maps back to x ranges // from clipangle to -clipangle. -static angle_t gr_xtoviewangle[MAXVIDWIDTH+1]; +static angle_t gl_xtoviewangle[MAXVIDWIDTH+1]; // ========================================================================== // GLOBALS @@ -106,24 +106,24 @@ static angle_t gr_xtoviewangle[MAXVIDWIDTH+1]; //#define NOCRAPPYMLOOK // base values set at SetViewSize -static float gr_basecentery; +static float gl_basecentery; -float gr_baseviewwindowy, gr_basewindowcentery; -float gr_viewwidth, gr_viewheight; // viewport clipping boundaries (screen coords) -float gr_viewwindowx; +float gl_baseviewwindowy, gl_basewindowcentery; +float gl_viewwidth, gl_viewheight; // viewport clipping boundaries (screen coords) +float gl_viewwindowx; -static float gr_centerx, gr_centery; -static float gr_viewwindowy; // top left corner of view window -static float gr_windowcenterx; // center of view window, for projection -static float gr_windowcentery; +static float gl_centerx, gl_centery; +static float gl_viewwindowy; // top left corner of view window +static float gl_windowcenterx; // center of view window, for projection +static float gl_windowcentery; -static float gr_pspritexscale, gr_pspriteyscale; +static float gl_pspritexscale, gl_pspriteyscale; -static seg_t *gr_curline; -static side_t *gr_sidedef; -static line_t *gr_linedef; -static sector_t *gr_frontsector; -static sector_t *gr_backsector; +static seg_t *gl_curline; +static side_t *gl_sidedef; +static line_t *gl_linedef; +static sector_t *gl_frontsector; +static sector_t *gl_backsector; // -------------------------------------------------------------------------- // STUFF FOR THE PROJECTION CODE @@ -135,14 +135,14 @@ FTransform atransform; static fixed_t dup_viewx, dup_viewy, dup_viewz; static angle_t dup_viewangle; -static float gr_viewx, gr_viewy, gr_viewz; -static float gr_viewsin, gr_viewcos; +static float gl_viewx, gl_viewy, gl_viewz; +static float gl_viewsin, gl_viewcos; // Maybe not necessary with the new T&L code (needs to be checked!) -static float gr_viewludsin, gr_viewludcos; // look up down kik test -static float gr_fovlud; +static float gl_viewludsin, gl_viewludcos; // look up down kik test +static float gl_fovlud; -static angle_t gr_aimingangle; +static angle_t gl_aimingangle; static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean skybox); // Render stats @@ -162,7 +162,7 @@ int rs_hw_numcolors = 0; int rs_hw_batchsorttime = 0; int rs_hw_batchdrawtime = 0; -boolean gr_shadersavailable = true; +boolean gl_shadersavailable = true; // ========================================================================== @@ -178,7 +178,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col fade_color.rgba = (colormap != NULL) ? (UINT32)colormap->fadergba : GL_DEFAULTFOG; // Crappy backup coloring if you can't do shaders - if (!cv_grshaders.value || !gr_shadersavailable) + if (!cv_glshaders.value || !gl_shadersavailable) { // be careful, this may get negative for high lightlevel values. float tint_alpha, fade_alpha; @@ -229,7 +229,7 @@ UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap) // Let's see if realcolor.rgba = (colormap != NULL) ? colormap->rgba : GL_DEFAULTMIX; - if (cv_grshaders.value && gr_shadersavailable) + if (cv_glshaders.value && gl_shadersavailable) { surfcolor.s.alpha = (255 - light); } @@ -256,12 +256,12 @@ static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t { INT16 finallight = lightnum; - if (cv_grfakecontrast.value != 0) + if (cv_glfakecontrast.value != 0) { const UINT8 contrast = 8; fixed_t extralight = 0; - if (cv_grfakecontrast.value == 2) // Smooth setting + if (cv_glfakecontrast.value == 2) // Smooth setting { extralight = (-(contrast<<FRACBITS) + FixedDiv(AngleFixed(R_PointToAngle2(0, 0, @@ -295,12 +295,12 @@ static FUINT HWR_CalcSlopeLight(FUINT lightnum, angle_t dir, fixed_t delta) { INT16 finallight = lightnum; - if (cv_grfakecontrast.value != 0 && cv_grslopecontrast.value != 0) + if (cv_glfakecontrast.value != 0 && cv_glslopecontrast.value != 0) { const UINT8 contrast = 8; fixed_t extralight = 0; - if (cv_grfakecontrast.value == 2) // Smooth setting + if (cv_glfakecontrast.value == 2) // Smooth setting { fixed_t dirmul = abs(FixedDiv(AngleFixed(dir) - (180<<FRACBITS), 180<<FRACBITS)); @@ -381,10 +381,10 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool } else { - if (gr_frontsector->f_slope && !isceiling) - slope = gr_frontsector->f_slope; - else if (gr_frontsector->c_slope && isceiling) - slope = gr_frontsector->c_slope; + if (gl_frontsector->f_slope && !isceiling) + slope = gl_frontsector->f_slope; + else if (gl_frontsector->c_slope && isceiling) + slope = gl_frontsector->c_slope; } // Set fixedheight to the slope's height from our viewpoint, if we have a slope @@ -471,19 +471,19 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool angle = FOFsector->ceilingpic_angle; } } - else if (gr_frontsector) + else if (gl_frontsector) { if (!isceiling) // it's a floor { - scrollx = FIXED_TO_FLOAT(gr_frontsector->floor_xoffs)/fflatwidth; - scrolly = FIXED_TO_FLOAT(gr_frontsector->floor_yoffs)/fflatheight; - angle = gr_frontsector->floorpic_angle; + scrollx = FIXED_TO_FLOAT(gl_frontsector->floor_xoffs)/fflatwidth; + scrolly = FIXED_TO_FLOAT(gl_frontsector->floor_yoffs)/fflatheight; + angle = gl_frontsector->floorpic_angle; } else // it's a ceiling { - scrollx = FIXED_TO_FLOAT(gr_frontsector->ceiling_xoffs)/fflatwidth; - scrolly = FIXED_TO_FLOAT(gr_frontsector->ceiling_yoffs)/fflatheight; - angle = gr_frontsector->ceilingpic_angle; + scrollx = FIXED_TO_FLOAT(gl_frontsector->ceiling_xoffs)/fflatwidth; + scrolly = FIXED_TO_FLOAT(gl_frontsector->ceiling_yoffs)/fflatheight; + angle = gl_frontsector->ceilingpic_angle; } } @@ -607,9 +607,9 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool vy = y1 + yd * j / numplanes; SETUP3DVERT((&horizonpts[1]), vx, vy); - dist = sqrtf(powf(vx - gr_viewx, 2) + powf(vy - gr_viewy, 2)); - vx = (vx - gr_viewx) * renderdist / dist + gr_viewx; - vy = (vy - gr_viewy) * renderdist / dist + gr_viewy; + dist = sqrtf(powf(vx - gl_viewx, 2) + powf(vy - gl_viewy, 2)); + vx = (vx - gl_viewx) * renderdist / dist + gl_viewx; + vy = (vy - gl_viewy) * renderdist / dist + gl_viewy; SETUP3DVERT((&horizonpts[0]), vx, vy); // Right side @@ -617,21 +617,21 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool vy = y1 + yd * (j+1) / numplanes; SETUP3DVERT((&horizonpts[2]), vx, vy); - dist = sqrtf(powf(vx - gr_viewx, 2) + powf(vy - gr_viewy, 2)); - vx = (vx - gr_viewx) * renderdist / dist + gr_viewx; - vy = (vy - gr_viewy) * renderdist / dist + gr_viewy; + dist = sqrtf(powf(vx - gl_viewx, 2) + powf(vy - gl_viewy, 2)); + vx = (vx - gl_viewx) * renderdist / dist + gl_viewx; + vy = (vy - gl_viewy) * renderdist / dist + gl_viewy; SETUP3DVERT((&horizonpts[3]), vx, vy); // Horizon fills - vx = (horizonpts[0].x - gr_viewx) * farrenderdist / renderdist + gr_viewx; - vy = (horizonpts[0].z - gr_viewy) * farrenderdist / renderdist + gr_viewy; + vx = (horizonpts[0].x - gl_viewx) * farrenderdist / renderdist + gl_viewx; + vy = (horizonpts[0].z - gl_viewy) * farrenderdist / renderdist + gl_viewy; SETUP3DVERT((&horizonpts[5]), vx, vy); - horizonpts[5].y = gr_viewz; + horizonpts[5].y = gl_viewz; - vx = (horizonpts[3].x - gr_viewx) * farrenderdist / renderdist + gr_viewx; - vy = (horizonpts[3].z - gr_viewy) * farrenderdist / renderdist + gr_viewy; + vx = (horizonpts[3].x - gl_viewx) * farrenderdist / renderdist + gl_viewx; + vy = (horizonpts[3].z - gl_viewy) * farrenderdist / renderdist + gl_viewy; SETUP3DVERT((&horizonpts[4]), vx, vy); - horizonpts[4].y = gr_viewz; + horizonpts[4].y = gl_viewz; // Draw HWR_ProcessPolygon(&Surf, horizonpts, 6, PolyFlags, shader, true); @@ -712,13 +712,13 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf) M_ClearBox(segbbox); M_AddToBox(segbbox, - FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->x), - FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->y)); + FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->x), + FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->y)); M_AddToBox(segbbox, - FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->x), - FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->y)); + FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->x), + FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->y)); - splat = (wallsplat_t *)gr_curline->linedef->splats; + splat = (wallsplat_t *)gl_curline->linedef->splats; for (; splat; splat = splat->next) { //BP: don't draw splat extern to this seg @@ -799,7 +799,7 @@ static void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIEL HWR_ProcessPolygon(pSurf, wallVerts, 4, blendmode|PF_Modulated|PF_Occlude, 2, false); // wall shader #ifdef WALLSPLATS - if (gr_curline->linedef->splats && cv_splats.value) + if (gl_curline->linedef->splats && cv_splats.value) HWR_DrawSegsSplats(pSurf); #endif } @@ -817,7 +817,7 @@ static float HWR_ClipViewSegment(INT32 x, polyvertex_t *v1, polyvertex_t *v2) { float num, den; float v1x, v1y, v1dx, v1dy, v2dx, v2dy; - angle_t pclipangle = gr_xtoviewangle[x]; + angle_t pclipangle = gl_xtoviewangle[x]; // a segment of a polygon v1x = v1->x; @@ -837,7 +837,7 @@ static float HWR_ClipViewSegment(INT32 x, polyvertex_t *v1, polyvertex_t *v2) // calc the frac along the polygon segment, //num = (v2x - v1x)*v2dy + (v1y - v2y)*v2dx; //num = -v1x * v2dy + v1y * v2dx; - num = (gr_viewx - v1x)*v2dy + (v1y - gr_viewy)*v2dx; + num = (gl_viewx - v1x)*v2dy + (v1y - gl_viewy)*v2dx; return num / den; } @@ -1057,7 +1057,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom GLMapTexture_t *grTex = NULL; float cliplow = 0.0f, cliphigh = 0.0f; - INT32 gr_midtexture; + INT32 gl_midtexture; fixed_t h, l; // 3D sides and 2s middle textures fixed_t hS, lS; @@ -1065,13 +1065,13 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom extracolormap_t *colormap; FSurfaceInfo Surf; - gr_sidedef = gr_curline->sidedef; - gr_linedef = gr_curline->linedef; + gl_sidedef = gl_curline->sidedef; + gl_linedef = gl_curline->linedef; - vs.x = ((polyvertex_t *)gr_curline->pv1)->x; - vs.y = ((polyvertex_t *)gr_curline->pv1)->y; - ve.x = ((polyvertex_t *)gr_curline->pv2)->x; - ve.y = ((polyvertex_t *)gr_curline->pv2)->y; + vs.x = ((polyvertex_t *)gl_curline->pv1)->x; + vs.y = ((polyvertex_t *)gl_curline->pv1)->y; + ve.x = ((polyvertex_t *)gl_curline->pv2)->x; + ve.y = ((polyvertex_t *)gl_curline->pv2)->y; v1x = FLOAT_TO_FIXED(vs.x); v1y = FLOAT_TO_FIXED(vs.y); @@ -1082,8 +1082,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom end1 = P_GetZAt(slope, v1x, v1y, normalheight); \ end2 = P_GetZAt(slope, v2x, v2y, normalheight); - SLOPEPARAMS(gr_frontsector->c_slope, worldtop, worldtopslope, gr_frontsector->ceilingheight) - SLOPEPARAMS(gr_frontsector->f_slope, worldbottom, worldbottomslope, gr_frontsector->floorheight) + SLOPEPARAMS(gl_frontsector->c_slope, worldtop, worldtopslope, gl_frontsector->ceilingheight) + SLOPEPARAMS(gl_frontsector->f_slope, worldbottom, worldbottomslope, gl_frontsector->floorheight) // remember vertices ordering // 3--2 @@ -1099,84 +1099,84 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // x offset the texture { - fixed_t texturehpeg = gr_sidedef->textureoffset + gr_curline->offset; + fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset; cliplow = (float)texturehpeg; - cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT)); + cliphigh = (float)(texturehpeg + (gl_curline->flength*FRACUNIT)); } - lightnum = HWR_CalcWallLight(gr_frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y); - colormap = gr_frontsector->extra_colormap; + lightnum = HWR_CalcWallLight(gl_frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y); + colormap = gl_frontsector->extra_colormap; - if (gr_frontsector) + if (gl_frontsector) Surf.PolyColor.s.alpha = 255; - if (gr_backsector) + if (gl_backsector) { - INT32 gr_toptexture = 0, gr_bottomtexture = 0; + INT32 gl_toptexture = 0, gl_bottomtexture = 0; // two sided line boolean bothceilingssky = false; // turned on if both back and front ceilings are sky boolean bothfloorssky = false; // likewise, but for floors - SLOPEPARAMS(gr_backsector->c_slope, worldhigh, worldhighslope, gr_backsector->ceilingheight) - SLOPEPARAMS(gr_backsector->f_slope, worldlow, worldlowslope, gr_backsector->floorheight) + SLOPEPARAMS(gl_backsector->c_slope, worldhigh, worldhighslope, gl_backsector->ceilingheight) + SLOPEPARAMS(gl_backsector->f_slope, worldlow, worldlowslope, gl_backsector->floorheight) #undef SLOPEPARAMS // hack to allow height changes in outdoor areas // This is what gets rid of the upper textures if there should be sky - if (gr_frontsector->ceilingpic == skyflatnum - && gr_backsector->ceilingpic == skyflatnum) + if (gl_frontsector->ceilingpic == skyflatnum + && gl_backsector->ceilingpic == skyflatnum) { bothceilingssky = true; } // likewise, but for floors and upper textures - if (gr_frontsector->floorpic == skyflatnum - && gr_backsector->floorpic == skyflatnum) + if (gl_frontsector->floorpic == skyflatnum + && gl_backsector->floorpic == skyflatnum) { bothfloorssky = true; } if (!bothceilingssky) - gr_toptexture = R_GetTextureNum(gr_sidedef->toptexture); + gl_toptexture = R_GetTextureNum(gl_sidedef->toptexture); if (!bothfloorssky) - gr_bottomtexture = R_GetTextureNum(gr_sidedef->bottomtexture); + gl_bottomtexture = R_GetTextureNum(gl_sidedef->bottomtexture); // check TOP TEXTURE - if ((worldhighslope < worldtopslope || worldhigh < worldtop) && gr_toptexture) + if ((worldhighslope < worldtopslope || worldhigh < worldtop) && gl_toptexture) { { fixed_t texturevpegtop; // top - grTex = HWR_GetTexture(gr_toptexture); + grTex = HWR_GetTexture(gl_toptexture); // PEGGING - if (gr_linedef->flags & ML_DONTPEGTOP) + if (gl_linedef->flags & ML_DONTPEGTOP) texturevpegtop = 0; - else if (gr_linedef->flags & ML_EFFECT1) - texturevpegtop = worldhigh + textureheight[gr_sidedef->toptexture] - worldtop; + else if (gl_linedef->flags & ML_EFFECT1) + texturevpegtop = worldhigh + textureheight[gl_sidedef->toptexture] - worldtop; else - texturevpegtop = gr_backsector->ceilingheight + textureheight[gr_sidedef->toptexture] - gr_frontsector->ceilingheight; + texturevpegtop = gl_backsector->ceilingheight + textureheight[gl_sidedef->toptexture] - gl_frontsector->ceilingheight; - texturevpegtop += gr_sidedef->rowoffset; + texturevpegtop += gl_sidedef->rowoffset; // This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway - texturevpegtop %= SHORT(textures[gr_toptexture]->height)<<FRACBITS; + texturevpegtop %= SHORT(textures[gl_toptexture]->height)<<FRACBITS; wallVerts[3].t = wallVerts[2].t = texturevpegtop * grTex->scaleY; - wallVerts[0].t = wallVerts[1].t = (texturevpegtop + gr_frontsector->ceilingheight - gr_backsector->ceilingheight) * grTex->scaleY; + wallVerts[0].t = wallVerts[1].t = (texturevpegtop + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * grTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; // Adjust t value for sloped walls - if (!(gr_linedef->flags & ML_EFFECT1)) + if (!(gl_linedef->flags & ML_EFFECT1)) { // Unskewed - wallVerts[3].t -= (worldtop - gr_frontsector->ceilingheight) * grTex->scaleY; - wallVerts[2].t -= (worldtopslope - gr_frontsector->ceilingheight) * grTex->scaleY; - wallVerts[0].t -= (worldhigh - gr_backsector->ceilingheight) * grTex->scaleY; - wallVerts[1].t -= (worldhighslope - gr_backsector->ceilingheight) * grTex->scaleY; + wallVerts[3].t -= (worldtop - gl_frontsector->ceilingheight) * grTex->scaleY; + wallVerts[2].t -= (worldtopslope - gl_frontsector->ceilingheight) * grTex->scaleY; + wallVerts[0].t -= (worldhigh - gl_backsector->ceilingheight) * grTex->scaleY; + wallVerts[1].t -= (worldhighslope - gl_backsector->ceilingheight) * grTex->scaleY; } - else if (gr_linedef->flags & ML_DONTPEGTOP) + else if (gl_linedef->flags & ML_DONTPEGTOP) { // Skewed by top wallVerts[0].t = (texturevpegtop + worldtop - worldhigh) * grTex->scaleY; @@ -1197,10 +1197,10 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope); wallVerts[1].y = FIXED_TO_FLOAT(worldhighslope); - if (gr_frontsector->numlights) - HWR_SplitWall(gr_frontsector, wallVerts, gr_toptexture, &Surf, FF_CUTLEVEL, NULL); + if (gl_frontsector->numlights) + HWR_SplitWall(gl_frontsector, wallVerts, gl_toptexture, &Surf, FF_CUTLEVEL, NULL); else if (grTex->mipmap.flags & TF_TRANSPARENT) - HWR_AddTransparentWall(wallVerts, &Surf, gr_toptexture, PF_Environment, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, &Surf, gl_toptexture, PF_Environment, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); } @@ -1208,41 +1208,41 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // check BOTTOM TEXTURE if (( worldlowslope > worldbottomslope || - worldlow > worldbottom) && gr_bottomtexture) //only if VISIBLE!!! + worldlow > worldbottom) && gl_bottomtexture) //only if VISIBLE!!! { { fixed_t texturevpegbottom = 0; // bottom - grTex = HWR_GetTexture(gr_bottomtexture); + grTex = HWR_GetTexture(gl_bottomtexture); // PEGGING - if (!(gr_linedef->flags & ML_DONTPEGBOTTOM)) + if (!(gl_linedef->flags & ML_DONTPEGBOTTOM)) texturevpegbottom = 0; - else if (gr_linedef->flags & ML_EFFECT1) + else if (gl_linedef->flags & ML_EFFECT1) texturevpegbottom = worldbottom - worldlow; else - texturevpegbottom = gr_frontsector->floorheight - gr_backsector->floorheight; + texturevpegbottom = gl_frontsector->floorheight - gl_backsector->floorheight; - texturevpegbottom += gr_sidedef->rowoffset; + texturevpegbottom += gl_sidedef->rowoffset; // This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway - texturevpegbottom %= SHORT(textures[gr_bottomtexture]->height)<<FRACBITS; + texturevpegbottom %= SHORT(textures[gl_bottomtexture]->height)<<FRACBITS; wallVerts[3].t = wallVerts[2].t = texturevpegbottom * grTex->scaleY; - wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + gr_backsector->floorheight - gr_frontsector->floorheight) * grTex->scaleY; + wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + gl_backsector->floorheight - gl_frontsector->floorheight) * grTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; // Adjust t value for sloped walls - if (!(gr_linedef->flags & ML_EFFECT1)) + if (!(gl_linedef->flags & ML_EFFECT1)) { // Unskewed - wallVerts[0].t -= (worldbottom - gr_frontsector->floorheight) * grTex->scaleY; - wallVerts[1].t -= (worldbottomslope - gr_frontsector->floorheight) * grTex->scaleY; - wallVerts[3].t -= (worldlow - gr_backsector->floorheight) * grTex->scaleY; - wallVerts[2].t -= (worldlowslope - gr_backsector->floorheight) * grTex->scaleY; + wallVerts[0].t -= (worldbottom - gl_frontsector->floorheight) * grTex->scaleY; + wallVerts[1].t -= (worldbottomslope - gl_frontsector->floorheight) * grTex->scaleY; + wallVerts[3].t -= (worldlow - gl_backsector->floorheight) * grTex->scaleY; + wallVerts[2].t -= (worldlowslope - gl_backsector->floorheight) * grTex->scaleY; } - else if (gr_linedef->flags & ML_DONTPEGBOTTOM) + else if (gl_linedef->flags & ML_DONTPEGBOTTOM) { // Skewed by bottom wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY; @@ -1263,15 +1263,15 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[2].y = FIXED_TO_FLOAT(worldlowslope); wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); - if (gr_frontsector->numlights) - HWR_SplitWall(gr_frontsector, wallVerts, gr_bottomtexture, &Surf, FF_CUTLEVEL, NULL); + if (gl_frontsector->numlights) + HWR_SplitWall(gl_frontsector, wallVerts, gl_bottomtexture, &Surf, FF_CUTLEVEL, NULL); else if (grTex->mipmap.flags & TF_TRANSPARENT) - HWR_AddTransparentWall(wallVerts, &Surf, gr_bottomtexture, PF_Environment, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, &Surf, gl_bottomtexture, PF_Environment, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); } - gr_midtexture = R_GetTextureNum(gr_sidedef->midtexture); - if (gr_midtexture) + gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture); + if (gl_midtexture) { FBITFIELD blendmode; sector_t *front, *back; @@ -1279,19 +1279,19 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom fixed_t texturevpeg = 0; INT32 repeats; - if (gr_linedef->frontsector->heightsec != -1) - front = §ors[gr_linedef->frontsector->heightsec]; + if (gl_linedef->frontsector->heightsec != -1) + front = §ors[gl_linedef->frontsector->heightsec]; else - front = gr_linedef->frontsector; + front = gl_linedef->frontsector; - if (gr_linedef->backsector->heightsec != -1) - back = §ors[gr_linedef->backsector->heightsec]; + if (gl_linedef->backsector->heightsec != -1) + back = §ors[gl_linedef->backsector->heightsec]; else - back = gr_linedef->backsector; + back = gl_linedef->backsector; - if (gr_sidedef->repeatcnt) - repeats = 1 + gr_sidedef->repeatcnt; - else if (gr_linedef->flags & ML_EFFECT5) + if (gl_sidedef->repeatcnt) + repeats = 1 + gl_sidedef->repeatcnt; + else if (gl_linedef->flags & ML_EFFECT5) { fixed_t high, low; @@ -1305,8 +1305,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom else low = back->floorheight; - repeats = (high - low)/textureheight[gr_sidedef->midtexture]; - if ((high-low)%textureheight[gr_sidedef->midtexture]) + repeats = (high - low)/textureheight[gl_sidedef->midtexture]; + if ((high-low)%textureheight[gl_sidedef->midtexture]) repeats++; // tile an extra time to fill the gap -- Monster Iestyn } else @@ -1322,7 +1322,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // NOTE: With polyobjects, whenever you need to check the properties of the polyobject sector it belongs to, // you must use the linedef's backsector to be correct // From CB - if (gr_curline->polyseg) + if (gl_curline->polyseg) { popentop = back->ceilingheight; popenbottom = back->floorheight; @@ -1333,33 +1333,33 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom popenbottom = max(worldbottom, worldlow); } - if (gr_linedef->flags & ML_EFFECT2) + if (gl_linedef->flags & ML_EFFECT2) { - if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) { - polybottom = max(front->floorheight, back->floorheight) + gr_sidedef->rowoffset; - polytop = polybottom + textureheight[gr_midtexture]*repeats; + polybottom = max(front->floorheight, back->floorheight) + gl_sidedef->rowoffset; + polytop = polybottom + textureheight[gl_midtexture]*repeats; } else { - polytop = min(front->ceilingheight, back->ceilingheight) + gr_sidedef->rowoffset; - polybottom = polytop - textureheight[gr_midtexture]*repeats; + polytop = min(front->ceilingheight, back->ceilingheight) + gl_sidedef->rowoffset; + polybottom = polytop - textureheight[gl_midtexture]*repeats; } } - else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + else if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) { - polybottom = popenbottom + gr_sidedef->rowoffset; - polytop = polybottom + textureheight[gr_midtexture]*repeats; + polybottom = popenbottom + gl_sidedef->rowoffset; + polytop = polybottom + textureheight[gl_midtexture]*repeats; } else { - polytop = popentop + gr_sidedef->rowoffset; - polybottom = polytop - textureheight[gr_midtexture]*repeats; + polytop = popentop + gl_sidedef->rowoffset; + polybottom = polytop - textureheight[gl_midtexture]*repeats; } // CB // NOTE: With polyobjects, whenever you need to check the properties of the polyobject sector it belongs to, // you must use the linedef's backsector to be correct - if (gr_curline->polyseg) + if (gl_curline->polyseg) { lowcut = polybottom; highcut = polytop; @@ -1376,12 +1376,12 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { // PEGGING - if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) - texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom; + if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) + texturevpeg = textureheight[gl_sidedef->midtexture]*repeats - h + polybottom; else texturevpeg = polytop - h; - grTex = HWR_GetTexture(gr_midtexture); + grTex = HWR_GetTexture(gl_midtexture); wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY; wallVerts[0].t = wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY; @@ -1399,9 +1399,9 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { fixed_t midtextureslant; - if (gr_linedef->flags & ML_EFFECT2) + if (gl_linedef->flags & ML_EFFECT2) midtextureslant = 0; - else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + else if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) midtextureslant = worldlow < worldbottom ? worldbottomslope-worldbottom : worldlowslope-worldlow; @@ -1426,8 +1426,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { // PEGGING - if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) - texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom; + if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) + texturevpeg = textureheight[gl_sidedef->midtexture]*repeats - h + polybottom; else texturevpeg = polytop - h; wallVerts[2].t = texturevpeg * grTex->scaleY; @@ -1440,7 +1440,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // set alpha for transparent walls (new boom and legacy linedef types) // ooops ! this do not work at all because render order we should render it in backtofront order - switch (gr_linedef->special) + switch (gl_linedef->special) { case 900: blendmode = HWR_TranstableToAlpha(tr_trans10, &Surf); @@ -1493,39 +1493,39 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom break; } - if (gr_curline->polyseg && gr_curline->polyseg->translucency > 0) + if (gl_curline->polyseg && gl_curline->polyseg->translucency > 0) { - if (gr_curline->polyseg->translucency >= NUMTRANSMAPS) // wall not drawn + if (gl_curline->polyseg->translucency >= NUMTRANSMAPS) // wall not drawn { Surf.PolyColor.s.alpha = 0x00; // This shouldn't draw anything regardless of blendmode blendmode = PF_Masked; } else - blendmode = HWR_TranstableToAlpha(gr_curline->polyseg->translucency, &Surf); + blendmode = HWR_TranstableToAlpha(gl_curline->polyseg->translucency, &Surf); } - if (gr_frontsector->numlights) + if (gl_frontsector->numlights) { if (!(blendmode & PF_Masked)) - HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_TRANSLUCENT, NULL); + HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_TRANSLUCENT, NULL); else { - HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_CUTLEVEL, NULL); + HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_CUTLEVEL, NULL); } } else if (!(blendmode & PF_Masked)) - HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, blendmode, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, &Surf, gl_midtexture, blendmode, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap); } // Sky culling // No longer so much a mess as before! - if (!gr_curline->polyseg) // Don't do it for polyobjects + if (!gl_curline->polyseg) // Don't do it for polyobjects { - if (gr_frontsector->ceilingpic == skyflatnum) + if (gl_frontsector->ceilingpic == skyflatnum) { - if (gr_backsector->ceilingpic != skyflatnum) // don't cull if back sector is also sky + if (gl_backsector->ceilingpic != skyflatnum) // don't cull if back sector is also sky { wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(INT32_MAX); // draw to top of map space wallVerts[0].y = FIXED_TO_FLOAT(worldtop); @@ -1534,9 +1534,9 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom } } - if (gr_frontsector->floorpic == skyflatnum) + if (gl_frontsector->floorpic == skyflatnum) { - if (gr_backsector->floorpic != skyflatnum) // don't cull if back sector is also sky + if (gl_backsector->floorpic != skyflatnum) // don't cull if back sector is also sky { wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope); @@ -1549,34 +1549,34 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom else { // Single sided line... Deal only with the middletexture (if one exists) - gr_midtexture = R_GetTextureNum(gr_sidedef->midtexture); - if (gr_midtexture && gr_linedef->special != 41) // (Ignore horizon line for OGL) + gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture); + if (gl_midtexture && gl_linedef->special != 41) // (Ignore horizon line for OGL) { { fixed_t texturevpeg; // PEGGING - if ((gr_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2)) - texturevpeg = gr_frontsector->floorheight + textureheight[gr_sidedef->midtexture] - gr_frontsector->ceilingheight + gr_sidedef->rowoffset; - else if (gr_linedef->flags & ML_DONTPEGBOTTOM) - texturevpeg = worldbottom + textureheight[gr_sidedef->midtexture] - worldtop + gr_sidedef->rowoffset; + if ((gl_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2)) + texturevpeg = gl_frontsector->floorheight + textureheight[gl_sidedef->midtexture] - gl_frontsector->ceilingheight + gl_sidedef->rowoffset; + else if (gl_linedef->flags & ML_DONTPEGBOTTOM) + texturevpeg = worldbottom + textureheight[gl_sidedef->midtexture] - worldtop + gl_sidedef->rowoffset; else // top of texture at top - texturevpeg = gr_sidedef->rowoffset; + texturevpeg = gl_sidedef->rowoffset; - grTex = HWR_GetTexture(gr_midtexture); + grTex = HWR_GetTexture(gl_midtexture); wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY; - wallVerts[0].t = wallVerts[1].t = (texturevpeg + gr_frontsector->ceilingheight - gr_frontsector->floorheight) * grTex->scaleY; + wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * grTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; // Texture correction for slopes - if (gr_linedef->flags & ML_EFFECT2) { - wallVerts[3].t += (gr_frontsector->ceilingheight - worldtop) * grTex->scaleY; - wallVerts[2].t += (gr_frontsector->ceilingheight - worldtopslope) * grTex->scaleY; - wallVerts[0].t += (gr_frontsector->floorheight - worldbottom) * grTex->scaleY; - wallVerts[1].t += (gr_frontsector->floorheight - worldbottomslope) * grTex->scaleY; - } else if (gr_linedef->flags & ML_DONTPEGBOTTOM) { + if (gl_linedef->flags & ML_EFFECT2) { + wallVerts[3].t += (gl_frontsector->ceilingheight - worldtop) * grTex->scaleY; + wallVerts[2].t += (gl_frontsector->ceilingheight - worldtopslope) * grTex->scaleY; + wallVerts[0].t += (gl_frontsector->floorheight - worldbottom) * grTex->scaleY; + wallVerts[1].t += (gl_frontsector->floorheight - worldbottomslope) * grTex->scaleY; + } else if (gl_linedef->flags & ML_DONTPEGBOTTOM) { wallVerts[3].t = wallVerts[0].t + (worldbottom-worldtop) * grTex->scaleY; wallVerts[2].t = wallVerts[1].t + (worldbottomslope-worldtopslope) * grTex->scaleY; } else { @@ -1592,27 +1592,27 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); // I don't think that solid walls can use translucent linedef types... - if (gr_frontsector->numlights) - HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_CUTLEVEL, NULL); + if (gl_frontsector->numlights) + HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_CUTLEVEL, NULL); else { if (grTex->mipmap.flags & TF_TRANSPARENT) - HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, PF_Environment, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, &Surf, gl_midtexture, PF_Environment, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); } } - if (!gr_curline->polyseg) + if (!gl_curline->polyseg) { - if (gr_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector + if (gl_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector { wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(INT32_MAX); // draw to top of map space wallVerts[0].y = FIXED_TO_FLOAT(worldtop); wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope); HWR_DrawSkyWall(wallVerts, &Surf); } - if (gr_frontsector->floorpic == skyflatnum) + if (gl_frontsector->floorpic == skyflatnum) { wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope); @@ -1624,7 +1624,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom //Hurdler: 3d-floors test - if (gr_frontsector && gr_backsector && gr_frontsector->tag != gr_backsector->tag && (gr_backsector->ffloors || gr_frontsector->ffloors)) + if (gl_frontsector && gl_backsector && gl_frontsector->tag != gl_backsector->tag && (gl_backsector->ffloors || gl_frontsector->ffloors)) { ffloor_t * rover; fixed_t highcut = 0, lowcut = 0; @@ -1634,12 +1634,12 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom ///TODO add slope support (fixing cutoffs, proper wall clipping) - maybe just disable highcut/lowcut if either sector or FOF has a slope /// to allow fun plane intersecting in OGL? But then people would abuse that and make software look bad. :C - highcut = gr_frontsector->ceilingheight < gr_backsector->ceilingheight ? gr_frontsector->ceilingheight : gr_backsector->ceilingheight; - lowcut = gr_frontsector->floorheight > gr_backsector->floorheight ? gr_frontsector->floorheight : gr_backsector->floorheight; + highcut = gl_frontsector->ceilingheight < gl_backsector->ceilingheight ? gl_frontsector->ceilingheight : gl_backsector->ceilingheight; + lowcut = gl_frontsector->floorheight > gl_backsector->floorheight ? gl_frontsector->floorheight : gl_backsector->floorheight; - if (gr_backsector->ffloors) + if (gl_backsector->ffloors) { - for (rover = gr_backsector->ffloors; rover; rover = rover->next) + for (rover = gl_backsector->ffloors; rover; rover = rover->next) { if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES)) continue; @@ -1652,7 +1652,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (rover->master->flags & ML_TFERLINE) { - size_t linenum = gr_curline->linedef-gr_backsector->lines[0]; + size_t linenum = gl_curline->linedef-gl_backsector->lines[0]; newline = rover->master->frontsector->lines[0] + linenum; texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } @@ -1661,9 +1661,9 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom hS = P_GetFFloorTopZAt (rover, v2x, v2y); l = P_GetFFloorBottomZAt(rover, v1x, v1y); lS = P_GetFFloorBottomZAt(rover, v2x, v2y); - if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut) + if (!(*rover->t_slope) && !gl_frontsector->c_slope && !gl_backsector->c_slope && h > highcut) h = hS = highcut; - if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut) + if (!(*rover->b_slope) && !gl_frontsector->f_slope && !gl_backsector->f_slope && l < lowcut) l = lS = lowcut; //Hurdler: HW code starts here //FIXME: check if peging is correct @@ -1698,7 +1698,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom else { texturevpeg = sides[rover->master->sidenum[0]].rowoffset; - attachtobottom = !!(gr_linedef->flags & ML_DONTPEGBOTTOM); + attachtobottom = !!(gl_linedef->flags & ML_DONTPEGBOTTOM); slopeskew = !!(rover->master->flags & ML_DONTPEGTOP); } @@ -1743,8 +1743,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); - if (gr_frontsector->numlights) - HWR_SplitWall(gr_frontsector, wallVerts, 0, &Surf, rover->flags, rover); + if (gl_frontsector->numlights) + HWR_SplitWall(gl_frontsector, wallVerts, 0, &Surf, rover->flags, rover); else HWR_AddTransparentWall(wallVerts, &Surf, 0, blendmode, true, lightnum, colormap); } @@ -1758,8 +1758,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1; } - if (gr_frontsector->numlights) - HWR_SplitWall(gr_frontsector, wallVerts, texnum, &Surf, rover->flags, rover); + if (gl_frontsector->numlights) + HWR_SplitWall(gl_frontsector, wallVerts, texnum, &Surf, rover->flags, rover); else { if (blendmode != PF_Masked) @@ -1771,9 +1771,9 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom } } - if (gr_frontsector->ffloors) // Putting this seperate should allow 2 FOF sectors to be connected without too many errors? I think? + if (gl_frontsector->ffloors) // Putting this seperate should allow 2 FOF sectors to be connected without too many errors? I think? { - for (rover = gr_frontsector->ffloors; rover; rover = rover->next) + for (rover = gl_frontsector->ffloors; rover; rover = rover->next) { if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES)) continue; @@ -1786,7 +1786,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (rover->master->flags & ML_TFERLINE) { - size_t linenum = gr_curline->linedef-gr_backsector->lines[0]; + size_t linenum = gl_curline->linedef-gl_backsector->lines[0]; newline = rover->master->frontsector->lines[0] + linenum; texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } @@ -1794,9 +1794,9 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom hS = P_GetFFloorTopZAt (rover, v2x, v2y); l = P_GetFFloorBottomZAt(rover, v1x, v1y); lS = P_GetFFloorBottomZAt(rover, v2x, v2y); - if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut) + if (!(*rover->t_slope) && !gl_frontsector->c_slope && !gl_backsector->c_slope && h > highcut) h = hS = highcut; - if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut) + if (!(*rover->b_slope) && !gl_frontsector->f_slope && !gl_backsector->f_slope && l < lowcut) l = lS = lowcut; //Hurdler: HW code starts here //FIXME: check if peging is correct @@ -1843,8 +1843,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); - if (gr_backsector->numlights) - HWR_SplitWall(gr_backsector, wallVerts, 0, &Surf, rover->flags, rover); + if (gl_backsector->numlights) + HWR_SplitWall(gl_backsector, wallVerts, 0, &Surf, rover->flags, rover); else HWR_AddTransparentWall(wallVerts, &Surf, 0, blendmode, true, lightnum, colormap); } @@ -1858,8 +1858,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1; } - if (gr_backsector->numlights) - HWR_SplitWall(gr_backsector, wallVerts, texnum, &Surf, rover->flags, rover); + if (gl_backsector->numlights) + HWR_SplitWall(gl_backsector, wallVerts, texnum, &Surf, rover->flags, rover); else { if (blendmode != PF_Masked) @@ -1898,10 +1898,10 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks if (afrontsector->f_slope || afrontsector->c_slope || abacksector->f_slope || abacksector->c_slope) { fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t - v1x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->x); - v1y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->y); - v2x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->x); - v2y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->y); + v1x = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->x); + v1y = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->y); + v2x = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->x); + v2y = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->y); #define SLOPEPARAMS(slope, end1, end2, normalheight) \ end1 = P_GetZAt(slope, v1x, v1y, normalheight); \ end2 = P_GetZAt(slope, v2x, v2y, normalheight); @@ -1972,17 +1972,17 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks // hw_newend is one past the last valid seg static cliprange_t * hw_newend; -static cliprange_t gr_solidsegs[MAXSEGS]; +static cliprange_t gl_solidsegs[MAXSEGS]; // needs fix: walls are incorrectly clipped one column less -static consvar_t cv_grclipwalls = {"gr_clipwalls", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +static consvar_t cv_glclipwalls = {"gr_clipwalls", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static void printsolidsegs(void) { cliprange_t * start; if (!hw_newend) return; - for (start = gr_solidsegs;start != hw_newend;start++) + for (start = gl_solidsegs;start != hw_newend;start++) { CONS_Debug(DBG_RENDER, "%d-%d|",start->first,start->last); } @@ -2000,7 +2000,7 @@ static void HWR_ClipSolidWallSegment(INT32 first, INT32 last) // Find the first range that touches the range // (adjacent pixels are touching). - start = gr_solidsegs; + start = gl_solidsegs; while (start->last < first-1) start++; @@ -2028,14 +2028,14 @@ static void HWR_ClipSolidWallSegment(INT32 first, INT32 last) } // There is a fragment above *start. - if (!cv_grclipwalls.value) + if (!cv_glclipwalls.value) { if (!poorhack) HWR_StoreWallRange(first, last); poorhack = true; } else { - highfrac = HWR_ClipViewSegment(start->first+1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2); + highfrac = HWR_ClipViewSegment(start->first+1, (polyvertex_t *)gl_curline->pv1, (polyvertex_t *)gl_curline->pv2); HWR_StoreWallRange(0, highfrac); } // Now adjust the clip size. @@ -2052,15 +2052,15 @@ static void HWR_ClipSolidWallSegment(INT32 first, INT32 last) while (last >= (next+1)->first-1) { // There is a fragment between two posts. - if (!cv_grclipwalls.value) + if (!cv_glclipwalls.value) { if (!poorhack) HWR_StoreWallRange(first,last); poorhack = true; } else { - lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2); - highfrac = HWR_ClipViewSegment((next+1)->first+1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2); + lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gl_curline->pv1, (polyvertex_t *)gl_curline->pv2); + highfrac = HWR_ClipViewSegment((next+1)->first+1, (polyvertex_t *)gl_curline->pv1, (polyvertex_t *)gl_curline->pv2); HWR_StoreWallRange(lowfrac, highfrac); } next++; @@ -2076,7 +2076,7 @@ static void HWR_ClipSolidWallSegment(INT32 first, INT32 last) if (first == next->first+1) // 1 line texture { - if (!cv_grclipwalls.value) + if (!cv_glclipwalls.value) { if (!poorhack) HWR_StoreWallRange(first,last); poorhack = true; @@ -2087,14 +2087,14 @@ static void HWR_ClipSolidWallSegment(INT32 first, INT32 last) else { // There is a fragment after *next. - if (!cv_grclipwalls.value) + if (!cv_glclipwalls.value) { if (!poorhack) HWR_StoreWallRange(first,last); poorhack = true; } else { - lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2); + lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gl_curline->pv1, (polyvertex_t *)gl_curline->pv2); HWR_StoreWallRange(lowfrac, 1); } } @@ -2135,7 +2135,7 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last) // Find the first range that touches the range // (adjacent pixels are touching). - start = gr_solidsegs; + start = gl_solidsegs; while (start->last < first - 1) start++; @@ -2149,7 +2149,7 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last) } // There is a fragment above *start. - if (!cv_grclipwalls.value) + if (!cv_glclipwalls.value) { //20/08/99: Changed by Hurdler (taken from faB's code) if (!poorhack) HWR_StoreWallRange(0, 1); poorhack = true; @@ -2157,8 +2157,8 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last) else { highfrac = HWR_ClipViewSegment(min(start->first + 1, - start->last), (polyvertex_t *)gr_curline->pv1, - (polyvertex_t *)gr_curline->pv2); + start->last), (polyvertex_t *)gl_curline->pv1, + (polyvertex_t *)gl_curline->pv2); HWR_StoreWallRange(0, highfrac); } } @@ -2170,15 +2170,15 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last) while (last >= (start+1)->first-1) { // There is a fragment between two posts. - if (!cv_grclipwalls.value) + if (!cv_glclipwalls.value) { if (!poorhack) HWR_StoreWallRange(0, 1); poorhack = true; } else { - lowfrac = HWR_ClipViewSegment(max(start->last-1,start->first), (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2); - highfrac = HWR_ClipViewSegment(min((start+1)->first+1,(start+1)->last), (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2); + lowfrac = HWR_ClipViewSegment(max(start->last-1,start->first), (polyvertex_t *)gl_curline->pv1, (polyvertex_t *)gl_curline->pv2); + highfrac = HWR_ClipViewSegment(min((start+1)->first+1,(start+1)->last), (polyvertex_t *)gl_curline->pv1, (polyvertex_t *)gl_curline->pv2); HWR_StoreWallRange(lowfrac, highfrac); } start++; @@ -2189,7 +2189,7 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last) if (first == start->first+1) // 1 line texture { - if (!cv_grclipwalls.value) + if (!cv_glclipwalls.value) { if (!poorhack) HWR_StoreWallRange(0, 1); poorhack = true; @@ -2200,7 +2200,7 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last) else { // There is a fragment after *next. - if (!cv_grclipwalls.value) + if (!cv_glclipwalls.value) { if (!poorhack) HWR_StoreWallRange(0,1); poorhack = true; @@ -2208,8 +2208,8 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last) else { lowfrac = HWR_ClipViewSegment(max(start->last - 1, - start->first), (polyvertex_t *)gr_curline->pv1, - (polyvertex_t *)gr_curline->pv2); + start->first), (polyvertex_t *)gl_curline->pv1, + (polyvertex_t *)gl_curline->pv2); HWR_StoreWallRange(lowfrac, 1); } } @@ -2224,7 +2224,7 @@ static boolean HWR_ClipToSolidSegs(INT32 first, INT32 last) // Find the first range that touches the range // (adjacent pixels are touching). - start = gr_solidsegs; + start = gl_solidsegs; while (start->last < first-1) start++; @@ -2243,17 +2243,17 @@ static boolean HWR_ClipToSolidSegs(INT32 first, INT32 last) // static void HWR_ClearClipSegs(void) { - gr_solidsegs[0].first = -0x7fffffff; - gr_solidsegs[0].last = -1; - gr_solidsegs[1].first = vid.width; //viewwidth; - gr_solidsegs[1].last = 0x7fffffff; - hw_newend = gr_solidsegs+2; + gl_solidsegs[0].first = -0x7fffffff; + gl_solidsegs[0].last = -1; + gl_solidsegs[1].first = vid.width; //viewwidth; + gl_solidsegs[1].last = 0x7fffffff; + hw_newend = gl_solidsegs+2; } #endif // NEWCLIP // -----------------+ // HWR_AddLine : Clips the given segment and adds any visible pieces to the line list. -// Notes : gr_cursectorlight is set to the current subsector -> sector -> light value +// Notes : gl_cursectorlight is set to the current subsector -> sector -> light value // : (it may be mixed with the wall's own flat colour in the future ...) // -----------------+ static void HWR_AddLine(seg_t * line) @@ -2272,12 +2272,12 @@ static void HWR_AddLine(seg_t * line) if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) return; - gr_curline = line; + gl_curline = line; - v1x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->x); - v1y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->y); - v2x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->x); - v2y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->y); + v1x = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->x); + v1y = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->y); + v2x = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->x); + v2y = FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->y); // OPTIMIZE: quickly reject orthogonal back sides. angle1 = R_PointToAngle(v1x, v1y); @@ -2309,27 +2309,27 @@ static void HWR_AddLine(seg_t * line) angle1 -= dup_viewangle; angle2 -= dup_viewangle; - tspan = angle1 + gr_clipangle; - if (tspan > 2*gr_clipangle) + tspan = angle1 + gl_clipangle; + if (tspan > 2*gl_clipangle) { - tspan -= 2*gr_clipangle; + tspan -= 2*gl_clipangle; // Totally off the left edge? if (tspan >= span) return; - angle1 = gr_clipangle; + angle1 = gl_clipangle; } - tspan = gr_clipangle - angle2; - if (tspan > 2*gr_clipangle) + tspan = gl_clipangle - angle2; + if (tspan > 2*gl_clipangle) { - tspan -= 2*gr_clipangle; + tspan -= 2*gl_clipangle; // Totally off the left edge? if (tspan >= span) return; - angle2 = (angle_t)-(signed)gr_clipangle; + angle2 = (angle_t)-(signed)gl_clipangle; } #if 0 @@ -2337,23 +2337,23 @@ static void HWR_AddLine(seg_t * line) float fx1,fx2,fy1,fy2; //BP: test with a better projection than viewangletox[R_PointToAngle(angle)] // do not enable this at release 4 mul and 2 div - fx1 = ((polyvertex_t *)(line->pv1))->x-gr_viewx; - fy1 = ((polyvertex_t *)(line->pv1))->y-gr_viewy; - fy2 = (fx1 * gr_viewcos + fy1 * gr_viewsin); + fx1 = ((polyvertex_t *)(line->pv1))->x-gl_viewx; + fy1 = ((polyvertex_t *)(line->pv1))->y-gl_viewy; + fy2 = (fx1 * gl_viewcos + fy1 * gl_viewsin); if (fy2 < 0) // the point is back fx1 = 0; else - fx1 = gr_windowcenterx + (fx1 * gr_viewsin - fy1 * gr_viewcos) * gr_centerx / fy2; + fx1 = gl_windowcenterx + (fx1 * gl_viewsin - fy1 * gl_viewcos) * gl_centerx / fy2; - fx2 = ((polyvertex_t *)(line->pv2))->x-gr_viewx; - fy2 = ((polyvertex_t *)(line->pv2))->y-gr_viewy; - fy1 = (fx2 * gr_viewcos + fy2 * gr_viewsin); + fx2 = ((polyvertex_t *)(line->pv2))->x-gl_viewx; + fy2 = ((polyvertex_t *)(line->pv2))->y-gl_viewy; + fy1 = (fx2 * gl_viewcos + fy2 * gl_viewsin); if (fy1 < 0) // the point is back fx2 = vid.width; else - fx2 = gr_windowcenterx + (fx2 * gr_viewsin - fy2 * gr_viewcos) * gr_centerx / fy1; + fx2 = gl_windowcenterx + (fx2 * gl_viewsin - fy2 * gl_viewcos) * gl_centerx / fy1; x1 = fx1+0.5f; x2 = fx2+0.5f; @@ -2364,8 +2364,8 @@ static void HWR_AddLine(seg_t * line) angle1 = (angle1+ANGLE_90)>>ANGLETOFINESHIFT; angle2 = (angle2+ANGLE_90)>>ANGLETOFINESHIFT; - x1 = gr_viewangletox[angle1]; - x2 = gr_viewangletox[angle2]; + x1 = gl_viewangletox[angle1]; + x2 = gl_viewangletox[angle2]; #endif // Does not cross a pixel? // if (x1 == x2) @@ -2377,7 +2377,7 @@ static void HWR_AddLine(seg_t * line) */ #endif - gr_backsector = line->backsector; + gl_backsector = line->backsector; #ifdef NEWCLIP if (!line->backsector) @@ -2388,26 +2388,26 @@ static void HWR_AddLine(seg_t * line) { boolean bothceilingssky = false, bothfloorssky = false; - gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true); + gl_backsector = R_FakeFlat(gl_backsector, &tempsec, NULL, NULL, true); - if (gr_backsector->ceilingpic == skyflatnum && gr_frontsector->ceilingpic == skyflatnum) + if (gl_backsector->ceilingpic == skyflatnum && gl_frontsector->ceilingpic == skyflatnum) bothceilingssky = true; - if (gr_backsector->floorpic == skyflatnum && gr_frontsector->floorpic == skyflatnum) + if (gl_backsector->floorpic == skyflatnum && gl_frontsector->floorpic == skyflatnum) bothfloorssky = true; if (bothceilingssky && bothfloorssky) // everything's sky? let's save us a bit of time then { if (!line->polyseg && !line->sidedef->midtexture - && ((!gr_frontsector->ffloors && !gr_backsector->ffloors) - || (gr_frontsector->tag == gr_backsector->tag))) + && ((!gl_frontsector->ffloors && !gl_backsector->ffloors) + || (gl_frontsector->tag == gl_backsector->tag))) return; // line is empty, don't even bother // treat like wide open window instead HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D return; } - if (CheckClip(line, gr_frontsector, gr_backsector)) + if (CheckClip(line, gl_frontsector, gl_backsector)) { gld_clipper_SafeAddClipRange(angle2, angle1); checkforemptylines = false; @@ -2416,7 +2416,7 @@ static void HWR_AddLine(seg_t * line) // Identical floor and ceiling on both sides, // identical light levels on both sides, // and no middle texture. - if (checkforemptylines && R_IsEmptyLine(line, gr_frontsector, gr_backsector)) + if (checkforemptylines && R_IsEmptyLine(line, gl_frontsector, gl_backsector)) return; } @@ -2424,28 +2424,28 @@ static void HWR_AddLine(seg_t * line) return; #else // Single sided line? - if (!gr_backsector) + if (!gl_backsector) goto clipsolid; - gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true); + gl_backsector = R_FakeFlat(gl_backsector, &tempsec, NULL, NULL, true); - if (gr_backsector->ceilingpic == skyflatnum && gr_frontsector->ceilingpic == skyflatnum) + if (gl_backsector->ceilingpic == skyflatnum && gl_frontsector->ceilingpic == skyflatnum) bothceilingssky = true; - if (gr_backsector->floorpic == skyflatnum && gr_frontsector->floorpic == skyflatnum) + if (gl_backsector->floorpic == skyflatnum && gl_frontsector->floorpic == skyflatnum) bothfloorssky = true; if (bothceilingssky && bothfloorssky) // everything's sky? let's save us a bit of time then { if (!line->polyseg && !line->sidedef->midtexture - && ((!gr_frontsector->ffloors && !gr_backsector->ffloors) - || (gr_frontsector->tag == gr_backsector->tag))) + && ((!gl_frontsector->ffloors && !gl_backsector->ffloors) + || (gl_frontsector->tag == gl_backsector->tag))) return; // line is empty, don't even bother goto clippass; // treat like wide open window instead } - if (gr_frontsector->f_slope || gr_frontsector->c_slope || gr_backsector->f_slope || gr_backsector->c_slope) + if (gl_frontsector->f_slope || gl_frontsector->c_slope || gl_backsector->f_slope || gl_backsector->c_slope) { fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends @@ -2454,10 +2454,10 @@ static void HWR_AddLine(seg_t * line) end1 = P_GetZAt(slope, v1x, v1y, normalheight); \ end2 = P_GetZAt(slope, v2x, v2y, normalheight); - SLOPEPARAMS(gr_frontsector->f_slope, frontf1, frontf2, gr_frontsector-> floorheight) - SLOPEPARAMS(gr_frontsector->c_slope, frontc1, frontc2, gr_frontsector->ceilingheight) - SLOPEPARAMS( gr_backsector->f_slope, backf1, backf2, gr_backsector-> floorheight) - SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight) + SLOPEPARAMS(gl_frontsector->f_slope, frontf1, frontf2, gl_frontsector-> floorheight) + SLOPEPARAMS(gl_frontsector->c_slope, frontc1, frontc2, gl_frontsector->ceilingheight) + SLOPEPARAMS( gl_backsector->f_slope, backf1, backf2, gl_backsector-> floorheight) + SLOPEPARAMS( gl_backsector->c_slope, backc1, backc2, gl_backsector->ceilingheight) #undef SLOPEPARAMS // if both ceilings are skies, consider it always "open" // same for floors @@ -2472,8 +2472,8 @@ static void HWR_AddLine(seg_t * line) // Check for automap fix. if (backc1 <= backf1 && backc2 <= backf2 - && ((backc1 >= frontc1 && backc2 >= frontc2) || gr_curline->sidedef->toptexture) - && ((backf1 <= frontf1 && backf2 >= frontf2) || gr_curline->sidedef->bottomtexture)) + && ((backc1 >= frontc1 && backc2 >= frontc2) || gl_curline->sidedef->toptexture) + && ((backf1 <= frontf1 && backf2 >= frontf2) || gl_curline->sidedef->bottomtexture)) goto clipsolid; } @@ -2492,23 +2492,23 @@ static void HWR_AddLine(seg_t * line) if (!bothceilingssky && !bothfloorssky) { // Closed door. - if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || - gr_backsector->floorheight >= gr_frontsector->ceilingheight) + if (gl_backsector->ceilingheight <= gl_frontsector->floorheight || + gl_backsector->floorheight >= gl_frontsector->ceilingheight) goto clipsolid; // Check for automap fix. - if (gr_backsector->ceilingheight <= gr_backsector->floorheight - && ((gr_backsector->ceilingheight >= gr_frontsector->ceilingheight) || gr_curline->sidedef->toptexture) - && ((gr_backsector->floorheight <= gr_backsector->floorheight) || gr_curline->sidedef->bottomtexture)) + if (gl_backsector->ceilingheight <= gl_backsector->floorheight + && ((gl_backsector->ceilingheight >= gl_frontsector->ceilingheight) || gl_curline->sidedef->toptexture) + && ((gl_backsector->floorheight <= gl_backsector->floorheight) || gl_curline->sidedef->bottomtexture)) goto clipsolid; } // Window. if (!bothceilingssky) // ceilings are always the "same" when sky - if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight) + if (gl_backsector->ceilingheight != gl_frontsector->ceilingheight) goto clippass; if (!bothfloorssky) // floors are always the "same" when sky - if (gr_backsector->floorheight != gr_frontsector->floorheight) + if (gl_backsector->floorheight != gl_frontsector->floorheight) goto clippass; } @@ -2516,7 +2516,7 @@ static void HWR_AddLine(seg_t * line) // Identical floor and ceiling on both sides, // identical light levels on both sides, // and no middle texture. - if (R_IsEmptyLine(gr_curline, gr_frontsector, gr_backsector)) + if (R_IsEmptyLine(gl_curline, gl_frontsector, gl_backsector)) return; clippass: @@ -2588,28 +2588,28 @@ static boolean HWR_CheckBBox(fixed_t *bspcoord) if (span >= ANGLE_180) return true; - tspan = angle1 + gr_clipangle; + tspan = angle1 + gl_clipangle; - if (tspan > 2*gr_clipangle) + if (tspan > 2*gl_clipangle) { - tspan -= 2*gr_clipangle; + tspan -= 2*gl_clipangle; // Totally off the left edge? if (tspan >= span) return false; - angle1 = gr_clipangle; + angle1 = gl_clipangle; } - tspan = gr_clipangle - angle2; - if (tspan > 2*gr_clipangle) + tspan = gl_clipangle - angle2; + if (tspan > 2*gl_clipangle) { - tspan -= 2*gr_clipangle; + tspan -= 2*gl_clipangle; // Totally off the left edge? if (tspan >= span) return false; - angle2 = (angle_t)-(signed)gr_clipangle; + angle2 = (angle_t)-(signed)gl_clipangle; } // Find the first clippost @@ -2617,8 +2617,8 @@ static boolean HWR_CheckBBox(fixed_t *bspcoord) // (adjacent pixels are touching). angle1 = (angle1+ANGLE_90)>>ANGLETOFINESHIFT; angle2 = (angle2+ANGLE_90)>>ANGLETOFINESHIFT; - sx1 = gr_viewangletox[angle1]; - sx2 = gr_viewangletox[angle2]; + sx1 = gl_viewangletox[angle1]; + sx2 = gl_viewangletox[angle2]; // Does not cross a pixel. if (sx1 == sx2) @@ -2638,7 +2638,7 @@ static boolean HWR_CheckBBox(fixed_t *bspcoord) static inline void HWR_AddPolyObjectSegs(void) { size_t i, j; - seg_t *gr_fakeline = Z_Calloc(sizeof(seg_t), PU_STATIC, NULL); + seg_t *gl_fakeline = Z_Calloc(sizeof(seg_t), PU_STATIC, NULL); polyvertex_t *pv1 = Z_Calloc(sizeof(polyvertex_t), PU_STATIC, NULL); polyvertex_t *pv2 = Z_Calloc(sizeof(polyvertex_t), PU_STATIC, NULL); @@ -2649,25 +2649,25 @@ static inline void HWR_AddPolyObjectSegs(void) for (j = 0; j < po_ptrs[i]->segCount; ++j) { // Copy the info of a polyobject's seg, then convert it to OpenGL floating point - M_Memcpy(gr_fakeline, po_ptrs[i]->segs[j], sizeof(seg_t)); + M_Memcpy(gl_fakeline, po_ptrs[i]->segs[j], sizeof(seg_t)); // Now convert the line to float and add it to be rendered - pv1->x = FIXED_TO_FLOAT(gr_fakeline->v1->x); - pv1->y = FIXED_TO_FLOAT(gr_fakeline->v1->y); - pv2->x = FIXED_TO_FLOAT(gr_fakeline->v2->x); - pv2->y = FIXED_TO_FLOAT(gr_fakeline->v2->y); + pv1->x = FIXED_TO_FLOAT(gl_fakeline->v1->x); + pv1->y = FIXED_TO_FLOAT(gl_fakeline->v1->y); + pv2->x = FIXED_TO_FLOAT(gl_fakeline->v2->x); + pv2->y = FIXED_TO_FLOAT(gl_fakeline->v2->y); - gr_fakeline->pv1 = pv1; - gr_fakeline->pv2 = pv2; + gl_fakeline->pv1 = pv1; + gl_fakeline->pv2 = pv2; - HWR_AddLine(gr_fakeline); + HWR_AddLine(gl_fakeline); } } // Free temporary data no longer needed Z_Free(pv2); Z_Free(pv1); - Z_Free(gr_fakeline); + Z_Free(gl_fakeline); } static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, @@ -2778,19 +2778,19 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT; } } - else if (gr_frontsector) + else if (gl_frontsector) { if (!isceiling) // it's a floor { - scrollx = FIXED_TO_FLOAT(gr_frontsector->floor_xoffs)/fflatwidth; - scrolly = FIXED_TO_FLOAT(gr_frontsector->floor_yoffs)/fflatheight; - angle = gr_frontsector->floorpic_angle>>ANGLETOFINESHIFT; + scrollx = FIXED_TO_FLOAT(gl_frontsector->floor_xoffs)/fflatwidth; + scrolly = FIXED_TO_FLOAT(gl_frontsector->floor_yoffs)/fflatheight; + angle = gl_frontsector->floorpic_angle>>ANGLETOFINESHIFT; } else // it's a ceiling { - scrollx = FIXED_TO_FLOAT(gr_frontsector->ceiling_xoffs)/fflatwidth; - scrolly = FIXED_TO_FLOAT(gr_frontsector->ceiling_yoffs)/fflatheight; - angle = gr_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT; + scrollx = FIXED_TO_FLOAT(gl_frontsector->ceiling_xoffs)/fflatwidth; + scrolly = FIXED_TO_FLOAT(gl_frontsector->ceiling_yoffs)/fflatheight; + angle = gl_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT; } } @@ -2874,11 +2874,11 @@ static void HWR_AddPolyObjectPlanes(void) if (po_ptrs[i]->translucency >= NUMTRANSMAPS) continue; - if (polyobjsector->floorheight <= gr_frontsector->ceilingheight - && polyobjsector->floorheight >= gr_frontsector->floorheight + if (polyobjsector->floorheight <= gl_frontsector->ceilingheight + && polyobjsector->floorheight >= gl_frontsector->floorheight && (viewz < polyobjsector->floorheight)) { - light = R_GetPlaneLight(gr_frontsector, polyobjsector->floorheight, true); + light = R_GetPlaneLight(gl_frontsector, polyobjsector->floorheight, true); if (po_ptrs[i]->translucency > 0) { FSurfaceInfo Surf; @@ -2886,22 +2886,22 @@ static void HWR_AddPolyObjectPlanes(void) memset(&Surf, 0x00, sizeof(Surf)); blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf); HWR_AddTransparentPolyobjectFloor(&levelflats[polyobjsector->floorpic], po_ptrs[i], false, polyobjsector->floorheight, - (light == -1 ? gr_frontsector->lightlevel : *gr_frontsector->lightlist[light].lightlevel), Surf.PolyColor.s.alpha, polyobjsector, blendmode, (light == -1 ? gr_frontsector->extra_colormap : *gr_frontsector->lightlist[light].extra_colormap)); + (light == -1 ? gl_frontsector->lightlevel : *gl_frontsector->lightlist[light].lightlevel), Surf.PolyColor.s.alpha, polyobjsector, blendmode, (light == -1 ? gl_frontsector->extra_colormap : *gl_frontsector->lightlist[light].extra_colormap)); } else { HWR_GetLevelFlat(&levelflats[polyobjsector->floorpic]); HWR_RenderPolyObjectPlane(po_ptrs[i], false, polyobjsector->floorheight, PF_Occlude, - (light == -1 ? gr_frontsector->lightlevel : *gr_frontsector->lightlist[light].lightlevel), &levelflats[polyobjsector->floorpic], - polyobjsector, 255, (light == -1 ? gr_frontsector->extra_colormap : *gr_frontsector->lightlist[light].extra_colormap)); + (light == -1 ? gl_frontsector->lightlevel : *gl_frontsector->lightlist[light].lightlevel), &levelflats[polyobjsector->floorpic], + polyobjsector, 255, (light == -1 ? gl_frontsector->extra_colormap : *gl_frontsector->lightlist[light].extra_colormap)); } } - if (polyobjsector->ceilingheight >= gr_frontsector->floorheight - && polyobjsector->ceilingheight <= gr_frontsector->ceilingheight + if (polyobjsector->ceilingheight >= gl_frontsector->floorheight + && polyobjsector->ceilingheight <= gl_frontsector->ceilingheight && (viewz > polyobjsector->ceilingheight)) { - light = R_GetPlaneLight(gr_frontsector, polyobjsector->ceilingheight, true); + light = R_GetPlaneLight(gl_frontsector, polyobjsector->ceilingheight, true); if (po_ptrs[i]->translucency > 0) { FSurfaceInfo Surf; @@ -2909,14 +2909,14 @@ static void HWR_AddPolyObjectPlanes(void) memset(&Surf, 0x00, sizeof(Surf)); blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf); HWR_AddTransparentPolyobjectFloor(&levelflats[polyobjsector->ceilingpic], po_ptrs[i], true, polyobjsector->ceilingheight, - (light == -1 ? gr_frontsector->lightlevel : *gr_frontsector->lightlist[light].lightlevel), Surf.PolyColor.s.alpha, polyobjsector, blendmode, (light == -1 ? gr_frontsector->extra_colormap : *gr_frontsector->lightlist[light].extra_colormap)); + (light == -1 ? gl_frontsector->lightlevel : *gl_frontsector->lightlist[light].lightlevel), Surf.PolyColor.s.alpha, polyobjsector, blendmode, (light == -1 ? gl_frontsector->extra_colormap : *gl_frontsector->lightlist[light].extra_colormap)); } else { HWR_GetLevelFlat(&levelflats[polyobjsector->ceilingpic]); HWR_RenderPolyObjectPlane(po_ptrs[i], true, polyobjsector->ceilingheight, PF_Occlude, - (light == -1 ? gr_frontsector->lightlevel : *gr_frontsector->lightlist[light].lightlevel), &levelflats[polyobjsector->ceilingpic], - polyobjsector, 255, (light == -1 ? gr_frontsector->extra_colormap : *gr_frontsector->lightlist[light].extra_colormap)); + (light == -1 ? gl_frontsector->lightlevel : *gl_frontsector->lightlist[light].lightlevel), &levelflats[polyobjsector->ceilingpic], + polyobjsector, 255, (light == -1 ? gl_frontsector->extra_colormap : *gl_frontsector->lightlist[light].extra_colormap)); } } } @@ -2926,7 +2926,7 @@ static void HWR_AddPolyObjectPlanes(void) // HWR_Subsector : Determine floor/ceiling planes. // : Add sprites of things in sector. // : Draw one or more line segments. -// Notes : Sets gr_cursectorlight to the light of the parent sector, to modulate wall textures +// Notes : Sets gl_cursectorlight to the light of the parent sector, to modulate wall textures // -----------------+ static void HWR_Subsector(size_t num) { @@ -2958,7 +2958,7 @@ static void HWR_Subsector(size_t num) // subsector sub = &subsectors[num]; // sector - gr_frontsector = sub->sector; + gl_frontsector = sub->sector; // how many linedefs count = sub->numlines; // first line seg @@ -2968,96 +2968,96 @@ static void HWR_Subsector(size_t num) { // there are no segs but only planes sub = &subsectors[0]; - gr_frontsector = sub->sector; + gl_frontsector = sub->sector; count = 0; line = NULL; } //SoM: 4/7/2000: Test to make Boom water work in Hardware mode. - gr_frontsector = R_FakeFlat(gr_frontsector, &tempsec, &floorlightlevel, + gl_frontsector = R_FakeFlat(gl_frontsector, &tempsec, &floorlightlevel, &ceilinglightlevel, false); //FIXME: Use floorlightlevel and ceilinglightlevel insted of lightlevel. - floorcolormap = ceilingcolormap = gr_frontsector->extra_colormap; + floorcolormap = ceilingcolormap = gl_frontsector->extra_colormap; // ------------------------------------------------------------------------ // sector lighting, DISABLED because it's done in HWR_StoreWallRange // ------------------------------------------------------------------------ /// \todo store a RGBA instead of just intensity, allow coloured sector lighting //light = (FUBYTE)(sub->sector->lightlevel & 0xFF) / 255.0f; - //gr_cursectorlight.red = light; - //gr_cursectorlight.green = light; - //gr_cursectorlight.blue = light; - //gr_cursectorlight.alpha = light; + //gl_cursectorlight.red = light; + //gl_cursectorlight.green = light; + //gl_cursectorlight.blue = light; + //gl_cursectorlight.alpha = light; // ----- for special tricks with HW renderer ----- - if (gr_frontsector->pseudoSector) + if (gl_frontsector->pseudoSector) { - cullFloorHeight = locFloorHeight = gr_frontsector->virtualFloorheight; - cullCeilingHeight = locCeilingHeight = gr_frontsector->virtualCeilingheight; + cullFloorHeight = locFloorHeight = gl_frontsector->virtualFloorheight; + cullCeilingHeight = locCeilingHeight = gl_frontsector->virtualCeilingheight; } - else if (gr_frontsector->virtualFloor) + else if (gl_frontsector->virtualFloor) { ///@TODO Is this whole virtualFloor mess even useful? I don't think it even triggers ever. - cullFloorHeight = locFloorHeight = gr_frontsector->virtualFloorheight; - if (gr_frontsector->virtualCeiling) - cullCeilingHeight = locCeilingHeight = gr_frontsector->virtualCeilingheight; + cullFloorHeight = locFloorHeight = gl_frontsector->virtualFloorheight; + if (gl_frontsector->virtualCeiling) + cullCeilingHeight = locCeilingHeight = gl_frontsector->virtualCeilingheight; else - cullCeilingHeight = locCeilingHeight = gr_frontsector->ceilingheight; + cullCeilingHeight = locCeilingHeight = gl_frontsector->ceilingheight; } - else if (gr_frontsector->virtualCeiling) + else if (gl_frontsector->virtualCeiling) { - cullCeilingHeight = locCeilingHeight = gr_frontsector->virtualCeilingheight; - cullFloorHeight = locFloorHeight = gr_frontsector->floorheight; + cullCeilingHeight = locCeilingHeight = gl_frontsector->virtualCeilingheight; + cullFloorHeight = locFloorHeight = gl_frontsector->floorheight; } else { - cullFloorHeight = P_GetSectorFloorZAt (gr_frontsector, viewx, viewy); - cullCeilingHeight = P_GetSectorCeilingZAt(gr_frontsector, viewx, viewy); - locFloorHeight = P_GetSectorFloorZAt (gr_frontsector, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); - locCeilingHeight = P_GetSectorCeilingZAt(gr_frontsector, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); + cullFloorHeight = P_GetSectorFloorZAt (gl_frontsector, viewx, viewy); + cullCeilingHeight = P_GetSectorCeilingZAt(gl_frontsector, viewx, viewy); + locFloorHeight = P_GetSectorFloorZAt (gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y); + locCeilingHeight = P_GetSectorCeilingZAt(gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y); } // ----- end special tricks ----- - if (gr_frontsector->ffloors) + if (gl_frontsector->ffloors) { - if (gr_frontsector->moved) + if (gl_frontsector->moved) { - gr_frontsector->numlights = sub->sector->numlights = 0; - R_Prep3DFloors(gr_frontsector); - sub->sector->lightlist = gr_frontsector->lightlist; - sub->sector->numlights = gr_frontsector->numlights; - sub->sector->moved = gr_frontsector->moved = false; + gl_frontsector->numlights = sub->sector->numlights = 0; + R_Prep3DFloors(gl_frontsector); + sub->sector->lightlist = gl_frontsector->lightlist; + sub->sector->numlights = gl_frontsector->numlights; + sub->sector->moved = gl_frontsector->moved = false; } - light = R_GetPlaneLight(gr_frontsector, locFloorHeight, false); - if (gr_frontsector->floorlightsec == -1) - floorlightlevel = *gr_frontsector->lightlist[light].lightlevel; - floorcolormap = *gr_frontsector->lightlist[light].extra_colormap; + light = R_GetPlaneLight(gl_frontsector, locFloorHeight, false); + if (gl_frontsector->floorlightsec == -1) + floorlightlevel = *gl_frontsector->lightlist[light].lightlevel; + floorcolormap = *gl_frontsector->lightlist[light].extra_colormap; - light = R_GetPlaneLight(gr_frontsector, locCeilingHeight, false); - if (gr_frontsector->ceilinglightsec == -1) - ceilinglightlevel = *gr_frontsector->lightlist[light].lightlevel; - ceilingcolormap = *gr_frontsector->lightlist[light].extra_colormap; + light = R_GetPlaneLight(gl_frontsector, locCeilingHeight, false); + if (gl_frontsector->ceilinglightsec == -1) + ceilinglightlevel = *gl_frontsector->lightlist[light].lightlevel; + ceilingcolormap = *gl_frontsector->lightlist[light].extra_colormap; } - sub->sector->extra_colormap = gr_frontsector->extra_colormap; + sub->sector->extra_colormap = gl_frontsector->extra_colormap; // render floor ? #ifdef DOPLANES // yeah, easy backface cull! :) if (cullFloorHeight < dup_viewz) { - if (gr_frontsector->floorpic != skyflatnum) + if (gl_frontsector->floorpic != skyflatnum) { if (sub->validcount != validcount) { - HWR_GetLevelFlat(&levelflats[gr_frontsector->floorpic]); + HWR_GetLevelFlat(&levelflats[gl_frontsector->floorpic]); HWR_RenderPlane(sub, &extrasubsectors[num], false, // Hack to make things continue to work around slopes. - locFloorHeight == cullFloorHeight ? locFloorHeight : gr_frontsector->floorheight, + locFloorHeight == cullFloorHeight ? locFloorHeight : gl_frontsector->floorheight, // We now return you to your regularly scheduled rendering. - PF_Occlude, floorlightlevel, &levelflats[gr_frontsector->floorpic], NULL, 255, floorcolormap); + PF_Occlude, floorlightlevel, &levelflats[gl_frontsector->floorpic], NULL, 255, floorcolormap); } } else @@ -3070,16 +3070,16 @@ static void HWR_Subsector(size_t num) if (cullCeilingHeight > dup_viewz) { - if (gr_frontsector->ceilingpic != skyflatnum) + if (gl_frontsector->ceilingpic != skyflatnum) { if (sub->validcount != validcount) { - HWR_GetLevelFlat(&levelflats[gr_frontsector->ceilingpic]); + HWR_GetLevelFlat(&levelflats[gl_frontsector->ceilingpic]); HWR_RenderPlane(sub, &extrasubsectors[num], true, // Hack to make things continue to work around slopes. - locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gr_frontsector->ceilingheight, + locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gl_frontsector->ceilingheight, // We now return you to your regularly scheduled rendering. - PF_Occlude, ceilinglightlevel, &levelflats[gr_frontsector->ceilingpic], NULL, 255, ceilingcolormap); + PF_Occlude, ceilinglightlevel, &levelflats[gl_frontsector->ceilingpic], NULL, 255, ceilingcolormap); } } else @@ -3092,23 +3092,23 @@ static void HWR_Subsector(size_t num) #ifndef POLYSKY // Moved here because before, when above the ceiling and the floor does not have the sky flat, it doesn't draw the sky - if (gr_frontsector->ceilingpic == skyflatnum || gr_frontsector->floorpic == skyflatnum) + if (gl_frontsector->ceilingpic == skyflatnum || gl_frontsector->floorpic == skyflatnum) drawsky = true; #endif #ifdef R_FAKEFLOORS - if (gr_frontsector->ffloors) + if (gl_frontsector->ffloors) { /// \todo fix light, xoffs, yoffs, extracolormap ? ffloor_t * rover; - for (rover = gr_frontsector->ffloors; + for (rover = gl_frontsector->ffloors; rover; rover = rover->next) { fixed_t cullHeight, centerHeight; // bottom plane cullHeight = P_GetFFloorBottomZAt(rover, viewx, viewy); - centerHeight = P_GetFFloorBottomZAt(rover, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); + centerHeight = P_GetFFloorBottomZAt(rover, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y); if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES)) continue; @@ -3124,41 +3124,41 @@ static void HWR_Subsector(size_t num) { UINT8 alpha; - light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); - alpha = HWR_FogBlockAlpha(*gr_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap); + light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); + alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap); HWR_AddTransparentFloor(0, &extrasubsectors[num], false, *rover->bottomheight, - *gr_frontsector->lightlist[light].lightlevel, + *gl_frontsector->lightlist[light].lightlevel, alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, rover->master->frontsector->extra_colormap); } else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) // SoM: Flags are more efficient { - light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); + light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); HWR_AddTransparentFloor(&levelflats[*rover->bottompic], &extrasubsectors[num], false, *rover->bottomheight, - *gr_frontsector->lightlist[light].lightlevel, + *gl_frontsector->lightlist[light].lightlevel, rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent, - false, *gr_frontsector->lightlist[light].extra_colormap); + false, *gl_frontsector->lightlist[light].extra_colormap); } else { HWR_GetLevelFlat(&levelflats[*rover->bottompic]); - light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); - HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic], - rover->master->frontsector, 255, *gr_frontsector->lightlist[light].extra_colormap); + light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); + HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic], + rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap); } } // top plane cullHeight = P_GetFFloorTopZAt(rover, viewx, viewy); - centerHeight = P_GetFFloorTopZAt(rover, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); + centerHeight = P_GetFFloorTopZAt(rover, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y); if (centerHeight >= locFloorHeight && centerHeight <= locCeilingHeight && @@ -3169,35 +3169,35 @@ static void HWR_Subsector(size_t num) { UINT8 alpha; - light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); - alpha = HWR_FogBlockAlpha(*gr_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap); + light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); + alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap); HWR_AddTransparentFloor(0, &extrasubsectors[num], true, *rover->topheight, - *gr_frontsector->lightlist[light].lightlevel, + *gl_frontsector->lightlist[light].lightlevel, alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, rover->master->frontsector->extra_colormap); } else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) { - light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); + light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); HWR_AddTransparentFloor(&levelflats[*rover->toppic], &extrasubsectors[num], true, *rover->topheight, - *gr_frontsector->lightlist[light].lightlevel, + *gl_frontsector->lightlist[light].lightlevel, rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent, - false, *gr_frontsector->lightlist[light].extra_colormap); + false, *gl_frontsector->lightlist[light].extra_colormap); } else { HWR_GetLevelFlat(&levelflats[*rover->toppic]); - light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); - HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic], - rover->master->frontsector, 255, *gr_frontsector->lightlist[light].extra_colormap); + light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); + HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic], + rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap); } } } @@ -3243,11 +3243,11 @@ static void HWR_Subsector(size_t num) { // draw sprites first, coz they are clipped to the solidsegs of // subsectors more 'in front' - HWR_AddSprites(gr_frontsector); + HWR_AddSprites(gl_frontsector); //Hurdler: at this point validcount must be the same, but is not because - // gr_frontsector doesn't point anymore to sub->sector due to - // the call gr_frontsector = R_FakeFlat(...) + // gl_frontsector doesn't point anymore to sub->sector due to + // the call gl_frontsector = R_FakeFlat(...) // if it's not done, the sprite is drawn more than once, // what looks really bad with translucency or dynamic light, // without talking about the overdraw of course. @@ -3335,12 +3335,12 @@ static void HWR_RenderBSPNode(INT32 bspnum) { if (bspnum == -1) { - //*(gr_drawsubsector_p++) = 0; + //*(gl_drawsubsector_p++) = 0; HWR_Subsector(0); } else { - //*(gr_drawsubsector_p++) = bspnum&(~NF_SUBSECTOR); + //*(gl_drawsubsector_p++) = bspnum&(~NF_SUBSECTOR); HWR_Subsector(bspnum&(~NF_SUBSECTOR)); } return; @@ -3370,7 +3370,7 @@ static void HWR_RenderBSPNode(INT32 bspnum) // static void HWR_ClearDrawSubsectors(void) { - gr_drawsubsector_p = gr_drawsubsectors; + gl_drawsubsector_p = gl_drawsubsectors; } // @@ -3378,7 +3378,7 @@ static void HWR_ClearDrawSubsectors(void) // static void HWR_RenderSubsectors(void) { - while (gr_drawsubsector_p > gr_drawsubsectors) + while (gl_drawsubsector_p > gl_drawsubsectors) { HWR_RenderBSPNode( lastsubsec->nextsubsec = bspnum & (~NF_SUBSECTOR); @@ -3432,7 +3432,7 @@ void HWR_InitTextureMapping(void) else if (t > grviewwidth+1) t = grviewwidth+1; } - gr_viewangletox[i] = t; + gl_viewangletox[i] = t; } // Scan viewangletox[] to generate xtoviewangle[]: @@ -3441,32 +3441,32 @@ void HWR_InitTextureMapping(void) for (x = 0; x <= grviewwidth; x++) { i = 0; - while (gr_viewangletox[i]>x) + while (gl_viewangletox[i]>x) i++; - gr_xtoviewangle[x] = (i<<ANGLETOFINESHIFT) - ANGLE_90; + gl_xtoviewangle[x] = (i<<ANGLETOFINESHIFT) - ANGLE_90; } // Take out the fencepost cases from viewangletox. for (i = 0; i < FINEANGLES/2; i++) { - if (gr_viewangletox[i] == -1) - gr_viewangletox[i] = 0; - else if (gr_viewangletox[i] == grviewwidth+1) - gr_viewangletox[i] = grviewwidth; + if (gl_viewangletox[i] == -1) + gl_viewangletox[i] = 0; + else if (gl_viewangletox[i] == grviewwidth+1) + gl_viewangletox[i] = grviewwidth; } - gr_clipangle = gr_xtoviewangle[0]; + gl_clipangle = gl_xtoviewangle[0]; } // ========================================================================== -// gr_things.c +// gl_things.c // ========================================================================== // sprites are drawn after all wall and planes are rendered, so that // sprite translucency effects apply on the rendered view (instead of the background sky!!) -static UINT32 gr_visspritecount; -static gr_vissprite_t *gr_visspritechunks[MAXVISSPRITES >> VISSPRITECHUNKBITS] = {NULL}; +static UINT32 gl_visspritecount; +static gl_vissprite_t *gl_visspritechunks[MAXVISSPRITES >> VISSPRITECHUNKBITS] = {NULL}; // -------------------------------------------------------------------------- // HWR_ClearSprites @@ -3474,31 +3474,31 @@ static gr_vissprite_t *gr_visspritechunks[MAXVISSPRITES >> VISSPRITECHUNKBITS] = // -------------------------------------------------------------------------- static void HWR_ClearSprites(void) { - gr_visspritecount = 0; + gl_visspritecount = 0; } // -------------------------------------------------------------------------- // HWR_NewVisSprite // -------------------------------------------------------------------------- -static gr_vissprite_t gr_overflowsprite; +static gl_vissprite_t gl_overflowsprite; -static gr_vissprite_t *HWR_GetVisSprite(UINT32 num) +static gl_vissprite_t *HWR_GetVisSprite(UINT32 num) { UINT32 chunk = num >> VISSPRITECHUNKBITS; // Allocate chunk if necessary - if (!gr_visspritechunks[chunk]) - Z_Malloc(sizeof(gr_vissprite_t) * VISSPRITESPERCHUNK, PU_LEVEL, &gr_visspritechunks[chunk]); + if (!gl_visspritechunks[chunk]) + Z_Malloc(sizeof(gl_vissprite_t) * VISSPRITESPERCHUNK, PU_LEVEL, &gl_visspritechunks[chunk]); - return gr_visspritechunks[chunk] + (num & VISSPRITEINDEXMASK); + return gl_visspritechunks[chunk] + (num & VISSPRITEINDEXMASK); } -static gr_vissprite_t *HWR_NewVisSprite(void) +static gl_vissprite_t *HWR_NewVisSprite(void) { - if (gr_visspritecount == MAXVISSPRITES) - return &gr_overflowsprite; + if (gl_visspritecount == MAXVISSPRITES) + return &gl_overflowsprite; - return HWR_GetVisSprite(gr_visspritecount++); + return HWR_GetVisSprite(gl_visspritecount++); } // @@ -3561,7 +3561,7 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale) groundz = R_GetShadowZ(thing, &groundslope); - //if (abs(groundz - gr_viewz) / tz > 4) return; // Prevent stretchy shadows and possible crashes + //if (abs(groundz - gl_viewz) / tz > 4) return; // Prevent stretchy shadows and possible crashes floordiff = abs((flip < 0 ? thing->height : 0) + thing->z - groundz); @@ -3599,8 +3599,8 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale) { float oldx = shadowVerts[i].x; float oldy = shadowVerts[i].z; - shadowVerts[i].x = fx + ((oldx - fx) * gr_viewcos) - ((oldy - fy) * gr_viewsin); - shadowVerts[i].z = fy + ((oldx - fx) * gr_viewsin) + ((oldy - fy) * gr_viewcos); + shadowVerts[i].x = fx + ((oldx - fx) * gl_viewcos) - ((oldy - fy) * gl_viewsin); + shadowVerts[i].z = fy + ((oldx - fx) * gl_viewsin) + ((oldy - fy) * gl_viewcos); } if (groundslope) @@ -3643,9 +3643,9 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale) } // This is expecting a pointer to an array containing 4 wallVerts for a sprite -static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts, const boolean precip) +static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean precip) { - if (cv_grspritebillboarding.value + if (cv_glspritebillboarding.value && spr && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE) && wallVerts) { @@ -3659,24 +3659,24 @@ static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts // X, Y, AND Z need to be manipulated for the polys to rotate around the // origin, because of how the origin setting works I believe that should // be mobj->z or mobj->z + mobj->height - wallVerts[2].y = wallVerts[3].y = (spr->ty - basey) * gr_viewludsin + basey; - wallVerts[0].y = wallVerts[1].y = (lowy - basey) * gr_viewludsin + basey; + wallVerts[2].y = wallVerts[3].y = (spr->ty - basey) * gl_viewludsin + basey; + wallVerts[0].y = wallVerts[1].y = (lowy - basey) * gl_viewludsin + basey; // translate back to be around 0 before translating back - wallVerts[3].x += ((spr->ty - basey) * gr_viewludcos) * gr_viewcos; - wallVerts[2].x += ((spr->ty - basey) * gr_viewludcos) * gr_viewcos; + wallVerts[3].x += ((spr->ty - basey) * gl_viewludcos) * gl_viewcos; + wallVerts[2].x += ((spr->ty - basey) * gl_viewludcos) * gl_viewcos; - wallVerts[0].x += ((lowy - basey) * gr_viewludcos) * gr_viewcos; - wallVerts[1].x += ((lowy - basey) * gr_viewludcos) * gr_viewcos; + wallVerts[0].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos; + wallVerts[1].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos; - wallVerts[3].z += ((spr->ty - basey) * gr_viewludcos) * gr_viewsin; - wallVerts[2].z += ((spr->ty - basey) * gr_viewludcos) * gr_viewsin; + wallVerts[3].z += ((spr->ty - basey) * gl_viewludcos) * gl_viewsin; + wallVerts[2].z += ((spr->ty - basey) * gl_viewludcos) * gl_viewsin; - wallVerts[0].z += ((lowy - basey) * gr_viewludcos) * gr_viewsin; - wallVerts[1].z += ((lowy - basey) * gr_viewludcos) * gr_viewsin; + wallVerts[0].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin; + wallVerts[1].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin; } } -static void HWR_SplitSprite(gr_vissprite_t *spr) +static void HWR_SplitSprite(gl_vissprite_t *spr) { float this_scale = 1.0f; FOutVector wallVerts[4]; @@ -3755,8 +3755,8 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) // if it has a dispoffset, push it a little towards the camera if (spr->dispoffset) { - float co = -gr_viewcos*(0.05f*spr->dispoffset); - float si = -gr_viewsin*(0.05f*spr->dispoffset); + float co = -gl_viewcos*(0.05f*spr->dispoffset); + float si = -gl_viewsin*(0.05f*spr->dispoffset); baseWallVerts[0].z = baseWallVerts[3].z = baseWallVerts[0].z+si; baseWallVerts[1].z = baseWallVerts[2].z = baseWallVerts[1].z+si; baseWallVerts[0].x = baseWallVerts[3].x = baseWallVerts[0].x+co; @@ -3875,7 +3875,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) wallVerts[1].y = endbot; // The x and y only need to be adjusted in the case that it's not a papersprite - if (cv_grspritebillboarding.value + if (cv_glspritebillboarding.value && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE)) { // Get the x and z of the vertices so billboarding draws correctly @@ -3936,7 +3936,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) // : (monsters, bonuses, weapons, lights, ...) // Returns : // -----------------+ -static void HWR_DrawSprite(gr_vissprite_t *spr) +static void HWR_DrawSprite(gl_vissprite_t *spr) { float this_scale = 1.0f; FOutVector wallVerts[4]; @@ -4022,8 +4022,8 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) // if it has a dispoffset, push it a little towards the camera if (spr->dispoffset) { - float co = -gr_viewcos*(0.05f*spr->dispoffset); - float si = -gr_viewsin*(0.05f*spr->dispoffset); + float co = -gl_viewcos*(0.05f*spr->dispoffset); + float si = -gl_viewsin*(0.05f*spr->dispoffset); wallVerts[0].z = wallVerts[3].z = wallVerts[0].z+si; wallVerts[1].z = wallVerts[2].z = wallVerts[1].z+si; wallVerts[0].x = wallVerts[3].x = wallVerts[0].x+co; @@ -4079,7 +4079,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) #ifdef HWPRECIP // Sprite drawer for precipitation -static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr) +static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) { FBITFIELD blend = 0; FOutVector wallVerts[4]; @@ -4179,14 +4179,14 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr) // -------------------------------------------------------------------------- // Sort vissprites by distance // -------------------------------------------------------------------------- -gr_vissprite_t* gr_vsprorder[MAXVISSPRITES]; +gl_vissprite_t* gl_vsprorder[MAXVISSPRITES]; // Note: For more correct transparency the transparent sprites would need to be // sorted and drawn together with transparent surfaces. static int CompareVisSprites(const void *p1, const void *p2) { - gr_vissprite_t* spr1 = *(gr_vissprite_t*const*)p1; - gr_vissprite_t* spr2 = *(gr_vissprite_t*const*)p2; + gl_vissprite_t* spr1 = *(gl_vissprite_t*const*)p1; + gl_vissprite_t* spr2 = *(gl_vissprite_t*const*)p2; int idiff; float fdiff; @@ -4213,11 +4213,11 @@ static int CompareVisSprites(const void *p1, const void *p2) static void HWR_SortVisSprites(void) { UINT32 i; - for (i = 0; i < gr_visspritecount; i++) + for (i = 0; i < gl_visspritecount; i++) { - gr_vsprorder[i] = HWR_GetVisSprite(i); + gl_vsprorder[i] = HWR_GetVisSprite(i); } - qsort(gr_vsprorder, gr_visspritecount, sizeof(gr_vissprite_t*), CompareVisSprites); + qsort(gl_vsprorder, gl_visspritecount, sizeof(gl_vissprite_t*), CompareVisSprites); } // A drawnode is something that points to a 3D floor, 3D side, or masked @@ -4277,16 +4277,16 @@ static size_t numpolyplanes = 0; // a list of transparent poyobject floors to be static polyplaneinfo_t *polyplaneinfo = NULL; //Hurdler: 3D water sutffs -typedef struct gr_drawnode_s +typedef struct gl_drawnode_s { planeinfo_t *plane; polyplaneinfo_t *polyplane; wallinfo_t *wall; - gr_vissprite_t *sprite; + gl_vissprite_t *sprite; -// struct gr_drawnode_s *next; -// struct gr_drawnode_s *prev; -} gr_drawnode_t; +// struct gl_drawnode_s *next; +// struct gl_drawnode_s *prev; +} gl_drawnode_t; static INT32 drawcount = 0; @@ -4352,7 +4352,7 @@ void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polyse } // putting sortindex and sortnode here so the comparator function can see them -gr_drawnode_t *sortnode; +gl_drawnode_t *sortnode; size_t *sortindex; static int CompareDrawNodes(const void *p1, const void *p2) @@ -4479,8 +4479,8 @@ static void HWR_CreateDrawNodes(void) { if (sortnode[sortindex[i]].plane) { - // We aren't traversing the BSP tree, so make gr_frontsector null to avoid crashes. - gr_frontsector = NULL; + // We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes. + gl_frontsector = NULL; if (!(sortnode[sortindex[i]].plane->blend & PF_NoTexture)) HWR_GetLevelFlat(sortnode[sortindex[i]].plane->levelflat); @@ -4489,8 +4489,8 @@ static void HWR_CreateDrawNodes(void) } else if (sortnode[sortindex[i]].polyplane) { - // We aren't traversing the BSP tree, so make gr_frontsector null to avoid crashes. - gr_frontsector = NULL; + // We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes. + gl_frontsector = NULL; if (!(sortnode[sortindex[i]].polyplane->blend & PF_NoTexture)) HWR_GetLevelFlat(sortnode[sortindex[i]].polyplane->levelflat); @@ -4525,10 +4525,10 @@ static void HWR_CreateDrawNodes(void) static void HWR_DrawSprites(void) { UINT32 i; - HWD.pfnSetSpecialState(HWD_SET_MODEL_LIGHTING, cv_grmodellighting.value); - for (i = 0; i < gr_visspritecount; i++) + HWD.pfnSetSpecialState(HWD_SET_MODEL_LIGHTING, cv_glmodellighting.value); + for (i = 0; i < gl_visspritecount; i++) { - gr_vissprite_t *spr = gr_vsprorder[i]; + gl_vissprite_t *spr = gl_vsprorder[i]; #ifdef HWPRECIP if (spr->precip) HWR_DrawPrecipitationSprite(spr); @@ -4542,7 +4542,7 @@ static void HWR_DrawSprites(void) if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) { - if (!cv_grmodels.value || md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f) + if (!cv_glmodels.value || md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f) HWR_DrawSprite(spr); else { @@ -4552,7 +4552,7 @@ static void HWR_DrawSprites(void) } else { - if (!cv_grmodels.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f) + if (!cv_glmodels.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f) HWR_DrawSprite(spr); else { @@ -4621,7 +4621,7 @@ static void HWR_AddSprites(sector_t *sec) // BP why not use xtoviexangle/viewangletox like in bsp ?.... static void HWR_ProjectSprite(mobj_t *thing) { - gr_vissprite_t *vis; + gl_vissprite_t *vis; float tr_x, tr_y; float tz; float x1, x2; @@ -4658,16 +4658,16 @@ static void HWR_ProjectSprite(mobj_t *thing) this_scale = FIXED_TO_FLOAT(thing->scale); // transform the origin point - tr_x = FIXED_TO_FLOAT(thing->x) - gr_viewx; - tr_y = FIXED_TO_FLOAT(thing->y) - gr_viewy; + tr_x = FIXED_TO_FLOAT(thing->x) - gl_viewx; + tr_y = FIXED_TO_FLOAT(thing->y) - gl_viewy; // rotation around vertical axis - tz = (tr_x * gr_viewcos) + (tr_y * gr_viewsin); + tz = (tr_x * gl_viewcos) + (tr_y * gl_viewsin); // thing is behind view plane? if (tz < ZCLIP_PLANE && !papersprite) { - if (cv_grmodels.value) //Yellow: Only MD2's dont disappear + if (cv_glmodels.value) //Yellow: Only MD2's dont disappear { if (thing->skin && thing->sprite == SPR_PLAY) md2 = &md2_playermodels[( (skin_t *)thing->skin - skins )]; @@ -4843,7 +4843,7 @@ static void HWR_ProjectSprite(mobj_t *thing) if (thing->subsector->sector->cullheight) { - if (HWR_DoCulling(thing->subsector->sector->cullheight, viewsector->cullheight, gr_viewz, gz, gzt)) + if (HWR_DoCulling(thing->subsector->sector->cullheight, viewsector->cullheight, gl_viewz, gz, gzt)) return; } @@ -4855,12 +4855,12 @@ static void HWR_ProjectSprite(mobj_t *thing) if (heightsec != -1 && phs != -1) // only clip things which are in special sectors { - if (gr_viewz < FIXED_TO_FLOAT(sectors[phs].floorheight) ? + if (gl_viewz < FIXED_TO_FLOAT(sectors[phs].floorheight) ? FIXED_TO_FLOAT(thing->z) >= FIXED_TO_FLOAT(sectors[heightsec].floorheight) : gzt < FIXED_TO_FLOAT(sectors[heightsec].floorheight)) return; - if (gr_viewz > FIXED_TO_FLOAT(sectors[phs].ceilingheight) ? - gzt < FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) && gr_viewz >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) : + if (gl_viewz > FIXED_TO_FLOAT(sectors[phs].ceilingheight) ? + gzt < FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) && gl_viewz >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) : FIXED_TO_FLOAT(thing->z) >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight)) return; } @@ -4940,7 +4940,7 @@ static void HWR_ProjectSprite(mobj_t *thing) // Precipitation projector for hardware mode static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) { - gr_vissprite_t *vis; + gl_vissprite_t *vis; float tr_x, tr_y; float tz; float x1, x2; @@ -4953,11 +4953,11 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) UINT8 flip; // transform the origin point - tr_x = FIXED_TO_FLOAT(thing->x) - gr_viewx; - tr_y = FIXED_TO_FLOAT(thing->y) - gr_viewy; + tr_x = FIXED_TO_FLOAT(thing->x) - gl_viewx; + tr_y = FIXED_TO_FLOAT(thing->y) - gl_viewy; // rotation around vertical axis - tz = (tr_x * gr_viewcos) + (tr_y * gr_viewsin); + tz = (tr_x * gl_viewcos) + (tr_y * gl_viewsin); // thing is behind view plane? if (tz < ZCLIP_PLANE) @@ -5048,7 +5048,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) // ========================================================================== static void HWR_DrawSkyBackground(player_t *player) { - if (cv_grskydome.value) + if (cv_glskydome.value) { FTransform dometransform; const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd); @@ -5062,7 +5062,7 @@ static void HWR_DrawSkyBackground(player_t *player) memset(&dometransform, 0x00, sizeof(FTransform)); //04/01/2000: Hurdler: added for T&L - // It should replace all other gr_viewxxx when finished + // It should replace all other gl_viewxxx when finished HWR_SetTransformAiming(&dometransform, player, false); dometransform.angley = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES); @@ -5120,7 +5120,7 @@ static void HWR_DrawSkyBackground(player_t *player) // software doesn't draw any further than 1024 for skies anyway, but this doesn't overlap properly // The only time this will probably be an issue is when a sky wider than 1024 is used as a sky AND a regular wall texture - angle = (dup_viewangle + gr_xtoviewangle[0]); + angle = (dup_viewangle + gl_xtoviewangle[0]); dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->width/256.0f); @@ -5185,10 +5185,10 @@ static inline void HWR_ClearView(void) /// \bug faB - enable depth mask, disable color mask - HWD.pfnGClipRect((INT32)gr_viewwindowx, - (INT32)gr_viewwindowy, - (INT32)(gr_viewwindowx + gr_viewwidth), - (INT32)(gr_viewwindowy + gr_viewheight), + HWD.pfnGClipRect((INT32)gl_viewwindowx, + (INT32)gl_viewwindowy, + (INT32)(gl_viewwindowx + gl_viewwidth), + (INT32)(gl_viewwindowy + gl_viewheight), ZCLIP_PLANE); HWD.pfnClearBuffer(false, true, 0); @@ -5204,30 +5204,30 @@ static inline void HWR_ClearView(void) void HWR_SetViewSize(void) { // setup view size - gr_viewwidth = (float)vid.width; - gr_viewheight = (float)vid.height; + gl_viewwidth = (float)vid.width; + gl_viewheight = (float)vid.height; if (splitscreen) - gr_viewheight /= 2; + gl_viewheight /= 2; - gr_centerx = gr_viewwidth / 2; - gr_basecentery = gr_viewheight / 2; //note: this is (gr_centerx * gr_viewheight / gr_viewwidth) + gl_centerx = gl_viewwidth / 2; + gl_basecentery = gl_viewheight / 2; //note: this is (gl_centerx * gl_viewheight / gl_viewwidth) - gr_viewwindowx = (vid.width - gr_viewwidth) / 2; - gr_windowcenterx = (float)(vid.width / 2); - if (fabsf(gr_viewwidth - vid.width) < 1.0E-36f) + gl_viewwindowx = (vid.width - gl_viewwidth) / 2; + gl_windowcenterx = (float)(vid.width / 2); + if (fabsf(gl_viewwidth - vid.width) < 1.0E-36f) { - gr_baseviewwindowy = 0; - gr_basewindowcentery = gr_viewheight / 2; // window top left corner at 0,0 + gl_baseviewwindowy = 0; + gl_basewindowcentery = gl_viewheight / 2; // window top left corner at 0,0 } else { - gr_baseviewwindowy = (vid.height-gr_viewheight) / 2; - gr_basewindowcentery = (float)(vid.height / 2); + gl_baseviewwindowy = (vid.height-gl_viewheight) / 2; + gl_basewindowcentery = (float)(vid.height / 2); } - gr_pspritexscale = gr_viewwidth / BASEVIDWIDTH; - gr_pspriteyscale = ((vid.height*gr_pspritexscale*BASEVIDWIDTH)/BASEVIDHEIGHT)/vid.width; + gl_pspritexscale = gl_viewwidth / BASEVIDWIDTH; + gl_pspriteyscale = ((vid.height*gl_pspritexscale*BASEVIDWIDTH)/BASEVIDHEIGHT)/vid.width; HWD.pfnFlushScreenTextures(); } @@ -5238,20 +5238,20 @@ static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean { // 1 = always on // 2 = chasecam only - if (cv_grshearing.value == 1 || (cv_grshearing.value == 2 && R_IsViewpointThirdPerson(player, skybox))) + if (cv_glshearing.value == 1 || (cv_glshearing.value == 2 && R_IsViewpointThirdPerson(player, skybox))) { fixed_t fixedaiming = AIMINGTODY(aimingangle); trans->viewaiming = FIXED_TO_FLOAT(fixedaiming); trans->shearing = true; - gr_aimingangle = 0; + gl_aimingangle = 0; } else { trans->shearing = false; - gr_aimingangle = aimingangle; + gl_aimingangle = aimingangle; } - trans->anglex = (float)(gr_aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES); + trans->anglex = (float)(gl_aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES); } // ========================================================================== @@ -5288,42 +5288,42 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) dup_viewangle = viewangle; // set window position - gr_centery = gr_basecentery; - gr_viewwindowy = gr_baseviewwindowy; - gr_windowcentery = gr_basewindowcentery; + gl_centery = gl_basecentery; + gl_viewwindowy = gl_baseviewwindowy; + gl_windowcentery = gl_basewindowcentery; if (splitscreen && viewnumber == 1) { - gr_viewwindowy += (vid.height/2); - gr_windowcentery += (vid.height/2); + gl_viewwindowy += (vid.height/2); + gl_windowcentery += (vid.height/2); } // check for new console commands. NetUpdate(); - gr_viewx = FIXED_TO_FLOAT(dup_viewx); - gr_viewy = FIXED_TO_FLOAT(dup_viewy); - gr_viewz = FIXED_TO_FLOAT(dup_viewz); - gr_viewsin = FIXED_TO_FLOAT(viewsin); - gr_viewcos = FIXED_TO_FLOAT(viewcos); + gl_viewx = FIXED_TO_FLOAT(dup_viewx); + gl_viewy = FIXED_TO_FLOAT(dup_viewy); + gl_viewz = FIXED_TO_FLOAT(dup_viewz); + gl_viewsin = FIXED_TO_FLOAT(viewsin); + gl_viewcos = FIXED_TO_FLOAT(viewcos); //04/01/2000: Hurdler: added for T&L - // It should replace all other gr_viewxxx when finished + // It should replace all other gl_viewxxx when finished memset(&atransform, 0x00, sizeof(FTransform)); HWR_SetTransformAiming(&atransform, player, true); atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES); - gr_viewludsin = FIXED_TO_FLOAT(FINECOSINE(gr_aimingangle>>ANGLETOFINESHIFT)); - gr_viewludcos = FIXED_TO_FLOAT(-FINESINE(gr_aimingangle>>ANGLETOFINESHIFT)); + gl_viewludsin = FIXED_TO_FLOAT(FINECOSINE(gl_aimingangle>>ANGLETOFINESHIFT)); + gl_viewludcos = FIXED_TO_FLOAT(-FINESINE(gl_aimingangle>>ANGLETOFINESHIFT)); if (*type == postimg_flip) atransform.flip = true; else atransform.flip = false; - atransform.x = gr_viewx; // FIXED_TO_FLOAT(viewx) - atransform.y = gr_viewy; // FIXED_TO_FLOAT(viewy) - atransform.z = gr_viewz; // FIXED_TO_FLOAT(viewz) + atransform.x = gl_viewx; // FIXED_TO_FLOAT(viewx) + atransform.y = gl_viewy; // FIXED_TO_FLOAT(viewy) + atransform.z = gl_viewz; // FIXED_TO_FLOAT(viewz) atransform.scalex = 1; atransform.scaley = (float)vid.width/vid.height; atransform.scalez = 1; @@ -5338,7 +5338,7 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) } atransform.splitscreen = splitscreen; - gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); + gl_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); //------------------------------------------------------------------------ HWR_ClearView(); @@ -5356,7 +5356,7 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) #ifdef NEWCLIP if (rendermode == render_opengl) { - angle_t a1 = gld_FrustumAngle(gr_aimingangle); + angle_t a1 = gld_FrustumAngle(gl_aimingangle); gld_clipper_Clear(); gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1); #ifdef HAVE_SPHEREFRUSTRUM @@ -5372,12 +5372,12 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) HWD.pfnSetTransform(&atransform); // Reset the shader state. - HWD.pfnSetSpecialState(HWD_SET_SHADERS, cv_grshaders.value); + HWD.pfnSetSpecialState(HWD_SET_SHADERS, cv_glshaders.value); HWD.pfnSetShader(0); validcount++; - if (cv_grbatching.value) + if (cv_glbatching.value) HWR_StartBatching(); HWR_RenderBSPNode((INT32)numnodes-1); @@ -5390,14 +5390,14 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) viewangle = localaiming2; // Handle stuff when you are looking farther up or down. - if ((gr_aimingangle || cv_fov.value+player->fovadd > 90*FRACUNIT)) + if ((gl_aimingangle || cv_fov.value+player->fovadd > 90*FRACUNIT)) { dup_viewangle += ANGLE_90; HWR_ClearClipSegs(); HWR_RenderBSPNode((INT32)numnodes-1); //left dup_viewangle += ANGLE_90; - if (((INT32)gr_aimingangle > ANGLE_45 || (INT32)gr_aimingangle<-ANGLE_45)) + if (((INT32)gl_aimingangle > ANGLE_45 || (INT32)gl_aimingangle<-ANGLE_45)) { HWR_ClearClipSegs(); HWR_RenderBSPNode((INT32)numnodes-1); //back @@ -5411,7 +5411,7 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) } #endif - if (cv_grbatching.value) + if (cv_glbatching.value) HWR_RenderBatches(); // Check for new console commands. @@ -5470,7 +5470,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) ClearColor.blue = 0.0f; ClearColor.alpha = 1.0f; - if (cv_grshaders.value) + if (cv_glshaders.value) HWD.pfnSetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime. if (viewnumber == 0) // Only do it if it's the first screen being rendered @@ -5501,42 +5501,42 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) dup_viewangle = viewangle; // set window position - gr_centery = gr_basecentery; - gr_viewwindowy = gr_baseviewwindowy; - gr_windowcentery = gr_basewindowcentery; + gl_centery = gl_basecentery; + gl_viewwindowy = gl_baseviewwindowy; + gl_windowcentery = gl_basewindowcentery; if (splitscreen && viewnumber == 1) { - gr_viewwindowy += (vid.height/2); - gr_windowcentery += (vid.height/2); + gl_viewwindowy += (vid.height/2); + gl_windowcentery += (vid.height/2); } // check for new console commands. NetUpdate(); - gr_viewx = FIXED_TO_FLOAT(dup_viewx); - gr_viewy = FIXED_TO_FLOAT(dup_viewy); - gr_viewz = FIXED_TO_FLOAT(dup_viewz); - gr_viewsin = FIXED_TO_FLOAT(viewsin); - gr_viewcos = FIXED_TO_FLOAT(viewcos); + gl_viewx = FIXED_TO_FLOAT(dup_viewx); + gl_viewy = FIXED_TO_FLOAT(dup_viewy); + gl_viewz = FIXED_TO_FLOAT(dup_viewz); + gl_viewsin = FIXED_TO_FLOAT(viewsin); + gl_viewcos = FIXED_TO_FLOAT(viewcos); //04/01/2000: Hurdler: added for T&L - // It should replace all other gr_viewxxx when finished + // It should replace all other gl_viewxxx when finished memset(&atransform, 0x00, sizeof(FTransform)); HWR_SetTransformAiming(&atransform, player, false); atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES); - gr_viewludsin = FIXED_TO_FLOAT(FINECOSINE(gr_aimingangle>>ANGLETOFINESHIFT)); - gr_viewludcos = FIXED_TO_FLOAT(-FINESINE(gr_aimingangle>>ANGLETOFINESHIFT)); + gl_viewludsin = FIXED_TO_FLOAT(FINECOSINE(gl_aimingangle>>ANGLETOFINESHIFT)); + gl_viewludcos = FIXED_TO_FLOAT(-FINESINE(gl_aimingangle>>ANGLETOFINESHIFT)); if (*type == postimg_flip) atransform.flip = true; else atransform.flip = false; - atransform.x = gr_viewx; // FIXED_TO_FLOAT(viewx) - atransform.y = gr_viewy; // FIXED_TO_FLOAT(viewy) - atransform.z = gr_viewz; // FIXED_TO_FLOAT(viewz) + atransform.x = gl_viewx; // FIXED_TO_FLOAT(viewx) + atransform.y = gl_viewy; // FIXED_TO_FLOAT(viewy) + atransform.z = gl_viewz; // FIXED_TO_FLOAT(viewz) atransform.scalex = 1; atransform.scaley = (float)vid.width/vid.height; atransform.scalez = 1; @@ -5551,7 +5551,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) } atransform.splitscreen = splitscreen; - gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); + gl_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); //------------------------------------------------------------------------ HWR_ClearView(); // Clears the depth buffer and resets the view I believe @@ -5569,7 +5569,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) #ifdef NEWCLIP if (rendermode == render_opengl) { - angle_t a1 = gld_FrustumAngle(gr_aimingangle); + angle_t a1 = gld_FrustumAngle(gl_aimingangle); gld_clipper_Clear(); gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1); #ifdef HAVE_SPHEREFRUSTRUM @@ -5585,7 +5585,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) HWD.pfnSetTransform(&atransform); // Reset the shader state. - HWD.pfnSetSpecialState(HWD_SET_SHADERS, cv_grshaders.value); + HWD.pfnSetSpecialState(HWD_SET_SHADERS, cv_glshaders.value); HWD.pfnSetShader(0); rs_numbspcalls = 0; @@ -5594,7 +5594,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) validcount++; - if (cv_grbatching.value) + if (cv_glbatching.value) HWR_StartBatching(); HWR_RenderBSPNode((INT32)numnodes-1); @@ -5607,14 +5607,14 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) viewangle = localaiming2; // Handle stuff when you are looking farther up or down. - if ((gr_aimingangle || cv_fov.value+player->fovadd > 90*FRACUNIT)) + if ((gl_aimingangle || cv_fov.value+player->fovadd > 90*FRACUNIT)) { dup_viewangle += ANGLE_90; HWR_ClearClipSegs(); HWR_RenderBSPNode((INT32)numnodes-1); //left dup_viewangle += ANGLE_90; - if (((INT32)gr_aimingangle > ANGLE_45 || (INT32)gr_aimingangle<-ANGLE_45)) + if (((INT32)gl_aimingangle > ANGLE_45 || (INT32)gl_aimingangle<-ANGLE_45)) { HWR_ClearClipSegs(); HWR_RenderBSPNode((INT32)numnodes-1); //back @@ -5630,7 +5630,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) rs_bsptime = I_GetTimeMicros() - rs_bsptime; - if (cv_grbatching.value) + if (cv_glbatching.value) HWR_RenderBatches(); // Check for new console commands. @@ -5643,7 +5643,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) #endif // Draw MD2 and sprites - rs_numsprites = gr_visspritecount; + rs_numsprites = gl_visspritecount; rs_hw_spritesorttime = I_GetTimeMicros(); HWR_SortVisSprites(); rs_hw_spritesorttime = I_GetTimeMicros() - rs_hw_spritesorttime; @@ -5685,8 +5685,8 @@ static CV_PossibleValue_t grmodelinterpolation_cons_t[] = {{0, "Off"}, {1, "Some static CV_PossibleValue_t grfakecontrast_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Smooth"}, {0, NULL}}; static CV_PossibleValue_t grshearing_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Third-person"}, {0, NULL}}; -static void CV_grfiltermode_OnChange(void); -static void CV_granisotropic_OnChange(void); +static void CV_glfiltermode_OnChange(void); +static void CV_glanisotropic_OnChange(void); static CV_PossibleValue_t grfiltermode_cons_t[]= {{HWD_SET_TEXTUREFILTER_POINTSAMPLED, "Nearest"}, {HWD_SET_TEXTUREFILTER_BILINEAR, "Bilinear"}, {HWD_SET_TEXTUREFILTER_TRILINEAR, "Trilinear"}, @@ -5696,46 +5696,46 @@ static CV_PossibleValue_t grfiltermode_cons_t[]= {{HWD_SET_TEXTUREFILTER_POINTSA {0, NULL}}; CV_PossibleValue_t granisotropicmode_cons_t[] = {{1, "MIN"}, {16, "MAX"}, {0, NULL}}; -consvar_t cv_grshaders = {"gr_shaders", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glshaders = {"gr_shaders", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_fovchange = {"gr_fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #ifdef ALAM_LIGHTING -consvar_t cv_grdynamiclighting = {"gr_dynamiclighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grstaticlighting = {"gr_staticlighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grcoronas = {"gr_coronas", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grcoronasize = {"gr_coronasize", "1", CV_SAVE|CV_FLOAT, 0, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_gldynamiclighting = {"gr_dynamiclighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glstaticlighting = {"gr_staticlighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glcoronas = {"gr_coronas", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glcoronasize = {"gr_coronasize", "1", CV_SAVE|CV_FLOAT, 0, NULL, 0, NULL, NULL, 0, 0, NULL}; #endif -consvar_t cv_grmodels = {"gr_models", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grmodelinterpolation = {"gr_modelinterpolation", "Sometimes", CV_SAVE, grmodelinterpolation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grmodellighting = {"gr_modellighting", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glmodels = {"gr_models", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glmodelinterpolation = {"gr_modelinterpolation", "Sometimes", CV_SAVE, grmodelinterpolation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glmodellighting = {"gr_modellighting", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grshearing = {"gr_shearing", "Off", CV_SAVE, grshearing_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grskydome = {"gr_skydome", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grfakecontrast = {"gr_fakecontrast", "Smooth", CV_SAVE, grfakecontrast_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grslopecontrast = {"gr_slopecontrast", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glshearing = {"gr_shearing", "Off", CV_SAVE, grshearing_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glskydome = {"gr_skydome", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glfakecontrast = {"gr_fakecontrast", "Smooth", CV_SAVE, grfakecontrast_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glslopecontrast = {"gr_slopecontrast", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grfiltermode = {"gr_filtermode", "Nearest", CV_SAVE|CV_CALL, grfiltermode_cons_t, - CV_grfiltermode_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_granisotropicmode = {"gr_anisotropicmode", "1", CV_CALL, granisotropicmode_cons_t, - CV_granisotropic_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glfiltermode = {"gr_filtermode", "Nearest", CV_SAVE|CV_CALL, grfiltermode_cons_t, + CV_glfiltermode_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glanisotropicmode = {"gr_anisotropicmode", "1", CV_CALL, granisotropicmode_cons_t, + CV_glanisotropic_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grcorrecttricks = {"gr_correcttricks", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glcorrecttricks = {"gr_correcttricks", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_glbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -static void CV_grfiltermode_OnChange(void) +static void CV_glfiltermode_OnChange(void) { if (rendermode == render_opengl) - HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_grfiltermode.value); + HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value); } -static void CV_granisotropic_OnChange(void) +static void CV_glanisotropic_OnChange(void) { if (rendermode == render_opengl) - HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_granisotropicmode.value); + HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value); } //added by Hurdler: console varibale that are saved @@ -5744,31 +5744,31 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_fovchange); #ifdef ALAM_LIGHTING - CV_RegisterVar(&cv_grstaticlighting); - CV_RegisterVar(&cv_grdynamiclighting); - CV_RegisterVar(&cv_grcoronasize); - CV_RegisterVar(&cv_grcoronas); + CV_RegisterVar(&cv_glstaticlighting); + CV_RegisterVar(&cv_gldynamiclighting); + CV_RegisterVar(&cv_glcoronasize); + CV_RegisterVar(&cv_glcoronas); #endif - CV_RegisterVar(&cv_grmodellighting); - CV_RegisterVar(&cv_grmodelinterpolation); - CV_RegisterVar(&cv_grmodels); + CV_RegisterVar(&cv_glmodellighting); + CV_RegisterVar(&cv_glmodelinterpolation); + CV_RegisterVar(&cv_glmodels); - CV_RegisterVar(&cv_grskydome); - CV_RegisterVar(&cv_grspritebillboarding); - CV_RegisterVar(&cv_grfakecontrast); - CV_RegisterVar(&cv_grshearing); - CV_RegisterVar(&cv_grshaders); + CV_RegisterVar(&cv_glskydome); + CV_RegisterVar(&cv_glspritebillboarding); + CV_RegisterVar(&cv_glfakecontrast); + CV_RegisterVar(&cv_glshearing); + CV_RegisterVar(&cv_glshaders); - CV_RegisterVar(&cv_grfiltermode); - CV_RegisterVar(&cv_grcorrecttricks); - CV_RegisterVar(&cv_grsolvetjoin); + CV_RegisterVar(&cv_glfiltermode); + CV_RegisterVar(&cv_glcorrecttricks); + CV_RegisterVar(&cv_glsolvetjoin); CV_RegisterVar(&cv_renderstats); - CV_RegisterVar(&cv_grbatching); + CV_RegisterVar(&cv_glbatching); #ifndef NEWCLIP - CV_RegisterVar(&cv_grclipwalls); + CV_RegisterVar(&cv_glclipwalls); #endif } @@ -5778,7 +5778,7 @@ void HWR_AddSessionCommands(void) if (alreadycalled) return; - CV_RegisterVar(&cv_granisotropicmode); + CV_RegisterVar(&cv_glanisotropicmode); alreadycalled = true; } @@ -5808,7 +5808,7 @@ void HWR_Startup(void) for (i = 0; i < numwadfiles; i++) HWR_ReadShaders(i, (wadfiles[i]->type == RET_PK3)); if (!HWR_LoadShaders()) - gr_shadersavailable = false; + gl_shadersavailable = false; } if (rendermode == render_opengl) @@ -5823,8 +5823,8 @@ void HWR_Startup(void) void HWR_Switch(void) { // Set special states from CVARs - HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_grfiltermode.value); - HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_granisotropicmode.value); + HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value); + HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value); } // -------------------------------------------------------------------------- @@ -5843,23 +5843,23 @@ void transform(float *cx, float *cy, float *cz) { float tr_x,tr_y; // translation - tr_x = *cx - gr_viewx; - tr_y = *cz - gr_viewy; + tr_x = *cx - gl_viewx; + tr_y = *cz - gl_viewy; // *cy = *cy; // rotation around vertical y axis - *cx = (tr_x * gr_viewsin) - (tr_y * gr_viewcos); - tr_x = (tr_x * gr_viewcos) + (tr_y * gr_viewsin); + *cx = (tr_x * gl_viewsin) - (tr_y * gl_viewcos); + tr_x = (tr_x * gl_viewcos) + (tr_y * gl_viewsin); //look up/down ----TOTAL SUCKS!!!--- do the 2 in one!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - tr_y = *cy - gr_viewz; + tr_y = *cy - gl_viewz; - *cy = (tr_x * gr_viewludcos) + (tr_y * gr_viewludsin); - *cz = (tr_x * gr_viewludsin) - (tr_y * gr_viewludcos); + *cy = (tr_x * gl_viewludcos) + (tr_y * gl_viewludsin); + *cz = (tr_x * gl_viewludsin) - (tr_y * gl_viewludcos); //scale y before frustum so that frustum can be scaled to screen height - *cy *= ORIGINAL_ASPECT * gr_fovlud; - *cx *= gr_fovlud; + *cy *= ORIGINAL_ASPECT * gl_fovlud; + *cx *= gl_fovlud; } void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap) @@ -5915,7 +5915,7 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, HWR_ProcessPolygon(pSurf, wallVerts, 4, blendmode, shader, false); #ifdef WALLSPLATS - if (gr_curline->linedef->splats && cv_splats.value) + if (gl_curline->linedef->splats && cv_splats.value) HWR_DrawSegsSplats(pSurf); #endif } diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 21bd7ddb3ed12081428f8eeb74667083db0340e3..f404d8c5e80d6738afdd6f5f1dd7aa7a5be36c15 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -75,32 +75,32 @@ boolean HWR_LoadShaders(void); extern CV_PossibleValue_t granisotropicmode_cons_t[]; #ifdef ALAM_LIGHTING -extern consvar_t cv_grdynamiclighting; -extern consvar_t cv_grstaticlighting; -extern consvar_t cv_grcoronas; -extern consvar_t cv_grcoronasize; +extern consvar_t cv_gldynamiclighting; +extern consvar_t cv_glstaticlighting; +extern consvar_t cv_glcoronas; +extern consvar_t cv_glcoronasize; #endif -extern consvar_t cv_grshaders; -extern consvar_t cv_grmodels; -extern consvar_t cv_grmodelinterpolation; -extern consvar_t cv_grmodellighting; -extern consvar_t cv_grfiltermode; -extern consvar_t cv_granisotropicmode; -extern consvar_t cv_grcorrecttricks; +extern consvar_t cv_glshaders; +extern consvar_t cv_glmodels; +extern consvar_t cv_glmodelinterpolation; +extern consvar_t cv_glmodellighting; +extern consvar_t cv_glfiltermode; +extern consvar_t cv_glanisotropicmode; +extern consvar_t cv_glcorrecttricks; extern consvar_t cv_fovchange; -extern consvar_t cv_grsolvetjoin; -extern consvar_t cv_grshearing; -extern consvar_t cv_grspritebillboarding; -extern consvar_t cv_grskydome; -extern consvar_t cv_grfakecontrast; -extern consvar_t cv_grslopecontrast; +extern consvar_t cv_glsolvetjoin; +extern consvar_t cv_glshearing; +extern consvar_t cv_glspritebillboarding; +extern consvar_t cv_glskydome; +extern consvar_t cv_glfakecontrast; +extern consvar_t cv_glslopecontrast; -extern consvar_t cv_grbatching; +extern consvar_t cv_glbatching; -extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy; +extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowy; -extern float gr_viewwindowx, gr_basewindowcentery; +extern float gl_viewwindowx, gl_basewindowcentery; // BP: big hack for a test in lighting ref : 1249753487AB extern fixed_t *hwbbox; @@ -124,6 +124,6 @@ extern int rs_hw_numcolors; extern int rs_hw_batchsorttime; extern int rs_hw_batchdrawtime; -extern boolean gr_shadersavailable; +extern boolean gl_shadersavailable; #endif diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index a09fdc926891b19ab0e607c7d5155016fe6a8da1..c311d64623205e9f859adde604d7caec2003eedb 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1108,14 +1108,14 @@ static boolean HWR_AllowModel(mobj_t *mobj) static boolean HWR_CanInterpolateModel(mobj_t *mobj, model_t *model) { - if (cv_grmodelinterpolation.value == 2) // Always interpolate + if (cv_glmodelinterpolation.value == 2) // Always interpolate return true; return model->interpolate[(mobj->frame & FF_FRAMEMASK)]; } static boolean HWR_CanInterpolateSprite2(modelspr2frames_t *spr2frame) { - if (cv_grmodelinterpolation.value == 2) // Always interpolate + if (cv_glmodelinterpolation.value == 2) // Always interpolate return true; return spr2frame->interpolate; } @@ -1181,7 +1181,7 @@ static UINT8 HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t // HWR_DrawModel // -boolean HWR_DrawModel(gr_vissprite_t *spr) +boolean HWR_DrawModel(gl_vissprite_t *spr) { md2_t *md2; @@ -1192,7 +1192,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr) FTransform p; FSurfaceInfo Surf; - if (!cv_grmodels.value) + if (!cv_glmodels.value) return false; if (spr->precip) @@ -1388,7 +1388,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr) #ifdef USE_MODEL_NEXTFRAME #define INTERPOLERATION_LIMIT TICRATE/4 - if (cv_grmodelinterpolation.value && tics <= durs && tics <= INTERPOLERATION_LIMIT) + if (cv_glmodelinterpolation.value && tics <= durs && tics <= INTERPOLERATION_LIMIT) { if (durs > INTERPOLERATION_LIMIT) durs = INTERPOLERATION_LIMIT; diff --git a/src/hardware/hw_md2.h b/src/hardware/hw_md2.h index 42a9d7c634d3643fd198372e87b5250d8c5f9068..0f4d2c7bc925f45005757c09a80cabaf103a8a3a 100644 --- a/src/hardware/hw_md2.h +++ b/src/hardware/hw_md2.h @@ -42,7 +42,7 @@ extern md2_t md2_playermodels[MAXSKINS]; void HWR_InitModels(void); void HWR_AddPlayerModel(INT32 skin); void HWR_AddSpriteModel(size_t spritenum); -boolean HWR_DrawModel(gr_vissprite_t *spr); +boolean HWR_DrawModel(gl_vissprite_t *spr); #define PLAYERMODELPREFIX "PLAYER" diff --git a/src/hardware/hw_trick.c b/src/hardware/hw_trick.c index 82d81b5b2520925835ed635faf392a0469239fb5..312be66d46f58c18a6d3da16073757c62f488d8e 100644 --- a/src/hardware/hw_trick.c +++ b/src/hardware/hw_trick.c @@ -739,7 +739,7 @@ void HWR_CorrectSWTricks(void) sector_t **sectorList; sector_t *outSector; - if ((0 == cv_grcorrecttricks.value)) + if ((0 == cv_glcorrecttricks.value)) return; // determine lines for sectors diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 49dbcd08f14d97448e5d3e7a67310a91fadf98d6..8b48a043881ae180329164e30f8964aed7594497 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -58,8 +58,8 @@ static GLuint tex_downloaded = 0; static GLfloat fov = 90.0f; static FBITFIELD CurrentPolyFlags; -static FTextureInfo *gr_cachetail = NULL; -static FTextureInfo *gr_cachehead = NULL; +static FTextureInfo *gl_cachetail = NULL; +static FTextureInfo *gl_cachehead = NULL; RGBA_t myPaletteData[256]; GLint screen_width = 0; // used by Draw2DLine() @@ -1200,7 +1200,7 @@ void SetModelView(GLint w, GLint h) pglLoadIdentity(); GLPerspective(fov, ASPECT_RATIO); - //pglScalef(1.0f, 320.0f/200.0f, 1.0f); // gr_scalefrustum (ORIGINAL_ASPECT) + //pglScalef(1.0f, 320.0f/200.0f, 1.0f); // gl_scalefrustum (ORIGINAL_ASPECT) // added for new coronas' code (without depth buffer) pglGetIntegerv(GL_VIEWPORT, viewport); @@ -1277,14 +1277,14 @@ void Flush(void) { //GL_DBG_Printf ("HWR_Flush()\n"); - while (gr_cachehead) + while (gl_cachehead) { - if (gr_cachehead->downloaded) - pglDeleteTextures(1, (GLuint *)&gr_cachehead->downloaded); - gr_cachehead->downloaded = 0; - gr_cachehead = gr_cachehead->nextmipmap; + if (gl_cachehead->downloaded) + pglDeleteTextures(1, (GLuint *)&gl_cachehead->downloaded); + gl_cachehead->downloaded = 0; + gl_cachehead = gl_cachehead->nextmipmap; } - gr_cachetail = gr_cachehead = NULL; //Hurdler: well, gr_cachehead is already NULL + gl_cachetail = gl_cachehead = NULL; //Hurdler: well, gl_cachehead is already NULL tex_downloaded = 0; } @@ -1860,13 +1860,13 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo) { UpdateTexture(pTexInfo); pTexInfo->nextmipmap = NULL; - if (gr_cachetail) + if (gl_cachetail) { // insertion at the tail - gr_cachetail->nextmipmap = pTexInfo; - gr_cachetail = pTexInfo; + gl_cachetail->nextmipmap = pTexInfo; + gl_cachetail = pTexInfo; } else // initialization of the linked list - gr_cachetail = gr_cachehead = pTexInfo; + gl_cachetail = gl_cachehead = pTexInfo; } } @@ -2959,7 +2959,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) EXPORT INT32 HWRAPI(GetTextureUsed) (void) { - FTextureInfo *tmp = gr_cachehead; + FTextureInfo *tmp = gl_cachehead; INT32 res = 0; while (tmp) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 7b84784e58102c690f37c21e6a79d07d54adfc86..b611925330ffd96c1c29354694160c55a442bdf2 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1880,7 +1880,7 @@ static inline void HU_DrawCrosshair(void) #ifdef HWRENDER if (rendermode != render_soft) - y = (INT32)gr_basewindowcentery; + y = (INT32)gl_basewindowcentery; else #endif y = viewwindowy + (viewheight>>1); @@ -1901,7 +1901,7 @@ static inline void HU_DrawCrosshair2(void) #ifdef HWRENDER if (rendermode != render_soft) - y = (INT32)gr_basewindowcentery; + y = (INT32)gl_basewindowcentery; else #endif y = viewwindowy + (viewheight>>1); @@ -1910,7 +1910,7 @@ static inline void HU_DrawCrosshair2(void) { #ifdef HWRENDER if (rendermode != render_soft) - y += (INT32)gr_viewheight; + y += (INT32)gl_viewheight; else #endif y += viewheight; diff --git a/src/m_menu.c b/src/m_menu.c index 98178c15c34f51e0f05e2e5ed003886a36f2aa9d..338d9b1be556a56c80854ec665114f42ba231c37 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1446,19 +1446,19 @@ static menuitem_t OP_ColorOptionsMenu[] = static menuitem_t OP_OpenGLOptionsMenu[] = { {IT_HEADER, NULL, "3D Models", NULL, 0}, - {IT_STRING|IT_CVAR, NULL, "Models", &cv_grmodels, 12}, - {IT_STRING|IT_CVAR, NULL, "Frame interpolation", &cv_grmodelinterpolation, 22}, - {IT_STRING|IT_CVAR, NULL, "Ambient lighting", &cv_grmodellighting, 32}, + {IT_STRING|IT_CVAR, NULL, "Models", &cv_glmodels, 12}, + {IT_STRING|IT_CVAR, NULL, "Frame interpolation", &cv_glmodelinterpolation, 22}, + {IT_STRING|IT_CVAR, NULL, "Ambient lighting", &cv_glmodellighting, 32}, {IT_HEADER, NULL, "General", NULL, 51}, - {IT_STRING|IT_CVAR, NULL, "Shaders", &cv_grshaders, 63}, - {IT_STRING|IT_CVAR, NULL, "Lack of perspective", &cv_grshearing, 73}, + {IT_STRING|IT_CVAR, NULL, "Shaders", &cv_glshaders, 63}, + {IT_STRING|IT_CVAR, NULL, "Lack of perspective", &cv_glshearing, 73}, {IT_STRING|IT_CVAR, NULL, "Field of view", &cv_fov, 83}, {IT_HEADER, NULL, "Miscellaneous", NULL, 102}, {IT_STRING|IT_CVAR, NULL, "Bit depth", &cv_scr_depth, 114}, - {IT_STRING|IT_CVAR, NULL, "Texture filter", &cv_grfiltermode, 124}, - {IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 134}, + {IT_STRING|IT_CVAR, NULL, "Texture filter", &cv_glfiltermode, 124}, + {IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_glanisotropicmode, 134}, #ifdef ALAM_LIGHTING {IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 144}, #endif @@ -1470,10 +1470,10 @@ static menuitem_t OP_OpenGLOptionsMenu[] = #ifdef ALAM_LIGHTING static menuitem_t OP_OpenGLLightingMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Coronas", &cv_grcoronas, 0}, - {IT_STRING|IT_CVAR, NULL, "Coronas size", &cv_grcoronasize, 10}, - {IT_STRING|IT_CVAR, NULL, "Dynamic lighting", &cv_grdynamiclighting, 20}, - {IT_STRING|IT_CVAR, NULL, "Static lighting", &cv_grstaticlighting, 30}, + {IT_STRING|IT_CVAR, NULL, "Coronas", &cv_glcoronas, 0}, + {IT_STRING|IT_CVAR, NULL, "Coronas size", &cv_glcoronasize, 10}, + {IT_STRING|IT_CVAR, NULL, "Dynamic lighting", &cv_gldynamiclighting, 20}, + {IT_STRING|IT_CVAR, NULL, "Static lighting", &cv_glstaticlighting, 30}, }; #endif // ALAM_LIGHTING @@ -2306,9 +2306,9 @@ void Nextmap_OnChange(void) // Check if file exists, if not, disable REPLAY option sprintf(tabase,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1].name); -#ifdef OLDNREPLAYNAME +#ifdef OLDNREPLAYNAME sprintf(tabaseold,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)); -#endif +#endif for (i = 0; i < 4; i++) { SP_NightsReplayMenu[i].status = IT_DISABLED; @@ -2336,7 +2336,7 @@ void Nextmap_OnChange(void) active = true; } - // Old style name compatibility + // Old style name compatibility #ifdef OLDNREPLAYNAME if (FIL_FileExists(va("%s-score-best.lmp", tabaseold))) { SP_NightsReplayMenu[0].status = IT_WHITESTRING|IT_CALL; diff --git a/src/p_user.c b/src/p_user.c index 261e4b28cde64f109cc275cfc3b0e6ab7b39b03c..df037504e2a18c83b877f9521701ba25a101496e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -10042,7 +10042,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (camorbit) //Sev here, I'm guessing this is where orbital cam lives { #ifdef HWRENDER - if (rendermode == render_opengl && !cv_grshearing.value) + if (rendermode == render_opengl && !cv_glshearing.value) distxy = FixedMul(dist, FINECOSINE((focusaiming>>ANGLETOFINESHIFT) & FINEMASK)); else #endif diff --git a/src/r_main.c b/src/r_main.c index cf7360804338b1e9e9c20f068307b98ea3151fbd..ead1403becb93140c3265ea652f19784bbab6daa 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1064,7 +1064,7 @@ static void R_SetupFreelook(void) // (lmps, network and use F12...) if (rendermode == render_soft #ifdef HWRENDER - || cv_grshearing.value + || cv_glshearing.value #endif ) {