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->weapon == WP_SABER &&
09181                 BG_SaberInSpecial(cent->saberMove))
09182         {
09183                 VectorClear(velocity);
09184         }
09185 
09186         speed = VectorNormalize( velocity );
09187 
09188         if (!speed)
09189         {
09190                 torsoAngles[YAW] = headAngles[YAW];
09191         }
09192 
09193         // only show a fraction of the pitch angle in the torso
09194         if ( headAngles[PITCH] > 180 ) {
09195                 dest = (-360 + headAngles[PITCH]) * 0.75;
09196         } else {
09197                 dest = headAngles[PITCH] * 0.75;
09198         }
09199 
09200         if (cent->m_iVehicleNum)
09201         { //swing instantly on vehicles
09202                 *tPitchAngle = dest;
09203         }
09204         else
09205         {
09206                 BG_SwingAngles( dest, 15, 30, 0.1, tPitchAngle, tPitching, frametime );
09207         }
09208         torsoAngles[PITCH] = *tPitchAngle;
09209 
09210         // --------- roll -------------
09211 
09212         if ( speed ) {
09213                 vec3_t  axis[3];
09214                 float   side;
09215 
09216                 speed *= 0.05;
09217 
09218                 AnglesToAxis( legsAngles, axis );
09219                 side = speed * DotProduct( velocity, axis[1] );
09220                 legsAngles[ROLL] -= side;
09221 
09222                 side = speed * DotProduct( velocity, axis[0] );
09223                 legsAngles[PITCH] += side;
09224         }
09225 
09226         //legsAngles[YAW] = headAngles[YAW] + (movementOffsets[ dir ]*speed_dif);
09227 
09228         //rww - crazy velocity-based leg angle calculation
09229         legsAngles[YAW] = headAngles[YAW];
09230         velPos[0] = cent_lerpOrigin[0] + velocity[0];
09231         velPos[1] = cent_lerpOrigin[1] + velocity[1];
09232         velPos[2] = cent_lerpOrigin[2];// + velocity[2];
09233 
09234         if ( cent->groundEntityNum == ENTITYNUM_NONE ||
09235                  cent->forceFrame ||
09236                  (cent->weapon == WP_EMPLACED_GUN && emplaced) )
09237         { //off the ground, no direction-based leg angles (same if in saberlock)
09238                 VectorCopy(cent_lerpOrigin, velPos);
09239         }
09240 
09241         VectorSubtract(cent_lerpOrigin, velPos, velAng);
09242 
09243         if (!VectorCompare(velAng, vec3_origin))
09244         {
09245                 vectoangles(velAng, velAng);
09246 
09247                 if (velAng[YAW] <= legsAngles[YAW])
09248                 {
09249                         degrees_negative = (legsAngles[YAW] - velAng[YAW]);
09250                         degrees_positive = (360 - legsAngles[YAW]) + velAng[YAW];
09251                 }
09252                 else
09253                 {
09254                         degrees_negative = legsAngles[YAW] + (360 - velAng[YAW]);
09255                         degrees_positive = (velAng[YAW] - legsAngles[YAW]);
09256                 }
09257 
09258                 if ( degrees_negative < degrees_positive )
09259                 {
09260                         dif = degrees_negative;
09261                         adddir = 0;
09262                 }
09263                 else
09264                 {
09265                         dif = degrees_positive;
09266                         adddir = 1;
09267                 }
09268 
09269                 if (dif > 90)
09270                 {
09271                         dif = (180 - dif);
09272                 }
09273 
09274                 if (dif > 60)
09275                 {
09276                         dif = 60;
09277                 }
09278 
09279                 //Slight hack for when playing is running backward
09280                 if (dir == 3 || dir == 5)
09281                 {
09282                         dif = -dif;
09283                 }
09284 
09285                 if (adddir)
09286                 {
09287                         legsAngles[YAW] -= dif;
09288                 }
09289                 else
09290                 {
09291                         legsAngles[YAW] += dif;
09292                 }
09293         }
09294 
09295         if (cent->m_iVehicleNum)
09296         { //swing instantly on vehicles
09297                 *lYawAngle = legsAngles[YAW];
09298         }
09299         else
09300         {
09301                 BG_SwingAngles( legsAngles[YAW], /*40*/0, 90, 0.65, lYawAngle, lYawing, frametime );
09302         }
09303         legsAngles[YAW] = *lYawAngle;
09304 
09305         /*
09306         // pain twitch
09307         CG_AddPainTwitch( cent, torsoAngles );
09308         */
09309 
09310         legsAngles[ROLL] = 0;
09311         torsoAngles[ROLL] = 0;
09312 
09313 //      VectorCopy(legsAngles, turAngles);
09314 
09315         // pull the angles back out of the hierarchial chain
09316         AnglesSubtract( headAngles, torsoAngles, headAngles );
09317         AnglesSubtract( torsoAngles, legsAngles, torsoAngles );
09318 
09319         legsAngles[PITCH] = 0;
09320 
09321         if (cent->heldByClient)
09322         { //keep the base angles clear when doing the IK stuff, it doesn't compensate for it.
09323           //rwwFIXMEFIXME: Store leg angles off and add them to all the fed in angles for G2 functions?
09324                 VectorClear(legsAngles);
09325                 legsAngles[YAW] = cent_lerpAngles[YAW];
09326         }
09327 
09328 #ifdef BONE_BASED_LEG_ANGLES
09329         legBoneYaw = legsAngles[YAW];
09330         VectorClear(legsAngles);
09331         legsAngles[YAW] = cent_lerpAngles[YAW];
09332 #endif
09333 
09334         VectorCopy(legsAngles, turAngles);
09335 
09336         AnglesToAxis( legsAngles, legs );
09337 
09338         VectorCopy( cent_lerpAngles, viewAngles );
09339         viewAngles[YAW] = viewAngles[ROLL] = 0;
09340         viewAngles[PITCH] *= 0.5;
09341 
09342         VectorSet( angles, 0, legsAngles[1], 0 );
09343 
09344         angles[0] = legsAngles[0];
09345         if ( angles[0] > 30 )
09346         {
09347                 angles[0] = 30;
09348         }
09349         else if ( angles[0] < -30 )
09350         {
09351                 angles[0] = -30;
09352         }
09353 
09354         if (cent->weapon == WP_EMPLACED_GUN &&
09355                 emplaced)
09356         { //if using an emplaced gun, then we want to make sure we're angled to "hold" it right
09357                 vec3_t facingAngles;
09358 
09359                 VectorSubtract(emplaced->pos.trBase, cent_lerpOrigin, facingAngles);
09360                 vectoangles(facingAngles, facingAngles);
09361 
09362                 if (emplaced->weapon == WP_NONE)
09363                 { //e-web
09364                         VectorCopy(facingAngles, legsAngles);
09365                         AnglesToAxis( legsAngles, legs );
09366                 }
09367                 else
09368                 { //misc emplaced
09369                         float dif = AngleSubtract(cent_lerpAngles[YAW], facingAngles[YAW]);
09370 
09371                         /*
09372                         if (emplaced->weapon == WP_NONE)
09373                         { //offset is a little bit different for the e-web
09374                                 dif -= 16.0f;
09375                         }
09376                         */
09377 
09378                         VectorSet(facingAngles, -16.0f, -dif, 0.0f);
09379 
09380                         if (cent->legsAnim == BOTH_STRAFE_LEFT1 || cent->legsAnim == BOTH_STRAFE_RIGHT1)
09381                         { //try to adjust so it doesn't look wrong
09382                                 if (crazySmoothFactor)
09383                                 { //want to smooth a lot during this because it chops around and looks like ass
09384                                         *crazySmoothFactor = time + 1000;
09385                                 }
09386 
09387                                 BG_G2ClientSpineAngles(ghoul2, motionBolt, cent_lerpOrigin, cent_lerpAngles, cent, time,
09388                                         viewAngles, ciLegs, ciTorso, angles, thoracicAngles, ulAngles, llAngles, modelScale,
09389                                         tPitchAngle, tYawAngle, corrTime);
09390                                 strap_G2API_SetBoneAngles(ghoul2, 0, "lower_lumbar", llAngles, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09391                                 strap_G2API_SetBoneAngles(ghoul2, 0, "upper_lumbar", ulAngles, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09392                                 strap_G2API_SetBoneAngles(ghoul2, 0, "cranium", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09393 
09394                                 VectorAdd(facingAngles, thoracicAngles, facingAngles);
09395 
09396                                 if (cent->legsAnim == BOTH_STRAFE_LEFT1)
09397                                 { //this one needs some further correction
09398                                         facingAngles[YAW] -= 32.0f;
09399                                 }
09400                         }
09401                         else
09402                         {
09403                                 //strap_G2API_SetBoneAngles(ghoul2, 0, "lower_lumbar", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09404                                 //strap_G2API_SetBoneAngles(ghoul2, 0, "upper_lumbar", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09405                                 strap_G2API_SetBoneAngles(ghoul2, 0, "cranium", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time);
09406                         }
09407 
09408                         VectorScale(facingAngles, 0.6f, facingAngles);
09409                         strap_G2API_SetBoneAngles(ghoul2, 0, "lower_lumbar", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09410                         VectorScale(facingAngles, 0.8f, facingAngles);
09411                         strap_G2API_SetBoneAngles(ghoul2, 0, "upper_lumbar", facingAngles, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09412                         VectorScale(facingAngles, 0.8f, facingAngles);
09413                         strap_G2API_SetBoneAngles(ghoul2, 0, "thoracic", facingAngles, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09414 
09415                         //Now we want the head angled toward where we are facing
09416                         VectorSet(facingAngles, 0.0f, dif, 0.0f);
09417                         VectorScale(facingAngles, 0.6f, facingAngles);
09418                         strap_G2API_SetBoneAngles(ghoul2, 0, "cervical", facingAngles, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09419 
09420                         return; //don't have to bother with the rest then
09421                 }
09422         }
09423 
09424         BG_G2ClientSpineAngles(ghoul2, motionBolt, cent_lerpOrigin, cent_lerpAngles, cent, time,
09425                 viewAngles, ciLegs, ciTorso, angles, thoracicAngles, ulAngles, llAngles, modelScale,
09426                 tPitchAngle, tYawAngle, corrTime);
09427 
09428         VectorCopy(cent_lerpAngles, eyeAngles);
09429 
09430         for ( i = 0; i < 3; i++ )
09431         {
09432                 lookAngles[i] = AngleNormalize180( lookAngles[i] );
09433                 eyeAngles[i] = AngleNormalize180( eyeAngles[i] );
09434         }
09435         AnglesSubtract( lookAngles, eyeAngles, lookAngles );
09436 
09437         BG_UpdateLookAngles(lookTime, lastHeadAngles, time, lookAngles, lookSpeed, -50.0f, 50.0f, -70.0f, 70.0f, -30.0f, 30.0f);
09438 
09439         BG_G2ClientNeckAngles(ghoul2, time, lookAngles, headAngles, neckAngles, thoracicAngles, headClampMinAngles, headClampMaxAngles);
09440 
09441 #ifdef BONE_BASED_LEG_ANGLES
09442         {
09443                 vec3_t bLAngles;
09444                 VectorClear(bLAngles);
09445                 bLAngles[ROLL] = AngleNormalize180((legBoneYaw - cent_lerpAngles[YAW]));
09446                 strap_G2API_SetBoneAngles(ghoul2, 0, "model_root", bLAngles, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09447 
09448                 if (!llAngles[YAW])
09449                 {
09450                         llAngles[YAW] -= bLAngles[ROLL];
09451                 }
09452         }
09453 #endif
09454         strap_G2API_SetBoneAngles(ghoul2, 0, "lower_lumbar", llAngles, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09455         strap_G2API_SetBoneAngles(ghoul2, 0, "upper_lumbar", ulAngles, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09456         strap_G2API_SetBoneAngles(ghoul2, 0, "thoracic", thoracicAngles, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time); 
09457         //strap_G2API_SetBoneAngles(ghoul2, 0, "cervical", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time);
09458 }

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
 

Definition at line 8577 of file bg_pmove.c.

References sharedSetBoneIKStateParams_t::angles, sharedRagDollUpdateParams_t::angles, bgHumanoidAnimations, sharedSetBoneIKStateParams_t::blendTime, BONE_ANGLES_POSTMULT, sharedIKMoveParams_t::boneName, sharedIKMoveParams_t::desiredOrigin, sharedSetBoneIKStateParams_t::endFrame, entityState_t, animation_s::firstFrame, sharedSetBoneIKStateParams_t::forceAnimOnBone, IKS_DYNAMIC, IKS_NONE, mdxaBone_t::matrix, sharedRagDollUpdateParams_t::me, sharedIKMoveParams_t::movementSpeed, NEGATIVE_Y, NEGATIVE_Z, NULL, entityState_s::number, animation_s::numFrames, sharedSetBoneIKStateParams_t::origin, sharedIKMoveParams_t::origin, sharedSetBoneIKStateParams_t::pcjMaxs, sharedSetBoneIKStateParams_t::pcjMins, sharedSetBoneIKStateParams_t::pcjOverrides, PITCH, sharedRagDollUpdateParams_t::position, POSITIVE_X, qfalse, qtrue, sharedSetBoneIKStateParams_t::radius, ROLL, sharedSetBoneIKStateParams_t::scale, sharedRagDollUpdateParams_t::scale, sharedSetBoneIKStateParams_t::startFrame, strap_G2API_AnimateG2Models(), strap_G2API_GetBoltMatrix(), strap_G2API_GetBoneAnim(), strap_G2API_IKMove(), strap_G2API_SetBoneAngles(), strap_G2API_SetBoneAnim(), strap_G2API_SetBoneIKState(), vec3_origin, vec3_t, VectorClear, VectorCopy, VectorSet, VectorSubtract, and sharedRagDollUpdateParams_t::velocity.

08579 {
08580         mdxaBone_t lHandMatrix;
08581         vec3_t lHand;
08582         vec3_t torg;
08583         float distToDest;
08584 
08585         if (!ghoul2)
08586         {
08587                 return;
08588         }
08589 
08590         assert(bgHumanoidAnimations[basePose].firstFrame > 0);
08591 
08592         if (!*ikInProgress && !forceHalt)
08593         {
08594                 int baseposeAnim = basePose;
08595                 sharedSetBoneIKStateParams_t ikP;
08596 
08597                 //restrict the shoulder joint
08598                 //VectorSet(ikP.pcjMins,-50.0f,-80.0f,-15.0f);
08599                 //VectorSet(ikP.pcjMaxs,15.0f,40.0f,15.0f);
08600 
08601                 //for now, leaving it unrestricted, but restricting elbow joint.
08602                 //This lets us break the arm however we want in order to fling people
08603                 //in throws, and doesn't look bad.
08604                 VectorSet(ikP.pcjMins,0,0,0);
08605                 VectorSet(ikP.pcjMaxs,0,0,0);
08606 
08607                 //give the info on our entity.
08608                 ikP.blendTime = blendTime;
08609                 VectorCopy(origin, ikP.origin);
08610                 VectorCopy(angles, ikP.angles);
08611                 ikP.angles[PITCH] = 0;
08612                 ikP.pcjOverrides = 0;
08613                 ikP.radius = 10.0f;
08614                 VectorCopy(scale, ikP.scale);
08615                 
08616                 //base pose frames for the limb
08617                 ikP.startFrame = bgHumanoidAnimations[baseposeAnim].firstFrame + bgHumanoidAnimations[baseposeAnim].numFrames;
08618                 ikP.endFrame = bgHumanoidAnimations[baseposeAnim].firstFrame + bgHumanoidAnimations[baseposeAnim].numFrames;
08619 
08620                 ikP.forceAnimOnBone = qfalse; //let it use existing anim if it's the same as this one.
08621 
08622                 //we want to call with a null bone name first. This will init all of the
08623                 //ik system stuff on the g2 instance, because we need ragdoll effectors
08624                 //in order for our pcj's to know how to angle properly.
08625                 if (!strap_G2API_SetBoneIKState(ghoul2, time, NULL, IKS_DYNAMIC, &ikP))
08626                 {
08627                         assert(!"Failed to init IK system for g2 instance!");
08628                 }
08629 
08630                 //Now, create our IK bone state.
08631                 if (strap_G2API_SetBoneIKState(ghoul2, time, "lhumerus", IKS_DYNAMIC, &ikP))
08632                 {
08633                         //restrict the elbow joint
08634                         VectorSet(ikP.pcjMins,-90.0f,-20.0f,-20.0f);
08635                         VectorSet(ikP.pcjMaxs,30.0f,20.0f,-20.0f);
08636 
08637                         if (strap_G2API_SetBoneIKState(ghoul2, time, "lradius", IKS_DYNAMIC, &ikP))
08638                         { //everything went alright.
08639                                 *ikInProgress = qtrue;
08640                         }
08641                 }
08642         }
08643 
08644         if (*ikInProgress && !forceHalt)
08645         { //actively update our ik state.
08646                 sharedIKMoveParams_t ikM;
08647                 sharedRagDollUpdateParams_t tuParms;
08648                 vec3_t tAngles;
08649 
08650                 //set the argument struct up
08651                 VectorCopy(desiredPos, ikM.desiredOrigin); //we want the bone to move here.. if possible
08652 
08653                 VectorCopy(angles, tAngles);
08654                 tAngles[PITCH] = tAngles[ROLL] = 0;
08655 
08656                 strap_G2API_GetBoltMatrix(ghoul2, 0, lHandBolt, &lHandMatrix, tAngles, origin, time, 0, scale);
08657                 //Get the point position from the matrix.
08658                 lHand[0] = lHandMatrix.matrix[0][3];
08659                 lHand[1] = lHandMatrix.matrix[1][3];
08660                 lHand[2] = lHandMatrix.matrix[2][3];
08661 
08662                 VectorSubtract(lHand, desiredPos, torg);
08663                 distToDest = VectorLength(torg);
08664 
08665                 //closer we are, more we want to keep updated.
08666                 //if we're far away we don't want to be too fast or we'll start twitching all over.
08667                 if (distToDest < 2)
08668                 { //however if we're this close we want very precise movement
08669                         ikM.movementSpeed = 0.4f;
08670                 }
08671                 else if (distToDest < 16)
08672                 {
08673                         ikM.movementSpeed = 0.9f;//8.0f;
08674                 }
08675                 else if (distToDest < 32)
08676                 {
08677                         ikM.movementSpeed = 0.8f;//4.0f;
08678                 }
08679                 else if (distToDest < 64)
08680                 {
08681                         ikM.movementSpeed = 0.7f;//2.0f;
08682                 }
08683                 else
08684                 {
08685                         ikM.movementSpeed = 0.6f;
08686                 }
08687                 VectorCopy(origin, ikM.origin); //our position in the world.
08688 
08689                 ikM.boneName[0] = 0;
08690                 if (strap_G2API_IKMove(ghoul2, time, &ikM))
08691                 {
08692                         //now do the standard model animate stuff with ragdoll update params.
08693                         VectorCopy(angles, tuParms.angles);
08694                         tuParms.angles[PITCH] = 0;
08695 
08696                         VectorCopy(origin, tuParms.position);
08697                         VectorCopy(scale, tuParms.scale);
08698 
08699                         tuParms.me = ent->number;
08700                         VectorClear(tuParms.velocity);
08701 
08702                         strap_G2API_AnimateG2Models(ghoul2, time, &tuParms);
08703                 }
08704                 else
08705                 {
08706                         *ikInProgress = qfalse;
08707                 }
08708         }
08709         else if (*ikInProgress)
08710         { //kill it
08711                 float cFrame, animSpeed;
08712                 int sFrame, eFrame, flags;
08713 
08714                 strap_G2API_SetBoneIKState(ghoul2, time, "lhumerus", IKS_NONE, NULL);
08715                 strap_G2API_SetBoneIKState(ghoul2, time, "lradius", IKS_NONE, NULL);
08716                 
08717                 //then reset the angles/anims on these PCJs
08718                 strap_G2API_SetBoneAngles(ghoul2, 0, "lhumerus", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, NULL, 0, time);
08719                 strap_G2API_SetBoneAngles(ghoul2, 0, "lradius", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, NULL, 0, time);
08720 
08721                 //Get the anim/frames that the pelvis is on exactly, and match the left arm back up with them again.
08722                 strap_G2API_GetBoneAnim(ghoul2, "pelvis", (const int)time, &cFrame, &sFrame, &eFrame, &flags, &animSpeed, 0, 0);
08723                 strap_G2API_SetBoneAnim(ghoul2, 0, "lhumerus", sFrame, eFrame, flags, animSpeed, time, sFrame, 300);
08724                 strap_G2API_SetBoneAnim(ghoul2, 0, "lradius", sFrame, eFrame, flags, animSpeed, time, sFrame, 300);
08725 
08726                 //And finally, get rid of all the ik state effector data by calling with null bone name (similar to how we init it).
08727                 strap_G2API_SetBoneIKState(ghoul2, time, NULL, IKS_NONE, NULL);
08728                 
08729                 *ikInProgress = qfalse;
08730         }
08731 }

qboolean BG_InKnockDown int  anim  ) 
 

Definition at line 8526 of file bg_pmove.c.

References BOTH_FORCE_GETUP_B1, BOTH_FORCE_GETUP_B2, BOTH_FORCE_GETUP_B3, BOTH_FORCE_GETUP_B4, BOTH_FORCE_GETUP_B5, BOTH_FORCE_GETUP_F1, BOTH_FORCE_GETUP_F2, BOTH_GETUP1, BOTH_GETUP2, BOTH_GETUP3, BOTH_GETUP4, BOTH_GETUP5, 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_KNOCKDOWN1, BOTH_KNOCKDOWN2, BOTH_KNOCKDOWN3, BOTH_KNOCKDOWN4, BOTH_KNOCKDOWN5, qboolean, qfalse, and qtrue.

Referenced by ForcePowerUsableOn(), and PM_CheckStabDown().

08527 {
08528         switch ( (anim) )
08529         {
08530         case BOTH_KNOCKDOWN1:
08531         case BOTH_KNOCKDOWN2:
08532         case BOTH_KNOCKDOWN3:
08533         case BOTH_KNOCKDOWN4:
08534         case BOTH_KNOCKDOWN5:
08535                 return qtrue;
08536                 break;
08537         case BOTH_GETUP1:
08538         case BOTH_GETUP2:
08539         case BOTH_GETUP3:
08540         case BOTH_GETUP4:
08541         case BOTH_GETUP5:
08542         case BOTH_FORCE_GETUP_F1:
08543         case BOTH_FORCE_GETUP_F2:
08544         case BOTH_FORCE_GETUP_B1:
08545         case BOTH_FORCE_GETUP_B2:
08546         case BOTH_FORCE_GETUP_B3:
08547         case BOTH_FORCE_GETUP_B4:
08548         case BOTH_FORCE_GETUP_B5:
08549         case BOTH_GETUP_BROLL_B:
08550         case BOTH_GETUP_BROLL_F:
08551         case BOTH_GETUP_BROLL_L:
08552         case BOTH_GETUP_BROLL_R:
08553         case BOTH_GETUP_FROLL_B:
08554         case BOTH_GETUP_FROLL_F:
08555         case BOTH_GETUP_FROLL_L:
08556         case BOTH_GETUP_FROLL_R:
08557                 return qtrue;
08558                 break;
08559         }
08560         return qfalse;
08561 }

qboolean BG_InRoll2 entityState_t es  ) 
 

Definition at line 9059 of file bg_pmove.c.

References 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, entityState_t, entityState_s::legsAnim, qboolean, qfalse, and qtrue.

Referenced by BG_G2PlayerAngles().

09060 {
09061         switch ( (es->legsAnim) )
09062         {
09063         case BOTH_GETUP_BROLL_B:
09064         case BOTH_GETUP_BROLL_F:
09065         case BOTH_GETUP_BROLL_L:
09066         case BOTH_GETUP_BROLL_R:
09067         case BOTH_GETUP_FROLL_B:
09068         case BOTH_GETUP_FROLL_F:
09069         case BOTH_GETUP_FROLL_L:
09070         case BOTH_GETUP_FROLL_R:
09071         case BOTH_ROLL_F:
09072         case BOTH_ROLL_B:
09073         case BOTH_ROLL_R:
09074         case BOTH_ROLL_L:
09075                 return qtrue;
09076                 break;
09077         }
09078         return qfalse;
09079 }

qboolean BG_InRollAnim entityState_t cent  ) 
 

Definition at line 8513 of file bg_pmove.c.

References BOTH_ROLL_B, BOTH_ROLL_F, BOTH_ROLL_L, BOTH_ROLL_R, entityState_t, entityState_s::legsAnim, qboolean, qfalse, and qtrue.

08514 {
08515         switch ( (cent->legsAnim) )
08516         {
08517         case BOTH_ROLL_F:
08518         case BOTH_ROLL_B:
08519         case BOTH_ROLL_R:
08520         case BOTH_ROLL_L:
08521                 return qtrue;
08522         }
08523         return qfalse;
08524 }

qboolean BG_InRollES entityState_t ps,
int  anim
 

Definition at line 8563 of file bg_pmove.c.

References BOTH_ROLL_B, BOTH_ROLL_F, BOTH_ROLL_L, BOTH_ROLL_R, entityState_t, qboolean, qfalse, and qtrue.

08564 {
08565         switch ( (anim) )
08566         {
08567         case BOTH_ROLL_F:
08568         case BOTH_ROLL_B:
08569         case BOTH_ROLL_R:
08570         case BOTH_ROLL_L:
08571                 return qtrue;
08572                 break;
08573         }
08574         return qfalse;
08575 }

qboolean BG_InSlopeAnim int  anim  ) 
 

Definition at line 4743 of file bg_pmove.c.

References LEGS_LEFTUP1, LEGS_LEFTUP2, LEGS_LEFTUP3, LEGS_LEFTUP4, LEGS_LEFTUP5, LEGS_RIGHTUP1, LEGS_RIGHTUP2, LEGS_RIGHTUP3, LEGS_RIGHTUP4, LEGS_RIGHTUP5, LEGS_S1_LUP1, LEGS_S1_LUP2, LEGS_S1_LUP3, LEGS_S1_LUP4, LEGS_S1_LUP5, LEGS_S1_RUP1, LEGS_S1_RUP2, LEGS_S1_RUP3, LEGS_S1_RUP4, LEGS_S1_RUP5, LEGS_S3_LUP1, LEGS_S3_LUP2, LEGS_S3_LUP3, LEGS_S3_LUP4, LEGS_S3_LUP5, LEGS_S3_RUP1, LEGS_S3_RUP2, LEGS_S3_RUP3, LEGS_S3_RUP4, LEGS_S3_RUP5, LEGS_S4_LUP1, LEGS_S4_LUP2, LEGS_S4_LUP3, LEGS_S4_LUP4, LEGS_S4_LUP5, LEGS_S4_RUP1, LEGS_S4_RUP2, LEGS_S4_RUP3, LEGS_S4_RUP4, LEGS_S4_RUP5, LEGS_S5_LUP1, LEGS_S5_LUP2, LEGS_S5_LUP3, LEGS_S5_LUP4, LEGS_S5_LUP5, LEGS_S5_RUP1, LEGS_S5_RUP2, LEGS_S5_RUP3, LEGS_S5_RUP4, LEGS_S5_RUP5, qboolean, qfalse, and qtrue.

Referenced by PM_SetSaberMove(), and PM_WeaponLightsaber().

04744 {
04745         switch ( anim )
04746         {
04747         case LEGS_LEFTUP1:                      //# On a slope with left foot 4 higher than right
04748         case LEGS_LEFTUP2:                      //# On a slope with left foot 8 higher than right
04749         case LEGS_LEFTUP3:                      //# On a slope with left foot 12 higher than right
04750         case LEGS_LEFTUP4:                      //# On a slope with left foot 16 higher than right
04751         case LEGS_LEFTUP5:                      //# On a slope with left foot 20 higher than right
04752         case LEGS_RIGHTUP1:                     //# On a slope with RIGHT foot 4 higher than left
04753         case LEGS_RIGHTUP2:                     //# On a slope with RIGHT foot 8 higher than left
04754         case LEGS_RIGHTUP3:                     //# On a slope with RIGHT foot 12 higher than left
04755         case LEGS_RIGHTUP4:                     //# On a slope with RIGHT foot 16 higher than left
04756         case LEGS_RIGHTUP5:                     //# On a slope with RIGHT foot 20 higher than left
04757         case LEGS_S1_LUP1:
04758         case LEGS_S1_LUP2:
04759         case LEGS_S1_LUP3:
04760         case LEGS_S1_LUP4:
04761         case LEGS_S1_LUP5:
04762         case LEGS_S1_RUP1:
04763         case LEGS_S1_RUP2:
04764         case LEGS_S1_RUP3:
04765         case LEGS_S1_RUP4:
04766         case LEGS_S1_RUP5:
04767         case LEGS_S3_LUP1:
04768         case LEGS_S3_LUP2:
04769         case LEGS_S3_LUP3:
04770         case LEGS_S3_LUP4:
04771         case LEGS_S3_LUP5:
04772         case LEGS_S3_RUP1:
04773         case LEGS_S3_RUP2:
04774         case LEGS_S3_RUP3:
04775         case LEGS_S3_RUP4:
04776         case LEGS_S3_RUP5:
04777         case LEGS_S4_LUP1:
04778         case LEGS_S4_LUP2:
04779         case LEGS_S4_LUP3:
04780         case LEGS_S4_LUP4:
04781         case LEGS_S4_LUP5:
04782         case LEGS_S4_RUP1:
04783         case LEGS_S4_RUP2:
04784         case LEGS_S4_RUP3:
04785         case LEGS_S4_RUP4:
04786         case LEGS_S4_RUP5:
04787         case LEGS_S5_LUP1:
04788         case LEGS_S5_LUP2:
04789         case LEGS_S5_LUP3:
04790         case LEGS_S5_LUP4:
04791         case LEGS_S5_LUP5:
04792         case LEGS_S5_RUP1:
04793         case LEGS_S5_RUP2:
04794         case LEGS_S5_RUP3:
04795         case LEGS_S5_RUP4:
04796         case LEGS_S5_RUP5:
04797                 return qtrue;
04798                 break;
04799         }
04800         return qfalse;
04801 }

qboolean BG_KnockDownable playerState_t ps  ) 
 

Definition at line 218 of file bg_pmove.c.

References playerState_s::emplacedIndex, playerState_s::m_iVehicleNum, playerState_t, qboolean, qfalse, and qtrue.

Referenced by ClientCommand(), ClientThink_real(), ForceThrow(), G_Knockdown(), PM_SaberLockBreak(), PM_VehicleImpact(), and Wampa_Slash().

00219 {
00220         if (!ps)
00221         { //just for safety
00222                 return qfalse;
00223         }
00224 
00225         if (ps->m_iVehicleNum)
00226         { //riding a vehicle, don't knock me down
00227                 return qfalse;
00228         }
00229 
00230         if (ps->emplacedIndex)
00231         { //using emplaced gun or eweb, can't be knocked down
00232                 return qfalse;
00233         }
00234 
00235         //ok, I guess?
00236         return qtrue;
00237 }

saberInfo_t* BG_MySaber int  clientNum,
int  saberNum
 

qboolean BG_SaberLockBreakAnim int  anim  ) 
 

Definition at line 1487 of file bg_panimate.c.

References BG_SuperBreakLoseAnim(), BG_SuperBreakWinAnim(), BOTH_BF1BREAK, BOTH_BF2BREAK, BOTH_CCWCIRCLEBREAK, BOTH_CWCIRCLEBREAK, BOTH_LK_DL_DL_S_B_1_L, BOTH_LK_DL_DL_S_B_1_W, BOTH_LK_DL_DL_T_B_1_L, BOTH_LK_DL_DL_T_B_1_W, BOTH_LK_DL_S_S_B_1_L, BOTH_LK_DL_S_S_B_1_W, BOTH_LK_DL_S_T_B_1_L, BOTH_LK_DL_S_T_B_1_W, BOTH_LK_DL_ST_S_B_1_L, BOTH_LK_DL_ST_S_B_1_W, BOTH_LK_DL_ST_T_B_1_L, BOTH_LK_DL_ST_T_B_1_W, BOTH_LK_S_DL_S_B_1_L, BOTH_LK_S_DL_S_B_1_W, BOTH_LK_S_DL_T_B_1_L, BOTH_LK_S_DL_T_B_1_W, BOTH_LK_S_S_S_B_1_L, BOTH_LK_S_S_S_B_1_W, BOTH_LK_S_S_T_B_1_L, BOTH_LK_S_S_T_B_1_W, BOTH_LK_S_ST_S_B_1_L, BOTH_LK_S_ST_S_B_1_W, BOTH_LK_S_ST_T_B_1_L, BOTH_LK_S_ST_T_B_1_W, BOTH_LK_ST_DL_S_B_1_L, BOTH_LK_ST_DL_S_B_1_W, BOTH_LK_ST_DL_T_B_1_L, BOTH_LK_ST_DL_T_B_1_W, BOTH_LK_ST_S_S_B_1_L, BOTH_LK_ST_S_S_B_1_W, BOTH_LK_ST_S_T_B_1_L, BOTH_LK_ST_S_T_B_1_W, BOTH_LK_ST_ST_S_B_1_L, BOTH_LK_ST_ST_S_B_1_W, BOTH_LK_ST_ST_T_B_1_L, BOTH_LK_ST_ST_T_B_1_W, qboolean, and qtrue.

Referenced by BG_G2PlayerAngles(), and PmoveSingle().

01488 {
01489         switch ( anim )
01490         {
01491         case BOTH_BF1BREAK:
01492         case BOTH_BF2BREAK:
01493         case BOTH_CWCIRCLEBREAK:
01494         case BOTH_CCWCIRCLEBREAK:
01495         case BOTH_LK_S_DL_S_B_1_L:      //normal break I lost
01496         case BOTH_LK_S_DL_S_B_1_W:      //normal break I won
01497         case BOTH_LK_S_DL_T_B_1_L:      //normal break I lost
01498         case BOTH_LK_S_DL_T_B_1_W:      //normal break I won
01499         case BOTH_LK_S_ST_S_B_1_L:      //normal break I lost
01500         case BOTH_LK_S_ST_S_B_1_W:      //normal break I won
01501         case BOTH_LK_S_ST_T_B_1_L:      //normal break I lost
01502         case BOTH_LK_S_ST_T_B_1_W:      //normal break I won
01503         case BOTH_LK_S_S_S_B_1_L:       //normal break I lost
01504         case BOTH_LK_S_S_S_B_1_W:       //normal break I won
01505         case BOTH_LK_S_S_T_B_1_L:       //normal break I lost
01506         case BOTH_LK_S_S_T_B_1_W:       //normal break I won
01507         case BOTH_LK_DL_DL_S_B_1_L:     //normal break I lost
01508         case BOTH_LK_DL_DL_S_B_1_W:     //normal break I won
01509         case BOTH_LK_DL_DL_T_B_1_L:     //normal break I lost
01510         case BOTH_LK_DL_DL_T_B_1_W:     //normal break I won
01511         case BOTH_LK_DL_ST_S_B_1_L:     //normal break I lost
01512         case BOTH_LK_DL_ST_S_B_1_W:     //normal break I won
01513         case BOTH_LK_DL_ST_T_B_1_L:     //normal break I lost
01514         case BOTH_LK_DL_ST_T_B_1_W:     //normal break I won
01515         case BOTH_LK_DL_S_S_B_1_L:      //normal break I lost
01516         case BOTH_LK_DL_S_S_B_1_W:      //normal break I won
01517         case BOTH_LK_DL_S_T_B_1_L:      //normal break I lost
01518         case BOTH_LK_DL_S_T_B_1_W:      //normal break I won
01519         case BOTH_LK_ST_DL_S_B_1_L:     //normal break I lost
01520         case BOTH_LK_ST_DL_S_B_1_W:     //normal break I won
01521         case BOTH_LK_ST_DL_T_B_1_L:     //normal break I lost
01522         case BOTH_LK_ST_DL_T_B_1_W:     //normal break I won
01523         case BOTH_LK_ST_ST_S_B_1_L:     //normal break I lost
01524         case BOTH_LK_ST_ST_S_B_1_W:     //normal break I won
01525         case BOTH_LK_ST_ST_T_B_1_L:     //normal break I lost
01526         case BOTH_LK_ST_ST_T_B_1_W:     //normal break I won
01527         case BOTH_LK_ST_S_S_B_1_L:      //normal break I lost
01528         case BOTH_LK_ST_S_S_B_1_W:      //normal break I won
01529         case BOTH_LK_ST_S_T_B_1_L:      //normal break I lost
01530         case BOTH_LK_ST_S_T_B_1_W:      //normal break I won
01531                 return qtrue;
01532                 break;
01533         }
01534         return (BG_SuperBreakLoseAnim(anim)||BG_SuperBreakWinAnim(anim));
01535 }

qboolean BG_SabersOff playerState_t ps  ) 
 

Definition at line 201 of file bg_pmove.c.

References playerState_s::fd, playerState_t, qboolean, qfalse, qtrue, forcedata_s::saberAnimLevelBase, playerState_s::saberHolstered, SS_DUAL, and SS_STAFF.

Referenced by Jedi_SaberBlockGo(), NPC_BSGrenadier_Attack(), PM_GetSaberStance(), PM_VehicleWeaponAnimate(), PM_WeaponLightsaber(), SaberUpdateSelf(), WP_SaberCanBlock(), WP_SaberPositionUpdate(), WP_SabersIntersect(), and WP_SaberStartMissileBlockCheck().

00202 {
00203         if ( !ps->saberHolstered )
00204         {
00205                 return qfalse;
00206         }
00207         if ( ps->fd.saberAnimLevelBase == SS_DUAL
00208                 || ps->fd.saberAnimLevelBase == SS_STAFF )
00209         {
00210                 if ( ps->saberHolstered < 2 )
00211                 {
00212                         return qfalse;
00213                 }
00214         }
00215         return qtrue;
00216 }

qboolean BG_UnrestrainedPitchRoll playerState_t ps,
Vehicle_t pVeh
 

Definition at line 7785 of file bg_pmove.c.

References bg_fighterAltControl, playerState_s::clientNum, vmCvar_t::integer, playerState_s::m_iVehicleNum, Vehicle_s::m_pVehicleInfo, MAX_CLIENTS, playerState_t, qboolean, qfalse, qtrue, vehicleInfo_t::type, Vehicle_t, and VH_FIGHTER.

Referenced by PM_UpdateViewAngles(), and PM_VehicleViewAngles().

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_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
 

Definition at line 8734 of file bg_pmove.c.

References AngleNormalize180(), PITCH, ROLL, vec3_t, VectorCopy, VectorSubtract, and YAW.

Referenced by BG_G2PlayerAngles().

08735 {
08736         static const float fFrameInter = 0.1f;
08737         static vec3_t oldLookAngles;
08738         static vec3_t lookAnglesDiff;
08739         static int ang;
08740 
08741         if ( lookingDebounceTime > time )
08742         {
08743                 //clamp so don't get "Exorcist" effect
08744                 if ( lookAngles[PITCH] > maxPitch )
08745                 {
08746                         lookAngles[PITCH] = maxPitch;
08747                 }
08748                 else if ( lookAngles[PITCH] < minPitch )
08749                 {
08750                         lookAngles[PITCH] = minPitch;
08751                 }
08752                 if ( lookAngles[YAW] > maxYaw )
08753                 {
08754                         lookAngles[YAW] = maxYaw;
08755                 }
08756                 else if ( lookAngles[YAW] < minYaw )
08757                 {
08758                         lookAngles[YAW] = minYaw;
08759                 }
08760                 if ( lookAngles[ROLL] > maxRoll )
08761                 {
08762                         lookAngles[ROLL] = maxRoll;
08763                 }
08764                 else if ( lookAngles[ROLL] < minRoll )
08765                 {
08766                         lookAngles[ROLL] = minRoll;
08767                 }
08768 
08769                 //slowly lerp to this new value
08770                 //Remember last headAngles
08771                 VectorCopy( lastHeadAngles, oldLookAngles );
08772                 VectorSubtract( lookAngles, oldLookAngles, lookAnglesDiff );
08773 
08774                 for ( ang = 0; ang < 3; ang++ )
08775                 {
08776                         lookAnglesDiff[ang] = AngleNormalize180( lookAnglesDiff[ang] );
08777                 }
08778 
08779                 if( VectorLengthSquared( lookAnglesDiff ) )
08780                 {
08781                         lookAngles[PITCH] = AngleNormalize180( oldLookAngles[PITCH]+(lookAnglesDiff[PITCH]*fFrameInter*lookSpeed) );
08782                         lookAngles[YAW] = AngleNormalize180( oldLookAngles[YAW]+(lookAnglesDiff[YAW]*fFrameInter*lookSpeed) );
08783                         lookAngles[ROLL] = AngleNormalize180( oldLookAngles[ROLL]+(lookAnglesDiff[ROLL]*fFrameInter*lookSpeed) );
08784                 }
08785         }
08786         //Remember current lookAngles next time
08787         VectorCopy( lookAngles, lastHeadAngles );
08788 }

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)
 

Definition at line 9990 of file bg_pmove.c.

References trace_t::allsolid, AnglesToAxis(), DEFAULT_MINS_2, vehicleInfo_t::height, vehicleInfo_t::length, Vehicle_s::m_pVehicleInfo, Vehicle_s::m_vOrientation, trace_t::startsolid, vehicleInfo_t::type, vec3_t, VectorCopy, VectorMA, VectorSet, VectorSubtract, Vehicle_t, VH_FIGHTER, VH_FLIER, and vehicleInfo_t::width.

Referenced by PmoveSingle().

09993 {
09994         if ( !veh 
09995                 || !veh->m_pVehicleInfo->length 
09996                 || !veh->m_pVehicleInfo->width 
09997                 || !veh->m_pVehicleInfo->height )
09998                 //|| veh->m_LandTrace.fraction < 1.0f )
09999         {
10000                 return;
10001         }
10002         else if ( veh->m_pVehicleInfo->type != VH_FIGHTER 
10003                 //&& veh->m_pVehicleInfo->type != VH_SPEEDER 
10004                 && veh->m_pVehicleInfo->type != VH_FLIER )
10005         {//only those types of vehicles have dynamic bboxes, the rest just use a static bbox
10006                 VectorSet( maxs, veh->m_pVehicleInfo->width/2.0f, veh->m_pVehicleInfo->width/2.0f, veh->m_pVehicleInfo->height+DEFAULT_MINS_2 );
10007                 VectorSet( mins, veh->m_pVehicleInfo->width/-2.0f, veh->m_pVehicleInfo->width/-2.0f, DEFAULT_MINS_2 );
10008                 return;
10009         }
10010         else
10011         {
10012                 vec3_t  axis[3], point[8];
10013                 vec3_t  newMins, newMaxs;
10014                 int             curAxis = 0, i;
10015                 trace_t trace;
10016 
10017                 AnglesToAxis( veh->m_vOrientation, axis );
10018                 VectorMA( origin, veh->m_pVehicleInfo->length/2.0f, axis[0], point[0] );
10019                 VectorMA( origin, -veh->m_pVehicleInfo->length/2.0f, axis[0], point[1] );
10020                 //extrapolate each side up and down
10021                 VectorMA( point[0], veh->m_pVehicleInfo->height/2.0f, axis[2], point[0] );
10022                 VectorMA( point[0], -veh->m_pVehicleInfo->height, axis[2], point[2] );
10023                 VectorMA( point[1], veh->m_pVehicleInfo->height/2.0f, axis[2], point[1] );
10024                 VectorMA( point[1], -veh->m_pVehicleInfo->height, axis[2], point[3] );
10025 
10026                 VectorMA( origin, veh->m_pVehicleInfo->width/2.0f, axis[1], point[4] );
10027                 VectorMA( origin, -veh->m_pVehicleInfo->width/2.0f, axis[1], point[5] );
10028                 //extrapolate each side up and down
10029                 VectorMA( point[4], veh->m_pVehicleInfo->height/2.0f, axis[2], point[4] );
10030                 VectorMA( point[4], -veh->m_pVehicleInfo->height, axis[2], point[6] );
10031                 VectorMA( point[5], veh->m_pVehicleInfo->height/2.0f, axis[2], point[5] );
10032                 VectorMA( point[5], -veh->m_pVehicleInfo->height, axis[2], point[7] );
10033                 /*
10034                 VectorMA( origin, veh->m_pVehicleInfo->height/2.0f, axis[2], point[4] );
10035                 VectorMA( origin, -veh->m_pVehicleInfo->height/2.0f, axis[2], point[5] );
10036                 */
10037                 //Now inflate a bbox around these points
10038                 VectorCopy( origin, newMins );
10039                 VectorCopy( origin, newMaxs );
10040                 for ( curAxis = 0; curAxis < 3; curAxis++ )
10041                 {
10042                         for ( i = 0; i < 8; i++ )
10043                         {
10044                                 if ( point[i][curAxis] > newMaxs[curAxis] )
10045                                 {
10046                                         newMaxs[curAxis] = point[i][curAxis];
10047                                 }
10048                                 else if ( point[i][curAxis] < newMins[curAxis] )
10049                                 {
10050                                         newMins[curAxis] = point[i][curAxis];
10051                                 }
10052                         }
10053                 }
10054                 VectorSubtract( newMins, origin, newMins );
10055                 VectorSubtract( newMaxs, origin, newMaxs );
10056                 //now see if that's a valid way to be
10057                 if (localTrace)
10058                 {
10059                         localTrace( &trace, origin, newMins, newMaxs, origin, clientNum, tracemask );
10060                 }
10061                 else
10062                 { //don't care about solid stuff then
10063                         trace.startsolid = trace.allsolid = 0;
10064                 }
10065                 if ( !trace.startsolid && !trace.allsolid )
10066                 {//let's use it!
10067                         VectorCopy( newMins, mins );
10068                         VectorCopy( newMaxs, maxs );
10069                 }
10070                 //else: just use the last one, I guess...?
10071                 //FIXME: make it as close as possible?  Or actually prevent the change in m_vOrientation?  Or push away from anything we hit?
10072         }
10073 }

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

Definition at line 676 of file bg_pmove.c.

References trace_t::fraction, Vehicle_s::m_LandTrace, Vehicle_s::m_pVehicleInfo, MIN_LANDING_SLOPE, vehicleInfo_t::mousePitch, vehicleInfo_t::mouseYaw, cplane_s::normal, trace_t::plane, vehicleInfo_t::speedDependantTurning, vehicleInfo_t::speedMax, and Vehicle_t.

Referenced by CG_DrawActiveFrame().

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 }

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
 

