+
+ int in_trigger = 0;
+ for( int i=0; i<world->trigger_count; i++ )
+ {
+ struct trigger_zone *zone = &world->triggers[i];
+
+ for( int j=0; j<random_ticks; j++ )
+ {
+ logic_packet packet;
+ packet.location = zone->target_logic_brick;
+ packet.function = 0;
+
+ packet.type = k_mdl_128bit_datatype_vec3;
+ packet.data._v4f[0] = vg_randf()*2.0f-1.0f;
+ packet.data._v4f[1] = vg_randf()*2.0f-1.0f;
+ packet.data._v4f[2] = vg_randf()*2.0f-1.0f;
+ m4x3_mulv( zone->transform, packet.data._v4f, packet.data._v4f );
+
+ logic_bricks_send_packet( world, &packet );
+ continue;
+ }
+
+ v3f local;
+ m4x3_mulv( zone->inv_transform, pos, local );
+
+ if( (fabsf(local[0]) <= 1.0f) &&
+ (fabsf(local[1]) <= 1.0f) &&
+ (fabsf(local[2]) <= 1.0f) )
+ {
+ in_trigger = 1;
+
+ if( !world_global.in_trigger )
+ {
+ logic_packet packet;
+ packet.location = zone->target_logic_brick;
+ packet.function = 0;
+
+ packet.type = k_mdl_128bit_datatype_vec3;
+ v3_copy( pos, packet.data._v4f );
+
+ logic_bricks_send_packet( world, &packet );
+ }
+ }
+
+ vg_line_boxf_transformed( zone->transform, (boxf){{-1.0f,-1.0f,-1.0f},
+ { 1.0f, 1.0f, 1.0f}},
+ 0xff00ff00 );
+ }
+
+ if( k_debug_light_indices )
+ {
+ for( int i=0; i<world->light_count; i++ )
+ {
+ struct world_light *light = &world->lights[i];
+ struct classtype_world_light *inf = light->inf;
+
+ u32 colour = 0xff000000;
+ u8 r = inf->colour[0] * 255.0f,
+ g = inf->colour[1] * 255.0f,
+ b = inf->colour[2] * 255.0f;
+
+ colour |= r;
+ colour |= g << 8;
+ colour |= b << 16;
+
+ vg_line_pt3( light->node->co, 0.25f, colour );
+ }
+ }
+
+ world_global.in_trigger = in_trigger;
+ sfd_update();
+
+ if( debug_logic_bricks )
+ logic_bricks_debug( world );
+
+ /* process soundscape transactions */
+ audio_lock();
+ for( int i=0; i<world->soundscape_count; i++ )
+ {
+ struct soundscape *s = &world->soundscapes[i];
+ s->usage_count = 0;
+
+ for( int j=0; j<s->max_instances; j++ )
+ {
+ if( s->channels[j] )
+ {
+ if( audio_channel_finished(s->channels[j]) )
+ s->channels[j] = audio_relinquish_channel( s->channels[j] );
+ else
+ s->usage_count ++;
+ }
+ }
+ }
+ audio_unlock();