camera shake
[carveJwlIkooP6JGAAIwe30JlM.git] / world_load.c
index 493b89d9cb759147c931ce75b4881a631bc5584f..2eca813ceeda80941dffed10b9f76dcbc5438773 100644 (file)
@@ -4,6 +4,7 @@
 #include "world_load.h"
 #include "world_routes.h"
 #include "world_gate.h"
+#include "ent_skateshop.h"
 
 /* 
  * load the .mdl file located in path (relative to exe), it will load into the 
@@ -57,6 +58,7 @@ VG_STATIC void world_load_mdl( const char *path )
    mdl_load_array( meta, &world->ent_marker,    "ent_marker",     heap );
    mdl_load_array( meta, &world->ent_skateshop, "ent_skateshop",  heap );
    mdl_load_array( meta, &world->ent_swspreview,"ent_swspreview", heap );
+   mdl_load_array( meta, &world->ent_ccmd,      "ent_ccmd",       heap );
 
    mdl_array_ptr infos;
    mdl_load_array( meta, &infos, "ent_worldinfo", vg_mem.scratch );
@@ -130,21 +132,21 @@ static void skaterift_world_changer_thread( void *data )
    char worlds[3][4096];
    u32 i=0;
 
-   DIR *dir = opendir( folder.buffer );
-   if( !dir ){
+   vg_dir dir;
+   if( !vg_dir_open(&dir, folder.buffer) ){
       vg_error( "opendir('%s') failed\n", folder.buffer );
       vg_async_call( async_skaterift_world_loaded, NULL, 0 );
       return;
    }
 
-   struct dirent *entry;
-   while( (entry = readdir(dir)) ){
-      if( entry->d_type == DT_REG ){
-         if( entry->d_name[0] == '.' ) continue;
+   while( vg_dir_next_entry(&dir) ){
+      if( vg_dir_entry_type(&dir) == k_vg_entry_type_file ){
+         const char *d_name = vg_dir_entry_name(&dir);
+         if( d_name[0] == '.' ) continue;
 
          vg_str file = folder;
          vg_strcat( &file, "/" );
-         vg_strcat( &file, entry->d_name );
+         vg_strcat( &file, d_name );
          if( !vg_strgood( &file ) ) continue;
 
          char *ext = vg_strch( &file, '.' );
@@ -159,7 +161,7 @@ static void skaterift_world_changer_thread( void *data )
          strcpy( worlds[i++], file.buffer );
       }
    }
-   closedir(dir);
+   vg_dir_close(&dir);
 
    if( i == 0 ){
       vg_warn( "There are no .mdl files in the map folder.\n" );