Definition at line 5834 of file bg_pmove.c.

References trace_t::allsolid, bgEntity_t, CG_GetVehicleCamPos(), CONTENTS_BODY, CONTENTS_SOLID, trace_t::endpos, trace_t::entityNum, trace_t::fraction, gentity_t, vehicleInfo_t::length, Vehicle_s::m_pPilot, gentity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, MAX_XHAIR_DIST_ACCURACY, entityState_s::number, pm, gentity_s::s, trace_t::startsolid, pmove_t::trace, trap_Trace(), vec3_origin, vec3_t, VectorCopy, VectorMA, VectorNormalize(), VectorSubtract, and WP_GetVehicleCamPos().

Referenced by PM_RocketLock(), and WP_VehCheckTraceFromCamPos().

05835 {
05836         //NOTE: this MUST stay up to date with the method used in CG_ScanForCrosshairEntity (where it checks the doExtraVehTraceFromViewPos bool)
05837         vec3_t  viewDir2End, extraEnd, camPos;
05838         float   minAutoAimDist;
05839 
05840 #ifdef QAGAME
05841         WP_GetVehicleCamPos( (gentity_t *)bgEnt, (gentity_t *)bgEnt->m_pVehicle->m_pPilot, camPos );
05842 #else
05843         CG_GetVehicleCamPos( camPos );
05844 #endif
05845         
05846         minAutoAimDist = Distance( entOrg, camPos ) + (bgEnt->m_pVehicle->m_pVehicleInfo->length/2.0f) + 200.0f;
05847 
05848         VectorCopy( end, newEnd );
05849         VectorSubtract( end, camPos, viewDir2End );
05850         VectorNormalize( viewDir2End );
05851         VectorMA( camPos, MAX_XHAIR_DIST_ACCURACY, viewDir2End, extraEnd );
05852 
05853 #ifdef QAGAME
05854         trap_Trace( camTrace, camPos, vec3_origin, vec3_origin, extraEnd, 
05855                 bgEnt->s.number, CONTENTS_SOLID|CONTENTS_BODY );
05856 #else
05857         pm->trace( camTrace, camPos, vec3_origin, vec3_origin, extraEnd, 
05858                 bgEnt->s.number, CONTENTS_SOLID|CONTENTS_BODY );
05859 #endif
05860 
05861         if ( !camTrace->allsolid
05862                 && !camTrace->startsolid
05863                 && camTrace->fraction < 1.0f
05864                 && (camTrace->fraction*MAX_XHAIR_DIST_ACCURACY) > minAutoAimDist 
05865                 && ((camTrace->fraction*MAX_XHAIR_DIST_ACCURACY)-Distance( entOrg, camPos )) < bestDist )
05866         {//this trace hit *something* that's closer than the thing the main trace hit, so use this result instead
05867                 VectorCopy( camTrace->endpos, newEnd );
05868                 VectorSubtract( newEnd, shotStart, shotDir );
05869                 VectorNormalize( shotDir );
05870                 return (camTrace->entityNum+1);
05871         }
05872         return 0;
05873 }

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 PM_AddEvent int  newEvent  ) 
 

Definition at line 910 of file bg_pmove.c.

References BG_AddPredictableEventToPlayerstate(), pm, and pmove_t::ps.

Referenced by BG_EnoughForcePowerForMove(), PM_AdjustAngleForWallRunUp(), PM_AdjustAttackStates(), PM_GrabWallForJump(), PM_MoveForKata(), PM_SaberAttackForMovement(), PM_SaberFlipOverAttackMove(), PM_SaberJumpAttackMove(), PM_SaberLockBreak(), PM_SaberLocked(), PM_SaberLungeAttackMove(), PM_SetSaberMove(), PM_StepSlideMove(), PM_VehicleWeaponAnimate(), and PM_WeaponLightsaber().

00910                                  {
00911         BG_AddPredictableEventToPlayerstate( newEvent, 0, pm->ps );
00912 }

void PM_AddEventWithParm int  newEvent,
int  parm
 

Definition at line 914 of file bg_pmove.c.

References BG_AddPredictableEventToPlayerstate(), pm, and pmove_t::ps.

Referenced by PM_BeginWeaponChange(), PM_ItemUsable(), and PmoveSingle().

00915 {
00916         BG_AddPredictableEventToPlayerstate( newEvent, parm, pm->ps );
00917 }

void PM_AddTouchEnt int  entityNum  ) 
 

Definition at line 924 of file bg_pmove.c.

References ENTITYNUM_WORLD, MAXTOUCH, pmove_t::numtouch, pm, and pmove_t::touchents.

Referenced by PM_SlideMove().

00924                                      {
00925         int             i;
00926 
00927         if ( entityNum == ENTITYNUM_WORLD ) {
00928                 return;
00929         }
00930         if ( pm->numtouch == MAXTOUCH ) {
00931                 return;
00932         }
00933 
00934         // see if it is already added
00935         for ( i = 0 ; i < pm->numtouch ; i++ ) {
00936                 if ( pm->touchents[ i ] == entityNum ) {
00937                         return;
00938                 }
00939         }
00940 
00941         // add it
00942         pm->touchents[pm->numtouch] = entityNum;
00943         pm->numtouch++;
00944 }

qboolean PM_AdjustAngleForWallJump playerState_t ps,
usercmd_t ucmd,
qboolean  doMove
 

Definition at line 1607 of file bg_pmove.c.

References ANGLE2SHORT, usercmd_s::angles, AngleVectors(), BG_ForcePowerDrain(), BG_InReboundHold(), BG_InReboundJump(), BOTH_FORCEJUMP1, BOTH_FORCEWALLHOLD_BACK, BOTH_FORCEWALLHOLD_FORWARD, BOTH_FORCEWALLHOLD_LEFT, BOTH_FORCEWALLHOLD_RIGHT, BOTH_FORCEWALLREBOUND_BACK, BOTH_FORCEWALLREBOUND_FORWARD, BOTH_FORCEWALLREBOUND_LEFT, BOTH_FORCEWALLREBOUND_RIGHT, BOTH_FORCEWALLRELEASE_FORWARD, playerState_s::clientNum, pmove_t::debugMelee, playerState_s::delta_angles, fabs(), playerState_s::fd, forcedata_s::forceJumpSound, forcedata_s::forceJumpZStart, usercmd_s::forwardmove, FP_LEVITATION, trace_t::fraction, JUMP_OFF_WALL_SPEED, playerState_s::legsAnim, playerState_s::legsTimer, MASK_PLAYERSOLID, pmove_t::maxs, pmove_t::mins, cplane_s::normal, NULL, playerState_s::origin, trace_t::plane, playerState_t, pm, playerState_s::pm_flags, PM_SetAnim(), PM_SetPMViewAngle(), playerState_s::pm_time, PMF_JUMP_HELD, PMF_STUCK_TO_WALL, PMF_TIME_KNOCKBACK, pmove_t::ps, qboolean, qfalse, qtrue, usercmd_s::rightmove, playerState_s::saberHolstered, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, SETANIM_FLAG_RESTART, SETANIM_LEGS, playerState_s::torsoAnim, playerState_s::torsoTimer, pmove_t::trace, ucmd, usercmd_s::upmove, usercmd_t, vec3_t, VectorMA, VectorScale, VectorSet, vectoyaw(), playerState_s::velocity, playerState_s::viewangles, and YAW.

Referenced by PmoveSingle().

01608 {
01609         if ( ( ( BG_InReboundJump( ps->legsAnim ) || BG_InReboundHold( ps->legsAnim ) )
01610                         && ( BG_InReboundJump( ps->torsoAnim ) || BG_InReboundHold( ps->torsoAnim ) ) )
01611                 || (pm->ps->pm_flags&PMF_STUCK_TO_WALL) )
01612         {//hugging wall, getting ready to jump off
01613                 //stick to wall, if there is one
01614                 vec3_t  checkDir, traceTo, mins, maxs, fwdAngles;
01615                 trace_t trace;
01616                 float   dist = 128.0f, yawAdjust;
01617 
01618                 VectorSet(mins, pm->mins[0],pm->mins[1],0);
01619                 VectorSet(maxs, pm->maxs[0],pm->maxs[1],24);
01620                 VectorSet(fwdAngles, 0, pm->ps->viewangles[YAW], 0);
01621 
01622                 switch ( ps->legsAnim )
01623                 {
01624                 case BOTH_FORCEWALLREBOUND_RIGHT:
01625                 case BOTH_FORCEWALLHOLD_RIGHT:
01626                         AngleVectors( fwdAngles, NULL, checkDir, NULL );
01627                         yawAdjust = -90;
01628                         break;
01629                 case BOTH_FORCEWALLREBOUND_LEFT:
01630                 case BOTH_FORCEWALLHOLD_LEFT:
01631                         AngleVectors( fwdAngles, NULL, checkDir, NULL );
01632                         VectorScale( checkDir, -1, checkDir );
01633                         yawAdjust = 90;
01634                         break;
01635                 case BOTH_FORCEWALLREBOUND_FORWARD:
01636                 case BOTH_FORCEWALLHOLD_FORWARD:
01637                         AngleVectors( fwdAngles, checkDir, NULL, NULL );
01638                         yawAdjust = 180;
01639                         break;
01640                 case BOTH_FORCEWALLREBOUND_BACK:
01641                 case BOTH_FORCEWALLHOLD_BACK:
01642                         AngleVectors( fwdAngles, checkDir, NULL, NULL );
01643                         VectorScale( checkDir, -1, checkDir );
01644                         yawAdjust = 0;
01645                         break;
01646                 default:
01647                         //WTF???
01648                         pm->ps->pm_flags &= ~PMF_STUCK_TO_WALL;
01649                         return qfalse;
01650                         break;
01651                 }
01652                 if ( pm->debugMelee )
01653                 {//uber-skillz
01654                         if ( ucmd->upmove > 0 )
01655                         {//hold on until you let go manually
01656                                 if ( BG_InReboundHold( ps->legsAnim ) )
01657                                 {//keep holding
01658                                         if ( ps->legsTimer < 150 )
01659                                         {
01660                                                 ps->legsTimer = 150;
01661                                         }
01662                                 }
01663                                 else
01664                                 {//if got to hold part of anim, play hold anim
01665                                         if ( ps->legsTimer <= 300 )
01666                                         {
01667                                                 ps->saberHolstered = 2;
01668                                                 PM_SetAnim( SETANIM_BOTH, BOTH_FORCEWALLRELEASE_FORWARD+(ps->legsAnim-BOTH_FORCEWALLHOLD_FORWARD), SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD, 0 );
01669                                                 ps->legsTimer = ps->torsoTimer = 150;
01670                                         }
01671                                 }
01672                         }
01673                 }
01674                 VectorMA( ps->origin, dist, checkDir, traceTo );
01675                 pm->trace( &trace, ps->origin, mins, maxs, traceTo, ps->clientNum, MASK_PLAYERSOLID );
01676                 if ( //ucmd->upmove <= 0 && 
01677                         ps->legsTimer > 100 &&
01678                         trace.fraction < 1.0f && 
01679                         fabs(trace.plane.normal[2]) <= 0.2f/*MAX_WALL_GRAB_SLOPE*/ )
01680                 {//still a vertical wall there
01681                         //FIXME: don't pull around 90 turns
01682                         /*
01683                         if ( ent->s.number || !player_locked )
01684                         {
01685                                 ucmd->forwardmove = 127;
01686                         }
01687                         */
01688                         if ( ucmd->upmove < 0 )
01689                         {
01690                                 ucmd->upmove = 0;
01691                         }
01692                         //align me to the wall
01693                         ps->viewangles[YAW] = vectoyaw( trace.plane.normal )+yawAdjust;
01694                         PM_SetPMViewAngle(ps, ps->viewangles, ucmd);
01695                         /*
01696                         if ( ent->client->ps.viewEntity <= 0 || ent->client->ps.viewEntity >= ENTITYNUM_WORLD )
01697                         {//don't clamp angles when looking through a viewEntity
01698                                 SetClientViewAngle( ent, ent->client->ps.viewangles );
01699                         }
01700                         */
01701                         ucmd->angles[YAW] = ANGLE2SHORT( ps->viewangles[YAW] ) - ps->delta_angles[YAW];
01702                         //if ( ent->s.number || !player_locked )
01703                         if (1)
01704                         {
01705                                 if ( doMove )
01706                                 {
01707                                         //pull me toward the wall
01708                                         VectorScale( trace.plane.normal, -128.0f, ps->velocity );
01709                                 }
01710                         }
01711                         ucmd->upmove = 0;
01712                         ps->pm_flags |= PMF_STUCK_TO_WALL;
01713                         return qtrue;
01714                 }
01715                 else if ( doMove 
01716                         && (ps->pm_flags&PMF_STUCK_TO_WALL))
01717                 {//jump off
01718                         //push off of it!
01719                         ps->pm_flags &= ~PMF_STUCK_TO_WALL;
01720                         ps->velocity[0] = ps->velocity[1] = 0;
01721                         VectorScale( checkDir, -JUMP_OFF_WALL_SPEED, ps->velocity );
01722                         ps->velocity[2] = BG_ForceWallJumpStrength();
01723                         ps->pm_flags |= PMF_JUMP_HELD;//PMF_JUMPING|PMF_JUMP_HELD;
01724                         //G_SoundOnEnt( ent, CHAN_BODY, "sound/weapons/force/jump.wav" );
01725                         ps->fd.forceJumpSound = 1; //this is a stupid thing, i should fix it.
01726                         //ent->client->ps.forcePowersActive |= (1<<FP_LEVITATION);
01727                         if (ps->origin[2] < ps->fd.forceJumpZStart)
01728                         {
01729                                 ps->fd.forceJumpZStart = ps->origin[2];
01730                         }
01731                         //FIXME do I need this?
01732 
01733                         BG_ForcePowerDrain( ps, FP_LEVITATION, 10 );
01734                         //no control for half a second
01735                         ps->pm_flags |= PMF_TIME_KNOCKBACK;
01736                         ps->pm_time = 500;
01737                         ucmd->forwardmove = 0;
01738                         ucmd->rightmove = 0;
01739                         ucmd->upmove = 127;
01740 
01741                         if ( BG_InReboundHold( ps->legsAnim ) )
01742                         {//if was in hold pose, release now
01743                                 PM_SetAnim( SETANIM_BOTH, BOTH_FORCEWALLRELEASE_FORWARD+(ps->legsAnim-BOTH_FORCEWALLHOLD_FORWARD), SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD, 0 );
01744                         }
01745                         else
01746                         {
01747                                 //PM_JumpForDir();
01748                                 PM_SetAnim(SETANIM_LEGS,BOTH_FORCEJUMP1,SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_RESTART, 0);
01749                         }
01750 
01751                         //return qtrue;
01752                 }
01753         }
01754         ps->pm_flags &= ~PMF_STUCK_TO_WALL;
01755         return qfalse;
01756 }

qboolean PM_AdjustAngleForWallRun playerState_t ps,
usercmd_t ucmd,
qboolean  doMove
 

Definition at line 1356 of file bg_pmove.c.

References ANGLE2SHORT, usercmd_s::angles, AngleVectors(), BOTH_WALL_RUN_LEFT, BOTH_WALL_RUN_LEFT_STOP, BOTH_WALL_RUN_RIGHT, BOTH_WALL_RUN_RIGHT_STOP, playerState_s::clientNum, playerState_s::delta_angles, DotProduct, usercmd_s::forwardmove, trace_t::fraction, playerState_s::legsAnim, playerState_s::legsTimer, MASK_PLAYERSOLID, cplane_s::normal, NULL, playerState_s::origin, trace_t::plane, playerState_t, pm, PM_SetAnim(), PM_SetPMViewAngle(), pmove_t::ps, qboolean, qfalse, qtrue, usercmd_s::rightmove, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, pmove_t::trace, ucmd, usercmd_s::upmove, usercmd_t, vec3_t, VectorClear, VectorMA, VectorScale, VectorSet, vectoyaw(), playerState_s::velocity, playerState_s::viewangles, and YAW.

Referenced by PmoveSingle().

01357 {
01358         if (( (ps->legsAnim) == BOTH_WALL_RUN_RIGHT || (ps->legsAnim) == BOTH_WALL_RUN_LEFT ) && ps->legsTimer > 500 )
01359         {//wall-running and not at end of anim
01360                 //stick to wall, if there is one
01361                 vec3_t  fwd, rt, traceTo, mins, maxs, fwdAngles;
01362                 trace_t trace;
01363                 float   dist, yawAdjust;
01364 
01365                 VectorSet(mins, -15, -15, 0);
01366                 VectorSet(maxs, 15, 15, 24);
01367                 VectorSet(fwdAngles, 0, pm->ps->viewangles[YAW], 0);
01368 
01369                 AngleVectors( fwdAngles, fwd, rt, NULL );
01370                 if ( (ps->legsAnim) == BOTH_WALL_RUN_RIGHT )
01371                 {
01372                         dist = 128;
01373                         yawAdjust = -90;
01374                 }
01375                 else
01376                 {
01377                         dist = -128;
01378                         yawAdjust = 90;
01379                 }
01380                 VectorMA( ps->origin, dist, rt, traceTo );
01381                 
01382                 pm->trace( &trace, ps->origin, mins, maxs, traceTo, ps->clientNum, MASK_PLAYERSOLID );
01383 
01384                 if ( trace.fraction < 1.0f 
01385                         && (trace.plane.normal[2] >= 0.0f && trace.plane.normal[2] <= 0.4f) )//&& ent->client->ps.groundEntityNum == ENTITYNUM_NONE )
01386                 {
01387                         trace_t trace2;
01388                         vec3_t traceTo2;
01389                         vec3_t  wallRunFwd, wallRunAngles;
01390                         
01391                         VectorClear( wallRunAngles );
01392                         wallRunAngles[YAW] = vectoyaw( trace.plane.normal )+yawAdjust;
01393                         AngleVectors( wallRunAngles, wallRunFwd, NULL, NULL );
01394 
01395                         VectorMA( pm->ps->origin, 32, wallRunFwd, traceTo2 );
01396                         pm->trace( &trace2, pm->ps->origin, mins, maxs, traceTo2, pm->ps->clientNum, MASK_PLAYERSOLID );
01397                         if ( trace2.fraction < 1.0f && DotProduct( trace2.plane.normal, wallRunFwd ) <= -0.999f )
01398                         {//wall we can't run on in front of us
01399                                 trace.fraction = 1.0f;//just a way to get it to kick us off the wall below
01400                         }
01401                 } 
01402 
01403                 if ( trace.fraction < 1.0f 
01404                         && (trace.plane.normal[2] >= 0.0f&&trace.plane.normal[2] <= 0.4f/*MAX_WALL_RUN_Z_NORMAL*/) )
01405                 {//still a wall there
01406                         if ( (ps->legsAnim) == BOTH_WALL_RUN_RIGHT )
01407                         {
01408                                 ucmd->rightmove = 127;
01409                         }
01410                         else
01411                         {
01412                                 ucmd->rightmove = -127;
01413                         }
01414                         if ( ucmd->upmove < 0 )
01415                         {
01416                                 ucmd->upmove = 0;
01417                         }
01418                         //make me face perpendicular to the wall
01419                         ps->viewangles[YAW] = vectoyaw( trace.plane.normal )+yawAdjust;
01420 
01421                         PM_SetPMViewAngle(ps, ps->viewangles, ucmd);
01422 
01423                         ucmd->angles[YAW] = ANGLE2SHORT( ps->viewangles[YAW] ) - ps->delta_angles[YAW];
01424                         if ( doMove )
01425                         {
01426                                 //push me forward
01427                                 float   zVel = ps->velocity[2];
01428                                 if ( ps->legsTimer > 500 )
01429                                 {//not at end of anim yet
01430                                         float speed = 175;
01431                                         if ( ucmd->forwardmove < 0 )
01432                                         {//slower
01433                                                 speed = 100;
01434                                         }
01435                                         else if ( ucmd->forwardmove > 0 )
01436                                         {
01437                                                 speed = 250;//running speed
01438                                         }
01439                                         VectorScale( fwd, speed, ps->velocity );
01440                                 }
01441                                 ps->velocity[2] = zVel;//preserve z velocity
01442                                 //pull me toward the wall, too
01443                                 VectorMA( ps->velocity, dist, rt, ps->velocity );
01444                         }
01445                         ucmd->forwardmove = 0;
01446                         return qtrue;
01447                 }
01448                 else if ( doMove )
01449                 {//stop it
01450                         if ( (ps->legsAnim) == BOTH_WALL_RUN_RIGHT )
01451                         {
01452                                 PM_SetAnim(SETANIM_BOTH, BOTH_WALL_RUN_RIGHT_STOP, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD, 0);
01453                         }
01454                         else if ( (ps->legsAnim) == BOTH_WALL_RUN_LEFT )
01455                         {
01456                                 PM_SetAnim(SETANIM_BOTH, BOTH_WALL_RUN_LEFT_STOP, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD, 0);
01457                         }
01458                 }
01459         }
01460 
01461         return qfalse;
01462 }

