struct countable
{
- enum classtype ct;
+ enum classtype ct, ct1;
void **to_allocate;
u32 item_size;
int count;
{
{
k_classtype_spawn,
+ k_classtype_none,
(void*)&world->spawns,
sizeof(struct respawn_point)
},
{
k_classtype_audio,
+ k_classtype_none,
(void*)&world->audio_things,
sizeof(struct world_audio_thing)
},
{
k_classtype_trigger,
+ k_classtype_particle_box,
(void*)&world->triggers,
sizeof(struct trigger_zone)
},
+
+#if 0
{
k_classtype_logic_relay,
(void*)&world->logic_relays,
sizeof(struct logic_relay)
},
+#endif
+
{
k_classtype_logic_achievement,
+ k_classtype_none,
(void*)&world->logic_achievements,
sizeof(struct logic_achievement)
},
{
k_classtype_world_light,
+ k_classtype_none,
(void*)&world->lights,
sizeof(struct world_light)
},
{
k_classtype_nonlocal_gate,
+ k_classtype_none,
(void*)&world->nonlocal_gates,
sizeof(struct nonlocal_gate)
+ },
+ {
+ k_classtype_soundscape,
+ k_classtype_none,
+ (void*)&world->soundscapes,
+ sizeof(struct soundscape)
}
};
for( int j=0; j<vg_list_size(entity_counts); j ++ )
{
- if( pnode->classtype == entity_counts[j].ct )
+ if( (pnode->classtype == entity_counts[j].ct) ||
+ (pnode->classtype == entity_counts[j].ct1) )
{
pnode->sub_uid = entity_counts[j].count;
entity_counts[j].count ++;
u32 bufsize = counter->item_size*counter->count;
*counter->to_allocate = vg_linear_alloc( world_global.generic_heap,
bufsize );
+ memset( *counter->to_allocate, 0, bufsize );
}
+
+ logic_bricks_world_gen_allocate( world );
+
+ world->trigger_bh = bh_create( world_global.generic_heap,
+ &bh_system_triggers,
+ world,
+ world->trigger_count,
+ 1 );
}
VG_STATIC void world_pct_spawn( world_instance *world, mdl_node *pnode )
v3_copy( pnode->co, thing->pos );
- if( aud->flags & AUDIO_FLAG_SPACIAL_3D )
- thing->volume = aud->volume * pnode->s[0];
- else
- thing->volume = aud->volume;
+ 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.source_mode = k_audio_source_mono;
+ thing->temp_embedded_clip.flags = aud->flags;
- audio_clip_load( &thing->temp_embedded_clip, world_global.audio_heap );
- thing->player.name = mdl_pstr( world->meta, pnode->pstr_name );
- thing->player.enqued = 0;
+ 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_trigger( world_instance *world, mdl_node *pnode )
-{
- struct trigger_zone *trigger = &world->triggers[ world->trigger_count ];
- struct classtype_trigger *inf = mdl_get_entdata( world->meta, pnode );
-
- if( inf->target )
- {
- mdl_node *target_node = mdl_node_from_id( world->meta, inf->target );
-
- trigger->target.sub_id = target_node->sub_uid;
- trigger->target.classtype = target_node->classtype;
- }
- else
- {
- vg_warn( "Trigger with no target...\n" );
- return;
- }
-
- mdl_node_transform( pnode, trigger->transform );
- m4x3_invert_full( trigger->transform, trigger->inv_transform );
-
- world->trigger_count ++;
-}
-
-
+#if 0
VG_STATIC void world_pct_relay( world_instance *world, mdl_node *pnode )
{
struct logic_relay *relay = &world->logic_relays[ world->relay_count ];
v3_copy( pnode->co, relay->pos );
world->relay_count ++;
}
+#endif
VG_STATIC void world_pct_achievement( world_instance *world, mdl_node *pnode )
{ k_classtype_spawn, world_pct_spawn },
{ k_classtype_water, world_pct_water },
{ k_classtype_audio, world_pct_audio },
- { k_classtype_trigger, world_pct_trigger },
+#if 0
{ k_classtype_logic_relay, world_pct_relay },
+#endif
{ k_classtype_logic_achievement, world_pct_achievement },
{ k_classtype_world_light, world_pct_world_light },
{ k_classtype_nonlocal_gate, world_pct_nonlocal_gate }
for( int i=0; i<world->audio_things_count; i++ )
{
struct world_audio_thing *thingy = &world->audio_things[ i ];
-
- audio_player_init( &thingy->player );
- audio_player_set_flags( &thingy->player, thingy->flags );
- audio_player_set_vol( &thingy->player, thingy->volume );
- audio_player_set_pan( &thingy->player, 0.0f );
-
- if( thingy->flags & AUDIO_FLAG_SPACIAL_3D )
- audio_player_set_position( &thingy->player, thingy->pos );
if( thingy->flags & AUDIO_FLAG_AUTO_START )
- audio_player_playclip( &thingy->player, &thingy->temp_embedded_clip );
+ {
+ audio_channel *ch =
+ audio_request_channel( &thingy->temp_embedded_clip, thingy->flags );
+
+ audio_channel_edit_volume( ch, thingy->volume, 1 );
+ audio_channel_set_spacial( ch, thingy->pos, thingy->range );
+
+ if( !(ch->flags & AUDIO_FLAG_LOOP) )
+ ch = audio_relinquish_channel( ch );
+ }
}
audio_unlock();
/* clean dangling pointers */
world->meta = NULL;
+ /*
+ * TODO: Theres probably a better way to do this?
+ */
+
world->textures = NULL;
world->texture_count = 0;
world->materials = NULL;
world->lights = NULL;
world->light_count = 0;
+#if 0
world->logic_relays = NULL;
world->relay_count = 0;
+#endif
world->logic_achievements = NULL;
world->achievement_count = 0;
world->collectors = NULL;
world->collector_count = 0;
+ world->soundscapes = NULL;
+ world->soundscape_count = 0;
+
+ world->logic_bricks = NULL;
+ world->logic_brick_count = 0;
+
world->nonlocal_gates = NULL;
world->nonlocalgate_count = 0;