Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace current KZ mode with SimpleKZ #1310

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion mp/src/game/client/momentum/c_mom_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ C_MomentumPlayer::C_MomentumPlayer(): m_pSpecTarget(nullptr)
m_afButtonDisabled = 0;
m_flStartSpeed = 0.0f;
m_flEndSpeed = 0.0f;
m_flStamina = 0.0f;
// m_flStamina = 0.0f;
m_flGrabbableLadderTime = 0.0f;

m_iLandTick = 0;
Expand All @@ -70,6 +70,17 @@ C_MomentumPlayer::C_MomentumPlayer(): m_pSpecTarget(nullptr)
m_nWallRunState = WALLRUN_NOT;
m_bWasSprinting = false;


m_bPSTurningLeft = false;
m_flPSBonusSpeed = 0.0f;
m_flPSTurnRate = 0.0f;
m_flPSVelMod = 1.0f;
m_flPSVelModLanding = 1.0f;
m_vecOldVelocity.Init();
m_iTicksSinceIncrement = 0;
m_vecLandingVelocity.Init();
m_iLastJumpButtonTick = 0;

m_nButtonsToggled = 0;
}

Expand Down
18 changes: 17 additions & 1 deletion mp/src/game/client/momentum/c_mom_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,23 @@ class C_MomentumPlayer : public C_BasePlayer, public CMomRunEntity
Vector GetEscapeVel() const { return m_vecCornerEscapeVel; }
void SetEscapeVel(const Vector &vecNewYaw) { m_vecCornerEscapeVel = vecNewYaw; }

void SetOldEyeAngles(const QAngle &ang) { m_qangOldEyeAngles = ang; }
const QAngle &OldEyeAngles() const { return m_qangOldEyeAngles; }

private:

// KZ stuff (SKZ)
bool m_bPSTurningLeft;
float m_flPSBonusSpeed;
float m_flPSTurnRate;
float m_flPSVelMod;
float m_flPSVelModLanding;
Vector m_vecOldVelocity;
int m_iTicksSinceIncrement;
QAngle m_qangOldEyeAngles;
Vector m_vecLandingVelocity;
int m_iLastJumpButtonTick;

// Mobility mod (parkour)
bool m_bWasSprinting;
bool m_bIsPowerSliding;
Expand Down Expand Up @@ -144,7 +160,7 @@ class C_MomentumPlayer : public C_BasePlayer, public CMomRunEntity
SurfInt m_surfIntList[SurfInt::TYPE_COUNT]; // Stores interactions by type
SurfInt::Type m_surfIntHistory[SurfInt::TYPE_COUNT]; // Keeps track of the history of interactions

float m_flStamina;
// float m_flStamina;

CMomRunEntity *m_pSpecTarget;

Expand Down
13 changes: 11 additions & 2 deletions mp/src/game/server/momentum/mom_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,7 @@ static MAKE_TOGGLE_CONVAR_C(mom_trail_enable, "0", FCVAR_CLIENTCMD_CAN_EXECUTE |
static CMomentumPlayer *s_pPlayer = nullptr;

CMomentumPlayer::CMomentumPlayer()
: m_flStamina(0.0f),
m_flLastVelocity(0.0f), m_nPerfectSyncTicks(0), m_nStrafeTicks(0), m_nAccelTicks(0),
: m_flLastVelocity(0.0f), m_nPerfectSyncTicks(0), m_nStrafeTicks(0), m_nAccelTicks(0),
m_nPrevButtons(0), m_flTweenVelValue(1.0f), m_bInAirDueToJump(false), m_iProgressNumber(-1),
m_cvarMapFinMoveEnable("mom_mapfinished_movement_enable")
{
Expand Down Expand Up @@ -255,6 +254,16 @@ CMomentumPlayer::CMomentumPlayer()
m_bIsWalking = false;
m_bIsSprinting = false;

m_bPSTurningLeft = false;
m_flPSBonusSpeed = 0.0f;
m_flPSTurnRate = 0.0f;
m_flPSVelMod = 1.0f;
m_flPSVelModLanding = 1.0f;
m_vecOldVelocity.Init();
m_iTicksSinceIncrement = 0;
m_vecLandingVelocity.Init();
m_iLastJumpButtonTick = 0;

m_bIsPowerSliding = false;
m_nWallRunState = WALLRUN_NOT;

Expand Down
18 changes: 17 additions & 1 deletion mp/src/game/server/momentum/mom_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,22 @@ class CMomentumPlayer : public CBasePlayer, public CGameEventListener, public CM

SavedState_t *GetSavedRunState() { return &m_SavedRunState; }

// KZ stuff

QAngle m_qangOldEyeAngles;
bool m_bPSTurningLeft;
float m_flPSBonusSpeed;
float m_flPSTurnRate;
float m_flPSVelMod;
float m_flPSVelModLanding;
Vector m_vecOldVelocity;
int m_iTicksSinceIncrement;
Vector m_vecLandingVelocity;
int m_iLastJumpButtonTick;

void SetOldEyeAngles(const QAngle &ang) { m_qangOldEyeAngles = ang; }
const QAngle &OldEyeAngles() const { return m_qangOldEyeAngles; }

// Ahop stuff
CNetworkVar(bool, m_bIsSprinting);
CNetworkVar(bool, m_bIsWalking);
Expand Down Expand Up @@ -384,7 +400,7 @@ class CMomentumPlayer : public CBasePlayer, public CGameEventListener, public CM
QAngle m_qangLastAngle;

// used by CMomentumGameMovement
float m_flStamina;
// float m_flStamina;

bool m_bAllowUserTeleports;

Expand Down
24 changes: 18 additions & 6 deletions mp/src/game/shared/gamemovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1133,14 +1133,19 @@ void CGameMovement::ProcessMovement( CBasePlayer *pPlayer, CMoveData *pMove )

mv = pMove;
mv->m_flMaxSpeed = pPlayer->GetPlayerMaxSpeed();
// CSGO (and therefore SKZ) caps ground speed at CS_PLAYER_SPEED_RUN (250.0f) as well
if (g_pGameModeSystem->GameModeIs(GAMEMODE_KZ))
{
mv->m_flMaxSpeed = MIN(250.0f, mv->m_flMaxSpeed);
}

// CheckV( player->CurrentCommandNumber(), "StartPos", mv->GetAbsOrigin() );

DiffPrint( "start %f %f %f", mv->GetAbsOrigin().x, mv->GetAbsOrigin().y, mv->GetAbsOrigin().z );

// Run the command.
// Run the command.
PlayerMove();

FinishMove();

DiffPrint( "end %f %f %f", mv->GetAbsOrigin().x, mv->GetAbsOrigin().y, mv->GetAbsOrigin().z );
Expand Down Expand Up @@ -1849,10 +1854,17 @@ void CGameMovement::Accelerate( Vector& wishdir, float wishspeed, float accel )
// If not going to add any speed, done.
if (addspeed <= 0)
return;

// Determine amount of acceleration.
accelspeed = accel * gpGlobals->frametime * wishspeed * player->m_surfaceFriction;

if (g_pGameModeSystem->GameModeIs(GAMEMODE_KZ))
{
// Change acceleration based on movement modifiers (KZ)
const float kAccelerationScale = MAX(250.0f, wishspeed);
accelspeed = accel * gpGlobals->frametime * kAccelerationScale * player->m_surfaceFriction;
}
else
{
accelspeed = accel * gpGlobals->frametime * wishspeed * player->m_surfaceFriction;
}
// Cap at addspeed
if (accelspeed > addspeed)
accelspeed = addspeed;
Expand Down
Loading