From 2b02ff505f37cb731e93c0c6a2f6586018a084a1 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 31 Oct 2009 11:19:44 +0000 Subject: [PATCH] Moved skin preview to the Gfx struct so it is not overwritten if you cancel skin loading. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1115 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- buttons.c | 10 +++++----- global.h | 3 --- init.c | 2 +- op_c.c | 2 +- struct.h | 4 ++++ windows.c | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/buttons.c b/buttons.c index 4d7a101a..b06925a8 100644 --- a/buttons.c +++ b/buttons.c @@ -1111,7 +1111,7 @@ void Button_Skins(void) for (y = 14, offs_y = 0; offs_y < 16; offs_y++, y++) for (x = 6, x_pos = 0; x_pos<173; x_pos++, x++) - Pixel_in_window(x, y, skin_logo[offs_y][x_pos]); + Pixel_in_window(x, y, Gfx->preview[offs_y][x_pos]); Update_window_area(0, 0, Window_width, Window_height); @@ -1153,13 +1153,13 @@ void Button_Skins(void) 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 (skin_logo[offs_y][x_pos] == MC_Black) + if (gfx->preview[offs_y][x_pos] == MC_Black) Pixel_in_window(x, y, Old_black); - else if (skin_logo[offs_y][x_pos] == MC_Dark) + else if (gfx->preview[offs_y][x_pos] == MC_Dark) Pixel_in_window(x, y, Old_dark); - else if (skin_logo[offs_y][x_pos] == MC_Light) + else if (gfx->preview[offs_y][x_pos] == MC_Light) Pixel_in_window(x, y, Old_light); - else if (skin_logo[offs_y][x_pos] == MC_White) + else if (gfx->preview[offs_y][x_pos] == MC_White) Pixel_in_window(x, y, Old_white); } Update_window_area(4, 14, 174, 16); diff --git a/global.h b/global.h index 37a3f6d3..b2eef28d 100644 --- a/global.h +++ b/global.h @@ -805,9 +805,6 @@ GFX2_GLOBAL byte * Menu_font; /// Pointer to the current active skin. GFX2_GLOBAL T_Gui_skin * Gfx; -/// Logo of skin -byte skin_logo[16][173]; - // -- Help data /// Index of the ::Help_section shown by the Help screen. diff --git a/init.c b/init.c index 44de50f4..cffa297a 100644 --- a/init.c +++ b/init.c @@ -350,7 +350,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx) cursor_x += MENU_WIDTH; if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "logo")) return 1; - if (Read_GUI_block(gui, cursor_x, cursor_y, skin_logo, 173, 16, "logo", 0)) + if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->preview, 173, 16, "logo", 0)) return 1; cursor_y+=MENU_HEIGHT; diff --git a/op_c.c b/op_c.c index e0d28767..1417a623 100644 --- a/op_c.c +++ b/op_c.c @@ -1206,7 +1206,7 @@ void Convert_24b_bitmap_to_256_Floyd_Steinberg(T_Bitmap256 dest,T_Bitmap24B sour } void Convert_24b_bitmap_to_256_nearest_neighbor(T_Bitmap256 dest, - T_Bitmap24B source, int width, int height, T_Components * palette, + T_Bitmap24B source, int width, int height, __attribute__((unused)) T_Components * palette, T_Conversion_table * tc) { T_Bitmap24B current; diff --git a/struct.h b/struct.h index 5b03f0f2..81502a07 100644 --- a/struct.h +++ b/struct.h @@ -426,6 +426,10 @@ typedef struct /// A default 256-color palette. T_Palette Default_palette; + /// Preview for displaying in the skin dialog + byte preview[16][173]; + + } T_Gui_skin; diff --git a/windows.c b/windows.c index 00577a7b..9ed71284 100644 --- a/windows.c +++ b/windows.c @@ -2678,7 +2678,7 @@ void Remap_menu_sprites() // Skin preview for (j = 0; j < 173; j++) for (i = 0; i < 16; i++) - Remap_pixel(&skin_logo[i][j]); + Remap_pixel(&Gfx->preview[i][j]); } Clear_border(MC_Black); }