UFO: Alien Invasion
cl_camera.cpp File Reference
#include "../client.h"
#include "cl_view.h"
#include "cl_hud.h"
#include "../input/cl_input.h"
#include "events/e_parse.h"
Include dependency graph for cl_camera.cpp:

Go to the source code of this file.

Macros

#define MIN_CAMROT_SPEED   5
 
#define MIN_CAMROT_ACCEL   5
 
#define MAX_CAMROT_SPEED   1000
 
#define MAX_CAMROT_ACCEL   1000
 
#define MIN_CAMMOVE_SPEED   150
 
#define MIN_CAMMOVE_ACCEL   150
 
#define MAX_CAMMOVE_SPEED   3000
 
#define MAX_CAMMOVE_ACCEL   3000
 
#define LEVEL_MIN   0.05
 
#define LEVEL_SPEED   3.0
 
#define MIN_CAMZOOM_QUANT   0.05
 
#define MAX_CAMZOOM_QUANT   1.0
 

Functions

static void CL_ClampCamToMap (const float border)
 forces the camera to stay within the horizontal bounds of the map plus some border More...
 
void CL_CameraMove (void)
 Update the camera position. This can be done in two different reasons. The first is the user input, the second is an active camera route. The camera route overrides the user input and is lerping the movement until the final position is reached. More...
 
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. More...
 
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. More...
 
void CL_CameraZoomIn (void)
 Zooms the scene of the battlefield in. More...
 
void CL_CameraZoomOut (void)
 Zooms the scene of the battlefield out. More...
 
static void CL_CamSetAngles_f (void)
 
static void CL_CamSetZoom_f (void)
 
static void CL_CenterCameraIntoMap_f (void)
 
void CL_CameraInit (void)
 

Variables

static bool cameraRoute = false
 
static int cameraRouteEnd
 
static vec3_t routeFrom
 
static vec3_t routeDelta
 
static float routeDist
 
const float MIN_ZOOM = 0.5
 
const float MAX_ZOOM = 32.0
 
static cvar_tcl_camrotspeed
 
static cvar_tcl_cammovespeed
 
static cvar_tcl_cammoveaccel
 
static cvar_tcl_campitchmin
 
static cvar_tcl_campitchmax
 
static cvar_tcl_camzoomspeed
 
cvar_tcl_camzoommax
 
cvar_tcl_camzoomquant
 
cvar_tcl_camzoommin
 
cvar_tcl_centerview
 

Macro Definition Documentation

◆ LEVEL_MIN

#define LEVEL_MIN   0.05

Definition at line 55 of file cl_camera.cpp.

◆ LEVEL_SPEED

#define LEVEL_SPEED   3.0

Definition at line 56 of file cl_camera.cpp.

◆ MAX_CAMMOVE_ACCEL

#define MAX_CAMMOVE_ACCEL   3000

Definition at line 54 of file cl_camera.cpp.

◆ MAX_CAMMOVE_SPEED

#define MAX_CAMMOVE_SPEED   3000

Definition at line 53 of file cl_camera.cpp.

◆ MAX_CAMROT_ACCEL

#define MAX_CAMROT_ACCEL   1000

Definition at line 50 of file cl_camera.cpp.

◆ MAX_CAMROT_SPEED

#define MAX_CAMROT_SPEED   1000

Definition at line 49 of file cl_camera.cpp.

◆ MAX_CAMZOOM_QUANT

#define MAX_CAMZOOM_QUANT   1.0

Definition at line 58 of file cl_camera.cpp.

◆ MIN_CAMMOVE_ACCEL

#define MIN_CAMMOVE_ACCEL   150

Definition at line 52 of file cl_camera.cpp.

◆ MIN_CAMMOVE_SPEED

#define MIN_CAMMOVE_SPEED   150

Definition at line 51 of file cl_camera.cpp.

◆ MIN_CAMROT_ACCEL

#define MIN_CAMROT_ACCEL   5

Definition at line 48 of file cl_camera.cpp.

◆ MIN_CAMROT_SPEED

#define MIN_CAMROT_SPEED   5

Definition at line 47 of file cl_camera.cpp.

◆ MIN_CAMZOOM_QUANT

#define MIN_CAMZOOM_QUANT   0.05

Definition at line 57 of file cl_camera.cpp.

Function Documentation

◆ CL_CameraInit()

◆ CL_CameraMove()

◆ CL_CameraRoute()

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.

See also
CL_CameraMove
CL_ViewCenterAtGridPosition
Parameters
[in]fromThe grid position to start the camera movement from
[in]targetThe grid position to move the camera to

Definition at line 250 of file cl_camera.cpp.

References clientBattleScape_t::cam, cameraRoute, cl, CL_BlockBattlescapeEvents(), cl_centerview, Cvar_SetValue(), cvar_t::integer, camera_t::origin, PosToVec, routeDelta, routeDist, routeFrom, camera_t::speed, UNIT_SIZE, VectorClear, VectorCompareEps(), VectorCopy, VectorLength(), VectorNormalize(), and VectorSubtract.

