1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-10-31 19:36:16 +00:00

intra:: extra debug

This commit is contained in:
Zeno Rogue 2022-02-26 10:37:18 +01:00
parent 822c77b302
commit cfaa52cf42
2 changed files with 27 additions and 4 deletions

View File

@ -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)

View File

@ -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);