codemp/cgame/cg_view.c File Reference

#include "cg_local.h"
#include "bg_saga.h"
#include "cg_lights.h"
#include "../namespace_begin.h"
#include "../namespace_end.h"

Go to the source code of this file.

Defines

#define MASK_CAMERACLIP   (MASK_SOLID|CONTENTS_PLAYERCLIP)
#define CAMERA_SIZE   4
#define CAMERA_DAMP_INTERVAL   50
#define WAVE_AMPLITUDE   1
#define WAVE_FREQUENCY   0.4
#define CAMERA_DEFAULT_FOV   90.0f
#define MAX_SHAKE_INTENSITY   16.0f
#define SIDEFRAME_WIDTH   16
#define SIDEFRAME_HEIGHT   32

Functions

void CG_TestModel_f (void)
void CG_TestGun_f (void)
void CG_TestModelNextFrame_f (void)
void CG_TestModelPrevFrame_f (void)
void CG_TestModelNextSkin_f (void)
void CG_TestModelPrevSkin_f (void)
void CG_CalcEntityLerpPositions (centity_t *cent)
qboolean BG_UnrestrainedPitchRoll (playerState_t *ps, Vehicle_t *pVeh)
void CG_GetVehicleCamPos (vec3_t camPos)
void CG_ZoomDown_f (void)
void CG_ZoomUp_f (void)
qboolean CG_CalcFOVFromX (float fov_x)
qboolean CG_CheckPassengerTurretView (void)
void CG_EmplacedView (vec3_t angles)
void CG_DrawSkyBoxPortal (const char *cstr)
void CG_AddBufferedSound (sfxHandle_t sfx)
void CG_UpdateSoundTrackers ()
void CG_SE_UpdateShake (vec3_t origin, vec3_t angles)
void CG_SE_UpdateMusic (void)
void CG_CalcScreenEffects (void)
void CGCam_Shake (float intensity, int duration)
void CG_DoCameraShake (vec3_t origin, float intensity, int radius, int time)
void CGCam_SetMusicMult (float multiplier, int duration)
int BG_EmplacedView (vec3_t baseAngles, vec3_t angles, float *newYaw, float constraint)
void CG_AddRadarAutomapEnts (void)
void CG_DrawAutoMap (void)
void BG_VehicleTurnRateForSpeed (Vehicle_t *pVeh, float speed, float *mPitchOverride, float *mYawOverride)
qboolean PM_InKnockDown (playerState_t *ps)
void CG_ActualLoadDeferredPlayers (void)
void CG_DrawActiveFrame (int serverTime, stereoFrame_t stereoView, qboolean demoPlayback)

Variables

vec3_t camerafwd
vec3_t cameraup
vec3_t cameraFocusAngles
vec3_t cameraFocusLoc
vec3_t cameraIdealTarget
vec3_t cameraIdealLoc
vec3_t cameraCurTarget = {0,0,0} cameraCurLoc={0,0,0}
vec3_t cameraOldLoc = {0,0,0} cameraNewLoc={0,0,0}
int cameraLastFrame = 0
float cameraLastYaw = 0
float cameraStiffFactor = 0.0f
qboolean gCGHasFallVector
vec3_t gCGFallVector
vmCvar_t cg_thirdPersonHorzOffset
float zoomFov
int cg_actionCamLastTime = 0
vec3_t cg_actionCamLastPos
vec3_t cg_lastTurretViewAngles = {0}
qboolean cg_skyOri
vec3_t cg_skyOriPos
float cg_skyOriScale
qboolean cg_noFogOutsidePortal
cgscreffects_t cgScreenEffects
float cg_autoMapZoom = 512.0f
float cg_autoMapZoomMainOffset = 0.0f
vec3_t cg_autoMapAngle = {90.0f, 0.0f, 0.0f}
autoMapInput_t cg_autoMapInput
int cg_autoMapInputTime = 0
float cg_linearFogOverride = 0.0f
qboolean cgQueueLoad


Define Documentation

#define CAMERA_DAMP_INTERVAL   50
 

Definition at line 219 of file cg_view.c.

#define CAMERA_DEFAULT_FOV   90.0f
 

Definition at line 1998 of file cg_view.c.

Referenced by CG_SE_UpdateShake().

#define CAMERA_SIZE   4
 

Definition at line 14 of file cg_view.c.

Referenced by G_EstimateCamPos().

#define MASK_CAMERACLIP   (MASK_SOLID|CONTENTS_PLAYERCLIP)
 

Definition at line 13 of file cg_view.c.

Referenced by G_EstimateCamPos().

#define MAX_SHAKE_INTENSITY   16.0f
 

Definition at line 1999 of file cg_view.c.

Referenced by CGCam_Shake().

#define SIDEFRAME_HEIGHT   32
 

Definition at line 2275 of file cg_view.c.

Referenced by CG_DrawAutoMap().

#define SIDEFRAME_WIDTH   16
 

Definition at line 2274 of file cg_view.c.

Referenced by CG_DrawAutoMap().

#define WAVE_AMPLITUDE   1
 

Definition at line 1187 of file cg_view.c.

#define WAVE_FREQUENCY   0.4
 

Definition at line 1188 of file cg_view.c.


Function Documentation

int BG_EmplacedView vec3_t  baseAngles,
vec3_t  angles,
float *  newYaw,
float  constraint
 

Definition at line 2703 of file bg_misc.c.

02704 {
02705         float dif = AngleSubtract(baseAngles[YAW], angles[YAW]);
02706 
02707         if (dif > constraint ||
02708                 dif < -constraint)
02709         {
02710                 float amt;
02711 
02712                 if (dif > constraint)
02713                 {
02714                         amt = (dif-constraint);
02715                         dif = constraint;
02716                 }
02717                 else if (dif < -constraint)
02718                 {
02719                         amt = (dif+constraint);
02720                         dif = -constraint;
02721                 }
02722                 else
02723                 {
02724                         amt = 0.0f;
02725                 }
02726 
02727                 *newYaw = AngleSubtract(angles[YAW], -dif);
02728 
02729                 if (amt > 1.0f || amt < -1.0f)
02730                 { //significant, force the view
02731                         return 2;
02732                 }
02733                 else
02734                 { //just a little out of range
02735                         return 1;
02736                 }
02737         }
02738 
02739         return 0;
02740 }

qboolean BG_UnrestrainedPitchRoll playerState_t ps,
Vehicle_t pVeh
 

Definition at line 7785 of file bg_pmove.c.

07786 {
07787         if ( bg_fighterAltControl.integer
07788                 && ps->clientNum < MAX_CLIENTS //real client
07789                 && ps->m_iVehicleNum//in a vehicle
07790                 && pVeh //valid vehicle data pointer
07791                 && pVeh->m_pVehicleInfo//valid vehicle info
07792                 && pVeh->m_pVehicleInfo->type == VH_FIGHTER )//fighter
07793                 //FIXME: specify per vehicle instead of assuming true for all fighters
07794                 //FIXME: map/server setting?
07795         {//can roll and pitch without limitation!
07796                 return qtrue;
07797         }
07798         return qfalse;
07799 }

void BG_VehicleTurnRateForSpeed Vehicle_t pVeh,
float  speed,
float *  mPitchOverride,
float *  mYawOverride
 

Definition at line 676 of file bg_pmove.c.

00677 {
00678         if ( pVeh && pVeh->m_pVehicleInfo )
00679         {
00680                 float speedFrac = 1.0f;
00681                 if ( pVeh->m_pVehicleInfo->speedDependantTurning )
00682                 {
00683                         if ( pVeh->m_LandTrace.fraction >= 1.0f 
00684                                 || pVeh->m_LandTrace.plane.normal[2] < MIN_LANDING_SLOPE  )
00685                         {
00686                                 speedFrac = (speed/(pVeh->m_pVehicleInfo->speedMax*0.75f));
00687                                 if ( speedFrac < 0.25f )
00688                                 {
00689                                         speedFrac = 0.25f;
00690                                 }
00691                                 else if ( speedFrac > 1.0f )
00692                                 {
00693                                         speedFrac = 1.0f;
00694                                 }
00695                         }
00696                 }
00697                 if ( pVeh->m_pVehicleInfo->mousePitch )
00698                 {
00699                         *mPitchOverride = pVeh->m_pVehicleInfo->mousePitch*speedFrac;
00700                 }
00701                 if ( pVeh->m_pVehicleInfo->mouseYaw )
00702                 {
00703                         *mYawOverride = pVeh->m_pVehicleInfo->mouseYaw*speedFrac;
00704                 }
00705         }
00706 }

void CG_ActualLoadDeferredPlayers void   ) 
 

Definition at line 1953 of file cg_players.c.

References CG_LoadClientInfo(), cgs, cgs_t::clientinfo, and cgs_t::maxclients.

Referenced by CG_DrawActiveFrame().

01954 {
01955         int             i;
01956         clientInfo_t    *ci;
01957 
01958         // scan for a deferred player to load
01959         for ( i = 0, ci = cgs.clientinfo ; i < cgs.maxclients ; i++, ci++ ) {
01960                 if ( ci->infoValid && ci->deferred ) {
01961                         CG_LoadClientInfo( ci );
01962 //                      break;
01963                 }
01964         }
01965 }

void CG_AddBufferedSound sfxHandle_t  sfx  ) 
 

Definition at line 1934 of file cg_view.c.

References cg, MAX_SOUNDBUFFER, sfxHandle_t, cg_t::soundBuffer, cg_t::soundBufferIn, and cg_t::soundBufferOut.

Referenced by CG_CheckLocalSounds(), and CG_EntityEvent().

01934                                             {
01935         if ( !sfx )
01936                 return;
01937         cg.soundBuffer[cg.soundBufferIn] = sfx;
01938         cg.soundBufferIn = (cg.soundBufferIn + 1) % MAX_SOUNDBUFFER;
01939         if (cg.soundBufferIn == cg.soundBufferOut) {
01940                 cg.soundBufferOut++;
01941         }
01942 }

void CG_AddRadarAutomapEnts void   ) 
 

Definition at line 2248 of file cg_view.c.

References cg, cg_entities, playerState_s::clientNum, cg_t::predictedPlayerState, cg_t::radarEntities, and cg_t::radarEntityCount.

Referenced by CG_DrawAutoMap().

