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

Method PM_WaterMove

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

PM_WaterMove.

()

Source from the content-addressed store, hash-verified

452 * PM_WaterMove.
453 */
454 public static void PM_WaterMove() {
455 int i;
456 float[] wishvel = { 0, 0, 0 };
457 float wishspeed;
458 float[] wishdir = { 0, 0, 0 };
459
460
461 // user intentions
462 for (i = 0; i < 3; i++)
463 wishvel[i] = pml.forward[i] * pm.cmd.forwardmove
464 + pml.right[i] * pm.cmd.sidemove;
465
466 if (0 == pm.cmd.forwardmove && 0 == pm.cmd.sidemove
467 && 0 == pm.cmd.upmove)
468 wishvel[2] -= 60; // drift towards bottom
469 else
470 wishvel[2] += pm.cmd.upmove;
471
472 PM_AddCurrents(wishvel);
473
474 Math3D.VectorCopy(wishvel, wishdir);
475 wishspeed = Math3D.VectorNormalize(wishdir);
476
477 if (wishspeed > pm_maxspeed) {
478 Math3D.VectorScale(wishvel, pm_maxspeed / wishspeed, wishvel);
479 wishspeed = pm_maxspeed;
480 }
481 wishspeed *= 0.5;
482
483 PM_Accelerate(wishdir, wishspeed, pm_wateraccelerate);
484
485 PM_StepSlideMove();
486 }
487
488 /**
489 * PM_AirMove.

Callers 1

PmoveMethod · 0.95

Calls 6

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

Tested by

no test coverage detected