From ce321bf04bd28f008494f6bb675fa18c25425952 Mon Sep 17 00:00:00 2001 From: Jay Dolan Date: Mon, 24 Jan 2022 20:24:02 -0500 Subject: [PATCH] Add a filter for Quetoo's CONTENTS_ATMOSPHERIC. --- radiant/filters.cpp | 6 ++++++ radiant/mainframe.cpp | 20 ++++++++++++++++++++ radiant/mainframe.h | 3 +++ radiant/qedefs.h | 1 + radiant/qfiles.h | 1 + 5 files changed, 31 insertions(+) diff --git a/radiant/filters.cpp b/radiant/filters.cpp index ce329f82..118deae0 100644 --- a/radiant/filters.cpp +++ b/radiant/filters.cpp @@ -144,6 +144,7 @@ bfilter_t *FilterAddBase( bfilter_t *pFilter ){ pFilter = FilterAddImpl( pFilter,1,0,"caulk",EXCLUDE_CAULK,true ); pFilter = FilterAddImpl( pFilter,8,0,NULL,EXCLUDE_LIQUIDS,true ); pFilter = FilterAddImpl( pFilter,8,0,NULL,EXCLUDE_MIST,true ); + pFilter = FilterAddImpl( pFilter,8,0,NULL,EXCLUDE_ATMOSPHERIC,true ); pFilter = FilterAddImpl( pFilter,8,0,NULL,EXCLUDE_HINTSSKIPS,true ); pFilter = FilterAddImpl( pFilter,8,0,NULL,EXCLUDE_TRANSLUCENT,true ); pFilter = FilterAddImpl( pFilter,8,0,NULL,EXCLUDE_AREAPORTALS,true ); @@ -346,6 +347,11 @@ bool FilterBrush( brush_t *pb ){ if ( f->texdef.contents & CONTENTS_MIST ) { filterbrush = true; } + break; + case EXCLUDE_ATMOSPHERIC: + if ( f->texdef.contents & CONTENTS_ATMOSPHERIC ) { + filterbrush = true; + } if ( strstr( f->pShader->getName(), "common/fog" ) ) { filterbrush = true; } diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 106ec8db..7e8e2f48 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -273,6 +273,7 @@ SCommandInfo g_Commands[] = {"FilterLiquids", '5', RAD_ALT, ID_FILTER_LIQUIDS, "menu_filter_liquids"}, {"FilterLiquids", GDK_KEY_5, RAD_ALT, ID_FILTER_LIQUIDS, "menu_filter_liquids"}, {"FilterMist", GDK_KEY_M, RAD_ALT, ID_FILTER_MIST, "menu_filter_mist"}, + {"FilterAtmospheric", GDK_KEY_A, RAD_ALT, ID_FILTER_ATMOSPHERIC, "menu_filter_atmospheric"}, {"FilterCaulk", '6', RAD_ALT, ID_FILTER_CAULK, "menu_filter_caulk"}, {"FilterCaulk", GDK_KEY_6, RAD_ALT, ID_FILTER_CAULK, "menu_filter_caulk"}, {"FilterClips", '7', RAD_ALT, ID_FILTER_CLIPS, "menu_filter_clips"}, @@ -657,6 +658,7 @@ gint HandleCommand( GtkWidget *widget, gpointer data ){ case ID_FILTER_LIGHTS: g_pParentWnd->OnFilterLights(); break; case ID_FILTER_LIQUIDS: g_pParentWnd->OnFilterLiquids(); break; case ID_FILTER_MIST: g_pParentWnd->OnFilterMist(); break; + case ID_FILTER_ATMOSPHERIC: g_pParentWnd->OnFilterAtmospheric(); break; case ID_FILTER_MODELS: g_pParentWnd->OnFilterModels(); break; case ID_FILTER_PATCHES: g_pParentWnd->OnFilterPatches(); break; case ID_FILTER_TRANSLUCENT: g_pParentWnd->OnFilterTranslucent(); break; @@ -1137,6 +1139,7 @@ void MainFrame::create_main_menu( GtkWidget *window, GtkWidget *vbox ){ create_check_menu_item_with_mnemonic( menu_in_menu, _( "Translucent" ), G_CALLBACK( HandleCommand ), ID_FILTER_TRANSLUCENT, FALSE ); create_check_menu_item_with_mnemonic( menu_in_menu, _( "Liquids" ), G_CALLBACK( HandleCommand ), ID_FILTER_LIQUIDS, FALSE ); create_check_menu_item_with_mnemonic( menu_in_menu, _( "Mist" ), G_CALLBACK( HandleCommand ), ID_FILTER_MIST, FALSE ); + create_check_menu_item_with_mnemonic( menu_in_menu, _( "Atmospheric" ), G_CALLBACK( HandleCommand ), ID_FILTER_ATMOSPHERIC, FALSE ); create_check_menu_item_with_mnemonic( menu_in_menu, _( "Sky" ), G_CALLBACK( HandleCommand ), ID_FILTER_SKY, FALSE ); create_check_menu_item_with_mnemonic( menu_in_menu, _( "Caulk" ), G_CALLBACK( HandleCommand ), ID_FILTER_CAULK, FALSE ); create_check_menu_item_with_mnemonic( menu_in_menu, _( "Clips" ), G_CALLBACK( HandleCommand ), ID_FILTER_CLIPS, FALSE ); @@ -3984,6 +3987,9 @@ void MainFrame::SetButtonMenuStates(){ item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_filter_mist" ) ); gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_MIST ) != 0 ); + item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_filter_atmospheric" ) ); + gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), + ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_ATMOSPHERIC ) != 0 ); item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_filter_caulk" ) ); gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_CAULK ) != 0 ); @@ -7780,6 +7786,20 @@ void MainFrame::OnFilterMist(){ Sys_UpdateWindows( W_XY | W_CAMERA ); } +void MainFrame::OnFilterAtmospheric(){ + GtkWidget *item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_filter_atmosperic" ) ); + g_bIgnoreCommands++; + if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_ATMOSPHERIC ) & EXCLUDE_ATMOSPHERIC ) { + gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), TRUE ); + } + else{ + gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), FALSE ); + } + g_bIgnoreCommands--; + PerformFiltering(); + Sys_UpdateWindows( W_XY | W_CAMERA ); +} + void MainFrame::OnFilterModels(){ GtkWidget *item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_filter_models" ) ); g_bIgnoreCommands++; diff --git a/radiant/mainframe.h b/radiant/mainframe.h index 08fde0a8..0c1f86cf 100644 --- a/radiant/mainframe.h +++ b/radiant/mainframe.h @@ -413,6 +413,8 @@ struct SKeyInfo #define ID_COLORS_MAJOR_ALT 40231 #define ID_SELECT_FUNC_GROUP 40233 +#define ID_FILTER_ATMOSPHERIC 40234 + // those must have their own ID chunk ID_GRID_025 <= ID_GRID <= ID_GRID_256 #define ID_GRID_025 40300 @@ -896,6 +898,7 @@ void OnFilterHintsskips(); void OnFilterLights(); void OnFilterLiquids(); void OnFilterMist(); +void OnFilterAtmospheric(); void OnFilterModels(); void OnFilterPatches(); void OnFilterTranslucent(); diff --git a/radiant/qedefs.h b/radiant/qedefs.h index d6932494..825db39b 100644 --- a/radiant/qedefs.h +++ b/radiant/qedefs.h @@ -86,6 +86,7 @@ #define EXCLUDE_BOTCLIP 0x00040000 #define EXCLUDE_SKY 0x00080000 #define EXCLUDE_MIST 0x00100000 +#define EXCLUDE_ATMOSPHERIC 0x00200000 #define INCLUDE_EASY 0x00000001 #define INCLUDE_NORMAL 0x00000002 diff --git a/radiant/qfiles.h b/radiant/qfiles.h index 58608dcf..c91df784 100644 --- a/radiant/qfiles.h +++ b/radiant/qfiles.h @@ -362,6 +362,7 @@ typedef struct #define CONTENTS_MIST 64 #define LAST_VISIBLE_CONTENTS 64 +#define CONTENTS_ATMOSPHERIC 0x80 #define CONTENTS_AREAPORTAL 0x8000 // remaining contents are non-visible, and don't eat brushes