1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Franklin Wei 2017-07-13 16:56:17 -04:00
parent e7a35ba383
commit 3a70222a73
2 changed files with 5 additions and 2 deletions

View file

@ -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;
}

View file

@ -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));