From 54c3b4cc536480d0be5e57b8e7b75f7e30086d69 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 1 Mar 2022 16:07:04 +0900 Subject: [PATCH] [client] Get the chase camera working with input It turns out cam_controls is for pointing the player model in the direction of movement rather than controlling the camera (I should add proper camera controls). --- libs/client/cl_chase.c | 6 +++++- libs/client/cl_input.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/client/cl_chase.c b/libs/client/cl_chase.c index 67d3f5749..9f1a08b6e 100644 --- a/libs/client/cl_chase.c +++ b/libs/client/cl_chase.c @@ -121,6 +121,9 @@ set_camera (chasestate_t *cs, viewstate_t *vs) static void cam_controls (chasestate_t *cs, viewstate_t *vs) { + // FIXME this doesn't actually control the camera, but rather makes the + // player face the direction of motion. It probably should not access + // movement input buttons and axes directly. // get basic movement from keyboard vec4f_t move = { }; vec4f_t forward = { }; @@ -162,7 +165,8 @@ cam_controls (chasestate_t *cs, viewstate_t *vs) vs->player_angles[YAW] = (atan2 (dir[1], dir[0]) * 180 / M_PI); } - vs->player_angles[PITCH] = 0; + //vs->player_angles[PITCH] = 0; + VectorCopy (vs->player_angles, cs->player_angles); } static void diff --git a/libs/client/cl_input.c b/libs/client/cl_input.c index 00eebfc75..3ca4b306a 100644 --- a/libs/client/cl_input.c +++ b/libs/client/cl_input.c @@ -409,7 +409,7 @@ CL_Input_BuildMove (float frametime, movestate_t *state, viewstate_t *vs) VectorScale (forward, move[FORWARD], f); VectorScale (right, move[SIDE], r); move[FORWARD] = f[0] + r[0]; - move[SIDE] = f[1] + r[1]; + move[SIDE] = -f[1] - r[1]; } state->move = move; }