qboolean PM_AdjustAngleForWallRunUp playerState_t ps,
usercmd_t ucmd,
qboolean  doMove
 

Definition at line 1472 of file bg_pmove.c.

References trace_t::allsolid, ANGLE2SHORT, usercmd_s::angles, AngleVectors(), BOTH_FORCEWALLRUNFLIP_ALT, BOTH_FORCEWALLRUNFLIP_END, BOTH_FORCEWALLRUNFLIP_START, playerState_s::clientNum, playerState_s::delta_angles, trace_t::endpos, EV_JUMP, usercmd_s::forwardmove, trace_t::fraction, playerState_s::legsAnim, playerState_s::legsTimer, MASK_PLAYERSOLID, pmove_t::maxs, pmove_t::mins, cplane_s::normal, NULL, playerState_s::origin, trace_t::plane, playerState_t, pm, PM_AddEvent(), playerState_s::pm_flags, PM_SetAnim(), PM_SetPMViewAngle(), PMF_JUMP_HELD, pmove_t::ps, qboolean, qfalse, qtrue, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, trace_t::startsolid, pmove_t::trace, ucmd, usercmd_s::upmove, usercmd_t, vec3_t, VectorCopy, VectorMA, VectorScale, VectorSet, vectoyaw(), playerState_s::velocity, playerState_s::viewangles, and YAW.

Referenced by PmoveSingle().

01473 {
01474         if ( ps->legsAnim == BOTH_FORCEWALLRUNFLIP_START )
01475         {//wall-running up
01476                 //stick to wall, if there is one
01477                 vec3_t  fwd, traceTo, mins, maxs, fwdAngles;
01478                 trace_t trace;
01479                 float   dist = 128;
01480 
01481                 VectorSet(mins, -15,-15,0);
01482                 VectorSet(maxs, 15,15,24);
01483                 VectorSet(fwdAngles, 0, pm->ps->viewangles[YAW], 0);
01484 
01485                 AngleVectors( fwdAngles, fwd, NULL, NULL );
01486                 VectorMA( ps->origin, dist, fwd, traceTo );
01487                 pm->trace( &trace, ps->origin, mins, maxs, traceTo, ps->clientNum, MASK_PLAYERSOLID );
01488                 if ( trace.fraction > 0.5f )
01489                 {//hmm, some room, see if there's a floor right here
01490                         trace_t trace2;
01491                         vec3_t  top, bottom;
01492 
01493                         VectorCopy( trace.endpos, top );
01494                         top[2] += (pm->mins[2]*-1) + 4.0f;
01495                         VectorCopy( top, bottom );
01496                         bottom[2] -= 64.0f;
01497                         pm->trace( &trace2, top, pm->mins, pm->maxs, bottom, ps->clientNum, MASK_PLAYERSOLID );
01498                         if ( !trace2.allsolid 
01499                                 && !trace2.startsolid 
01500                                 && trace2.fraction < 1.0f 
01501                                 && trace2.plane.normal[2] > 0.7f )//slope we can stand on
01502                         {//cool, do the alt-flip and land on whetever it is we just scaled up
01503                                 VectorScale( fwd, 100, pm->ps->velocity );
01504                                 pm->ps->velocity[2] += 400;
01505                                 PM_SetAnim(SETANIM_BOTH, BOTH_FORCEWALLRUNFLIP_ALT, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD, 0);
01506                                 pm->ps->pm_flags |= PMF_JUMP_HELD;
01507                                 //ent->client->ps.pm_flags |= PMF_JUMPING|PMF_SLOW_MO_FALL;
01508                                 //ent->client->ps.forcePowersActive |= (1<<FP_LEVITATION);
01509                                 //G_AddEvent( ent, EV_JUMP, 0 );
01510                                 PM_AddEvent(EV_JUMP);
01511                                 ucmd->upmove = 0;
01512                                 return qfalse;
01513                         }
01514                 }
01515 
01516                 if ( //ucmd->upmove <= 0 && 
01517                         ps->legsTimer > 0 &&
01518                         ucmd->forwardmove > 0 &&
01519                         trace.fraction < 1.0f && 
01520                         (trace.plane.normal[2] >= 0.0f&&trace.plane.normal[2]<=0.4f/*MAX_WALL_RUN_Z_NORMAL*/) )
01521                 {//still a vertical wall there
01522                         //make sure there's not a ceiling above us!
01523                         trace_t trace2;
01524                         VectorCopy( ps->origin, traceTo );
01525                         traceTo[2] += 64;
01526                         pm->trace( &trace2, ps->origin, mins, maxs, traceTo, ps->clientNum, MASK_PLAYERSOLID );
01527                         if ( trace2.fraction < 1.0f )
01528                         {//will hit a ceiling, so force jump-off right now
01529                                 //NOTE: hits any entity or clip brush in the way, too, not just architecture!
01530                         }
01531                         else
01532                         {//all clear, keep going
01533                                 //FIXME: don't pull around 90 turns
01534                                 //FIXME: simulate stepping up steps here, somehow?
01535                                 ucmd->forwardmove = 127;
01536                                 if ( ucmd->upmove < 0 )
01537                                 {
01538                                         ucmd->upmove = 0;
01539                                 }
01540                                 //make me face the wall
01541                                 ps->viewangles[YAW] = vectoyaw( trace.plane.normal )+180;
01542                                 PM_SetPMViewAngle(ps, ps->viewangles, ucmd);
01543                                 /*
01544                                 if ( ent->client->ps.viewEntity <= 0 || ent->client->ps.viewEntity >= ENTITYNUM_WORLD )
01545                                 {//don't clamp angles when looking through a viewEntity
01546                                         SetClientViewAngle( ent, ent->client->ps.viewangles );
01547                                 }
01548                                 */
01549                                 ucmd->angles[YAW] = ANGLE2SHORT( ps->viewangles[YAW] ) - ps->delta_angles[YAW];
01550                                 //if ( ent->s.number || !player_locked )
01551                                 if (1) //aslkfhsakf
01552                                 {
01553                                         if ( doMove )
01554                                         {
01555                                                 //pull me toward the wall
01556                                                 VectorScale( trace.plane.normal, -dist*trace.fraction, ps->velocity );
01557                                                 //push me up
01558                                                 if ( ps->legsTimer > 200 )
01559                                                 {//not at end of anim yet
01560                                                         float speed = 300;
01561                                                         /*
01562                                                         if ( ucmd->forwardmove < 0 )
01563                                                         {//slower
01564                                                                 speed = 100;
01565                                                         }
01566                                                         else if ( ucmd->forwardmove > 0 )
01567                                                         {
01568                                                                 speed = 250;//running speed
01569                                                         }
01570                                                         */
01571                                                         ps->velocity[2] = speed;//preserve z velocity
01572                                                 }
01573                                         }
01574                                 }
01575                                 ucmd->forwardmove = 0;
01576                                 return qtrue;
01577                         }
01578                 }
01579                 //failed!
01580                 if ( doMove )
01581                 {//stop it
01582                         VectorScale( fwd, -300.0f, ps->velocity );
01583                         ps->velocity[2] += 200;
01584                         //NPC_SetAnim( ent, SETANIM_BOTH, BOTH_FORCEWALLRUNFLIP_END, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
01585                         //why?!?#?#@!%$R@$KR#F:Hdl;asfm
01586                         PM_SetAnim(SETANIM_BOTH, BOTH_FORCEWALLRUNFLIP_END, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD, 0);
01587                         ps->pm_flags |= PMF_JUMP_HELD;
01588                         //ent->client->ps.pm_flags |= PMF_JUMPING|PMF_SLOW_MO_FALL;
01589 
01590                         //FIXME do I need this in mp?
01591                         //ent->client->ps.forcePowersActive |= (1<<FP_LEVITATION);
01592                         PM_AddEvent(EV_JUMP);
01593                         ucmd->upmove = 0;
01594                         //return qtrue;
01595                 }
01596         }
01597         return qfalse;
01598 }

qboolean PM_AdjustAnglesForWallRunUpFlipAlt usercmd_t ucmd  ) 
 

Definition at line 1464 of file bg_pmove.c.

References pm, PM_SetPMViewAngle(), pmove_t::ps, qboolean, qtrue, ucmd, usercmd_t, and playerState_s::viewangles.

Referenced by PmoveSingle().

01465 {
01466 //      ucmd->angles[PITCH] = ANGLE2SHORT( pm->ps->viewangles[PITCH] ) - pm->ps->delta_angles[PITCH];
01467 //      ucmd->angles[YAW] = ANGLE2SHORT( pm->ps->viewangles[YAW] ) - pm->ps->delta_angles[YAW];
01468         PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, ucmd);
01469         return qtrue;
01470 }

void PM_AdjustAttackStates pmove_t pm  ) 
 

Definition at line 8032 of file bg_pmove.c.

References playerState_s::ammo, bgEntity_t, BUTTON_ALT_ATTACK, BUTTON_ATTACK, usercmd_s::buttons, CLASS_VEHICLE, pmove_t::cmd, playerState_s::commandTime, EF_ALT_FIRING, EF_FIRING, playerState_s::eFlags, EV_DISRUPTOR_ZOOMSOUND, playerState_s::m_iVehicleNum, bgEntity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, entityState_s::NPC_class, pm, PM_AddEvent(), PM_DEAD, pm_entSelf, pm_entVeh, playerState_s::pm_flags, PM_INTERMISSION, playerState_s::pm_type, PMF_RESPAWNED, pmove_t::ps, qfalse, qtrue, bgEntity_s::s, usercmd_s::serverTime, vehicleInfo_t::type, VH_FIGHTER, VH_WALKER, playerState_s::weapon, WEAPON_READY, weaponData, playerState_s::weaponstate, playerState_s::weaponTime, WP_DISRUPTOR, WP_SABER, playerState_s::zoomFov, playerState_s::zoomLocked, playerState_s::zoomLockTime, playerState_s::zoomMode, and playerState_s::zoomTime.

Referenced by PmoveSingle().

08034 {
08035         int amount;
08036 
08037         if (pm_entSelf->s.NPC_class!=CLASS_VEHICLE
08038                 &&pm->ps->m_iVehicleNum)
08039         { //riding a vehicle
08040                 bgEntity_t *veh = pm_entVeh;
08041                 if ( veh &&
08042                         (veh->m_pVehicle && (veh->m_pVehicle->m_pVehicleInfo->type == VH_WALKER || veh->m_pVehicle && veh->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER)) )
08043                 {//riding a walker/fighter
08044                         //not firing, ever
08045                         pm->ps->eFlags &= ~(EF_FIRING|EF_ALT_FIRING);
08046                         return;
08047                 }
08048         }
08049         // get ammo usage
08050         if ( pm->cmd.buttons & BUTTON_ALT_ATTACK )
08051         {
08052                 amount = pm->ps->ammo[weaponData[ pm->ps->weapon ].ammoIndex] - weaponData[pm->ps->weapon].altEnergyPerShot;
08053         }
08054         else
08055         {
08056                 amount = pm->ps->ammo[weaponData[ pm->ps->weapon ].ammoIndex] - weaponData[pm->ps->weapon].energyPerShot;
08057         }
08058 
08059         // disruptor alt-fire should toggle the zoom mode, but only bother doing this for the player?
08060         if ( pm->ps->weapon == WP_DISRUPTOR && pm->ps->weaponstate == WEAPON_READY )
08061         {
08062                 if ( !(pm->ps->eFlags & EF_ALT_FIRING) && (pm->cmd.buttons & BUTTON_ALT_ATTACK) /*&&
08063                         pm->cmd.upmove <= 0 && !pm->cmd.forwardmove && !pm->cmd.rightmove*/)
08064                 {
08065                         // We just pressed the alt-fire key
08066                         if ( !pm->ps->zoomMode && pm->ps->pm_type != PM_DEAD )
08067                         {
08068                                 // not already zooming, so do it now
08069                                 pm->ps->zoomMode = 1;
08070                                 pm->ps->zoomLocked = qfalse;
08071                                 pm->ps->zoomFov = 80.0f;//cg_fov.value;
08072                                 pm->ps->zoomLockTime = pm->cmd.serverTime + 50;
08073                                 PM_AddEvent(EV_DISRUPTOR_ZOOMSOUND);
08074                         }
08075                         else if (pm->ps->zoomMode == 1 && pm->ps->zoomLockTime < pm->cmd.serverTime)
08076                         { //check for == 1 so we can't turn binoculars off with disruptor alt fire
08077                                 // already zooming, so must be wanting to turn it off
08078                                 pm->ps->zoomMode = 0;
08079                                 pm->ps->zoomTime = pm->ps->commandTime;
08080                                 pm->ps->zoomLocked = qfalse;
08081                                 PM_AddEvent(EV_DISRUPTOR_ZOOMSOUND);
08082                                 pm->ps->weaponTime = 1000;
08083                         }
08084                 }
08085                 else if ( !(pm->cmd.buttons & BUTTON_ALT_ATTACK ) && pm->ps->zoomLockTime < pm->cmd.serverTime)
08086                 {
08087                         // Not pressing zoom any more
08088                         if ( pm->ps->zoomMode )
08089                         {
08090                                 if (pm->ps->zoomMode == 1 && !pm->ps->zoomLocked)
08091                                 { //approximate what level the client should be zoomed at based on how long zoom was held
08092                                         pm->ps->zoomFov = ((pm->cmd.serverTime+50) - pm->ps->zoomLockTime) * 0.035f;
08093                                         if (pm->ps->zoomFov > 50)
08094                                         {
08095                                                 pm->ps->zoomFov = 50;
08096                                         }
08097                                         if (pm->ps->zoomFov < 1)
08098                                         {
08099                                                 pm->ps->zoomFov = 1;
08100                                         }
08101                                 }
08102                                 // were zooming in, so now lock the zoom
08103                                 pm->ps->zoomLocked = qtrue;
08104                         }
08105                 }
08106                 //This seemed like a good idea, but apparently it confuses people. So disabled for now.
08107                 /*
08108                 else if (!(pm->ps->eFlags & EF_ALT_FIRING) && (pm->cmd.buttons & BUTTON_ALT_ATTACK) &&
08109                         (pm->cmd.upmove > 0 || pm->cmd.forwardmove || pm->cmd.rightmove))
08110                 { //if you try to zoom while moving, just convert it into a primary attack
08111                         pm->cmd.buttons &= ~BUTTON_ALT_ATTACK;
08112                         pm->cmd.buttons |= BUTTON_ATTACK;
08113                 }
08114                 */
08115 
08116                 /*
08117                 if (pm->cmd.upmove > 0 || pm->cmd.forwardmove || pm->cmd.rightmove)
08118                 {
08119                         if (pm->ps->zoomMode == 1 && pm->ps->zoomLockTime < pm->cmd.serverTime)
08120                         { //check for == 1 so we can't turn binoculars off with disruptor alt fire
08121                                 pm->ps->zoomMode = 0;
08122                                 pm->ps->zoomTime = pm->ps->commandTime;
08123                                 pm->ps->zoomLocked = qfalse;
08124                                 PM_AddEvent(EV_DISRUPTOR_ZOOMSOUND);
08125                         }
08126                 }
08127                 */
08128 
08129                 if ( pm->cmd.buttons & BUTTON_ATTACK )
08130                 {
08131                         // If we are zoomed, we should switch the ammo usage to the alt-fire, otherwise, we'll
08132                         //      just use whatever ammo was selected from above
08133                         if ( pm->ps->zoomMode )
08134                         {
08135                                 amount = pm->ps->ammo[weaponData[ pm->ps->weapon ].ammoIndex] - 
08136                                                         weaponData[pm->ps->weapon].altEnergyPerShot;
08137                         }
08138                 }
08139                 else
08140                 {
08141                         // alt-fire button pressing doesn't use any ammo
08142                         amount = 0;
08143                 }
08144         }
08145         /*
08146         else if (pm->ps->weapon == WP_DISRUPTOR) //still perform certain checks, even if the weapon is not ready
08147         {
08148                 if (pm->cmd.upmove > 0 || pm->cmd.forwardmove || pm->cmd.rightmove)
08149                 {
08150                         if (pm->ps->zoomMode == 1 && pm->ps->zoomLockTime < pm->cmd.serverTime)
08151                         { //check for == 1 so we can't turn binoculars off with disruptor alt fire
08152                                 pm->ps->zoomMode = 0;
08153                                 pm->ps->zoomTime = pm->ps->commandTime;
08154                                 pm->ps->zoomLocked = qfalse;
08155                                 PM_AddEvent(EV_DISRUPTOR_ZOOMSOUND);
08156                         }
08157                 }
08158         }
08159         */
08160 
08161         // set the firing flag for continuous beam weapons, saber will fire even if out of ammo
08162         if ( !(pm->ps->pm_flags & PMF_RESPAWNED) && 
08163                         pm->ps->pm_type != PM_INTERMISSION && 
08164                         ( pm->cmd.buttons & (BUTTON_ATTACK|BUTTON_ALT_ATTACK)) && 
08165                         ( amount >= 0 || pm->ps->weapon == WP_SABER ))
08166         {
08167                 if ( pm->cmd.buttons & BUTTON_ALT_ATTACK )
08168                 {
08169                         pm->ps->eFlags |= EF_ALT_FIRING;
08170                 }
08171                 else
08172                 {
08173                         pm->ps->eFlags &= ~EF_ALT_FIRING;
08174                 }
08175 
08176                 // This flag should always get set, even when alt-firing
08177                 pm->ps->eFlags |= EF_FIRING;
08178         } 
08179         else 
08180         {
08181                 // Clear 'em out
08182                 pm->ps->eFlags &= ~(EF_FIRING|EF_ALT_FIRING);
08183         }
08184 
08185         // disruptor should convert a main fire to an alt-fire if the gun is currently zoomed
08186         if ( pm->ps->weapon == WP_DISRUPTOR)
08187         {
08188                 if ( pm->cmd.buttons & BUTTON_ATTACK && pm->ps->zoomMode == 1 && pm->ps->zoomLocked)
08189                 {
08190                         // converting the main fire to an alt-fire
08191                         pm->cmd.buttons |= BUTTON_ALT_ATTACK;
08192                         pm->ps->eFlags |= EF_ALT_FIRING;
08193                 }
08194                 else if ( pm->cmd.buttons & BUTTON_ALT_ATTACK && pm->ps->zoomMode == 1 && pm->ps->zoomLocked)
08195                 {
08196                         pm->cmd.buttons &= ~BUTTON_ALT_ATTACK;
08197                         pm->ps->eFlags &= ~EF_ALT_FIRING;
08198                 }
08199         }
08200 }

qboolean PM_AdjustStandAnimForSlope void   ) 
 

Definition at line 4805 of file bg_pmove.c.

References BOTH_CROUCH1, BOTH_CROUCH1IDLE, BOTH_SABERFAST_STANCE, BOTH_SABERSLOW_STANCE, BOTH_STAND1, BOTH_STAND2, BOTH_STAND3, BOTH_STAND4, BOTH_STAND5, BOTH_STAND6, pmove_t::cmd, pmove_t::g2Bolts_LFoot, pmove_t::g2Bolts_RFoot, pmove_t::ghoul2, LEGS_LEFTUP1, LEGS_LEFTUP2, LEGS_LEFTUP3, LEGS_LEFTUP4, LEGS_LEFTUP5, LEGS_RIGHTUP1, LEGS_RIGHTUP2, LEGS_RIGHTUP3, LEGS_RIGHTUP4, LEGS_RIGHTUP5, LEGS_S1_LUP1, LEGS_S1_LUP2, LEGS_S1_LUP3, LEGS_S1_LUP4, LEGS_S1_LUP5, LEGS_S1_RUP1, LEGS_S1_RUP2, LEGS_S1_RUP3, LEGS_S1_RUP4, LEGS_S1_RUP5, LEGS_S3_LUP1, LEGS_S3_LUP2, LEGS_S3_LUP3, LEGS_S3_LUP4, LEGS_S3_LUP5, LEGS_S3_RUP1, LEGS_S3_RUP2, LEGS_S3_RUP3, LEGS_S3_RUP4, LEGS_S3_RUP5, LEGS_S4_LUP1, LEGS_S4_LUP2, LEGS_S4_LUP3, LEGS_S4_LUP4, LEGS_S4_LUP5, LEGS_S4_RUP1, LEGS_S4_RUP2, LEGS_S4_RUP3, LEGS_S4_RUP4, LEGS_S4_RUP5, LEGS_S5_LUP1, LEGS_S5_LUP2, LEGS_S5_LUP3, LEGS_S5_LUP4, LEGS_S5_LUP5, LEGS_S5_RUP1, LEGS_S5_RUP2, LEGS_S5_RUP3, LEGS_S5_RUP4, LEGS_S5_RUP5, playerState_s::legsAnim, pm, PM_ContinueLegsAnim(), PM_FootSlopeTrace(), pmove_t::ps, qboolean, qfalse, qtrue, usercmd_s::serverTime, SLOPE_RECALC_INT, SLOPERECALCVAR, TORSO_WEAPONREADY1, TORSO_WEAPONREADY10, TORSO_WEAPONREADY2, and TORSO_WEAPONREADY3.

04806 {
04807         float   diff;
04808         float   interval;
04809         int             destAnim;
04810         int             legsAnim;
04811         #define SLOPERECALCVAR pm->ps->slopeRecalcTime //this is purely convenience
04812 
04813         if (!pm->ghoul2)
04814         { //probably just changed models and not quite in sync yet
04815                 return qfalse;
04816         }
04817 
04818         if ( pm->g2Bolts_LFoot == -1 || pm->g2Bolts_RFoot == -1 )
04819         {//need these bolts!
04820                 return qfalse;
04821         }
04822 
04823         //step 1: find the 2 foot tags
04824         PM_FootSlopeTrace( &diff, &interval );
04825 
04826         //step 4: based on difference, choose one of the left/right slope-match intervals
04827         if ( diff >= interval*5 )
04828         {
04829                 destAnim = LEGS_LEFTUP5;
04830         }
04831         else if ( diff >= interval*4 )
04832         {
04833                 destAnim = LEGS_LEFTUP4;
04834         }
04835         else if ( diff >= interval*3 )
04836         {
04837                 destAnim = LEGS_LEFTUP3;
04838         }
04839         else if ( diff >= interval*2 )
04840         {
04841                 destAnim = LEGS_LEFTUP2;
04842         }
04843         else if ( diff >= interval )
04844         {
04845                 destAnim = LEGS_LEFTUP1;
04846         }
04847         else if ( diff <= interval*-5 )
04848         {
04849                 destAnim = LEGS_RIGHTUP5;
04850         }
04851         else if ( diff <= interval*-4 )
04852         {
04853                 destAnim = LEGS_RIGHTUP4;
04854         }
04855         else if ( diff <= interval*-3 )
04856         {
04857                 destAnim = LEGS_RIGHTUP3;
04858         }
04859         else if ( diff <= interval*-2 )
04860         {
04861                 destAnim = LEGS_RIGHTUP2;
04862         }
04863         else if ( diff <= interval*-1 )
04864         {
04865                 destAnim = LEGS_RIGHTUP1;
04866         }
04867         else
04868         {
04869                 return qfalse;
04870         }
04871 
04872         legsAnim = pm->ps->legsAnim;
04873         //adjust for current legs anim
04874         switch ( legsAnim )
04875         {
04876         case BOTH_STAND1:
04877 
04878         case LEGS_S1_LUP1:
04879         case LEGS_S1_LUP2:
04880         case LEGS_S1_LUP3:
04881         case LEGS_S1_LUP4:
04882         case LEGS_S1_LUP5:
04883         case LEGS_S1_RUP1:
04884         case LEGS_S1_RUP2:
04885         case LEGS_S1_RUP3:
04886         case LEGS_S1_RUP4:
04887         case LEGS_S1_RUP5:
04888                 destAnim = LEGS_S1_LUP1 + (destAnim-LEGS_LEFTUP1);
04889                 break;
04890         case BOTH_STAND2:
04891         case BOTH_SABERFAST_STANCE:
04892         case BOTH_SABERSLOW_STANCE:
04893         case BOTH_CROUCH1IDLE:
04894         case BOTH_CROUCH1:
04895         case LEGS_LEFTUP1:                      //# On a slope with left foot 4 higher than right
04896         case LEGS_LEFTUP2:                      //# On a slope with left foot 8 higher than right
04897         case LEGS_LEFTUP3:                      //# On a slope with left foot 12 higher than right
04898         case LEGS_LEFTUP4:                      //# On a slope with left foot 16 higher than right
04899         case LEGS_LEFTUP5:                      //# On a slope with left foot 20 higher than right
04900         case LEGS_RIGHTUP1:                     //# On a slope with RIGHT foot 4 higher than left
04901         case LEGS_RIGHTUP2:                     //# On a slope with RIGHT foot 8 higher than left
04902         case LEGS_RIGHTUP3:                     //# On a slope with RIGHT foot 12 higher than left
04903         case LEGS_RIGHTUP4:                     //# On a slope with RIGHT foot 16 higher than left
04904         case LEGS_RIGHTUP5:                     //# On a slope with RIGHT foot 20 higher than left
04905                 //fine
04906                 break;
04907         case BOTH_STAND3:
04908         case LEGS_S3_LUP1:
04909         case LEGS_S3_LUP2:
04910         case LEGS_S3_LUP3:
04911         case LEGS_S3_LUP4:
04912         case LEGS_S3_LUP5:
04913         case LEGS_S3_RUP1:
04914         case LEGS_S3_RUP2:
04915         case LEGS_S3_RUP3:
04916         case LEGS_S3_RUP4:
04917         case LEGS_S3_RUP5:
04918                 destAnim = LEGS_S3_LUP1 + (destAnim-LEGS_LEFTUP1);
04919                 break;
04920         case BOTH_STAND4:
04921         case LEGS_S4_LUP1:
04922         case LEGS_S4_LUP2:
04923         case LEGS_S4_LUP3:
04924         case LEGS_S4_LUP4:
04925         case LEGS_S4_LUP5:
04926         case LEGS_S4_RUP1:
04927         case LEGS_S4_RUP2:
04928         case LEGS_S4_RUP3:
04929         case LEGS_S4_RUP4:
04930         case LEGS_S4_RUP5:
04931                 destAnim = LEGS_S4_LUP1 + (destAnim-LEGS_LEFTUP1);
04932                 break;
04933         case BOTH_STAND5:
04934         case LEGS_S5_LUP1:
04935         case LEGS_S5_LUP2:
04936         case LEGS_S5_LUP3:
04937         case LEGS_S5_LUP4:
04938         case LEGS_S5_LUP5:
04939         case LEGS_S5_RUP1:
04940         case LEGS_S5_RUP2:
04941         case LEGS_S5_RUP3:
04942         case LEGS_S5_RUP4:
04943         case LEGS_S5_RUP5:
04944                 destAnim = LEGS_S5_LUP1 + (destAnim-LEGS_LEFTUP1);
04945                 break;
04946         case BOTH_STAND6:
04947         default:
04948                 return qfalse;
04949                 break;
04950         }
04951 
04952         //step 5: based on the chosen interval and the current legsAnim, pick the correct anim
04953         //step 6: increment/decrement to the dest anim, not instant
04954         if ( (legsAnim >= LEGS_LEFTUP1 && legsAnim <= LEGS_LEFTUP5)
04955                 || (legsAnim >= LEGS_S1_LUP1 && legsAnim <= LEGS_S1_LUP5)
04956                 || (legsAnim >= LEGS_S3_LUP1 && legsAnim <= LEGS_S3_LUP5)
04957                 || (legsAnim >= LEGS_S4_LUP1 && legsAnim <= LEGS_S4_LUP5)
04958                 || (legsAnim >= LEGS_S5_LUP1 && legsAnim <= LEGS_S5_LUP5) )
04959         {//already in left-side up
04960                 if ( destAnim > legsAnim && SLOPERECALCVAR < pm->cmd.serverTime )
04961                 {
04962                         legsAnim++;
04963                         SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
04964                 }
04965                 else if ( destAnim < legsAnim && SLOPERECALCVAR < pm->cmd.serverTime )
04966                 {
04967                         legsAnim--;
04968                         SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
04969                 }
04970                 else //if (SLOPERECALCVAR < pm->cmd.serverTime)
04971                 {
04972                         legsAnim = destAnim;
04973                 }
04974 
04975                 destAnim = legsAnim;
04976         }
04977         else if ( (legsAnim >= LEGS_RIGHTUP1 && legsAnim <= LEGS_RIGHTUP5) 
04978                 || (legsAnim >= LEGS_S1_RUP1 && legsAnim <= LEGS_S1_RUP5)
04979                 || (legsAnim >= LEGS_S3_RUP1 && legsAnim <= LEGS_S3_RUP5)
04980                 || (legsAnim >= LEGS_S4_RUP1 && legsAnim <= LEGS_S4_RUP5)
04981                 || (legsAnim >= LEGS_S5_RUP1 && legsAnim <= LEGS_S5_RUP5) )
04982         {//already in right-side up
04983                 if ( destAnim > legsAnim && SLOPERECALCVAR < pm->cmd.serverTime )
04984                 {
04985                         legsAnim++;
04986                         SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
04987                 }
04988                 else if ( destAnim < legsAnim && SLOPERECALCVAR < pm->cmd.serverTime )
04989                 {
04990                         legsAnim--;
04991                         SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
04992                 }
04993                 else //if (SLOPERECALCVAR < pm->cmd.serverTime)
04994                 {
04995                         legsAnim = destAnim;
04996                 }
04997                 
04998                 destAnim = legsAnim;
04999         }
05000         else
05001         {//in a stand of some sort?
05002                 switch ( legsAnim )
05003                 {
05004                 case BOTH_STAND1:
05005                 case TORSO_WEAPONREADY1:
05006                 case TORSO_WEAPONREADY2:
05007                 case TORSO_WEAPONREADY3:
05008                 case TORSO_WEAPONREADY10:
05009 
05010                         if ( destAnim >= LEGS_S1_LUP1 && destAnim <= LEGS_S1_LUP5 )
05011                         {//going into left side up
05012                                 destAnim = LEGS_S1_LUP1;
05013                                 SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
05014                         }
05015                         else if ( destAnim >= LEGS_S1_RUP1 && destAnim <= LEGS_S1_RUP5 )
05016                         {//going into right side up
05017                                 destAnim = LEGS_S1_RUP1;
05018                                 SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
05019                         }
05020                         else
05021                         {//will never get here
05022                                 return qfalse;
05023                         }
05024                         break;
05025                 case BOTH_STAND2:
05026                 case BOTH_SABERFAST_STANCE:
05027                 case BOTH_SABERSLOW_STANCE:
05028                 case BOTH_CROUCH1IDLE:
05029                         if ( destAnim >= LEGS_LEFTUP1 && destAnim <= LEGS_LEFTUP5 )
05030                         {//going into left side up
05031                                 destAnim = LEGS_LEFTUP1;
05032                                 SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
05033                         }
05034                         else if ( destAnim >= LEGS_RIGHTUP1 && destAnim <= LEGS_RIGHTUP5 )
05035                         {//going into right side up
05036                                 destAnim = LEGS_RIGHTUP1;
05037                                 SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
05038                         }
05039                         else
05040                         {//will never get here
05041                                 return qfalse;
05042                         }
05043                         break;
05044                 case BOTH_STAND3:
05045                         if ( destAnim >= LEGS_S3_LUP1 && destAnim <= LEGS_S3_LUP5 )
05046                         {//going into left side up
05047                                 destAnim = LEGS_S3_LUP1;
05048                                 SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
05049                         }
05050                         else if ( destAnim >= LEGS_S3_RUP1 && destAnim <= LEGS_S3_RUP5 )
05051                         {//going into right side up
05052                                 destAnim = LEGS_S3_RUP1;
05053                                 SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
05054                         }
05055                         else
05056                         {//will never get here
05057                                 return qfalse;
05058                         }
05059                         break;
05060                 case BOTH_STAND4:
05061                         if ( destAnim >= LEGS_S4_LUP1 && destAnim <= LEGS_S4_LUP5 )
05062                         {//going into left side up
05063                                 destAnim = LEGS_S4_LUP1;
05064                                 SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
05065                         }
05066                         else if ( destAnim >= LEGS_S4_RUP1 && destAnim <= LEGS_S4_RUP5 )
05067                         {//going into right side up
05068                                 destAnim = LEGS_S4_RUP1;
05069                                 SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
05070                         }
05071                         else
05072                         {//will never get here
05073                                 return qfalse;
05074                         }
05075                         break;
05076                 case BOTH_STAND5:
05077                         if ( destAnim >= LEGS_S5_LUP1 && destAnim <= LEGS_S5_LUP5 )
05078                         {//going into left side up
05079                                 destAnim = LEGS_S5_LUP1;
05080                                 SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
05081                         }
05082                         else if ( destAnim >= LEGS_S5_RUP1 && destAnim <= LEGS_S5_RUP5 )
05083                         {//going into right side up
05084                                 destAnim = LEGS_S5_RUP1;
05085                                 SLOPERECALCVAR = pm->cmd.serverTime + SLOPE_RECALC_INT;
05086                         }
05087                         else
05088                         {//will never get here
05089                                 return qfalse;
05090                         }
05091                         break;
05092                 case BOTH_STAND6:
05093                 default:
05094                         return qfalse;
05095                         break;
05096                 }
05097         }
05098         //step 7: set the anim
05099         //PM_SetAnim( SETANIM_LEGS, destAnim, SETANIM_FLAG_NORMAL, 100 );
05100         PM_ContinueLegsAnim(destAnim);
05101 
05102         return qtrue;
05103 }

