diff --git a/3d-models.cpp b/3d-models.cpp index 4345c10f..754db570 100644 --- a/3d-models.cpp +++ b/3d-models.cpp @@ -896,7 +896,7 @@ void geometry_information::make_3d_models() { &shEagle, &shFemaleBody, &shFlailMissile, &shGadflyWing, &shGargoyleWings, &shHawk, &shJiangShi, &shKnife, &shPBody, &shPHead, &shRaiderBody, &shReptileBody, &shSkeletonBody, &shTongue, &shTrapArrow, &shTrylobite, &shWaterElemental, &shWolfBody, &shYeti, &shWormHead, &shWormHead, &shDragonHead, &shDragonSegment, &shDragonTail, - &shTentacleX, &shTentHead, &shILeaf[0], &shILeaf[1], &shWormSegment, &shSmallWormSegment, + &shTentHead, &shILeaf[0], &shILeaf[1], &shWormSegment, &shSmallWormSegment, &shWormTail, &shSmallWormTail, &shFrogBody }) make_shadow(*sh); diff --git a/geometry.cpp b/geometry.cpp index ce672da9..3d027b11 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -167,6 +167,10 @@ enum class ePipeEnd {sharp, ball}; struct embedding_method; +struct length_adjusted_shapes { + hpcshape shIBranch; + }; + /** basic geometry parameters */ struct geometry_information { @@ -293,7 +297,7 @@ hpcshape shFigurine, shTreat, shSmallTreat, shElementalShard, // shBranch, - shIBranch, shTentacle, shTentacleX, shILeaf[3], + shILeaf[3], shMovestar, shWolf, shYeti, shDemon, shGDemon, shEagle, shGargoyleWings, shGargoyleBody, shFoxTail1, shFoxTail2, @@ -395,6 +399,9 @@ hpcshape map shPipe; + length_adjusted_shapes lash_default; + map lash; + vector shPlainWall3D, shWireframe3D, shWall3D, shMiniWall3D; vector walltester; @@ -483,9 +490,11 @@ hpcshape void initPolyForGL(); void extra_vertices(); transmatrix ddi(int a, ld x); - void drawTentacle(hpcshape &h, ld rad, ld var, ld divby); + void drawTentacle(ld rad, ld var, ld divby, ld tlength); hyperpoint hpxyzsc(double x, double y, double z); hyperpoint turtlevertex(int u, double x, double y, double z); + + length_adjusted_shapes& get_lash(ld len); void bshape(hpcshape& sh, PPR prio); void finishshape(); diff --git a/graph-monster.cpp b/graph-monster.cpp index c28a70ea..408ab3c5 100644 --- a/graph-monster.cpp +++ b/graph-monster.cpp @@ -1355,7 +1355,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const shiftmatrix& V1, color_t } else if(isMagneticPole(m)) { if(m == moNorthPole) - queuepolyat(VBODY * spin180(), cgi.shTentacle, 0x000000C0, PPR::TENTACLE1); + queuepolyat(VBODY * spin180(), cgi.lash_default.shIBranch, 0x000000C0, PPR::TENTACLE1); queuepolyat(VBODY, cgi.shDisk, darkena(col, 0, 0xFF), PPR::MONSTER_BODY); } else if(isMetalBeast(m) || m == moBrownBug) { @@ -1555,7 +1555,8 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col return false; if(isIvy(c) || isMutantIvy(c) || c->monst == moFriendlyIvy) { - queuepoly(Vb, cgi.shIBranch, (col << 8) + 0xFF); + auto& lash = (geometry == gNormal && BITRUNCATED) ? cgi.lash_default : cgi.get_lash(hdist0(currentmap->adj(c, c->mondir) * C0)); + queuepoly(Vb, lash.shIBranch, (col << 8) + 0xFF); christmas_lights(c, Vb); } @@ -1574,11 +1575,6 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col drawMonsterType(moGhost, c, Vs, col, footphase, asciicol); col = minf[moTentacletail].color; } - /* - queuepoly(at_smart_lof(Vb, cgi.ABODY), cgi.shTentacleX, 0xFFFFFFFF); - queuepoly(at_smart_lof(Vb, cgi.ABODY), cgi.shTentacle, (col << 8) + 0xFF); - ShadowV(Vb, cgi.shTentacleX, PPR::GIANTSHADOW); - */ bool hexsnake = c->monst == moHexSnake || c->monst == moHexSnakeTail; bool thead = c->monst == moTentacle || c->monst == moTentaclewait || c->monst == moTentacleEscaping; hpcshape& sh = hexsnake ? cgi.shWormSegment : cgi.shSmallWormSegment; diff --git a/polygons.cpp b/polygons.cpp index 0abc50aa..cb5d1d96 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -156,13 +156,7 @@ void geometry_information::extra_vertices() { transmatrix geometry_information::ddi(int a, ld x) { return xspinpush(a * S_step, x); } -void geometry_information::drawTentacle(hpcshape &h, ld rad, ld var, ld divby) { - double tlength = max(crossf, hexhexdist); - if(geometry == gBinaryTiling) tlength *= 0.7; - if(geometry == gBinary4) tlength *= 0.45; - #if CAP_ARCM - if(arcm::in()) tlength = arcm::current.scale(); - #endif +void geometry_information::drawTentacle(ld rad, ld var, ld divby, ld tlength) { 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); @@ -1167,6 +1161,17 @@ void geometry_information::configure_floorshapes() { for(int i=0; i<3; i++) shRedRockFloor[i].scale = .9 - .1 * i; } +length_adjusted_shapes& geometry_information::get_lash(ld len) { + int id = int(len * 100 + .5); + if(lash.count(id)) return lash[id]; + auto& res = lash[id]; + bshape(res.shIBranch, PPR::TENTACLE1); + drawTentacle(crossf * .1, crossf * .2, 5, len); + finishshape(); + extra_vertices(); + return res; + } + void geometry_information::prepare_shapes() { require_basics(); if(cgflags & qRAYONLY) return; @@ -1343,12 +1348,15 @@ void geometry_information::prepare_shapes() { wormscale = WDIM == 3 ? 3 : 1; // first layer monsters - bshape(shTentacleX, PPR::TENTACLE0); - drawTentacle(shTentacleX, crossf * .25, crossf * .1, 10); - bshape(shIBranch, PPR::TENTACLE1); - drawTentacle(shIBranch, crossf * .1, crossf * .2, 5); - bshape(shTentacle, PPR::TENTACLE1); - drawTentacle(shTentacle, crossf * .2, crossf * .1, 10); + bshape(lash_default.shIBranch, PPR::TENTACLE1); + double tlength = max(crossf, hexhexdist); + if(geometry == gBinaryTiling) tlength *= 0.7; + if(geometry == gBinary4) tlength *= 0.45; + #if CAP_ARCM + if(arcm::in()) tlength = arcm::current.scale(); + #endif + drawTentacle(crossf * .1, crossf * .2, 5, tlength); + copyshape(shJoint, shDisk, PPR::ONTENTACLE); bshape(shTentHead, PPR::ONTENTACLE, scalefactor * wormscale, 79); bshape(shWormHead, PPR::ONTENTACLE, scalefactor * wormscale, 80);