]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Q3map2:
authorGarux <garux@mail.ru>
Wed, 2 Aug 2017 06:04:48 +0000 (09:04 +0300)
committerGarux <garux@mail.ru>
Wed, 2 Aug 2017 06:04:48 +0000 (09:04 +0300)
fix compilation on linux
* packer: pack actual loaded bsp instead of one, found in vfs

Radiant:

binds...
* Q - toggle QE/Scale tools (MouseDragOrScale command)
* new MouseRotateOrScale command
* shift + m3: set custom transform/pivot origin in pivoted mode
switch manipulator mode = disable
is snapped to (if SnapToGrid is on):
grid
selection bbox edges
selection bbox origin

misc...
* Scale tool: now scales bbox by gridsize increment
* m1 selector fix: shift/ctrl + m1 drag, release shift/ctrl, release m1 = replace brush selection
* m1 selector fix: do not select when dragged off pivot in pivoted mode
* don't restore cursor pos after quit mlook (do center)
* toggle and paint selectors do select matching stuff (depth threshold ~= 0.1 u)

12 files changed:
include/iselection.h
libs/gtkutil/cursor.h
libs/stringio.h
radiant/camwindow.cpp
radiant/mainframe.cpp
radiant/selection.cpp
radiant/texwindow.cpp
radiant/xywindow.cpp
radiant/xywindow.h
tools/quake3/common/vfs.c
tools/quake3/common/vfs.h
tools/quake3/q3map2/main.c

index f5c76310b1cc4e17196ebebb33157c1779f839e0..36b27deb02bef3c69cdc3967dbc562fc8593481e 100644 (file)
@@ -124,6 +124,7 @@ virtual void rotateSelected( const Quaternion& rotation ) = 0;
 virtual void scaleSelected( const Vector3& scaling ) = 0;
 
 virtual void pivotChanged() const = 0;
+virtual void setCustomPivotOrigin( Vector3& point ) const = 0;
 };
 
 #include "modulesystem.h"