void PM_AnglesForSlope const float  yaw,
const vec3_t  slope,
vec3_t  angles
 

Definition at line 4650 of file bg_pmove.c.

References AngleVectors(), DotProduct, NULL, PITCH, Q_fabs(), ROLL, vec3_t, vectoangles(), VectorSet, and YAW.

04651 {
04652         vec3_t  nvf, ovf, ovr, new_angles;
04653         float   pitch, mod, dot;
04654 
04655         VectorSet( angles, 0, yaw, 0 );
04656         AngleVectors( angles, ovf, ovr, NULL );
04657 
04658         vectoangles( slope, new_angles );
04659         pitch = new_angles[PITCH] + 90;
04660         new_angles[ROLL] = new_angles[PITCH] = 0;
04661 
04662         AngleVectors( new_angles, nvf, NULL, NULL );
04663 
04664         mod = DotProduct( nvf, ovr );
04665 
04666         if ( mod < 0 )
04667                 mod = -1;
04668         else
04669                 mod = 1;
04670 
04671         dot = DotProduct( nvf, ovf );
04672 
04673         angles[YAW] = 0;
04674         angles[PITCH] = dot * pitch;
04675         angles[ROLL] = ((1-Q_fabs(dot)) * pitch * mod);
04676 }

void PM_BeginWeaponChange int  weapon  ) 
 

Definition at line 5767 of file bg_pmove.c.

References BG_ClearRocketLock(), playerState_s::commandTime, EV_CHANGE_WEAPON, pm, PM_AddEventWithParm(), PM_SetAnim(), pmove_t::ps, SETANIM_FLAG_OVERRIDE, SETANIM_TORSO, STAT_WEAPONS, playerState_s::stats, TORSO_DROPWEAP1, WEAPON_DROPPING, playerState_s::weaponstate, playerState_s::weaponTime, WP_NUM_WEAPONS, playerState_s::zoomMode, and playerState_s::zoomTime.

Referenced by PM_WeaponLightsaber().

05767                                         {
05768         if ( weapon <= WP_NONE || weapon >= WP_NUM_WEAPONS ) {
05769                 return;
05770         }
05771 
05772         if ( !( pm->ps->stats[STAT_WEAPONS] & ( 1 << weapon ) ) ) {
05773                 return;
05774         }
05775         
05776         if ( pm->ps->weaponstate == WEAPON_DROPPING ) {
05777                 return;
05778         }
05779 
05780         // turn of any kind of zooming when weapon switching.
05781         if (pm->ps->zoomMode)
05782         {
05783                 pm->ps->zoomMode = 0;
05784                 pm->ps->zoomTime = pm->ps->commandTime;
05785         }
05786 
05787         PM_AddEventWithParm( EV_CHANGE_WEAPON, weapon );
05788         pm->ps->weaponstate = WEAPON_DROPPING;
05789         pm->ps->weaponTime += 200;
05790         //PM_StartTorsoAnim( TORSO_DROPWEAP1 );
05791         PM_SetAnim(SETANIM_TORSO, TORSO_DROPWEAP1, SETANIM_FLAG_OVERRIDE, 0);
05792 
05793         BG_ClearRocketLock( pm->ps );
05794 }

bgEntity_t* PM_BGEntForNum int  num  ) 
 

Definition at line 172 of file bg_pmove.c.

References pmove_t::baseEnt, bgEntity_t, byte, pmove_t::entSize, MAX_GENTITIES, NULL, and pm.

Referenced by PM_CanBackstab(), PM_CheckStabDown(), PM_RocketLock(), PM_SaberLocked(), PM_SomeoneInFront(), PM_VehForcedTurning(), PM_VehicleImpact(), PM_WeaponLightsaber(), and PmoveSingle().

00173 {
00174         bgEntity_t *ent;
00175 
00176         if (!pm)
00177         {
00178                 assert(!"You cannot call PM_BGEntForNum outside of pm functions!");
00179                 return NULL;
00180         }
00181 
00182         if (!pm->baseEnt)
00183         {
00184                 assert(!"Base entity address not set");
00185                 return NULL;
00186         }
00187 
00188         if (!pm->entSize)
00189         {
00190                 assert(!"sizeof(ent) is 0, impossible (not set?)");
00191                 return NULL;
00192         }
00193 
00194         assert(num >= 0 && num < MAX_GENTITIES);
00195 
00196     ent = (bgEntity_t *)((byte *)pm->baseEnt + pm->entSize*(num));
00197 
00198         return ent;
00199 }

qboolean PM_CanRollFromSoulCal playerState_t ps  ) 
 

Definition at line 1419 of file bg_panimate.c.

References BOTH_A7_SOULCAL, playerState_s::legsAnim, playerState_s::legsTimer, playerState_t, qboolean, qfalse, and qtrue.

Referenced by PM_MoveForKata().

01420 {
01421         if ( ps->legsAnim == BOTH_A7_SOULCAL
01422                 && ps->legsTimer < 700
01423                 && ps->legsTimer > 250 )
01424         {
01425                 return qtrue;
01426         }
01427         return qfalse;
01428 }

qboolean PM_CanSetWeaponAnims void   ) 
 

Definition at line 6370 of file bg_pmove.c.

References playerState_s::m_iVehicleNum, pm, pmove_t::ps, qboolean, qfalse, and qtrue.

06371 {
06372     if (pm->ps->m_iVehicleNum)
06373         {
06374                 return qfalse;
06375         }
06376 
06377         return qtrue;
06378 }

qboolean PM_CheckDualForwardJumpDuck void   ) 
 

Definition at line 4323 of file bg_pmove.c.

References BOTH_JUMPATTACK6, playerState_s::legsAnim, playerState_s::legsTimer, pmove_t::mins, pm, PM_AnimLength(), playerState_s::pm_flags, PMF_FIX_MINS, pmove_t::ps, qboolean, qfalse, and qtrue.

04324 {
04325         qboolean resized = qfalse;
04326         if ( pm->ps->legsAnim == BOTH_JUMPATTACK6 )
04327         {
04328                 //dynamically reduce bounding box to let character sail over heads of enemies
04329                 if ( ( pm->ps->legsTimer >= 1450
04330                                 && PM_AnimLength( 0, BOTH_JUMPATTACK6 ) - pm->ps->legsTimer >= 400 ) 
04331                         ||(pm->ps->legsTimer >= 400
04332                                 && PM_AnimLength( 0, BOTH_JUMPATTACK6 ) - pm->ps->legsTimer >= 1100 ) )
04333                 {//in a part of the anim that we're pretty much sideways in, raise up the mins
04334                         pm->mins[2] = 0;
04335                         pm->ps->pm_flags |= PMF_FIX_MINS;
04336                         resized = qtrue;
04337                 }
04338         }
04339         return resized;
04340 }

void PM_CheckFixMins void   ) 
 

Definition at line 4342 of file bg_pmove.c.

References trace_t::allsolid, BOTH_JUMPATTACK6, playerState_s::clientNum, trace_t::fraction, playerState_s::legsAnim, playerState_s::legsTimer, pmove_t::maxs, pmove_t::mins, MINS_Z, playerState_s::origin, pm, playerState_s::pm_flags, PMF_DUCKED, PMF_FIX_MINS, pmove_t::ps, playerState_s::standheight, trace_t::startsolid, playerState_s::torsoTimer, pmove_t::trace, pmove_t::tracemask, vec3_t, and VectorSet.

04343 {
04344         if ( (pm->ps->pm_flags&PMF_FIX_MINS) )// pm->mins[2] > DEFAULT_MINS_2 )
04345         {//drop the mins back down
04346                 //do a trace to make sure it's okay
04347                 trace_t trace;
04348                 vec3_t end, curMins, curMaxs;
04349         
04350                 VectorSet( end, pm->ps->origin[0], pm->ps->origin[1], pm->ps->origin[2]+MINS_Z ); 
04351                 VectorSet( curMins, pm->mins[0], pm->mins[1], 0 ); 
04352                 VectorSet( curMaxs, pm->maxs[0], pm->maxs[1], pm->ps->standheight ); 
04353 
04354                 pm->trace( &trace, pm->ps->origin, curMins, curMaxs, end, pm->ps->clientNum, pm->tracemask );
04355                 if ( !trace.allsolid && !trace.startsolid )
04356                 {//should never start in solid
04357                         if ( trace.fraction >= 1.0f )
04358                         {//all clear
04359                                 //drop the bottom of my bbox back down
04360                                 pm->mins[2] = MINS_Z;
04361                                 pm->ps->pm_flags &= ~PMF_FIX_MINS;
04362                         }
04363                         else
04364                         {//move me up so the bottom of my bbox will be where the trace ended, at least
04365                                 //need to trace up, too
04366                                 float updist = ((1.0f-trace.fraction) * -MINS_Z);
04367                                 end[2] = pm->ps->origin[2]+updist; 
04368                                 pm->trace( &trace, pm->ps->origin, curMins, curMaxs, end, pm->ps->clientNum, pm->tracemask );
04369                                 if ( !trace.allsolid && !trace.startsolid )
04370                                 {//should never start in solid
04371                                         if ( trace.fraction >= 1.0f )
04372                                         {//all clear
04373                                                 //move me up
04374                                                 pm->ps->origin[2] += updist;
04375                                                 //drop the bottom of my bbox back down
04376                                                 pm->mins[2] = MINS_Z;
04377                                                 pm->ps->pm_flags &= ~PMF_FIX_MINS;
04378                                         }
04379                                         else
04380                                         {//crap, no room to expand, so just crouch us
04381                                                 if ( pm->ps->legsAnim != BOTH_JUMPATTACK6
04382                                                         || pm->ps->legsTimer <= 200 )
04383                                                 {//at the end of the anim, and we can't leave ourselves like this
04384                                                         //so drop the maxs, put the mins back and move us up
04385                                                         pm->maxs[2] += MINS_Z;
04386                                                         pm->ps->origin[2] -= MINS_Z;
04387                                                         pm->mins[2] = MINS_Z;
04388                                                         //this way we'll be in a crouch when we're done
04389                                                         if ( pm->ps->legsAnim == BOTH_JUMPATTACK6 )
04390                                                         {
04391                                                                 pm->ps->legsTimer = pm->ps->torsoTimer = 0;
04392                                                         }
04393                                                         pm->ps->pm_flags |= PMF_DUCKED;
04394                                                         //FIXME: do we need to set a crouch anim here?
04395                                                         pm->ps->pm_flags &= ~PMF_FIX_MINS;
04396                                                 }
04397                                         }
04398                                 }//crap, stuck
04399                         }
04400                 }//crap, stuck!
04401         }
04402 }

void PM_ClipVelocity vec3_t  in,
vec3_t  normal,
vec3_t  out,
float  overbounce
 

Definition at line 954 of file bg_pmove.c.

References playerState_s::clientNum, DotProduct, ENTITYNUM_NONE, playerState_s::groundEntityNum, MAX_CLIENTS, MIN_WALK_NORMAL, pm, playerState_s::pm_flags, PMF_STUCK_TO_WALL, pmove_t::ps, pmove_t::stepSlideFix, vec3_t, and VectorCopy.

Referenced by PM_SlideMove(), and PM_StepSlideMove().

00954                                                                                {
00955         float   backoff;
00956         float   change;
00957         float   oldInZ;
00958         int             i;
00959         
00960         if ( (pm->ps->pm_flags&PMF_STUCK_TO_WALL) )
00961         {//no sliding!
00962                 VectorCopy( in, out );
00963                 return;
00964         }
00965         oldInZ = in[2];
00966 
00967         backoff = DotProduct (in, normal);
00968         
00969         if ( backoff < 0 ) {
00970                 backoff *= overbounce;
00971         } else {
00972                 backoff /= overbounce;
00973         }
00974 
00975         for ( i=0 ; i<3 ; i++ ) {
00976                 change = normal[i]*backoff;
00977                 out[i] = in[i] - change;
00978         }
00979         if ( pm->stepSlideFix )
00980         {
00981                 if ( pm->ps->clientNum < MAX_CLIENTS//normal player
00982                         && pm->ps->groundEntityNum != ENTITYNUM_NONE//on the ground
00983                         && normal[2] < MIN_WALK_NORMAL )//sliding against a steep slope
00984                 {//if walking on the ground, don't slide up slopes that are too steep to walk on
00985                         out[2] = oldInZ;
00986                 }
00987         }
00988 }

qboolean PM_DoSlowFall void   ) 
 

Definition at line 321 of file bg_pmove.c.

References BOTH_WALL_RUN_LEFT, BOTH_WALL_RUN_RIGHT, playerState_s::legsAnim, playerState_s::legsTimer, pm, pmove_t::ps, qboolean, qfalse, and qtrue.

Referenced by PmoveSingle().

00322 {
00323         if ( ( (pm->ps->legsAnim) == BOTH_WALL_RUN_RIGHT || (pm->ps->legsAnim) == BOTH_WALL_RUN_LEFT ) && pm->ps->legsTimer > 500 )
00324         {
00325                 return qtrue;
00326         }
00327 
00328         return qfalse;
00329 }

void PM_FinishWeaponChange void   ) 
 

Definition at line 5802 of file bg_pmove.c.

References pmove_t::cmd, LS_DRAW, pm, PM_SetAnim(), PM_SetSaberMove(), pmove_t::ps, SETANIM_FLAG_OVERRIDE, SETANIM_TORSO, STAT_WEAPONS, playerState_s::stats, TORSO_RAISEWEAP1, playerState_s::weapon, usercmd_s::weapon, WEAPON_RAISING, playerState_s::weaponstate, playerState_s::weaponTime, WP_NONE, WP_NUM_WEAPONS, and WP_SABER.

Referenced by PM_WeaponLightsaber().

05802                                    {
05803         int             weapon;
05804 
05805         weapon = pm->cmd.weapon;
05806         if ( weapon < WP_NONE || weapon >= WP_NUM_WEAPONS ) {
05807                 weapon = WP_NONE;
05808         }
05809 
05810         if ( !( pm->ps->stats[STAT_WEAPONS] & ( 1 << weapon ) ) ) {
05811                 weapon = WP_NONE;
05812         }
05813 
05814         if (weapon == WP_SABER)
05815         {
05816                 PM_SetSaberMove(LS_DRAW);
05817         }
05818         else
05819         {
05820                 //PM_StartTorsoAnim( TORSO_RAISEWEAP1);
05821                 PM_SetAnim(SETANIM_TORSO, TORSO_RAISEWEAP1, SETANIM_FLAG_OVERRIDE, 0);
05822         }
05823         pm->ps->weapon = weapon;
05824         pm->ps->weaponstate = WEAPON_RAISING;
05825         pm->ps->weaponTime += 250;
05826 }

void PM_FootSlopeTrace float *  pDiff,
float *  pInterval
 

Definition at line 4678 of file bg_pmove.c.

References playerState_s::clientNum, pmove_t::cmd, trace_t::endpos, pmove_t::g2Bolts_LFoot, pmove_t::g2Bolts_RFoot, pmove_t::ghoul2, mdxaBone_t::matrix, pmove_t::mins, pmove_t::modelScale, cplane_s::normal, NULL, playerState_s::origin, trace_t::plane, pm, pmove_t::ps, usercmd_s::serverTime, strap_G2API_GetBoltMatrix(), pmove_t::trace, pmove_t::tracemask, vec3_t, VectorCopy, VectorSet, playerState_s::viewangles, and YAW.

Referenced by PM_AdjustStandAnimForSlope().

04679 {
04680         vec3_t  footLOrg, footROrg, footLBot, footRBot;
04681         vec3_t footLPoint, footRPoint;
04682         vec3_t footMins, footMaxs;
04683         vec3_t footLSlope, footRSlope;
04684 
04685         trace_t trace;
04686         float   diff, interval;
04687 
04688         mdxaBone_t      boltMatrix;
04689         vec3_t          G2Angles;
04690         
04691         VectorSet(G2Angles, 0, pm->ps->viewangles[YAW], 0);
04692 
04693         interval = 4;//?
04694 
04695         strap_G2API_GetBoltMatrix( pm->ghoul2, 0, pm->g2Bolts_LFoot, 
04696                         &boltMatrix, G2Angles, pm->ps->origin, pm->cmd.serverTime, 
04697                                         NULL, pm->modelScale );
04698         footLPoint[0] = boltMatrix.matrix[0][3];
04699         footLPoint[1] = boltMatrix.matrix[1][3];
04700         footLPoint[2] = boltMatrix.matrix[2][3];
04701         
04702         strap_G2API_GetBoltMatrix( pm->ghoul2, 0, pm->g2Bolts_RFoot, 
04703                                         &boltMatrix, G2Angles, pm->ps->origin, pm->cmd.serverTime, 
04704                                         NULL, pm->modelScale );
04705         footRPoint[0] = boltMatrix.matrix[0][3];
04706         footRPoint[1] = boltMatrix.matrix[1][3];
04707         footRPoint[2] = boltMatrix.matrix[2][3];
04708 
04709         //get these on the cgame and store it, save ourselves a ghoul2 construct skel call
04710         VectorCopy( footLPoint, footLOrg );
04711         VectorCopy( footRPoint, footROrg );
04712 
04713         //step 2: adjust foot tag z height to bottom of bbox+1
04714         footLOrg[2] = pm->ps->origin[2] + pm->mins[2] + 1;
04715         footROrg[2] = pm->ps->origin[2] + pm->mins[2] + 1;
04716         VectorSet( footLBot, footLOrg[0], footLOrg[1], footLOrg[2] - interval*10 );
04717         VectorSet( footRBot, footROrg[0], footROrg[1], footROrg[2] - interval*10 );
04718 
04719         //step 3: trace down from each, find difference
04720         VectorSet( footMins, -3, -3, 0 );
04721         VectorSet( footMaxs, 3, 3, 1 );
04722 
04723         pm->trace( &trace, footLOrg, footMins, footMaxs, footLBot, pm->ps->clientNum, pm->tracemask );
04724         VectorCopy( trace.endpos, footLBot );
04725         VectorCopy( trace.plane.normal, footLSlope );
04726 
04727         pm->trace( &trace, footROrg, footMins, footMaxs, footRBot, pm->ps->clientNum, pm->tracemask );
04728         VectorCopy( trace.endpos, footRBot );
04729         VectorCopy( trace.plane.normal, footRSlope );
04730 
04731         diff = footLBot[2] - footRBot[2];
04732 
04733         if ( pDiff != NULL )
04734         {
04735                 *pDiff = diff;
04736         }
04737         if ( pInterval != NULL )
04738         {
04739                 *pInterval = interval;
04740         }
04741 }

qboolean PM_ForceJumpingUp void   ) 
 

Definition at line 1266 of file bg_pmove.c.

References BG_CanUseFPNow(), BG_HasYsalamiri(), BG_InSpecialJump(), BG_SaberInSpecial(), BG_SaberInSpecialAttack(), pmove_t::cmd, ENTITYNUM_NONE, playerState_s::fd, FORCE_LEVEL_0, forcedata_s::forceJumpCharge, forcedata_s::forcePowerLevel, forcedata_s::forcePowersActive, FP_LEVITATION, pmove_t::gametype, playerState_s::groundEntityNum, playerState_s::legsAnim, pm, playerState_s::pm_flags, PMF_JUMP_HELD, pmove_t::ps, qboolean, qfalse, qtrue, playerState_s::saberMove, usercmd_s::serverTime, and playerState_s::velocity.

01267 {
01268         if ( !(pm->ps->fd.forcePowersActive&(1<<FP_LEVITATION)) && pm->ps->fd.forceJumpCharge )
01269         {//already jumped and let go
01270                 return qfalse;
01271         }
01272 
01273         if ( BG_InSpecialJump( pm->ps->legsAnim ) )
01274         {
01275                 return qfalse;
01276         }
01277 
01278         if (BG_SaberInSpecial(pm->ps->saberMove))
01279         {
01280                 return qfalse;
01281         }
01282 
01283         if (BG_SaberInSpecialAttack(pm->ps->legsAnim))
01284         {
01285                 return qfalse;
01286         }
01287 
01288         if (BG_HasYsalamiri(pm->gametype, pm->ps))
01289         {
01290                 return qfalse;
01291         }
01292 
01293         if (!BG_CanUseFPNow(pm->gametype, pm->ps, pm->cmd.serverTime, FP_LEVITATION))
01294         {
01295                 return qfalse;
01296         }
01297 
01298         if ( pm->ps->groundEntityNum == ENTITYNUM_NONE && //in air
01299                 (pm->ps->pm_flags & PMF_JUMP_HELD) && //jumped
01300                 pm->ps->fd.forcePowerLevel[FP_LEVITATION] > FORCE_LEVEL_0 && //force-jump capable
01301                 pm->ps->velocity[2] > 0 )//going up
01302         {
01303                 return qtrue;
01304         }
01305         return qfalse;
01306 }

int PM_GetOkWeaponForVehicle void   ) 
 

Definition at line 9759 of file bg_pmove.c.

References pm, PM_WeaponOkOnVehicle(), pmove_t::ps, STAT_WEAPONS, playerState_s::stats, and WP_NUM_WEAPONS.

Referenced by PmoveSingle().

09760 {
09761         int i = 0;
09762 
09763         while (i < WP_NUM_WEAPONS)
09764         {
09765                 if ((pm->ps->stats[STAT_WEAPONS] & (1 << i)) &&
09766                         PM_WeaponOkOnVehicle(i))
09767                 { //this one's good
09768                         return i;
09769                 }
09770 
09771                 i++;
09772         }
09773 
09774         //oh dear!
09775         //assert(!"No valid veh weaps");
09776         return -1;
09777 }

int PM_GetSaberStance void   ) 
 

Definition at line 261 of file bg_pmove.c.

References BG_MySaber(), BG_SabersOff(), BOTH_SABERDUAL_STANCE, BOTH_SABERFAST_STANCE, BOTH_SABERSLOW_STANCE, BOTH_SABERSTAFF_STANCE, BOTH_STAND1, BOTH_STAND2, playerState_s::clientNum, playerState_s::fd, pm, pmove_t::ps, saberInfo_t::readyAnim, forcedata_s::saberAnimLevel, playerState_s::saberEntityNum, playerState_s::saberHolstered, SS_DESANN, SS_DUAL, SS_FAST, SS_MEDIUM, SS_NONE, SS_STAFF, SS_STRONG, and SS_TAVION.

Referenced by PM_SetSaberMove(), and PM_WeaponLightsaber().

00262 {
00263         int anim = BOTH_STAND2;
00264         saberInfo_t *saber1 = BG_MySaber( pm->ps->clientNum, 0 );
00265         saberInfo_t *saber2 = BG_MySaber( pm->ps->clientNum, 1 );
00266 
00267         if (!pm->ps->saberEntityNum)
00268         { //lost it
00269                 return BOTH_STAND1;
00270         }
00271 
00272         if ( BG_SabersOff( pm->ps ) )
00273         {
00274                 return BOTH_STAND1;
00275         }
00276 
00277         if ( saber1
00278                 && saber1->readyAnim != -1 )
00279         {
00280                 return saber1->readyAnim;
00281         }
00282 
00283         if ( saber2
00284                 && saber2->readyAnim != -1 )
00285         {
00286                 return saber2->readyAnim;
00287         }
00288 
00289         if ( saber1 
00290                 && saber2
00291                 && !pm->ps->saberHolstered )
00292         {//dual sabers, both on
00293                 return BOTH_SABERDUAL_STANCE;
00294         }
00295 
00296         switch ( pm->ps->fd.saberAnimLevel )
00297         {
00298         case SS_DUAL:
00299                 anim = BOTH_SABERDUAL_STANCE;
00300                 break;
00301         case SS_STAFF:
00302                 anim = BOTH_SABERSTAFF_STANCE;
00303                 break;
00304         case SS_FAST:
00305         case SS_TAVION:
00306                 anim = BOTH_SABERFAST_STANCE;
00307                 break;
00308         case SS_STRONG:
00309                 anim = BOTH_SABERSLOW_STANCE;
00310                 break;
00311         case SS_NONE:
00312         case SS_MEDIUM:
00313         case SS_DESANN:
00314         default:
00315                 anim = BOTH_STAND2;
00316                 break;
00317         }
00318         return anim;
00319 }

void PM_GrabWallForJump int  anim  ) 
 

Definition at line 1776 of file bg_pmove.c.

References EV_JUMP, pm, PM_AddEvent(), playerState_s::pm_flags, PM_SetAnim(), PMF_STUCK_TO_WALL, pmove_t::ps, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, and SETANIM_FLAG_RESTART.

01777 {//NOTE!!! assumes an appropriate anim is being passed in!!!
01778         PM_SetAnim( SETANIM_BOTH, anim, SETANIM_FLAG_RESTART|SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD, 0 );
01779         PM_AddEvent( EV_JUMP );//make sound for grab
01780         pm->ps->pm_flags |= PMF_STUCK_TO_WALL;
01781 }

qboolean PM_GroundSlideOkay float  zNormal  ) 
 

Definition at line 554 of file bg_slidemove.c.

References BG_InReboundJump(), BOTH_FORCELONGLEAP_ATTACK, BOTH_FORCELONGLEAP_LAND, BOTH_FORCELONGLEAP_START, BOTH_FORCEWALLRUNFLIP_START, BOTH_WALL_RUN_LEFT, BOTH_WALL_RUN_LEFT_STOP, BOTH_WALL_RUN_RIGHT, BOTH_WALL_RUN_RIGHT_STOP, playerState_s::legsAnim, pm, pmove_t::ps, qboolean, qfalse, qtrue, and playerState_s::velocity.

Referenced by PM_SlideMove().

00555 {
00556         if ( zNormal > 0 )
00557         {
00558                 if ( pm->ps->velocity[2] > 0 )
00559                 {
00560                         if ( pm->ps->legsAnim == BOTH_WALL_RUN_RIGHT
00561                                 || pm->ps->legsAnim == BOTH_WALL_RUN_LEFT 
00562                                 || pm->ps->legsAnim == BOTH_WALL_RUN_RIGHT_STOP
00563                                 || pm->ps->legsAnim == BOTH_WALL_RUN_LEFT_STOP 
00564                                 || pm->ps->legsAnim == BOTH_FORCEWALLRUNFLIP_START 
00565                                 || pm->ps->legsAnim == BOTH_FORCELONGLEAP_START
00566                                 || pm->ps->legsAnim == BOTH_FORCELONGLEAP_ATTACK
00567                                 || pm->ps->legsAnim == BOTH_FORCELONGLEAP_LAND
00568                                 || BG_InReboundJump( pm->ps->legsAnim ))
00569                         {
00570                                 return qfalse;
00571                         }
00572                 }
00573         }
00574         return qtrue;
00575 }

void PM_HoverTrace void   ) 
 

Definition at line 719 of file bg_pmove.c.

References AngleVectors(), bgEntity_t, vehicleInfo_t::bouyancy, CLASS_VEHICLE, playerState_s::clientNum, trace_t::contents, CONTENTS_LAVA, CONTENTS_SLIME, CONTENTS_WATER, trace_t::endpos, EV_PLAY_EFFECT_ID, fabs(), trace_t::fraction, pml_t::frametime, G_AddEvent(), G_PlayEffectID(), gentity_t, pml_t::groundPlane, pml_t::groundTrace, vehicleInfo_t::hoverHeight, vehicleInfo_t::hoverStrength, vehicleInfo_t::iWakeFX, Vehicle_s::m_fTimeModifier, bgEntity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, Vehicle_s::m_ulFlags, Vehicle_s::m_vAngularVelocity, Vehicle_s::m_vOrientation, Vehicle_s::m_vPrevOrientation, pmove_t::maxs, vehicleInfo_t::maxSlope, MIN_WALK_NORMAL, pmove_t::mins, cplane_s::normal, entityState_s::NPC_class, NULL, playerState_s::origin, PITCH, trace_t::plane, pm, pm_entSelf, pml, pmove_t::ps, Q_irand(), qfalse, qtrue, ROLL, bgEntity_s::s, pmove_t::trace, pmove_t::tracemask, vec3_t, VectorCopy, VEH_FLYING, Vehicle_t, playerState_s::velocity, pmove_t::waterlevel, and YAW.

Referenced by PmoveSingle().

