codemp/game/bg_pmove.c File Reference

#include "q_shared.h"
#include "bg_public.h"
#include "bg_local.h"
#include "bg_strap.h"
#include "../ghoul2/G2.h"
#include "../namespace_begin.h"
#include "../namespace_end.h"

Go to the source code of this file.

Defines

#define MAX_WEAPON_CHARGE_TIME   5000
#define PM_INLINE   ID_INLINE
#define FLY_NONE   0
#define FLY_NORMAL   1
#define FLY_VEHICLE   2
#define FLY_HOVER   3
#define METROID_JUMP   1
#define JUMP_OFF_WALL_SPEED   200.0f
#define USE_DELAY   2000
#define SLOPE_RECALC_INT   100
#define SLOPERECALCVAR   pm->ps->slopeRecalcTime
#define MAX_XHAIR_DIST_ACCURACY   20000.0f
#define BOWCASTER_CHARGE_UNIT   200.0f
#define BRYAR_CHARGE_UNIT   200.0f
#define JETPACK_HOVER_HEIGHT   64

Functions

qboolean BG_FullBodyTauntAnim (int anim)
float PM_WalkableGroundDistance (void)
qboolean PM_GroundSlideOkay (float zNormal)
saberInfo_tBG_MySaber (int clientNum, int saberNum)
bgEntity_tPM_BGEntForNum (int num)
qboolean BG_SabersOff (playerState_t *ps)
qboolean BG_KnockDownable (playerState_t *ps)
qboolean PM_INLINE PM_IsRocketTrooper (void)
int PM_GetSaberStance (void)
qboolean PM_DoSlowFall (void)
void PM_pitch_roll_for_slope (bgEntity_t *forwhom, vec3_t pass_slope, vec3_t storeAngles)
void PM_SetSpecialMoveValues (void)
void BG_ExternThisSoICanRecompileInDebug (Vehicle_t *pVeh, playerState_t *riderPS)
void BG_VehicleTurnRateForSpeed (Vehicle_t *pVeh, float speed, float *mPitchOverride, float *mYawOverride)
void PM_HoverTrace (void)
void PM_AddEvent (int newEvent)
void PM_AddEventWithParm (int newEvent, int parm)
void PM_AddTouchEnt (int entityNum)
void PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce)
qboolean PM_ForceJumpingUp (void)
void PM_SetPMViewAngle (playerState_t *ps, vec3_t angle, usercmd_t *ucmd)
qboolean PM_AdjustAngleForWallRun (playerState_t *ps, usercmd_t *ucmd, qboolean doMove)
qboolean PM_AdjustAnglesForWallRunUpFlipAlt (usercmd_t *ucmd)
qboolean PM_AdjustAngleForWallRunUp (playerState_t *ps, usercmd_t *ucmd, qboolean doMove)
qboolean PM_AdjustAngleForWallJump (playerState_t *ps, usercmd_t *ucmd, qboolean doMove)
void PM_SetForceJumpZStart (float value)
void PM_GrabWallForJump (int anim)
qboolean PM_CanRollFromSoulCal (playerState_t *ps)
qboolean PM_CheckDualForwardJumpDuck (void)
void PM_CheckFixMins (void)
void PM_Use (void)
qboolean PM_WalkingAnim (int anim)
qboolean PM_RunningAnim (int anim)
qboolean PM_SwimmingAnim (int anim)
qboolean PM_RollingAnim (int anim)
void PM_AnglesForSlope (const float yaw, const vec3_t slope, vec3_t angles)
void PM_FootSlopeTrace (float *pDiff, float *pInterval)
qboolean BG_InSlopeAnim (int anim)
qboolean PM_AdjustStandAnimForSlope (void)
int PM_LegsSlopeBackTransition (int desiredAnim)
void BG_ClearRocketLock (playerState_t *ps)
void PM_BeginWeaponChange (int weapon)
void PM_FinishWeaponChange (void)
void CG_GetVehicleCamPos (vec3_t camPos)
int BG_VehTraceFromCamPos (trace_t *camTrace, bgEntity_t *bgEnt, const vec3_t entOrg, const vec3_t shotStart, const vec3_t end, vec3_t newEnd, vec3_t shotDir, float bestDist)
void PM_RocketLock (float lockDist, qboolean vehicleLock)
int PM_ItemUsable (playerState_t *ps, int forcedUse)
qboolean PM_CanSetWeaponAnims (void)
int PM_irand_timesync (int val1, int val2)
void PM_VehicleWeaponAnimate (void)
int PM_KickMoveForConditions (void)
qboolean BG_UnrestrainedPitchRoll (playerState_t *ps, Vehicle_t *pVeh)
void PM_UpdateViewAngles (playerState_t *ps, const usercmd_t *cmd)
void PM_AdjustAttackStates (pmove_t *pm)
void BG_CmdForRoll (playerState_t *ps, int anim, usercmd_t *pCmd)
qboolean PM_SaberInTransition (int move)
void BG_AdjustClientSpeed (playerState_t *ps, usercmd_t *cmd, int svTime)
qboolean BG_InRollAnim (entityState_t *cent)
qboolean BG_InKnockDown (int anim)
qboolean BG_InRollES (entityState_t *ps, int anim)
void BG_IK_MoveArm (void *ghoul2, int lHandBolt, int time, entityState_t *ent, int basePose, vec3_t desiredPos, qboolean *ikInProgress, vec3_t origin, vec3_t angles, vec3_t scale, int blendTime, qboolean forceHalt)
void BG_UpdateLookAngles (int lookingDebounceTime, vec3_t lastHeadAngles, int time, vec3_t lookAngles, float lookSpeed, float minPitch, float maxPitch, float minYaw, float maxYaw, float minRoll, float maxRoll)
qboolean BG_InRoll2 (entityState_t *es)
qboolean BG_SaberLockBreakAnim (int anim)
void BG_G2PlayerAngles (void *ghoul2, int motionBolt, entityState_t *cent, int time, vec3_t cent_lerpOrigin, vec3_t cent_lerpAngles, vec3_t legs[3], vec3_t legsAngles, qboolean *tYawing, qboolean *tPitching, qboolean *lYawing, float *tYawAngle, float *tPitchAngle, float *lYawAngle, int frametime, vec3_t turAngles, vec3_t modelScale, int ciLegs, int ciTorso, int *corrTime, vec3_t lookAngles, vec3_t lastHeadAngles, int lookTime, entityState_t *emplaced, int *crazySmoothFactor)
void BG_G2ATSTAngles (void *ghoul2, int time, vec3_t cent_lerpAngles)
void PM_VehicleViewAngles (playerState_t *ps, bgEntity_t *veh, usercmd_t *ucmd)
qboolean PM_WeaponOkOnVehicle (int weapon)
int PM_GetOkWeaponForVehicle (void)
void PM_VehForcedTurning (bgEntity_t *veh)
void PM_VehFaceHyperspacePoint (bgEntity_t *veh)
void BG_VehicleAdjustBBoxForOrientation (Vehicle_t *veh, vec3_t origin, vec3_t mins, vec3_t maxs, int clientNum, int tracemask, void(*localTrace)(trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask))
void trap_SnapVector (float *v)
int BG_EmplacedView (vec3_t baseAngles, vec3_t angles, float *newYaw, float constraint)
qboolean BG_FighterUpdate (Vehicle_t *pVeh, const usercmd_t *pUcmd, vec3_t trMins, vec3_t trMaxs, float gravity, void(*traceFunc)(trace_t *results, const vec3_t start, const vec3_t lmins, const vec3_t lmaxs, const vec3_t end, int passEntityNum, int contentMask))
void PM_MoveForKata (usercmd_t *ucmd)
void PmoveSingle (pmove_t *pmove)
void Pmove (pmove_t *pmove)

