(internal) Skins have their own GUI color indices : avoids sharing/restoring MC_ colors

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1121 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-10-31 15:46:07 +00:00
parent 1a2ac678e0
commit 036d8008cb
6 changed files with 105 additions and 95 deletions

View File

@ -994,13 +994,6 @@ void Add_font_or_skin(const char *name)
} }
// declared in windows.c for remap
extern byte Old_black;
extern byte Old_dark;
extern byte Old_light;
extern byte Old_white;
extern byte Old_trans;
// Callback to display a skin name in the list // Callback to display a skin name in the list
void Draw_one_skin_name(word x, word y, word index, byte highlighted) void Draw_one_skin_name(word x, word y, word index, byte highlighted)
{ {
@ -1009,8 +1002,7 @@ void Draw_one_skin_name(word x, word y, word index, byte highlighted)
if (Skin_files_list.Nb_elements) if (Skin_files_list.Nb_elements)
{ {
current_item = Get_item_by_index(&Skin_files_list, index); current_item = Get_item_by_index(&Skin_files_list, index);
// We use Old_ colors because previewing a skin mess up MC_ ... Print_in_window(x,y,current_item->Short_name, MC_Black, (highlighted)?MC_Dark:MC_Light);
Print_in_window(x,y,current_item->Short_name, Old_black, (highlighted)?Old_dark:Old_light);
} }
} }
@ -1058,13 +1050,6 @@ void Button_Skins(void)
selected_font = Find_file_in_fileselector(&Font_files_list, Config.Font_file); selected_font = Find_file_in_fileselector(&Font_files_list, Config.Font_file);
// Do this before setting up the skin list because it will redraw itself using the old colors...
Old_black = MC_Black;
Old_dark = MC_Dark;
Old_light = MC_Light;
Old_white = MC_White;
Old_trans = MC_Trans;
// -------------------------------------------------------------- // --------------------------------------------------------------
@ -1119,7 +1104,7 @@ void Button_Skins(void)
for (y = 14, offs_y = 0; offs_y < 16; offs_y++, y++) for (y = 14, offs_y = 0; offs_y < 16; offs_y++, y++)
for (x = 6, x_pos = 0; x_pos<173; x_pos++, x++) for (x = 6, x_pos = 0; x_pos<173; x_pos++, x++)
Pixel_in_window(x, y, Gfx->preview[offs_y][x_pos]); Pixel_in_window(x, y, Gfx->Preview[offs_y][x_pos]);
Update_window_area(0, 0, Window_width, Window_height); Update_window_area(0, 0, Window_width, Window_height);
@ -1147,23 +1132,27 @@ void Button_Skins(void)
if (gfx == NULL) // Error if (gfx == NULL) // Error
{ {
Verbose_error_message(Gui_loading_error_message); Verbose_error_message(Gui_loading_error_message);
// Update preview
Window_rectangle(4, 14, 174, 16, MC_Light);
} }
else
// Update preview {
// The new palette is not in place but the skin is loaded using the // Update preview
// new color indexes, so we have to reverse-remap it... // The new palette is not in place but the skin is loaded using the
for (y = 14, offs_y = 0; offs_y < 16; offs_y++, y++) // new color indexes, so we have to reverse-remap it...
for (x = 6, x_pos = 0; x_pos<173; x_pos++, x++) for (y = 14, offs_y = 0; offs_y < 16; offs_y++, y++)
{ for (x = 6, x_pos = 0; x_pos<173; x_pos++, x++)
if (gfx->preview[offs_y][x_pos] == MC_Black) {
Pixel_in_window(x, y, Old_black); if (gfx->Preview[offs_y][x_pos] == gfx->Color_black)
else if (gfx->preview[offs_y][x_pos] == MC_Dark) Pixel_in_window(x, y, MC_Black);
Pixel_in_window(x, y, Old_dark); else if (gfx->Preview[offs_y][x_pos] == gfx->Color_dark)
else if (gfx->preview[offs_y][x_pos] == MC_Light) Pixel_in_window(x, y, MC_Dark);
Pixel_in_window(x, y, Old_light); else if (gfx->Preview[offs_y][x_pos] == gfx->Color_white)
else if (gfx->preview[offs_y][x_pos] == MC_White) Pixel_in_window(x, y, MC_White);
Pixel_in_window(x, y, Old_white); else if (gfx->Preview[offs_y][x_pos] == gfx->Color_light)
} Pixel_in_window(x, y, MC_Light);
}
}
Update_window_area(4, 14, 174, 16); Update_window_area(4, 14, 174, 16);
break; break;
@ -1192,15 +1181,26 @@ void Button_Skins(void)
if(clicked_button == 1) if(clicked_button == 1)
{ {
byte * new_font; byte * new_font;
if (gfx != NULL) if (gfx != NULL)
{ {
free(Gfx); free(Gfx);
Gfx = gfx; Gfx = gfx;
free(Config.Skin_file); free(Config.Skin_file);
Config.Skin_file = strdup(skinsdir); Config.Skin_file = strdup(skinsdir);
Config.Fav_menu_colors[0] = gfx->Default_palette[gfx->Color_black];
Config.Fav_menu_colors[1] = gfx->Default_palette[gfx->Color_dark];
Config.Fav_menu_colors[2] = gfx->Default_palette[gfx->Color_light];
Config.Fav_menu_colors[3] = gfx->Default_palette[gfx->Color_white];
MC_Black = gfx->Color_black;
MC_Dark = gfx->Color_dark;
MC_Light = gfx->Color_light;
MC_White = gfx->Color_white;
MC_Trans = gfx->Color_trans;
} }
// (Re-)load the selected font // (Re-)load the selected font
new_font = Load_font(Get_item_by_index(&Font_files_list,selected_font)->Full_name); new_font = Load_font(Get_item_by_index(&Font_files_list,selected_font)->Full_name);
@ -1223,13 +1223,6 @@ void Button_Skins(void)
// and remap the skin // and remap the skin
Compute_optimal_menu_colors(Main_palette); Compute_optimal_menu_colors(Main_palette);
} else {
// Get the initial colors back
MC_Black = Old_black;
MC_Dark = Old_dark;
MC_Light = Old_light;
MC_White = Old_white;
MC_Trans = Old_trans;
} }
Close_window(); Close_window();

