28 #include "../client.h"
31 #include "../input/cl_input.h"
47 #define MIN_CAMROT_SPEED 5
48 #define MIN_CAMROT_ACCEL 5
49 #define MAX_CAMROT_SPEED 1000
50 #define MAX_CAMROT_ACCEL 1000
51 #define MIN_CAMMOVE_SPEED 150
52 #define MIN_CAMMOVE_ACCEL 150
53 #define MAX_CAMMOVE_SPEED 3000
54 #define MAX_CAMMOVE_ACCEL 3000
55 #define LEVEL_MIN 0.05
56 #define LEVEL_SPEED 3.0
57 #define MIN_CAMZOOM_QUANT 0.05
58 #define MAX_CAMZOOM_QUANT 1.0
102 const float rotspeed =
104 const float movespeed =
107 const float moveaccel =
115 for (
int i = 0;
i < 2;
i++) {
173 const float sy = sin(angle);
174 const float cy = cos(angle);
175 vec3_t g_forward, g_right;
221 }
else if (frac < -0.1) {
236 const double border = 144.0 * (
cl.
cam.
zoom - cl_camzoommin->
value - 0.4) / cl_camzoommax->
value;
289 const float minDistToMove = 4.0f;
291 if (dist < minDistToMove) {
292 if (target[2] != current[2])
312 quant = 1 + cl_camzoomquant->
value;
335 quant = 1 + cl_camzoomquant->
value;
351 static void CL_CamPrintAngles_f (
void)
393 cl_camrotspeed =
Cvar_Get(
"cl_camrotspeed",
"250",
CVAR_ARCHIVE,
"Rotation speed of the battlescape camera.");
394 cl_cammovespeed =
Cvar_Get(
"cl_cammovespeed",
"450",
CVAR_ARCHIVE,
"Movement speed of the battlescape camera.");
395 cl_cammoveaccel =
Cvar_Get(
"cl_cammoveaccel",
"1250",
CVAR_ARCHIVE,
"Movement acceleration of the battlescape camera.");
396 cl_campitchmax =
Cvar_Get(
"cl_campitchmax",
"89", 0,
"Max. battlescape camera pitch - over 90 presents apparent mouse inversion.");
397 cl_camzoomspeed =
Cvar_Get(
"cl_camzoomspeed",
"2.0", 0);
398 cl_campitchmin =
Cvar_Get(
"cl_campitchmin",
"10", 0,
"Min. battlescape camera pitch - under 35 presents difficulty positioning cursor.");
399 cl_camzoomquant =
Cvar_Get(
"cl_camzoomquant",
"0.16",
CVAR_ARCHIVE,
"Battlescape camera zoom quantisation.");
400 cl_camzoommin =
Cvar_Get(
"cl_camzoommin",
"0.3", 0,
"Minimum zoom value for tactical missions.");
401 cl_camzoommax =
Cvar_Get(
"cl_camzoommax",
"3.4", 0,
"Maximum zoom value for tactical missions.");
402 cl_centerview =
Cvar_Get(
"cl_centerview",
"1",
CVAR_ARCHIVE,
"Center the view when selecting a new soldier.");
405 Cmd_AddCommand(
"debug_camangles", CL_CamPrintAngles_f,
"Print current camera angles.");
#define CAMERA_START_DIST
vec_t VectorLength(const vec3_t v)
Calculate the length of a vector.
void CL_CameraMove(void)
Update the camera position. This can be done in two different reasons. The first is the user input...
const char * Cmd_Argv(int arg)
Returns a given argument.
#define CAMERA_START_HEIGHT
void Cmd_AddCommand(const char *cmdName, xcommand_t function, const char *desc)
Add a new command to the script interface.
#define VectorCopy(src, dest)
static cvar_t * cl_campitchmax
#define VectorSet(v, x, y, z)
#define MIN_CAMMOVE_ACCEL
void VectorMA(const vec3_t veca, const float scale, const vec3_t vecb, vec3_t outVector)
Sets vector_out (vc) to vevtor1 (va) + scale * vector2 (vb)
static void CL_CamSetZoom_f(void)
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
void CL_BlockBattlescapeEvents(bool block)
Adds the ability to block battlescape event execution until something other is finished. E.g. camera movement.
#define MAX_CAMMOVE_SPEED
vec_t VectorNormalize2(const vec3_t v, vec3_t out)
Calculated the normal vector for a given vec3_t.
void Com_Printf(const char *const fmt,...)
void CL_CheckCameraRoute(const pos3_t from, const pos3_t target)
Only moves the camera to the given target location if its not yet close enough.
#define VectorScale(in, scale, out)
#define MAX_CAMZOOM_QUANT
static cvar_t * cl_camrotspeed
void AngleVectors(const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Create the rotation matrix in order to rotate something.
#define DotProduct(x, y)
Returns the distance between two 3-dimensional vectors.
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags, const char *desc)
Init or return a cvar.
void CL_CameraZoomIn(void)
Zooms the scene of the battlefield in.
int Cmd_Argc(void)
Return the number of arguments of the current command. "command parameter" will result in a argc of 2...
static cvar_t * cl_camzoomspeed
#define MAX_CAMMOVE_ACCEL
#define VecToPos(v, p)
Map boundary is +/- MAX_WORLD_WIDTH - to get into the positive area we add the possible max negative ...
#define PosToVec(p, v)
Pos boundary size is +/- 128 - to get into the positive area we add the possible max negative value a...
void CL_ViewCalcFieldOfViewX(void)
Calculates refdef's FOV_X. Should generally be called after any changes are made to the zoom level (v...
static cvar_t * cl_campitchmin
void getCenter(vec3_t center) const
Calculates the center of the bounding box.
#define Vector2Dist(a, b)
static void CL_ClampCamToMap(const float border)
forces the camera to stay within the horizontal bounds of the map plus some border ...
static void CL_CamSetAngles_f(void)
vec_t VectorNormalize(vec3_t v)
Calculate unit vector for a given vec3_t.
static int cameraRouteEnd
#define MIN_CAMMOVE_SPEED
#define CAMERA_LEVEL_HEIGHT
int VectorCompareEps(const vec3_t v1, const vec3_t v2, float epsilon)
Compare two vectors that may have an epsilon difference but still be the same vectors.
void CL_CameraRoute(const pos3_t from, const pos3_t target)
Interpolates the camera movement from the given start point to the given end point.
static cvar_t * cl_cammovespeed
void CL_CameraZoomOut(void)
Zooms the scene of the battlefield out.
#define MIN_CAMZOOM_QUANT
static void CL_CenterCameraIntoMap_f(void)
void Cvar_SetValue(const char *varName, float value)
Expands value to a string and calls Cvar_Set.
#define VectorSubtract(a, b, dest)
static cvar_t * cl_cammoveaccel