quantized positions
[carveJwlIkooP6JGAAIwe30JlM.git] / player_skate.c
index dbf927b0416ec8df4ab253810a0f244c5fef4102..4bad1deb30cbda0b2db1d8577a744d468467afc4 100644 (file)
@@ -2524,10 +2524,11 @@ begin_collision:;
    skate_integrate();
    vg_line_point( state->cog, 0.02f, VG__WHITE );
 
-   ent_gate *gate = 
-      world_intersect_gates(world, localplayer.rb.co, state->prev_pos );
+   u32 id = world_intersect_gates( world, localplayer.rb.co, state->prev_pos );
+
+   if( id ){
+      ent_gate *gate = mdl_arritm( &world->ent_gate, mdl_entity_id_id(id) );
 
-   if( gate ){
       m4x3_mulv( gate->transport, localplayer.rb.co, localplayer.rb.co );
       m3x3_mulv( gate->transport, localplayer.rb.v,  localplayer.rb.v );
       m4x3_mulv( gate->transport, state->cog,   state->cog );
@@ -2543,7 +2544,7 @@ begin_collision:;
       q_mul( transport_rotation, state->smoothed_rotation,
                                  state->smoothed_rotation );
       rb_update_transform( &localplayer.rb );
-      player__pass_gate( gate );
+      player__pass_gate( id );
    }
 
    /* FIXME: Rate limit */
@@ -3184,4 +3185,55 @@ static void player__skate_reset( ent_spawn *rp ){
    state->head_position[1] = 1.8f;
 }
 
+#include "network_compression.h"
+
+static void player__skate_animator_exchange( bitpack_ctx *ctx, void *data ){
+   struct player_skate_animator *animator = data;
+   
+   bitpack_qv3f( ctx, 16, -1024.0f, 1024.0f, 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 );
+   bitpack_qf32( ctx, 8, -1.0f, 1.0f, &animator->z );
+   bitpack_qf32( ctx, 8, -1.0f, 1.0f, &animator->x );
+
+   /* these could likely be pressed down into single bits if needed */
+   bitpack_qf32( ctx, 8,  0.0f, 1.0f, &animator->fly );
+   bitpack_qf32( ctx, 8,  0.0f, 1.0f, &animator->grind );
+   bitpack_qf32( ctx, 8,  0.0f, 1.0f, &animator->stand );
+   bitpack_qf32( ctx, 8,  0.0f, 1.0f, &animator->push );
+   bitpack_qf32( ctx, 8,  0.0f, 1.0f, &animator->jump );        /*??*/
+   bitpack_qf32( ctx, 8,  0.0f, 1.0f, &animator->jump_charge ); /*??*/
+
+   /* just the sign bit? */
+   bitpack_qf32( ctx, 8, -1.0f, 1.0f, &animator->reverse );
+   bitpack_qf32( ctx, 8, -1.0f, 1.0f, &animator->delayed_slip_dir );
+   bitpack_bytes( ctx, 1, &animator->jump_dir );
+   bitpack_bytes( ctx, 1, &animator->trick_type );
+
+   bitpack_qf32( ctx, 8,  0.0f, 1.0f, &animator->grind_balance );
+   bitpack_qf32( ctx, 8, -1.0f, 1.0f, &animator->airdir );
+   bitpack_qf32( ctx, 8, -1.0f, 1.0f, &animator->weight );
+   bitpack_qf32( ctx, 8,  0.0f, 1.0f, &animator->trick_foot );
+   bitpack_qf32( ctx, 8,  0.0f, 1.0f, &animator->slap );
+   bitpack_qf32( ctx, 8,  0.0f, 1.0f, &animator->subslap );
+   bitpack_qf32( ctx, 8,  0.0f, 1.0f, &animator->grabbing );
+
+   /* animator->wobble is ommited */
+
+   bitpack_qv2f( ctx, 8, -1.0f, 1.0f, animator->foot_offset );
+   bitpack_qquat( ctx, animator->qfixuptotal );
+   bitpack_qquat( ctx, animator->qflip );
+
+   bitpack_qv3f( ctx, 16, -100.0f, 100.0f, animator->board_euler );
+   bitpack_qf32( ctx, 8, -1.0f, 1.0f, &animator->board_lean );
+   bitpack_qv2f( ctx, 8, -1.0f, 1.0f, animator->steer );
+   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 */