Referenced by CL_CheckCameraRoute().

◆ CL_CameraZoomIn()

void CL_CameraZoomIn ( void  )

◆ CL_CameraZoomOut()

void CL_CameraZoomOut ( void  )

◆ CL_CamSetAngles_f()

static void CL_CamSetAngles_f ( void  )
static

Definition at line 357 of file cl_camera.cpp.

References camera_t::angles, clientBattleScape_t::cam, cl, Cmd_Argc(), Cmd_Argv(), Com_Printf(), PITCH, ROLL, and YAW.

Referenced by CL_CameraInit().

◆ CL_CamSetZoom_f()

static void CL_CamSetZoom_f ( void  )
static

◆ CL_CenterCameraIntoMap_f()

static void CL_CenterCameraIntoMap_f ( void  )
static

◆ CL_CheckCameraRoute()

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.

Definition at line 285 of file cl_camera.cpp.

References clientBattleScape_t::cam, cl, CL_CameraRoute(), Cvar_SetValue(), camera_t::origin, VecToPos, and Vector2Dist.

Referenced by CL_ActorAppear(), CL_ActorStartShoot(), CL_MoveView(), and LE_CenterView().

◆ CL_ClampCamToMap()

static void CL_ClampCamToMap ( const float  border)
inlinestatic

forces the camera to stay within the horizontal bounds of the map plus some border

Definition at line 75 of file cl_camera.cpp.

References clientBattleScape_t::cam, cl, AABB::getMaxX(), AABB::getMaxY(), AABB::getMinX(), AABB::getMinY(), mapData_t::mapBox, clientBattleScape_t::mapData, and camera_t::origin.

Referenced by CL_CameraMove().

Variable Documentation

◆ cameraRoute

bool cameraRoute = false
static

Definition at line 34 of file cl_camera.cpp.

Referenced by CL_CameraMove(), and CL_CameraRoute().

◆ cameraRouteEnd

int cameraRouteEnd
static

Definition at line 35 of file cl_camera.cpp.

Referenced by CL_CameraMove().

◆ cl_cammoveaccel

cvar_t* cl_cammoveaccel
static

Definition at line 62 of file cl_camera.cpp.

Referenced by CL_CameraInit(), and CL_CameraMove().

◆ cl_cammovespeed

cvar_t* cl_cammovespeed
static

Definition at line 61 of file cl_camera.cpp.

Referenced by CL_CameraInit(), and CL_CameraMove().

◆ cl_campitchmax

cvar_t* cl_campitchmax
static

Definition at line 64 of file cl_camera.cpp.

Referenced by CL_CameraInit(), and CL_CameraMove().

◆ cl_campitchmin

cvar_t* cl_campitchmin
static

Definition at line 63 of file cl_camera.cpp.

Referenced by CL_CameraInit(), and CL_CameraMove().

◆ cl_camrotspeed

cvar_t* cl_camrotspeed
static

Definition at line 60 of file cl_camera.cpp.

Referenced by CL_CameraInit(), and CL_CameraMove().

◆ cl_camzoommax

cvar_t* cl_camzoommax

Definition at line 66 of file cl_camera.cpp.

Referenced by CL_CameraInit(), CL_CameraMove(), CL_CameraZoomIn(), and CL_CamSetZoom_f().

◆ cl_camzoommin

cvar_t* cl_camzoommin

◆ cl_camzoomquant

cvar_t* cl_camzoomquant

Definition at line 67 of file cl_camera.cpp.

Referenced by CL_CameraInit(), CL_CameraZoomIn(), and CL_CameraZoomOut().

◆ cl_camzoomspeed

cvar_t* cl_camzoomspeed
static

Definition at line 65 of file cl_camera.cpp.

Referenced by CL_CameraInit(), and CL_CameraMove().

◆ cl_centerview

cvar_t* cl_centerview

Definition at line 69 of file cl_camera.cpp.

Referenced by CL_CameraInit(), CL_CameraRoute(), and LE_CenterView().

◆ MAX_ZOOM

const float MAX_ZOOM = 32.0

Definition at line 44 of file cl_camera.cpp.

Referenced by CL_CameraMove(), CL_CameraZoomIn(), and CL_CamSetZoom_f().

◆ MIN_ZOOM

const float MIN_ZOOM = 0.5

Definition at line 40 of file cl_camera.cpp.

Referenced by CL_CameraMove(), CL_CameraZoomOut(), CL_CamSetZoom_f(), and SEQ_SetCamera().

◆ routeDelta

vec3_t routeDelta
static

Definition at line 36 of file cl_camera.cpp.

Referenced by CL_CameraMove(), and CL_CameraRoute().

◆ routeDist

float routeDist
static

Definition at line 37 of file cl_camera.cpp.

Referenced by CL_CameraMove(), and CL_CameraRoute().

◆ routeFrom

vec3_t routeFrom
static

Definition at line 36 of file cl_camera.cpp.

Referenced by CL_CameraMove(), and CL_CameraRoute().