mission is possible
[carveJwlIkooP6JGAAIwe30JlM.git] / world_gen.h
index c8c7fb797b419ca80da92801d127b3c7c3ff2dd9..2bada3aa5fcd79acb692054b0c9a239c38accddf 100644 (file)
@@ -637,6 +637,7 @@ VG_STATIC void world_init_blank( world_instance *world )
    world->rendering_gate = NULL;
 
    world->water.enabled = 0;
+   world->time = 0.0;
 
    /* default lighting conditions 
     * -------------------------------------------------------------*/
@@ -838,6 +839,25 @@ VG_STATIC void world_load( u32 index, const char *path )
    mdl_load_array( meta, &world->ent_skateshop, "ent_skateshop",  heap );
    mdl_load_array( meta, &world->ent_swspreview,"ent_swspreview", heap );
 
+   mdl_array_ptr infos;
+   mdl_load_array( meta, &infos, "ent_worldinfo", vg_mem.scratch );
+
+   if( mdl_arrcount(&infos) ){
+      world->info = *((ent_worldinfo *)mdl_arritm(&infos,0));
+   }
+   else{
+      world->info.pstr_author = 0;
+      world->info.pstr_desc = 0;
+      world->info.pstr_name = 0;
+      world->info.timezone = 0.0f;
+   }
+
+   time_t t;
+   struct tm *tm;
+   time( &t );
+   tm = gmtime( &t );
+   world->time = (float)tm->tm_min/20.0f + (world->info.timezone/24.0f);
+
    /* process resources from pack */
    world_process_resources( world );