diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 64b7e0a9..771a5a7f 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -629,7 +629,7 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum) // Download a Doom 'flat' to the hardware cache and make it ready for use -void HWR_GetFlat(lumpnum_t flatlumpnum) +void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap) { GLMipmap_t *grmip; @@ -638,7 +638,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum) grmip->colormap = colormaps; #ifdef GLENCORE - if (encoremap) + if (!noencoremap && encoremap) grmip->colormap += (256*32); #endif diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 6f3712ef..8570c3b3 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -520,7 +520,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum v[0].t = v[1].t = (float)((y & flatflag)/dflatsize); v[2].t = v[3].t = (float)(v[0].t + h/dflatsize); - HWR_GetFlat(flatlumpnum); + HWR_GetFlat(flatlumpnum, false); // Never Encore map drawflatfill, duh. //Hurdler: Boris, the same comment as above... but maybe for pics // it not a problem since they don't have any transparent pixel diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index dd1cf076..b3f058c4 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -34,7 +34,9 @@ void HWR_InitTextureCache(void); void HWR_FreeTextureCache(void); void HWR_FreeExtraSubsectors(void); -void HWR_GetFlat(lumpnum_t flatlumpnum); +void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap); +// ^ some flats must NOT be remapped to encore, since we remap them as we cache them for ease, adding a toggle here seems wise. + GLTexture_t *HWR_GetTexture(INT32 tex); void HWR_GetPatch(GLPatch_t *gpatch); void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap); diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 3b1327cd..1a7cbdf7 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -28,7 +28,7 @@ #include "../p_local.h" #include "../p_setup.h" #include "../r_local.h" -#include "../r_bsp.h" +#include "../r_bsp.h" // R_NoEncore #include "../r_main.h" // cv_fov #include "../d_clisrv.h" #include "../w_wad.h" @@ -416,7 +416,7 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei if (angle) // Only needs to be done if there's an altered angle { - angle = InvAngle(angle)>>ANGLETOFINESHIFT; + angle = (InvAngle(angle)+ANGLE_180)>>ANGLETOFINESHIFT; // This needs to be done so that it scrolls in a different direction after rotation like software /*tempxsow = FLOAT_TO_FIXED(scrollx); @@ -1492,7 +1492,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { // Single sided line... Deal only with the middletexture (if one exists) gr_midtexture = R_GetTextureNum(gr_sidedef->midtexture); - if (gr_midtexture) + if (gr_midtexture && gr_linedef->special != 41) // (Ignore horizon line for OGL) { { fixed_t texturevpeg; @@ -2305,7 +2305,7 @@ void HWR_AddPolyObjectPlanes(void) } else { - HWR_GetFlat(levelflats[polyobjsector->floorpic].lumpnum); + HWR_GetFlat(levelflats[polyobjsector->floorpic].lumpnum, R_NoEncore(polyobjsector, false)); HWR_RenderPolyObjectPlane(po_ptrs[i], false, polyobjsector->floorheight, PF_Occlude, polyobjsector->lightlevel, levelflats[polyobjsector->floorpic].lumpnum, polyobjsector, 255, NULL); @@ -2327,7 +2327,7 @@ void HWR_AddPolyObjectPlanes(void) } else { - HWR_GetFlat(levelflats[polyobjsector->ceilingpic].lumpnum); + HWR_GetFlat(levelflats[polyobjsector->ceilingpic].lumpnum, R_NoEncore(polyobjsector, true)); HWR_RenderPolyObjectPlane(po_ptrs[i], true, polyobjsector->ceilingheight, PF_Occlude, polyobjsector->lightlevel, levelflats[polyobjsector->floorpic].lumpnum, polyobjsector, 255, NULL); @@ -2463,7 +2463,7 @@ void HWR_Subsector(size_t num) { if (sub->validcount != validcount) { - HWR_GetFlat(levelflats[gr_frontsector->floorpic].lumpnum); + HWR_GetFlat(levelflats[gr_frontsector->floorpic].lumpnum, R_NoEncore(gr_frontsector, false)); HWR_RenderPlane(&extrasubsectors[num], false, // Hack to make things continue to work around slopes. locFloorHeight == cullFloorHeight ? locFloorHeight : gr_frontsector->floorheight, @@ -2479,7 +2479,7 @@ void HWR_Subsector(size_t num) { if (sub->validcount != validcount) { - HWR_GetFlat(levelflats[gr_frontsector->ceilingpic].lumpnum); + HWR_GetFlat(levelflats[gr_frontsector->ceilingpic].lumpnum, R_NoEncore(gr_frontsector, true)); HWR_RenderPlane(&extrasubsectors[num], true, // Hack to make things continue to work around slopes. locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gr_frontsector->ceilingheight, @@ -2551,7 +2551,7 @@ void HWR_Subsector(size_t num) } else { - HWR_GetFlat(levelflats[*rover->bottompic].lumpnum); + HWR_GetFlat(levelflats[*rover->bottompic].lumpnum, R_NoEncore(gr_frontsector, false)); light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < cullHeight ? true : false); HWR_RenderPlane(&extrasubsectors[num], false, *rover->bottomheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum, rover->master->frontsector, 255, gr_frontsector->lightlist[light].extra_colormap); @@ -2606,7 +2606,7 @@ void HWR_Subsector(size_t num) } else { - HWR_GetFlat(levelflats[*rover->toppic].lumpnum); + HWR_GetFlat(levelflats[*rover->toppic].lumpnum, R_NoEncore(gr_frontsector, true)); light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < cullHeight ? true : false); HWR_RenderPlane(&extrasubsectors[num], true, *rover->topheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum, rover->master->frontsector, 255, gr_frontsector->lightlist[light].extra_colormap); @@ -3979,7 +3979,7 @@ void HWR_RenderDrawNodes(void) gr_frontsector = NULL; if (!(sortnode[sortindex[i]].plane->blend & PF_NoTexture)) - HWR_GetFlat(sortnode[sortindex[i]].plane->lumpnum); + HWR_GetFlat(sortnode[sortindex[i]].plane->lumpnum, false); HWR_RenderPlane(sortnode[sortindex[i]].plane->xsub, sortnode[sortindex[i]].plane->isceiling, sortnode[sortindex[i]].plane->fixedheight, sortnode[sortindex[i]].plane->blend, sortnode[sortindex[i]].plane->lightlevel, sortnode[sortindex[i]].plane->lumpnum, sortnode[sortindex[i]].plane->FOFSector, sortnode[sortindex[i]].plane->alpha, /*sortnode[sortindex[i]].plane->fogplane,*/ sortnode[sortindex[i]].plane->planecolormap); } @@ -3989,7 +3989,7 @@ void HWR_RenderDrawNodes(void) gr_frontsector = NULL; if (!(sortnode[sortindex[i]].polyplane->blend & PF_NoTexture)) - HWR_GetFlat(sortnode[sortindex[i]].polyplane->lumpnum); + HWR_GetFlat(sortnode[sortindex[i]].polyplane->lumpnum, false); HWR_RenderPolyObjectPlane(sortnode[sortindex[i]].polyplane->polysector, sortnode[sortindex[i]].polyplane->isceiling, sortnode[sortindex[i]].polyplane->fixedheight, sortnode[sortindex[i]].polyplane->blend, sortnode[sortindex[i]].polyplane->lightlevel, sortnode[sortindex[i]].polyplane->lumpnum, sortnode[sortindex[i]].polyplane->FOFSector, sortnode[sortindex[i]].polyplane->alpha, sortnode[sortindex[i]].polyplane->planecolormap); } diff --git a/src/r_bsp.c b/src/r_bsp.c index 296cbbe8..43cb6432 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -37,7 +37,7 @@ drawseg_t *ds_p = NULL; // indicates doors closed wrt automap bugfix: INT32 doorclosed; -static boolean R_NoEncore(sector_t *sector, boolean ceiling) +boolean R_NoEncore(sector_t *sector, boolean ceiling) { boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 15); #if 0 // perfect implementation diff --git a/src/r_bsp.h b/src/r_bsp.h index e3662e2e..1e4ca68f 100644 --- a/src/r_bsp.h +++ b/src/r_bsp.h @@ -40,6 +40,10 @@ void R_ClearDrawSegs(void); void R_RenderBSPNode(INT32 bspnum); void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2); +// determines when a given sector shouldn't abide by the encoremap's palette. +// no longer a static since this is used for encore in hw_main.c as well now: +boolean R_NoEncore(sector_t *sector, boolean ceiling); + #ifdef POLYOBJECTS void R_SortPolyObjects(subsector_t *sub);