1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-02-02 12:19:18 +00:00

fixed the POLY_INVERSE flag for user-drawn shapes

This commit is contained in:
Zeno Rogue 2017-12-03 18:44:51 +01:00
parent 2cec36efa9
commit b6604b942a

View File

@ -1022,6 +1022,7 @@ void finishshape() {
double area = 0; double area = 0;
for(int i=last->s; i<last->e-1; i++) for(int i=last->s; i<last->e-1; i++)
area += hpc[i][0] * hpc[i+1][1] - hpc[i+1][0] * hpc[i][1]; area += hpc[i][0] * hpc[i+1][1] - hpc[i+1][0] * hpc[i][1];
if(abs(area) < 1e-9) last->flags |= POLY_ISSIDE;
if(area >= 0) last->flags |= POLY_INVERSE; if(area >= 0) last->flags |= POLY_INVERSE;
/* if(isnan(area)) ; /* if(isnan(area)) ;
else if(intval(hpc[last->s], hpc[last->e-1]) > 1e-6) else if(intval(hpc[last->s], hpc[last->e-1]) > 1e-6)
@ -2118,10 +2119,9 @@ void buildpolys() {
usershape *us = usershapes[i][j]; usershape *us = usershapes[i][j];
if(!us) continue; if(!us) continue;
for(int l=0; l<USERLAYERS; l++) { for(int l=0; l<USERLAYERS; l++) {
us->d[l].sh.s = qhpc; bshape(us->d[l].sh, us->d[l].sh.prio);
first = true;
pushShape(us->d[l]); pushShape(us->d[l]);
us->d[l].sh.e = qhpc; finishshape();
} }
} }