]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/camwindow.cpp
if a font was not found, fall back to fixed or courier new - should fix "missing...
[xonotic/netradiant.git] / radiant / camwindow.cpp
index b89e5447e77e6a66c040eb16c8128e726c81fdfd..f1566abd310b8130301081df2ae9279fce59e7da 100644 (file)
@@ -82,6 +82,7 @@ struct camwindow_globals_private_t
   bool m_bCamDiscrete;
   bool m_bCubicClipping;
   bool m_showStats;
+  int m_nStrafeMode;
 
   camwindow_globals_private_t() :
     m_nMoveSpeed(100),
@@ -90,7 +91,8 @@ struct camwindow_globals_private_t
     m_bCamInverseMouse(false),
     m_bCamDiscrete(true),
     m_bCubicClipping(true),
-    m_showStats(true)
+    m_showStats(true),
+       m_nStrafeMode(0)
   {
   }
 
@@ -671,12 +673,25 @@ void Camera_motionDelta(int x, int y, unsigned int state, void* data)
   camera_t* cam = reinterpret_cast<camera_t*>(data);
 
   cam->m_mouseMove.motion_delta(x, y, state);
-  cam->m_strafe = (state & GDK_CONTROL_MASK) != 0;
 
-  if(cam->m_strafe)
-    cam->m_strafe_forward = (state & GDK_SHIFT_MASK) != 0;
-  else
-    cam->m_strafe_forward = false;
+       switch(g_camwindow_globals_private.m_nStrafeMode)
+       {
+               case 0:
+                       cam->m_strafe = (state & GDK_CONTROL_MASK) != 0;
+                       if(cam->m_strafe)
+                               cam->m_strafe_forward = (state & GDK_SHIFT_MASK) != 0;
+                       else
+                               cam->m_strafe_forward = false;
+                       break;
+               case 1:
+                       cam->m_strafe = (state & GDK_CONTROL_MASK) != 0 && (state & GDK_SHIFT_MASK) == 0;
+                       cam->m_strafe_forward = false;
+                       break;
+               case 2:
+                       cam->m_strafe = (state & GDK_CONTROL_MASK) != 0 && (state & GDK_SHIFT_MASK) == 0;
+                       cam->m_strafe_forward = cam->m_strafe;
+                       break;
+       }
 }
 
 class CamWnd
@@ -1676,11 +1691,11 @@ void CamWnd::Cam_Draw()
 
   if(g_camwindow_globals_private.m_showStats)
   {
-    glRasterPos3f(1.0f, static_cast<float>(m_Camera.height) - 1.0f, 0.0f);
+    glRasterPos3f(1.0f, static_cast<float>(m_Camera.height) - GlobalOpenGL().m_fontDescent, 0.0f);
     extern const char* Renderer_GetStats();
     GlobalOpenGL().drawString(Renderer_GetStats());
 
-    glRasterPos3f(1.0f, static_cast<float>(m_Camera.height) - 11.0f, 0.0f);
+    glRasterPos3f(1.0f, static_cast<float>(m_Camera.height) - GlobalOpenGL().m_fontDescent - GlobalOpenGL().m_fontHeight, 0.0f);
     extern const char* Cull_GetStats();
     GlobalOpenGL().drawString(Cull_GetStats());
   }
@@ -1989,6 +2004,14 @@ void Camera_constructPreferences(PreferencesPage& page)
       IntExportCallback(RenderModeExportCaller())
     );
   }
+
+    const char* strafe_mode[] = { "Both", "Forward", "Up" };
+
+    page.appendCombo(
+      "Strafe Mode",
+      g_camwindow_globals_private.m_nStrafeMode,
+      STRING_ARRAY_RANGE(strafe_mode)
+    );
 }
 void Camera_constructPage(PreferenceGroup& group)
 {
@@ -2080,6 +2103,7 @@ void CamWnd_Construct()
   GlobalPreferenceSystem().registerPreference("SI_Colors4", Vector3ImportStringCaller(g_camwindow_globals.color_cameraback), Vector3ExportStringCaller(g_camwindow_globals.color_cameraback));
   GlobalPreferenceSystem().registerPreference("SI_Colors12", Vector3ImportStringCaller(g_camwindow_globals.color_selbrushes3d), Vector3ExportStringCaller(g_camwindow_globals.color_selbrushes3d));
   GlobalPreferenceSystem().registerPreference("CameraRenderMode", makeIntStringImportCallback(RenderModeImportCaller()), makeIntStringExportCallback(RenderModeExportCaller()));
+  GlobalPreferenceSystem().registerPreference("StrafeMode", IntImportStringCaller(g_camwindow_globals_private.m_nStrafeMode), IntExportStringCaller(g_camwindow_globals_private.m_nStrafeMode));
 
   CamWnd_constructStatic();