]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit 'a8f1237884e3741541e891724fbae07f8ff7d3b8' into master-merge
authorThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 04:06:16 +0000 (06:06 +0200)
committerThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 04:06:16 +0000 (06:06 +0200)
radiant/camwindow.cpp
radiant/selection.cpp

index cba949715f54c5d3cecc65d8ba1cb3fc5ade595c..33f9db649d84d964ce2196beb341419d45673bcc 100644 (file)
@@ -95,7 +95,7 @@ struct camwindow_globals_private_t
                m_bCamDiscrete( true ),
                m_bCubicClipping( false ),
                m_showStats( true ),
-               m_nStrafeMode( 0 ){
+               m_nStrafeMode( 3 ){
        }
 
 };
@@ -147,6 +147,7 @@ struct camera_t
 
        bool m_strafe; // true when in strafemode toggled by the ctrl-key
        bool m_strafe_forward; // true when in strafemode by ctrl-key and shift is pressed for forward strafing
+       bool m_strafe_forward_invert; //silly option to invert forward strafing to support old fegs
 
        unsigned int movementflags; // movement flags
        Timer m_keycontrol_timer;
@@ -285,7 +286,7 @@ void Camera_FreeMove( camera_t& camera, int dx, int dy ){
 
                camera.origin -= camera.vright * strafespeed * dx;
                if ( camera.m_strafe_forward ) {
-                       camera.origin -= camera.vpn * strafespeed * dy;
+                       camera.origin += camera.m_strafe_forward_invert ? ( camera.vpn * strafespeed * dy ) : ( -camera.vpn * strafespeed * dy );
                }
                else{
                        camera.origin += camera.vup * strafespeed * dy;
@@ -628,16 +629,12 @@ void Camera_motionDelta( int x, int y, unsigned int state, void* data ){
 
        cam->m_mouseMove.motion_delta( x, y, state );
 
+       cam->m_strafe_forward_invert = 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;
-               }
+               cam->m_strafe = false;
                break;
        case 1:
                cam->m_strafe = ( state & GDK_CONTROL_MASK ) != 0 && ( state & GDK_SHIFT_MASK ) == 0;
@@ -647,9 +644,24 @@ void Camera_motionDelta( int x, int y, unsigned int state, void* data ){
                cam->m_strafe = ( state & GDK_CONTROL_MASK ) != 0 && ( state & GDK_SHIFT_MASK ) == 0;
                cam->m_strafe_forward = cam->m_strafe;
                break;
+       case 4:
+               cam->m_strafe_forward_invert = true;
+       default:
+               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;
        }
 }
 
+
+
+
+
 class CamWnd
 {
 View m_view;
@@ -1929,7 +1941,7 @@ void Camera_constructPreferences( PreferencesPage& page ){
                        );
        }
 
-       const char* strafe_mode[] = { "Both", "Forward", "Up" };
+       const char* strafe_mode[] = { "None", "Up", "Forward", "Both", "Both Inverted" };
 
        page.appendCombo(
                "Strafe Mode",
index 43a9ca995991dd3b200c335f4c695f11f992ecf9..a608b7412547dc3a0b226cf199e0245cef8c01a7 100644 (file)
@@ -381,9 +381,9 @@ void Transform( const Matrix4& manip2object, const Matrix4& device2manip, const
                float grid = GetSnapGridSize();
                Vector3 maxs( m_bounds.origin + m_bounds.extents );
                Vector3 mins( m_bounds.origin - m_bounds.extents );
-//             globalOutputStream() << "current: " << current << "\n";
+               //globalOutputStream() << "current: " << current << "\n";
                for( std::size_t i = 0; i < 3; ++i ){
-                       if( current[i] != 0.f ){
+                       if( fabs( current[i] ) > 0.000001f ){
                                float snapto1 = float_snapped( maxs[i] + current[i] , grid );
                                float snapto2 = float_snapped( mins[i] + current[i] , grid );
 
@@ -2643,6 +2643,7 @@ std::list<Selectable*>& best(){
 };
 
 bool g_bAltDragManipulatorResize = false;
+bool g_bTmpComponentMode = false;
 
 class DragManipulator : public Manipulator
 {
@@ -2729,6 +2730,7 @@ void testSelect( const View& view, const Matrix4& pivot2world ){
        {
                ( *i ).second->setSelected( true );
        }
+       g_bTmpComponentMode = m_selected;
 }
 
 void setSelected( bool select ){
@@ -3681,6 +3683,7 @@ void RadiantSelectionSystem::endMove(){
 
        if ( Mode() == ePrimitive ) {
                if ( ManipulatorMode() == eDrag ) {
+                       g_bTmpComponentMode = false;
                        if( g_bAltDragManipulatorResize ){
                                Scene_SelectAll_Component( false, SelectionSystem::eVertex );
                        }
@@ -3927,7 +3930,7 @@ void RadiantSelectionSystem::setCustomPivotOrigin( Vector3& point ) const {
 AABB RadiantSelectionSystem::getSelectionAABB() const {
        AABB bounds;
        if ( !nothingSelected() ) {
-               if ( Mode() == eComponent ) {
+               if ( Mode() == eComponent || g_bTmpComponentMode ) {
                        Scene_BoundsSelectedComponent( GlobalSceneGraph(), bounds );
                }
                else