Variables

pmove_tpm
pml_t pml
bgEntity_tpm_entSelf = NULL
bgEntity_tpm_entVeh = NULL
qboolean gPMDoSlowFall = qfalse
qboolean pm_cancelOutZoom = qfalse
float pm_stopspeed = 100.0f
float pm_duckScale = 0.50f
float pm_swimScale = 0.50f
float pm_wadeScale = 0.70f
float pm_vehicleaccelerate = 36.0f
float pm_accelerate = 10.0f
float pm_airaccelerate = 1.0f
float pm_wateraccelerate = 4.0f
float pm_flyaccelerate = 8.0f
float pm_friction = 6.0f
float pm_waterfriction = 1.0f
float pm_flightfriction = 3.0f
float pm_spectatorfriction = 5.0f
int c_pmove = 0
float forceSpeedLevels [4]
int forcePowerNeeded [NUM_FORCE_POWER_LEVELS][NUM_FORCE_POWERS]
float forceJumpHeight [NUM_FORCE_POWER_LEVELS]
float forceJumpStrength [NUM_FORCE_POWER_LEVELS]
vmCvar_t cg_paused
float forceJumpHeightMax [NUM_FORCE_POWER_LEVELS]
int WeaponReadyLegsAnim [WP_NUM_WEAPONS]
vmCvar_t bg_fighterAltControl


Define Documentation

#define BOWCASTER_CHARGE_UNIT   200.0f
 

Definition at line 6237 of file bg_pmove.c.

#define BRYAR_CHARGE_UNIT   200.0f
 

Definition at line 6238 of file bg_pmove.c.

#define FLY_HOVER   3
 

Definition at line 444 of file bg_pmove.c.

Referenced by PM_SetSpecialMoveValues(), and PmoveSingle().

#define FLY_NONE   0
 

Definition at line 441 of file bg_pmove.c.

Referenced by PM_SetSpecialMoveValues().

#define FLY_NORMAL   1
 

Definition at line 442 of file bg_pmove.c.

Referenced by PM_SetSpecialMoveValues(), and PmoveSingle().

#define FLY_VEHICLE   2
 

Definition at line 443 of file bg_pmove.c.

Referenced by PM_SetSpecialMoveValues(), and PmoveSingle().

#define JETPACK_HOVER_HEIGHT   64
 

Definition at line 10085 of file bg_pmove.c.

Referenced by PmoveSingle().

#define JUMP_OFF_WALL_SPEED   200.0f
 

