diff --git a/config.cpp b/config.cpp index 6ea6f4d3..6a511d9b 100644 --- a/config.cpp +++ b/config.cpp @@ -176,6 +176,7 @@ void initConfig() { addsaver(geom3::tc_alpha, "3D TC alpha"); addsaver(geom3::highdetail, "3D highdetail"); addsaver(geom3::middetail, "3D middetail"); + addsaver(geom3::gp_autoscale_heights, "3D Goldberg autoscaling"); addsaver(memory_saving_mode, "memory_saving_mode", (ISMOBILE || ISPANDORA || ISWEB) ? 1 : 0); @@ -985,7 +986,7 @@ string explain3D(ld *param) { XLAT( "The height of walls, in absolute units. For the current values of g and c, " "wall height of %1 absolute units corresponds to projection value of %2.", - fts3(wall_height), fts3(factor_to_projection(geom3::WALL))); + fts3(actual_wall_height()), fts3(factor_to_projection(geom3::WALL))); if(param == &rock_wall_ratio) return diff --git a/dialogs.cpp b/dialogs.cpp index cdaba9b9..ec447c0e 100644 --- a/dialogs.cpp +++ b/dialogs.cpp @@ -703,6 +703,9 @@ namespace dialog { if(ne.editwhat == &vid.linewidth) addBoolItem("finer lines at the boundary", vid.antialias & AA_LINEWIDTH, 'o'); + + if(ne.editwhat == &geom3::wall_height) + addBoolItem("auto-adjust in Goldberg grids", geom3::gp_autoscale_heights, 'o'); display(); @@ -758,6 +761,13 @@ namespace dialog { genrange_bonus = sightrange_bonus; doOvergenerate(); } + else if(uni == 'o' && ne.editwhat == &geom3::wall_height) { + geom3::gp_autoscale_heights = !geom3::gp_autoscale_heights; + buildpolys(); + #if CAP_GL + resetGL(); + #endif + } else if(uni == 'O' && ne.editwhat == &ne.intbuf && ne.intval == &sightrange_bonus && allowChangeRange()) { gamerange_bonus = sightrange_bonus; } diff --git a/geometry.cpp b/geometry.cpp index e3d3b65b..4a060ae7 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -193,6 +193,7 @@ namespace geom3 { ld rock_wall_ratio = .9; ld human_wall_ratio = .7; ld human_height; + bool gp_autoscale_heights = true; ld highdetail = 8, middetail = 8; @@ -247,6 +248,12 @@ namespace geom3 { string invalid; + ld actual_wall_height() { + if(gp::on && gp_autoscale_heights) + return wall_height * min(4 * gp::scale, 1); + return wall_height; + } + void compute() { // tanh(depth) / tanh(camera) == vid.alpha invalid = ""; @@ -294,9 +301,10 @@ namespace geom3 { } else { INFDEEP = (euclid || sphere) ? 0.01 : lev_to_projection(0) * tanh(camera); - WALL = lev_to_factor(wall_height); + ld wh = actual_wall_height(); + WALL = lev_to_factor(wh); - human_height = human_wall_ratio * wall_height; + human_height = human_wall_ratio * wh; LEG1 = lev_to_factor(human_height * .1); LEG = lev_to_factor(human_height * .2); @@ -311,13 +319,13 @@ namespace geom3 { ABODY = lev_to_factor(human_height * .4); AHEAD = lev_to_factor(human_height * .6); - BIRD = lev_to_factor((human_wall_ratio+1)/2 * wall_height * .8); + BIRD = lev_to_factor((human_wall_ratio+1)/2 * wh * .8); GHOST = lev_to_factor(human_height * .5); FLATEYE = lev_to_factor(human_height * .15); - slev = rock_wall_ratio * wall_height / 3; + slev = rock_wall_ratio * wh / 3; for(int s=0; s<=3; s++) - SLEV[s] = lev_to_factor(rock_wall_ratio * wall_height * s/3); + SLEV[s] = lev_to_factor(rock_wall_ratio * wh * s/3); LAKE = lev_to_factor(-lake_top); HELLSPIKE = lev_to_factor(-(lake_top+lake_bottom)/2); BOTTOM = lev_to_factor(-lake_bottom); diff --git a/graph.cpp b/graph.cpp index 764c7961..5fb13b6a 100644 --- a/graph.cpp +++ b/graph.cpp @@ -3169,7 +3169,7 @@ void escherSidewall(cell *c, int sidepar, const transmatrix& V, int col) { else if(sidepar == SIDE_WALL) { const int layers = 2 << detaillevel; for(int z=1; z ds(qfi.shape, &shCircleFloor); dynamicval db(qfi.special, true); for(int z=1; z