Use common helper to copy and bound palettes
This commit is contained in:
parent
11f7bc51ee
commit
50b1717ae3
|
@ -1002,16 +1002,21 @@ void gr_palette_step_up(int r, int g, int b)
|
|||
#undef min
|
||||
using std::min;
|
||||
|
||||
void gr_palette_load( ubyte *pal )
|
||||
static void gr_palette_copy( ubyte *d, const ubyte *s )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<768; i++ )
|
||||
{
|
||||
gr_current_pal[i] = pal[i];
|
||||
if (gr_current_pal[i] > 63)
|
||||
gr_current_pal[i] = 63;
|
||||
d[i] = s[i];
|
||||
if (d[i] > 63)
|
||||
d[i] = 63;
|
||||
}
|
||||
}
|
||||
|
||||
void gr_palette_load( ubyte *pal )
|
||||
{
|
||||
gr_palette_copy(gr_current_pal, pal);
|
||||
|
||||
gr_palette_step_up(0, 0, 0); // make ogl_setbrightness_internal get run so that menus get brightened too.
|
||||
init_computed_colors();
|
||||
|
@ -1019,13 +1024,7 @@ void gr_palette_load( ubyte *pal )
|
|||
|
||||
void gr_palette_read(ubyte * pal)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<768; i++ )
|
||||
{
|
||||
pal[i]=gr_current_pal[i];
|
||||
if (pal[i] > 63)
|
||||
pal[i] = 63;
|
||||
}
|
||||
gr_palette_copy(pal, gr_current_pal);
|
||||
}
|
||||
|
||||
#define GL_BGR_EXT 0x80E0
|
||||
|
|
Loading…
Reference in a new issue