From 804c20949d43175179489ecbb1305752cfa17217 Mon Sep 17 00:00:00 2001 From: Garux Date: Wed, 2 Aug 2017 09:15:41 +0300 Subject: [PATCH] Q3map2: * _setmaxstdio(2048) for windows * game_qfusion update Radiant: misc... * wrap long command lines in build menu -> customize * map info dialog: + Total patches, Ingame entities, Group entities, Ingame group entities counts * fix: map info dialog -> sort by count works * fix of: minimize main wnd, close, start = cam, cons, texbro null size --- radiant/build.cpp | 3 + radiant/mainframe.cpp | 4 +- radiant/map.cpp | 210 ++++++++++++++++++++++++----- tools/quake3/q3map2/game_qfusion.h | 28 ++-- tools/quake3/q3map2/main.c | 3 + 5 files changed, 196 insertions(+), 52 deletions(-) diff --git a/radiant/build.cpp b/radiant/build.cpp index baa39568..915ce0fc 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -924,6 +924,9 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE ); + g_object_set( G_OBJECT( renderer ), "wrap-mode", PANGO_WRAP_WORD, NULL ); + //g_object_set( G_OBJECT( renderer ), "ellipsize", PANGO_ELLIPSIZE_MIDDLE, NULL ); + object_set_int_property( G_OBJECT( renderer ), "wrap-width", 640 ); g_signal_connect( renderer, "edited", G_CALLBACK( commands_cell_edited ), store ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 ); diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 68fb2b61..b93e1e26 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -3074,12 +3074,14 @@ void MainFrame::Create(){ EverySecondTimer_enable(); - if ( g_layout_globals.nState & GDK_WINDOW_STATE_MAXIMIZED ) { + if ( g_layout_globals.nState & GDK_WINDOW_STATE_MAXIMIZED || + g_layout_globals.nState & GDK_WINDOW_STATE_ICONIFIED ) { 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 ); diff --git a/radiant/map.cpp b/radiant/map.cpp index 4e25a4cd..e4c6e26a 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -86,6 +86,7 @@ MapModules& ReferenceAPI_getMapModules(); #include "autosave.h" #include "brushmodule.h" #include "brush.h" +#include "patch.h" class NameObserver { @@ -760,13 +761,57 @@ void Scene_EntityBreakdown( EntityBreakdown& entitymap ){ GlobalSceneGraph().traverse( EntityBreakdownWalker( entitymap ) ); } +class CountStuffWalker : public scene::Graph::Walker +{ +int& m_patches; +int& m_ents_ingame; +int& m_groupents; +int& m_groupents_ingame; +public: +CountStuffWalker( int& patches, int& ents_ingame, int& groupents, int& groupents_ingame ) + : m_patches( patches ), m_ents_ingame( ents_ingame ), m_groupents( groupents ), m_groupents_ingame( groupents_ingame ){ +} +bool pre( const scene::Path& path, scene::Instance& instance ) const { + Patch* patch = Node_getPatch( path.top() ); + if( patch != 0 ){ + ++m_patches; + } + Entity* entity = Node_getEntity( path.top() ); + if ( entity != 0 ){ + if( entity->isContainer() ){ + ++m_groupents; + if( !string_equal_nocase( "func_group", entity->getKeyValue( "classname" ) ) && + !string_equal_nocase( "_decal", entity->getKeyValue( "classname" ) ) ){ + ++m_groupents_ingame; + ++m_ents_ingame; + } + return true; + } + if( !string_equal_nocase_n( "light", entity->getKeyValue( "classname" ), 5 ) && + !string_equal_nocase( "misc_model", entity->getKeyValue( "classname" ) ) ){ + ++m_ents_ingame; + } + } + return true; +} +}; + +void Scene_CountStuff( int& patches, int& ents_ingame, int& groupents, int& groupents_ingame ){ + GlobalSceneGraph().traverse( CountStuffWalker( patches, ents_ingame, groupents, groupents_ingame ) ); +} WindowPosition g_posMapInfoWnd( c_default_window_pos ); void DoMapInfo(){ ModalDialog dialog; - GtkEntry* brushes_entry; - GtkEntry* entities_entry; + + GtkWidget* w_brushes; + GtkWidget* w_patches; + GtkWidget* w_ents; + GtkWidget* w_ents_ingame; + GtkWidget* w_groupents; + GtkWidget* w_groupents_ingame; + GtkListStore* EntityBreakdownWalker; GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Map Info", G_CALLBACK( dialog_delete_callback ), &dialog ); @@ -779,48 +824,114 @@ void DoMapInfo(){ { GtkHBox* hbox = create_dialog_hbox( 4 ); - gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 ); + gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, FALSE, 0 ); { - GtkTable* table = create_dialog_table( 2, 2, 4, 4 ); + GtkTable* table = create_dialog_table( 3, 4, 4, 4 ); gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 ); - { - GtkEntry* entry = GTK_ENTRY( gtk_entry_new() ); - gtk_widget_show( GTK_WIDGET( entry ) ); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + GtkWidget* label = gtk_label_new( "Total Brushes:" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, + (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_entry_set_editable( entry, FALSE ); - - brushes_entry = entry; + gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); } { - GtkEntry* entry = GTK_ENTRY( gtk_entry_new() ); - gtk_widget_show( GTK_WIDGET( entry ) ); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_entry_set_editable( entry, FALSE ); - - entities_entry = entry; + GtkWidget* label = gtk_label_new( "" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table ), label, 1, 2, 0, 1, + (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), + (GtkAttachOptions) ( 0 ), 3, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); + w_brushes = label; } { - GtkWidget* label = gtk_label_new( "Total Brushes" ); + GtkWidget* label = gtk_label_new( "Total Patches:" ); gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, + gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); + } + { + GtkWidget* label = gtk_label_new( "" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1, + (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), + (GtkAttachOptions) ( 0 ), 3, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); + w_patches = label; } { - GtkWidget* label = gtk_label_new( "Total Entities" ); + GtkWidget* label = gtk_label_new( "Total Entities:" ); gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); + } + { + GtkWidget* label = gtk_label_new( "" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table ), label, 1, 2, 1, 2, + (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), + (GtkAttachOptions) ( 0 ), 3, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); + w_ents = label; + } + { + GtkWidget* label = gtk_label_new( "Ingame Entities:" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); + } + { + GtkWidget* label = gtk_label_new( "" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 1, 2, + (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), + (GtkAttachOptions) ( 0 ), 3, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); + w_ents_ingame = label; + } + { + GtkWidget* label = gtk_label_new( "Group Entities:" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); + } + { + GtkWidget* label = gtk_label_new( "" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table ), label, 1, 2, 2, 3, + (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), + (GtkAttachOptions) ( 0 ), 3, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); + w_groupents = label; + } + { + GtkWidget* label = gtk_label_new( "Ingame Group Entities:" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); + } + { + GtkWidget* label = gtk_label_new( "" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 2, 3, + (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), + (GtkAttachOptions) ( 0 ), 3, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); + w_groupents_ingame = label; } + } { GtkVBox* vbox2 = create_dialog_vbox( 4 ); @@ -833,17 +944,17 @@ void DoMapInfo(){ } } { - GtkWidget* label = gtk_label_new( "Entity breakdown" ); + GtkWidget* label = gtk_label_new( "*** Entity breakdown ***" ); gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, TRUE, 0 ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 0.5 ); } { GtkScrolledWindow* scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, 4 ); gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( scr ), TRUE, TRUE, 0 ); { - GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING ); + GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_UINT ); GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ); gtk_tree_view_set_headers_clickable( GTK_TREE_VIEW( view ), TRUE ); @@ -879,21 +990,46 @@ void DoMapInfo(){ for ( EntityBreakdown::iterator i = entitymap.begin(); i != entitymap.end(); ++i ) { - char tmp[16]; - sprintf( tmp, "%u", Unsigned( ( *i ).second ) ); GtkTreeIter iter; gtk_list_store_append( GTK_LIST_STORE( EntityBreakdownWalker ), &iter ); - gtk_list_store_set( GTK_LIST_STORE( EntityBreakdownWalker ), &iter, 0, ( *i ).first.c_str(), 1, tmp, -1 ); + gtk_list_store_set( GTK_LIST_STORE( EntityBreakdownWalker ), &iter, 0, ( *i ).first.c_str(), 1, Unsigned( ( *i ).second ), -1 ); } } g_object_unref( G_OBJECT( EntityBreakdownWalker ) ); - char tmp[16]; - sprintf( tmp, "%u", Unsigned( g_brushCount.get() ) ); - gtk_entry_set_text( GTK_ENTRY( brushes_entry ), tmp ); - sprintf( tmp, "%u", Unsigned( g_entityCount.get() ) ); - gtk_entry_set_text( GTK_ENTRY( entities_entry ), tmp ); + int n_patches = 0; + int n_ents_ingame = 0; + int n_groupents = 0; + int n_groupents_ingame = 0; + Scene_CountStuff( n_patches, n_ents_ingame, n_groupents, n_groupents_ingame ); + //globalOutputStream() << n_patches << n_ents_ingame << n_groupents << n_groupents_ingame << "\n"; + + char *markup; + + markup = g_markup_printf_escaped( "%u ", Unsigned( g_brushCount.get() ) ); + gtk_label_set_markup( GTK_LABEL( w_brushes ), markup ); + g_free( markup ); + + markup = g_markup_printf_escaped( "%i ", n_patches ); + gtk_label_set_markup( GTK_LABEL( w_patches ), markup ); + g_free( markup ); + + markup = g_markup_printf_escaped( "%u ", Unsigned( g_entityCount.get() ) ); + gtk_label_set_markup( GTK_LABEL( w_ents ), markup ); + g_free( markup ); + + markup = g_markup_printf_escaped( "%i ", n_ents_ingame ); + gtk_label_set_markup( GTK_LABEL( w_ents_ingame ), markup ); + g_free( markup ); + + markup = g_markup_printf_escaped( "%i ", n_groupents ); + gtk_label_set_markup( GTK_LABEL( w_groupents ), markup ); + g_free( markup ); + + markup = g_markup_printf_escaped( "%i ", n_groupents_ingame ); + gtk_label_set_markup( GTK_LABEL( w_groupents_ingame ), markup ); + g_free( markup ); modal_dialog_show( window, dialog ); @@ -2104,7 +2240,7 @@ void DoFind(){ } void Map_constructPreferences( PreferencesPage& page ){ - page.appendCheckBox( "", "Load last map on open", g_bLoadLastMap ); + page.appendCheckBox( "", "Load last map at startup", g_bLoadLastMap ); } diff --git a/tools/quake3/q3map2/game_qfusion.h b/tools/quake3/q3map2/game_qfusion.h index 3df7e141..5cd5b038 100644 --- a/tools/quake3/q3map2/game_qfusion.h +++ b/tools/quake3/q3map2/game_qfusion.h @@ -103,21 +103,21 @@ { "qfusion", /* -game x */ - "baseq3", /* default base game data dir */ - ".q3a", /* unix home sub-dir */ - "quake", /* magic path word */ + "base", /* default base game data dir */ + ".qfusion", /* unix home sub-dir */ + "qfusion", /* magic path word */ "scripts", /* shader directory */ - 2048, /* max lightmapped surface verts */ - 2048, /* max surface verts */ - 12288, /* max surface indexes */ - qtrue, /* flares */ + 65535, /* max lightmapped surface verts */ + 65535, /* max surface verts */ + 393210, /* max surface indexes */ + qfalse, /* flares */ "flareshader", /* default flare shader */ qfalse, /* wolf lighting model? */ 512, /* lightmap width/height */ 1.0f, /* lightmap gamma */ - qfalse, /* lightmap sRGB */ - qfalse, /* texture sRGB */ - qfalse, /* color sRGB */ + qtrue, /* lightmap sRGB */ + qtrue, /* texture sRGB */ + qtrue, /* color sRGB */ 0.0f, /* lightmap exposure */ 1.0f, /* lightmap compensate */ 1.0f, /* lightgrid scale */ @@ -125,15 +125,15 @@ qtrue, /* light angle attenuation uses half-lambert curve */ qtrue, /* disable shader lightstyles hack */ qtrue, /* keep light entities on bsp */ - 8, /* default patchMeta subdivisions tolerance */ + 4, /* default patchMeta subdivisions tolerance */ qtrue, /* patch casting enabled */ qtrue, /* compile deluxemaps */ 0, /* deluxemaps default mode */ - 256, /* minimap size */ + 512, /* minimap size */ 1.0f, /* minimap sharpener */ - 0.0f, /* minimap border */ + 1.0f / 66.0f, /* minimap border */ qtrue, /* minimap keep aspect */ - MINIMAP_MODE_WHITE, /* minimap mode */ + MINIMAP_MODE_GRAY, /* minimap mode */ "../minimaps/%s.tga", /* minimap name format */ "FBSP", /* bsp file prefix */ 1, /* bsp file version */ diff --git a/tools/quake3/q3map2/main.c b/tools/quake3/q3map2/main.c index fe097bef..753e5070 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -3699,6 +3699,9 @@ int main( int argc, char **argv ){ int i, r; double start, end; +#ifdef WIN32 + _setmaxstdio(2048); +#endif /* we want consistent 'randomness' */ srand( 0 ); -- 2.39.2