]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an option to use the viewlocation first position's angles for the viewing angle...
authorMario <mario@smbclan.net>
Mon, 22 Jan 2018 20:17:33 +0000 (06:17 +1000)
committerMario <mario@smbclan.net>
Mon, 22 Jan 2018 20:17:33 +0000 (06:17 +1000)
qcsrc/common/viewloc.qc

index fd7937b5208d7f9dbd2f9aa9afcb2f99bacd99ad..5f5fe8b9fdd6f4bb512a66287b31acf76e949919 100644 (file)
@@ -86,6 +86,7 @@ bool autocvar_cam_snap_close;
 bool autocvar_cam_track;
 bool autocvar_cam_snap_hard;
 bool autocvar_cam_snap_unlock;
+bool autocvar_cam_useangle = true;
 void viewloc_SetViewLocation()
 {
        entity view = CSQCModel_server2csqc(player_localentnum - 1);
@@ -103,6 +104,10 @@ void viewloc_SetViewLocation()
                 * basically the player would move around in a small "box" in the center of the screen with out changing the camera position or angles */
                camera_position = vec_bounds_in(view.origin, position_a, position_b);
 
+               // use camera's angle when possible
+               if (autocvar_cam_useangle) {
+                       camera_angle = view.viewloc.enemy.movedir;
+               }
 
                // a tracking camera follows the player when it leaves the world box
                if (autocvar_cam_track || !have_sidescroll) {
@@ -121,7 +126,7 @@ void viewloc_SetViewLocation()
 
                        /* if the difference between the old and new angle is 60 degrees or more, switch angles.
                         * NOTE: bug/feature: this will use non-snaped angles for one frame.
-                        * doing this resualts in less code, faster code, and a smoother transisition between angles.
+                        * doing this results in less code, faster code, and a smoother transisition between angles.
                         */
                        float camera_angle_diff = max(camera_angle.y, old_camera_angle.y) - min(camera_angle.y, old_camera_angle.y);