Definition at line 1600 of file bg_pmove.c.

Referenced by PM_AdjustAngleForWallJump().

#define MAX_WEAPON_CHARGE_TIME   5000
 

Definition at line 16 of file bg_pmove.c.

#define MAX_XHAIR_DIST_ACCURACY   20000.0f
 

Definition at line 5833 of file bg_pmove.c.

#define METROID_JUMP   1
 

Definition at line 1264 of file bg_pmove.c.

#define PM_INLINE   ID_INLINE
 

Definition at line 241 of file bg_pmove.c.

Referenced by PM_IsRocketTrooper().

#define SLOPE_RECALC_INT   100
 

Definition at line 4803 of file bg_pmove.c.

Referenced by PM_AdjustStandAnimForSlope().

#define SLOPERECALCVAR   pm->ps->slopeRecalcTime
 

Referenced by PM_AdjustStandAnimForSlope().

#define USE_DELAY   2000
 

Definition at line 4558 of file bg_pmove.c.

Referenced by PM_Use().


Function Documentation

void BG_AdjustClientSpeed playerState_t ps,
usercmd_t cmd,
int  svTime
 

Definition at line 8332 of file bg_pmove.c.

References playerState_s::basespeed, BG_InRoll(), BG_MySaber(), BG_SaberInAttack(), BG_SpinningSaberAnim(), bgEntity_t, BOTH_ROLL_B, BUTTON_WALKING, usercmd_s::buttons, CLASS_VEHICLE, playerState_s::clientNum, pmove_t::cmd, ENTITYNUM_NONE, playerState_s::fd, FORCE_LEVEL_1, FORCE_LEVEL_2, FORCE_LEVEL_3, forcedata_s::forceGripCripple, playerState_s::forceHandExtend, forcedata_s::forcePowersActive, forcedata_s::forceRageRecoveryTime, usercmd_s::forwardmove, FP_GRIP, FP_RAGE, FP_SPEED, playerState_s::groundEntityNum, HANDEXTEND_DODGE, HANDEXTEND_KNOCKDOWN, HANDEXTEND_POSTTHROWN, HANDEXTEND_PRETHROWN, playerState_s::legsAnim, playerState_s::legsTimer, MAX_CLIENTS, saberInfo_t::moveSpeedScale, entityState_s::NPC_class, playerState_t, pm, pm_entSelf, PM_SaberInTransition(), pmove_t::ps, bgEntity_s::s, forcedata_s::saberAnimLevel, playerState_s::saberMove, usercmd_s::serverTime, playerState_s::speed, SS_DUAL, SS_STAFF, usercmd_t, playerState_s::weapon, WP_DISRUPTOR, WP_SABER, playerState_s::zoomLockTime, and playerState_s::zoomMode.

Referenced by PmoveSingle().

