Add cvar sv_allowbunnyhopping to control whether the bunny hopping limiter is enabled
This commit is contained in:
parent
68bb362ffb
commit
a1cf2d38bb
6 changed files with 38 additions and 0 deletions
|
@ -9,6 +9,10 @@
|
|||
* Fixed hand grenade animations not playing correctly [#209](https://github.com/SamVanheer/halflife-updated/pull/209) (Thanks Toodles2You)
|
||||
* Fixed out of bounds access in studiomodel renderer bone setup code (halflife issue [#3360](https://github.com/ValveSoftware/halflife/issues/3360))
|
||||
|
||||
### Features
|
||||
|
||||
* Added cvar `sv_allowbunnyhopping` to control whether the bunny hopping limiter is enabled (halflife issue [#11](https://github.com/ValveSoftware/halflife/issues/11))
|
||||
|
||||
## Changes in V1.0.0 Release Candidate 001
|
||||
|
||||
### Bug fixes
|
||||
|
|
|
@ -773,6 +773,7 @@ void ParmsChangeLevel()
|
|||
pSaveData->connectionCount = BuildChangeList(pSaveData->levelList, MAX_LEVEL_CONNECTIONS);
|
||||
}
|
||||
|
||||
static bool g_LastAllowBunnyHoppingState = false;
|
||||
|
||||
//
|
||||
// GLOBALS ASSUMED SET: g_ulFrameCount
|
||||
|
@ -787,6 +788,25 @@ void StartFrame()
|
|||
|
||||
gpGlobals->teamplay = teamplay.value;
|
||||
g_ulFrameCount++;
|
||||
|
||||
const bool allowBunnyHopping = sv_allowbunnyhopping.value != 0;
|
||||
|
||||
if (allowBunnyHopping != g_LastAllowBunnyHoppingState)
|
||||
{
|
||||
g_LastAllowBunnyHoppingState = allowBunnyHopping;
|
||||
|
||||
for (int i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
{
|
||||
auto player = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
g_engfuncs.pfnSetPhysicsKeyValue(player->edict(), "bj", UTIL_dtos1(allowBunnyHopping ? 1 : 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ cvar_t allow_spectators = {"allow_spectators", "0.0", FCVAR_SERVER}; // 0 preven
|
|||
|
||||
cvar_t mp_chattime = {"mp_chattime", "10", FCVAR_SERVER};
|
||||
|
||||
cvar_t sv_allowbunnyhopping = {"sv_allowbunnyhopping", "0", FCVAR_SERVER};
|
||||
|
||||
//CVARS FOR SKILL LEVEL SETTINGS
|
||||
// Agrunt
|
||||
cvar_t sk_agrunt_health1 = {"sk_agrunt_health1", "0"};
|
||||
|
@ -493,6 +495,8 @@ void GameDLLInit()
|
|||
|
||||
CVAR_REGISTER(&mp_chattime);
|
||||
|
||||
CVAR_REGISTER(&sv_allowbunnyhopping);
|
||||
|
||||
// REGISTER CVARS FOR SKILL LEVEL STUFF
|
||||
// Agrunt
|
||||
CVAR_REGISTER(&sk_agrunt_health1); // {"sk_agrunt_health1","0"};
|
||||
|
|
|
@ -41,6 +41,8 @@ extern cvar_t allowmonsters;
|
|||
extern cvar_t allow_spectators;
|
||||
extern cvar_t mp_chattime;
|
||||
|
||||
extern cvar_t sv_allowbunnyhopping;
|
||||
|
||||
// Engine Cvars
|
||||
inline cvar_t* g_psv_gravity;
|
||||
inline cvar_t* g_psv_aim;
|
||||
|
|
|
@ -2806,6 +2806,7 @@ void CBasePlayer::Spawn()
|
|||
|
||||
g_engfuncs.pfnSetPhysicsKeyValue(edict(), "slj", "0");
|
||||
g_engfuncs.pfnSetPhysicsKeyValue(edict(), "hl", "1");
|
||||
g_engfuncs.pfnSetPhysicsKeyValue(edict(), "bj", UTIL_dtos1(sv_allowbunnyhopping.value != 0 ? 1 : 0));
|
||||
|
||||
m_iFOV = 0; // init field of view.
|
||||
m_iClientFOV = -1; // make sure fov reset is sent
|
||||
|
|
|
@ -2525,6 +2525,13 @@ void PM_NoClip()
|
|||
//-----------------------------------------------------------------------------
|
||||
void PM_PreventMegaBunnyJumping()
|
||||
{
|
||||
const bool allowBunnyHopping = atoi(pmove->PM_Info_ValueForKey(pmove->physinfo, "bj")) == 1;
|
||||
|
||||
if (allowBunnyHopping)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Current player speed
|
||||
float spd;
|
||||
// If we have to crop, apply this cropping fraction to velocity
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue