From: hgn Date: Wed, 4 Oct 2023 04:32:30 +0000 (+0100) Subject: walk exchange X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;ds=sidebyside;h=c1e54530e1b29e131aad80e242faaf0c0cfee0b0;p=carveJwlIkooP6JGAAIwe30JlM.git walk exchange --- diff --git a/player_remote.c b/player_remote.c index cfad5e9..bf3b5d3 100644 --- a/player_remote.c +++ b/player_remote.c @@ -249,7 +249,7 @@ static void remote_player_send_playerframe(void){ bitpack_ctx ctx = { .mode = k_bitpack_compress, .buffer = frame->animdata, - .buffer_len = size, + .buffer_len = sys->animator_size, .bytes = 0, }; diff --git a/player_skate.c b/player_skate.c index 7acc9f5..6ddb4ae 100644 --- a/player_skate.c +++ b/player_skate.c @@ -3192,6 +3192,7 @@ static void player__skate_animator_exchange( bitpack_ctx *ctx, void *data ){ bitpack_bytes( ctx, sizeof(animator->root_co), animator->root_co ); bitpack_qquat( ctx, animator->root_q ); + bitpack_qv3f( ctx, 8, -1.0f, 1.0f, animator->offset ); bitpack_qv3f( ctx, 8, -1.0f, 1.0f, animator->local_cog ); bitpack_qf32( ctx, 8, 0.0f, 1.0f, &animator->slide ); @@ -3232,6 +3233,7 @@ static void player__skate_animator_exchange( bitpack_ctx *ctx, void *data ){ bitpack_qv2f( ctx, 8, -1.0f, 1.0f, animator->grab ); bitpack_qf32( ctx, 16, 0.0f, 120.0f, &animator->push_time ); + bitpack_qf32( ctx, 16, 0.0f, 120.0f, &animator->jump_time ); } #endif /* PLAYER_SKATE_C */ diff --git a/player_walk.c b/player_walk.c index ec025a1..0692bdc 100644 --- a/player_walk.c +++ b/player_walk.c @@ -962,4 +962,8 @@ static void player__walk_reset( ent_spawn *rp ){ w->state.outro_start_time = 0.0; } +static void player__walk_animator_exchange( bitpack_ctx *ctx, void *data ){ + struct player_walk_animator *animator = data; + bitpack_bytes( ctx, sizeof(*animator), animator ); +} #endif /* PLAYER_DEVICE_WALK_H */ diff --git a/player_walk.h b/player_walk.h index 14acb70..a03e9a7 100644 --- a/player_walk.h +++ b/player_walk.h @@ -98,6 +98,7 @@ static void player__walk_bind (void); static void player__walk_transition (void); static void player__walk_reset (ent_spawn *rp ); static void player__walk_restore (void); +static void player__walk_animator_exchange( bitpack_ctx *ctx, void *data ); struct player_subsystem_interface static player_subsystem_walk = { .system_register = player__walk_register, @@ -110,6 +111,7 @@ struct player_subsystem_interface static player_subsystem_walk = { .animate = player__walk_animate, .post_animate = player__walk_post_animate, .pose = player__walk_pose, + .network_animator_exchange = player__walk_animator_exchange, .animator_data = &player_walk.animator, .animator_size = sizeof(player_walk.animator), diff --git a/skaterift.c b/skaterift.c index b5029c4..b07eadb 100644 --- a/skaterift.c +++ b/skaterift.c @@ -59,6 +59,33 @@ static struct player_avatar localplayer_avatar; int main( int argc, char *argv[] ){ +#if 0 + u8 buf[ 512 ]; + bitpack_ctx ctx = { + .buffer = buf, + .buffer_len = 512, + .bytes = 0, + .mode = k_bitpack_compress + }; + + v4f q = { 0.388, -0.565, 0.515, 0.515 }; + vg_info( "q: %f %f %f %f\n", q[0], q[1], q[2], q[3] ); + + /* compress */ + bitpack_qquat( &ctx, q ); + + vg_info( "compressed bytes: %u\n", ctx.bytes ); + + /* decompress */ + ctx.bytes = 0; + ctx.mode = k_bitpack_decompress; + + bitpack_qquat( &ctx, q ); + vg_info( "q: %f %f %f %f\n", q[0], q[1], q[2], q[3] ); + + return 0; +#endif + vg_mem.use_libc_malloc = 0; vg_set_mem_quota( 160*1024*1024 ); vg_enter( argc, argv, "Voyager Game Engine" );