From 3a70222a732621e52cec9f865e4d2ee2de7d8541 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Thu, 13 Jul 2017 16:56:17 -0400 Subject: [PATCH] puzzles: fix star drawing in Signpost - change point ordering to make concave polygon rendering work - also enables an "Easter egg" of sorts Change-Id: I3b4044a374dce1cff889d5f3744de9e634978591 --- apps/plugins/puzzles/rbwrappers.c | 2 ++ apps/plugins/puzzles/src/signpost.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/plugins/puzzles/rbwrappers.c b/apps/plugins/puzzles/rbwrappers.c index 4fbfdc4e60..95bc2fc5b1 100644 --- a/apps/plugins/puzzles/rbwrappers.c +++ b/apps/plugins/puzzles/rbwrappers.c @@ -12,6 +12,8 @@ int sprintf_wrapper(char *str, const char *fmt, ...) char *getenv_wrapper(const char *c) { + if(!strcmp(c, "SIGNPOST_GEARS")) + return "y"; return NULL; } diff --git a/apps/plugins/puzzles/src/signpost.c b/apps/plugins/puzzles/src/signpost.c index ca72768c27..a61ec8b536 100644 --- a/apps/plugins/puzzles/src/signpost.c +++ b/apps/plugins/puzzles/src/signpost.c @@ -1810,8 +1810,9 @@ static void draw_star(drawing *dr, int cx, int cy, int rad, int npoints, coords = snewn(npoints * 2 * 2, int); for (n = 0; n < npoints * 2; n++) { - a = 2.0 * PI * ((double)n / ((double)npoints * 2.0)) + angle_offset; - r = (n % 2) ? (double)rad/2.0 : (double)rad; + /* hack to accomodate rockbox's concave polygon drawing */ + a = 2.0 * PI * ((double)n / ((double)npoints * 2.0)) + angle_offset - PI / npoints; + r = (n % 2 == 0) ? (double)rad/2.0 : (double)rad; /* We're rotating the point at (0, -r) by a degrees */ coords[2*n+0] = cx + (int)( r * sin(a));