2 Copyright (c) 2001, Loki software, inc.
\r
5 Redistribution and use in source and binary forms, with or without modification,
\r
6 are permitted provided that the following conditions are met:
\r
8 Redistributions of source code must retain the above copyright notice, this list
\r
9 of conditions and the following disclaimer.
\r
11 Redistributions in binary form must reproduce the above copyright notice, this
\r
12 list of conditions and the following disclaimer in the documentation and/or
\r
13 other materials provided with the distribution.
\r
15 Neither the name of Loki software nor the names of its contributors may be used
\r
16 to endorse or promote products derived from this software without specific prior
\r
17 written permission.
\r
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
\r
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
\r
22 DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
\r
23 DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
\r
24 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
\r
25 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
\r
26 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
\r
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
\r
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
33 bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude)
\r
35 bfilter_t *pNew = new bfilter_t;
\r
36 pNew->next = pFilter;
\r
37 pNew->attribute = type;
\r
38 if (type == 1 || type == 3) pNew->string = str;
\r
39 if (type == 2 || type == 4) pNew->mask = bmask;
\r
40 if (g_qeglobals.d_savedinfo.exclude & exclude)
\r
41 pNew->active = true;
\r
43 pNew->active = false;
\r
47 // removes the filter list at *pFilter, returns NULL pointer
\r
48 bfilter_t *FilterListDelete(bfilter_t *pFilter)
\r
50 if (pFilter != NULL)
\r
52 FilterListDelete(pFilter->next);
\r
59 //spog - FilterUpdate is called each time the filters are changed by menu or shortcuts
\r
60 bfilter_t *FilterUpdate(bfilter_t *pFilter)
\r
62 pFilter = FilterAdd(pFilter,1,0,"clip",EXCLUDE_CLIP);
\r
63 pFilter = FilterAdd(pFilter,1,0,"caulk",EXCLUDE_CAULK);
\r
64 pFilter = FilterAdd(pFilter,1,0,"liquids",EXCLUDE_LIQUIDS);
\r
65 pFilter = FilterAdd(pFilter,1,0,"hint",EXCLUDE_HINTSSKIPS);
\r
66 pFilter = FilterAdd(pFilter,1,0,"clusterportal",EXCLUDE_CLUSTERPORTALS);
\r
67 pFilter = FilterAdd(pFilter,1,0,"areaportal",EXCLUDE_AREAPORTALS);
\r
68 pFilter = FilterAdd(pFilter,2,QER_TRANS,NULL,EXCLUDE_TRANSLUCENT);
\r
69 pFilter = FilterAdd(pFilter,3,0,"trigger",EXCLUDE_TRIGGERS);
\r
70 pFilter = FilterAdd(pFilter,3,0,"misc_model",EXCLUDE_MODELS);
\r
71 pFilter = FilterAdd(pFilter,3,0,"misc_gamemodel",EXCLUDE_MODELS);
\r
72 pFilter = FilterAdd(pFilter,4,ECLASS_LIGHT,NULL,EXCLUDE_LIGHTS);
\r
73 pFilter = FilterAdd(pFilter,4,ECLASS_PATH,NULL,EXCLUDE_PATHS);
\r
74 pFilter = FilterAdd(pFilter,1,0,"lightgrid",EXCLUDE_LIGHTGRID);
\r
75 pFilter = FilterAdd(pFilter,1,0,"botclip",EXCLUDE_BOTCLIP);
\r
76 pFilter = FilterAdd(pFilter,1,0,"clipmonster",EXCLUDE_BOTCLIP);
\r
86 bool FilterBrush(brush_t *pb)
\r
90 return FALSE; // during construction
\r
92 if (pb->hiddenBrush)
\r
95 if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_WORLD)
\r
97 if (strcmp(pb->owner->eclass->name, "worldspawn") == 0 || !strcmp(pb->owner->eclass->name,"func_group")) // hack, treating func_group as world
\r
103 if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_ENT)
\r
105 if (strcmp(pb->owner->eclass->name, "worldspawn") != 0 && strcmp(pb->owner->eclass->name,"func_group")) // hack, treating func_group as world
\r
111 if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_CURVES )
\r
113 if (pb->patchBrush)
\r
120 if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_DETAILS )
\r
122 if (!pb->patchBrush && pb->brush_faces->texdef.contents & CONTENTS_DETAIL )
\r
127 if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_STRUCTURAL )
\r
129 if (!pb->patchBrush && !( pb->brush_faces->texdef.contents & CONTENTS_DETAIL ))
\r
135 // if brush belongs to world entity or a brushmodel entity and is not a patch
\r
136 if ( ( strcmp(pb->owner->eclass->name, "worldspawn") == 0
\r
137 || !strncmp( pb->owner->eclass->name, "func", 4)
\r
138 || !strncmp( pb->owner->eclass->name, "trigger", 7) ) && !pb->patchBrush )
\r
141 for (face_t *f=pb->brush_faces;f!=NULL;f = f->next)
\r
144 for (bfilter_t *filters = g_qeglobals.d_savedinfo.filters;
\r
146 filters = filters->next)
\r
148 // exclude by attribute 1 brush->face->pShader->getName()
\r
149 if (filters->active && filters->attribute == 1)
\r
151 if (strstr(f->pShader->getName(),filters->string))
\r
157 // exclude by attribute 2 brush->face->pShader->getFlags()
\r
158 else if (filters->active
\r
159 && filters->attribute == 2)
\r
161 if (f->pShader->getFlags() & filters->mask)
\r
171 if (filterbrush)// if no face is found that should not be excluded
\r
172 return true; // exclude this brush
\r
175 // if brush is a patch
\r
176 if ( pb->patchBrush )
\r
178 bool drawpatch=true;
\r
179 for (bfilter_t *filters = g_qeglobals.d_savedinfo.filters;
\r
181 filters = filters->next)
\r
183 // exclude by attribute 1 (for patch) brush->pPatch->pShader->getName()
\r
184 if (filters->active
\r
185 && filters->attribute == 1)
\r
187 if (strstr(pb->pPatch->pShader->getName(),filters->string))
\r
194 // exclude by attribute 2 (for patch) brush->pPatch->pShader->getFlags()
\r
195 if (filters->active
\r
196 && filters->attribute == 2)
\r
198 if (pb->pPatch->pShader->getFlags() & filters->mask)
\r
205 if (!drawpatch) // if a shader is found that should be excluded
\r
206 return TRUE; // exclude this patch
\r
209 if (strcmp(pb->owner->eclass->name, "worldspawn") != 0) // if brush does not belong to world entity
\r
211 bool drawentity=true;
\r
212 for (bfilter_t *filters = g_qeglobals.d_savedinfo.filters;
\r
214 filters = filters->next)
\r
216 // exclude by attribute 3 brush->owner->eclass->name
\r
217 if (filters->active
\r
218 && filters->attribute == 3)
\r
220 if (strstr(pb->owner->eclass->name,filters->string))
\r
227 // exclude by attribute 4 brush->owner->eclass->nShowFlags
\r
228 else if (filters->active
\r
229 && filters->attribute == 4)
\r
231 if ( pb->owner->eclass->nShowFlags & filters->mask )
\r
238 if (!drawentity) // if an eclass property is found that should be excluded
\r
239 return TRUE; // exclude this brush
\r