From: hgn Date: Thu, 29 May 2025 01:23:57 +0000 (+0100) Subject: AND THER WAS LIGHT X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=ba6ac28151a70c7c5ae480e9322f09ad53124757;p=carveJwlIkooP6JGAAIwe30JlM.git AND THER WAS LIGHT --- diff --git a/content_skaterift/maps/dev_hub/main.mdl b/content_skaterift/maps/dev_hub/main.mdl index ad7c362..0c90209 100644 Binary files a/content_skaterift/maps/dev_hub/main.mdl and b/content_skaterift/maps/dev_hub/main.mdl differ diff --git a/content_skaterift/maps/dev_tutorial/main.mdl b/content_skaterift/maps/dev_tutorial/main.mdl index 5ffb99f..9b6ec4b 100644 Binary files a/content_skaterift/maps/dev_tutorial/main.mdl and b/content_skaterift/maps/dev_tutorial/main.mdl differ diff --git a/content_skaterift/maps/mp_line1/main.mdl b/content_skaterift/maps/mp_line1/main.mdl index 83c567e..79141db 100644 Binary files a/content_skaterift/maps/mp_line1/main.mdl and b/content_skaterift/maps/mp_line1/main.mdl differ diff --git a/content_skaterift/maps/mp_spawn/main.mdl b/content_skaterift/maps/mp_spawn/main.mdl index d8d1473..58b4d7d 100644 Binary files a/content_skaterift/maps/mp_spawn/main.mdl and b/content_skaterift/maps/mp_spawn/main.mdl differ diff --git a/content_skaterift/sound/city.ogg b/content_skaterift/sound/city.ogg new file mode 100644 index 0000000..13900d6 Binary files /dev/null and b/content_skaterift/sound/city.ogg differ diff --git a/content_skaterift/sound/gino.ogg b/content_skaterift/sound/gino.ogg new file mode 100644 index 0000000..353a2b3 Binary files /dev/null and b/content_skaterift/sound/gino.ogg differ diff --git a/content_skaterift/sound/happy.ogg b/content_skaterift/sound/happy.ogg new file mode 100644 index 0000000..b9f82a3 Binary files /dev/null and b/content_skaterift/sound/happy.ogg differ diff --git a/content_skaterift/sound/heli.ogg b/content_skaterift/sound/heli.ogg new file mode 100644 index 0000000..63b3c1e Binary files /dev/null and b/content_skaterift/sound/heli.ogg differ diff --git a/content_skaterift/sound/island.ogg b/content_skaterift/sound/island.ogg new file mode 100644 index 0000000..c503e49 Binary files /dev/null and b/content_skaterift/sound/island.ogg differ diff --git a/content_skaterift/sound/jungle.ogg b/content_skaterift/sound/jungle.ogg new file mode 100644 index 0000000..827f14a Binary files /dev/null and b/content_skaterift/sound/jungle.ogg differ diff --git a/content_skaterift/sound/techno.ogg b/content_skaterift/sound/techno.ogg new file mode 100644 index 0000000..9f197a0 Binary files /dev/null and b/content_skaterift/sound/techno.ogg differ diff --git a/skaterift_blender/sr_main.py b/skaterift_blender/sr_main.py index 8af6c51..d272cbd 100644 --- a/skaterift_blender/sr_main.py +++ b/skaterift_blender/sr_main.py @@ -42,6 +42,7 @@ sr_entity_list = [ ('ent_script', 'Script', '', 29 ), ('ent_atom', 'Atom', '', 30 ), ('ent_cutscene', 'Cutscene', '', 31 ), + # reserved 32.. light ] MDL_VERSION_NR = 109 @@ -60,6 +61,7 @@ def get_entity_enum_id( alias ): if alias == 'ent_cubemap': return 21 if alias == 'mdl_armature': return 28 + if alias == 'ent_light': return 32 return 0 #} @@ -217,6 +219,7 @@ class ent_light(Structure): ("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): @@ -2340,14 +2343,14 @@ class SR_UL_ENT_EVENT_LIST(bpy.types.UIList): 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: diff --git a/src/audio.c b/src/audio.c index 463269b..2d47ca5 100644 --- a/src/audio.c +++ b/src/audio.c @@ -99,11 +99,6 @@ audio_clip audio_grass[] = { { .path = "sound/grass3.ogg" }, }; -audio_clip audio_ambience[] = -{ - { .path="sound/town_generic.ogg" } -}; - audio_clip audio_gate_pass = { .path = "sound/gate_pass.ogg" }; @@ -121,6 +116,11 @@ audio_clip audio_wood_break = .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" }, @@ -192,7 +192,6 @@ void audio_init(void) 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 ); @@ -209,6 +208,7 @@ void audio_init(void) 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(); diff --git a/src/ent_npc.c b/src/ent_npc.c index 12c16b5..81d80ff 100644 --- a/src/ent_npc.c +++ b/src/ent_npc.c @@ -53,6 +53,8 @@ struct const cs_subtitle *subtitles; i32 sub_index; v3f sub_position; + + audio_channel_id aud_gino; } _npc; @@ -379,6 +381,34 @@ void _ent_npc_preupdate(void) 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 ++ ) diff --git a/src/ent_script.c b/src/ent_script.c index 228c3e6..c29f4cb 100644 --- a/src/ent_script.c +++ b/src/ent_script.c @@ -10,6 +10,7 @@ _ent_script; #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[] = { @@ -17,6 +18,7 @@ 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 } }; diff --git a/src/ent_skateshop.c b/src/ent_skateshop.c index 0497c70..c270fa6 100644 --- a/src/ent_skateshop.c +++ b/src/ent_skateshop.c @@ -131,14 +131,17 @@ static void skateshop_playermod( bool immobile ) 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) diff --git a/src/entity.h b/src/entity.h index bd627d0..802f8fd 100644 --- a/src/entity.h +++ b/src/entity.h @@ -74,6 +74,7 @@ enum entity_alias{ k_ent_script = 29, k_ent_atom = 30, k_ent_cutscene = 31, + k_ent_light = 32, k_ent_max }; @@ -109,7 +110,8 @@ const char *_entity_alias_str[] = [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 ) diff --git a/src/scripts/l1_speed.c b/src/scripts/l1_speed.c new file mode 100644 index 0000000..6b929f3 --- /dev/null +++ b/src/scripts/l1_speed.c @@ -0,0 +1,35 @@ +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; +} diff --git a/src/world_entity.c b/src/world_entity.c index 1b34a81..dabece9 100644 --- a/src/world_entity.c +++ b/src/world_entity.c @@ -390,6 +390,31 @@ entity_event_result ent_audio_event( ent_event *event ) 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; @@ -811,6 +836,7 @@ static void _event_trigger( ent_event *event ) [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,