1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 01:00:25 +00:00

fixed new geometry handling for Archimedean

This commit is contained in:
Zeno Rogue 2019-08-22 12:14:39 +02:00
parent 2f954d0538
commit a03eb0d913
23 changed files with 57 additions and 55 deletions

View File

@ -264,9 +264,9 @@ EX void achievement_collection(eItem it, int prevgold, int newgold) {
if(PURE && geometry == gNormal)
achievement_gain("GRAILH", rg::special_geometry);
#if CAP_CRYSTAL
if(PURE && geometry == gCrystal && ginf[gCrystal].sides == 8 && ginf[gCrystal].vertex == 4 && !crystal::used_compass_inside)
if(PURE && cryst && ginf[gCrystal].sides == 8 && ginf[gCrystal].vertex == 4 && !crystal::used_compass_inside)
achievement_gain("GRAIL4D", rg::special_geometry);
if(BITRUNCATED && geometry == gCrystal && ginf[gCrystal].sides == 8 && ginf[gCrystal].vertex == 3 && !crystal::used_compass_inside)
if(BITRUNCATED && cryst && ginf[gCrystal].sides == 8 && ginf[gCrystal].vertex == 3 && !crystal::used_compass_inside)
achievement_gain("GRAIL4D2", rg::special_geometry);
#endif
if(q == 3) achievement_gain("GRAIL3");

View File

@ -69,7 +69,8 @@ struct archimedean_tiling {
void regroup();
string world_size();
eGeometryClass get_class();
geometryinfo1& get_geometry();
eGeometryClass get_class() { return get_geometry().kind; }
ld scale();
};
@ -311,14 +312,14 @@ void archimedean_tiling::regroup() {
}
}
eGeometryClass archimedean_tiling::get_class() {
if(euclidean_angle_sum < 1.999999) return gcSphere;
else if(euclidean_angle_sum > 2.000001) return gcHyperbolic;
else return gcEuclid;
geometryinfo1& archimedean_tiling::get_geometry() {
if(euclidean_angle_sum < 1.999999) return ginf[gSphere].g;
else if(euclidean_angle_sum > 2.000001) return ginf[gNormal].g;
else return ginf[gEuclid].g;
}
void archimedean_tiling::compute_geometry() {
ginf[gArchimedean].cclass = get_class();
ginf[gArchimedean].g = get_geometry();
set_flag(ginf[gArchimedean].flags, qBOUNDED, get_class() == gcSphere);
DEBB(DF_GEOM, (format("euclidean_angle_sum = %f\n", float(euclidean_angle_sum))));

View File

@ -45,7 +45,7 @@ EX int roundTableRadius(cell *c) {
EX int celldistAltRelative(cell *c) {
#if CAP_CRYSTAL
if(geometry == gCrystal) return crystal::dist_relative(c);
if(cryst) return crystal::dist_relative(c);
#endif
#if MAXMDIM >= 4
if(euclid && WDIM == 3) return euclid3::dist_relative(c);

View File

@ -265,7 +265,7 @@ EX void initcells() {
if(res) currentmap = res;
else if(nonisotropic || prod) currentmap = nisot::new_map();
#if CAP_CRYSTAL
else if(geometry == gCrystal) currentmap = crystal::new_map();
else if(cryst) currentmap = crystal::new_map();
#endif
#if CAP_ARCM
else if(archimedean) currentmap = arcm::new_map();
@ -466,7 +466,7 @@ EX int celldist(cell *c) {
if(masterless)
return eudist(decodeId(c->master));
if(euclid && (penrose || archimedean)) return celldistance(currentmap->gamestart(), c);
if(sphere || binarytiling || WDIM == 3 || geometry == gCrystal || sol || penrose) return celldistance(currentmap->gamestart(), c);
if(sphere || binarytiling || WDIM == 3 || cryst || sol || penrose) return celldistance(currentmap->gamestart(), c);
#if CAP_IRR
if(IRREGULAR) return irr::celldist(c, false);
#endif
@ -506,7 +506,7 @@ EX int celldistAlt(cell *c) {
#endif
if(nil) return c->master->zebraval + abs(c->master->emeraldval) + (specialland == laCamelot && !tactic::on? 30 : 0);;
#if CAP_CRYSTAL
if(geometry == gCrystal)
if(cryst)
return crystal::dist_alt(c);
#endif
if(sphere || quotient) {
@ -935,7 +935,7 @@ EX int heptdistance(heptagon *h1, heptagon *h2) {
// very rough distance
int d = 0;
#if CAP_CRYSTAL
if(geometry == gCrystal) return crystal::space_distance(h1->c7, h2->c7);
if(cryst) return crystal::space_distance(h1->c7, h2->c7);
#endif
if(sol) return solv::approx_distance(h1, h2);
while(true) {
@ -949,7 +949,7 @@ EX int heptdistance(heptagon *h1, heptagon *h2) {
EX int heptdistance(cell *c1, cell *c2) {
#if CAP_CRYSTAL
if(geometry == gCrystal) return crystal::space_distance(c1, c2);
if(cryst) return crystal::space_distance(c1, c2);
#endif
if(!hyperbolic || quotient || WDIM == 3) return celldistance(c1, c2);
else return heptdistance(c1->master, c2->master);
@ -1034,7 +1034,7 @@ EX int celldistance(cell *c1, cell *c2) {
}
#if CAP_CRYSTAL
if(geometry == gCrystal) return crystal::precise_distance(c1, c2);
if(cryst) return crystal::precise_distance(c1, c2);
#endif
if(masterless || archimedean || quotient || sol || (penrose && euclid) || experimental) {
@ -1072,7 +1072,7 @@ EX int celldistance(cell *c1, cell *c2) {
EX vector<cell*> build_shortest_path(cell *c1, cell *c2) {
#if CAP_CRYSTAL
if(geometry == gCrystal) return crystal::build_shortest_path(c1, c2);
if(cryst) return crystal::build_shortest_path(c1, c2);
#endif
vector<cell*> p;
if(euclid) {

View File

@ -1885,7 +1885,7 @@ EX void show_color_dialog() {
}
#if CAP_CRYSTAL
if(geometry == gCrystal && cheater) {
if(cryst && cheater) {
dialog::addItem(XLAT("crystal coordinate colors"), 'C');
dialog::add_action([] () { crystal::view_coordinates = true; pushScreen([] () { edit_color_table(crystal::coordcolors); });});
}

View File

@ -515,7 +515,7 @@ EX ld compass_angle() {
EX bool crystal_cell(cell *c, transmatrix V) {
if(geometry != gCrystal) return false;
if(!cryst) return false;
if(view_east && cheater) {
int d = dist_alt(c);
@ -1140,7 +1140,7 @@ EX void show() {
string s;
if(i % 2) s = its(i/2) + ".5D";
else s = its(i/2) + "D";
dialog::addBoolItem(s, geometry == gCrystal && ginf[gCrystal].sides == i && ginf[gCrystal].vertex == 4, 'a' + i - 5);
dialog::addBoolItem(s, cryst && ginf[gCrystal].sides == i && ginf[gCrystal].vertex == 4, 'a' + i - 5);
dialog::add_action(dialog::add_confirmation([i]() { set_crystal(i); start_game(); }));
}
dialog::addBoolItem(XLAT("4D double bitruncated"), ginf[gCrystal].vertex == 3, 'D');
@ -1152,13 +1152,13 @@ EX void show() {
dialog::editNumber(compass_probability, 0, 1, 0.1, 1, XLAT("compass probability"), compass_help());
dialog::bound_low(0);
});
if(geometry == gCrystal) {
if(cryst) {
dialog::addBoolItem(XLAT("3D display"), rug::rugged, 'r');
dialog::add_action_push(rug::show);
}
else
dialog::addBreak(100);
if(rug::rugged && geometry == gCrystal && ginf[gCrystal].sides == 8) {
if(rug::rugged && cryst && ginf[gCrystal].sides == 8) {
dialog::addBoolItem(XLAT("render a cut"), draw_cut, 'x');
dialog::add_action([]() {
draw_cut = true;
@ -1451,7 +1451,7 @@ void transform_euclid_to_crystal () {
void add_crystal_transform(char c) {
if(shmup::on) return;
if(geometry == gCrystal && ginf[gCrystal].sides == 6) {
if(cryst && ginf[gCrystal].sides == 6) {
dialog::addItem("convert Crystal to 3D", c);
dialog::add_action(transform_crystal_to_euclid);
}

View File

@ -2420,7 +2420,7 @@ EX void killMonster(cell *c, eMonster who, flagtype deathflags IS(0)) {
if(m == moPirate && isOnCIsland(c) && c->item == itNone && (
eubinary ||
(c->master->alt && celldistAlt(c) <= 2-getDistLimit()) ||
isHaunted(c->land)) && geometry != gCrystal) {
isHaunted(c->land)) && !cryst) {
bool toomany = false;
for(int i=0; i<c->type; i++) {
cell *c2 = c->move(i);
@ -7459,7 +7459,7 @@ EX bool in_full_game() {
if(chaosmode) return true;
if(euclid && isCrossroads(specialland)) return true;
if(weirdhyperbolic && specialland == laCrossroads4) return true;
if(geometry == gCrystal && isCrossroads(specialland)) return true;
if(cryst && isCrossroads(specialland)) return true;
if(geometry == gNormal && !NONSTDVAR) return true;
return false;
}
@ -7495,7 +7495,7 @@ EX void knightFlavorMessage(cell *c2) {
addMessage(XLAT("\"The Holy Grail is in the center of the Round Table.\""));
}
#if CAP_CRYSTAL
else if(msgid == 3 && geometry == gCrystal) {
else if(msgid == 3 && cryst) {
if(crystal::pure())
addMessage(XLAT("\"Each piece of the Round Table is exactly %1 steps away from the Holy Grail.\"", its(roundTableRadius(c2))));
else
@ -7521,7 +7521,7 @@ EX void knightFlavorMessage(cell *c2) {
string s = "";
if(0) ;
#if CAP_CRYSTAL
else if(geometry == gCrystal)
else if(cryst)
s = crystal::get_table_boundary();
#endif
else if(!quotient)
@ -7533,7 +7533,7 @@ EX void knightFlavorMessage(cell *c2) {
string s = "";
if(0);
#if CAP_CRYSTAL
else if(geometry == gCrystal)
else if(cryst)
s = crystal::get_table_volume();
#endif
else if(!quotient)

View File

@ -415,7 +415,7 @@ void ge_select_tiling(const vector<eGeometry>& lst) {
bool on = geometry == i;
dynamicval<eGeometry> cg(geometry, eGeometry(i));
if(archimedean && !CAP_ARCM) continue;
if(geometry == gCrystal && !CAP_CRYSTAL) continue;
if(cryst && !CAP_CRYSTAL) continue;
if(geometry == gFieldQuotient && !CAP_FIELD) continue;
dialog::addBoolItem(XLAT((geometry == gProduct && !on) ? XLAT("current geometry x E") : ginf[i].menu_displayed_name), on, letter++);
dialog::lastItem().value += validclasses[land_validity(specialland).quality_level];
@ -670,7 +670,7 @@ EX void showEuclideanMenu() {
if(euwrap || geometry == gFieldQuotient || geometry == gCrystal || archimedean || (euclid && WDIM == 3)) {
if(euwrap || geometry == gFieldQuotient || cryst || archimedean || (euclid && WDIM == 3)) {
dialog::addItem(XLAT("advanced parameters"), '4');
dialog::add_action([] {
if(0);
@ -679,7 +679,7 @@ EX void showEuclideanMenu() {
pushScreen(arcm::show);
#endif
#if CAP_CRYSTAL
else if(geometry == gCrystal)
else if(cryst)
pushScreen(crystal::show);
#endif
#if MAXMDIM == 4
@ -774,7 +774,7 @@ EX void showEuclideanMenu() {
(archimedean && sphere) ? its(isize(currentmap->allcells())) :
#endif
#if CAP_CRYSTAL
geometry == gCrystal ? "∞^" + its(ts/2) :
cryst ? "∞^" + its(ts/2) :
#endif
WDIM == 3 && bounded ? its(isize(currentmap->allcells())) :
WDIM == 3 && euclid ? "" :

View File

@ -885,7 +885,7 @@ EX void check_cgi() {
if(geometry == gArchimedean) V("ARCM", arcm::current.symbol);
if(geometry == gCrystal) V("CRYSTAL", its(ginf[gCrystal].sides) + its(ginf[gCrystal].vertex));
if(cryst) V("CRYSTAL", its(ginf[gCrystal].sides) + its(ginf[gCrystal].vertex));
if(binarytiling || GDIM == 3) V("WQ", its(vid.texture_step));

View File

@ -123,7 +123,7 @@ transmatrix hrmap_standard::relative_matrix(cell *c2, cell *c1, const hyperpoint
h2 = h2->move(bestd);
}
#if CAP_CRYSTAL
else if(geometry == gCrystal) {
else if(cryst) {
for(int d3=0; d3<S7; d3++) {
auto h3 = h2->cmove(d3);
if(visited.count(h3)) continue;

View File

@ -901,7 +901,7 @@ EX bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int
else if(it == itCompass) {
transmatrix V2;
#if CAP_CRYSTAL
if(geometry == gCrystal) {
if(cryst) {
if(crystal::compass_probability <= 0) return true;
if(cwt.at->land == laCamelot && celldistAltRelative(cwt.at) < 0) crystal::used_compass_inside = true;
V2 = V * spin(crystal::compass_angle() + M_PI);

View File

@ -289,7 +289,7 @@ EX string generateHelpForItem(eItem it) {
string help = helptitle(XLATN(iinf[it].name), iinf[it].color);
#if CAP_CRYSTAL
if(it == itCompass && geometry == gCrystal)
if(it == itCompass && cryst)
help += crystal::compass_help();
else
#endif
@ -680,7 +680,7 @@ string generateHelpForLand(eLand l) {
}
#if CAP_CRYSTAL
if(l == laCamelot && geometry == gCrystal) {
if(l == laCamelot && cryst) {
if(!crystal::used_compass_inside) s += XLAT("\nSpecial conduct (still valid)\n");
else s += XLAT("\nSpecial conduct failed:\n");

View File

@ -223,7 +223,7 @@ heptagon *createStep(heptagon *h, int d) {
}
heptagon *hrmap_standard::create_step(heptagon *h, int d) {
if(!h->move(0) && h->s != hsOrigin && !binarytiling && (geometry != gCrystal)) {
if(!h->move(0) && h->s != hsOrigin && !binarytiling && !cryst) {
// cheating:
int pard=0;
if(S3 == 3)

View File

@ -111,13 +111,14 @@ void addMessage(string s, char spamtype = 0);
#define binarytiling (ginf[geometry].flags & qBINARY)
#define archimedean (geometry == gArchimedean)
#define cryst (geometry == gCrystal)
#define penrose (ginf[geometry].flags & qPENROSE)
/** convenience flag for geometries with major aspects missing */
#define experimental (ginf[geometry].flags & qEXPERIMENTAL)
// these geometries do not feature alternate structures for horocycles
#define eubinary (euclid || binarytiling || geometry == gCrystal || nil)
#define eubinary (euclid || binarytiling || cryst || nil)
#define cgclass (ginf[geometry].cclass)
#define euclid (cgclass == gcEuclid)

View File

@ -1292,7 +1292,7 @@ EX void centerpc(ld aspd) {
if(dual::split([=] () { centerpc(aspd); })) return;
#if CAP_CRYSTAL
if(geometry == gCrystal)
if(cryst)
crystal::centerrug(aspd);
#endif

View File

@ -497,7 +497,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
c->wall = waCavewall;
else c->wall = waCavefloor;
}
else if(a4 || archimedean || geometry == gCrystal)
else if(a4 || archimedean || cryst)
c->wall = hrand(100) < 50 ? waCavefloor : waCavewall;
else if(!BITRUNCATED) {
if(polarb50(c))
@ -1661,7 +1661,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
if(d == 7 && c->wall == waCTree && hrand_monster(GDIM == 2 ? 5000 : 50000) < 100 + items[itPirate] + yendor::hardness())
c->monst = moParrot;
ONEMPTY {
if(hrand(1500) < 4 && celldistAlt(c) <= -5 && peace::on && geometry != gCrystal)
if(hrand(1500) < 4 && celldistAlt(c) <= -5 && peace::on && !cryst)
c->item = itCompass;
if(hrand_monster(16000) < 40 + (items[itPirate] + yendor::hardness()))
c->monst = moPirate;
@ -2552,7 +2552,7 @@ EX void setdist(cell *c, int d, cell *from) {
// this fixes the following problem:
// http://steamcommunity.com/app/342610/discussions/0/1470840994970724215/
if(!generatingEquidistant && from && d >= 7 && c->land && !binarytiling && !archimedean && geometry != gCrystal && WDIM == 2 && hyperbolic) {
if(!generatingEquidistant && from && d >= 7 && c->land && !binarytiling && !archimedean && !cryst && WDIM == 2 && hyperbolic) {
int cdi = celldist(c);
if(celldist(from) > cdi) {
forCellCM(c2, c) if(celldist(c2) < cdi) {
@ -2629,7 +2629,7 @@ EX void setdist(cell *c, int d, cell *from) {
if(0);
else if(chaosmode > 1) ;
#if CAP_CRYSTAL
else if(geometry == gCrystal) crystal::set_land(c);
else if(cryst) crystal::set_land(c);
#endif
#if MAXMDIM == 4
else if(euclid && WDIM == 3) euclid3::set_land(c);
@ -2716,7 +2716,7 @@ EX void setdist(cell *c, int d, cell *from) {
else
placeLocalOrbs(c);
#if CAP_CRYSTAL
if(geometry == gCrystal && c->land != laMinefield)
if(cryst && c->land != laMinefield)
crystal::may_place_compass(c);
#endif
}

View File

@ -733,7 +733,7 @@ EX land_validity_t& land_validity(eLand l) {
}
if(l == laBrownian) {
if(quotient || !hyperbolic || geometry == gCrystal) return dont_work;
if(quotient || !hyperbolic || cryst) return dont_work;
}
if(binarytiling) {
@ -753,7 +753,7 @@ EX land_validity_t& land_validity(eLand l) {
#endif
#if CAP_CRYSTAL
if(geometry == gCrystal) {
if(cryst) {
if(l == laCamelot) return interesting;
if(isCrossroads(l)) return full_game;
}

View File

@ -146,7 +146,7 @@ namespace mapstream {
}
#endif
#if CAP_CRYSTAL
if(geometry == gCrystal) {
if(cryst) {
f.write(ginf[gCrystal].sides);
if(ginf[gCrystal].sides == 8)
f.write(ginf[gCrystal].vertex);
@ -293,7 +293,7 @@ namespace mapstream {
torusconfig::activate();
}
#if CAP_CRYSTAL
if(geometry == gCrystal && f.vernum >= 10504) {
if(cryst && f.vernum >= 10504) {
int sides;
f.read(sides);
#if CAP_CRYSTAL

View File

@ -1672,7 +1672,7 @@ EX namespace patterns {
if(archimedean)
dialog::addSelItem(XLAT("Archimedean"), "Archimedean", 'A');
if(geometry == gCrystal)
if(cryst)
dialog::addSelItem(XLAT("Crystal coordinates"), "Crystal", 'K');
dialog::addSelItem(XLAT("sides"), "sides", 'B');

View File

@ -198,14 +198,14 @@ bool bad(cell *c2, cell *c) {
int rcelldist(cell *c) {
#if CAP_CRYSTAL
if(geometry == gCrystal) return crystal::space_distance(c, currentmap->gamestart());
if(cryst) return crystal::space_distance(c, currentmap->gamestart());
#endif
return celldist(c);
}
int pcelldist(cell *c) {
#if CAP_CRYSTAL
if(geometry == gCrystal) return crystal::precise_distance(c, currentmap->gamestart());
if(cryst) return crystal::precise_distance(c, currentmap->gamestart());
#endif
return celldist(c);
}
@ -1336,7 +1336,7 @@ void markers() {
if(cd != DISTANCE_UNKNOWN)
queuestr(H, vid.fsize,
#if CAP_CRYSTAL
(geometry == gCrystal && !crystal::pure()) ? fts(crystal::space_distance(cwt.at, track.back())) :
(cryst && !crystal::pure()) ? fts(crystal::space_distance(cwt.at, track.back())) :
#endif
its(cd), 0x10101 * int(128 - 100 * sintick(150)));
addauraspecial(H, 0xFFD500, 0);

View File

@ -1509,7 +1509,7 @@ EX void init_model() {
err_zero_current = err_zero;
#if CAP_CRYSTAL
if(geometry == gCrystal && surface::sh == surface::dsNone) {
if(cryst && surface::sh == surface::dsNone) {
surface::sh = surface::dsCrystal;
crystal::init_rotation();
good_shape = true;

View File

@ -1198,7 +1198,7 @@ EX void set_variation(eVariation target) {
stop_game();
if(euclid6 || binarytiling || sol || penrose) geometry = gNormal;
auto& cd = ginf[gCrystal];
if(target == eVariation::bitruncated && geometry == gCrystal && cd.sides == 8 && cd.vertex == 4) {
if(target == eVariation::bitruncated && cryst && cd.sides == 8 && cd.vertex == 4) {
cd.vertex = 3;
cd.tiling_name = "{8,3}";
target = eVariation::pure;

View File

@ -1144,7 +1144,7 @@ modecode_t modecode() {
#endif
#if CAP_CRYSTAL
if(geometry == gCrystal) {
if(cryst) {
mct += ll(ginf[geometry].sides) << 29;
mct += ll(ginf[geometry].vertex) << 37;
}