79
init.c
View File

@ -123,11 +123,11 @@ byte GUI_seek_right(SDL_Surface *gui, int *start_x, int start_y, byte neutral_co
return 1; return 1;
} }
byte Read_GUI_block(SDL_Surface *gui, int start_x, int start_y, void *dest, int width, int height, char * section, int type) byte Read_GUI_block(T_Gui_skin *gfx, SDL_Surface *gui, int start_x, int start_y, void *dest, int width, int height, char * section, int type)
{ {
// type: 0 = normal GUI element, only 4 colors allowed // type: 0 = normal GUI element, only 4 colors allowed
// type: 1 = mouse cursor, 4 colors allowed + transparent // type: 1 = mouse cursor, 4 colors allowed + transparent
// type: 2 = brush icon or sieve pattern (only MC_White and MC_Trans) // type: 2 = brush icon or sieve pattern (only gui->Color_white and gui->Color_trans)
// type: 3 = raw bitmap (splash screen) // type: 3 = raw bitmap (splash screen)
byte * dest_ptr=dest; byte * dest_ptr=dest;
@ -147,28 +147,28 @@ byte Read_GUI_block(SDL_Surface *gui, int start_x, int start_y, void *dest, int
for (x=start_x; x<start_x+width; x++) for (x=start_x; x<start_x+width; x++)
{ {
color=Get_SDL_pixel_8(gui,x,y); color=Get_SDL_pixel_8(gui,x,y);
if (type==0 && (color != MC_Black && color != MC_Dark && color != MC_Light && color != MC_White)) if (type==0 && (color != gfx->Color_black && color != gfx->Color_dark && color != gfx->Color_light && color != gfx->Color_white))
{ {
sprintf(Gui_loading_error_message, "Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the GUI colors (which were detected as %d,%d,%d,%d.\n", sprintf(Gui_loading_error_message, "Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the GUI colors (which were detected as %d,%d,%d,%d.\n",
start_x, start_y, height, width, section, x, y, color, MC_Black, MC_Dark, MC_Light, MC_White); start_x, start_y, height, width, section, x, y, color, gfx->Color_black, gfx->Color_dark, gfx->Color_light, gfx->Color_white);
return 1; return 1;
} }
if (type==1 && (color != MC_Black && color != MC_Dark && color != MC_Light && color != MC_White && color != MC_Trans)) if (type==1 && (color != gfx->Color_black && color != gfx->Color_dark && color != gfx->Color_light && color != gfx->Color_white && color != gfx->Color_trans))
{ {
sprintf(Gui_loading_error_message, "Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the mouse colors (which were detected as %d,%d,%d,%d,%d.\n", sprintf(Gui_loading_error_message, "Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the mouse colors (which were detected as %d,%d,%d,%d,%d.\n",
start_x, start_y, height, width, section, x, y, color, MC_Black, MC_Dark, MC_Light, MC_White, MC_Trans); start_x, start_y, height, width, section, x, y, color, gfx->Color_black, gfx->Color_dark, gfx->Color_light, gfx->Color_white, gfx->Color_trans);
return 1; return 1;
} }
if (type==2) if (type==2)
{ {
if (color != MC_White && color != MC_Trans) if (color != gfx->Color_white && color != gfx->Color_trans)
{ {
sprintf(Gui_loading_error_message, "Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the brush colors (which were detected as %d on %d.\n", sprintf(Gui_loading_error_message, "Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the brush colors (which were detected as %d on %d.\n",
start_x, start_y, height, width, section, x, y, color, MC_White, MC_Trans); start_x, start_y, height, width, section, x, y, color, gfx->Color_white, gfx->Color_trans);
return 1; return 1;
} }
// Conversion en 0/1 pour les brosses monochromes internes // Conversion en 0/1 pour les brosses monochromes internes
color = (color != MC_Trans); color = (color != gfx->Color_trans);
} }
*dest_ptr=color; *dest_ptr=color;
dest_ptr++; dest_ptr++;
@ -177,12 +177,12 @@ byte Read_GUI_block(SDL_Surface *gui, int start_x, int start_y, void *dest, int
return 0; return 0;
} }
byte Read_GUI_pattern(SDL_Surface *gui, int start_x, int start_y, word *dest, char * section) byte Read_GUI_pattern(T_Gui_skin *gfx, SDL_Surface *gui, int start_x, int start_y, word *dest, char * section)
{ {
byte buffer[256]; byte buffer[256];
int x,y; int x,y;
if (Read_GUI_block(gui, start_x, start_y, buffer, 16, 16, section, 2)) if (Read_GUI_block(gfx, gui, start_x, start_y, buffer, 16, 16, section, 2))
return 1; return 1;
for (y=0; y<16; y++) for (y=0; y<16; y++)
@ -209,7 +209,7 @@ void Center_GUI_cursor(T_Gui_skin *gfx, byte *cursor_buffer, int cursor_number)
{ {
for (y=0;y<29;y++) for (y=0;y<29;y++)
{ {
if (cursor_buffer[y*29+start_x]!=MC_Trans) if (cursor_buffer[y*29+start_x]!=gfx->Color_trans)
{ {
found=1; found=1;
break; break;
@ -224,7 +224,7 @@ void Center_GUI_cursor(T_Gui_skin *gfx, byte *cursor_buffer, int cursor_number)
{ {
for (x=0;x<29;x++) for (x=0;x<29;x++)
{ {
if (cursor_buffer[start_y*29+x]!=MC_Trans) if (cursor_buffer[start_y*29+x]!=gfx->Color_trans)
{ {
found=1; found=1;
break; break;
@ -271,8 +271,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
Get_SDL_Palette(SDLPal, gfx->Default_palette); Get_SDL_Palette(SDLPal, gfx->Default_palette);
// Carré "noir" // Carré "noir"
MC_Black = Get_SDL_pixel_8(gui,cursor_x,cursor_y); gfx->Color_black = Get_SDL_pixel_8(gui,cursor_x,cursor_y);
Fav_menu_colors[0] = gfx->Default_palette[MC_Black];
do do
{ {
if (++cursor_x>=gui->w) if (++cursor_x>=gui->w)
@ -281,10 +280,9 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
return 1; return 1;
} }
color=Get_SDL_pixel_8(gui,cursor_x,cursor_y); color=Get_SDL_pixel_8(gui,cursor_x,cursor_y);
} while(color==MC_Black); } while(color==gfx->Color_black);
// Carré "foncé" // Carré "foncé"
MC_Dark=color; gfx->Color_dark = color;
Fav_menu_colors[1] = gfx->Default_palette[MC_Dark];
do do
{ {
if (++cursor_x>=gui->w) if (++cursor_x>=gui->w)
@ -293,10 +291,9 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
return 1; return 1;
} }
color=Get_SDL_pixel_8(gui,cursor_x,cursor_y); color=Get_SDL_pixel_8(gui,cursor_x,cursor_y);
} while(color==MC_Dark); } while(color==gfx->Color_dark);
// Carré "clair" // Carré "clair"
MC_Light=color; gfx->Color_light = color;
Fav_menu_colors[2] = gfx->Default_palette[MC_Light];
do do
{ {
if (++cursor_x>gui->w) if (++cursor_x>gui->w)
@ -305,10 +302,9 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
return 1; return 1;
} }
color=Get_SDL_pixel_8(gui,cursor_x,cursor_y); color=Get_SDL_pixel_8(gui,cursor_x,cursor_y);
} while(color==MC_Light); } while(color==gfx->Color_light);
// Carré "blanc" // Carré "blanc"
MC_White=color; gfx->Color_white = color;
Fav_menu_colors[3] = gfx->Default_palette[MC_White];
do do
{ {
if (++cursor_x>=gui->w) if (++cursor_x>=gui->w)
@ -317,9 +313,9 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
return 1; return 1;
} }
color=Get_SDL_pixel_8(gui,cursor_x,cursor_y); color=Get_SDL_pixel_8(gui,cursor_x,cursor_y);
} while(color==MC_White); } while(color==gfx->Color_white);
// Carré "transparent" // Carré "transparent"
MC_Trans=color; gfx->Color_trans=color;
do do
{ {
if (++cursor_x>=gui->w) if (++cursor_x>=gui->w)
@ -328,14 +324,14 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
return 1; return 1;
} }
color=Get_SDL_pixel_8(gui,cursor_x,cursor_y); color=Get_SDL_pixel_8(gui,cursor_x,cursor_y);
} while(color==MC_Trans); } while(color==gfx->Color_trans);
// Reste : couleur neutre // Reste : couleur neutre
neutral_color=color; neutral_color=color;
cursor_x=0; cursor_x=0;
cursor_y=1; cursor_y=1;
while ((color=Get_SDL_pixel_8(gui,cursor_x,cursor_y))==MC_Black) while ((color=Get_SDL_pixel_8(gui,cursor_x,cursor_y))==gfx->Color_black)
{ {
cursor_y++; cursor_y++;
if (cursor_y>=gui->h) if (cursor_y>=gui->h)
@ -348,13 +344,13 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
// Menu // Menu
if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu")) if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu"))
return 1; return 1;
if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Menu_block, MENU_WIDTH, MENU_HEIGHT,"menu",0)) if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Menu_block, MENU_WIDTH, MENU_HEIGHT,"menu",0))
return 1; return 1;
cursor_x += MENU_WIDTH; cursor_x += MENU_WIDTH;
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "logo")) if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "logo"))
return 1; return 1;
if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->preview, 173, 16, "logo", 0)) if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Preview, 173, 16, "logo", 0))
return 1; return 1;
cursor_y+=MENU_HEIGHT; cursor_y+=MENU_HEIGHT;
@ -371,7 +367,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "effect sprite")) if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "effect sprite"))
return 1; return 1;
} }
if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Effect_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "effect sprite",0)) if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Effect_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "effect sprite",0))
return 1; return 1;
cursor_x+=MENU_SPRITE_WIDTH; cursor_x+=MENU_SPRITE_WIDTH;
} }
@ -390,7 +386,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "mouse cursor")) if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "mouse cursor"))
return 1; return 1;
} }
if (Read_GUI_block(gui, cursor_x, cursor_y, mouse_cursor_area, 29, 29, "mouse cursor",1)) if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, mouse_cursor_area, 29, 29, "mouse cursor",1))
return 1; return 1;
Center_GUI_cursor(gfx, (byte *)mouse_cursor_area,i); Center_GUI_cursor(gfx, (byte *)mouse_cursor_area,i);
cursor_x+=29; cursor_x+=29;
@ -410,7 +406,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "menu sprite")) if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "menu sprite"))
return 1; return 1;
} }
if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Menu_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "menu sprite",1)) if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Menu_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "menu sprite",1))
return 1; return 1;
cursor_x+=MENU_SPRITE_WIDTH; cursor_x+=MENU_SPRITE_WIDTH;
} }
@ -432,7 +428,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "brush icon")) if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "brush icon"))
return 1; return 1;
} }
if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Paintbrush_sprite[i], PAINTBRUSH_WIDTH, PAINTBRUSH_HEIGHT, "brush icon",2)) if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Paintbrush_sprite[i], PAINTBRUSH_WIDTH, PAINTBRUSH_HEIGHT, "brush icon",2))
return 1; return 1;
cursor_x+=PAINTBRUSH_WIDTH; cursor_x+=PAINTBRUSH_WIDTH;
} }
@ -451,7 +447,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "sprite drive")) if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "sprite drive"))
return 1; return 1;
} }
if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Icon_sprite[i], ICON_SPRITE_WIDTH, ICON_SPRITE_HEIGHT, "sprite drive",1)) if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Icon_sprite[i], ICON_SPRITE_WIDTH, ICON_SPRITE_HEIGHT, "sprite drive",1))
return 1; return 1;
cursor_x+=ICON_SPRITE_WIDTH; cursor_x+=ICON_SPRITE_WIDTH;
} }
@ -461,7 +457,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "logo menu")) if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "logo menu"))
return 1; return 1;
if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Logo_grafx2, 231, 56, "logo menu",3)) if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Logo_grafx2, 231, 56, "logo menu",3))
return 1; return 1;
cursor_y+=56; cursor_y+=56;
@ -478,7 +474,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "sieve pattern")) if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "sieve pattern"))
return 1; return 1;
} }
if (Read_GUI_pattern(gui, cursor_x, cursor_y, gfx->Sieve_pattern[i],"sieve pattern")) if (Read_GUI_pattern(gfx, gui, cursor_x, cursor_y, gfx->Sieve_pattern[i],"sieve pattern"))
return 1; return 1;
cursor_x+=16; cursor_x+=16;
} }
@ -500,7 +496,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (norm)")) if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (norm)"))
return 1; return 1;
} }
if (Read_GUI_block(gui, cursor_x, cursor_y, &(gfx->Help_font_norm[i][0][0]), 6, 8, "help font (norm)",0)) if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, &(gfx->Help_font_norm[i][0][0]), 6, 8, "help font (norm)",0))
return 1; return 1;
cursor_x+=6; cursor_x+=6;
} }
@ -522,7 +518,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (bold)")) if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (bold)"))
return 1; return 1;
} }
if (Read_GUI_block(gui, cursor_x, cursor_y, &(gfx->Bold_font[i][0][0]), 6, 8, "help font (bold)",0)) if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, &(gfx->Bold_font[i][0][0]), 6, 8, "help font (bold)",0))
return 1; return 1;
cursor_x+=6; cursor_x+=6;
} }
@ -557,15 +553,12 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
else else
dest=&(gfx->Help_font_t1[char_1++][0][0]); dest=&(gfx->Help_font_t1[char_1++][0][0]);
if (Read_GUI_block(gui, cursor_x, cursor_y, dest, 6, 8, "help font (title)",0)) if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, dest, 6, 8, "help font (title)",0))
return 1; return 1;
cursor_x+=6; cursor_x+=6;
} }
cursor_y+=8; cursor_y+=8;
Current_help_section=0;
Help_position=0;
gfx->Preset_paintbrush_width [ 0]= 1; gfx->Preset_paintbrush_width [ 0]= 1;
gfx->Preset_paintbrush_height[ 0]= 1; gfx->Preset_paintbrush_height[ 0]= 1;
gfx->Paintbrush_type [ 0]=PAINTBRUSH_SHAPE_SQUARE; gfx->Paintbrush_type [ 0]=PAINTBRUSH_SHAPE_SQUARE;

