walk exchange
authorhgn <hgodden00@gmail.com>
Wed, 4 Oct 2023 04:32:30 +0000 (05:32 +0100)
committerhgn <hgodden00@gmail.com>
Wed, 4 Oct 2023 04:32:30 +0000 (05:32 +0100)
player_remote.c
player_skate.c
player_walk.c
player_walk.h
skaterift.c

index cfad5e9018d236280207831ffc020eeeaa03095f..bf3b5d3d83e1d6e8bfd4a2df47b27633a5437350 100644 (file)
@@ -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,
          };
          
index 7acc9f5ff0292652a4caa0ce6e7afbbc5b5b89db..6ddb4ae836141b30fb5eb825023e42ab7cacc9f6 100644 (file)
@@ -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 */
index ec025a17630e4e52bf2cb77d7982802ed4abdfd1..0692bdc404a78d127fa1b6be315792ddc1ed2f39 100644 (file)
@@ -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 */
index 14acb703c74d0d4685f64ae00c636cca146cea9e..a03e9a721d190fe6903849c8f764a9890457b6dc 100644 (file)
@@ -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),
index b5029c4ca30745d85ce619c4e0e045e118d1ed2a..b07eadb318ec7488816f3573830ade349bae2636 100644 (file)
 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" );