MCPcopy Create free account
hub / github.com/JACoders/OpenJK / ProcessMoveCommands

Function ProcessMoveCommands

code/game/FighterNPC.cpp:381–908  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379// ProcessMoveCommands the Vehicle.
380#define FIGHTER_MIN_TAKEOFF_FRACTION 0.7f
381static void ProcessMoveCommands( Vehicle_t *pVeh )
382{
383 /************************************************************************************/
384 /* BEGIN Here is where we move the vehicle (forward or back or whatever). BEGIN */
385 /************************************************************************************/
386
387 //Client sets ucmds and such for speed alterations
388 float speedInc, speedIdleDec, speedIdle, speedIdleAccel, speedMin, speedMax;
389 bgEntity_t *parent = pVeh->m_pParentEntity;
390 qboolean isLandingOrLaunching = qfalse;
391#ifndef _JK2MP//SP
392 int curTime = level.time;
393#elif defined QAGAME//MP GAME
394 int curTime = level.time;
395#elif defined CGAME//MP CGAME
396 //FIXME: pass in ucmd? Not sure if this is reliable...
397 int curTime = pm->cmd.serverTime;
398#endif
399
400#ifdef _JK2MP
401 playerState_t *parentPS = parent->playerState;
402#else
403 playerState_t *parentPS = &parent->client->ps;
404#endif
405
406#ifdef _JK2MP
407 if ( parentPS->hyperSpaceTime
408 && curTime - parentPS->hyperSpaceTime < HYPERSPACE_TIME )
409 {//Going to Hyperspace
410 //totally override movement
411 float timeFrac = ((float)(curTime-parentPS->hyperSpaceTime))/HYPERSPACE_TIME;
412 if ( timeFrac < HYPERSPACE_TELEPORT_FRAC )
413 {//for first half, instantly jump to top speed!
414 if ( !(parentPS->eFlags2&EF2_HYPERSPACE) )
415 {//waiting to face the right direction, do nothing
416 parentPS->speed = 0.0f;
417 }
418 else
419 {
420 if ( parentPS->speed < HYPERSPACE_SPEED )
421 {//just started hyperspace
422//MIKE: This is going to play the sound twice for the predicting client, I suggest using
423//a predicted event or only doing it game-side. -rich
424#ifdef QAGAME//MP GAME-side
425 //G_EntitySound( ((gentity_t *)(pVeh->m_pParentEntity)), CHAN_LOCAL, pVeh->m_pVehicleInfo->soundHyper );
426#elif defined CGAME//MP CGAME-side
427 trap_S_StartSound( NULL, pm->ps->clientNum, CHAN_LOCAL, pVeh->m_pVehicleInfo->soundHyper );
428#endif
429 }
430
431 parentPS->speed = HYPERSPACE_SPEED;
432 }
433 }
434 else
435 {//slow from top speed to 200...
436 parentPS->speed = 200.0f + ((1.0f-timeFrac)*(1.0f/HYPERSPACE_TELEPORT_FRAC)*(HYPERSPACE_SPEED-200.0f));
437 //don't mess with acceleration, just pop to the high velocity
438 if ( VectorLength( parentPS->velocity ) < parentPS->speed )

Callers

nothing calls this directly

Calls 15

trap_S_StartSoundFunction · 0.85
VectorLengthFunction · 0.85
VectorScaleFunction · 0.85
G_EntitySoundFunction · 0.85
G_SoundIndexOnEntFunction · 0.85
VectorCopyFunction · 0.85
AngleVectorsFunction · 0.85
DotProductFunction · 0.85
FighterIsLandingFunction · 0.70
FighterIsLaunchingFunction · 0.70
G_PlayEffectFunction · 0.70

Tested by

no test coverage detected