1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-26 15:12:48 +00:00

added some missing guards

This commit is contained in:
Zeno Rogue 2025-06-22 15:41:43 +02:00
parent d4bb23b8eb
commit 537a3b8779
10 changed files with 49 additions and 6 deletions

View File

@ -192,10 +192,16 @@ EX char specgeom_lovasz() { return rg::check(geometry == gKleinQuartic && variat
EX char specgeom_halloween() { return rg::check((geometry == gSphere || geometry == gElliptic) && BITRUNCATED && !disksize && firstland == laHalloween); }
EX char specgeom_heptagonal() { return rg::check(PURE && geometry == gNormal && !disksize, rg::special_geometry_nicewalls); }
EX char specgeom_euclid_gen() { return rg::check(geometry == gEuclid && !disksize && firstland == laMirrorOld); }
#if CAP_CRYSTAL
EX char specgeom_crystal1() { return rg::check(PURE && cryst && ginf[gCrystal].sides == 8 && ginf[gCrystal].vertex == 4 && !crystal::used_compass_inside && !disksize && firstland == laCamelot); }
EX char specgeom_crystal2() { return rg::check(BITRUNCATED && cryst && ginf[gCrystal].sides == 8 && ginf[gCrystal].vertex == 3 && !crystal::used_compass_inside && !disksize && firstland == laCamelot); }
#endif
EX vector<std::function<char()>> all_specgeom_checks = { specgeom_zebra, specgeom_lovasz, specgeom_halloween, specgeom_heptagonal, specgeom_crystal1, specgeom_crystal2, specgeom_euclid_gen };
EX vector<std::function<char()>> all_specgeom_checks = { specgeom_zebra, specgeom_lovasz, specgeom_halloween, specgeom_heptagonal,
#if CAP_CRYSTAL
specgeom_crystal1, specgeom_crystal2,
#endif
specgeom_euclid_gen };
EX char any_specgeom() {
for(auto chk: all_specgeom_checks) if(chk() != rg::fail) return chk();

View File

@ -2013,9 +2013,11 @@ EX void convert() {
sh.vertices.clear();
sh.connections.clear();
sh.cycle_length = id.modval;
#if CAP_ARCM
if(arcm::in())
sh.orig_id = arcm::get_graphical_id(s);
else
#endif
sh.orig_id = shvid(s);
sh.repeat_value = t / id.modval;
sh.flags = hr::pseudohept(s) ? arcm::sfPH : 0;

View File

@ -515,7 +515,9 @@ EX void killMonster(cell *c, eMonster who, flagtype deathflags IS(0)) {
}
#endif
#if CAP_COMPLEX2
if(m == moHunterGuard) ambush::guard_attack();
#endif
if(m == moGolemMoved) m = moGolem;
if(m == moKnightMoved) m = moKnight;

View File

@ -121,10 +121,12 @@ void eclectic_red(color_t& col) {
constexpr ld spinspeed = .75 / M_PI;
EX color_t apply_mine_knowledge(color_t wcol, cell* c) {
#if CAP_COMPLEX2
if(mine::marked_safe(c))
return gradient(wcol, 0x40FF40, 0, 0.2, 1);
if(mine::marked_mine(c))
return gradient(wcol, 0xFF4040, -1, vid.ispeed ? sintick(100) : 1, 1);
#endif
return wcol;
}
@ -1412,6 +1414,7 @@ EX void draw_mine_numbers(int mines, const shiftmatrix& V, int ct6) {
}
}
#if CAP_COMPLEX2
EX void draw_mine_markers(cell *c, const shiftmatrix& V) {
if(mine_markers && !mine::marked_safe(c)) {
color_t col = 0xFF4040;
@ -1421,6 +1424,7 @@ EX void draw_mine_markers(cell *c, const shiftmatrix& V) {
queuepoly(V, cgi.shJoint, 0);
}
}
#endif
void celldrawer::draw_features() {
char xch = winf[c->wall].glyph;
@ -1666,10 +1670,12 @@ void celldrawer::draw_features() {
break;
}
#if CAP_COMPLEX2
case waMineUnknown: case waMineMine: {
draw_mine_markers(c, V);
break;
}
#endif
case waEditStatue:
if(!mapeditor::drawUserShape(V * ddspin(c, c->mondir), mapeditor::sgWall, c->wparam, darkena(wcol, fd, 0xFF), c))
@ -1787,8 +1793,10 @@ void celldrawer::draw_features_and_walls_3d() {
if(anyshiftclick) return;
}
#if CAP_COMPLEX2
if(among(c->wall, waMineUnknown, waMineMine))
draw_mine_markers(c, face_the_player(V));
#endif
if(isWall3(c, wcol)) {
if(!no_wall_rendering) {

View File

@ -301,9 +301,11 @@ EX bool swordConflict(const player_move_info& sm1, const player_move_info& sm2)
EX string yasc_message;
EX string blocking_monster_name(const moveissue& mi) {
#if CAP_COMPLEX2
if(mi.monster == moKnight && mi.where)
return XLAT("%1 the Knight", camelot::knight_name(mi.where));
else
#endif
return dnameof(mi.monster);
}

View File

@ -1087,8 +1087,10 @@ EX void mainloopiter() {
#if CAP_SDLJOY
if(joydir.d != -1) checkjoy();
#if CAP_THREAD
if(joystick_done && joythread) { joythread->join(); delete joythread; joystick_done = false; }
#endif
#endif
}
EX bool need_refresh;

View File

@ -283,6 +283,7 @@ template<class T, class U> void sizeto(T& t, int n, const U& val) {
if(isize(t) <= n) t.resize(n+1, val);
}
#if CAP_BT
void geometry_information::bshape_bt(floorshape &fsh, int id, int sides, ld size, cell *c) {
sizeto(fsh.b, id);
@ -329,6 +330,7 @@ void geometry_information::bshape_bt(floorshape &fsh, int id, int sides, ld size
}
}
}
#endif
#if CAP_IRR
namespace irr { void generate_floorshapes(); }
@ -378,7 +380,10 @@ void geometry_information::generate_floorshapes_for(int id, cell *c) {
int siid = 0, sidir = 0;
if(arcm::in()) {
if(0) ;
#if CAP_ARCM
else if(arcm::in()) {
if(BITRUNCATED)
siid = arcm::pseudohept(c), sidir = arcm::pseudohept(c) ? 0 : !arcm::pseudohept(c->cmove(0));
else if(geosupport_football() == 2)
@ -386,6 +391,7 @@ void geometry_information::generate_floorshapes_for(int id, cell *c) {
else
siid = 1, sidir = 0;
}
#endif
#if CAP_IRR
else if(IRREGULAR) {
@ -442,10 +448,12 @@ void geometry_information::generate_floorshapes_for(int id, cell *c) {
for(auto pfsh: all_plain_floorshapes) {
auto& fsh = *pfsh;
#if CAP_BT
if(bt::in()) {
bshape_bt(fsh, id, S7, fsh.rad1, c);
continue;
}
#endif
// special
ld sca = 3 * shFullFloor.rad0 / fsh.rad0;

View File

@ -731,7 +731,11 @@ void geometry_information::prepare_basics() {
int s6 = BITRUNCATED ? S3*2 : S3;
vals.emplace_back(S7, unrect ? 0 : BITRUNCATED ? fake::around / 3 : fake::around / 2);
vals.emplace_back(s6, unrect ? fake::around : BITRUNCATED ? fake::around * 2 / 3 : fake::around / 2);
#if CAP_ARCM
ld edgelength = euclid ? 1 : arcm::compute_edgelength(vals);
#else
ld edgelength = 1;
#endif
// circumradius and inradius, for S7 and S6 shapes
auto c7 = asin_auto(sin_auto(edgelength/2) / sin(M_PI / S7));
@ -906,7 +910,9 @@ void geometry_information::prepare_basics() {
}
if(mtwisted && underlying_euclid) {
single_step = 1;
#if CAP_ARCM
if(ug == gArchimedean) plevel = arcm::current_or_fake().dual_tile_area();
#endif
if(ug == gEuclid && PURE) plevel = sqrt(3)/4.;
if(ug == gEuclidSquare && PURE) plevel = 1;
if(ug == gEuclidSquare && BITRUNCATED) plevel = 0.25;

View File

@ -1556,12 +1556,14 @@ EX namespace ccolor {
#define CCO [] (cell *c, data& cco) -> color_t
bool is_mirrored(cell *c) {
#if CAP_ARCM
if(arcm::in()) {
int id = arcm::id_of(c->master);
int tid = arcm::current.tilegroup[id];
int tid2 = arcm::current.tilegroup[id^1];
return (id&1) && (tid != tid2);
}
#endif
if(arb::in()) {
int id = shvid(c);
auto& sh = arb::current.shapes[id];
@ -1671,6 +1673,7 @@ EX namespace ccolor {
CCO { return cco.ctab[patterns::sevenval(c)]; },
{0xC00000, 0xC08000, 0xC0C000, 0x00C000, 0xC0C0, 0x00C0, 0xC000C0});
#if CAP_CRYSTAL
EX data crystal_colors = data("Crystal coordinates", [] { return cryst; },
CCO { return crystal::colorize(c, 'K'); }, {});
@ -1685,6 +1688,7 @@ EX namespace ccolor {
EX data crystal_diagonal = data("Crystal diagonal", [] { return cryst; },
CCO { return crystal::colorize(c, '/'); }, {});
#endif
EX data nil_penrose = data("Nil staircase", [] { return nil; },
CCO { return nilv::colorize(c, '/'); }, {});
@ -1802,7 +1806,10 @@ EX namespace ccolor {
&shape, &shape_mirror,
&threecolor, &football, &chessboard,
&landscape, &landscape_dark, &seven, &randbw, &distance,
&crystal_colors, &crystal_cage, &crystal_hyperplanes, &crystal_honeycomb, &crystal_diagonal, &nil_penrose,
#if CAP_CRYSTAL
&crystal_colors, &crystal_cage, &crystal_hyperplanes, &crystal_honeycomb, &crystal_diagonal,
#endif
&nil_penrose,
&zebra_pattern, &zebra_triangles, &zebra_stripes, &emerald_pattern, &palace_elements, &palace_domains,
#if CAP_FIELD
&field_c, &field_d, &field_n, &field_s,

View File

@ -430,7 +430,7 @@
#endif
#endif
#if !CAP_SDLGFX && !ISFAKEMOBILE
#if !CAP_SDL && !ISFAKEMOBILE
#define SDLK_F1 (123001)
#define SDLK_F2 (123002)
#define SDLK_F3 (123003)