08333 {
08334         saberInfo_t     *saber;
08335 
08336         if (ps->clientNum >= MAX_CLIENTS)
08337         {
08338                 bgEntity_t *bgEnt = pm_entSelf;
08339 
08340                 if (bgEnt && bgEnt->s.NPC_class == CLASS_VEHICLE)
08341                 { //vehicles manage their own speed
08342                         return;
08343                 }
08344         }
08345 
08346         //For prediction, always reset speed back to the last known server base speed
08347         //If we didn't do this, under lag we'd eventually dwindle speed down to 0 even though
08348         //that would not be the correct predicted value.
08349         ps->speed = ps->basespeed;
08350 
08351         if (ps->forceHandExtend == HANDEXTEND_DODGE)
08352         {
08353                 ps->speed = 0;
08354         }
08355 
08356         if (ps->forceHandExtend == HANDEXTEND_KNOCKDOWN ||
08357                 ps->forceHandExtend == HANDEXTEND_PRETHROWN ||
08358                 ps->forceHandExtend == HANDEXTEND_POSTTHROWN)
08359         {
08360                 ps->speed = 0;
08361         }
08362 
08363 
08364         if ( cmd->forwardmove < 0 && !(cmd->buttons&BUTTON_WALKING) && pm->ps->groundEntityNum != ENTITYNUM_NONE )
08365         {//running backwards is slower than running forwards (like SP)
08366                 ps->speed *= 0.75;
08367         }
08368 
08369         if (ps->fd.forcePowersActive & (1 << FP_GRIP))
08370         {
08371                 ps->speed *= 0.4;
08372         }
08373 
08374         if (ps->fd.forcePowersActive & (1 << FP_SPEED))
08375         {
08376                 ps->speed *= 1.7;
08377         }
08378         else if (ps->fd.forcePowersActive & (1 << FP_RAGE))
08379         {
08380                 ps->speed *= 1.3;
08381         }
08382         else if (ps->fd.forceRageRecoveryTime > svTime)
08383         {
08384                 ps->speed *= 0.75;
08385         }
08386 
08387         if (pm->ps->weapon == WP_DISRUPTOR &&
08388                 pm->ps->zoomMode == 1 && pm->ps->zoomLockTime < pm->cmd.serverTime)
08389         {
08390                 ps->speed *= 0.5f;
08391         }
08392 
08393         if (ps->fd.forceGripCripple)
08394         {
08395                 if (ps->fd.forcePowersActive & (1 << FP_RAGE))
08396                 {
08397                         ps->speed *= 0.9;
08398                 }
08399                 else if (ps->fd.forcePowersActive & (1 << FP_SPEED))
08400                 { //force speed will help us escape
08401                         ps->speed *= 0.8;
08402                 }
08403                 else
08404                 {
08405                         ps->speed *= 0.2;
08406                 }
08407         }
08408 
08409         if ( BG_SaberInAttack( ps->saberMove ) && cmd->forwardmove < 0 )
08410         {//if running backwards while attacking, don't run as fast.
08411                 switch( ps->fd.saberAnimLevel )
08412                 {
08413                 case FORCE_LEVEL_1:
08414                         ps->speed *= 0.75f;
08415                         break;
08416                 case FORCE_LEVEL_2:
08417                 case SS_DUAL:
08418                 case SS_STAFF:
08419                         ps->speed *= 0.60f;
08420                         break;
08421                 case FORCE_LEVEL_3:
08422                         ps->speed *= 0.45f;
08423                         break;
08424                 default:
08425                         break;
08426                 }
08427         }
08428         else if ( BG_SpinningSaberAnim( ps->legsAnim ) )
08429         {
08430                 if (ps->fd.saberAnimLevel == FORCE_LEVEL_3)
08431                 {
08432                         ps->speed *= 0.3f;
08433                 }
08434                 else
08435                 {
08436                         ps->speed *= 0.5f;
08437                 }
08438         }
08439         else if ( ps->weapon == WP_SABER && BG_SaberInAttack( ps->saberMove ) )
08440         {//if attacking with saber while running, drop your speed
08441                 switch( ps->fd.saberAnimLevel )
08442                 {
08443                 case FORCE_LEVEL_2:
08444                 case SS_DUAL:
08445                 case SS_STAFF:
08446                         ps->speed *= 0.85f;
08447                         break;
08448                 case FORCE_LEVEL_3:
08449                         ps->speed *= 0.55f;
08450                         break;
08451                 default:
08452                         break;
08453                 }
08454         }
08455         else if (ps->weapon == WP_SABER && ps->fd.saberAnimLevel == FORCE_LEVEL_3 &&
08456                 PM_SaberInTransition(ps->saberMove))
08457         { //Now, we want to even slow down in transitions for level 3 (since it has chains and stuff now)
08458                 if (cmd->forwardmove < 0)
08459                 {
08460                         ps->speed *= 0.4f;
08461                 }
08462                 else
08463                 {
08464                         ps->speed *= 0.6f;
08465                 }
08466         }
08467 
08468         if ( BG_InRoll( ps, ps->legsAnim ) && ps->speed > 50 )
08469         { //can't roll unless you're able to move normally
08470                 if ((ps->legsAnim) == BOTH_ROLL_B)
08471                 { //backwards roll is pretty fast, should also be slower
08472                         if (ps->legsTimer > 800)
08473                         {
08474                                 ps->speed = ps->legsTimer/2.5;
08475                         }
08476                         else
08477                         {
08478                                 ps->speed = ps->legsTimer/6.0;//450;
08479                         }
08480                 }
08481                 else
08482                 {
08483                         if (ps->legsTimer > 800)
08484                         {
08485                                 ps->speed = ps->legsTimer/1.5;//450;
08486                         }
08487                         else
08488                         {
08489                                 ps->speed = ps->legsTimer/5.0;//450;
08490                         }
08491                 }
08492                 if (ps->speed > 600)
08493                 {
08494                         ps->speed = 600;
08495                 }
08496                 //Automatically slow down as the roll ends.
08497         }
08498 
08499         saber = BG_MySaber( ps->clientNum, 0 );
08500         if ( saber 
08501                 && saber->moveSpeedScale != 1.0f )
08502         {
08503                 ps->speed *= saber->moveSpeedScale;
08504         }
08505         saber = BG_MySaber( ps->clientNum, 1 );
08506         if ( saber 
08507                 && saber->moveSpeedScale != 1.0f )
08508         {
08509                 ps->speed *= saber->moveSpeedScale;
08510         }
08511 }

void BG_ClearRocketLock playerState_t ps  ) 
 

Definition at line 5751 of file bg_pmove.c.

References ENTITYNUM_NONE, playerState_t, playerState_s::rocketLastValidTime, playerState_s::rocketLockIndex, playerState_s::rocketLockTime, and playerState_s::rocketTargetTime.

Referenced by player_die(), and PM_BeginWeaponChange().

05752 {
05753         if ( ps )
05754         {
05755                 ps->rocketLockIndex = ENTITYNUM_NONE;
05756                 ps->rocketLastValidTime = 0;
05757                 ps->rocketLockTime = -1;
05758                 ps->rocketTargetTime = 0;
05759         }
05760 }

void BG_CmdForRoll playerState_t ps,
int  anim,
usercmd_t pCmd
 

Definition at line 8202 of file bg_pmove.c.

