From bed4180d03dd5c6541bc3fedf18c4962bbda0e7e Mon Sep 17 00:00:00 2001 From: Vaqtincha <51029683+Vaqtincha@users.noreply.github.com> Date: Wed, 18 Sep 2019 13:04:32 +0500 Subject: [PATCH] Add CVar mp_show_scenarioicon (#416) * Add CVar mp_show_scenarioicon (Condition-Zero style scenario icon near round timer) --- README.md | 1 + dist/game.cfg | 7 +++++++ regamedll/dlls/game.cpp | 7 +++++++ regamedll/dlls/game.h | 1 + regamedll/dlls/ggrenade.cpp | 8 +++++++- regamedll/dlls/player.cpp | 8 +++++++- 6 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 222b7453..8db6dad2 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure' | mp_forcerespawn | 0 | 0 | - | Players will automatically respawn when killed.
`0` disabled
`>0.00001` time delay to respawn | | mp_hostage_hurtable | 1 | 0 | 1 | The hostages can take damage.
`0` disabled
`1` from any team
`2` only from `CT`
`3` only from `T` | | mp_show_radioicon | 1 | 0 | 1 | Show radio icon.
`0` disabled
`1` enabled | +| mp_show_scenarioicon | 0 | 0 | 1 | Show scenario icon in HUD such as count of alive hostages or ticking bomb.
`0` disabled
`1` enabled | | mp_old_bomb_defused_sound | 1 | 0 | 1 | Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused
`0` disabled
`1` enabled | | showtriggers | 0 | 0 | 1 | Debug cvar shows triggers. | | sv_alltalk | 0 | 0 | 4 | When players can hear each other ([further explanation](../../wiki/sv_alltalk)).
`0` dead don't hear alive
`1` no restrictions
`2` teammates hear each other
`3` Same as 2, but spectators hear everybody
`4` alive hear alive, dead hear dead and alive. diff --git a/dist/game.cfg b/dist/game.cfg index 6f80f830..18599ae7 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -158,6 +158,13 @@ mp_hostage_hurtable 1 // Default value: "1" mp_show_radioicon 1 +// Show scenario icon in HUD such as count of alive hostages or ticking bomb. +// 0 - disabled (default behavior) +// 1 - enabled +// +// Default value: "0" +mp_show_scenarioicon 0 + // Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused // 0 - disabled (default behavior) // 1 - enabled diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index ed4a94fc..5b06ebbe 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -115,6 +115,7 @@ cvar_t hostagehurtable = { "mp_hostage_hurtable", "1", FCVAR_SERVER, 1 cvar_t roundover = { "mp_roundover", "0", FCVAR_SERVER, 0.0f, nullptr }; cvar_t forcerespawn = { "mp_forcerespawn", "0", FCVAR_SERVER, 0.0f, nullptr }; cvar_t show_radioicon = { "mp_show_radioicon", "1", 0, 1.0f, nullptr }; +cvar_t show_scenarioicon = { "mp_show_scenarioicon", "0", FCVAR_SERVER, 0.0f, nullptr }; cvar_t old_bomb_defused_sound = { "mp_old_bomb_defused_sound", "1", 0, 1.0f, nullptr }; cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr }; cvar_t legacy_bombtarget_touch = { "mp_legacy_bombtarget_touch", "1", 0, 1.0f, nullptr }; @@ -317,6 +318,12 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&roundover); CVAR_REGISTER(&forcerespawn); CVAR_REGISTER(&show_radioicon); + + if (!AreRunningCZero()) + { + CVAR_REGISTER(&show_scenarioicon); + } + CVAR_REGISTER(&old_bomb_defused_sound); CVAR_REGISTER(&item_staytime); CVAR_REGISTER(&legacy_bombtarget_touch); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index 381376b6..e03f3b08 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -152,6 +152,7 @@ extern cvar_t hostagehurtable; extern cvar_t roundover; extern cvar_t forcerespawn; extern cvar_t show_radioicon; +extern cvar_t show_scenarioicon; extern cvar_t old_bomb_defused_sound; extern cvar_t item_staytime; extern cvar_t legacy_bombtarget_touch; diff --git a/regamedll/dlls/ggrenade.cpp b/regamedll/dlls/ggrenade.cpp index 188c1a5c..85bb14fb 100644 --- a/regamedll/dlls/ggrenade.cpp +++ b/regamedll/dlls/ggrenade.cpp @@ -1270,8 +1270,14 @@ CGrenade *CGrenade::__API_HOOK(ShootSmokeGrenade)(entvars_t *pevOwner, VectorRef void AnnounceFlashInterval(float interval, float offset) { - if (!AreRunningCZero()) + if (!AreRunningCZero() +#ifdef REGAMEDLL_ADD + && !show_scenarioicon.value +#endif + ) + { return; + } MESSAGE_BEGIN(MSG_ALL, gmsgScenarioIcon); WRITE_BYTE(1); diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 315c7b13..192852ab 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -6724,8 +6724,14 @@ void CBasePlayer::SendHostagePos() void CBasePlayer::SendHostageIcons() { - if (!AreRunningCZero()) + if (!AreRunningCZero() +#ifdef REGAMEDLL_ADD + && !show_scenarioicon.value +#endif + ) + { return; + } int hostagesCount = 0; CBaseEntity *pHostage = nullptr;