void UFOAIFilterInit (void)
{
+ // texture name filters
filters[FILTER_ACTORCLIP] = FilterAdd(1, 0, "actorclip", 0);
filters[FILTER_WEAPONCLIP] = FilterAdd(1, 0, "weaponclip", 0);
filters[FILTER_NODRAW] = FilterAdd(1, 0, "nodraw", 0);
filters[FILTER_STEPON] = FilterAdd(1, 0, "stepon", 0);
- filters[FILTER_LEVEL1] = FilterAdd(2, UFOAI_CONTENTS_LEVEL_1, "level1", 0);
- filters[FILTER_LEVEL2] = FilterAdd(2, UFOAI_CONTENTS_LEVEL_2, "level2", 0);
- filters[FILTER_LEVEL3] = FilterAdd(2, UFOAI_CONTENTS_LEVEL_3, "level3", 0);
- filters[FILTER_LEVEL4] = FilterAdd(2, UFOAI_CONTENTS_LEVEL_4, "level4", 0);
- filters[FILTER_LEVEL5] = FilterAdd(2, UFOAI_CONTENTS_LEVEL_5, "level5", 0);
- filters[FILTER_LEVEL6] = FilterAdd(2, UFOAI_CONTENTS_LEVEL_6, "level6", 0);
- filters[FILTER_LEVEL7] = FilterAdd(2, UFOAI_CONTENTS_LEVEL_7, "level7", 0);
- filters[FILTER_LEVEL8] = FilterAdd(2, UFOAI_CONTENTS_LEVEL_8, "level8", 0);
+ // content flag filters
+ filters[FILTER_LEVEL1] = FilterAdd(7, UFOAI_CONTENTS_LEVEL_1, "level1", 0);
+ filters[FILTER_LEVEL2] = FilterAdd(7, UFOAI_CONTENTS_LEVEL_2, "level2", 0);
+ filters[FILTER_LEVEL3] = FilterAdd(7, UFOAI_CONTENTS_LEVEL_3, "level3", 0);
+ filters[FILTER_LEVEL4] = FilterAdd(7, UFOAI_CONTENTS_LEVEL_4, "level4", 0);
+ filters[FILTER_LEVEL5] = FilterAdd(7, UFOAI_CONTENTS_LEVEL_5, "level5", 0);
+ filters[FILTER_LEVEL6] = FilterAdd(7, UFOAI_CONTENTS_LEVEL_6, "level6", 0);
+ filters[FILTER_LEVEL7] = FilterAdd(7, UFOAI_CONTENTS_LEVEL_7, "level7", 0);
+ filters[FILTER_LEVEL8] = FilterAdd(7, UFOAI_CONTENTS_LEVEL_8, "level8", 0);
Sys_Printf("UFO:AI Filters initialized\n");
}
if (filters[type]->active) {
filters[type]->active = false;
- Sys_Printf("filter %i deactivated\n", type);
+ //Sys_Printf("filter %i deactivated (mask %i 0x%x)\n", type, filters[type]->mask, filters[type]->mask);
} else {
filters[type]->active = true;
- Sys_Printf("filter %i activated\n", type);
+ //Sys_Printf("filter %i activated (mask %i 0x%x)\n", type, filters[type]->mask, filters[type]->mask);
}
FiltersActivate();
// type 3 = entity filter (name)
// type 2 = QER_* shader flags
// type 4 = entity classes
+// type 5 = surface flags (q2)
+// type 6 = content flags (q2)
+// type 7 = content flags - no match (q2)
bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude)
{
bfilter_t *pNew = new bfilter_t;
pNew->next = pFilter;
pNew->attribute = type;
if (type == 1 || type == 3) pNew->string = str;
- if (type == 2 || type == 4) pNew->mask = bmask;
+ if (type == 2 || type == 4 || type == 5 || type == 6 || type == 7) pNew->mask = bmask;
if (g_qeglobals.d_savedinfo.exclude & exclude)
pNew->active = true;
else
filters != NULL;
filters = filters->next)
{
+ if (!filters->active)
+ continue;
// exclude by attribute 1 brush->face->pShader->getName()
- if (filters->active && filters->attribute == 1)
+ if (filters->attribute == 1)
{
if (strstr(f->pShader->getName(),filters->string))
{
}
}
// exclude by attribute 2 brush->face->pShader->getFlags()
- else if (filters->active
- && filters->attribute == 2)
+ else if (filters->attribute == 2)
{
if (f->pShader->getFlags() & filters->mask)
{
filterbrush=true;
break;
}
+ // quake2 - 5 == surface flags, 6 == content flags
+ }
+ else if (filters->attribute == 5)
+ {
+ if (f->texdef.flags && f->texdef.flags & filters->mask)
+ {
+ filterbrush=true;
+ break;
+ }
+ }
+ else if (filters->attribute == 6)
+ {
+ if (f->texdef.contents && f->texdef.contents & filters->mask)
+ {
+ filterbrush=true;
+ break;
+ }
+ }
+ else if (filters->attribute == 7)
+ {
+ if (f->texdef.contents && !(f->texdef.contents & filters->mask))
+ {
+ filterbrush=true;
+ break;
+ }
}
}
if (!filterbrush)