02249 {
02250         int i = 0;
02251 
02252         //first add yourself
02253         CG_AddRefentForAutoMap(&cg_entities[cg.predictedPlayerState.clientNum]);
02254 
02255         while (i < cg.radarEntityCount)
02256         {
02257                 CG_AddRefentForAutoMap(&cg_entities[cg.radarEntities[i]]);
02258                 i++;
02259         }
02260 }

void CG_CalcEntityLerpPositions centity_t cent  ) 
 

Definition at line 3064 of file cg_ents.c.

References trace_t::allsolid, entityState_s::apos, BG_EvaluateTrajectory(), centity_t, cg, CG_AdjustPositionForMover(), cg_entities, cg_smoothClients, CG_Trace(), CLASS_VEHICLE, playerState_s::clientNum, centity_s::currentState, DEFAULT_MAXS_2, DEFAULT_MINS_2, EF_DEAD, EF_RAG, entityState_s::eFlags, ET_NPC, entityState_s::eType, trace_t::fraction, entityState_s::groundEntityNum, vmCvar_t::integer, centity_s::interpolate, centity_s::isRagging, centity_s::lerpAngles, centity_s::lerpOrigin, playerState_s::m_iVehicleNum, MASK_PLAYERSOLID, MAX_CLIENTS, centity_s::nextState, entityState_s::NPC_class, entityState_s::number, entityState_s::owner, playerMaxs, playerMins, entityState_s::pos, cg_t::predictedPlayerState, qboolean, qfalse, qtrue, snapshot_t::serverTime, cg_t::snap, trace_t::startsolid, cg_t::time, TR_INTERPOLATE, TR_LINEAR_STOP, trajectory_t::trType, vec3_t, VectorAdd, VectorClear, VectorCopy, VectorMA, and VectorNormalize().

Referenced by vmMain().

03064                                                    {
03065         qboolean goAway = qfalse;
03066 
03067         // if this player does not want to see extrapolated players
03068         if ( !cg_smoothClients.integer ) {
03069                 // make sure the clients use TR_INTERPOLATE
03070                 if ( cent->currentState.number < MAX_CLIENTS ) {
03071                         cent->currentState.pos.trType = TR_INTERPOLATE;
03072                         cent->nextState.pos.trType = TR_INTERPOLATE;
03073                 }
03074         }
03075 
03076         if (cg.predictedPlayerState.m_iVehicleNum &&
03077                 cg.predictedPlayerState.m_iVehicleNum == cent->currentState.number &&
03078                 cent->currentState.eType == ET_NPC && cent->currentState.NPC_class == CLASS_VEHICLE)
03079         { //special case for vehicle we are riding
03080                 centity_t *veh = &cg_entities[cg.predictedPlayerState.m_iVehicleNum];
03081 
03082                 if (veh->currentState.owner == cg.predictedPlayerState.clientNum)
03083                 { //only do this if the vehicle is pilotted by this client and predicting properly
03084                         BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, cent->lerpOrigin );
03085                         BG_EvaluateTrajectory( &cent->currentState.apos, cg.time, cent->lerpAngles );
03086                         return;
03087                 }
03088         }
03089 
03090         if ( cent->interpolate && cent->currentState.pos.trType == TR_INTERPOLATE ) {
03091                 CG_InterpolateEntityPosition( cent );
03092                 return;
03093         }
03094 
03095         // first see if we can interpolate between two snaps for
03096         // linear extrapolated clients
03097         if ( cent->interpolate && cent->currentState.pos.trType == TR_LINEAR_STOP &&
03098                                                                                         cent->currentState.number < MAX_CLIENTS) {
03099                 CG_InterpolateEntityPosition( cent );
03100                 goAway = qtrue;
03101         }
03102         else if (cent->interpolate &&
03103                 cent->currentState.eType == ET_NPC && cent->currentState.NPC_class == CLASS_VEHICLE)
03104         {
03105                 CG_InterpolateEntityPosition( cent );
03106                 goAway = qtrue;
03107         }
03108         else
03109         {
03110                 // just use the current frame and evaluate as best we can
03111                 BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, cent->lerpOrigin );
03112                 BG_EvaluateTrajectory( &cent->currentState.apos, cg.time, cent->lerpAngles );
03113         }
03114 
03115 #if 0
03116         if (cent->hasRagOffset && cent->ragOffsetTime < cg.time)
03117         { //take all of the offsets from last frame and normalize the total direction and add it in
03118                 vec3_t slideDir;
03119                 vec3_t preOffset;
03120                 vec3_t addedOffset;
03121                 vec3_t  playerMins = {-15, -15, DEFAULT_MINS_2};
03122                 vec3_t  playerMaxs = {15, 15, DEFAULT_MAXS_2};
03123                 trace_t tr;
03124 
03125                 //VectorSubtract(cent->lerpOrigin, callData->bonePos, slideDir);
03126                 VectorCopy(cent->ragOffsets, slideDir);
03127                 VectorNormalize(slideDir);
03128 
03129                 //Store it in case we want to go back
03130                 VectorCopy(cent->lerpOriginOffset, preOffset);
03131 
03132                 //just add a little at a time
03133                 VectorMA(cent->lerpOriginOffset, 0.4f, slideDir, cent->lerpOriginOffset);
03134 
03135                 if (VectorLength(cent->lerpOriginOffset) > 10.0f)
03136                 { //don't go too far away
03137                         VectorCopy(preOffset, cent->lerpOriginOffset);
03138                 }
03139                 else
03140                 {
03141                         //Let's trace there to make sure we can make it
03142                         VectorAdd(cent->lerpOrigin, cent->lerpOriginOffset, addedOffset);
03143                         CG_Trace(&tr, cent->lerpOrigin, playerMins, playerMaxs, addedOffset, cent->currentState.number, MASK_PLAYERSOLID);
03144 
03145                         if (tr.startsolid || tr.allsolid || tr.fraction != 1.0f)
03146                         { //can't get there
03147                                 VectorCopy(preOffset, cent->lerpOriginOffset);
03148                         }
03149                         else
03150                         {
03151                                 /*
03152                                 if (cent->lerpOriginOffset[2] > 4.0f)
03153                                 { //don't go too far off the ground
03154                                         cent->lerpOriginOffset[2] = 4.0f;
03155                                 }
03156                                 */
03157                                 //I guess I just don't want this happening.
03158                                 cent->lerpOriginOffset[2] = 0.0f;
03159                         }
03160                 }
03161 
03162                 //done with this bit
03163                 cent->hasRagOffset = qfalse;
03164                 VectorClear(cent->ragOffsets);
03165                 cent->ragOffsetTime = cg.time + 50;
03166         }
03167 
03168         //See if we should add in the offset for ragdoll
03169         if (cent->isRagging && ((cent->currentState.eFlags & EF_DEAD) || (cent->currentState.eFlags & EF_RAG)))
03170         {
03171                 VectorAdd(cent->lerpOrigin, cent->lerpOriginOffset, cent->lerpOrigin);
03172         }
03173 #endif
03174 
03175         if (goAway)
03176         {
03177                 return;
03178         }
03179 
03180         // adjust for riding a mover if it wasn't rolled into the predicted
03181         // player state
03182         if ( cent->currentState.number != cg.predictedPlayerState.clientNum ) {
03183                 CG_AdjustPositionForMover( cent->lerpOrigin, cent->currentState.groundEntityNum, 
03184                 cg.snap->serverTime, cg.time, cent->lerpOrigin );
03185         }
03186 }

qboolean CG_CalcFOVFromX float  fov_x  ) 
 

Definition at line 1130 of file cg_view.c.

References atan2(), cg, refdef_t::fov_x, refdef_t::fov_y, refdef_t::height, M_PI, qboolean, qfalse, cg_t::refdef, tan(), and refdef_t::width.

01131 {
01132         float   x;
01133 //      float   phase;
01134 //      float   v;
01135 //      int             contents;
01136         float   fov_y;
01137         qboolean        inwater;
01138 
01139         x = cg.refdef.width / tan( fov_x / 360 * M_PI );
01140         fov_y = atan2( cg.refdef.height, x );
01141         fov_y = fov_y * 360 / M_PI;
01142 
01143         // there's a problem with this, it only takes the leafbrushes into account, not the entity brushes,
01144         //      so if you give slime/water etc properties to a func_door area brush in order to move the whole water 
01145         //      level up/down this doesn't take into account the door position, so warps the view the whole time
01146         //      whether the water is up or not. Fortunately there's only one slime area in Trek that you can be under,
01147         //      so lose it...
01148 #if 0
01149 /*
01150         // warp if underwater
01151         contents = CG_PointContents( cg.refdef.vieworg, -1 );
01152         if ( contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) ){
01153                 phase = cg.time / 1000.0 * WAVE_FREQUENCY * M_PI * 2;
01154                 v = WAVE_AMPLITUDE * sin( phase );
01155                 fov_x += v;
01156                 fov_y -= v;
01157                 inwater = qtrue;
01158         }
01159         else {
01160                 inwater = qfalse;
01161         }
01162 */
01163 #else
01164         inwater = qfalse;
01165 #endif
01166 
01167 
01168         // set it
01169         cg.refdef.fov_x = fov_x;
01170         cg.refdef.fov_y = fov_y;
01171 
01172 #ifdef _XBOX
01173         if(cg.widescreen)
01174                 cg.refdef.fov_x *= 1.125f;
01175 #endif
01176 
01177         return (inwater);
01178 }

void CG_CalcScreenEffects void   ) 
 

Definition at line 2096 of file cg_view.c.

References cg, CG_SE_UpdateMusic(), CG_SE_UpdateShake(), cg_t::refdef, refdef_t::viewangles, and refdef_t::vieworg.

Referenced by CG_DrawActiveFrame().

qboolean CG_CheckPassengerTurretView void   ) 
 

Definition at line 1477 of file cg_view.c.

References AnglesSubtract(), centity_t, cg, cg_entities, cg_lastTurretViewAngles, cg_t::frametime, playerState_s::generic1, centity_s::ghoul2, turretStats_t::iAmmoMax, centity_s::lerpAngles, centity_s::lerpOrigin, Vehicle_s::m_iGunnerViewTag, playerState_s::m_iVehicleNum, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, MAX_VEHICLE_TURRETS, vehicleInfo_t::maxPassengers, centity_s::modelScale, NEGATIVE_X, NEGATIVE_Y, NULL, ORIGIN, turretStats_t::passengerNum, turretStats_t::pitchBone, cg_t::predictedPlayerState, qboolean, qfalse, qtrue, cg_t::refdef, cg_t::time, trap_G2API_AddBolt(), trap_G2API_GetBoltMatrix_NoRecNoRot(), vehicleInfo_t::turret, vec3_t, vectoangles(), VectorMA, refdef_t::viewangles, refdef_t::vieworg, and turretStats_t::yawBone.

01478 {
01479         if ( cg.predictedPlayerState.m_iVehicleNum //in a vehicle
01480                 && cg.predictedPlayerState.generic1 )//as a passenger
01481         {//passenger in a vehicle
01482                 centity_t *vehCent = &cg_entities[cg.predictedPlayerState.m_iVehicleNum];
01483                 if ( vehCent->m_pVehicle
01484                         && vehCent->m_pVehicle->m_pVehicleInfo 
01485                         && vehCent->m_pVehicle->m_pVehicleInfo->maxPassengers )
01486                 {//a vehicle capable of carrying passengers
01487                         int turretNum;
01488                         for ( turretNum = 0; turretNum < MAX_VEHICLE_TURRETS; turretNum++ )
01489                         {
01490                                 if ( vehCent->m_pVehicle->m_pVehicleInfo->turret[turretNum].iAmmoMax )
01491                                 {// valid turret
01492                                         if ( vehCent->m_pVehicle->m_pVehicleInfo->turret[turretNum].passengerNum == cg.predictedPlayerState.generic1 )
01493                                         {//I control this turret
01494                                                 int boltIndex = -1;
01495                                                 qboolean hackPosAndAngle = qfalse;
01496                                                 if ( vehCent->m_pVehicle->m_iGunnerViewTag[turretNum] != -1 )
01497                                                 {
01498                                                         boltIndex = vehCent->m_pVehicle->m_iGunnerViewTag[turretNum];
01499                                                 }
01500                                                 else
01501                                                 {//crap... guess?
01502                                                         hackPosAndAngle = qtrue;
01503                                                         if ( vehCent->m_pVehicle->m_pVehicleInfo->turret[turretNum].yawBone )
01504                                                         {
01505                                                                 boltIndex = trap_G2API_AddBolt( vehCent->ghoul2, 0, vehCent->m_pVehicle->m_pVehicleInfo->turret[turretNum].yawBone );
01506                                                         }
01507                                                         else if ( vehCent->m_pVehicle->m_pVehicleInfo->turret[turretNum].pitchBone )
01508                                                         {
01509                                                                 boltIndex = trap_G2API_AddBolt( vehCent->ghoul2, 0, vehCent->m_pVehicle->m_pVehicleInfo->turret[turretNum].pitchBone );
01510                                                         }
01511                                                         else
01512                                                         {//well, no way of knowing, so screw it
01513                                                                 return qfalse;
01514                                                         }
01515                                                 }
01516                                                 if ( boltIndex != -1 )
01517                                                 {
01518                                                         mdxaBone_t boltMatrix;
01519                                                         vec3_t fwd, up;
01520                                                         trap_G2API_GetBoltMatrix_NoRecNoRot(vehCent->ghoul2, 0, boltIndex, &boltMatrix, vehCent->lerpAngles,
01521                                                                 vehCent->lerpOrigin, cg.time, NULL, vehCent->modelScale);
01522                                                         BG_GiveMeVectorFromMatrix(&boltMatrix, ORIGIN, cg.refdef.vieworg);
01523                                                         if ( hackPosAndAngle )
01524                                                         {
01525                                                                 //FIXME: these are assumptions, externalize?  BETTER YET: give me a controller view bolt/tag for each turret
01526                                                                 BG_GiveMeVectorFromMatrix(&boltMatrix, NEGATIVE_X, fwd);
01527                                                                 BG_GiveMeVectorFromMatrix(&boltMatrix, NEGATIVE_Y, up);
01528                                                                 VectorMA( cg.refdef.vieworg, 8.0f, fwd, cg.refdef.vieworg );
01529                                                                 VectorMA( cg.refdef.vieworg, 4.0f, up, cg.refdef.vieworg );
01530                                                         }
01531                                                         else
01532                                                         {
01533                                                                 BG_GiveMeVectorFromMatrix(&boltMatrix, NEGATIVE_Y, fwd);
01534                                                         }
01535                                                         {
01536                                                                 vec3_t  newAngles, deltaAngles;
01537                                                                 vectoangles( fwd, newAngles );
01538                                                                 AnglesSubtract( newAngles, cg_lastTurretViewAngles, deltaAngles );
01539                                                                 VectorMA( cg_lastTurretViewAngles, 0.5f*(float)cg.frametime/100.0f, deltaAngles, cg.refdef.viewangles );
01540                                                         }
01541                                                         return qtrue;
01542                                                 }
01543                                         }
01544                                 }
01545                         }
01546                 }
01547         }
01548         return qfalse;
01549 }

void CG_DoCameraShake vec3_t  origin,
float  intensity,
int  radius,
int  time
 

Definition at line 2121 of file cg_view.c.

References cg, CGCam_Shake(), cg_t::refdef, vec3_t, VectorNormalize(), VectorSubtract, and refdef_t::vieworg.

Referenced by vmMain().

02122 {
02123         //FIXME: When exactly is the vieworg calculated in relation to the rest of the frame?s
02124 
02125         vec3_t  dir;
02126         float   dist, intensityScale;
02127         float   realIntensity;
02128 
02129         VectorSubtract( cg.refdef.vieworg, origin, dir );
02130         dist = VectorNormalize( dir );
02131 
02132         //Use the dir to add kick to the explosion
02133 
02134         if ( dist > radius )
02135                 return;
02136 
02137         intensityScale = 1 - ( dist / (float) radius );
02138         realIntensity = intensity * intensityScale;
02139 
02140         CGCam_Shake( realIntensity, time );
02141 }

void CG_DrawActiveFrame int  serverTime,
stereoFrame_t  stereoView,
qboolean  demoPlayback
 

Definition at line 2439 of file cg_view.c.

References AnglesToAxis(), snapshot_t::areamask, refdef_t::areamask, bg_fighterAltControl, BG_InGrappleMove(), BG_VehicleTurnRateForSpeed(), bgSiegeClasses, centity_t, cg, CG_ActualLoadDeferredPlayers(), CG_AddLagometerFrameInfo(), CG_AddLocalEntities(), CG_AddMarks(), CG_AddPacketEntities(), CG_AddParticles(), CG_AddViewWeapon(), CG_CalcScreenEffects(), CG_ConfigString(), CG_DrawActive(), CG_DrawAutoMap(), CG_DrawInformation(), CG_DrawMiscEnts(), CG_DrawSkyBoxPortal(), cg_entities, cg_fpls, CG_GetStringEdString(), cg_linearFogOverride, CG_PredictPlayerState(), CG_Printf(), CG_ProcessSnapshots(), CG_RunLightStyles(), cg_snapshotTimeout, cg_stats, cg_thirdPerson, cg_timescale, cg_timescaleFadeEnd, cg_timescaleFadeSpeed, CG_UpdateCvars(), CG_UpdateSoundTrackers(), cgQueueLoad, cgs, CLASS_VEHICLE, cg_t::clientFrame, cgs_t::clientinfo, playerState_s::clientNum, Com_Error(), CS_GLOBAL_AMBIENT_SET, CS_SKYBOXORG, centity_s::currentState, cg_t::demoPlayback, playerState_s::emplacedIndex, ERR_DROP, ET_NPC, entityState_s::eType, playerState_s::fallingToDeath, playerState_s::forceHandExtend, cg_t::forceSelect, refdef_t::fov_x, cg_t::frametime, cgs_t::gametype, gCGFallVector, gCGHasFallVector, playerState_s::generic1, GT_SIEGE, HANDEXTEND_KNOCKDOWN, refEntity_t::hModel, cg_t::hyperspace, cg_t::infoScreenText, vmCvar_t::integer, cg_t::itemSelect, playerState_s::legsAnim, playerState_s::m_iVehicleNum, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, memcpy(), name, entityState_s::NPC_class, NULL, cg_t::oldTime, playerState_s::origin, PERS_TEAM, playerState_s::persistant, PM_InKnockDown(), PM_SPECTATOR, playerState_s::pm_type, cg_t::predictedPlayerState, snapshot_t::ps, qboolean, qfalse, qtrue, cg_t::refdef, cg_t::renderingThirdPerson, playerState_s::saberLockTime, cg_t::snap, SNAPFLAG_NOT_ACTIVE, snapshot_t::snapFlags, entityState_s::speed, STAT_HEALTH, playerState_s::stats, STEREO_RIGHT, stereoFrame_t, TEAM_SPECTATOR, cg_t::testModelEntity, refdef_t::time, cg_t::time, playerState_s::torsoAnim, trap_Cvar_Set(), trap_FX_AddScheduledEffects(), trap_FX_AdjustTime(), trap_Milliseconds(), trap_R_ClearScene(), trap_R_SetRangeFog(), trap_ROFF_UpdateEntities(), trap_S_ClearLoopingSounds(), trap_S_Respatialize(), trap_S_UpdateAmbientSet(), trap_SetUserCmdValue(), vehicleInfo_t::type, ui_myteam, va(), vmCvar_t::value, vec3_t, vectoangles(), VectorCopy, VectorNormalize(), VectorSubtract, VH_FIGHTER, refdef_t::viewaxis, refdef_t::vieworg, playerState_s::weapon, cg_t::weaponSelect, WP_EMPLACED_GUN, WP_MELEE, WP_SABER, playerState_s::zoomMode, and cg_t::zoomSensitivity.

Referenced by vmMain().

02439                                                                                            {
02440         int             inwater;
02441         const char *cstr;
02442         float mSensitivity = cg.zoomSensitivity;
02443         float mPitchOverride = 0.0f;
02444         float mYawOverride = 0.0f;
02445         static centity_t *veh = NULL;
02446 #ifdef VEH_CONTROL_SCHEME_4
02447         float mSensitivityOverride = 0.0f;
02448         qboolean bUseFighterPitch = qfalse;
02449         qboolean        isFighter = qfalse;
02450 #endif
02451 
02452         if (cgQueueLoad)
02453         { //do this before you start messing around with adding ghoul2 refents and crap
02454                 CG_ActualLoadDeferredPlayers();
02455                 cgQueueLoad = qfalse;
02456         }
02457 
02458         cg.time = serverTime;
02459         cg.demoPlayback = demoPlayback;
02460 
02461         if (cg.snap && ui_myteam.integer != cg.snap->ps.persistant[PERS_TEAM])
02462         {
02463                 trap_Cvar_Set ( "ui_myteam", va("%i", cg.snap->ps.persistant[PERS_TEAM]) );
02464         }
02465         if (cgs.gametype == GT_SIEGE &&
02466                 cg.snap &&
02467                 cg_siegeClassIndex != cgs.clientinfo[cg.snap->ps.clientNum].siegeIndex)
02468         {
02469                 cg_siegeClassIndex = cgs.clientinfo[cg.snap->ps.clientNum].siegeIndex;
02470                 if (cg_siegeClassIndex == -1)
02471                 {
02472                         trap_Cvar_Set("ui_mySiegeClass", "<none>");
02473                 }
02474                 else
02475                 {
02476                         trap_Cvar_Set("ui_mySiegeClass", bgSiegeClasses[cg_siegeClassIndex].name);
02477                 }
02478         }
02479 
02480         // update cvars
02481         CG_UpdateCvars();
02482 
02483         // if we are only updating the screen as a loading
02484         // pacifier, don't even try to read snapshots
02485         if ( cg.infoScreenText[0] != 0 ) {
02486                 CG_DrawInformation();
02487                 return;
02488         }
02489 
02490         trap_FX_AdjustTime( cg.time );
02491 
02492         CG_RunLightStyles();
02493 
02494         // any looped sounds will be respecified as entities
02495         // are added to the render list
02496         trap_S_ClearLoopingSounds();
02497 
02498         // clear all the render lists
02499         trap_R_ClearScene();
02500 
02501         // set up cg.snap and possibly cg.nextSnap
02502         CG_ProcessSnapshots();
02503 
02504         trap_ROFF_UpdateEntities();
02505 
02506         // if we haven't received any snapshots yet, all
02507         // we can draw is the information screen
02508         if ( !cg.snap || ( cg.snap->snapFlags & SNAPFLAG_NOT_ACTIVE ) )
02509         {
02510 #if 0   
02511                 // Transition from zero to negative one on the snapshot timeout.
02512                 // The reason we do this is because the first client frame is responsible for
02513                 // some farily slow processing (such as weather) and we dont want to include
02514                 // that processing time into our calculations
02515                 if ( !cg.snapshotTimeoutTime )
02516                 {
02517                         cg.snapshotTimeoutTime = -1;
02518                 }
02519                 // Transition the snapshot timeout time from -1 to the current time in 
02520                 // milliseconds which will start the timeout.
02521                 else if ( cg.snapshotTimeoutTime == -1 )
02522                 {               
02523                         cg.snapshotTimeoutTime = trap_Milliseconds ( );
02524                 }
02525 
02526                 // If we have been waiting too long then just error out
02527                 if ( cg.snapshotTimeoutTime > 0 && (trap_Milliseconds ( ) - cg.snapshotTimeoutTime > cg_snapshotTimeout.integer * 1000) )
02528                 {
02529                         Com_Error ( ERR_DROP, CG_GetStringEdString("MP_SVGAME", "SNAPSHOT_TIMEOUT"));
02530                         return;
02531                 }
02532 #endif  
02533                 CG_DrawInformation();
02534                 return;
02535         }
02536 
02537         // let the client system know what our weapon and zoom settings are
02538         if (cg.snap && cg.snap->ps.saberLockTime > cg.time)
02539         {
02540                 mSensitivity = 0.01f;
02541         }
02542         else if (cg.predictedPlayerState.weapon == WP_EMPLACED_GUN)
02543         { //lower sens for emplaced guns and vehicles
02544                 mSensitivity = 0.2f;
02545         }
02546 #ifdef VEH_CONTROL_SCHEME_4
02547         else if (cg.predictedPlayerState.m_iVehicleNum//in a vehicle
02548                 && !cg.predictedPlayerState.generic1 )//not as a passenger
02549         {
02550                 centity_t *cent = &cg_entities[cg.predictedPlayerState.m_iVehicleNum];
02551                 if ( cent->m_pVehicle
02552                         && cent->m_pVehicle->m_pVehicleInfo
02553                         && cent->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER )
02554                 {
02555                         BG_VehicleTurnRateForSpeed( cent->m_pVehicle, cent->currentState.speed, &mPitchOverride, &mYawOverride );
02556                         //mSensitivityOverride = 5.0f;//old default value
02557                         mSensitivityOverride = 0.0f;
02558                         bUseFighterPitch = qtrue;
02559                         trap_SetUserCmdValue( cg.weaponSelect, mSensitivity, mPitchOverride, mYawOverride, mSensitivityOverride, cg.forceSelect, cg.itemSelect, bUseFighterPitch );
02560                         isFighter = qtrue;
02561                 }
02562         } 
02563 
02564         if ( !isFighter )
02565 #endif //VEH_CONTROL_SCHEME_4
02566         {
02567                 if (cg.predictedPlayerState.m_iVehicleNum)
02568                 {
02569                         veh = &cg_entities[cg.predictedPlayerState.m_iVehicleNum];
02570                 }
02571                 if (veh &&
02572                         veh->currentState.eType == ET_NPC &&
02573                         veh->currentState.NPC_class == CLASS_VEHICLE &&
02574                         veh->m_pVehicle &&
02575                         veh->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER &&
02576                         bg_fighterAltControl.integer)
02577                 {
02578                         trap_SetUserCmdValue( cg.weaponSelect, mSensitivity, mPitchOverride, mYawOverride, 0.0f, cg.forceSelect, cg.itemSelect, qtrue );
02579                         veh = NULL; //this is done because I don't want an extra assign each frame because I am so perfect and super efficient.
02580                 }
02581                 else
02582                 {
02583                         trap_SetUserCmdValue( cg.weaponSelect, mSensitivity, mPitchOverride, mYawOverride, 0.0f, cg.forceSelect, cg.itemSelect, qfalse );
02584                 }
02585         }
02586 
02587         // this counter will be bumped for every valid scene we generate
02588         cg.clientFrame++;
02589 
02590         // update cg.predictedPlayerState
02591         CG_PredictPlayerState();
02592 
02593         // decide on third person view
02594         cg.renderingThirdPerson = cg_thirdPerson.integer || (cg.snap->ps.stats[STAT_HEALTH] <= 0);
02595 
02596         if (cg.snap->ps.stats[STAT_HEALTH] > 0)
02597         {
02598                 if (cg.predictedPlayerState.weapon == WP_EMPLACED_GUN && cg.predictedPlayerState.emplacedIndex /*&&
02599                         cg_entities[cg.predictedPlayerState.emplacedIndex].currentState.weapon == WP_NONE*/)
02600                 { //force third person for e-web and emplaced use
02601                         cg.renderingThirdPerson = 1;
02602                 }
02603                 else if (cg.predictedPlayerState.weapon == WP_SABER || cg.predictedPlayerState.weapon == WP_MELEE ||
02604                         BG_InGrappleMove(cg.predictedPlayerState.torsoAnim) || BG_InGrappleMove(cg.predictedPlayerState.legsAnim) ||
02605                         cg.predictedPlayerState.forceHandExtend == HANDEXTEND_KNOCKDOWN || cg.predictedPlayerState.fallingToDeath ||
02606                         cg.predictedPlayerState.m_iVehicleNum || PM_InKnockDown(&cg.predictedPlayerState))
02607                 {
02608                         if (cg_fpls.integer && cg.predictedPlayerState.weapon == WP_SABER)
02609                         { //force to first person for fpls
02610                                 cg.renderingThirdPerson = 0;
02611                         }
02612                         else
02613                         {
02614                                 cg.renderingThirdPerson = 1;
02615                         }
02616                 }
02617                 else if (cg.snap->ps.zoomMode)
02618                 { //always force first person when zoomed
02619                         cg.renderingThirdPerson = 0;
02620                 }
02621         }
02622         
02623         if (cg.predictedPlayerState.pm_type == PM_SPECTATOR)
02624         { //always first person for spec
02625                 cg.renderingThirdPerson = 0;
02626         }
02627 
02628 
02629         if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR)
02630         {
02631                 cg.renderingThirdPerson = 0;
02632         }
02633 
02634         // build cg.refdef
02635         inwater = CG_CalcViewValues();
02636 
02637         if (cg_linearFogOverride)
02638         {
02639                 trap_R_SetRangeFog(-cg_linearFogOverride);
02640         }
02641         else if (cg.predictedPlayerState.zoomMode)
02642         { //zooming with binoculars or sniper, set the fog range based on the zoom level -rww
02643                 cg_rangedFogging = qtrue;
02644                 //smaller the fov the less fog we have between the view and cull dist
02645                 trap_R_SetRangeFog(cg.refdef.fov_x*64.0f);
02646         }
02647         else if (cg_rangedFogging)
02648         { //disable it
02649                 cg_rangedFogging = qfalse;
02650                 trap_R_SetRangeFog(0.0f);
02651         }
02652 
02653         cstr = CG_ConfigString(CS_SKYBOXORG);
02654 
02655         if (cstr && cstr[0])
02656         { //we have a skyportal
02657                 CG_DrawSkyBoxPortal(cstr);
02658         }
02659 
02660         CG_CalcScreenEffects();
02661 
02662         // first person blend blobs, done after AnglesToAxis
02663         if ( !cg.renderingThirdPerson && cg.predictedPlayerState.pm_type != PM_SPECTATOR ) {
02664                 CG_DamageBlendBlob();
02665         }
02666 
02667         // build the render lists
02668         if ( !cg.hyperspace ) {
02669                 CG_AddPacketEntities(qfalse);                   // adter calcViewValues, so predicted player state is correct
02670                 CG_AddMarks();
02671                 CG_AddParticles ();
02672                 CG_AddLocalEntities();
02673                 CG_DrawMiscEnts();
02674         }
02675         CG_AddViewWeapon( &cg.predictedPlayerState );
02676 
02677         if ( !cg.hyperspace) 
02678         {
02679                 trap_FX_AddScheduledEffects(qfalse);
02680         }
02681 
02682         // add buffered sounds
02683         CG_PlayBufferedSounds();
02684 
02685         // finish up the rest of the refdef
02686         if ( cg.testModelEntity.hModel ) {
02687                 CG_AddTestModel();
02688         }
02689         cg.refdef.time = cg.time;
02690         memcpy( cg.refdef.areamask, cg.snap->areamask, sizeof( cg.refdef.areamask ) );
02691 
02692         // warning sounds when powerup is wearing off
02693         CG_PowerupTimerSounds();
02694 
02695         // if there are any entities flagged as sound trackers and attached to other entities, update their sound pos
02696         CG_UpdateSoundTrackers();
02697 
02698         if (gCGHasFallVector)
02699         {
02700                 vec3_t lookAng;
02701 
02702                 VectorSubtract(cg.snap->ps.origin, cg.refdef.vieworg, lookAng);
02703                 VectorNormalize(lookAng);
02704                 vectoangles(lookAng, lookAng);
02705 
02706                 VectorCopy(gCGFallVector, cg.refdef.vieworg);
02707                 AnglesToAxis(lookAng, cg.refdef.viewaxis);
02708         }
02709 
02710         //This is done from the vieworg to get origin for non-attenuated sounds
02711         cstr = CG_ConfigString( CS_GLOBAL_AMBIENT_SET );
02712 
02713         if (cstr && cstr[0])
02714         {
02715                 trap_S_UpdateAmbientSet( cstr, cg.refdef.vieworg );
02716         }
02717 
02718         // update audio positions
02719         trap_S_Respatialize( cg.snap->ps.clientNum, cg.refdef.vieworg, cg.refdef.viewaxis, inwater );
02720 
02721         // make sure the lagometerSample and frame timing isn't done twice when in stereo
02722         if ( stereoView != STEREO_RIGHT ) {
02723                 cg.frametime = cg.time - cg.oldTime;
02724                 if ( cg.frametime < 0 ) {
02725                         cg.frametime = 0;
02726                 }
02727                 cg.oldTime = cg.time;
02728                 CG_AddLagometerFrameInfo();
02729         }
02730         if (cg_timescale.value != cg_timescaleFadeEnd.value) {
02731                 if (cg_timescale.value < cg_timescaleFadeEnd.value) {
02732                         cg_timescale.value += cg_timescaleFadeSpeed.value * ((float)cg.frametime) / 1000;
02733                         if (cg_timescale.value > cg_timescaleFadeEnd.value)
02734                                 cg_timescale.value = cg_timescaleFadeEnd.value;
02735                 }
02736                 else {
02737                         cg_timescale.value -= cg_timescaleFadeSpeed.value * ((float)cg.frametime) / 1000;
02738                         if (cg_timescale.value < cg_timescaleFadeEnd.value)
02739                                 cg_timescale.value = cg_timescaleFadeEnd.value;
02740                 }
02741                 if (cg_timescaleFadeSpeed.value) {
02742                         trap_Cvar_Set("timescale", va("%f", cg_timescale.value));
02743                 }
02744         }
02745 
02746         // actually issue the rendering calls
02747         CG_DrawActive( stereoView );
02748 
02749         CG_DrawAutoMap();
02750 
02751         if ( cg_stats.integer ) {
02752                 CG_Printf( "cg.clientFrame:%i\n", cg.clientFrame );
02753         }
02754 }

void CG_DrawAutoMap void   ) 
 

Definition at line 2276 of file cg_view.c.

References trace_t::allsolid, AnglesToAxis(), AngleVectors(), cg, CG_AddRadarAutomapEnts(), cg_autoMap, cg_autoMapAngle, cg_autoMapH, cg_autoMapInput, cg_autoMapInputTime, cg_autoMapW, cg_autoMapX, cg_autoMapY, cg_autoMapZoom, cg_autoMapZoomMainOffset, CG_DrawPic(), cg_entities, CG_Trace(), cgs, CLASS_VEHICLE, cgs_t::clientinfo, playerState_s::clientNum, DEFAULT_MAXS_2, DEFAULT_MINS_2, autoMapInput_t::down, trace_t::endpos, ET_NPC, refdef_t::fov_x, refdef_t::fov_y, cgs_t::gametype, autoMapInput_t::goToDefaults, GT_TEAM, refdef_t::height, clientInfo_t::infoValid, vmCvar_t::integer, playerState_s::m_iVehicleNum, MASK_SOLID, cgs_t::media, memset(), playerState_s::origin, PERS_TEAM, playerState_s::persistant, PITCH, autoMapInput_t::pitch, playerMaxs, playerMins, playerState_s::pm_flags, PMF_FOLLOW, cg_t::predictedPlayerState, snapshot_t::ps, RDF_AUTOMAP, RDF_NOWORLDMODEL, refdef_t::rdflags, SIDEFRAME_HEIGHT, SIDEFRAME_WIDTH, cg_t::snap, trace_t::startsolid, STAT_HEALTH, playerState_s::stats, TEAM_SPECTATOR, refdef_t::time, cg_t::time, trap_R_AutomapElevAdj(), trap_R_ClearScene(), trap_R_GetRealRes(), trap_R_RenderScene(), autoMapInput_t::up, vmCvar_t::value, vec3_t, VectorCopy, VectorMA, VectorSet, VH_FIGHTER, refdef_t::viewangles, refdef_t::viewaxis, refdef_t::vieworg, refdef_t::width, cgMedia_t::wireframeAutomapFrame_bottom, cgMedia_t::wireframeAutomapFrame_left, cgMedia_t::wireframeAutomapFrame_right, cgMedia_t::wireframeAutomapFrame_top, refdef_t::x, refdef_t::y, YAW, and autoMapInput_t::yaw.

Referenced by CG_DrawActiveFrame().

02277 {
02278         clientInfo_t    *local;
02279         refdef_t                refdef;
02280         trace_t                 tr;
02281         vec3_t                  fwd;
02282         vec3_t                  playerMins, playerMaxs;
02283         int                             vWidth, vHeight;
02284         float                   hScale, vScale;
02285         float                   x, y, w, h;
02286 
02287         if (!cg_autoMap.integer)
02288         { //don't do anything then
02289                 return;
02290         }
02291 
02292         if ( cg.snap->ps.stats[STAT_HEALTH] <= 0 )
02293         { //don't show when dead
02294                 return;
02295         }
02296 
02297         if ( (cg.predictedPlayerState.pm_flags & PMF_FOLLOW) || cg.predictedPlayerState.persistant[PERS_TEAM] == TEAM_SPECTATOR )
02298         { //don't show when spec
02299                 return;
02300         }
02301 
02302         local = &cgs.clientinfo[ cg.predictedPlayerState.clientNum ];
02303         if ( !local->infoValid )
02304         { //don't show if bad ci
02305                 return;
02306         }
02307 
02308         if (cgs.gametype < GT_TEAM)
02309         { //don't show in non-team gametypes
02310                 return;
02311         }
02312 
02313         if (cg_autoMapInputTime >= cg.time)
02314         {
02315                 if (cg_autoMapInput.up)
02316                 {
02317                         cg_autoMapZoom -= cg_autoMapInput.up;
02318                         if (cg_autoMapZoom < cg_autoMapZoomMainOffset+64.0f)
02319                         {
02320                                 cg_autoMapZoom = cg_autoMapZoomMainOffset+64.0f;
02321                         }
02322                 }
02323 
02324                 if (cg_autoMapInput.down)
02325                 {
02326                         cg_autoMapZoom += cg_autoMapInput.down;
02327                         if (cg_autoMapZoom > cg_autoMapZoomMainOffset+4096.0f)
02328                         {
02329                                 cg_autoMapZoom = cg_autoMapZoomMainOffset+4096.0f;
02330                         }
02331                 }
02332 
02333                 if (cg_autoMapInput.yaw)
02334                 {
02335                         cg_autoMapAngle[YAW] += cg_autoMapInput.yaw;
02336                 }
02337 
02338                 if (cg_autoMapInput.pitch)
02339                 {
02340                         cg_autoMapAngle[PITCH] += cg_autoMapInput.pitch;
02341                 }
02342 
02343                 if (cg_autoMapInput.goToDefaults)
02344                 {
02345                         cg_autoMapZoom = 512.0f;
02346                         VectorSet(cg_autoMapAngle, 90.0f, 0.0f, 0.0f);
02347                 }
02348         }
02349 
02350         memset( &refdef, 0, sizeof( refdef ) );
02351 
02352         refdef.rdflags = (RDF_NOWORLDMODEL|RDF_AUTOMAP);
02353 
02354         VectorCopy(cg.predictedPlayerState.origin, refdef.vieworg);
02355         VectorCopy(cg_autoMapAngle, refdef.viewangles);
02356         
02357         //scale out in the direction of the view angles base on the zoom factor
02358         AngleVectors(refdef.viewangles, fwd, 0, 0);
02359         VectorMA(refdef.vieworg, -cg_autoMapZoom, fwd, refdef.vieworg);
02360 
02361         AnglesToAxis(refdef.viewangles, refdef.viewaxis);
02362 
02363         refdef.fov_x = 50;
02364         refdef.fov_y = 50;
02365 
02366         //guess this doesn't need to be done every frame, but eh
02367         trap_R_GetRealRes(&vWidth, &vHeight);
02368 
02369         //set scaling values so that the 640x480 will result at 1.0/1.0
02370         hScale = vWidth/640.0f;
02371         vScale = vHeight/480.0f;
02372 
02373         x = cg_autoMapX.value;
02374         y = cg_autoMapY.value;
02375         w = cg_autoMapW.value;
02376         h = cg_autoMapH.value;
02377 
02378         refdef.x = x*hScale;
02379         refdef.y = y*vScale;
02380         refdef.width = w*hScale;
02381         refdef.height = h*vScale;
02382 
02383         CG_DrawPic(x-SIDEFRAME_WIDTH, y, SIDEFRAME_WIDTH, h, cgs.media.wireframeAutomapFrame_left);
02384         CG_DrawPic(x+w, y, SIDEFRAME_WIDTH, h, cgs.media.wireframeAutomapFrame_right);
02385         CG_DrawPic(x-SIDEFRAME_WIDTH, y-SIDEFRAME_HEIGHT, w+(SIDEFRAME_WIDTH*2), SIDEFRAME_HEIGHT, cgs.media.wireframeAutomapFrame_top);
02386         CG_DrawPic(x-SIDEFRAME_WIDTH, y+h, w+(SIDEFRAME_WIDTH*2), SIDEFRAME_HEIGHT, cgs.media.wireframeAutomapFrame_bottom);
02387 
02388         refdef.time = cg.time;
02389 
02390         trap_R_ClearScene();
02391         CG_AddRadarAutomapEnts();
02392 
02393         if (cg.predictedPlayerState.m_iVehicleNum &&
02394                 cg_entities[cg.predictedPlayerState.m_iVehicleNum].currentState.eType == ET_NPC &&
02395                 cg_entities[cg.predictedPlayerState.m_iVehicleNum].currentState.NPC_class == CLASS_VEHICLE &&
02396                 cg_entities[cg.predictedPlayerState.m_iVehicleNum].m_pVehicle &&
02397                 cg_entities[cg.predictedPlayerState.m_iVehicleNum].m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER)
02398         { //constantly adjust to current height
02399                 trap_R_AutomapElevAdj(cg.predictedPlayerState.origin[2]);
02400         }
02401         else
02402         {
02403                 //Trace down and set the ground elevation as the main automap elevation point
02404                 VectorSet(playerMins, -15, -15, DEFAULT_MINS_2);
02405                 VectorSet(playerMaxs, 15, 15, DEFAULT_MAXS_2);
02406 
02407                 VectorCopy(cg.predictedPlayerState.origin, fwd);
02408                 fwd[2] -= 4096.0f;
02409                 CG_Trace(&tr, cg.predictedPlayerState.origin, playerMins, playerMaxs, fwd, cg.predictedPlayerState.clientNum, MASK_SOLID);
02410 
02411                 if (!tr.startsolid && !tr.allsolid)
02412                 {
02413                         trap_R_AutomapElevAdj(tr.endpos[2]);
02414                 }
02415         }
02416         trap_R_RenderScene( &refdef );
02417 }

void CG_DrawSkyBoxPortal const char *  cstr  ) 
 

Definition at line 1740 of file cg_view.c.

References atan2(), atof(), atoi(), cg, CG_AddPacketEntities(), CG_Error(), cg_fov, cg_noFogOutsidePortal, cg_skyOri, cg_skyOriPos, cg_skyOriScale, COM_ParseExt(), refdef_t::fov_x, refdef_t::fov_y, refdef_t::height, cg_t::hyperspace, M_PI, PM_INTERMISSION, playerState_s::pm_type, cg_t::predictedPlayerState, qfalse, qtrue, RDF_DRAWSKYBOX, RDF_NOFOG, RDF_SKYBOXPORTAL, refdef_t::rdflags, cg_t::refdef, tan(), refdef_t::time, cg_t::time, trap_FX_AddScheduledEffects(), trap_R_RenderScene(), vmCvar_t::value, vec3_t, vec4_t, VectorAdd, VectorScale, VectorSubtract, refdef_t::vieworg, refdef_t::width, ZOOM_OUT_TIME, zoomFov, playerState_s::zoomMode, and cg_t::zoomTime.

Referenced by CG_DrawActiveFrame().

01741 {
01742         static float lastfov;
01743         refdef_t backuprefdef;
01744         float fov_x;
01745         float fov_y;
01746         float x;
01747         char *token;
01748         float f = 0;
01749 
01750         lastfov = zoomFov;      // for transitions back from zoomed in modes
01751 
01752         backuprefdef = cg.refdef;
01753 
01754         token = COM_ParseExt(&cstr, qfalse);
01755         if (!token || !token[0])
01756         {
01757                 CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring\n");
01758         }
01759         cg.refdef.vieworg[0] = atof(token);
01760 
01761         token = COM_ParseExt(&cstr, qfalse);
01762         if (!token || !token[0])
01763         {
01764                 CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring\n");
01765         }
01766         cg.refdef.vieworg[1] = atof(token);
01767 
01768         token = COM_ParseExt(&cstr, qfalse);
01769         if (!token || !token[0])
01770         {
01771                 CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring\n");
01772         }
01773         cg.refdef.vieworg[2] = atof(token);
01774 
01775         token = COM_ParseExt(&cstr, qfalse);
01776         if (!token || !token[0]) 
01777         {
01778                 CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring\n");
01779         }
01780         fov_x = atoi(token);
01781 
01782         if (!fov_x)
01783         {
01784                 fov_x = cg_fov.value;
01785         }
01786 
01787         // setup fog the first time, ignore this part of the configstring after that
01788         token = COM_ParseExt(&cstr, qfalse);
01789         if (!token || !token[0])
01790         {
01791                 CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring.  No fog state\n");
01792         }
01793         else 
01794         {
01795                 vec4_t  fogColor;
01796                 int             fogStart, fogEnd;
01797 
01798                 if(atoi(token))
01799                 {       // this camera has fog
01800                         token = COM_ParseExt(&cstr, qfalse);
01801 
01802                         if (!token || !token[0])
01803                         {
01804                                 CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring.  No fog[0]\n");
01805                         }
01806                         fogColor[0] = atof(token);
01807 
01808                         token = COM_ParseExt(&cstr, qfalse);
01809                         if (!token || !token[0])
01810                         {
01811                                 CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring.  No fog[1]\n");
01812                         }
01813                         fogColor[1] = atof(token);
01814 
01815                         token = COM_ParseExt(&cstr, qfalse);
01816                         if (!token || !token[0])
01817                         {
01818                                 CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring.  No fog[2]\n");
01819                         }
01820                         fogColor[2] = atof(token);
01821 
01822                         token = COM_ParseExt(&cstr, qfalse);
01823                         if (!token || !token[0])
01824                         {
01825                                 fogStart = 0;
01826                         }
01827                         else
01828                         {
01829                                 fogStart = atoi(token);
01830                         }
01831 
01832                         token = COM_ParseExt(&cstr, qfalse);
01833                         if (!token || !token[0])
01834                         {
01835                                 fogEnd = 0;
01836                         }
01837                         else
01838                         {
01839                                 fogEnd = atoi(token);
01840                         }
01841                 }
01842         }
01843 
01844         if ( cg.predictedPlayerState.pm_type == PM_INTERMISSION )
01845         {
01846                 // if in intermission, use a fixed value
01847                 fov_x = cg_fov.value;
01848         }
01849         else
01850         {
01851                 fov_x = cg_fov.value;
01852                 if ( fov_x < 1 ) 
01853                 {
01854                         fov_x = 1;
01855                 }
01856                 else if ( fov_x > 160 )
01857                 {
01858                         fov_x = 160;
01859                 }
01860 
01861                 if (cg.predictedPlayerState.zoomMode)
01862                 {
01863                         fov_x = zoomFov;
01864                 }
01865 
01866                 // do smooth transitions for zooming
01867                 if (cg.predictedPlayerState.zoomMode)
01868                 { //zoomed/zooming in
01869                         f = ( cg.time - cg.zoomTime ) / (float)ZOOM_OUT_TIME;
01870                         if ( f > 1.0 ) {
01871                                 fov_x = zoomFov;
01872                         } else {
01873                                 fov_x = fov_x + f * ( zoomFov - fov_x );
01874                         }
01875                         lastfov = fov_x;
01876                 }
01877                 else
01878                 { //zooming out
01879                         f = ( cg.time - cg.zoomTime ) / (float)ZOOM_OUT_TIME;
01880                         if ( f > 1.0 ) {
01881                                 fov_x = fov_x;
01882                         } else {
01883                                 fov_x = zoomFov + f * ( fov_x - zoomFov);
01884                         }
01885                 }
01886         }
01887 
01888         x = cg.refdef.width / tan( fov_x / 360 * M_PI );
01889         fov_y = atan2( cg.refdef.height, x );
01890         fov_y = fov_y * 360 / M_PI;
01891 
01892         cg.refdef.fov_x = fov_x;
01893         cg.refdef.fov_y = fov_y;
01894         
01895         cg.refdef.rdflags |= RDF_SKYBOXPORTAL;
01896         cg.refdef.rdflags |= RDF_DRAWSKYBOX;
01897 
01898         cg.refdef.time = cg.time;
01899 
01900         if ( !cg.hyperspace) 
01901         { //rww - also had to add this to add effects being rendered in portal sky areas properly.
01902                 trap_FX_AddScheduledEffects(qtrue);
01903         }
01904 
01905         CG_AddPacketEntities(qtrue); //rww - There was no proper way to put real entities inside the portal view before.
01906                                                                         //This will put specially flagged entities in the render.
01907 
01908         if (cg_skyOri)
01909         { //ok, we want to orient the sky refdef vieworg based on the normal vieworg's relation to the ori pos
01910                 vec3_t dif;
01911 
01912                 VectorSubtract(backuprefdef.vieworg, cg_skyOriPos, dif);
01913                 VectorScale(dif, cg_skyOriScale, dif);
01914                 VectorAdd(cg.refdef.vieworg, dif, cg.refdef.vieworg);
01915         }
01916 
01917         if (cg_noFogOutsidePortal)
01918         { //make sure no fog flag is stripped first, and make sure it is set on the normal refdef
01919                 cg.refdef.rdflags &= ~RDF_NOFOG;
01920                 backuprefdef.rdflags |= RDF_NOFOG;
01921         }
01922 
01923         // draw the skybox
01924         trap_R_RenderScene( &cg.refdef );
01925 
01926         cg.refdef = backuprefdef;
01927 }

void CG_EmplacedView vec3_t  angles  ) 
 

Definition at line 2177 of file cg_view.c.

References AnglesToAxis(), BG_EmplacedView(), cg, cg_entities, playerState_s::emplacedIndex, cg_t::predictedPlayerState, snapshot_t::ps, cg_t::refdef, cg_t::snap, cg_t::time, trap_SetClientForceAngle(), vec3_t, playerState_s::viewangles, refdef_t::viewangles, refdef_t::viewaxis, and YAW.

02178 {
02179         float yaw;
02180         int override;
02181         
02182         override = BG_EmplacedView(cg.refdef.viewangles, angles, &yaw,
02183                 cg_entities[cg.snap->ps.emplacedIndex].currentState.origin2[0]);
02184         
02185         if (override)
02186         {
02187         cg.refdef.viewangles[YAW] = yaw;
02188                 AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis);
02189 
02190                 if (override == 2)
02191                 {
02192                         trap_SetClientForceAngle(cg.time + 5000, cg.refdef.viewangles);
02193                 }
02194         }
02195 
02196         //we want to constrain the predicted player state viewangles as well
02197         override = BG_EmplacedView(cg.predictedPlayerState.viewangles, angles, &yaw,
02198                 cg_entities[cg.snap->ps.emplacedIndex].currentState.origin2[0]);
02199         if (override)
02200         {
02201         cg.predictedPlayerState.viewangles[YAW] = yaw;
02202         }
02203 }

void CG_GetVehicleCamPos vec3_t  camPos  ) 
 

Definition at line 797 of file cg_view.c.

References cg, cg_t::refdef, vec3_t, VectorCopy, and refdef_t::vieworg.

Referenced by BG_VehTraceFromCamPos().

00798 {
00799         VectorCopy( cg.refdef.vieworg, camPos );
00800 }

void CG_SE_UpdateMusic void   ) 
 

Definition at line 2043 of file cg_view.c.

References cg, cgScreenEffects, Com_sprintf(), cgscreffects_s::music_volume_multiplier, cgscreffects_s::music_volume_set, cgscreffects_s::music_volume_time, qfalse, qtrue, cg_t::time, and trap_Cvar_Set().

Referenced by CG_CalcScreenEffects().

02044 {
02045         if (cgScreenEffects.music_volume_multiplier < 0.1)
02046         {
02047                 cgScreenEffects.music_volume_multiplier = 1.0;
02048                 return;
02049         }
02050 
02051         if (cgScreenEffects.music_volume_time < cg.time)
02052         {
02053                 if (cgScreenEffects.music_volume_multiplier != 1.0 || cgScreenEffects.music_volume_set)
02054                 {
02055                         char musMultStr[512];
02056 
02057                         cgScreenEffects.music_volume_multiplier += 0.1;
02058                         if (cgScreenEffects.music_volume_multiplier > 1.0)
02059                         {
02060                                 cgScreenEffects.music_volume_multiplier = 1.0;
02061                         }
02062 
02063                         Com_sprintf(musMultStr, sizeof(musMultStr), "%f", cgScreenEffects.music_volume_multiplier);
02064                         trap_Cvar_Set("s_musicMult", musMultStr);
02065 
02066                         if (cgScreenEffects.music_volume_multiplier == 1.0)
02067                         {
02068                                 cgScreenEffects.music_volume_set = qfalse;
02069                         }
02070                         else
02071                         {
02072                                 cgScreenEffects.music_volume_time = cg.time + 200;
02073                         }
02074                 }
02075 
02076                 return;
02077         }
02078 
02079         if (!cgScreenEffects.music_volume_set)
02080         { //if the volume_time is >= cg.time, we should have a volume multiplier set
02081                 char musMultStr[512];
02082 
02083                 Com_sprintf(musMultStr, sizeof(musMultStr), "%f", cgScreenEffects.music_volume_multiplier);
02084                 trap_Cvar_Set("s_musicMult", musMultStr);
02085                 cgScreenEffects.music_volume_set = qtrue;
02086         }
02087 }

void CG_SE_UpdateShake vec3_t  origin,
vec3_t  angles
 

Definition at line 2003 of file cg_view.c.

References CAMERA_DEFAULT_FOV, cg, cgScreenEffects, crandom, cgscreffects_s::FOV, cgscreffects_s::FOV2, cgscreffects_s::shake_duration, cgscreffects_s::shake_intensity, cgscreffects_s::shake_start, cg_t::time, vec3_t, and VectorAdd.

Referenced by CG_CalcScreenEffects().

02004 {
02005         vec3_t  moveDir;
02006         float   intensity_scale, intensity;
02007         int             i;
02008 
02009         if ( cgScreenEffects.shake_duration <= 0 )
02010                 return;
02011 
02012         if ( cg.time > ( cgScreenEffects.shake_start + cgScreenEffects.shake_duration ) )
02013         {
02014                 cgScreenEffects.shake_intensity = 0;
02015                 cgScreenEffects.shake_duration = 0;
02016                 cgScreenEffects.shake_start = 0;
02017                 return;
02018         }
02019 
02020         cgScreenEffects.FOV = CAMERA_DEFAULT_FOV;
02021         cgScreenEffects.FOV2 = CAMERA_DEFAULT_FOV;
02022 
02023         //intensity_scale now also takes into account FOV with 90.0 as normal
02024         intensity_scale = 1.0f - ( (float) ( cg.time - cgScreenEffects.shake_start ) / (float) cgScreenEffects.shake_duration ) * (((cgScreenEffects.FOV+cgScreenEffects.FOV2)/2.0f)/90.0f);
02025 
02026         intensity = cgScreenEffects.shake_intensity * intensity_scale;
02027 
02028         for ( i = 0; i < 3; i++ )
02029         {
02030                 moveDir[i] = ( crandom() * intensity );
02031         }
02032 
02033         //Move the camera
02034         VectorAdd( origin, moveDir, origin );
02035 
02036         for ( i=0; i < 2; i++ ) // Don't do ROLL
02037                 moveDir[i] = ( crandom() * intensity );
02038 
02039         //Move the angles
02040         VectorAdd( angles, moveDir, angles );
02041 }

void CG_TestGun_f void   ) 
 

Definition at line 98 of file cg_view.c.

References cg, CG_TestModel_f(), qtrue, refEntity_t::renderfx, RF_DEPTHHACK, RF_FIRST_PERSON, cg_t::testGun, and cg_t::testModelEntity.

00098                          {
00099         CG_TestModel_f();
00100         cg.testGun = qtrue;
00101         //cg.testModelEntity.renderfx = RF_MINLIGHT | RF_DEPTHHACK | RF_FIRST_PERSON;
00102 
00103         // rww - 9-13-01 [1-26-01-sof2]
00104         cg.testModelEntity.renderfx = RF_DEPTHHACK | RF_FIRST_PERSON;
00105 }

void CG_TestModel_f void   ) 
 

Definition at line 60 of file cg_view.c.

References AnglesToAxis(), atof(), refEntity_t::axis, refEntity_t::backlerp, cg, CG_Argv(), CG_Printf(), refEntity_t::frame, refEntity_t::hModel, MAX_QPATH, memset(), refEntity_t::oldframe, refEntity_t::origin, PITCH, Q_strncpyz(), qfalse, cg_t::refdef, ROLL, cg_t::testGun, cg_t::testModelEntity, cg_t::testModelName, trap_Argc(), trap_R_RegisterModel(), vec3_t, VectorMA, refdef_t::viewangles, refdef_t::viewaxis, refdef_t::vieworg, and YAW.

Referenced by CG_TestGun_f().

00060                            {
00061         vec3_t          angles;
00062 
00063         memset( &cg.testModelEntity, 0, sizeof(cg.testModelEntity) );
00064         if ( trap_Argc() < 2 ) {
00065                 return;
00066         }
00067 
00068         Q_strncpyz (cg.testModelName, CG_Argv( 1 ), MAX_QPATH );
00069         cg.testModelEntity.hModel = trap_R_RegisterModel( cg.testModelName );
00070 
00071         if ( trap_Argc() == 3 ) {
00072                 cg.testModelEntity.backlerp = atof( CG_Argv( 2 ) );
00073                 cg.testModelEntity.frame = 1;
00074                 cg.testModelEntity.oldframe = 0;
00075         }
00076         if (! cg.testModelEntity.hModel ) {
00077                 CG_Printf( "Can't register model\n" );
00078                 return;
00079         }
00080 
00081         VectorMA( cg.refdef.vieworg, 100, cg.refdef.viewaxis[0], cg.testModelEntity.origin );
00082 
00083         angles[PITCH] = 0;
00084         angles[YAW] = 180 + cg.refdef.viewangles[1];
00085         angles[ROLL] = 0;
00086 
00087         AnglesToAxis( angles, cg.testModelEntity.axis );
00088         cg.testGun = qfalse;
00089 }

void CG_TestModelNextFrame_f void   ) 
 

Definition at line 108 of file cg_view.c.

References cg, CG_Printf(), refEntity_t::frame, and cg_t::testModelEntity.

00108                                     {
00109         cg.testModelEntity.frame++;
00110         CG_Printf( "frame %i\n", cg.testModelEntity.frame );
00111 }

void CG_TestModelNextSkin_f void   ) 
 

Definition at line 121 of file cg_view.c.

References cg, CG_Printf(), refEntity_t::skinNum, and cg_t::testModelEntity.

00121                                    {
00122         cg.testModelEntity.skinNum++;
00123         CG_Printf( "skin %i\n", cg.testModelEntity.skinNum );
00124 }

void CG_TestModelPrevFrame_f void   ) 
 

Definition at line 113 of file cg_view.c.

References cg, CG_Printf(), refEntity_t::frame, and cg_t::testModelEntity.

00113                                     {
00114         cg.testModelEntity.frame--;
00115         if ( cg.testModelEntity.frame < 0 ) {
00116                 cg.testModelEntity.frame = 0;
00117         }
00118         CG_Printf( "frame %i\n", cg.testModelEntity.frame );
00119 }

void CG_TestModelPrevSkin_f void   ) 
 

Definition at line 126 of file cg_view.c.

References cg, CG_Printf(), refEntity_t::skinNum, and cg_t::testModelEntity.

00126                                    {
00127         cg.testModelEntity.skinNum--;
00128         if ( cg.testModelEntity.skinNum < 0 ) {
00129                 cg.testModelEntity.skinNum = 0;
00130         }
00131         CG_Printf( "skin %i\n", cg.testModelEntity.skinNum );
00132 }

void CG_UpdateSoundTrackers  ) 
 

Definition at line 1960 of file cg_view.c.

