From 8d9244b89268e2a5301f0a6b3523e17b68f52cbd Mon Sep 17 00:00:00 2001 From: Vaqtincha Date: Mon, 28 Oct 2024 11:06:25 +0500 Subject: [PATCH] Add new CVar mp_jump_height Code style fix --- README.md | 1 + dist/game.cfg | 5 +++++ regamedll/dlls/game.cpp | 2 ++ regamedll/dlls/game.h | 1 + regamedll/dlls/player.cpp | 4 ++-- regamedll/pm_shared/pm_shared.cpp | 4 ++-- 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3d1201bf7..4148e2b8f 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab | mp_ammo_respawn_time | 20 | 0.0 | - | The respawn time for ammunition. | | mp_vote_flags | km | 0 | - | Vote systems enabled in server.
`0` voting disabled
`k` votekick enabled via `vote` command
`m` votemap enabled via `votemap` command | | mp_votemap_min_time | 180 | 0.0 | - | Minimum seconds that must elapse on map before `votemap` command can be used. | +| mp_jump_height | 45 | 0.0 | - | Player jump height. | diff --git a/dist/game.cfg b/dist/game.cfg index c5dad01c9..551d3d183 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -620,3 +620,8 @@ mp_vote_flags "km" // // Default value: "180" mp_votemap_min_time "180" + +// Player jump height +// +// Default value: "48" +mp_jump_height "48" diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index 789435938..8809584c0 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -171,6 +171,7 @@ cvar_t deathmsg_flags = { "mp_deathmsg_flags", "abc", 0, 0.0f cvar_t assist_damage_threshold = { "mp_assist_damage_threshold", "40", 0, 40.0f, nullptr }; cvar_t freezetime_duck = { "mp_freezetime_duck", "1", 0, 1.0f, nullptr }; cvar_t freezetime_jump = { "mp_freezetime_jump", "1", 0, 1.0f, nullptr }; +cvar_t jump_height = { "mp_jump_height", "45", FCVAR_SERVER, 45.0f, nullptr }; cvar_t hostages_rescued_ratio = { "mp_hostages_rescued_ratio", "1.0", 0, 1.0f, nullptr }; @@ -449,6 +450,7 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&freezetime_duck); CVAR_REGISTER(&freezetime_jump); + CVAR_REGISTER(&jump_height); CVAR_REGISTER(&defuser_allocation); CVAR_REGISTER(&location_area_info); CVAR_REGISTER(&chat_loc_fallback); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index 09da5305a..baea7498a 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -200,6 +200,7 @@ extern cvar_t deathmsg_flags; extern cvar_t assist_damage_threshold; extern cvar_t freezetime_duck; extern cvar_t freezetime_jump; +extern cvar_t jump_height; extern cvar_t defuser_allocation; extern cvar_t location_area_info; extern cvar_t chat_loc_fallback; diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 9782921c1..80d1941db 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -1487,7 +1487,7 @@ void CBasePlayer::PackDeadPlayerItems() { DropShield(); #ifdef REGAMEDLL_ADD - if(iPackGun != GR_PLR_DROP_GUN_ALL) + if (iPackGun != GR_PLR_DROP_GUN_ALL) #endif { bSkipPrimSec = true; @@ -2186,7 +2186,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib) { CBasePlayer *pAttacker = CBasePlayer::Instance(pevAttacker); - if(pAttacker /*safety*/ && !pAttacker->IsBot() && pAttacker->m_iTeam != m_iTeam) + if (pAttacker /*safety*/ && !pAttacker->IsBot() && pAttacker->m_iTeam != m_iTeam) { if (pAttacker->HasShield()) killerHasShield = true; diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index e9efb3763..980ccf705 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -2429,13 +2429,13 @@ inline real_t PM_JumpHeight(bool longjump) #ifdef REGAMEDLL_API if (longjump) { - if(pmoveplayer->m_flLongJumpHeight > 0.0) + if (pmoveplayer->m_flLongJumpHeight > 0.0) return pmoveplayer->m_flLongJumpHeight; } else if (pmoveplayer->m_flJumpHeight > 0.0) return pmoveplayer->m_flJumpHeight; #endif - return Q_sqrt(2.0 * 800.0f * (longjump ? 56.0f : 45.0f)); + return Q_sqrt(2.0 * 800.0f * (longjump ? 56.0f : Q_max(jump_height.value, 0.0f))); } LINK_HOOK_VOID_CHAIN2(PM_Jump)