shithub: puzzles

Download patch

ref: ab80d0b7fdd07bfc9037a44df97d862ce5e986ea
parent: 7fce4f57c201fe6a60ab25ccb62f089c711e97cc
author: Simon Tatham <anakin@pobox.com>
date: Mon May 7 13:50:14 EDT 2007

Add a new misc.c function needed by Slide's colour setup.

[originally from svn r7552]

--- a/misc.c
+++ b/misc.c
@@ -167,14 +167,12 @@
     return ret;
 }
 
-void game_mkhighlight(frontend *fe, float *ret,
-                      int background, int highlight, int lowlight)
+void game_mkhighlight_specific(frontend *fe, float *ret,
+			       int background, int highlight, int lowlight)
 {
     float max;
     int i;
 
-    frontend_default_colour(fe, &ret[background * 3]);
-
     /*
      * Drop the background colour so that the highlight is
      * noticeably brighter than it while still being under 1.
@@ -192,6 +190,13 @@
         ret[highlight * 3 + i] = ret[background * 3 + i] * 1.2F;
         ret[lowlight * 3 + i] = ret[background * 3 + i] * 0.8F;
     }
+}
+
+void game_mkhighlight(frontend *fe, float *ret,
+                      int background, int highlight, int lowlight)
+{
+    frontend_default_colour(fe, &ret[background * 3]);
+    game_mkhighlight_specific(fe, ret, background, highlight, lowlight);
 }
 
 static void memswap(void *av, void *bv, int size)
--- a/puzzles.h
+++ b/puzzles.h
@@ -280,6 +280,10 @@
  * and auto-generates highlight and lowlight colours too. */
 void game_mkhighlight(frontend *fe, float *ret,
                       int background, int highlight, int lowlight);
+/* As above, but starts from a provided background colour rather
+ * than the frontend default. */
+void game_mkhighlight_specific(frontend *fe, float *ret,
+			       int background, int highlight, int lowlight);
 
 /* Randomly shuffles an array of items. */
 void shuffle(void *array, int nelts, int eltsize, random_state *rs);