]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit '39f598c5f44010cc32f1b445b12cb088a72bbc50' into master-merge
authorThomas Debesse <dev@illwieckz.net>
Mon, 20 Jun 2022 02:38:12 +0000 (04:38 +0200)
committerThomas Debesse <dev@illwieckz.net>
Mon, 20 Jun 2022 02:38:12 +0000 (04:38 +0200)
19 files changed:
libs/gtkutil/accelerator.cpp
libs/gtkutil/filechooser.cpp
plugins/entity/entity.cpp
radiant/brushmanip.cpp
radiant/camwindow.cpp
radiant/csg.cpp
radiant/entityinspector.cpp
radiant/main.cpp
radiant/mainframe.cpp
radiant/preferences.cpp
radiant/select.cpp
radiant/texwindow.cpp
radiant/xywindow.cpp
radiant/xywindow.h
tools/quake3/q3map2/light.c
tools/quake3/q3map2/light_ydnar.c
tools/quake3/q3map2/main.c
tools/quake3/q3map2/model.c
tools/quake3/q3map2/q3map2.h

index 414a8eac1c8246792bcbb272283972781d12f054..00380d452f8eb6c66fcac93a0439693c0b2f0cee 100644 (file)
@@ -352,7 +352,9 @@ void Keys_releaseAll( PressedKeys::Keys& keys, guint state ){
 
 gboolean PressedKeys_key_press(ui::Widget widget, GdkEventKey* event, PressedKeys* pressedKeys ){
        //globalOutputStream() << "pressed: " << event->keyval << "\n";
-       return event->state == 0 && Keys_press( pressedKeys->keys, event->keyval );
+       //return event->state == 0 && Keys_press( pressedKeys->keys, event->keyval );
+       //NumLock perspective window fix
+       return ( event->state & ALLOWED_MODIFIERS ) == 0 && Keys_press( pressedKeys->keys, event->keyval );
 }
 
 gboolean PressedKeys_key_release(ui::Widget widget, GdkEventKey* event, PressedKeys* pressedKeys ){
index ac3d5a612e8573ef92562e136aa7ce7bbcae5f3a..abfc225dcc4b05136bf91fff90ec924d52ccffe4 100644 (file)
@@ -186,6 +186,15 @@ const char* file_dialog_show( ui::Window parent, bool open, const char* title, c
        // we should add all important paths as shortcut folder...
        // gtk_file_chooser_add_shortcut_folder(GTK_FILE_CHOOSER(dialog), "/tmp/", NULL);
 
+       if ( open && masks.m_filters.size() > 1 ){
+               GtkFileFilter* filter = gtk_file_filter_new();
+               gtk_file_filter_set_name( filter, "Supported formats" );
+               for ( std::size_t i = 0; i < masks.m_filters.size(); ++i )
+               {
+                       gtk_file_filter_add_pattern( filter, masks.m_filters[i].c_str() );
+               }
+               gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( dialog ), filter );
+       }
 
        for ( std::size_t i = 0; i < masks.m_filters.size(); ++i )
        {
@@ -200,7 +209,7 @@ const char* file_dialog_show( ui::Window parent, bool open, const char* title, c
 
                if ( !string_equal( pattern, "*" ) ) {
                        GtkFileFilter* filter = gtk_file_chooser_get_filter( GTK_FILE_CHOOSER( dialog ) );
-                       if ( filter != 0 ) { // no filter set? some file-chooser implementations may allow the user to set no filter, which we treat as 'all files'
+                       if ( filter != 0 && !string_equal( gtk_file_filter_get_name( filter ), "Supported formats" ) ) { // no filter set? some file-chooser implementations may allow the user to set no filter, which we treat as 'all files'
                                type = masks.GetTypeForGTKMask( gtk_file_filter_get_name( filter ) ).m_type;
                                // last ext separator
                                const char* extension = path_get_extension( g_file_dialog_file );
index dfd2a6408c4aa878cf062e357976b9aa8bd71fda..181f9412082ed9c74434b7dbf4701957454e7765 100644 (file)
@@ -113,7 +113,7 @@ Counter* EntityKeyValues::m_counter = 0;
 bool g_showNames = true;
 bool g_showAngles = true;
 bool g_newLightDraw = true;
-bool g_lightRadii = false;
+bool g_lightRadii = true;
 
 class ConnectEntities
 {
@@ -208,22 +208,48 @@ void connectEntities( const scene::Path& path, const scene::Path& targetPath, in
        else
        {
                ConnectEntities connector( e1, e2, index );
-               const char* value = e2->getKeyValue( "targetname" );
-               if ( !string_empty( value ) ) {
-                       connector.connect( value );
+               //killconnect
+               if( index == 1 ){
+                       const char* value = e2->getKeyValue( "targetname" );
+                       if ( !string_empty( value ) ) {
+                               connector.connect( value );
+                       }
+                       else
+                       {
+                               const char* type = e2->getKeyValue( "classname" );
+                               if ( string_empty( type ) ) {
+                                       type = "t";
+                               }
+                               StringOutputStream key( 64 );
+                               key << type << "1";
+                               GlobalNamespace().makeUnique( key.c_str(), ConnectEntities::ConnectCaller( connector ) );
+                       }
                }
-               else
-               {
-                       const char* type = e2->getKeyValue( "classname" );
-                       if ( string_empty( type ) ) {
-                               type = "t";
+               //normal connect
+               else{
+                       //prioritize existing target key
+                       //checking, if ent got other connected ones already, could be better solution
+                       const char* value = e1->getKeyValue( "target" );
+                       if ( !string_empty( value ) ) {
+                               connector.connect( value );
+                       }
+                       else{
+                               value = e2->getKeyValue( "targetname" );
+                               if ( !string_empty( value ) ) {
+                                       connector.connect( value );
+                               }
+                               else{
+                                       const char* type = e2->getKeyValue( "classname" );
+                                       if ( string_empty( type ) ) {
+                                               type = "t";
+                                       }
+                                       StringOutputStream key( 64 );
+                                       key << type << "1";
+                                       GlobalNamespace().makeUnique( key.c_str(), ConnectEntities::ConnectCaller( connector ) );
+                               }
                        }
-                       StringOutputStream key( 64 );
-                       key << type << "1";
-                       GlobalNamespace().makeUnique( key.c_str(), ConnectEntities::ConnectCaller( connector ) );
                }
        }
-
        SceneChangeNotify();
 }
 void setLightRadii( bool lightRadii ){
index d424bb2be84874bb3ae9b3a52aa20731457cfc68..76679ace0eaf101e091916b993a7edc8e9682999 100644 (file)
@@ -1312,8 +1312,8 @@ void Brush_constructMenu( ui::Menu menu ){
                if ( g_Layout_enableDetachableMenus.m_value ) {
                        menu_tearoff( menu_in_menu );
                }
-               create_menu_item_with_mnemonic( menu_in_menu, "Make _Hollow", "CSGMakeHollow" );
-               create_menu_item_with_mnemonic( menu_in_menu, "Make _Room", "CSGMakeRoom" );
+               create_menu_item_with_mnemonic( menu_in_menu, "Make _Hollow", "CSGHollow" );
+               create_menu_item_with_mnemonic( menu_in_menu, "Make _Room", "CSGRoom" );
                create_menu_item_with_mnemonic( menu_in_menu, "CSG _Subtract", "CSGSubtract" );
                create_menu_item_with_mnemonic( menu_in_menu, "CSG _Merge", "CSGMerge" );
        }
index a2fe0d8d06c3a48af6c2b468a7e275d95feecdaf..cc5946566b586f61447142bee71c9079105af4ca 100644 (file)
@@ -93,7 +93,7 @@ struct camwindow_globals_private_t
                m_nAngleSpeed( 3 ),
                m_bCamInverseMouse( false ),
                m_bCamDiscrete( true ),
-               m_bCubicClipping( true ),
+               m_bCubicClipping( false ),
                m_showStats( true ),
                m_nStrafeMode( 0 ){
        }
@@ -1673,7 +1673,7 @@ void Camera_ToggleFarClip(){
 
 
 void CamWnd_constructToolbar( ui::Toolbar toolbar ){
-       toolbar_append_toggle_button( toolbar, "Cubic clip the camera view (\\)", "view_cubicclipping.png", "ToggleCubicClip" );
+       toolbar_append_toggle_button( toolbar, "Cubic clip the camera view (Ctrl + \\)", "view_cubicclipping.png", "ToggleCubicClip" );
 }
 
 void CamWnd_registerShortcuts(){
index 2a59d2fec6785eb8cdb96527e3ada8be4b8c3e7b..c459804a549c3636b244eebfb0603fd05dadf085 100644 (file)
 #include "brushmanip.h"
 #include "brushnode.h"
 #include "grid.h"
-/*
-void Face_makeBrush( Face& face, const Brush& brush, brush_vector_t& out, float offset ){
-       if ( face.contributes() ) {
-               out.push_back( new Brush( brush ) );
-               Face* newFace = out.back()->addFace( face );
-               if ( newFace != 0 ) {
-                       newFace->flipWinding();
-                       newFace->getPlane().offset( offset );
-                       newFace->planeChanged();
-               }
-       }
-}
-*/
 
 void Face_makeBrush( Face& face, const Brush& brush, brush_vector_t& out, float offset ){
        if ( face.contributes() ) {
                out.push_back( new Brush( brush ) );
-               //face.getPlane().offset( -offset );
-               //face.planeChanged();
                std::shared_ptr<Face> newFace = out.back()->addFace( face );
+               face.getPlane().offset( -offset );
+               face.planeChanged();
                if ( newFace != 0 ) {
                        newFace->flipWinding();
                        newFace->getPlane().offset( offset );
@@ -57,7 +44,7 @@ void Face_makeBrush( Face& face, const Brush& brush, brush_vector_t& out, float
        }
 }
 
-void Face_makeRoom( Face &face, const Brush &brush, brush_vector_t &out, float offset ){
+void Face_extrude( Face& face, const Brush& brush, brush_vector_t& out, float offset ){
        if ( face.contributes() ) {
                face.getPlane().offset( offset );
                out.push_back( new Brush( brush ) );
@@ -70,27 +57,39 @@ void Face_makeRoom( Face &face, const Brush &brush, brush_vector_t &out, float o
        }
 }
 
-void Brush_makeHollow( const Brush &brush, brush_vector_t &out, float offset ){
-       Brush_forEachFace( brush, [&]( Face &face ) {
+
+class FaceMakeBrush
+{
+const Brush& brush;
+brush_vector_t& out;
+float offset;
+bool room;
+public:
+FaceMakeBrush( const Brush& brush, brush_vector_t& out, float offset, bool room )
+       : brush( brush ), out( out ), offset( offset ), room( room ){
+}
+void operator()( Face& face ) const {
+       if( room ){
+               Face_extrude( face, brush, out, offset );
+       }
+       else{
                Face_makeBrush( face, brush, out, offset );
-       } );
 }
+}
+};
 
-void Brush_makeRoom( const Brush &brush, brush_vector_t &out, float offset ){
-       Brush_forEachFace( brush, [&]( Face &face ) {
-               Face_makeRoom( face, brush, out, offset );
-       } );
+void Brush_makeHollow( const Brush& brush, brush_vector_t& out, float offset, bool room ){
+       Brush_forEachFace( brush, FaceMakeBrush( brush, out, offset, room ) );
 }
 
 class BrushHollowSelectedWalker : public scene::Graph::Walker
 {
 float m_offset;
-bool m_makeRoom;
+bool room;
 public:
-BrushHollowSelectedWalker( float offset, bool makeRoom )
-       : m_offset( offset ), m_makeRoom( makeRoom ){
+BrushHollowSelectedWalker( float offset, bool room )
+       : m_offset( offset ), room( room ){
 }
-
 bool pre( const scene::Path& path, scene::Instance& instance ) const {
        if ( path.top().get().visible() ) {
                Brush* brush = Node_getBrush( path.top() );
@@ -98,15 +97,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const {
                         && Instance_getSelectable( instance )->isSelected()
                         && path.size() > 1 ) {
                        brush_vector_t out;
-
-                       if ( m_makeRoom ) {
-                               Brush_makeRoom(* brush, out, m_offset );
-                       }
-                       else
-                       {
-                               Brush_makeHollow(* brush, out, m_offset );
-                       }
-
+                       Brush_makeHollow( *brush, out, m_offset, room );
                        for ( brush_vector_t::const_iterator i = out.begin(); i != out.end(); ++i )
                        {
                                ( *i )->removeEmptyFaces();
@@ -161,8 +152,8 @@ void post( const scene::Path& path, scene::Instance& instance ) const {
 }
 };
 
-void Scene_BrushMakeHollow_Selected( scene::Graph& graph, bool makeRoom ){
-       GlobalSceneGraph().traverse( BrushHollowSelectedWalker( GetGridSize(), makeRoom ) );
+void Scene_BrushMakeHollow_Selected( scene::Graph& graph, bool room ){
+       GlobalSceneGraph().traverse( BrushHollowSelectedWalker( GetGridSize(), room ) );
        GlobalSceneGraph().traverse( BrushDeleteSelected() );
 }
 
@@ -181,7 +172,7 @@ void CSG_MakeHollow( void ){
 }
 
 void CSG_MakeRoom( void ){
-       UndoableCommand undo( "brushRoom" );
+       UndoableCommand undo( "makeRoom" );
 
        Scene_BrushMakeHollow_Selected( GlobalSceneGraph(), true );
 
index e74dd3f0834f637719ed9c0c2d9fcda4b72d0638..d2acdc80f3be71214fb9e73fcdf1c3ae4fe8be4d 100644 (file)
@@ -1153,6 +1153,23 @@ void EntityInspector_clearKeyValue(){
        }
 }
 
+static gint EntityInspector_clearKeyValueKB( GtkEntry* widget, GdkEventKey* event, gpointer data ){
+       if ( event->keyval == GDK_Delete ) {
+               // Get current selection text
+               StringOutputStream key( 64 );
+               key << gtk_entry_get_text( g_entityKeyEntry );
+
+               if ( strcmp( key.c_str(), "classname" ) != 0 ) {
+                       StringOutputStream command;
+                       command << "entityDeleteKey -key " << key.c_str();
+                       UndoableCommand undo( command.c_str() );
+                       Scene_EntitySetKeyValue_Selected( key.c_str(), "" );
+               }
+               return TRUE;
+       }
+       return FALSE;
+}
+
 void EntityInspector_clearAllKeyValues(){
        UndoableCommand undo( "entityClear" );
 
@@ -1268,8 +1285,18 @@ static gint EntityEntry_keypress( ui::Entry widget, GdkEventKey* event, gpointer
                }
                return TRUE;
        }
-       if ( event->keyval == GDK_KEY_Escape ) {
-               gtk_window_set_focus( widget.window(), NULL );
+       if ( event->keyval == GDK_Tab ) {
+               if ( widget._handle == g_entityKeyEntry._handle ) {
+                       gtk_window_set_focus( widget.window(), g_entityValueEntry );
+               }
+               else
+               {
+                       gtk_window_set_focus( widget.window(), g_entityKeyEntry );
+               }
+               return TRUE;
+       }
+       if ( event->keyval == GDK_Escape ) {
+               // gtk_window_set_focus( widget.window(), NULL );
                return TRUE;
        }
 
@@ -1284,11 +1311,26 @@ void EntityInspector_destroyWindow( ui::Widget widget, gpointer data ){
        GlobalEntityAttributes_clear();
 }
 
+static gint EntityInspector_destroyWindowKB( GtkWidget* widget, GdkEventKey* event, gpointer data ){
+       //if ( event->keyval == GDK_Escape && GTK_WIDGET_VISIBLE( GTK_WIDGET( widget ) ) ) {
+       if ( event->keyval == GDK_Escape  ) {
+               //globalErrorStream() << "Doom3Light_getBounds: failed to parse default light radius\n";
+               GroupDialog_showPage( g_page_entity );
+               return TRUE;
+       }
+       if ( event->keyval == GDK_Tab  ) {
+               gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityKeyEntry ) );
+               return TRUE;
+       }
+       return FALSE;
+}
+
 ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
     auto vbox = ui::VBox( FALSE, 2 );
        vbox.show();
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 );
 
+       g_signal_connect( G_OBJECT( toplevel ), "key_press_event", G_CALLBACK( EntityInspector_destroyWindowKB ), 0 );
        vbox.connect( "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 );
 
        {
@@ -1403,6 +1445,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                                                auto view = ui::TreeView(ui::TreeModel::from(store._handle));
                                                gtk_tree_view_set_enable_search(view, FALSE );
                                                gtk_tree_view_set_headers_visible(view, FALSE );
+                                               g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( EntityInspector_clearKeyValueKB ), 0 );
 
                                                {
                                                        auto renderer = ui::CellRendererText(ui::New);
index 6c8ffd037992e5173a564986264232adbd9f2562..5bd19fd2e75acc96f6e680070373e376000a8311 100644 (file)
@@ -529,6 +529,7 @@ int main( int argc, char* argv[] ){
        if ( lib != 0 ) {
                void ( WINAPI *qDwmEnableComposition )( bool bEnable ) = ( void (WINAPI *) ( bool bEnable ) )GetProcAddress( lib, "DwmEnableComposition" );
                if ( qDwmEnableComposition ) {
+                       // disable Aero
                        qDwmEnableComposition( FALSE );
                }
                FreeLibrary( lib );
index ea0ccd5ba221648329f0306486645723c88f602e..1bea47d16daa80c47f0b4ca559b64d8e9871ba7b 100644 (file)
@@ -181,7 +181,7 @@ class VFSModuleObserver : public ModuleObserver
 public:
 void realise(){
        VFS_Init();
-}
+       }
 
 void unrealise(){
        VFS_Shutdown();
@@ -201,7 +201,7 @@ void VFS_Destroy(){
 // Home Paths
 
 #if GDEF_OS_WINDOWS
-                                                                                                                       #include <shlobj.h>
+#include <shlobj.h>
 #include <objbase.h>
 const GUID qFOLDERID_SavedGames = {0x4C5C32FF, 0xBB9D, 0x43b0, {0xB5, 0xB4, 0x2D, 0x72, 0xE5, 0x4E, 0xAA, 0xA4}};
 #define qREFKNOWNFOLDERID GUID
@@ -2537,8 +2537,8 @@ void Select_constructToolbar( ui::Toolbar toolbar ){
 void CSG_constructToolbar( ui::Toolbar toolbar ){
        toolbar_append_button( toolbar, "CSG Subtract (SHIFT + U)", "selection_csgsubtract.png", "CSGSubtract" );
        toolbar_append_button( toolbar, "CSG Merge (CTRL + U)", "selection_csgmerge.png", "CSGMerge" );
-       toolbar_append_button( toolbar, "Make Hollow", "selection_makehollow.png", "CSGMakeHollow" );
-       toolbar_append_button( toolbar, "Make Room", "selection_makeroom.png", "CSGMakeRoom" );
+       toolbar_append_button( toolbar, "Make Hollow", "selection_makehollow.png", "CSGHollow" );
+       toolbar_append_button( toolbar, "Make Room", "selection_makeroom.png", "CSGRoom" );
 }
 
 void ComponentModes_constructToolbar( ui::Toolbar toolbar ){
@@ -3083,41 +3083,37 @@ void MainFrame::Create(){
        if ( CurrentStyle() == eRegular || CurrentStyle() == eRegularLeft )
        {
                {
+                       ui::Widget hsplit = ui::HPaned(ui::New);
+                       m_vSplit = hsplit;
+                       vbox.pack_start( hsplit, TRUE, TRUE, 0 );
+                       hsplit.show();
+                       {
                        ui::Widget vsplit = ui::VPaned(ui::New);
+                               vsplit.show();
                        m_vSplit = vsplit;
-                       vbox.pack_start( vsplit, TRUE, TRUE, 0 );
-                       vsplit.show();
+                               ui::Widget vsplit2 = ui::VPaned(ui::New);
+                               vsplit2.show();
+                               m_vSplit = vsplit2;
+                               if ( CurrentStyle() == eRegular ){
+                                       gtk_paned_add1( GTK_PANED( hsplit ), vsplit );
+                                       gtk_paned_add2( GTK_PANED( hsplit ), vsplit2 );
+                               }
+                               else{
+                                       gtk_paned_add2( GTK_PANED( hsplit ), vsplit );
+                                       gtk_paned_add1( GTK_PANED( hsplit ), vsplit2 );
+                               }
 
                        // console
                        ui::Widget console_window = Console_constructWindow( window );
                        gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE );
 
-                       {
-                               ui::Widget hsplit = ui::HPaned(ui::New);
-                               hsplit.show();
-                               m_hSplit = hsplit;
-                               gtk_paned_add1( GTK_PANED( vsplit ), hsplit );
-
                                // xy
                                m_pXYWnd = new XYWnd();
                                m_pXYWnd->SetViewType( XY );
                                ui::Widget xy_window = ui::Widget(create_framed_widget( m_pXYWnd->GetWidget( ) ));
 
+                               gtk_paned_add1( GTK_PANED( vsplit ), xy_window );
                                {
-                                       ui::Widget vsplit2 = ui::VPaned(ui::New);
-                                       vsplit2.show();
-                                       m_vSplit2 = vsplit2;
-
-                                       if ( CurrentStyle() == eRegular ) {
-                                               gtk_paned_add1( GTK_PANED( hsplit ), xy_window );
-                                               gtk_paned_add2( GTK_PANED( hsplit ), vsplit2 );
-                                       }
-                                       else
-                                       {
-                                               gtk_paned_add1( GTK_PANED( hsplit ), vsplit2 );
-                                               gtk_paned_add2( GTK_PANED( hsplit ), xy_window );
-                                       }
-
                                        // camera
                                        m_pCamWnd = NewCamWnd();
                                        GlobalCamera_setCamWnd( *m_pCamWnd );
@@ -3617,8 +3613,8 @@ void MainFrame_Construct(){
 
        GlobalCommands_insert( "CSGSubtract", makeCallbackF(CSG_Subtract), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) );
        GlobalCommands_insert( "CSGMerge", makeCallbackF(CSG_Merge), Accelerator( 'U', (GdkModifierType) GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "CSGMakeHollow", makeCallbackF(CSG_MakeHollow) );
-       GlobalCommands_insert( "CSGMakeRoom", makeCallbackF(CSG_MakeRoom) );
+       GlobalCommands_insert( "CSGHollow", makeCallbackF(CSG_MakeHollow) );
+       GlobalCommands_insert( "CSGRoom", makeCallbackF(CSG_MakeRoom) );
 
        Grid_registerCommands();
 
index 4005dff25737f749e686635e1932c00c14474ad4..30758606c0ce174a93f8dd4a312536e3b871e9f0 100644 (file)
@@ -75,6 +75,7 @@ void Mouse_constructPreferences( PreferencesPage& page ){
                page.appendRadio( "Mouse Type",  g_glwindow_globals.m_nMouseType, STRING_ARRAY_RANGE( buttons ) );
        }
        page.appendCheckBox( "Right Button", "Activates Context Menu", g_xywindow_globals.m_bRightClick );
+       page.appendCheckBox( "", "Improved mousewheel zoom", g_xywindow_globals.m_bImprovedWheelZoom );
 }
 void Mouse_constructPage( PreferenceGroup& group ){
        PreferencesPage page( group.createPage( "Mouse", "Mouse Preferences" ) );
index c5a36947e28f06772d936146d0caeee8ac951e8e..eb2cacbd8129ea80a5d76decef17c5a6aabf248a 100644 (file)
@@ -892,6 +892,9 @@ struct RotateDialog
 static gboolean rotatedlg_apply( ui::Widget widget, RotateDialog* rotateDialog ){
        Vector3 eulerXYZ;
 
+       gtk_spin_button_update ( rotateDialog->x );
+       gtk_spin_button_update ( rotateDialog->y );
+       gtk_spin_button_update ( rotateDialog->z );
        eulerXYZ[0] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->x ) );
        eulerXYZ[1] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->y ) );
        eulerXYZ[2] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->z ) );
@@ -916,6 +919,7 @@ static gboolean rotatedlg_cancel( ui::Widget widget, RotateDialog* rotateDialog
 
 static gboolean rotatedlg_ok( ui::Widget widget, RotateDialog* rotateDialog ){
        rotatedlg_apply( widget, rotateDialog );
+//     rotatedlg_cancel( widget, rotateDialog );
        rotateDialog->window.hide();
        return TRUE;
 }
@@ -1056,6 +1060,7 @@ static gboolean scaledlg_cancel( ui::Widget widget, ScaleDialog* scaleDialog ){
 
 static gboolean scaledlg_ok( ui::Widget widget, ScaleDialog* scaleDialog ){
        scaledlg_apply( widget, scaleDialog );
+       //scaledlg_cancel( widget, scaleDialog );
        scaleDialog->window.hide();
        return TRUE;
 }
index 18311b40262299d04c2553168b2f1071d9b14da1..6640b97e7b04b873fb8d9ece04b4df78f5e9aca8 100644 (file)
@@ -169,6 +169,7 @@ typedef ReferenceCaller<TextureGroups, void(const char*), TextureGroups_addShade
 void TextureGroups_addDirectory( TextureGroups& groups, const char* directory ){
        groups.insert( directory );
 }
+
 typedef ReferenceCaller<TextureGroups, void(const char*), TextureGroups_addDirectory> TextureGroupsAddDirectoryCaller;
 
 class DeferredAdjustment
@@ -327,42 +328,80 @@ bool m_searchedTags;
 bool m_tags;
 // The uniform size (in pixels) that textures are resized to when m_resizeTextures is true.
 int m_uniformTextureSize;
+int m_uniformTextureMinSize;
 
 // Return the display width of a texture in the texture browser
-int getTextureWidth( qtexture_t* tex ){
-       int width;
+/*void getTextureWH( qtexture_t* tex, int *width, int *height ){
        if ( !g_TextureBrowser_fixedSize ) {
                // Don't use uniform size
-               width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
+               *width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
+               *height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
+
        }
-       else if
-       ( tex->width >= tex->height ) {
+       else if ( tex->width >= tex->height ) {
                // Texture is square, or wider than it is tall
-               width = m_uniformTextureSize;
+               if ( tex->width >= m_uniformTextureSize ){
+                       *width = m_uniformTextureSize;
+                       *height = (int)( m_uniformTextureSize * ( (float)tex->height / tex->width ) );
+               }
+               else if ( tex->width <= m_uniformTextureMinSize ){
+                       *width = m_uniformTextureMinSize;
+                       *height = (int)( m_uniformTextureMinSize * ( (float)tex->height / tex->width ) );
        }
        else {
-               // Otherwise, preserve the texture's aspect ratio
-               width = (int)( m_uniformTextureSize * ( (float)tex->width / tex->height ) );
+                       *width = tex->width;
+                       *height = tex->height;
+       }
+       }
+       else {
+               // Texture taller than it is wide
+               if ( tex->height >= m_uniformTextureSize ){
+                       *height = m_uniformTextureSize;
+                       *width = (int)( m_uniformTextureSize * ( (float)tex->width / tex->height ) );
+               }
+               else if ( tex->height <= m_uniformTextureMinSize ){
+                       *height = m_uniformTextureMinSize;
+                       *width = (int)( m_uniformTextureMinSize * ( (float)tex->width / tex->height ) );
+               }
+               else {
+                       *width = tex->width;
+                       *height = tex->height;
+               }
        }
-       return width;
 }
 
-// Return the display height of a texture in the texture browser
-int getTextureHeight( qtexture_t* tex ){
-       int height;
-       if ( !g_TextureBrowser_fixedSize ) {
+*/
+void getTextureWH( qtexture_t* tex, int *width, int *height ){
                // Don't use uniform size
-               height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
-       }
-       else if ( tex->height >= tex->width ) {
-               // Texture is square, or taller than it is wide
-               height = m_uniformTextureSize;
+               *width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
+               *height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
+
+       if ( g_TextureBrowser_fixedSize ){
+               int W = *width;
+               int H = *height;
+               if      ( W >= H ) {
+                       // Texture is square, or wider than it is tall
+                       if ( W >= m_uniformTextureSize ){
+                               *width = m_uniformTextureSize;
+                               *height = m_uniformTextureSize * H / W;
+       }
+                       else if ( W <= m_uniformTextureMinSize ){
+                               *width = m_uniformTextureMinSize;
+                               *height = m_uniformTextureMinSize * H / W;
+                       }
        }
        else {
-               // Otherwise, preserve the texture's aspect ratio
-               height = (int)( m_uniformTextureSize * ( (float)tex->height / tex->width ) );
+                       // Texture taller than it is wide
+                       if ( H >= m_uniformTextureSize ){
+                               *height = m_uniformTextureSize;
+                               *width = m_uniformTextureSize * W / H;
+       }
+                       else if ( H <= m_uniformTextureMinSize ){
+                               *height = m_uniformTextureMinSize;
+                               *width = m_uniformTextureMinSize * W / H;
+                       }
+               }
        }
-       return height;
 }
 
 TextureBrowser() :
@@ -387,7 +426,8 @@ TextureBrowser() :
        m_rmbSelected( false ),
        m_searchedTags( false ),
        m_tags( false ),
-       m_uniformTextureSize( 96 ){
+       m_uniformTextureSize( 160 ),
+       m_uniformTextureMinSize( 48 ){
 }
 };
 
@@ -488,8 +528,8 @@ void Texture_StartPos( TextureLayout& layout ){
 void Texture_NextPos( TextureBrowser& textureBrowser, TextureLayout& layout, qtexture_t* current_texture, int *x, int *y ){
        qtexture_t* q = current_texture;
 
-       int nWidth = textureBrowser.getTextureWidth( q );
-       int nHeight = textureBrowser.getTextureHeight( q );
+       int nWidth, nHeight;
+       textureBrowser.getTextureWH( q, &nWidth, &nHeight );
        if ( layout.current_x + nWidth > textureBrowser.width - 8 && layout.current_row ) { // go to the next row unless the texture is the first on the row
                layout.current_x = 8;
                layout.current_y -= layout.current_row + TextureBrowser_fontHeight( textureBrowser ) + 4;
@@ -618,7 +658,9 @@ void TextureBrowser_evaluateHeight( TextureBrowser& textureBrowser ){
 
                        int x, y;
                        Texture_NextPos( textureBrowser, layout, shader->getTexture(), &x, &y );
-                       textureBrowser.m_nTotalHeight = std::max( textureBrowser.m_nTotalHeight, abs( layout.current_y ) + TextureBrowser_fontHeight( textureBrowser ) + textureBrowser.getTextureHeight( shader->getTexture() ) + 4 );
+                       int nWidth, nHeight;
+                       textureBrowser.getTextureWH( shader->getTexture(), &nWidth, &nHeight );
+                       textureBrowser.m_nTotalHeight = std::max( textureBrowser.m_nTotalHeight, abs( layout.current_y ) + TextureBrowser_fontHeight( textureBrowser ) + nHeight + 4 );
                }
        }
 }
@@ -871,8 +913,8 @@ void TextureBrowser_ShowDirectory( TextureBrowser& textureBrowser, const char* d
                Archive* archive = GlobalFileSystem().getArchive( directory );
                if ( archive != nullptr )
                {
-                       LoadShaderVisitor visitor;
-                       archive->forEachFile( Archive::VisitorFunc( visitor, Archive::eFiles, 0 ), "textures/" );
+               LoadShaderVisitor visitor;
+               archive->forEachFile( Archive::VisitorFunc( visitor, Archive::eFiles, 0 ), "textures/" );
 
                        // Doom3-like dds/ prefix (used by DarkPlaces).
                        archive->forEachFile( Archive::VisitorFunc( visitor, Archive::eFiles, 0 ), "dds/textures/" );
@@ -1083,8 +1125,8 @@ IShader* Texture_At( TextureBrowser& textureBrowser, int mx, int my ){
                        break;
                }
 
-               int nWidth = textureBrowser.getTextureWidth( q );
-               int nHeight = textureBrowser.getTextureHeight( q );
+               int nWidth, nHeight;
+               textureBrowser.getTextureWH( q, &nWidth, &nHeight );
                if ( mx > x && mx - x < nWidth
                         && my < y && y - my < nHeight + TextureBrowser_fontHeight( textureBrowser ) ) {
                        return shader;
@@ -1221,8 +1263,8 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
                        break;
                }
 
-               int nWidth = textureBrowser.getTextureWidth( q );
-               int nHeight = textureBrowser.getTextureHeight( q );
+               int nWidth, nHeight;
+               textureBrowser.getTextureWH( q, &nWidth, &nHeight );
 
                if ( y != last_y ) {
                        last_y = y;
@@ -1374,6 +1416,11 @@ void TextureBrowser_setUniformSize( TextureBrowser& textureBrowser, std::size_t
        TextureBrowser_queueDraw( textureBrowser );
 }
 
+void TextureBrowser_setUniformMinSize( TextureBrowser& textureBrowser, std::size_t scale ){
+       textureBrowser.m_uniformTextureMinSize = scale;
+
+       TextureBrowser_queueDraw( textureBrowser );
+}
 
 void TextureBrowser_MouseWheel( TextureBrowser& textureBrowser, bool bUp ){
        int originy = TextureBrowser_getOriginY( textureBrowser );
@@ -1697,6 +1744,8 @@ void TreeView_onRowActivated( ui::TreeView treeview, ui::TreePath path, ui::Tree
                ScopeDisableScreenUpdates disableScreenUpdates( dirName, "Loading Textures" );
                TextureBrowser_ShowDirectory( GlobalTextureBrowser(), dirName );
                TextureBrowser_queueDraw( GlobalTextureBrowser() );
+               //deactivate, so SPACE and RETURN wont be broken for 2d
+               gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( treeview ) ) ), NULL );
        }
 }
 
@@ -2434,7 +2483,7 @@ void TextureBrowser_showGLWidget(){
                textureBrowser.m_vframe.set_child_packing( textureBrowser.m_gl_widget, TRUE, TRUE, 0, ui::Packing::START );
 
                textureBrowser.m_gl_widget.show();
-       }
+}
 }
 
 void TextureBrowser_hideGLWidget(){
@@ -2804,6 +2853,17 @@ struct UniformTextureSize {
        }
 };
 
+struct UniformTextureMinSize {
+       static void Export(const TextureBrowser &self, const Callback<void(int)> &returnz) {
+               returnz(GlobalTextureBrowser().m_uniformTextureMinSize);
+       }
+
+       static void Import(TextureBrowser &self, int value) {
+               if (value > 16)
+                       TextureBrowser_setUniformSize(self, value);
+       }
+};
+
 void TextureBrowser_constructPreferences( PreferencesPage& page ){
        page.appendCheckBox(
                "", "Texture scrollbar",
@@ -2817,18 +2877,15 @@ void TextureBrowser_constructPreferences( PreferencesPage& page ){
                        make_property<TextureScale>(GlobalTextureBrowser())
                        );
        }
-       page.appendSpinner(
-               "Texture Thumbnail Size",
-               GlobalTextureBrowser().m_uniformTextureSize,
-               GlobalTextureBrowser().m_uniformTextureSize,
-               16, 8192
-       );
+       page.appendSpinner( "Thumbnails Max Size", GlobalTextureBrowser().m_uniformTextureSize, GlobalTextureBrowser().m_uniformTextureSize, 16, 8192 );
+       page.appendSpinner( "Thumbnails Min Size", GlobalTextureBrowser().m_uniformTextureMinSize, GlobalTextureBrowser().m_uniformTextureMinSize, 16, 8192 );
        page.appendEntry( "Mousewheel Increment", GlobalTextureBrowser().m_mouseWheelScrollIncrement );
        {
                const char* startup_shaders[] = { "None", TextureBrowser_getCommonShadersName() };
                page.appendCombo( "Load Shaders at Startup", reinterpret_cast<int&>( GlobalTextureBrowser().m_startupShaders ), STRING_ARRAY_RANGE( startup_shaders ) );
        }
 }
+
 void TextureBrowser_constructPage( PreferenceGroup& group ){
        PreferencesPage page( group.createPage( "Texture Browser", "Texture Browser Preferences" ) );
        TextureBrowser_constructPreferences( page );
@@ -2868,6 +2925,7 @@ void TextureBrowser_Construct(){
 
        GlobalPreferenceSystem().registerPreference( "TextureScale", make_property_string<TextureScale>(textureBrowser) );
        GlobalPreferenceSystem().registerPreference( "UniformTextureSize", make_property_string<UniformTextureSize>(textureBrowser) );
+       GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize", make_property_string<UniformTextureMinSize>(textureBrowser) );
        GlobalPreferenceSystem().registerPreference( "TextureScrollbar", make_property_string<TextureBrowser_ShowScrollbar>(textureBrowser));
        GlobalPreferenceSystem().registerPreference( "ShowShaders", make_property_string( textureBrowser.m_showShaders ) );
        GlobalPreferenceSystem().registerPreference( "ShowShaderlistOnly", make_property_string( g_TextureBrowser_shaderlistOnly ) );
index 237f44af26637db03be1633c6747e3a6c70d4cc6..5e67ecf2813394ebc4c881e16c647b3636fcc633 100644 (file)
@@ -501,17 +501,17 @@ void XYWnd::SetScale( float f ){
        XYWnd_Update( *this );
 }
 
-void XYWnd_ZoomIn( XYWnd* xy ){
+void XYWnd::ZoomIn(){
        float max_scale = 64;
-       float scale = xy->Scale() * 5.0f / 4.0f;
+       float scale = Scale() * 5.0f / 4.0f;
        if ( scale > max_scale ) {
-               if ( xy->Scale() != max_scale ) {
-                       xy->SetScale( max_scale );
+               if ( Scale() != max_scale ) {
+                       SetScale( max_scale );
                }
        }
        else
        {
-               xy->SetScale( scale );
+               SetScale( scale );
        }
 }
 
@@ -519,17 +519,31 @@ void XYWnd_ZoomIn( XYWnd* xy ){
 // NOTE: the zoom out factor is 4/5, we could think about customizing it
 //  we don't go below a zoom factor corresponding to 10% of the max world size
 //  (this has to be computed against the window size)
-void XYWnd_ZoomOut( XYWnd* xy ){
-       float min_scale = MIN( xy->Width(),xy->Height() ) / ( 1.1f * ( g_MaxWorldCoord - g_MinWorldCoord ) );
-       float scale = xy->Scale() * 4.0f / 5.0f;
+void XYWnd::ZoomOut(){
+       float min_scale = MIN( Width(), Height() ) / ( 1.1f * ( g_MaxWorldCoord - g_MinWorldCoord ) );
+       float scale = Scale() * 4.0f / 5.0f;
        if ( scale < min_scale ) {
-               if ( xy->Scale() != min_scale ) {
-                       xy->SetScale( min_scale );
+               if ( Scale() != min_scale ) {
+                       SetScale( min_scale );
                }
        }
        else
        {
-               xy->SetScale( scale );
+               SetScale( scale );
+       }
+}
+
+void XYWnd::ZoomInWithMouse( int pointx, int pointy ){
+       float old_scale = Scale();
+       ZoomIn();
+       if ( g_xywindow_globals.m_bImprovedWheelZoom ) {
+               float scale_diff = 1.0 / old_scale - 1.0 / Scale();
+               int nDim1 = ( m_viewType == YZ ) ? 1 : 0;
+               int nDim2 = ( m_viewType == XY ) ? 1 : 2;
+               Vector3 origin = GetOrigin();
+               origin[nDim1] += scale_diff * (pointx - 0.5 * Width());
+               origin[nDim2] -= scale_diff * (pointy - 0.5 * Height());
+               SetOrigin( origin );
        }
 }
 
@@ -767,10 +781,10 @@ void xywnd_motion( gdouble x, gdouble y, guint state, void* data ){
 
 gboolean xywnd_wheel_scroll( ui::Widget widget, GdkEventScroll* event, XYWnd* xywnd ){
        if ( event->direction == GDK_SCROLL_UP ) {
-               XYWnd_ZoomIn( xywnd );
+               xywnd->ZoomInWithMouse( (int)event->x, (int)event->y );
        }
        else if ( event->direction == GDK_SCROLL_DOWN ) {
-               XYWnd_ZoomOut( xywnd );
+               xywnd->ZoomOut();
        }
        return FALSE;
 }
@@ -1211,16 +1225,15 @@ int g_dragZoom = 0;
 void XYWnd_zoomDelta( int x, int y, unsigned int state, void* data ){
        if ( y != 0 ) {
                g_dragZoom += y;
-
                while ( abs( g_dragZoom ) > 8 )
                {
                        if ( g_dragZoom > 0 ) {
-                               XYWnd_ZoomOut( reinterpret_cast<XYWnd*>( data ) );
+                               reinterpret_cast<XYWnd*>( data )->ZoomOut();
                                g_dragZoom -= 8;
                        }
                        else
                        {
-                               XYWnd_ZoomIn( reinterpret_cast<XYWnd*>( data ) );
+                               reinterpret_cast<XYWnd*>( data )->ZoomIn();
                                g_dragZoom += 8;
                        }
                }
@@ -2530,14 +2543,14 @@ void XY_Zoom100(){
 }
 
 void XY_ZoomIn(){
-       XYWnd_ZoomIn( g_pParentWnd->ActiveXY() );
+       g_pParentWnd->ActiveXY()->ZoomIn();
 }
 
 // NOTE: the zoom out factor is 4/5, we could think about customizing it
 //  we don't go below a zoom factor corresponding to 10% of the max world size
 //  (this has to be computed against the window size)
 void XY_ZoomOut(){
-       XYWnd_ZoomOut( g_pParentWnd->ActiveXY() );
+       g_pParentWnd->ActiveXY()->ZoomOut();
 }
 
 
@@ -2777,6 +2790,7 @@ void XYWindow_Construct(){
        GlobalPreferenceSystem().registerPreference( "ClipCaulk", make_property_string( g_clip_useCaulk ) );
 
        GlobalPreferenceSystem().registerPreference( "NewRightClick", make_property_string( g_xywindow_globals.m_bRightClick ) );
+       GlobalPreferenceSystem().registerPreference( "ImprovedWheelZoom", make_property_string( g_xywindow_globals.m_bImprovedWheelZoom ) );
        GlobalPreferenceSystem().registerPreference( "ChaseMouse", make_property_string( g_xywindow_globals_private.m_bChaseMouse ) );
        GlobalPreferenceSystem().registerPreference( "SizePainting", make_property_string( g_xywindow_globals_private.m_bSizePaint ) );
        GlobalPreferenceSystem().registerPreference( "ShowCrosshair", make_property_string( g_xywindow_globals_private.g_bCrossHairs ) );
index bf7eb853432cc683a4f4874aaac0c5f28abd239c..bb9e92ddc8f271613219ba735682d13af48f9856 100644 (file)
@@ -124,6 +124,10 @@ void Zoom_End();
 bool m_zoom_started;
 guint m_zoom_focusOut;
 
+void ZoomIn();
+void ZoomOut();
+void ZoomInWithMouse( int pointx, int pointy );
+
 void Redraw();
 
 void SetActive( bool b ){
@@ -253,6 +257,7 @@ struct xywindow_globals_t
 
        bool m_bRightClick;
        bool m_bNoStipple;
+       bool m_bImprovedWheelZoom;
 
        xywindow_globals_t() :
                color_gridback( 0.77f, 0.77f, 0.77f ),
@@ -271,7 +276,8 @@ struct xywindow_globals_t
                AxisColorY( 0.f, 1.f, 0.f ),
                AxisColorZ( 0.f, 0.f, 1.f ),
                m_bRightClick( true ),
-               m_bNoStipple( false ){
+               m_bNoStipple( false ),
+               m_bImprovedWheelZoom( true ){
        }
 
 };
index 93335d2f1ec871178c4c4dbb24ba53a7456eee68..f14cc43c843c4f8c8efdb30d632767832898ca82 100644 (file)
@@ -2444,6 +2444,30 @@ int LightMain( int argc, char **argv ){
                        i++;
                }
 
+               /* Lighting brightness */
+               else if( !strcmp( argv[ i ], "-brightness" ) ){
+                       f = atof( argv[ i + 1 ] );
+                       lightmapBrightness = f;
+                       Sys_Printf( "Lighting brightness set to %f\n", lightmapBrightness );
+                       i++;
+               }
+
+               /* Lighting contrast */
+               else if( !strcmp( argv[ i ], "-contrast" ) ){
+                       f = atof( argv[ i + 1 ] );
+                       lightmapContrast = f;
+                       if( lightmapContrast > 255 ){
+                               lightmapContrast = 255;
+                       }
+                       else if( lightmapContrast < -255 ){
+                               lightmapContrast = -255;
+                       }
+                       Sys_Printf( "Lighting contrast set to %f\n", lightmapContrast );
+                       i++;
+                       /* change to factor in range of 0 to 129.5 */
+                       lightmapContrast = ( 259 * ( lightmapContrast + 255 ) ) / ( 255 * ( 259 - lightmapContrast ) );
+               }
+
                /* ydnar switches */
                else if ( !strcmp( argv[ i ], "-bounce" ) ) {
                        bounce = atoi( argv[ i + 1 ] );
index 6317d14755466fe1a625e601efd622e9c81c5146..aa71f82696ea053be8900fa8a2b5da80b535fba0 100644 (file)
@@ -55,6 +55,8 @@ void ColorToBytes( const float *color, byte *colorBytes, float scale ){
        if ( scale <= 0.0f ) {
                scale = 1.0f;
        }
+       /* globally */
+       scale *= lightmapBrightness;
 
        /* make a local copy */
        VectorScale( color, scale, sample );
@@ -119,6 +121,23 @@ void ColorToBytes( const float *color, byte *colorBytes, float scale ){
        /* compensate for ingame overbrighting/bitshifting */
        VectorScale( sample, ( 1.0f / lightmapCompensate ), sample );
 
+       /* contrast */
+       if ( lightmapContrast != 1.0f ){
+               for ( i = 0; i < 3; i++ ){
+                       sample[i] = lightmapContrast * ( sample[i] - 128 ) + 128;
+                       if ( sample[i] < 0 ){
+                               sample[i] = 0;
+                       }
+               }
+               if ( ( sample[0] > 255 ) || ( sample[1] > 255 ) || ( sample[2] > 255 ) ) {
+                       max = sample[0] > sample[1] ? sample[0] : sample[1];
+                       max = max > sample[2] ? max : sample[2];
+                       sample[0] = sample[0] * 255 / max;
+                       sample[1] = sample[1] * 255 / max;
+                       sample[2] = sample[2] * 255 / max;
+               }
+       }
+
        /* sRGB lightmaps */
        if ( lightmapsRGB ) {
                sample[0] = floor( Image_sRGBFloatFromLinearFloat( sample[0] * ( 1.0 / 255.0 ) ) * 255.0 + 0.5 );
index b88a5390c27d1eeb4e1f5b4845a7f30077ae2162..0021ba92257a5b52fa75b3a39afd7a21e4d80c11 100644 (file)
@@ -741,6 +741,7 @@ skipEXfile:
                                                temp, scriptline, token );
                        }
 
+                       qboolean hasmap = qfalse;
                        while ( 1 )
                        {
                                /* get the next token */
@@ -766,13 +767,19 @@ skipEXfile:
                                                if ( !strcmp( token, "}" ) ) {
                                                        break;
                                                }
+                                               if ( !strcmp( token, "{" ) ) {
+                                                       Sys_Printf( "WARNING9: %s : line %d : opening brace inside shader stage\n", temp, scriptline );
+                                               }
+                                               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 ( !Q_stricmp( token, "map" ) ||
                                                        !Q_stricmp( token, "clampMap" ) ) {
-
+                                                       hasmap = qtrue;
                                                        /* get an image */
                                                        GetToken( qfalse );
                                                        if ( token[ 0 ] != '*' && token[ 0 ] != '$' ) {
@@ -781,6 +788,7 @@ skipEXfile:
                                                }
                                                else if ( !Q_stricmp( token, "animMap" ) ||
                                                        !Q_stricmp( token, "clampAnimMap" ) ) {
+                                                       hasmap = qtrue;
                                                        GetToken( qfalse );// skip num
                                                        while ( TokenAvailable() ){
                                                                GetToken( qfalse );
@@ -788,6 +796,7 @@ skipEXfile:
                                                        }
                                                }
                                                else if ( !Q_stricmp( token, "videoMap" ) ){
+                                                       hasmap = qtrue;
                                                        GetToken( qfalse );
                                                        FixDOSName( token );
                                                        if ( strchr( token, '/' ) == NULL && strchr( token, '\\' ) == NULL ){
@@ -812,6 +821,9 @@ skipEXfile:
                                                }
                                        }
                                }
+                               else if ( !Q_strncasecmp( token, "implicit", 8 ) ){
+                                       Sys_Printf( "WARNING5: %s : line %d : unsupported %s shader\n", temp, scriptline, token );
+                               }
                                /* skip the shader */
                                else if ( !wantShader ) continue;
 
@@ -830,6 +842,7 @@ skipEXfile:
 
                                /* skyparms <outer image> <cloud height> <inner image> */
                                else if ( !Q_stricmp( token, "skyParms" ) ) {
+                                       hasmap = qtrue;
                                        /* get image base */
                                        GetToken( qfalse );
 
@@ -853,6 +866,9 @@ skipEXfile:
                                        GetToken( qfalse );
                                        GetToken( qfalse );
                                }
+                               else if ( !Q_stricmp( token, "fogparms" ) ){
+                                       hasmap = qtrue;
+                               }
                        }
 
                        //exclude shader
@@ -864,6 +880,9 @@ skipEXfile:
                                                break;
                                        }
                                }
+                               if ( !hasmap ){
+                                       wantShader = qfalse;
+                               }
                                if ( wantShader ){
                                        if ( ShaderFileExcluded ){
                                                if ( reasonShaderFile != NULL ){
@@ -1080,7 +1099,7 @@ skipEXfile:
 
 /*
    repackBSPMain()
-   repack multiple maps, strip only required shaders
+   repack multiple maps, strip out only required shaders
    works for Q3 type of shaders and ents
  */
 
@@ -1698,6 +1717,10 @@ skipEXrefile:
                                                        strcat( shaderText, "\n\t}" );
                                                        break;
                                                }
+                                               if ( !strcmp( token, "{" ) ) {
+                                                       strcat( shaderText, "\n\t{" );
+                                                       Sys_Printf( "WARNING9: %s : line %d : opening brace inside shader stage\n", temp, scriptline );
+                                               }
                                                /* skip the shader */
                                                if ( !wantShader ) continue;
 
@@ -1872,11 +1895,6 @@ skipEXrefile:
                        }
 
                        //exclude shader
-                       if ( wantShader && !hasmap ){
-                               Sys_Printf( "WARNING8: %s : shader has no known maps\n", pk3Shaders + shader*65 );
-                               wantShader = qfalse;
-                               *( pk3Shaders + shader*65 ) = '\0';
-                       }
                        if ( wantShader ){
                                for ( j = 0; j < ExShadersN; j++ ){
                                        if ( !Q_stricmp( ExShaders + j*65, pk3Shaders + shader*65 ) ){
@@ -1885,6 +1903,11 @@ skipEXrefile:
                                                break;
                                        }
                                }
+                               if ( wantShader && !hasmap ){
+                                       Sys_Printf( "WARNING8: %s : shader has no known maps\n", pk3Shaders + shader*65 );
+                                       wantShader = qfalse;
+                                       *( pk3Shaders + shader*65 ) = '\0';
+                               }
                                if ( wantShader ){
                                        strcat( allShaders, shaderText );
                                        *( pk3Shaders + shader*65 ) = '\0';
index 27edf7e4637851b8f8c3fd7a3b682fb04b74d870..17e690e7a1c67d1a97c1523f62685aaefb2d8095 100644 (file)
@@ -548,7 +548,7 @@ void InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap
                        vec3_t min = { 999999, 999999, 999999 }, max = { -999999, -999999, -999999 };
                        vec3_t avgDirection = { 0, 0, 0 };
                        int axis;
-                       #define nonax_clip_dbg 1
+                       #define nonax_clip_dbg 0
 
                        /* temp hack */
                        if ( !si->clipModel && !( si->compileFlags & C_SOLID ) ) {
index c3401d7b8fa6cf79f916c26830d59038c9271208..7f0582e249820c4513110f4a6574273dd1423515 100644 (file)
@@ -2386,6 +2386,8 @@ Q_EXTERN float texturesRGB Q_ASSIGN( qfalse );
 Q_EXTERN float colorsRGB Q_ASSIGN( qfalse );
 Q_EXTERN float lightmapExposure Q_ASSIGN( 0.0f );
 Q_EXTERN float lightmapCompensate Q_ASSIGN( 1.0f );
+Q_EXTERN float lightmapBrightness Q_ASSIGN( 1.0f );
+Q_EXTERN float lightmapContrast Q_ASSIGN( 1.0f );
 
 /* ydnar: for runtime tweaking of falloff tolerance */
 Q_EXTERN float falloffTolerance Q_ASSIGN( 1.0f );