New CVars: sv_autobunnyhopping and sv_enablebunnyhopping (#686)

* Add bunnyhopping

* Add missing cvar register. Added cvars to readme and cfg

* API added

* Changed define
This commit is contained in:
Alejo 2021-10-20 13:18:30 -03:00 committed by GitHub
parent c6187f3dc7
commit b9cccc691b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 51 additions and 3 deletions

View File

@ -100,6 +100,8 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| mp_fadetoblack | 0 | 0 | 2 | Observer's screen will fade to black on kill event or permanent.<br/> `0` No fade.<br/>`1` Fade to black and won't be able to watch anybody.<br/>`2` fade to black only on kill moment. |
| mp_falldamage | 1 | 0 | 1 | Damage from falling.<br/>`0` disabled <br/>`1` enabled |
| sv_allchat | 1 | 0 | 1 | Players can receive all other players text chat, team restrictions apply<br/>`0` disabled <br/>`1` enabled |
| sv_autobunnyhopping | 0 | 0 | 1 | Players automatically re-jump while holding jump button.<br/>`0` disabled <br/>`1` enabled |
| sv_enablebunnyhopping | 0 | 0 | 1 | Allow player speed to exceed maximum running speed.<br/>`0` disabled <br/>`1` enabled |
</details>
## How to install zBot for CS 1.6?

14
dist/game.cfg vendored
View File

@ -462,3 +462,17 @@ mp_free_armor 0
//
// Default value: "0"
sv_allchat 0
// Players automatically re-jump while holding jump button.
// 0 - disabled (default behaviour)
// 1 - enabled
//
// Default value: "0"
sv_autobunnyhopping 0
// Allow player speed to exceed maximum running speed
// 0 - disabled (default behaviour)
// 1 - enabled
//
// Default value: "0"
sv_enablebunnyhopping 0

View File

@ -539,6 +539,8 @@ void CCSPlayer::Reset()
m_iWeaponInfiniteIds = 0;
m_bCanShootOverride = false;
m_bGameForcingRespawn = false;
m_bAutoBunnyHopping = false;
m_bMegaBunnyJumping = false;
}
void CCSPlayer::OnSpawn()

View File

@ -159,6 +159,8 @@ cvar_t t_default_weapons_secondary = { "mp_t_default_weapons_secondary", "
cvar_t t_default_weapons_primary = { "mp_t_default_weapons_primary", "", 0, 0.0f, nullptr };
cvar_t free_armor = { "mp_free_armor", "0", 0, 0.0f, nullptr };
cvar_t allchat = { "sv_allchat", "0", 0, 0.0f, nullptr };
cvar_t sv_autobunnyhopping = { "sv_autobunnyhopping", "0", 0, 0.0f, nullptr };
cvar_t sv_enablebunnyhopping = { "sv_enablebunnyhopping", "0", 0, 0.0f, nullptr };
void GameDLL_Version_f()
{
@ -387,6 +389,8 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&t_default_weapons_primary);
CVAR_REGISTER(&free_armor);
CVAR_REGISTER(&allchat);
CVAR_REGISTER(&sv_autobunnyhopping);
CVAR_REGISTER(&sv_enablebunnyhopping);
// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");

View File

@ -185,6 +185,8 @@ extern cvar_t t_default_weapons_secondary;
extern cvar_t t_default_weapons_primary;
extern cvar_t free_armor;
extern cvar_t allchat;
extern cvar_t sv_autobunnyhopping;
extern cvar_t sv_enablebunnyhopping;
#endif

View File

@ -2418,8 +2418,19 @@ void PM_Jump()
return;
}
#ifdef REGAMEDLL_API
const CCSPlayer* player = UTIL_PlayerByIndex(pmove->player_index + 1)->CSPlayer();
#endif
// don't pogo stick
if (pmove->oldbuttons & IN_JUMP)
if (pmove->oldbuttons & IN_JUMP
#ifdef REGAMEDLL_ADD
&& sv_autobunnyhopping.value <= 0.0
#ifdef REGAMEDLL_API
&& !player->m_bAutoBunnyHopping
#endif
#endif
)
{
return;
}
@ -2434,7 +2445,16 @@ void PM_Jump()
// In the air now.
pmove->onground = -1;
PM_PreventMegaBunnyJumping();
#ifdef REGAMEDLL_ADD
if (sv_enablebunnyhopping.value <= 0.0
#ifdef REGAMEDLL_API
&& !player->m_bMegaBunnyJumping
#endif
)
#endif
{
PM_PreventMegaBunnyJumping();
}
real_t fvel = Length(pmove->velocity);
float fvol = 1.0f;

View File

@ -46,7 +46,9 @@ public:
m_iWeaponInfiniteAmmo(0),
m_iWeaponInfiniteIds(0),
m_bCanShootOverride(false),
m_bGameForcingRespawn(false)
m_bGameForcingRespawn(false),
m_bAutoBunnyHopping(false),
m_bMegaBunnyJumping(false)
{
m_szModel[0] = '\0';
}
@ -125,6 +127,8 @@ public:
int m_iWeaponInfiniteIds;
bool m_bCanShootOverride;
bool m_bGameForcingRespawn;
bool m_bAutoBunnyHopping;
bool m_bMegaBunnyJumping;
};
// Inlines