('ent_script', 'Script', '', 29 ),
('ent_atom', 'Atom', '', 30 ),
('ent_cutscene', 'Cutscene', '', 31 ),
+ # reserved 32.. light
]
MDL_VERSION_NR = 109
if alias == 'ent_cubemap': return 21
if alias == 'mdl_armature': return 28
+ if alias == 'ent_light': return 32
return 0
#}
("range",c_float),
("inverse_world",(c_float*3)*4), # Runtime
("angle_sin_cos",(c_float*2))] # Runtime
+ sr_functions = { 'on': 0x1 }
#}
class version_refcount_union(Union):
if item.reciever == None:
rec.alert=True
rec.prop( item, 'reciever', text='',emboss=True )
- rec.label( text=(item.reciever.SR_data.ent_type if item.reciever else '') + \
+ rec.label( text=( obj_ent_type( item.reciever ) if item.reciever else '') + \
(' (self)' if item.reciever == context.active_object else '' ) )
rec_ev = layout.column()
errstr = None
if item.reciever:
#{
- tipo = item.reciever.SR_data.ent_type
+ tipo = obj_ent_type( item.reciever )
cls = globals()[ tipo ]
table = getattr( cls, 'sr_functions', None )
if table:
{ .path = "sound/grass3.ogg" },
};
-audio_clip audio_ambience[] =
-{
- { .path="sound/town_generic.ogg" }
-};
-
audio_clip audio_gate_pass = {
.path = "sound/gate_pass.ogg"
};
.path = "sound/woodbreak.ogg"
};
+audio_clip audio_gino[] =
+{
+ { .path = "sound/gino.ogg" },
+};
+
audio_clip audio_rewind[] = {
{ .path = "sound/rewind_start.ogg" },
{ .path = "sound/rewind_end_1.5.ogg" },
audio_clip_loadn( audio_taps, VG_ARRAY_LEN(audio_taps), NULL );
audio_clip_loadn( audio_flips, VG_ARRAY_LEN(audio_flips), NULL );
audio_clip_loadn( audio_hits, VG_ARRAY_LEN(audio_hits), NULL );
- audio_clip_loadn( audio_ambience, VG_ARRAY_LEN(audio_ambience), NULL );
audio_clip_loadn( &audio_splash, 1, NULL );
audio_clip_loadn( &audio_gate_pass, 1, NULL );
audio_clip_loadn( &audio_gate_lap, 1, NULL );
audio_clip_loadn( audio_rewind, VG_ARRAY_LEN(audio_rewind), NULL );
audio_clip_loadn( audio_ui, VG_ARRAY_LEN(audio_ui), NULL );
audio_clip_loadn( audio_challenge, VG_ARRAY_LEN(audio_challenge), NULL );
+ audio_clip_loadn( audio_gino, VG_ARRAY_LEN(audio_gino), NULL );
vg_audio_lock();
air_audio_data.channel_id = vg_audio_get_first_idle_channel();
const cs_subtitle *subtitles;
i32 sub_index;
v3f sub_position;
+
+ audio_channel_id aud_gino;
}
_npc;
else
_npc.gino.spark_t -= vg.time_delta;
}
+
+ vg_audio_lock();
+ if( !_npc.aud_gino )
+ {
+ _npc.aud_gino = vg_audio_get_first_idle_channel();
+ if( _npc.aud_gino )
+ {
+ vg_audio_set_channel_clip( _npc.aud_gino, &audio_gino[0] );
+ vg_audio_set_channel_spacial_falloff( _npc.aud_gino, _npc.gino.co, 40.0f );
+ vg_audio_set_channel_volume( _npc.aud_gino, 1.0, 1 );
+ vg_audio_add_channel_flags( _npc.aud_gino, AUDIO_FLAG_LOOP );
+ vg_audio_start_channel( _npc.aud_gino );
+ }
+ }
+ else
+ {
+ vg_audio_set_channel_spacial_falloff( _npc.aud_gino, _npc.gino.co, 40.0f );
+ }
+ vg_audio_unlock();
+ }
+ else
+ {
+ if( _npc.aud_gino )
+ {
+ vg_audio_lock();
+ _npc.aud_gino = vg_audio_crossfade( _npc.aud_gino, NULL, 0.1f );
+ vg_audio_unlock();
+ }
}
for( u32 i=0; i<4; i ++ )
#include "scripts/explode.c"
#include "scripts/tutorial_island.c"
#include "scripts/board_maker.c"
+#include "scripts/l1_speed.c"
struct ent_script_table_entry _ent_script_table[] =
{
{ "volc_main", _skaterift_script_volc },
{ "board_maker", _skaterift_script_board_maker },
{ "generic", _skaterift_script_generic },
+ { "l1_speed", _script_l1_speed },
{ NULL }
};
static void skateshop_accept_board( addon_cache_id cache_id )
{
- vg_info( "chose board from skateshop (%u)\n", _skateshop.selected_board_index );
- addon_cache_unwatch( k_addon_type_board, localplayer.board_view_slot );
- addon_cache_watch( k_addon_type_board, cache_id );
- localplayer.board_view_slot = cache_id;
- network_send_item( k_netmsg_playeritem_board );
- gui_helper_reset( k_gui_helper_mode_clear );
- skateshop_playermod( 0 );
- _skateshop.open = 0;
+ if( world_clear_event( k_world_event_shop ) )
+ {
+ vg_info( "chose board from skateshop (%u)\n", _skateshop.selected_board_index );
+ addon_cache_unwatch( k_addon_type_board, localplayer.board_view_slot );
+ addon_cache_watch( k_addon_type_board, cache_id );
+ localplayer.board_view_slot = cache_id;
+ network_send_item( k_netmsg_playeritem_board );
+ gui_helper_reset( k_gui_helper_mode_clear );
+ skateshop_playermod( 0 );
+ _skateshop.open = 0;
+ }
}
static void skateshop_accept_playermodel(void)
k_ent_script = 29,
k_ent_atom = 30,
k_ent_cutscene = 31,
+ k_ent_light = 32,
k_ent_max
};
[k_ent_armature] = "mdl_armature",
[k_ent_script] = "ent_script",
[k_ent_atom] = "ent_atom",
- [k_ent_cutscene] = "ent_cutscene"
+ [k_ent_cutscene] = "ent_cutscene",
+ [k_ent_light] = "ent_light"
};
static inline u32 mdl_entity_id_type( u32 entity_id )
--- /dev/null
+struct script_speed
+{
+ bool ok, init;
+};
+
+static bool _script_l1_speed( ent_script_event *event )
+{
+ if( event->type == k_escript_event_allocate )
+ {
+ struct script_event_allocate *event_info = event->info;
+ struct script_speed *s = vg_linear_alloc( event_info->heap, sizeof(struct script_speed) );
+ s->ok = 0;
+ s->init = 0;
+ event_info->userdata = s;
+ return 1;
+ }
+ struct script_speed *s = event->userdata;
+
+ if( event->type == k_escript_event_update )
+ {
+ bool new_state = 0;
+ f32 speed = v3_length( localplayer.rb.v );
+ if( speed > 50.0f )
+ new_state = 1;
+
+ if( (new_state != s->ok) || (s->init == 0) )
+ {
+ _world_raise_event( event->script_entity_id, new_state? "yes": "no" );
+ s->ok = new_state;
+ s->init = 1;
+ }
+ }
+
+ return 1;
+}
return k_entity_event_result_OK;
}
+entity_event_result ent_light_event( ent_event *event )
+{
+ world_instance *world = &_world.main;
+ ent_light *light = af_arritm( &world->ent_light, mdl_entity_id_id( event->recieve_entity_id ) );
+
+ if( AF_STR_EQ( &world->meta.af, event->pstr_recieve_event, "on" ) )
+ {
+ if( event->flags & k_ent_event_data_const_i32 )
+ {
+ v3f colour;
+ if( event->data.const_i32 )
+ v3_muls( light->colour, light->colour[3] * 2.0f, colour );
+ else
+ v3_fill( colour, 0.0f );
+
+ u32 offset = mdl_entity_id_id( event->recieve_entity_id ) * sizeof(f32)*4*3;
+ glBindBuffer( GL_TEXTURE_BUFFER, world->tbo_light_entities );
+ glBufferSubData( GL_TEXTURE_BUFFER, offset, sizeof(f32)*3, colour );
+ }
+ else return k_entity_event_result_invalid;
+ }
+ else return k_entity_event_result_unhandled;
+ return k_entity_event_result_OK;
+}
+
entity_event_result ent_ccmd_event( ent_event *event )
{
world_instance *world = &_world.main;
[k_ent_skateshop] = ent_skateshop_event,
[k_ent_objective] = ent_objective_event,
[k_ent_ccmd] = ent_ccmd_event,
+ [k_ent_light] = ent_light_event,
[k_ent_gate] = ent_gate_event,
[k_ent_challenge] = ent_challenge_event,
[k_ent_route] = ent_route_event,