dont remember
[carveJwlIkooP6JGAAIwe30JlM.git] / player_common.c
index 0e0c8a949a0c283c71228e56ccc93ca8d0641dc9..e0343a07aee2fca7ef644f73af9dcfabb7768882 100644 (file)
@@ -33,8 +33,8 @@ VG_STATIC void player_camera_portal_correction( player_instance *player )
    {
       /* construct plane equation for reciever gate */
       v4f plane;
-      v3_copy( player->gate_waiting->recv_to_world[2], plane );
-      plane[3] = v3_dot( plane, player->gate_waiting->recv_to_world[3] );
+      q_mulv( player->gate_waiting->q[1], (v3f){0.0f,0.0f,1.0f}, plane );
+      plane[3] = v3_dot( plane, player->gate_waiting->co[1] );
 
       /* check camera polarity */
       if( v3_dot( player->cam.pos, plane ) < plane[3] ) 
@@ -51,36 +51,28 @@ VG_STATIC void player_camera_portal_correction( player_instance *player )
          m4x3_invert_affine( player->gate_waiting->transport, inverse );
          m4x3_mulv( inverse, player->cam.pos, player->cam.pos );
 
-#if 0
-         /* TODO: Find robust method for this */
-         v3f fwd_dir = { cosf(player->cam.angles[0]),
-                         0.0f,
-                         sinf(player->cam.angles[0])};
-         m3x3_mulv( inverse, fwd_dir, fwd_dir );
-         player->cam.angles[0] = atan2f( fwd_dir[2], fwd_dir[0] );
-#endif
-
          struct skeleton *sk = &player->playeravatar->sk;
          skeleton_apply_transform( sk, inverse );
       }
    }
 }
 
+static v3f TEMP_TPV_EXTRA;
+
 VG_STATIC void player__cam_iterate( player_instance *player )
 {
    struct player_avatar *av = player->playeravatar;
 
-   if( player->subsystem == k_player_subsystem_walk )
-   {
+   if( player->subsystem == k_player_subsystem_walk ){
       v3_copy( (v3f){-0.1f,1.8f,0.0f}, player->fpv_viewpoint );
       v3_copy( (v3f){0.0f,0.0f,0.0f}, player->fpv_offset );
       v3_copy( (v3f){0.0f,1.4f,0.0f}, player->tpv_offset );
    }
-   else
-   {
+   else{
       v3_copy( (v3f){0.0f,1.8f,0.0f}, player->fpv_viewpoint );
       v3_copy( (v3f){-0.35f,0.0f,0.0f}, player->fpv_offset );
       v3_copy( (v3f){0.0f,1.4f,0.0f}, player->tpv_offset );
+      v3_add( TEMP_TPV_EXTRA, player->tpv_offset, player->tpv_offset );
    }
 
    player->cam_velocity_constant = 0.25f;