14
main.c
View File

@ -550,6 +550,9 @@ int Init_program(int argc,char * argv[])
Analyze_command_line(argc,argv); Analyze_command_line(argc,argv);
Current_help_section=0;
Help_position=0;
// Load sprites, palette etc. // Load sprites, palette etc.
strcpy(Gui_skin_file,Config.Skin_file); strcpy(Gui_skin_file,Config.Skin_file);
Gfx = Load_graphics(Gui_skin_file); Gfx = Load_graphics(Gui_skin_file);
@ -562,6 +565,17 @@ int Init_program(int argc,char * argv[])
Error(ERROR_GUI_MISSING); Error(ERROR_GUI_MISSING);
} }
} }
Config.Fav_menu_colors[0] = Gfx->Default_palette[Gfx->Color_black];
Config.Fav_menu_colors[1] = Gfx->Default_palette[Gfx->Color_dark];
Config.Fav_menu_colors[2] = Gfx->Default_palette[Gfx->Color_light];
Config.Fav_menu_colors[3] = Gfx->Default_palette[Gfx->Color_white];
MC_Black = Gfx->Color_black;
MC_Dark = Gfx->Color_dark;
MC_Light = Gfx->Color_light;
MC_White = Gfx->Color_white;
MC_Trans = Gfx->Color_trans;
// Infos sur les trames (Sieve) // Infos sur les trames (Sieve)
Sieve_mode=0; Sieve_mode=0;
Copy_preset_sieve(0); Copy_preset_sieve(0);

