From 666ddb007e9ba8a30a5ec915b04bd247c797f341 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 7 May 2018 20:13:56 +0200 Subject: [PATCH] MAJOR REWRITE of floor patterns --- floorshapes.cpp | 612 +++++++++++++++++++++++++++++++++++++++++ graph.cpp | 685 ++++++++++++++++++---------------------------- hyper.h | 16 +- hypgraph.cpp | 1 + landlock.cpp | 2 +- mapeditor.cpp | 2 +- pattern2.cpp | 2 - polygons.cpp | 710 +++++++++--------------------------------------- shmup.cpp | 12 +- textures.cpp | 27 +- 10 files changed, 1037 insertions(+), 1032 deletions(-) create mode 100644 floorshapes.cpp diff --git a/floorshapes.cpp b/floorshapes.cpp new file mode 100644 index 00000000..17da0de6 --- /dev/null +++ b/floorshapes.cpp @@ -0,0 +1,612 @@ +struct plain_floorshape; +struct escher_floorshape; + +vector all_plain_floorshapes; +vector all_escher_floorshapes; + +struct floorshape { + bool is_plain; + int shapeid, prio; + vector b, shadow, side[SIDEPARS], gpside[SIDEPARS][8]; + floorshape() { prio = PPR_FLOOR; } + }; + +struct plain_floorshape : floorshape { + ld rad0, rad1; + plain_floorshape() { is_plain = true; all_plain_floorshapes.push_back(this); } + void configure(ld r0, ld r1) { rad0 = r0; rad1 = r1; } + }; + +// noftype: 0 (shapeid2 is heptagonal or just use shapeid1), 1 (shapeid2 is pure heptagonal), 2 (shapeid2 is Euclidean), 3 (shapeid2 is hexagonal) +struct escher_floorshape : floorshape { + int shapeid0, shapeid1, noftype, shapeid2; + ld scale; + escher_floorshape(int s0, int s1, int noft=0, int s2=0) : shapeid0(s0), shapeid1(s1), noftype(noft), shapeid2(s2) { + all_escher_floorshapes.push_back(this); scale = 1; is_plain = false; + } + }; + +plain_floorshape + shFloor, + shMFloor, shMFloor2, shMFloor3, shMFloor4, shFullFloor, + shBigTriangle, shTriheptaFloor, shBigHepta; + +escher_floorshape shStarFloor(1,2), + shCloudFloor(3, 4), + shCrossFloor(5, 6, 2, 54), + shChargedFloor(7, 385, 1, 10), + shSStarFloor(11, 12), + shOverFloor(13, 15, 1, 14), + shTriFloor(17, 18, 0, 385), + shFeatherFloor(19, 21, 1, 20), + shBarrowFloor(23, 24, 1, 25), + shNewFloor(26, 27, 2, 54), + shTrollFloor(28, 29), + shButterflyFloor(325, 326, 1, 178), + shLavaFloor(359, 360, 1, 178), + shSeabed(334, 335), + shCloudSeabed(336, 337), + shCaveSeabed(338, 339, 2, 54), + shPalaceFloor(45, 46, 0, 385), + shDemonFloor(51, 50, 1, 178), + shCaveFloor(52, 53, 2, 54), + shDesertFloor(55, 56, 0, 4), + shPowerFloor(57, 58, 0, 12), /* dragon */ + shRoseFloor(174, 175, 1, 173), + shSwitchFloor(377, 378, 1, 379), + shTurtleFloor(176, 177, 1, 178), + shRedRockFloor[3] = {{55, 56}, {55, 56}, {55, 56}}, // 1 - .1 * i + shDragonFloor(181, 182, 2, 183); /* dragon */ + +hyperpoint adist(ld a, ld x) { + return spin(a) * xpush(x) * C0; + } + +typedef pair> matrixitem; + +struct mesher { + eGeometry g; + int sym; + ld bspi; + hyperpoint lcorner, rcorner, mfar[2], vfar[4]; + }; + +mesher msh(eGeometry g, int sym, ld main, ld v0, ld v1, ld bspi, ld scale) { + main *= scale; v0 *= scale; v1 *= scale; + mesher m; + m.sym = sym; + m.bspi = bspi; + dynamicval dg(geometry, g); + + hyperpoint rot = xpush(v0) * spin(M_PI - M_PI/sym) * xpush(main) * C0; + hyperpoint bnlfar = xpush(v0) * spin(M_PI) * rspintox(rot) * rspintox(rot) * rspintox(rot) * xpush(hdist0(rot)) * C0; + hyperpoint bnrfar = xpush(v0) * spin(M_PI) * spintox(rot) * spintox(rot) * spintox(rot) * xpush(hdist0(rot)) * C0; + + m.lcorner = adist (bspi-M_PI/sym, main); + m.rcorner = adist (bspi+M_PI/sym, main); + m.mfar[0] = adist (bspi, v0); + m.mfar[1] = adist (bspi, v1); + m.vfar[0] = spin(bspi) * bnlfar; + m.vfar[2] = spin(bspi) * bnrfar; + m.vfar[1] = spin(-2*M_PI/sym) * m.vfar[2]; + m.vfar[3] = spin(+2*M_PI/sym) * m.vfar[0]; + + return m; + } + +struct matrixlist { + mesher o, n; + vector v; + }; + +matrixitem genitem(const transmatrix& m1, const transmatrix& m2, int nsym) { + matrixitem mi; + mi.first = m1; + for(int i=0; i lst; + for(int i=0; i dg(geometry, gNormal); + lst.push_back(hpxy(polydata[whereis+2*i], polydata[whereis+2*i+1])); + } + if(sym == 2) + for(int i=qty-1; i>=0; i--) { + dynamicval dg(geometry, gNormal); + lst.push_back(hpxy(polydata[whereis+2*i], -polydata[whereis+2*i+1])); + } + + hyperpoint lstmid = hpxyz(0,0,0); + using namespace hyperpoint_vec; + for(auto p: lst) lstmid += p; + transmatrix T = spin(-m.o.bspi); + while((spin(2*M_PI / rots) * T* lstmid)[0] < (T*lstmid)[0]) + T = spin(2*M_PI / rots) * T; + while((spin(-2*M_PI / rots) * T* lstmid)[0] < (T*lstmid)[0]) + T = spin(-2*M_PI / rots) * T; + T = spin(m.o.bspi) * T; + for(auto &p: lst) p = T * p; + + if(rots > osym && rots % osym == 0) { + int rep = rots / osym; + int s = lst.size(); + for(int i=0; i -1e-5 && z[1] > -1e-5 && z[2] > -1e-5) { + nh = m.second[r] * z, mapped++; + } + } + if(mapped == 0) printf("warning: not mapped (shapeid %d)\n", shapeid); + hpcpush(mid(nh, nh)); + } + } + + hpcpush(hpc[last->s]); + } + + +void bshape_regular(floorshape &fsh, int id, int sides, int shift, ld size) { + bshape(fsh.b[id], fsh.prio); + for(int t=0; t<=sides; t++) + hpcpush(ddi(t*S84 / sides + shift, size) * C0); + + bshape(fsh.shadow[id], fsh.prio); + for(int t=0; t<=sides; t++) + hpcpush(ddi(t*S84 / sides + shift, size * SHADMUL) * C0); + + for(int k=0; k usedml; + + void build_plainshape(int& id, gp::local_info& li, cell *c0, int siid, int sidir) { + if(!just_matrices) + id = nextid++; + + bool master = !(li.relative.first||li.relative.second); + int cor = master ? S7 : 6; + if(master) li.last_dir = -1; + printf("last=%d at=%d,%d tot=%d siid=%d sidir=%d cor=%d id=%d\n", li.last_dir, li.relative.first, li.relative.second, li.total_dir, siid, sidir, cor, id); + + for(auto pfsh: all_escher_floorshapes) { + auto& fsh = *pfsh; + generate_matrices_scale(1, fsh.noftype); + auto& m = (siid && geosupport_graveyard() == 2) ? hex_matrices : hept_matrices; + + m.n.sym = cor; + + int i = 0; + + /* if(siid == 0) + for(auto& ma: m.v) ma.first = ma.first * pispin; */ + + for(int d=0; d cornerlist; + + if(&fsh == &shTriheptaFloor) { + if(!siid) { + for(int i=0; i>2; + // if(siid == 2) si.dir++; + // if(siid != pattern_threecolor(c)) printf("threecolor mismatch\n"); + // if(pattern_threecolor(createMov(c, fixdir(si.dir, c))) != (siid+1)%3) printf("threecolor mismatch direction\n"); + sidir = fixdir(si.dir, c); + } + else if(geosupport_graveyard() == 2) { + siid = !pseudohept(c); + sidir = !ishex1(c); + } + else { + siid = 0; + sidir = 0; + } + auto& id = pshid[siid][sidir][draw_li.relative.first&31][draw_li.relative.second&31][fix6(draw_li.total_dir)]; + if(id == -1 || just_matrices) build_plainshape(id, draw_li, c, siid, sidir); + return id; + } + } + +qfloorinfo qfi; +qfloorinfo qfi_dc; + +int chasmg; + +void set_no_floor() { + qfi.fshape = NULL; + qfi.shape = NULL; + } + +void set_floor(floorshape& sh) { + qfi.fshape = &sh; + qfi.shape = NULL; + } + +void set_floor(hpcshape& sh) { + qfi.shape = &sh; + qfi.fshape = NULL; + qfi.spin = Id; + } + +void set_floor(const transmatrix& spin, hpcshape& sh) { + qfi.shape = &sh; + qfi.fshape = NULL; + qfi.spin = spin; + } + +void draw_shapevec(cell *c, const transmatrix& V, const vector &shv, int col, int prio = -1) { + if(gp::on) { + int id = gp::get_plainshape_id(c); + queuepolyat(V, shv[id], col, prio); + } + else if((euclid || gp::on) && ishex1(c)) + queuepolyat(V * pispin, shv[0], col, prio); + else if(!(S7&1) && nonbitrunc) { + auto si = patterns::getpatterninfo(c, patterns::PAT_COLORING, 0); + if(si.id == 8) si.dir++; + transmatrix D = applyPatterndir(c, si); + queuepolyat(V*D, shv[pseudohept(c)], col, prio); + } + else if(geosupport_threecolor() == 2) + queuepolyat(V, shv[pseudohept(c)], col, prio); + else + queuepolyat(V, shv[ctof(c)], col, prio); + } + +void draw_floorshape(cell *c, const transmatrix& V, const floorshape &fsh, int col, int prio = -1) { + draw_shapevec(c, V, fsh.b, col, prio); + } + +void draw_qfi(cell *c, const transmatrix& V, int col, int prio = -1, vector floorshape::* tab = &floorshape::b) { + if(qfi.shape) + queuepolyat(V * qfi.spin, *qfi.shape, col, prio); + else if(!qfi.fshape) ; +#if CAP_TEXTURE + else if(qfi.tinf) { + queuetable(V * qfi.spin, qfi.tinf->vertices, size(qfi.tinf->vertices), texture::config.mesh_color, texture::config.recolor(col), prio == -1 ? PPR_FLOOR : prio); + lastptd().u.poly.tinf = qfi.tinf; + if(gp::on) + lastptd().u.poly.flags = POLY_INVERSE; + } +#endif + else draw_shapevec(c, V, (qfi.fshape->*tab), col, prio); + } + +void viewmat() { +/* + int id = 0; + if(gp::on) { + gp::just_matrices = true; + gp::draw_li = gp::get_local_info(cwt.c); + if(gp::draw_li.last_dir == -1) gp::draw_li.total_dir = 0; + gp::draw_li.total_dir = fix6(gp::draw_li.total_dir); + gp::get_plainshape_id(cwt.c); + gp::just_matrices = false; + } + // if(gp::on && !gp::usedml.count(cwt.c)) return; + for(auto& v: (pseudohept(cwt.c) ? hept_matrices : hex_matrices).v) { +// for(auto& v: (gp::on ? gp::usedml[cwt.c] : pseudohept(cwt.c) ? hept_matrices : hex_matrices).v) { + hyperpoint h1 = gmatrix[cwt.c] * v.second[0] * hpxyz(1,0,0); + hyperpoint h2 = gmatrix[cwt.c] * v.second[0] * hpxyz(0,1,0); + hyperpoint h3 = gmatrix[cwt.c] * v.second[0] * hpxyz(0,0,1); + queueline(h1, h2, 0xFFFFFFFF, 4, PPR_LINE); + queueline(h2, h3, 0xFFFFFFFF, 4, PPR_LINE); + queueline(h3, h1, 0xFFFFFFFF, 4, PPR_LINE); + hyperpoint ch = mid3(h1, h2, h3); + queuestr(ch, vid.fsize, its(id), 0xFFFFFF); +if(0) { + hyperpoint h1 = gmatrix[cwt.c] * inverse(v.first) * hpxyz(1,0,0); + hyperpoint h2 = gmatrix[cwt.c] * inverse(v.first) * hpxyz(0,1,0); + hyperpoint h3 = gmatrix[cwt.c] * inverse(v.first) * hpxyz(0,0,1); + queueline(h1, h2, 0xFF00FF80, 4, PPR_LINE); + queueline(h2, h3, 0xFF00FF80, 4, PPR_LINE); + queueline(h3, h1, 0xFF00FF80, 4, PPR_LINE); + hyperpoint ch = mid3(h1, h2, h3); + queuestr(ch, vid.fsize, its(id), 0xFFFFFF); + } + id++; + } */ + } + diff --git a/graph.cpp b/graph.cpp index e9c89269..0f27f544 100644 --- a/graph.cpp +++ b/graph.cpp @@ -561,7 +561,7 @@ bool drawItemType(eItem it, cell *c, const transmatrix& V, int icol, int ticks, it == itDodeca ? &shDodeca : xch == '*' ? &shGem[ct6] : xch == '(' ? &shKnife : - it == itShard ? &shMFloor[0] : + it == itShard ? &shMFloor.b[0] : it == itTreat ? &shTreat : it == itSlime ? &shEgg : xch == '%' ? &shDaisy : xch == '$' ? &shStar : xch == ';' ? &shTriangle : @@ -632,9 +632,11 @@ bool drawItemType(eItem it, cell *c, const transmatrix& V, int icol, int ticks, } else if(it == itPalace) { + if(ct6 >= size(shMFloor3.b)) ct6 = 0; + if(ct6 >= size(shMFloor3.b)) return; transmatrix V2 = V * spin(ticks / 1500.); - queuepoly(V2, shMFloor3[ct6], 0xFFD500FF); - queuepoly(V2, shMFloor4[ct6], darkena(icol, 0, 0xFF)); + queuepoly(V2, shMFloor3.b[ct6], 0xFFD500FF); + queuepoly(V2, shMFloor4.b[ct6], darkena(icol, 0, 0xFF)); queuepoly(V2, shGem[ct6], 0xFFD500FF); xsh = NULL; } @@ -2371,10 +2373,10 @@ transmatrix applyDowndir(cell *c, cellfunction *cf) { return ddspin(c, patterns::downdir(c, cf), S42); } -void drawTowerFloor(const transmatrix& V, cell *c, int col, cellfunction *cf = coastvalEdge) { +void set_towerfloor(cell *c, cellfunction *cf = coastvalEdge) { if(weirdhyperbolic || sphere) { - int ct6 = ctof(c); - qfloor(c, V, PLAINFLOOR, col); return; + set_floor(shFloor); + return; } int j = -1; @@ -2396,17 +2398,16 @@ void drawTowerFloor(const transmatrix& V, cell *c, int col, cellfunction *cf = c } if(j >= 0) - qfloor(c, V, applyDowndir(c, cf), shTower[j], col); + set_floor(applyDowndir(c, cf), shTower[j]); else if(c->wall != waLadder) - qfloor(c, V, shMFloor[ctof(c)], col); + set_floor(shMFloor); } -void drawZebraFloor(const transmatrix& V, cell *c, int col) { +void set_zebrafloor(cell *c) { - if(euclid) { qfloor(c, V, shTower[10], col); return; } + if(euclid) { set_floor(shTower[10]); return; } if(weirdhyperbolic) { - int ct6 = ctof(c); - qfloor(c, V, PLAINFLOOR, col); return; + set_floor(shFloor); return; } auto si = patterns::getpatterninfo(c, 'z', patterns::SPF_SYM0123); @@ -2418,12 +2419,12 @@ void drawZebraFloor(const transmatrix& V, cell *c, int col) { else if(si.id >= 28 && si.id < 40) j = 3; else j = 0; - qfloor(c, V, applyPatterndir(c, si), shZebra[j], col); + set_floor(applyPatterndir(c, si), shZebra[j]); } -void qplainfloor(cell *c, bool warp, const transmatrix &V, int col); +void set_maywarp_floor(cell *c); -void drawReptileFloor(const transmatrix& V, cell *c, int col, bool usefloor) { +void set_reptile_floor(cell *c, const transmatrix& V, int col, bool nodetails = false) { auto si = euclid6 ? @@ -2444,18 +2445,12 @@ void drawReptileFloor(const transmatrix& V, cell *c, int col, bool usefloor) { if(euclid6) j = 0; transmatrix D = applyPatterndir(c, si); - transmatrix V2 = V * D; - if(wmescher) { - if(usefloor) - qfloor(c, V, D, shReptile[j][0], darkena(col, 0, 0xFF)); - else - queuepoly(V2, shReptile[j][0], darkena(col, 0, 0xFF)); - } - else - qplainfloor(c, isWarped(c), V, darkena(col, 0, 0xFF)); + if(wmescher) + set_floor(D, shReptile[j][0]); + else set_maywarp_floor(c); - if(usefloor && chasmg == 2) return; + if(nodetails) return; int dcol = 0; @@ -2480,18 +2475,25 @@ void drawReptileFloor(const transmatrix& V, cell *c, int col, bool usefloor) { if(!chasmg) { if(wmescher) - queuepoly(V2, shReptile[j][1], dcol); + queuepoly(V*D, shReptile[j][1], dcol); else - queuepoly(V2, shMFloor[ctof(c)], dcol); + draw_floorshape(c, V, shMFloor, dcol); } if(ecol != -1) { - queuepoly(V2, shReptile[j][2], (ecol << 8) + 0xFF); - queuepoly(V2, shReptile[j][3], (ecol << 8) + 0xFF); + queuepoly(V*D, shReptile[j][2], (ecol << 8) + 0xFF); + queuepoly(V*D, shReptile[j][3], (ecol << 8) + 0xFF); } } -void drawEmeraldFloor(const transmatrix& V, cell *c, int col) { +void draw_reptile(cell *c, const transmatrix &V, int col) { + auto qfib = qfi; + set_reptile_floor(c, V, col, chasmg == 2); + draw_qfi(c, V, col); + qfi = qfib; + } + +void set_emeraldfloor(cell *c) { if(!euclid && !nonbitrunc) { auto si = patterns::getpatterninfo(c, 'f', patterns::SPF_SYM0123); @@ -2505,16 +2507,12 @@ void drawEmeraldFloor(const transmatrix& V, cell *c, int col) { else if(si.id == 36) j = 5; if(j >= 0) { - qfloor(c, V, applyPatterndir(c, si), shEmeraldFloor[j], col); + set_floor(applyPatterndir(c, si), shEmeraldFloor[j]); return; } } - int ct6 = ctof(c); - int xct6 = ct6; - if(gp::on && has_nice_dual() && pseudohept(c) && !ishept(c)) xct6 = 2; - - qfloor(c, V, CAVEFLOOR, col); + set_floor(shCaveFloor); } double fanframe; @@ -3063,6 +3061,7 @@ bool noAdjacentChasms(cell *c) { // does the current geometry allow nice duals bool has_nice_dual() { if(!nonbitrunc) return true; + if((S7 & 1) == 0) return true; if(!gp::on) return false; return (gp::param.first + gp::param.second * 2) % 3 == 0; } @@ -3076,137 +3075,75 @@ bool use_swapped_duals() { return (euclid && !a4) || gp::on; } -void floorShadow(cell *c, const transmatrix& V, int col, bool warp) { +void floorShadow(cell *c, const transmatrix& V, int col) { if(pmodel == mdHyperboloid || pmodel == mdBall || pmodel == mdHemisphere) return; // shadows break the depth testing - if(shmup::on || nbtnice) warp = false; dynamicval p(poly_outline, OUTLINE_TRANS); - if(!(qfi.shape->flags & POLY_HASSHADOW)) { + if(qfi.shape) { queuepolyat(V * qfi.spin * shadowmulmatrix, *qfi.shape, col, PPR_WALLSHADOW); } - else if(warp) { - if(euclid) { - if(ishex1(c)) - queuepolyat(V * pispin, shTriheptaFloorShadow[0], col, PPR_WALLSHADOW); - else - queuepolyat(V, shTriheptaFloorShadow[ctof(c)], col, PPR_WALLSHADOW); - } - else { - auto si = patterns::getpatterninfo(c, 0, 0); - queuepolyat(V * applyPatterndir(c, si), shTriheptaFloorShadow[si.id == 13 ? 2 : ctof(c)], col, PPR_WALLSHADOW); - } - } - else if(is_nice_dual(c)) { - if(use_swapped_duals() && ishex1(c)) - queuepolyat(V * pispin, shBigTriShadow, col, PPR_WALLSHADOW); - else - queuepolyat(V, shBigTriShadow, col, PPR_WALLSHADOW); - } - else { - queuepolyat(V, shFloorShadow[ctof(c)], col, PPR_WALLSHADOW); - } - } - -void plainfloor(cell *c, bool warp, const transmatrix &V, int col, int prio) { - if(warp) { - if(euclid) { - if(ishex1(c)) - queuepolyat(V * pispin, shTriheptaFloor[ctof(c)], col, prio); - else - queuepolyat(V, shTriheptaFloor[ctof(c)], col, prio); - } - else { - auto si = patterns::getpatterninfo(c, 0, 0); - queuepolyat(V * applyPatterndir(c, si), shTriheptaFloor[/*sphere ? ctof(c) :*/ si.id], col, prio); - } - } - else if(is_nice_dual(c)) { - if(use_swapped_duals() && ishex1(c)) - queuepolyat(V * pispin, shBigTriangle, col, prio); - else - queuepolyat(V, shBigTriangle, col, prio); - } + else if(qfi.fshape->is_plain) + draw_shapevec(c, V, qfi.fshape->shadow, col, PPR_WALLSHADOW); else - queuepolyat(V, *qfi.shape, col, prio); + draw_qfi(c, V * shadowmulmatrix, col, PPR_WALLSHADOW); } -void qfloor_eswap(cell *c, const transmatrix& V, const hpcshape& sh, int col); - -void qplainfloor(cell *c, bool warp, const transmatrix &V, int col) { - if(warp) { +void set_maywarp_floor(cell *c) { + bool warp = isWarped(c); + if(warp && !shmup::on && geosupport_graveyard() == 2) { auto si = patterns::getpatterninfo(c, 0, 0); - qfloor(c, V, applyPatterndir(c, si), shTriheptaFloor[si.id], col); + if(si.id == 0 || si.id == 1) + set_floor(shTriheptaFloor); + else if(si.id >= 14) + set_floor(shFloor); + else + set_floor(applyPatterndir(c, si), shTriheptaSpecial[si.id]); } - else if(is_nice_dual(c)) - qfloor_eswap(c, V, shBigTriangle, col); - else - qfloor(c, V, shFloor[ctof(c)], col); + else if(is_nice_dual(c)) set_floor(shBigTriangle); + else set_floor(shFloor); } int wavephase; -void warpfloor(cell *c, const transmatrix& V, int col, int prio, bool warp) { - if(shmup::on || nbtnice) warp = false; -#if CAP_TEXTURE - if(qfi.tinf) { - queuetable(V*qfi.spin, qfi.tinf->vertices, size(qfi.tinf->vertices), 0, texture::config.recolor(col), prio); - lastptd().u.poly.tinf = qfi.tinf; - } - else -#endif - plainfloor(c, warp, V, col, prio); - } - -#define placeSidewallX(a,b,c,d,e,f,g) \ - { if(!(qfi.shape->flags & POLY_HASWALLS) || !validsidepar[c]) { \ - escherSidewall(a,c,d,g); break; } \ - else placeSidewall(a,b,c,d,e,f,g); } -#define placeSidewallXB(a,b,c,d,e,f,g, Break) \ - { if(!(qfi.shape->flags & POLY_HASWALLS) || !validsidepar[c]) { \ - escherSidewall(a,c,d,g); Break; break; } \ - else placeSidewall(a,b,c,d,e,f,g); } - void escherSidewall(cell *c, int sidepar, const transmatrix& V, int col) { if(sidepar >= SIDE_SLEV && sidepar <= SIDE_SLEV+2) { int sl = sidepar - SIDE_SLEV; for(int z=1; z<=4; z++) if(z == 1 || (z == 4 && detaillevel == 2)) - warpfloor(c, mscale(V, zgrad0(geom3::slev * sl, geom3::slev * (sl+1), z, 4)), col, PPR_REDWALL-4+z+4*sl, false); + draw_qfi(c, mscale(V, zgrad0(geom3::slev * sl, geom3::slev * (sl+1), z, 4)), col, PPR_REDWALL-4+z+4*sl); } else if(sidepar == SIDE_WALL) { const int layers = 2 << detaillevel; for(int z=1; zmov[i] || !pseudohept(c->mov[i]))) return; - if(is_nice_dual(c)) { - if(pseudohept(c)) return; - bool b = !(i&1); - if(use_swapped_duals()) { - if(!ishex1(c)) b = !b; - if(gp::on) b = !b; - } - if(b) return; +bool placeSidewall(cell *c, int i, int sidepar, const transmatrix& V, int col) { + + if(!qfi.fshape || !qfi.fshape->is_plain || !validsidepar[sidepar]) { + escherSidewall(c, sidepar, V, col); + return true; } + + if(qfi.fshape == &shBigTriangle && pseudohept(c->mov[i])) return false; + if(qfi.fshape == &shTriheptaFloor && !pseudohept(c) && !pseudohept(c->mov[i])) return false; + int prio; /* if(mirr) prio = PPR_GLASS - 2; else */ if(sidepar == SIDE_WALL) prio = PPR_WALL3 - 2; @@ -3216,29 +3153,15 @@ void placeSidewall(cell *c, int i, int sidepar, const transmatrix& V, bool warp, else if(sidepar == SIDE_BTOI) prio = PPR_BELOWBOTTOM; else prio = PPR_REDWALL-2+4*(sidepar-SIDE_SLEV); - flagtype f = qfi.shape->flags; - - if((f & POLY_GP) && !mirr) { - if(f & POLY_FULL) - queuepolyat(V, gp::get_plainshape().shFullFloorSide[sidepar][i], col, prio); - if(f & POLY_PLAIN) - queuepolyat(V, gp::get_plainshape().shFloorSide[sidepar][i], col, prio); - return; - } - transmatrix V2 = V * ddspin(c, i); - // if(sphere && vid.alpha <= 1 && tC0(V2 * xpush(cellgfxdist(c, i)/2))[2] < -.5) return; - - /* int aw = away(V2); prio += aw; - if(!detaillevel && aw < 0) return; - */ + if(gp::on) { + draw_shapevec(c, V2, qfi.fshape->gpside[sidepar][i], col, prio); + return false; + } - // queuepoly(V2 * xpush(.1), shSnowball, aw ? 0xFFFFFFFF : 0xFF0000FF); - // prio += c->cpdist - c->mov[i]->cpdist; - - queuepolyat(V2, - ((f & POLY_FULL)?shFullFloorSide:mirr?shMFloorSide:warp?(pseudohept(c)&&!ishept(c)?shTriheptaSideGP:shTriheptaSide):is_nice_dual(c)?shBigTriSide:shFloorSide)[sidepar][ctof(c)], col, prio); + queuepolyat(V2, qfi.fshape->side[sidepar][pseudohept(c)], col, prio); + return false; } bool openorsafe(cell *c) { @@ -3357,13 +3280,6 @@ bool allemptynear(cell *c) { static const int trapcol[4] = {0x904040, 0xA02020, 0xD00000, 0x303030}; static const int terracol[8] = {0xD000, 0xE25050, 0xD0D0D0, 0x606060, 0x303030, 0x181818, 0x0080, 0x8080}; -void qfloor_eswap(cell *c, const transmatrix& V, const hpcshape& sh, int col) { - if((euclid || gp::on) && ishex1(c)) - qfloor(c, V, pispin, sh, col); - else - qfloor(c, V, sh, col); - }; - bool bright; // how much to darken @@ -3456,10 +3372,10 @@ void draw_wall(cell *c, const transmatrix& V, int wcol, int& zcol, int ct6, int const int layers = 2 << detaillevel; for(int z=1; zwall == waIcewall) alpha = 0xC0; - bool warp = isWarped(c); - if(starcol && !(wmescher && c->wall == waPlatform)) queuepolyat(Vdepth, shThisWall, darkena(starcol, 0, 0xFF), PPR_WALL3A); - warpfloor(c, Vdepth, darkena(wcol0, fd, alpha), PPR_WALL3, warp); - floorShadow(c, V, SHADOW_WALL, warp); + draw_qfi(c, Vdepth, darkena(wcol0, fd, alpha), PPR_WALL3); + floorShadow(c, V, SHADOW_WALL); if(c->wall == waCamelot) { forCellIdEx(c2, i, c) { - placeSidewallX(c, i, SIDE_SLEV, V, warp, false, darkena(wcol2, fd, alpha)); + if(placeSidewall(c, i, SIDE_SLEV, V, darkena(wcol2, fd, alpha))) break; } forCellIdEx(c2, i, c) { - placeSidewallX(c, i, SIDE_SLEV+1, V, warp, false, darkena(wcol2, fd, alpha)); + if(placeSidewall(c, i, SIDE_SLEV+1, V, darkena(wcol2, fd, alpha))) break; } forCellIdEx(c2, i, c) { - placeSidewallX(c, i, SIDE_SLEV+2, V, warp, false, darkena(wcol2, fd, alpha)); + if(placeSidewall(c, i, SIDE_SLEV+2, V, darkena(wcol2, fd, alpha))) break; } forCellIdEx(c2, i, c) { - placeSidewallX(c, i, SIDE_WTS3, V, warp, false, darkena(wcol2, fd, alpha)); + if(placeSidewall(c, i, SIDE_WTS3, V, darkena(wcol2, fd, alpha))) break; } } else { forCellIdEx(c2, i, c) if(!highwall(c2) || conegraph(c2)) { - placeSidewallX(c, i, SIDE_WALL, V, warp, false, darkena(wcol2, fd, alpha)); + if(placeSidewall(c, i, SIDE_WALL, V, darkena(wcol2, fd, alpha))) break; } } } } } -void qfloor_caves(cell* c, const transmatrix& Vf, int col, int ct6, int xct6) { - /* if(gp::on) { - if(pseudohept(c)) - qfloor(c, Vf, shCaveFloor[ishept(c) ? 1 : 2], col); - else if(ishex1(c)) - qfloor(c, Vf, pispin, shCaveFloor[0], col); - else - qfloor(c, Vf, shCaveFloor[0], col); - } - else */ - qfloor_eswap(c, Vf, CAVEFLOOR, col); - } - -// ptrn qfloor(c, Vf, CAVEFLOOR, darkena(fcol, fd, 0xFF)); +bool just_gmatrix; void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { @@ -3527,10 +3428,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { return; } #endif - - qfi.shape = &shFloor[ctof(c)]; - ivoryz = isGravityLand(c->land); - + bool orig = false; if(!inmirrorcount) { transmatrix& gm = gmatrix[c]; @@ -3542,6 +3440,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(orig) gm = V; } + if(just_gmatrix) return; + + set_floor(shFloor); + ivoryz = isGravityLand(c->land); // if(behindsphere(V)) return; @@ -3798,8 +3700,6 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { int ctype = c->type; int ct6 = ctof(c); - int xct6 = ct6; - if(gp::on && has_nice_dual() && pseudohept(c) && !ishept(c)) xct6 = 2; bool error = false; @@ -3846,39 +3746,28 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { zcol = 0; int rd = rosedist(c); if(rd == 1) - queuepoly(V, shRoseFloor[ct6], 0x80406020); + draw_floorshape(c, V, shRoseFloor, 0x80406020); if(rd == 2) - queuepoly(V, shRoseFloor[ct6], 0x80406040); + draw_floorshape(c, V, shRoseFloor, 0x80406040); if(c->land == laZebra) fd++; if(c->land == laHalloween && !wmblack) { transmatrix Vdepth = wmspatial ? mscale(V, geom3::BOTTOM) : V; - queuepolyat(Vdepth, FULLFLOOR, darkena(firecolor(ticks / 10), 0, 0xDF), - PPR_LAKEBOTTOM); + draw_floorshape(c, Vdepth, shFullFloor, darkena(firecolor(ticks / 10), 0, 0xDF), PPR_LAKEBOTTOM); } } - + #if CAP_EDIT else if(mapeditor::drawUserShape(V * applyPatterndir(c, si), 3, si.id, darkena(fcol, fd, (cmode & sm::DRAW) ? 0xC0 : 0xFF), c)); + + else if(patterns::whichShape == '7') + set_floor(shBigHepta); - else if(patterns::whichShape == '7') { - if(ishept(c)) - qfloor(c, Vf, wmblack ? shBFloor[ct6] : - euclid ? shBigHex : - shBigHepta, darkena(fcol, fd, 0xFF)); - } + else if(patterns::whichShape == '8') + set_floor(shTriheptaFloor); - else if(patterns::whichShape == '8') { - qfloor_eswap(c, Vf, shTriheptaFloor[ctof(c)], darkena(fcol, fd, 0xFF)); - } - - else if(patterns::whichShape == '6') { - if(!ishept(c)) - qfloor(c, Vf, - wmblack ? shBFloor[ct6] : - euclid ? (ishex1(c) ? shBigHexTriangle : shBigHexTriangleRev) : - shBigTriangle, darkena(fcol, fd, 0xFF)); - } + else if(patterns::whichShape == '6') + set_floor(shBigTriangle); #endif #if CAP_TEXTURE @@ -3902,7 +3791,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { transmatrix V2 = V * qfi.spin; if(!wmblack) for(int d=0; d<6; d++) { inmirrorcount+=d; - qfloor(c, V2 * spin(d*M_PI/3), shHalfFloor[2], darkena(fcol, fd, 0xFF)); + queuepolyat(V2 * spin(d*M_PI/3), shHalfFloor[2], darkena(fcol, fd, 0xFF), PPR_FLOORa); inmirrorcount-=d; } if(wmspatial) { @@ -3918,9 +3807,9 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { transmatrix V2 = V * qfi.spin; if(!wmblack) { inmirrorcount++; - qfloor(c, mirrorif(V2, !onleft), shHalfFloor[ct6], darkena(fcol, fd, 0xFF)); + queuepolyat(mirrorif(V2, !onleft), shHalfFloor[ct6], darkena(fcol, fd, 0xFF), PPR_FLOORa); inmirrorcount--; - qfloor(c, mirrorif(V2, onleft), shHalfFloor[ct6], darkena(fcol, fd, 0xFF)); + queuepolyat(mirrorif(V2, onleft), shHalfFloor[ct6], darkena(fcol, fd, 0xFF), PPR_FLOORa); } if(wmspatial) { @@ -3943,120 +3832,97 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { transmatrix V2 = V * qfi.spin; if(wmspatial && wmescher) { - qfi.shape = &shSemiFeatherFloor[0]; + set_floor(shSemiFeatherFloor[0]); int dk = 1; int vcol = winf[waVinePlant].color; - warpfloor(c, mscale(V, geom3::WALL), darkena(vcol, dk, 0xFF), PPR_WALL3A, false); - escherSidewall(c, SIDE_WALL, V, darkena(gradient(0, vcol, 0, .8, 1), dk, 0xFF)); - qfloor(c, V2, shSemiFeatherFloor[1], darkena(fcol, dk, 0xFF)); - qfi.shape = &shFeatherFloor[0]; + draw_qfi(c, mscale(V2, geom3::WALL), darkena(vcol, dk, 0xFF), PPR_WALL3A); + escherSidewall(c, SIDE_WALL, V2, darkena(gradient(0, vcol, 0, .8, 1), dk, 0xFF)); + queuepoly(V2, shSemiFeatherFloor[1], darkena(fcol, dk, 0xFF)); + set_floor(shFeatherFloor); } else if(wmspatial) { - hpcshape *shar = wmplain ? shFloor : shFeatherFloor; - - int dk = 1; - qfloor(c, V, shar[0], darkena(fcol, dk, 0xFF)); + floorshape& shar = *(wmplain ? (floorshape*)&shFloor : (floorshape*)&shFeatherFloor); + set_floor(shar); + int vcol = winf[waVinePlant].color; int vcol2 = gradient(0, vcol, 0, .8, 1); transmatrix Vdepth = mscale(V2, geom3::WALL); - queuepolyat(Vdepth, shSemiFloor[0], darkena(vcol, dk, 0xFF), PPR_WALL3A); + queuepolyat(Vdepth, shSemiFloor[0], darkena(vcol, fd, 0xFF), PPR_WALL3A); {dynamicval p(poly_outline, OUTLINE_TRANS); queuepolyat(V2 * spin(M_PI*2/3), shSemiFloorShadow, SHADOW_WALL, PPR_WALLSHADOW); } - queuepolyat(V2, shSemiFloorSide[SIDE_WALL], darkena(vcol, dk, 0xFF), PPR_WALL3A-2+away(V2)); + queuepolyat(V2, shSemiFloorSide[SIDE_WALL], darkena(vcol, fd, 0xFF), PPR_WALL3A-2+away(V2)); if(validsidepar[SIDE_WALL]) forCellIdEx(c2, j, c) { int dis = i-j; dis %= 6; if(dis<0) dis += 6; if(dis != 1 && dis != 5) continue; - placeSidewall(c, j, SIDE_WALL, V, false, false, darkena(vcol2, fd, 0xFF)); + if(placeSidewall(c, j, SIDE_WALL, V, darkena(vcol2, fd, 0xFF))) break; } } - else { + else { hpcshape *shar = shSemiFeatherFloor; if(wmblack) shar = shSemiBFloor; if(wmplain) shar = shSemiFloor; - int dk = wmblack ? 0 : wmplain ? 1 : 1; + queuepoly(V2, shar[0], darkena(winf[waVinePlant].color, fd, 0xFF)); - qfloor(c, V2, shar[0], darkena(winf[waVinePlant].color, dk, 0xFF)); - qfloor(c, V2, shar[1], darkena(fcol, dk, 0xFF)); + set_floor(qfi.spin, shar[1]); } } - else if(c->land == laReptile || c->wall == waReptile) - drawReptileFloor(Vf, c, fcol, true); + else if(c->land == laReptile || c->wall == waReptile) + set_reptile_floor(c, Vf, fcol); else if(wmblack == 1 && c->wall == waMineOpen && vid.grid) ; -// else if(true) -// qfloor(c, Vf, shWave[wavephase][ct6], darkena(fcol, fd, 0xFF)); -// else if(true) -// qfloor(c, Vf, shSeabed[ct6], darkena(fcol, fd, 0xFF)); - else if(wmblack) { - qfloor(c, Vf, shBFloor[ct6], darkena(fcol, 0, 0xFF)); + set_floor(shBFloor[ct6]); int rd = rosedist(c); if(rd == 1) - qfloor(c, Vf, shHeptaMarker, darkena(fcol, 0, 0x80)); + queuepoly(Vf, shHeptaMarker, darkena(fcol, 0, 0x80)); else if(rd == 2) - qfloor(c, Vf, shHeptaMarker, darkena(fcol, 0, 0x40)); + queuepoly(Vf, shHeptaMarker, darkena(fcol, 0, 0x40)); } - else if(isWarped(c) && euclid) - qfloor_eswap(c, Vf, shTriheptaFloor[ctof(c)], darkena(fcol, fd, 0xFF)); - - else if(is_nice_dual(c) && !pseudohept(c)) { - qfloor_eswap(c, Vf, shBigTriangle, darkena(fcol, fd, 0xFF)); - } - - else if(isWarped(c) && !nbtnice && !shmup::on) { - auto si = patterns::getpatterninfo(c, 0, 0); - if(si.id < 14) - qfloor(c, Vf, applyPatterndir(c, si), shTriheptaFloor[si.id], darkena(fcol, fd, 0xFF)); - else - qfloor(c, Vf, shFloor[ctof(c)], darkena(fcol, fd, 0xFF)); - } + else if(isWarped(c) || is_nice_dual(c)) + set_maywarp_floor(c); else if(wmplain) { - if(wmspatial && highwall(c)) - qfloor_virtual(c, Vf, PLAINFLOOR); - else - qfloor(c, Vf, PLAINFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shFloor); } else if(randomPatternsMode && c->land != laBarrier && !isWarped(c->land)) { int j = (randompattern[c->land]/5) % 15; - int dfcol = darkena(fcol, fd, 0xFF); int k = randompattern[c->land] % RPV_MODULO; int k7 = randompattern[c->land] % 7; - if(k == RPV_ZEBRA && k7 < 2) drawZebraFloor(Vf, c, dfcol); - else if(k == RPV_EMERALD && k7 == 0) drawEmeraldFloor(Vf, c, dfcol); - else if(k == RPV_CYCLE && k7 < 4) drawTowerFloor(Vf, c, dfcol, celldist); + if(k == RPV_ZEBRA && k7 < 2) set_zebrafloor(c); + else if(k == RPV_EMERALD && k7 == 0) set_emeraldfloor(c); + else if(k == RPV_CYCLE && k7 < 4) set_towerfloor(c, celldist); else switch(j) { - case 0: qfloor(c, Vf, CLOUDFLOOR, dfcol); break; - case 1: qfloor(c, Vf, FEATHERFLOOR, dfcol); break; - case 2: qfloor(c, Vf, STARFLOOR, dfcol); break; - case 3: qfloor_eswap(c, Vf, TRIFLOOR, dfcol); break; - case 4: qfloor_eswap(c, Vf, SSTARFLOOR, dfcol); break; - case 5: qfloor(c, Vf, OVERFLOOR, dfcol); break; - case 6: qfloor(c, Vf, FEATHERFLOOR, dfcol); break; - case 7: qfloor_eswap(c, Vf, DEMONFLOOR, dfcol); break; - case 8: qfloor_eswap(c, Vf, CROSSFLOOR, dfcol); break; - case 9: qfloor(c, Vf, MFLOOR1, dfcol); break; - case 10: qfloor_caves(c, Vf, dfcol, ct6, xct6); break; - case 11: qfloor_eswap(c, Vf, POWERFLOOR, dfcol); break; - case 12: qfloor_eswap(c, Vf, DESERTFLOOR, dfcol); break; - case 13: qfloor_eswap(c, Vf, CHARGEDFLOOR, dfcol); break; - case 14: qfloor_eswap(c, Vf, CHARGEDFLOOR, dfcol); break; + case 0: set_floor(shCloudFloor); break; + case 1: set_floor(shFeatherFloor); break; + case 2: set_floor(shStarFloor); break; + case 3: set_floor(shTriFloor); break; + case 4: set_floor(shSStarFloor); break; + case 5: set_floor(shOverFloor); break; + case 6: set_floor(shFeatherFloor); break; + case 7: set_floor(shDemonFloor); break; + case 8: set_floor(shCrossFloor); break; + case 9: set_floor(shMFloor); break; + case 10: set_floor(shCaveFloor); break; + case 11: set_floor(shPowerFloor); break; + case 12: set_floor(shDesertFloor); break; + case 13: set_floor(shChargedFloor); break; + case 14: set_floor(shLavaFloor); break; } } @@ -4064,163 +3930,141 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { // queuepoly(Vf, shLeafFloor[ct6], darkena(fcol, fd, 0xFF)); /* else if(c->land == laPrairie && prairie::isriver(c)) - drawTowerFloor(Vf, c, darkena(fcol, fd, 0xFF), + set_towerfloor(Vf, c, darkena(fcol, fd, 0xFF), prairie::isleft(c) ? river::towerleft : river::towerright); */ else switch(c->land) { case laPrairie: - qfloor(c, Vf, CLOUDFLOOR, darkena(fcol, fd, 0xFF)); + case laAlchemist: + set_floor(shCloudFloor); break; + case laJungle: case laWineyard: - qfloor(c, Vf, FEATHERFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shFeatherFloor); break; case laZebra: - drawZebraFloor(Vf, c, darkena(fcol, fd, 0xFF)); + set_zebrafloor(c); break; case laMountain: - drawTowerFloor(Vf, c, darkena(fcol, fd, 0xFF), - euclid ? celldist : c->master->alt ? celldistAltPlus : celldist); + set_towerfloor(c, euclid ? celldist : c->master->alt ? celldistAltPlus : celldist); break; case laEmerald: - drawEmeraldFloor(Vf, c, darkena(fcol, fd, 0xFF)); + set_emeraldfloor(c); break; case laRlyeh: - qfloor_eswap(c, Vf, TRIFLOOR, darkena(fcol, fd, 0xFF)); - break; - case laTemple: - qfloor_eswap(c, Vf, TRIFLOOR, darkena(fcol, fd, 0xFF)); - break; - - case laAlchemist: - qfloor(c, Vf, CLOUDFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shTriFloor); break; case laVolcano: - qfloor_eswap(c, Vf, LAVAFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shLavaFloor); break; case laRose: - qfloor_eswap(c, Vf, ROSEFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shRoseFloor); break; case laTortoise: - qfloor_eswap(c, Vf, TURTLEFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shTurtleFloor); break; case laBurial: case laRuins: - qfloor(c, Vf, BARROWFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shBarrowFloor); break; case laTrollheim: - if(!eoh && !gp::on) - qfloor_eswap(c, Vf, TROLLFLOOR, darkena(fcol, fd, 0xFF)); - else - qfloor_caves(c, Vf, darkena(fcol, fd, 0xFF), ct6, xct6); - break; - - case laJungle: - qfloor(c, Vf, FEATHERFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shTrollFloor); break; - + /*case laMountain: - qfloor(c, Vf, FEATHERFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(FEATHERFLOOR); break; */ case laGraveyard: - qfloor_eswap(c, Vf, CROSSFLOOR, darkena(fcol, fd, 0xFF)); - break; - - case laDeadCaves: - qfloor_caves(c, Vf, darkena(fcol, fd, 0xFF), ct6, xct6); + set_floor(shCrossFloor); break; case laMotion: - qfloor(c, Vf, MFLOOR1, darkena(fcol, fd, 0xFF)); + set_floor(shMFloor); break; case laWhirlwind: - qfloor_eswap(c, Vf, NEWFLOOR, darkena(fcol, fd, 0xFF)); + case laEFire: case laEAir: case laEWater: case laEEarth: case laElementalWall: + set_floor(shNewFloor); break; case laHell: - qfloor_eswap(c, Vf, DEMONFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shDemonFloor); break; case laIce: case laBlizzard: - qfloor(c, Vf, STARFLOOR, darkena(fcol, fd, 0xFF)); - break; - - case laCocytus: - qfloor_eswap(c, Vf, DESERTFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shStarFloor); break; case laSwitch: - qfloor_eswap(c, Vf, SWITCHFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shSwitchFloor); if(ctof(c)) for(int i=0; itype; i++) queuepoly(Vf * ddspin(c, i, S6) * xpush(rhexf), shSwitchDisk, darkena(minf[active_switch()].color, fd, 0xFF)); break; case laStorms: - qfloor_eswap(c, Vf, CHARGEDFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shChargedFloor); break; case laWildWest: - qfloor_eswap(c, Vf, SSTARFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shSStarFloor); break; case laPower: - qfloor_eswap(c, Vf, POWERFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shPowerFloor); break; - + case laCaves: - qfloor_caves(c, Vf, darkena(fcol, fd, 0xFF), ct6, xct6); + case laLivefjord: + case laDeadCaves: + set_floor(shCaveFloor); break; case laDesert: - qfloor_eswap(c, Vf, DESERTFLOOR, darkena(fcol, fd, 0xFF)); + case laDryForest: + case laRedRock: case laSnakeNest: + case laCocytus: + set_floor(shDesertFloor); break; case laBull: - qfloor_eswap(c, Vf, BUTTERFLYFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shButterflyFloor); break; - case laDryForest: - qfloor_eswap(c, Vf, DESERTFLOOR, darkena(fcol, fd, 0xFF)); - break; - case laCaribbean: case laOcean: case laOceanWall: case laWhirlpool: - qfloor(c, Vf, CLOUDFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shCloudFloor); break; case laKraken: - qfloor(c, Vf, FULLFLOOR, darkena(fcol, fd, 0xFF)); - break; - case laDocks: - qfloor(c, Vf, FULLFLOOR, darkena(fcol, fd, 0xFF)); - break; - - case laLivefjord: - qfloor_caves(c, Vf, darkena(fcol, fd, 0xFF), ct6, xct6); - break; - - case laRedRock: case laSnakeNest: - qfloor_eswap(c, Vf, DESERTFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shFullFloor); break; case laPalace: case laTerracotta: - qfloor_eswap(c, Vf, PALACEFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shPalaceFloor); break; + case laDragon: + set_floor(shDragonFloor); + break; + + case laOvergrown: case laClearing: case laHauntedWall: case laHaunted: case laHauntedBorder: + set_floor(shOverFloor); + break; + case laMercuryRiver: { if(eoh) - qfloor(c, Vf, PLAINFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shFloor); else { int bridgedir = -1; if(c->type == 6) { @@ -4230,10 +4074,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { bridgedir = i; } if(bridgedir == -1) - qfloor_eswap(c, Vf, PALACEFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shPalaceFloor); else { transmatrix bspin = ddspin(c, bridgedir); - qfloor(c, Vf, bspin, shMercuryBridge[0], darkena(fcol, fd, 0xFF)); + set_floor(bspin, shMercuryBridge[0]); // only needed in one direction if(c < c->mov[bridgedir]) { bspin = Vf * bspin; @@ -4248,52 +4092,62 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { break; } - case laOvergrown: case laClearing: case laHauntedWall: case laHaunted: case laHauntedBorder: - qfloor(c, Vf, OVERFLOOR, darkena(fcol, fd, 0xFF)); - break; - case laHive: if(c->wall != waFloorB && c->wall != waFloorA && c->wall != waMirror && c->wall != waCloud) { - qfloor(c, Vf, PLAINFLOOR, darkena(fcol, 1, 0xFF)); + fd = 1; + set_floor(shFloor); if(c->wall != waMirror && c->wall != waCloud) - qfloor(c, Vf, MFLOOR1, darkena(fcol, 2, 0xFF)); + draw_floorshape(c, V, shMFloor, darkena(fcol, 2, 0xFF)); if(c->wall != waMirror && c->wall != waCloud) - qfloor(c, Vf, MFLOOR2, darkena(fcol, fcol==wcol ? 1 : 2, 0xFF)); + draw_floorshape(c, V, shMFloor2, darkena(fcol, fcol==wcol ? 1 : 2, 0xFF)); } else - qfloor(c, Vf, PLAINFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shFloor); break; case laEndorian: if(c->wall == waTrunk) - qfloor(c, Vf, PLAINFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shFloor); else if(c->wall == waCanopy || c->wall == waSolidBranch || c->wall == waWeakBranch) - qfloor(c, Vf, FEATHERFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shFeatherFloor); else - drawTowerFloor(Vf, c, darkena(fcol, fd, 0xFF)); - break; - - case laDragon: - if(nonbitrunc) - qfloor(c, Vf, PLAINFLOOR, darkena(fcol, fd, 0xFF)); - else - qfloor(c, Vf, DRAGONFLOOR, darkena(fcol, fd, 0xFF)); - break; - - case laEFire: case laEAir: case laEWater: case laEEarth: case laElementalWall: - qfloor_eswap(c, Vf, NEWFLOOR, darkena(fcol, fd, 0xFF)); + set_towerfloor(c); break; case laIvoryTower: case laDungeon: - drawTowerFloor(Vf, c, darkena(fcol, fd, 0xFF)); + set_towerfloor(c); break; default: - qfloor(c, Vf, PLAINFLOOR, darkena(fcol, fd, 0xFF)); + set_floor(shFloor); } + + // actually draw the floor + + if(chasmg == 2) ; + else if(chasmg && wmspatial) { + if(detaillevel == 0) return; + + int col = c->land == laCocytus ? 0x080808FF : 0x101010FF; + + if(qfi.fshape == &shCloudFloor) + set_floor(shCloudSeabed); + else if(qfi.fshape == &shFloor) + set_floor(shFullFloor); + else if(qfi.fshape == &shCaveFloor) + set_floor(shCaveSeabed); + draw_qfi(c, V, col, PPR_LAKEBOTTOM); + + int fd0 = fd ? fd-1 : 0; + draw_qfi(c, (*Vdp), darkena(fcol, fd0, 0x80), PPR_LAKELEV); + } + else { + draw_qfi(c, V, darkena(fcol, fd, 0xFF)); + } + // walls #if CAP_EDIT @@ -4330,16 +4184,14 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(realred(c->wall) && !wmspatial) { int s = snakelevel(c); - if(s >= 1) - qfloor(c, V, shRedRockFloor[0][xct6], getSnakelevColor(c, 0, 7, fd, wcol)); - if(s >= 2) - queuepoly(V, shRedRockFloor[1][xct6], getSnakelevColor(c, 1, 7, fd, wcol)); - if(s >= 3) - queuepoly(V, shRedRockFloor[2][xct6], getSnakelevColor(c, 2, 7, fd, wcol)); + if(s >= 1) draw_floorshape(c, V, shRedRockFloor[0], getSnakelevColor(c, 0, 7, fd, wcol)); + if(s >= 2) draw_floorshape(c, V, shRedRockFloor[1], getSnakelevColor(c, 1, 7, fd, wcol)); + if(s >= 3) draw_floorshape(c, V, shRedRockFloor[2], getSnakelevColor(c, 2, 7, fd, wcol)); } if(c->wall == waTower && !wmspatial) { - qfloor(c, V, shMFloor[ct6], darkena(0xE8E8E8, fd, 0xFF)); + fcol = 0xE8E8E8; + set_floor(shMFloor); } if(pseudohept(c) && ( @@ -4386,12 +4238,12 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { case waLadder: if(euclid) { - queuepoly(V, shMFloor[ct6], 0x804000FF); - queuepoly(V, shMFloor2[ct6], 0x000000FF); + draw_floorshape(c, V, shMFloor, 0x804000FF); + draw_floorshape(c, V, shMFloor2, 0x000000FF); } else { - queuepolyat(V, shFloor[ct6], 0x804000FF, PPR_FLOOR+1); - queuepolyat(V, shMFloor[ct6], 0x000000FF, PPR_FLOOR+2); + draw_floorshape(c, V, shFloor, 0x804000FF, PPR_FLOOR+1); + draw_floorshape(c, V, shMFloor, 0x000000FF, PPR_FLOOR+2); } break; @@ -4400,9 +4252,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { dynamicval qfi2(qfi, qfi); int col = reptilecolor(c); chasmg = 0; - drawReptileFloor(V, c, col, true); + set_reptile_floor(c, V, col); + draw_qfi(c, V, col); forCellIdEx(c2, i, c) if(chasmgraph(c2)) - placeSidewallX(c, i, SIDE_LAKE, V, isWarped(c), false, darkena(gradient(0, col, 0, .8, 1), fd, 0xFF)); + if(placeSidewall(c, i, SIDE_LAKE, V, darkena(gradient(0, col, 0, .8, 1), fd, 0xFF))) break; chasmg = 1; break; } @@ -4472,8 +4325,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { case waClosePlate: case waOpenPlate: { transmatrix V2 = V; if((ctype&1) && wmescher) V2 = V * pispin; - queuepoly(V2, shMFloor[ct6], darkena(winf[c->wall].color, 0, 0xFF)); - queuepoly(V2, shMFloor2[ct6], (!wmblack) ? darkena(fcol, 1, 0xFF) : darkena(0,1,0xFF)); + draw_floorshape(c, V2, shMFloor, darkena(winf[c->wall].color, 0, 0xFF)); + draw_floorshape(c, V2, shMFloor2, (!wmblack) ? darkena(fcol, 1, 0xFF) : darkena(0,1,0xFF)); break; } @@ -4510,9 +4363,11 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { int col = winf[waGlass].color; int dcol = darkena(col, 0, 0x80); transmatrix Vdepth = mscale((*Vdp), geom3::WALL); - queuepolyat(Vdepth, shMFloor[ct6], dcol, PPR_WALL); // GLASS + draw_floorshape(c, Vdepth, shMFloor, dcol, PPR_WALL); // GLASS + dynamicval dq(qfi, qfi); + set_floor(shMFloor); if(validsidepar[SIDE_WALL]) forCellIdEx(c2, i, c) - placeSidewall(c, i, SIDE_WALL, (*Vdp), false, true, dcol); + if(placeSidewall(c, i, SIDE_WALL, (*Vdp), dcol)) break; } break; @@ -4538,8 +4393,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { dynamicval ds(qfi.shape, &shCircleFloor); for(int z=1; z= sl2) - placeSidewallX(c, i, SIDE_SLEV+s, V, w, false, getSnakelevColor(c, s, sl, fd, wcol)); + if(placeSidewall(c, i, SIDE_SLEV+s, V, getSnakelevColor(c, s, sl, fd, wcol))) break; } } @@ -4578,9 +4432,11 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { int col = winf[c->wall].color; int dcol = darkena(col, 0, 0xC0); transmatrix Vdepth = mscale((*Vdp), geom3::WALL); - queuepolyat(Vdepth, shMFloor[ct6], dcol, PPR_WALL); // GLASS + draw_floorshape(c, Vdepth, shMFloor, dcol, PPR_WALL); // GLASS + dynamicval dq(qfi, qfi); + set_floor(shMFloor); if(validsidepar[SIDE_WALL]) forCellIdEx(c2, i, c) - placeSidewall(c, i, SIDE_WALL, (*Vdp), false, true, dcol); + if(placeSidewall(c, i, SIDE_WALL, (*Vdp), dcol)) break; } else { queuepoly(V, shMirror, darkena(wcol, 0, 0xC0)); @@ -4622,7 +4478,6 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { int sha = shallow(c); if(wmspatial && sha) { - bool w = isWarped(c); int col = (highwall(c) || c->wall == waTower) ? wcol : fcol; if(!chasmg) { @@ -4631,27 +4486,27 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(sha & 1) { forCellIdEx(c2, i, c) if(chasmgraph(c2)) - placeSidewallX(c, i, SIDE_LAKE, V, w, false, D(.8)); + if(placeSidewall(c, i, SIDE_LAKE, V, D(.8))) break; } if(sha & 2) { forCellIdEx(c2, i, c) if(chasmgraph(c2)) - placeSidewallX(c, i, SIDE_LTOB, V, w, false, D(.7)); + if(placeSidewall(c, i, SIDE_LTOB, V, D(.7))) break; } if(sha & 4) { bool dbot = true; forCellIdEx(c2, i, c) if(chasmgraph(c2) == 2) { if(dbot) dbot = false, - warpfloor(c, mscale(V, geom3::BOTTOM), 0x080808FF, PPR_LAKEBOTTOM, isWarped(c)); - placeSidewallX(c, i, SIDE_BTOI, V, w, false, D(.6)); + draw_qfi(c, mscale(V, geom3::BOTTOM), 0x080808FF, PPR_LAKEBOTTOM); + if(placeSidewall(c, i, SIDE_BTOI, V, D(.6))) break; } #undef D } } // wall between lake and chasm -- no Escher here if(chasmg == 1) forCellIdEx(c2, i, c) if(chasmgraph(c2) == 2) { - placeSidewall(c, i, SIDE_LAKE, V, w, false, 0x202030FF); - placeSidewall(c, i, SIDE_LTOB, V, w, false, 0x181820FF); - placeSidewall(c, i, SIDE_BTOI, V, w, false, 0x101010FF); + placeSidewall(c, i, SIDE_LAKE, V, 0x202030FF); + placeSidewall(c, i, SIDE_LTOB, V, 0x181820FF); + placeSidewall(c, i, SIDE_BTOI, V, 0x101010FF); } } @@ -4659,7 +4514,6 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { forCellIdEx(c2, i, c) if(chasmgraph(c2) == 0) { transmatrix V2 = V * cellrelmatrix(c, i); // if(!behindsphere(V2)) continue; - bool w = isWarped(c2); int wcol2, fcol2; setcolors(c2, wcol2, fcol2); int col = (highwall(c2) || c->wall == waTower) ? wcol2 : fcol2; @@ -4669,20 +4523,12 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { V2 = V2 * ddspin(c2, j); j = 0; } - placeSidewall(c2, j, SIDE_LAKE, V2, w, false, darkena(gradient(0, col, 0, .8, 1), fd, 0xFF)); - placeSidewall(c2, j, SIDE_LTOB, V2, w, false, darkena(gradient(0, col, 0, .7, 1), fd, 0xFF)); - placeSidewall(c2, j, SIDE_BTOI, V2, w, false, darkena(gradient(0, col, 0, .6, 1), fd, 0xFF)); + placeSidewall(c2, j, SIDE_LAKE, V2, darkena(gradient(0, col, 0, .8, 1), fd, 0xFF)); + placeSidewall(c2, j, SIDE_LTOB, V2, darkena(gradient(0, col, 0, .7, 1), fd, 0xFF)); + placeSidewall(c2, j, SIDE_BTOI, V2, darkena(gradient(0, col, 0, .6, 1), fd, 0xFF)); } } - if(chasmg == 1 && wmspatial) { - int fd0 = fd ? fd-1 : 0; - - qfi.shape = &getSeabed(*qfi.shape); - // this draws the water surface - warpfloor(c, (*Vdp), darkena(fcol, fd0, 0x80), PPR_LAKELEV, isWarped(c)); - } - if(chasmg) { int q = size(ptds); int maxtime = euclid || sphere ? 20000 : 1500; @@ -4694,7 +4540,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(t <= maxtime) { erase = false; if(fa.walltype == waNone) - warpfloor(c, V, darkena(fcol, fd, 0xFF), PPR_FLOOR, isWarped(c)); + draw_qfi(c, V, darkena(fcol, fd, 0xFF), PPR_FLOOR); else { int wcol2, fcol2; eWall w = c->wall; int p = c->wparam; @@ -4702,11 +4548,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { setcolors(c, wcol2, fcol2); int starcol = c->wall == waVinePlant ? 0x60C000 : wcol2; c->wall = w; c->wparam = p; - bool warp = isWarped(c); - warpfloor(c, mscale(V, geom3::WALL), darkena(starcol, fd, 0xFF), PPR_WALL3, warp); + draw_qfi(c, mscale(V, geom3::WALL), darkena(starcol, fd, 0xFF), PPR_WALL3); queuepolyat(mscale(V, geom3::WALL), shWall[ct6], darkena(wcol2, 0, 0xFF), PPR_WALL3A); forCellIdEx(c2, i, c) - placeSidewallX(c, i, SIDE_WALL, V, warp, false, darkena(wcol2, 1, 0xFF)); + if(placeSidewall(c, i, SIDE_WALL, V, darkena(wcol2, 1, 0xFF))) break; } pushdown(c, q, V, t*t / 1000000. + t / 1000., true, true); } diff --git a/hyper.h b/hyper.h index 11b284a1..617cea62 100644 --- a/hyper.h +++ b/hyper.h @@ -2131,7 +2131,6 @@ void buildEquidistant(cell *c); void produceGhost(cell *c, eMonster victim, eMonster who); void sideAttack(cell *mf, int dir, eMonster who, int bonus, eItem orb); void sideAttack(cell *mf, int dir, eMonster who, int bonuskill); -void warpfloor(cell *c, const transmatrix& V, int col, int prio, bool warp); void orboflava(int i); @@ -3232,9 +3231,12 @@ polytodraw& lastptd(); void queuepolyat(const transmatrix& V, const hpcshape& h, int col, int prio); void queuetable(const transmatrix& V, const vector& f, int cnt, int linecol, int fillcol, int prio); +struct floorshape; + struct qfloorinfo { transmatrix spin; const hpcshape *shape; + const floorshape *fshape; textureinfo *tinf; }; @@ -3247,8 +3249,7 @@ struct hpcshape { int flags; }; -extern hpcshape - shFullFloor[2], shFullCross[2]; +extern hpcshape shFullCross[2]; int fix6(int a); int fix7(int a); @@ -3359,3 +3360,12 @@ namespace gp { } extern bool debug_geometry; + +void queuepoly(const transmatrix& V, const hpcshape& h, int col); +void queuepolyat(const transmatrix& V, const hpcshape& h, int col, int prio); + +void queuestr(const hyperpoint& h, int size, const string& chr, int col, int frame = 0); +void queuechr(const transmatrix& V, double size, char chr, int col, int frame = 0); + +extern bool just_gmatrix; +void drawrec(const heptspin& hs, hstate s, const transmatrix& V); diff --git a/hypgraph.cpp b/hypgraph.cpp index af6951fc..ae0f9e98 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -539,6 +539,7 @@ void drawrec(cell *c, const transmatrix& V) { void drawrec(cell *c, const transmatrix& V) { draw_li.relative = loc(0,0); draw_li.total_dir = 0; + draw_li.last_dir = -1; if(dodrawcell(c)) drawcell(c, V, 0, false); for(int i=0; itype; i++) { diff --git a/landlock.cpp b/landlock.cpp index 8c946846..ac62d57b 100644 --- a/landlock.cpp +++ b/landlock.cpp @@ -1261,7 +1261,7 @@ land_validity_t& land_validity(eLand l) { } // Warped Coast does not work on non-bitrunc S3s (except standard heptagonal where we have to keep it) - if(l == laWarpCoast && (S3==3) && !has_nice_dual()) { + if(l == laWarpCoast && (S3==3) && geosupport_graveyard() != 2) { return ugly_version; } diff --git a/mapeditor.cpp b/mapeditor.cpp index 9ca7f9e1..ea74bf04 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -1120,7 +1120,7 @@ namespace mapeditor { drawItemType(eItem(id), drawcell, Id, iinf[id].color, 0, false); } else { - warpfloor(drawcell, Id, 0, PPR_FLOOR, isWarped(drawcell)); + draw_qfi(drawcell, Id, 0, PPR_FLOOR); } sortquickqueue(); diff --git a/pattern2.cpp b/pattern2.cpp index 77010804..81aae26c 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -704,8 +704,6 @@ namespace patterns { if(u == 8 && qhex == 2) u = 12; else if(u == 2 && qhex == 1) u = 8; else if(u == 6 && qhex == 2) u = 10; - if(gp::on && pseudohept(c) && !ishept(c)) - u = 13; si.id = u; if(u == 6) { diff --git a/polygons.cpp b/polygons.cpp index a6afcd94..69a0fb9a 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -64,7 +64,7 @@ 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 ? .04 : .0001) : 0.25)) { + if(/*vid.usingGL && */!first && intval(hpc.back(), h) > (sphere ? (ISMOBWEB || gp::on ? .04 : .0001) : 0.1)) { hyperpoint md = mid(hpc.back(), h); hpcpush(md); hpcpush(h); @@ -1063,38 +1063,21 @@ void drawqueue() { } } -struct plainshape { - bool active; - hpcshape shFloor, shFullFloor, shFloorSide[SIDEPARS][8], shFullFloorSide[SIDEPARS][8]; - }; - hpcshape - shFloorSide[SIDEPARS][2], shSemiFloorSide[SIDEPARS], shTriheptaSide[SIDEPARS][2], - shTriheptaSideGP[SIDEPARS][2], - shMFloorSide[SIDEPARS][2], shFullFloorSide[SIDEPARS][2], - shFullFloor[2], shFullCross[2], - shSeabed[2], shCloudSeabed[3], shCaveSeabed[4], + shSemiFloorSide[SIDEPARS], + shBFloor[2], + shFullCross[2], shWave[8][2], - shFloor[2], shBFloor[2], shMFloor2[2], shMFloor3[2], shMFloor4[2], shCircleFloor, - shFloorShadow[2], shTriheptaFloorShadow[3], shTriheptaEucShadow[3], shWall[2], shMineMark[2], shFan, - shStarFloor[3], shCloudFloor[3], shTriFloor[3], shZebra[5], - shSwitchFloor[3], shSwitchDisk, - shButterflyFloor[3], shLavaFloor[3], + shZebra[5], + shSwitchDisk, shTower[11], - shTurtleFloor[4], shDragonFloor[3], shRoseFloor[4], - shChargedFloor[4], shSStarFloor[3], shOverFloor[3], shEmeraldFloor[6], - shFeatherFloor[3], shDemonFloor[3], shCrossFloor[3], shMFloor[2], shCaveFloor[4], - shSemiFeatherFloor[2], shPowerFloor[3], + shSemiFeatherFloor[2], shSemiFloor[2], shSemiBFloor[2], shSemiFloorShadow, - shDesertFloor[3], shRedRockFloor[3][3], - shPalaceFloor[3], shNewFloor[3], shTrollFloor[2], shMercuryBridge[2], - shLeafFloor[2], - shBarrowFloor[3], - shTriheptaFloor[14], shTriheptaFloor2[2], shTriheptaEuc[3], + shTriheptaSpecial[14], shCross, shGiantStar[2], shLake, shMirror, shHalfFloor[3], shHalfMirror[3], shGem[2], shStar, shDisk, shDiskT, shDiskS, shDiskM, shDiskSq, shRing, @@ -1130,8 +1113,6 @@ hpcshape shHedgehogBlade, shHedgehogBladePlayer, shWolfBody, shWolfHead, shWolfLegs, shWolfEyes, shWolfFrontLeg, shWolfRearLeg, shWolfFrontPaw, shWolfRearPaw, - shBigHepta, shBigHex, shBigHexTriangle, shBigHexTriangleRev, - shBigTriangle, shBigTriSide[SIDEPARS][2], shBigTriShadow, shFemaleBody, shFemaleHair, shFemaleDress, shWitchDress, shWitchHair, shBeautyHair, shFlowerHair, shFlowerHand, shSuspenders, shBugBody, shBugArmor, shBugLeg, shBugAntenna, @@ -1174,7 +1155,7 @@ hpcshape shAsymmetric, shDodeca; - + ld tentacle_length; #define USERLAYERS 32 @@ -1314,41 +1295,6 @@ void bshape(hpcshape& sh, int p, double shzoom, int shapeid, double bonus = 0, f hpcpush(ipoint(0, 1)); } -void bshape_goldberg(hpcshape sh[3], int p, double shzoom, int shapeid, double bonus = 0) { - ld bonus2 = bonus; - if(S7 == 8 && gp::on) - bonus2 += M_PI / 8, bonus += M_PI / 6 + .4; - ld nzoom2 = shzoom; - - ld nzoom = shzoom * .8; - - if(S7 == 4 && gp::on) { - nzoom2 *= .5, bonus2 -= M_PI/4; - if(sh == shCrossFloor) - nzoom *= 2, bonus += 22.5/180 * M_PI, - bonus2 -= M_PI/3, bonus += M_PI/9; - if(sh == shTriFloor) - bonus2 += M_PI/6, bonus += M_PI/18, nzoom *= 1.2, bonus2 -= M_PI/4; - if(sh == shButterflyFloor) - bonus2 += M_PI/9, bonus += M_PI/6, nzoom *= 1.5; - if(sh == shCaveSeabed) - bonus += M_PI/2; - if(sh == shPowerFloor) - bonus += M_PI/2, nzoom *= 1.5, bonus += M_PI/18; - if(sh == shDesertFloor) - bonus += M_PI/6, nzoom *= 1.2, bonus2 += M_PI/4; - if(sh == shPalaceFloor) - bonus += M_PI/6, nzoom *= 1.2; - if(sh == shTurtleFloor) - bonus += M_PI/6, nzoom *= 1.5, bonus += M_PI/18; - if(sh == shDemonFloor) - bonus += M_PI/8, nzoom *= 1.5; - } - - bshape(sh[1], p, nzoom2, shapeid, bonus2); - bshape(sh[2], p, nzoom, shapeid, bonus + M_PI/S7 - (a38? .25 : .15), 1); - } - void copyshape(hpcshape& sh, hpcshape& orig, int p) { if(last) last->e = size(hpc); sh = orig; sh.prio = p; @@ -1407,6 +1353,10 @@ template ld grot(bool geometry, ld factor, T... t) { ld dlow_table[SIDEPARS], dhi_table[SIDEPARS]; +#define SHADMUL (S3==4 ? 1.05 : 1.3) + +#include "floorshapes.cpp" + void buildpolys() { symmetriesAt.clear(); @@ -1428,10 +1378,6 @@ void buildpolys() { if(euclid) scalef *= .52/crossf; - double scalef2 = nonbitrunc ? crossf / hcrossf7 * .88 : euclid ? scalef : hcrossf / hcrossf7; - - double spzoom = sphere ? 1.4375 : 1; - double spzoom6 = sphere ? 1.2375 : 1; double spzoom7 = sphere ? .8 : 1; @@ -1448,23 +1394,15 @@ void buildpolys() { if(geometry == gTinySphere) fac80 *= 1.2, fac94 *= .94; - auto MF = [] (double f, int i) { return (f*i)/8; }; - - bool gsq = S7 == 4 && gp::on; - ld nzoom = gsca(gsq, .5); - ld anzoom = gsca(gsq, 1.5); - -#define SHADMUL (S3==4 ? 1.05 : 1.3) - // procedural floors - double shexf = nonbitrunc ? crossf* .55 : hexf; + double zhexf = nonbitrunc ? crossf* .55 : hexf; double p = -.006; int td = ((nonbitrunc || euclid) && !(S7&1)) ? S42+S6 : 0; double trihepta0 = scalef*spzoom6*(.2776+p) * gsca(a4, 1.3, a46, .975, a47, .85, a38, .9) * bscale6; - double trihepta1 = (sphere ? .54 * gp::scale : scalef*spzoom6*(.5273-2*p)) * gsca(a4, .8, a46, 1.075, sphere4, 1.3) * bscale7; + double trihepta1 = (sphere ? .54 : scalef*spzoom6*(.5273-2*p)) * gsca(a4, .8, a46, 1.075, sphere4, 1.3) * bscale7; double eps = hexhexdist * .05; if(euclid) trihepta0 = hexhexdist * .5 - eps * sqrt(3)/2, trihepta1 = hexhexdist * sqrt(3)/2 - eps; // .5-.1; .75-.05 @@ -1472,50 +1410,14 @@ void buildpolys() { if(euclid4) trihepta0 = trihepta1 = crossf * 1.35 / 2; - if(sphere&&S7==3&&!gp::on) trihepta0 *= 1.3, trihepta1 *= 1.6; + if(sphere&&S7==3) trihepta0 *= 1.3, trihepta1 *= 1.6; - if(sphere&&gp::on) trihepta1 *= 1.4; - - int tshift0 = (a4?S14:0); - int tshift1 = (td + (!(S7&1))) ? S6:0; // +S6+(a4&(S7&1)?S6:0); - - bshape(shTriheptaFloor[0], PPR_FLOOR); - for(int t=0; t<=S3; t++) hpcpush(ddi(t*S28 + tshift0, trihepta0) * C0); - last->flags |= POLY_HASWALLS | POLY_HASSHADOW; - - bshape(shTriheptaFloor[1], PPR_FLOOR); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S12 + tshift1, trihepta1) * C0); - last->flags |= POLY_HASWALLS | POLY_HASSHADOW; - - bshape(shTriheptaFloorShadow[0], PPR_FLOOR); - for(int t=0; t<=S3; t++) hpcpush(ddi(t*S28 + tshift0, trihepta0*SHADMUL) * C0); - - bshape(shTriheptaFloorShadow[1], PPR_FLOOR); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S12 + tshift1, trihepta1*SHADMUL) * C0); - - bshape(shTriheptaFloor[13], PPR_FLOOR); - for(int t=0; t<=S6; t++) hpcpush(ddi(t*S14 + S7, trihepta0*1.6) * C0); - last->flags |= POLY_HASWALLS | POLY_HASSHADOW; - - bshape(shTriheptaFloorShadow[2], PPR_FLOOR); - for(int t=0; t<=S6; t++) hpcpush(ddi(t*S14 + S7, trihepta0*SHADMUL*1.6) * C0); - - {double x = hexvdist; - bshape(shFullFloor[0], PPR_FLOOR); - x *= bscale6; - x *= gp::scale; - if(gp::scale != 1) x *= 1.6; - // if(gp::gp::coords == gp::euc_coord(2,0)) x /= 1.2; - // if(gp::gp::coords == gp::euc_coord(3,0)) x /= 2; - for(int t=0; t<=S6; t++) hpcpush(ddi(S7 + t*S14, x) * C0); - - x = rhexf; - x *= bscale7; - // x *= gp::scale; - // if(gp::scale != 1) x *= 1.6; - bshape(shFullFloor[1], PPR_FLOOR); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S12+td, x) * C0); - } + if(nonbitrunc) { + ld hedge = hdist(spin(M_PI/S7) * xpush(rhexf) * C0, spin(-M_PI/S7) * xpush(rhexf) * C0); + + trihepta1 = hdist0(xpush(tessf) * spin(2*M_PI*2/S7) * xpush(tessf) * C0) / 2 * .98; + trihepta0 = hdist0(xpush(-tessf) * spin(M_PI/S7) * xpush(rhexf+hedge/2) * C0) * .98; + } {double x = hexvdist; bshape(shFullCross[0], PPR_FLOOR); @@ -1534,17 +1436,16 @@ void buildpolys() { last->flags |= POLY_HASWALLS | POLY_FULL | POLY_HASSHADOW; } - bool strict = false; + double floorrad0 = hexvdist*0.92; + double floorrad1 = rhexf / gp::scale *0.94; - if(a4 && nonbitrunc) fac94 *= 1.1; + ld goldbf = 1; + if(gp::on) goldbf = gp::scale * 1.6; + if(gp::on) floorrad1 /= 1.6; - if(a46 && nonbitrunc) fac94 *= .9; - - double floorrad0 = shexf*fac80*spzoom; - - double floorrad1 = strict ? hcrossf : euclid ? shexf*fac80*spzoom : shexf*fac94; - - double triangleside = hcrossf*.94 * (gp::on ? 1.5 * gp::scale : 1); + double triangleside = hcrossf*.94; + if(nonbitrunc) + triangleside = tessf * .94; if(euclid4) { if(nonbitrunc) @@ -1553,30 +1454,8 @@ void buildpolys() { floorrad0 = hexvdist * .9, floorrad1 = rhexf * .8; } - - bshape(shFloor[0], PPR_FLOOR); - for(int t=0; t<=S6; t++) hpcpush(ddi(S7 + t*S14, floorrad0) * C0); - last->flags |= POLY_HASWALLS | POLY_PLAIN | POLY_HASSHADOW; - bshape(shCircleFloor, PPR_FLOOR); - for(int t=0; t<=S84; t+=2) hpcpush(ddi(t, shexf*.7*spzoom) * C0); - - bshape(shFloor[1], PPR_FLOOR); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S12 + td, floorrad1) * C0); - last->flags |= POLY_HASWALLS | POLY_PLAIN | POLY_HASSHADOW; - - for(int i=0; i<3; i++) for(int j=0; j<3; j++) shadowmulmatrix[i][j] = - i==2&&j==2 ? 1: - i==j ? SHADMUL: - 0; - - bshape(shFloorShadow[0], PPR_FLOOR); - for(int t=0; t<=S6; t++) hpcpush(ddi(S7 + t*S14, floorrad0*SHADMUL) * C0); - - bshape(shFloorShadow[1], PPR_FLOOR); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S12 + td, floorrad1*SHADMUL) * C0); - - // sidewalls for the 3D mode + // sidewall parameters for the 3D mode for(int k=0; k 0 && dhi > 0) || (dlow < 0 && dhi < 0); - bshape(shFloorSide[k][0], PPR_LAKEWALL); - for(int t=0; t<=1; t++) hpcpush(ddi(t*S14-S7, floorrad0) * C0); - chasmifyPoly(dlow, dhi, k); - - bshape(shFloorSide[k][1], PPR_LAKEWALL); - for(int t=0; t<=1; t++) hpcpush(ddi(t*S12-S6, floorrad1) * C0); - chasmifyPoly(dlow, dhi, k); - - bshape(shFullFloorSide[k][0], PPR_LAKEWALL); - for(int t=0; t<=1; t++) hpcpush(ddi(t*S14-S7, hexvdist) * C0); - chasmifyPoly(dlow, dhi, k); - - bshape(shFullFloorSide[k][1], PPR_LAKEWALL); - for(int t=0; t<=1; t++) hpcpush(ddi(t*S12-S6, rhexf) * C0); - chasmifyPoly(dlow, dhi, k); - bshape(shSemiFloorSide[k], PPR_LAKEWALL); for(int t=0; t<=3; t+=3) hpcpush(ddi(S7 + (3+t)*S14, floorrad0) * C0); chasmifyPoly(dlow, dhi, k); - - bshape(shTriheptaSide[k][0], PPR_LAKEWALL); - for(int t=0; t<=1; t++) hpcpush(ddi(t*S28-S14, trihepta0) * C0); - chasmifyPoly(dlow, dhi, k); - - bshape(shTriheptaSide[k][1], PPR_LAKEWALL); - for(int t=0; t<=1; t++) hpcpush(ddi(t*S12-S6, trihepta1) * C0); - chasmifyPoly(dlow, dhi, k); - - bshape(shTriheptaSideGP[k][0], PPR_LAKEWALL); - for(int t=0; t<=1; t++) hpcpush(ddi(t*S14-S7, trihepta0*1.6) * C0); - chasmifyPoly(dlow, dhi, k); - - bshape(shTriheptaSideGP[k][1], PPR_LAKEWALL); - for(int t=0; t<=1; t++) hpcpush(ddi(t*S14-S7, trihepta0*1.6) * C0); - chasmifyPoly(dlow, dhi, k); - - bshape(shMFloorSide[k][0], PPR_LAKEWALL); - for(int t=0; t<=1; t++) hpcpush(ddi(t*S14-S7, MF(floorrad0,7)) * C0); - chasmifyPoly(dlow, dhi, k); - - bshape(shMFloorSide[k][1], PPR_LAKEWALL); - for(int t=0; t<=1; t++) hpcpush(ddi(t*S12-S6, MF(floorrad1,7)) * C0); - chasmifyPoly(dlow, dhi, k); - - bshape(shBigTriSide[k][0], PPR_LAKEWALL); - for(int t=0; t<=1; t++) hpcpush(ddi(t*S28-S14, triangleside) * C0); - chasmifyPoly(dlow, dhi, k); } - + + bshape(shCircleFloor, PPR_FLOOR); + for(int t=0; t<=S84; t+=2) hpcpush(ddi(t, floorrad1*gp::scale*.9) * C0); + + for(int i=0; i<3; i++) for(int j=0; j<3; j++) shadowmulmatrix[i][j] = + i==2&&j==2 ? 1: + i==j ? SHADMUL: + 0; + for(int d=0; d<2; d++) { bshape(shSemiFloor[d], PPR_FLOOR); - for(int t=0; t<=4; t++) hpcpush(ddi(S7 + (3+3*d+t%4)*S14, shexf*fac80*spzoom) * C0); + for(int t=0; t<=4; t++) hpcpush(ddi(S7 + (3+3*d+t%4)*S14, floorrad0) * C0); } - ld xmf = gsca(gsq, .75); + // todo not shexf - bshape(shMFloor[0], PPR_FLOORa); - for(int t=0; t<=S6; t++) hpcpush(ddi(S7 + t*S14, shexf*MF(fac80,7)*spzoom*xmf) * C0); - - bshape(shMFloor[1], PPR_FLOORa); - for(int t=0; t<=S7; t++) hpcpush(ddi(td + t*S12, shexf*MF(fac94,7)*xmf) * C0); - - bshape(shMFloor2[0], PPR_FLOORb); - for(int t=0; t<=S6; t++) hpcpush(ddi(S7 + t*S14, shexf*MF(fac80,6)*spzoom*xmf) * C0); - - bshape(shMFloor2[1], PPR_FLOORb); - for(int t=0; t<=S7; t++) hpcpush(ddi(td + t*S12, shexf*MF(fac94,6)*xmf) * C0); - - bshape(shMFloor3[0], PPR_FLOORc); - for(int t=0; t<=S6; t++) hpcpush(ddi(S7 + t*S14, shexf*MF(fac80,5)*spzoom*xmf) * C0); - - bshape(shMFloor3[1], PPR_FLOORc); - for(int t=0; t<=S7; t++) hpcpush(ddi(td + t*S12, shexf*MF(fac94,5)*xmf) * C0); - - bshape(shMFloor4[0], PPR_FLOORd); - for(int t=0; t<=S6; t++) hpcpush(ddi(S7 + t*S14, shexf*MF(fac80,4)*spzoom*xmf) * C0); - - bshape(shMFloor4[1], PPR_FLOORd); - for(int t=0; t<=S7; t++) hpcpush(ddi(td + t*S12, shexf*MF(fac94,4)*xmf) * C0); - - bshape(shBigCarpet1, PPR_GFLOORa); -//for(int t=0; t<=7; t++) hpcpush(ddi(t*12, -shexf*3.5) * C0); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*12, -shexf*2.1) * C0); + bshape(shBigCarpet1, PPR_GFLOORa); + for(int t=0; t<=S7; t++) hpcpush(ddi(t*12, -zhexf*2.1) * C0); bshape(shBigCarpet2, PPR_GFLOORb); -//for(int t=0; t<=7; t++) hpcpush(ddi(t*12, -shexf*3.4) * C0); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*12, -shexf*1.9) * C0); + for(int t=0; t<=S7; t++) hpcpush(ddi(t*12, -zhexf*1.9) * C0); bshape(shBigCarpet3, PPR_GFLOORc); -//for(int t=0; t<=7; t++) hpcpush(ddi(t*12, -shexf*3.4) * C0); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*12*3, -shexf*1.7) * C0); + for(int t=0; t<=S7; t++) hpcpush(ddi(t*12*3, -zhexf*1.7) * C0); bshape(shBFloor[0], PPR_BFLOOR); - for(int t=0; t<=S6; t++) hpcpush(ddi(S7 + t*S14, shexf*.1) * C0); + for(int t=0; t<=S6; t++) hpcpush(ddi(S7 + t*S14, floorrad0*.1) * C0); bshape(shBFloor[1], PPR_BFLOOR); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S12, shexf*.1) * C0); + for(int t=0; t<=S7; t++) hpcpush(ddi(t*S12, floorrad1*.1) * C0); bshape(shMineMark[0], PPR_MINEMARK); - for(int t=0; t<=S6; t++) hpcpush(ddi(S7 + t*S14, shexf*.1) * C0); + for(int t=0; t<=S6; t++) hpcpush(ddi(S7 + t*S14, floorrad0*.1) * C0); bshape(shMineMark[1], PPR_MINEMARK); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S12, shexf*.1) * C0); + for(int t=0; t<=S7; t++) hpcpush(ddi(t*S12, floorrad1*.1) * C0); for(int d=0; d<2; d++) { bshape(shSemiBFloor[d], PPR_BFLOOR); - for(int t=0; t<=4; t++) hpcpush(ddi(S7 + (3+3*d+t%4)*S14, shexf*.1) * C0); + for(int t=0; t<=4; t++) hpcpush(ddi(S7 + (3+3*d+t%4)*S14, floorrad0*.1) * C0); } // walls etc bshape(shGiantStar[1], PPR_GFLOORa); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S36, -shexf*2.4) * C0); + for(int t=0; t<=S7; t++) hpcpush(ddi(t*S36, -zhexf*2.4) * C0); bshape(shGiantStar[0], PPR_GFLOORa); for(int t=0; t<=S6; t++) { - hpcpush(ddi(t*S14, -shexf*2.4) * C0); - hpcpush(ddi(t*S14+S7, shexf*1.5) * C0); + hpcpush(ddi(t*S14, -zhexf*2.4) * C0); + hpcpush(ddi(t*S14+S7, zhexf*1.5) * C0); } - hpcpush(ddi(0, -shexf*2.4) * C0); + hpcpush(ddi(0, -zhexf*2.4) * C0); bshape(shMirror, PPR_WALL); if(nonbitrunc) { - for(int t=0; t<=S7; t++) hpcpush(ddi(t*12, shexf*MF(fac80,7)) * C0); + for(int t=0; t<=S7; t++) hpcpush(ddi(t*12, floorrad1*7/8 * gp::scale) * C0); } else { - for(int t=0; t<=6; t++) hpcpush(ddi(S7 + t*S14, shexf*MF(fac94,7)) * C0); + for(int t=0; t<=6; t++) hpcpush(ddi(S7 + t*S14, floorrad0*7/8 * gp::scale) * C0); } bshape(shWall[0], PPR_WALL); for(int t=0; t<=S6; t++) { - hpcpush(ddi(S7 + t*S14, shexf*fac80) * C0); - if(t != S6) hpcpush(ddi(S14 + t*S14, shexf*.2) * C0); + hpcpush(ddi(S7 + t*S14, floorrad0 * goldbf) * C0); + if(t != S6) hpcpush(ddi(S14 + t*S14, floorrad0 * goldbf/4) * C0); } + printf("rad0 = %lf\n", floorrad0 * goldbf); + printf("rad1 = %lf\n", floorrad1 * goldbf); + bshape(shWall[1], PPR_WALL); if(S7 == 6 || S7 == 4) { for(int t=0; t<=S6; t++) { - hpcpush(ddi(S7 + t*S14, shexf*fac80) * C0); - if(t != S6) hpcpush(ddi(S14 + t*S14, shexf*.2) * C0); + hpcpush(ddi(S7 + t*S14, floorrad1 * goldbf) * C0); + if(t != S6) hpcpush(ddi(S14 + t*S14, floorrad1 * goldbf/4) * C0); } } else - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S36+td, shexf*fac94) * C0); + for(int t=0; t<=S7; t++) hpcpush(ddi(t*S36+td, floorrad1 * goldbf) * C0); bshape(shCross, PPR_WALL); for(int i=0; i<=84; i+=7) - hpcpush(spin(2*M_PI*i/84) * xpush(shexf * (i%3 ? 0.8 : 0.3)) * C0); + hpcpush(spin(2*M_PI*i/84) * xpush(zhexf * (i%3 ? 0.8 : 0.3)) * C0); // items bshape(shGem[0], PPR_ITEM); for(int t=0; t<=S6; t++) { - hpcpush(ddi(S7 + t*S14, shexf*.4) * C0); - if(t != S6) hpcpush(ddi(S14 + t*S14, shexf*.1) * C0); + hpcpush(ddi(S7 + t*S14, zhexf*.4) * C0); + if(t != S6) hpcpush(ddi(S14 + t*S14, zhexf*.1) * C0); } bshape(shGem[1], PPR_ITEM); if(S7 == 6) { for(int t=0; t<=S6; t++) { - hpcpush(ddi(S7 + t*S14, shexf*.4) * C0); - if(t != S6) hpcpush(ddi(S14 + t*S14, shexf*.1) * C0); + hpcpush(ddi(S7 + t*S14, zhexf*.4) * C0); + if(t != S6) hpcpush(ddi(S14 + t*S14, zhexf*.1) * C0); } } else - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S36, shexf*.5) * C0); + for(int t=0; t<=S7; t++) hpcpush(ddi(t*S36, zhexf*.5) * C0); bshape(shStar, PPR_ITEM); for(int t=0; t<=S84; t+=S6) { - hpcpush(ddi(t, shexf*.2) * C0); - if(t != S84) hpcpush(ddi(t+3, shexf*.6) * C0); + hpcpush(ddi(t, zhexf*.2) * C0); + if(t != S84) hpcpush(ddi(t+3, zhexf*.6) * C0); } bshape(shDaisy, PPR_ITEM); for(int t=0; t<=S6; t++) { - hpcpush(ddi(t*S14, shexf*.8*3/4) * C0); - if(t != S6) hpcpush(ddi(t*S14+S7, shexf*-.5*3/4) * C0); + hpcpush(ddi(t*S14, zhexf*.8*3/4) * C0); + if(t != S6) hpcpush(ddi(t*S14+S7, zhexf*-.5*3/4) * C0); } - hpcpush(ddi(0, shexf*.6) * C0); + hpcpush(ddi(0, zhexf*.6) * C0); bshape(shTriangle, PPR_ITEM); for(int t=0; t<=S3; t++) { - hpcpush(ddi(t*S28, shexf*.5) * C0); + hpcpush(ddi(t*S28, zhexf*.5) * C0); } double disksize = crossf; @@ -1926,19 +1745,19 @@ void buildpolys() { bshape(shILeaf[0], PPR_ONTENTACLE); for(int t=0; t<=S6; t++) { - hpcpush(ddi(S7 + t*S14, shexf*.7) * C0); + hpcpush(ddi(S7 + t*S14, zhexf*.7) * C0); if(t != S6) - hpcpush(ddi(S14 + t*S14, shexf*.15) * C0); + hpcpush(ddi(S14 + t*S14, zhexf*.15) * C0); } bshape(shILeaf[1], PPR_ONTENTACLE); if(S3 == 3) - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S36, shexf*.8) * C0); + for(int t=0; t<=S7; t++) hpcpush(ddi(t*S36, zhexf*.8) * C0); else { for(int t=0; t<=S7; t++) { - hpcpush(ddi(t*S12, shexf*.8) * C0); + hpcpush(ddi(t*S12, zhexf*.8) * C0); if(t != S6) - hpcpush(ddi(t*S12 + S6, shexf*.2) * C0); + hpcpush(ddi(t*S12 + S6, zhexf*.2) * C0); } } @@ -1951,30 +1770,10 @@ void buildpolys() { hpcpush(ddi(i, crossf * (0.4 + .03 * sin(i * M_PI * 2 / S84 * 7))) * C0); bshape(shHeptaMarker, PPR_HEPTAMARK); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S12, shexf*.2) * C0); + for(int t=0; t<=S7; t++) hpcpush(ddi(t*S12, zhexf*.2) * C0); bshape(shSnowball, PPR_ITEM); - for(int t=0; t<=S7*4; t++) hpcpush(ddi(t*S3, shexf*.1) * C0); - - bshape(shBigHepta, PPR_FLOOR); - for(int t=0; t<=S7; t++) hpcpush(ddi(t*S12, -shexf*1.5) * C0); - - bshape(shBigHex, PPR_FLOOR); - for(int t=0; t<=S6; t++) hpcpush(ddi(t*S14, -shexf*1.3) * C0); - - bshape(shBigTriangle, PPR_FLOOR); - for(int t=0; t<=S3; t++) hpcpush(ddi(t*S28, -triangleside) * C0); - last->flags |= POLY_HASWALLS | POLY_HASSHADOW; - - bshape(shBigTriShadow, PPR_FLOOR); - for(int t=0; t<=S3; t++) hpcpush(ddi(t*S28 + S14 + (S3==4?S14:0), triangleside*SHADMUL) * C0); - - -/*bshape(shBigHexTriangleRev, PPR_FLOOR); - for(int t=0; t<=S3; t++) hpcpush(ddi(t*S28, -shexf*1.3) * C0); - - bshape(shBigHexTriangle, PPR_FLOOR); - for(int t=0; t<=S3; t++) hpcpush(ddi(S14+t*S28, -shexf*1.3) * C0); */ + 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++) @@ -1984,10 +1783,6 @@ void buildpolys() { for(int t=0; t<=60; t++) hpcpush(spin(M_PI * t / 30.0) * xpush(crossf * ((t&1) ? 0.3 : 0.6)) * C0); - ld goldbf = 1; - - if(gp::on) goldbf = gp::scale * 1.6; - for(int i=0; i<16; i++) { bshape(shParticle[i], PPR_PARTICLE); for(int t=0; t<6; t++) @@ -2003,122 +1798,40 @@ void buildpolys() { if(a46 && !nonbitrunc) spzoom6 *= .9; if(a47 && !nonbitrunc) spzoom6 *= .85; - ld goldbf2 = gp::scale; + shFullFloor.configure(hexvdist, rhexf); + shFloor.configure(floorrad0, floorrad1); + shMFloor.configure(floorrad0*7/8, floorrad1*7/8); + shMFloor2.configure(floorrad0*6/8, floorrad1*6/8); + shMFloor3.configure(floorrad0*5/8, floorrad1*5/8); + shMFloor4.configure(floorrad0*4/8, floorrad1*4/8); + shBigTriangle.configure(triangleside, 0); + shBigHepta.configure(0, (nonbitrunc ? tessf : crossf) * .97); + shTriheptaFloor.configure(trihepta0, trihepta1); + shDragonFloor.prio = PPR_FLOOR_DRAGON; + shPowerFloor.prio = PPR_FLOOR_DRAGON; + for(int i=0; i<3; i++) shRedRockFloor[i].scale = .9 - .1 * i; + generate_floorshapes(); - double espzoom6 = spzoom6, espzoomd7 = spzoomd7; - - // if(euclid) espzoom6 *= 1.5, espzoomd7 *= 1.2; - - double octroll = a38 ? .2 : a46 ? -.2 : a47 ? .1 : 0; - if(euclid4) octroll += M_PI/4; - - double ffscale6 = gsca(a4,.675); - double ffspin6 = grot(a4,.125); - double ffspin7 = grot(a4,-.45); - - double ffscale2 = gsca(a4,.7); - double ffspin2 = grot(a4,M_PI/4); - - // floors: - bshape(shStarFloor[0], PPR_FLOOR, scalef2*spzoom6*ffscale2, 1, ffspin2); - bshape(shStarFloor[1], PPR_FLOOR, scalef2*spzoomd7*ffscale2*gsca(ap4,1.5)*nzoom, 2, octroll + grot(gsq, M_PI/4)); - bshape(shStarFloor[2], PPR_FLOOR, scalef2*spzoom6, 1); - - bshape(shCloudFloor[0], PPR_FLOOR, scalef2*spzoom6*gsca(sphere,.9)*ffscale2*gsca(gsq, 1.2), 3, ffspin2); - bshape(shCloudFloor[1], PPR_FLOOR, scalef2*spzoomd7*ffscale2*gsca(ap4,1.5)*nzoom, 4, octroll + grot(gsq, M_PI/4)); - bshape(shCloudFloor[2], PPR_FLOOR, euclid ? scalef2 : scalef2*spzoom6*.9*gsca(gsq, 1.2), 3); - - bshape(shCrossFloor[0], PPR_FLOOR, scalef*espzoom6*gsca(sphere,.9)*ffscale2, 5, ffspin2); - bshape_goldberg(shCrossFloor, PPR_FLOOR, scalef*espzoomd7*gsca(sphere,.9)*ffscale2 * gsca(a47,1.3), 6, octroll); - - double ntscale = gsca(nonbitrunc, gsca(a38, 1.4, a47, 2, a46, 1.525)) * gp::scale; - double ntrot = grot(a46&&nonbitrunc, .25, a38&&nonbitrunc, -.2); - - bshape(shChargedFloor[0], PPR_FLOOR, scalef*espzoom6*gsca(sphere,.9)*ffscale2, 7, ffspin2); - bshape(shChargedFloor[1], PPR_FLOOR, scalef*spzoomd7 * nzoom, 9); - bshape(shChargedFloor[2], PPR_FLOOR, scalef*espzoom6, 7); - bshape(shChargedFloor[3], 12, spzoomd7 * gsca(a4 && euclid, .4, a4,1.2,sphere&&nonbitrunc,.9)* ntscale, 10, ntrot + grot(euclid4 && nonbitrunc, M_PI/4 + .1)); // nonbitrunc variant - - bshape(shSStarFloor[0], PPR_FLOOR, scalef*spzoom6*gsca(sphere,.8)*ffscale2, 11, grot(a4,.775)); - bshape_goldberg(shSStarFloor, PPR_FLOOR, scalef*spzoomd7*gsca(a4,.85), 12, octroll); - bshape(shOverFloor[0], PPR_FLOOR, scalef*spzoom * gsca(a47,1.3, a45,1.3, a46,1.1), 13, grot(a47,-.75, a45,-.7, a46,.9)); - if(nonbitrunc) { - if(a4) bshape(shOverFloor[1], PPR_FLOOR, goldbf2, 368 + S7 - 5, 0); - else bshape(shOverFloor[1], PPR_FLOOR, goldbf2 * gsca(a38,1.3, sphere, .83), 14, octroll + grot(a38,.4)); - } - else bshape(shOverFloor[1], PPR_FLOOR, scalef*spzoom7, 15); - bshape(shOverFloor[2], PPR_FLOOR, euclid?scalef*1.2:spzoom7, 16); - bshape(shTriFloor[0], PPR_FLOOR, scalef*espzoom6*gsca(sphere,.9, a4,.9)*ffscale2, 17, ffspin2 + grot(a47,.1)); - bshape_goldberg(shTriFloor, PPR_FLOOR, scalef*espzoomd7*ffscale2*gsca(a4,1.2, a47,1.5), 18, octroll + grot(a4,.25, a47,-.1, sphere4,.7) + grot(euclid&&a4, M_PI/8)); - bshape(shFeatherFloor[0], PPR_FLOOR, scalef*spzoom6*ffscale2, 19, ffspin2); - if(nonbitrunc && !gp::on) bshape(shFeatherFloor[1], PPR_FLOOR, sphere ? .83 : gsca(ap4,1.1) * ntscale, 20, ntrot); - else bshape(shFeatherFloor[1], PPR_FLOOR, scalef*spzoom7*gsca(sphere,1.1,a4,1.1)*ffscale2*ntscale*anzoom, 21, sphere?1.3:ntrot); - bshape(shFeatherFloor[2], PPR_FLOOR, scalef*1.1, 22); // Euclidean variant - bshape(shBarrowFloor[0], PPR_FLOOR, goldbf * gsca(euclid,.9) * spzoom6 * gsca(a467,1.7, a46,.8, a38,1.4) * gsca(euclid&&a4, .7) * anzoom, 23); - bshape(shBarrowFloor[1], PPR_FLOOR, goldbf * spzoomd7 * gsca(a4,1.15, a467,1.9, a46,.8, a38,1.5, sphere&&nonbitrunc,.9) * gsca(euclid&&a4, .5), 24, octroll - grot(a47,.1)); - bshape(shBarrowFloor[2], PPR_FLOOR, ntscale*gsca(sphere||euclid,.9) * gsca(euclid&&a4&&nonbitrunc, .5) * anzoom, 25, ntrot + grot(euclid&&a4&&nonbitrunc, M_PI/4)); - bshape(shNewFloor[0], PPR_FLOOR, scalef*espzoom6 * ffscale2, 26, ffspin2); - bshape_goldberg(shNewFloor, PPR_FLOOR, scalef*espzoomd7 * ffscale2, 27, octroll); - - bshape(shTrollFloor[0], PPR_FLOOR, spzoom6*gsca(a38,1.4, a467,1.6, a46,.8), 28); - bshape(shTrollFloor[1], PPR_FLOOR, spzoomd7*gsca(a38, 1.6, a467,2.4, a46,.8), 29, octroll); - - bshape(shButterflyFloor[0], PPR_FLOOR, scalef*espzoom6*gsca(sphere,.9)*ffscale2, 325, ffspin2); - bshape_goldberg(shButterflyFloor, PPR_FLOOR, scalef*espzoomd7*ffscale2, 326, sphere?.7:0); - - bshape(shLavaFloor[0], PPR_FLOOR, scalef*espzoom6 * ffscale2, 359, ffspin2); - bshape_goldberg(shLavaFloor, PPR_FLOOR, scalef*espzoomd7 * ffscale2 * gsca(a467,1.4), 360, octroll); - bshape(shHalfFloor[0], PPR_FLOOR, scalef*spzoom6, 329); bshape(shHalfFloor[1], PPR_FLOOR, scalef*spzoom6, 327); bshape(shHalfFloor[2], PPR_FLOOR, scalef*spzoom6, 331); bshape(shHalfMirror[0], PPR_WALL, scalef*spzoom6, 330); bshape(shHalfMirror[1], PPR_WALL, scalef*spzoom6, 328); bshape(shHalfMirror[2], PPR_WALL, scalef*spzoom6, 332); - - bshape(shSeabed[0], PPR_FLOOR, scalef*spzoom6, 334); - bshape(shSeabed[1], PPR_FLOOR, scalef*spzoom6, 335); - bshape(shCloudSeabed[0], PPR_FLOOR, scalef*spzoom6 * gsca(a46,.8, a47,.75, a38,1.05, a45,.75), 336, grot(a45,-.8125, a38,1)); - bshape(shCloudSeabed[1], PPR_FLOOR, scalef*spzoom6 * gsca(a46,.5, a47,.6, a38,1.25, a45,.35), 337, grot(a46,-.2, a38,.2)); - bshape(shCloudSeabed[2], PPR_FLOOR, scalef*espzoom6, 337); - bshape(shCaveSeabed[0], PPR_FLOOR, scalef*spzoom6 * gsca(a45,.65, a46,.7, a47,.675), 338); - bshape_goldberg(shCaveSeabed, PPR_FLOOR, scalef*spzoom6 * gsca(a45,.5, a46,.6, a47,.725), 339, grot(a46,-.3)); - bshape(shCaveSeabed[3], PPR_FLOOR, scalef*spzoom6 * gsca(euclid,1.2), 54); - - if(false) for(int i=0; i<8; i++) { - hpcshape& sh = shWave[i][1]; - bshape(sh, PPR_FLOOR, scalef*spzoom6, 340); - for(int t=sh.s; t= 2 ? PPR_LIZEYE : PPR_FLOOR_DRAGON, scalef * gsca(euclid, 1.16), 277+i*4+j); + bshape(shReptile[i][j], j >= 2 ? PPR_LIZEYE : j == 1 ? PPR_FLOORa : PPR_FLOOR_DRAGON, scalef * gsca(euclid, 1.16), 277+i*4+j); shift(shReptile[1][2], 0.316534, -0.136547, 1.057752); shift(shReptile[1][3], 0.340722, -0.059946, 1.058152); @@ -2526,6 +2214,8 @@ void initShape(int sg, int id) { } void queuepolyat(const transmatrix& V, const hpcshape& h, int col, int prio) { + if(prio == -1) prio = h.prio; + polytodraw& ptd = nextptd(); ptd.kind = pkPoly; ptd.u.poly.V = V; @@ -2588,55 +2278,6 @@ void queuepolyb(const transmatrix& V, const hpcshape& h, int col, int b) { queuepolyat(V,h,col,h.prio+b); } -qfloorinfo qfi; -qfloorinfo qfi_dc; - -int chasmg; - -const hpcshape& getSeabed(const hpcshape& c) { - if(&c == &shCloudFloor[2]) return shCloudSeabed[2]; - if(&c == &shCaveFloor[2]) return shCaveSeabed[2]; - if(&c == &shCaveFloor[3]) return shCaveSeabed[3]; - if(&c == &shFloor[0]) return shFullFloor[0]; - if(&c == &shFloor[1]) return shFullFloor[1]; - if(c.flags & POLY_GP) if(c.flags & POLY_PLAIN) - return gp::get_plainshape().shFullFloor; - if(nonbitrunc || euclid || sphere) return c; - if(&c == &shCaveFloor[0]) return shCaveSeabed[0]; - if(&c == &shCaveFloor[1]) return shCaveSeabed[1]; - if(&c == &shCloudFloor[0]) return shCloudSeabed[0]; - if(&c == &shCloudFloor[1]) return shCloudSeabed[1]; - return c; - } - -void qfloor0(cell *c, const transmatrix& V, const hpcshape& h, int col) { - extern bool wmspatial; - if(chasmg == 2) ; - else if(chasmg && wmspatial) { - if(detaillevel == 0) return; - queuepolyat(V, getSeabed(h), c->land == laCocytus ? 0x080808FF : 0x101010FF, PPR_LAKEBOTTOM); - } - else - queuepoly(V,h,col); - } - -void qfloor(cell *c, const transmatrix& V, const hpcshape& h, int col) { - qfloor0(c, V, h, col); - qfi.shape = &h, qfi.spin = Id; - qfi.tinf = NULL; - } - -void qfloor_virtual(cell *c, const transmatrix& V, const hpcshape& h) { - qfi.shape = &h, qfi.spin = Id; - qfi.tinf = NULL; - } - -void qfloor(cell *c, const transmatrix& V, const transmatrix& Vspin, const hpcshape& h, int col) { - qfloor0(c, V*Vspin, h, col); - qfi.shape = &h, qfi.spin = Vspin; - qfi.tinf = NULL; - } - void curvepoint(const hyperpoint& H1) { curvedata.push_back(glhr::pointtogl(H1)); } @@ -2912,13 +2553,13 @@ void queuechr(const hyperpoint& h, int size, char chr, int col, int frame) { queuechr(xc, yc, sc, size, chr, col, frame); } -void queuechr(const transmatrix& V, double size, char chr, int col, int frame = 0) { +void queuechr(const transmatrix& V, double size, char chr, int col, int frame) { int xc, yc, sc; getcoord0(tC0(V), xc, yc, sc); int xs, ys, ss; getcoord0(V * xpush0(.5), xs, ys, ss); queuechr(xc, yc, sc, int(sqrt(squar(xc-xs)+squar(yc-ys)) * scalef * size), chr, col, frame); } -void queuestr(const hyperpoint& h, int size, const string& chr, int col, int frame = 0) { +void queuestr(const hyperpoint& h, int size, const string& chr, int col, int frame) { int xc, yc, sc; getcoord0(h, xc, yc, sc); queuestr(xc, yc, sc, size, chr, col, frame); } @@ -2998,29 +2639,29 @@ NEWSHAPE, 27,7,1, -0.343473,0.068811, -0.371524,0.213003, -0.243649,0.253621, NEWSHAPE, 28,3,1, -0.262252,-0.145851, -0.264695,-0.107665, -0.284349,-0.038417, -0.297250,0.003588, -0.274408,0.048950, -0.266188,0.105083, -0.261804,0.148400, -0.241599,0.174935, -0.209702,0.203376, -0.168334,0.233368, -0.124537,0.231186, -0.074296,0.239577, -0.051790,0.275001, -0.021701,0.311779, // shTrollFloor[1] (7x2) NEWSHAPE, 29,7,2, -0.319274,-0.152751, -0.312576,-0.088525, -0.288942,-0.033872, -// shTriheptaFloor[0] (3x1) +// shTriheptaSpecial[0] (3x1) NEWSHAPE, 30,3,1, -0.139445,0.241954, -// shTriheptaFloor[1] (7x1) +// shTriheptaSpecial[1] (7x1) NEWSHAPE, 31,7,1, 0.555765,-0.002168, -// shTriheptaFloor[2] (1x2) +// shTriheptaSpecial[2] (1x2) NEWSHAPE, 32,1,2, 0.276938,-0.000093, -0.141904,0.242007, -0.293711,0.146334, -// shTriheptaFloor[3] (1x2) +// shTriheptaSpecial[3] (1x2) NEWSHAPE, 33,1,2, -0.351825,0.160017, -0.123908,0.541824, 0.350858,0.435495, 0.559842,-0.000857, -// shTriheptaFloor[4] (1x1) +// shTriheptaSpecial[4] (1x1) NEWSHAPE, 34,1,1, 0.267620,0.003973, -0.007632,0.337777, -0.271967,0.165630, -0.292806,-0.156142, -0.141920,-0.243873, -// shTriheptaFloor[5] (1x2) +// shTriheptaSpecial[5] (1x2) NEWSHAPE, 35,1,2, 0.376029,0.016747, 0.233909,-0.274206, -0.115849,-0.540138, -0.486044,-0.233574, -// shTriheptaFloor[6] (1x2) +// shTriheptaSpecial[6] (1x2) NEWSHAPE, 36,1,2, 0.136841,-0.241418, -0.007877,-0.337310, -0.282188,-0.183806, -// shTriheptaFloor[7] (1x2) +// shTriheptaSpecial[7] (1x2) NEWSHAPE, 37,1,2, 0.562869,0.005892, 0.346218,0.424587, -0.098836,0.362115, -0.344149,0.171831, -// shTriheptaFloor[9] (1x2) +// shTriheptaSpecial[9] (1x2) NEWSHAPE, 38,1,2, 0.384569,0.008580, 0.234427,0.298447, -0.070055,0.365304, -0.492813,0.235557, -// shTriheptaFloor[10] (1x2) +// shTriheptaSpecial[10] (1x2) NEWSHAPE, 39,1,2, 0.286495,0.001984, -0.014828,0.337687, -0.282562,0.156802, -// shTriheptaFloor2[0] (3x1) +// shTriheptaSpecial2[0] (3x1) NEWSHAPE, 40,3,1, -0.134870,0.238185, -0.014606,0.184459, 0.080296,0.256902, 0.180115,0.200011, 0.166151,0.081439, 0.273667,0.005344, -// shTriheptaFloor2[1] (7x2) +// shTriheptaSpecial2[1] (7x2) NEWSHAPE, 41,7,2, -0.499701,-0.228679, -0.472331,-0.116951, -0.361356,-0.069085, // shTriheptaEuc[0] (3x1) NEWSHAPE, 42,3,1, -0.232333,-0.000167, @@ -3679,107 +3320,10 @@ NEWSHAPE, 382, 1, 2, 0.024784,0.028900, -0.009988,0.111744, -0.018320,0.147991, NEWSHAPE, 383, 1, 2, 0.164154,0.032677, 0.112722,0.126268, 0.093106,0.144972, 0.036998,0.184005, -0.028137,0.220088, -0.088953,0.208314, -0.221199,0.117397, -0.270025,0.057450, -0.290973,0.020569, NEWSHAPE, 384, 1, 2, 0.146470,0.021791, 0.134179,0.071381, 0.089857,0.116839, 0.039860,0.139410, -0.005910,0.150902, -0.047971,0.139775, -0.104973,0.100695, -0.147597,0.052809, -0.177722,0.017653, -0.186756,0.003107, - +NEWSHAPE, 385, 7, 1, 0.354675,0, NEWSHAPE }; -namespace gp { - plainshape psh[32][32][8]; - extern gp::local_info draw_li; - - void clear_plainshapes() { - for(int i=0; i<32; i++) - for(int j=0; j<32; j++) - for(int k=0; k<8; k++) - clear_plainshape(psh[i][j][k]); - } - - plainshape& get_plainshape() { - auto& pshape = psh[draw_li.relative.first&31][draw_li.relative.second&31][fix6(draw_li.total_dir)]; - if(!pshape.active) build_plainshape(pshape, draw_li); - return pshape; - } - } - -void clear_plainshape(plainshape& gsh) { - gsh.active = false; - } - -void build_plainshape(plainshape& gsh, gp::local_info& li) { - - gsh.active = true; - bshape(gsh.shFullFloor, PPR_FLOOR); - bool master = !(li.relative.first||li.relative.second); - int cor = master ? S7 : 6; - printf("generating plainshape %d,%d,%d (%d)\n", li.relative.first, li.relative.second, li.total_dir, cor); - if(master) li.last_dir = -1; - - for(int j=0; j<=cor; j++) - hpcpush(get_corner_position(li, j)); - last->flags |= POLY_HASWALLS | POLY_FULL | POLY_GP; - - bshape(gsh.shFloor, PPR_FLOOR); - for(int j=0; j<=cor; j++) - hpcpush(get_corner_position(li, j, 3.3)); - last->flags |= POLY_HASWALLS | POLY_PLAIN | POLY_GP; - - for(int k=0; kland == laCocytus ? 0x080808FF : 0x101010FF), PPR_LAKEBOTTOM); - } - else { - queuetable(V * qfi.spin, mi.vertices, n, mesh_color, recolor(col), PPR_FLOOR); - } - - lastptd().u.poly.tinf = &mi; - if(gp::on) - lastptd().u.poly.flags = POLY_INVERSE; if(grid_color) { - queuepolyat(V, shFullFloor[ctof(c)], 0, PPR_FLOOR); + draw_floorshape(c, V, shFullFloor, 0, PPR_FLOOR); lastptd().u.poly.outline = grid_color; }