diff --git a/control.cpp b/control.cpp index 97dc9b26..d859792b 100644 --- a/control.cpp +++ b/control.cpp @@ -392,11 +392,17 @@ EX void full_rotate_camera(int dir, ld val) { else if(GDIM == 3) { val *= camera_rot_speed; if(third_person_rotation) shift_view(ctangent(2, -third_person_rotation)), didsomething = true, playermoved = false; - if(keep_vertical()) { + ld max_angle = quarter_circle - 1e-4; + if(walking::on && dir == 1) { + max_angle /= degree; + walking::eye_angle += val * walking::eye_angle_scale / degree; + if(walking::eye_angle > max_angle) walking::eye_angle = max_angle; + if(walking::eye_angle < -max_angle) walking::eye_angle = -max_angle; + } + else if(keep_vertical()) { hyperpoint vv = vertical_vector(); ld alpha = -atan2(vv[2], vv[1]); rotate_view(cspin(2, 1, alpha)); - ld max_angle = quarter_circle - 1e-4; if(dir == 1 && alpha + val > max_angle) val = max_angle - alpha; if(dir == 1 && alpha + val < -max_angle) diff --git a/intra.cpp b/intra.cpp index ec417d61..8269ac5f 100644 --- a/intra.cpp +++ b/intra.cpp @@ -139,8 +139,8 @@ hyperpoint portal_data::from_poco(hyperpoint h) const { } EX portal_data make_portal(cellwalker cw, int spin) { - if(debug_portal & 33) - println(hlog, "working in: ", full_geometry_name()); + if(debug_portal & 289) + println(hlog, "working in: ", full_geometry_name(), " wall no ", cw.spin, "/", cw.at->type); auto& ss = currentmap->get_cellshape(cw.at); auto fac = ss.faces_local[cw.spin]; portal_data id; @@ -261,6 +261,23 @@ EX portal_data make_portal(cellwalker cw, int spin) { println(hlog, "chosen edge is ", first, "--", second); } + if(debug_portal & 256) { + println(hlog, "portal scale = ", id.scale); + auto res = [&] (ld x, ld y, ld z) { + hyperpoint h = hyperpoint(x, y, z, 1); + return id.from_poco(h); + }; + for(int x=0; x<5; x++) { + println(hlog, "horizontal ", x, " = ", hdist(res(x*.1,0,0), res(x*.1+.001,0,0))); + println(hlog, "vertical ", x, " = ", hdist(res(x*.1,0,0), res(x*.1,0.001,0))); + println(hlog, "deep ", x, " = ", hdist(res(x*.1,0,0), res(x*.1,0,0.001))); + } + hyperpoint a = hyperpoint(.4, .2, .1, 1); + println(hlog, "a = ", a); + println(hlog, "b = ", id.from_poco(a)); + println(hlog, "c = ", id.to_poco(id.from_poco(a))); + } + if(debug_portal & 1) { for(auto p: fac) { auto p2 = id.to_poco(p);