Add a filter for CONTENTS_MIST, with special love for common/fog and common/dust.

This allows mappers to quickly toggle large fog volumes in the camera view.
This commit is contained in:
Jay Dolan 2020-12-16 21:56:16 -05:00
parent 55995d2488
commit 112e118de1
5 changed files with 49 additions and 7 deletions

View file

@ -143,6 +143,7 @@ bfilter_t *FilterAddBase( bfilter_t *pFilter ){
pFilter = FilterAddImpl( pFilter,1,0,"clip",EXCLUDE_CLIP,true );
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_HINTSSKIPS,true );
pFilter = FilterAddImpl( pFilter,8,0,NULL,EXCLUDE_TRANSLUCENT,true );
pFilter = FilterAddImpl( pFilter,8,0,NULL,EXCLUDE_SKY,true );
@ -236,7 +237,9 @@ bool FilterBrush( brush_t *pb ){
}
// if brush belongs to world entity or a brushmodel entity and is not a patch
if ( ( strcmp( pb->owner->eclass->name, "worldspawn" ) == 0
if ( ( !strcmp( pb->owner->eclass->name, "worldspawn" )
|| !strcmp( pb->owner->eclass->name, "misc_fog")
|| !strcmp( pb->owner->eclass->name, "misc_dust")
|| !strncmp( pb->owner->eclass->name, "func", 4 )
|| !strncmp( pb->owner->eclass->name, "trigger", 7 ) ) && !pb->patchBrush ) {
bool filterbrush = false;
@ -309,9 +312,14 @@ bool FilterBrush( brush_t *pb ){
if ( f->texdef.contents & CONTENTS_WINDOW ) {
filterbrush = true;
}
if ( f->texdef.flags & (SURF_TRANS33 | SURF_TRANS66 | SURF_ALPHA_TEST) ) {
if ( f->texdef.flags & (SURF_TRANS33 | SURF_TRANS66) ) {
filterbrush = true;
}
if ( g_pGameDescription->mGameFile == "quetoo.game" ) {
if (f->texdef.flags & ( SURF_TRANS100 | SURF_ALPHA_TEST )) {
filterbrush = true;
}
}
if ( strstr( f->pShader->getName(), "glass" ) ||
strstr( f->pShader->getName(), "window" ) ) {
filterbrush = true;
@ -325,6 +333,17 @@ bool FilterBrush( brush_t *pb ){
filterbrush = true;
}
break;
case EXCLUDE_MIST:
if ( f->texdef.contents & CONTENTS_MIST ) {
filterbrush = true;
}
if ( strstr( f->pShader->getName(), "common/fog" ) ) {
filterbrush = true;
}
if ( strstr( f->pShader->getName(), "common/dust" ) ) {
filterbrush = true;
}
break;
}
}

View file

@ -272,11 +272,12 @@ SCommandInfo g_Commands[] =
{"FilterTranslucent", GDK_KEY_4, RAD_ALT, ID_FILTER_TRANSLUCENT, "menu_filter_translucent"},
{"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"},
{"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"},
{"FilterClips", GDK_KEY_7, RAD_ALT, ID_FILTER_CLIPS, "menu_filter_clips"},
{"FilterBotClips", GDK_KEY_M, RAD_ALT, ID_FILTER_BOTCLIPS, "menu_filter_botclips"},
{"FilterBotClips", GDK_KEY_B, RAD_ALT, ID_FILTER_BOTCLIPS, "menu_filter_botclips"},
{"FilterPaths", '8', RAD_ALT, ID_FILTER_PATHS, "menu_filter_paths"},
{"FilterPaths", GDK_KEY_8, RAD_ALT, ID_FILTER_PATHS, "menu_filter_paths"},
{"FilterClusterportals", '9', RAD_ALT, ID_FILTER_CLUSTERPORTALS, "menu_filter_clusterportals"},
@ -287,7 +288,7 @@ SCommandInfo g_Commands[] =
{"FilterDetails", GDK_KEY_D, RAD_CONTROL, ID_FILTER_DETAILS, "menu_filter_details"},
{"FilterStructural", GDK_KEY_D, RAD_CONTROL | RAD_SHIFT, ID_FILTER_STRUCTURAL, "menu_filter_structural"},
{"FilterHintsSkips", GDK_KEY_H, RAD_CONTROL, ID_FILTER_HINTSSKIPS, "menu_filter_hintsskips"},
{"FilterHintsSky", GDK_KEY_S, RAD_ALT, ID_FILTER_SKY, "menu_filter_sky"},
{"FilterSky", GDK_KEY_S, RAD_ALT, ID_FILTER_SKY, "menu_filter_sky"},
{"FilterModels", GDK_KEY_M, RAD_SHIFT, ID_FILTER_MODELS, "menu_filter_models"},
{"FilterTriggers", GDK_KEY_T, RAD_CONTROL | RAD_SHIFT, ID_FILTER_TRIGGERS, "menu_filter_triggers"},
{"LoadPointfile", GDK_KEY_L, RAD_SHIFT, ID_FILE_POINTFILE, "menu_load_pointfile"},
@ -655,6 +656,7 @@ gint HandleCommand( GtkWidget *widget, gpointer data ){
case ID_FILTER_SKY: g_pParentWnd->OnFilterSky(); break;
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_MODELS: g_pParentWnd->OnFilterModels(); break;
case ID_FILTER_PATCHES: g_pParentWnd->OnFilterPatches(); break;
case ID_FILTER_TRANSLUCENT: g_pParentWnd->OnFilterTranslucent(); break;
@ -1134,6 +1136,7 @@ void MainFrame::create_main_menu( GtkWidget *window, GtkWidget *vbox ){
create_check_menu_item_with_mnemonic( menu_in_menu, _( "Entities" ), G_CALLBACK( HandleCommand ), ID_FILTER_ENTITIES, FALSE );
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, _( "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 );
@ -3978,6 +3981,9 @@ void MainFrame::SetButtonMenuStates(){
item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_filter_liquids" ) );
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ),
( g_qeglobals.d_savedinfo.exclude & EXCLUDE_LIQUIDS ) != 0 );
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_caulk" ) );
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ),
( g_qeglobals.d_savedinfo.exclude & EXCLUDE_CAULK ) != 0 );
@ -4020,6 +4026,7 @@ void MainFrame::SetButtonMenuStates(){
item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_filter_triggers" ) );
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ),
( g_qeglobals.d_savedinfo.exclude & EXCLUDE_TRIGGERS ) != 0 );
item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_toggle_lock" ) );
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), ( g_PrefsDlg.m_bTextureLock ) ? TRUE : FALSE );
item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_toggle_rotatelock" ) );
@ -7759,6 +7766,20 @@ void MainFrame::OnFilterLiquids(){
Sys_UpdateWindows( W_XY | W_CAMERA );
}
void MainFrame::OnFilterMist(){
GtkWidget *item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_filter_mist" ) );
g_bIgnoreCommands++;
if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_MIST ) & EXCLUDE_MIST ) {
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++;

View file

@ -403,6 +403,7 @@ struct SKeyInfo
#define ID_FILTER_STRUCTURAL 40226
#define ID_FILTER_BOTCLIPS 40227
#define ID_FILTER_SKY 40228
#define ID_FILTER_MIST 40229
#define ID_CURVE_REDISPERSE_INTERMEDIATE_COLS 40230
#define ID_CURVE_REDISPERSE_INTERMEDIATE_ROWS 40231
@ -894,6 +895,7 @@ void OnFilterEntities();
void OnFilterHintsskips();
void OnFilterLights();
void OnFilterLiquids();
void OnFilterMist();
void OnFilterModels();
void OnFilterPatches();
void OnFilterTranslucent();

View file

@ -85,6 +85,7 @@
#define EXCLUDE_STRUCTURAL 0x00020000
#define EXCLUDE_BOTCLIP 0x00040000
#define EXCLUDE_SKY 0x00080000
#define EXCLUDE_MIST 0x00100000
#define INCLUDE_EASY 0x00000001
#define INCLUDE_NORMAL 0x00000002

View file

@ -408,14 +408,13 @@ typedef struct texinfo_s
#define SURF_LIGHT 0x1 // value will hold the light strength
#define SURF_SLICK 0x2 // effects game physics
#define SURF_SKY 0x4 // don't draw, but add to skybox
#define SURF_WARP 0x8 // turbulent water warp
#define SURF_TRANS33 0x10
#define SURF_TRANS66 0x20
#define SURF_FLOWING 0x40 // scroll towards angle
#define SURF_TRANS100 0x40 // quetoo provides texture alpha via overriding SURF_FLOWING
#define SURF_NODRAW 0x80 // don't bother referencing the texture
#define SURF_HINT 0x100
#define SURF_SKIP 0x200