References animNumber_t, BOTH_GETUP_BROLL_B, BOTH_GETUP_BROLL_F, BOTH_GETUP_BROLL_L, BOTH_GETUP_BROLL_R, BOTH_GETUP_FROLL_B, BOTH_GETUP_FROLL_F, BOTH_GETUP_FROLL_L, BOTH_GETUP_FROLL_R, BOTH_ROLL_B, BOTH_ROLL_F, BOTH_ROLL_L, BOTH_ROLL_R, usercmd_s::forwardmove, playerState_s::legsAnim, playerState_s::legsTimer, playerState_t, PM_AnimLength(), usercmd_s::rightmove, playerState_s::torsoTimer, usercmd_s::upmove, and usercmd_t.

Referenced by PmoveSingle().

08203 {
08204         switch ( (anim) )
08205         {
08206         case BOTH_ROLL_F:
08207                 pCmd->forwardmove = 127;
08208                 pCmd->rightmove = 0;
08209                 break;
08210         case BOTH_ROLL_B:
08211                 pCmd->forwardmove = -127;
08212                 pCmd->rightmove = 0;
08213                 break;
08214         case BOTH_ROLL_R:
08215                 pCmd->forwardmove = 0;
08216                 pCmd->rightmove = 127;
08217                 break;
08218         case BOTH_ROLL_L:
08219                 pCmd->forwardmove = 0;
08220                 pCmd->rightmove = -127;
08221                 break;
08222         case BOTH_GETUP_BROLL_R:
08223                 pCmd->forwardmove = 0;
08224                 pCmd->rightmove = 48;
08225                 //NOTE: speed is 400
08226                 break;
08227 
08228         case BOTH_GETUP_FROLL_R:
08229                 if ( ps->legsTimer <= 250 )
08230                 {//end of anim
08231                         pCmd->forwardmove = pCmd->rightmove = 0;
08232                 }
08233                 else
08234                 {
08235                         pCmd->forwardmove = 0;
08236                         pCmd->rightmove = 48;
08237                         //NOTE: speed is 400
08238                 }
08239                 break;
08240 
08241         case BOTH_GETUP_BROLL_L:
08242                 pCmd->forwardmove = 0;
08243                 pCmd->rightmove = -48;
08244                 //NOTE: speed is 400
08245                 break;
08246 
08247         case BOTH_GETUP_FROLL_L:
08248                 if ( ps->legsTimer <= 250 )
08249                 {//end of anim
08250                         pCmd->forwardmove = pCmd->rightmove = 0;
08251                 }
08252                 else
08253                 {
08254                         pCmd->forwardmove = 0;
08255                         pCmd->rightmove = -48;
08256                         //NOTE: speed is 400
08257                 }
08258                 break;
08259 
08260         case BOTH_GETUP_BROLL_B:
08261                 if ( ps->torsoTimer <= 250 )
08262                 {//end of anim
08263                         pCmd->forwardmove = pCmd->rightmove = 0;
08264                 }
08265                 else if ( PM_AnimLength( 0, (animNumber_t)ps->legsAnim ) - ps->torsoTimer < 350 )
08266                 {//beginning of anim
08267                         pCmd->forwardmove = pCmd->rightmove = 0;
08268                 }
08269                 else
08270                 {
08271                         //FIXME: ramp down over length of anim
08272                         pCmd->forwardmove = -64;
08273                         pCmd->rightmove = 0;
08274                         //NOTE: speed is 400
08275                 }
08276                 break;
08277 
08278         case BOTH_GETUP_FROLL_B:
08279                 if ( ps->torsoTimer <= 100 )
08280                 {//end of anim
08281                         pCmd->forwardmove = pCmd->rightmove = 0;
08282                 }
08283                 else if ( PM_AnimLength( 0, (animNumber_t)ps->legsAnim ) - ps->torsoTimer < 200 )
08284                 {//beginning of anim
08285                         pCmd->forwardmove = pCmd->rightmove = 0;
08286                 }
08287                 else
08288                 {
08289                         //FIXME: ramp down over length of anim
08290                         pCmd->forwardmove = -64;
08291                         pCmd->rightmove = 0;
08292                         //NOTE: speed is 400
08293                 }
08294                 break;
08295 
08296         case BOTH_GETUP_BROLL_F:
08297                 if ( ps->torsoTimer <= 550 )
08298                 {//end of anim
08299                         pCmd->forwardmove = pCmd->rightmove = 0;
08300                 }
08301                 else if ( PM_AnimLength( 0, (animNumber_t)ps->legsAnim ) - ps->torsoTimer < 150 )
08302                 {//beginning of anim
08303                         pCmd->forwardmove = pCmd->rightmove = 0;
08304                 }
08305                 else
08306                 {
08307                         pCmd->forwardmove = 64;
08308                         pCmd->rightmove = 0;
08309                         //NOTE: speed is 400
08310                 }
08311                 break;
08312 
08313         case BOTH_GETUP_FROLL_F:
08314                 if ( ps->torsoTimer <= 100 )
08315                 {//end of anim
08316                         pCmd->forwardmove = pCmd->rightmove = 0;
08317                 }
08318                 else
08319                 {
08320                         //FIXME: ramp down over length of anim
08321                         pCmd->forwardmove = 64;
08322                         pCmd->rightmove = 0;
08323                         //NOTE: speed is 400
08324                 }
08325                 break;
08326         }
08327         pCmd->upmove = 0;
08328 }

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 }

