diff --git a/engine.c b/engine.c index ef958885..31fc37cc 100644 --- a/engine.c +++ b/engine.c @@ -66,7 +66,7 @@ byte* Window_background[8]; ///Table of tooltip texts for menu buttons char * Menu_tooltip[NB_BUTTONS]= { - "Toolbars / Hide toolbars", + "Hide toolbars / Select ", "Layers manager ", "Get/Set transparent col.", diff --git a/factory.c b/factory.c index 2b93b31d..95d468ea 100644 --- a/factory.c +++ b/factory.c @@ -52,6 +52,15 @@ static word Brush_backup_height; static byte Palette_has_changed; static byte Brush_was_altered; +/// Helper function to clamp a double to 0-255 range +inline byte clamp_byte(double value) +{ + if (value<0.0) + return 0; + else if (value>255.0) + return 255; + else return (byte)value; +} // Wrapper functions to call C from Lua @@ -224,10 +233,10 @@ int L_GetLayerPixel(lua_State* L) int L_SetColor(lua_State* L) { byte c=lua_tonumber(L,1); - byte r=lua_tonumber(L,2); - byte g=lua_tonumber(L,3); - byte b=lua_tonumber(L,4); - + byte r=clamp_byte(lua_tonumber(L,2)); + byte g=clamp_byte(lua_tonumber(L,3)); + byte b=clamp_byte(lua_tonumber(L,4)); + Main_palette[c].R=Round_palette_component(r); Main_palette[c].G=Round_palette_component(g); Main_palette[c].B=Round_palette_component(b); @@ -258,7 +267,11 @@ int L_GetBackupColor(lua_State* L) int L_MatchColor(lua_State* L) { - int c = Best_color_nonexcluded(lua_tonumber(L,1), lua_tonumber(L, 2), lua_tonumber(L, 3)); + byte r=clamp_byte(lua_tonumber(L,1)); + byte g=clamp_byte(lua_tonumber(L,2)); + byte b=clamp_byte(lua_tonumber(L,3)); + + int c = Best_color_nonexcluded(r,g,b); lua_pushinteger(L, c); return 1; } diff --git a/helpfile.h b/helpfile.h index 05849546..de165ce8 100644 --- a/helpfile.h +++ b/helpfile.h @@ -412,7 +412,7 @@ static const T_Help_table helptable_credits[] = HELP_TEXT ("") //HELP_TEXT ("0----5----0----5----0----5----0----5----0--X") HELP_TEXT (" anibiqme blumunkee BDCIron ") - HELP_TEXT (" Ced Dawnbringer El Topo ") + HELP_TEXT (" Ced DawnBringer El Topo ") HELP_TEXT (" falenblood fano Frost ") HELP_TEXT (" Grimmy Gürkan Sengün Hatch ") HELP_TEXT (" HoraK-FDF iLKke Iw2evk ") @@ -2479,17 +2479,17 @@ static const T_Help_table helptable_hide[] = HELP_TITLE("HIDE MENU") HELP_TEXT ("") HELP_BOLD ("LEFT CLICK") - HELP_TEXT ("") - HELP_TEXT ("Opens a drop-down menu where you can choose") - HELP_TEXT ("Which toolbars are going to be visible in") - HELP_TEXT ("the menu.") - HELP_TEXT ("") - HELP_BOLD ("RIGHT CLICK") - HELP_LINK ("(Key:%s)",0x200+BUTTON_HIDE) + HELP_LINK ("(Key:%s)",0x100+BUTTON_HIDE) HELP_TEXT ("") HELP_TEXT ("Allows you to hide all toolbars, leaving") HELP_TEXT ("only the status bar.") HELP_TEXT ("Click again to show them again.") + HELP_TEXT ("") + HELP_BOLD ("RIGHT CLICK") + HELP_TEXT ("") + HELP_TEXT ("Opens a drop-down menu where you can choose") + HELP_TEXT ("Which toolbars are going to be visible in") + HELP_TEXT ("the menu.") }; diff --git a/hotkeys.c b/hotkeys.c index 7a95200f..85f98bdf 100644 --- a/hotkeys.c +++ b/hotkeys.c @@ -1499,7 +1499,7 @@ word Ordering[NB_SHORTCUTS]= SPECIAL_MOUSE_RIGHT, // Emulate mouse right SPECIAL_CLICK_LEFT, // Emulate mouse click left SPECIAL_CLICK_RIGHT, // Emulate mouse click right - 0x200+BUTTON_HIDE, // Show / Hide menus + 0x100+BUTTON_HIDE, // Show / Hide menus SPECIAL_SHOW_HIDE_CURSOR, // Show / Hide cursor SPECIAL_DOT_PAINTBRUSH, // Paintbrush = "." 0x100+BUTTON_PAINTBRUSHES, // Paintbrush choice diff --git a/init.c b/init.c index 6ae4456d..d07f2928 100644 --- a/init.c +++ b/init.c @@ -1372,8 +1372,8 @@ void Init_buttons(void) 0,0, 16,9, BUTTON_SHAPE_RECTANGLE, - Button_Toggle_toolbar, Button_Toggle_all_toolbars, - 1,0, + Button_Toggle_all_toolbars, Button_Toggle_toolbar, + 0,1, Do_nothing, FAMILY_TOOLBAR); } diff --git a/scripts/Downbringer1.lua b/scripts/dawnbringer1.lua similarity index 92% rename from scripts/Downbringer1.lua rename to scripts/dawnbringer1.lua index 498349de..c011484f 100644 --- a/scripts/Downbringer1.lua +++ b/scripts/dawnbringer1.lua @@ -56,7 +56,7 @@ for y = 0, h - 1, 1 do g = V + SPEC1 + SPEC2 b = V + SPEC1 + SPEC2 - c = matchcolor(math.max(0,math.min(255,r)),math.max(0,math.min(255,g)),math.max(0,math.min(255,b))) + c = matchcolor(r,g,b) putpicturepixel(x, y, c); diff --git a/scripts/Downbringer2.lua b/scripts/dawnbringer2.lua similarity index 100% rename from scripts/Downbringer2.lua rename to scripts/dawnbringer2.lua