MCPcopy Create free account
hub / github.com/demoth/jake2 / PM_AirMove

Method PM_AirMove

qcommon/src/main/java/jake2/qcommon/PMove.java:491–558  ·  view source on GitHub ↗

PM_AirMove.

()

Source from the content-addressed store, hash-verified

489 * PM_AirMove.
490 */
491 public static void PM_AirMove() {
492 float[] wishvel = { 0, 0, 0 };
493 float fmove, smove;
494 float[] wishdir = { 0, 0, 0 };
495 float wishspeed;
496 float maxspeed;
497
498 fmove = pm.cmd.forwardmove;
499 smove = pm.cmd.sidemove;
500
501 wishvel[0] = pml.forward[0] * fmove + pml.right[0] * smove;
502 wishvel[1] = pml.forward[1] * fmove + pml.right[1] * smove;
503
504 wishvel[2] = 0;
505
506 PM_AddCurrents(wishvel);
507
508 Math3D.VectorCopy(wishvel, wishdir);
509 wishspeed = Math3D.VectorNormalize(wishdir);
510
511
512 // clamp to server defined max speed
513 maxspeed = (pm.s.pm_flags & Defines.PMF_DUCKED) != 0 ? pm_duckspeed
514 : pm_maxspeed;
515
516 if (wishspeed > maxspeed) {
517 Math3D.VectorScale(wishvel, maxspeed / wishspeed, wishvel);
518 wishspeed = maxspeed;
519 }
520
521 if (pml.ladder) {
522 PM_Accelerate(wishdir, wishspeed, pm_accelerate);
523 if (0 == wishvel[2]) {
524 if (pml.velocity[2] > 0) {
525 pml.velocity[2] -= pm.s.gravity * pml.frametime;
526 if (pml.velocity[2] < 0)
527 pml.velocity[2] = 0;
528 } else {
529 pml.velocity[2] += pm.s.gravity * pml.frametime;
530 if (pml.velocity[2] > 0)
531 pml.velocity[2] = 0;
532 }
533 }
534 PM_StepSlideMove();
535 } else if (pm.groundentity != null) { // walking on ground
536 pml.velocity[2] = 0; //!!! this is before the accel
537 PM_Accelerate(wishdir, wishspeed, pm_accelerate);
538
539 // PGM -- fix for negative trigger_gravity fields
540 // pml.velocity[2] = 0;
541 if (pm.s.gravity > 0)
542 pml.velocity[2] = 0;
543 else
544 pml.velocity[2] -= pm.s.gravity * pml.frametime;
545 // PGM
546 if (0 == pml.velocity[0] && 0 == pml.velocity[1])
547 return;
548 PM_StepSlideMove();

Callers 1

PmoveMethod · 0.95

Calls 7

PM_AddCurrentsMethod · 0.95
VectorCopyMethod · 0.95
VectorNormalizeMethod · 0.95
VectorScaleMethod · 0.95
PM_AccelerateMethod · 0.95
PM_StepSlideMoveMethod · 0.95
PM_AirAccelerateMethod · 0.95

Tested by

no test coverage detected