+VG_STATIC void world_pct_spawn( world_instance *world, mdl_node *pnode )
+{
+ struct respawn_point *rp = &world->spawns[ world->spawn_count ++ ];
+
+ v3_copy( pnode->co, rp->co );
+ v4_copy( pnode->q, rp->q );
+ rp->name = mdl_pstr( world->meta, pnode->pstr_name );
+}
+
+VG_STATIC void world_pct_water( world_instance *world, mdl_node *pnode )
+{
+ if( world->water.enabled )
+ {
+ vg_warn( "Multiple water surfaces in level! ('%s')\n",
+ mdl_pstr( world->meta, pnode->pstr_name ));
+ return;
+ }
+
+ world->water.enabled = 1;
+ water_set_surface( world, pnode->co[1] );
+}
+
+VG_STATIC void world_pct_audio( world_instance *world, mdl_node *pnode )
+{
+ struct world_audio_thing *thing = &world->audio_things[
+ world->audio_things_count ];
+
+ memset( thing, 0, sizeof(struct world_audio_thing) );
+ struct classtype_audio *aud = mdl_get_entdata( world->meta, pnode );
+
+ v3_copy( pnode->co, thing->pos );
+
+ thing->volume = aud->volume;
+ thing->range = pnode->s[0];
+
+ thing->flags = aud->flags;
+ thing->temp_embedded_clip.path = mdl_pstr( world->meta, aud->pstr_file );
+ thing->temp_embedded_clip.flags = aud->flags;
+
+ audio_clip_load( &thing->temp_embedded_clip, world_global.generic_heap );
+
+ pnode->sub_uid = world->audio_things_count;
+ world->audio_things_count ++;
+}
+
+VG_STATIC void world_pct_world_light( world_instance *world, mdl_node *pnode )
+{
+ struct world_light *light = &world->lights[ world->light_count ++ ];
+ light->node = pnode;
+ light->inf = mdl_get_entdata( world->meta, pnode );
+
+ q_m3x3( pnode->q, light->inverse_world );
+ v3_copy( pnode->co, light->inverse_world[3] );
+ m4x3_invert_affine( light->inverse_world, light->inverse_world );
+
+ light->angle_sin_cos[0] = sinf( light->inf->angle * 0.5f );
+ light->angle_sin_cos[1] = cosf( light->inf->angle * 0.5f );
+}
+
+VG_STATIC void world_pct_nonlocal_gate( world_instance *world, mdl_node *pnode )
+{
+ struct nonlocal_gate *gate = &world->nonlocal_gates[
+ world->nonlocalgate_count ++ ];
+ struct classtype_gate *inf = mdl_get_entdata( world->meta, pnode );
+
+ gate->working = 0;
+ gate->node = pnode;
+ gate->target_map_index = 0;
+ v2_copy( inf->dims, gate->gate.dims );
+}
+
+VG_STATIC void world_entities_process( world_instance *world )
+{
+ struct entity_instruction
+ {
+ enum classtype ct;
+ void (*process)( world_instance *world, mdl_node *pnode );
+ }
+ entity_instructions[] =
+ {
+ { k_classtype_spawn, world_pct_spawn },
+ { k_classtype_water, world_pct_water },
+ { k_classtype_audio, world_pct_audio },
+ { k_classtype_world_light, world_pct_world_light },
+ { k_classtype_nonlocal_gate, world_pct_nonlocal_gate }
+ };
+
+ for( int i=0; i<world->meta->info.node_count; i++ )
+ {
+ mdl_node *pnode = mdl_node_from_id( world->meta, i );
+
+ for( int j=0; j<vg_list_size(entity_instructions); j++ )
+ {
+ struct entity_instruction *instr = &entity_instructions[j];
+
+ if( pnode->classtype == instr->ct )
+ {
+ instr->process( world, pnode );
+ break;