From: hgn Date: Tue, 27 May 2025 20:17:16 +0000 (+0100) Subject: little bit of this little bit of that X-Git-Url: https://skaterift.com/git/?a=commitdiff_plain;h=8addcb176e83ec8e1430aa0257e85e4b4ea0105e;p=carveJwlIkooP6JGAAIwe30JlM.git little bit of this little bit of that --- diff --git a/content_skaterift/maps/dev_heaven/main.mdl b/content_skaterift/maps/dev_heaven/main.mdl index 90318de..320860b 100644 Binary files a/content_skaterift/maps/dev_heaven/main.mdl and b/content_skaterift/maps/dev_heaven/main.mdl differ diff --git a/content_skaterift/maps/dev_hub/main.mdl b/content_skaterift/maps/dev_hub/main.mdl index ac093da..ad7c362 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 adb1b87..5ffb99f 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_mtzero/before.mdl b/content_skaterift/maps/mp_mtzero/before.mdl index ed66d46..e000c27 100644 Binary files a/content_skaterift/maps/mp_mtzero/before.mdl and b/content_skaterift/maps/mp_mtzero/before.mdl differ diff --git a/content_skaterift/maps/mp_mtzero/main.mdl b/content_skaterift/maps/mp_mtzero/main.mdl index 2d4686c..0363762 100644 Binary files a/content_skaterift/maps/mp_mtzero/main.mdl and b/content_skaterift/maps/mp_mtzero/main.mdl differ diff --git a/content_skaterift/metascenes/ch2s3a.ms b/content_skaterift/metascenes/ch2s3a.ms index 89867e0..a1b3646 100644 Binary files a/content_skaterift/metascenes/ch2s3a.ms and b/content_skaterift/metascenes/ch2s3a.ms differ diff --git a/content_skaterift/metascenes/ch2s4.ms b/content_skaterift/metascenes/ch2s4.ms index 34aef21..472a39b 100644 Binary files a/content_skaterift/metascenes/ch2s4.ms and b/content_skaterift/metascenes/ch2s4.ms differ diff --git a/content_skaterift/metascenes/ch2s4FUCK.ms b/content_skaterift/metascenes/ch2s4FUCK.ms new file mode 100644 index 0000000..385ad49 Binary files /dev/null and b/content_skaterift/metascenes/ch2s4FUCK.ms differ diff --git a/content_skaterift/metascenes/ch2s4a.ms b/content_skaterift/metascenes/ch2s4a.ms index e428f7c..6b75a7e 100644 Binary files a/content_skaterift/metascenes/ch2s4a.ms and b/content_skaterift/metascenes/ch2s4a.ms differ diff --git a/content_skaterift/metascenes/ch4s1a.ms b/content_skaterift/metascenes/ch4s1a.ms index 6535ee8..a330c27 100644 Binary files a/content_skaterift/metascenes/ch4s1a.ms and b/content_skaterift/metascenes/ch4s1a.ms differ diff --git a/content_skaterift/models/lazes.mdl b/content_skaterift/models/lazes.mdl new file mode 100644 index 0000000..f465ff0 Binary files /dev/null and b/content_skaterift/models/lazes.mdl differ diff --git a/skaterift_blender/sr_main.py b/skaterift_blender/sr_main.py index ba854e5..8af6c51 100644 --- a/skaterift_blender/sr_main.py +++ b/skaterift_blender/sr_main.py @@ -330,7 +330,9 @@ class ent_npc(Structure): #{ _fields_ = [("transform",mdl_transform), ("pstr_id",c_uint32), - ("pstr_context_id",c_uint32)] + ("pstr_context_id",c_uint32), + ("pstr_anim",c_uint32), + ("none0",c_uint32)] sr_functions = { 'proximity': 0x00, 'interact': 0x00 } #} @@ -1774,6 +1776,7 @@ class SR_OBJECT_ENT_GLIDER(bpy.types.PropertyGroup):#{ class SR_OBJECT_ENT_NPC(bpy.types.PropertyGroup):#{ id: bpy.props.StringProperty() context_id: bpy.props.StringProperty() + anim: bpy.props.StringProperty() # old, unused. # au: bpy.props.IntProperty() @@ -3169,13 +3172,18 @@ def cv_draw_route( route, dij ): gi = checkpoints[i].target gj = checkpoints[(i+1)%len(checkpoints)].target + cc1 = cc + if bpy.context.active_object == route: + if route.SR_data.ent_route[0].gates_index == i: + cc1 = (1,1,1) + if gi: #{ if gi.SR_data.ent_gate[0].tipo != 'passive': #{ dest = gi.SR_data.ent_gate[0].target if dest: - cv_draw_line_dotted( gi.location, dest.location, cc ) + cv_draw_line_dotted( gi.location, dest.location, cc1 ) gi = dest #} #} @@ -3187,19 +3195,18 @@ def cv_draw_route( route, dij ): if path: #{ - cv_draw_arrow(gi.location,dij.points[path[0]],cc,1.5,False) - cv_draw_arrow(dij.points[path[len(path)-1]],gj.location,cc,1.5,False) + cv_draw_arrow(gi.location,dij.points[path[0]],cc1,1.5,False) + cv_draw_arrow(dij.points[path[len(path)-1]],gj.location,cc1,1.5,False) for j in range(len(path)-1):#{ i0 = path[j] i1 = path[j+1] o0 = dij.points[ i0 ] o1 = dij.points[ i1 ] - cv_draw_arrow(o0,o1,cc,1.5,False) + cv_draw_arrow(o0,o1,cc1,1.5,False) #} #} - else:#{ - cv_draw_line_dotted( gi.location, gj.location, cc ) - #} + else: + cv_draw_line_dotted( gi.location, gj.location, cc1 ) #} #} diff --git a/skaterift_blender/sr_mdl.py b/skaterift_blender/sr_mdl.py index dfa7671..9b35d22 100644 --- a/skaterift_blender/sr_mdl.py +++ b/skaterift_blender/sr_mdl.py @@ -937,7 +937,8 @@ def _mdl_compiler_compile_entities(): npc = ent_npc() compile_obj_transform( obj, npc.transform ) npc.pstr_id = _af_pack_string( obj_data.id ) - npc.pstr_context_id = _af_pack_string( obj_data.context_id ) + npc.pstr_context_id = _af_pack_string( obj_data.context_id ) + npc.pstr_anim = _af_pack_string( obj_data.anim ) sr_ent_push( npc ) #} elif ent_type == 'ent_script':#{ diff --git a/skaterift_blender/sr_metascene.py b/skaterift_blender/sr_metascene.py index b28fc62..ad03430 100644 --- a/skaterift_blender/sr_metascene.py +++ b/skaterift_blender/sr_metascene.py @@ -105,7 +105,7 @@ class ms_strip_data_union(Union): class ms_strip(Structure): #{ _fields_ = [("mode",c_uint8), - ("offset",c_uint32), + ("offset",c_int32), ("anon",ms_strip_data_union)] #} @@ -257,8 +257,10 @@ def _metascene_comp_armature_range( obj, start, end, out_strip ): kf.q[2] = -rq[2] kf.q[3] = rq[0] kf.s[0] = sca[0] - kf.s[1] = sca[2] - kf.s[2] = sca[1] + kf.s[1] = sca[1] + kf.s[2] = sca[2] + + print( kf.s[0], kf.s[1], kf.s[2] ) _ms_compiler.keyframes.append(kf) #} @@ -462,7 +464,7 @@ def _metascene_camera_anims( obj, entity_id ): _metascene_compile_action_curves( out_strip, NLAStrip.action ) out_strip.anon.strip.instance_id = 0xffffffff out_strip.anon.strip.object_id = entity_id - out_strip.anon.strip.offset = math.floor( NLAStrip.frame_start ) + out_strip.offset = math.floor( NLAStrip.frame_start ) out_strip.anon.strip.timing_offset = NLAStrip.action_frame_start out_strip.anon.strip.length = math.ceil( NLAStrip.frame_end - out_strip.offset ) out_strip.anon.strip.pstr_name = _af_pack_string( NLAStrip.name ) @@ -483,7 +485,7 @@ def _metascene_camera_anims( obj, entity_id ): _metascene_compile_action_curves( out_strip, NLAStrip.action ) out_strip.anon.strip.instance_id = 0xffffffff out_strip.anon.strip.object_id = entity_id - out_strip.anon.strip.offset = math.floor( NLAStrip.frame_start ) + out_strip.offset = math.floor( NLAStrip.frame_start ) out_strip.anon.strip.timing_offset = NLAStrip.action_frame_start out_strip.anon.strip.length = math.ceil( NLAStrip.frame_end - out_strip.offset ) out_strip.anon.strip.pstr_name = _af_pack_string( NLAStrip.name ) diff --git a/src/compass.c b/src/compass.c index 7a651ee..7dd9fd3 100644 --- a/src/compass.c +++ b/src/compass.c @@ -163,12 +163,6 @@ void compass_render_texture(void) { ent_route *route = af_arritm( &world->ent_route, i ); - if( !(route->flags & (k_ent_route_flag_achieve_gold|k_ent_route_flag_achieve_silver)) ) - { - if( compass_co( projection, route->board_transform[3], 0.0f ) ) - mdl_draw_submesh( &mdl->submeshes[ _compass.sm_comp_objective ] ); - } - if( route->active_checkpoint != 0xffff ) { v4f colour; @@ -189,6 +183,19 @@ void compass_render_texture(void) } } } + else + { + shader_compass_uColour( (v4f){ 1,1,1,1 } ); + for( u32 i=0; ient_route); i++ ) + { + ent_route *route = af_arritm( &world->ent_route, i ); + if( !(route->flags & (k_ent_route_flag_achieve_gold|k_ent_route_flag_achieve_silver)) ) + { + if( compass_co( projection, route->board_transform[3], 0.0f ) ) + mdl_draw_submesh( &mdl->submeshes[ _compass.sm_comp_objective ] ); + } + } + } } void compass_render_imgui( ui_context *ctx ) diff --git a/src/ent_challenge.c b/src/ent_challenge.c index cc4599f..d925f65 100644 --- a/src/ent_challenge.c +++ b/src/ent_challenge.c @@ -25,9 +25,15 @@ void _ent_challenge_win(void) world_instance *world = &_world.main; ent_challenge *challenge = af_arritm( &world->ent_challenge, mdl_entity_id_id( _world.active_challenge_id ) ); + + if( !challenge->status ) + { + gui_notify( "\xb3 Challenge complete!", 5.0f, k_ui_fg ); + } + _ent_challenge_clear( challenge ); challenge->status = 1; - ent_region_re_eval( world ); + ent_region_re_eval( world, 0 ); struct ent_script_event event; struct script_event_completion_changed inf = { @@ -333,7 +339,7 @@ static int _skaterift_challenge_ccmd( int argc, const char *argv[] ) if( argc==2 ) { challenge->status = atoi( argv[1] ); - ent_region_re_eval( world ); + ent_region_re_eval( world, 0 ); struct ent_script_event event; struct script_event_completion_changed inf = { @@ -365,7 +371,7 @@ static int _skaterift_challenge_ccmd( int argc, const char *argv[] ) route->flags |= (u32)(k_ent_route_flag_achieve_silver); if( !strcmp( argv[1], "gold" ) ) route->flags |= (u32)(k_ent_route_flag_achieve_gold|k_ent_route_flag_achieve_silver); - ent_region_re_eval( world ); + ent_region_re_eval( world, 0 ); struct ent_script_event event; struct script_event_completion_changed inf = { diff --git a/src/ent_npc.c b/src/ent_npc.c index 1b71ab2..12c16b5 100644 --- a/src/ent_npc.c +++ b/src/ent_npc.c @@ -30,10 +30,18 @@ struct struct player_effects_data effect_data; player_pose pose; m4x3f *final_mtx; + + enum + { + k_npc_idle, + k_npc_stand, + k_npc_sit + } + anim; } humans[4]; - struct skeleton_anim anim_idle; + struct skeleton_anim anim_idle, anim_stand, anim_sit; enum npc_sub_state { @@ -226,6 +234,8 @@ void _ent_npc_init(void) human->final_mtx = vg_linear_alloc( alloc, mtx_size ); } player_get_anim( &_npc.anim_idle, "idle_lean+y" ); + player_get_anim( &_npc.anim_stand, "idle_cycle+y" ); + player_get_anim( &_npc.anim_sit, "sit" ); } void _ent_npc_reset(void) @@ -383,7 +393,14 @@ void _ent_npc_preupdate(void) pose->board.lean = 0.0f; v3_copy( human->co, pose->root_co ); v4_copy( human->q, pose->root_q ); - skeleton_sample_anim( sk, &_npc.anim_idle, vg.time*0.1f+0.4f, apose ); + + if( human->anim == k_npc_sit ) + skeleton_sample_anim( sk, &_npc.anim_sit, 1.6f, apose ); + else if( human->anim == k_npc_stand ) + skeleton_sample_anim( sk, &_npc.anim_stand, vg.time*0.5f+0.4f, apose ); + else + skeleton_sample_anim( sk, &_npc.anim_idle, vg.time*0.1f+0.4f, apose ); + skeleton_copy_pose( sk, apose, pose->keyframes ); // no for JC. if( i != (k_npc_jc-1) ) @@ -539,6 +556,12 @@ entity_event_result ent_npc_event( ent_event *event ) } else if( AF_STR_EQ( &world->meta.af, event->pstr_recieve_event, "proximity" ) ) { + human->anim = 0; + if( AF_STR_EQ( &world->meta.af, npc->pstr_anim, "sit" ) ) + human->anim = k_npc_sit; + else if( AF_STR_EQ( &world->meta.af, npc->pstr_anim, "stand" ) ) + human->anim = k_npc_stand; + if( human->alive == 0 ) { const char *addons[] = diff --git a/src/ent_region.c b/src/ent_region.c index 04c1bb2..aa3b273 100644 --- a/src/ent_region.c +++ b/src/ent_region.c @@ -65,7 +65,7 @@ entity_event_result ent_region_event( ent_event *event ) /* * reevaluate all achievements to calculate the compiled achievement */ -void ent_region_re_eval( world_instance *world ) +void ent_region_re_eval( world_instance *world, bool init ) { u32 world_total = k_ent_route_flag_achieve_gold | k_ent_route_flag_achieve_silver; @@ -105,13 +105,22 @@ void ent_region_re_eval( world_instance *world ) } } + u32 original_flags = region->flags; region->flags = combined; world_total &= combined; - if( region->flags & k_ent_route_flag_achieve_silver ) _world_raise_event( mdl_entity_id( k_ent_region, j ), "silver" ); if( region->flags & k_ent_route_flag_achieve_gold ) _world_raise_event( mdl_entity_id( k_ent_region, j ), "gold" ); + + if( !init ) + { + if( !(original_flags & (k_ent_route_flag_achieve_silver|k_ent_route_flag_achieve_gold)) && + region->flags & (k_ent_route_flag_achieve_silver|k_ent_route_flag_achieve_gold) ) + { + gui_notify( "\xb3 Region completed!", 6.0f, k_ui_fg ); + } + } } } diff --git a/src/ent_region.h b/src/ent_region.h index c55edd2..4565d64 100644 --- a/src/ent_region.h +++ b/src/ent_region.h @@ -16,5 +16,5 @@ struct ent_region_unlock_data }; u32 region_spark_colour( u32 flags ); -void ent_region_re_eval( world_instance *world ); +void ent_region_re_eval( world_instance *world, bool init ); entity_event_result ent_region_event( ent_event *event ); diff --git a/src/ent_script.c b/src/ent_script.c index c21f24b..228c3e6 100644 --- a/src/ent_script.c +++ b/src/ent_script.c @@ -6,6 +6,7 @@ struct } _ent_script; +#include "scripts/generic.c" #include "scripts/explode.c" #include "scripts/tutorial_island.c" #include "scripts/board_maker.c" @@ -15,6 +16,7 @@ struct ent_script_table_entry _ent_script_table[] = { "explode", _skaterift_script_explode }, { "volc_main", _skaterift_script_volc }, { "board_maker", _skaterift_script_board_maker }, + { "generic", _skaterift_script_generic }, { NULL } }; diff --git a/src/entity.h b/src/entity.h index c1c7c3c..bd627d0 100644 --- a/src/entity.h +++ b/src/entity.h @@ -772,7 +772,7 @@ struct ent_glider struct ent_npc { mdl_transform transform; - u32 pstr_id, pstr_context_id; + u32 pstr_id, pstr_context_id, pstr_anim, none1; }; typedef enum entity_event_result entity_event_result; diff --git a/src/gui.h b/src/gui.h index ad50fb3..e36204d 100644 --- a/src/gui.h +++ b/src/gui.h @@ -57,6 +57,14 @@ struct } helper_mode; + struct gui_notifier + { + const char *string; + f32 duration, time_left; /* seconds */ + u32 colour; + } + notifiers[ 4 ]; + struct icon_call { enum gui_icon icon; @@ -85,6 +93,34 @@ struct } static gui = {.cur_icon_colour = {1.0f,1.0f,1.0f,1.0f},.colour_changed=1}; +void gui_notify( const char *string, f32 duration, u32 colour ) +{ + // JINGLE SOME KEYS HERE + // JINGLE SOME KEYS HERE + // JINGLE SOME KEYS HERE + // JINGLE SOME KEYS HERE + // JINGLE SOME KEYS HERE + struct gui_notifier *notifier = NULL; + for( u32 i=0; itime_left > 0.0f ) + { + notifier = NULL; + continue; + } + else break; + } + + if( !notifier ) + return; + + notifier->string = string; + notifier->duration = duration; + notifier->time_left = duration; + notifier->colour = colour; +} + static void gui_helper_reset( enum gui_helper_mode mode ) { gui.helper_count = 0; @@ -161,10 +197,37 @@ static void gui_draw( ui_context *ctx ) /* helpers * ----------------------------------------------------------------- */ + gui.factive = vg_lerpf( gui.factive, gui.helper_count?1.0f:0.0f, vg.time_frame_delta*2.0f ); + + { + ui_px y = 80; + ui_px w = 360, h = 60; + ctx->font = &vgf_default_large; + for( u32 i=0; itime_left -= vg.time_frame_delta; + if( notifier->time_left > 0.0f ) + { + const float k_trans = 0.2; + float t0 = notifier->time_left, + t1 = notifier->duration - t0, + t = vg_smoothstepf( vg_minf( vg_minf( k_trans, t0 ), t1 ) / k_trans ), + x = (f32)(w+8) * t; + ui_rect box = { vg.window_x - (ui_px)x, y, w, h }; + ui_fill( ctx, box, ui_opacity( GUI_COL_DARK, t*0.6f ) ); + ui_outline( ctx, box, 1, ui_opacity( GUI_COL_NORM, t*0.6f ), 0 ); + ui_text( ctx, box, notifier->string, 1, k_ui_align_middle_center, ui_colour( ctx, notifier->colour ) ); + } + y += h + 8; + } + } + if( _cutscene.state >= k_cutscene_state_ready ) + { + ctx->font = &vgf_default_small; return; - - gui.factive = vg_lerpf( gui.factive, gui.helper_count?1.0f:0.0f, vg.time_frame_delta*2.0f ); + } ctx->font = &vgf_default_title; ui_px height = ctx->font->ch + 16; diff --git a/src/metascene.c b/src/metascene.c index 991dfa9..8e8856e 100644 --- a/src/metascene.c +++ b/src/metascene.c @@ -486,7 +486,6 @@ void cutscene_update( f32 delta ) if( _cutscene.freeze_player ) localplayer.immobile = 1; - _cutscene.state = k_cutscene_state_playing; vg_audio_lock(); for( u32 j=0; j (si->strip->offset + si->strip->strip.length) ) + if( frame > (si->strip->offset + (i32)si->strip->strip.length) ) move = 1; else { @@ -547,7 +548,7 @@ void cutscene_update( f32 delta ) if( strip->mode & k_ms_strip_mode_animation ) { - if( frame > strip->offset + strip->strip.length ) + if( frame > strip->offset + (i32)strip->strip.length ) { vg_warn( "Skipping?\n" ); _cutscene.strip ++; @@ -886,6 +887,12 @@ static void cb_cutscene_view( ui_context *ctx, ui_rect rect, struct vg_magi_pane return; } + if( _cutscene.state == k_cutscene_state_unloading ) + { + ui_text( ctx, rect, "Cutscene UN-loading..", 1, k_ui_align_middle_center, 0 ); + return; + } + ms_strip *usage[8]; for( u32 i=0; ioffset + usage[k]->strip.length < strip->offset ) + if( usage[k]->offset + (i32)usage[k]->strip.length < strip->offset ) usage[k] = NULL; if( !usage[k] ) @@ -952,7 +959,7 @@ static void cb_cutscene_view( ui_context *ctx, ui_rect rect, struct vg_magi_pane } } - ui_rect box = { strip->offset, layer*32, strip->strip.length, 30 }; + ui_rect box = { strip->offset, layer*32, (i32)strip->strip.length, 30 }; box[0] += root[0]; box[1] += root[1]; @@ -972,6 +979,13 @@ static void cb_cutscene_view( ui_context *ctx, ui_rect rect, struct vg_magi_pane } } +static int cmd_cutscene_play( int argc, const char *argv[] ) +{ + if( argc == 1 ) + _cutscene_load_and_play( argv[0], 0, 0 ); + return 1; +} + static int cmd_cutscene_inspector( int argc, const char *argv[] ) { ui_px w = 800, h = 400; @@ -985,6 +999,6 @@ static int cmd_cutscene_inspector( int argc, const char *argv[] ) void cutscene_init(void) { - //vg_console_reg_cmd( "cutscene", cmd_cutscene_load, NULL ); + vg_console_reg_cmd( "cutscene_play", cmd_cutscene_play, NULL ); vg_console_reg_cmd( "cutscene_inspector", cmd_cutscene_inspector, NULL ); } diff --git a/src/metascene.h b/src/metascene.h index fd2ef6d..1f6a797 100644 --- a/src/metascene.h +++ b/src/metascene.h @@ -67,7 +67,7 @@ enum ms_strip_mode struct ms_strip { u8 mode; - u32 offset; + i32 offset; union { diff --git a/src/player_skate.c b/src/player_skate.c index 53e6cf8..e4934c2 100644 --- a/src/player_skate.c +++ b/src/player_skate.c @@ -697,13 +697,14 @@ invalidated_grind:; joystick_state( k_srjoystick_steer, steer ); v2_normalize_clamp( steer ); - if( (fabsf(steer[1]) > 0.5f) && (state->land_dist >= 1.5f) ){ - state->flip_rate = (1.0f/state->land_dist) * vg_signf(steer[1]) * - state->reverse ; + if( (fabsf(steer[1]) > 0.5f) && (state->land_dist >= 1.5f) ) + { + state->flip_rate = (1.0f/state->land_dist) * vg_signf(steer[1]) * state->reverse; state->flip_time = 0.0f; v3_copy( localplayer.rb.to_world[0], state->flip_axis ); } - else{ + else + { state->flip_rate = 0.0f; v3_zero( state->flip_axis ); } @@ -721,9 +722,9 @@ invalidated_grind:; /* * Air control, no real physics */ -static void skate_apply_air_model(void){ +static void skate_apply_air_model(void) +{ struct player_skate_state *state = &player_skate.state; - if( state->activity_prev > k_skate_activity_air_to_grind ) player__approximate_best_trajectory(); @@ -3129,8 +3130,8 @@ void player__skate_animate(void){ /* flip angle */ - if( (state->activity <= k_skate_activity_air_to_grind) && - (fabsf(state->flip_rate) > 0.01f) ){ + if( (state->activity <= k_skate_activity_air_to_grind) && (fabsf(state->flip_rate) > 0.01f) ) + { float substep = vg.time_fixed_extrapolate; float t = state->flip_time+state->flip_rate*substep*vg.time_fixed_delta; sign = vg_signf( t ); diff --git a/src/scripts/generic.c b/src/scripts/generic.c index db0e0c5..2480cf9 100644 --- a/src/scripts/generic.c +++ b/src/scripts/generic.c @@ -1,68 +1,21 @@ - -struct board_maker_unlock_waiter +static bool _skaterift_script_generic( ent_script_event *event ) { - bool changed; - bool unlocked; -}; - -static bool _skaterift_script_board_maker_unlock( ent_script_event *event ) -{ -#if 0 - if( event->type == k_escript_event_allocate ) - { - struct script_event_allocate *event_info = event->info; - struct board_maker_unlock_waiter *waiter = vg_linear_alloc( event_info->heap, sizeof(struct board_maker_unlock_waiter) ); - waiter->changed = 0; - waiter->unlocked = 0; - event_info->userdata = waiter; - } - - u64 status; - if( on_atom_changed( event, "board_maker_unlock", &status ) ) + if( event->type == k_escript_event_world_event ) { - struct board_maker_unlock_waiter *waiter = event->userdata; - waiter->changed = 1; - waiter->unlocked = status; - } - - if( event->type == k_escript_event_update || event->type == k_escript_event_world_start ) - { - if( _cutscene.state == k_cutscene_state_none ) + struct script_event_world_io *inf = event->info; + world_instance *world = &_world.main; + if( AF_STR_EQ( &world->meta.af, inf->event->pstr_recieve_event, "unlock_mtzero" ) ) { - struct board_maker_unlock_waiter *waiter = event->userdata; - if( waiter->changed ) - { - _ent_list_set_visible( event->entity_list, waiter->unlocked ); - waiter->changed = 0; - } + gui_notify( "\xb8 Mt.Zero Unlocked!", 8.0f, k_ui_green ); } - } -#endif - return 1; -} - -#if 0 -static bool _skaterift_script_board_maker( ent_script_event *event ) -{ - if( on_function_trigger( event, 0 ) ) - { - if( world_set_event( k_world_event_board_maker ) ) + if( AF_STR_EQ( &world->meta.af, inf->event->pstr_recieve_event, "unlock_city" ) ) + { + gui_notify( "\xb8 Downtown Unlocked!", 8.0f, k_ui_green ); + } + if( AF_STR_EQ( &world->meta.af, inf->event->pstr_recieve_event, "unlock_valley" ) ) { - struct ent_list_iter iter; - _ent_list_iter_start( &iter, event->entity_list, k_ent_marker ); - while( _ent_list_iter( &iter ) ) - { - ent_marker *marker = af_arritm( &event->world->ent_marker, iter.index ); - const char *alias = af_str( &event->world->meta.af, marker->pstr_alias ); - - if( !strcmp( alias, "$board_position" ) ) - v3_copy( marker->transform.co, _board_maker.origin ); - else if( !strcmp( alias, "$camera_position" ) ) - v3_copy( marker->transform.co, _board_maker.camera_pos ); - } - _board_maker_open(); + gui_notify( "\xb8 Valley Unlocked!", 8.0f, k_ui_green ); } } return 1; } -#endif diff --git a/src/world_entity.c b/src/world_entity.c index ae485aa..1b34a81 100644 --- a/src/world_entity.c +++ b/src/world_entity.c @@ -663,6 +663,8 @@ void world_entity_start( world_instance *world, vg_msg *sav ) } } + _atom_list_clear( k_atom_list_world ); + vg_msg_cursor orig = sav->cur; if( vg_msg_seekframe( sav, "atoms" ) ) { @@ -676,7 +678,7 @@ void world_entity_start( world_instance *world, vg_msg *sav ) } } - ent_region_re_eval( world ); + ent_region_re_eval( world, 1 ); /* true/false initializers * ----------------------------------------------------------------------------------- */ diff --git a/src/world_load.c b/src/world_load.c index a8aa6e1..4ff46c8 100644 --- a/src/world_load.c +++ b/src/world_load.c @@ -439,7 +439,6 @@ void world_switcher_update(void) vg_str folder_str; vg_strnull( &folder_str, info->path, sizeof(info->path) ); info->OK = addon_get_content_folder( _world.load_addon, &folder_str ); - _atom_list_clear( k_atom_list_world ); vg_async_task_dispatch( task, skaterift_world_load_t1 ); } diff --git a/src/world_routes.c b/src/world_routes.c index cc784f2..d7b9f52 100644 --- a/src/world_routes.c +++ b/src/world_routes.c @@ -118,9 +118,20 @@ static void world_routes_time_lap( u32 route_index ) if( (route->best_laptime == 0.0) || (lap_time < route->best_laptime) ) route->best_laptime = lap_time; + u32 original_flags = route->flags; + route->flags |= k_ent_route_flag_achieve_silver; if( clean ) route->flags |= k_ent_route_flag_achieve_gold; - ent_region_re_eval( world ); + ent_region_re_eval( world, 0 ); + + if( (route->flags & k_ent_route_flag_achieve_gold) && !(original_flags & k_ent_route_flag_achieve_gold) ) + { + gui_notify( "\xb3 Route completed in gold!", 5.0f, k_ui_yellow ); + } + else if( (route->flags & k_ent_route_flag_achieve_silver) && !(original_flags & k_ent_route_flag_achieve_silver) ) + { + gui_notify( "\xb3 Route completed in silver!", 5.0f, k_ui_fg ); + } struct ent_script_event event; struct script_event_completion_changed inf = {