void BG_ExternThisSoICanRecompileInDebug Vehicle_t pVeh,
playerState_t riderPS
 

Definition at line 641 of file bg_pmove.c.

References playerState_t, and Vehicle_t.

00642 {
00643 /*
00644         float pitchSubtract, pitchDelta, yawDelta;
00645         //Com_Printf( S_COLOR_RED"PITCH: %4.2f, YAW: %4.2f, ROLL: %4.2f\n", riderPS->viewangles[0],riderPS->viewangles[1],riderPS->viewangles[2]);
00646         yawDelta = AngleSubtract(riderPS->viewangles[YAW],pVeh->m_vPrevRiderViewAngles[YAW]);
00647 #ifndef QAGAME
00648         if ( !cg_paused.integer )
00649         {
00650                 //Com_Printf( "%d - yawDelta %4.2f\n", pm->cmd.serverTime, yawDelta );
00651         }
00652 #endif
00653         yawDelta *= (4.0f*pVeh->m_fTimeModifier);
00654         pVeh->m_vOrientation[ROLL] -= yawDelta;
00655 
00656         pitchDelta = AngleSubtract(riderPS->viewangles[PITCH],pVeh->m_vPrevRiderViewAngles[PITCH]);
00657         pitchDelta *= (2.0f*pVeh->m_fTimeModifier);
00658         pitchSubtract = pitchDelta * (fabs(pVeh->m_vOrientation[ROLL])/90.0f);
00659         pVeh->m_vOrientation[PITCH] += pitchDelta-pitchSubtract;
00660         if ( pVeh->m_vOrientation[ROLL] > 0 )
00661         {
00662                 pVeh->m_vOrientation[YAW] += pitchSubtract;
00663         }
00664         else
00665         {
00666                 pVeh->m_vOrientation[YAW] -= pitchSubtract;
00667         }
00668         pVeh->m_vOrientation[PITCH] = AngleNormalize180( pVeh->m_vOrientation[PITCH] );
00669         pVeh->m_vOrientation[YAW] = AngleNormalize360( pVeh->m_vOrientation[YAW] );
00670         pVeh->m_vOrientation[ROLL] = AngleNormalize180( pVeh->m_vOrientation[ROLL] );
00671 
00672         VectorCopy( riderPS->viewangles, pVeh->m_vPrevRiderViewAngles );
00673 */
00674 }

qboolean BG_FighterUpdate Vehicle_t pVeh,
const usercmd_t pUcmd,
vec3_t  trMins,
vec3_t  trMaxs,
float  gravity,
void(*  traceFunc)(trace_t *results, const vec3_t start, const vec3_t lmins, const vec3_t lmaxs, const vec3_t end, int passEntityNum, int contentMask)
 

Definition at line 96 of file FighterNPC.c.

References Com_Error(), CONTENTS_BODY, EF_DEAD, playerState_s::eFlags, ERR_DROP, vehicleInfo_t::Ghost, playerState_s::gravity, vehicleInfo_t::gravity, vehicleInfo_t::landingHeight, Vehicle_s::m_LandTrace, Vehicle_s::m_pParentEntity, Vehicle_s::m_pPilot, Vehicle_s::m_ppPassengers, Vehicle_s::m_pVehicleInfo, MASK_NPCSOLID, vehicleInfo_t::maxPassengers, vehicleInfo_t::name, entityState_s::number, playerState_s::origin, bgEntity_s::playerState, playerState_t, qboolean, qfalse, bgEntity_s::s, STAT_HEALTH, playerState_s::stats, usercmd_t, vec3_t, VectorCopy, and Vehicle_t.

Referenced by PmoveSingle().

