From b0175a22b22467afd154f73f9111899c7cf49aed Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Fri, 26 Apr 2019 22:05:15 +0200 Subject: [PATCH] Add "EHB" button in palette dialog. allow to build an Amiga "Extra Half Bright" palette. OCS/ECS rocks ! --- src/helpfile.h | 3 +++ src/palette.c | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/helpfile.h b/src/helpfile.h index ac0556ae..c7bf8847 100644 --- a/src/helpfile.h +++ b/src/helpfile.h @@ -2879,6 +2879,9 @@ static const T_Help_table helptable_palette[] = HELP_TEXT ("to the number of colors you want (and") HELP_TEXT ("modifies the picture).") HELP_TEXT ("") + HELP_TEXT ("- EHB: Amiga Extra Half Bright. Sets colors") + HELP_TEXT ("32 to 63 to half tones of colors 0 to 31.") + HELP_TEXT ("") HELP_TEXT ("- Undo: Allows you to recover the last") HELP_TEXT ("modifications made on the palette. Note that") HELP_TEXT ("it can't undo the changes that affect the") diff --git a/src/palette.c b/src/palette.c index 008266ac..ab01dd3d 100644 --- a/src/palette.c +++ b/src/palette.c @@ -1085,15 +1085,15 @@ void Button_Palette(int btn) // Coordinates of the block that displays Backcolor static const int BGCOLOR_DISPLAY_X = 176; - static const int BGCOLOR_DISPLAY_Y = 65; + static const int BGCOLOR_DISPLAY_Y = 65 + 14; static const int BGCOLOR_DISPLAY_W = 40; - static const int BGCOLOR_DISPLAY_H = 96; + static const int BGCOLOR_DISPLAY_H = 96 - 14; // Coordinates of the block that displays Forecolor static const int FGCOLOR_DISPLAY_X = 180; - static const int FGCOLOR_DISPLAY_Y = 69; + static const int FGCOLOR_DISPLAY_Y = 69 + 14; static const int FGCOLOR_DISPLAY_W = 32; - static const int FGCOLOR_DISPLAY_H = 88; + static const int FGCOLOR_DISPLAY_H = 88 - 14; // Coordinates of the Color# static const int COLOR_X = 111; @@ -1252,6 +1252,8 @@ void Button_Palette(int btn) Window_set_normal_button( 44,178,35,14,"Load" ,1,1,KEY_l); // 26 Window_set_normal_button( 83,178,35,14,"Save" ,1,1,KEY_s); // 27 + Window_set_normal_button( 89+84,L4,39,14,"EHB" ,3,1,KEY_b); // 28 + // Dessin des petits effets spéciaux pour les boutons [+] et [-] Draw_thingumajig(BUTTON_PLUS_X-5, BUTTON_PLUS_Y,MC_White,-1); Draw_thingumajig(BUTTON_MINUS_X+16,BUTTON_MINUS_Y,MC_Dark,+1); @@ -2628,6 +2630,16 @@ void Button_Palette(int btn) case 27: // Save palette Save_picture(CONTEXT_PALETTE); break; + + case 28: // EHB : Amiga Extra Half Bright + for (i = 0; i < 32; i++) + { + working_palette[i+32].R = working_palette[i].R >> 1; + working_palette[i+32].G = working_palette[i].G >> 1; + working_palette[i+32].B = working_palette[i].B >> 1; + } + Set_palette(working_palette); + break; }