References centity_t, cg, cg_entities, CG_S_UpdateLoopingSounds(), playerState_s::clientNum, centity_s::currentState, EF_SOUNDTRACKER, entityState_s::eFlags, ENTITYNUM_NONE, centity_s::lerpOrigin, entityState_s::number, snapshot_t::ps, cg_t::refdef, cg_t::snap, trap_S_UpdateEntityPosition(), entityState_s::trickedentindex, VectorCopy, and refdef_t::vieworg.

Referenced by CG_DrawActiveFrame().

01961 {
01962         int num;
01963         centity_t *cent;
01964 
01965         for ( num = 0 ; num < ENTITYNUM_NONE ; num++ )
01966         {
01967                 cent = &cg_entities[num];
01968 
01969                 if (cent && (cent->currentState.eFlags & EF_SOUNDTRACKER) && cent->currentState.number == num)
01970                         //make sure the thing is valid at least.
01971                 { //keep sound for this entity updated in accordance with its attached entity at all times
01972                         if (cg.snap && cent->currentState.trickedentindex == cg.snap->ps.clientNum)
01973                         { //this is actually the player, so center the sound origin right on top of us
01974                                 VectorCopy(cg.refdef.vieworg, cent->lerpOrigin);
01975                                 trap_S_UpdateEntityPosition( cent->currentState.number, cent->lerpOrigin );
01976                         }
01977                         else
01978                         {
01979                                 trap_S_UpdateEntityPosition( cent->currentState.number, cg_entities[cent->currentState.trickedentindex].lerpOrigin );
01980                         }
01981                 }
01982 
01983                 if (cent->currentState.number == num)
01984                 {
01985                         //update all looping sounds..
01986                         CG_S_UpdateLoopingSounds(num);
01987                 }
01988         }
01989 }

void CG_ZoomDown_f void   ) 
 

Definition at line 1105 of file cg_view.c.

References cg, qtrue, cg_t::time, cg_t::zoomed, and cg_t::zoomTime.

01105                            { 
01106         if ( cg.zoomed ) {
01107                 return;
01108         }
01109         cg.zoomed = qtrue;
01110         cg.zoomTime = cg.time;
01111 }

void CG_ZoomUp_f void   ) 
 

Definition at line 1113 of file cg_view.c.

References cg, qfalse, cg_t::time, cg_t::zoomed, and cg_t::zoomTime.

01113                          { 
01114         if ( !cg.zoomed ) {
01115                 return;
01116         }
01117         cg.zoomed = qfalse;
01118         cg.zoomTime = cg.time;
01119 }

void CGCam_SetMusicMult float  multiplier,
int  duration
 

Definition at line 2143 of file cg_view.c.

References cg, cgScreenEffects, cgscreffects_s::music_volume_multiplier, cgscreffects_s::music_volume_set, cgscreffects_s::music_volume_time, qfalse, and cg_t::time.

Referenced by CG_EntityEvent().

02144 {
02145         if (multiplier < 0.1f)
02146         {
02147                 multiplier = 0.1f;
02148         }
02149 
02150         if (multiplier > 1.0f)
02151         {
02152                 multiplier = 1.0f;
02153         }
02154 
02155         cgScreenEffects.music_volume_multiplier = multiplier;
02156         cgScreenEffects.music_volume_time = cg.time + duration;
02157         cgScreenEffects.music_volume_set = qfalse;
02158 }

void CGCam_Shake float  intensity,
int  duration
 

Definition at line 2102 of file cg_view.c.

References cg, cgScreenEffects, MAX_SHAKE_INTENSITY, cgscreffects_s::shake_duration, cgscreffects_s::shake_intensity, cgscreffects_s::shake_start, and cg_t::time.

Referenced by CG_AddPlayerWeapon(), CG_DoCameraShake(), CG_EntityEvent(), CG_ExplosionEffects(), and CG_FireWeapon().

02103 {
02104         if ( intensity > MAX_SHAKE_INTENSITY )
02105                 intensity = MAX_SHAKE_INTENSITY;
02106 
02107         cgScreenEffects.shake_intensity = intensity;
02108         cgScreenEffects.shake_duration = duration;
02109         
02110 
02111         cgScreenEffects.shake_start = cg.time;
02112 //JLFRUMBLE
02113 #ifdef _XBOX
02114 extern void FF_XboxShake(float intensity, int duration);
02115 
02116 FF_XboxShake(intensity, duration);
02117 
02118 #endif
02119 }

qboolean PM_InKnockDown playerState_t ps  ) 
 

Definition at line 1216 of file bg_panimate.c.

01217 {
01218         switch ( (ps->legsAnim) )
01219         {
01220         case BOTH_KNOCKDOWN1:
01221         case BOTH_KNOCKDOWN2:
01222         case BOTH_KNOCKDOWN3:
01223         case BOTH_KNOCKDOWN4:
01224         case BOTH_KNOCKDOWN5:
01225                 return qtrue;
01226                 break;
01227         case BOTH_GETUP1:
01228         case BOTH_GETUP2:
01229         case BOTH_GETUP3:
01230         case BOTH_GETUP4:
01231         case BOTH_GETUP5:
01232         case BOTH_FORCE_GETUP_F1:
01233         case BOTH_FORCE_GETUP_F2:
01234         case BOTH_FORCE_GETUP_B1:
01235         case BOTH_FORCE_GETUP_B2:
01236         case BOTH_FORCE_GETUP_B3:
01237         case BOTH_FORCE_GETUP_B4:
01238         case BOTH_FORCE_GETUP_B5:
01239         case BOTH_GETUP_BROLL_B:
01240         case BOTH_GETUP_BROLL_F:
01241         case BOTH_GETUP_BROLL_L:
01242         case BOTH_GETUP_BROLL_R:
01243         case BOTH_GETUP_FROLL_B:
01244         case BOTH_GETUP_FROLL_F:
01245         case BOTH_GETUP_FROLL_L:
01246         case BOTH_GETUP_FROLL_R:
01247                 if ( ps->legsTimer )
01248                 {
01249                         return qtrue;
01250                 }
01251                 break;
01252         }
01253         return qfalse;
01254 }


Variable Documentation

vec3_t cameraCurTarget = {0,0,0} cameraCurLoc={0,0,0}
 

Definition at line 227 of file cg_view.c.

Referenced by G_EstimateCamPos().

vec3_t cameraFocusAngles
 

Definition at line 225 of file cg_view.c.

Referenced by G_EstimateCamPos().

vec3_t cameraFocusLoc
 

Definition at line 225 of file cg_view.c.

Referenced by G_EstimateCamPos().

vec3_t camerafwd
 

Definition at line 223 of file cg_view.c.

Referenced by G_EstimateCamPos().

vec3_t cameraIdealLoc
 

Definition at line 226 of file cg_view.c.

Referenced by G_EstimateCamPos().

vec3_t cameraIdealTarget
 

Definition at line 226 of file cg_view.c.

Referenced by G_EstimateCamPos().

int cameraLastFrame = 0
 

Definition at line 229 of file cg_view.c.

float cameraLastYaw = 0
 

Definition at line 231 of file cg_view.c.

vec3_t cameraOldLoc = {0,0,0} cameraNewLoc={0,0,0}
 

Definition at line 228 of file cg_view.c.

float cameraStiffFactor = 0.0f
 

Definition at line 232 of file cg_view.c.

vec3_t cameraup
 

Definition at line 223 of file cg_view.c.

Referenced by G_EstimateCamPos().

vec3_t cg_actionCamLastPos
 

Definition at line 1397 of file cg_view.c.

int cg_actionCamLastTime = 0
 

Definition at line 1396 of file cg_view.c.

vec3_t cg_autoMapAngle = {90.0f, 0.0f, 0.0f}
 

Definition at line 2271 of file cg_view.c.

Referenced by CG_DrawAutoMap(), and vmMain().

autoMapInput_t cg_autoMapInput
 

Definition at line 2272 of file cg_view.c.

Referenced by CG_DrawAutoMap(), and vmMain().

int cg_autoMapInputTime = 0
 

Definition at line 2273 of file cg_view.c.

Referenced by CG_DrawAutoMap(), and vmMain().

float cg_autoMapZoom = 512.0f
 

Definition at line 2269 of file cg_view.c.

Referenced by CG_DrawAutoMap().

float cg_autoMapZoomMainOffset = 0.0f
 

Definition at line 2270 of file cg_view.c.

Referenced by CG_DrawAutoMap().

vec3_t cg_lastTurretViewAngles = {0}
 

Definition at line 1476 of file cg_view.c.

Referenced by CG_CheckPassengerTurretView().

float cg_linearFogOverride = 0.0f
 

Definition at line 2427 of file cg_view.c.

Referenced by CG_DrawActiveFrame(), and CG_SpawnCGameEntFromVars().

qboolean cg_noFogOutsidePortal
 

Definition at line 1739 of file cg_view.c.

Referenced by CG_CreateSkyPortalFromSpawnEnt(), and CG_DrawSkyBoxPortal().

qboolean cg_skyOri
 

Definition at line 1736 of file cg_view.c.

Referenced by CG_CreateSkyOriFromSpawnEnt(), and CG_DrawSkyBoxPortal().

vec3_t cg_skyOriPos
 

Definition at line 1737 of file cg_view.c.

Referenced by CG_CreateSkyOriFromSpawnEnt(), and CG_DrawSkyBoxPortal().

float cg_skyOriScale
 

Definition at line 1738 of file cg_view.c.

Referenced by CG_CreateSkyOriFromSpawnEnt(), and CG_DrawSkyBoxPortal().

vmCvar_t cg_thirdPersonHorzOffset
 

Definition at line 601 of file cg_view.c.

qboolean cgQueueLoad
 

Definition at line 2434 of file cg_view.c.

Referenced by CG_DrawActiveFrame(), and CG_LoadDeferredPlayers().

cgscreffects_t cgScreenEffects
 

Definition at line 2001 of file cg_view.c.

Referenced by CG_SE_UpdateMusic(), CG_SE_UpdateShake(), CGCam_SetMusicMult(), and CGCam_Shake().

vec3_t gCGFallVector
 

Definition at line 249 of file cg_view.c.

Referenced by CG_DrawActiveFrame().

qboolean gCGHasFallVector
 

Definition at line 248 of file cg_view.c.

Referenced by CG_DrawActiveFrame().

float zoomFov
 

Definition at line 1189 of file cg_view.c.

Referenced by CG_DrawSkyBoxPortal().