diff options
| author | Franklin Wei <git@fwei.tk> | 2017-07-13 16:56:17 -0400 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2017-07-17 17:03:03 -0400 |
| commit | 3a70222a732621e52cec9f865e4d2ee2de7d8541 (patch) | |
| tree | 7be187d265b9048a37d0427a484e76ef214941f9 /apps/plugins/puzzles | |
| parent | e7a35ba3833925043b1b3e4a164e06058500bcd8 (diff) | |
| download | rockbox-3a70222a732621e52cec9f865e4d2ee2de7d8541.zip rockbox-3a70222a732621e52cec9f865e4d2ee2de7d8541.tar.gz rockbox-3a70222a732621e52cec9f865e4d2ee2de7d8541.tar.bz2 rockbox-3a70222a732621e52cec9f865e4d2ee2de7d8541.tar.xz | |
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
Diffstat (limited to 'apps/plugins/puzzles')
| -rw-r--r-- | apps/plugins/puzzles/rbwrappers.c | 2 | ||||
| -rw-r--r-- | 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 4fbfdc4..95bc2fc 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 ca72768..a61ec8b 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)); |