1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

nilv:: geodesic sightrange

This commit is contained in:
Zeno Rogue 2019-08-06 21:01:00 +02:00
parent 1eacccd587
commit e62a3c0d8e
2 changed files with 9 additions and 8 deletions

View File

@ -708,7 +708,7 @@ void edit_sightrange() {
} }
else if(WDIM == 3) { else if(WDIM == 3) {
dialog::editNumber(sightranges[geometry], 0, 2 * M_PI, 0.5, M_PI, XLAT("3D sight range"), dialog::editNumber(sightranges[geometry], 0, 2 * M_PI, 0.5, M_PI, XLAT("3D sight range"),
pmodel == mdGeodesic ? solhelp() : XLAT( (pmodel == mdGeodesic && sol) ? solhelp() : XLAT(
"Sight range for 3D geometries is specified in the absolute units. This value also affects the fog effect.\n\n" "Sight range for 3D geometries is specified in the absolute units. This value also affects the fog effect.\n\n"
"In spherical geometries, the sight range of 2? will let you see things behind you as if they were in front of you, " "In spherical geometries, the sight range of 2? will let you see things behind you as if they were in front of you, "
"and the sight range of ? (or more) will let you see things on the antipodal point just as if they were close to you.\n\n" "and the sight range of ? (or more) will let you see things on the antipodal point just as if they were close to you.\n\n"
@ -728,7 +728,7 @@ void edit_sightrange() {
dialog::bound_up(allowIncreasedSight() ? euclid ? 99 : gp::dist_2() * 5 : 0); dialog::bound_up(allowIncreasedSight() ? euclid ? 99 : gp::dist_2() * 5 : 0);
} }
dialog::extra_options = [] () { dialog::extra_options = [] () {
if(pmodel == mdGeodesic) { if(pmodel == mdGeodesic && sol) {
dialog::addSelItem(XLAT("fog effect"), fts(sightranges[geometry]), 'R'); dialog::addSelItem(XLAT("fog effect"), fts(sightranges[geometry]), 'R');
dialog::add_action([] { dialog::add_action([] {
auto xo = dialog::extra_options; auto xo = dialog::extra_options;
@ -798,7 +798,7 @@ void edit_sightrange() {
void menuitem_sightrange(char c) { void menuitem_sightrange(char c) {
if(vid.use_smart_range) if(vid.use_smart_range)
dialog::addSelItem(XLAT("minimum visible cell in pixels"), fts(WDIM == 3 ? vid.smart_range_detail_3 : vid.smart_range_detail), c); dialog::addSelItem(XLAT("minimum visible cell in pixels"), fts(WDIM == 3 ? vid.smart_range_detail_3 : vid.smart_range_detail), c);
else if(pmodel == mdGeodesic) else if(pmodel == mdGeodesic && sol)
dialog::addSelItem(XLAT("3D sight range"), fts(solv::solrange_xy) + "x" + fts(solv::solrange_z), c); dialog::addSelItem(XLAT("3D sight range"), fts(solv::solrange_xy) + "x" + fts(solv::solrange_z), c);
else if(WDIM == 3) else if(WDIM == 3)
dialog::addSelItem(XLAT("3D sight range"), fts(sightranges[geometry]), c); dialog::addSelItem(XLAT("3D sight range"), fts(sightranges[geometry]), c);

View File

@ -910,7 +910,7 @@ bool invalid_point(const hyperpoint h) {
bool in_smart_range(const transmatrix& T) { bool in_smart_range(const transmatrix& T) {
hyperpoint h = tC0(T); hyperpoint h = tC0(T);
if(invalid_point(h)) return false; if(invalid_point(h)) return false;
if(nil) return cells_drawn < 2000; if(nil) return true;
if(pmodel == mdGeodesic) return solv::in_table_range(h); if(pmodel == mdGeodesic) return solv::in_table_range(h);
hyperpoint h1; hyperpoint h1;
applymodel(h, h1); applymodel(h, h1);
@ -1880,11 +1880,12 @@ bool do_draw(cell *c, const transmatrix& T) {
PROD( if(product::pmap) return product::in_actual([&] { return do_draw(product::get_at(c, product::plevel), T); }); ) PROD( if(product::pmap) return product::in_actual([&] { return do_draw(product::get_at(c, product::plevel), T); }); )
if(WDIM == 3) { if(WDIM == 3) {
if(cells_drawn > vid.cells_drawn_limit) return false; if(cells_drawn > vid.cells_drawn_limit) return false;
if(pmodel == mdGeodesic) { if(nil && pmodel == mdGeodesic) {
if(!nisot::in_table_range(tC0(T))) return false; ld dist = hdist0(nisot::inverse_exp(tC0(T), nisot::iLazy));
if(!limited_generation(c)) return false; if(dist > sightranges[geometry] + (vid.sloppy_3d ? 0 : 0.9)) return false;
if(dist <= extra_generation_distance && !limited_generation(c)) return false;
} }
else if(nil) { else if(pmodel == mdGeodesic && !nil) {
if(!nisot::in_table_range(tC0(T))) return false; if(!nisot::in_table_range(tC0(T))) return false;
if(!limited_generation(c)) return false; if(!limited_generation(c)) return false;
} }