From 753339737ea98fd9caf26a5913f8f210897ef04a Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 6 Jul 2005 18:27:40 +0000 Subject: Refactoring from James H: the highlight and lowlight colour setup common to Fifteen, Sixteen, Twiddle and Pegs is now a utility function in misc.c. [originally from svn r6076] --- pegs.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'pegs.c') diff --git a/pegs.c b/pegs.c index 0709187..2a03902 100644 --- a/pegs.c +++ b/pegs.c @@ -845,28 +845,8 @@ static void game_set_size(game_drawstate *ds, game_params *params, static float *game_colours(frontend *fe, game_state *state, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); - int i; - float max; - - frontend_default_colour(fe, &ret[COL_BACKGROUND * 3]); - /* - * Drop the background colour so that the highlight is - * noticeably brighter than it while still being under 1. - */ - max = ret[COL_BACKGROUND*3]; - for (i = 1; i < 3; i++) - if (ret[COL_BACKGROUND*3+i] > max) - max = ret[COL_BACKGROUND*3+i]; - if (max * 1.2F > 1.0F) { - for (i = 0; i < 3; i++) - ret[COL_BACKGROUND*3+i] /= (max * 1.2F); - } - - for (i = 0; i < 3; i++) { - ret[COL_HIGHLIGHT * 3 + i] = ret[COL_BACKGROUND * 3 + i] * 1.2F; - ret[COL_LOWLIGHT * 3 + i] = ret[COL_BACKGROUND * 3 + i] * 0.8F; - } + game_mkhighlight(fe, ret, COL_BACKGROUND, COL_HIGHLIGHT, COL_LOWLIGHT); ret[COL_PEG * 3 + 0] = 0.0F; ret[COL_PEG * 3 + 1] = 0.0F; -- cgit v1.1