00720 {
00721         Vehicle_t *pVeh;
00722         float hoverHeight;
00723         vec3_t          point, vAng, fxAxis[3];
00724         trace_t         *trace;
00725         float relativeWaterLevel;
00726 
00727         bgEntity_t *pEnt = pm_entSelf;
00728         if ( !pEnt || pEnt->s.NPC_class != CLASS_VEHICLE )
00729         {
00730                 return;
00731         }
00732 
00733         pVeh = pEnt->m_pVehicle;
00734         hoverHeight = pVeh->m_pVehicleInfo->hoverHeight;
00735         trace = &pml.groundTrace;
00736 
00737         pml.groundPlane = qfalse;
00738 
00739         //relativeWaterLevel = (pm->ps->waterheight - (pm->ps->origin[2]+pm->mins[2]));
00740         relativeWaterLevel = pm->waterlevel; //I.. guess this works
00741         if ( pm->waterlevel && relativeWaterLevel >= 0 )
00742         {//in water
00743                 if ( pVeh->m_pVehicleInfo->bouyancy <= 0.0f )
00744                 {//sink like a rock
00745                 }
00746                 else
00747                 {//rise up
00748                         float floatHeight = (pVeh->m_pVehicleInfo->bouyancy * ((pm->maxs[2]-pm->mins[2])*0.5f)) - (hoverHeight*0.5f);//1.0f should make you float half-in, half-out of water
00749                         if ( relativeWaterLevel > floatHeight )
00750                         {//too low, should rise up
00751                                 pm->ps->velocity[2] += (relativeWaterLevel - floatHeight) * pVeh->m_fTimeModifier;
00752                         }
00753                 }
00754                 //if ( pm->ps->waterheight < pm->ps->origin[2]+pm->maxs[2] )
00755                 if (pm->waterlevel <= 1)
00756                 {//part of us is sticking out of water
00757                         if ( fabs(pm->ps->velocity[0]) + fabs(pm->ps->velocity[1]) > 100 )
00758                         {//moving at a decent speed
00759                                 if ( Q_irand( pml.frametime, 100 ) >= 50 )
00760                                 {//splash
00761                                         vec3_t wakeOrg;
00762 
00763                                         vAng[PITCH] = vAng[ROLL] = 0;
00764                                         vAng[YAW] = pVeh->m_vOrientation[YAW];
00765                                         AngleVectors( vAng, fxAxis[2], fxAxis[1], fxAxis[0] );
00766                                         VectorCopy( pm->ps->origin, wakeOrg );
00767                                         //wakeOrg[2] = pm->ps->waterheight;
00768                                         if (pm->waterlevel >= 2)
00769                                         {
00770                                                 wakeOrg[2] = pm->ps->origin[2]+16;
00771                                         }
00772                                         else
00773                                         {
00774                                                 wakeOrg[2] = pm->ps->origin[2];
00775                                         }
00776 #ifdef QAGAME //yeah, this is kind of crappy and makes no use of prediction whatsoever
00777                                         if ( pVeh->m_pVehicleInfo->iWakeFX )
00778                                         {
00779                                                 //G_PlayEffectID( pVeh->m_pVehicleInfo->iWakeFX, wakeOrg, fxAxis[0] );
00780                                                 //tempent use bad!
00781                                                 G_AddEvent((gentity_t *)pEnt, EV_PLAY_EFFECT_ID, pVeh->m_pVehicleInfo->iWakeFX);
00782                                         }
00783 #endif
00784                                 }
00785                         }
00786                 }
00787         }
00788         else
00789         {
00790                 int traceContents;
00791                 float minNormal = (float)MIN_WALK_NORMAL;
00792                 minNormal = pVeh->m_pVehicleInfo->maxSlope;
00793 
00794                 point[0] = pm->ps->origin[0];
00795                 point[1] = pm->ps->origin[1];
00796                 point[2] = pm->ps->origin[2] - hoverHeight;
00797 
00798                 //FIXME: check for water, too?  If over water, go slower and make wave effect
00799                 //              If *in* water, go really slow and use bouyancy stat to determine how far below surface to float
00800 
00801                 //NOTE: if bouyancy is 2.0f or higher, you float over water like it's solid ground.
00802                 //              if it's 1.0f, you sink halfway into water.  If it's 0, you sink...
00803                 traceContents = pm->tracemask;
00804                 if ( pVeh->m_pVehicleInfo->bouyancy >= 2.0f )
00805                 {//sit on water
00806                         traceContents |= (CONTENTS_WATER|CONTENTS_SLIME|CONTENTS_LAVA);
00807                 }
00808                 pm->trace( trace, pm->ps->origin, pm->mins, pm->maxs, point, pm->ps->clientNum, traceContents );
00809                 if (trace->plane.normal[0] > 0.5f || trace->plane.normal[0] < -0.5f ||
00810                         trace->plane.normal[1] > 0.5f || trace->plane.normal[1] < -0.5f)
00811                 { //steep slanted hill, don't go up it.
00812                         float d = fabs(trace->plane.normal[0]);
00813                         float e = fabs(trace->plane.normal[1]);
00814                         if (e > d)
00815                         {
00816                                 d = e;
00817                         }
00818                         pm->ps->velocity[2] = -300.0f*d;
00819                 }
00820                 else if ( trace->plane.normal[2] >= minNormal ) 
00821                 {//not a steep slope, so push us up
00822                         if ( trace->fraction < 1.0f )
00823                         {//push up off ground
00824                                 float hoverForce = pVeh->m_pVehicleInfo->hoverStrength;
00825                                 if ( trace->fraction > 0.5f )
00826                                 {
00827                                         pm->ps->velocity[2] += (1.0f-trace->fraction)*hoverForce*pVeh->m_fTimeModifier;
00828                                 }
00829                                 else
00830                                 {
00831                                         pm->ps->velocity[2] += (0.5f-(trace->fraction*trace->fraction))*hoverForce*2.0f*pVeh->m_fTimeModifier;
00832                                 }
00833                                 if ( (trace->contents&(CONTENTS_WATER|CONTENTS_SLIME|CONTENTS_LAVA)) )
00834                                 {//hovering on water, make a spash if moving
00835                                         if ( fabs(pm->ps->velocity[0]) + fabs(pm->ps->velocity[1]) > 100 )
00836                                         {//moving at a decent speed
00837                                                 if ( Q_irand( pml.frametime, 100 ) >= 50 )
00838                                                 {//splash
00839                                                         vAng[PITCH] = vAng[ROLL] = 0;
00840                                                         vAng[YAW] = pVeh->m_vOrientation[YAW];
00841                                                         AngleVectors( vAng, fxAxis[2], fxAxis[1], fxAxis[0] );
00842 #ifdef QAGAME
00843                                                         if ( pVeh->m_pVehicleInfo->iWakeFX )
00844                                                         {
00845                                                                 G_PlayEffectID( pVeh->m_pVehicleInfo->iWakeFX, trace->endpos, fxAxis[0] );
00846                                                         }
00847 #endif
00848                                                 }
00849                                         }
00850                                 }
00851                                 pml.groundPlane = qtrue;
00852                         }
00853                 }
00854         }
00855         if ( pml.groundPlane )
00856         {
00857                 PM_SetVehicleAngles( pml.groundTrace.plane.normal );
00858                 // We're on the ground.
00859                 pVeh->m_ulFlags &= ~VEH_FLYING;
00860 
00861                 pVeh->m_vAngularVelocity = 0.0f;
00862         }
00863         else
00864         {
00865                 PM_SetVehicleAngles( NULL );
00866                 // We're flying in the air.
00867                 pVeh->m_ulFlags |= VEH_FLYING;
00868                 //groundTrace
00869 
00870                 if (pVeh->m_vAngularVelocity==0.0f)
00871                 {
00872                         pVeh->m_vAngularVelocity = pVeh->m_vOrientation[YAW] - pVeh->m_vPrevOrientation[YAW];
00873                         if (pVeh->m_vAngularVelocity<-15.0f)
00874                         {
00875                                 pVeh->m_vAngularVelocity = -15.0f;
00876                         }
00877                         if (pVeh->m_vAngularVelocity> 15.0f)
00878                         {
00879                                 pVeh->m_vAngularVelocity =  15.0f;
00880                         }
00881                 }
00882                 //pVeh->m_vAngularVelocity *= 0.95f;            // Angular Velocity Decays Over Time
00883                 if (pVeh->m_vAngularVelocity > 0.0f)
00884                 {
00885                         pVeh->m_vAngularVelocity -= pml.frametime;
00886                         if (pVeh->m_vAngularVelocity < 0.0f)
00887                         {
00888                                 pVeh->m_vAngularVelocity = 0.0f;
00889                         }
00890                 }
00891                 else if (pVeh->m_vAngularVelocity < 0.0f)
00892                 {
00893                         pVeh->m_vAngularVelocity += pml.frametime;
00894                         if (pVeh->m_vAngularVelocity > 0.0f)
00895                         {
00896                                 pVeh->m_vAngularVelocity = 0.0f;
00897                         }
00898                 }
00899         }
00900         PM_GroundTraceMissed();
00901 }

int PM_irand_timesync int  val1,
int  val2
 

Definition at line 10 of file bg_saber.c.

References pmove_t::cmd, pm, Q_random(), and usercmd_s::serverTime.

Referenced by PM_SaberKataDone(), PM_SaberLockBreak(), PM_SaberLocked(), PM_SetSaberMove(), PM_VehicleWeaponAnimate(), and PM_WeaponLightsaber().

00011 {
00012         int i;
00013 
00014         i = (val1-1) + (Q_random( &pm->cmd.serverTime )*(val2 - val1)) + 1;
00015         if (i < val1)
00016         {
00017                 i = val1;
00018         }
00019         if (i > val2)
00020         {
00021                 i = val2;
00022         }
00023 
00024         return i;
00025 }

qboolean PM_INLINE PM_IsRocketTrooper void   ) 
 

Definition at line 247 of file bg_pmove.c.

References PM_INLINE, qboolean, and qfalse.

Referenced by PmoveSingle().

00248 {
00249         /*
00250         if (pm->ps->clientNum < MAX_CLIENTS &&
00251                 pm->gametype == GT_SIEGE &&
00252                 pm->nonHumanoid)
00253         {
00254                 return qtrue;
00255         }
00256         */
00257 
00258         return qfalse;
00259 }

int PM_ItemUsable playerState_t ps,
int  forcedUse
 

Definition at line 6240 of file bg_pmove.c.

References trace_t::allsolid, AngleVectors(), BG_IsItemSelectable(), bg_itemlist, playerState_s::clientNum, playerState_s::duelInProgress, EF_DEAD, EF_SEEKERDRONE, playerState_s::eFlags, trace_t::endpos, trace_t::entityNum, EV_ITEMUSEFAIL, playerState_s::fd, trace_t::fraction, HI_AMMODISP, HI_CLOAK, HI_EWEB, HI_HEALTHDISP, HI_JETPACK, HI_MEDPAC, HI_MEDPAC_BIG, HI_SEEKER, HI_SENTRY_GUN, HI_SHIELD, playerState_s::m_iVehicleNum, MASK_PLAYERSOLID, MASK_SHOT, MASK_SOLID, NULL, playerState_s::origin, PITCH, playerState_t, pm, PM_AddEventWithParm(), playerState_s::pm_flags, PMF_USE_ITEM_HELD, ROLL, SEEKER_ALREADYDEPLOYED, SENTRY_ALREADYPLACED, SENTRY_NOROOM, forcedata_s::sentryDeployed, SHIELD_NOROOM, trace_t::startsolid, STAT_HEALTH, STAT_HOLDABLE_ITEM, STAT_MAX_HEALTH, playerState_s::stats, pmove_t::trace, vec3_t, VectorCopy, VectorMA, VectorSet, playerState_s::viewangles, and YAW.

06241 {
06242         vec3_t fwd, fwdorg, dest, pos;
06243         vec3_t yawonly;
06244         vec3_t mins, maxs;
06245         vec3_t trtest;
06246         trace_t tr;
06247 
06248         if (ps->m_iVehicleNum)
06249         {
06250                 return 0;
06251         }
06252 
06253         if (ps->pm_flags & PMF_USE_ITEM_HELD)
06254         { //force to let go first
06255                 return 0;
06256         }
06257 
06258         if (ps->duelInProgress)
06259         { //not allowed to use holdables while in a private duel.
06260                 return 0;
06261         }
06262 
06263         if (!forcedUse)
06264         {
06265                 forcedUse = bg_itemlist[ps->stats[STAT_HOLDABLE_ITEM]].giTag;
06266         }
06267 
06268         if (!BG_IsItemSelectable(ps, forcedUse))
06269         {
06270                 return 0;
06271         }
06272 
06273         switch (forcedUse)
06274         {
06275         case HI_MEDPAC:
06276         case HI_MEDPAC_BIG:
06277                 if (ps->stats[STAT_HEALTH] >= ps->stats[STAT_MAX_HEALTH])
06278                 {
06279                         return 0;
06280                 }
06281                 if (ps->stats[STAT_HEALTH] <= 0 ||
06282                         (ps->eFlags & EF_DEAD))
06283                 {
06284                         return 0;
06285                 }
06286 
06287                 return 1;
06288         case HI_SEEKER:
06289                 if (ps->eFlags & EF_SEEKERDRONE)
06290                 {
06291                         PM_AddEventWithParm(EV_ITEMUSEFAIL, SEEKER_ALREADYDEPLOYED);
06292                         return 0;
06293                 }
06294 
06295                 return 1;
06296         case HI_SENTRY_GUN:
06297                 if (ps->fd.sentryDeployed)
06298                 {
06299                         PM_AddEventWithParm(EV_ITEMUSEFAIL, SENTRY_ALREADYPLACED);
06300                         return 0;
06301                 }
06302 
06303                 yawonly[ROLL] = 0;
06304                 yawonly[PITCH] = 0;
06305                 yawonly[YAW] = ps->viewangles[YAW];
06306 
06307                 VectorSet( mins, -8, -8, 0 );
06308                 VectorSet( maxs, 8, 8, 24 );
06309 
06310                 AngleVectors(yawonly, fwd, NULL, NULL);
06311 
06312                 fwdorg[0] = ps->origin[0] + fwd[0]*64;
06313                 fwdorg[1] = ps->origin[1] + fwd[1]*64;
06314                 fwdorg[2] = ps->origin[2] + fwd[2]*64;
06315 
06316                 trtest[0] = fwdorg[0] + fwd[0]*16;
06317                 trtest[1] = fwdorg[1] + fwd[1]*16;
06318                 trtest[2] = fwdorg[2] + fwd[2]*16;
06319 
06320                 pm->trace(&tr, ps->origin, mins, maxs, trtest, ps->clientNum, MASK_PLAYERSOLID);
06321 
06322                 if ((tr.fraction != 1 && tr.entityNum != ps->clientNum) || tr.startsolid || tr.allsolid)
06323                 {
06324                         PM_AddEventWithParm(EV_ITEMUSEFAIL, SENTRY_NOROOM);
06325                         return 0;
06326                 }
06327 
06328                 return 1;
06329         case HI_SHIELD:
06330                 mins[0] = -8;
06331                 mins[1] = -8;
06332                 mins[2] = 0;
06333 
06334                 maxs[0] = 8;
06335                 maxs[1] = 8;
06336                 maxs[2] = 8;
06337 
06338                 AngleVectors (ps->viewangles, fwd, NULL, NULL);
06339                 fwd[2] = 0;
06340                 VectorMA(ps->origin, 64, fwd, dest);
06341                 pm->trace(&tr, ps->origin, mins, maxs, dest, ps->clientNum, MASK_SHOT );
06342                 if (tr.fraction > 0.9 && !tr.startsolid && !tr.allsolid)
06343                 {
06344                         VectorCopy(tr.endpos, pos);
06345                         VectorSet( dest, pos[0], pos[1], pos[2] - 4096 );
06346                         pm->trace( &tr, pos, mins, maxs, dest, ps->clientNum, MASK_SOLID );
06347                         if ( !tr.startsolid && !tr.allsolid )
06348                         {
06349                                 return 1;
06350                         }
06351                 }
06352                 PM_AddEventWithParm(EV_ITEMUSEFAIL, SHIELD_NOROOM);
06353                 return 0;
06354         case HI_JETPACK: //check for stuff here?
06355                 return 1;
06356         case HI_HEALTHDISP:
06357                 return 1;
06358         case HI_AMMODISP:
06359                 return 1;
06360         case HI_EWEB:
06361                 return 1;
06362         case HI_CLOAK: //check for stuff here?
06363                 return 1;
06364         default:
06365                 return 1;
06366         }
06367 }

int PM_KickMoveForConditions void   ) 
 

Definition at line 2617 of file bg_saber.c.

References pmove_t::cmd, DIR_BACK, DIR_FRONT, DIR_LEFT, DIR_RIGHT, usercmd_s::forwardmove, LS_KICK_B, LS_KICK_F, LS_KICK_L, LS_KICK_R, LS_KICK_RL, LS_KICK_S, pm, usercmd_s::rightmove, and usercmd_s::upmove.

Referenced by PM_WeaponLightsaber().

02618 {
02619         int kickMove = -1;
02620 
02621         //FIXME: only if FP_SABER_OFFENSE >= 3
02622         if ( pm->cmd.rightmove )
02623         {//kick to side
02624                 if ( pm->cmd.rightmove > 0 )
02625                 {//kick right
02626                         kickMove = LS_KICK_R;
02627                 }
02628                 else
02629                 {//kick left
02630                         kickMove = LS_KICK_L;
02631                 }
02632                 pm->cmd.rightmove = 0;
02633         }
02634         else if ( pm->cmd.forwardmove )
02635         {//kick front/back
02636                 if ( pm->cmd.forwardmove > 0 )
02637                 {//kick fwd
02638                         /*
02639                         if (pm->ps->groundEntityNum != ENTITYNUM_NONE &&
02640                                 PM_CheckEnemyPresence( DIR_FRONT, 64.0f ))
02641                         {
02642                                 kickMove = LS_HILT_BASH;
02643                         }
02644                         else
02645                         */
02646                         {
02647                                 kickMove = LS_KICK_F;
02648                         }
02649                 }
02650                 else
02651                 {//kick back
02652                         kickMove = LS_KICK_B;
02653                 }
02654                 pm->cmd.forwardmove = 0;
02655         }
02656         else
02657         {
02658                 //if (pm->cmd.buttons & BUTTON_ATTACK)
02659                 //if (pm->ps->pm_flags & PMF_JUMP_HELD)
02660                 if (0)
02661                 { //ok, let's try some fancy kicks
02662                         //qboolean is actually of type int anyway, but just for safeness.
02663                         int front = (int)PM_CheckEnemyPresence( DIR_FRONT, 100.0f );
02664                         int back = (int)PM_CheckEnemyPresence( DIR_BACK, 100.0f );
02665                         int right = (int)PM_CheckEnemyPresence( DIR_RIGHT, 100.0f );
02666                         int left = (int)PM_CheckEnemyPresence( DIR_LEFT, 100.0f );
02667                         int numEnemy = front+back+right+left;
02668 
02669                         if (numEnemy >= 3 ||
02670                                 ((!right || !left) && numEnemy >= 2))
02671                         { //> 2 enemies near, or, >= 2 enemies near and they are not to the right and left.
02672                 kickMove = LS_KICK_S;
02673                         }
02674                         else if (right && left)
02675                         { //enemies on both sides
02676                                 kickMove = LS_KICK_RL;
02677                         }
02678                         else
02679                         { //oh well, just do a forward kick
02680                                 kickMove = LS_KICK_F;
02681                         }
02682 
02683                         pm->cmd.upmove = 0;
02684                 }
02685         }
02686 
02687         return kickMove;
02688 }

int PM_LegsSlopeBackTransition int  desiredAnim  ) 
 

Definition at line 5108 of file bg_pmove.c.

References pmove_t::cmd, LEGS_LEFTUP2, LEGS_LEFTUP3, LEGS_LEFTUP4, LEGS_LEFTUP5, LEGS_RIGHTUP2, LEGS_RIGHTUP3, LEGS_RIGHTUP4, LEGS_RIGHTUP5, LEGS_S1_LUP2, LEGS_S1_LUP3, LEGS_S1_LUP4, LEGS_S1_LUP5, LEGS_S1_RUP2, LEGS_S1_RUP3, LEGS_S1_RUP4, LEGS_S1_RUP5, LEGS_S3_LUP2, LEGS_S3_LUP3, LEGS_S3_LUP4, LEGS_S3_LUP5, LEGS_S3_RUP2, LEGS_S3_RUP3, LEGS_S3_RUP4, LEGS_S3_RUP5, LEGS_S4_LUP2, LEGS_S4_LUP3, LEGS_S4_LUP4, LEGS_S4_LUP5, LEGS_S4_RUP2, LEGS_S4_RUP3, LEGS_S4_RUP4, LEGS_S4_RUP5, LEGS_S5_LUP2, LEGS_S5_LUP3, LEGS_S5_LUP4, LEGS_S5_LUP5, LEGS_S5_RUP2, LEGS_S5_RUP3, LEGS_S5_RUP4, LEGS_S5_RUP5, playerState_s::legsAnim, pm, pmove_t::ps, usercmd_s::serverTime, playerState_s::slopeRecalcTime, VectorClear, and playerState_s::velocity.

05109 {
05110         int anim = pm->ps->legsAnim;
05111         int resultingAnim = desiredAnim;
05112 
05113         switch ( anim )
05114         {
05115         case LEGS_LEFTUP2:                      //# On a slope with left foot 8 higher than right
05116         case LEGS_LEFTUP3:                      //# On a slope with left foot 12 higher than right
05117         case LEGS_LEFTUP4:                      //# On a slope with left foot 16 higher than right
05118         case LEGS_LEFTUP5:                      //# On a slope with left foot 20 higher than right
05119         case LEGS_RIGHTUP2:                     //# On a slope with RIGHT foot 8 higher than left
05120         case LEGS_RIGHTUP3:                     //# On a slope with RIGHT foot 12 higher than left
05121         case LEGS_RIGHTUP4:                     //# On a slope with RIGHT foot 16 higher than left
05122         case LEGS_RIGHTUP5:                     //# On a slope with RIGHT foot 20 higher than left
05123         case LEGS_S1_LUP2:
05124         case LEGS_S1_LUP3:
05125         case LEGS_S1_LUP4:
05126         case LEGS_S1_LUP5:
05127         case LEGS_S1_RUP2:
05128         case LEGS_S1_RUP3:
05129         case LEGS_S1_RUP4:
05130         case LEGS_S1_RUP5:
05131         case LEGS_S3_LUP2:
05132         case LEGS_S3_LUP3:
05133         case LEGS_S3_LUP4:
05134         case LEGS_S3_LUP5:
05135         case LEGS_S3_RUP2:
05136         case LEGS_S3_RUP3:
05137         case LEGS_S3_RUP4:
05138         case LEGS_S3_RUP5:
05139         case LEGS_S4_LUP2:
05140         case LEGS_S4_LUP3:
05141         case LEGS_S4_LUP4:
05142         case LEGS_S4_LUP5:
05143         case LEGS_S4_RUP2:
05144         case LEGS_S4_RUP3:
05145         case LEGS_S4_RUP4:
05146         case LEGS_S4_RUP5:
05147         case LEGS_S5_LUP2:
05148         case LEGS_S5_LUP3:
05149         case LEGS_S5_LUP4:
05150         case LEGS_S5_LUP5:
05151         case LEGS_S5_RUP2:
05152         case LEGS_S5_RUP3:
05153         case LEGS_S5_RUP4:
05154         case LEGS_S5_RUP5:
05155                 if (pm->ps->slopeRecalcTime < pm->cmd.serverTime)
05156                 {
05157                         resultingAnim = anim-1;
05158                         pm->ps->slopeRecalcTime = pm->cmd.serverTime + 8;//SLOPE_RECALC_INT;
05159                 }
05160                 else
05161                 {
05162                         resultingAnim = anim;
05163                 }
05164                 VectorClear(pm->ps->velocity);
05165                 break;
05166         }
05167 
05168         return resultingAnim;
05169 }

void PM_MoveForKata usercmd_t ucmd  ) 
 

Definition at line 10089 of file bg_pmove.c.

References BOTH_A2_SPECIAL, BOTH_A3_SPECIAL, BOTH_A7_SOULCAL, pmove_t::cmd, ENTITYNUM_NONE, EV_JUMP, playerState_s::fd, forcedata_s::forceJumpZStart, usercmd_s::forwardmove, playerState_s::groundEntityNum, playerState_s::legsAnim, playerState_s::legsTimer, LS_STAFF_SOULCAL, playerState_s::origin, pm, PM_AddEvent(), PM_CanRollFromSoulCal(), pmove_t::ps, usercmd_s::rightmove, playerState_s::saberMove, ucmd, usercmd_s::upmove, usercmd_t, and playerState_s::velocity.

Referenced by PmoveSingle().

10090 {
10091         if ( pm->ps->legsAnim == BOTH_A7_SOULCAL
10092                 && pm->ps->saberMove == LS_STAFF_SOULCAL )
10093         {//forward spinning staff attack
10094                 ucmd->upmove = 0;
10095 
10096                 if ( PM_CanRollFromSoulCal( pm->ps ) )
10097                 {
10098                         ucmd->upmove = -127;
10099                         ucmd->rightmove = 0;
10100                         if (ucmd->forwardmove < 0)
10101                         {
10102                                 ucmd->forwardmove = 0;
10103                         }
10104                 }
10105                 else
10106                 {
10107                         ucmd->rightmove = 0;
10108                         //FIXME: don't slide off people/obstacles?
10109                         if ( pm->ps->legsTimer >= 2750 )
10110                         {//not at end
10111                                 //push forward
10112                                 ucmd->forwardmove = 64;
10113                         }
10114                         else
10115                         {
10116                                 ucmd->forwardmove = 0;
10117                         }
10118                 }
10119                 if ( pm->ps->legsTimer >= 2650 
10120                         && pm->ps->legsTimer < 2850 )     
10121                 {//the jump
10122                         if ( pm->ps->groundEntityNum != ENTITYNUM_NONE )
10123                         {//still on ground?
10124                                 //jump!
10125                                 pm->ps->velocity[2] = 250;
10126                                 pm->ps->fd.forceJumpZStart = pm->ps->origin[2];//so we don't take damage if we land at same height
10127                         //      pm->ps->pm_flags |= PMF_JUMPING;//|PMF_SLOW_MO_FALL;
10128                                 //FIXME: NPCs yell?
10129                                 PM_AddEvent(EV_JUMP);
10130                         }
10131                 }
10132         }
10133         else if (pm->ps->legsAnim == BOTH_A2_SPECIAL)
10134         { //medium kata
10135                 pm->cmd.rightmove = 0;
10136                 pm->cmd.upmove = 0;
10137                 if (pm->ps->legsTimer < 2700 && pm->ps->legsTimer > 2300)
10138                 {
10139                         pm->cmd.forwardmove = 127;
10140                 }
10141                 else if (pm->ps->legsTimer < 900 && pm->ps->legsTimer > 500)
10142                 {
10143                         pm->cmd.forwardmove = 127;
10144                 }
10145                 else
10146                 {
10147                         pm->cmd.forwardmove = 0;
10148                 }
10149         }
10150         else if (pm->ps->legsAnim == BOTH_A3_SPECIAL)
10151         { //strong kata
10152                 pm->cmd.rightmove = 0;
10153                 pm->cmd.upmove = 0;
10154                 if (pm->ps->legsTimer < 1700 && pm->ps->legsTimer > 1000)
10155                 {
10156                         pm->cmd.forwardmove = 127;
10157                 }
10158                 else
10159                 {
10160                         pm->cmd.forwardmove = 0;
10161                 }
10162         }
10163         else
10164         {
10165                 pm->cmd.forwardmove = 0;
10166                 pm->cmd.rightmove = 0;
10167                 pm->cmd.upmove = 0;
10168         }
10169 }

void PM_pitch_roll_for_slope bgEntity_t forwhom,
vec3_t  pass_slope,
vec3_t  storeAngles
 

Definition at line 346 of file bg_pmove.c.

References AngleVectors(), bgEntity_t, CLASS_VEHICLE, DotProduct, fabs(), trace_t::fraction, bgEntity_s::m_pVehicle, Vehicle_s::m_vOrientation, MASK_SOLID, pmove_t::mins, cplane_s::normal, entityState_s::NPC_class, NULL, entityState_s::number, playerState_s::origin, PITCH, trace_t::plane, pm, pmove_t::ps, Q_fabs(), ROLL, bgEntity_s::s, pmove_t::trace, vec3_origin, vec3_t, vectoangles(), VectorCopy, Vehicle_t, playerState_s::viewangles, and YAW.

00347 {
00348         vec3_t  slope;
00349         vec3_t  nvf, ovf, ovr, startspot, endspot, new_angles = { 0, 0, 0 };
00350         float   pitch, mod, dot;
00351 
00352         //if we don't have a slope, get one
00353         if( !pass_slope || VectorCompare( vec3_origin, pass_slope ) )
00354         {
00355                 trace_t trace;
00356 
00357                 VectorCopy( pm->ps->origin, startspot );
00358                 startspot[2] += pm->mins[2] + 4;
00359                 VectorCopy( startspot, endspot );
00360                 endspot[2] -= 300;
00361                 pm->trace( &trace, pm->ps->origin, vec3_origin, vec3_origin, endspot, forwhom->s.number, MASK_SOLID );
00362 //              if(trace_fraction>0.05&&forwhom.movetype==MOVETYPE_STEP)
00363 //                      forwhom.flags(-)FL_ONGROUND;
00364 
00365                 if ( trace.fraction >= 1.0 )
00366                         return;
00367 
00368                 if( !( &trace.plane ) )
00369                         return;
00370 
00371                 if ( VectorCompare( vec3_origin, trace.plane.normal ) )
00372                         return;
00373 
00374                 VectorCopy( trace.plane.normal, slope );
00375         }
00376         else
00377         {
00378                 VectorCopy( pass_slope, slope );
00379         }
00380 
00381         if ( forwhom->s.NPC_class == CLASS_VEHICLE )
00382         {//special code for vehicles
00383                 Vehicle_t *pVeh = forwhom->m_pVehicle;
00384                 vec3_t tempAngles;
00385 
00386                 tempAngles[PITCH] = tempAngles[ROLL] = 0;
00387                 tempAngles[YAW] = pVeh->m_vOrientation[YAW];
00388                 AngleVectors( tempAngles, ovf, ovr, NULL );
00389         }
00390         else
00391         {
00392                 AngleVectors( pm->ps->viewangles, ovf, ovr, NULL );
00393         }
00394 
00395         vectoangles( slope, new_angles );
00396         pitch = new_angles[PITCH] + 90;
00397         new_angles[ROLL] = new_angles[PITCH] = 0;
00398 
00399         AngleVectors( new_angles, nvf, NULL, NULL );
00400 
00401         mod = DotProduct( nvf, ovr );
00402 
00403         if ( mod<0 )
00404                 mod = -1;
00405         else
00406                 mod = 1;
00407 
00408         dot = DotProduct( nvf, ovf );
00409 
00410         if ( storeAngles )
00411         {
00412                 storeAngles[PITCH] = dot * pitch;
00413                 storeAngles[ROLL] = ((1-Q_fabs(dot)) * pitch * mod);
00414         }
00415         else //if ( forwhom->client )
00416         {
00417                 float oldmins2;
00418 
00419                 pm->ps->viewangles[PITCH] = dot * pitch;
00420                 pm->ps->viewangles[ROLL] = ((1-Q_fabs(dot)) * pitch * mod);
00421                 oldmins2 = pm->mins[2];
00422                 pm->mins[2] = -24 + 12 * fabs(pm->ps->viewangles[PITCH])/180.0f;
00423                 //FIXME: if it gets bigger, move up
00424                 if ( oldmins2 > pm->mins[2] )
00425                 {//our mins is now lower, need to move up
00426                         //FIXME: trace?
00427                         pm->ps->origin[2] += (oldmins2 - pm->mins[2]);
00428                         //forwhom->currentOrigin[2] = forwhom->client->ps.origin[2];
00429                         //gi.linkentity( forwhom );
00430                 }
00431         }
00432         /*
00433         else
00434         {
00435                 forwhom->currentAngles[PITCH] = dot * pitch;
00436                 forwhom->currentAngles[ROLL] = ((1-Q_fabs(dot)) * pitch * mod);
00437         }
00438         */
00439 }

void PM_RocketLock float  lockDist,
qboolean  vehicleLock
 

Definition at line 5875 of file bg_pmove.c.

References AngleVectors(), BG_VehTraceFromCamPos(), bgEntity_t, playerState_s::clientNum, pmove_t::cmd, trace_t::endpos, trace_t::entityNum, ENTITYNUM_NONE, ET_NPC, ET_PLAYER, entityState_s::eType, trace_t::fraction, MASK_PLAYERSOLID, memcpy(), NULL, playerState_s::origin, pm, PM_BGEntForNum(), entityState_s::powerups, pmove_t::ps, PW_CLOAKED, playerState_s::rocketLastValidTime, playerState_s::rocketLockIndex, playerState_s::rocketLockTime, playerState_s::rocketTargetTime, bgEntity_s::s, usercmd_s::serverTime, pmove_t::trace, vec3_t, VectorCopy, VectorMA, playerState_s::viewangles, playerState_s::viewheight, WP_MuzzlePoint, and WP_ROCKET_LAUNCHER.

05876 {
05877         // Not really a charge weapon, but we still want to delay fire until the button comes up so that we can
05878         //      implement our alt-fire locking stuff
05879         vec3_t          ang;
05880         trace_t         tr;
05881         
05882         vec3_t muzzleOffPoint, muzzlePoint, forward, right, up;
05883 
05884         if ( vehicleLock )
05885         {
05886                 AngleVectors( pm->ps->viewangles, forward, right, up );
05887                 VectorCopy( pm->ps->origin, muzzlePoint );
05888                 VectorMA( muzzlePoint, lockDist, forward, ang );
05889         }
05890         else
05891         {
05892                 AngleVectors( pm->ps->viewangles, forward, right, up );
05893 
05894                 AngleVectors(pm->ps->viewangles, ang, NULL, NULL);
05895 
05896                 VectorCopy( pm->ps->origin, muzzlePoint );
05897                 VectorCopy(WP_MuzzlePoint[WP_ROCKET_LAUNCHER], muzzleOffPoint);
05898 
05899                 VectorMA(muzzlePoint, muzzleOffPoint[0], forward, muzzlePoint);
05900                 VectorMA(muzzlePoint, muzzleOffPoint[1], right, muzzlePoint);
05901                 muzzlePoint[2] += pm->ps->viewheight + muzzleOffPoint[2];
05902                 ang[0] = muzzlePoint[0] + ang[0]*lockDist;
05903                 ang[1] = muzzlePoint[1] + ang[1]*lockDist;
05904                 ang[2] = muzzlePoint[2] + ang[2]*lockDist;
05905         }
05906 
05907 
05908         pm->trace(&tr, muzzlePoint, NULL, NULL, ang, pm->ps->clientNum, MASK_PLAYERSOLID);
05909 
05910         if ( vehicleLock )
05911         {//vehicles also do a trace from the camera point if the main one misses
05912                 if ( tr.fraction >= 1.0f )
05913                 {
05914                         trace_t camTrace;
05915                         vec3_t newEnd, shotDir;
05916                         if ( BG_VehTraceFromCamPos( &camTrace, PM_BGEntForNum(pm->ps->clientNum), pm->ps->origin, muzzlePoint, tr.endpos, newEnd, shotDir, (tr.fraction*lockDist) ) )
05917                         {
05918                                 memcpy( &tr, &camTrace, sizeof(tr) );
05919                         }
05920                 }
05921         }
05922 
05923         if (tr.fraction != 1 && tr.entityNum < ENTITYNUM_NONE && tr.entityNum != pm->ps->clientNum)
05924         {
05925                 bgEntity_t *bgEnt = PM_BGEntForNum(tr.entityNum);
05926                 if ( bgEnt && (bgEnt->s.powerups&PW_CLOAKED) )
05927                 {
05928                         pm->ps->rocketLockIndex = ENTITYNUM_NONE;
05929                         pm->ps->rocketLockTime = 0;
05930                 }
05931                 else if (bgEnt && (bgEnt->s.eType == ET_PLAYER || bgEnt->s.eType == ET_NPC))
05932                 {
05933                         if (pm->ps->rocketLockIndex == ENTITYNUM_NONE)
05934                         {
05935                                 pm->ps->rocketLockIndex = tr.entityNum;
05936                                 pm->ps->rocketLockTime = pm->cmd.serverTime;
05937                         }
05938                         else if (pm->ps->rocketLockIndex != tr.entityNum && pm->ps->rocketTargetTime < pm->cmd.serverTime)
05939                         {
05940                                 pm->ps->rocketLockIndex = tr.entityNum;
05941                                 pm->ps->rocketLockTime = pm->cmd.serverTime;
05942                         }
05943                         else if (pm->ps->rocketLockIndex == tr.entityNum)
05944                         {
05945                                 if (pm->ps->rocketLockTime == -1)
05946                                 {
05947                                         pm->ps->rocketLockTime = pm->ps->rocketLastValidTime;
05948                                 }
05949                         }
05950 
05951                         if (pm->ps->rocketLockIndex == tr.entityNum)
05952                         {
05953                                 pm->ps->rocketTargetTime = pm->cmd.serverTime + 500;
05954                         }
05955                 }
05956                 else if (!vehicleLock)
05957                 {
05958                         if (pm->ps->rocketTargetTime < pm->cmd.serverTime)
05959                         {
05960                                 pm->ps->rocketLockIndex = ENTITYNUM_NONE;
05961                                 pm->ps->rocketLockTime = 0;
05962                         }
05963                 }
05964         }
05965         else if (pm->ps->rocketTargetTime < pm->cmd.serverTime)
05966         {
05967                 pm->ps->rocketLockIndex = ENTITYNUM_NONE;
05968                 pm->ps->rocketLockTime = 0;
05969         }
05970         else
05971         {
05972                 if (pm->ps->rocketLockTime != -1)
05973                 {
05974                         pm->ps->rocketLastValidTime = pm->ps->rocketLockTime;
05975                 }
05976                 pm->ps->rocketLockTime = -1;
05977         }
05978 }

