diff --git a/blizzard.cpp b/blizzard.cpp index 236ce1f4..aa850971 100644 --- a/blizzard.cpp +++ b/blizzard.cpp @@ -236,7 +236,7 @@ void drawArrowTraps() { transmatrix& t0 = gmatrix.at(r[0]); transmatrix& t1 = gmatrix.at(r[4]); - queueline(tC0(t0), tC0(t1), 0xFF0000FF, 4, PPR_ITEM); + queueline(tC0(t0), tC0(t1), 0xFF0000FF, 4 + vid.linequality, PPR_ITEM); if((c->wparam & 7) == 3 && !shmup::on) { // queueline(t0 * randomPointIn(r[0]->type), t1 * randomPointIn(r[1]->type), 0xFFFFFFFF, 4, PPR_ITEM); int tt = ticks % 401; diff --git a/config.cpp b/config.cpp index 3c97ae01..cf75265e 100644 --- a/config.cpp +++ b/config.cpp @@ -271,6 +271,8 @@ void initConfig() { addsaver(irr::rearrange_max_attempts, "irregular-rearrange-max", 50); addsaver(irr::rearrange_less, "irregular-rearrangeless", 10); + addsaver(vid.linequality, "line quality", 0); + #if CAP_SHMUP shmup::initConfig(); #endif @@ -609,6 +611,8 @@ void showGraphConfig() { } else dialog::addBreak(100); + + dialog::addSelItem(XLAT("line quality"), its(vid.linequality), 'L'); #if CAP_FRAMELIMIT dialog::addSelItem(XLAT("framerate limit"), its(vid.framelimit), 'l'); @@ -661,7 +665,7 @@ void showGraphConfig() { char xuni = uni | 96; - if(uni >= 32 && uni < 64) xuni = uni; + if((uni >= 32 && uni < 64) || uni == 'L') xuni = uni; if(xuni == 'u') vid.particles = !vid.particles; if(xuni == 'd') vid.graphglyph = (1+vid.graphglyph)%3; @@ -736,6 +740,12 @@ void showGraphConfig() { dialog::add_action([] () { vid.antialias ^= AA_LINEWIDTH; }); }; } + + if(xuni == 'L') { + dialog::editNumber(vid.linequality, -3, 5, 1, 1, XLAT("line quality"), + XLAT("Higher numbers make the curved lines smoother, but reduces the performance.")); + dialog::reaction = [] () { resetGeometry(); }; + } if(xuni == 'c') { dialog::editNumber(vid.mobilecompasssize, 0, 100, 10, 20, XLAT("compass size"), ""); diff --git a/graph.cpp b/graph.cpp index 0f283427..08febc4f 100644 --- a/graph.cpp +++ b/graph.cpp @@ -139,7 +139,7 @@ void drawShield(const transmatrix& V, eItem it) { col = 0; double d = it == itOrbShield ? hexf : hexf - .1; int mt = sphere ? 7 : 5; - for(int a=0; a<=S84*mt; a++) + for(ld a=0; a<=S84*mt+1e-6; a+=pow(.5, vid.linequality)) curvepoint(V*ddi0(a, d + sin(ds + M_PI*2*a/4/mt)*.1)); queuecurve(darkena(col, 0, 0xFF), 0x8080808, PPR_LINE); #endif @@ -150,7 +150,7 @@ void drawSpeed(const transmatrix& V) { ld ds = ticks / 10.; int col = darkena(iinf[itOrbSpeed].color, 0, 0xFF); for(int b=0; bS42) z = S84-z; + double z = a; if(z>S42) z = S84-z; if(z <= 10) d += (10-z) * (10-z) * (10-z) / 3000.; ld rad = hexf * (2.5 + .5 * sin(ds+u*.3)) * d; @@ -217,7 +217,7 @@ void drawWinter(const transmatrix& V, int hdir) { int col = darkena(iinf[itOrbWinter].color, 0, 0xFF); for(int u=0; u<20; u++) { ld rad = 6 * sin(ds+u * 2 * M_PI / 20); - queueline(V*ddi0(S42+hdir+rad, hexf*.5), V*ddi0(S42+hdir+rad, hexf*3), col, 2); + queueline(V*ddi0(S42+hdir+rad, hexf*.5), V*ddi0(S42+hdir+rad, hexf*3), col, 2 + vid.linequality); } #endif } @@ -228,7 +228,7 @@ void drawLightning(const transmatrix& V) { for(int u=0; u<20; u++) { ld leng = 0.5 / (0.1 + (rand() % 100) / 100.0); ld rad = rand() % S84; - queueline(V*ddi0(rad, hexf*0.3), V*ddi0(rad, hexf*leng), col, 2); + queueline(V*ddi0(rad, hexf*0.3), V*ddi0(rad, hexf*leng), col, 2 + vid.linequality); } #endif } @@ -335,8 +335,9 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) { if((u-tim)%250) continue; ld rad = hexf * u / 250; int col = darkena(iinf[itOrbSafety].color, 0, 0xFF); - for(int a=0; amondir); int col = darkena(0x606020, 0, 0xFF); for(int u=-1; u<=1; u++) - queueline(Vparam*ddi0(hdir+S21, u*crossf/5), Vparam*ddi(hdir, crossf)*ddi0(hdir+S21, u*crossf/5), col, 2); + queueline(Vparam*ddi0(hdir+S21, u*crossf/5), Vparam*ddi(hdir, crossf)*ddi0(hdir+S21, u*crossf/5), col, 2 + vid.linequality); } } @@ -3649,8 +3650,9 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { for(int u=0; u<5; u++) { ld rad = hexf * (.3 * u + (ds%1000) * .0003); int tcol = darkena(gradient(forecolor, backcolor, 0, rad, 1.5 * hexf), 0, 0xFF); - for(int a=0; atype; t++) if(c->mov[t] && c->mov[t]->ligon) { int hdir = displaydir(c, t); int lcol = darkena(gradient(iinf[itOrbLightning].color, 0, 0, tim, 1100), 0, 0xFF); - queueline(V*ddi0(ticks, hexf/2), V*ddi0(hdir, crossf), lcol, 2); + queueline(V*ddi0(ticks, hexf/2), V*ddi0(hdir, crossf), lcol, 2 + vid.linequality); } } @@ -4716,6 +4718,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { // hyper: 0.3798 int prec = sphere ? 3 : 1; + prec += vid.linequality; if(irr::on) { int id = irr::cellindex[c]; @@ -4831,8 +4834,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(vid.grid && c->bardir != NODIR && c->bardir != NOBARRIERS && c->land != laHauntedWall && c->barleft != NOWALLSEP_USED) { int col = darkena(0x505050, 0, 0xFF); - queueline(tC0(V), V*tC0(heptmove[c->bardir]), col, 2); - queueline(tC0(V), V*tC0(hexmove[c->bardir]), col, 2); + queueline(tC0(V), V*tC0(heptmove[c->bardir]), col, 2 + vid.linequality); + queueline(tC0(V), V*tC0(hexmove[c->bardir]), col, 2 + vid.linequality); } #if CAP_MODEL @@ -5075,7 +5078,7 @@ void drawFlashes() { int flashcol = f.color; if(u > 500) flashcol = gradient(flashcol, 0, 500, u, 1100); flashcol = darkena(flashcol, 0, 0xFF); - for(int a=0; a<=S84; a++) curvepoint(V*ddi0(a, rad)); + PRING(a) curvepoint(V*ddi0(a, rad)); queuecurve(flashcol, 0x8080808, PPR_LINE); } } @@ -5089,7 +5092,7 @@ void drawFlashes() { int flashcol = f.color; if(u > 1000) flashcol = gradient(flashcol, 0, 1000, u, 2200); flashcol = darkena(flashcol, 0, 0xFF); - for(int a=0; a<=S84; a++) curvepoint(V*ddi0(a, rad)); + PRING(a) curvepoint(V*ddi0(a, rad)); queuecurve(flashcol, 0x8080808, PPR_LINE); } } @@ -5319,10 +5322,10 @@ void drawmovestar(double dx, double dy) { #if CAP_QUEUE if(euclid) - queueline(tC0(Centered), Centered * ddi0(d * 10.5, 0.5) , col, 0); + queueline(tC0(Centered), Centered * ddi0(d * 10.5, 0.5) , col, vid.linequality); else // queueline(tC0(Centered), Centered * spin(M_PI*d/4)* xpush(d==0?.7:d==2?.6:.5) * C0, col >> darken); - queueline(tC0(Centered), Centered * xspinpush0(M_PI*d/4, d==0?.7:d==2?.5:.2), col, 3); + queueline(tC0(Centered), Centered * xspinpush0(M_PI*d/4, d==0?.7:d==2?.5:.2), col, 3 + vid.linequality); #endif } } @@ -5410,7 +5413,7 @@ void drawfullmap() { queuereset(vid.usingGL ? mdDisk : mdUnchanged, PPR_CIRCLE); for(int b=-1; b<=1; b+=2) - for(int a=-90; a<=90; a++) { + for(ld a=-90; a<=90+1e-6; a+=pow(.5, vid.linequality)) { using namespace hyperpoint_vec; ld x = sin(a * vid.twopoint_param * b / 90); ld y = 0; @@ -5429,10 +5432,10 @@ void drawfullmap() { if(!stereo::active() && sphere && pmodel == mdSinusoidal) { queuereset(vid.usingGL ? mdDisk : mdUnchanged, PPR_CIRCLE); - for(int a=-45; a<45; a++) { + for(ld a=-45; a<45+1e-6; a+=pow(.5, vid.linequality)) { curvepoint(hpxyz(cos(a * M_PI / 90) * vid.radius, a * vid.radius / 90, 0)); } - for(int a=45; a>=-45; a--) { + for(ld a=45; a>=-45-1e-6; a-=pow(.5, vid.linequality)) { curvepoint(hpxyz(-cos(a * M_PI / 90) * vid.radius, a * vid.radius / 90, 0)); } queuecurve(ringcolor, 0, PPR_CIRCLE); diff --git a/hyper.h b/hyper.h index 21bf2b09..09accae0 100644 --- a/hyper.h +++ b/hyper.h @@ -809,6 +809,8 @@ struct videopar { ld ballangle, ballproj, euclid_to_sphere, twopoint_param, stretch; int mobilecompasssize; int aurastr, aurasmoothen; + + int linequality; bool full; @@ -3742,4 +3744,8 @@ namespace ors { bool saved_tortoise_on(cell *c); +#define RING(i) for(double i=0; i<=S84+1e-6; i+=S3 * pow(.5, vid.linequality)) +#define REVRING(i) for(double i=S84; i>=-1e-6; i-=S3 * pow(.5, vid.linequality)) +#define PRING(i) for(double i=0; i<=S84+1e-6; i+= pow(.5, vid.linequality)) + } diff --git a/mapeditor.cpp b/mapeditor.cpp index e6a06804..9edac1bc 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -906,20 +906,21 @@ namespace mapeditor { unsigned gridcolor = 0xC0C0C040; void drawGrid() { + unsigned lightgrid = gridcolor; + lightgrid -= (lightgrid & 0xFF) / 2; for(int d=0; dtype) == 0) ? gridcolor : lightgrid; - queueline(d2 * C0, d2 * spin(M_PI*d/S42)* xpush(1) * C0, col, 4); - for(int u=2; u<=20; u++) { - queueline( - d2 * spin(M_PI*d/S42)* xpush(u/20.) * C0, - d2 * spin(M_PI*(d+1)/S42)* xpush(u/20.) * C0, - (u%5==0) ? gridcolor : lightgrid, 0); - } + queueline(d2 * C0, d2 * spin(M_PI*d/S42)* xpush(1) * C0, col, 4 + vid.linequality); } - queueline(drawtrans*ccenter, drawtrans*coldcenter, gridcolor, 4); + for(int u=2; u<=20; u++) { + PRING(d) { + transmatrix d2 = drawtrans * rgpushxto0(ccenter) * rspintox(inverse(drawtrans * rgpushxto0(ccenter)) * coldcenter); + curvepoint(d2 * spin(M_PI*d/S42)* xpush(u/20.) * C0); + } + queuecurve((u%5==0) ? gridcolor : lightgrid, 0, PPR_LINE); + } + queueline(drawtrans*ccenter, drawtrans*coldcenter, gridcolor, 4 + vid.linequality); } void drawHandleKey(int sym, int uni); @@ -1626,14 +1627,15 @@ namespace mapeditor { #if CAP_TEXTURE void queue_hcircle(transmatrix Ctr, ld radius) { vector pts; - int circp = 6; + int circp = int(6 * pow(2, vid.linequality)); if(radius > 0.04) circp *= 2; if(radius > .1) circp *= 2; for(int j=0; jmov[t] && c->mov[t] < c) queuelinef(V * gp::get_corner_position(c, t), V * gp::get_corner_position(c, (t+1)%c->type), - col, 1); + col, 1 + vid.linequality); } else if(euclid || !pseudohept(c)) for(int t=0; ttype; t++) if(euclid ? c->mov[t]mov[t] < c)) { queuelinef(V * ddspin(c,t,-S7) * xpush0(x), V * ddspin(c,t,+S7) * xpush0(x), - col, 1); + col, 1 + vid.linequality); } break; } @@ -1892,7 +1892,7 @@ namespace linepatterns { if(pseudohept(c)) for(int t=0; ttype; t++) queuelinef(V * gp::get_corner_position(c, t%c->type, 2), V * gp::get_corner_position(c, (t+1)%c->type, 2), - col, 1); + col, 1 + vid.linequality); } else { if(!pseudohept(c)) for(int i=0; itype; i++) { @@ -1901,14 +1901,14 @@ namespace linepatterns { double x = hexhexdist / 2; // sphere?.3651:euclid?.2611:.2849; queuelinef(V * ddspin(c,i,-S14) * xpush0(x), V * ddspin(c,i,+S14) * xpush0(x), - col, 1); + col, 1 + vid.linequality); } } break; case patTriNet: forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2)) if(celldist(c) != celldist(c2)) { - queuelinef(tC0(V), gmatrix[c2]*C0, col, 2); + queuelinef(tC0(V), gmatrix[c2]*C0, col, 2 + vid.linequality); } break; @@ -1916,18 +1916,18 @@ namespace linepatterns { forCellIdEx(c2, i, c) { if(S3 == 4) c2 = (cellwalker(c, i) + wstep + 1 + wstep).c; if(c2 > c) if(gmatrix.count(c2) && celldist(c) == celldist(c2)) - queuelinef(tC0(V), gmatrix[c2]*C0, col, 2); + queuelinef(tC0(V), gmatrix[c2]*C0, col, 2 + vid.linequality); } break; case patHepta: forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2) && pseudohept(c) == pseudohept(c2)) - queuelinef(tC0(V), gmatrix[c2]*C0, col, 2); + queuelinef(tC0(V), gmatrix[c2]*C0, col, 2 + vid.linequality); break; case patRhomb: forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2) && pseudohept(c) != pseudohept(c2)) - queuelinef(tC0(V), gmatrix[c2]*C0, col, 2); + queuelinef(tC0(V), gmatrix[c2]*C0, col, 2 + vid.linequality); break; case patPalace: { @@ -1938,7 +1938,7 @@ namespace linepatterns { if(polarb50(c1) != a && polarb50(c2) != a) queuelinef(V * ddspin(c,i,84*5/14) * xpush0(tessf/2), V * ddspin(c,i,84*9/14) * xpush0(tessf/2), - col, 1); + col, 1 + vid.linequality); } break; } @@ -1947,13 +1947,13 @@ namespace linepatterns { if(pseudohept(c)) for(int i=0; i<7; i++) queuelinef(V * ddspin(c,i,84*5/14) * xpush0(tessf/2), V * ddspin(c,i,84*9/14) * xpush0(tessf/2), - col, 1); + col, 1 + vid.linequality); break; case patBigTriangles: { if(is_master(c) && !euclid) for(int i=0; imaster->move[i] && c->master->move[i] < c->master) { - queuelinef(tC0(V), V*xspinpush0(-2*M_PI*i/S7 - master_to_c7_angle(), tessf), col, 2); + queuelinef(tC0(V), V*xspinpush0(-2*M_PI*i/S7 - master_to_c7_angle(), tessf), col, 2 + vid.linequality); } break; } @@ -1961,7 +1961,7 @@ namespace linepatterns { case patBigRings: { if(is_master(c) && !euclid) for(int i=0; imaster->move[i] && c->master->move[i] < c->master && c->master->move[i]->dm4 == c->master->dm4) - queuelinef(tC0(V), V*xspinpush0(-2*M_PI*i/S7 - master_to_c7_angle(), tessf), col, 2); + queuelinef(tC0(V), V*xspinpush0(-2*M_PI*i/S7 - master_to_c7_angle(), tessf), col, 2 + vid.linequality); // V*xspinpush0((nonbitrunc?M_PI:0) -2*M_PI*i/S7 break; } @@ -1969,7 +1969,7 @@ namespace linepatterns { case patTree: if(is_master(c)) { cell *c2 = c->master->move[0]->c7; - if(gmatrix.count(c2)) queuelinef(tC0(V), gmatrix[c2]*C0, col, 2); + if(gmatrix.count(c2)) queuelinef(tC0(V), gmatrix[c2]*C0, col, 2 + vid.linequality); } break; @@ -1979,7 +1979,7 @@ namespace linepatterns { forCellEx(c2, c) if(c2 > c && c2->master->alt && celldistAlt(c2) == d && gmatrix.count(c2)) queuelinef(tC0(V), gmatrix[c2]*C0, darkena(backcolor ^ 0xFFFFFF, 0, col), - 2); + 2 + vid.linequality); } break; @@ -1988,7 +1988,7 @@ namespace linepatterns { for(int i=0; imaster->move[i] && c->master->move[i]->alt == c->master->alt->move[0]) { cell *c2 = c->master->move[i]->c7; - if(gmatrix.count(c2)) queuelinef(tC0(V), gmatrix[c2]*C0, col, 2); + if(gmatrix.count(c2)) queuelinef(tC0(V), gmatrix[c2]*C0, col, 2 + vid.linequality); } } break; @@ -1998,21 +1998,21 @@ namespace linepatterns { if(c->master->c7 != c) if(gmatrix.count(c->mov[0])) queuelinef(tC0(V), gmatrix[c->mov[0]]*C0, darkena(backcolor ^ 0xFFFFFF, 0, col), - 2); + 2 + vid.linequality); } else if(irr::on) { if(c->master->c7 != c) if(gmatrix.count(c->master->c7)) queuelinef(tC0(V), gmatrix[c->master->c7]*C0, darkena(backcolor ^ 0xFFFFFF, 0, col), - 2); + 2 + vid.linequality); } else { int p = emeraldval(c); double hdist = hdist0(heptmove[0] * heptmove[2] * C0); if(pseudohept(c) && (p/4 == 10 || p/4 == 8)) for(int i=0; imov[i] && emeraldval(c->mov[i]) == p-4) { - queuelinef(tC0(V), V*tC0(heptmove[i]), col, 2); - queuelinef(tC0(V), V*tC0(spin(-i * ALPHA) * xpush(-hdist/2)), col, 2); + queuelinef(tC0(V), V*tC0(heptmove[i]), col, 2 + vid.linequality); + queuelinef(tC0(V), V*tC0(spin(-i * ALPHA) * xpush(-hdist/2)), col, 2 + vid.linequality); } } break; @@ -2023,7 +2023,7 @@ namespace linepatterns { for(int i=0; imov[i] && c->mov[i]->master != c->master && gmatrix.count(c->mov[i])) queuelinef(tC0(V), gmatrix[c->mov[i]]*C0, col, - 1); + 1 + vid.linequality); } else { int a = emeraldval(c); @@ -2034,7 +2034,7 @@ namespace linepatterns { if(emeraldval(h1->c7)/4 == 8 && emeraldval(h2->c7)/4 == 8) queuelinef(V * ddspin(c,i,84*5/14) * xpush0(tessf/2), V * ddspin(c,i,84*9/14) * xpush0(tessf/2), - col, 1); + col, 1 + vid.linequality); } } break; diff --git a/polygons.cpp b/polygons.cpp index dc59e379..cbaa6397 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -86,7 +86,8 @@ bool ptdsort(const polytodraw& p1, const polytodraw& p2) { void hpcpush(hyperpoint h) { if(sphere) h = mid(h,h); - if(/*vid.usingGL && */!first && intval(hpc.back(), h) > (sphere ? (ISMOBWEB || gp::on || irr::on ? .04 : .0001) : 0.1)) { + ld threshold = (sphere ? (ISMOBWEB || gp::on || irr::on ? .04 : .001) : 0.1) * pow(.25, vid.linequality); + if(/*vid.usingGL && */!first && intval(hpc.back(), h) > threshold) { hyperpoint md = mid(hpc.back(), h); hpcpush(md); hpcpush(h); @@ -884,7 +885,7 @@ void prettypoint(const hyperpoint& h) { } void prettylinesub(const hyperpoint& h1, const hyperpoint& h2, int lev) { - if(lev) { + if(lev >= 0) { hyperpoint h3 = midz(h1, h2); prettylinesub(h1, h3, lev-1); prettylinesub(h3, h2, lev-1); @@ -1295,11 +1296,12 @@ usershape *usershapes[USERSHAPEGROUPS][USERSHAPEIDS]; void drawTentacle(hpcshape &h, ld rad, ld var, ld divby) { double tlength = max(crossf, hexhexdist * gp::scale * irr::scale); - for(int i=0; i<=20; i++) - hpcpush(ddi(S21, rad + var * sin(i * M_PI/divby)) * ddi(0, tlength * i/20.) * C0); - for(int i=20; i>=0; i--) - hpcpush(ddi(S21*3, rad - var * sin(i * M_PI/divby)) * ddi(0, tlength * i/20.) * C0); - hpcpush(ddi(S21, rad + var * sin(0 * M_PI/divby)) * ddi(0, tlength * 0/20.) * C0); + int max = int(20 * pow(2, vid.linequality)); + for(ld i=0; i<=max; i++) + hpcpush(ddi(S21, rad + var * sin(i * M_PI/divby)) * ddi(0, tlength * i/max) * C0); + for(ld i=max; i>=0; i--) + hpcpush(ddi(S21*3, rad - var * sin(i * M_PI/divby)) * ddi(0, tlength * i/max) * C0); + hpcpush(ddi(S21, rad + var * sin(0 * M_PI/divby)) * C0); } hyperpoint hpxd(ld d, ld x, ld y, ld z) { @@ -1780,35 +1782,36 @@ void buildpolys() { } bshape(shEgg, PPR_ITEM); - for(int i=0; i<=S84; i+=S3) + + RING(i) hpcpush(hpxy(sin(i*2*M_PI/S84)*.15, cos(i*2*M_PI/S84)*.11)); bshape(shRing, PPR_ITEM); - for(int i=0; i<=S84; i+=S3) + RING(i) hpcpush(ddi(i, disksize * .25) * C0); - for(int i=S84; i>=0; i--) + REVRING(i) hpcpush(ddi(i, disksize * .30) * C0); hpcpush(ddi(0, disksize * .25) * C0); bshape(shSpikedRing, PPR_ITEM); - for(int i=0; i<=S84; i+=S3) + RING(i) hpcpush(ddi(i, disksize * .25) * C0); - for(int i=S84; i>=0; i--) - hpcpush(ddi(i, disksize * (i&1?.35:.30)) * C0); + REVRING(i) + hpcpush(ddi(i, disksize * (int(i)&1?.35:.30)) * C0); hpcpush(ddi(0, disksize * .25) * C0); bshape(shTargetRing, PPR_ITEM); - for(int i=0; i<=S84; i+=S3) + RING(i) hpcpush(ddi(i, disksize * .25) * C0); - for(int i=S84; i>=0; i--) + REVRING(i) hpcpush(ddi(i, disksize * (i >= S42-6 && i <= S42+6 ?.36:.30)) * C0); hpcpush(ddi(0, disksize * .25) * C0); bshape(shSpearRing, PPR_ITEM); - for(int i=0; i<=S84; i+=S3) + RING(i) hpcpush(ddi(i, disksize * .25) * C0); - for(int i=S84; i>=0; i--) { - int d = i - S42; + REVRING(i) { + double d = i - S42; if(d<0) d = -d; d = 8 - 2 * d; if(d<0) d = 0; @@ -1832,10 +1835,10 @@ void buildpolys() { */ bshape(shLoveRing, PPR_ITEM); - for(int i=0; i<=S84; i+=S3) - hpcpush(ddi(i, disksize * .25) * C0); - for(int i=S84; i>=0; i--) { - int j = i*3 % S84; + RING(i) hpcpush(ddi(i, disksize * .25) * C0); + REVRING(i) { + double j = i*3; + while(j >= S84) j -= S84; double d = j - S42; d = d / 9; if(d<0) d = -d; @@ -1846,40 +1849,42 @@ void buildpolys() { } hpcpush(ddi(0, disksize * .25) * C0); + auto dmod = [] (ld a, ld b) { return a - int(a/b)*b; }; + bshape(shSawRing, PPR_ITEM); - for(int i=0; i<=S84; i+=S3) + RING(i) hpcpush(ddi(i, disksize * .25) * C0); - for(int i=S84; i>=0; i--) - hpcpush(ddi(i, disksize * (.3 + (i&3) * .02)) * C0); + REVRING(i) + hpcpush(ddi(i, disksize * (.3 + (dmod(i, 4) * .02))) * C0); hpcpush(ddi(0, disksize * .25) * C0); bshape(shGearRing, PPR_ITEM); - for(int i=0; i<=S84; i+=S3) + RING(i) hpcpush(ddi(i, disksize * .25) * C0); - for(int i=S84; i>=0; i--) - hpcpush(ddi(i, disksize * ((i%6<3)?.3:.36)) * C0); + REVRING(i) + hpcpush(ddi(i, disksize * ((dmod(i, 6)<3)?.3:.36)) * C0); hpcpush(ddi(0, disksize * .25) * C0); bshape(shPeaceRing, PPR_ITEM); - for(int i=0; i<=S84; i++) + RING(i) hpcpush(ddi(i, disksize * .25) * C0); - for(int i=S84; i>=0; i--) - hpcpush(ddi(i, disksize * (i%S28 < S7?.36 : .3)) * C0); + REVRING(i) + hpcpush(ddi(i, disksize * (dmod(i, S28) < S7?.36 : .3)) * C0); hpcpush(ddi(0, disksize * .25) * C0); bshape(shHeptaRing, PPR_ITEM); - for(int i=0; i<=S84; i+=S3) + RING(i) hpcpush(ddi(i, disksize * .25) * C0); - for(int i=S84; i>=0; i--) - hpcpush(ddi(i, disksize * (i%S12 < S3?.4 : .27)) * C0); + REVRING(i) + hpcpush(ddi(i, disksize * (dmod(i, S12) < S3?.4 : .27)) * C0); hpcpush(ddi(0, disksize * .25) * C0); bshape(shCompass1, PPR_ITEM); - for(int i=0; i<=S84; i+=S3) + RING(i) hpcpush(ddi(i, crossf * .35) * C0); bshape(shCompass2, PPR_ITEMa); - for(int i=0; i<=S84; i+=S3) + REVRING(i) hpcpush(ddi(i, crossf * .3) * C0); bshape(shCompass3, PPR_ITEMb); @@ -1913,11 +1918,11 @@ void buildpolys() { } bshape(shSlime, 33); - for(int i=0; i<=S84; i++) + PRING(i) hpcpush(ddi(i, crossf * (0.7 + .2 * sin(i * M_PI * 2 / S84 * 9))) * C0); bshape(shJelly, 33); - for(int i=0; i<=S84; i++) + PRING(i) hpcpush(ddi(i, crossf * (0.4 + .03 * sin(i * M_PI * 2 / S84 * 7))) * C0); bshape(shHeptaMarker, PPR_HEPTAMARK); @@ -1927,7 +1932,7 @@ void buildpolys() { for(int t=0; t<=S7*4; t++) hpcpush(ddi(t*S3, zhexf*.1) * C0); bshape(shRose, PPR_ITEM); - for(int t=0; t<=S84; t++) + PRING(t) hpcpush(spin(M_PI * t / (S42+.0)) * xpush(crossf * (0.2 + .15 * sin(M_PI * t / (S42+.0) * 3))) * C0); bshape(shThorns, PPR_THORNS); @@ -2049,10 +2054,10 @@ void buildpolys() { bshape(shWormHead, PPR_ONTENTACLE, scalef, 80); bshape(shWormSegment, PPR_TENTACLE1); - for(int i=0; i<=S84; i+=S3) - hpcpush(ddi(i, .20 * scalef) * C0); + RING(i) + hpcpush(ddi(i, .20 * scalef) * C0); bshape(shSmallWormSegment, PPR_TENTACLE1); - for(int i=0; i<=S84; i+=S3) + RING(i) hpcpush(ddi(i, .16 * scalef) * C0); bshape(shWormTail, PPR_TENTACLE1, scalef, 383); bshape(shSmallWormTail, PPR_TENTACLE1, scalef, 384); diff --git a/rogueviz-kohonen.cpp b/rogueviz-kohonen.cpp index 80dfa1ef..9e3298cf 100644 --- a/rogueviz-kohonen.cpp +++ b/rogueviz-kohonen.cpp @@ -813,7 +813,7 @@ namespace levelline { queueline( tC0(T * ddspin(c1,i) * xpush(d2 * (vmid-val1) / (val2-val1))), tC0(T * ddspin(c1,i-1) * xpush(d3 * (vmid-val1) / (val3-val1))), - l.color); + l.color, vid.linequality); }; while(v1 < v2 && v1 < v3) { draw(); diff --git a/rogueviz.cpp b/rogueviz.cpp index 4a130cdf..22145f3a 100644 --- a/rogueviz.cpp +++ b/rogueviz.cpp @@ -1173,13 +1173,13 @@ bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) { hyperpoint l1 = T*tC0(spiral::at(1+ei->i)); for(int z=1; z<=prec; z++) { hyperpoint l2 = T*tC0(spiral::at(1+ei->i+(ei->j-ei->i) * z / (prec+.0))); - queueline(l1, l2, col, 0); + queueline(l1, l2, col, vid.linequality); l1 = l2; lastptd().prio = PPR_STRUCT0; } } else { - queueline(h1, h2, col, 2); + queueline(h1, h2, col, 2 + vid.linequality); lastptd().prio = PPR_STRUCT0; } } diff --git a/rug.cpp b/rug.cpp index 30152226..50e75687 100644 --- a/rug.cpp +++ b/rug.cpp @@ -1236,13 +1236,13 @@ void prepareTexture() { drawthemap(); if(mousing && !renderonce) { for(int i=0; ih); queuechr(V, 0.5, 'X', 0xFFFFFFFF, 2); for(int i=0; i<72; i++) - queueline(tC0(V * spin(i*M_PI/32) * xpush(finger_range)), tC0(V * spin((i+1)*M_PI/32) * xpush(finger_range)), 0xFFFFFFFF, 0); + queueline(tC0(V * spin(i*M_PI/32) * xpush(finger_range)), tC0(V * spin((i+1)*M_PI/32) * xpush(finger_range)), 0xFFFFFFFF, vid.linequality); } drawqueue(); vid = svid;