View File

@ -433,9 +433,9 @@ void Set_nice_menu_colors(dword * color_usage,int not_picture)
rgb[index].R=Main_palette[color].R; rgb[index].R=Main_palette[color].R;
rgb[index].G=Main_palette[color].G; rgb[index].G=Main_palette[color].G;
rgb[index].B=Main_palette[color].B; rgb[index].B=Main_palette[color].B;
Main_palette[color].R=Fav_menu_colors[index].R; Main_palette[color].R=Config.Fav_menu_colors[index].R;
Main_palette[color].G=Fav_menu_colors[index].G; Main_palette[color].G=Config.Fav_menu_colors[index].G;
Main_palette[color].B=Fav_menu_colors[index].B; Main_palette[color].B=Config.Fav_menu_colors[index].B;
} }
// Maintenant qu'on a placé notre nouvelle palette, on va chercher quelles // Maintenant qu'on a placé notre nouvelle palette, on va chercher quelles

View File

@ -427,8 +427,18 @@ typedef struct
T_Palette Default_palette; T_Palette Default_palette;
/// Preview for displaying in the skin dialog /// Preview for displaying in the skin dialog
byte preview[16][173]; byte Preview[16][173];
/// Black GUI color index in skin palette
byte Color_black;
/// Dark GUI color index in skin palette
byte Color_dark;
/// Light GUI color index in skin palette
byte Color_light;
/// White GUI color index in skin palette
byte Color_white;
/// Transparent GUI color index in skin file
byte Color_trans;
} T_Gui_skin; } T_Gui_skin;