qboolean PM_RollingAnim int  anim  ) 
 

Definition at line 4636 of file bg_pmove.c.

References BOTH_ROLL_B, BOTH_ROLL_F, BOTH_ROLL_L, BOTH_ROLL_R, qboolean, qfalse, and qtrue.

Referenced by Jedi_SaberBusy(), NPC_ChoosePainAnimation(), and WP_ResistForcePush().

04637 {
04638         switch ( anim )
04639         {
04640         case BOTH_ROLL_F:                       //# Roll forward
04641         case BOTH_ROLL_B:                       //# Roll backward
04642         case BOTH_ROLL_L:                       //# Roll left
04643         case BOTH_ROLL_R:                       //# Roll right
04644                 return qtrue;
04645                 break;
04646         }
04647         return qfalse;
04648 }

qboolean PM_RunningAnim int  anim  ) 
 

Definition at line 4601 of file bg_pmove.c.

References BOTH_RUN1, BOTH_RUN1START, BOTH_RUN1STOP, BOTH_RUN2, BOTH_RUN_DUAL, BOTH_RUN_STAFF, BOTH_RUNBACK1, BOTH_RUNBACK2, BOTH_RUNBACK_DUAL, BOTH_RUNBACK_STAFF, BOTH_RUNSTRAFE_LEFT1, BOTH_RUNSTRAFE_RIGHT1, qboolean, qfalse, and qtrue.

Referenced by BG_SetAnimFinal(), G_UpdateClientAnims(), and PM_WeaponLightsaber().

04602 {
04603         switch ( (anim) )
04604         {
04605         case BOTH_RUN1:                 
04606         case BOTH_RUN2:                 
04607         case BOTH_RUN_STAFF:
04608         case BOTH_RUN_DUAL:
04609         case BOTH_RUNBACK1:                     
04610         case BOTH_RUNBACK2:                     
04611         case BOTH_RUNBACK_STAFF:                        
04612         case BOTH_RUNBACK_DUAL:
04613         case BOTH_RUN1START:                    //# Start into full run1
04614         case BOTH_RUN1STOP:                     //# Stop from full run1
04615         case BOTH_RUNSTRAFE_LEFT1:      //# Sidestep left: should loop
04616         case BOTH_RUNSTRAFE_RIGHT1:     //# Sidestep right: should loop
04617                 return qtrue;
04618                 break;
04619         }
04620         return qfalse;
04621 }

qboolean PM_SaberInTransition int  move  ) 
 

Definition at line 1610 of file bg_panimate.c.

01611 {
01612         if ( move >= LS_T1_BR__R && move <= LS_T1_BL__L )
01613         {
01614                 return qtrue;
01615         }
01616         return qfalse;
01617 }

void PM_SetForceJumpZStart float  value  ) 
 

Definition at line 1759 of file bg_pmove.c.

References playerState_s::fd, forcedata_s::forceJumpZStart, pm, and pmove_t::ps.

Referenced by PM_SaberFlipOverAttackMove(), and PM_SaberJumpAttackMove().

01760 {
01761         pm->ps->fd.forceJumpZStart = value;
01762         if (!pm->ps->fd.forceJumpZStart)
01763         {
01764                 pm->ps->fd.forceJumpZStart -= 0.1;
01765         }
01766 }

void PM_SetPMViewAngle playerState_t ps,
vec3_t  angle,
usercmd_t ucmd
 

Definition at line 1342 of file bg_pmove.c.

References ANGLE2SHORT, usercmd_s::angles, playerState_s::delta_angles, playerState_t, ucmd, usercmd_t, vec3_t, VectorCopy, and playerState_s::viewangles.

Referenced by PM_AdjustAngleForWallJump(), PM_AdjustAngleForWallRun(), PM_AdjustAngleForWallRunUp(), PM_AdjustAnglesForWallRunUpFlipAlt(), PM_VehFaceHyperspacePoint(), PM_VehForcedTurning(), PM_VehicleViewAngles(), and PmoveSingle().

01343 {
01344         int                     i;
01345 
01346         for (i=0 ; i<3 ; i++)
01347         { // set the delta angle
01348                 int             cmdAngle;
01349 
01350                 cmdAngle = ANGLE2SHORT(angle[i]);
01351                 ps->delta_angles[i] = cmdAngle - ucmd->angles[i];
01352         }
01353         VectorCopy (angle, ps->viewangles);
01354 }

void PM_SetSpecialMoveValues void   ) 
 

Definition at line 447 of file bg_pmove.c.

References bgEntity_t, CLASS_VEHICLE, playerState_s::clientNum, EF2_FLYING, playerState_s::eFlags2, FLY_HOVER, FLY_NONE, FLY_NORMAL, FLY_VEHICLE, vehicleInfo_t::hoverHeight, bgEntity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, MAX_CLIENTS, entityState_s::NPC_class, pm, pm_entSelf, pmove_t::ps, bgEntity_s::s, vehicleInfo_t::type, and VH_FIGHTER.

Referenced by PmoveSingle().

00448 {
00449         bgEntity_t *pEnt;
00450         
00451         if (pm->ps->clientNum < MAX_CLIENTS)
00452         { //we know that real players aren't vehs
00453                 pm_flying = FLY_NONE;
00454                 return;
00455         }
00456 
00457         //default until we decide otherwise
00458         pm_flying = FLY_NONE;
00459 
00460         pEnt = pm_entSelf;
00461 
00462         if ( pEnt )
00463         {
00464                 if ( (pm->ps->eFlags2&EF2_FLYING) )// pm->gent->client->moveType == MT_FLYSWIM )
00465                 {
00466                         pm_flying = FLY_NORMAL;
00467                 }
00468                 else if ( pEnt->s.NPC_class == CLASS_VEHICLE )
00469                 {
00470                         if ( pEnt->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER )
00471                         {
00472                                 pm_flying = FLY_VEHICLE;
00473                         }
00474                         else if ( pEnt->m_pVehicle->m_pVehicleInfo->hoverHeight > 0 )
00475                         {
00476                                 pm_flying = FLY_HOVER;
00477                         }
00478                 }
00479         }
00480 }

qboolean PM_SwimmingAnim int  anim  ) 
 

Definition at line 4623 of file bg_pmove.c.

References BOTH_SWIM_IDLE1, BOTH_SWIMBACKWARD, BOTH_SWIMFORWARD, qboolean, qfalse, and qtrue.

Referenced by PM_WeaponLightsaber().

04624 {
04625         switch ( anim )
04626         {
04627         case BOTH_SWIM_IDLE1:           //# Swimming Idle 1
04628         case BOTH_SWIMFORWARD:          //# Swim forward loop
04629         case BOTH_SWIMBACKWARD:         //# Swim backward loop
04630                 return qtrue;
04631                 break;
04632         }
04633         return qfalse;
04634 }

void PM_UpdateViewAngles playerState_t ps,
const usercmd_t cmd
 

Definition at line 7814 of file bg_pmove.c.

References ANGLE2SHORT, AngleNormalize180(), usercmd_s::angles, BG_UnrestrainedPitchRoll(), playerState_s::delta_angles, HYPERSPACE_TIME, playerState_s::hyperSpaceTime, bgEntity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, Vehicle_s::m_vPrevRiderViewAngles, PITCH, bgEntity_s::playerState, playerState_t, pm_entVeh, PM_INTERMISSION, PM_SPECTATOR, PM_SPINTERMISSION, playerState_s::pm_type, usercmd_s::serverTime, SHORT2ANGLE, STAT_HEALTH, playerState_s::stats, vehicleInfo_t::type, usercmd_t, VH_FIGHTER, playerState_s::viewangles, and YAW.

Referenced by CG_PredictPlayerState(), and PmoveSingle().

07814                                                                     {
07815         short           temp;
07816         int             i;
07817 
07818         if ( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPINTERMISSION) {
07819                 return;         // no view changes at all
07820         }
07821 
07822         if ( ps->pm_type != PM_SPECTATOR && ps->stats[STAT_HEALTH] <= 0 ) {
07823                 return;         // no view changes at all
07824         }
07825 
07826         // circularly clamp the angles with deltas
07827         for (i=0 ; i<3 ; i++) {
07828                 temp = cmd->angles[i] + ps->delta_angles[i];
07829 #ifdef VEH_CONTROL_SCHEME_4
07830                 if ( pm_entVeh 
07831                         && pm_entVeh->m_pVehicle
07832                         && pm_entVeh->m_pVehicle->m_pVehicleInfo
07833                         && pm_entVeh->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER
07834                         && (cmd->serverTime-pm_entVeh->playerState->hyperSpaceTime) >= HYPERSPACE_TIME )
07835                 {//in a vehicle and not hyperspacing
07836                         if ( i == PITCH ) 
07837                         {
07838                                 int pitchClamp = ANGLE2SHORT(AngleNormalize180(pm_entVeh->m_pVehicle->m_vPrevRiderViewAngles[PITCH]+10.0f));
07839                                 // don't let the player look up or down more than 22.5 degrees
07840                                 if ( temp > pitchClamp ) 
07841                                 {
07842                                         ps->delta_angles[i] = pitchClamp - cmd->angles[i];
07843                                         temp = pitchClamp;
07844                                 } 
07845                                 else if ( temp < -pitchClamp ) 
07846                                 {
07847                                         ps->delta_angles[i] = -pitchClamp - cmd->angles[i];
07848                                         temp = -pitchClamp;
07849                                 }
07850                         }
07851                         if ( i == YAW ) 
07852                         {
07853                                 int yawClamp = ANGLE2SHORT(AngleNormalize180(pm_entVeh->m_pVehicle->m_vPrevRiderViewAngles[YAW]+10.0f));
07854                                 // don't let the player look left or right more than 22.5 degrees
07855                                 if ( temp > yawClamp ) 
07856                                 {
07857                                         ps->delta_angles[i] = yawClamp - cmd->angles[i];
07858                                         temp = yawClamp;
07859                                 }
07860                                 else if ( temp < -yawClamp ) 
07861                                 {
07862                                         ps->delta_angles[i] = -yawClamp - cmd->angles[i];
07863                                         temp = -yawClamp;
07864                                 }
07865                         }
07866                 }
07867 #else //VEH_CONTROL_SCHEME_4
07868                 if ( pm_entVeh && BG_UnrestrainedPitchRoll( ps, pm_entVeh->m_pVehicle ) )
07869                 {//in a fighter
07870                         /*
07871                         if ( i == ROLL )
07872                         {//get roll from vehicle
07873                                 ps->viewangles[ROLL] = pm_entVeh->playerState->viewangles[ROLL];//->m_pVehicle->m_vOrientation[ROLL];
07874                                 continue;
07875 
07876                         }
07877                         */
07878                 }
07879 #endif // VEH_CONTROL_SCHEME_4
07880                 else
07881                 {
07882                         if ( i == PITCH ) {
07883                                 // don't let the player look up or down more than 90 degrees
07884                                 if ( temp > 16000 ) {
07885                                         ps->delta_angles[i] = 16000 - cmd->angles[i];
07886                                         temp = 16000;
07887                                 } else if ( temp < -16000 ) {
07888                                         ps->delta_angles[i] = -16000 - cmd->angles[i];
07889                                         temp = -16000;
07890                                 }
07891                         }
07892                 }
07893                 ps->viewangles[i] = SHORT2ANGLE(temp);
07894         }
07895 }

void PM_Use void   ) 
 

Definition at line 4560 of file bg_pmove.c.

References BUTTON_USE, usercmd_s::buttons, pmove_t::cmd, EV_USE, pm, pmove_t::ps, USE_DELAY, pmove_t::useEvent, and playerState_s::useTime.

Referenced by PmoveSingle().

04561 {
04562         if ( pm->ps->useTime > 0 )
04563                 pm->ps->useTime -= 100;//pm->cmd.msec;
04564 
04565         if ( pm->ps->useTime > 0 ) {
04566                 return;
04567         }
04568 
04569         if ( ! (pm->cmd.buttons & BUTTON_USE ) )
04570         {
04571                 pm->useEvent = 0;
04572                 pm->ps->useTime = 0;
04573                 return;
04574         }
04575 
04576         pm->useEvent = EV_USE;
04577         pm->ps->useTime = USE_DELAY;
04578 }

void PM_VehFaceHyperspacePoint bgEntity_t veh  ) 
 

Definition at line 9913 of file bg_pmove.c.

References AngleNormalize180(), AngleNormalize360(), AngleSubtract(), bgEntity_t, pmove_t::cmd, EF2_HYPERSPACE, playerState_s::eFlags2, fabs(), usercmd_s::forwardmove, pml_t::frametime, HYPERSPACE_TELEPORT_FRAC, HYPERSPACE_TIME, playerState_s::hyperSpaceAngles, playerState_s::hyperSpaceTime, bgEntity_s::m_pVehicle, Vehicle_s::m_ucmd, Vehicle_s::m_vOrientation, pml_t::msec, bgEntity_s::playerState, pm, PM_SetPMViewAngle(), pml, pmove_t::ps, usercmd_s::rightmove, usercmd_s::serverTime, usercmd_s::upmove, playerState_s::viewangles, and YAW.

Referenced by PmoveSingle().

09914 {
09915 
09916         if (!veh || !veh->m_pVehicle)
09917         {
09918                 return;
09919         }
09920         else
09921         {
09922                 float timeFrac = ((float)(pm->cmd.serverTime-veh->playerState->hyperSpaceTime))/HYPERSPACE_TIME;
09923                 float   turnRate, aDelta;
09924                 int             i, matchedAxes = 0;
09925 
09926                 pm->cmd.upmove = veh->m_pVehicle->m_ucmd.upmove = 127;
09927                 pm->cmd.forwardmove = veh->m_pVehicle->m_ucmd.forwardmove = 0;
09928                 pm->cmd.rightmove = veh->m_pVehicle->m_ucmd.rightmove = 0;
09929                 
09930                 turnRate = (90.0f*pml.frametime);
09931                 for ( i = 0; i < 3; i++ )
09932                 {
09933                         aDelta = AngleSubtract(veh->playerState->hyperSpaceAngles[i], veh->m_pVehicle->m_vOrientation[i]);
09934                         if ( fabs( aDelta ) < turnRate )
09935                         {//all is good
09936                                 pm->ps->viewangles[i] = veh->playerState->hyperSpaceAngles[i];
09937                                 matchedAxes++;
09938                         }
09939                         else
09940                         {
09941                                 aDelta = AngleSubtract(veh->playerState->hyperSpaceAngles[i], pm->ps->viewangles[i]);
09942                                 if ( fabs( aDelta ) < turnRate )
09943                                 {
09944                                         pm->ps->viewangles[i] = veh->playerState->hyperSpaceAngles[i];
09945                                 }
09946                                 else if ( aDelta > 0 )
09947                                 {
09948                                         if ( i == YAW )
09949                                         {
09950                                                 pm->ps->viewangles[i] = AngleNormalize360( pm->ps->viewangles[i]+turnRate );
09951                                         }
09952                                         else
09953                                         {
09954                                                 pm->ps->viewangles[i] = AngleNormalize180( pm->ps->viewangles[i]+turnRate );
09955                                         }
09956                                 }
09957                                 else
09958                                 {
09959                                         if ( i == YAW )
09960                                         {
09961                                                 pm->ps->viewangles[i] = AngleNormalize360( pm->ps->viewangles[i]-turnRate );
09962                                         }
09963                                         else
09964                                         {
09965                                                 pm->ps->viewangles[i] = AngleNormalize180( pm->ps->viewangles[i]-turnRate );
09966                                         }
09967                                 }
09968                         }
09969                 }
09970 
09971                 PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, &pm->cmd);
09972                 
09973                 if ( timeFrac < HYPERSPACE_TELEPORT_FRAC )
09974                 {//haven't gone through yet
09975                         if ( matchedAxes < 3 )
09976                         {//not facing the right dir yet
09977                                 //keep hyperspace time up to date
09978                                 veh->playerState->hyperSpaceTime += pml.msec;
09979                         }
09980                         else if ( !(veh->playerState->eFlags2&EF2_HYPERSPACE))
09981                         {//flag us as ready to hyperspace!
09982                                 veh->playerState->eFlags2 |= EF2_HYPERSPACE;
09983                         }
09984                 }
09985         }
09986 }

void PM_VehForcedTurning bgEntity_t veh  ) 
 

Definition at line 9780 of file bg_pmove.c.

References AngleNormalize180(), AngleSubtract(), bgEntity_t, pmove_t::cmd, usercmd_s::forwardmove, pml_t::frametime, bgEntity_s::m_pVehicle, Vehicle_s::m_ucmd, Vehicle_s::m_vPrevRiderViewAngles, playerState_s::origin, entityState_s::origin, PITCH, bgEntity_s::playerState, pm, PM_BGEntForNum(), PM_SetPMViewAngle(), pml, pmove_t::ps, usercmd_s::rightmove, bgEntity_s::s, usercmd_s::upmove, vec3_t, vectoangles(), VectorClear, VectorSubtract, playerState_s::vehTurnaroundIndex, playerState_s::viewangles, and YAW.

Referenced by PmoveSingle().

09781 {
09782         bgEntity_t *dst = PM_BGEntForNum(veh->playerState->vehTurnaroundIndex);
09783         float pitchD, yawD;
09784         vec3_t dir;
09785 
09786         if (!veh || !veh->m_pVehicle)
09787         {
09788                 return;
09789         }
09790 
09791         if (!dst)
09792         { //can't find dest ent?
09793                 return;
09794         }
09795 
09796         pm->cmd.upmove = veh->m_pVehicle->m_ucmd.upmove = 127;
09797         pm->cmd.forwardmove = veh->m_pVehicle->m_ucmd.forwardmove = 0;
09798         pm->cmd.rightmove = veh->m_pVehicle->m_ucmd.rightmove = 0;
09799 
09800         VectorSubtract(dst->s.origin, veh->playerState->origin, dir);
09801         vectoangles(dir, dir);
09802 
09803         yawD = AngleSubtract(pm->ps->viewangles[YAW], dir[YAW]);
09804         pitchD = AngleSubtract(pm->ps->viewangles[PITCH], dir[PITCH]);
09805 
09806         yawD *= 0.6f*pml.frametime;
09807         pitchD *= 0.6f*pml.frametime;
09808 
09809 #ifdef VEH_CONTROL_SCHEME_4
09810         veh->playerState->viewangles[YAW] = AngleSubtract(veh->playerState->viewangles[YAW], yawD);
09811         veh->playerState->viewangles[PITCH] = AngleSubtract(veh->playerState->viewangles[PITCH], pitchD);
09812         pm->ps->viewangles[YAW] = veh->playerState->viewangles[YAW];
09813         pm->ps->viewangles[PITCH] = 0;
09814 
09815         PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, &pm->cmd);
09816         PM_SetPMViewAngle(veh->playerState, veh->playerState->viewangles, &pm->cmd);
09817         VectorClear( veh->m_pVehicle->m_vPrevRiderViewAngles );
09818         veh->m_pVehicle->m_vPrevRiderViewAngles[YAW] = AngleNormalize180(pm->ps->viewangles[YAW]);
09819 
09820 #else //VEH_CONTROL_SCHEME_4
09821 
09822         pm->ps->viewangles[YAW] = AngleSubtract(pm->ps->viewangles[YAW], yawD);
09823         pm->ps->viewangles[PITCH] = AngleSubtract(pm->ps->viewangles[PITCH], pitchD);
09824 
09825         PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, &pm->cmd);
09826 #endif //VEH_CONTROL_SCHEME_4
09827 }

void PM_VehicleViewAngles playerState_t ps,
bgEntity_t veh,
usercmd_t ucmd
 

Definition at line 9643 of file bg_pmove.c.

References BG_UnrestrainedPitchRoll(), bgEntity_t, playerState_s::clientNum, playerState_s::generic1, vehicleInfo_t::lookPitch, Vehicle_s::m_pPilot, bgEntity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, MAX_VEHICLE_TURRETS, entityState_s::number, turretStats_t::passengerNum, PITCH, turretStats_t::pitchClampDown, turretStats_t::pitchClampUp, playerState_t, PM_SetPMViewAngle(), qboolean, qtrue, ROLL, bgEntity_s::s, vehicleInfo_t::turret, ucmd, usercmd_t, vec3_t, Vehicle_t, playerState_s::viewangles, YAW, turretStats_t::yawClampLeft, and turretStats_t::yawClampRight.

Referenced by PmoveSingle().

09644 {
09645         Vehicle_t *pVeh = veh->m_pVehicle;
09646         qboolean setAngles = qtrue;
09647         vec3_t clampMin;
09648         vec3_t clampMax;
09649         int i;
09650 
09651         if ( veh->m_pVehicle->m_pPilot 
09652                 && veh->m_pVehicle->m_pPilot->s.number == ps->clientNum )
09653         {//set the pilot's viewangles to the vehicle's viewangles
09654 #ifdef VEH_CONTROL_SCHEME_4
09655                 if ( 1 )
09656 #else //VEH_CONTROL_SCHEME_4
09657                 if ( !BG_UnrestrainedPitchRoll( ps, veh->m_pVehicle ) )
09658 #endif //VEH_CONTROL_SCHEME_4
09659                 {//only if not if doing special free-roll/pitch control
09660                         setAngles = qtrue;
09661                         clampMin[PITCH] = -pVeh->m_pVehicleInfo->lookPitch;
09662                         clampMax[PITCH] = pVeh->m_pVehicleInfo->lookPitch;
09663                         clampMin[YAW] = clampMax[YAW] = 0;
09664                         clampMin[ROLL] = clampMax[ROLL] = -1;
09665                 }
09666         }
09667         else 
09668         {
09669                 //NOTE: passengers can look around freely, UNLESS they're controlling a turret!
09670                 for ( i = 0; i < MAX_VEHICLE_TURRETS; i++ )
09671                 {
09672                         if ( veh->m_pVehicle->m_pVehicleInfo->turret[i].passengerNum == ps->generic1 )
09673                         {//this turret is my station
09674                                 setAngles = qtrue;
09675                                 clampMin[PITCH] = veh->m_pVehicle->m_pVehicleInfo->turret[i].pitchClampUp;
09676                                 clampMax[PITCH] = veh->m_pVehicle->m_pVehicleInfo->turret[i].pitchClampDown;
09677                                 clampMin[YAW] = veh->m_pVehicle->m_pVehicleInfo->turret[i].yawClampRight;
09678                                 clampMax[YAW] = veh->m_pVehicle->m_pVehicleInfo->turret[i].yawClampLeft;
09679                                 clampMin[ROLL] = clampMax[ROLL] = 0;
09680                                 break;
09681                         }
09682                 }
09683         }
09684         if ( setAngles )
09685         {
09686                 for ( i = 0; i < 3; i++ )
09687                 {//clamp viewangles
09688                         if ( clampMin[i] == -1 || clampMax[i] == -1 )
09689                         {//no clamp
09690                         }
09691                         else if ( !clampMin[i] && !clampMax[i] )
09692                         {//no allowance
09693                                 //ps->viewangles[i] = veh->playerState->viewangles[i];
09694                         }
09695                         else
09696                         {//allowance
09697                                 if (ps->viewangles[i] > clampMax[i])
09698                                 {
09699                                         ps->viewangles[i] = clampMax[i];
09700                                 }
09701                                 else if (ps->viewangles[i] < clampMin[i])
09702                                 {
09703                                         ps->viewangles[i] = clampMin[i];
09704                                 }
09705                         }
09706                 }
09707 
09708                 PM_SetPMViewAngle(ps, ps->viewangles, ucmd);
09709         }
09710 }

void PM_VehicleWeaponAnimate void   ) 
 

Definition at line 6382 of file bg_pmove.c.

References BG_SabersOff(), bgEntity_t, BOTH_ATTACK3, BOTH_VS_AIR_G, BOTH_VS_ATF_G, BOTH_VS_ATL_G, BOTH_VS_ATL_S, BOTH_VS_ATR_G, BOTH_VS_ATR_S, BOTH_VS_IDLE, BOTH_VS_IDLE_G, BOTH_VS_IDLE_SL, BOTH_VS_IDLE_SR, BOTH_VS_LAND_G, BOTH_VS_LAND_SL, BOTH_VS_LAND_SR, BOTH_VS_REV, BOTH_VT_ATF_G, BOTH_VT_ATL_G, BOTH_VT_ATL_S, BOTH_VT_ATR_G, BOTH_VT_ATR_S, BOTH_VT_IDLE, BOTH_VT_IDLE_G, BOTH_VT_IDLE_S, BOTH_VT_RUN_FWD, BOTH_VT_TURBO, BOTH_VT_WALK_REV, BUTTON_ALT_ATTACK, BUTTON_ATTACK, usercmd_s::buttons, playerState_s::clientNum, pmove_t::cmd, EV_SABER_ATTACK, LS_R_TL2BR, Vehicle_s::m_pPilot, bgEntity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, Vehicle_s::m_ulFlags, bgEntity_s::playerState, pm, PM_AddEvent(), pm_entVeh, PM_irand_timesync(), PM_SetAnim(), pmove_t::ps, usercmd_s::rightmove, playerState_s::saberMove, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_NORMAL, SETANIM_FLAG_OVERRIDE, SETANIM_FLAG_RESTART, playerState_s::speed, vehicleInfo_t::speedMax, playerState_s::torsoAnim, playerState_s::torsoTimer, vehicleInfo_t::type, VEH_CRASHING, Vehicle_t, VH_ANIMAL, VH_FIGHTER, VH_SPEEDER, VH_WALKER, playerState_s::weapon, WP_BLASTER, and WP_SABER.

Referenced by PmoveSingle().

06383 {
06384         bgEntity_t *veh = pm_entVeh;
06385         Vehicle_t *pVeh;
06386         int iFlags = 0, iBlend = 0, Anim = -1;
06387 
06388         if (!veh ||
06389                 !veh->m_pVehicle ||
06390                 !veh->m_pVehicle->m_pPilot ||
06391                 !veh->m_pVehicle->m_pPilot->playerState ||
06392                 pm->ps->clientNum != veh->m_pVehicle->m_pPilot->playerState->clientNum)
06393         { //make sure the vehicle exists, and its pilot is this player
06394                 return;
06395         }
06396 
06397         pVeh = veh->m_pVehicle;
06398 
06399         if (pVeh->m_pVehicleInfo->type == VH_WALKER ||
06400                 pVeh->m_pVehicleInfo->type == VH_FIGHTER)
06401         { //slightly hacky I guess, but whatever.
06402                 return;
06403         }
06404 backAgain:
06405         // If they're firing, play the right fire animation.
06406         if ( pm->cmd.buttons & ( BUTTON_ATTACK | BUTTON_ALT_ATTACK ) )
06407         {
06408                 iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD;
06409                 iBlend = 200;
06410 
06411                 switch ( pm->ps->weapon )
06412                 {
06413                         case WP_SABER:
06414                                 if ( pm->cmd.buttons & BUTTON_ALT_ATTACK )
06415                                 { //don't do anything.. I guess.
06416                                         pm->cmd.buttons &= ~BUTTON_ALT_ATTACK;
06417                                         goto backAgain;
06418                                 }
06419                                 // If we're already in an attack animation, leave (let it continue).
06420                                 if (pm->ps->torsoTimer <= 0)
06421                                 { //we'll be starting a new attack
06422                                         PM_AddEvent(EV_SABER_ATTACK);
06423                                 }
06424 
06425                                 //just set it to something so we have a proper trail. This is a stupid
06426                                 //hack (much like the rest of this function)
06427                                 pm->ps->saberMove = LS_R_TL2BR;
06428 
06429                                 if ( pm->ps->torsoTimer > 0 && (pm->ps->torsoAnim == BOTH_VS_ATR_S ||
06430                                                 pm->ps->torsoAnim == BOTH_VS_ATL_S) )
06431                                 {
06432                                         /*
06433                                         //FIXME: no need to even call the PM_SetAnim at all in this case
06434                                         Anim = (animNumber_t)pm->ps->torsoAnim;
06435                                         iFlags = SETANIM_FLAG_NORMAL;
06436                                         break;
06437                                         */
06438                                         return;
06439                                 }
06440 
06441                                 // Start the attack.
06442                                 if ( pm->cmd.rightmove > 0 )    //right side attack
06443                                 {
06444                                         Anim = BOTH_VS_ATR_S;
06445                                 }
06446                                 else if ( pm->cmd.rightmove < 0 )       //left-side attack
06447                                 {
06448                                         Anim = BOTH_VS_ATL_S;
06449                                 }
06450                                 else    //random
06451                                 {
06452                                         //FIXME: alternate back and forth or auto-aim?
06453                                         //if ( !Q_irand( 0, 1 ) )
06454                                         if (!PM_irand_timesync(0, 1))
06455                                         {
06456                                                 Anim = BOTH_VS_ATR_S;
06457                                         }
06458                                         else
06459                                         {
06460                                                 Anim = BOTH_VS_ATL_S;
06461                                         }
06462                                 }
06463 
06464                                 if (pm->ps->torsoTimer <= 0)
06465                                 { //restart the anim if we are already in it (and finished)
06466                                         iFlags |= SETANIM_FLAG_RESTART;
06467                                 }
06468                                 break;
06469 
06470                         case WP_BLASTER:
06471                                 // Override the shoot anim.
06472                                 if ( pm->ps->torsoAnim == BOTH_ATTACK3 )
06473                                 {
06474                                         if ( pm->cmd.rightmove > 0 )                    //right side attack
06475                                         {
06476                                                 Anim = BOTH_VS_ATR_G;
06477                                         }
06478                                         else if ( pm->cmd.rightmove < 0 )       //left side
06479                                         {
06480                                                 Anim = BOTH_VS_ATL_G;
06481                                         }
06482                                         else    //frontal
06483                                         {
06484                                                 Anim = BOTH_VS_ATF_G;
06485                                         }
06486                                 }
06487                                 break;
06488 
06489                         default:
06490                                 Anim = BOTH_VS_IDLE;
06491                                 break;
06492                 }
06493         }
06494         else if (veh->playerState && veh->playerState->speed < 0 &&
06495                 pVeh->m_pVehicleInfo->type == VH_ANIMAL)
06496         { //tauntaun is going backwards
06497                 Anim = BOTH_VT_WALK_REV;
06498                 iBlend = 600;
06499         }
06500         else if (veh->playerState && veh->playerState->speed < 0 &&
06501                 pVeh->m_pVehicleInfo->type == VH_SPEEDER)
06502         { //speeder is going backwards
06503                 Anim = BOTH_VS_REV;
06504                 iBlend = 600;
06505         }
06506         // They're not firing so play the Idle for the weapon.
06507         else
06508         {
06509                 iFlags = SETANIM_FLAG_NORMAL;
06510 
06511                 switch ( pm->ps->weapon )
06512                 {
06513                         case WP_SABER:
06514                                 if ( BG_SabersOff( pm->ps ) )
06515                                 { //saber holstered, normal idle
06516                                         Anim = BOTH_VS_IDLE;
06517                                 }
06518                                 // In the Air.
06519                                 //else if ( pVeh->m_ulFlags & VEH_FLYING )
06520                                 else if (0)
06521                                 {
06522                                         iBlend = 800;
06523                                         Anim = BOTH_VS_AIR_G;
06524                                         iFlags = SETANIM_FLAG_OVERRIDE;
06525                                 }
06526                                 // Crashing.
06527                                 //else if ( pVeh->m_ulFlags & VEH_CRASHING )
06528                                 else if (0)
06529                                 {
06530                                         pVeh->m_ulFlags &= ~VEH_CRASHING;       // Remove the flag, we are doing the animation.
06531                                         iBlend = 800;
06532                                         Anim = BOTH_VS_LAND_SR;
06533                                         iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD;
06534                                 }
06535                                 else
06536                                 {
06537                                         Anim = BOTH_VS_IDLE_SR;
06538                                 }
06539                                 break;
06540 
06541                         case WP_BLASTER:
06542                                 // In the Air.
06543                                 //if ( pVeh->m_ulFlags & VEH_FLYING )
06544                                 if (0)
06545                                 {
06546                                         iBlend = 800;
06547                                         Anim = BOTH_VS_AIR_G;
06548                                         iFlags = SETANIM_FLAG_OVERRIDE;
06549                                 }
06550                                 // Crashing.
06551                                 //else if ( pVeh->m_ulFlags & VEH_CRASHING )
06552                                 else if (0)
06553                                 {
06554                                         pVeh->m_ulFlags &= ~VEH_CRASHING;       // Remove the flag, we are doing the animation.
06555                                         iBlend = 800;
06556                                         Anim = BOTH_VS_LAND_G;
06557                                         iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD;
06558                                 }
06559                                 else
06560                                 {
06561                                         Anim = BOTH_VS_IDLE_G;
06562                                 }
06563                                 break;
06564 
06565                         default:
06566                                 Anim = BOTH_VS_IDLE;
06567                                 break;
06568                 }
06569         }
06570 
06571         if (Anim != -1)
06572         { //override it
06573                 if (pVeh->m_pVehicleInfo->type == VH_ANIMAL)
06574                 { //agh.. remap anims for the tauntaun
06575                         switch (Anim)
06576                         {
06577                         case BOTH_VS_IDLE:
06578                                 if (veh->playerState && veh->playerState->speed > 0)
06579                                 {
06580                                         if (veh->playerState->speed > pVeh->m_pVehicleInfo->speedMax)
06581                                         { //turbo
06582                                                 Anim = BOTH_VT_TURBO;
06583                                         }
06584                                         else
06585                                         {
06586                                                 Anim = BOTH_VT_RUN_FWD;
06587                                         }
06588                                 }
06589                                 else
06590                                 {
06591                                         Anim = BOTH_VT_IDLE;
06592                                 }
06593                                 break;
06594                         case BOTH_VS_ATR_S:
06595                                 Anim = BOTH_VT_ATR_S;
06596                                 break;
06597                         case BOTH_VS_ATL_S:
06598                                 Anim = BOTH_VT_ATL_S;
06599                                 break;
06600                         case BOTH_VS_ATR_G:
06601                 Anim = BOTH_VT_ATR_G;
06602                                 break;
06603                         case BOTH_VS_ATL_G:
06604                                 Anim = BOTH_VT_ATL_G;
06605                                 break;
06606                         case BOTH_VS_ATF_G:
06607                                 Anim = BOTH_VT_ATF_G;
06608                                 break;
06609                         case BOTH_VS_IDLE_SL:
06610                                 Anim = BOTH_VT_IDLE_S;
06611                                 break;
06612                         case BOTH_VS_IDLE_SR:
06613                                 Anim = BOTH_VT_IDLE_S;
06614                                 break;
06615                         case BOTH_VS_IDLE_G:
06616                                 Anim = BOTH_VT_IDLE_G;
06617                                 break;
06618 
06619                         //should not happen for tauntaun:
06620                         case BOTH_VS_AIR_G:
06621                         case BOTH_VS_LAND_SL:
06622                         case BOTH_VS_LAND_SR:
06623                         case BOTH_VS_LAND_G:
06624                                 return;
06625                         default:
06626                                 break;
06627                         }
06628                 }
06629 
06630                 PM_SetAnim(SETANIM_BOTH, Anim, iFlags, iBlend);
06631         }
06632 }

