mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
arb:: patterns configuration
This commit is contained in:
parent
c7ec3585ad
commit
e4b2453313
@ -16,6 +16,7 @@ EX namespace arb {
|
||||
|
||||
struct shape {
|
||||
int id;
|
||||
int flags;
|
||||
vector<hyperpoint> vertices;
|
||||
vector<ld> angles;
|
||||
vector<ld> edges;
|
||||
@ -27,6 +28,7 @@ struct shape {
|
||||
struct arbi_tiling {
|
||||
|
||||
int order;
|
||||
bool have_line, have_ph;
|
||||
|
||||
vector<shape> shapes;
|
||||
string name;
|
||||
@ -85,6 +87,14 @@ void load(const string& fname) {
|
||||
exp_parser ep;
|
||||
ep.s = s;
|
||||
ld angleunit = 1, distunit = 1, angleofs = 0;
|
||||
auto addflag = [&] (int f) {
|
||||
int ai;
|
||||
if(ep.next() == ')') ai = isize(c.shapes)-1;
|
||||
else ai = ep.iparse();
|
||||
verify_index(ai, c.shapes);
|
||||
c.shapes[ai].flags |= f;
|
||||
ep.force_eat(")");
|
||||
};
|
||||
while(true) {
|
||||
ep.skip_white();
|
||||
if(ep.next() == 0) break;
|
||||
@ -116,6 +126,14 @@ void load(const string& fname) {
|
||||
else if(ep.eat("angleunit(")) angleunit = real(ep.parsepar());
|
||||
else if(ep.eat("angleofs(")) angleofs = real(ep.parsepar());
|
||||
else if(ep.eat("distunit(")) distunit = real(ep.parsepar());
|
||||
else if(ep.eat("line(")) {
|
||||
addflag(arcm::sfLINE);
|
||||
c.have_line = true;
|
||||
}
|
||||
else if(ep.eat("grave(")) {
|
||||
addflag(arcm::sfPH);
|
||||
c.have_ph = true;
|
||||
}
|
||||
else if(ep.eat("let(")) {
|
||||
string tok = ep.next_token();
|
||||
ep.force_eat("=");
|
||||
@ -125,6 +143,7 @@ void load(const string& fname) {
|
||||
c.shapes.emplace_back();
|
||||
auto& cc = c.shapes.back();
|
||||
cc.id = isize(c.shapes) - 1;
|
||||
cc.flags = 0;
|
||||
while(ep.next() != ')') {
|
||||
ld dist = ep.rparse(0);
|
||||
ep.force_eat(",");
|
||||
@ -370,6 +389,14 @@ EX bool in() { return geometry == gArbitrary; }
|
||||
|
||||
EX string tes = "tessellations/marjorie-rice.tes";
|
||||
|
||||
EX bool linespattern(cell *c) {
|
||||
return current.shapes[id_of(c->master)].flags & arcm::sfLINE;
|
||||
}
|
||||
|
||||
EX bool pseudohept(cell *c) {
|
||||
return current.shapes[id_of(c->master)].flags & arcm::sfPH;
|
||||
}
|
||||
|
||||
EX void choose() {
|
||||
dialog::openFileDialog(tes, XLAT("open a tiling"), ".tes",
|
||||
[] () {
|
||||
|
@ -84,11 +84,13 @@ struct archimedean_tiling {
|
||||
|
||||
#if CAP_ARCM
|
||||
|
||||
#if HDR
|
||||
static const int sfPH = 1;
|
||||
static const int sfLINE = 2;
|
||||
static const int sfCHESS = 4;
|
||||
static const int sfTHREE = 8;
|
||||
static const int sfSEMILINE = 16;
|
||||
#endif
|
||||
|
||||
EX archimedean_tiling current;
|
||||
|
||||
|
@ -597,6 +597,8 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
else if(arcm::in() && arcm::current.have_line)
|
||||
v = arcm::linespattern(c) ? 24 : 16;
|
||||
#endif
|
||||
else if(arb::in() && arb::current.have_line)
|
||||
v = arb::linespattern(c) ? 24 : 16;
|
||||
else if((euclid&&bounded) || hyperbolic_not37 || quotient || arcm::in()) {
|
||||
v = hrand(100) < 25 ? 24 : 16;
|
||||
}
|
||||
@ -663,6 +665,8 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
else if(arcm::in() && arcm::current.have_line)
|
||||
c->wall = arcm::linespattern(c) ? waTrapdoor : waNone;
|
||||
#endif
|
||||
else if(arb::in() && arb::current.have_line)
|
||||
c->wall = arb::linespattern(c) ? waTrapdoor : waNone;
|
||||
else if(euclid && !arcm::in()) {
|
||||
auto co = euc2_coordinates(c);
|
||||
int y = co.second;
|
||||
@ -691,6 +695,8 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
else if(arcm::in() && arcm::current.have_line)
|
||||
c->wall = arcm::linespattern(c) ? waVinePlant : waNone;
|
||||
#endif
|
||||
else if(arb::in() && arb::current.have_line)
|
||||
c->wall = arb::linespattern(c) ? waVinePlant : waNone;
|
||||
else if(nil) {
|
||||
if((c->master->emeraldval & 1) == 1)
|
||||
c->wall = waVinePlant;
|
||||
|
@ -1245,6 +1245,8 @@ EX int geosupport_football() {
|
||||
if(arcm::in() /* PURE */) return arcm::current.support_football();
|
||||
#endif
|
||||
|
||||
if(arb::in()) return arb::current.have_ph;
|
||||
|
||||
#if CAP_IRR
|
||||
if(IRREGULAR) return irr::bitruncations_performed ? 2 : 1;
|
||||
#endif
|
||||
@ -1269,7 +1271,7 @@ EX int pattern_threecolor(cell *c) {
|
||||
return c->master->rval1;
|
||||
}
|
||||
#endif
|
||||
if(arb::in()) return 0;
|
||||
if(arb::in()) return arb::id_of(c->master) % 3;
|
||||
if(IRREGULAR || bt::in()) return !pseudohept(c);
|
||||
#if CAP_GP
|
||||
if(S3 == 3 && !(S7&1) && gp_threecolor() == 1 && c->master->c7 != c) {
|
||||
@ -1407,6 +1409,7 @@ EX bool pseudohept(cell *c) {
|
||||
#if CAP_ARCM
|
||||
if(arcm::in()) return arcm::pseudohept(c);
|
||||
#endif
|
||||
if(arb::in()) return arb::pseudohept(c);
|
||||
#if CAP_GP
|
||||
if(GOLDBERG && gp_threecolor() == 2)
|
||||
return gp::pseudohept_val(c) == 0;
|
||||
|
Loading…
Reference in New Issue
Block a user