mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-26 19:21:13 +00:00
Fix brightness issues with 2d drawing functions and palette rendering
This commit is contained in:
parent
725a8195ab
commit
913bbb3fc0
3 changed files with 12 additions and 6 deletions
|
@ -35,7 +35,7 @@ INT32 textureformat = GL_TEXFMT_P_8; // use chromakey for hole
|
|||
RGBA_t mapPalette[256] = {0}; // the palette for the currently loaded level or menu etc.
|
||||
|
||||
// Returns a pointer to the palette which should be used for caching textures.
|
||||
static RGBA_t *HWR_GetTexturePalette(void)
|
||||
RGBA_t *HWR_GetTexturePalette(void)
|
||||
{
|
||||
return HWR_ShouldUsePaletteRendering() ? mapPalette : pLocalPalette;
|
||||
}
|
||||
|
|
|
@ -672,7 +672,8 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
|||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
Surf.PolyColor.rgba = V_GetColor(color).rgba;
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
|
||||
}
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
|
@ -845,7 +846,8 @@ void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 ac
|
|||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
Surf.PolyColor.rgba = V_GetColor(actualcolor).rgba;
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
Surf.PolyColor.rgba = palette[actualcolor&0xFF].rgba;
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
|
||||
}
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
|
@ -1050,8 +1052,9 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
|
|||
{
|
||||
F2DCoord v1, v2;
|
||||
RGBA_t color_rgba;
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
|
||||
color_rgba = V_GetColor(color);
|
||||
color_rgba = palette[color&0xFF];
|
||||
|
||||
v1.x = ((float)fl->a.x-(vid.width/2.0f))*(2.0f/vid.width);
|
||||
v1.y = ((float)fl->a.y-(vid.height/2.0f))*(2.0f/vid.height);
|
||||
|
@ -1236,6 +1239,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
float fx, fy, fw, fh;
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
|
||||
UINT8 perplayershuffle = 0;
|
||||
|
||||
|
@ -1323,7 +1327,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||
|
||||
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
||||
{
|
||||
RGBA_t rgbaColour = V_GetColor(color);
|
||||
RGBA_t rgbaColour = palette[color&0xFF];
|
||||
FRGBAFloat clearColour;
|
||||
clearColour.red = (float)rgbaColour.s.red / 255;
|
||||
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||
|
@ -1400,7 +1404,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = 1.0f;
|
||||
|
||||
Surf.PolyColor = V_GetColor(color);
|
||||
Surf.PolyColor = palette[color&0xFF];
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
|
|
|
@ -104,6 +104,8 @@ void HWR_FreeExtraSubsectors(void);
|
|||
// --------
|
||||
// hw_cache.c
|
||||
// --------
|
||||
RGBA_t *HWR_GetTexturePalette(void);
|
||||
|
||||
void HWR_InitMapTextures(void);
|
||||
void HWR_LoadMapTextures(size_t pnumtextures);
|
||||
void HWR_FreeMapTextures(void);
|
||||
|
|
Loading…
Reference in a new issue