float PM_WalkableGroundDistance void   ) 
 

Definition at line 2008 of file bg_saber.c.

References playerState_s::clientNum, trace_t::endpos, MASK_SOLID, pmove_t::maxs, MIN_WALK_NORMAL, pmove_t::mins, cplane_s::normal, playerState_s::origin, trace_t::plane, pm, pmove_t::ps, pmove_t::trace, vec3_t, VectorCopy, and VectorSubtract.

02009 {
02010         trace_t tr;
02011         vec3_t down;
02012 
02013         VectorCopy(pm->ps->origin, down);
02014 
02015         down[2] -= 4096;
02016 
02017         pm->trace(&tr, pm->ps->origin, pm->mins, pm->maxs, down, pm->ps->clientNum, MASK_SOLID);
02018 
02019         if ( tr.plane.normal[2] < MIN_WALK_NORMAL )
02020         {//can't stand on this plane
02021                 return 4096;
02022         }
02023 
02024         VectorSubtract(pm->ps->origin, tr.endpos, down);
02025 
02026         return VectorLength(down);
02027 }

qboolean PM_WalkingAnim int  anim  ) 
 

Definition at line 4580 of file bg_pmove.c.

References BOTH_WALK1, BOTH_WALK2, BOTH_WALK5, BOTH_WALK6, BOTH_WALK7, BOTH_WALK_DUAL, BOTH_WALK_STAFF, BOTH_WALKBACK1, BOTH_WALKBACK2, BOTH_WALKBACK_DUAL, BOTH_WALKBACK_STAFF, qboolean, qfalse, and qtrue.

Referenced by BG_SetAnimFinal(), and PM_WeaponLightsaber().

04581 {
04582         switch ( anim )
04583         {
04584         case BOTH_WALK1:                                //# Normal walk
04585         case BOTH_WALK2:                                //# Normal walk with saber
04586         case BOTH_WALK_STAFF:                   //# Normal walk with staff
04587         case BOTH_WALK_DUAL:                    //# Normal walk with staff
04588         case BOTH_WALK5:                                //# Tavion taunting Kyle (cin 22)
04589         case BOTH_WALK6:                                //# Slow walk for Luke (cin 12)
04590         case BOTH_WALK7:                                //# Fast walk
04591         case BOTH_WALKBACK1:                    //# Walk1 backwards
04592         case BOTH_WALKBACK2:                    //# Walk2 backwards
04593         case BOTH_WALKBACK_STAFF:               //# Walk backwards with staff
04594         case BOTH_WALKBACK_DUAL:                //# Walk backwards with dual
04595                 return qtrue;
04596                 break;
04597         }
04598         return qfalse;
04599 }

qboolean PM_WeaponOkOnVehicle int  weapon  ) 
 

Definition at line 9742 of file bg_pmove.c.

References qboolean, qfalse, qtrue, WP_BLASTER, WP_MELEE, and WP_SABER.

Referenced by PM_GetOkWeaponForVehicle(), and PmoveSingle().

09743 {
09744         //FIXME: check g_vehicleInfo for our vehicle?
09745         switch ( weapon )
09746         {
09747         //case WP_NONE:
09748         case WP_MELEE:
09749         case WP_SABER:
09750         case WP_BLASTER:
09751         //case WP_THERMAL:
09752                 return qtrue;
09753                 break;
09754         }
09755         return qfalse;
09756 }

void Pmove pmove_t pmove  ) 
 

Definition at line 11164 of file bg_pmove.c.

References usercmd_s::buttons, pmove_t::cmd, playerState_s::commandTime, playerState_s::fallingToDeath, usercmd_s::forwardmove, playerState_s::pm_flags, PMF_JUMP_HELD, pmove_t::pmove_fixed, playerState_s::pmove_framecount, pmove_t::pmove_msec, PmoveSingle(), pmove_t::ps, PS_PMOVEFRAMECOUNTBITS, usercmd_s::rightmove, usercmd_s::serverTime, and usercmd_s::upmove.

Referenced by CG_PredictPlayerState(), ClientThink_real(), and SpectatorThink().

11164                             {
11165         int                     finalTime;
11166 
11167         finalTime = pmove->cmd.serverTime;
11168 
11169         if ( finalTime < pmove->ps->commandTime ) {
11170                 return; // should not happen
11171         }
11172 
11173         if ( finalTime > pmove->ps->commandTime + 1000 ) {
11174                 pmove->ps->commandTime = finalTime - 1000;
11175         }
11176 
11177         if (pmove->ps->fallingToDeath)
11178         {
11179                 pmove->cmd.forwardmove = 0;
11180                 pmove->cmd.rightmove = 0;
11181                 pmove->cmd.upmove = 0;
11182                 pmove->cmd.buttons = 0;
11183         }
11184 
11185         pmove->ps->pmove_framecount = (pmove->ps->pmove_framecount+1) & ((1<<PS_PMOVEFRAMECOUNTBITS)-1);
11186 
11187         // chop the move up if it is too long, to prevent framerate
11188         // dependent behavior
11189         while ( pmove->ps->commandTime != finalTime ) {
11190                 int             msec;
11191 
11192                 msec = finalTime - pmove->ps->commandTime;
11193 
11194                 if ( pmove->pmove_fixed ) {
11195                         if ( msec > pmove->pmove_msec ) {
11196                                 msec = pmove->pmove_msec;
11197                         }
11198                 }
11199                 else {
11200                         if ( msec > 66 ) {
11201                                 msec = 66;
11202                         }
11203                 }
11204                 pmove->cmd.serverTime = pmove->ps->commandTime + msec;
11205                 
11206                 PmoveSingle( pmove );
11207                 
11208                 if ( pmove->ps->pm_flags & PMF_JUMP_HELD ) {
11209                         pmove->cmd.upmove = 20;
11210                 }
11211         }
11212 }

void PmoveSingle pmove_t pmove  ) 
 

Definition at line 10171 of file bg_pmove.c.

References abs(), AngleVectors(), vehicleInfo_t::Animate, vehicleInfo_t::AttachRiders, BG_AdjustClientSpeed(), BG_CmdForRoll(), BG_FighterUpdate(), BG_FullBodyTauntAnim(), BG_GetItemIndexByTag(), BG_InGrappleMove(), BG_InKataAnim(), BG_InRoll(), BG_KickingAnim(), BG_KickMove(), BG_SaberInKata(), BG_SaberLockBreakAnim(), BG_SpinningSaberAnim(), BG_VehicleAdjustBBoxForOrientation(), bgEntity_t, vehicleInfo_t::Board, BOTH_A2_STABBACK1, BOTH_ATTACK_BACK, BOTH_CROUCHATTACKBACK1, BOTH_FORCELAND1, BOTH_FORCELANDBACK1, BOTH_FORCELANDLEFT1, BOTH_FORCELANDRIGHT1, BOTH_FORCELEAP2_T__B_, BOTH_FORCEWALLRUNFLIP_ALT, BOTH_INAIR1, BOTH_INAIRBACK1, BOTH_INAIRLEFT1, BOTH_INAIRRIGHT1, BOTH_JUMPFLIPSLASHDOWN1, BOTH_JUMPFLIPSTABDOWN, BOTH_MEDITATE, BOTH_MEDITATE_END, BOTH_ROLL_STAB, BUTTON_ALT_ATTACK, BUTTON_ATTACK, BUTTON_FORCE_DRAIN, BUTTON_FORCE_LIGHTNING, BUTTON_FORCEGRIP, BUTTON_FORCEPOWER, BUTTON_TALK, BUTTON_USE_HOLDABLE, BUTTON_WALKING, usercmd_s::buttons, c_pmove, CG_TestLine(), CLASS_RANCOR, CLASS_VEHICLE, gentity_s::client, playerState_s::clientNum, clientPersistant_t::cmd, pmove_t::cmd, playerState_s::commandTime, CONTENTS_BODY, EF_ALT_FIRING, EF_DISINTEGRATION, EF_FIRING, EF_JETPACK_FLAMING, EF_NODRAW, EF_TALK, playerState_s::eFlags, playerState_s::emplacedIndex, ENTITYNUM_NONE, ENTITYNUM_WORLD, ET_NPC, entityState_s::eType, EV_WEAPON_CHARGE, playerState_s::fd, FLY_HOVER, FLY_NORMAL, FLY_VEHICLE, forcedata_s::forceGripCripple, playerState_s::forceHandExtend, playerState_s::forceHandExtendTime, forcedata_s::forceJumpZStart, forcedata_s::forcePowerSelected, forcedata_s::forcePowersKnown, usercmd_s::forcesel, pml_t::forward, usercmd_s::forwardmove, pml_t::frametime, gentity_t, bgEntity_s::ghoul2, gPMDoSlowFall, playerState_s::gravity, playerState_s::groundEntityNum, HANDEXTEND_TAUNT, playerState_s::heldByClient, HYPERSPACE_TIME, playerState_s::hyperSpaceTime, gentity_s::inuse, usercmd_s::invensel, IT_HOLDABLE, JETPACK_HOVER_HEIGHT, playerState_s::legsAnim, playerState_s::legsTimer, LS_A_BACK, LS_A_BACK_CR, LS_A_BACKSTAB, LS_A_FLIP_SLASH, LS_A_FLIP_STAB, LS_A_JUMP_T__B_, LS_A_LUNGE, LS_DUAL_FB, LS_DUAL_LR, LS_PULL_ATTACK_STAB, LS_PULL_ATTACK_SWING, LS_STABDOWN, LS_STABDOWN_DUAL, LS_STABDOWN_STAFF, Vehicle_s::m_fTimeModifier, Vehicle_s::m_iBoarding, Vehicle_s::m_iNumPassengers, playerState_s::m_iVehicleNum, Vehicle_s::m_pPilot, Vehicle_s::m_ppPassengers, bgEntity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, Vehicle_s::m_ucmd, Vehicle_s::m_ulFlags, Vehicle_s::m_vOrientation, Vehicle_s::m_vPrevOrientation, MAX_CLIENTS, pmove_t::maxs, memset(), pmove_t::mins, playerState_s::moveDir, pml_t::msec, pmove_t::noSpecMove, entityState_s::NPC_class, NULL, entityState_s::number, pmove_t::numtouch, playerState_s::origin, gclient_s::pers, PITCH, bgEntity_s::playerState, pm, PM_AddEventWithParm(), PM_AdjustAngleForWallJump(), PM_AdjustAngleForWallRun(), PM_AdjustAngleForWallRunUp(), PM_AdjustAnglesForWallRunUpFlipAlt(), PM_AdjustAttackStates(), PM_BGEntForNum(), pm_cancelOutZoom, PM_ContinueLegsAnim(), PM_DEAD, PM_DoSlowFall(), pm_entSelf, pm_entVeh, playerState_s::pm_flags, PM_FLOAT, PM_FREEZE, PM_GetOkWeaponForVehicle(), PM_GroundDistance(), PM_HoverTrace(), PM_INTERMISSION, PM_IsRocketTrooper(), PM_JETPACK, PM_MoveForKata(), PM_NOCLIP, PM_SetAnim(), PM_SetPMViewAngle(), PM_SetSpecialMoveValues(), PM_SPECTATOR, PM_SPINTERMISSION, playerState_s::pm_type, PM_UpdateViewAngles(), PM_Use(), PM_VehFaceHyperspacePoint(), PM_VehForcedTurning(), PM_VehicleViewAngles(), PM_VehicleWeaponAnimate(), PM_WeaponOkOnVehicle(), PMF_BACKWARDS_RUN, PMF_JUMP_HELD, PMF_RESPAWNED, PMF_STUCK_TO_WALL, PMF_TIME_WATERJUMP, pml, pml_t::previous_origin, pml_t::previous_velocity, pml_t::previous_waterlevel, vehicleInfo_t::ProcessMoveCommands, vehicleInfo_t::ProcessOrientCommands, gclient_s::ps, pmove_t::ps, Q_irand(), qboolean, qfalse, qtrue, pml_t::right, usercmd_s::rightmove, ROLL, bgEntity_s::s, playerState_s::saberHolstered, playerState_s::saberLockTime, playerState_s::saberMove, usercmd_s::serverTime, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, gentity_s::spawnflags, playerState_s::speed, STAT_HEALTH, STAT_HOLDABLE_ITEM, STAT_HOLDABLE_ITEMS, playerState_s::stats, playerState_s::torsoAnim, playerState_s::torsoTimer, pmove_t::trace, pmove_t::tracemask, trap_SnapVector(), vehicleInfo_t::type, pml_t::up, vehicleInfo_t::Update, vehicleInfo_t::UpdateRider, usercmd_s::upmove, vec3_t, VectorCopy, VectorMA, VectorScale, VectorSet, VEH_CRASHING, playerState_s::vehBoarding, playerState_s::vehTurnaroundIndex, playerState_s::vehTurnaroundTime, playerState_s::velocity, VH_ANIMAL, VH_FIGHTER, VH_WALKER, playerState_s::viewangles, pml_t::walking, pmove_t::waterlevel, pmove_t::watertype, usercmd_s::weapon, playerState_s::weapon, WEAPON_CHARGING_ALT, WEAPON_READY, playerState_s::weaponstate, playerState_s::weaponTime, WP_DISRUPTOR, WP_SABER, YAW, playerState_s::zoomLocked, and playerState_s::zoomMode.

Referenced by Pmove().

