]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/camwindow.cpp
fix compile on current Arch Linux
[xonotic/netradiant.git] / radiant / camwindow.cpp
index b89e5447e77e6a66c040eb16c8128e726c81fdfd..f0744e48245be372b7d80dfb9e460fb3898c3559 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
@@ -1538,6 +1553,7 @@ void CamWnd::Cam_Draw()
 
   // enable depth buffer writes
   glDepthMask(GL_TRUE);
+  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 
   Vector3 clearColour(0, 0, 0);
   if(m_Camera.draw_mode != cd_lighting)
@@ -1676,11 +1692,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_font->getPixelDescent(), 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_font->getPixelDescent() - GlobalOpenGL().m_font->getPixelHeight(), 0.0f);
     extern const char* Cull_GetStats();
     GlobalOpenGL().drawString(Cull_GetStats());
   }
@@ -1952,9 +1968,9 @@ typedef FreeCaller1<const IntImportCallback&, RenderModeExport> RenderModeExport
 
 void Camera_constructPreferences(PreferencesPage& page)
 {
-  page.appendSlider("Movement Speed", g_camwindow_globals_private.m_nMoveSpeed, TRUE, 0, 0, 100, MIN_CAM_SPEED, MAX_CAM_SPEED, 1, 10, 10);
+  page.appendSlider("Movement Speed", g_camwindow_globals_private.m_nMoveSpeed, TRUE, 0, 0, 100, MIN_CAM_SPEED, MAX_CAM_SPEED, 1, 10);
   page.appendCheckBox("", "Link strafe speed to movement speed", g_camwindow_globals_private.m_bCamLinkSpeed);
-  page.appendSlider("Rotation Speed", g_camwindow_globals_private.m_nAngleSpeed, TRUE, 0, 0, 3, 1, 180, 1, 10, 10);
+  page.appendSlider("Rotation Speed", g_camwindow_globals_private.m_nAngleSpeed, TRUE, 0, 0, 3, 1, 180, 1, 10);
   page.appendCheckBox("", "Invert mouse vertical axis", g_camwindow_globals_private.m_bCamInverseMouse);
   page.appendCheckBox(
     "", "Discrete movement",
@@ -1989,6 +2005,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 +2104,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();