visgroup filtering
[csRadar.git] / vmf.h
diff --git a/vmf.h b/vmf.h
index 4793e0bda61af53b28c06a4bc521193369c9bc0a..ea91d17ed7e78e59cb180c2f88eca79aea522266 100644 (file)
--- a/vmf.h
+++ b/vmf.h
@@ -831,3 +831,37 @@ void vmf_entity_transform( vdf_node *ent, m4x3f mat )
        // Scale
        m4x3_scale( mat, scale );
 }
+
+u32 vmf_visgroup_id( vdf_node *root, const char *name )
+{
+       vdf_node *dict = vdf_next( root, "visgroups", NULL );
+       
+       if( dict )
+       {
+               vdf_foreach( dict, "visgroup", group )
+               {
+                       if( !strcmp( kv_get( group, "name", "" ), name ) )
+                       {
+                               return kv_get_int( group, "visgroupid", 0 );
+                       }
+               }
+       }
+       
+       return 0;
+}
+
+int vmf_visgroup_match( vdf_node *ent, u32 target )
+{
+       vdf_node *editor = vdf_next( ent, "editor", NULL );
+       
+       if( editor )
+       {
+               kv_foreach( editor, "visgroupid", groupe )
+               {
+                       if( target == atoi( groupe ) )
+                               return 1;
+               }
+       }
+       
+       return 0;
+}