View File

@ -2554,12 +2554,12 @@ void Compute_optimal_menu_colors(T_Components * palette)
// Recherche du noir // Recherche du noir
Compute_4_best_colors_for_1_menu_color Compute_4_best_colors_for_1_menu_color
(Fav_menu_colors[0].R, Fav_menu_colors[0].G, Fav_menu_colors[0].B,palette,table); (Config.Fav_menu_colors[0].R, Config.Fav_menu_colors[0].G, Config.Fav_menu_colors[0].B,palette,table);
MC_Black=table[0]; MC_Black=table[0];
// Recherche du blanc // Recherche du blanc
Compute_4_best_colors_for_1_menu_color Compute_4_best_colors_for_1_menu_color
(Fav_menu_colors[3].R, Fav_menu_colors[3].G, Fav_menu_colors[3].B,palette,table); (Config.Fav_menu_colors[3].R, Config.Fav_menu_colors[3].G, Config.Fav_menu_colors[3].B,palette,table);
if (MC_Black!=table[0]) if (MC_Black!=table[0])
MC_White=table[0]; MC_White=table[0];
else else
@ -2567,7 +2567,7 @@ void Compute_optimal_menu_colors(T_Components * palette)
// Recherche du gris clair // Recherche du gris clair
Compute_4_best_colors_for_1_menu_color Compute_4_best_colors_for_1_menu_color
(Fav_menu_colors[2].R, Fav_menu_colors[2].G, Fav_menu_colors[2].B,palette,table); (Config.Fav_menu_colors[2].R, Config.Fav_menu_colors[2].G, Config.Fav_menu_colors[2].B,palette,table);
if ( (MC_Black!=table[0]) && (MC_White!=table[0]) ) if ( (MC_Black!=table[0]) && (MC_White!=table[0]) )
MC_Light=table[0]; MC_Light=table[0];
else else
@ -2580,7 +2580,7 @@ void Compute_optimal_menu_colors(T_Components * palette)
// Recherche du gris foncé // Recherche du gris foncé
Compute_4_best_colors_for_1_menu_color Compute_4_best_colors_for_1_menu_color
(Fav_menu_colors[1].R, Fav_menu_colors[1].G, Fav_menu_colors[1].B,palette,table); (Config.Fav_menu_colors[1].R, Config.Fav_menu_colors[1].G, Config.Fav_menu_colors[1].B,palette,table);
if ( (MC_Black!=table[0]) && (MC_White!=table[0]) && (MC_Light!=table[0]) ) if ( (MC_Black!=table[0]) && (MC_White!=table[0]) && (MC_Light!=table[0]) )
MC_Dark=table[0]; MC_Dark=table[0];
else else
@ -2678,7 +2678,7 @@ void Remap_menu_sprites()
// Skin preview // Skin preview
for (j = 0; j < 173; j++) for (j = 0; j < 173; j++)
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
Remap_pixel(&Gfx->preview[i][j]); Remap_pixel(&Gfx->Preview[i][j]);
} }
Clear_border(MC_Black); Clear_border(MC_Black);
} }