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

auto-adjusted plevel

This commit is contained in:
Zeno Rogue 2019-08-18 21:16:27 +02:00
parent da87291ea4
commit ecfef817a9
5 changed files with 12 additions and 7 deletions

View File

@ -442,6 +442,8 @@ EX void initConfig() {
addsaver(vid.collignon_parameter, "collignon-parameter", 1); addsaver(vid.collignon_parameter, "collignon-parameter", 1);
addsaver(vid.collignon_reflected, "collignon-reflect", false); addsaver(vid.collignon_reflected, "collignon-reflect", false);
addsaver(vid.plevel_factor, "plevel_factor", 1);
addsaver(vid.creature_scale, "3d-creaturescale", 1); addsaver(vid.creature_scale, "3d-creaturescale", 1);
addsaver(vid.height_width, "3d-heightwidth", 1.5); addsaver(vid.height_width, "3d-heightwidth", 1.5);

View File

@ -121,6 +121,8 @@ struct geometry_information {
ld asteroid_size[8]; ld asteroid_size[8];
ld wormscale; ld wormscale;
ld tentacle_length; ld tentacle_length;
/** level in product geometries */
ld plevel;
/** various parameters related to the 3D view */ /** various parameters related to the 3D view */
ld INFDEEP, BOTTOM, HELLSPIKE, LAKE, WALL, FLOOR, STUFF, ld INFDEEP, BOTTOM, HELLSPIKE, LAKE, WALL, FLOOR, STUFF,
@ -553,6 +555,8 @@ void geometry_information::prepare_basics() {
floorrad1 = rhexf * (GDIM == 3 ? 1 : .8); floorrad1 = rhexf * (GDIM == 3 ? 1 : .8);
} }
plevel = vid.plevel_factor * scalefactor;
set_sibling_limit(); set_sibling_limit();
prepare_compute3(); prepare_compute3();

View File

@ -319,6 +319,7 @@ struct videopar {
bool auto_eye; bool auto_eye;
ld collignon_parameter; bool collignon_reflected; ld collignon_parameter; bool collignon_reflected;
ld plevel_factor;
}; };
extern videopar vid; extern videopar vid;

View File

@ -1379,8 +1379,8 @@ EX void optimizeview() {
ld z = zlevel(tC0(View)); ld z = zlevel(tC0(View));
View = mscale(View, -z); View = mscale(View, -z);
product::in_underlying_map(optimizeview); product::in_underlying_map(optimizeview);
if(z > product::plevel / 2) { product::current_view_level--; z -= product::plevel; } if(z > cgi.plevel / 2) { product::current_view_level--; z -= cgi.plevel; }
if(z < -product::plevel / 2) { product::current_view_level++; z += product::plevel; } if(z < -cgi.plevel / 2) { product::current_view_level++; z += cgi.plevel; }
View = mscale(View, z); View = mscale(View, z);
return; return;
} }

View File

@ -557,8 +557,6 @@ EX namespace product {
pmodel = mdPerspective; pmodel = mdPerspective;
} }
EX ld plevel = 1;
EX int current_view_level; EX int current_view_level;
hrmap *pmap; hrmap *pmap;
@ -599,7 +597,7 @@ EX namespace product {
cell* gamestart() override { return getCell(underlying_map->gamestart(), 0); } cell* gamestart() override { return getCell(underlying_map->gamestart(), 0); }
transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& point_hint) override { transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& point_hint) override {
return in_underlying([&] { return calc_relative_matrix(where[c2].first, where[c1].first, point_hint); }) * mscale(Id, plevel * (where[c2].second - where[c1].second)); return in_underlying([&] { return calc_relative_matrix(where[c2].first, where[c1].first, point_hint); }) * mscale(Id, cgi.plevel * (where[c2].second - where[c1].second));
} }
hrmap_product() { hrmap_product() {
@ -619,7 +617,7 @@ EX namespace product {
void drawcell_stack(cell *c, transmatrix V, int spinv, bool mirrored) { void drawcell_stack(cell *c, transmatrix V, int spinv, bool mirrored) {
if(sphere) gmatrix[c] = V; /* some computations need gmatrix0 for underlying geometry */ if(sphere) gmatrix[c] = V; /* some computations need gmatrix0 for underlying geometry */
in_actual([&] { for(int z=-5; z<=5; z++) drawcell(get_at(c, current_view_level+z), V * mscale(Id, plevel * z), spinv, mirrored); }); in_actual([&] { for(int z=-5; z<=5; z++) drawcell(get_at(c, current_view_level+z), V * mscale(Id, cgi.plevel * z), spinv, mirrored); });
} }
void find_cell_connection(cell *c, int d) { void find_cell_connection(cell *c, int d) {
@ -639,7 +637,7 @@ EX namespace product {
EX hyperpoint get_corner(cell *c, int i, ld z) { EX hyperpoint get_corner(cell *c, int i, ld z) {
dynamicval<eGeometry> g(geometry, underlying); dynamicval<eGeometry> g(geometry, underlying);
dynamicval<geometry_information*> gc(cgip, underlying_cgip); dynamicval<geometry_information*> gc(cgip, underlying_cgip);
return mscale(get_corner_position(c, i), exp(plevel * z/2)); return mscale(get_corner_position(c, i), exp(cgi.plevel * z/2));
} }
EX int wall_offset(cell *c) { EX int wall_offset(cell *c) {