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
56#define LEVEL_SPEED 3.0
57#define MIN_CAMZOOM_QUANT 0.05
58#define MAX_CAMZOOM_QUANT 1.0
77 if (
cl.cam.origin[0] <
cl.mapData->mapBox.getMinX() - border)
78 cl.cam.origin[0] =
cl.mapData->mapBox.getMinX() - border;
79 else if (
cl.cam.origin[0] >
cl.mapData->mapBox.getMaxX() + border)
80 cl.cam.origin[0] =
cl.mapData->mapBox.getMaxX() + border;
82 if (
cl.cam.origin[1] <
cl.mapData->mapBox.getMinY() - border)
83 cl.cam.origin[1] =
cl.mapData->mapBox.getMinY() - border;
84 else if (
cl.cam.origin[1] >
cl.mapData->mapBox.getMaxY() + border)
85 cl.cam.origin[1] =
cl.mapData->mapBox.getMaxY() + border;
102 const float rotspeed =
104 const float movespeed =
107 const float moveaccel =
113 float frac =
cls.frametime * moveaccel * 2.5;
115 for (
int i = 0;
i < 2;
i++) {
116 if (fabs(
cl.cam.omega[
i]) > frac) {
117 if (
cl.cam.omega[
i] > 0)
118 cl.cam.omega[
i] -= frac;
120 cl.cam.omega[
i] += frac;
130 if (
cl.cam.omega[
i] > rotspeed)
131 cl.cam.omega[
i] = rotspeed;
132 if (-
cl.cam.omega[
i] > rotspeed)
133 cl.cam.omega[
i] = -rotspeed;
158 frac =
cls.frametime * moveaccel * 2;
172 const float angle =
cl.cam.angles[
YAW] *
torad;
173 const float sy = sin(angle);
174 const float cy = cos(angle);
175 vec3_t g_forward, g_right;
182 frac =
cls.frametime * moveaccel;
191 frac =
cls.frametime * moveaccel * 3.5;
221 }
else if (frac < -0.1) {
230 cl.cam.origin[2] = 0.;
289 const float minDistToMove = 4.0f;
291 if (dist < minDistToMove) {
292 if (target[2] != current[2])
315 cl.cam.zoom *= quant;
338 cl.cam.zoom /= quant;
351static void CL_CamPrintAngles_f (
void)
353 Com_Printf(
"camera angles %0.3f:%0.3f:%0.3f\n",
cl.cam.angles[0],
cl.cam.angles[1],
cl.cam.angles[2]);
368 cl.cam.angles[
ROLL] = 0.0f;
388 cl.mapData->mapBox.getCenter(
cl.cam.origin);
396 cl_campitchmax =
Cvar_Get(
"cl_campitchmax",
"89", 0,
"Max. battlescape camera pitch - over 90 presents apparent mouse inversion.");
398 cl_campitchmin =
Cvar_Get(
"cl_campitchmin",
"10", 0,
"Min. battlescape camera pitch - under 35 presents difficulty positioning cursor.");
405 Cmd_AddCommand(
"debug_camangles", CL_CamPrintAngles_f,
"Print current camera angles.");
static cvar_t * cl_cammovespeed
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.
static cvar_t * cl_cammoveaccel
void CL_CameraMove(void)
Update the camera position. This can be done in two different reasons. The first is the user input,...
static cvar_t * cl_campitchmax
static void CL_CamSetAngles_f(void)
#define MAX_CAMZOOM_QUANT
#define MAX_CAMMOVE_ACCEL
static cvar_t * cl_campitchmin
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.
void CL_CameraZoomIn(void)
Zooms the scene of the battlefield in.
static int cameraRouteEnd
#define MIN_CAMMOVE_ACCEL
static cvar_t * cl_camzoomspeed
static void CL_CenterCameraIntoMap_f(void)
#define MIN_CAMMOVE_SPEED
static void CL_ClampCamToMap(const float border)
forces the camera to stay within the horizontal bounds of the map plus some border
static cvar_t * cl_camrotspeed
void CL_CameraZoomOut(void)
Zooms the scene of the battlefield out.
static void CL_CamSetZoom_f(void)
#define MAX_CAMMOVE_SPEED
#define MIN_CAMZOOM_QUANT
#define CAMERA_LEVEL_HEIGHT
#define CAMERA_START_DIST
#define CAMERA_START_HEIGHT
void CL_ViewCalcFieldOfViewX(void)
Calculates refdef's FOV_X. Should generally be called after any changes are made to the zoom level (v...
Primary header for client.
const char * Cmd_Argv(int arg)
Returns a given argument.
int Cmd_Argc(void)
Return the number of arguments of the current command. "command parameter" will result in a argc of 2...
void Cmd_AddCommand(const char *cmdName, xcommand_t function, const char *desc)
Add a new command to the script interface.
void Com_Printf(const char *const fmt,...)
void Cvar_SetValue(const char *varName, float value)
Expands value to a string and calls Cvar_Set.
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags, const char *desc)
Init or return a cvar.
void CL_BlockBattlescapeEvents(bool block)
Adds the ability to block battlescape event execution until something other is finished....
vec_t VectorNormalize(vec3_t v)
Calculate unit vector for a given vec3_t.
vec_t VectorLength(const vec3_t v)
Calculate the length of a vector.
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).
vec_t VectorNormalize2(const vec3_t v, vec3_t out)
Calculated the normal vector for a given vec3_t.
void AngleVectors(const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Create the rotation matrix in order to rotate something.
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.
#define PosToVec(p, v)
Pos boundary size is +/- 128 - to get into the positive area we add the possible max negative value a...
#define VecToPos(v, p)
Map boundary is +/- MAX_WORLD_WIDTH - to get into the positive area we add the possible max negative ...
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
#define VectorSubtract(a, b, dest)
#define VectorCopy(src, dest)
#define Vector2Dist(a, b)
#define DotProduct(x, y)
Returns the distance between two 3-dimensional vectors.
#define VectorSet(v, x, y, z)
#define VectorScale(in, scale, out)