Proper remapping on skin change in (almost) all cases. I commit this before breaking everything trying to fix the remaining issue...
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1114 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
f9dc259af5
commit
a2fd796e59
37
buttons.c
37
buttons.c
@ -1014,6 +1014,11 @@ void Draw_one_skin_name(word x, word y, word index, byte highlighted)
|
||||
}
|
||||
}
|
||||
|
||||
#define SWAP_BYTES(a,b) { byte c=a; a=b; b=c;}
|
||||
#define SWAP_WORDS(a,b) { word c=a; a=b; b=c;}
|
||||
#define SWAP_SHORTS(a,b) { short c=a; a=b; b=c;}
|
||||
#define SWAP_FLOATS(a,b) { float c=a; a=b; b=c;}
|
||||
|
||||
/// Skin selector window
|
||||
void Button_Skins(void)
|
||||
{
|
||||
@ -1108,7 +1113,7 @@ void Button_Skins(void)
|
||||
for (x = 6, x_pos = 0; x_pos<173; x_pos++, x++)
|
||||
Pixel_in_window(x, y, skin_logo[offs_y][x_pos]);
|
||||
|
||||
Update_window_area(0,0,Window_width, Window_height);
|
||||
Update_window_area(0, 0, Window_width, Window_height);
|
||||
|
||||
Display_cursor();
|
||||
|
||||
@ -1212,6 +1217,31 @@ void Button_Skins(void)
|
||||
Config.Display_image_limits = showlimits;
|
||||
Config.Separate_colors = separatecolors;
|
||||
|
||||
// We loaded a new menu but not changed the palette
|
||||
// So we have to remap FROM MC_ TO Old_ and not the reverse way...
|
||||
SWAP_BYTES(Old_black, MC_Black);
|
||||
SWAP_BYTES(Old_dark, MC_Dark);
|
||||
SWAP_BYTES(Old_light, MC_Light);
|
||||
SWAP_BYTES(Old_white, MC_White);
|
||||
SWAP_BYTES(Old_trans, MC_Trans);
|
||||
Remap_menu_sprites();
|
||||
Old_black = MC_Black;
|
||||
Old_dark = MC_Dark;
|
||||
Old_light = MC_Light;
|
||||
Old_white = MC_White;
|
||||
Old_trans = MC_Trans;
|
||||
|
||||
} else {
|
||||
MC_Black = Old_black;
|
||||
MC_Dark = Old_dark;
|
||||
MC_Light = Old_light;
|
||||
MC_White = Old_white;
|
||||
MC_Trans = Old_trans;
|
||||
|
||||
// TODO : il faudrait aussi restaurer la preview du skin initial, soit ici
|
||||
// soit la prochaine fois qu'on ouvre la fenêtre. Une solution est de
|
||||
// ne pas utiliser une variable globale pour skin_logo mais de la mettre
|
||||
// dans gfx à la place.
|
||||
}
|
||||
|
||||
Close_window();
|
||||
@ -1228,11 +1258,6 @@ void Button_Page(void)
|
||||
byte factor_index;
|
||||
char Temp_buffer[256];
|
||||
|
||||
#define SWAP_BYTES(a,b) { byte c=a; a=b; b=c;}
|
||||
#define SWAP_WORDS(a,b) { word c=a; a=b; b=c;}
|
||||
#define SWAP_SHORTS(a,b) { short c=a; a=b; b=c;}
|
||||
#define SWAP_FLOATS(a,b) { float c=a; a=b; b=c;}
|
||||
|
||||
Hide_cursor();
|
||||
|
||||
// On dégrossit le travail avec les infos des listes de pages
|
||||
|
||||
24
windows.c
24
windows.c
@ -2543,14 +2543,14 @@ void Remap_screen_after_menu_colors_change(void)
|
||||
void Compute_optimal_menu_colors(T_Components * palette)
|
||||
{
|
||||
byte table[4];
|
||||
short i,j,k;
|
||||
short i;
|
||||
|
||||
|
||||
Old_black =MC_Black;
|
||||
Old_dark=MC_Dark;
|
||||
Old_light=MC_Light;
|
||||
Old_white=MC_White;
|
||||
Old_trans=MC_Trans;
|
||||
Old_dark = MC_Dark;
|
||||
Old_light = MC_Light;
|
||||
Old_white = MC_White;
|
||||
Old_trans = MC_Trans;
|
||||
|
||||
// Recherche du noir
|
||||
Compute_4_best_colors_for_1_menu_color
|
||||
@ -2610,7 +2610,14 @@ void Compute_optimal_menu_colors(T_Components * palette)
|
||||
for (MC_Trans=0; ((MC_Trans==MC_Black) || (MC_Trans==MC_Dark) ||
|
||||
(MC_Trans==MC_Light) || (MC_Trans==MC_White)); MC_Trans++);
|
||||
|
||||
// Et maintenant, on "remappe" tous les sprites, etc...
|
||||
Remap_menu_sprites();
|
||||
}
|
||||
|
||||
/// Remap all menu data when the palette changes or a new skin is loaded
|
||||
void Remap_menu_sprites()
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
if ( (MC_Light!=Old_light)
|
||||
|| (MC_Dark!=Old_dark)
|
||||
|| (MC_White!=Old_white)
|
||||
@ -2667,6 +2674,11 @@ void Compute_optimal_menu_colors(T_Components * palette)
|
||||
for (j=0; j<ICON_SPRITE_HEIGHT; j++)
|
||||
for (i=0; i<ICON_SPRITE_WIDTH; i++)
|
||||
Remap_pixel(&Gfx->Icon_sprite[k][j][i]);
|
||||
|
||||
// Skin preview
|
||||
for (j = 0; j < 173; j++)
|
||||
for (i = 0; i < 16; i++)
|
||||
Remap_pixel(&skin_logo[i][j]);
|
||||
}
|
||||
Clear_border(MC_Black);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user