10171                                   {
10172         qboolean stiffenedUp = qfalse;
10173         float gDist = 0;
10174         qboolean noAnimate = qfalse;
10175         int savedGravity = 0;
10176 
10177         pm = pmove;
10178 
10179         if (pm->ps->emplacedIndex)
10180         {
10181                 if (pm->cmd.buttons & BUTTON_ALT_ATTACK)
10182                 { //hackerrific.
10183                         pm->cmd.buttons &= ~BUTTON_ALT_ATTACK;
10184                         pm->cmd.buttons |= BUTTON_ATTACK;
10185                 }
10186         }
10187 
10188         //set up these "global" bg ents
10189         pm_entSelf = PM_BGEntForNum(pm->ps->clientNum);
10190         if (pm->ps->m_iVehicleNum)
10191         {
10192                 if (pm->ps->clientNum < MAX_CLIENTS)
10193                 { //player riding vehicle
10194                         pm_entVeh = PM_BGEntForNum(pm->ps->m_iVehicleNum);
10195                 }
10196                 else
10197                 { //vehicle with player pilot
10198                         pm_entVeh = PM_BGEntForNum(pm->ps->m_iVehicleNum-1);
10199                 }
10200         }
10201         else
10202         { //no vehicle ent
10203                 pm_entVeh = NULL;
10204         }
10205 
10206         gPMDoSlowFall = PM_DoSlowFall();
10207 
10208         // this counter lets us debug movement problems with a journal
10209         // by setting a conditional breakpoint fot the previous frame
10210         c_pmove++;
10211 
10212         // clear results
10213         pm->numtouch = 0;
10214         pm->watertype = 0;
10215         pm->waterlevel = 0;
10216 
10217         if (PM_IsRocketTrooper())
10218         { //kind of nasty, don't let them crouch or anything if nonhumanoid (probably a rockettrooper)
10219                 if (pm->cmd.upmove < 0)
10220                 {
10221                         pm->cmd.upmove = 0;
10222                 }
10223         }
10224 
10225         if (pm->ps->pm_type == PM_FLOAT)
10226         { //You get no control over where you go in grip movement
10227                 stiffenedUp = qtrue;
10228         }
10229         else if (pm->ps->eFlags & EF_DISINTEGRATION)
10230         {
10231                 stiffenedUp = qtrue;
10232         }
10233         else if ( BG_SaberLockBreakAnim( pm->ps->legsAnim )
10234                 || BG_SaberLockBreakAnim( pm->ps->torsoAnim ) 
10235                 || pm->ps->saberLockTime >= pm->cmd.serverTime )
10236         {//can't move or turn
10237                 stiffenedUp = qtrue;
10238                 PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, &pm->cmd);
10239         }
10240         else if ( pm->ps->saberMove == LS_A_BACK || pm->ps->saberMove == LS_A_BACK_CR ||
10241                 pm->ps->saberMove == LS_A_BACKSTAB || pm->ps->saberMove == LS_A_FLIP_STAB ||
10242                 pm->ps->saberMove == LS_A_FLIP_SLASH || pm->ps->saberMove == LS_A_JUMP_T__B_ ||
10243                 pm->ps->saberMove == LS_DUAL_LR || pm->ps->saberMove == LS_DUAL_FB)
10244         {
10245                 if (pm->ps->legsAnim == BOTH_JUMPFLIPSTABDOWN ||
10246                         pm->ps->legsAnim == BOTH_JUMPFLIPSLASHDOWN1)
10247                 { //flipover medium stance attack
10248                         if (pm->ps->legsTimer < 1600 && pm->ps->legsTimer > 900)
10249                         {
10250                                 pm->ps->viewangles[YAW] += pml.frametime*240.0f;
10251                                 PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, &pm->cmd);
10252                         }
10253                 }
10254                 stiffenedUp = qtrue;
10255         }
10256         else if ((pm->ps->legsAnim) == (BOTH_A2_STABBACK1) ||
10257                 (pm->ps->legsAnim) == (BOTH_ATTACK_BACK) ||
10258                 (pm->ps->legsAnim) == (BOTH_CROUCHATTACKBACK1) ||
10259                 (pm->ps->legsAnim) == (BOTH_FORCELEAP2_T__B_) ||
10260                 (pm->ps->legsAnim) == (BOTH_JUMPFLIPSTABDOWN) ||
10261                 (pm->ps->legsAnim) == (BOTH_JUMPFLIPSLASHDOWN1))
10262         {
10263                 stiffenedUp = qtrue;
10264         }
10265         else if (pm->ps->legsAnim == BOTH_ROLL_STAB)
10266         {
10267                 stiffenedUp = qtrue;
10268                 PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, &pm->cmd);
10269         }
10270         else if (pm->ps->heldByClient)
10271         {
10272                 stiffenedUp = qtrue;
10273         }
10274         else if (BG_KickMove(pm->ps->saberMove) || BG_KickingAnim(pm->ps->legsAnim))
10275         {
10276                 stiffenedUp = qtrue;
10277         }
10278         else if (BG_InGrappleMove(pm->ps->torsoAnim))
10279         {
10280                 stiffenedUp = qtrue;
10281                 PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, &pm->cmd);
10282         }
10283         else if ( pm->ps->saberMove == LS_STABDOWN_DUAL ||
10284                         pm->ps->saberMove == LS_STABDOWN_STAFF ||
10285                         pm->ps->saberMove == LS_STABDOWN)
10286         {//FIXME: need to only move forward until we bump into our target...?
10287                 if (pm->ps->legsTimer < 800)
10288                 { //freeze movement near end of anim
10289                         stiffenedUp = qtrue;
10290                         PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, &pm->cmd);
10291                 }
10292                 else
10293                 { //force forward til then
10294             pm->cmd.rightmove = 0;
10295                         pm->cmd.upmove = 0;
10296                         pm->cmd.forwardmove = 64;
10297                 }
10298         }
10299         else if (pm->ps->saberMove == LS_PULL_ATTACK_STAB ||
10300                 pm->ps->saberMove == LS_PULL_ATTACK_SWING)
10301         {
10302                 stiffenedUp = qtrue;
10303         }
10304         else if (BG_SaberInKata(pm->ps->saberMove) ||
10305                          BG_InKataAnim(pm->ps->torsoAnim) ||
10306                          BG_InKataAnim(pm->ps->legsAnim))
10307         {
10308                 PM_MoveForKata(&pm->cmd);
10309         }
10310         else if ( BG_FullBodyTauntAnim( pm->ps->legsAnim )
10311                 && BG_FullBodyTauntAnim( pm->ps->torsoAnim ) )
10312         {
10313                 if ( (pm->cmd.buttons&BUTTON_ATTACK)
10314                         || (pm->cmd.buttons&BUTTON_ALT_ATTACK)
10315                         || (pm->cmd.buttons&BUTTON_FORCEPOWER)
10316                         || (pm->cmd.buttons&BUTTON_FORCEGRIP)
10317                         || (pm->cmd.buttons&BUTTON_FORCE_LIGHTNING)
10318                         || (pm->cmd.buttons&BUTTON_FORCE_DRAIN)
10319                         || pm->cmd.upmove )
10320                 {//stop the anim
10321                         if ( pm->ps->legsAnim == BOTH_MEDITATE
10322                                 && pm->ps->torsoAnim == BOTH_MEDITATE )
10323                         {
10324                                 PM_SetAnim( SETANIM_BOTH, BOTH_MEDITATE_END, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD, 0 );
10325                         }
10326                         else
10327                         {
10328                                 pm->ps->legsTimer = pm->ps->torsoTimer = 0;
10329                         }
10330                         if ( pm->ps->forceHandExtend == HANDEXTEND_TAUNT )
10331                         {
10332                                 pm->ps->forceHandExtend = 0;
10333                         }
10334                 }
10335                 else 
10336                 {
10337                         if ( pm->ps->legsAnim == BOTH_MEDITATE )
10338                         {
10339                                 if ( pm->ps->legsTimer < 100 )
10340                                 {
10341                                         pm->ps->legsTimer = 100;
10342                                 }
10343                         }
10344                         if ( pm->ps->torsoAnim == BOTH_MEDITATE )
10345                         {
10346                                 if ( pm->ps->torsoTimer < 100 )
10347                                 {
10348                                         pm->ps->legsTimer = 100;
10349                                 }
10350                                 pm->ps->forceHandExtend = HANDEXTEND_TAUNT;
10351                                 pm->ps->forceHandExtendTime = pm->cmd.serverTime + 100;
10352                         }
10353                         if ( pm->ps->legsTimer > 0 || pm->ps->torsoTimer > 0 )
10354                         {
10355                                 stiffenedUp = qtrue;
10356                                 PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, &pm->cmd);
10357                                 pm->cmd.rightmove = 0;
10358                                 pm->cmd.upmove = 0;
10359                                 pm->cmd.forwardmove = 0;
10360                                 pm->cmd.buttons = 0;
10361                         }
10362                 }
10363         }
10364         else if ( pm->ps->legsAnim == BOTH_MEDITATE_END 
10365                 && pm->ps->legsTimer > 0 )
10366         {
10367                 stiffenedUp = qtrue;
10368                 PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, &pm->cmd);
10369         pm->cmd.rightmove = 0;
10370                 pm->cmd.upmove = 0;
10371                 pm->cmd.forwardmove = 0;
10372                 pm->cmd.buttons = 0;
10373         }
10374         else if (pm->ps->legsAnim == BOTH_FORCELAND1 ||
10375                 pm->ps->legsAnim == BOTH_FORCELANDBACK1 ||
10376                 pm->ps->legsAnim == BOTH_FORCELANDRIGHT1 ||
10377                 pm->ps->legsAnim == BOTH_FORCELANDLEFT1) 
10378         { //can't move while in a force land
10379                 stiffenedUp = qtrue;
10380         }
10381 
10382         if ( pm->ps->saberMove == LS_A_LUNGE )
10383         {//can't move during lunge
10384                 pm->cmd.rightmove = pm->cmd.upmove = 0;
10385                 if ( pm->ps->legsTimer > 500 )
10386                 {
10387                         pm->cmd.forwardmove = 127;
10388                 }
10389                 else
10390                 {
10391                         pm->cmd.forwardmove = 0;
10392                 }
10393         }
10394 
10395         if ( pm->ps->saberMove == LS_A_JUMP_T__B_ )
10396         {//can't move during leap
10397                 if ( pm->ps->groundEntityNum != ENTITYNUM_NONE )
10398                 {//hit the ground
10399                         pm->cmd.forwardmove = 0;
10400                 }
10401                 pm->cmd.rightmove = pm->cmd.upmove = 0;
10402         }
10403 
10404 #if 0
10405         if ((pm->ps->legsAnim) == BOTH_KISSER1LOOP ||
10406                 (pm->ps->legsAnim) == BOTH_KISSEE1LOOP)
10407         {
10408                 stiffenedUp = qtrue;
10409         }
10410 #endif
10411 
10412         if (pm->ps->emplacedIndex)
10413         {
10414                 if (pm->cmd.forwardmove < 0 || PM_GroundDistance() > 32.0f)
10415                 {
10416                         pm->ps->emplacedIndex = 0;
10417                         pm->ps->saberHolstered = 0;
10418                 }
10419                 else
10420                 {
10421                         stiffenedUp = qtrue;
10422                 }
10423         }
10424 
10425         /*
10426         if (pm->ps->weapon == WP_DISRUPTOR && pm->ps->weaponstate == WEAPON_CHARGING_ALT)
10427         { //not allowed to move while charging the disruptor
10428                 pm->cmd.forwardmove = 0;
10429                 pm->cmd.rightmove = 0;
10430                 if (pm->cmd.upmove > 0)
10431                 {
10432                         pm->cmd.upmove = 0;
10433                 }
10434         }
10435         */
10436 
10437         if (pm->ps->weapon == WP_DISRUPTOR && pm->ps->weaponstate == WEAPON_CHARGING_ALT)
10438         { //not allowed to move while charging the disruptor
10439                 if (pm->cmd.forwardmove ||
10440                         pm->cmd.rightmove ||
10441                         pm->cmd.upmove > 0)
10442                 { //get out
10443                         pm->ps->weaponstate = WEAPON_READY;
10444                         pm->ps->weaponTime = 1000;
10445                         PM_AddEventWithParm(EV_WEAPON_CHARGE, WP_DISRUPTOR); //cut the weapon charge sound
10446                         pm->cmd.upmove = 0;
10447                 }
10448         }
10449         else if (pm->ps->weapon == WP_DISRUPTOR && pm->ps->zoomMode == 1)
10450         { //can't jump
10451                 if (pm->cmd.upmove > 0)
10452                 {
10453                         pm->cmd.upmove = 0;
10454                 }
10455         }
10456 
10457         if (stiffenedUp)
10458         {
10459                 pm->cmd.forwardmove = 0;
10460                 pm->cmd.rightmove = 0;
10461                 pm->cmd.upmove = 0;
10462         }
10463 
10464         if (pm->ps->fd.forceGripCripple)
10465         { //don't let attack or alt attack if being gripped I guess
10466                 pm->cmd.buttons &= ~BUTTON_ATTACK;
10467                 pm->cmd.buttons &= ~BUTTON_ALT_ATTACK;
10468         }
10469 
10470         if ( BG_InRoll( pm->ps, pm->ps->legsAnim ) )
10471         { //can't roll unless you're able to move normally
10472                 BG_CmdForRoll( pm->ps, pm->ps->legsAnim, &pm->cmd );
10473         }
10474 
10475         PM_CmdForSaberMoves(&pm->cmd);
10476 
10477         BG_AdjustClientSpeed(pm->ps, &pm->cmd, pm->cmd.serverTime);
10478 
10479         if ( pm->ps->stats[STAT_HEALTH] <= 0 ) {
10480                 pm->tracemask &= ~CONTENTS_BODY;        // corpses can fly through bodies
10481         }
10482 
10483         // make sure walking button is clear if they are running, to avoid
10484         // proxy no-footsteps cheats
10485         if ( abs( pm->cmd.forwardmove ) > 64 || abs( pm->cmd.rightmove ) > 64 ) {
10486                 pm->cmd.buttons &= ~BUTTON_WALKING;
10487         }
10488 
10489         // set the talk balloon flag
10490         if ( pm->cmd.buttons & BUTTON_TALK ) {
10491                 pm->ps->eFlags |= EF_TALK;
10492         } else {
10493                 pm->ps->eFlags &= ~EF_TALK;
10494         }
10495 
10496         pm_cancelOutZoom = qfalse;
10497         if (pm->ps->weapon == WP_DISRUPTOR &&
10498                 pm->ps->zoomMode == 1)
10499         {
10500                 if ((pm->cmd.buttons & BUTTON_ALT_ATTACK) &&
10501                         !(pm->cmd.buttons & BUTTON_ATTACK) &&
10502                         pm->ps->zoomLocked)
10503                 {
10504                         pm_cancelOutZoom = qtrue;
10505                 }
10506         }
10507         // In certain situations, we may want to control which attack buttons are pressed and what kind of functionality
10508         //      is attached to them
10509         PM_AdjustAttackStates( pm );
10510 
10511         // clear the respawned flag if attack and use are cleared
10512         if ( pm->ps->stats[STAT_HEALTH] > 0 && 
10513                 !( pm->cmd.buttons & (BUTTON_ATTACK | BUTTON_USE_HOLDABLE) ) ) {
10514                 pm->ps->pm_flags &= ~PMF_RESPAWNED;
10515         }
10516 
10517         // if talk button is down, dissallow all other input
10518         // this is to prevent any possible intercept proxy from
10519         // adding fake talk balloons
10520         if ( pmove->cmd.buttons & BUTTON_TALK ) {
10521                 // keep the talk button set tho for when the cmd.serverTime > 66 msec
10522                 // and the same cmd is used multiple times in Pmove
10523                 pmove->cmd.buttons = BUTTON_TALK;
10524                 pmove->cmd.forwardmove = 0;
10525                 pmove->cmd.rightmove = 0;
10526                 pmove->cmd.upmove = 0;
10527         }
10528 
10529         // clear all pmove local vars
10530         memset (&pml, 0, sizeof(pml));
10531 
10532         // determine the time
10533         pml.msec = pmove->cmd.serverTime - pm->ps->commandTime;
10534         if ( pml.msec < 1 ) {
10535                 pml.msec = 1;
10536         } else if ( pml.msec > 200 ) {
10537                 pml.msec = 200;
10538         }
10539 
10540         /*
10541         if (pm->ps->clientNum >= MAX_CLIENTS)
10542         {
10543 #ifdef QAGAME
10544                 Com_Printf( "^1 SERVER N%i msec %d\n", pm->ps->clientNum, pml.msec );
10545 #else
10546                 Com_Printf( "^2 CLIENT N%i msec %d\n", pm->ps->clientNum, pml.msec );
10547 #endif
10548         }
10549         */
10550 
10551         pm->ps->commandTime = pmove->cmd.serverTime;
10552 
10553         // save old org in case we get stuck
10554         VectorCopy (pm->ps->origin, pml.previous_origin);
10555 
10556         // save old velocity for crashlanding
10557         VectorCopy (pm->ps->velocity, pml.previous_velocity);
10558 
10559         pml.frametime = pml.msec * 0.001;
10560 
10561         if (pm->ps->clientNum >= MAX_CLIENTS &&
10562                 pm_entSelf &&
10563                 pm_entSelf->s.NPC_class == CLASS_VEHICLE)
10564         { //we are a vehicle
10565                 bgEntity_t *veh = pm_entSelf;
10566                 assert( veh && veh->m_pVehicle);
10567                 if ( veh && veh->m_pVehicle )
10568                 {
10569                         veh->m_pVehicle->m_fTimeModifier = pml.frametime*60.0f;
10570                 }
10571         }
10572         else if (pm_entSelf->s.NPC_class!=CLASS_VEHICLE
10573                 &&pm->ps->m_iVehicleNum)
10574         {
10575                 bgEntity_t *veh = pm_entVeh;
10576 
10577                 if (veh && veh->playerState &&
10578                         (pm->cmd.serverTime-veh->playerState->hyperSpaceTime) < HYPERSPACE_TIME)
10579                 { //going into hyperspace, turn to face the right angles
10580             PM_VehFaceHyperspacePoint(veh);
10581                 }
10582                 else if (veh && veh->playerState &&
10583                         veh->playerState->vehTurnaroundIndex &&
10584                         veh->playerState->vehTurnaroundTime > pm->cmd.serverTime)
10585                 { //riding this vehicle, turn my view too
10586             PM_VehForcedTurning(veh);
10587                 }
10588         }
10589 
10590         if ( pm->ps->legsAnim == BOTH_FORCEWALLRUNFLIP_ALT &&
10591                 pm->ps->legsTimer > 0 )
10592         {
10593                 vec3_t vFwd, fwdAng;
10594                 VectorSet(fwdAng, 0.0f, pm->ps->viewangles[YAW], 0.0f);
10595 
10596                 AngleVectors( fwdAng, vFwd, NULL, NULL );
10597                 if ( pm->ps->groundEntityNum == ENTITYNUM_NONE )
10598                 {
10599                         float savZ = pm->ps->velocity[2];
10600                         VectorScale( vFwd, 100, pm->ps->velocity );
10601                         pm->ps->velocity[2] = savZ;
10602                 }
10603                 pm->cmd.forwardmove = pm->cmd.rightmove = pm->cmd.upmove = 0;
10604                 PM_AdjustAnglesForWallRunUpFlipAlt( &pm->cmd );
10605         }
10606 
10607 //      PM_AdjustAngleForWallRun(pm->ps, &pm->cmd, qtrue);
10608 //      PM_AdjustAnglesForStabDown( pm->ps, &pm->cmd );
10609         PM_AdjustAngleForWallJump( pm->ps, &pm->cmd, qtrue );
10610         PM_AdjustAngleForWallRunUp( pm->ps, &pm->cmd, qtrue );
10611         PM_AdjustAngleForWallRun( pm->ps, &pm->cmd, qtrue );
10612 
10613         if (pm->ps->saberMove == LS_A_JUMP_T__B_ || pm->ps->saberMove == LS_A_LUNGE ||
10614                 pm->ps->saberMove == LS_A_BACK_CR || pm->ps->saberMove == LS_A_BACK ||
10615                 pm->ps->saberMove == LS_A_BACKSTAB)
10616         {
10617                 PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, &pm->cmd);
10618         }
10619 
10620 #if 0
10621         if ((pm->ps->legsAnim) == BOTH_KISSER1LOOP ||
10622                 (pm->ps->legsAnim) == BOTH_KISSEE1LOOP)
10623         {
10624                 pm->ps->viewangles[PITCH] = 0;
10625                 PM_SetPMViewAngle(pm->ps, pm->ps->viewangles, &pm->cmd);
10626         }
10627 #endif
10628 
10629         PM_SetSpecialMoveValues();
10630 
10631         // update the viewangles
10632         PM_UpdateViewAngles( pm->ps, &pm->cmd );
10633 
10634         AngleVectors (pm->ps->viewangles, pml.forward, pml.right, pml.up);
10635 
10636         if ( pm->cmd.upmove < 10 && !(pm->ps->pm_flags & PMF_STUCK_TO_WALL)) {
10637                 // not holding jump
10638                 pm->ps->pm_flags &= ~PMF_JUMP_HELD;
10639         }
10640 
10641         // decide if backpedaling animations should be used
10642         if ( pm->cmd.forwardmove < 0 ) {
10643                 pm->ps->pm_flags |= PMF_BACKWARDS_RUN;
10644         } else if ( pm->cmd.forwardmove > 0 || ( pm->cmd.forwardmove == 0 && pm->cmd.rightmove ) ) {
10645                 pm->ps->pm_flags &= ~PMF_BACKWARDS_RUN;
10646         }
10647 
10648         if ( pm->ps->pm_type >= PM_DEAD ) {
10649                 pm->cmd.forwardmove = 0;
10650                 pm->cmd.rightmove = 0;
10651                 pm->cmd.upmove = 0;
10652         }
10653 
10654         /*
10655         if (pm->ps->fd.saberAnimLevel == SS_STAFF &&
10656                 (pm->cmd.buttons & BUTTON_ALT_ATTACK) &&
10657                 pm->cmd.upmove > 0)
10658         { //this is how you do kick-for-condition
10659                 pm->cmd.upmove = 0;
10660                 pm->ps->pm_flags |= PMF_JUMP_HELD;
10661         }
10662         */
10663 
10664         if (pm->ps->saberLockTime >= pm->cmd.serverTime)
10665         {
10666                 pm->cmd.upmove = 0;
10667                 pm->cmd.forwardmove = 0;//50;
10668                 pm->cmd.rightmove = 0;//*= 0.1;
10669         }
10670 
10671         if ( pm->ps->pm_type == PM_SPECTATOR ) {
10672                 PM_CheckDuck ();
10673                 if (!pm->noSpecMove)
10674                 {
10675                         PM_FlyMove ();
10676                 }
10677                 PM_DropTimers ();
10678                 return;
10679         }
10680 
10681         if ( pm->ps->pm_type == PM_NOCLIP ) {
10682                 if (pm->ps->clientNum < MAX_CLIENTS)
10683                 {
10684                         PM_NoclipMove ();
10685                         PM_DropTimers ();
10686                         return;
10687                 }
10688         }
10689 
10690         if (pm->ps->pm_type == PM_FREEZE) {
10691                 return;         // no movement at all
10692         }
10693 
10694         if ( pm->ps->pm_type == PM_INTERMISSION || pm->ps->pm_type == PM_SPINTERMISSION) {
10695                 return;         // no movement at all
10696         }
10697 
10698         // set watertype, and waterlevel
10699         PM_SetWaterLevel();
10700         pml.previous_waterlevel = pmove->waterlevel;
10701 
10702         // set mins, maxs, and viewheight
10703         PM_CheckDuck ();
10704 
10705         if (pm->ps->pm_type == PM_JETPACK)
10706         {
10707                 gDist = PM_GroundDistance();
10708                 savedGravity = pm->ps->gravity;
10709 
10710                 if (gDist < JETPACK_HOVER_HEIGHT+64)
10711                 {
10712                         pm->ps->gravity *= 0.1f;
10713                 }
10714                 else
10715                 {
10716                         pm->ps->gravity *= 0.25f;
10717                 }
10718         }
10719         else if (gPMDoSlowFall)
10720         {
10721                 savedGravity = pm->ps->gravity;
10722                 pm->ps->gravity *= 0.5;
10723         }
10724 
10725         //if we're in jetpack mode then see if we should be jetting around
10726         if (pm->ps->pm_type == PM_JETPACK)
10727         {
10728                 if (pm->cmd.rightmove > 0)
10729                 {
10730                         PM_ContinueLegsAnim(BOTH_INAIRRIGHT1);
10731                 }
10732                 else if (pm->cmd.rightmove < 0)
10733                 {
10734             PM_ContinueLegsAnim(BOTH_INAIRLEFT1);
10735                 }
10736                 else if (pm->cmd.forwardmove > 0)
10737                 {
10738                         PM_ContinueLegsAnim(BOTH_INAIR1);
10739                 }
10740                 else if (pm->cmd.forwardmove < 0)
10741                 {
10742                         PM_ContinueLegsAnim(BOTH_INAIRBACK1);
10743                 }
10744                 else
10745                 {
10746                         PM_ContinueLegsAnim(BOTH_INAIR1);
10747                 }
10748 
10749                 if (pm->ps->weapon == WP_SABER &&
10750                         BG_SpinningSaberAnim( pm->ps->legsAnim ))
10751                 { //make him stir around since he shouldn't have any real control when spinning
10752                         pm->ps->velocity[0] += Q_irand(-100, 100);
10753                         pm->ps->velocity[1] += Q_irand(-100, 100);
10754                 }
10755 
10756                 if (pm->cmd.upmove > 0 && pm->ps->velocity[2] < 256)
10757                 { //cap upward velocity off at 256. Seems reasonable.
10758                         float addIn = 12.0f;
10759 
10760 /*
10761                         //Add based on our distance to the ground if we're already travelling upward
10762                         if (pm->ps->velocity[2] > 0)
10763                         {
10764                                 while (gDist > 64)
10765                                 { //subtract 1 for every 64 units off the ground we get
10766                                         addIn--;
10767 
10768                                         gDist -= 64;
10769 
10770                                         if (addIn <= 0)
10771                                         { //break out if we're not even going to add anything
10772                                                 break;
10773                                         }
10774                                 }
10775                         }
10776 */                      
10777                         if (pm->ps->velocity[2] > 0)
10778                         {
10779                                 addIn = 12.0f - (gDist / 64.0f);
10780                         }
10781 
10782                         if (addIn > 0.0f)
10783                         {
10784                                 pm->ps->velocity[2] += addIn;
10785                         }
10786 
10787                         pm->ps->eFlags |= EF_JETPACK_FLAMING; //going up
10788                 }
10789                 else
10790                 {
10791                         pm->ps->eFlags &= ~EF_JETPACK_FLAMING; //idling
10792 
10793                         if (pm->ps->velocity[2] < 256)
10794                         {
10795                                 if (pm->ps->velocity[2] < -100)
10796                                 {
10797                                         pm->ps->velocity[2] = -100;
10798                                 }
10799                                 if (gDist < JETPACK_HOVER_HEIGHT)
10800                                 { //make sure we're always hovering off the ground somewhat while jetpack is active
10801                                         pm->ps->velocity[2] += 2;
10802                                 }
10803                         }
10804                 }
10805         }
10806 
10807         if (pm->ps->clientNum >= MAX_CLIENTS &&
10808                 pm_entSelf && pm_entSelf->m_pVehicle)
10809         { //Now update our mins/maxs to match our m_vOrientation based on our length, width & height
10810                 BG_VehicleAdjustBBoxForOrientation( pm_entSelf->m_pVehicle, pm->ps->origin, pm->mins, pm->maxs, pm->ps->clientNum, pm->tracemask, pm->trace );
10811         }
10812 
10813         // set groundentity
10814         PM_GroundTrace();
10815         if ( pm_flying == FLY_HOVER )
10816         {//never stick to the ground
10817                 PM_HoverTrace();
10818         }
10819 
10820         if ( pm->ps->groundEntityNum != ENTITYNUM_NONE )
10821         {//on ground
10822                 pm->ps->fd.forceJumpZStart = 0;
10823         }
10824 
10825         if ( pm->ps->pm_type == PM_DEAD ) {
10826                 if (pm->ps->clientNum >= MAX_CLIENTS &&
10827                         pm_entSelf &&
10828                         pm_entSelf->s.NPC_class == CLASS_VEHICLE &&
10829                         pm_entSelf->m_pVehicle->m_pVehicleInfo->type != VH_ANIMAL)
10830                 {//vehicles don't use deadmove
10831                 }
10832                 else
10833                 {
10834                         PM_DeadMove ();
10835                 }
10836         }
10837 
10838         PM_DropTimers();
10839 
10840 #ifdef _TESTING_VEH_PREDICTION
10841 #ifndef QAGAME
10842         {
10843                 vec3_t blah;
10844                 VectorMA(pm->ps->origin, 128.0f, pm->ps->moveDir, blah);
10845                 CG_TestLine(pm->ps->origin, blah, 1, 0x0000ff, 1);
10846 
10847                 VectorMA(pm->ps->origin, 1.0f, pm->ps->velocity, blah);
10848                 CG_TestLine(pm->ps->origin, blah, 1, 0xff0000, 1);
10849         }
10850 #endif
10851 #endif
10852 
10853         if (pm_entSelf->s.NPC_class!=CLASS_VEHICLE
10854                 &&pm->ps->m_iVehicleNum)
10855         { //a player riding a vehicle
10856                 bgEntity_t *veh = pm_entVeh;
10857 
10858                 if ( veh && veh->m_pVehicle &&
10859                         (veh->m_pVehicle->m_pVehicleInfo->type == VH_WALKER || veh->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER) )
10860                 {//*sigh*, until we get forced weapon-switching working?
10861                         pm->cmd.buttons &= ~(BUTTON_ATTACK|BUTTON_ALT_ATTACK);
10862                         pm->ps->eFlags &= ~(EF_FIRING|EF_ALT_FIRING);
10863                         //pm->cmd.weapon = pm->ps->weapon;
10864                 }
10865         }
10866 
10867         if (!pm->ps->m_iVehicleNum &&
10868                 pm_entSelf->s.NPC_class!=CLASS_VEHICLE&&
10869                 pm_entSelf->s.NPC_class!=CLASS_RANCOR&&
10870                 pm->ps->groundEntityNum < ENTITYNUM_WORLD &&
10871                 pm->ps->groundEntityNum >= MAX_CLIENTS)
10872         { //I am a player client, not riding on a vehicle, and potentially standing on an NPC
10873                 bgEntity_t *pEnt = PM_BGEntForNum(pm->ps->groundEntityNum);
10874 
10875                 if (pEnt && pEnt->s.eType == ET_NPC &&
10876                         pEnt->s.NPC_class != CLASS_VEHICLE) //don't bounce on vehicles
10877                 { //this is actually an NPC, let's try to bounce of its head to make sure we can't just stand around on top of it.
10878                         if (pm->ps->velocity[2] < 270)
10879                         { //try forcing velocity up and also force him to jump
10880                                 pm->ps->velocity[2] = 270; //seems reasonable
10881                                 pm->cmd.upmove = 127;
10882                         }
10883                 }
10884 #ifdef QAGAME
10885                 else if ( !pm->ps->zoomMode &&
10886                         pm_entSelf //I exist
10887                         && pEnt->m_pVehicle )//ent has a vehicle
10888                 {
10889                         gentity_t *gEnt = (gentity_t*)pEnt;
10890                         if ( gEnt->client
10891                                 && !gEnt->client->ps.m_iVehicleNum //vehicle is empty
10892                                 && (gEnt->spawnflags&2) )//SUSPENDED
10893                         {//it's a vehicle, see if we should get in it
10894                                 //if land on an empty, suspended vehicle, get in it
10895                                 pEnt->m_pVehicle->m_pVehicleInfo->Board( pEnt->m_pVehicle, (bgEntity_t *)pm_entSelf );
10896                         }
10897                 }
10898 #endif
10899         }
10900 
10901         if (pm->ps->clientNum >= MAX_CLIENTS &&
10902                 pm_entSelf &&
10903                 pm_entSelf->s.NPC_class == CLASS_VEHICLE)
10904         { //we are a vehicle
10905                 bgEntity_t *veh = pm_entSelf;
10906 
10907                 assert(veh && veh->playerState && veh->m_pVehicle && veh->s.number >= MAX_CLIENTS);
10908 
10909                 if (veh->m_pVehicle->m_pVehicleInfo->type != VH_FIGHTER)
10910                 { //kind of hacky, don't want to do this for flying vehicles
10911                         veh->m_pVehicle->m_vOrientation[PITCH] = pm->ps->viewangles[PITCH];
10912                 }
10913 
10914                 if (!pm->ps->m_iVehicleNum)
10915                 { //no one is driving, just update and get out
10916 #ifdef QAGAME
10917                         veh->m_pVehicle->m_pVehicleInfo->Update(veh->m_pVehicle, &pm->cmd);
10918                     veh->m_pVehicle->m_pVehicleInfo->Animate(veh->m_pVehicle);
10919 #endif
10920                 }
10921                 else
10922                 {
10923                         bgEntity_t *self = pm_entVeh;
10924 #ifdef QAGAME
10925                         int i = 0;
10926 #endif
10927 
10928                         assert(self && self->playerState && self->s.number < MAX_CLIENTS);
10929 
10930                         if (pm->ps->pm_type == PM_DEAD &&
10931                                 (veh->m_pVehicle->m_ulFlags & VEH_CRASHING))
10932                         {
10933                                 veh->m_pVehicle->m_ulFlags &= ~VEH_CRASHING;
10934                         }
10935 
10936                         if (self->playerState->m_iVehicleNum)
10937                         { //only do it if they still have a vehicle (didn't get ejected this update or something)
10938                                 PM_VehicleViewAngles(self->playerState, veh, &veh->m_pVehicle->m_ucmd);
10939                         }
10940 
10941 #ifdef QAGAME
10942                         veh->m_pVehicle->m_pVehicleInfo->Update(veh->m_pVehicle, &veh->m_pVehicle->m_ucmd);
10943                         veh->m_pVehicle->m_pVehicleInfo->Animate(veh->m_pVehicle);
10944 
10945                         veh->m_pVehicle->m_pVehicleInfo->UpdateRider(veh->m_pVehicle, self, &veh->m_pVehicle->m_ucmd);
10946                         //update the passengers
10947                         while (i < veh->m_pVehicle->m_iNumPassengers)
10948                         {
10949                                 if (veh->m_pVehicle->m_ppPassengers[i])
10950                                 {
10951                                         gentity_t *thePassenger = (gentity_t *)veh->m_pVehicle->m_ppPassengers[i]; //yes, this is, in fact, ass.
10952                                         if (thePassenger->inuse && thePassenger->client)
10953                                         {
10954                                                 veh->m_pVehicle->m_pVehicleInfo->UpdateRider(veh->m_pVehicle, veh->m_pVehicle->m_ppPassengers[i], &thePassenger->client->pers.cmd);
10955                                         }
10956                                 }
10957                                 i++;
10958                         }
10959 #else
10960                         if (!veh->playerState->vehBoarding )//|| veh->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER)
10961                         {
10962                                 if (veh->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER)
10963                                 { //client must explicitly call this for prediction
10964                                         BG_FighterUpdate(veh->m_pVehicle, &veh->m_pVehicle->m_ucmd, pm->mins, pm->maxs, self->playerState->gravity, pm->trace);
10965                                 }
10966 
10967                                 if (veh->m_pVehicle->m_iBoarding == 0)
10968                                 {
10969                                         vec3_t vRollAng;
10970 
10971                                         //make sure we are set as its pilot cgame side
10972                                         veh->m_pVehicle->m_pPilot = self;
10973 
10974                                         // Keep track of the old orientation.
10975                                         VectorCopy( veh->m_pVehicle->m_vOrientation, veh->m_pVehicle->m_vPrevOrientation );
10976 
10977                                         veh->m_pVehicle->m_pVehicleInfo->ProcessOrientCommands(veh->m_pVehicle);
10978                                         PM_SetPMViewAngle(veh->playerState, veh->m_pVehicle->m_vOrientation, &veh->m_pVehicle->m_ucmd);
10979                                         veh->m_pVehicle->m_pVehicleInfo->ProcessMoveCommands(veh->m_pVehicle);
10980 
10981                                         vRollAng[YAW] = self->playerState->viewangles[YAW];
10982                                         vRollAng[PITCH] = self->playerState->viewangles[PITCH];
10983                                         vRollAng[ROLL] = veh->m_pVehicle->m_vOrientation[ROLL];
10984                                         PM_SetPMViewAngle(self->playerState, vRollAng, &pm->cmd);
10985 
10986                                         // Setup the move direction.
10987                                         if ( veh->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER )
10988                                         {
10989                                                 AngleVectors( veh->m_pVehicle->m_vOrientation, veh->playerState->moveDir, NULL, NULL ); 
10990                                         }
10991                                         else
10992                                         {
10993                                                 vec3_t vVehAngles;
10994 
10995                                                 VectorSet(vVehAngles, 0, veh->m_pVehicle->m_vOrientation[YAW], 0);
10996                                                 AngleVectors( vVehAngles, veh->playerState->moveDir, NULL, NULL ); 
10997                                         }
10998                                 }
10999                         }
11000                         /*
11001                         else
11002                         {
11003                                 veh->playerState->speed = 0.0f;
11004                                 PM_SetPMViewAngle(self->playerState, veh->playerState->viewangles, &veh->m_pVehicle->m_ucmd);
11005                         }
11006                         */
11007                         else if (veh->playerState)
11008                         {
11009                                 veh->playerState->speed = 0.0f;
11010                                 if (veh->m_pVehicle)
11011                                 {
11012                                         PM_SetPMViewAngle(self->playerState, veh->m_pVehicle->m_vOrientation, &pm->cmd);
11013                                         PM_SetPMViewAngle(veh->playerState, veh->m_pVehicle->m_vOrientation, &pm->cmd);
11014                                 }
11015                         }
11016 #endif
11017                 }
11018                 noAnimate = qtrue;
11019         }
11020 
11021         if (pm_entSelf->s.NPC_class!=CLASS_VEHICLE
11022                 &&pm->ps->m_iVehicleNum)
11023         {//don't even run physics on a player if he's on a vehicle - he goes where the vehicle goes
11024         }
11025         else
11026         { //don't even run physics on a player if he's on a vehicle - he goes where the vehicle goes
11027                 if (pm->ps->pm_type == PM_FLOAT
11028                         ||pm_flying == FLY_NORMAL)
11029                 {
11030                         PM_FlyMove ();
11031                 }
11032                 else if ( pm_flying == FLY_VEHICLE )
11033                 {
11034                         PM_FlyVehicleMove();
11035                 }
11036                 else
11037                 {
11038                         if (pm->ps->pm_flags & PMF_TIME_WATERJUMP) {
11039                                 PM_WaterJumpMove();
11040                         } else if ( pm->waterlevel > 1 ) {
11041                                 // swimming
11042                                 PM_WaterMove();
11043                         } else if ( pml.walking ) {
11044                                 // walking on ground
11045                                 PM_WalkMove();
11046                         } else {
11047                                 // airborne
11048                                 PM_AirMove();
11049                         }
11050                 }
11051         }
11052 
11053         if (!noAnimate)
11054         {
11055                 PM_Animate();
11056         }
11057 
11058         // set groundentity, watertype, and waterlevel
11059         PM_GroundTrace();
11060         if ( pm_flying == FLY_HOVER )
11061         {//never stick to the ground
11062                 PM_HoverTrace();
11063         }
11064         PM_SetWaterLevel();
11065         if (pm->cmd.forcesel != -1 && (pm->ps->fd.forcePowersKnown & (1 << pm->cmd.forcesel)))
11066         {
11067                 pm->ps->fd.forcePowerSelected = pm->cmd.forcesel;
11068         }
11069         if (pm->cmd.invensel != -1 && (pm->ps->stats[STAT_HOLDABLE_ITEMS] & (1 << pm->cmd.invensel)))
11070         {
11071                 pm->ps->stats[STAT_HOLDABLE_ITEM] = BG_GetItemIndexByTag(pm->cmd.invensel, IT_HOLDABLE);
11072         }
11073 
11074         if (pm->ps->m_iVehicleNum 
11075                 /*&&pm_entSelf->s.NPC_class!=CLASS_VEHICLE*/
11076                 && pm->ps->clientNum < MAX_CLIENTS)
11077         {//a client riding a vehicle
11078                 if ( (pm->ps->eFlags&EF_NODRAW) )
11079                 {//inside the vehicle, do nothing
11080                 }
11081                 else if (!PM_WeaponOkOnVehicle(pm->cmd.weapon) || !PM_WeaponOkOnVehicle(pm->ps->weapon))
11082                 { //this weapon is not legal for the vehicle, force to our current one
11083             if (!PM_WeaponOkOnVehicle(pm->ps->weapon))
11084                         { //uh-oh!
11085                                 int weap = PM_GetOkWeaponForVehicle();
11086 
11087                                 if (weap != -1)
11088                                 {
11089                                         pm->cmd.weapon = weap;
11090                                         pm->ps->weapon = weap;
11091                                 }
11092                         }
11093                         else
11094                         {
11095                                 pm->cmd.weapon = pm->ps->weapon;
11096                         }
11097                 }
11098         }
11099 
11100         if (!pm->ps->m_iVehicleNum //not a vehicle and not riding one
11101                 || pm_entSelf->s.NPC_class==CLASS_VEHICLE //you are a vehicle NPC
11102                 || (!(pm->ps->eFlags&EF_NODRAW)&&PM_WeaponOkOnVehicle(pm->cmd.weapon)) )//you're not inside the vehicle and the weapon you're holding can be used when riding this vehicle
11103         { //only run weapons if a valid weapon is selected
11104                 // weapons
11105                 PM_Weapon();
11106         }
11107 
11108         PM_Use();
11109 
11110         if (!pm->ps->m_iVehicleNum &&
11111                 (pm->ps->clientNum < MAX_CLIENTS ||
11112                 !pm_entSelf ||
11113                 pm_entSelf->s.NPC_class != CLASS_VEHICLE))
11114         { //don't do this if we're on a vehicle, or we are one
11115                 // footstep events / legs animations
11116                 PM_Footsteps();
11117         }
11118 
11119         // entering / leaving water splashes
11120         PM_WaterEvents();
11121 
11122         // snap some parts of playerstate to save network bandwidth
11123         trap_SnapVector( pm->ps->velocity );
11124 
11125         if (pm->ps->pm_type == PM_JETPACK || gPMDoSlowFall )
11126         {
11127                 pm->ps->gravity = savedGravity;
11128         }
11129 
11130         if (//pm->ps->m_iVehicleNum &&
11131                 pm->ps->clientNum >= MAX_CLIENTS &&
11132                 pm_entSelf &&
11133                 pm_entSelf->s.NPC_class == CLASS_VEHICLE)
11134         { //a vehicle with passengers
11135                 bgEntity_t *veh;
11136                 
11137                 veh = pm_entSelf;
11138 
11139                 assert(veh->m_pVehicle);
11140 
11141                 //this could be kind of "inefficient" because it's called after every passenger pmove too.
11142                 //Maybe instead of AttachRiders we should have each rider call attach for himself?
11143                 if (veh->m_pVehicle && veh->ghoul2)
11144                 {
11145                         veh->m_pVehicle->m_pVehicleInfo->AttachRiders( veh->m_pVehicle );
11146                 }
11147         }
11148 
11149         if (pm_entSelf->s.NPC_class!=CLASS_VEHICLE
11150                 && pm->ps->m_iVehicleNum)
11151         { //riding a vehicle, see if we should do some anim overrides
11152                 PM_VehicleWeaponAnimate();
11153         }
11154 }

void trap_SnapVector float *  v  ) 
 

Definition at line 579 of file cg_syscalls.c.

00579                                  {
00580         syscall( CG_SNAPVECTOR, v );
00581 }


Variable Documentation

vmCvar_t bg_fighterAltControl
 

Definition at line 7784 of file bg_pmove.c.

int c_pmove = 0
 

Definition at line 57 of file bg_pmove.c.

Referenced by PM_StepSlideMove(), and PmoveSingle().

vmCvar_t cg_paused
 

Definition at line 638 of file bg_pmove.c.

float forceJumpHeight[NUM_FORCE_POWER_LEVELS]
 

Initial value:

 
{
        32,
        96,
        192,
        384
}

Definition at line 155 of file bg_pmove.c.

float forceJumpHeightMax[NUM_FORCE_POWER_LEVELS]
 

Initial value:

 
{
        66,
        130,
        226,
        418
}

Definition at line 1768 of file bg_pmove.c.

float forceJumpStrength[NUM_FORCE_POWER_LEVELS]
 

Initial value:

 
{
        JUMP_VELOCITY,
        420,
        590,
        840
}

Definition at line 163 of file bg_pmove.c.

Referenced by ForceJump(), ForceJumpCharge(), Jedi_CheckFlipEvasions(), and WPConstantRoutine().

int forcePowerNeeded[NUM_FORCE_POWER_LEVELS][NUM_FORCE_POWERS]
 

Definition at line 67 of file bg_pmove.c.

float forceSpeedLevels[4]
 

Initial value:

 
{
        1, 
        1.25,
        1.5,
        1.75
}

Definition at line 59 of file bg_pmove.c.

qboolean gPMDoSlowFall = qfalse
 

Definition at line 36 of file bg_pmove.c.

Referenced by PmoveSingle().

pmove_t* pm
 

Definition at line 30 of file bg_pmove.c.

Referenced by AnimateRiders(), BG_AdjustClientSpeed(), BG_EnoughForcePowerForMove(), BG_VehTraceFromCamPos(), ClientImpacts(), ClientThink_real(), G_SetAnim(), PM_AddEvent(), PM_AddEventWithParm(), PM_AddTouchEnt(), PM_AdjustAngleForWallJump(), PM_AdjustAngleForWallRun(), PM_AdjustAngleForWallRunUp(), PM_AdjustAnglesForWallRunUpFlipAlt(), PM_AdjustAttackStates(), PM_AdjustStandAnimForSlope(), PM_AnimLength(), PM_BeginWeaponChange(), PM_BGEntForNum(), PM_CanBackstab(), PM_CanDoKata(), PM_CanDoRollStab(), PM_CanSetWeaponAnims(), PM_CheckAltKickAttack(), PM_CheckDualForwardJumpDuck(), PM_CheckFixMins(), PM_CheckPullAttack(), PM_CheckStabDown(), PM_ClipVelocity(), PM_ContinueLegsAnim(), PM_DebugLegsAnim(), PM_DoSlowFall(), PM_FinishWeaponChange(), PM_FootSlopeTrace(), PM_ForceJumpingUp(), PM_ForceLegsAnim(), PM_GetOkWeaponForVehicle(), PM_GetSaberStance(), PM_GrabWallForJump(), PM_GroundDistance(), PM_GroundSlideOkay(), PM_HoverTrace(), PM_InSecondaryStyle(), PM_irand_timesync(), PM_ItemUsable(), PM_KickMoveForConditions(), PM_LegsSlopeBackTransition(), PM_MoveForKata(), PM_pitch_roll_for_slope(), PM_RocketLock(), PM_SaberAttackForMovement(), PM_SaberBackflipAttackMove(), PM_SaberDualJumpAttackMove(), PM_SaberFlipOverAttackMove(), PM_SaberJumpAttackMove(), PM_SaberJumpAttackMove2(), PM_SaberKataDone(), PM_SaberLockBreak(), PM_SaberLocked(), PM_SaberLockResultAnim(), PM_SaberLockWinAnim(), PM_SaberLungeAttackMove(), PM_SaberMoveOkayForKata(), PM_SaberPowerCheck(), PM_SetAnim(), PM_SetAnimFinal(), PM_SetForceJumpZStart(), PM_SetLegsAnimTimer(), PM_SetSaberMove(), PM_SetSpecialMoveValues(), PM_SetTorsoAnimTimer(), PM_SlideMove(), PM_SomeoneInFront(), PM_StartTorsoAnim(), PM_StepSlideMove(), PM_Use(), PM_VehFaceHyperspacePoint(), PM_VehForcedTurning(), PM_VehicleImpact(), PM_VehicleWeaponAnimate(), PM_WalkableGroundDistance(), PM_WeaponLightsaber(), PmoveSingle(), ProcessOrientCommands(), qsort(), and SpectatorThink().

float pm_accelerate = 10.0f
 

Definition at line 47 of file bg_pmove.c.

float pm_airaccelerate = 1.0f
 

Definition at line 48 of file bg_pmove.c.

qboolean pm_cancelOutZoom = qfalse
 

Definition at line 38 of file bg_pmove.c.

Referenced by PmoveSingle().

float pm_duckScale = 0.50f
 

Definition at line 42 of file bg_pmove.c.

bgEntity_t* pm_entSelf = NULL
 

Definition at line 33 of file bg_pmove.c.

Referenced by BG_AdjustClientSpeed(), PM_AdjustAttackStates(), PM_HoverTrace(), PM_SetSpecialMoveValues(), PM_SlideMove(), PM_StepSlideMove(), and PmoveSingle().

bgEntity_t* pm_entVeh = NULL
 

Definition at line 34 of file bg_pmove.c.

Referenced by PM_AdjustAttackStates(), PM_UpdateViewAngles(), PM_VehicleWeaponAnimate(), and PmoveSingle().

float pm_flightfriction = 3.0f
 

Definition at line 54 of file bg_pmove.c.

float pm_flyaccelerate = 8.0f
 

Definition at line 50 of file bg_pmove.c.

float pm_friction = 6.0f
 

Definition at line 52 of file bg_pmove.c.

float pm_spectatorfriction = 5.0f
 

Definition at line 55 of file bg_pmove.c.

float pm_stopspeed = 100.0f
 

Definition at line 41 of file bg_pmove.c.

float pm_swimScale = 0.50f
 

Definition at line 43 of file bg_pmove.c.

float pm_vehicleaccelerate = 36.0f
 

Definition at line 46 of file bg_pmove.c.

float pm_wadeScale = 0.70f
 

Definition at line 44 of file bg_pmove.c.

float pm_wateraccelerate = 4.0f
 

Definition at line 49 of file bg_pmove.c.

float pm_waterfriction = 1.0f
 

Definition at line 53 of file bg_pmove.c.

pml_t pml
 

Definition at line 31 of file bg_pmove.c.

Referenced by PM_HoverTrace(), PM_SlideMove(), PM_VehFaceHyperspacePoint(), PM_VehForcedTurning(), PM_VehicleImpact(), PM_WeaponLightsaber(), and PmoveSingle().

int WeaponReadyLegsAnim[WP_NUM_WEAPONS]
 

Definition at line 5105 of file bg_pmove.c.