From 8220611718f6d8f2f521435bf300f271eb2595bb Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 30 Nov 2021 20:56:36 +0100 Subject: [PATCH] third_person_rotation --- config.cpp | 1 + control.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/config.cpp b/config.cpp index 9ed7edb6..63d22d76 100644 --- a/config.cpp +++ b/config.cpp @@ -1043,6 +1043,7 @@ EX void initConfig() { param_f(camera_speed, "camspd", "camera-speed", 1); param_f(camera_rot_speed, "camrot", "camera-rot-speed", 1); + param_f(third_person_rotation, "third_person_rotation", 0); param_f(panini_alpha, "panini_alpha", 0); param_f(stereo_alpha, "stereo_alpha", 0); diff --git a/control.cpp b/control.cpp index 20c2a799..97dc9b26 100644 --- a/control.cpp +++ b/control.cpp @@ -364,6 +364,8 @@ EX void full_strafe_camera(ld t) { } } +EX ld third_person_rotation = 0; + EX void full_rotate_camera(int dir, ld val) { if(rug::rug_control() && lshiftclick) { val *= camera_rot_speed; @@ -389,6 +391,7 @@ EX void full_rotate_camera(int dir, ld val) { #endif 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()) { hyperpoint vv = vertical_vector(); ld alpha = -atan2(vv[2], vv[1]); @@ -403,6 +406,7 @@ EX void full_rotate_camera(int dir, ld val) { } else rotate_view(cspin(dir, 2, val)); + if(third_person_rotation) shift_view(ctangent(2, third_person_rotation)); if(!rug::rug_control()) didsomething = true; } else