#include "q_shared.h"
#include "bg_public.h"
#include "bg_local.h"
Include dependency graph for bg_pmove.c:

Go to the source code of this file.
|
||||||||||||||||
|
Definition at line 240 of file bg_pmove.c. References DotProduct, pml_t::frametime, i, pm, pml, pmove_t::ps, vec3_t, VectorMA, VectorNormalize(), VectorScale, VectorSubtract, and playerState_s::velocity. Referenced by PM_AirMove(), PM_FlyMove(), PM_NoclipMove(), PM_WalkMove(), and PM_WaterMove(). 00240 {
00241 #if 1
00242 // q2 style
00243 int i;
00244 float addspeed, accelspeed, currentspeed;
00245
00246 currentspeed = DotProduct (pm->ps->velocity, wishdir);
00247 addspeed = wishspeed - currentspeed;
00248 if (addspeed <= 0) {
00249 return;
00250 }
00251 accelspeed = accel*pml.frametime*wishspeed;
00252 if (accelspeed > addspeed) {
00253 accelspeed = addspeed;
00254 }
00255
00256 for (i=0 ; i<3 ; i++) {
00257 pm->ps->velocity[i] += accelspeed*wishdir[i];
00258 }
00259 #else
00260 // proper way (avoids strafe jump maxspeed bug), but feels bad
00261 vec3_t wishVelocity;
00262 vec3_t pushDir;
00263 float pushLen;
00264 float canPush;
00265
00266 VectorScale( wishdir, wishspeed, wishVelocity );
00267 VectorSubtract( wishVelocity, pm->ps->velocity, pushDir );
00268 pushLen = VectorNormalize( pushDir );
00269
00270 canPush = accel*pml.frametime*wishspeed;
00271 if (canPush > pushLen) {
00272 canPush = pushLen;
00273 }
00274
00275 VectorMA( pm->ps->velocity, canPush, pushDir, pm->ps->velocity );
00276 #endif
00277 }
|
Here is the call graph for this function:

|
|
Definition at line 58 of file bg_pmove.c. References BG_AddPredictableEventToPlayerstate(), pm, and pmove_t::ps. Referenced by PM_Animate(), PM_BeginWeaponChange(), PM_CheckJump(), PM_CrashLand(), PM_Footsteps(), PM_StepSlideMove(), PM_WaterEvents(), and PM_Weapon(). 00058 {
00059 BG_AddPredictableEventToPlayerstate( newEvent, 0, pm->ps );
00060 }
|
Here is the call graph for this function:

|
|
Definition at line 67 of file bg_pmove.c. References i, pmove_t::numtouch, pm, and pmove_t::touchents. Referenced by PM_GroundTrace(), and PM_SlideMove(). 00067 {
00068 int i;
00069
00070 if ( entityNum == ENTITYNUM_WORLD ) {
00071 return;
00072 }
00073 if ( pm->numtouch == MAXTOUCH ) {
00074 return;
00075 }
00076
00077 // see if it is already added
00078 for ( i = 0 ; i < pm->numtouch ; i++ ) {
00079 if ( pm->touchents[ i ] == entityNum ) {
00080 return;
00081 }
00082 }
00083
00084 // add it
00085 pm->touchents[pm->numtouch] = entityNum;
00086 pm->numtouch++;
00087 }
|
|
|
Definition at line 601 of file bg_pmove.c. References pmove_t::cmd, pml_t::forward, usercmd_s::forwardmove, pml_t::groundPlane, pml_t::groundTrace, i, cplane_s::normal, OVERCLIP, trace_t::plane, pm, PM_Accelerate(), pm_airaccelerate, PM_ClipVelocity(), PM_CmdScale(), playerState_s::pm_flags, PM_Friction(), PM_SetMovementDir(), PM_SlideMove(), PM_StepSlideMove(), pml, pmove_t::ps, qtrue, pml_t::right, usercmd_s::rightmove, usercmd_t, vec3_t, VectorCopy, VectorNormalize(), and playerState_s::velocity. Referenced by PM_WalkMove(), and PmoveSingle(). 00601 {
00602 int i;
00603 vec3_t wishvel;
00604 float fmove, smove;
00605 vec3_t wishdir;
00606 float wishspeed;
00607 float scale;
00608 usercmd_t cmd;
00609
00610 PM_Friction();
00611
00612 fmove = pm->cmd.forwardmove;
00613 smove = pm->cmd.rightmove;
00614
00615 cmd = pm->cmd;
00616 scale = PM_CmdScale( &cmd );
00617
00618 // set the movementDir so clients can rotate the legs for strafing
00619 PM_SetMovementDir();
00620
00621 // project moves down to flat plane
00622 pml.forward[2] = 0;
00623 pml.right[2] = 0;
00624 VectorNormalize (pml.forward);
00625 VectorNormalize (pml.right);
00626
00627 for ( i = 0 ; i < 2 ; i++ ) {
00628 wishvel[i] = pml.forward[i]*fmove + pml.right[i]*smove;
00629 }
00630 wishvel[2] = 0;
00631
00632 VectorCopy (wishvel, wishdir);
00633 wishspeed = VectorNormalize(wishdir);
00634 wishspeed *= scale;
00635
00636 // not on ground, so little effect on velocity
00637 PM_Accelerate (wishdir, wishspeed, pm_airaccelerate);
00638
00639 // we may have a ground plane that is very steep, even
00640 // though we don't have a groundentity
00641 // slide along the steep plane
00642 if ( pml.groundPlane ) {
00643 PM_ClipVelocity (pm->ps->velocity, pml.groundTrace.plane.normal,
00644 pm->ps->velocity, OVERCLIP );
00645 }
00646
00647 #if 0
00648 //ZOID: If we are on the grapple, try stair-stepping
00649 //this allows a player to use the grapple to pull himself
00650 //over a ledge
00651 if (pm->ps->pm_flags & PMF_GRAPPLE_PULL)
00652 PM_StepSlideMove ( qtrue );
00653 else
00654 PM_SlideMove ( qtrue );
00655 #endif
00656
00657 PM_StepSlideMove ( qtrue );
00658 }
|
Here is the call graph for this function:

|
|
Definition at line 1714 of file bg_pmove.c. References usercmd_s::buttons, pmove_t::cmd, EV_TAUNT, pm, PM_AddEvent(), PM_StartTorsoAnim(), pmove_t::ps, TORSO_AFFIRMATIVE, TORSO_FOLLOWME, TORSO_GESTURE, TORSO_GETFLAG, TORSO_GUARDBASE, TORSO_NEGATIVE, TORSO_PATROL, and playerState_s::torsoTimer. Referenced by PmoveSingle(). 01714 {
01715 if ( pm->cmd.buttons & BUTTON_GESTURE ) {
01716 if ( pm->ps->torsoTimer == 0 ) {
01717 PM_StartTorsoAnim( TORSO_GESTURE );
01718 pm->ps->torsoTimer = TIMER_GESTURE;
01719 PM_AddEvent( EV_TAUNT );
01720 }
01721 #ifdef MISSIONPACK
01722 } else if ( pm->cmd.buttons & BUTTON_GETFLAG ) {
01723 if ( pm->ps->torsoTimer == 0 ) {
01724 PM_StartTorsoAnim( TORSO_GETFLAG );
01725 pm->ps->torsoTimer = 600; //TIMER_GESTURE;
01726 }
01727 } else if ( pm->cmd.buttons & BUTTON_GUARDBASE ) {
01728 if ( pm->ps->torsoTimer == 0 ) {
01729 PM_StartTorsoAnim( TORSO_GUARDBASE );
01730 pm->ps->torsoTimer = 600; //TIMER_GESTURE;
01731 }
01732 } else if ( pm->cmd.buttons & BUTTON_PATROL ) {
01733 if ( pm->ps->torsoTimer == 0 ) {
01734 PM_StartTorsoAnim( TORSO_PATROL );
01735 pm->ps->torsoTimer = 600; //TIMER_GESTURE;
01736 }
01737 } else if ( pm->cmd.buttons & BUTTON_FOLLOWME ) {
01738 if ( pm->ps->torsoTimer == 0 ) {
01739 PM_StartTorsoAnim( TORSO_FOLLOWME );
01740 pm->ps->torsoTimer = 600; //TIMER_GESTURE;
01741 }
01742 } else if ( pm->cmd.buttons & BUTTON_AFFIRMATIVE ) {
01743 if ( pm->ps->torsoTimer == 0 ) {
01744 PM_StartTorsoAnim( TORSO_AFFIRMATIVE);
01745 pm->ps->torsoTimer = 600; //TIMER_GESTURE;
01746 }
01747 } else if ( pm->cmd.buttons & BUTTON_NEGATIVE ) {
01748 if ( pm->ps->torsoTimer == 0 ) {
01749 PM_StartTorsoAnim( TORSO_NEGATIVE );
01750 pm->ps->torsoTimer = 600; //TIMER_GESTURE;
01751 }
01752 #endif
01753 }
01754 }
|
Here is the call graph for this function:

|
|
Definition at line 1469 of file bg_pmove.c. References EV_CHANGE_WEAPON, pm, PM_AddEvent(), PM_StartTorsoAnim(), pmove_t::ps, playerState_s::stats, TORSO_DROP, playerState_s::weaponstate, and playerState_s::weaponTime. Referenced by PM_Weapon(). 01469 {
01470 if ( weapon <= WP_NONE || weapon >= WP_NUM_WEAPONS ) {
01471 return;
01472 }
01473
01474 if ( !( pm->ps->stats[STAT_WEAPONS] & ( 1 << weapon ) ) ) {
01475 return;
01476 }
01477
01478 if ( pm->ps->weaponstate == WEAPON_DROPPING ) {
01479 return;
01480 }
01481
01482 PM_AddEvent( EV_CHANGE_WEAPON );
01483 pm->ps->weaponstate = WEAPON_DROPPING;
01484 pm->ps->weaponTime += 200;
01485 PM_StartTorsoAnim( TORSO_DROP );
01486 }
|
Here is the call graph for this function:

|
|
Definition at line 1249 of file bg_pmove.c. References trace_t::allsolid, playerState_s::clientNum, pmove_t::cmd, pmove_t::maxs, pmove_t::mins, MINS_Z, playerState_s::origin, pm, playerState_s::pm_flags, playerState_s::pm_type, playerState_s::powerups, pmove_t::ps, pmove_t::trace, pmove_t::tracemask, usercmd_s::upmove, VectorSet, and playerState_s::viewheight. Referenced by PmoveSingle(). 01250 {
01251 trace_t trace;
01252
01253 if ( pm->ps->powerups[PW_INVULNERABILITY] ) {
01254 if ( pm->ps->pm_flags & PMF_INVULEXPAND ) {
01255 // invulnerability sphere has a 42 units radius
01256 VectorSet( pm->mins, -42, -42, -42 );
01257 VectorSet( pm->maxs, 42, 42, 42 );
01258 }
01259 else {
01260 VectorSet( pm->mins, -15, -15, MINS_Z );
01261 VectorSet( pm->maxs, 15, 15, 16 );
01262 }
01263 pm->ps->pm_flags |= PMF_DUCKED;
01264 pm->ps->viewheight = CROUCH_VIEWHEIGHT;
01265 return;
01266 }
01267 pm->ps->pm_flags &= ~PMF_INVULEXPAND;
01268
01269 pm->mins[0] = -15;
01270 pm->mins[1] = -15;
01271
01272 pm->maxs[0] = 15;
01273 pm->maxs[1] = 15;
01274
01275 pm->mins[2] = MINS_Z;
01276
01277 if (pm->ps->pm_type == PM_DEAD)
01278 {
01279 pm->maxs[2] = -8;
01280 pm->ps->viewheight = DEAD_VIEWHEIGHT;
01281 return;
01282 }
01283
01284 if (pm->cmd.upmove < 0)
01285 { // duck
01286 pm->ps->pm_flags |= PMF_DUCKED;
01287 }
01288 else
01289 { // stand up if possible
01290 if (pm->ps->pm_flags & PMF_DUCKED)
01291 {
01292 // try to stand up
01293 pm->maxs[2] = 32;
01294 pm->trace (&trace, pm->ps->origin, pm->mins, pm->maxs, pm->ps->origin, pm->ps->clientNum, pm->tracemask );
01295 if (!trace.allsolid)
01296 pm->ps->pm_flags &= ~PMF_DUCKED;
01297 }
01298 }
01299
01300 if (pm->ps->pm_flags & PMF_DUCKED)
01301 {
01302 pm->maxs[2] = 16;
01303 pm->ps->viewheight = CROUCH_VIEWHEIGHT;
01304 }
01305 else
01306 {
01307 pm->maxs[2] = 32;
01308 pm->ps->viewheight = DEFAULT_VIEWHEIGHT;
01309 }
01310 }
|
|
|
Definition at line 359 of file bg_pmove.c. References pmove_t::cmd, EV_JUMP, usercmd_s::forwardmove, playerState_s::groundEntityNum, pml_t::groundPlane, LEGS_JUMP, LEGS_JUMPB, pm, PM_AddEvent(), playerState_s::pm_flags, PM_ForceLegsAnim(), pml, pmove_t::ps, qboolean, usercmd_s::upmove, playerState_s::velocity, and pml_t::walking. Referenced by PM_WalkMove(). 00359 {
00360 if ( pm->ps->pm_flags & PMF_RESPAWNED ) {
00361 return qfalse; // don't allow jump until all buttons are up
00362 }
00363
00364 if ( pm->cmd.upmove < 10 ) {
00365 // not holding jump
00366 return qfalse;
00367 }
00368
00369 // must wait for jump to be released
00370 if ( pm->ps->pm_flags & PMF_JUMP_HELD ) {
00371 // clear upmove so cmdscale doesn't lower running speed
00372 pm->cmd.upmove = 0;
00373 return qfalse;
00374 }
00375
00376 pml.groundPlane = qfalse; // jumping away
00377 pml.walking = qfalse;
00378 pm->ps->pm_flags |= PMF_JUMP_HELD;
00379
00380 pm->ps->groundEntityNum = ENTITYNUM_NONE;
00381 pm->ps->velocity[2] = JUMP_VELOCITY;
00382 PM_AddEvent( EV_JUMP );
00383
00384 if ( pm->cmd.forwardmove >= 0 ) {
00385 PM_ForceLegsAnim( LEGS_JUMP );
00386 pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
00387 } else {
00388 PM_ForceLegsAnim( LEGS_JUMPB );
00389 pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
00390 }
00391
00392 return qtrue;
00393 }
|
Here is the call graph for this function:

|
|
Definition at line 400 of file bg_pmove.c. References playerState_s::clientNum, pml_t::forward, playerState_s::origin, pm, playerState_s::pm_flags, playerState_s::pm_time, pml, pmove_t::pointcontents, pmove_t::ps, qboolean, vec3_t, VectorMA, VectorNormalize(), VectorScale, playerState_s::velocity, and pmove_t::waterlevel. Referenced by PM_WaterMove(). 00400 {
00401 vec3_t spot;
00402 int cont;
00403 vec3_t flatforward;
00404
00405 if (pm->ps->pm_time) {
00406 return qfalse;
00407 }
00408
00409 // check for water jump
00410 if ( pm->waterlevel != 2 ) {
00411 return qfalse;
00412 }
00413
00414 flatforward[0] = pml.forward[0];
00415 flatforward[1] = pml.forward[1];
00416 flatforward[2] = 0;
00417 VectorNormalize (flatforward);
00418
00419 VectorMA (pm->ps->origin, 30, flatforward, spot);
00420 spot[2] += 4;
00421 cont = pm->pointcontents (spot, pm->ps->clientNum );
00422 if ( !(cont & CONTENTS_SOLID) ) {
00423 return qfalse;
00424 }
00425
00426 spot[2] += 16;
00427 cont = pm->pointcontents (spot, pm->ps->clientNum );
00428 if ( cont ) {
00429 return qfalse;
00430 }
00431
00432 // jump out of water
00433 VectorScale (pml.forward, 200, pm->ps->velocity);
00434 pm->ps->velocity[2] = 350;
00435
00436 pm->ps->pm_flags |= PMF_TIME_WATERJUMP;
00437 pm->ps->pm_time = 2000;
00438
00439 return qtrue;
00440 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 145 of file bg_pmove.c. References DotProduct, i, and in. Referenced by PM_AirMove(), PM_SlideMove(), PM_StepSlideMove(), PM_WalkMove(), and PM_WaterMove(). 00145 {
00146 float backoff;
00147 float change;
00148 int i;
00149
00150 backoff = DotProduct (in, normal);
00151
00152 if ( backoff < 0 ) {
00153 backoff *= overbounce;
00154 } else {
00155 backoff /= overbounce;
00156 }
00157
00158 for ( i=0 ; i<3 ; i++ ) {
00159 change = normal[i]*backoff;
00160 out[i] = in[i] - change;
00161 }
00162 }
|
|
|
Definition at line 290 of file bg_pmove.c. References abs(), usercmd_s::forwardmove, max, pm, pmove_t::ps, usercmd_s::rightmove, playerState_s::speed, sqrt(), usercmd_s::upmove, and usercmd_t. Referenced by PM_AirMove(), PM_FlyMove(), PM_NoclipMove(), PM_WalkMove(), and PM_WaterMove(). 00290 {
00291 int max;
00292 float total;
00293 float scale;
00294
00295 max = abs( cmd->forwardmove );
00296 if ( abs( cmd->rightmove ) > max ) {
00297 max = abs( cmd->rightmove );
00298 }
00299 if ( abs( cmd->upmove ) > max ) {
00300 max = abs( cmd->upmove );
00301 }
00302 if ( !max ) {
00303 return 0;
00304 }
00305
00306 total = sqrt( cmd->forwardmove * cmd->forwardmove
00307 + cmd->rightmove * cmd->rightmove + cmd->upmove * cmd->upmove );
00308 scale = (float)pm->ps->speed * max / ( 127.0 * total );
00309
00310 return scale;
00311 }
|
Here is the call graph for this function:

|
|
Definition at line 112 of file bg_pmove.c. References playerState_s::legsAnim, playerState_s::legsTimer, pm, PM_StartLegsAnim(), and pmove_t::ps. Referenced by PM_Footsteps(). 00112 {
00113 if ( ( pm->ps->legsAnim & ~ANIM_TOGGLEBIT ) == anim ) {
00114 return;
00115 }
00116 if ( pm->ps->legsTimer > 0 ) {
00117 return; // a high priority animation is running
00118 }
00119 PM_StartLegsAnim( anim );
00120 }
|
Here is the call graph for this function:

|
|
Definition at line 122 of file bg_pmove.c. References pm, PM_StartTorsoAnim(), pmove_t::ps, playerState_s::torsoAnim, and playerState_s::torsoTimer. Referenced by PM_TorsoAnimation(). 00122 {
00123 if ( ( pm->ps->torsoAnim & ~ANIM_TOGGLEBIT ) == anim ) {
00124 return;
00125 }
00126 if ( pm->ps->torsoTimer > 0 ) {
00127 return; // a high priority animation is running
00128 }
00129 PM_StartTorsoAnim( anim );
00130 }
|
Here is the call graph for this function:

|
|
Definition at line 1024 of file bg_pmove.c. References trace_t::allsolid, c_pmove, playerState_s::clientNum, Com_Printf(), pmove_t::debugLevel, playerState_s::groundEntityNum, pml_t::groundPlane, pml_t::groundTrace, i, j, k, pmove_t::maxs, pmove_t::mins, playerState_s::origin, pm, pml, point, pmove_t::ps, pmove_t::trace, pmove_t::tracemask, vec3_t, VectorCopy, and pml_t::walking. Referenced by PM_GroundTrace(). 01024 {
01025 int i, j, k;
01026 vec3_t point;
01027
01028 if ( pm->debugLevel ) {
01029 Com_Printf("%i:allsolid\n", c_pmove);
01030 }
01031
01032 // jitter around
01033 for (i = -1; i <= 1; i++) {
01034 for (j = -1; j <= 1; j++) {
01035 for (k = -1; k <= 1; k++) {
01036 VectorCopy(pm->ps->origin, point);
01037 point[0] += (float) i;
01038 point[1] += (float) j;
01039 point[2] += (float) k;
01040 pm->trace (trace, point, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask);
01041 if ( !trace->allsolid ) {
01042 point[0] = pm->ps->origin[0];
01043 point[1] = pm->ps->origin[1];
01044 point[2] = pm->ps->origin[2] - 0.25;
01045
01046 pm->trace (trace, pm->ps->origin, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask);
01047 pml.groundTrace = *trace;
01048 return qtrue;
01049 }
01050 }
01051 }
01052 }
01053
01054 pm->ps->groundEntityNum = ENTITYNUM_NONE;
01055 pml.groundPlane = qfalse;
01056 pml.walking = qfalse;
01057
01058 return qfalse;
01059 }
|
Here is the call graph for this function:

|
|
Definition at line 924 of file bg_pmove.c. References a, b, playerState_s::bobCycle, c, den, EV_FALL_FAR, EV_FALL_MEDIUM, EV_FALL_SHORT, playerState_s::gravity, pml_t::groundTrace, LEGS_LAND, LEGS_LANDB, playerState_s::legsTimer, playerState_s::origin, pm, PM_AddEvent(), playerState_s::pm_flags, PM_FootstepForSurface(), PM_ForceLegsAnim(), pml, pml_t::previous_origin, pml_t::previous_velocity, pmove_t::ps, sqrt(), playerState_s::stats, trace_t::surfaceFlags, t, and pmove_t::waterlevel. Referenced by PM_GroundTrace(). 00924 {
00925 float delta;
00926 float dist;
00927 float vel, acc;
00928 float t;
00929 float a, b, c, den;
00930
00931 // decide which landing animation to use
00932 if ( pm->ps->pm_flags & PMF_BACKWARDS_JUMP ) {
00933 PM_ForceLegsAnim( LEGS_LANDB );
00934 } else {
00935 PM_ForceLegsAnim( LEGS_LAND );
00936 }
00937
00938 pm->ps->legsTimer = TIMER_LAND;
00939
00940 // calculate the exact velocity on landing
00941 dist = pm->ps->origin[2] - pml.previous_origin[2];
00942 vel = pml.previous_velocity[2];
00943 acc = -pm->ps->gravity;
00944
00945 a = acc / 2;
00946 b = vel;
00947 c = -dist;
00948
00949 den = b * b - 4 * a * c;
00950 if ( den < 0 ) {
00951 return;
00952 }
00953 t = (-b - sqrt( den ) ) / ( 2 * a );
00954
00955 delta = vel + t * acc;
00956 delta = delta*delta * 0.0001;
00957
00958 // ducking while falling doubles damage
00959 if ( pm->ps->pm_flags & PMF_DUCKED ) {
00960 delta *= 2;
00961 }
00962
00963 // never take falling damage if completely underwater
00964 if ( pm->waterlevel == 3 ) {
00965 return;
00966 }
00967
00968 // reduce falling damage if there is standing water
00969 if ( pm->waterlevel == 2 ) {
00970 delta *= 0.25;
00971 }
00972 if ( pm->waterlevel == 1 ) {
00973 delta *= 0.5;
00974 }
00975
00976 if ( delta < 1 ) {
00977 return;
00978 }
00979
00980 // create a local entity event to play the sound
00981
00982 // SURF_NODAMAGE is used for bounce pads where you don't ever
00983 // want to take damage or play a crunch sound
00984 if ( !(pml.groundTrace.surfaceFlags & SURF_NODAMAGE) ) {
00985 if ( delta > 60 ) {
00986 PM_AddEvent( EV_FALL_FAR );
00987 } else if ( delta > 40 ) {
00988 // this is a pain grunt, so don't play it if dead
00989 if ( pm->ps->stats[STAT_HEALTH] > 0 ) {
00990 PM_AddEvent( EV_FALL_MEDIUM );
00991 }
00992 } else if ( delta > 7 ) {
00993 PM_AddEvent( EV_FALL_SHORT );
00994 } else {
00995 PM_AddEvent( PM_FootstepForSurface() );
00996 }
00997 }
00998
00999 // start footstep cycle over
01000 pm->ps->bobCycle = 0;
01001 }
|
Here is the call graph for this function:

|
|
Definition at line 817 of file bg_pmove.c. References pm, pml, pmove_t::ps, VectorClear, VectorLength(), VectorNormalize(), VectorScale, playerState_s::velocity, and pml_t::walking. Referenced by PmoveSingle(). 00817 {
00818 float forward;
00819
00820 if ( !pml.walking ) {
00821 return;
00822 }
00823
00824 // extra friction
00825
00826 forward = VectorLength (pm->ps->velocity);
00827 forward -= 20;
00828 if ( forward <= 0 ) {
00829 VectorClear (pm->ps->velocity);
00830 } else {
00831 VectorNormalize (pm->ps->velocity);
00832 VectorScale (pm->ps->velocity, forward, pm->ps->velocity);
00833 }
00834 }
|
Here is the call graph for this function:

|
|
Definition at line 1762 of file bg_pmove.c. References playerState_s::legsTimer, pml_t::msec, pm, playerState_s::pm_flags, playerState_s::pm_time, pml, pmove_t::ps, and playerState_s::torsoTimer. Referenced by PmoveSingle(). 01762 {
01763 // drop misc timing counter
01764 if ( pm->ps->pm_time ) {
01765 if ( pml.msec >= pm->ps->pm_time ) {
01766 pm->ps->pm_flags &= ~PMF_ALL_TIMES;
01767 pm->ps->pm_time = 0;
01768 } else {
01769 pm->ps->pm_time -= pml.msec;
01770 }
01771 }
01772
01773 // drop animation counter
01774 if ( pm->ps->legsTimer > 0 ) {
01775 pm->ps->legsTimer -= pml.msec;
01776 if ( pm->ps->legsTimer < 0 ) {
01777 pm->ps->legsTimer = 0;
01778 }
01779 }
01780
01781 if ( pm->ps->torsoTimer > 0 ) {
01782 pm->ps->torsoTimer -= pml.msec;
01783 if ( pm->ps->torsoTimer < 0 ) {
01784 pm->ps->torsoTimer = 0;
01785 }
01786 }
01787 }
|
|
|
Definition at line 1494 of file bg_pmove.c. References pmove_t::cmd, pm, PM_StartTorsoAnim(), pmove_t::ps, playerState_s::stats, TORSO_RAISE, playerState_s::weapon, usercmd_s::weapon, playerState_s::weaponstate, and playerState_s::weaponTime. Referenced by PM_Weapon(). 01494 {
01495 int weapon;
01496
01497 weapon = pm->cmd.weapon;
01498 if ( weapon < WP_NONE || weapon >= WP_NUM_WEAPONS ) {
01499 weapon = WP_NONE;
01500 }
01501
01502 if ( !( pm->ps->stats[STAT_WEAPONS] & ( 1 << weapon ) ) ) {
01503 weapon = WP_NONE;
01504 }
01505
01506 pm->ps->weapon = weapon;
01507 pm->ps->weaponstate = WEAPON_RAISING;
01508 pm->ps->weaponTime += 250;
01509 PM_StartTorsoAnim( TORSO_RAISE );
01510 }
|
Here is the call graph for this function:

|
|
Definition at line 560 of file bg_pmove.c. References pmove_t::cmd, pml_t::forward, usercmd_s::forwardmove, i, pm, PM_Accelerate(), PM_CmdScale(), pm_flyaccelerate, PM_Friction(), PM_StepSlideMove(), pml, qfalse, pml_t::right, usercmd_s::rightmove, usercmd_s::upmove, vec3_t, VectorCopy, and VectorNormalize(). Referenced by PmoveSingle(). 00560 {
00561 int i;
00562 vec3_t wishvel;
00563 float wishspeed;
00564 vec3_t wishdir;
00565 float scale;
00566
00567 // normal slowdown
00568 PM_Friction ();
00569
00570 scale = PM_CmdScale( &pm->cmd );
00571 //
00572 // user intentions
00573 //
00574 if ( !scale ) {
00575 wishvel[0] = 0;
00576 wishvel[1] = 0;
00577 wishvel[2] = 0;
00578 } else {
00579 for (i=0 ; i<3 ; i++) {
00580 wishvel[i] = scale * pml.forward[i]*pm->cmd.forwardmove + scale * pml.right[i]*pm->cmd.rightmove;
00581 }
00582
00583 wishvel[2] += scale * pm->cmd.upmove;
00584 }
00585
00586 VectorCopy (wishvel, wishdir);
00587 wishspeed = VectorNormalize(wishdir);
00588
00589 PM_Accelerate (wishdir, wishspeed, pm_flyaccelerate);
00590
00591 PM_StepSlideMove( qfalse );
00592 }
|
Here is the call graph for this function:

|
|
Definition at line 906 of file bg_pmove.c. References pml_t::groundTrace, pml, and trace_t::surfaceFlags. Referenced by PM_CrashLand(), and PM_Footsteps(). 00906 {
00907 if ( pml.groundTrace.surfaceFlags & SURF_NOSTEPS ) {
00908 return 0;
00909 }
00910 if ( pml.groundTrace.surfaceFlags & SURF_METALSTEPS ) {
00911 return EV_FOOTSTEP_METAL;
00912 }
00913 return EV_FOOTSTEP;
00914 }
|
|
|
Definition at line 1322 of file bg_pmove.c. References playerState_s::bobCycle, usercmd_s::buttons, pmove_t::cmd, EV_FOOTSPLASH, EV_SWIM, usercmd_s::forwardmove, playerState_s::groundEntityNum, LEGS_BACK, LEGS_BACKCR, LEGS_BACKWALK, LEGS_IDLE, LEGS_IDLECR, LEGS_RUN, LEGS_SWIM, LEGS_WALK, LEGS_WALKCR, pml_t::msec, pmove_t::noFootsteps, pm, PM_AddEvent(), PM_ContinueLegsAnim(), playerState_s::pm_flags, PM_FootstepForSurface(), pml, playerState_s::powerups, pmove_t::ps, qboolean, usercmd_s::rightmove, sqrt(), playerState_s::velocity, pmove_t::waterlevel, and pmove_t::xyspeed. Referenced by PmoveSingle(). 01322 {
01323 float bobmove;
01324 int old;
01325 qboolean footstep;
01326
01327 //
01328 // calculate speed and cycle to be used for
01329 // all cyclic walking effects
01330 //
01331 pm->xyspeed = sqrt( pm->ps->velocity[0] * pm->ps->velocity[0]
01332 + pm->ps->velocity[1] * pm->ps->velocity[1] );
01333
01334 if ( pm->ps->groundEntityNum == ENTITYNUM_NONE ) {
01335
01336 if ( pm->ps->powerups[PW_INVULNERABILITY] ) {
01337 PM_ContinueLegsAnim( LEGS_IDLECR );
01338 }
01339 // airborne leaves position in cycle intact, but doesn't advance
01340 if ( pm->waterlevel > 1 ) {
01341 PM_ContinueLegsAnim( LEGS_SWIM );
01342 }
01343 return;
01344 }
01345
01346 // if not trying to move
01347 if ( !pm->cmd.forwardmove && !pm->cmd.rightmove ) {
01348 if ( pm->xyspeed < 5 ) {
01349 pm->ps->bobCycle = 0; // start at beginning of cycle again
01350 if ( pm->ps->pm_flags & PMF_DUCKED ) {
01351 PM_ContinueLegsAnim( LEGS_IDLECR );
01352 } else {
01353 PM_ContinueLegsAnim( LEGS_IDLE );
01354 }
01355 }
01356 return;
01357 }
01358
01359
01360 footstep = qfalse;
01361
01362 if ( pm->ps->pm_flags & PMF_DUCKED ) {
01363 bobmove = 0.5; // ducked characters bob much faster
01364 if ( pm->ps->pm_flags & PMF_BACKWARDS_RUN ) {
01365 PM_ContinueLegsAnim( LEGS_BACKCR );
01366 }
01367 else {
01368 PM_ContinueLegsAnim( LEGS_WALKCR );
01369 }
01370 // ducked characters never play footsteps
01371 /*
01372 } else if ( pm->ps->pm_flags & PMF_BACKWARDS_RUN ) {
01373 if ( !( pm->cmd.buttons & BUTTON_WALKING ) ) {
01374 bobmove = 0.4; // faster speeds bob faster
01375 footstep = qtrue;
01376 } else {
01377 bobmove = 0.3;
01378 }
01379 PM_ContinueLegsAnim( LEGS_BACK );
01380 */
01381 } else {
01382 if ( !( pm->cmd.buttons & BUTTON_WALKING ) ) {
01383 bobmove = 0.4f; // faster speeds bob faster
01384 if ( pm->ps->pm_flags & PMF_BACKWARDS_RUN ) {
01385 PM_ContinueLegsAnim( LEGS_BACK );
01386 }
01387 else {
01388 PM_ContinueLegsAnim( LEGS_RUN );
01389 }
01390 footstep = qtrue;
01391 } else {
01392 bobmove = 0.3f; // walking bobs slow
01393 if ( pm->ps->pm_flags & PMF_BACKWARDS_RUN ) {
01394 PM_ContinueLegsAnim( LEGS_BACKWALK );
01395 }
01396 else {
01397 PM_ContinueLegsAnim( LEGS_WALK );
01398 }
01399 }
01400 }
01401
01402 // check for footstep / splash sounds
01403 old = pm->ps->bobCycle;
01404 pm->ps->bobCycle = (int)( old + bobmove * pml.msec ) & 255;
01405
01406 // if we just crossed a cycle boundary, play an apropriate footstep event
01407 if ( ( ( old + 64 ) ^ ( pm->ps->bobCycle + 64 ) ) & 128 ) {
01408 if ( pm->waterlevel == 0 ) {
01409 // on ground will only play sounds if running
01410 if ( footstep && !pm->noFootsteps ) {
01411 PM_AddEvent( PM_FootstepForSurface() );
01412 }
01413 } else if ( pm->waterlevel == 1 ) {
01414 // splashing
01415 PM_AddEvent( EV_FOOTSPLASH );
01416 } else if ( pm->waterlevel == 2 ) {
01417 // wading / swimming at surface
01418 PM_AddEvent( EV_SWIM );
01419 } else if ( pm->waterlevel == 3 ) {
01420 // no sound when completely underwater
01421
01422 }
01423 }
01424 }
|
Here is the call graph for this function:

|
|
Definition at line 132 of file bg_pmove.c. References playerState_s::legsTimer, pm, PM_StartLegsAnim(), and pmove_t::ps. Referenced by PM_CheckJump(), PM_CrashLand(), PM_GroundTrace(), and PM_GroundTraceMissed(). 00132 {
00133 pm->ps->legsTimer = 0;
00134 PM_StartLegsAnim( anim );
00135 }
|
Here is the call graph for this function:

|
|
Definition at line 172 of file bg_pmove.c. References control(), pml_t::frametime, pml_t::groundTrace, pm, playerState_s::pm_flags, pm_flightfriction, pm_friction, pm_spectatorfriction, pm_stopspeed, playerState_s::pm_type, pm_waterfriction, pml, playerState_s::powerups, pmove_t::ps, trace_t::surfaceFlags, vec3_t, VectorCopy, VectorLength(), playerState_s::velocity, pml_t::walking, and pmove_t::waterlevel. Referenced by PM_AirMove(), PM_FlyMove(), PM_WalkMove(), and PM_WaterMove(). 00172 {
00173 vec3_t vec;
00174 float *vel;
00175 float speed, newspeed, control;
00176 float drop;
00177
00178 vel = pm->ps->velocity;
00179
00180 VectorCopy( vel, vec );
00181 if ( pml.walking ) {
00182 vec[2] = 0; // ignore slope movement
00183 }
00184
00185 speed = VectorLength(vec);
00186 if (speed < 1) {
00187 vel[0] = 0;
00188 vel[1] = 0; // allow sinking underwater
00189 // FIXME: still have z friction underwater?
00190 return;
00191 }
00192
00193 drop = 0;
00194
00195 // apply ground friction
00196 if ( pm->waterlevel <= 1 ) {
00197 if ( pml.walking && !(pml.groundTrace.surfaceFlags & SURF_SLICK) ) {
00198 // if getting knocked back, no friction
00199 if ( ! (pm->ps->pm_flags & PMF_TIME_KNOCKBACK) ) {
00200 control = speed < pm_stopspeed ? pm_stopspeed : speed;
00201 drop += control*pm_friction*pml.frametime;
00202 }
00203 }
00204 }
00205
00206 // apply water friction even if just wading
00207 if ( pm->waterlevel ) {
00208 drop += speed*pm_waterfriction*pm->waterlevel*pml.frametime;
00209 }
00210
00211 // apply flying friction
00212 if ( pm->ps->powerups[PW_FLIGHT]) {
00213 drop += speed*pm_flightfriction*pml.frametime;
00214 }
00215
00216 if ( pm->ps->pm_type == PM_SPECTATOR) {
00217 drop += speed*pm_spectatorfriction*pml.frametime;
00218 }
00219
00220 // scale the velocity
00221 newspeed = speed - drop;
00222 if (newspeed < 0) {
00223 newspeed = 0;
00224 }
00225 newspeed /= speed;
00226
00227 vel[0] = vel[0] * newspeed;
00228 vel[1] = vel[1] * newspeed;
00229 vel[2] = vel[2] * newspeed;
00230 }
|
Here is the call graph for this function:

|
|
Definition at line 666 of file bg_pmove.c. References pml_t::forward, playerState_s::grapplePoint, pml_t::groundPlane, playerState_s::origin, pm, pml, pmove_t::ps, v, vec3_t, VectorAdd, VectorCopy, VectorLength(), VectorNormalize(), VectorScale, VectorSubtract, and playerState_s::velocity. Referenced by PmoveSingle(). 00666 {
00667 vec3_t vel, v;
00668 float vlen;
00669
00670 VectorScale(pml.forward, -16, v);
00671 VectorAdd(pm->ps->grapplePoint, v, v);
00672 VectorSubtract(v, pm->ps->origin, vel);
00673 vlen = VectorLength(vel);
00674 VectorNormalize( vel );
00675
00676 if (vlen <= 100)
00677 VectorScale(vel, 10 * vlen, vel);
00678 else
00679 VectorScale(vel, 800, vel);
00680
00681 VectorCopy(vel, pm->ps->velocity);
00682
00683 pml.groundPlane = qfalse;
00684 }
|
Here is the call graph for this function:

|
|
Definition at line 1107 of file bg_pmove.c. References trace_t::allsolid, c_pmove, playerState_s::clientNum, pmove_t::cmd, Com_Printf(), pmove_t::debugLevel, DotProduct, trace_t::entityNum, usercmd_s::forwardmove, trace_t::fraction, playerState_s::groundEntityNum, pml_t::groundPlane, pml_t::groundTrace, LEGS_JUMP, LEGS_JUMPB, pmove_t::maxs, pmove_t::mins, cplane_s::normal, playerState_s::origin, trace_t::plane, pm, PM_AddTouchEnt(), PM_CorrectAllSolid(), PM_CrashLand(), playerState_s::pm_flags, PM_ForceLegsAnim(), PM_GroundTraceMissed(), playerState_s::pm_time, PMF_TIME_WATERJUMP, pml, point, pml_t::previous_velocity, pmove_t::ps, pmove_t::trace, pmove_t::tracemask, vec3_t, playerState_s::velocity, and pml_t::walking. Referenced by PmoveSingle(). 01107 {
01108 vec3_t point;
01109 trace_t trace;
01110
01111 point[0] = pm->ps->origin[0];
01112 point[1] = pm->ps->origin[1];
01113 point[2] = pm->ps->origin[2] - 0.25;
01114
01115 pm->trace (&trace, pm->ps->origin, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask);
01116 pml.groundTrace = trace;
01117
01118 // do something corrective if the trace starts in a solid...
01119 if ( trace.allsolid ) {
01120 if ( !PM_CorrectAllSolid(&trace) )
01121 return;
01122 }
01123
01124 // if the trace didn't hit anything, we are in free fall
01125 if ( trace.fraction == 1.0 ) {
01126 PM_GroundTraceMissed();
01127 pml.groundPlane = qfalse;
01128 pml.walking = qfalse;
01129 return;
01130 }
01131
01132 // check if getting thrown off the ground
01133 if ( pm->ps->velocity[2] > 0 && DotProduct( pm->ps->velocity, trace.plane.normal ) > 10 ) {
01134 if ( pm->debugLevel ) {
01135 Com_Printf("%i:kickoff\n", c_pmove);
01136 }
01137 // go into jump animation
01138 if ( pm->cmd.forwardmove >= 0 ) {
01139 PM_ForceLegsAnim( LEGS_JUMP );
01140 pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
01141 } else {
01142 PM_ForceLegsAnim( LEGS_JUMPB );
01143 pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
01144 }
01145
01146 pm->ps->groundEntityNum = ENTITYNUM_NONE;
01147 pml.groundPlane = qfalse;
01148 pml.walking = qfalse;
01149 return;
01150 }
01151
01152 // slopes that are too steep will not be considered onground
01153 if ( trace.plane.normal[2] < MIN_WALK_NORMAL ) {
01154 if ( pm->debugLevel ) {
01155 Com_Printf("%i:steep\n", c_pmove);
01156 }
01157 // FIXME: if they can't slide down the slope, let them
01158 // walk (sharp crevices)
01159 pm->ps->groundEntityNum = ENTITYNUM_NONE;
01160 pml.groundPlane = qtrue;
01161 pml.walking = qfalse;
01162 return;
01163 }
01164
01165 pml.groundPlane = qtrue;
01166 pml.walking = qtrue;
01167
01168 // hitting solid ground will end a waterjump
01169 if (pm->ps->pm_flags & PMF_TIME_WATERJUMP)
01170 {
01171 pm->ps->pm_flags &= ~(PMF_TIME_WATERJUMP | PMF_TIME_LAND);
01172 pm->ps->pm_time = 0;
01173 }
01174
01175 if ( pm->ps->groundEntityNum == ENTITYNUM_NONE ) {
01176 // just hit the ground
01177 if ( pm->debugLevel ) {
01178 Com_Printf("%i:Land\n", c_pmove);
01179 }
01180
01181 PM_CrashLand();
01182
01183 // don't do landing time if we were just going down a slope
01184 if ( pml.previous_velocity[2] < -200 ) {
01185 // don't allow another jump for a little while
01186 pm->ps->pm_flags |= PMF_TIME_LAND;
01187 pm->ps->pm_time = 250;
01188 }
01189 }
01190
01191 pm->ps->groundEntityNum = trace.entityNum;
01192
01193 // don't reset the z velocity for slopes
01194 // pm->ps->velocity[2] = 0;
01195
01196 PM_AddTouchEnt( trace.entityNum );
01197 }
|
Here is the call graph for this function:

|
|
Definition at line 1069 of file bg_pmove.c. References c_pmove, playerState_s::clientNum, pmove_t::cmd, Com_Printf(), pmove_t::debugLevel, usercmd_s::forwardmove, trace_t::fraction, playerState_s::groundEntityNum, pml_t::groundPlane, LEGS_JUMP, LEGS_JUMPB, pmove_t::maxs, pmove_t::mins, playerState_s::origin, pm, playerState_s::pm_flags, PM_ForceLegsAnim(), pml, point, pmove_t::ps, pmove_t::trace, pmove_t::tracemask, vec3_t, VectorCopy, and pml_t::walking. Referenced by PM_GroundTrace(). 01069 {
01070 trace_t trace;
01071 vec3_t point;
01072
01073 if ( pm->ps->groundEntityNum != ENTITYNUM_NONE ) {
01074 // we just transitioned into freefall
01075 if ( pm->debugLevel ) {
01076 Com_Printf("%i:lift\n", c_pmove);
01077 }
01078
01079 // if they aren't in a jumping animation and the ground is a ways away, force into it
01080 // if we didn't do the trace, the player would be backflipping down staircases
01081 VectorCopy( pm->ps->origin, point );
01082 point[2] -= 64;
01083
01084 pm->trace (&trace, pm->ps->origin, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask);
01085 if ( trace.fraction == 1.0 ) {
01086 if ( pm->cmd.forwardmove >= 0 ) {
01087 PM_ForceLegsAnim( LEGS_JUMP );
01088 pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
01089 } else {
01090 PM_ForceLegsAnim( LEGS_JUMPB );
01091 pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
01092 }
01093 }
01094 }
01095
01096 pm->ps->groundEntityNum = ENTITYNUM_NONE;
01097 pml.groundPlane = qfalse;
01098 pml.walking = qfalse;
01099 }
|
Here is the call graph for this function:

|
|
Definition at line 842 of file bg_pmove.c. References pmove_t::cmd, control(), pml_t::forward, usercmd_s::forwardmove, pml_t::frametime, i, playerState_s::origin, pm, pm_accelerate, PM_Accelerate(), PM_CmdScale(), pm_friction, pm_stopspeed, pml, pmove_t::ps, pml_t::right, usercmd_s::rightmove, usercmd_s::upmove, vec3_origin, vec3_t, VectorCopy, VectorLength(), VectorMA, VectorNormalize(), VectorScale, playerState_s::velocity, and playerState_s::viewheight. Referenced by PmoveSingle(). 00842 {
00843 float speed, drop, friction, control, newspeed;
00844 int i;
00845 vec3_t wishvel;
00846 float fmove, smove;
00847 vec3_t wishdir;
00848 float wishspeed;
00849 float scale;
00850
00851 pm->ps->viewheight = DEFAULT_VIEWHEIGHT;
00852
00853 // friction
00854
00855 speed = VectorLength (pm->ps->velocity);
00856 if (speed < 1)
00857 {
00858 VectorCopy (vec3_origin, pm->ps->velocity);
00859 }
00860 else
00861 {
00862 drop = 0;
00863
00864 friction = pm_friction*1.5; // extra friction
00865 control = speed < pm_stopspeed ? pm_stopspeed : speed;
00866 drop += control*friction*pml.frametime;
00867
00868 // scale the velocity
00869 newspeed = speed - drop;
00870 if (newspeed < 0)
00871 newspeed = 0;
00872 newspeed /= speed;
00873
00874 VectorScale (pm->ps->velocity, newspeed, pm->ps->velocity);
00875 }
00876
00877 // accelerate
00878 scale = PM_CmdScale( &pm->cmd );
00879
00880 fmove = pm->cmd.forwardmove;
00881 smove = pm->cmd.rightmove;
00882
00883 for (i=0 ; i<3 ; i++)
00884 wishvel[i] = pml.forward[i]*fmove + pml.right[i]*smove;
00885 wishvel[2] += pm->cmd.upmove;
00886
00887 VectorCopy (wishvel, wishdir);
00888 wishspeed = VectorNormalize(wishdir);
00889 wishspeed *= scale;
00890
00891 PM_Accelerate( wishdir, wishspeed, pm_accelerate );
00892
00893 // move
00894 VectorMA (pm->ps->origin, pml.frametime, pm->ps->velocity, pm->ps->origin);
00895 }
|
Here is the call graph for this function:

|
|
Definition at line 322 of file bg_pmove.c. References pmove_t::cmd, usercmd_s::forwardmove, playerState_s::movementDir, pm, pmove_t::ps, and usercmd_s::rightmove. Referenced by PM_AirMove(), and PM_WalkMove(). 00322 {
00323 if ( pm->cmd.forwardmove || pm->cmd.rightmove ) {
00324 if ( pm->cmd.rightmove == 0 && pm->cmd.forwardmove > 0 ) {
00325 pm->ps->movementDir = 0;
00326 } else if ( pm->cmd.rightmove < 0 && pm->cmd.forwardmove > 0 ) {
00327 pm->ps->movementDir = 1;
00328 } else if ( pm->cmd.rightmove < 0 && pm->cmd.forwardmove == 0 ) {
00329 pm->ps->movementDir = 2;
00330 } else if ( pm->cmd.rightmove < 0 && pm->cmd.forwardmove < 0 ) {
00331 pm->ps->movementDir = 3;
00332 } else if ( pm->cmd.rightmove == 0 && pm->cmd.forwardmove < 0 ) {
00333 pm->ps->movementDir = 4;
00334 } else if ( pm->cmd.rightmove > 0 && pm->cmd.forwardmove < 0 ) {
00335 pm->ps->movementDir = 5;
00336 } else if ( pm->cmd.rightmove > 0 && pm->cmd.forwardmove == 0 ) {
00337 pm->ps->movementDir = 6;
00338 } else if ( pm->cmd.rightmove > 0 && pm->cmd.forwardmove > 0 ) {
00339 pm->ps->movementDir = 7;
00340 }
00341 } else {
00342 // if they aren't actively going directly sideways,
00343 // change the animation to the diagonal so they
00344 // don't stop too crooked
00345 if ( pm->ps->movementDir == 2 ) {
00346 pm->ps->movementDir = 1;
00347 } else if ( pm->ps->movementDir == 6 ) {
00348 pm->ps->movementDir = 7;
00349 }
00350 }
00351 }
|
|
|
Definition at line 1205 of file bg_pmove.c. References playerState_s::clientNum, MINS_Z, playerState_s::origin, pm, point, pmove_t::pointcontents, pmove_t::ps, vec3_t, playerState_s::viewheight, pmove_t::waterlevel, and pmove_t::watertype. Referenced by PmoveSingle(). 01205 {
01206 vec3_t point;
01207 int cont;
01208 int sample1;
01209 int sample2;
01210
01211 //
01212 // get waterlevel, accounting for ducking
01213 //
01214 pm->waterlevel = 0;
01215 pm->watertype = 0;
01216
01217 point[0] = pm->ps->origin[0];
01218 point[1] = pm->ps->origin[1];
01219 point[2] = pm->ps->origin[2] + MINS_Z + 1;
01220 cont = pm->pointcontents( point, pm->ps->clientNum );
01221
01222 if ( cont & MASK_WATER ) {
01223 sample2 = pm->ps->viewheight - MINS_Z;
01224 sample1 = sample2 / 2;
01225
01226 pm->watertype = cont;
01227 pm->waterlevel = 1;
01228 point[2] = pm->ps->origin[2] + MINS_Z + sample1;
01229 cont = pm->pointcontents (point, pm->ps->clientNum );
01230 if ( cont & MASK_WATER ) {
01231 pm->waterlevel = 2;
01232 point[2] = pm->ps->origin[2] + MINS_Z + sample2;
01233 cont = pm->pointcontents (point, pm->ps->clientNum );
01234 if ( cont & MASK_WATER ){
01235 pm->waterlevel = 3;
01236 }
01237 }
01238 }
01239
01240 }
|
|
|
Definition at line 101 of file bg_pmove.c. References playerState_s::legsAnim, playerState_s::legsTimer, pm, playerState_s::pm_type, and pmove_t::ps. Referenced by PM_ContinueLegsAnim(), and PM_ForceLegsAnim(). 00101 {
00102 if ( pm->ps->pm_type >= PM_DEAD ) {
00103 return;
00104 }
00105 if ( pm->ps->legsTimer > 0 ) {
00106 return; // a high priority animation is running
00107 }
00108 pm->ps->legsAnim = ( ( pm->ps->legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT )
00109 | anim;
00110 }
|
|
|
Definition at line 94 of file bg_pmove.c. References pm, playerState_s::pm_type, pmove_t::ps, and playerState_s::torsoAnim. Referenced by PM_Animate(), PM_BeginWeaponChange(), PM_ContinueTorsoAnim(), PM_FinishWeaponChange(), and PM_Weapon(). 00094 {
00095 if ( pm->ps->pm_type >= PM_DEAD ) {
00096 return;
00097 }
00098 pm->ps->torsoAnim = ( ( pm->ps->torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT )
00099 | anim;
00100 }
|
|
|
Definition at line 1519 of file bg_pmove.c. References pm, PM_ContinueTorsoAnim(), pmove_t::ps, TORSO_STAND, TORSO_STAND2, playerState_s::weapon, and playerState_s::weaponstate. Referenced by PmoveSingle(). 01519 {
01520 if ( pm->ps->weaponstate == WEAPON_READY ) {
01521 if ( pm->ps->weapon == WP_GAUNTLET ) {
01522 PM_ContinueTorsoAnim( TORSO_STAND2 );
01523 } else {
01524 PM_ContinueTorsoAnim( TORSO_STAND );
01525 }
01526 return;
01527 }
01528 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1797 of file bg_pmove.c. References usercmd_s::angles, playerState_s::delta_angles, i, playerState_t, PM_INTERMISSION, PM_SPECTATOR, playerState_s::pm_type, SHORT2ANGLE, playerState_s::stats, usercmd_t, and playerState_s::viewangles. Referenced by CG_InterpolatePlayerState(), CG_PredictPlayerState(), and PmoveSingle(). 01797 {
01798 short temp;
01799 int i;
01800
01801 if ( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPINTERMISSION) {
01802 return; // no view changes at all
01803 }
01804
01805 if ( ps->pm_type != PM_SPECTATOR && ps->stats[STAT_HEALTH] <= 0 ) {
01806 return; // no view changes at all
01807 }
01808
01809 // circularly clamp the angles with deltas
01810 for (i=0 ; i<3 ; i++) {
01811 temp = cmd->angles[i] + ps->delta_angles[i];
01812 if ( i == PITCH ) {
01813 // don't let the player look up or down more than 90 degrees
01814 if ( temp > 16000 ) {
01815 ps->delta_angles[i] = 16000 - cmd->angles[i];
01816 temp = 16000;
01817 } else if ( temp < -16000 ) {
01818 ps->delta_angles[i] = -16000 - cmd->angles[i];
01819 temp = -16000;
01820 }
01821 }
01822 ps->viewangles[i] = SHORT2ANGLE(temp);
01823 }
01824
01825 }
|
|
|
Definition at line 692 of file bg_pmove.c. References pmove_t::cmd, DotProduct, pml_t::forward, usercmd_s::forwardmove, pml_t::frametime, playerState_s::gravity, pml_t::groundTrace, i, cplane_s::normal, OVERCLIP, trace_t::plane, pm, PM_Accelerate(), PM_AirMove(), PM_CheckJump(), PM_ClipVelocity(), PM_CmdScale(), playerState_s::pm_flags, PM_Friction(), PM_SetMovementDir(), PM_StepSlideMove(), PM_WaterMove(), pml, pmove_t::ps, qfalse, pml_t::right, usercmd_s::rightmove, playerState_s::speed, trace_t::surfaceFlags, usercmd_t, vec3_t, VectorCopy, VectorLength(), VectorNormalize(), VectorScale, playerState_s::velocity, and pmove_t::waterlevel. Referenced by PmoveSingle(). 00692 {
00693 int i;
00694 vec3_t wishvel;
00695 float fmove, smove;
00696 vec3_t wishdir;
00697 float wishspeed;
00698 float scale;
00699 usercmd_t cmd;
00700 float accelerate;
00701 float vel;
00702
00703 if ( pm->waterlevel > 2 && DotProduct( pml.forward, pml.groundTrace.plane.normal ) > 0 ) {
00704 // begin swimming
00705 PM_WaterMove();
00706 return;
00707 }
00708
00709
00710 if ( PM_CheckJump () ) {
00711 // jumped away
00712 if ( pm->waterlevel > 1 ) {
00713 PM_WaterMove();
00714 } else {
00715 PM_AirMove();
00716 }
00717 return;
00718 }
00719
00720 PM_Friction ();
00721
00722 fmove = pm->cmd.forwardmove;
00723 smove = pm->cmd.rightmove;
00724
00725 cmd = pm->cmd;
00726 scale = PM_CmdScale( &cmd );
00727
00728 // set the movementDir so clients can rotate the legs for strafing
00729 PM_SetMovementDir();
00730
00731 // project moves down to flat plane
00732 pml.forward[2] = 0;
00733 pml.right[2] = 0;
00734
00735 // project the forward and right directions onto the ground plane
00736 PM_ClipVelocity (pml.forward, pml.groundTrace.plane.normal, pml.forward, OVERCLIP );
00737 PM_ClipVelocity (pml.right, pml.groundTrace.plane.normal, pml.right, OVERCLIP );
00738 //
00739 VectorNormalize (pml.forward);
00740 VectorNormalize (pml.right);
00741
00742 for ( i = 0 ; i < 3 ; i++ ) {
00743 wishvel[i] = pml.forward[i]*fmove + pml.right[i]*smove;
00744 }
00745 // when going up or down slopes the wish velocity should Not be zero
00746 // wishvel[2] = 0;
00747
00748 VectorCopy (wishvel, wishdir);
00749 wishspeed = VectorNormalize(wishdir);
00750 wishspeed *= scale;
00751
00752 // clamp the speed lower if ducking
00753 if ( pm->ps->pm_flags & PMF_DUCKED ) {
00754 if ( wishspeed > pm->ps->speed * pm_duckScale ) {
00755 wishspeed = pm->ps->speed * pm_duckScale;
00756 }
00757 }
00758
00759 // clamp the speed lower if wading or walking on the bottom
00760 if ( pm->waterlevel ) {
00761 float waterScale;
00762
00763 waterScale = pm->waterlevel / 3.0;
00764 waterScale = 1.0 - ( 1.0 - pm_swimScale ) * waterScale;
00765 if ( wishspeed > pm->ps->speed * waterScale ) {
00766 wishspeed = pm->ps->speed * waterScale;
00767 }
00768 }
00769
00770 // when a player gets hit, they temporarily lose
00771 // full control, which allows them to be moved a bit
00772 if ( ( pml.groundTrace.surfaceFlags & SURF_SLICK ) || pm->ps->pm_flags & PMF_TIME_KNOCKBACK ) {
00773 accelerate = pm_airaccelerate;
00774 } else {
00775 accelerate = pm_accelerate;
00776 }
00777
00778 PM_Accelerate (wishdir, wishspeed, accelerate);
00779
00780 //Com_Printf("velocity = %1.1f %1.1f %1.1f\n", pm->ps->velocity[0], pm->ps->velocity[1], pm->ps->velocity[2]);
00781 //Com_Printf("velocity1 = %1.1f\n", VectorLength(pm->ps->velocity));
00782
00783 if ( ( pml.groundTrace.surfaceFlags & SURF_SLICK ) || pm->ps->pm_flags & PMF_TIME_KNOCKBACK ) {
00784 pm->ps->velocity[2] -= pm->ps->gravity * pml.frametime;
00785 } else {
00786 // don't reset the z velocity for slopes
00787 // pm->ps->velocity[2] = 0;
00788 }
00789
00790 vel = VectorLength(pm->ps->velocity);
00791
00792 // slide along the ground plane
00793 PM_ClipVelocity (pm->ps->velocity, pml.groundTrace.plane.normal,
00794 pm->ps->velocity, OVERCLIP );
00795
00796 // don't decrease velocity when going up or down a slope
00797 VectorNormalize(pm->ps->velocity);
00798 VectorScale(pm->ps->velocity, vel, pm->ps->velocity);
00799
00800 // don't do anything if standing still
00801 if (!pm->ps->velocity[0] && !pm->ps->velocity[1]) {
00802 return;
00803 }
00804
00805 PM_StepSlideMove( qfalse );
00806
00807 //Com_Printf("velocity2 = %1.1f\n", VectorLength(pm->ps->velocity));
00808
00809 }
|
Here is the call graph for this function:

|
|
Definition at line 1433 of file bg_pmove.c. References EV_WATER_CLEAR, EV_WATER_LEAVE, EV_WATER_TOUCH, EV_WATER_UNDER, pm, PM_AddEvent(), pml, pml_t::previous_waterlevel, and pmove_t::waterlevel. Referenced by PmoveSingle(). 01433 { // FIXME?
01434 //
01435 // if just entered a water volume, play a sound
01436 //
01437 if (!pml.previous_waterlevel && pm->waterlevel) {
01438 PM_AddEvent( EV_WATER_TOUCH );
01439 }
01440
01441 //
01442 // if just completely exited a water volume, play a sound
01443 //
01444 if (pml.previous_waterlevel && !pm->waterlevel) {
01445 PM_AddEvent( EV_WATER_LEAVE );
01446 }
01447
01448 //
01449 // check for head just going under water
01450 //
01451 if (pml.previous_waterlevel != 3 && pm->waterlevel == 3) {
01452 PM_AddEvent( EV_WATER_UNDER );
01453 }
01454
01455 //
01456 // check for head just coming out of water
01457 //
01458 if (pml.previous_waterlevel == 3 && pm->waterlevel != 3) {
01459 PM_AddEvent( EV_WATER_CLEAR );
01460 }
01461 }
|
Here is the call graph for this function:

|
|
Definition at line 452 of file bg_pmove.c. References pml_t::frametime, playerState_s::gravity, pm, playerState_s::pm_flags, PM_StepSlideMove(), playerState_s::pm_time, pml, pmove_t::ps, qtrue, and playerState_s::velocity. Referenced by PM_WaterMove(), and PmoveSingle(). 00452 {
00453 // waterjump has no control, but falls
00454
00455 PM_StepSlideMove( qtrue );
00456
00457 pm->ps->velocity[2] -= pm->ps->gravity * pml.frametime;
00458 if (pm->ps->velocity[2] < 0) {
00459 // cancel as soon as we are falling down again
00460 pm->ps->pm_flags &= ~PMF_ALL_TIMES;
00461 pm->ps->pm_time = 0;
00462 }
00463 }
|
Here is the call graph for this function:

|
|
Definition at line 471 of file bg_pmove.c. References pmove_t::cmd, DotProduct, pml_t::forward, usercmd_s::forwardmove, pml_t::groundPlane, pml_t::groundTrace, i, cplane_s::normal, OVERCLIP, trace_t::plane, pm, PM_Accelerate(), PM_CheckWaterJump(), PM_ClipVelocity(), PM_CmdScale(), PM_Friction(), PM_SlideMove(), pm_wateraccelerate, PM_WaterJumpMove(), pml, pmove_t::ps, qfalse, pml_t::right, usercmd_s::rightmove, playerState_s::speed, usercmd_s::upmove, vec3_t, VectorCopy, VectorLength(), VectorNormalize(), VectorScale, playerState_s::velocity, and pmove_t::watertype. Referenced by PM_WalkMove(), and PmoveSingle(). 00471 {
00472 int i;
00473 vec3_t wishvel;
00474 float wishspeed;
00475 vec3_t wishdir;
00476 float scale;
00477 float vel;
00478
00479 if ( PM_CheckWaterJump() ) {
00480 PM_WaterJumpMove();
00481 return;
00482 }
00483 #if 0
00484 // jump = head for surface
00485 if ( pm->cmd.upmove >= 10 ) {
00486 if (pm->ps->velocity[2] > -300) {
00487 if ( pm->watertype == CONTENTS_WATER ) {
00488 pm->ps->velocity[2] = 100;
00489 } else if (pm->watertype == CONTENTS_SLIME) {
00490 pm->ps->velocity[2] = 80;
00491 } else {
00492 pm->ps->velocity[2] = 50;
00493 }
00494 }
00495 }
00496 #endif
00497 PM_Friction ();
00498
00499 scale = PM_CmdScale( &pm->cmd );
00500 //
00501 // user intentions
00502 //
00503 if ( !scale ) {
00504 wishvel[0] = 0;
00505 wishvel[1] = 0;
00506 wishvel[2] = -60; // sink towards bottom
00507 } else {
00508 for (i=0 ; i<3 ; i++)
00509 wishvel[i] = scale * pml.forward[i]*pm->cmd.forwardmove + scale * pml.right[i]*pm->cmd.rightmove;
00510
00511 wishvel[2] += scale * pm->cmd.upmove;
00512 }
00513
00514 VectorCopy (wishvel, wishdir);
00515 wishspeed = VectorNormalize(wishdir);
00516
00517 if ( wishspeed > pm->ps->speed * pm_swimScale ) {
00518 wishspeed = pm->ps->speed * pm_swimScale;
00519 }
00520
00521 PM_Accelerate (wishdir, wishspeed, pm_wateraccelerate);
00522
00523 // make sure we can go up slopes easily under water
00524 if ( pml.groundPlane && DotProduct( pm->ps->velocity, pml.groundTrace.plane.normal ) < 0 ) {
00525 vel = VectorLength(pm->ps->velocity);
00526 // slide along the ground plane
00527 PM_ClipVelocity (pm->ps->velocity, pml.groundTrace.plane.normal,
00528 pm->ps->velocity, OVERCLIP );
00529
00530 VectorNormalize(pm->ps->velocity);
00531 VectorScale(pm->ps->velocity, vel, pm->ps->velocity);
00532 }
00533
00534 PM_SlideMove( qfalse );
00535 }
|
Here is the call graph for this function:

|
|
Definition at line 1538 of file bg_pmove.c. References playerState_s::ammo, bg_itemlist, usercmd_s::buttons, pmove_t::cmd, EV_FIRE_WEAPON, EV_NOAMMO, EV_USE_ITEM0, pmove_t::gauntletHit, gitem_s::giTag, HI_MEDKIT, pml_t::msec, playerState_s::persistant, pm, PM_AddEvent(), PM_BeginWeaponChange(), PM_FinishWeaponChange(), playerState_s::pm_flags, PM_StartTorsoAnim(), pml, playerState_s::powerups, pmove_t::ps, STAT_HOLDABLE_ITEM, playerState_s::stats, TORSO_ATTACK, TORSO_ATTACK2, TORSO_STAND, TORSO_STAND2, usercmd_s::weapon, playerState_s::weapon, playerState_s::weaponstate, playerState_s::weaponTime, WP_BFG, WP_GAUNTLET, WP_GRAPPLING_HOOK, WP_GRENADE_LAUNCHER, WP_LIGHTNING, WP_MACHINEGUN, WP_PLASMAGUN, WP_RAILGUN, WP_ROCKET_LAUNCHER, and WP_SHOTGUN. Referenced by PmoveSingle(). 01538 {
01539 int addTime;
01540
01541 // don't allow attack until all buttons are up
01542 if ( pm->ps->pm_flags & PMF_RESPAWNED ) {
01543 return;
01544 }
01545
01546 // ignore if spectator
01547 if ( pm->ps->persistant[PERS_TEAM] == TEAM_SPECTATOR ) {
01548 return;
01549 }
01550
01551 // check for dead player
01552 if ( pm->ps->stats[STAT_HEALTH] <= 0 ) {
01553 pm->ps->weapon = WP_NONE;
01554 return;
01555 }
01556
01557 // check for item using
01558 if ( pm->cmd.buttons & BUTTON_USE_HOLDABLE ) {
01559 if ( ! ( pm->ps->pm_flags & PMF_USE_ITEM_HELD ) ) {
01560 if ( bg_itemlist[pm->ps->stats[STAT_HOLDABLE_ITEM]].giTag == HI_MEDKIT
01561 && pm->ps->stats[STAT_HEALTH] >= (pm->ps->stats[STAT_MAX_HEALTH] + 25) ) {
01562 // don't use medkit if at max health
01563 } else {
01564 pm->ps->pm_flags |= PMF_USE_ITEM_HELD;
01565 PM_AddEvent( EV_USE_ITEM0 + bg_itemlist[pm->ps->stats[STAT_HOLDABLE_ITEM]].giTag );
01566 pm->ps->stats[STAT_HOLDABLE_ITEM] = 0;
01567 }
01568 return;
01569 }
01570 } else {
01571 pm->ps->pm_flags &= ~PMF_USE_ITEM_HELD;
01572 }
01573
01574
01575 // make weapon function
01576 if ( pm->ps->weaponTime > 0 ) {
01577 pm->ps->weaponTime -= pml.msec;
01578 }
01579
01580 // check for weapon change
01581 // can't change if weapon is firing, but can change
01582 // again if lowering or raising
01583 if ( pm->ps->weaponTime <= 0 || pm->ps->weaponstate != WEAPON_FIRING ) {
01584 if ( pm->ps->weapon != pm->cmd.weapon ) {
01585 PM_BeginWeaponChange( pm->cmd.weapon );
01586 }
01587 }
01588
01589 if ( pm->ps->weaponTime > 0 ) {
01590 return;
01591 }
01592
01593 // change weapon if time
01594 if ( pm->ps->weaponstate == WEAPON_DROPPING ) {
01595 PM_FinishWeaponChange();
01596 return;
01597 }
01598
01599 if ( pm->ps->weaponstate == WEAPON_RAISING ) {
01600 pm->ps->weaponstate = WEAPON_READY;
01601 if ( pm->ps->weapon == WP_GAUNTLET ) {
01602 PM_StartTorsoAnim( TORSO_STAND2 );
01603 } else {
01604 PM_StartTorsoAnim( TORSO_STAND );
01605 }
01606 return;
01607 }
01608
01609 // check for fire
01610 if ( ! (pm->cmd.buttons & BUTTON_ATTACK) ) {
01611 pm->ps->weaponTime = 0;
01612 pm->ps->weaponstate = WEAPON_READY;
01613 return;
01614 }
01615
01616 // start the animation even if out of ammo
01617 if ( pm->ps->weapon == WP_GAUNTLET ) {
01618 // the guantlet only "fires" when it actually hits something
01619 if ( !pm->gauntletHit ) {
01620 pm->ps->weaponTime = 0;
01621 pm->ps->weaponstate = WEAPON_READY;
01622 return;
01623 }
01624 PM_StartTorsoAnim( TORSO_ATTACK2 );
01625 } else {
01626 PM_StartTorsoAnim( TORSO_ATTACK );
01627 }
01628
01629 pm->ps->weaponstate = WEAPON_FIRING;
01630
01631 // check for out of ammo
01632 if ( ! pm->ps->ammo[ pm->ps->weapon ] ) {
01633 PM_AddEvent( EV_NOAMMO );
01634 pm->ps->weaponTime += 500;
01635 return;
01636 }
01637
01638 // take an ammo away if not infinite
01639 if ( pm->ps->ammo[ pm->ps->weapon ] != -1 ) {
01640 pm->ps->ammo[ pm->ps->weapon ]--;
01641 }
01642
01643 // fire weapon
01644 PM_AddEvent( EV_FIRE_WEAPON );
01645
01646 switch( pm->ps->weapon ) {
01647 default:
01648 case WP_GAUNTLET:
01649 addTime = 400;
01650 break;
01651 case WP_LIGHTNING:
01652 addTime = 50;
01653 break;
01654 case WP_SHOTGUN:
01655 addTime = 1000;
01656 break;
01657 case WP_MACHINEGUN:
01658 addTime = 100;
01659 break;
01660 case WP_GRENADE_LAUNCHER:
01661 addTime = 800;
01662 break;
01663 case WP_ROCKET_LAUNCHER:
01664 addTime = 800;
01665 break;
01666 case WP_PLASMAGUN:
01667 addTime = 100;
01668 break;
01669 case WP_RAILGUN:
01670 addTime = 1500;
01671 break;
01672 case WP_BFG:
01673 addTime = 200;
01674 break;
01675 case WP_GRAPPLING_HOOK:
01676 addTime = 400;
01677 break;
01678 #ifdef MISSIONPACK
01679 case WP_NAILGUN:
01680 addTime = 1000;
01681 break;
01682 case WP_PROX_LAUNCHER:
01683 addTime = 800;
01684 break;
01685 case WP_CHAINGUN:
01686 addTime = 30;
01687 break;
01688 #endif
01689 }
01690
01691 #ifdef MISSIONPACK
01692 if( bg_itemlist[pm->ps->stats[STAT_PERSISTANT_POWERUP]].giTag == PW_SCOUT ) {
01693 addTime /= 1.5;
01694 }
01695 else
01696 if( bg_itemlist[pm->ps->stats[STAT_PERSISTANT_POWERUP]].giTag == PW_AMMOREGEN ) {
01697 addTime /= 1.3;
01698 }
01699 else
01700 #endif
01701 if ( pm->ps->powerups[PW_HASTE] ) {
01702 addTime /= 1.3;
01703 }
01704
01705 pm->ps->weaponTime += addTime;
01706 }
|
Here is the call graph for this function:

|
|
Definition at line 2026 of file bg_pmove.c. References pmove_t::cmd, playerState_s::commandTime, playerState_s::pm_flags, pmove_t::pmove_fixed, playerState_s::pmove_framecount, pmove_t::pmove_msec, PmoveSingle(), pmove_t::ps, usercmd_s::serverTime, and usercmd_s::upmove. Referenced by CG_PredictPlayerState(), ClientThink_real(), and SpectatorThink(). 02026 {
02027 int finalTime;
02028
02029 finalTime = pmove->cmd.serverTime;
02030
02031 if ( finalTime < pmove->ps->commandTime ) {
02032 return; // should not happen
02033 }
02034
02035 if ( finalTime > pmove->ps->commandTime + 1000 ) {
02036 pmove->ps->commandTime = finalTime - 1000;
02037 }
02038
02039 pmove->ps->pmove_framecount = (pmove->ps->pmove_framecount+1) & ((1<<PS_PMOVEFRAMECOUNTBITS)-1);
02040
02041 // chop the move up if it is too long, to prevent framerate
02042 // dependent behavior
02043 while ( pmove->ps->commandTime != finalTime ) {
02044 int msec;
02045
02046 msec = finalTime - pmove->ps->commandTime;
02047
02048 if ( pmove->pmove_fixed ) {
02049 if ( msec > pmove->pmove_msec ) {
02050 msec = pmove->pmove_msec;
02051 }
02052 }
02053 else {
02054 if ( msec > 66 ) {
02055 msec = 66;
02056 }
02057 }
02058 pmove->cmd.serverTime = pmove->ps->commandTime + msec;
02059 PmoveSingle( pmove );
02060
02061 if ( pmove->ps->pm_flags & PMF_JUMP_HELD ) {
02062 pmove->cmd.upmove = 20;
02063 }
02064 }
02065
02066 //PM_CheckStuck();
02067
02068 }
|
Here is the call graph for this function:

|
|
Definition at line 1836 of file bg_pmove.c. References abs(), playerState_s::ammo, AngleVectors(), BUTTON_ATTACK, usercmd_s::buttons, c_pmove, pmove_t::cmd, playerState_s::commandTime, playerState_s::eFlags, pml_t::forward, usercmd_s::forwardmove, pml_t::frametime, memset(), pml_t::msec, pmove_t::numtouch, playerState_s::origin, pm, PM_AirMove(), PM_Animate(), PM_CheckDuck(), PM_DeadMove(), PM_DropTimers(), playerState_s::pm_flags, PM_FlyMove(), PM_Footsteps(), PM_GrappleMove(), PM_GroundTrace(), PM_INTERMISSION, PM_NoclipMove(), PM_SetWaterLevel(), PM_TorsoAnimation(), playerState_s::pm_type, PM_UpdateViewAngles(), PM_WalkMove(), PM_WaterEvents(), PM_WaterJumpMove(), PM_WaterMove(), PM_Weapon(), pml, playerState_s::powerups, pml_t::previous_origin, pml_t::previous_velocity, pml_t::previous_waterlevel, pmove_t::ps, pml_t::right, usercmd_s::rightmove, usercmd_s::serverTime, playerState_s::stats, pmove_t::tracemask, trap_SnapVector(), pml_t::up, usercmd_s::upmove, VectorCopy, playerState_s::velocity, playerState_s::viewangles, pml_t::walking, pmove_t::waterlevel, pmove_t::watertype, and playerState_s::weapon. Referenced by Pmove(). 01836 {
01837 pm = pmove;
01838
01839 // this counter lets us debug movement problems with a journal
01840 // by setting a conditional breakpoint fot the previous frame
01841 c_pmove++;
01842
01843 // clear results
01844 pm->numtouch = 0;
01845 pm->watertype = 0;
01846 pm->waterlevel = 0;
01847
01848 if ( pm->ps->stats[STAT_HEALTH] <= 0 ) {
01849 pm->tracemask &= ~CONTENTS_BODY; // corpses can fly through bodies
01850 }
01851
01852 // make sure walking button is clear if they are running, to avoid
01853 // proxy no-footsteps cheats
01854 if ( abs( pm->cmd.forwardmove ) > 64 || abs( pm->cmd.rightmove ) > 64 ) {
01855 pm->cmd.buttons &= ~BUTTON_WALKING;
01856 }
01857
01858 // set the talk balloon flag
01859 if ( pm->cmd.buttons & BUTTON_TALK ) {
01860 pm->ps->eFlags |= EF_TALK;
01861 } else {
01862 pm->ps->eFlags &= ~EF_TALK;
01863 }
01864
01865 // set the firing flag for continuous beam weapons
01866 if ( !(pm->ps->pm_flags & PMF_RESPAWNED) && pm->ps->pm_type != PM_INTERMISSION
01867 && ( pm->cmd.buttons & BUTTON_ATTACK ) && pm->ps->ammo[ pm->ps->weapon ] ) {
01868 pm->ps->eFlags |= EF_FIRING;
01869 } else {
01870 pm->ps->eFlags &= ~EF_FIRING;
01871 }
01872
01873 // clear the respawned flag if attack and use are cleared
01874 if ( pm->ps->stats[STAT_HEALTH] > 0 &&
01875 !( pm->cmd.buttons & (BUTTON_ATTACK | BUTTON_USE_HOLDABLE) ) ) {
01876 pm->ps->pm_flags &= ~PMF_RESPAWNED;
01877 }
01878
01879 // if talk button is down, dissallow all other input
01880 // this is to prevent any possible intercept proxy from
01881 // adding fake talk balloons
01882 if ( pmove->cmd.buttons & BUTTON_TALK ) {
01883 // keep the talk button set tho for when the cmd.serverTime > 66 msec
01884 // and the same cmd is used multiple times in Pmove
01885 pmove->cmd.buttons = BUTTON_TALK;
01886 pmove->cmd.forwardmove = 0;
01887 pmove->cmd.rightmove = 0;
01888 pmove->cmd.upmove = 0;
01889 }
01890
01891 // clear all pmove local vars
01892 memset (&pml, 0, sizeof(pml));
01893
01894 // determine the time
01895 pml.msec = pmove->cmd.serverTime - pm->ps->commandTime;
01896 if ( pml.msec < 1 ) {
01897 pml.msec = 1;
01898 } else if ( pml.msec > 200 ) {
01899 pml.msec = 200;
01900 }
01901 pm->ps->commandTime = pmove->cmd.serverTime;
01902
01903 // save old org in case we get stuck
01904 VectorCopy (pm->ps->origin, pml.previous_origin);
01905
01906 // save old velocity for crashlanding
01907 VectorCopy (pm->ps->velocity, pml.previous_velocity);
01908
01909 pml.frametime = pml.msec * 0.001;
01910
01911 // update the viewangles
01912 PM_UpdateViewAngles( pm->ps, &pm->cmd );
01913
01914 AngleVectors (pm->ps->viewangles, pml.forward, pml.right, pml.up);
01915
01916 if ( pm->cmd.upmove < 10 ) {
01917 // not holding jump
01918 pm->ps->pm_flags &= ~PMF_JUMP_HELD;
01919 }
01920
01921 // decide if backpedaling animations should be used
01922 if ( pm->cmd.forwardmove < 0 ) {
01923 pm->ps->pm_flags |= PMF_BACKWARDS_RUN;
01924 } else if ( pm->cmd.forwardmove > 0 || ( pm->cmd.forwardmove == 0 && pm->cmd.rightmove ) ) {
01925 pm->ps->pm_flags &= ~PMF_BACKWARDS_RUN;
01926 }
01927
01928 if ( pm->ps->pm_type >= PM_DEAD ) {
01929 pm->cmd.forwardmove = 0;
01930 pm->cmd.rightmove = 0;
01931 pm->cmd.upmove = 0;
01932 }
01933
01934 if ( pm->ps->pm_type == PM_SPECTATOR ) {
01935 PM_CheckDuck ();
01936 PM_FlyMove ();
01937 PM_DropTimers ();
01938 return;
01939 }
01940
01941 if ( pm->ps->pm_type == PM_NOCLIP ) {
01942 PM_NoclipMove ();
01943 PM_DropTimers ();
01944 return;
01945 }
01946
01947 if (pm->ps->pm_type == PM_FREEZE) {
01948 return; // no movement at all
01949 }
01950
01951 if ( pm->ps->pm_type == PM_INTERMISSION || pm->ps->pm_type == PM_SPINTERMISSION) {
01952 return; // no movement at all
01953 }
01954
01955 // set watertype, and waterlevel
01956 PM_SetWaterLevel();
01957 pml.previous_waterlevel = pmove->waterlevel;
01958
01959 // set mins, maxs, and viewheight
01960 PM_CheckDuck ();
01961
01962 // set groundentity
01963 PM_GroundTrace();
01964
01965 if ( pm->ps->pm_type == PM_DEAD ) {
01966 PM_DeadMove ();
01967 }
01968
01969 PM_DropTimers();
01970
01971 #ifdef MISSIONPACK
01972 if ( pm->ps->powerups[PW_INVULNERABILITY] ) {
01973 PM_InvulnerabilityMove();
01974 } else
01975 #endif
01976 if ( pm->ps->powerups[PW_FLIGHT] ) {
01977 // flight powerup doesn't allow jump and has different friction
01978 PM_FlyMove();
01979 } else if (pm->ps->pm_flags & PMF_GRAPPLE_PULL) {
01980 PM_GrappleMove();
01981 // We can wiggle a bit
01982 PM_AirMove();
01983 } else if (pm->ps->pm_flags & PMF_TIME_WATERJUMP) {
01984 PM_WaterJumpMove();
01985 } else if ( pm->waterlevel > 1 ) {
01986 // swimming
01987 PM_WaterMove();
01988 } else if ( pml.walking ) {
01989 // walking on ground
01990 PM_WalkMove();
01991 } else {
01992 // airborne
01993 PM_AirMove();
01994 }
01995
01996 PM_Animate();
01997
01998 // set groundentity, watertype, and waterlevel
01999 PM_GroundTrace();
02000 PM_SetWaterLevel();
02001
02002 // weapons
02003 PM_Weapon();
02004
02005 // torso animation
02006 PM_TorsoAnimation();
02007
02008 // footstep events / legs animations
02009 PM_Footsteps();
02010
02011 // entering / leaving water splashes
02012 PM_WaterEvents();
02013
02014 // snap some parts of playerstate to save network bandwidth
02015 trap_SnapVector( pm->ps->velocity );
02016 }
|
Here is the call graph for this function:

|
|
Definition at line 392 of file cg_syscalls.c. 00392 {
00393 syscall( CG_SNAPVECTOR, v );
00394 }
|
|
|
Definition at line 49 of file bg_pmove.c. Referenced by PM_CorrectAllSolid(), PM_GroundTrace(), PM_GroundTraceMissed(), PM_StepSlideMove(), and PmoveSingle(). |
|
|
|
Definition at line 39 of file bg_pmove.c. Referenced by PM_NoclipMove(). |
|
|
Definition at line 40 of file bg_pmove.c. Referenced by PM_AirMove(). |
|
|
Definition at line 35 of file bg_pmove.c. |
|
|
Definition at line 46 of file bg_pmove.c. Referenced by PM_Friction(). |
|
|
Definition at line 42 of file bg_pmove.c. Referenced by PM_FlyMove(). |
|
|
Definition at line 44 of file bg_pmove.c. Referenced by PM_Friction(), and PM_NoclipMove(). |
|
|
Definition at line 47 of file bg_pmove.c. Referenced by PM_Friction(). |
|
|
Definition at line 34 of file bg_pmove.c. Referenced by PM_Friction(), and PM_NoclipMove(). |
|
|
Definition at line 36 of file bg_pmove.c. |
|
|
Definition at line 37 of file bg_pmove.c. |
|
|
Definition at line 41 of file bg_pmove.c. Referenced by PM_WaterMove(). |
|
|
Definition at line 45 of file bg_pmove.c. Referenced by PM_Friction(). |
|
|
Definition at line 31 of file bg_pmove.c. Referenced by PM_Accelerate(), PM_AirMove(), PM_CheckJump(), PM_CheckWaterJump(), PM_CorrectAllSolid(), PM_CrashLand(), PM_DeadMove(), PM_DropTimers(), PM_FlyMove(), PM_FootstepForSurface(), PM_Footsteps(), PM_Friction(), PM_GrappleMove(), PM_GroundTrace(), PM_GroundTraceMissed(), PM_NoclipMove(), PM_SlideMove(), PM_WalkMove(), PM_WaterEvents(), PM_WaterJumpMove(), PM_WaterMove(), PM_Weapon(), and PmoveSingle(). |
1.3.9.1