00098 {
00099         vec3_t          bottom;
00100         playerState_t *parentPS;
00101         qboolean        isDead = qfalse;
00102 #ifdef QAGAME //don't do this on client
00103         int i;
00104 
00105         // Make sure the riders are not visible or collidable.
00106         pVeh->m_pVehicleInfo->Ghost( pVeh, pVeh->m_pPilot );
00107         for ( i = 0; i < pVeh->m_pVehicleInfo->maxPassengers; i++ )
00108         {
00109                 pVeh->m_pVehicleInfo->Ghost( pVeh, pVeh->m_ppPassengers[i] );
00110         }
00111 #endif
00112 
00113 
00114 #ifdef _JK2MP
00115         parentPS = pVeh->m_pParentEntity->playerState;
00116 #else
00117         parentPS = &pVeh->m_pParentEntity->client->ps;
00118 #endif
00119 
00120         if (!parentPS)
00121         {
00122                 Com_Error(ERR_DROP, "NULL PS in BG_FighterUpdate (%s)", pVeh->m_pVehicleInfo->name);
00123                 return false;
00124         }
00125 
00126         // If we have a pilot, take out gravity (it's a flying craft...).
00127         if ( pVeh->m_pPilot )
00128         {
00129                 parentPS->gravity = 0;
00130 #ifndef _JK2MP //don't need this flag in mp, I.. guess
00131                 pVeh->m_pParentEntity->svFlags |= SVF_CUSTOM_GRAVITY;
00132 #endif
00133         }
00134         else
00135         {
00136 #ifndef _JK2MP //don't need this flag in mp, I.. guess
00137                 pVeh->m_pParentEntity->svFlags &= ~SVF_CUSTOM_GRAVITY;
00138 #else //in MP set grav back to normal gravity
00139                 if (pVeh->m_pVehicleInfo->gravity)
00140                 {
00141                         parentPS->gravity = pVeh->m_pVehicleInfo->gravity;
00142                 }
00143                 else
00144                 { //it doesn't have gravity specified apparently
00145                         parentPS->gravity = gravity;
00146                 }
00147 #endif
00148         }
00149 
00150 #ifdef _JK2MP
00151         isDead = (qboolean)((parentPS->eFlags&EF_DEAD)!=0);
00152 #else
00153         isDead = (parentPS->stats[STAT_HEALTH] <= 0 );
00154 #endif
00155 
00156         /*
00157         if ( isDead || 
00158                 (pVeh->m_pVehicleInfo->surfDestruction &&
00159                         pVeh->m_iRemovedSurfaces ) )
00160         {//can't land if dead or spiralling out of control
00161                 pVeh->m_LandTrace.fraction = 1.0f;
00162                 pVeh->m_LandTrace.contents = pVeh->m_LandTrace.surfaceFlags = 0;
00163                 VectorClear( pVeh->m_LandTrace.plane.normal );
00164                 pVeh->m_LandTrace.allsolid = qfalse;
00165                 pVeh->m_LandTrace.startsolid = qfalse;
00166         }
00167         else
00168         {
00169         */
00170         //argh, no, I need to have a way to see when they impact the ground while damaged. -rww
00171 
00172                 // Check to see if the fighter has taken off yet (if it's a certain height above ground).
00173                 VectorCopy( parentPS->origin, bottom );
00174                 bottom[2] -= pVeh->m_pVehicleInfo->landingHeight;
00175 
00176                 traceFunc( &pVeh->m_LandTrace, parentPS->origin, trMins, trMaxs, bottom, pVeh->m_pParentEntity->s.number, (MASK_NPCSOLID&~CONTENTS_BODY) );
00177         //}
00178 
00179         return true;
00180 }

qboolean BG_FullBodyTauntAnim int  anim  ) 
 

Definition at line 1538 of file bg_panimate.c.

01539 {
01540         switch ( anim )
01541         {
01542         case BOTH_GESTURE1:
01543         case BOTH_DUAL_TAUNT:
01544         case BOTH_STAFF_TAUNT:
01545         case BOTH_BOW:
01546         case BOTH_MEDITATE:
01547         case BOTH_SHOWOFF_FAST:
01548         case BOTH_SHOWOFF_MEDIUM:
01549         case BOTH_SHOWOFF_STRONG:
01550         case BOTH_SHOWOFF_DUAL:
01551         case BOTH_SHOWOFF_STAFF:
01552         case BOTH_VICTORY_FAST:
01553         case BOTH_VICTORY_MEDIUM:
01554         case BOTH_VICTORY_STRONG:
01555         case BOTH_VICTORY_DUAL:
01556         case BOTH_VICTORY_STAFF:
01557                 return qtrue;
01558                 break;
01559         }
01560         return qfalse;
01561 }

void BG_G2ATSTAngles void *  ghoul2,
int  time,
vec3_t  cent_lerpAngles
 

Definition at line 9460 of file bg_pmove.c.

References BONE_ANGLES_POSTMULT, NEGATIVE_Y, NEGATIVE_Z, POSITIVE_X, strap_G2API_SetBoneAngles(), and vec3_t.

