From: MirceaKitsune Date: Sun, 6 Nov 2011 15:45:13 +0000 (+0200) Subject: Fix a big issue I forgot with the color picker X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bc9382e1a5e8a12a1df19e70145fa40a701d2249;p=voretournament%2Fvoretournament.git Fix a big issue I forgot with the color picker --- diff --git a/data/qcsrc/menu/voret/colorpicker.c b/data/qcsrc/menu/voret/colorpicker.c index c3963db0..81e77d1e 100644 --- a/data/qcsrc/menu/voret/colorpicker.c +++ b/data/qcsrc/menu/voret/colorpicker.c @@ -51,6 +51,25 @@ vector hslimage_color(vector v, vector margin) return hsl_to_rgb(v_x * 6 * eX + eY + v_y / 0.875 * eZ); } +vector color_hslimage(vector v, vector margin) +{ + vector pos; + v = rgb_to_hsl(v); + if (v_y) + { + pos_x = v_x / 6; + pos_y = v_z * 0.875; + } + else // grey scale + { + pos_x = v_z; + pos_y = 0.875 + 0.07; + } + pos_x = margin_x + pos_x * (1 - 2 * margin_x); + pos_y = margin_y + pos_y * (1 - 2 * margin_y); + return pos; +} + float mouseDragVoretColorpicker(entity me, vector coords) { float i; diff --git a/data/qcsrc/menu/voret/colorpicker_string.c b/data/qcsrc/menu/voret/colorpicker_string.c index b6c3d231..ee9c9495 100644 --- a/data/qcsrc/menu/voret/colorpicker_string.c +++ b/data/qcsrc/menu/voret/colorpicker_string.c @@ -29,9 +29,9 @@ void configureVoretColorpickerStringVoretColorpickerString(entity me, string the me.cvarName = theCvar; me.configureImage(me, me.image); if(cvar_string(theCvar) != "") - me.prevcoords = hslimage_color(stov(cvar_string(theCvar)), me.imagemargin); + me.prevcoords = color_hslimage(stov(cvar_string(theCvar)), me.imagemargin); else // use default - me.prevcoords = hslimage_color(stov(cvar_string(theDefaultCvar)), me.imagemargin); + me.prevcoords = color_hslimage(stov(cvar_string(theDefaultCvar)), me.imagemargin); } float mousePressVoretColorpickerString(entity me, vector coords)