From e89a931ad856e88e8269860ff89f99bd74319b95 Mon Sep 17 00:00:00 2001 From: tuxxi Date: Fri, 18 Mar 2016 18:41:17 -0700 Subject: [PATCH 1/3] added stamina to scroll gamemode, changed movespeed to 250 u/s on scroll gamemode --- mp/src/game/server/momentum/Timer.cpp | 2 +- mp/src/game/server/momentum/mom_player.cpp | 3 ++ .../game/shared/momentum/mom_gamemovement.cpp | 54 ++++++++++--------- mp/src/game/shared/movevars_shared.cpp | 2 +- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/mp/src/game/server/momentum/Timer.cpp b/mp/src/game/server/momentum/Timer.cpp index 069a3b6212..ba4cacae5c 100644 --- a/mp/src/game/server/momentum/Timer.cpp +++ b/mp/src/game/server/momentum/Timer.cpp @@ -27,7 +27,7 @@ void CTimer::PostTime() //Build URL char webURL[512]; - Q_snprintf(webURL, 512, "http://momentum-mod.org/postscore/%llu/%s/%i/%s", steamID, map, + Q_snprintf(webURL, 512, "http://b00926d9.ngrok.io/postscore/%llu/%s/%i/%s", steamID, map, ticks, tickRate.sType); DevLog("Ticks sent to server: %i\n", ticks); diff --git a/mp/src/game/server/momentum/mom_player.cpp b/mp/src/game/server/momentum/mom_player.cpp index a8acfb5b6f..508a23a073 100644 --- a/mp/src/game/server/momentum/mom_player.cpp +++ b/mp/src/game/server/momentum/mom_player.cpp @@ -43,6 +43,7 @@ void CMomentumPlayer::Spawn() AddFlag(FL_GODMODE); // do this here because we can't get a local player in the timer class ConVarRef gm("mom_gamemode"); + ConVarRef speed("sv_maxspeed"); switch (gm.GetInt()) { case MOMGM_BHOP: @@ -50,9 +51,11 @@ void CMomentumPlayer::Spawn() case MOMGM_UNKNOWN: default: EnableAutoBhop(); + speed.SetValue("260"); break; case MOMGM_SCROLL: DisableAutoBhop(); + speed.SetValue("250"); break; } SetThink(&CMomentumPlayer::CheckForBhop); // Pass a function pointer diff --git a/mp/src/game/shared/momentum/mom_gamemovement.cpp b/mp/src/game/shared/momentum/mom_gamemovement.cpp index 9c892b5537..1485eefa33 100644 --- a/mp/src/game/shared/momentum/mom_gamemovement.cpp +++ b/mp/src/game/shared/momentum/mom_gamemovement.cpp @@ -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); } @@ -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; diff --git a/mp/src/game/shared/movevars_shared.cpp b/mp/src/game/shared/movevars_shared.cpp index 309a8c07e9..e4a30ef359 100644 --- a/mp/src/game/shared/movevars_shared.cpp +++ b/mp/src/game/shared/movevars_shared.cpp @@ -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 From bd2b23b83310fd1e5ee9f96ba543f90390b7486a Mon Sep 17 00:00:00 2001 From: tuxxi Date: Sat, 19 Mar 2016 01:02:37 -0700 Subject: [PATCH 2/3] moved sv_maxspeed stuff to CTimer --- mp/src/game/server/momentum/Timer.cpp | 19 +++++++++++-------- mp/src/game/server/momentum/mom_player.cpp | 3 --- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mp/src/game/server/momentum/Timer.cpp b/mp/src/game/server/momentum/Timer.cpp index ba4cacae5c..e067b2e6ea 100644 --- a/mp/src/game/server/momentum/Timer.cpp +++ b/mp/src/game/server/momentum/Timer.cpp @@ -27,7 +27,7 @@ void CTimer::PostTime() //Build URL char webURL[512]; - Q_snprintf(webURL, 512, "http://b00926d9.ngrok.io/postscore/%llu/%s/%i/%s", steamID, map, + Q_snprintf(webURL, 512, "http://momentum-mod.org/postscore/%llu/%s/%i/%s", steamID, map, ticks, tickRate.sType); DevLog("Ticks sent to server: %i\n", ticks); @@ -252,31 +252,34 @@ 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 ::\nsv_maxvelocity: %i\nsv_airaccelerate: %i \nsv_maxspeed: %i", 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) diff --git a/mp/src/game/server/momentum/mom_player.cpp b/mp/src/game/server/momentum/mom_player.cpp index 508a23a073..a8acfb5b6f 100644 --- a/mp/src/game/server/momentum/mom_player.cpp +++ b/mp/src/game/server/momentum/mom_player.cpp @@ -43,7 +43,6 @@ void CMomentumPlayer::Spawn() AddFlag(FL_GODMODE); // do this here because we can't get a local player in the timer class ConVarRef gm("mom_gamemode"); - ConVarRef speed("sv_maxspeed"); switch (gm.GetInt()) { case MOMGM_BHOP: @@ -51,11 +50,9 @@ void CMomentumPlayer::Spawn() case MOMGM_UNKNOWN: default: EnableAutoBhop(); - speed.SetValue("260"); break; case MOMGM_SCROLL: DisableAutoBhop(); - speed.SetValue("250"); break; } SetThink(&CMomentumPlayer::CheckForBhop); // Pass a function pointer From 7e5262fcd5b2181b4d516b4b46ac7e9e4c8434d0 Mon Sep 17 00:00:00 2001 From: tuxxi Date: Wed, 23 Mar 2016 02:34:59 -0700 Subject: [PATCH 3/3] cleaned up DevLog in CTimer --- mp/src/game/server/momentum/Timer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mp/src/game/server/momentum/Timer.cpp b/mp/src/game/server/momentum/Timer.cpp index e067b2e6ea..db9b79aa42 100644 --- a/mp/src/game/server/momentum/Timer.cpp +++ b/mp/src/game/server/momentum/Timer.cpp @@ -279,7 +279,8 @@ void CTimer::SetGameModeConVars() DevWarning("[%i] GameMode not defined.\n", gm.GetInt()); break; } - DevMsg("CTimer set ::\nsv_maxvelocity: %i\nsv_airaccelerate: %i \nsv_maxspeed: %i", sv_maxvelocity.GetInt(), sv_airaccelerate.GetInt(), sv_maxspeed.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)