include challenge entitites in region consideration
authorhgn <hgodden00@gmail.com>
Tue, 28 Nov 2023 11:37:53 +0000 (11:37 +0000)
committerhgn <hgodden00@gmail.com>
Tue, 28 Nov 2023 11:37:53 +0000 (11:37 +0000)
ent_region.c

index 4d835b8ff632e89f6dff158b5118c659eb88aaea..eecf22d05ff65d1b4846bdb324c56733ed0c2b33 100644 (file)
@@ -88,8 +88,26 @@ static void ent_region_re_eval( world_instance *world ){
          combined &= route->flags;
       }
 
-      region->flags = combined;
+      for( u32 j=0; j<mdl_arrcount(&world->ent_challenge); j ++ ){
+         ent_challenge *challenge = mdl_arritm( &world->ent_challenge, j );
 
-      /* TODO: Challenges */
+         v3f local;
+         m4x3_mulv( volume->to_local, challenge->transform.co, local );
+         if( !((fabsf(local[0]) <= 1.0f) &&
+               (fabsf(local[1]) <= 1.0f) &&
+               (fabsf(local[2]) <= 1.0f)) ){
+            continue;
+         }
+
+         u32 flags = 0x00;
+         if( challenge->status ){
+            flags |= k_ent_route_flag_achieve_gold;
+            flags |= k_ent_route_flag_achieve_silver;
+         }
+
+         combined &= flags;
+      }
+
+      region->flags = combined;
    }
 }