Skip to content

Commit

Permalink
Merge pull request #49 from momentum-mod/stamina-scroll
Browse files Browse the repository at this point in the history
scroll/kz gamemode stamina and movespeed
  • Loading branch information
Rubén committed Mar 23, 2016
2 parents 472b47a + 7e5262f commit c476c39
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 32 deletions.
18 changes: 11 additions & 7 deletions mp/src/game/server/momentum/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,31 +252,35 @@ CON_COMMAND_F(hud_timer_request_stages, "", FCVAR_DONTRECORD | FCVAR_CLIENTCMD_C
void CTimer::SetGameModeConVars()
{
ConVarRef gm("mom_gamemode");
ConVarRef aa("sv_airaccelerate");
switch (gm.GetInt())
{
case MOMGM_SURF:
sv_maxvelocity.SetValue(3500);
aa.SetValue(150);
sv_airaccelerate.SetValue(150);
sv_maxspeed.SetValue(260);
break;
case MOMGM_BHOP:
sv_maxvelocity.SetValue(10000);
aa.SetValue(1000);
sv_maxvelocity.SetValue(100000);
sv_airaccelerate.SetValue(1000);
sv_maxspeed.SetValue(260);
break;
case MOMGM_SCROLL:
sv_maxvelocity.SetValue(3500);
aa.SetValue(100);
sv_airaccelerate.SetValue(100);
sv_maxspeed.SetValue(250);
break;
case MOMGM_UNKNOWN:
case MOMGM_ALLOWED:
sv_maxvelocity.SetValue(3500);
aa.SetValue(150);
sv_airaccelerate.SetValue(150);
sv_maxspeed.SetValue(260);
break;
default:
DevWarning("[%i] GameMode not defined.\n", gm.GetInt());
break;
}
DevMsg("CTimer set ::\nsv_maxvelocity: %i\nsv_airaccelerate: %i", sv_maxvelocity.GetInt(), aa.GetInt());
DevMsg("CTimer set values:\nsv_maxvelocity: %i\nsv_airaccelerate: %i \nsv_maxspeed: %i\n",
sv_maxvelocity.GetInt(), sv_airaccelerate.GetInt(), sv_maxspeed.GetInt());
}
//Practice mode that stops the timer and allows the player to noclip.
void CTimer::EnablePractice(CBasePlayer *pPlayer)
Expand Down
54 changes: 30 additions & 24 deletions mp/src/game/shared/momentum/mom_gamemovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,30 @@ float CMomentumGameMovement::ClimbSpeed(void) const

void CMomentumGameMovement::WalkMove()
{
//MOM_TODO: enable this via some timer command or something so we can have stamina for scroll/kz modes
/*
if (player->m_flStamina > 0)
ConVarRef gm("mom_gamemode");
if (gm.GetInt() == MOMGM_SCROLL)
{
float flRatio;
if (player->m_flStamina > 0)
{
float flRatio;

flRatio = (STAMINA_MAX - ((player->m_flStamina / 1000.0) * STAMINA_RECOVER_RATE)) / STAMINA_MAX;
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;
// 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);
flRatio = pow(flRatio, flFrametimeRatio);

mv->m_vecVelocity.x *= flRatio;
mv->m_vecVelocity.y *= flRatio;
mv->m_vecVelocity.x *= flRatio;
mv->m_vecVelocity.y *= flRatio;
}
}
*/

BaseClass::WalkMove();
CheckForLadders(player->GetGroundEntity() != NULL);
}
Expand Down Expand Up @@ -597,19 +599,23 @@ bool CMomentumGameMovement::CheckJumpButton()
{
mv->m_vecVelocity[2] += flGroundFactor * sqrt(2 * 800 * 57.0); // 2 * gravity * height
}
//MOM_TODO: enable this via command or something for scroll/kz modes
/*
if (player->m_flStamina > 0)

//stamina stuff (scroll gamemode only)
ConVarRef gm("mom_gamemode");
if (gm.GetInt() == MOMGM_SCROLL)
{
float flRatio;
if (player->m_flStamina > 0)
{
float flRatio;

flRatio = (STAMINA_MAX - ((player->m_flStamina / 1000.0) * STAMINA_RECOVER_RATE)) / STAMINA_MAX;
flRatio = (STAMINA_MAX - ((player->m_flStamina / 1000.0) * STAMINA_RECOVER_RATE)) / STAMINA_MAX;

mv->m_vecVelocity[2] *= flRatio;
}

mv->m_vecVelocity[2] *= flRatio;
player->m_flStamina = (STAMINA_COST_JUMP / STAMINA_RECOVER_RATE) * 1000.0;
}

player->m_flStamina = (STAMINA_COST_JUMP / STAMINA_RECOVER_RATE) * 1000.0;
*/
FinishGravity();

mv->m_outWishVel.z += mv->m_vecVelocity[2] - startz;
Expand Down
2 changes: 1 addition & 1 deletion mp/src/game/shared/movevars_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ConVar sv_specnoclip ( "sv_specnoclip", "1", FCVAR_ARCHIVE | FCVAR_NOTIFY | FCVA
#if defined( CSTRIKE_DLL ) || defined( HL1MP_DLL )
ConVar sv_maxspeed ( "sv_maxspeed", "320", FCVAR_NOTIFY | FCVAR_REPLICATED);
#else
ConVar sv_maxspeed ( "sv_maxspeed", "260", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY);
ConVar sv_maxspeed ( "sv_maxspeed", "260", FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY);
#endif // CSTRIKE_DLL

#ifdef _XBOX
Expand Down

0 comments on commit c476c39

Please sign in to comment.