09461 {//                                                                                                                                                                                     up                      right           fwd
09462         strap_G2API_SetBoneAngles(ghoul2, 0, "thoracic", cent_lerpAngles, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09463 }

void BG_G2PlayerAngles void *  ghoul2,
int  motionBolt,
entityState_t cent,
int  time,
vec3_t  cent_lerpOrigin,
vec3_t  cent_lerpAngles,
vec3_t  legs[3],
vec3_t  legsAngles,
qboolean tYawing,
qboolean tPitching,
qboolean lYawing,
float *  tYawAngle,
float *  tPitchAngle,
float *  lYawAngle,
int  frametime,
vec3_t  turAngles,
vec3_t  modelScale,
int  ciLegs,
int  ciTorso,
int *  corrTime,
vec3_t  lookAngles,
vec3_t  lastHeadAngles,
int  lookTime,
entityState_t emplaced,
int *  crazySmoothFactor
 

Definition at line 9083 of file bg_pmove.c.

References AngleMod(), AngleNormalize180(), entityState_s::angles2, AnglesSubtract(), AnglesToAxis(), AngleSubtract(), BG_InRoll2(), BG_SaberInSpecial(), BG_SaberLockBreakAnim(), BG_UpdateLookAngles(), BONE_ANGLES_POSTMULT, BOTH_STAND1, BOTH_STRAFE_LEFT1, BOTH_STRAFE_RIGHT1, Com_Error(), DotProduct, EF_DEAD, entityState_s::eFlags, ENTITYNUM_NONE, entityState_t, ERR_DROP, entityState_s::forceFrame, entityState_s::groundEntityNum, entityState_s::heldByClient, entityState_s::legsAnim, entityState_s::m_iVehicleNum, MAX_CLIENTS, NEGATIVE_Y, NEGATIVE_Z, entityState_s::number, PITCH, entityState_s::pos, POSITIVE_X, qtrue, ROLL, entityState_s::saberMove, strap_G2API_SetBoneAngles(), entityState_s::torsoAnim, trajectory_t::trBase, trajectory_t::trDelta, vec3_origin, vec3_t, vectoangles(), VectorAdd, VectorClear, VectorCopy, VectorNormalize(), VectorScale, VectorSet, VectorSubtract, entityState_s::weapon, WeaponReadyAnim, WP_EMPLACED_GUN, WP_NONE, WP_SABER, and YAW.

09089 {
09090         int                                     adddir = 0;
09091         static int                      dir;
09092         static int                      i;
09093         static int                      movementOffsets[8] = { 0, 22, 45, -22, 0, 22, -45, -22 };
09094         float                           degrees_negative = 0;
09095         float                           degrees_positive = 0;
09096         static float            dif;
09097         static float            dest;
09098         static float            speed; //, speed_dif, speed_desired;
09099         static const float      lookSpeed = 1.5f;
09100 #ifdef BONE_BASED_LEG_ANGLES
09101         static float            legBoneYaw;
09102 #endif
09103         static vec3_t           eyeAngles;
09104         static vec3_t           neckAngles;
09105         static vec3_t           velocity;
09106         static vec3_t           torsoAngles, headAngles;
09107         static vec3_t           velPos, velAng;
09108         static vec3_t           ulAngles, llAngles, viewAngles, angles, thoracicAngles = {0,0,0};
09109         static vec3_t           headClampMinAngles = {-25,-55,-10}, headClampMaxAngles = {50,50,10};
09110 
09111         if ( cent->m_iVehicleNum || cent->forceFrame || BG_SaberLockBreakAnim(cent->legsAnim) || BG_SaberLockBreakAnim(cent->torsoAnim) )
09112         { //a vehicle or riding a vehicle - in either case we don't need to be in here
09113                 vec3_t forcedAngles;
09114 
09115                 VectorClear(forcedAngles);
09116                 forcedAngles[YAW] = cent_lerpAngles[YAW];
09117                 forcedAngles[ROLL] = cent_lerpAngles[ROLL];
09118                 AnglesToAxis( forcedAngles, legs );
09119                 VectorCopy(forcedAngles, legsAngles);
09120 
09121                 if (cent->number < MAX_CLIENTS)
09122                 {
09123                         strap_G2API_SetBoneAngles(ghoul2, 0, "lower_lumbar", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09124                         strap_G2API_SetBoneAngles(ghoul2, 0, "upper_lumbar", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09125                         strap_G2API_SetBoneAngles(ghoul2, 0, "cranium", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09126                         strap_G2API_SetBoneAngles(ghoul2, 0, "thoracic", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09127                         strap_G2API_SetBoneAngles(ghoul2, 0, "cervical", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09128                 }
09129                 return;
09130         }
09131 
09132         if ((time+2000) < *corrTime)
09133         {
09134                 *corrTime = 0;
09135         }
09136 
09137         VectorCopy( cent_lerpAngles, headAngles );
09138         headAngles[YAW] = AngleMod( headAngles[YAW] );
09139         VectorClear( legsAngles );
09140         VectorClear( torsoAngles );
09141         // --------- yaw -------------
09142 
09143         // allow yaw to drift a bit
09144         if ((( cent->legsAnim ) != BOTH_STAND1) || 
09145                         ( cent->torsoAnim ) != WeaponReadyAnim[cent->weapon]  ) 
09146         {
09147                 // if not standing still, always point all in the same direction
09148                 //cent->pe.torso.yawing = qtrue;        // always center
09149                 *tYawing = qtrue;
09150                 //cent->pe.torso.pitching = qtrue;      // always center
09151                 *tPitching = qtrue;
09152                 //cent->pe.legs.yawing = qtrue; // always center
09153                 *lYawing = qtrue;
09154         }
09155 
09156         // adjust legs for movement dir
09157         if ( cent->eFlags & EF_DEAD ) {
09158                 // don't let dead bodies twitch
09159                 dir = 0;
09160         } else {
09161                 dir = cent->angles2[YAW];
09162                 if ( dir < 0 || dir > 7 ) {
09163                         Com_Error( ERR_DROP, "Bad player movement angle (%i)", dir );
09164                 }
09165         }
09166 
09167         torsoAngles[YAW] = headAngles[YAW];
09168 
09169         //for now, turn torso instantly and let the legs swing to follow
09170         *tYawAngle = torsoAngles[YAW];
09171 
09172         // --------- pitch -------------
09173 
09174         VectorCopy( cent->pos.trDelta, velocity );
09175 
09176         if (BG_InRoll2(cent))
09177         { //don't affect angles based on vel then
09178                 VectorClear(velocity);
09179         }
09180         else if (cent->