From 66cf81a2f16141bbade9336b523234ea49a52f38 Mon Sep 17 00:00:00 2001 From: hgn Date: Thu, 19 Dec 2024 14:01:20 +0000 Subject: [PATCH] fix bad timing error, add some testing code --- build.c | 3 ++ control_overlay.h.c0 | 111 ++++++++++++++++++++++++++++++++++++++++ src/metascene.c | 117 +++++++++++++++++++++++++++---------------- src/skaterift.c | 19 +++++++ 4 files changed, 207 insertions(+), 43 deletions(-) create mode 100644 control_overlay.h.c0 diff --git a/build.c b/build.c index d350fe8..ebd4954 100644 --- a/build.c +++ b/build.c @@ -332,6 +332,9 @@ int main( int argc, char *argv[] ) if( vg_opt('r', NULL) ) vg_test_env.optimization = 3; + + if( vg_long_opt( "no-asan", NULL ) ) + vg_test_env.debug_asan = 0; } vg_success( "All scripts completed\n" ); diff --git a/control_overlay.h.c0 b/control_overlay.h.c0 new file mode 100644 index 0000000..115fbfc --- /dev/null +++ b/control_overlay.h.c0 @@ -0,0 +1,111 @@ + ov_carve_l = 0, + ov_y = 1, + ov_a = 2, + ov_b = 3, + ov_x = 4, + ov_ls = 5, + ov_key = 6, + ov_key_down = 7, + ov_shift = 8, + ov_shift_down = 9, + ov_space = 10, + ov_space_down = 11, + ov_text_jump = 12, + ov_jump_ind = 13, + ov_text_carve = 14, + ov_text_crouch = 15, + ov_stored_ind = 16, + ov_text_stored = 17, + ov_text_push = 18, + ov_text_left = 19, + ov_text_right = 20, + ov_text_manual = 21, + ov_text_front_flip = 22, + ov_text_back_flip = 23, + ov_text_w = 24, + ov_text_s = 25, + ov_text_shift = 26, + ov_text_grab = 27, + ov_key_fill = 28, + ov_shift_fill = 29, + ov_space_fill = 30, + ov_lmb = 31, + ov_rmb = 32, + ov_mouse = 33, + ov_text_shuvit = 34, + ov_text_kickflip = 35, + ov_text_treflip = 36, + ov_rmb_down = 37, + ov_lmb_down = 38, + ov_mouse_grabs = 39, + ov_text_walk = 40, + ov_text_back = 41, + ov_text_skate = 42, + ov_text_forward = 43, + ov_text_e = 44, + ov_text_glide = 45, + ov_text_walk_lwr = 46, + ov_text_camera = 47, + ov_text_run = 48, + ov_text_look = 49, + ov_text_rewind = 50, + ov_text_respawn = 51, + ov_ls_circ_walk = 52, + ov_rs_circ_look = 53, + ov_rs = 54, + ov_ls_circ_skate = 55, + ov_ls_circ_manual = 56, + ov_ls_circ_frontflip = 57, + ov_ls_circ_backflip = 58, + ov_rs_circ_grab = 59, + ov_lt = 60, + ov_lb = 61, + ov_carve_r = 62, + ov_lb_down = 63, + ov_rb = 64, + ov_rb_down = 65, + ov_lt_act = 66, + ov_rt = 67, + ov_rt_act = 68, + ov_lt_run = 69, + ov_rt_grab = 70, + ov_rt_crouch = 71, + ov_dpad = 72, + ov_text_dw_rewind = 73, + ov_text_a_shuvit = 74, + ov_text_b_kickflip = 75, + ov_text_x_treflip = 76, + ov_text_y_walk = 77, + ov_text_y_glide = 78, + ov_text_y_walk_lwr = 79, + ov_text_de_camera = 80, + ov_y_down = 81, + ov_a_down = 82, + ov_b_down = 83, + ov_x_down = 84, + ov_text_a_jump = 85, + ov_text_a_jump_mid = 86, + ov_text_b_push = 87, + ov_text_y_skate = 88, + ov_dpad_w = 89, + ov_dpad_n = 90, + ov_dpad_e = 91, + ov_dpad_s = 92, + ov_text_dn_respawn = 93, + ov_text_met_menu = 94, + ov_met_r = 95, + ov_met = 96, + ov_met_r_down = 97, + ov_met_l = 98, + ov_met_l_down = 99, + ov_text_menu = 100, + ov_key_menu = 101, + ov_key_menu_down = 102, + ov_y_ps = 103, + ov_a_ps = 104, + ov_b_ps = 105, + ov_x_ps = 106, + ov_y_down_ps = 107, + ov_a_down_ps = 108, + ov_b_down_ps = 109, + ov_x_down_ps = 110, diff --git a/src/metascene.c b/src/metascene.c index d8213ed..ea9bc38 100644 --- a/src/metascene.c +++ b/src/metascene.c @@ -37,6 +37,7 @@ struct { const char *name; u32 name_hash; + u32 reference_count; mdl_context mdl; @@ -212,10 +213,13 @@ static void cutscene_load_thread( void *data ) ref = &_cutscene.refs[ ref_id ]; ref->name = name; ref->name_hash = name_hash; + ref->reference_count = 0; vg_info( "Indexed reference '%s'\n", name ); _cutscene.unique_refs ++; } + ref->reference_count ++; + _cutscene.instances[ i ].ref_id = ref_id; _cutscene.instances[ i ].skinning_data = NULL; } @@ -458,6 +462,9 @@ ent_camera *_cutscene_active_camera(void) void cutscene_update( f32 delta ) { + if( !_cutscene.ready ) + return; + _cutscene.time += delta; u32 frame = _cutscene.time * _cutscene.meta.info.framerate; @@ -707,68 +714,92 @@ static void cb_cutscene_view( ui_context *ctx, ui_rect rect, ms_strip *usage[8]; for( u32 i=0; idata_mode == 2 ) + for( u32 i=0; i<_cutscene.unique_refs; i ++ ) { - ui_rect box = { root[0] + strip->offset, root[1], 1, rect[3]-16 }; - ui_fill( ctx, box, 0xff00ff00 ); + struct model_ref *mref = &_cutscene.refs[i]; - box[1] += box[3] -16; - box[2] = 200; - box[3] = 16; + char inf[128]; + snprintf( inf, sizeof(inf), "%s (%u references)", + mref->name, mref->reference_count ); - if( ui_clip( rect, box, box ) ) - { - ui_text( ctx, box, af_str( &_cutscene.meta.af, strip->pstr_name ), - 1, k_ui_align_middle_left, 0 ); - } - continue; + ui_text( ctx, box, inf, 1, k_ui_align_middle_left, 0 ); + box[1] += 16; } - - u32 layer = 0; - for( u32 k=0; kdata_mode == 2 ) { - if( usage[k]->offset + usage[k]->length < strip->offset ) + ui_rect box = { root[0]+strip->offset, root[1], 1, panel_r[3]-16 }; + ui_fill( ctx, box, 0xff00ff00 ); + + box[1] += box[3] -16; + box[2] = 200; + box[3] = 16; + + if( ui_clip( panel_r, box, box ) ) { - usage[k] = NULL; + ui_text( ctx, box, af_str( &_cutscene.meta.af, strip->pstr_name ), + 1, k_ui_align_middle_left, 0 ); } + continue; } - - if( !usage[k] ) + + u32 layer = 0; + for( u32 k=0; koffset + usage[k]->length < strip->offset ) + { + usage[k] = NULL; + } + } + + if( !usage[k] ) + { + usage[k] = strip; + layer = k; + break; + } } - } - ui_rect box = { strip->offset, layer*32, strip->length, 30 }; - box[0] += root[0]; - box[1] += root[1]; + ui_rect box = { strip->offset, layer*32, strip->length, 30 }; + box[0] += root[0]; + box[1] += root[1]; - if( ui_clip( rect, box, box ) ) - { - u32 colour = af_str_hash( &_cutscene.meta.af, strip->pstr_name ); + if( ui_clip( panel_r, box, box ) ) + { + u32 colour = af_str_hash( &_cutscene.meta.af, strip->pstr_name ); - ui_fill( ctx, box, colour | 0xff000000 ); - ui_text( ctx, box, af_str( &_cutscene.meta.af, strip->pstr_name ), 1, - k_ui_align_middle_center, 0 ); + ui_fill( ctx, box, colour | 0xff000000 ); + ui_text( ctx, box, af_str( &_cutscene.meta.af, strip->pstr_name ), 1, + k_ui_align_middle_center, 0 ); + } } - } - ui_rect cursor = { (f32)_cutscene.time*_cutscene.meta.info.framerate, - 0, 1, VG_ARRAY_LEN(usage)*32 }; - cursor[0] += root[0]; - cursor[1] += root[1]; - if( ui_clip( rect, cursor, cursor ) ) - ui_fill( ctx, cursor, 0xffffffff ); + ui_rect cursor = { (f32)_cutscene.time*_cutscene.meta.info.framerate, + 0, 1, VG_ARRAY_LEN(usage)*32 }; + cursor[0] += root[0]; + cursor[1] += root[1]; + if( ui_clip( panel_r, cursor, cursor ) ) + ui_fill( ctx, cursor, 0xffffffff ); + } } static int cmd_cutscene_inspector( int argc, const char *argv[] ) diff --git a/src/skaterift.c b/src/skaterift.c index 7bd4103..cb2e8e8 100644 --- a/src/skaterift.c +++ b/src/skaterift.c @@ -503,6 +503,8 @@ static void skaterift_composite_maincamera(void) vg_camera_finalize( &g_render.cam ); } +static void temp_not_done_1(void); + static void render_main_game(void) { if( skaterift.activity == k_skaterift_replay ) @@ -515,6 +517,9 @@ static void render_main_game(void) localplayer.deferred_frame_record ); localplayer.deferred_frame_record = 0; } + + temp_not_done_1(); + animate_remote_players(); player__pre_render(); @@ -688,3 +693,17 @@ void vg_gui( ui_context *ctx ) #include "metascene.c" #include "control_overlay.c" #include "ent_camera.c" + + +static void temp_not_done_1(void) +{ + if( _cutscene.ready ) + { + struct skeleton *sk = &localplayer.skeleton; + for( u32 i=0; ibone_count; i ++ ) + { + m4x3_copy( _cutscene.instances[1].skinning_data[i], + localplayer.final_mtx[i] ); + } + } +} -- 2.25.1