mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Exterminate the smurfs! This fixes the problem where everything in the game was drastically hue shifted on certain hardware configurations, particularly the Raspberry Pi.
git-svn-id: https://svn.eduke32.com/eduke32@5884 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
231c22d654
commit
b18db99691
3 changed files with 27 additions and 8 deletions
|
@ -596,7 +596,7 @@ void removebasepal(int32_t const id)
|
|||
// 16: don't reset palfade*
|
||||
void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags)
|
||||
{
|
||||
int32_t i, j, nohwgamma;
|
||||
int32_t i, j;
|
||||
const uint8_t *dapal;
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
|
@ -624,8 +624,8 @@ void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags)
|
|||
// vid_gamma = 1.0 + ((float)curbrightness / 10.0);
|
||||
}
|
||||
|
||||
nohwgamma = setgamma();
|
||||
j = nohwgamma ? curbrightness : 0;
|
||||
setgamma();
|
||||
j = !gammabrightness ? curbrightness : 0;
|
||||
|
||||
for (i=0; i<256; i++)
|
||||
{
|
||||
|
@ -669,7 +669,7 @@ void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags)
|
|||
|
||||
// XXX: no-HW-gamma OpenGL platforms will exhibit bad performance with
|
||||
// simultaneous basepal and tint changes?
|
||||
const int32_t doinvalidate = (paldidchange || (palsumdidchange && nohwgamma));
|
||||
const int32_t doinvalidate = (paldidchange || (palsumdidchange && !gammabrightness));
|
||||
|
||||
if (!(flags&2) && doinvalidate)
|
||||
gltexinvalidatetype(INVALIDATE_ALL);
|
||||
|
@ -693,9 +693,8 @@ palette_t getpal(int32_t col)
|
|||
{
|
||||
if (!gammabrightness)
|
||||
{
|
||||
palette_t p ={ britable[curbrightness][curpalette[col].b],
|
||||
britable[curbrightness][curpalette[col].g],
|
||||
britable[curbrightness][curpalette[col].r], 0 };
|
||||
palette_t const p = { britable[curbrightness][curpalette[col].r], britable[curbrightness][curpalette[col].g],
|
||||
britable[curbrightness][curpalette[col].b], 0 };
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
@ -1877,8 +1877,18 @@ int32_t setgamma(void)
|
|||
if (i < 0)
|
||||
{
|
||||
#ifndef __ANDROID__ // Don't do this check, it is really supported, TODO
|
||||
/*
|
||||
if (i != INT32_MIN)
|
||||
initprintf("Unable to set gamma: SDL_SetWindowGammaRamp failed: %s\n", SDL_GetError());
|
||||
*/
|
||||
|
||||
#if SDL_MAJOR_VERSION == 1
|
||||
SDL_SetGammaRamp(&sysgamma[0][0], &sysgamma[1][0], &sysgamma[2][0]);
|
||||
#else
|
||||
if (sdl_window)
|
||||
SDL_SetWindowGammaRamp(sdl_window, &sysgamma[0][0], &sysgamma[1][0], &sysgamma[2][0]);
|
||||
#endif
|
||||
gammabrightness = 0;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -1887,6 +1897,8 @@ int32_t setgamma(void)
|
|||
lastvidgcb[0] = gamma;
|
||||
lastvidgcb[1] = contrast;
|
||||
lastvidgcb[2] = bright;
|
||||
|
||||
gammabrightness = 1;
|
||||
}
|
||||
|
||||
return i;
|
||||
|
|
|
@ -471,6 +471,8 @@ static MenuEntry_t ME_VIDEOSETUP_APPLY = MAKE_MENUENTRY( "Apply Changes", &MF_Re
|
|||
|
||||
static MenuLink_t MEO_DISPLAYSETUP_COLORCORR = { MENU_COLCORR, MA_Advance, };
|
||||
static MenuEntry_t ME_DISPLAYSETUP_COLORCORR = MAKE_MENUENTRY( "Color Correction", &MF_Redfont, &MEF_BigOptionsRt, &MEO_DISPLAYSETUP_COLORCORR, Link );
|
||||
|
||||
|
||||
static MenuOption_t MEO_DISPLAYSETUP_PIXELDOUBLING = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OnOff, &ud.detail );
|
||||
static MenuEntry_t ME_DISPLAYSETUP_PIXELDOUBLING = MAKE_MENUENTRY( "Pixel Doubling:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_DISPLAYSETUP_PIXELDOUBLING, Option );
|
||||
|
||||
|
@ -976,7 +978,7 @@ static MenuEntry_t *MEL_RENDERERSETUP_POLYMER [] ={
|
|||
#ifdef DROIDMENU
|
||||
static MenuRangeFloat_t MEO_COLCORR_GAMMA = MAKE_MENURANGE( &vid_gamma, &MF_Bluefont, 1.f, 2.5f, 0.f, 39, 1 );
|
||||
#else
|
||||
static MenuRangeFloat_t MEO_COLCORR_GAMMA = MAKE_MENURANGE( &vid_gamma, &MF_Bluefont, 0.2f, 4.f, 0.f, 39, 1 );
|
||||
static MenuRangeFloat_t MEO_COLCORR_GAMMA = MAKE_MENURANGE( &vid_gamma, &MF_Bluefont, 0.3f, 4.f, 0.f, 38, 1 );
|
||||
#endif
|
||||
static MenuEntry_t ME_COLCORR_GAMMA = MAKE_MENUENTRY( "Gamma:", &MF_Redfont, &MEF_ColorCorrect, &MEO_COLCORR_GAMMA, RangeFloat );
|
||||
static MenuRangeFloat_t MEO_COLCORR_CONTRAST = MAKE_MENURANGE( &vid_contrast, &MF_Bluefont, 0.1f, 2.7f, 0.f, 53, 1 );
|
||||
|
@ -1772,6 +1774,12 @@ static void M_PreMenu(MenuID_t cm)
|
|||
MEO_SAVE[i].font = (g_oldverSavegame[i] && MEO_SAVE[i].editfield == NULL) ? &MF_MinifontDarkGray : &MF_MinifontRed;
|
||||
break;
|
||||
|
||||
case MENU_COLCORR:
|
||||
case MENU_COLCORR_INGAME:
|
||||
MenuEntry_DisableOnCondition(&ME_COLCORR_CONTRAST, !gammabrightness);
|
||||
MenuEntry_DisableOnCondition(&ME_COLCORR_BRIGHTNESS, !gammabrightness);
|
||||
break;
|
||||
|
||||
case MENU_CHEATS:
|
||||
case MENU_CHEATENTRY:
|
||||
case MENU_CHEAT_WARP:
|
||||
|
|
Loading…
Reference in a new issue