From 6c80744146fb583d066be0a2977225da29e575fe Mon Sep 17 00:00:00 2001 From: Vaqtincha <51029683+Vaqtincha@users.noreply.github.com> Date: Wed, 27 May 2020 06:26:45 +0500 Subject: [PATCH] Add new CVar mp_falldamage (#539) * Add CVar mp_falldamage --- README.md | 1 + dist/game.cfg | 8 ++++++++ regamedll/dlls/game.cpp | 5 ++++- regamedll/dlls/game.h | 1 + regamedll/dlls/multiplay_gamerules.cpp | 8 ++++++++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c9a0397..a49de0fb 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure' | mp_give_player_c4 | 1 | 0 | 1 | Whether this map should spawn a C4 bomb for a player or not.
`0` disabled
`1` enabled | | mp_weapons_allow_map_placed | 1 | 0 | 1 | When set, map weapons (located on the floor by map) will be shown.
`0` hide all map weapons.
`1` enabled
`NOTE`: Effect will work after round restart. | | mp_fadetoblack | 0 | 0 | 2 | Observer's screen will fade to black on kill event or permanent.
`0` No fade.
`1` Fade to black and won't be able to watch anybody.
`2` fade to black only on kill moment. | +| mp_falldamage | 1 | 0 | 1 | Damage from falling.
`0` disabled
`1` enabled | ## How to install zBot for CS 1.6? diff --git a/dist/game.cfg b/dist/game.cfg index 7199c757..544693a6 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -382,3 +382,11 @@ mp_weapons_allow_map_placed 1 // // Default value: "0" mp_fadetoblack 0 + +// Damage from falling. +// 0 - disabled +// 1 - enabled (default behaviour) +// +// Default value: "1" +mp_falldamage 1 + diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index e958ff14..f9d62d6b 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -147,6 +147,8 @@ cvar_t ff_damage_reduction_other = { "ff_damage_reduction_other", cvar_t radio_timeout = { "mp_radio_timeout", "1.5", FCVAR_SERVER, 1.5f, nullptr }; cvar_t radio_maxinround = { "mp_radio_maxinround", "60", FCVAR_SERVER, 60.0f, nullptr }; +cvar_t falldamage = { "mp_falldamage", "1", FCVAR_SERVER, 1.0f, nullptr }; + void GameDLL_Version_f() { @@ -359,7 +361,8 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&radio_timeout); CVAR_REGISTER(&radio_maxinround); - + CVAR_REGISTER(&falldamage); + // print version CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n"); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index f2be670d..6884a41c 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -173,6 +173,7 @@ extern cvar_t ff_damage_reduction_grenade_self; extern cvar_t ff_damage_reduction_other; extern cvar_t radio_timeout; extern cvar_t radio_maxinround; +extern cvar_t falldamage; #endif diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 1adf6246..460f5d24 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -3586,6 +3586,14 @@ LINK_HOOK_CLASS_CUSTOM_CHAIN(float, CHalfLifeMultiplay, CSGameRules, FlPlayerFal float EXT_FUNC CHalfLifeMultiplay::__API_HOOK(FlPlayerFallDamage)(CBasePlayer *pPlayer) { + +#ifdef REGAMEDLL_ADD + if (!falldamage.value) + { + return 0.0f; + } +#endif + pPlayer->m_flFallVelocity -= MAX_PLAYER_SAFE_FALL_SPEED; return pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED * 1.25; }