npcs and tutorial stuff
[carveJwlIkooP6JGAAIwe30JlM.git] / entity.c
index 59e9219abcfe58a7baaab9a574b19c5b83091b16..557ba799a792d2e61e96f8fa3591b67ed72a4b78 100644 (file)
--- a/entity.c
+++ b/entity.c
@@ -1,22 +1,21 @@
-#ifndef ENTITY_C
-#define ENTITY_C
-
 #include "world.h"
 #include "entity.h"
 #include "world_entity.h"
 
-#include "ent_skateshop.c"
-#include "ent_objective.c"
-#include "ent_challenge.c"
-#include "ent_relay.c"
-#include "ent_route.c"
-#include "ent_portal.c"
-#include "ent_miniworld.c"
-#include "ent_region.c"
+#include "ent_objective.h"
+#include "ent_skateshop.h"
+#include "ent_relay.h"
+#include "ent_challenge.h"
+#include "ent_route.h"
+#include "ent_miniworld.h"
+#include "ent_region.h"
+#include "ent_glider.h"
+#include "ent_npc.h"
 
 typedef void (*fn_entity_call_handler)( world_instance *, ent_call *);
 
-static void entity_call( world_instance *world, ent_call *call ){
+void entity_call( world_instance *world, ent_call *call )
+{
    u32 type = mdl_entity_id_type( call->id );
 
    fn_entity_call_handler table[] = {
@@ -30,7 +29,9 @@ static void entity_call( world_instance *world, ent_call *call ){
       [k_ent_challenge] = ent_challenge_call,
       [k_ent_route]     = ent_route_call,
       [k_ent_miniworld] = ent_miniworld_call,
-      [k_ent_region]    = ent_region_call
+      [k_ent_region]    = ent_region_call,
+      [k_ent_glider]    = ent_glider_call,
+      [k_ent_npc]       = ent_npc_call
    };
 
    if( type >= vg_list_size(table) ){
@@ -48,4 +49,17 @@ static void entity_call( world_instance *world, ent_call *call ){
    fn( world, call );
 }
 
-#endif /* ENTITY_C */
+ent_marker *ent_find_marker( mdl_context *mdl, mdl_array_ptr *arr, 
+                             const char *alias )
+{
+   for( u32 i=0; i<mdl_arrcount(arr); i++ ){
+      ent_marker *marker = mdl_arritm( arr, i );
+
+      if( !strcmp( mdl_pstr( mdl, marker->pstr_alias ), alias ) ){
+         return marker;
+      }
+   }
+
+   return NULL;
+}
+