#ifndef PLAYER_COMMON_C
#define PLAYER_COMMON_C
+#include "ent_skateshop.h"
#include "player.h"
#include "conf.h"
+#include "input.h"
VG_STATIC float
k_cam_spring = 20.0f,
player->cam_override_strength );
v3_lerp( player->cam.pos, player->cam_override_pos,
player->cam_override_strength, player->cam.pos );
+ player->cam.fov = vg_lerpf( player->cam.fov, player->cam_override_fov,
+ player->cam_override_strength );
/* portal transitions */
player_camera_portal_correction( player );
VG_STATIC void player_look( player_instance *player, v3f angles )
{
+ if( vg_ui.wants_mouse ) return;
+
angles[2] = 0.0f;
v2f mouse_input;
mouse_input[1] *= -1.0f;
v2_muladds( angles, mouse_input, 0.0025f, angles );
- if( vg_input.controller_should_use_trackpad_look ){
- static v2f last_input;
- static v2f vel;
- static v2f vel_smooth;
-
- v2f input = { player->input_js2h->axis.value,
- player->input_js2v->axis.value };
+ v2f jlook;
+ joystick_state( k_srjoystick_look, jlook );
- if( cl_invert_y )
- input[1] *= -1.0f;
-
- if( (v2_length2(last_input) > 0.001f) && (v2_length2(input) > 0.001f) ){
- v2_sub( input, last_input, vel );
- v2_muls( vel, 1.0f/vg.time_delta, vel );
- }
- else{
- v2_zero( vel );
- }
+ angles[0] += jlook[0] * vg.time_delta * 4.0f;
+ float input_y = jlook[1] * vg.time_delta * 4.0f;
+ if( cl_invert_y )
+ input_y *= -1.0f;
- v2_lerp( vel_smooth, vel, vg.time_delta*8.0f, vel_smooth );
-
- v2_muladds( angles, vel_smooth, vg.time_delta, angles );
- v2_copy( input, last_input );
- }
- else{
- angles[0] += player->input_js2h->axis.value * vg.time_delta * 4.0f;
+ angles[1] += input_y;
+ angles[1] = vg_clampf( angles[1], -VG_PIf*0.5f, VG_PIf*0.5f );
+}
- float input_y = player->input_js2v->axis.value * vg.time_delta * 4.0f;
- if( cl_invert_y )
- input_y *= -1.0f;
+struct player_board *player_get_player_board( struct player_instance *player )
+{
+ struct player_board *board = NULL;
- angles[1] += input_y;
+ if( localplayer.board_view_slot ){
+ struct cache_board *cache_view = localplayer.board_view_slot;
+ if( cache_view->state == k_cache_board_state_loaded ){
+ board = &cache_view->board;
+ }
}
- angles[1] = vg_clampf( angles[1], -VG_PIf*0.5f, VG_PIf*0.5f );
+ return board;
}
#endif /* PLAYER_COMMON_C */