From: Garux Date: Wed, 2 Aug 2017 06:06:17 +0000 (+0300) Subject: Q3map2: X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e7c45da823515747a88569374d62717b72dcf078;p=xonotic%2Fnetradiant.git Q3map2: * code fixes * packer: !FAIL! msg for missing ingame resources, ~fail for the rest * bumped stack size to 4Mb to fix crash for huge skies, using old shaders with fairly useless q3map_surfacelight + q3map_lightsubdivide < 999 combo Radiant: binds... * F5: run first in the list or recently invoked build option * F11: fullscreen misc... * opening *.map, sent via cmd line: enabled for non win32 too * fix: textures find/replace wnd better default pos, size * fix: crash in CSG::Subtract * fix crash: main wnd maximized + 'start on primary monitor' off + monitors > 1 * correct save/restore of main wnd pos/size and maximized/fullscreened states * scale widgets consistently along with main wnd, while using regular layout --- diff --git a/Makefile b/Makefile index 048407fb..bcb1f6f6 100644 --- a/Makefile +++ b/Makefile @@ -483,7 +483,9 @@ endif %.o: %.c $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) | dependencies-check $(CC) $< $(CFLAGS) $(CFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(CPPFLAGS_COMMON) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ -$(INSTALLDIR)/q3map2.$(EXE): LDFLAGS_EXTRA := -Wl,--large-address-aware +ifeq ($(OS),Win32) +$(INSTALLDIR)/q3map2.$(EXE): LDFLAGS_EXTRA := -Wl,--large-address-aware,--stack,4194304 +endif $(INSTALLDIR)/q3map2.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG) $(LIBS_JPEG) $(LIBS_ZLIB) $(INSTALLDIR)/q3map2.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) $(CPPFLAGS_JPEG) -Itools/quake3/common -Ilibs -Iinclude $(INSTALLDIR)/q3map2.$(EXE): \ diff --git a/libs/string/string.h b/libs/string/string.h index 826d4a93..dd67d2af 100644 --- a/libs/string/string.h +++ b/libs/string/string.h @@ -148,6 +148,11 @@ inline bool string_equal_suffix( const char* string, const char* suffix){ return string_equal_n( s , suffix, string_length( suffix ) ); } +inline bool string_equal_suffix_nocase( const char* string, const char* suffix){ + const char *s = string + string_length( string ) - string_length( suffix ); + return string_equal_nocase_n( s , suffix, string_length( suffix ) ); +} + /// \brief Copies \p other into \p string and returns \p string. /// Assumes that the space allocated for \p string is at least string_length(other) + 1. /// O(n) diff --git a/radiant/build.cpp b/radiant/build.cpp index 793ab5a5..baa39568 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -954,6 +954,7 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi namespace { CopiedString g_buildMenu; +CopiedString g_lastExecutedBuild; } void LoadBuildMenu(); @@ -996,6 +997,7 @@ BuildMenuItem( const char* name, GtkMenuItem* item ) : m_name( name ), m_item( item ){ } void run(){ + g_lastExecutedBuild = m_name; RunBSP( m_name ); } typedef MemberCaller RunCaller; @@ -1069,3 +1071,13 @@ void BuildMenu_Construct(){ void BuildMenu_Destroy(){ SaveBuildMenu(); } + + +void Build_runRecentExecutedBuild(){ + if( g_lastExecutedBuild.empty() ){ + g_BuildMenuItems.begin()->run(); + } + else{ + RunBSP( g_lastExecutedBuild.c_str() ); + } +} diff --git a/radiant/build.h b/radiant/build.h index 32a39718..39024fad 100644 --- a/radiant/build.h +++ b/radiant/build.h @@ -40,5 +40,6 @@ typedef struct _GtkMenu GtkMenu; void Build_constructMenu( GtkMenu* menu ); extern GtkMenu* g_bsp_menu; +void Build_runRecentExecutedBuild(); #endif diff --git a/radiant/csg.cpp b/radiant/csg.cpp index 753c5077..5b9eb44a 100644 --- a/radiant/csg.cpp +++ b/radiant/csg.cpp @@ -670,8 +670,9 @@ void post( const scene::Path& path, scene::Instance& instance ) const { delete ( *i ); } } + scene::Node& parent = path.parent(); Path_deleteTop( path ); - if( Node_getTraversable( path.parent() )->empty() ){ + if( Node_getTraversable( parent )->empty() ){ m_eraseParent = true; } } diff --git a/radiant/environment.cpp b/radiant/environment.cpp index 99aa6c26..ad0edd77 100644 --- a/radiant/environment.cpp +++ b/radiant/environment.cpp @@ -180,6 +180,20 @@ bool portable_app_setup(){ return false; } + +char* openCmdMap; + +void cmdMap(){ + openCmdMap = NULL; + for ( int i = 1; i < g_argc; ++i ) + { + //if ( !stricmp( g_argv[i] + strlen(g_argv[i]) - 4, ".map" ) ){ + if( string_equal_suffix_nocase( g_argv[i], ".map" ) ){ + openCmdMap = g_argv[i]; + } + } +} + #if defined( POSIX ) #include @@ -251,24 +265,13 @@ void environment_init( int argc, char* argv[] ){ home_path = home.c_str(); } gamedetect(); + cmdMap(); } #elif defined( WIN32 ) #include -char* openCmdMap; - -void cmdMap(){ - openCmdMap = NULL; - for ( int i = 1; i < g_argc; ++i ) - { - if ( !stricmp( g_argv[i] + strlen(g_argv[i]) - 4, ".map" ) ){ - openCmdMap = g_argv[i]; - } - } -} - void environment_init( int argc, char* argv[] ){ args_init( argc, argv ); diff --git a/radiant/environment.h b/radiant/environment.h index 18398e8c..b5dc6c15 100644 --- a/radiant/environment.h +++ b/radiant/environment.h @@ -29,9 +29,7 @@ const char* environment_get_app_path(); extern int g_argc; extern char** g_argv; -#if defined( WIN32 ) extern char* openCmdMap; -#endif #endif diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index 8452a760..88d28320 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -133,7 +133,7 @@ static gint replace_focus_in( GtkWidget* widget, GdkEventFocus *event, gpointer FindTextureDialog::FindTextureDialog(){ m_bSelectedOnly = FALSE; - //m_position_tracker.setPosition( c_default_window_pos ); + m_position_tracker.setPosition( WindowPosition( -1, -1, 0, 0 ) ); } FindTextureDialog::~FindTextureDialog(){ diff --git a/radiant/main.cpp b/radiant/main.cpp index f7f6cf6b..d17db3d6 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -652,13 +652,10 @@ int main( int argc, char* argv[] ){ hide_splash(); -#ifdef WIN32 if( openCmdMap && *openCmdMap ){ Map_LoadFile( openCmdMap ); } - else -#endif // WIN32 - if ( g_bLoadLastMap && !g_strLastMap.empty() ) { + else if ( g_bLoadLastMap && !g_strLastMap.empty() ) { Map_LoadFile( g_strLastMap.c_str() ); } else diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 9054117a..0bb43da6 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -135,11 +135,11 @@ struct layout_globals_t layout_globals_t() : m_position( -1, -1, 640, 480 ), - nXYHeight( 300 ), - nXYWidth( 300 ), - nCamWidth( 200 ), - nCamHeight( 200 ), - nState( GDK_WINDOW_STATE_MAXIMIZED ){ + nXYHeight( 350 ), + nXYWidth( 600 ), + nCamWidth( 300 ), + nCamHeight( 210 ), + nState( 0 ){ } }; @@ -2117,6 +2117,7 @@ GtkMenuItem* create_bsp_menu(){ } create_menu_item_with_mnemonic( menu, "Customize...", "BuildMenuCustomize" ); + create_menu_item_with_mnemonic( menu, "Run recent build", "Build_runRecentExecutedBuild" ); menu_separator( menu ); @@ -2158,6 +2159,7 @@ GtkMenuItem* create_misc_menu(){ // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=394 // create_menu_item_with_mnemonic(menu, "_Print XY View", FreeCaller()); create_menu_item_with_mnemonic( menu, "_Background select", FreeCaller() ); + create_menu_item_with_mnemonic( menu, "Fullscreen", "Fullscreen" ); return misc_menu_item; } @@ -2866,19 +2868,9 @@ void MainFrame::Create(){ #ifdef WIN32 if ( g_multimon_globals.m_bStartOnPrimMon ) { PositionWindowOnPrimaryScreen( g_layout_globals.m_position ); - window_set_position( window, g_layout_globals.m_position ); } - else #endif - if ( g_layout_globals.nState & GDK_WINDOW_STATE_MAXIMIZED ) { - gtk_window_maximize( window ); - WindowPosition default_position( -1, -1, 640, 480 ); - window_set_position( window, default_position ); - } - else - { - window_set_position( window, g_layout_globals.m_position ); - } + window_set_position( window, g_layout_globals.m_position ); m_window = window; @@ -2898,22 +2890,22 @@ void MainFrame::Create(){ gtk_widget_show( vsplit2 ); m_vSplit2 = vsplit2; if ( CurrentStyle() == eRegular ){ - gtk_paned_add1( GTK_PANED( hsplit ), vsplit ); - gtk_paned_add2( GTK_PANED( hsplit ), vsplit2 ); + gtk_paned_pack1( GTK_PANED( hsplit ), vsplit, TRUE, TRUE ); + gtk_paned_pack2( GTK_PANED( hsplit ), vsplit2, TRUE, TRUE ); } else{ - gtk_paned_add2( GTK_PANED( hsplit ), vsplit ); - gtk_paned_add1( GTK_PANED( hsplit ), vsplit2 ); + gtk_paned_pack2( GTK_PANED( hsplit ), vsplit, TRUE, TRUE ); + gtk_paned_pack1( GTK_PANED( hsplit ), vsplit2, TRUE, TRUE ); } // console GtkWidget* console_window = Console_constructWindow( window ); - gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE ); + gtk_paned_pack2( GTK_PANED( vsplit ), console_window, TRUE, TRUE ); // xy m_pXYWnd = new XYWnd(); m_pXYWnd->SetViewType( XY ); GtkWidget* xy_window = GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) ); - gtk_paned_add1( GTK_PANED( vsplit ), xy_window ); + gtk_paned_pack1( GTK_PANED( vsplit ), xy_window, TRUE, TRUE ); { // camera m_pCamWnd = NewCamWnd(); @@ -2921,27 +2913,15 @@ void MainFrame::Create(){ CamWnd_setParent( *m_pCamWnd, window ); GtkFrame* camera_window = create_framed_widget( CamWnd_getWidget( *m_pCamWnd ) ); - gtk_paned_add1( GTK_PANED( vsplit2 ), GTK_WIDGET( camera_window ) ); + gtk_paned_pack1( GTK_PANED( vsplit2 ), GTK_WIDGET( camera_window ), TRUE, TRUE ); // textures GtkFrame* texture_window = create_framed_widget( TextureBrowser_constructWindow( window ) ); - gtk_paned_add2( GTK_PANED( vsplit2 ), GTK_WIDGET( texture_window ) ); + gtk_paned_pack2( GTK_PANED( vsplit2 ), GTK_WIDGET( texture_window ), TRUE, TRUE ); } } } - - gtk_paned_set_position( GTK_PANED( m_vSplit ), g_layout_globals.nXYHeight ); - - if ( CurrentStyle() == eRegular ) { - gtk_paned_set_position( GTK_PANED( m_hSplit ), g_layout_globals.nXYWidth ); - } - else - { - gtk_paned_set_position( GTK_PANED( m_hSplit ), g_layout_globals.nCamWidth ); - } - - gtk_paned_set_position( GTK_PANED( m_vSplit2 ), g_layout_globals.nCamHeight ); } else if ( CurrentStyle() == eFloating ) { { @@ -3089,6 +3069,25 @@ void MainFrame::Create(){ EverySecondTimer_enable(); + if ( g_layout_globals.nState & GDK_WINDOW_STATE_MAXIMIZED ) { + gtk_window_maximize( window ); + } + if ( g_layout_globals.nState & GDK_WINDOW_STATE_FULLSCREEN ) { + gtk_window_fullscreen( window ); + } + if ( !FloatingGroupDialog() ) { + gtk_paned_set_position( GTK_PANED( m_vSplit ), g_layout_globals.nXYHeight ); + + if ( CurrentStyle() == eRegular ) { + gtk_paned_set_position( GTK_PANED( m_hSplit ), g_layout_globals.nXYWidth ); + } + else + { + gtk_paned_set_position( GTK_PANED( m_hSplit ), g_layout_globals.nCamWidth ); + } + + gtk_paned_set_position( GTK_PANED( m_vSplit2 ), g_layout_globals.nCamHeight ); + } //GlobalShortcuts_reportUnregistered(); } @@ -3107,7 +3106,9 @@ void MainFrame::SaveWindowInfo(){ g_layout_globals.nCamHeight = gtk_paned_get_position( GTK_PANED( m_vSplit2 ) ); } - g_layout_globals.m_position = m_position_tracker.getPosition(); + if( gdk_window_get_state( GTK_WIDGET( m_window )->window ) == 0 ){ + g_layout_globals.m_position = m_position_tracker.getPosition(); + } g_layout_globals.nState = gdk_window_get_state( GTK_WIDGET( m_window )->window ); } @@ -3272,6 +3273,26 @@ void Layout_registerPreferencesPage(){ PreferencesDialog_addInterfacePage( FreeCaller1() ); } +void MainFrame_toggleFullscreen(){ + GtkWindow* wnd = MainFrame_getWindow(); + if( gdk_window_get_state( GTK_WIDGET( wnd )->window ) & GDK_WINDOW_STATE_FULLSCREEN ){ + //some portion of buttsex, because gtk_window_unfullscreen doesn't work correctly after calling some modal window + bool maximize = ( gdk_window_get_state( GTK_WIDGET( wnd )->window ) & GDK_WINDOW_STATE_MAXIMIZED ); + gtk_window_unfullscreen( wnd ); + if( maximize ){ + gtk_window_unmaximize( wnd ); + gtk_window_maximize( wnd ); + } + else{ + gtk_window_move( wnd, g_layout_globals.m_position.x, g_layout_globals.m_position.y ); + gtk_window_resize( wnd, g_layout_globals.m_position.w, g_layout_globals.m_position.h ); + } + } + else{ + gtk_window_fullscreen( wnd ); + } +} + #include "preferencesystem.h" #include "stringio.h" @@ -3334,6 +3355,7 @@ void MainFrame_Construct(){ GlobalCommands_insert( "ArbitraryScale", FreeCaller(), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); GlobalCommands_insert( "BuildMenuCustomize", FreeCaller() ); + GlobalCommands_insert( "Build_runRecentExecutedBuild", FreeCaller(), Accelerator( GDK_F5 ) ); GlobalCommands_insert( "FindBrush", FreeCaller() ); @@ -3369,6 +3391,8 @@ void MainFrame_Construct(){ GlobalCommands_insert( "ChooseClipperColor", makeCallback( g_ColoursMenu.m_clipper ) ); GlobalCommands_insert( "ChooseOrthoViewNameColor", makeCallback( g_ColoursMenu.m_viewname ) ); + GlobalCommands_insert( "Fullscreen", FreeCaller(), Accelerator( GDK_F11 ) ); + GlobalCommands_insert( "CSGSubtract", FreeCaller(), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) ); GlobalCommands_insert( "CSGMerge", FreeCaller(), Accelerator( 'U', (GdkModifierType)GDK_CONTROL_MASK ) ); diff --git a/radiant/map.cpp b/radiant/map.cpp index a66229b7..4040ab3c 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -1842,9 +1842,7 @@ void SaveMap(){ } else if ( Map_Modified( g_map ) ) { Map_Save(); -#ifdef WIN32 MRU_AddFile( g_map.m_name.c_str() ); //add on saving, but not opening via cmd line: spoils the list -#endif } } diff --git a/radiant/server.cpp b/radiant/server.cpp index 1904867b..aad08221 100644 --- a/radiant/server.cpp +++ b/radiant/server.cpp @@ -144,6 +144,10 @@ FunctionPointer findSymbol( const char* symbol ){ #include +#ifndef RTLD_DEEPBIND +#define RTLD_DEEPBIND 0 +#endif + class DynamicLibrary { void* m_library; @@ -151,7 +155,7 @@ public: typedef int ( *FunctionPointer )(); DynamicLibrary( const char* filename ){ - m_library = dlopen( filename, RTLD_NOW ); + m_library = dlopen( filename, RTLD_NOW | (RTLD_DEEPBIND + 0) ); } ~DynamicLibrary(){ if ( !failed() ) { diff --git a/tools/quake3/q3map2/brush.c b/tools/quake3/q3map2/brush.c index ae89a127..e15d5612 100644 --- a/tools/quake3/q3map2/brush.c +++ b/tools/quake3/q3map2/brush.c @@ -95,10 +95,11 @@ brush_t *AllocBrush( int numSides ){ /* allocate and clear */ - if ( numSides <= 0 ) { + /*if ( numSides <= 0 ) { Error( "AllocBrush called with numsides = %d", numSides ); } - c = (size_t)&( ( (brush_t*) 0 )->sides[ numSides ] ); + c = (size_t)&( ( (brush_t*) 0 )->sides[ numSides ] );*/ + c = sizeof(*bb) + (numSides > 6 ? sizeof(side_t)*(numSides - 6) : 0); bb = safe_malloc( c ); memset( bb, 0, c ); if ( numthreads == 1 ) { diff --git a/tools/quake3/q3map2/bspfile_abstract.c b/tools/quake3/q3map2/bspfile_abstract.c index e5e4055f..6ec7e21c 100644 --- a/tools/quake3/q3map2/bspfile_abstract.c +++ b/tools/quake3/q3map2/bspfile_abstract.c @@ -630,10 +630,9 @@ void InjectCommandLine( char **argv, int beginArgs, int endArgs ){ char *sentinel = newCommandLine + sizeof( newCommandLine ) - 1; int i; -if (nocmdline) -{ - return; -} + if ( nocmdline ){ + return; + } previousCommandLine = ValueForKey( &entities[0], "_q3map2_cmdline" ); if ( previousCommandLine && *previousCommandLine ) { inpos = previousCommandLine; diff --git a/tools/quake3/q3map2/main.c b/tools/quake3/q3map2/main.c index 6ee40957..fe097bef 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -2383,8 +2383,14 @@ skipEXfile: Sys_Printf( "++%s\n", temp ); continue; } - Sys_Printf( " !FAIL! %s\n", pk3Shaders + i*65 ); - if ( i != pk3ShadersN - 1 ) packFAIL = qtrue; //levelshot typically + + if ( i == pk3ShadersN - 1 ){ //levelshot typically + Sys_Printf( " ~fail %s\n", pk3Shaders + i*65 ); + } + else{ + Sys_Printf( " !FAIL! %s\n", pk3Shaders + i*65 ); + packFAIL = qtrue; + } } } @@ -2443,7 +2449,7 @@ skipEXfile: Sys_Printf( "++%s\n", temp ); } else{ - Sys_Printf( " !FAIL! %s\n", temp ); + Sys_Printf( " ~fail %s\n", temp ); } sprintf( temp, "scripts/%s.arena", nameOFmap ); @@ -2451,7 +2457,7 @@ skipEXfile: Sys_Printf( "++%s\n", temp ); } else{ - Sys_Printf( " !FAIL! %s\n", temp ); + Sys_Printf( " ~fail %s\n", temp ); } sprintf( temp, "scripts/%s.defi", nameOFmap ); @@ -2459,7 +2465,7 @@ skipEXfile: Sys_Printf( "++%s\n", temp ); } else{ - Sys_Printf( " !FAIL! %s\n", temp ); + Sys_Printf( " ~fail %s\n", temp ); } if ( !packFAIL ){ diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index fbc2b5e5..0629d442 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -2003,11 +2003,10 @@ Q_EXTERN qboolean warnImage Q_ASSIGN( qtrue ); /* ydnar: sinusoid samples */ Q_EXTERN float jitters[ MAX_JITTERS ]; -/*can't code*/ +/* can't code */ Q_EXTERN qboolean doingBSP Q_ASSIGN( qfalse ); /* commandline arguments */ -Q_EXTERN qboolean nocmdline Q_ASSIGN( qfalse ); Q_EXTERN qboolean verbose; Q_EXTERN qboolean verboseEntities Q_ASSIGN( qfalse ); Q_EXTERN qboolean force Q_ASSIGN( qfalse ); @@ -2030,6 +2029,7 @@ Q_EXTERN qboolean skyFixHack Q_ASSIGN( qfalse ); /* ydnar */ Q_EXTERN qboolean bspAlternateSplitWeights Q_ASSIGN( qfalse ); /* 27 */ Q_EXTERN qboolean deepBSP Q_ASSIGN( qfalse ); /* div0 */ Q_EXTERN qboolean maxAreaFaceSurface Q_ASSIGN( qfalse ); /* divVerent */ +Q_EXTERN qboolean nocmdline Q_ASSIGN( qfalse ); Q_EXTERN int patchSubdivisions Q_ASSIGN( 8 ); /* ydnar: -patchmeta subdivisions */ diff --git a/tools/quake3/q3map2/shaders.c b/tools/quake3/q3map2/shaders.c index a4453374..3d5249ef 100644 --- a/tools/quake3/q3map2/shaders.c +++ b/tools/quake3/q3map2/shaders.c @@ -1276,7 +1276,7 @@ static void ParseShaderFile( const char *filename ){ else if ( !Q_stricmp( token, "sun" ) /* sof2 */ || !Q_stricmp( token, "q3map_sun" ) || !Q_stricmp( token, "q3map_sunExt" ) ) { float a, b; sun_t *sun; - qboolean ext; + qboolean ext = qfalse; /* ydnar: extended sun directive? */ diff --git a/tools/quake3/q3map2/surface.c b/tools/quake3/q3map2/surface.c index 5aa290f9..18c115ee 100644 --- a/tools/quake3/q3map2/surface.c +++ b/tools/quake3/q3map2/surface.c @@ -1164,7 +1164,7 @@ mapDrawSurface_t *DrawSurfaceForMesh( entity_t *e, parseMesh_t *p, mesh_t *mesh /* spew forth errors */ if ( VectorLength( plane ) < 0.001f ) { - Sys_Printf( "BOGUS " ); + Sys_Printf( "DrawSurfaceForMesh: bogus plane\n" ); } /* test each vert */