void CMomentumGameMovement::WalkMove() { ConVarRef gm("mom_gamemode"); if (gm.GetInt() == MOMGM_SCROLL) { if (player->m_flStamina > 0) { float flRatio; flRatio = (STAMINA_MAX - ((player->m_flStamina / 1000.0) * STAMINA_RECOVER_RATE)) / STAMINA_MAX; // This Goldsrc code was run with variable timesteps and it had framerate dependencies. // People looking at Goldsrc for reference are usually // (these days) measuring the stoppage at 60fps or greater, so we need // to account for the fact that Goldsrc was applying more stopping power // since it applied the slowdown across more frames. float flReferenceFrametime = 1.0f / 70.0f; float flFrametimeRatio = gpGlobals->frametime / flReferenceFrametime; flRatio = pow(flRatio, flFrametimeRatio); mv->m_vecVelocity.x *= flRatio; mv->m_vecVelocity.y *= flRatio; } } BaseClass::WalkMove(); CheckForLadders(player->GetGroundEntity() != NULL); }
void CMomentumGameMovement::AirMove(void) { int i; Vector wishvel; float fmove, smove; Vector wishdir; float wishspeed; Vector forward, right, up; AngleVectors(mv->m_vecViewAngles, &forward, &right, &up); // Determine movement angles // Copy movement amounts fmove = mv->m_flForwardMove; smove = mv->m_flSideMove; // Zero out z components of movement vectors forward[2] = 0; right[2] = 0; VectorNormalize(forward); // Normalize remainder of vectors VectorNormalize(right); // for (i = 0; i<2; i++) // Determine x and y parts of velocity wishvel[i] = forward[i] * fmove + right[i] * smove; wishvel[2] = 0; // Zero out z part of velocity VectorCopy(wishvel, wishdir); // Determine maginitude of speed of move wishspeed = VectorNormalize(wishdir); // // clamp to server defined max speed // if (wishspeed != 0 && (wishspeed > mv->m_flMaxSpeed)) { VectorScale(wishvel, mv->m_flMaxSpeed / wishspeed, wishvel); wishspeed = mv->m_flMaxSpeed; } AirAccelerate(wishdir, wishspeed, sv_airaccelerate.GetFloat()); // Add in any base velocity to the current velocity. VectorAdd(mv->m_vecVelocity, player->GetBaseVelocity(), mv->m_vecVelocity); flReflectNormal = NO_REFL_NORMAL_CHANGE; TryPlayerMove(NULL, NULL); // Now pull the base velocity back out. Base velocity is set if you are on a moving object, like a conveyor (or maybe another monster?) VectorSubtract(mv->m_vecVelocity, player->GetBaseVelocity(), mv->m_vecVelocity); CheckForLadders(false); //return bDidReflect; }
void CHL2GameMovement::AirMove() { BaseClass::AirMove(); CheckForLadders(false); }
void CHL2GameMovement::WalkMove() { BaseClass::WalkMove(); CheckForLadders(player->GetGroundEntity() != NULL); }