From 33ea63c70862db215168823eb62b154fd90cb1df Mon Sep 17 00:00:00 2001
From: luiscuenca <luiscuenca@outboxcode.com>
Date: Thu, 17 Oct 2019 15:06:12 -0700
Subject: [PATCH] Fix warnings and update controls

---
 .../resources/controllers/keyboardMouse.json  | 31 ++++++++++++++++++-
 interface/src/Application.cpp                 |  2 +-
 .../src/avatars-renderer/Avatar.cpp           |  4 +--
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/interface/resources/controllers/keyboardMouse.json b/interface/resources/controllers/keyboardMouse.json
index eb07c9a6dd..d6ecc540c2 100644
--- a/interface/resources/controllers/keyboardMouse.json
+++ b/interface/resources/controllers/keyboardMouse.json
@@ -78,6 +78,15 @@
           "to": "Actions.Yaw"
         },
 
+        { "from": { "makeAxis" : [
+                ["Keyboard.Left"],
+                ["Keyboard.Right"]
+             ]
+          },
+          "when": ["Application.CameraFirstPersonLookat", "!Keyboard.Shift"],
+          "to": "Actions.Yaw"
+        },
+
         { "from": { "makeAxis" : [
                 ["Keyboard.Left"],
                 ["Keyboard.Right"]
@@ -113,7 +122,16 @@
           "when": ["Application.CameraFirstPerson", "!Keyboard.Control"],
           "to": "Actions.Yaw"
         },
-        
+
+        { "from": { "makeAxis" : [
+                ["Keyboard.A"],
+                ["Keyboard.D"]
+            ]
+          },
+          "when": ["Application.CameraFirstPersonLookat", "!Keyboard.Control"],
+          "to": "Actions.Yaw"
+        },
+
         { "from": { "makeAxis" : [
                 ["Keyboard.A"],
                 ["Keyboard.D"]
@@ -149,6 +167,15 @@
           "when": "Application.CameraFirstPerson",
           "to": "Actions.Yaw"
         },
+
+        { "from": { "makeAxis" : [
+                ["Keyboard.TouchpadLeft"],
+                ["Keyboard.TouchpadRight"]
+            ]
+          },
+          "when": "Application.CameraFirstPersonLookat",
+          "to": "Actions.Yaw"
+        },
         
         { "from": { "makeAxis" : [
                 ["Keyboard.TouchpadLeft"],
@@ -222,10 +249,12 @@
         { "from": "Keyboard.Left", "when": "Keyboard.Shift", "to": "Actions.LATERAL_LEFT" },
         { "from": "Keyboard.Right", "when": "Keyboard.Shift", "to": "Actions.LATERAL_RIGHT" },
         { "from": "Keyboard.Up", "when": "Application.CameraFirstPerson", "to": "Actions.LONGITUDINAL_FORWARD" },
+        { "from": "Keyboard.Up", "when": "Application.CameraFirstPersonLookat", "to": "Actions.LONGITUDINAL_FORWARD" },
         { "from": "Keyboard.Up", "when": "Application.CameraThirdPerson", "to": "Actions.LONGITUDINAL_FORWARD" },
         { "from": "Keyboard.Up", "when": "Application.CameraLookAt", "to": "Actions.LONGITUDINAL_FORWARD" },
         { "from": "Keyboard.Up", "when": "Application.CameraSelfie", "to": "Actions.LONGITUDINAL_BACKWARD" },
         { "from": "Keyboard.Down", "when": "Application.CameraFirstPerson", "to": "Actions.LONGITUDINAL_BACKWARD" },
+        { "from": "Keyboard.Down", "when": "Application.CameraFirstPersonLookat", "to": "Actions.LONGITUDINAL_BACKWARD" },
         { "from": "Keyboard.Down", "when": "Application.CameraThirdPerson", "to": "Actions.LONGITUDINAL_BACKWARD" },
         { "from": "Keyboard.Down", "when": "Application.CameraLookAt", "to": "Actions.LONGITUDINAL_BACKWARD" },
         { "from": "Keyboard.Down", "when": "Application.CameraSelfie", "to": "Actions.LONGITUDINAL_FORWARD" },
diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp
index d11c1ac5e0..994c9c7fd3 100644
--- a/interface/src/Application.cpp
+++ b/interface/src/Application.cpp
@@ -717,7 +717,7 @@ private:
 
 static const QString STATE_IN_HMD = "InHMD";
 static const QString STATE_CAMERA_FULL_SCREEN_MIRROR = "CameraFSM";
-static const QString STATE_CAMERA_FIRST_PERSON = "CameraFirstPersonLegacy";
+static const QString STATE_CAMERA_FIRST_PERSON = "CameraFirstPerson";
 static const QString STATE_CAMERA_FIRST_PERSON_LOOK_AT = "CameraFirstPersonLookat";
 static const QString STATE_CAMERA_THIRD_PERSON = "CameraThirdPerson";
 static const QString STATE_CAMERA_ENTITY = "CameraEntity";
diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp
index d6db75180d..bea9f979b8 100644
--- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp
+++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp
@@ -854,8 +854,8 @@ void Avatar::render(RenderArgs* renderArgs) {
         float distanceToTarget = glm::length(toTarget);
         const float DISPLAYNAME_DISTANCE = 20.0f;
         updateDisplayNameAlpha(distanceToTarget < DISPLAYNAME_DISTANCE);
-        if (!isMyAvatar() || renderArgs->_cameraMode != (int8_t)CAMERA_MODE_FIRST_PERSON_LOOK_AT
-                          || renderArgs->_cameraMode != (int8_t)CAMERA_MODE_FIRST_PERSON) {
+        if (!isMyAvatar() || !(renderArgs->_cameraMode == (int8_t)CAMERA_MODE_FIRST_PERSON_LOOK_AT
+                          || renderArgs->_cameraMode == (int8_t)CAMERA_MODE_FIRST_PERSON)) {
             auto& frustum = renderArgs->getViewFrustum();
             auto textPosition = getDisplayNamePosition();
             if (frustum.pointIntersectsFrustum(textPosition)) {