projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
scraped a small amount of crap
[carveJwlIkooP6JGAAIwe30JlM.git]
/
player_common.c
diff --git
a/player_common.c
b/player_common.c
index 259a7987fc6bd5adda266765ce0834fe58f8c6a0..4cb1a0bd77c5650187b7c884a365404fa1b5f15b 100644
(file)
--- a/
player_common.c
+++ b/
player_common.c
@@
-2,6
+2,7
@@
#define PLAYER_COMMON_C
#include "player.h"
#define PLAYER_COMMON_C
#include "player.h"
+#include "conf.h"
VG_STATIC void player_vector_angles( v3f angles, v3f v, float C, float k )
{
VG_STATIC void player_vector_angles( v3f angles, v3f v, float C, float k )
{
@@
-17,6
+18,7
@@
VG_STATIC void player_vector_angles( v3f angles, v3f v, float C, float k )
angles[0] = yaw;
angles[1] = pitch;
angles[0] = yaw;
angles[1] = pitch;
+ angles[2] = 0.0f;
}
VG_STATIC float player_get_heading_yaw( player_instance *player )
}
VG_STATIC float player_get_heading_yaw( player_instance *player )
@@
-115,8
+117,10
@@
VG_STATIC void player__cam_iterate( player_instance *player )
vg.frame_delta * 8.0f, player->tpv_offset_smooth );
/* fov -- simple blend */
vg.frame_delta * 8.0f, player->tpv_offset_smooth );
/* fov -- simple blend */
- /* FIXME: cl_fov */
- player->cam.fov = vg_lerpf( 97.0f, 128.0f, player->camera_type_blend );
+ float fov_skate = vg_lerpf( 97.0f, 135.0f, cl_fov ),
+ fov_walk = vg_lerpf( 90.0f, 110.0f, cl_fov );
+
+ player->cam.fov = vg_lerpf( fov_walk, fov_skate, player->camera_type_blend );
/*
* first person camera
/*
* first person camera
@@
-226,7
+230,12
@@
VG_STATIC void player__cam_iterate( player_instance *player )
VG_STATIC void player_look( player_instance *player, v3f angles )
{
angles[2] = 0.0f;
VG_STATIC void player_look( player_instance *player, v3f angles )
{
angles[2] = 0.0f;
- v2_muladds( angles, vg.mouse_delta, 0.0025f, angles );
+
+ v2f mouse_input;
+ v2_copy( vg.mouse_delta, mouse_input );
+ if( cl_invert_y )
+ 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;
if( vg_input.controller_should_use_trackpad_look ){
static v2f last_input;
@@
-236,6
+245,9
@@
VG_STATIC void player_look( player_instance *player, v3f angles )
v2f input = { player->input_js2h->axis.value,
player->input_js2v->axis.value };
v2f input = { player->input_js2h->axis.value,
player->input_js2v->axis.value };
+ 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 );
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 );
@@
-251,7
+263,12
@@
VG_STATIC void player_look( player_instance *player, v3f angles )
}
else{
angles[0] += player->input_js2h->axis.value * vg.time_delta * 4.0f;
}
else{
angles[0] += player->input_js2h->axis.value * vg.time_delta * 4.0f;
- angles[1] += player->input_js2v->axis.value * vg.time_delta * 4.0f;
+
+ float input_y = player->input_js2v->axis.value * vg.time_delta * 4.0f;
+ if( cl_invert_y )
+ input_y *= -1.0f;
+
+ angles[1] += input_y;
}
angles[1] = vg_clampf( angles[1], -VG_PIf*0.5f, VG_PIf*0.5f );
}
angles[1] = vg_clampf( angles[1], -VG_PIf*0.5f, VG_PIf*0.5f );