mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-24 06:50:09 +00:00
more guards added
This commit is contained in:
parent
3e81697164
commit
8760ac4cfb
@ -1372,7 +1372,9 @@ EX bool horo_ok() {
|
||||
if(INVERSE) return false;
|
||||
if(hat::in()) return false;
|
||||
if(currentmap->strict_tree_rules()) return true;
|
||||
#if MAXMDIM >= 4
|
||||
if(reg3::in_hrmap_h3() && !PURE) return false;
|
||||
#endif
|
||||
return mhyperbolic && !bt::in() && !arcm::in() && !kite::in() && !experimental && !mhybrid && !arb::in() && !quotient;
|
||||
}
|
||||
|
||||
|
@ -2475,9 +2475,11 @@ EX void show3D_height_details() {
|
||||
add_edit(vid.infdeep_height);
|
||||
add_edit(vid.sun_size);
|
||||
add_edit(vid.star_size);
|
||||
#if MAXMDIM >= 4
|
||||
add_edit(star_prob);
|
||||
add_edit(vid.height_limits);
|
||||
if(euclid && msphere) add_edit(use_euclidean_infinity);
|
||||
#endif
|
||||
|
||||
dialog::addBreak(100);
|
||||
dialog::addHelp(lalign(0, "absolute altitudes:\n\n"
|
||||
@ -2721,10 +2723,12 @@ EX int config3 = addHook(hooks_configfile, 100, [] {
|
||||
param_b(numerical_minefield, "numerical_minefield")
|
||||
->editable("display mine counts numerically", 'n');
|
||||
param_b(dont_display_minecount, "dont_display_minecount");
|
||||
#if MAXMDIM >= 4
|
||||
param_enum(draw_sky, "draw_sky", "draw_sky", skyAutomatic)
|
||||
-> editable({{"NO", "do not draw sky"}, {"automatic", ""}, {"skybox", "works only in Euclidean"}, {"always", "might be glitched in some settings"}}, "sky rendering", 's');
|
||||
param_b(use_euclidean_infinity, "use_euclidean_infinity", true)
|
||||
-> editable("infinite sky", 'i');
|
||||
#endif
|
||||
param_f(linepatterns::parallel_count, "parallel_count")
|
||||
->editable(0, 24, 1, "number of parallels drawn", "", 'n');
|
||||
param_f(linepatterns::parallel_max, "parallel_max")
|
||||
@ -2863,10 +2867,12 @@ EX int config3 = addHook(hooks_configfile, 100, [] {
|
||||
"the sky height, which might be beyond the range visible in fog. To prevent this, "
|
||||
"the intensity of the fog effect depends on the value here rather than the actual distance. "
|
||||
"Stars are affected similarly.", '4');
|
||||
#if MAXMDIM >= 3
|
||||
param_fd(vid.sky_height, "sky_height")
|
||||
->set_hint([] { return geom3::to_wh(cgi.SKY); })
|
||||
->editable(0, 10, .1, "altitude of the sky", unitwarn, '5')
|
||||
->set_reaction(delete_sky);
|
||||
#endif
|
||||
param_fd(vid.star_height, "star_height")
|
||||
->set_hint([] { return geom3::to_wh(cgi.STAR); })
|
||||
->editable(0, 10, .1, "altitude of the stars", unitwarn, '6');
|
||||
@ -2877,8 +2883,10 @@ EX int config3 = addHook(hooks_configfile, 100, [] {
|
||||
->editable(0, 10, .1, "sun size (relative to item sizes)", "", '8');
|
||||
param_f(vid.star_size, "star_size", "star_size", 0.75)
|
||||
->editable(0, 10, .1, "night star size (relative to item sizes)", "", '9');
|
||||
#if MAXMDIM >= 4
|
||||
param_f(star_prob, "star_prob", 0.3)
|
||||
->editable(0, 1, .01, "star probability", "probability of star per tile", '*');
|
||||
#endif
|
||||
param_b(vid.height_limits, "height_limits", true)
|
||||
->editable("prevent exceeding recommended altitudes", 'l');
|
||||
param_b(auto_remove_roofs, "auto_remove_roofs", true)
|
||||
|
@ -1295,6 +1295,7 @@ void embedding_method::auto_configure() {
|
||||
}
|
||||
|
||||
EX void invoke_embed(geom3::eSpatialEmbedding se) {
|
||||
#if MAXMDIM >= 4
|
||||
if(GDIM == 3) { if(geom3::auto_configure) geom3::switch_fpp(); else geom3::switch_always3(); }
|
||||
if(in_tpp()) geom3::switch_tpp();
|
||||
if(se != geom3::seNone) {
|
||||
@ -1303,6 +1304,7 @@ EX void invoke_embed(geom3::eSpatialEmbedding se) {
|
||||
delete_sky();
|
||||
if(vid.usingGL) resetGL();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
geom3::eSpatialEmbedding embed_by_name(string ss) {
|
||||
|
@ -113,8 +113,8 @@ void expansion_analyzer::preliminary_grouping() {
|
||||
for(int v: rulegen::treestates[i].rules)
|
||||
if(v >= 0) children[i].push_back(v);
|
||||
}
|
||||
else if(reg3::exact_rules()) {
|
||||
#if MAXMDIM >= 4
|
||||
else if(reg3::exact_rules()) {
|
||||
rootid = reg3::rule_get_root(0);
|
||||
auto& chi = reg3::rule_get_children();
|
||||
auto& chpos = reg3::rule_get_childpos();
|
||||
@ -128,8 +128,8 @@ void expansion_analyzer::preliminary_grouping() {
|
||||
children[i].push_back(ck);
|
||||
k++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
sample_id(currentmap->gamestart());
|
||||
// queue for, do not change to range-based for
|
||||
@ -145,7 +145,9 @@ void expansion_analyzer::preliminary_grouping() {
|
||||
}
|
||||
|
||||
void expansion_analyzer::reduce_grouping() {
|
||||
#if MAXMDIM >= 4
|
||||
if(reg3::exact_rules()) return;
|
||||
#endif
|
||||
if(currentmap->strict_tree_rules()) return;
|
||||
int old_N = N;
|
||||
vector<int> grouping;
|
||||
@ -239,7 +241,11 @@ bool expansion_analyzer::verify(int id) {
|
||||
|
||||
int expansion_analyzer::valid(int v, int step) {
|
||||
if(step < 0) return 0;
|
||||
#if MAXMDIM >= 4
|
||||
int more = 5;
|
||||
#else
|
||||
int more = reg3::exact_rules() ? 1 : 5;
|
||||
#endif
|
||||
#if CAP_GMP == 0
|
||||
if(get_descendants(step+v+v+more).approx_int() >= bignum::BASE) return 0;
|
||||
typedef ld val;
|
||||
@ -392,7 +398,9 @@ int type_in_quick(expansion_analyzer& ea, cell *c, const cellfunction& f) {
|
||||
}
|
||||
|
||||
EX bool sizes_known() {
|
||||
#if MAXMDIM >= 4
|
||||
if(reg3::exact_rules()) return true;
|
||||
#endif
|
||||
if(closed_manifold) return false;
|
||||
// Castle Anthrax is infinite
|
||||
if(bt::in()) return false;
|
||||
|
@ -1175,7 +1175,9 @@ EX namespace geom3 {
|
||||
if(vid.always3) {
|
||||
changing_embedded_settings = true;
|
||||
geom3::switch_fpp();
|
||||
#if MAXMDIM >= 4
|
||||
delete_sky();
|
||||
#endif
|
||||
// not sure why this is needed...
|
||||
resetGL();
|
||||
geom3::switch_fpp();
|
||||
@ -1183,6 +1185,7 @@ EX namespace geom3 {
|
||||
}
|
||||
}
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
EX void apply_settings_light() {
|
||||
if(vid.always3) {
|
||||
changing_embedded_settings = true;
|
||||
@ -1191,6 +1194,7 @@ EX namespace geom3 {
|
||||
changing_embedded_settings = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
EX }
|
||||
|
||||
|
2
reg3.cpp
2
reg3.cpp
@ -2907,6 +2907,8 @@ EX }
|
||||
EX namespace reg3 {
|
||||
EX bool in() { return false; }
|
||||
EX bool in_rule() { return false; }
|
||||
EX bool cubes_reg3;
|
||||
EX bool exact_rules() { return false; }
|
||||
EX }
|
||||
#endif
|
||||
|
||||
|
25
rulegen.cpp
25
rulegen.cpp
@ -199,25 +199,33 @@ EX int less_states;
|
||||
|
||||
EX int number_of_types() {
|
||||
if(arb::in() || WDIM == 2) return isize(arb::current.shapes);
|
||||
#if CAP_MAXMDIM >= 4
|
||||
if(WDIM == 3) return gcd(reg3::quotient_count_sub(), less_states);
|
||||
#endif
|
||||
throw hr_exception("unknown number_of_types");
|
||||
}
|
||||
|
||||
EX int get_id(cell *c) {
|
||||
if(arb::in() || WDIM == 2) return shvid(c);
|
||||
#if CAP_MAXMDIM >= 4
|
||||
if(WDIM == 3) return zgmod(reg3::get_aid(c), less_states);
|
||||
#endif
|
||||
throw hr_exception("unknown get_id");
|
||||
}
|
||||
|
||||
int shape_size(int id) {
|
||||
if(arb::in() || WDIM == 2) return isize(arb::current.shapes[id].connections);
|
||||
#if CAP_MAXMDIM >= 4
|
||||
if(WDIM == 3) return reg3::get_size_of_aid(id);
|
||||
#endif
|
||||
throw hr_exception("unknown shape_size");
|
||||
}
|
||||
|
||||
int cycle_size(int id) {
|
||||
if(arb::in() || WDIM == 2) return arb::current.shapes[id].cycle_length;
|
||||
#if CAP_MAXMDIM >= 4
|
||||
if(WDIM == 3) return reg3::get_size_of_aid(id);
|
||||
#endif
|
||||
throw hr_exception("unknown shape size");
|
||||
}
|
||||
|
||||
@ -1321,10 +1329,12 @@ EX int move_code(twalker cs) {
|
||||
be_solid(cs.at); ufind(cs); ufind(cs2); be_solid(cs2.at);
|
||||
fix_distances(cs.at);
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
if(WDIM == 3) {
|
||||
if(cs2.at->parent_dir == cs2.spin) return C_PARENT;
|
||||
else return get_roadsign(cs+wstep);
|
||||
}
|
||||
#endif
|
||||
|
||||
int y = cs.at->dist - cs.peek()->dist;
|
||||
int x;
|
||||
@ -1461,8 +1471,10 @@ vector<int> gen_rule(twalker cwmain, int id) {
|
||||
if(WDIM != 3) for(int i=0; i<isize(cids); i++) if(cids[i] == DIR_UNKNOWN)
|
||||
cids[i] = get_side(cwmain+i) < 0 ? DIR_RIGHT : DIR_LEFT;
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
if(WDIM == 3) for(int i=0; i<isize(cids); i++) if(cids[i] == DIR_UNKNOWN)
|
||||
cids[i] = get_roadsign(cwmain+i);
|
||||
#endif
|
||||
|
||||
return cids;
|
||||
}
|
||||
@ -2035,12 +2047,14 @@ EX void rules_iteration() {
|
||||
if(isize(important) != N)
|
||||
throw rulegen_retry("need more rules after examine");
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
if(WDIM == 3) {
|
||||
check_road_shortcuts();
|
||||
optimize();
|
||||
N = isize(important);
|
||||
check_validity_3d();
|
||||
}
|
||||
#endif
|
||||
|
||||
if(skipped_branches.size()) {
|
||||
checks_to_skip.clear();
|
||||
@ -2076,7 +2090,9 @@ EX void cleanup() {
|
||||
important.clear();
|
||||
shortcuts.clear();
|
||||
single_live_branch_close_to_root.clear();
|
||||
#if MAXMDIM >= 4
|
||||
cleanup3();
|
||||
#endif
|
||||
}
|
||||
|
||||
EX void clear_all() {
|
||||
@ -2098,6 +2114,7 @@ EX void generate_rules() {
|
||||
start_time = SDL_GetTicks();
|
||||
delete_tmap();
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
if(WDIM == 3 && reg3::in_hrmap_rule_or_subrule()) {
|
||||
stop_game();
|
||||
reg3::consider_rules = 0;
|
||||
@ -2107,7 +2124,9 @@ EX void generate_rules() {
|
||||
else if(WDIM == 3) {
|
||||
flags |= w_numerical;
|
||||
}
|
||||
else if(!arb::in()) try {
|
||||
else
|
||||
#endif
|
||||
if(!arb::in()) try {
|
||||
arb::convert::convert();
|
||||
if(flags & w_numerical) arb::convert::activate();
|
||||
}
|
||||
@ -2166,7 +2185,9 @@ EX void generate_rules() {
|
||||
t_origin.push_back(twalker(c, 0));
|
||||
}
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
if(GDIM == 3) build_cycle_data();
|
||||
#endif
|
||||
|
||||
bfs_queue = queue<tcell*>();
|
||||
if(flags & w_bfs) for(auto c: t_origin) bfs_queue.push(c.at);
|
||||
@ -2486,10 +2507,12 @@ auto hooks = addHook(hooks_configfile, 100, [] {
|
||||
param_i(max_shortcut_length, "max_shortcut_length");
|
||||
param_i(rulegen_timeout, "rulegen_timeout");
|
||||
param_i(first_restart_on, "first_restart_on");
|
||||
#if MAXMDIM >= 4
|
||||
param_i(max_ignore_level_pre, "max_ignore_level_pre");
|
||||
param_i(max_ignore_level_post, "max_ignore_level_post");
|
||||
param_i(max_ignore_time_pre, "max_ignore_time_pre");
|
||||
param_i(max_ignore_time_post, "max_ignore_time_post");
|
||||
#endif
|
||||
});
|
||||
|
||||
EX void parse_treestate(arb::arbi_tiling& c, exp_parser& ep) {
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
namespace hr {
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
EX namespace rulegen {
|
||||
|
||||
struct road_shortcut_trie_vertex {
|
||||
@ -1757,6 +1758,7 @@ int readRuleArgs3() {
|
||||
auto hook3 = addHook(hooks_args, 100, readRuleArgs3);
|
||||
#endif
|
||||
|
||||
}
|
||||
EX }
|
||||
#endif
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user