diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index 3655beb8a..b8490f4ed 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -124,7 +124,7 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt polygonArray[polygonArraySize].numVerts = iNumPts; polygonArray[polygonArraySize].polyFlags = PolyFlags; polygonArray[polygonArraySize].texture = current_texture; - polygonArray[polygonArraySize].shader = (shader_target != -1) ? HWR_GetShaderFromTarget(shader_target) : shader_target; + polygonArray[polygonArraySize].shader = (shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target; polygonArray[polygonArraySize].horizonSpecial = horizonSpecial; polygonArraySize++; diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 7254ba227..3d52df320 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -46,12 +46,16 @@ RGBA_t *HWR_GetTexturePalette(void) static INT32 format2bpp(GLTextureFormat_t format) { - if (format == GL_TEXFMT_RGBA) - return 4; - else if (format == GL_TEXFMT_ALPHA_INTENSITY_88 || format == GL_TEXFMT_AP_88) - return 2; - else - return 1; + switch (format) + { + case GL_TEXFMT_RGBA: + return 4; + case GL_TEXFMT_ALPHA_INTENSITY_88: + case GL_TEXFMT_AP_88: + return 2; + default: + return 1; + } } // This code was originally placed directly in HWR_DrawPatchInCache. @@ -221,8 +225,6 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap, if (texture->width <= 0 || texture->height <= 0) return; - palette = HWR_GetTexturePalette(); - x1 = patch->originx; width = SHORT(realpatch->width); height = SHORT(realpatch->height); @@ -234,6 +236,8 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap, if (patch->originy > texture->height || (patch->originy + height) < 0) return; // patch not located within texture's y bounds, ignore + palette = HWR_GetTexturePalette(); + // patch is actually inside the texture! // now check if texture is partly off-screen and adjust accordingly @@ -323,7 +327,6 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe boolean skyspecial = false; // poor hack for Legacy large skies.. RGBA_t *palette; - palette = HWR_GetTexturePalette(); texture = textures[texnum]; @@ -361,6 +364,8 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe INT32 j; RGBA_t col; + palette = HWR_GetTexturePalette(); + col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX]; for (idx = 0, j = 0; j < blockheight; j++) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 0f308017d..51f3346dc 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5764,7 +5764,7 @@ static void HWR_TogglePaletteRendering(void) // If the r_opengl "texture palette" stays the same during this switch, these textures // will not be cleared out. However they are still out of date since the // composite texture blending method has changed. Therefore they need to be cleared. - GL_ClearMipMapCache(); + HWR_LoadMapTextures(numtextures); } } else @@ -5778,7 +5778,7 @@ static void HWR_TogglePaletteRendering(void) // If the r_opengl "texture palette" stays the same during this switch, these textures // will not be cleared out. However they are still out of date since the // composite texture blending method has changed. Therefore they need to be cleared. - GL_ClearMipMapCache(); + HWR_LoadMapTextures(numtextures); } } } diff --git a/src/st_stuff.c b/src/st_stuff.c index 04523f577..4f5401aae 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -187,7 +187,7 @@ void ST_doPaletteStuff(void) #ifdef HWRENDER if (rendermode == render_opengl && !HWR_PalRenderFlashpal()) - palette = 0; // No flashpals here in OpenGL + palette = 0; // Don't set the palette to a flashpal in OpenGL's truecolor mode #endif palette = min(max(palette, 0), 13);