index 0a6a495d61c5c4e19b330131f690428fe74deb78..b08c7428db459651345bb34ba7e2ea30e104ce4d 100644 (file)
@@ -118,7 +118,7 @@ class FreezePointer
 {
 unsigned int handle_motion;
 int recorded_x, recorded_y, last_x, last_y, center_x, center_y;
-GtkWidget* weedjet;
+GtkWidget* m_weedjet;
 typedef void ( *MotionDeltaFunction )( int x, int y, unsigned int state, void* data );
 MotionDeltaFunction m_function;
 void* m_data;
@@ -168,7 +168,7 @@ void freeze_pointer( GtkWindow* window, GtkWidget* widget, MotionDeltaFunction f
        //gdk_window_set_cursor ( GTK_WIDGET( window )->window, cursor );
        /*      is needed to fix activating neighbour widgets, that happens, if using upper one */
        gtk_grab_add( widget );
-       weedjet = widget;
+       m_weedjet = widget;
 
        gdk_cursor_unref( cursor );
 
@@ -190,17 +190,22 @@ void freeze_pointer( GtkWindow* window, GtkWidget* widget, MotionDeltaFunction f
        handle_motion = g_signal_connect( G_OBJECT( window ), "motion_notify_event", G_CALLBACK( motion_delta ), this );
 }
 
-void unfreeze_pointer( GtkWindow* window ){
+void unfreeze_pointer( GtkWindow* window, bool centerize ){
        g_signal_handler_disconnect( G_OBJECT( window ), handle_motion );
 
        m_function = 0;
        m_data = 0;
 
-       Sys_SetCursorPos( window, recorded_x, recorded_y );
-
+       if( centerize ){
+               Sys_SetCursorPos( window, center_x, center_y );
+       }
+       else{
+               Sys_SetCursorPos( window, recorded_x, recorded_y );
+       }
 //     gdk_window_set_cursor( GTK_WIDGET( window )->window, 0 );
        gdk_pointer_ungrab( GDK_CURRENT_TIME );
-       gtk_grab_remove( weedjet );
+       if( m_weedjet )
+               gtk_grab_remove( m_weedjet );
 }
 };
 
index 82d0e2584160a2793fb9c696fdd4c90daa11db0f..658e0ace0f476dd103b355bed31eac7b1f3fc2f4 100644 (file)
@@ -234,7 +234,7 @@ inline bool Tokeniser_getFloat( Tokeniser& tokeniser, float& f ){
        //fallback for 1.#IND 1.#INF 1.#QNAN cases, happening sometimes after rotating & often scaling with tex lock in BP mode
        else if ( token != 0 && strstr( token, ".#" ) ) {
                globalErrorStream() << "Warning: " << Unsigned( tokeniser.getLine() ) << ":" << Unsigned( tokeniser.getColumn() ) << ": expected parse problem at '" << token << "': wanted '#number'\nProcessing anyway\n";
-               *strstr( token, ".#" ) = '\0';
+//             *strstr( token, ".#" ) = '\0';
                return true;
        }
        Tokeniser_unexpectedError( tokeniser, token, "#number" );
index 37bcaba3e23f4c34ba211069d21329007b4c57e0..48c3375a80b84436f83766e5fa7fdd8fc9f3cbf2 100644 (file)
@@ -1343,7 +1343,7 @@ void CamWnd::DisableFreeMove(){
        CamWnd_Remove_Handlers_FreeMove( *this );
        CamWnd_Add_Handlers_Move( *this );
 
-       m_freezePointer.unfreeze_pointer( m_parent );
+       m_freezePointer.unfreeze_pointer( m_parent, true );
        g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_freemove_handle_focusout );
 
        CamWnd_Update( *this );
index 3d33df075f9000f7c886841a56e8d458a6c4a39d..9054117abade7d5be53c500a504400d0a1c73af3 100644 (file)
@@ -1469,6 +1469,27 @@ void ClipperMode(){
 }
 
 
+void ToggleRotateScaleModes(){
+       if ( g_currentToolMode == RotateMode ) {
+               ScaleMode();
+       }
+       else
+       {
+               RotateMode();
+       }
+}
+
+void ToggleDragScaleModes(){
+       if ( g_currentToolMode == DragMode ) {
+               ScaleMode();
+       }
+       else
+       {
+               DragMode();
+       }
+}
+
+
 void Texdef_Rotate( float angle ){
        StringOutputStream command;
        command << "brushRotateTexture -angle " << angle;
@@ -2280,14 +2301,19 @@ void SurfaceInspector_registerShortcuts(){
        command_connect_accelerator( "FitTexture" );
 }
 
-
 void TexBro_registerShortcuts(){
        command_connect_accelerator( "FindReplaceTextures" );
        command_connect_accelerator( "RefreshShaders" );
+}
+
+void Misc_registerShortcuts(){
        //refresh models
        command_connect_accelerator( "RefreshReferences" );
+       command_connect_accelerator( "MouseRotateOrScale" );
+       command_connect_accelerator( "MouseDragOrScale" );
 }
 
+
 void register_shortcuts(){
 //     PatchInspector_registerShortcuts();
        //Patch_registerShortcuts();
@@ -2301,6 +2327,7 @@ void register_shortcuts(){
 //     SnapToGrid_registerShortcuts();
 //     SelectByType_registerShortcuts();
        TexBro_registerShortcuts();
+       Misc_registerShortcuts();
 }
 
 void File_constructToolbar( GtkToolbar* toolbar ){
@@ -2352,7 +2379,7 @@ void XYWnd_constructToolbar( GtkToolbar* toolbar ){
 void Manipulators_constructToolbar( GtkToolbar* toolbar ){
        toolbar_append_toggle_button( toolbar, "Translate (W)", "select_mousetranslate.png", "MouseTranslate" );
        toolbar_append_toggle_button( toolbar, "Rotate (R)", "select_mouserotate.png", "MouseRotate" );
-       toolbar_append_toggle_button( toolbar, "Scale", "select_mousescale.png", "MouseScale" );
+       toolbar_append_toggle_button( toolbar, "Scale (Q)", "select_mousescale.png", "MouseScale" );
        toolbar_append_toggle_button( toolbar, "Resize (Q)", "select_mouseresize.png", "MouseDrag" );
 
        Clipper_constructToolbar( toolbar );
@@ -3318,7 +3345,9 @@ void MainFrame_Construct(){
        GlobalToggles_insert( "MouseTranslate", FreeCaller<TranslateMode>(), ToggleItem::AddCallbackCaller( g_translatemode_button ), Accelerator( 'W' ) );
        GlobalToggles_insert( "MouseRotate", FreeCaller<RotateMode>(), ToggleItem::AddCallbackCaller( g_rotatemode_button ), Accelerator( 'R' ) );
        GlobalToggles_insert( "MouseScale", FreeCaller<ScaleMode>(), ToggleItem::AddCallbackCaller( g_scalemode_button ) );
-       GlobalToggles_insert( "MouseDrag", FreeCaller<DragMode>(), ToggleItem::AddCallbackCaller( g_dragmode_button ), Accelerator( 'Q' ) );
+       GlobalToggles_insert( "MouseDrag", FreeCaller<DragMode>(), ToggleItem::AddCallbackCaller( g_dragmode_button ) );
+       GlobalCommands_insert( "MouseRotateOrScale", FreeCaller<ToggleRotateScaleModes>() );
+       GlobalCommands_insert( "MouseDragOrScale", FreeCaller<ToggleDragScaleModes>(), Accelerator( 'Q' ) );
 
        GlobalCommands_insert( "gtkThemeDlg", FreeCaller<gtkThemeDlg>() );
        GlobalCommands_insert( "ColorSchemeOriginal", FreeCaller<ColorScheme_Original>() );
index ff4c6ee32fab33129828cde4ea9f0542aef36e2f..52435f15b43a24114d7159f8fbd6105e60ac7126 100644 (file)
@@ -325,6 +325,8 @@ void Transform( const Matrix4& manip2object, const Matrix4& device2manip, const
 }
 };
 
+void GetSelectionAABB( AABB& bounds );
+const Matrix4& ssGetPivot2World();
 
 class Scalable
 {
@@ -339,14 +341,28 @@ private:
 Vector3 m_start;
 Vector3 m_axis;
 Scalable& m_scalable;
+
+AABB m_aabb;
+Vector3 m_transform_origin;
+Vector3 m_choosen_extent;
+
 public:
 ScaleAxis( Scalable& scalable )
        : m_scalable( scalable ){
 }
 void Construct( const Matrix4& device2manip, const float x, const float y ){
        point_on_axis( m_start, m_axis, device2manip, x, y );
+
+       GetSelectionAABB( m_aabb );
+       m_transform_origin = vector4_to_vector3( ssGetPivot2World().t() );
+       m_choosen_extent = Vector3( std::max( m_aabb.origin[0] + m_aabb.extents[0] - m_transform_origin[0], - m_aabb.origin[0] + m_aabb.extents[0] + m_transform_origin[0] ),
+                                       std::max( m_aabb.origin[1] + m_aabb.extents[1] - m_transform_origin[1], - m_aabb.origin[1] + m_aabb.extents[1] + m_transform_origin[1] ),
+                                       std::max( m_aabb.origin[2] + m_aabb.extents[2] - m_transform_origin[2], - m_aabb.origin[2] + m_aabb.extents[2] + m_transform_origin[2] )
+                                                       );
+
 }
 void Transform( const Matrix4& manip2object, const Matrix4& device2manip, const float x, const float y ){
+       //globalOutputStream() << "manip2object: " << manip2object << "  device2manip: " << device2manip << "  x: " << x << "  y:" << y <<"\n";
        Vector3 current;
        point_on_axis( current, m_axis, device2manip, x, y );
        Vector3 delta = vector3_subtracted( current, m_start );
@@ -355,11 +371,19 @@ void Transform( const Matrix4& manip2object, const Matrix4& device2manip, const
        vector3_snap( delta, GetSnapGridSize() );
 
        Vector3 start( vector3_snapped( m_start, GetSnapGridSize() ) );
+       //globalOutputStream() << "start: " << start << "   delta: " << delta <<"\n";
        Vector3 scale(
                start[0] == 0 ? 1 : 1 + delta[0] / start[0],
                start[1] == 0 ? 1 : 1 + delta[1] / start[1],
                start[2] == 0 ? 1 : 1 + delta[2] / start[2]
                );
+
+       for( std::size_t i = 0; i < 3; i++ ){
+               if( m_choosen_extent[i] > 0.0625 ){ //epsilon to prevent too high scale for set of models, having really small extent, formed by origins
+                       scale[i] = ( m_choosen_extent[i] + delta[i] ) / m_choosen_extent[i];
+               }
+       }
+
        m_scalable.scale( scale );
 }
 
@@ -373,12 +397,24 @@ class ScaleFree : public Manipulatable
 private:
 Vector3 m_start;
 Scalable& m_scalable;
+
+AABB m_aabb;
+Vector3 m_transform_origin;
+Vector3 m_choosen_extent;
+
 public:
 ScaleFree( Scalable& scalable )
        : m_scalable( scalable ){
 }
 void Construct( const Matrix4& device2manip, const float x, const float y ){
        point_on_plane( m_start, device2manip, x, y );
+
+       GetSelectionAABB( m_aabb );
+       m_transform_origin = vector4_to_vector3( ssGetPivot2World().t() );
+       m_choosen_extent = Vector3( std::max( m_aabb.origin[0] + m_aabb.extents[0] - m_transform_origin[0], - m_aabb.origin[0] + m_aabb.extents[0] + m_transform_origin[0] ),
+                                       std::max( m_aabb.origin[1] + m_aabb.extents[1] - m_transform_origin[1], - m_aabb.origin[1] + m_aabb.extents[1] + m_transform_origin[1] ),
+                                       std::max( m_aabb.origin[2] + m_aabb.extents[2] - m_transform_origin[2], - m_aabb.origin[2] + m_aabb.extents[2] + m_transform_origin[2] )
+                                                       );
 }
 void Transform( const Matrix4& manip2object, const Matrix4& device2manip, const float x, const float y ){
        Vector3 current;
@@ -394,6 +430,13 @@ void Transform( const Matrix4& manip2object, const Matrix4& device2manip, const
                start[1] == 0 ? 1 : 1 + delta[1] / start[1],
                start[2] == 0 ? 1 : 1 + delta[2] / start[2]
                );
+
+       for( std::size_t i = 0; i < 3; i++ ){
+               if( m_choosen_extent[i] > 0.0625 ){
+                       scale[i] = ( m_choosen_extent[i] + delta[i] ) / m_choosen_extent[i];
+               }
+       }
+
        m_scalable.scale( scale );
 }
 };
@@ -2537,9 +2580,7 @@ EManipulatorMode m_manipulator_mode;
 Manipulator* m_manipulator;
 
 // state
-public:
 bool m_undo_begun;
-private:
 EMode m_mode;
 EComponentMode m_componentmode;
 
@@ -2559,8 +2600,13 @@ selection_t m_component_selection;
 Signal1<const Selectable&> m_selectionChanged_callbacks;
 
 void ConstructPivot() const;
+void setCustomPivotOrigin( Vector3& point ) const;
+public:
+void getSelectionAABB( AABB& bounds ) const;
+private:
 mutable bool m_pivotChanged;
 bool m_pivot_moving;
+mutable bool m_pivotIsCustom;
 
 void Scene_TestSelect( Selector& selector, SelectionTest& test, const View& view, SelectionSystem::EMode mode, SelectionSystem::EComponentMode componentMode );
 
@@ -2591,7 +2637,8 @@ RadiantSelectionSystem() :
        m_rotate_manipulator( *this, 8, 64 ),
        m_scale_manipulator( *this, 0, 64 ),
        m_pivotChanged( false ),
-       m_pivot_moving( false ){
+       m_pivot_moving( false ),
+       m_pivotIsCustom( false ){
        SetManipulatorMode( eTranslate );
        pivotChanged();
        addSelectionChangeCallback( PivotChangedSelectionCaller( *this ) );
@@ -2623,6 +2670,7 @@ EComponentMode ComponentMode() const {
        return m_componentmode;
 }
 void SetManipulatorMode( EManipulatorMode mode ){
+       m_pivotIsCustom = false;
        m_manipulator_mode = mode;
        switch ( m_manipulator_mode )
        {
@@ -2864,15 +2912,45 @@ void SelectPoint( const View& view, const float device_point[2], const float dev
                        break;
                        case RadiantSelectionSystem::eSelect:
                        {
-                               if( !( *selector.begin() ).second->isSelected() ){
-                                       ( *selector.begin() ).second->setSelected( true );
+                               SelectionPool::iterator best = selector.begin();
+                               if( !( *best ).second->isSelected() ){
+                                       ( *best ).second->setSelected( true );
+                               }
+                               SelectionPool::iterator i = best;
+                               ++i;
+                               while ( i != selector.end() )
+                               {
+                                       if( ( *i ).first.equalEpsilon( ( *best ).first, 0.25f, 0.000001f ) ){
+                                               if( !( *i ).second->isSelected() ){
+                                                       ( *i ).second->setSelected( true );
+                                               }
+                                       }
+                                       else{
+                                               break;
+                                       }
+                                       ++i;
                                }
                        }
                        break;
                        case RadiantSelectionSystem::eDeselect:
                        {
-                               if( ( *selector.begin() ).second->isSelected() ){
-                                       ( *selector.begin() ).second->setSelected( false );
+                               SelectionPool::iterator best = selector.begin();
+                               if( ( *best ).second->isSelected() ){
+                                       ( *best ).second->setSelected( false );
+                               }
+                               SelectionPool::iterator i = best;
+                               ++i;
+                               while ( i != selector.end() )
+                               {
+                                       if( ( *i ).first.equalEpsilon( ( *best ).first, 0.25f, 0.000001f ) ){
+                                               if( ( *i ).second->isSelected() ){
+                                                       ( *i ).second->setSelected( false );
+                                               }
+                                       }
+                                       else{
+                                               break;
+                                       }
+                                       ++i;
                                }
                        }
                        break;
@@ -2908,14 +2986,21 @@ bool SelectPoint_InitPaint( const View& view, const float device_point[2], const
 
                if ( !selector.failed() ) {
                        SelectableSortedSet::iterator best = selector.begin();
-                       if ( ( *best ).second->isSelected() ) {
-                               ( *best ).second->setSelected( false );
-                               return false;
-                       }
-                       else{
-                               ( *best ).second->setSelected( true );
-                               return true;
+                       const bool wasSelected = ( *best ).second->isSelected();
+                       ( *best ).second->setSelected( !wasSelected );
+                       SelectableSortedSet::iterator i = best;
+                       ++i;
+                       while ( i != selector.end() )
+                       {
+                               if( ( *i ).first.equalEpsilon( ( *best ).first, 0.25f, 0.000001f ) ){
+                                       ( *i ).second->setSelected( !wasSelected );
+                               }
+                               else{
+                                       break;
+                               }
+                               ++i;
                        }
+                       return !wasSelected;
                }
                else{
                        return true;
@@ -3380,7 +3465,7 @@ inline void pivot_for_node( Matrix4& pivot, scene::Node& node, scene::Instance&
 #endif
 
 void RadiantSelectionSystem::ConstructPivot() const {
-       if ( !m_pivotChanged || m_pivot_moving ) {
+       if ( !m_pivotChanged || m_pivot_moving || m_pivotIsCustom ) {
                return;
        }
        m_pivotChanged = false;
@@ -3401,6 +3486,7 @@ void RadiantSelectionSystem::ConstructPivot() const {
                }
 
                //vector3_snap( m_object_pivot, GetSnapGridSize() );
+               //globalOutputStream() << m_object_pivot << "\n";
                m_pivot2world = matrix4_translation_for_vec3( m_object_pivot );
 
                switch ( m_manipulator_mode )
@@ -3431,6 +3517,106 @@ void RadiantSelectionSystem::ConstructPivot() const {
        }
 }
 
+void RadiantSelectionSystem::setCustomPivotOrigin( Vector3& point ) const {
+       /*if ( !m_pivotChanged || m_pivot_moving ) {
+               return;
+       }*/
+       //m_pivotChanged = false;
+
+       if ( !nothingSelected() && ( m_manipulator_mode == eTranslate || m_manipulator_mode == eRotate || m_manipulator_mode == eScale ) ) {
+               AABB bounds;
+               if ( Mode() == eComponent ) {
+                       Scene_BoundsSelectedComponent( GlobalSceneGraph(), bounds );
+               }
+               else
+               {
+                       Scene_BoundsSelected( GlobalSceneGraph(), bounds );
+               }
+               //globalOutputStream() << point << "\n";
+               const float gridsize = GetSnapGridSize();
+               //const float bbox_epsilon = gridsize / 4.0;
+
+               for( std::size_t i = 0; i < 3; i++ ){
+                       if( point[i] < 900000 ){
+                               float bestsnapDist = fabs( bounds.origin[i] - point[i] );
+                               float bestsnapTo = bounds.origin[i];
+                               float othersnapDist = fabs( bounds.origin[i] + bounds.extents[i] - point[i] );
+                               if( othersnapDist < bestsnapDist ){
+                                       bestsnapDist = othersnapDist;
+                                       bestsnapTo = bounds.origin[i] + bounds.extents[i];
+                               }
+                               othersnapDist = fabs( bounds.origin[i] - bounds.extents[i] - point[i] );
+                               if( othersnapDist < bestsnapDist ){
+                                       bestsnapDist = othersnapDist;
+                                       bestsnapTo = bounds.origin[i] - bounds.extents[i];
+                               }
+                               othersnapDist = fabs( float_snapped( point[i], gridsize ) - point[i] );
+                               if( othersnapDist < bestsnapDist ){
+                                       bestsnapDist = othersnapDist;
+                                       bestsnapTo = float_snapped( point[i], gridsize );
+                               }
+                               point[i] = bestsnapTo;
+
+/*                             if( float_equal_epsilon( point[i], bestsnapTo, bbox_epsilon ) ){
+                                       point[i] = bestsnapTo;
+                               }
+                               else{
+                                       point[i] = float_snapped( point[i], gridsize );
+                               }
+                               */
+                               m_pivot2world[i + 12] = point[i]; //m_pivot2world.tx() .ty() .tz()
+                       }
+               }
+
+               switch ( m_manipulator_mode )
+               {
+               case eTranslate:
+                       break;
+               case eRotate:
+                       if ( Mode() == eComponent ) {
+                               matrix4_assign_rotation_for_pivot( m_pivot2world, m_component_selection.back() );
+                       }
+                       else
+                       {
+                               matrix4_assign_rotation_for_pivot( m_pivot2world, m_selection.back() );
+                       }
+                       break;
+               case eScale:
+                       if ( Mode() == eComponent ) {
+                               matrix4_assign_rotation_for_pivot( m_pivot2world, m_component_selection.back() );
+                       }
+                       else
+                       {
+                               matrix4_assign_rotation_for_pivot( m_pivot2world, m_selection.back() );
+                       }
+                       break;
+               default:
+                       break;
+               }
+       }
+       m_pivotIsCustom = true;
+}
+
+void RadiantSelectionSystem::getSelectionAABB( AABB& bounds ) const {
+       if ( !nothingSelected() ) {
+               if ( Mode() == eComponent ) {
+                       Scene_BoundsSelectedComponent( GlobalSceneGraph(), bounds );
+               }
+               else
+               {
+                       Scene_BoundsSelected( GlobalSceneGraph(), bounds );
+               }
+       }
+}
+
+void GetSelectionAABB( AABB& bounds ){
+       getSelectionSystem().getSelectionAABB( bounds );
+}
+
+const Matrix4& ssGetPivot2World(){
+       return getSelectionSystem().GetPivot2World();
+}
+
 void RadiantSelectionSystem::renderSolid( Renderer& renderer, const VolumeTest& volume ) const {
        //if(view->TestPoint(m_object_pivot))
        if ( !nothingSelected() ) {
@@ -3773,6 +3959,7 @@ void onMouseDown( const WindowVector& position, ButtonIdentifier button, Modifie
 void onMouseMotion( const WindowVector& position, ModifierFlags modifiers ){
        m_selector.m_mouseMoved = true;
        if ( m_mouse_down && !g_mouseMovedCallback.empty() ) {
+               m_selector.m_mouseMovedWhilePressed = true;
                g_mouseMovedCallback.get() ( window_to_normalised_device( position, m_width, m_height ) );
        }
 }
@@ -3783,12 +3970,14 @@ void onMouseUp( const WindowVector& position, ButtonIdentifier button, ModifierF
                g_mouseUpCallback.get() ( window_to_normalised_device( position, m_width, m_height ) );
        }
        //L button w/o scene changed = tunnel selection
-       if( !getSelectionSystem().m_undo_begun && modifiers == c_modifierNone && button == c_button_select &&
+       if( // !getSelectionSystem().m_undo_begun &&
+               modifiers == c_modifierNone && button == c_button_select &&
                //( !m_selector.m_mouseMoved || !m_mouse_down ) &&
-               ( GlobalSelectionSystem().Mode() != SelectionSystem::eComponent || GlobalSelectionSystem().ManipulatorMode() != SelectionSystem::eDrag ) ){
+               !m_selector.m_mouseMovedWhilePressed &&
+               ( getSelectionSystem().Mode() != SelectionSystem::eComponent || getSelectionSystem().ManipulatorMode() != SelectionSystem::eDrag ) ){
                m_selector.testSelect_simpleM1( device_constrained( window_to_normalised_device( position, m_width, m_height ) ) );
        }
-       getSelectionSystem().m_undo_begun = false;
+       //getSelectionSystem().m_undo_begun = false;
        m_selector.m_mouseMoved = false;
        m_selector.m_mouseMovedWhilePressed = false;
 }
index 3ea764bbeab11c0d942fd327fa6fcd817464ed40..ba6c59e4ddfa832455904cf80e8ca7d7a7aae95d 100644 (file)
@@ -1020,7 +1020,7 @@ void TextureBrowser_trackingDelta( int x, int y, unsigned int state, void* data
 
 void TextureBrowser_Tracking_MouseUp( TextureBrowser& textureBrowser ){
        textureBrowser.m_move_started = false;
-       textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_parent );
+       textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_parent, false );
 }
 
 void TextureBrowser_Tracking_MouseDown( TextureBrowser& textureBrowser ){
@@ -1400,7 +1400,8 @@ gboolean TextureBrowser_button_press( GtkWidget* widget, GdkEventButton* event,
        }
        else if ( event->type == GDK_2BUTTON_PRESS && event->button == 1 ) {
                CopiedString texName = textureBrowser->shader;
-               const char* sh = texName.c_str();
+               //const char* sh = texName.c_str();
+               char* sh = const_cast<char*>( texName.c_str() );
                char* dir = strrchr( sh, '/' );
                if( dir != NULL ){
                        *(dir + 1) = '\0';
index 9ab1861e06771d56d159115f6c76dbca7f5abd08..af6467e34932021e26953676b7910ac95c6ac24f 100644 (file)
@@ -989,6 +989,18 @@ void XYWnd::Clipper_Crosshair_OnMouseMoved( int x, int y ){
        }
 }
 
+void XYWnd::SetCustomPivotOrigin( int pointx, int pointy ){
+       Vector3 point;
+       XY_ToPoint( pointx, pointy, point );
+       VIEWTYPE viewtype = static_cast<VIEWTYPE>( GetViewType() );
+       const int nDim = ( viewtype == YZ ) ? 0 : ( ( viewtype == XZ ) ? 1 : 2 );
+       //vector3_snap( point, GetSnapGridSize() );
+       point[nDim] = 999999;
+
+       GlobalSelectionSystem().setCustomPivotOrigin( point );
+       SceneChangeNotify();
+}
+
 unsigned int MoveCamera_buttons(){
        return RAD_CONTROL | ( g_glwindow_globals.m_nMouseType == ETwoButton ? RAD_RBUTTON : RAD_MBUTTON );
 }
@@ -1023,6 +1035,10 @@ void XYWnd_OrientCamera( XYWnd* xywnd, int x, int y, CamWnd& camwnd ){
        }
 }
 
+unsigned int SetCustomPivotOrigin_buttons(){
+       return RAD_MBUTTON | RAD_SHIFT;
+}
+
 /*
    ==============
    NewBrushDrag
@@ -1224,7 +1240,7 @@ void XYWnd::Move_Begin(){
 
 void XYWnd::Move_End(){
        m_move_started = false;
-       g_xywnd_freezePointer.unfreeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow() );
+       g_xywnd_freezePointer.unfreeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), false );
        g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_move_focusOut );
 }
 
@@ -1269,7 +1285,7 @@ void XYWnd::Zoom_Begin(){
 
 void XYWnd::Zoom_End(){
        m_zoom_started = false;
-       g_xywnd_freezePointer.unfreeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow() );
+       g_xywnd_freezePointer.unfreeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), false );
        g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_zoom_focusOut );
 }
 
@@ -1330,6 +1346,9 @@ void XYWnd::XY_MouseDown( int x, int y, unsigned int buttons ){
        else if ( buttons == OrientCamera_buttons() ) {
                XYWnd_OrientCamera( this, x, y, *g_pParentWnd->GetCamWnd() );
        }
+       else if ( buttons == SetCustomPivotOrigin_buttons() ) {
+               SetCustomPivotOrigin( x, y );
+       }
        else
        {
                m_window_observer->onMouseDown( WindowVector_forInteger( x, y ), button_for_flags( buttons ), modifiers_for_flags( buttons ) );
@@ -1387,6 +1406,10 @@ void XYWnd::XY_MouseMoved( int x, int y, unsigned int buttons ){
                XYWnd_OrientCamera( this, x, y, *g_pParentWnd->GetCamWnd() );
        }
 
+       else if ( buttons == SetCustomPivotOrigin_buttons() ) {
+               SetCustomPivotOrigin( x, y );
+       }
+
        else
        {
                m_window_observer->onMouseMotion( WindowVector_forInteger( x, y ), modifiers_for_flags( buttons ) );
index a8b4aaa2206bca913a7dbfb8d8f5d0f8874e987b..c5fa82a240bed03cceddeccf0458827a15749406 100644 (file)
@@ -143,6 +143,8 @@ void Clipper_OnMouseMoved( int x, int y );
 void Clipper_Crosshair_OnMouseMoved( int x, int y );
 void DropClipPoint( int pointx, int pointy );
 
+void SetCustomPivotOrigin( int pointx, int pointy );
+
 void SetViewType( VIEWTYPE n );
 bool m_bActive;
 
index f14504706bd5fed1ac3b83e2dc83ec2aa9716f4a..2b1b61bc379a0781ab495dd89ddbcd5027e0dd43 100644 (file)
@@ -275,7 +275,7 @@ void vfsListShaderFiles( char* list, int *num ){
                                }
 
                                for ( k = 0; k < *num; k++ ){
-                                       if ( !stricmp( list + k*65, dirlist ) ) goto shISdouplicate;
+                                       if ( !Q_stricmp( list + k*65, dirlist ) ) goto shISdouplicate;
                                }
                                strcpy( list + (*num)*65, dirlist );
                                (*num)++;
@@ -302,7 +302,7 @@ shISdouplicate:
                ext++;
 
                for ( k = 0; k < *num; k++ ){
-                       if ( !stricmp( list + k*65, ext ) ) goto shISdouplicate2;
+                       if ( !Q_stricmp( list + k*65, ext ) ) goto shISdouplicate2;
                }
                strcpy( list + (*num)*65, ext );
                (*num)++;
@@ -566,3 +566,41 @@ qboolean vfsPackFile( const char *filename, const char *packname, const int comp
 
        return qfalse;
 }
+
+qboolean vfsPackFile_Absolute_Path( const char *filepath, const char *filename, const char *packname, const int compLevel ){
+       char tmp[NAME_MAX];
+       strcpy( tmp, filepath );
+       if ( access( tmp, R_OK ) == 0 ) {
+               if ( access( packname, R_OK ) == 0 ) {
+                       mz_zip_archive zip;
+                       memset( &zip, 0, sizeof(zip) );
+                       mz_zip_reader_init_file( &zip, packname, 0 );
+                       mz_zip_writer_init_from_reader( &zip, packname );
+
+                       mz_bool success = MZ_TRUE;
+                       success &= mz_zip_writer_add_file( &zip, filename, tmp, 0, 0, compLevel );
+                       if ( !success || !mz_zip_writer_finalize_archive( &zip ) ){
+                               Error( "Failed creating zip archive \"%s\"!\n", packname );
+                       }
+                       mz_zip_reader_end( &zip);
+                       mz_zip_writer_end( &zip );
+               }
+               else{
+                       mz_zip_archive zip;
+                       memset( &zip, 0, sizeof(zip) );
+                       if( !mz_zip_writer_init_file( &zip, packname, 0 ) ){
+                               Error( "Failed creating zip archive \"%s\"!\n", packname );
+                       }
+                       mz_bool success = MZ_TRUE;
+                       success &= mz_zip_writer_add_file( &zip, filename, tmp, 0, 0, compLevel );
+                       if ( !success || !mz_zip_writer_finalize_archive( &zip ) ){
+                               Error( "Failed creating zip archive \"%s\"!\n", packname );
+                       }
+                       mz_zip_writer_end( &zip );
+               }
+
+               return qtrue;
+       }
+
+       return qfalse;
+}
index 89da7b145b737d8c0f2d9d04f9a55bea7237f5eb..3527b3e1392cf0f03d232f7345d43c16ac1bbeaa 100644 (file)
@@ -57,6 +57,7 @@ int vfsGetFileCount( const char *filename );
 int vfsLoadFile( const char *filename, void **buffer, int index );
 void vfsListShaderFiles( char* list, int *num );
 qboolean vfsPackFile( const char *filename, const char *packname, const int compLevel );
+qboolean vfsPackFile_Absolute_Path( const char *filepath, const char *filename, const char *packname, const int compLevel );
 
 extern char g_strForbiddenDirs[VFS_MAXDIRS][PATH_MAX + 1];
 extern int g_numForbiddenDirs;
index 0240bb830593b63982553957af0140c742209dc4..3120587fd9918ee6143307ab00690040c67870c4 100644 (file)
@@ -1660,10 +1660,10 @@ void tex2list( char* texlist, int *texnum, char* EXtex, int *EXtexnum ){
        StripExtension( token );
        FixDOSName( token );
        for ( i = 0; i < *texnum; i++ ){
-               if ( !stricmp( texlist + i*65, token ) ) return;
+               if ( !Q_stricmp( texlist + i*65, token ) ) return;
        }
        for ( i = 0; i < *EXtexnum; i++ ){
-               if ( !stricmp( EXtex + i*65, token ) ) return;
+               if ( !Q_stricmp( EXtex + i*65, token ) ) return;
        }
        strcpy ( texlist + (*texnum)*65, token );
        (*texnum)++;
@@ -1677,7 +1677,7 @@ void tex2list2( char* texlist, int *texnum, char* EXtex, int *EXtexnum, char* rE
        //StripExtension( token );
        char* dot = strrchr( token, '.' );
        if ( dot != NULL){
-               if ( stricmp( dot, ".tga" ) && stricmp( dot, ".jpg" ) && stricmp( dot, ".png" ) ){
+               if ( Q_stricmp( dot, ".tga" ) && Q_stricmp( dot, ".jpg" ) && Q_stricmp( dot, ".png" ) ){
                        Sys_Printf( "WARNING4: %s : weird or missing extension in shader\n", token );
                }
                else{
@@ -1690,13 +1690,13 @@ void tex2list2( char* texlist, int *texnum, char* EXtex, int *EXtexnum, char* rE
 
        /* exclude */
        for ( i = 0; i < *texnum; i++ ){
-               if ( !stricmp( texlist + i*65, texlist + (*texnum)*65 ) ) return;
+               if ( !Q_stricmp( texlist + i*65, texlist + (*texnum)*65 ) ) return;
        }
        for ( i = 0; i < *EXtexnum; i++ ){
-               if ( !stricmp( EXtex + i*65, texlist + (*texnum)*65 ) ) return;
+               if ( !Q_stricmp( EXtex + i*65, texlist + (*texnum)*65 ) ) return;
        }
        for ( i = 0; i < *rEXtexnum; i++ ){
-               if ( !stricmp( rEXtex + i*65, texlist + (*texnum)*65 ) ) return;
+               if ( !Q_stricmp( rEXtex + i*65, texlist + (*texnum)*65 ) ) return;
        }
        (*texnum)++;
        return;
@@ -1717,7 +1717,7 @@ void res2list( char* data, int *num ){
        }
        if ( *( data + (*num)*65 ) == '\0') return;
        for ( i = 0; i < *num; i++ ){
-               if ( !stricmp( data + i*65, data + (*num)*65 ) ) return;
+               if ( !Q_stricmp( data + i*65, data + (*num)*65 ) ) return;
        }
        (*num)++;
        return;
@@ -1825,7 +1825,7 @@ int pk3BSPMain( int argc, char **argv ){
        epair_t *ep;
        for ( ep = entities[0].epairs; ep != NULL; ep = ep->next )
        {
-               if ( !strnicmp( ep->key, "vertexremapshader", 17 ) ) {
+               if ( !Q_strncasecmp( ep->key, "vertexremapshader", 17 ) ) {
                        sscanf( ep->value, "%*[^;] %*[;] %s", pk3Shaders + pk3ShadersN*65 );
                        res2list( pk3Shaders, &pk3ShadersN );
                }
@@ -1846,13 +1846,13 @@ int pk3BSPMain( int argc, char **argv ){
                        res2list( pk3Sounds, &pk3SoundsN );
                }
 
-               if ( !stricmp( ValueForKey( &entities[i], "classname" ), "func_plat" ) ){
+               if ( !Q_stricmp( ValueForKey( &entities[i], "classname" ), "func_plat" ) ){
                        strcpy( pk3Sounds + pk3SoundsN*65, "sound/movers/plats/pt1_strt.wav");
                        res2list( pk3Sounds, &pk3SoundsN );
                        strcpy( pk3Sounds + pk3SoundsN*65, "sound/movers/plats/pt1_end.wav");
                        res2list( pk3Sounds, &pk3SoundsN );
                }
-               if ( !stricmp( ValueForKey( &entities[i], "classname" ), "target_push" ) ){
+               if ( !Q_stricmp( ValueForKey( &entities[i], "classname" ), "target_push" ) ){
                        if ( !(IntForKey( &entities[i], "spawnflags") & 1) ){
                                strcpy( pk3Sounds + pk3SoundsN*65, "sound/misc/windfly.wav");
                                res2list( pk3Sounds, &pk3SoundsN );
@@ -1940,19 +1940,19 @@ int pk3BSPMain( int argc, char **argv ){
                }
 
                /* blocks */
-               if ( !stricmp( token, "textures" ) ){
+               if ( !Q_stricmp( token, "textures" ) ){
                        parseEXblock ( ExTextures, &ExTexturesN, exName );
                }
-               else if ( !stricmp( token, "shaders" ) ){
+               else if ( !Q_stricmp( token, "shaders" ) ){
                        parseEXblock ( ExShaders, &ExShadersN, exName );
                }
-               else if ( !stricmp( token, "shaderfiles" ) ){
+               else if ( !Q_stricmp( token, "shaderfiles" ) ){
                        parseEXblock ( ExShaderfiles, &ExShaderfilesN, exName );
                }
-               else if ( !stricmp( token, "sounds" ) ){
+               else if ( !Q_stricmp( token, "sounds" ) ){
                        parseEXblock ( ExSounds, &ExSoundsN, exName );
                }
-               else if ( !stricmp( token, "videos" ) ){
+               else if ( !Q_stricmp( token, "videos" ) ){
                        parseEXblock ( ExVideos, &ExVideosN, exName );
                }
                else{
@@ -1965,7 +1965,7 @@ int pk3BSPMain( int argc, char **argv ){
 
        for ( i = 0; i < ExTexturesN; i++ ){
                for ( j = 0; j < ExShadersN; j++ ){
-                       if ( !stricmp( ExTextures + i*65, ExShaders + j*65 ) ){
+                       if ( !Q_stricmp( ExTextures + i*65, ExShaders + j*65 ) ){
                                break;
                        }
                }
@@ -1995,7 +1995,7 @@ skipEXfile:
        /* can exclude pure textures right now, shouldn't create shaders for them anyway */
        for ( i = 0; i < pk3ShadersN ; i++ ){
                for ( j = 0; j < ExPureTexturesN ; j++ ){
-                       if ( !stricmp( pk3Shaders + i*65, ExPureTextures + j*65 ) ){
+                       if ( !Q_stricmp( pk3Shaders + i*65, ExPureTextures + j*65 ) ){
                                *( pk3Shaders + i*65 ) = '\0';
                                break;
                        }
@@ -2019,7 +2019,7 @@ skipEXfile:
 
                /* do wanna le shader file? */
                for ( j = 0; j < ExShaderfilesN; j++ ){
-                       if ( !stricmp( ExShaderfiles + j*65, pk3Shaderfiles + i*65 ) ){
+                       if ( !Q_stricmp( ExShaderfiles + j*65, pk3Shaderfiles + i*65 ) ){
                                ShaderFileExcluded = qtrue;
                                reasonShaderFile = ExShaderfiles + j*65;
                                break;
@@ -2036,7 +2036,7 @@ skipEXfile:
 
                        /* does it contain restricted shaders/textures? */
                        for ( j = 0; j < ExShadersN; j++ ){
-                               if ( !stricmp( ExShaders + j*65, token ) ){
+                               if ( !Q_stricmp( ExShaders + j*65, token ) ){
                                        ShaderFileExcluded = qtrue;
                                        reasonShader = ExShaders + j*65;
                                        break;
@@ -2045,7 +2045,7 @@ skipEXfile:
                        if ( ShaderFileExcluded )
                                break;
                        for ( j = 0; j < ExPureTexturesN; j++ ){
-                               if ( !stricmp( ExPureTextures + j*65, token ) ){
+                               if ( !Q_stricmp( ExPureTextures + j*65, token ) ){
                                        ShaderFileExcluded = qtrue;
                                        reasonShader = ExPureTextures + j*65;
                                        break;
@@ -2101,7 +2101,7 @@ skipEXfile:
                        /* do wanna le shader? */
                        wantShader = qfalse;
                        for ( j = 0; j < pk3ShadersN; j++ ){
-                               if ( !stricmp( pk3Shaders + j*65, token) ){
+                               if ( !Q_stricmp( pk3Shaders + j*65, token) ){
                                        shader = j;
                                        wantShader = qtrue;
                                        break;
@@ -2146,15 +2146,15 @@ skipEXfile:
                                                if ( !strcmp( token, "{" ) ) {
                                                        Sys_Printf( "WARNING9: %s : line %d : opening brace inside shader stage\n", temp, scriptline );
                                                }
-                                               if ( !stricmp( token, "mapComp" ) || !stricmp( token, "mapNoComp" ) || !stricmp( token, "animmapcomp" ) || !stricmp( token, "animmapnocomp" ) ){
+                                               if ( !Q_stricmp( token, "mapComp" ) || !Q_stricmp( token, "mapNoComp" ) || !Q_stricmp( token, "animmapcomp" ) || !Q_stricmp( token, "animmapnocomp" ) ){
                                                        Sys_Printf( "WARNING7: %s : line %d : unsupported '%s' map directive\n", temp, scriptline, token );
                                                }
                                                /* skip the shader */
                                                if ( !wantShader ) continue;
 
                                                /* digest any images */
-                                               if ( !stricmp( token, "map" ) ||
-                                                       !stricmp( token, "clampMap" ) ) {
+                                               if ( !Q_stricmp( token, "map" ) ||
+                                                       !Q_stricmp( token, "clampMap" ) ) {
                                                        hasmap = qtrue;
                                                        /* get an image */
                                                        GetToken( qfalse );
@@ -2162,8 +2162,8 @@ skipEXfile:
                                                                tex2list( pk3Textures, &pk3TexturesN, ExTextures, &ExTexturesN );
                                                        }
                                                }
-                                               else if ( !stricmp( token, "animMap" ) ||
-                                                       !stricmp( token, "clampAnimMap" ) ) {
+                                               else if ( !Q_stricmp( token, "animMap" ) ||
+                                                       !Q_stricmp( token, "clampAnimMap" ) ) {
                                                        hasmap = qtrue;
                                                        GetToken( qfalse );// skip num
                                                        while ( TokenAvailable() ){
@@ -2171,7 +2171,7 @@ skipEXfile:
                                                                tex2list( pk3Textures, &pk3TexturesN, ExTextures, &ExTexturesN );
                                                        }
                                                }
-                                               else if ( !stricmp( token, "videoMap" ) ){
+                                               else if ( !Q_stricmp( token, "videoMap" ) ){
                                                        hasmap = qtrue;
                                                        GetToken( qfalse );
                                                        FixDOSName( token );
@@ -2181,12 +2181,12 @@ skipEXfile:
                                                        }
                                                        FixDOSName( token );
                                                        for ( j = 0; j < pk3VideosN; j++ ){
-                                                               if ( !stricmp( pk3Videos + j*65, token ) ){
+                                                               if ( !Q_stricmp( pk3Videos + j*65, token ) ){
                                                                        goto away;
                                                                }
                                                        }
                                                        for ( j = 0; j < ExVideosN; j++ ){
-                                                               if ( !stricmp( ExVideos + j*65, token ) ){
+                                                               if ( !Q_stricmp( ExVideos + j*65, token ) ){
                                                                        goto away;
                                                                }
                                                        }
@@ -2197,7 +2197,7 @@ skipEXfile:
                                                }
                                        }
                                }
-                               else if ( !strnicmp( token, "implicit", 8 ) ){
+                               else if ( !Q_strncasecmp( token, "implicit", 8 ) ){
                                        Sys_Printf( "WARNING5: %s : line %d : unsupported %s shader\n", temp, scriptline, token );
                                }
                                /* skip the shader */
@@ -2208,22 +2208,22 @@ skipEXfile:
                                ----------------------------------------------------------------- */
 
                                /* match surfaceparm */
-                               else if ( !stricmp( token, "surfaceparm" ) ) {
+                               else if ( !Q_stricmp( token, "surfaceparm" ) ) {
                                        GetToken( qfalse );
-                                       if ( !stricmp( token, "nodraw" ) ) {
+                                       if ( !Q_stricmp( token, "nodraw" ) ) {
                                                wantShader = qfalse;
                                                *( pk3Shaders + shader*65 ) = '\0';
                                        }
                                }
 
                                /* skyparms <outer image> <cloud height> <inner image> */
-                               else if ( !stricmp( token, "skyParms" ) ) {
+                               else if ( !Q_stricmp( token, "skyParms" ) ) {
                                        hasmap = qtrue;
                                        /* get image base */
                                        GetToken( qfalse );
 
                                        /* ignore bogus paths */
-                                       if ( stricmp( token, "-" ) && stricmp( token, "full" ) ) {
+                                       if ( Q_stricmp( token, "-" ) && Q_stricmp( token, "full" ) ) {
                                                strcpy ( temp, token );
                                                sprintf( token, "%s_up", temp );
                                                tex2list( pk3Textures, &pk3TexturesN, ExTextures, &ExTexturesN );
@@ -2242,7 +2242,7 @@ skipEXfile:
                                        GetToken( qfalse );
                                        GetToken( qfalse );
                                }
-                               else if ( !stricmp( token, "fogparms" ) ){
+                               else if ( !Q_stricmp( token, "fogparms" ) ){
                                        hasmap = qtrue;
                                }
                        }
@@ -2250,7 +2250,7 @@ skipEXfile:
                        //exclude shader
                        if ( wantShader ){
                                for ( j = 0; j < ExShadersN; j++ ){
-                                       if ( !stricmp( ExShaders + j*65, pk3Shaders + shader*65 ) ){
+                                       if ( !Q_stricmp( ExShaders + j*65, pk3Shaders + shader*65 ) ){
                                                wantShader = qfalse;
                                                *( pk3Shaders + shader*65 ) = '\0';
                                                break;
@@ -2305,14 +2305,14 @@ skipEXfile:
                if ( *( pk3Shaders + i*65 ) != '\0' ){
                        FixDOSName( pk3Shaders + i*65 );
                        for ( j = 0; j < pk3TexturesN; j++ ){
-                               if ( !stricmp( pk3Shaders + i*65, pk3Textures + j*65 ) ){
+                               if ( !Q_stricmp( pk3Shaders + i*65, pk3Textures + j*65 ) ){
                                        *( pk3Shaders + i*65 ) = '\0';
                                        break;
                                }
                        }
                        if ( *( pk3Shaders + i*65 ) == '\0' ) continue;
                        for ( j = 0; j < ExTexturesN; j++ ){
-                               if ( !stricmp( pk3Shaders + i*65, ExTextures + j*65 ) ){
+                               if ( !Q_stricmp( pk3Shaders + i*65, ExTextures + j*65 ) ){
                                        *( pk3Shaders + i*65 ) = '\0';
                                        break;
                                }
@@ -2323,7 +2323,7 @@ skipEXfile:
 //snds
        for ( i = 0; i < pk3SoundsN; i++ ){
                for ( j = 0; j < ExSoundsN; j++ ){
-                       if ( !stricmp( pk3Sounds + i*65, ExSounds + j*65 ) ){
+                       if ( !Q_stricmp( pk3Sounds + i*65, ExSounds + j*65 ) ){
                                *( pk3Sounds + i*65 ) = '\0';
                                break;
                        }
@@ -2429,7 +2429,8 @@ skipEXfile:
        Sys_Printf( "\n\t.bsp and stuff\n" );
 
        sprintf( temp, "maps/%s.bsp", nameOFmap );
-       if ( vfsPackFile( temp, packname, 10 ) ){
+       //if ( vfsPackFile( temp, packname, 10 ) ){
+       if ( vfsPackFile_Absolute_Path( source, temp, packname, 10 ) ){
                        Sys_Printf( "++%s\n", temp );
                }
        else{
@@ -2550,19 +2551,19 @@ int repackBSPMain( int argc, char **argv ){
                }
 
                /* blocks */
-               if ( !stricmp( token, "textures" ) ){
+               if ( !Q_stricmp( token, "textures" ) ){
                        parseEXblock ( ExTextures, &ExTexturesN, exName );
                }
-               else if ( !stricmp( token, "shaders" ) ){
+               else if ( !Q_stricmp( token, "shaders" ) ){
                        parseEXblock ( ExShaders, &ExShadersN, exName );
                }
-               else if ( !stricmp( token, "shaderfiles" ) ){
+               else if ( !Q_stricmp( token, "shaderfiles" ) ){
                        parseEXblock ( ExShaderfiles, &ExShaderfilesN, exName );
                }
-               else if ( !stricmp( token, "sounds" ) ){
+               else if ( !Q_stricmp( token, "sounds" ) ){
                        parseEXblock ( ExSounds, &ExSoundsN, exName );
                }
-               else if ( !stricmp( token, "videos" ) ){
+               else if ( !Q_stricmp( token, "videos" ) ){
                        parseEXblock ( ExVideos, &ExVideosN, exName );
                }
                else{
@@ -2575,7 +2576,7 @@ int repackBSPMain( int argc, char **argv ){
 
        for ( i = 0; i < ExTexturesN; i++ ){
                for ( j = 0; j < ExShadersN; j++ ){
-                       if ( !stricmp( ExTextures + i*65, ExShaders + j*65 ) ){
+                       if ( !Q_stricmp( ExTextures + i*65, ExShaders + j*65 ) ){
                                break;
                        }
                }
@@ -2647,19 +2648,19 @@ skipEXfile:
                }
 
                /* blocks */
-               if ( !stricmp( token, "textures" ) ){
+               if ( !Q_stricmp( token, "textures" ) ){
                        parseEXblock ( rExTextures, &rExTexturesN, exName );
                }
-               else if ( !stricmp( token, "shaders" ) ){
+               else if ( !Q_stricmp( token, "shaders" ) ){
                        parseEXblock ( rExShaders, &rExShadersN, exName );
                }
-               else if ( !stricmp( token, "shaderfiles" ) ){
+               else if ( !Q_stricmp( token, "shaderfiles" ) ){
                        parseEXblock ( rExShaderfiles, &rExShaderfilesN, exName );
                }
-               else if ( !stricmp( token, "sounds" ) ){
+               else if ( !Q_stricmp( token, "sounds" ) ){
                        parseEXblock ( rExSounds, &rExSoundsN, exName );
                }
-               else if ( !stricmp( token, "videos" ) ){
+               else if ( !Q_stricmp( token, "videos" ) ){
                        parseEXblock ( rExVideos, &rExVideosN, exName );
                }
                else{
@@ -2693,7 +2694,7 @@ skipEXrefile:
 
        /* do some path mangling */
        strcpy( source, ExpandArg( argv[ argc - 1 ] ) );
-       if ( !stricmp( strrchr( source, '.' ), ".bsp" ) ){
+       if ( !Q_stricmp( strrchr( source, '.' ), ".bsp" ) ){
                strcpy( bspList, source );
                bspListN++;
        }
@@ -2790,7 +2791,7 @@ skipEXrefile:
                epair_t *ep;
                for ( ep = entities[0].epairs; ep != NULL; ep = ep->next )
                {
-                       if ( !strnicmp( ep->key, "vertexremapshader", 17 ) ) {
+                       if ( !Q_strncasecmp( ep->key, "vertexremapshader", 17 ) ) {
                                sscanf( ep->value, "%*[^;] %*[;] %s", pk3Shaders + pk3ShadersN*65 );
                                res2list( pk3Shaders, &pk3ShadersN );
                        }
@@ -2811,13 +2812,13 @@ skipEXrefile:
                                res2list( pk3Sounds, &pk3SoundsN );
                        }
 
-                       if ( !stricmp( ValueForKey( &entities[i], "classname" ), "func_plat" ) ){
+                       if ( !Q_stricmp( ValueForKey( &entities[i], "classname" ), "func_plat" ) ){
                                strcpy( pk3Sounds + pk3SoundsN*65, "sound/movers/plats/pt1_strt.wav");
                                res2list( pk3Sounds, &pk3SoundsN );
                                strcpy( pk3Sounds + pk3SoundsN*65, "sound/movers/plats/pt1_end.wav");
                                res2list( pk3Sounds, &pk3SoundsN );
                        }
-                       if ( !stricmp( ValueForKey( &entities[i], "classname" ), "target_push" ) ){
+                       if ( !Q_stricmp( ValueForKey( &entities[i], "classname" ), "target_push" ) ){
                                if ( !(IntForKey( &entities[i], "spawnflags") & 1) ){
                                        strcpy( pk3Sounds + pk3SoundsN*65, "sound/misc/windfly.wav");
                                        res2list( pk3Sounds, &pk3SoundsN );
@@ -2988,7 +2989,7 @@ skipEXrefile:
        /* can exclude pure *base* textures right now, shouldn't create shaders for them anyway */
        for ( i = 0; i < pk3ShadersN ; i++ ){
                for ( j = 0; j < ExPureTexturesN ; j++ ){
-                       if ( !stricmp( pk3Shaders + i*65, ExPureTextures + j*65 ) ){
+                       if ( !Q_stricmp( pk3Shaders + i*65, ExPureTextures + j*65 ) ){
                                *( pk3Shaders + i*65 ) = '\0';
                                break;
                        }
@@ -2997,7 +2998,7 @@ skipEXrefile:
        /* can exclude repack.exclude shaders, assuming they got all their images */
        for ( i = 0; i < pk3ShadersN ; i++ ){
                for ( j = 0; j < rExShadersN ; j++ ){
-                       if ( !stricmp( pk3Shaders + i*65, rExShaders + j*65 ) ){
+                       if ( !Q_stricmp( pk3Shaders + i*65, rExShaders + j*65 ) ){
                                *( pk3Shaders + i*65 ) = '\0';
                                break;
                        }
@@ -3040,7 +3041,7 @@ skipEXrefile:
                        /* do wanna le shader? */
                        wantShader = qfalse;
                        for ( j = 0; j < pk3ShadersN; j++ ){
-                               if ( !stricmp( pk3Shaders + j*65, token) ){
+                               if ( !Q_stricmp( pk3Shaders + j*65, token) ){
                                        shader = j;
                                        wantShader = qtrue;
                                        break;
@@ -3048,7 +3049,7 @@ skipEXrefile:
                        }
                        if ( wantShader ){
                                for ( j = 0; j < rExTexturesN ; j++ ){
-                                       if ( !stricmp( pk3Shaders + shader*65, rExTextures + j*65 ) ){
+                                       if ( !Q_stricmp( pk3Shaders + shader*65, rExTextures + j*65 ) ){
                                                Sys_Printf( "WARNING3: %s : about to include shader for excluded texture\n", pk3Shaders + shader*65 );
                                                break;
                                        }
@@ -3101,8 +3102,8 @@ skipEXrefile:
                                                if ( !wantShader ) continue;
 
                                                /* digest any images */
-                                               if ( !stricmp( token, "map" ) ||
-                                                       !stricmp( token, "clampMap" ) ) {
+                                               if ( !Q_stricmp( token, "map" ) ||
+                                                       !Q_stricmp( token, "clampMap" ) ) {
                                                        strcat( shaderText, "\n\t\t" );
                                                        strcat( shaderText, token );
                                                        hasmap = qtrue;
@@ -3115,8 +3116,8 @@ skipEXrefile:
                                                        strcat( shaderText, " " );
                                                        strcat( shaderText, token );
                                                }
-                                               else if ( !stricmp( token, "animMap" ) ||
-                                                       !stricmp( token, "clampAnimMap" ) ) {
+                                               else if ( !Q_stricmp( token, "animMap" ) ||
+                                                       !Q_stricmp( token, "clampAnimMap" ) ) {
                                                        strcat( shaderText, "\n\t\t" );
                                                        strcat( shaderText, token );
                                                        hasmap = qtrue;
@@ -3132,7 +3133,7 @@ skipEXrefile:
                                                        }
                                                        tokenready = qtrue;
                                                }
-                                               else if ( !stricmp( token, "videoMap" ) ){
+                                               else if ( !Q_stricmp( token, "videoMap" ) ){
                                                        strcat( shaderText, "\n\t\t" );
                                                        strcat( shaderText, token );
                                                        hasmap = qtrue;
@@ -3146,17 +3147,17 @@ skipEXrefile:
                                                        }
                                                        FixDOSName( token );
                                                        for ( j = 0; j < pk3VideosN; j++ ){
-                                                               if ( !stricmp( pk3Videos + j*65, token ) ){
+                                                               if ( !Q_stricmp( pk3Videos + j*65, token ) ){
                                                                        goto away;
                                                                }
                                                        }
                                                        for ( j = 0; j < ExVideosN; j++ ){
-                                                               if ( !stricmp( ExVideos + j*65, token ) ){
+                                                               if ( !Q_stricmp( ExVideos + j*65, token ) ){
                                                                        goto away;
                                                                }
                                                        }
                                                        for ( j = 0; j < rExVideosN; j++ ){
-                                                               if ( !stricmp( rExVideos + j*65, token ) ){
+                                                               if ( !Q_stricmp( rExVideos + j*65, token ) ){
                                                                        goto away;
                                                                }
                                                        }
@@ -3165,7 +3166,7 @@ skipEXrefile:
                                                        away:
                                                        j = 0;
                                                }
-                                               else if ( !stricmp( token, "mapComp" ) || !stricmp( token, "mapNoComp" ) || !stricmp( token, "animmapcomp" ) || !stricmp( token, "animmapnocomp" ) ){
+                                               else if ( !Q_stricmp( token, "mapComp" ) || !Q_stricmp( token, "mapNoComp" ) || !Q_stricmp( token, "animmapcomp" ) || !Q_stricmp( token, "animmapnocomp" ) ){
                                                        Sys_Printf( "WARNING7: %s : %s shader\n", pk3Shaders + shader*65, token );
                                                        hasmap = qtrue;
                                                        if ( line == scriptline ){
@@ -3195,18 +3196,18 @@ skipEXrefile:
                                ----------------------------------------------------------------- */
 
                                /* match surfaceparm */
-                               else if ( !stricmp( token, "surfaceparm" ) ) {
+                               else if ( !Q_stricmp( token, "surfaceparm" ) ) {
                                        strcat( shaderText, "\n\tsurfaceparm " );
                                        GetToken( qfalse );
                                        strcat( shaderText, token );
-                                       if ( !stricmp( token, "nodraw" ) ) {
+                                       if ( !Q_stricmp( token, "nodraw" ) ) {
                                                wantShader = qfalse;
                                                *( pk3Shaders + shader*65 ) = '\0';
                                        }
                                }
 
                                /* skyparms <outer image> <cloud height> <inner image> */
-                               else if ( !stricmp( token, "skyParms" ) ) {
+                               else if ( !Q_stricmp( token, "skyParms" ) ) {
                                        strcat( shaderText, "\n\tskyParms " );
                                        hasmap = qtrue;
                                        /* get image base */
@@ -3214,7 +3215,7 @@ skipEXrefile:
                                        strcat( shaderText, token );
 
                                        /* ignore bogus paths */
-                                       if ( stricmp( token, "-" ) && stricmp( token, "full" ) ) {
+                                       if ( Q_stricmp( token, "-" ) && Q_stricmp( token, "full" ) ) {
                                                strcpy ( temp, token );
                                                sprintf( token, "%s_up", temp );
                                                tex2list2( pk3Textures, &pk3TexturesN, ExTextures, &ExTexturesN, rExTextures, &rExTexturesN );
@@ -3237,7 +3238,7 @@ skipEXrefile:
                                        strcat( shaderText, " " );
                                        strcat( shaderText, token );
                                }
-                               else if ( !strnicmp( token, "implicit", 8 ) ){
+                               else if ( !Q_strncasecmp( token, "implicit", 8 ) ){
                                        Sys_Printf( "WARNING5: %s : %s shader\n", pk3Shaders + shader*65, token );
                                        hasmap = qtrue;
                                        if ( line == scriptline ){
@@ -3249,7 +3250,7 @@ skipEXrefile:
                                                strcat( shaderText, token );
                                        }
                                }
-                               else if ( !stricmp( token, "fogparms" ) ){
+                               else if ( !Q_stricmp( token, "fogparms" ) ){
                                        hasmap = qtrue;
                                        if ( line == scriptline ){
                                                strcat( shaderText, " " );
@@ -3273,7 +3274,7 @@ skipEXrefile:
                        //exclude shader
                        if ( wantShader ){
                                for ( j = 0; j < ExShadersN; j++ ){
-                                       if ( !stricmp( ExShaders + j*65, pk3Shaders + shader*65 ) ){
+                                       if ( !Q_stricmp( ExShaders + j*65, pk3Shaders + shader*65 ) ){
                                                wantShader = qfalse;
                                                *( pk3Shaders + shader*65 ) = '\0';
                                                break;
@@ -3304,7 +3305,7 @@ skipEXrefile:
                                FixDOSName( pk3Shaders + i*65 );
                                //what if theres properly slashed one in the list?
                                for ( j = 0; j < pk3ShadersN; j++ ){
-                                       if ( !stricmp( pk3Shaders + i*65, pk3Shaders + j*65 ) && (i != j) ){
+                                       if ( !Q_stricmp( pk3Shaders + i*65, pk3Shaders + j*65 ) && (i != j) ){
                                                *( pk3Shaders + i*65 ) = '\0';
                                                break;
                                        }
@@ -3312,21 +3313,21 @@ skipEXrefile:
                        }
                        if ( *( pk3Shaders + i*65 ) == '\0' ) continue;
                        for ( j = 0; j < pk3TexturesN; j++ ){
-                               if ( !stricmp( pk3Shaders + i*65, pk3Textures + j*65 ) ){
+                               if ( !Q_stricmp( pk3Shaders + i*65, pk3Textures + j*65 ) ){
                                        *( pk3Shaders + i*65 ) = '\0';
                                        break;
                                }
                        }
                        if ( *( pk3Shaders + i*65 ) == '\0' ) continue;
                        for ( j = 0; j < ExTexturesN; j++ ){
-                               if ( !stricmp( pk3Shaders + i*65, ExTextures + j*65 ) ){
+                               if ( !Q_stricmp( pk3Shaders + i*65, ExTextures + j*65 ) ){
                                        *( pk3Shaders + i*65 ) = '\0';
                                        break;
                                }
                        }
                        if ( *( pk3Shaders + i*65 ) == '\0' ) continue;
                        for ( j = 0; j < rExTexturesN; j++ ){
-                               if ( !stricmp( pk3Shaders + i*65, rExTextures + j*65 ) ){
+                               if ( !Q_stricmp( pk3Shaders + i*65, rExTextures + j*65 ) ){
                                        *( pk3Shaders + i*65 ) = '\0';
                                        break;
                                }
@@ -3337,14 +3338,14 @@ skipEXrefile:
 //snds
        for ( i = 0; i < pk3SoundsN; i++ ){
                for ( j = 0; j < ExSoundsN; j++ ){
-                       if ( !stricmp( pk3Sounds + i*65, ExSounds + j*65 ) ){
+                       if ( !Q_stricmp( pk3Sounds + i*65, ExSounds + j*65 ) ){
                                *( pk3Sounds + i*65 ) = '\0';
                                break;
                        }
                }
                if ( *( pk3Sounds + i*65 ) == '\0' ) continue;
                for ( j = 0; j < rExSoundsN; j++ ){
-                       if ( !stricmp( pk3Sounds + i*65, rExSounds + j*65 ) ){
+                       if ( !Q_stricmp( pk3Sounds + i*65, rExSounds + j*65 ) ){
                                *( pk3Sounds + i*65 ) = '\0';
                                break;
                        }